﻿

/* below function overwritten in jquery-topnav.js but sill needed for dropdowns to work in IE6 */

var createMenu = function() {
	var menu = document.getElementById("menu").getElementsByTagName("li");
	for (var i = 0; i < menu.length; i++) {
		menu[i].onmouseover = function() {
			this.className += " hover";
		}
		menu[i].onmouseout = function() {
			//this.className = this.className.replace(new RegExp(" hover\\b"), "");
			if (this.className.indexOf("main_li") != -1) this.className = "main_li";
			if (this.className.indexOf("main_li") == -1) this.className = "";
		}
	}
}

/* preload quicklinks background images */
function preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=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];}}
}

/* homepage staff jump menu */
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* seach field on focus */
function searchFocus(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}

function searchBlur(thefield){
if (thefield.value=="")
thefield.value = thefield.defaultValue
}

window.onload = function() {
	createMenu();
	preloadImages('/images/homepage/bus_over.gif',
				  '/images/homepage/familyaccess_over.gif',
				  '/images/homepage/lunch_over.gif',
				  '/images/homepage/ei_over.gif',
				  '/images/homepage/news_over.gif');
}
