var SavedStyle = getCookie('W3C_Styles');
if (SavedStyle=='Default' || SavedStyle=='Alternate' || SavedStyle=='Off') setStyle(SavedStyle);

function setStyle(title) {
	if (document.getElementsByTagName) {
		for (var i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if (a.getAttribute("rel") &&
				a.getAttribute("rel").indexOf("stylesheet") != -1 &&
				a.getAttribute("media") &&
				a.getAttribute("media").indexOf("screen") != -1 &&
				a.getAttribute("title")) {
					a.disabled = true;
					if (a.getAttribute("title")==title) a.disabled = false;
					}
			}
		var ex = new Date();
		ex = new Date(ex.getTime() + 1000 * 60 * 60 * 24 * 30);
		setCookie('W3C_Styles', title, ex);
		return false;
		}
	else {
		alert("Your browser doesn't support style sheets switching.");
		return true;
		}
	}

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;
	}

