/*
function $(id) {

	return document.getElementById(id);

}
*/

function setCookie(sName, sValue) {

	date = new Date();
	date.setDate(date.getDate() + 1);
	document.cookie = sName + "=" + escape(sValue) + "; path=/; expires=" + date.toGMTString();

}

function getCookie(sName) {

	// cookies are separated by semicolons
	var aCookie = document.cookie.split("; ");

	for (var i=0; i < aCookie.length; i++) {

		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");

		if (sName == aCrumb[0]) {
			return unescape(aCrumb[1]);
		}

	}

	// a cookie with the requested name does not exist
	return null;

}

function showStyle(styleFile) {

	setCookie('style', styleFile);
	document.location.reload();

}

function initStyle(styleFile) {

	// to be called by the testing framework.
	// if the cookie hasn't been set yet, call it for the first time

	if (getCookie('style') == null) {
		showStyle(styleFile);
	}

}