function lnkStandard_OnClick()
{
	 setFontSize('1em');	 
}

function lnkSmaller_OnClick()
{
	changeBodyFont('decrease');
}

function lnkLarger_OnClick()
{	
	changeBodyFont('increase');
}

function lnkLargest_OnClick()
{
	changeBodyFont('largest');
}


function setFontSize(fontSize)
{
	document.body.style.fontSize = fontSize;	
	setCookie('ifFontSize', fontSize);
}

function setUserFontSize()
{
      
	var fontSize = getCookie('ifFontSize');
      if(fontSize){

	if(fontSize != '')
	{
		setFontSize(fontSize);
		
	}
	else
	{	
           	var fontSizeControl = '1em';

		if(fontSizeControl.value=='')
		{
			document.body.style.fontSize = '1em';
		}
		else
		{
			document.body.style.fontSize = fontSizeControl.value;
		}
	}
	}
	
		
}



function changeBodyFont(change)
{
	var bodyFontSize = document.body.style.fontSize;
	var amount;
			
	if(getUnit(bodyFontSize)=='em')
	{
		amount = parseFloat(getAmount(bodyFontSize));	
	}
	else
	{
		var amount = 1;
	}
	
	if(change=='increase')
	{
		amount = 1.2;
	}
	else
	{
		amount = 1.3;
	}	
		
	setFontSize(amount + 'em');
}



		
function getUnit(fontSize)
{
	if(fontSize.length>2)
	{
		var startPos = fontSize.length - 2;
		
		var unit = fontSize.substr(startPos, 2);
		return unit;
	}
}

function getAmount(fontSize)
{
	if(fontSize.length>2)
	{
		var endPos = fontSize.length - 2;
		
		var amount = fontSize.substr(0, endPos);
		return amount;
	}
	else	
	{
		return fontSize;
	}
}

function getCookie(name) 
{
	var cookies = document.cookie.split(';');
	for (var i=0; i<cookies.length; i++) 
	{
		var cookie = cookies[i];
		while (cookie.charAt(0)==' ') 
		{
			cookie = cookie.substring(1, cookie.length);
		}
		if (cookie.indexOf(name) == 0) 
		{
			return unescape( cookie.substring(name.length + 1, cookie.length) );
		}
	}
	return null;
}

function setCookie(name, value) 
{	
	document.cookie = name + "=" + escape(value);
}




