var intFontSize = "";

window.onload = Initialize;



function Initialize()



{



	cookie = ReadCookie("fontSize");

	intFontSize = cookie ? cookie : 12;

	bolLoaded = true;



//  if (typeof CustomOnLoad()!='undefined') // Apparantly, nobody supports the *new* standard. :p



if (window.CustomOnLoad)

  	CustomOnLoad();	

}



function ReadCookie(name) 

{

	var nameEQ = name + "=";

	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(nameEQ) == 0) 

			{return c.substring(nameEQ.length,c.length);}

	}

	return null;

};



window.onunload = WriteCookies;



function WriteCookies()

{

	if (intFontSize == "")

		{

		cookie = ReadCookie("fontSize");

		intFontSize = cookie ? cookie : 12;	

		}

	WriteCookie("fontSize", intFontSize, 365);

}







function WriteCookie(name,value,days) 

{

	if (days) 

	{

		var date = new Date();

		date.setTime(date.getTime()+(days*24*60*60*1000));

		var expires = "; expires="+date.toGMTString();

	}

	else

		{var expires = "";}

	document.cookie = name+"="+value+expires+"; path=/";

};



function increaseFontSize()

	{	

	if (intFontSize == "")

		{

		cookie = ReadCookie("fontSize");

		intFontSize = cookie ? cookie : 12;	

		}		

	setFontSize(++intFontSize);

	}



function decreaseFontSize()

	{

	if (intFontSize == "")

		{

		cookie = ReadCookie("fontSize");

		intFontSize = cookie ? cookie : 12;	

		}		



	if (intFontSize > 4)

		setFontSize(--intFontSize);

	}	



function resetFontSize()

	{

	intFontSize = 12;

	setFontSize(intFontSize);

	}



function setFontSize(fontSize)

	{

	$("#content").css("fontSize", fontSize + 'px');

//	bodyObj.style.fontSize = fontSize + 'px';

	intFontSize = fontSize;

	WriteCookies(); // onunload event unreliable

	};
