// JavaScript Document
function loginvalid(){
	if(document.loginform.email.value==""){
		alert("Please enter the username");
		document.loginform.email.focus();
		return false;		
	}
	
	if(document.loginform.pass.value==""){
		alert("Please enter the username");
		document.loginform.pass.focus();
		return false;
	}
	return true;
}
function registration_valid()
{
	
	var form=document.regform; //form object
	if(form.username.value==""){
		alert ("First name should not be blank ");
		form.username.focus();
		return;
	}
	
	if(form.firstname.value==""){
		alert ("First name should not be blank ");
		form.firstname.focus();
		return;
	}
	if(form.lname.value==""){
		alert ("Last name should not be blank !");
		form.lname.focus();
		return;
	}
	
	if(form.pass.value==''){
		alert('Password should not be blank ');
		form.pass.focus();
		return;
	}
	if(form.pass.value.length < 5){
		alert('Password must be 5 characters ');
		form.username.focus();
		return;
	}
	if(form.pass.value!=form.repass.value){
		alert('Both password are not matched ');
		form.pass.focus();
		return;
	}

	if(form.email.value=="")
	{
		alert ("Email Address should not be blank");
		form.email.focus();
		return;
		}
	if(checkEmail(form.email.value)==false)
	  {
		alert ("Enter valid Email Address ");
		form.email.value="";
		form.email.focus();
		return;
		}
	if(form.email.value != form.reemail.value)
		{
		alert("Email and Confirm Email are not same");
		form.reemail.value="";
		form.reemail.focus();
		return;
	}	
	form.posted.value='1';
	form.submit();	
}
function checkEmail(form) 
{
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form))
	{
	return true;
	}
	return false;
	return true;
}

