// JavaScript Document

function MM_swapImgRestore(me) { //v3.0
  var i,x,a=document.MM_sr; 

  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  {
  if(me)
    {  //dirty hak... but it works.. -RM
        if(me.childNodes[0].childNodes[0].id == currentActive)
            {
                //don't do anything..
            }
        else
            {
                x.src=x.oSrc;
            }
    }
   else
    {
        x.src=x.oSrc;
    }
  }

 
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   doesFontCookieExist();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//--------------------------------------------------------------------------------------------------------->>>>>
// we're going to be working with a cookie named fontSz.  It will contain a number, either 14px, 12px, or 10px.
// if fontSz contains a value it will be set upon initial pageLoad via the imageLoad method that is called on the 
// onload event of the page
//--------------------------------------------------------------------------------------------------------->>>>>


/// create a cookie
function createCookie(name,value) {
	
		var date = new Date();
		date.setTime(date.getTime()+(10*24*60*60*1000)); // 10 days
		var expires = "; expires="+date.toGMTString();
	
	document.cookie = name+"="+value+expires+"; path=/";
}

//read a set cookie
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//remove the cookie
function eraseCookie(name) {
	createCookie(name,"",-1);
}



function doesFontCookieExistHome()
{
    var isCookie = readCookie("fontSz");
    //there is a cookie, assume it has a value if not null <-- bad, but ok for now... 
    if(isCookie !== null)
    {
     setFontSize(isCookie.substring(0,2),true);
     isHome = true;
    }
    else{
        //else we'll set the default font size
        setFontSize("13");
         isHome = true;
    }

}

var currentActive;
var isHome;
//set font size..
//check for cookie, if one does not exist, set one and set the font styles


function doesFontCookieExist()
{
    var isCookie = readCookie("fontSz");
    //there is a cookie, assume it has a value if not null <-- bad, but ok for now... 
    if(isCookie !== null)
    {
        //set the font size of the returned value which is returned like 
       if(isHome)
       {
        setFontSize(isCookie.substring(0,2),true);
        isHome = false;
       }
       else
       {
        setFontSize(isCookie.substring(0,2));
       }
    }
    else{
        //else we'll set the default font size
        setFontSize("13");
    }
}

//Set the current font size to specified value, it will also set a cookie
function setFontSize(fontSz,isHome)
{

     var p = document.getElementsByTagName('p');
     var a = document.getElementsByTagName('a');
     var li = document.getElementsByTagName('li');
     
         for(i=0;i<p.length;i++) 
         {
            if(fontSz !== "")
            {
            //NOTE:::: Internet Explorer will allow sizing without a "px"... 
            //BUT FireFox will die.. so this works on both..
              p[i].style.fontSize = fontSz+"px";
            }
         }
         ///change the links too
          for(i=0;i<a.length;i++) 
         {
            if(fontSz !== "")
            {
            //NOTE:::: Internet Explorer will allow sizing without a "px"... 
            //BUT FireFox will die.. so this works on both..
              a[i].style.fontSize = fontSz+"px";
            }
         }
           ///change the list Items too
          for(i=0;i<li.length;i++) 
         {
            if(fontSz !== "")
            {
            //NOTE:::: Internet Explorer will allow sizing without a "px"... 
            //BUT FireFox will die.. so this works on both..
              li[i].style.fontSize = fontSz+"px";
            }
         }
  
    if(fontSz == "11" && !isHome)
            {
            
            currentActive = "A-small";
            document.getElementById("A-small").src = "../Images/global/A-small_over.jpg";
            document.getElementById("A-medium").src = "../Images/global/A-medium.jpg";
            document.getElementById("A-large").src = "../Images/global/A-large.jpg";
            }
        else if(fontSz == "11" && isHome)
            {
            currentActive = "A-small";
            document.getElementById("A-small").src = "Images/global/A-small_over.jpg";
            document.getElementById("A-medium").src = "Images/global/A-medium.jpg";
            document.getElementById("A-large").src = "Images/global/A-large.jpg";
            }
       if(fontSz ==  "13" && !isHome)
            {
            currentActive = "A-medium";
            document.getElementById("A-medium").src = "../Images/global/A-medium_over.jpg";
            document.getElementById("A-small").src = "../Images/global/A-small.jpg";
            document.getElementById("A-large").src = "../Images/global/A-large.jpg";
            }
       else if(fontSz == "13" && isHome)
            {
             currentActive = "A-medium";
            document.getElementById("A-medium").src = "Images/global/A-medium_over.jpg";
            document.getElementById("A-small").src = "Images/global/A-small.jpg";
            document.getElementById("A-large").src = "Images/global/A-large.jpg";
            }
        if(fontSz == "15" && !isHome)
            {
            currentActive = "A-large";
            document.getElementById("A-large").src = "../Images/global/A-large_over.jpg";
            document.getElementById("A-medium").src = "../Images/global/A-medium.jpg";
            document.getElementById("A-small").src = "../Images/global/A-small.jpg";
            }
        else if(fontSz == "15" && isHome)
            {
            currentActive = "A-large";
            document.getElementById("A-large").src = "Images/global/A-large_over.jpg";
            document.getElementById("A-medium").src = "Images/global/A-medium.jpg";
            document.getElementById("A-small").src = "Images/global/A-small.jpg";
            }
          createCookie("fontSz",fontSz);
}






//-->
