 
if (document.all)
{
	document.onkeypress = submitOnEnter;
}

function submitOnEnter()
{
	if (window.event.keyCode == 13)
	{
		window.event.returnValue = false;
		if (parent.navFrame !=null)
		{
			doRefresh();		
		}
		esSubmit();	
	}
} 
function doRefresh()
{
	//alert(sLang);				
	var now = new Date(); 	
	var loggedTime = now.getMonth() + "-" + now.getDate() + "-" + now.getFullYear() + "_" + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
	SetCookieSub("FleetLoginUser", "UserName", escape(parent.mainFrame.document.getElementById('username').value), null, "/", null, false);			
	SetCookieSub("FLEETSTARLASTUSER", "LoggedTime", escape(loggedTime), null, "/", null, false);			
	parent.navFrame.location.href="header.asp?style=user&lang=" + sLang;		
	parent.navFrame.document.getElementById('CSS').href = 'media/rebranding.asp?Id=' + loggedTime;				
	parent.bottomFrame.location.href="footer.asp?style=user&lang=" + sLang;					
	parent.bottomFrame.document.getElementById('CSS').href = 'media/rebranding.asp?Id=' + loggedTime;				
}
function changeLang(newLang)
{		
	document.all.save.disabled = true;
	document.all.username.disabled = true;
	document.all.password.disabled = true;		
	parent.navFrame.location.href = "header.asp?lang=" + newLang;
	parent.bottomFrame.location.href = "footer.asp?lang=" + newLang;
	location.href = "main.asp?lang=" + newLang;
}

function mainInit()
{
	parent.navFrame.showNav('hide');
	parent.bottomFrame.showLogout('hide');
	parent.bottomFrame.showUsername('');
	parent.bottomFrame.fleetNameDisplay.innerHTML = "";
	parent.navFrame.landscapeImg.style.display = 'block';	
	var sUserName = getCookieSub("FLEETSTARLASTUSER", "Name");
		
	if (sLang.length > 0)
	{
		if (document.all(sLang)) document.all(sLang).checked = true
	}
	else
	{
		if (document.all.en) document.all.en.checked = true;
	}
	
	
	if (sUserName.length > 0) 
	{
		document.all.username.value = unescape(sUserName);
		document.all.password.focus();  
	}
	else
		document.all.username.focus();

	if (sReturnMsg != "")
	{
		document.all.ReturnMsg.innerHTML = sReturnMsg + "<br/>";
		document.all.ReturnMsg1.style.display = "block";
		document.all.ReturnMsg2.style.display = "block";
		document.all.tdSpace.style.display = "none";
	}
	
	if (sContactMsg != "")
	{
		document.all.ContactMsg.innerHTML = sContactMsg;
		document.all.tdSpace.style.display = "none";
		//document.all.ContactMsg1.style.display = "block";
	}	

	var url = window.location.href;
	if ((url.indexOf("http://www.fordfleettelematics") == -1) && (url.indexOf("http://www.fleetstar-avl") == -1)) //URL is NOT Ford or AVL, so show the language options.
	{
		document.all.LanguageTitle.style.visibility = "visible";
		document.all.LanguageOptions.style.visibility = "visible";
	}
}
/*
function moreNews(newsID,newsURL)
{
	
	var URL = "";
	
	if (newsURL != "")
		URL = newsURL;
	else
		URL = "newsMore.asp?newsID=" + newsID;
	
	var obj = window.open(URL, 'frmNews','location=no,scrollbars=yes,menubar=no,toolbar=no,width=1000,height=700,resizable=yes');
	obj.focus();
}
*/
//Following is Aspire's code
function moreNews(newsID, companyID, newsURL)
{
	var URL = "";
	
	if (newsURL != "")
		URL = newsURL;
	else
		URL = "newsMore.asp?newsID=" + newsID;
	
	{
		URL = "newsMore.asp?newsID=" + newsID + "&DetailID=" + companyID;		
	}
	var obj = window.open(URL, 'frmNews','location=no,scrollbars=yes,menubar=no,toolbar=no,width=1000,height=700,resizable=yes');
	obj.focus();
}

