﻿// #### needs to be placed on the bottom of the page 

	var	browser = navigator.userAgent.toLowerCase();
	var id = (document.getElementById) ? true : false;
	var IEx = ((browser.indexOf('msie')  != -1) && id) ? true : false;
	var NS6 = ((browser.indexOf('gecko') != -1) && id) ? true : false;
		
	if (IEx || NS6)	
	{
		elObj1=(document.getElementById) ? document.getElementById('contentstart') : document.all('contentstart');

		var fSize = GetCookie('fSize');
		if (elObj1 != null)
		{
		    if (fSize == null)
		    {
		        if (IEx)
		        {
		            elObj1.style.fontFamily = elObj1.currentStyle.fontFamily;
			        elObj1.style.fontSize = elObj1.style.fontSize = 10+'pt';
		        }
		        else
		        {
		            elObj1.style.fontFamily = document.defaultView.getComputedStyle(elObj1, null).fontFamily;
			        elObj1.style.fontSize = document.defaultView.getComputedStyle(elObj1, null).fontSize = 10+'px';
		        }
		    }
		    else
		    {
		    	if (IEx)
		        {
			        elObj1.style.fontSize = fSize+'pt';
				    subObjSet_IE("td")
				    subObjSet_IE("p")
				    subObjSet_IE("font")
				    subObjSet_IE("span")
		        }
		        else
		        {
			        elObj1.style.fontSize = fSize+'px';	
				    subObjSet_NS("td")
				    subObjSet_NS("p")
				    subObjSet_NS("font")
				    subObjSet_NS("span")	        
		        }
		    }	
		}
	}


function subObjSet_IE(tgName)
{
	for (i=0;i<elObj1.getElementsByTagName("td").length; i++) {
		elObj1.getElementsByTagName("td").item(i).style.fontSize = (parseInt(elObj1.style.fontSize))+'pt';
		elObj1.style.fontFamily = elObj1.currentStyle.fontFamily;
	}
}


function subObjSet_NS(tgName)
{
	for (i=0;i<elObj1.getElementsByTagName(tgName).length; i++) {
		elObj1.getElementsByTagName(tgName).item(i).style.fontSize = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize))+'px';
		document.defaultView.getComputedStyle(elObj1, null).fontFamily = document.defaultView.getComputedStyle(elObj1, null).fontFamily;
	}
}

function fontObjUp()
{		
	var	browser = navigator.userAgent.toLowerCase();
	var IEx = ((browser.indexOf('msie')  != -1) && id) ? true : false;
	var NS6 = ((browser.indexOf('gecko') != -1) && id) ? true : false;
		
	if (IEx)
	{
        fontObjUp_IE();
	}
	else if (NS6)
	{
        fontObjUp_NS();
	}
}

function fontObjDwn()
{
	var	browser = navigator.userAgent.toLowerCase();
	var IEx = ((browser.indexOf('msie')  != -1) && id) ? true : false;
	var NS6 = ((browser.indexOf('gecko') != -1) && id) ? true : false;
		
	if (IEx)
	{
        fontObjDwn_IE();
	}
	else if (NS6)
	{
        fontObjDwn_NS();
	}
}

function fontObjUp_IE()
{
    if (parseInt(elObj1.style.fontSize) < 21)
    {
	    elObj1.style.fontSize = (parseInt(elObj1.style.fontSize)+1)+'pt';
	    elObj1.style.lineHeight = (parseInt(elObj1.style.fontSize)+3)+'pt';
	    elObj1.style.fontFamily = elObj1.currentStyle.fontFamily;
	    subObjDwn_IE("td")
	    subObjDwn_IE("P")
	    subObjDwn_IE("font")
	    subObjDwn_IE("span")
		
        selectIn = (parseInt(elObj1.style.fontSize)-6)
    }	
}

function fontObjUp_NS()
{
	if (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize) < 21)
    {
	    elObj1.style.fontFamily = document.defaultView.getComputedStyle(elObj1, null).fontFamily;
	    elObj1.style.fontSize = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize) + 1)+'px';
	    subObjDwn_NS("td")
	    subObjDwn_NS("p")
	    subObjDwn_NS("font")
	    subObjDwn_NS("span")
        selectIn = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize)-6)
    }	
}

function subObjDwn_NS(tgName)
{
	for (i=0;i<elObj1.getElementsByTagName(tgName).length; i++) 
	{
		elObj1.getElementsByTagName(tgName).item(i).style.fontSize = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize)-1)+'px';
		elObj1.getElementsByTagName(tgName).item(i).style.fontFamily = document.defaultView.getComputedStyle(elObj1, null).fontFamily;
	}
}

function subObjDwn_IE(tgName)
{

	for (i=0;i<elObj1.getElementsByTagName(tgName).length; i++) 
	{
		elObj1.getElementsByTagName(tgName).item(i).style.fontSize = (parseInt(elObj1.style.fontSize)-1)+'pt';
		elObj1.getElementsByTagName(tgName).item(i).style.lineHeight = (parseInt(elObj1.style.lineHeight)-1)+'pt';
		elObj1.getElementsByTagName(tgName).item(i).style.fontFamily = elObj1.currentStyle.fontFamily;
	}
}



function fontObjDwn_NS()
{
	if (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize) > 5)
	{
	    elObj1.style.fontFamily = document.defaultView.getComputedStyle(elObj1, null).fontFamily;
	    elObj1.style.fontSize = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize) - 1)+'px';
		subObjDwn_NS("td")
		subObjDwn_NS("p")
		subObjDwn_NS("font")
		subObjDwn_NS("span")
		
        selectIn = (parseInt(document.defaultView.getComputedStyle(elObj1, null).fontSize)-6);
	}
}


function fontObjDwn_IE()
{
    //alert('currently: ' + (elObj1.style.fontSize));
	if (parseInt(elObj1.style.fontSize) > 5)
	{
		elObj1.style.fontFamily = elObj1.currentStyle.fontFamily;
		elObj1.style.fontSize = (parseInt(elObj1.style.fontSize)-1)+'pt';
		subObjDwn_IE("td")
		subObjDwn_IE("p")
		subObjDwn_IE("font")
		subObjDwn_IE("span")
		   selectIn = (parseInt(elObj1.style.fontSize)-6)
	}
}

function selectFont()
{
	//fSize = (document.fontForm.fontSize.selectedIndex+6);
	
				subObjSet("td")
				subObjSet("p")
				subObjSet("font")
				subObjSet("span")
	elObj1.style.fontSize = fSize+'pt';
}

function saveSize() 
{
	var expDays = 1000; // number of days the cookie should last
	var expDate = new Date();
	expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays)); 
	SetCookie('fSize', parseInt(elObj1.style.fontSize), expDate);
}

function getCookieVal (offset) 
{  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) 
{  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

function SetCookie (name, value) 
{  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

