// navigation rollover functions
function menu_over(which){
	document.images[which].src = nav_ar[which]['on'].src;
}

function menu_out(which){
	document.images[which].src = nav_ar[which]['off'].src;
}


// load navigation page rollovers
function navRO(){
	nav_ar = new Array();
	for (var i=0;i<arguments.length;i++){
		nav_ar[arguments[i]] = new Array();
		nav_ar[arguments[i]]['off']=new Image();
		nav_ar[arguments[i]]['on']=new Image();
		nav_ar[arguments[i]]['off'].src="uploads/images/structure/nav_"+arguments[i]+".gif";
		nav_ar[arguments[i]]['on'].src="uploads/images/structure/nav_"+arguments[i]+"-on.gif";
	}
}

navRO("services","glossary","about","rates","books","contact");



// function for poking a new property value into a DOM element;
	// used here to toggle the visibility of the floating definition "window"
	function setIdProperty( id, property, value )
	{
		var styleObject = document.getElementById( id );
		if (styleObject != null)
		{
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}

	var timeoutID;

	// function triggered by glossary term mouseover events does the core
	// work of positioning the definition "window" for the particular browser
	// in use and enables its visibility
	function showDiv( domId )
	{
		var theWidth = 0
		var theHeight = 0
		var yOffset = 0
		
		// Try to get the yoffset...
		if (window.pageYOffset)
		{
			yOffset = window.pageYOffset
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
			yOffset = document.documentElement.scrollTop
		}
		else if (document.body)
		{
			yOffset = document.body.scrollTop
		}
		
		// Try to get the "inner width" and "inner height"
		if (window.innerWidth)
		{
			theWidth = window.innerWidth
			theHeight = window.innerHeight
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			theWidth = document.documentElement.clientWidth
			theHeight = document.documentElement.clientHeight
		}
		else if (document.body)
		{
			theWidth = document.body.clientWidth
			theHeight = document.body.clientHeight
		}
		
		var left = (theWidth-500)/2 + "px"
		var top = (theHeight-200)/2 + yOffset + "px"
		
		setIdProperty( domId, "left", left )
		setIdProperty( domId, "top", top )	
		
		// timeout delay
		timeoutID = window.setTimeout( 'setIdProperty( "'+ domId + '", "visibility", "visible" );', 500 );
	}

	// handles hiding the definition "window" when the mouse moves off the term
	function hideDiv( domId )
	{
	
		// cancel the dely on the show code
		window.clearTimeout(timeoutID);
		
		setIdProperty( domId, "visibility", "hidden" );
	}
