
function checkreturnkey(e)
  {
    var charCode = (navigator.appName =="Netscape") ? e.which : e.keyCode;
    if (charCode==13)   
      {
        Login()
      }
  }

	function Login()
		{
		   var blnValidate = Validate()
		   if (blnValidate)
		   {
     			__doPostBack('btnLogin','btnLogin_Click')   
		   
		   }   
		}  
		
		function __doPostBack(eventTarget, eventArgument) 
		{
			
				var theform;
				if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
				{  
					theform = document.forms["frmLogin"];                                      
				}
				else 
				{
					theform = document.frmLogin;
				}
				theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
				theform.__EVENTARGUMENT.value = eventArgument;
				theform.submit();
			}
		
		
		function InvalidUser()
		{
			alert('Invalid User Name.')
			document.forms[0].txtLoginName.value = ""
			document.forms[0].txtLoginName.focus()
			
		}
		function Validate()
		  {
				if (document.forms[0].txtLoginName.value == "")
		    {		  
						alert('User Name is Mandatory.')
		        document.forms[0].txtLoginName.focus()
		        return false
		    }
		  
				return true
		}
		function Authenticate()
		{
			alert('Invalid Password.')
		  document.forms[0].txtPassword.value = ""
		  document.forms[0].txtPassword.focus()
		 
		}
		
		function ChangePassword()
		{
				if (document.forms[0].txtLoginName.value == "")
		    {		  
						alert('User Name is mandatory.')
		        document.forms[0].txtLoginName.focus()
		        
		    }
		    else
		    {
		     __doPostBack('btnChangePassword', 'btnChangePassword_Click') 
		    }
			
		}
		
		
			function __doPostBack(eventTarget, eventArgument) 
		{
			
				var theform;
				if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
				{
					theform = document.forms["frmLogin"];
				}
				else 
				{
					theform = document.frmLogin;
				}
				theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
				theform.__EVENTARGUMENT.value = eventArgument;
				theform.submit();
			}
			
			function RedirectChangePassword()
			{
			  var username = document.forms[0].txtLoginName.value
			 	alert("Your Password is NULL.\n Please reset your password in spiProject.")
				/*with(document.forms[0])
					{
						__VIEWSTATE.name = 'VIEWSTATE';
						hidUserId.value= username
						action =  "spikeChangePassword.aspx"
						method = "post"
						target = "_self"
						submit();
					}*/
		  	}   
		
		function ForgotPassword()
		{
		
		if (document.forms[0].txtLoginName.value == "")
	    {		  
						alert('User Name is Mandatory.')
		        document.forms[0].txtLoginName.focus()
		        
		    }
		    else
		    {
					__doPostBack('btnForgotPassword')
		    }
		}


  function clearFields()
  {
   document.forms[0].txtLoginName.value = ""
  }

		
		
		