// JavaScript Document

var menu_img1=new Image();
var menu_img2=new Image();
var menu_img3=new Image();

menu_img1.src="wp-content/themes/cu/images/structure/cu_menu_left_h.png";
menu_img2.src="wp-content/themes/cu/images/structure/cu_menu_middle_h.png";
menu_img3.src="wp-content/themes/cu/images/structure/cu_menu_right_h.png";

var menuHighlightLeft="url('wp-content/themes/cu/images/structure/cu_menu_left_h.png') left no-repeat";
var menuHighlightMiddle="url('wp-content/themes/cu/images/structure/cu_menu_middle_h.png') center repeat-x";
var menuHighlightRight="url('wp-content/themes/cu/images/structure/cu_menu_right_h.png') right no-repeat";
var menuUnhilightLeft="url('wp-content/themes/cu/images/structure/cu_menu_left_u.png') left no-repeat";
var menuUnhilightMiddle="url('wp-content/themes/cu/images/structure/cu_menu_middle_u.png') center repeat-x";
var menuUnhilightRight="url('wp-content/themes/cu/images/structure/cu_menu_right_u.png') right no-repeat";

var menuHighlightLink="#ffffff";
var menuUnhilightLink="#005889";

//Settings
var menuID="cu-menu"; //Menu

//Fires when the mouse moves onto an element
function onMouseOverLiEvt(){
	var subDivs=this.getElementsByTagName("DIV");
	subDivs[0].style.background=menuHighlightLeft;
	subDivs[1].style.background=menuHighlightMiddle;
	subDivs[2].style.background=menuHighlightRight;
	this.getElementsByTagName("A")[0].style.color=menuHighlightLink;
}
//Fires when the mouse moves away from an element
function onMouseOutLiEvt(){
	var subDivs=this.getElementsByTagName("DIV");
	subDivs[0].style.background=menuUnhilightLeft;
	subDivs[1].style.background=menuUnhilightMiddle;
	subDivs[2].style.background=menuUnhilightRight;
	this.getElementsByTagName("A")[0].style.color=menuUnhilightLink;
}
function getChildrenByTagName(ref,name){
	var children=ref.childNodes;var tags=new Array();var i=0;
	while(children.length>i){
		if(children[i].tagName==name)tags.push(children[i]);i++;}
	return tags;
}
//Registers events
function menuInit(){
	var menu=document.getElementById(menuID);
	var LIs=menu.getElementsByTagName("LI");var i=0;
	var menuDIVs=getChildrenByTagName(menu,"DIV");
	while(LIs.length>i){LIs[i].onmouseover=onMouseOverLiEvt;
		LIs[i].onmouseout=onMouseOutLiEvt;i++;}
	i=0;
	while(menuDIVs.length>i){menuDIVs[i].onmouseover=onMouseOverLiEvt;
		menuDIVs[i].onmouseout=onMouseOutLiEvt;i++;}
}

