checkStylesheet();




function checkStylesheet()
{
	var textSize = getCookie("text_size");
	var theLink = "";

	if (textSize != "null")
	{
		setStylesheet('Text ' + textSize)
	}

	return true;
}




function cookieExists(cookieName)
{
	if (document.cookie != "")
	{
		var theCookieList = document.cookie.split(";");

		for (i = 0; i < theCookieList.length; i++)
		{
			var currCookieName = theCookieList[i].split("=")[0];
			var currCookieValue = theCookieList[i].split("=")[1];

			if (currCookieName.indexOf(cookieName) != -1)
			{
				if (currCookieValue == "null")
				{
					return false;
				}

				return true;
			}
		}
	}

	return false;
}




function getCookie(cookieName)
{
	if (cookieExists(cookieName))
	{
		var theCookieList = document.cookie.split(";");

		for (var i = 0; i < theCookieList.length; i++)
		{
			if (theCookieList[i].split("=")[0].indexOf(cookieName) != -1)
			{
				return theCookieList[i].split("=")[1];
			}
		}
	}

	return "null";
}




function setCookie(cookieName, cookieValue)
{
	var cookieOptions = "path=;";

	cookieOptions += "domain=dev.pixelpoint.at;www.gesundheitsland.at;";
	cookieOptions += "expires=" + (new Date("December 31, 2010")).toGMTString() + ";";

	document.cookie = cookieName + "=" + cookieValue + ";" + cookieOptions;

	return;
}




function setStylesheet(styleTitle)
{
	var currTag;

	if (document.getElementsByTagName)
	{
		for (var i = 0; (currTag = document.getElementsByTagName("link")[i]); i++)
		{
			if (currTag.getAttribute("rel").indexOf("style") != -1 && currTag.getAttribute("title"))
			{
				currTag.disabled = true;

				if(currTag.getAttribute("title") == styleTitle)
				{
					currTag.disabled = false;
				}
			}
		}
	}
	else
	{
		alert("You may not switch styles with this browser.");
	}
}





