

/** Base JS FOR AOH */


    var enableLogging=false;
	// the base url  - used to allow onclicks of html elements to cause proper navigation within site.
	var baseUrl="http://xp:8090/AOH_X/"; //"http://www.andrusonhudson.org/";
	// the dom ids of the navigation elements 
	var navIds=new Array("homeId", "aboutId", "eventsId", "servicesId","contactId");
	//  which menu itme is currently selected / the current page
	var currentNavIndex=0;

	/**
	 * Mouse over for Menu - 
	 * @param elem : the element receiving the action 
	 * @param index : the index in the menu - used for comparison to the current index
	 */
	function mo(elem, index) {
		log(currentNavIndex + " : " + elem.id + " : " + index);
		if(elem && elem!=null  && index !=null && index!=currentNavIndex) {
			elem.setAttribute("className", "menuNavHover");
			elem.className= "menuNavHover";
			log(elem.id + " : " + elem.className);
		}
	}


	/** 
	 * MouseOut for menu
	 * @param elem the element that received the event
	 * @param index the index in the menu - used for comparison to the current index
	 */
	function mout(elem,index){
		if(elem && elem != null && index !=null &&   index!=currentNavIndex){
			elem.setAttribute("className", "menuNav");
			elem.className= "menuNav";
		}
	}


	
	



	/** 
	 * On load,  hilite the menuitem
	 * @param 0 based index the index within the menu - corresponds to navIds array. 
	 */
	function setNav(index) {
		if ( index != null && index <= navIds.length && index >=0) 
			currentNavIndex=index;
			
		for(var i=0; i < navIds.length;i++){
			var elem=document.getElementById(navIds[i]);
			if(elem && elem != null) {
				if( index && index !=null &&  i==index) 
					elem.className= "menuNavHover";
				else
					elem.className= "menuNav";
			}
		}
	}




	/**
	 * Set the Window URL
	 */
	function nav(path){
		if(path && path !=null) 
			window.location.href=baseUrl+path;
	}

	
	function log(str){
		if(enableLogging){
			document.getElementById("log").value+=str+"\n";
		}
	}


