// image rollover
function rollover( imageobj )
{
	var mystring = imageobj.src;
	if( mystring.indexOf( ".gif" ) >= 1)	{ imageobj.src = mystring.replace( /\.gif/gi, '_over.gif' ); }
	else					{ imageobj.src = mystring.replace( /\.jpg/gi, '_over.jpg' ); }
}


// image rollout
function rollout( imageobj )
{
	var mystring = imageobj.src;
	if( mystring.indexOf( ".gif" ) >= 1 )	{ imageobj.src = mystring.replace( /\_over\.gif/gi, '.gif' ); }
	else					{ imageobj.src = mystring.replace( /\_over\.jpg/gi, '.jpg' ); }
}


// fix height of two elements
function fixH(one,two)
{
	if( document.getElementById(one) )
	{
		// get height
		var lh	= document.getElementById(one).offsetHeight;
		var rh	= document.getElementById(two).offsetHeight;
		var nh	= Math.max(lh, rh);
		
		// set height
		document.getElementById(one).style.height	= nh+"px";
		document.getElementById(two).style.height	= nh+"px";
	}
}

// declare variables for dropdown navigation
var sTimer			= new Array();
var currentMenu		= '';

// show drop-down sub navigation
function showSub( i )
{
	// kill timer to hide this menu
	window.clearTimeout( sTimer[currentMenu] );
	window.clearTimeout( sTimer[i] );

	// declare menus
	var thismenu	= document.getElementById( 'dropdown'	+ i );
	var thislabel	= document.getElementById( 'link'		+ i );

	// if the menu we're about to show is different than the menu currently opened, lets close that one first.
	if( currentMenu != '' && currentMenu != i ) { revertSub( currentMenu ); }

	// change the rollover style
	thislabel.className	= 'homehover';

	// show the new menu
	if( thismenu ) { thismenu.style.display = 'block'; }

	// set current menu to this menu
	currentMenu = i;
}

// start a timer to hide the drop down menu if we mouse off of it
function hideSub( i )
{
	sTimer[i] = window.setTimeout("revertSub('" + i + "')", 1000);
}

// hide the drop down menu
function revertSub( i )
{
	// declare local variables
	var thismenu	= document.getElementById( 'dropdown'	+ currentMenu );
	var thislabel	= document.getElementById( 'link'		+ currentMenu );

	// revert the classnames
	thislabel.className	= 'home';

	// hide the menu - only if it exists
	if( thismenu ) { thismenu.style.display = 'none'; }
}