// JavaScript Document
var blnDone = false;
var standardCSS = "base";
var alternateCSS = "high";
var standardCSSImgSrc = "/App_Themes/Biblio/Images/cnt_snv_dro.jpg";
var alternateCSSImgSrc = "/App_Themes/Biblio/Images/cnt_snv_dro_on.jpg";
var currentStyle = null;

function init() {
   	// quit if this function has already been called
   	if (blnDone) return;

   	// flag this function so we don't do the same thing twice
   	blnDone = true;   
	
	window.onload = function() {
		activeStyleSheet = getActiveStyleSheet();
		if (activeStyleSheet == standardCSS)
			setImageButton(standardCSSImgSrc);
		else
			setImageButton(alternateCSSImgSrc);	
		
		var objStyleSwitcher = document.getElementById("styleswitcher");   
		if (objStyleSwitcher) {		
			objStyleSwitcher.onclick = function() {
				switchStyle();	
				return false;
			}
		}
	}
	
	window.onunload = function(e) {
		activeStyleSheet = getActiveStyleSheet();
	  	createCookie("stylesheet", activeStyleSheet, 1);
	}
	
	var currentStyle = readCookie("stylesheet");
	if (currentStyle == null)
		currentStyle = standardCSS;
	setActiveStyleSheet(currentStyle);
}

init();