<!--
// © 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 //
// http://www.LasVegasNevada.gov //

var ROOT = "/clv_testing/"
//var ROOT = "";
//var ie5=document.getElementById&&document.all;
//var ns6=document.getElementById&&!document.all;
//if (ie5) {
//	ROOT = "//Fileserv/Data2/Clients/_A%20to%20E/City%20of%20Las%20Vegas/wireframes%20-%20active/";
//}
//if (ns6) {
//	ROOT = "";
//}

//------------
// DYNAMICALLY CHANGE THE STYLESHEET AND SET COOKIE - RETRIEVE COOKIE
//------------
var allcookies = document.cookie;

var font_types = ["small","medium","large"];

if(document.images) {
	icoFontSize01_on = new Image(12,12);
	icoFontSize01_off = new Image(12,12);
	icoFontSize02_on = new Image(12,12);
	icoFontSize02_off = new Image(12,12);	
	icoFontSize03_on = new Image(12,12);
	icoFontSize03_off = new Image(12,12);
}

if(document.images) {
	icoFontSize01_on.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize01_on.gif";
	icoFontSize01_off.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize01_off.gif";
	icoFontSize02_on.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize02_on.gif";
	icoFontSize02_off.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize02_off.gif";
	icoFontSize03_on.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize03_on.gif";
	icoFontSize03_off.src = "http://www.lasvegasnevada.gov/images/styles/icoFontSize03_off.gif";
}

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 = "icoFontSize0" + i;
				var imgName = imgLocation + "_on";
				swapit(imgLocation,imgName);
				setStyleSheet(font_types[i-1]);
			}
		}
	} else {
		var imgLocation = "icoFontSize01";
		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();				
	}
}

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();
				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 setStyleSheet(theme) {
	for ( i = 0; i < document.styleSheets.length; i++ ) {
          	if ( document.styleSheets[i].title ) {
            		document.styleSheets[i].disabled = true;
            		if ( document.styleSheets[i].title == theme ) {         		
              			document.styleSheets[i].disabled = false;
              		}
          	}
        }
}

document.write("<link rel='stylesheet' type='text/css' href='http://www.lasvegasnevada.gov/includes/stylesheetSmall.css' title='small'>");
document.write("<link rel='stylesheet' type='text/css' href='http://www.lasvegasnevada.gov/includes/stylesheetMedium.css' title='medium' DISABLED>");
document.write("<link rel='stylesheet' type='text/css' href='http://www.lasvegasnevada.gov/includes/stylesheetLarge.css' title='large' DISABLED>");

document.write("<link rel='shortcut icon' href='http://www.lasvegasnevada.gov/images/favicon.ico'>");

// -->
