/**
	* @copyright Copyright (C) 2006 - 2008 JoomlaShine.com
	* @author JoomlaShine.com
	* @license Commercial Proprietary
	* Please visit http://www.joomlashine.com for more information
*/

var prefsLoaded = false;
var currentFontSize = defaultFontSize;

function ssbcChangeFontSize(sizeDifference)
{
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 2.5);

	if(currentFontSize > 100){
		currentFontSize = 100;
	}else if(currentFontSize < 50){
		currentFontSize = 50;
	}

	ssbcSetFontSize("ssbc-master", currentFontSize);
}

function ssbcResetFontSize()
{
	currentFontSize = defaultFontSize;
	ssbcChangeFontSize(0);
}

function ssbcLoadPrefs()
{
	if(!prefsLoaded){
		cookie = ssbcReadCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		ssbcChangeFontSize(0);
		
		prefsLoaded = true;
	}
}

function ssbcSavePrefs()
{
	ssbcWriteCookie("fontSize", currentFontSize, 365);
}

function ssbcInitTemplate()
{
	// Set accessibility preferences
	ssbcLoadPrefs();
}

function ssbcFinalizeTemplate()
{
	// Save accessibility preferences
	ssbcSavePrefs();
}

ssbcAddEvent(window, 'load', ssbcInitTemplate);
ssbcAddEvent(window, 'unload', ssbcFinalizeTemplate);
