





    function enableStyleSheet(name, on) {
    for (var i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel") &&
            a.getAttribute("rel").indexOf("style") != -1 &&
            a.getAttribute("title")) {
            if (a.getAttribute("title") == name) {
                a.disabled = !on;
                createCookie(name, on, 365);
            }
        }
    }
}

function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}


enableStyleSheet("loRes", readCookie("loRes") != null && readCookie("loRes") == 'true');

function showHideBlock(blockId) {
    if (document.getElementById(blockId).className == 'none') {
        if (blockId == 'nav-expand') {
            document.getElementById(blockId).className = 'block clearfix';
            document.getElementById('selectImage').className = 'select open';
        } else {
            document.getElementById(blockId).className = 'block';
        }
    } else {
        document.getElementById(blockId).className = 'none';
        if (blockId == 'nav-expand') {
            document.getElementById('selectImage').className = 'select closed';
        }
    }
}

function showLayer(id) {
    document.getElementById(id).style.display = "block";
}

function hideLayer(id) {
    document.getElementById(id).style.display = "none";
}

function jumpTo(id) {
    var theElement = document.getElementById(id);
    var selectedPosX = 0;
    var selectedPosY = 0;
    while (theElement != null) {
        selectedPosX += theElement.offsetLeft;
        selectedPosY += theElement.offsetTop;
        theElement = theElement.offsetParent;
    }
    window.scrollTo(selectedPosX, selectedPosY);
}


function getIePosition() {
    document.getElementById('jumpto').style.top = 200 + document.body.scrollTop + "px";
}

function goToCountryPage() {
    document.getElementById('changeCountry').action = document.getElementById('changeCountry').action + document.getElementById('world').value;
}

function validateCommentFields() {
    if (document.getElementById('Comments.text').value != '' && document.getElementById('name').value != ''){
        Comments.post();
    } else {
        if (document.getElementById('errorMsg').className == 'none red') {
            document.getElementById('errorMsg').className = 'block red';
        }
    }
}
    /**
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){
_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}
return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}return true;};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(q){
var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){
return q.substring(q.indexOf("=",_2d)+1,_2e);
}}return "";}};
if(Array.prototype.push==null){
Array.prototype.push=function(_2f){
this[this.length]=_2f;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for backwards compatibility
var SWFObject=deconcept.SWFObject;


    HttpCall = {};
HttpCall.http = false;
if (navigator.appName == "Microsoft Internet Explorer") {
    HttpCall.http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
    HttpCall.http = new XMLHttpRequest();
}

HttpCall.animation = "HttpCallAnimation";

/**
 Just supply a url and an elementId and it set the inner html of the element to be the result of the call to the url
 **/
HttpCall.replaceElement = function(urlOrForm, elmId) {
    HttpCall.call(urlOrForm, function() {
        document.getElementById(elmId).innerHTML = HttpCall.http.responseText;
    });
}

HttpCall.buildURL = function(form) {
    var url = form.action + "?";
    var allElms = form.elements;
    var elm;
    for (var i = 0; i < allElms.length; i++) {
        elm = allElms[i];
        if (elm.name == '' || elm.tagName == 'FIELDSET') {
            continue;
        }
        if (elm.type.toLowerCase() == 'checkbox' && !elm.checked) {
            continue;
        }
        url += elm.name + '=' + elm.value + '&';
    }
    return url;
}

HttpCall.call = function(urlOrForm, onready) {
    if (document.getElementById(HttpCall.animation)) {
        document.getElementById(HttpCall.animation).style.display = 'block';
    }
    var url = (typeof urlOrForm == 'string') ? urlOrForm : HttpCall.buildURL(urlOrForm);
    HttpCall.http.open("GET", url + "&rnd=" + (new Date()).getTime(), true);
    if (onready) {
        HttpCall.http.onreadystatechange = function() {
            if (HttpCall.http.readyState == 4) {
                onready();
                if (document.getElementById(HttpCall.animation)) {
                    document.getElementById(HttpCall.animation).style.display = 'none';
                }
            }
        }
    }

    HttpCall.http.send(null);
}
    Fade = {};

browserName = navigator.appName;
isIE = function() {
    if (browserName == "Microsoft Internet Explorer") {
        return true;
    }
    return false;
}

Fade.max = (isIE()) ? 100 : 1.00;
Fade.inc = (isIE()) ? 5 : 0.10;
Fade.time = 100;
Fade.id = null;
Fade.fadeOutHandler = null;
Fade.fadeInHandler = null;

Fade.fadeOut = function(id) {
    clearTimeout(Fade.id);
    var elm = document.getElementById(id);
    var opac;
    if (isIE()) {
        if (!elm.filters[0]) {
            return;
        }
        opac = elm.filters[0].opacity;
    } else {
        if(elm.style.MozOpacity){
            opac = elm.style.MozOpacity != '' ? parseFloat(elm.style.MozOpacity) : 0.8;
        }else{
            opac = elm.style.opacity != '' ? parseFloat(elm.style.opacity) : 0.8;
        }
    }

    if (opac > 0) {
        if (isIE()){
            elm.filters[0].opacity = opac - Fade.inc;
            }
        else {
            var value = parseFloat(opac) - Fade.inc;
            elm.style.MozOpacity = value;
            elm.style.opacity = value;
        }
        Fade.id = setTimeout("Fade.fadeOut('" + id + "')", 40);
    } else {
        if(Fade.fadeOutHandler != null){
            Fade.fadeOutHandler();
            Fade.fadeOutHandler = null;
        }
        if (elm.fadeLocation)
            window.location = elm.fadeLocation;
    }
}

Fade.fadeIn = function(id) {
    var done = false;
    clearTimeout(Fade.id);
    var elm = document.getElementById(id);
    if (isIE()) {
        if (!elm.filters[0]) {
            return;
        }
        opac = elm.filters[0].opacity;
    } else {
        if(elm.style.MozOpacity){
            opac = (elm.style.MozOpacity != '' && elm.style.MozOpacity != 0) ? parseFloat(elm.style.MozOpacity): 0;
        } else{
            opac = (elm.style.opacity != '' && elm.style.opacity != 0)? parseFloat(elm.style.opacity): 0;
        }
    }

    if (opac < Fade.max) {
        if (isIE()) {
            elm.filters[0].opacity = opac + Fade.inc;
        }
        else {
            var value = parseFloat(opac) + Fade.inc;
            elm.style.MozOpacity = value;

            elm.style.opacity = value;
        }

        Fade.id = setTimeout("Fade.fadeIn('" + id + "')", Fade.time);
    } else {
        if (elm.nextFadeId)
            setTimeout("Fade.fadeIn('" + elm.nextFadeId + "')", Fade.time);
        if(Fade.fateOutHandler != null){
            Fade.fateOutHandler();
            Fade.fateOutHandler = null;
        }
    }
}

Fade.reset = function(id) {
    var elm = document.getElementById(id);
    if (isIE()) {
        if (!elm.filters[0]) {
            return;
        }
        elm.filters[0].opacity = 0;
    }
    else {
        elm.style.MozOpacity = 0;
    }
}

    //depends on fade.js

SlideShow = {};
SlideShow.fade = true;
SlideShow.speed = 7000;
SlideShow.id = "mainpic";
SlideShow.linkId = "mainpiclink";
SlideShow.domain = "http://staging.solidstategroup.com/";
SlideShow.images = [];
SlideShow.altText = [];
SlideShow.links = [];
SlideShow.currentPhoto = 1;
SlideShow.timer = null;
SlideShow.stopped = true;
SlideShow.startButtonId = "startButton";
SlideShow.stopButtonId = "stopButton";

SlideShow.addImage = function(imgsrc) {
    SlideShow.images[SlideShow.images.length] = imgsrc;
}

SlideShow.addAltText = function(alternativeText) {
    SlideShow.altText[SlideShow.altText.length] = alternativeText;
}

SlideShow.addLink = function(linkurl) {
    SlideShow.links[SlideShow.links.length] = linkurl;
}

SlideShow.changeImage = function() {
    if (SlideShow.currentPhoto >= SlideShow.images.length) {
        SlideShow.currentPhoto = 0;
    }
    var imgsrc = SlideShow.images[SlideShow.currentPhoto++];
    var alternativeText = SlideShow.altText[SlideShow.currentPhoto];
    if (SlideShow.fade) {
        var videosrc = SlideShow.links[SlideShow.currentPhoto - 1];
        SlideShow.fadeImg(imgsrc, videosrc,alternativeText);
    } else {
        document.getElementById(SlideShow.id).src = imgsrc;
    }
}

SlideShow.fadeImg = function (imgSrc, videosrc, alternativeText) {
    Fade.fadeOutHandler = function() {
        document.getElementById(SlideShow.id).src = imgSrc;
        document.getElementById(SlideShow.id).alt = alternativeText;
        if (document.getElementById(SlideShow.linkId)) {
            document.getElementById('mainpiclink').setAttribute("onclick",'window.open(\'' + videosrc + '\' ,\'null\',\'width=640,height=480,resizable=yes\')');
        }
        setTimeout("Fade.fadeIn('" + SlideShow.id + "')", 200);
    }
    Fade.fadeOut(SlideShow.id);
}

SlideShow.start = function() {
    if (SlideShow.stopped) {
        SlideShow.timer = setInterval(SlideShow.changeImage, SlideShow.speed);
        if (document.getElementById(SlideShow.startButtonId) != null) {
            document.getElementById(SlideShow.startButtonId).style.display = 'none';
            document.getElementById(SlideShow.stopButtonId).style.display = 'block';
        }
        SlideShow.stopped = false;
    }
}

SlideShow.stopSlideShow = function() {
    clearInterval(SlideShow.timer);
    if (document.getElementById(SlideShow.startButtonId) != null) {
        document.getElementById(SlideShow.startButtonId).style.display = 'block';
        document.getElementById(SlideShow.stopButtonId).style.display = 'none';
    }
    SlideShow.stopped = true;
}
    Comments = {};
Comments.displayElement = 'Comments.displayComments';
Comments.displayPost = 'Comments.displayPost';
Comments.rootArticleId = 'Comments.rootArticleId';
Comments.text = 'Comments.text';
Comments.showhideOnCompose = false;//normally something else shows and hides the element
Comments.showhideOnPost = true;
Comments.refreshOnPost = false;
Comments.hideOnCloseHandler = null; // set this to a function if you want somethign custom to fire
Comments.successMessage = 'Comments.successMessage';
Comments.postShowing = false;

Comments.form = 'Comments.form';
Comments.ajax = false;

Comments.refresh = function() {
    HttpCall.replaceElement('include/comments.jsp?rootArticleId=' + document.getElementById(Comments.rootArticleId).value, Comments.displayElement);

}

Comments.posted = function() {
    if (Comments.refreshOnPost) {
        Comments.refresh();
    }
    if (Comments.showhideOnPost) {
        document.getElementById(Comments.displayPost).className = "none";
        Comments.postShowing = false;
    }
    if (document.getElementById(Comments.successMessage)) {
        document.getElementById(Comments.successMessage).className = "block";
    }
    if (Comments.hideOnCloseHandler) {
        Comments.hideOnCloseHandler();
    }
}

Comments.composePost = function() {
    //clear the text
    if (Comments.showhideOnCompose) {
        if (!Comments.postShowing) {
            document.getElementById(Comments.displayPost).className = "block";
        } else {
            document.getElementById(Comments.displayPost).className = "none";
        }
        Comments.postShowing = !Comments.postShowing;
    }
    if (document.getElementById(Comments.text)) {
        document.getElementById(Comments.text).value = "";
    }
}

Comments.post = function() {
    if (Comments.ajax) {
        HttpCall.call(document.getElementById(Comments.form), Comments.posted);
    } else {
        //just submit the form
        document.getElementById(Comments.form).submit();
    }
}   
