﻿//////////////////////////////
//Main Navigation Functions//
function ShowSubMenu(area, img) 
{
   //alert(document.getElementById(area).style.zIndex);
   //document.getElementById(area).style.zIndex = 2000;
   //Clear selected button
   document.getElementById('MainNavImageAbout').src = "/NewImages/Global_MainNav_About.png";
   document.getElementById('MainNavImageResidents').src = "/NewImages/Global_MainNav_Residents.png";
   document.getElementById('MainNavImageBusiness').src = "/NewImages/Global_MainNav_Business.png";
   document.getElementById('MainNavImageVisitors').src = "/NewImages/Global_MainNav_Visitors.png";
   
   //Set the selected button
   document.getElementById(area).style.display = 'block';
   img.src = img.src.substr(0, img.src.length - 4) + '_on.png'; 
   
     
}
function CloseSubMenu(area)  
{  
    //Close Subnav
   document.getElementById(area).style.display='none';
}

function ClearSelectedMainNav()
{
   document.getElementById('MainNavImageAbout').src = "/NewImages/Global_MainNav_About.png";
   document.getElementById('MainNavImageResidents').src = "/NewImages/Global_MainNav_Residents.png";
   document.getElementById('MainNavImageBusiness').src = "/NewImages/Global_MainNav_Business.png";
   document.getElementById('MainNavImageVisitors').src = "/NewImages/Global_MainNav_Visitors.png";	
  
}


function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }

///////////////////////
// Search Functions //
function Search(SearchText) 
{
    alert(SearchText);
    window.location = "NewSearch.aspx?SearchText=" + SearchText;
}
function HandleSearch(e, text)
{
    var CharCode = e.keyCode? e.keyCode : e.charCode;
    if(CharCode == 13){
    if(text != 'Search' && text != '')
    { 
        document.getElementById('SearchButton').click();
    }
    return false; 
    }else{
    return true;
    }
}




///////////////////////////////
// Toggle Links & Downloads //
function ToggleLinksDownloads(divToShow)
{
	$('#Homepage_MostPopularLinksWrapper').hide();
	$('#Homepage_MostPopularDownloadsWrapper').hide();

	if(divToShow == 'links')
	{
		$('#Homepage_MostPopularLinksWrapper').show();
	}
	else
	{
		$('#Homepage_MostPopularDownloadsWrapper').show();
	}
	
}

function loadingpage() 
{  
var baseurl="http://www.peoriaaz.gov"
//runSlideShow();

        //var txt= document.getElementById("CalList").value;
        //alert(txt);

   
// leaving site alert
		links = document.getElementsByTagName('a');
 		 
		for(i=0; i<links.length; i++)
		{  
		
		if (String(document.links[i].href).search(/peoria|mailto|javascript/i)== -1) {
  			links[i].onclick = function() {alert('You are now leaving the City of Peoria, AZ Website. -  This link will open in a new window');}
  			links[i].target ='_blank'
 			}
 		if (String(document.links[i].href).search(/chamber/i)> 0) {
 		links[i].onclick = function() {alert('You are now leaving the City of Peoria, AZ Website. -  This link will open in a new window');}
  			links[i].target ='_blank'
 		}
	}  
	// -leaving Site end 

 

//var CookieCK=document.cookie.length;
//alert(CookieCK);

     // if(CookieCK>0){
     // setDefaultFontSize();
            
     // }else{
          // changeFont('small_font'); }



}  
// ---------------------------------------------------------------------  
// ------- END loadingpage function - All Onload calls go here -------------   
// --------------------------------------------------------------------- 

