NS4 = (document.layers) ? true : false;

function searchSubmit()
{
	if(document.Form1.searchField.value == "Search")
	{
		return false;
	}
	else
	{
		document.searchForm.qt.value = document.Form1.searchField.value;
		document.searchForm.submit();
	}
}

function searchCheckEnter(evt)
{
    evt = (evt) ? evt : ((window.event) ? window.event : "")

	var code = 0;
	if (NS4)
		code = evt.which;
	else
		code = evt.keyCode;
	if(code == 13)
	{
		searchSubmit();
		evt.preventDefault ? evt.preventDefault() : evt.returnValue = false;
	}
}

function loginCheckEnter(evt)
{
    evt = (evt) ? evt : ((window.event) ? window.event : "")

	var code = 0;

	if (NS4)
		code = evt.which;
	else
		code = evt.keyCode;
	if (code==13)
	{
		submitSignOn();	
		evt.preventDefault ? evt.preventDefault() : evt.returnValue = false;
	}
}

function submitSignOn()
{
	if (validateSignOn()) {
		SignOn();
	}
}

function validateSignOn()
{
	if (document.Form1.username.value == ""){
		alert("Please enter your username");
		document.Form1.username.focus()
		return false;
	}
	if (document.Form1.password.value == ""){
		alert("Please enter your password");
		document.Form1.password.focus()
		return false;
	}
	return true;
}

function SignOn()
{
	document.CTALogin.username.value = document.Form1.username.value;
	document.CTALogin.password.value = document.Form1.password.value;
	document.CTALogin.rememberMe.value = document.Form1.rememberMe.checked;
	document.CTALogin.submit();
}


function EnableBackground(state)
{
	//-- see homePage.aspx for divColTwoTopBeige
	var ctrl = document.getElementById('divColTwoTopBeige');
	
	//-- see style.css for styles declaration
	if(state)
	{
		ctrl.className = 'homeFeatureCopyAltTransparent';
		return;
	}
	
	ctrl.className = 'homeFeatureCopyAlt'; 
	
}


//-- this fixes the flash that overlaps the popup div.
function InitializeDivPopupFrame(divPopup)
{
	if(divPopup == null)
		return;
		
	var frame = document.createElement("iframe");
	
	frame.setAttribute("id", "iframePop");
	document.body.appendChild(frame);
	frame.style.height = divPopup.offsetHeight;
	frame.style.width = divPopup.offsetWidth;
	frame.style.left = divPopup.offsetLeft;
	frame.style.top = divPopup.offsetTop;
	frame.style.display = '';
	frame.style.position = "absolute";
	
}