/* MODULES/FUNCTIONS.JS
 *----------------------------------------------------------------------------*
 * Website: www.KarateProDojo.com
 * Web Design: Festa Technologies
 * Date: 02/25/2007
 *----------------------------------------------------------------------------*
 * Description:
 * This page contains all javascript functions used on the site.
 *----------------------------------------------------------------------------*
 */
 
 /*GLOBAL VARIABLES*/
var menuactive = new Array(2);
menuactive['classmenu']=false;
menuactive['studentmenu']=false;
 
/* HIDE
 *----------------------------------------------------------------------------*
 * Description:
 * This function hides an element of the given id
 *----------------------------------------------------------------------------*
 * Incoming Variables:
 * id		: The id of the element to hide
 *----------------------------------------------------------------------------*
 * Output:
 * Hides the element
 *----------------------------------------------------------------------------*
 */
function hide(id){
	document.getElementById(id).style.display="none";
}
 
/* HOVER
 *----------------------------------------------------------------------------*
 * Description:
 * This function changes the style sheet of an element to the same name
 * with 'hover' at the end of the className.
 * It is used to simulate the :hover attribute of CSS because IE doesn't
 * support that feature.
 *----------------------------------------------------------------------------*
 * Incoming Variables:
 * elmnt	: The element to change the className of
 *----------------------------------------------------------------------------*
 * Output:
 * Classname of element is appended with 'hover'
 *----------------------------------------------------------------------------*
 */
function hover(elmnt){
	name = elmnt.className;
	highlighted = false;
	if(name.length>5){
		if(name.substr(name.length-5,name.length)=='hover'){
			highlighted = true;
		}
	}
	if(!highlighted){
		elmnt.className = elmnt.className+'hover';
	}
}

/* SHOW
 *----------------------------------------------------------------------------*
 * Description:
 * This function shows an element of the given id
 *----------------------------------------------------------------------------*
 * Incoming Variables:
 * id		: The id of the element to show
 *----------------------------------------------------------------------------*
 * Output:
 * Makes the element visible
 *----------------------------------------------------------------------------*
 */
function show(id){
	if(menuactive[id]){
		clearTimeout(menuactive[id]);
		menuactive[id]=false;
	}
	document.getElementById(id).style.display="block";
}

/* UNHOVER
 *----------------------------------------------------------------------------*
 * Description:
 * This function changes the style sheet of an element back to its original
 * className, by removing the 'hover' that was added by the function HOVER
 * It is used to simulate the :hover attribute of CSS because IE doesn't
 * support that feature.
 *----------------------------------------------------------------------------*
 * Incoming Variables:
 * elmnt	: The element to change the className of
 *----------------------------------------------------------------------------*
 * Output:
 * Classname of element is restored to remove 'hover'
 *----------------------------------------------------------------------------*
 */
function unhover(elmnt){
	name = elmnt.className;
	if(name.length>5){
		if(name.substr(name.length-5,name.length)=='hover'){
			elmnt.className = name.substr(0,name.length-5);
		}
	}
}

/* WAIT HIDE
 *----------------------------------------------------------------------------*
 * Description:
 * This function waits the specified amount of time and hides the element
 *----------------------------------------------------------------------------*
 * Incoming Variables:
 * id		: The id of the element to hide
 * time		: Time in miliseconds to wait
 *----------------------------------------------------------------------------*
 * Output:
 * Hides the element after 'time' miliseconds
 *----------------------------------------------------------------------------*
 */
function waithide(id, time){
	menuactive[id] = setTimeout("hide('"+id+"')",time);
}