	csstype=getCookie('csstype');

	if (csstype != null && csstype != "")
	{
		if (csstype == "standard")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/standard.css\" />");
		}
		else if (csstype == "high_contrast")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/high_contrast.css\" />");
		}
		else if (csstype == "inverse_high_contrast")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/inverse_high_contrast.css\" />");
		}
		else if (csstype == "black_and_white")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/black_and_white.css\" />");
		}
		else if (csstype == "white_and_black")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/white_and_black.css\" />");
		}
		else if (csstype == "colourful")
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/colourful.css\" />");
		}
		else
		{
			document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/standard.css\" />");
		}
	}
	else
	{
		document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/standard.css\" />");
	}

function init()
{
	changefont();
}

function changefont()
{
	textsize=getCookie('textsize');
	
	if (textsize != null && textsize!="")
	{
		changeFontSize(textsize);
	}
}

function changeFontSize(inc)
{
	var p = document.getElementsByTagName('p');
	for(n=0; n<p.length; n++)
	{
		p[n].style.fontSize = inc + 'em';
	}
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		
		if (c_start!=-1)
		{
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	window.location.reload();
}

function checkCookie()
{
	textsize=getCookie('textsize');
	csstype=getCookie('csstype');
	
	if (textsize != null && textsize!="")
	{
		alert('Text size is '+textsize+'!');
	}
	if (csstype != null && csstype!="")
	{
		alert('CSS type is '+csstype+'!');
	}
}
