// TEXT ENLARGER
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else
	{
		expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name)
{
	var the_cookie = unescape(document.cookie);
	if (the_cookie.indexOf(";") > -1 ) {
		var cArr = the_cookie.split("; ");
		for (var i=0;i<cArr.length;i++) {
			if (cArr[i].indexOf(name + "=") == 0) return cArr[i].substr(name.length+1);
		}
	}
	else if (the_cookie.indexOf(name + "=") == 0) return the_cookie.substr(name.length+1);
	return "";
}

function setTextSize(which)
{
	var body = document.getElementsByTagName('body')[0];
	if (body.ts_orig_body_class == null)
	{
		body.ts_orig_body_class = body.className;
	}
	body.className = body.ts_orig_body_class + ' ts-'+which;
	createCookie('ts', which, 90);
}

window.onload = function() {
	var current_size = getCookie('ts');
	if (current_size != '')
	{
		setTextSize(current_size);
	}
}
