// new
var _haveFocus = false;
function checkSubmit()
{	
	if(isIE()){
	/* because we want to login with the keypress 'enter' */
		var strActiveElementID = document.activeElement.id;
		if(strActiveElementID == 'IbtnLogin')
		{
			//oElement = setFocus(strActiveElementID);
			//oElement.click();		
			return false;
		}else{
			return true;
		}	
	}else
	{
		if(_haveFocus){
		return false;
		}else{
		return true;
		}
	}	
}

function getForm()
{
	var oForm;
	if (isIE())
	{
			oForm = document.Form1;
	}else 
	{
			oForm = document.forms["Form1"];
	}
	return oForm;	
}
function isIE()
{
	return (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1);
}
function SetEventHandlers(){
  //BK
  var oForm = getForm();
  if(oForm != null){
	oForm.onsubmit = checkSubmit;
	}
	
  return;
}

function setFocus(strFieldID){
	var oElement = null;
	if (strFieldID != "")
	{
	   oElement = document.getElementById(strFieldID);
	   if (oElement!=null){
	 	  try{
		  	  while(document.activeElement.id != strFieldID)
			  		oElement.focus();
		  }catch(e){}
	   }
	} 
	return oElement;
}
// org
function clearText(objTxt)
{
	objTxt.value = "";
}
function initPage()
{
	oPass = document.getElementById('txtpassword');
	oPass.value = "Password";
	
	//new
	SetEventHandlers();
}

function LisaLogin(https, url)
{
	if(https)
		url = "https://" + url
	else
		url = "http://" + url
	
	
	var oForm = getNewForm("frmlogin",url);		
		document.body.appendChild(oForm);
		oForm.insertBefore(getHiddenInputElement("user",document.getElementById('txtuser').value), oForm.firstChild);
		oForm.insertBefore(getHiddenInputElement("password",document.getElementById('txtpassword').value), oForm.firstChild);
		oForm.submit();	
}
function getNewForm(strName, strAction)
{
	var oForm = document.createElement("FORM");
		oForm.id = strName ;
		oForm.method = "post";
		oForm.target = "_self";
		oForm.action = strAction;
	return oForm;
}
function getHiddenInputElement(strName, value)
{
	var oElement = document.createElement("INPUT");
		oElement.type = "hidden";
		oElement.name = strName;
		oElement.value = value;
	return oElement;
}

