/**
	* @copyright Copyright (C) 2008 smy-WebSolution.de
	* @author smy-WebSolution.de
	* @license Commercial Proprietary
	* Please visit http://www.smy-WebSolution.de for more information
*/

var prefsLoaded = false;
var currentFontSize = defaultFontSize;

function smyChangeFontSize(sizeDifference)
{
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 2.5);

	if(currentFontSize > 100){
		currentFontSize = 100;
	}else if(currentFontSize < 60){
		currentFontSize = 50;
	}

	smySetFontSize("smy-master", currentFontSize);
}

function smyResetFontSize()
{
	currentFontSize = defaultFontSize;
	smyChangeFontSize(0);
}

function smyLoadPrefs()
{
	if(!prefsLoaded){
		cookie = smyReadCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		smyChangeFontSize(0);
		
		prefsLoaded = true;
	}
}

function smySavePrefs()
{
	smyWriteCookie("fontSize", currentFontSize, 365);
}

function smyInitTemplate()
{
	// Set accessibility preferences
	smyLoadPrefs();
}

function smyFinalizeTemplate()
{
	// Save accessibility preferences
	smySavePrefs();
}

smyAddEvent(window, 'load', smyInitTemplate);
smyAddEvent(window, 'unload', smyFinalizeTemplate);
