/***********************************************
* Text Re-Sizer Script 
* Coded by:Sapient
* Last Modified: August 06, 2008
***********************************************/
var finalInc = 0;


function LoadFonts()
{
	var incTemp =  readCookie("fontSize");	
	document.getElementById('inc').value = 0;		
	increaseFontSize(incTemp);
}

function increaseFontSize(increment) {
        
        var incTemp = document.getElementById('inc').value;
	    
	    finalInc = 0;
        
        if(incTemp == 2 && increment == 0)
            finalInc = -2;
        else
            if(incTemp == 2 && increment == 1)
                finalInc = -1;
            else
                if(incTemp == 2 && increment == 2)
                    finalInc =0;
                else
                    if(incTemp == 1 && increment == 0)
                        finalInc = -1;
                    else
                        if(incTemp == 1 && increment == 1)
                            finalInc = 0;
                        else
                            if(incTemp == 1 && increment == 2)
                                finalInc = 1;
                                //*****
                            else
                                if(incTemp == 0 && increment == 0)
                                    finalInc = 0;
                                else
                                    if(incTemp == 0 && increment == 1)
                                        finalInc = 1;
                                    else
                                        if(incTemp == 0 && increment == 2)
                                            finalInc = 2;

	
     document.getElementById('inc').value = increment;
	//var tags = "a,p,div,td,tr,th,H1,H2,H3,H4,H5,span,ul,li"; 
	//var arr = tags.split(',');
	
    var p = new Array(); p = document.documentElement.getElementsByTagName("*");

	//for(indx=0;indx < arr.length; ++indx)
	{

   //var p = document.getElementsByTagName(arr[indx]);

   //for(i=0;i<p.length;i++) 
   for(i=p.length -1;i >=0 ;--i) 
   {
   if(p[i].nodeName =="A" || p[i].nodeName =="P" || p[i].nodeName =="DIV" ||
   p[i].nodeName =="TD" || p[i].nodeName =="TR" || p[i].nodeName =="TH" ||
   p[i].nodeName =="H1" || p[i].nodeName =="H2" || p[i].nodeName =="H3" ||
   p[i].nodeName =="H4" || p[i].nodeName =="H5" || p[i].nodeName =="SPAN" ||
   p[i].nodeName =="UL" || p[i].nodeName =="LI")
   {
   var tmpText;
    if(p[i].innerText == undefined)
    {
	 tmpText = p[i].textContent;
	 }
	 else
	 {
	    tmpText = p[i].innerText;
	 }	 
	 tmpText = tmpText.replace(' ',"");
     if(tmpText != "")
	 {

     var s ="";
     var currstyle;
     if(p[i].currentStyle == undefined)
     {
        currstyle= eval('document.defaultView.getComputedStyle(p[i], null).'+'fontSize');
     }
     else
     {
        currstyle= p[i].currentStyle.fontSize;
     }
        if(currstyle.indexOf("px")  !=-1)
        {       
       if(p[i].id != "smallA" && p[i].id != "mediumA" && p[i].id != "largeA")
		{
		
		
         var size = currstyle.replace('px','');
         s = parseInt(size,10);
         s +=finalInc;
		 
         p[i].style.fontSize = s+"px";


		}
         }
         else
         {
         //s = parseInt(currstyle.replace("pt",""));
         //s +=(finalInc/2);
         //p[i].style.fontSize = s+"pt";
         }

        }
	}

   }
   }
}


//creates cookie with the font setting
function createCookie(name,value) {
  expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
 };
//reads the created 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);
    else
        return 0;
  }
  //return null;
};

//window.onload = setUserOptions;
// sets the user cookie when page loads
/*function setUserOptions(){
	if(!prefsLoaded){

		cookie = readCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		setFontSize(currentFontSize);
		
		prefsLoaded = true;
	}

}*/
window.onunload = saveSettings;
//saves the last setting when window closes
function saveSettings()
{
  var incValue = null;  
  if(document.getElementById('inc').value == null)  
    incValue = 0;
  else
    incValue = document.getElementById('inc').value;
  
  //createCookie("fontSize", document.getElementById('inc').value);
  createCookie("fontSize", incValue);
}
 
/***********************************************
* Score Card Layout Hide Script 
* Coded by:Sapient
* Last Modified: August 14, 2008
***********************************************/


function ScorecardFaq()
	{
	 var HidePanel = window.location.href;
			
	            if (HidePanel.indexOf("Schools/Find_a_school/Pages/ScorecardFAQElementary.aspx")> -1)
	        {  
		        document.write(' <style type=text/css> #CPS_headerSection, #CPS_NavContainerSection, #CPS_footerSection, #breadcrumbSection {display:none} #CPS_containerSection { width:100%!important;} body {background-color:#FFFFFF!important;}</style>');

	        }						
	}

	ScorecardFaq();


/***********************************************
* Site Actions display control
* Coded by:Sapient
* Last Modified: November 24, 2008
***********************************************/
function DisplaySiteActionsDiv()
{
    var siteActionsDiv = document.getElementById('siteActionsDiv');
    if(siteActionsDiv.innerHTML == '')
        siteActionsDiv.style.display = "none";
}


/*****************************************************************
* Overriding the key press event of the global search textbox
* Coded by: Sapient
* Last Modified: January 19, 2009
*****************************************************************/
function ReplaceOnKeyPress()
{
     //Hacking the function name and the search text box id
     var submitFunction = "SD06736D6_Submit();";
     var searchTextBoxID = "ctl00_PlaceHolderSearchArea_SearchBox_SD06736D6_InputKeywords";

     var txtSearch = document.getElementById(searchTextBoxID);
     var browser=navigator.appName;
     
     //Overriding the default onkeypress event in case of FireFox
     if (txtSearch && (browser == "Netscape"))
     {
           txtSearch.onkeypress = function(e)
           { 
               var key = String.fromCharCode(e.keyCode);
               if (key == "\n" || key == "\r")
               {
                eval(submitFunction);
                return false;     
               }  
           }
     }
}


/*****************************************************************
* Displaying the current year in the Copyright section
* in the master page
* Coded by: Sapient
* Last Modified: January 20, 2009
*****************************************************************/
function LoadCurrentYearinCopyRight()
{
    var today = new Date()
    var year = today.getYear()
    if(year<1000) year+=1900

    var currentYear = document.getElementById("currentYear");
    currentYear.innerHTML = year + " ";

}

/*****************************************************************
* Prevent the drop down list from being hidden on A Note From page
* Coded by: Sapient
* Last Modified: February 06, 2009
*****************************************************************/
function AdjustTitleHeight()
{
    var titleBar = document.getElementById("titleBar");
    if(document.getElementById("ctl00_PlaceHolderMain_DropDownChoiceField1_DropDownChoice") == null)
        titleBar.style.height = "25px";
    else
        titleBar.style.height = "95px"
        
    if(document.getElementById("ctl00_PlaceHolderMain_LookupField1_Lookup") == null)
        titleBar.style.height = "25px";
    else
        titleBar.style.height = "95px"    
        
}