if (getCookie() == '') { 
    document.cookie = "style=1";
    setActiveStyleSheet(1);
} 
else {
    setActiveStyleSheet(getCookie());
}            
   
            function getCookie()
            {
                var arrCookie = document.cookie.split("; ");
                var valCookie = '';
              
                for (var i=0; i < arrCookie.length; i++)
                {
                   var arrCrumb = arrCookie[i].split("=");
                   if (arrCrumb[0] == "style") 
                       valCookie = arrCrumb[1];
                }
   
                if (arrCookie.length == 0) {
                    return '';
                } else {
                    return valCookie;
                }
           }
   
           function setActiveStyleSheet(num) 
           {
               var i, a, main;
            
               for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
                   if(a.getAttribute("rel").indexOf("style") != -1  && a.getAttribute("title")) {
                       a.disabled = true;
                       if(a.getAttribute("title") == "size" + num) {
                           a.disabled = false;
                       }
                   }
               }
           }
            
           function increaseSize() {
               var valCookie = parseInt(getCookie());
               if (valCookie < 2) {
                   valCookie = valCookie + 1;
                   document.cookie = "style=" + valCookie;
               }
               setActiveStyleSheet(valCookie);
           } 
        
           function decreaseSize() {
               var valCookie = parseInt(getCookie());
               if (valCookie > 0) {
                   valCookie = valCookie - 1;
                   document.cookie = "style=" + valCookie;
               }
               setActiveStyleSheet(valCookie);
           }

            var numTotalIntruders = 0;
            function setIntruder(numIntruders, elementName, alternateStyle) {
                numIntruders--;
                var agt=navigator.userAgent.toLowerCase();
                var is_ie = (agt.indexOf("msie") != -1)
                var is_mac = (agt.indexOf("mac")!=-1);
                if (is_ie && is_mac) {
                }
                else {
                    var intRandom;
                    intRandom = (Math.round(Math.random() * (numIntruders)));
                    visibleIntruder=elementName+intRandom; 
                    if (document.all) {
                     document.all(elementName + '0').style.display = "none";
                        document.all(elementName + intRandom).style.display = "";
                    }
                    else if (document.getElementById) {
                     document.getElementById(elementName + '0').style.display = "none";
                        document.getElementById(elementName + intRandom).style.display = "";
                    }
                    
                    if (alternateStyle == 1) {
                     if (numTotalIntruders % 2 == 0) {
                         if (document.all) {
                               document.all(elementName + intRandom).className = "intruderEven";
                              } 
                              else if (document.getElementById) {
                                 document.getElementById(elementName + intRandom).className = "intruderEven";
                             }
                        }
                 }
                    numTotalIntruders = numTotalIntruders + 1;
                }
            }

            function chooseDestination(){
                if (document.gateway.ddGateway.selectedIndex > 0) {
                    var URL = document.gateway.ddGateway.options[document.gateway.ddGateway.selectedIndex].value;
                    window.location.href = URL;
                }
            }

function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

function swapIntruder(layerName){
    if (!document.getElementsByTagName){ return; }
    divLayers = document.getElementsByTagName("div");
    pictureLayers=0;    
    for (i=0; i<divLayers.length; i++){
        divLayer = divLayers[i];
        if ((divLayer.className == layerName)){
            pictureLayers++;
        }
    }    
    ranNumber=(Math.floor(Math.random()*pictureLayers));
    pictureLayers2=0;
    for (i=0; i<divLayers.length; i++){
        divLayer = divLayers[i];
        if ((divLayer.className == layerName)){
            if (pictureLayers2==ranNumber){
                divLayer.style.display="inline";
            }
            pictureLayers2++;
        }
    }
}