var g_delayOutTimer = null;
			
var g_delayOutID = null;
		
var g_topMenuItemIDList = [ "subMenuCompany", "subMenuProducts", "subMenuPressRelease", "subMenuSupport", "subMenuBuyNow", "subMenuContactUs" ];

var g_deltaNormal = [ 268, 82, 150, 125, 0, 0 ];

var g_deltaSubZero = [  0, 77, 150, 125, 0, 0 ];
	
			
function OnHighLight( object, colorRef )
{
	stl = GetStyle( object.id );
				
	stl.background = colorRef;
				
	return 0;
			
}
			
function GetMenuXPos()
{
	var wide = 0;
				
	if ( window.innerWidth != null )
	{
		wide = window.innerWidth;
	}				
	else
	{
		wide = document.body.clientWidth;
	}
				
	return (wide / 2);			
}
			
function SetDelayedOut( objectID )
{
	if ( g_delayOutID != null ) {
					
		window.clearTimeout( g_delayOutTimer );
					
		ChangeBlock( objectID, false );
					
	}
									
	g_delayOutID = objectID;
				
	g_delayOutTimer = window.setTimeout( KillPopups, 2000 );
				
	if ( g_delayOutTimer == null ) 
	{
		g_delayOutID = null;
	}

	return 0;
			
}
			
function KillPopups()
{

	var count = 0;

	if ( g_delayOutTimer != null )
	{
		window.clearTimeout( g_delayOutTimer );
		
		g_delayOutTimer = null;
	}
		
	for ( count = 0; count < (g_topMenuItemIDList.length); count++ )
	{	
		ChangeBlock( g_topMenuItemIDList[count], false );
					
		g_delayOutID = null;
	}
				
	return 0;
			
}
			

function StartPopup( objectID )
{
	KillPopups();
				
	ChangeBlock( objectID, true );
				
	return 0;
			
}


function PlaceTopMenuGroups()
{
	
	var count = 0;

	var bSubZero = false;
				
	var pos = GetMenuXPos() - g_deltaNormal[0];
				
	if ( pos < 0 ) { pos = 0; bSubZero = true; }
				
	stl = GetStyle( g_topMenuItemIDList[0] )
				
	stl.left = pos;
		
	for ( count = 1; count < (g_topMenuItemIDList.length); count++ )
	{
		if ( bSubZero ) { pos += g_deltaSubZero[count]; } else { pos += g_deltaNormal[count]; }							
				
		stl = GetStyle( g_topMenuItemIDList[count] )
				
		stl.left = pos;	
	}
				
	return 0;
			
}

window.onresize = function RunOnResize()
{
	return PlaceTopMenuGroups();
}


function BuyNow( formName ) { 

	if ( document.forms[formName] ) document.forms[formName].submit();
			
	else alert( "unable to submit form." );
	
	return false;

}