//var webfoldername="/momilani"; //make empty string when deploying on server else use "/momilani/"
//var menufilename="menulocal.txt"; //use menulocal.txt for testing or menuserver.txt for online
var webfoldername=""; //make empty string when deploying on server else use "/momilani/"
var menufilename="menuserver.txt"; //use menulocal.txt for testing or menuserver.txt for online

function loadNavigation()
{
	
	
	var myXMLHttpRequestUtil = new XMLHttpRequestUtil();
	myXMLHttpRequestUtil.returnType = 'Text'; // checkpoint: set to text if want to popup and validate what is sent from server BUT parsing will not work
	myXMLHttpRequestUtil.callback = processLoadNavigation; 
	myXMLHttpRequestUtil.failedCallback = processFailedLoadNavigation;
	var tmpHostname = getHostName();
	var menuURL = tmpHostname + "/" + menufilename;
	//alert(menuURL);
	myXMLHttpRequestUtil.makeRequest(menuURL, '');
	return false;
}

function processLoadNavigation(dataFromServer)
{
	//alert(dataFromServer);
	document.getElementById('myDynamicNavigation').innerHTML = dataFromServer;
	var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryMenuBarDownHover.gif", imgRight:"SpryMenuBarRightHover.gif"});
	
	
}


function processFailedLoadNavigation(statusCode)
{
	
	alert("mrFailed in js method processFailedLoadNavigation()" + statusCode);
	
}


// change the url
function setURLThisSite( newPage )
{
	var tmpHostname = getHostName();
	var resetURL = tmpHostname + "/" + newPage;
	window.location.href = resetURL;	
}

function getHostName()
{
	// determine Hostname, include port number if applicable
	gHostName = window.location.protocol + "//" + window.location.hostname;
	var tmpPort = window.location.port;
	if (tmpPort.length > 0)
		gHostName = gHostName + ":" + tmpPort;
		
	gHostName = gHostName + webfoldername;
		
	return(gHostName);
}

	