

function formcheck(formobj)

{



var alertMsg = "Please complete the following fields:\n";



var l_Msg = alertMsg.length;



	if (formobj.username.value == "")

	{	alertMsg += " - " + " User Name " + "\n";

	}



	if(formobj.password.value == ""){

		alertMsg += " - " + " Password " + "\n";}



	

	if (alertMsg.length == l_Msg){

		usrpass=formobj.username.value + "|" + formobj.password.value;

		SetCookie("usrpass", usrpass , null, "/");

		SetCookie("navtype", 'first' , null, "/");

		SetCookie("firstId", 1 , null, "/");

		SetCookie("lastId", 10 , null, "/");

		return true;

	}else{

		alert(alertMsg);

		return false;

	}



alert(alertMsg);





}

function SetCookie (name,value,expires,path,domain,secure) {

   document.cookie = name + "=" + escape (value) +

                     ((expires) ? "; expires=" + expires.toGMTString() : "") +

                     ((path) ? "; path=" + path : "") +

                     ((domain) ? "; domain=" + domain : "") +

                     ((secure) ? "; secure" : "");

}


function validation(forgotpass)

{
if (forgotpass.emailid.value == "")
{ alert (" Please Enter Your Email Id.");
forgotpass.emailid.focus();
return(false);

}
if (forgotpass.emailid.value != "")
{
var checkemail = "@.";
var checkstr  = forgotpass.emailid.value;
var emailvalid = false;
var emailat = false;
var emailperiod = false;
for (i=0; i < checkstr.length; i++)
{
ch = checkstr.charAt(i);

for (j=0;  j < checkemail.length; j++)
{
if (ch == checkemail.charAt(j) && ch == "@")
emailat = true;
if (ch == checkemail.charAt(j) && ch == ".")
emailperiod = true;
  
  if (emailat && emailperiod)
      break;
  if (j == checkemail.length)
		break;
         
}
if (emailat && emailperiod)
{
		emailvalid = true
		break;
	}
}
if (!emailvalid)
{
alert("Please Enter a Valid Email ID.");
forgotpass.emailid.focus();
return (false);
}

}


}




