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, "/");

		
		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(loginform)

{

if (loginform.first.value == "")
{ alert (" Please Enter Your First Name.");
loginform.first.focus();
return(false);

}
if (loginform.username.value == "")
{ alert (" Please Enter a User Name.");
loginform.username.focus();
return(false);

}
if (loginform.password.value == "")
{ alert (" Please Enter Your Password.");
loginform.password.focus();
return(false);

}


if (loginform.rpass.value == "")
{ alert (" Please Repeat your password.");
loginform.rpass.focus();
return(false);

}

if (loginform.password.value != loginform.rpass.value)
{
alert ("Your Password Fields do not match. Recheck!.");
loginform.rpass.focus();
return (false);
}

if (loginform.email.value != "")
{
var checkemail = "@.";
var checkstr  = loginform.email.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.");
loginform.email.focus();
return (false);
}

}
if (loginform.address1.value == "")
{ alert (" Please your address.");
loginform.address1.focus();
return(false);

}
if (loginform.city.value == "")
{ alert (" Please enter your city name.");
loginform.city.focus();
return(false);

}
if (loginform.state.value == "")
{ alert (" Please select your state.");
loginform.state.focus();
return(false);

}

if (loginform.zipcode.value == "")
{ alert (" Please Enter your Zip code.");
loginform.zipcode.focus();
return(false);

}

}
