var activeStyle, sheetCnt = 2;
var cookie = getCookie("activeStyle");
if (cookie) ssheet(cookie);
else activeStyle = 1;
function ssheet(n) {
	if (!document.styleSheets) alert("This browser doesn't support style switching.");
	else {
		var undef,i,s,st,ti;
		if (n=='cycle') {
			activeStyle++;
			if (activeStyle>sheetCnt) activeStyle=1;
			}
		else activeStyle = n;
		st = 'Styl'+activeStyle;
		for (i=0; i<document.styleSheets.length; i++) {
			s = document.styleSheets[i];
			if (s.owningElement) ti = s.owningElement.title;
			else ti = s.title;
			if ( (!n) || (ti!='' && ti!=undef && ti!=st) ) s.disabled = true;
			else s.disabled=false;
			}
		updateCookie("activeStyle",activeStyle,14);
		}
	}

function updateCookie(name,value,days) {
	var ex = new Date();
	ex = new Date(ex.getTime() + 1000 * 60 * 60 * 24 * days);
	setCookie(name, value, ex, '/');
	}

function setCookie(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; EXPIRES=' + expires.toGMTString() : '')
		+ (path ? '; PATH=' + path : '')
		+ (domain ? '; DOMAIN=' + domain : '')
		+ (secure ? '; SECURE' : '');
	}
function getCookie(cookieName) {
	var cookieValue = null;
	if (document.cookie) {
		var posName = document.cookie.indexOf(escape(cookieName) + '=');
		if (posName!=-1) {
			var posValue = posName + (escape(cookieName) + '=').length;
			var endPos = document.cookie.indexOf(';', posValue);
			if (endPos!=-1) cookieValue = unescape(document.cookie.substring(posValue,endPos));
			else cookieValue = unescape(document.cookie.substring(posValue));
			}
		}
	return cookieValue;
	}