// JavaScript Document
/*function submitForm()
{
//alert("Dileep");
	if(mandatoryfill())
	{
	document.login.submit();

	}
}*/
	function loginValidate()
	{	
	
		var f1=document.login;	
		//alert("Dileep:: "+f1.userId.value);
		if(f1.userId.value=="")
		{
			alert("please Enter the username");
			f1.userId.focus();
			return false;
		}
		else if(f1.pass.value=="")
		{
			alert("Please Enter the password");
  			f1.pass.focus();
 			return false;
		}
		/*else if(/^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$/.test(f1.pass.value))
		{
			return true;
		}
		else
		{
			alert("Please fill the password ::: "+f1.pass.value);
  			f1.pass.focus();
 			return false;
		}*/
		
		return true;
 	}
	function submitOnPress(ev)
	{   
	   var key=ev.keyCode;
	   if(key==13 && mandatoryfill())
	{
		document.login.submit();
	}
	
}

var xmlHttp;
function createXMLHttpRequest()
{
	if (window.ActiveXObject) 
		{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	else if (window.XMLHttpRequest) 
		{
		xmlHttp = new XMLHttpRequest();
		}
}


function forgotPassword()
{
//alert("Dileep");
   //var type="A";
	createXMLHttpRequest();
	//var type=document.getElementById("type").value;
	var userId=document.getElementById("userId").value;
	//alert(type);
	//alert(userId);
	if(userId==null || userId=='')
	{
		alert('Please Enter Your User Id ');
		document.getElementById("userId").focus();
		return false;
	}
	//var type=document.getElementById("userId").value;
	xmlHttp.onreadystatechange = getAgentDetails;
	//alert("dileep");
	xmlHttp.open("POST","doLoginAction.do?param=forgotPass&user_id="+userId, true);
	xmlHttp.send(null);

}
function getAgentDetails()
{
	if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
			{
				var response1=xmlHttp.responseText;
				alert(response1);
			}
		}
}



function showOfficeIdTextBox()
{	
//alert("Dileep");
	if(document.getElementById("offText").style.display=="none")
	{
		document.getElementById("offText").style.display="";
		document.login.officeId.focus();
	}
	else
	{
		document.getElementById("offText").style.display="none";
		document.login.userId.focus();	
	}
		
}

function setCursor()
{
	//alert("Dileep");
	document.login.userId.focus();	
}
