


function AndMyBodyLoad()
{
    if(oldFunction){ oldFunction(); }
    
    var fontsize = GetCookie("fontsize");
     if( fontsize==null ) fontsize="80%";
     
    SetCurrentFontSize(fontsize);
    SetDivSize(fontsize);
}

function SetCurrentFontSize(fontsize)
{
    document.body.style.fontSize = fontsize;
    switch(fontsize)
	{
	    case '80%':
	        Log('Fontsize=100%');
	        break;
	    case '90%':
	        Log('Fontsize=110%');
	        break;
	    case '100%':
	        Log('Fontsize=120%');
	        break;
	        
	}
	
}

function AdJustTextForFontChange(fontsize)
{
    var fontChangeLi = document.getElementById("fontChangeLi");
    if( fontChangeLi!=null ) 
    {
        switch(fontsize)
	    {
            case '80%':
                fontChangeLi.innerHTML="<a href=\"#top\" onclick=\"Javascript: javascript:SetFontSize('100%');\">Large Font</a>";
                break;
            case '90%':
                fontChangeLi.innerHTML="<a href=\"#top\" onclick=\"Javascript: javascript:SetFontSize('100%');\">Large Font</a>";
                break;
            case '100%':
                fontChangeLi.innerHTML="<a href=\"#top\" onclick=\"Javascript: javascript:SetFontSize('80%');\">Normal Font</a>";
                break;
        }
    }
    
}

function SetDivSize(fontsize)
{
    if(document.getElementById('browse'))
    {
        var browseDiv = document.getElementById('browse');
    } 
    else 
    {
        return;
    }
    
	switch(fontsize)
	{
	    case '80%':
	        browseDiv.style.height = '33px';
	        break;
	    case '90%':
	        browseDiv.style.height = '53px';
	        break;
	    case '100%':
	        browseDiv.style.height = '53px';
	        break;
	}
	AdJustTextForFontChange(fontsize);
}

function Log( logParams )
{
//      
//    var url="./fileserver.aspx?file=blank.gif&" + logParams + "&Page=";
//   
//    var loc =  window.location.href.indexOf("?");
//    var path;
//    if( loc==-1 ) 
//    {
//        loc = window.location.href.lastIndexOf("/");
//        url += window.location.href.substr(loc+1, window.location.href.length-(loc+1) );
//    }
//    else
//    {
//        var orgUrl = window.location.href.substr(0,loc);
//        
//        loc = orgUrl.lastIndexOf("/");
//        url += orgUrl.substr(loc+1, orgUrl.length-(loc+1) )+ "&";
//        
//        loc =  window.location.href.indexOf("?");
//        url += window.location.href.substr(loc+1, window.location.href.length-(loc+1) );
//    }
//    
//    window.open(url,"FontChangeLoggerFrame");
}

// Method called from control
function SetFontSize(fontsize)
{
	SetCurrentFontSize(fontsize);
	
	SetDivSize(fontsize);
	document.cookie = "fontsize=" + fontsize;
}



//used in the contact us form
function clearForm()
{
    var formElements = document.forms["aspnetForm"].elements;
    for(var i=0; i<formElements.length; i++){
        if(formElements[i].type == 'text' || formElements[i].type == 'textarea'){
            formElements[i].value = ''
        }//end if
    }//end for
    return false;
}//end function

//use to add more than one event to a page element
//cross browser support
function addEvent(obj, evType, fn, useCapture)
{
  if (obj.addEventListener)
  {
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } 
  else if (obj.attachEvent)
  {
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }//end if/else/if
}//end function




function GetCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}




var oldFunction = window.onload;
window.onload = AndMyBodyLoad;


function Pop(url,windowName,params) 
{
	newpage = window.open(url,windowName,params);
	newpage.focus();
}
