window.onload = readTextSize;


function readTextSize()
{
	var standardTag	= document.getElementById("text_standard");
	var largerTag	= document.getElementById("text_larger");
	var largestTag	= document.getElementById("text_largest");
	var bodyTag		= document.getElementById("wrapper");

	if(getTextSize() != null){
		var textSize	= getTextSize();
		
		if(textSize == "=larger" || textSize == "larger"){
			standardTag.style.borderBottom = "none";
			largerTag.style.borderBottom = "1px solid";
			largestTag.style.borderBottom = "none";
			bodyTag.style.fontSize = "0.98em";
		}else if(textSize == "=largest" || textSize == "largest"){
			standardTag.style.borderBottom = "none";
			largerTag.style.borderBottom = "none";
			largestTag.style.borderBottom = "1px solid";
			bodyTag.style.fontSize = "1.08em";
		}else{
			standardTag.style.borderBottom = "1px solid";
			largerTag.style.borderBottom = "none";
			largestTag.style.borderBottom = "none";
			bodyTag.style.fontSize = "0.8em";
		}
	}else{
		standardTag.style.borderBottom = "1px solid";
		largerTag.style.borderBottom = "none";
		largestTag.style.borderBottom = "none";
		bodyTag.style.fontSize = "0.8em";
	}
	
}

function setTextSize(size)
{
	var textSize = size;
	var expireDate = new Date();
	expireDate.setMonth(expireDate.getMonth() + 12);
	
	document.cookie = "textSize=" + size + ";path=/;expires=" + expireDate.toGMTString();
	readTextSize();
}

function getTextSize()
{
	var name_eq = "textSize=";
	var ca = document.cookie.split(';');
	
	for(var i=0; i < ca.length; i++)
	{
		var c = ca[i];
		while(c.charAt(0)=='') c = c.substring(1,c.length);
		if(c.indexOf(name_eq) >= 0) return c.substring(name_eq.length, c.length);
	}
	
	return null;
}

