/**
 * @author byk@e-kalite.com.tr
 */
if (!eQ)
	var eQ={config: {}};

if (!eQ.config.fontSizeSwithcer)
	eQ.config.fontSizeSwithcer = {};

eQ.config.fontSizeSwithcer.unite(
	{
		informServer: true,
		largeFontSize: '15.6px',
		buttonId: 'fontSizeSwitcher'
	}
);

eQ.fontSizeSwitcher={};


eQ.fontSizeSwitcher.getCookieFont = function()
{
	if (document.cookie.length>0)
	{
	  c_start=document.cookie.indexOf("pharmacu_large_fnts=");
	  if (c_start!=-1)
	  {
	    c_start=c_start + "pharmacu_large_fnts".length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	  if (c_end==-1) c_end=document.cookie.length;
	  {
	    return unescape(document.cookie.substring(c_start,c_end));
	  }
	  }
	}
	return "";
}


eQ.fontSizeSwitcher.toggle = function()
{
	eQ.largeFonts = !eQ.largeFonts;
	document.body.style.fontSize = (eQ.largeFonts) ? eQ.config.fontSizeSwithcer.largeFontSize : '';
	
	document.cookie = "pharmacu_large_fnts=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/";
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+365);
	document.cookie="pharmacu_large_fnts="+eQ.largeFonts+";expires="+exdate.toGMTString()+"; path=/";
};

eQ.fontSizeSwitcher.init = function()
{
	var button = document.getElementById(eQ.config.fontSizeSwithcer.buttonId);
	if (button)
		aV.Events.add(button, 'click', eQ.fontSizeSwitcher.toggle);
	
	if(eQ.fontSizeSwitcher.getCookieFont() == "true")
	{
		eQ.largeFonts = true;
		document.body.style.fontSize = eQ.config.fontSizeSwithcer.largeFontSize;
	}
	else
	{
		eQ.largeFonts = false;
		document.body.style.fontSize = "";
	}
};

aV.Events.add(window, 'load', eQ.fontSizeSwitcher.init);

