function setActiveStyleSheet(title) {
	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") == title) a.disabled = false;
		}
	}
	//alert(title);
	createCookie(title);
	try{
		hl.resize();
	}catch(e){
		//alert(e);
	}
}

function createCookie(value) {
	expire = new Date();
	expire.setTime(expire.getTime() + (360*24*60*60*1000));
	var dateStr = expire.toGMTString();
	document.cookie = "@accesibility=" + escape (value) + "; expires=" + dateStr + "; path=/";
}

function getCookie(name){
	var myCookie = document.cookie;
	var cookieName = name + "=";
	var cNameLength = cookieName.length;
	var staPosition = myCookie.indexOf(cookieName);
	var endPosition;
	if(myCookie.length == 0) return null;
	if(staPosition != -1){
		staPosition = staPosition + cNameLength;
		endPosition = myCookie.indexOf(";",staPosition);
		if(endPosition == -1) endPosition = document.cookie.length;
		return unescape(myCookie.substring(staPosition,endPosition));
	}
	return null;
}

window.onload = function(e) {
	var cookie = getCookie("@accesibility");
	setActiveStyleSheet(cookie);
}

window.onunload = function(e) {
	var cookie = getCookie("@accesibility");
	createCookie(cookie);
}

var cookie = getCookie("@accesibility");
setActiveStyleSheet(cookie);

