/**
	* @copyright Copyright (C) 2009 - 2010 km-kh.com
	* @author km-kh.com
	* @license Commercial Proprietary
	* Please visit http://www.km-kh.com for more information
*/

var prefsLoaded = false;
var currentFontSize = defaultFontSize;

function hsvChangeFontSize(sizeDifference)
{
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 2.5);

	if(currentFontSize > 100){
		currentFontSize = 100;
	}else if(currentFontSize < 60){
		currentFontSize = 50;
	}

	hsvSetFontSize("jsn-master", currentFontSize);
}

function hsvResetFontSize()
{
	currentFontSize = defaultFontSize;
	hsvChangeFontSize(0);
}

function hsvLoadPrefs()
{
	if(!prefsLoaded){
		cookie = hsvReadCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		hsvChangeFontSize(0);
		
		prefsLoaded = true;
	}
}

function hsvSavePrefs()
{
	hsvWriteCookie("fontSize", currentFontSize, 365);
}

function hsvInitTemplate()
{
	// Set accessibility preferences
	hsvLoadPrefs();
}

function hsvFinalizeTemplate()
{
	// Save accessibility preferences
	hsvSavePrefs();
}

hsvAddEvent(window, 'load', hsvInitTemplate);
hsvAddEvent(window, 'unload', hsvFinalizeTemplate);
