<!--
// © 2005 City of Las Vegas | All Rights Reserved | Use only with permission //
// All Contents of this Website are the property of the City of Las Vegas //
// Dynamically Change the Stylesheet



var ROOT = "";

var allcookies = document.cookie;

var font_types = ["small","medium","large"];
if(document.images) {
 btnFont01_on = new Image(14,14);
 btnFont01_off = new Image(14,14);
 btnFont02_on = new Image(16,16);
 btnFont02_off = new Image(16,16); 
 btnFont03_on = new Image(18,18);
 btnFont03_off = new Image(18, 18);
}
if(document.images) {
 btnFont01_on.src = "/Resources/Images/btnFont01_on.png";
 btnFont01_off.src = "/Resources/Images/btnFont01_off.png";
 btnFont02_on.src = "/Resources/Images/btnFont02_on.png";
 btnFont02_off.src = "/Resources/Images/btnFont02_off.png";
 btnFont03_on.src = "/Resources/Images/btnFont03_on.png";
 btnFont03_off.src = "/Resources/Images/btnFont03_off.png";
 
}



function set_css() {
 // set style sheet based on user selection stored in "css" cookie
 var pos = allcookies.indexOf("css=");
 if (pos != -1) {
  var start = pos + 4;
  var end = allcookies.indexOf(";", start);
  if (end == -1) 
   end = allcookies.length;
  var value = allcookies.substring(start,end);
  value = unescape(value);
  for( var i=1;i<=3;i++) {
   if (value == font_types[i-1]) {
    var imgLocation = "btnFont0" + i;
    var imgName = imgLocation + "_on";
    swapit(imgLocation,imgName);
    setStyleSheet(font_types[i-1]);
   }
  }
 } else {
  var imgLocation = "btnFont01";
  var imgName = imgLocation + "_on";
  swapit(imgLocation,imgName);
  setStyleSheet(font_types[0]);
  var nextyear = new Date();
  nextyear.setFullYear(nextyear.getFullYear() + 1);
  document.cookie = "css=" + font_types[0] + "; expires=" + nextyear.toGMTString() + "; path=/";    
 }
}

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements);
}

function PNGFIX()
{
    var arVersion = navigator.appVersion.split("MSIE");
    var version = parseFloat(arVersion[1]);


    if (version >= 5.5)  
    {
       for(var i=0; i<document.images.length; i++)
       {
          var img = document.images[i];
          var imgName = img.src;
          if (imgName.substring(imgName.length-3, imgName.length) == "png")
          {
			if (imgName.substring(imgName.lastIndexOf('/')+1,imgName.lastIndexOf('/')+8) != "btnFont"){
				img.style.behavior = "url('/pngbehavior.htc')";
            }
          }
       }
       
       var arrClassElements = getElementsByClassName(document, "*", "Trans");
       arrClassElements[0].style.behavior = "url('/pngbehavior.htc')";
    }
}



function set_css_only() {
 // set style sheet based on user selection stored in "css" cookie
 var pos = allcookies.indexOf("css=");
 if (pos != -1) {
  var start = pos + 4;
  var end = allcookies.indexOf(";", start);
  if (end == -1) 
   end = allcookies.length;
  var value = allcookies.substring(start,end);
  value = unescape(value);
  for( var i=1;i<=3;i++) {
   if (value == font_types[i-1]) {
    setStyleSheet(font_types[i-1]);
   }
  }
 }
}

function swapit(imgLocation, imgName) {
 if(document.images) {
  document.images[imgLocation].src = eval(imgName + ".src");

 }
}

function swapit2(imgLocation) {

 var newImgLocation = "";
 if(document.images) {

  var imgName = document.images[imgLocation].src;
  
  imgName = imgName.substr(imgName.lastIndexOf('/')+1);    
  for(var i=1; i<=3; i++) {
   var newImgName = imgName.substr(0,imgName.lastIndexOf('_')-1) + i; 
   if(imgLocation.substring(imgLocation.length-1) == i){
    newImgName += "_on";
    document.images[imgLocation].src = eval(newImgName + ".src");
    var nextyear = new Date();
    nextyear.setFullYear(nextyear.getFullYear() + 1);
    document.cookie = "css=" + font_types[i-1] + "; expires=" + nextyear.toGMTString() + "; path=/";
    setStyleSheet(font_types[i-1]);
   }
   else {
    newImgLocation = imgLocation.substring(0,imgLocation.length-1) + i;
    newImgName += "_off";

    document.images[newImgLocation].src = eval(newImgName + ".src");

   }
  } 
 }
}

// function for changing stylesheets using document.styleSheets
// function for changing stylesheets using document.styleSheets
function getAllSheets() {
                if( document.getElementsByTagName ) {
                                //DOM browsers - get link and style tags
                                var Lt = document.getElementsByTagName('link');
                var St = document.getElementsByTagName('style');
                } else if( document.styleSheets && document.all ) {
                                //not all browsers that supply document.all supply document.all.tags but those that do and can switch stylesheets will also provide
                                //document.styleSheets (checking for document.all.tags produces errors in IE [WHY?!], even though it does actually support it)
                                var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
                } else { return []; } //lesser browser - return a blank array
                //for all link tags ...
                for( var x = 0, os = []; Lt[x]; x++ ) {
                //check for the rel attribute to see if it contains 'style'
                if( Lt[x].rel ) { var rel = Lt[x].rel;
    } else if( Lt[x].getAttribute ) { var rel = Lt[x].getAttribute('rel');
    } else { var rel = ''; }
    if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 ) {
      //fill os with linked stylesheets
      os[os.length] = Lt[x];
    }
  }
  //include all style tags too and return the array
  for( var x = 0; St[x]; x++ ) { os[os.length] = St[x]; } return os;
}
 
function setStyleSheet() {
                for( var i = 0, ss = getAllSheets(); ss[i]; i++ ) {
                                if( ss[i].title ) {
                                                ss[i].disabled = true;
                                }
                                for( var y = 0; y < arguments.length; y++ ) {
                                                if( ss[i].title == arguments[y] ) {
                                                                ss[i].disabled = false;
                                                }
                                }
                }
}
// -->

