// JavaScript Document

// initialise two objects for the menu
var listMenu = new FSMenu('listMenu', true, 'visibility', 'visible', 'hidden');
var listMenu_HotelLocator = new FSMenu('listMenu_HotelLocator', true, 'visibility', 'visible', 'hidden');


// generate the expand indicator
var arrow = null;
if (document.createElement && document.documentElement)
{
	arrow = document.createElement('span');
	//arrow.appendChild(document.createTextNode('»'));
	arrow.className = 'subind';
}


// add the function to be called during load event
addEvent(window, 'load', new Function('listMenu.activateMenu("listMenuRoot", arrow)'));
addEvent(window, 'load', new Function('listMenu_HotelLocator.activateMenu("listMenuRoot_HotelLocator", arrow)'));
addEvent(window, 'load', new Function('DocLoaded()'));


// the auto adjust for the menu
function adjustFloatingMenu(menuID)
{
	var objDoc;
	var documentTop = 0;
	var newTop = 0;
	
	
	// the initial top position of the menu
	var initialTop = 155;
	var currentTop = 0;
	
	
	// retrieve all the information needed to calculate new position
	documentTop = document.body.scrollTop;
	objDoc = document.getElementById(menuID);
	currentTop = objDoc.style.top;
	bannerHeight = 175;
	if(documentTop<bannerHeight){
		newTop = initialTop;
	}else{
		newTop = documentTop;		
	}
	/*
			newTop = documentTop + initialTop;		
	*/
	
	
	
	// only update the style when is not same
	if (currentTop != newTop) {
		objDoc.style.top = newTop;
	}
}

function DocLoaded()
{	
	//position: absolute; left: 630px; top: 175px;
	var objRightPanel = document.getElementById("floatingMenu2");
	
	// minor manual overide 
	// the right panel's left position
	// on specified browser
	var sUserAgent = navigator.userAgent;
	
	
	// Opera
	if (sUserAgent.indexOf("Opera") != -1)
	{
		objRightPanel.style.left = '615px';
	}
	
	// netscape
	else if (sUserAgent.indexOf("Netscape") != -1)
	{
		// no adjustment
	}
	
	// mozila 1.4
	else if (sUserAgent.indexOf("rv:1.4.1") != -1)
	{
		objRightPanel.style.left = '633px';
	}
	
	 // is MSIE
	else if (sUserAgent.indexOf("MSIE") != -1)
	{
		// no adjustment
	}
	
	
	setInterval("adjustFloatingMenu('floatingMenu')",200);
	setInterval("adjustFloatingMenu('floatingMenu2')",200);
}
