

function verifyEmail(emailad) 
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;
	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1))
	{
		return false;
	}
}
function ltrim(str)
{
	while(""+str.charAt(0)==" ")
	{
		str=str.substring(1,str.length);
	}
	return str;
}
function reverse(str)
{
	var reversedstr = "";
	var strArray;
	strArray = str.split("");
	for(var i = str.length -1 ; i >= 0 ; i--)
	{
		reversedstr += strArray[i];
	}
	return reversedstr;
}
function trim(str)
{
	str = ltrim(str);
	str = reverse(str);
	str = ltrim(str);
	str = reverse(str);
	return str;
}
	
	
	
	

	
	
	
	function validate()
	{
	//		
var a,c,b;
a=document.form1.message.value;
c=a.length;

if(document.form1.name.value=="")
{
alert("Please enter first your name")
document.form1.name.focus();
return false;
}

		
if(document.form1.email.value=="")
{
alert("Please enter your mail Id")
document.form1.email.focus();
return false;
}
		
if (verifyEmail(trim(document.form1.email.value)) == false && trim(document.form1.email.value)!="")
{
document.form1.email.focus();
alert("Your email is incorrect, please check it.");
return false;
}
		
		
	  
if (document.form1.message.value=="")
{
alert("Please enter your Message ")
document.form1.message.focus();
return false;
}


if (c>300)
{
alert("Maximum length of message is 300 ")
document.form1.message.focus();
return false;
		
}


if (document.form1.captcha_code.value=="")
{
alert("Please enter the Confirmation code:")
document.form1.captcha_code.focus();
return false;
}

if (document.form1.captcha_code.value!=document.form1.test.value)
{
alert("Values are not eqaul")
document.form1.captcha_code.focus();
return false;
}



return true;

	}

	function pvalidate()
	{
var pass;

if (document.form2.password.value=="")
{
alert("Please enter the Admin Password")
document.form2.password.focus();
return false;
}



return true;

	}
	