function verifyEmail(emailad) 
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.([a-zA-Z]{2,3}|world)$/;
	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1))
	{
		return false;
	}
}
function ltrim(str)
{
	//        alert (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 FormVal(form)
{
	var today = new Date();
//	var date1 = today.getYear() + "-" + today.getMonth() + "-" + today.getDate() + " " + today.getHours() + ":" + today.getMinutes();
//	var date1 = today.getTime()/1000;
//alert(date);
//	alert(today.toLocaleString());

	var date=today.toLocaleString();
	document.Form.cdate.value = date;
	//var d = new Date();
		//var curr_Time = d.getTime();
		//document.Form.cdate.value=Math.round(curr_Time/1000);

	if (trim(form.name.value) == "")
	{
		alert("Please enter your name.")
		document.Form.name.focus()
		return false;
	}
	if (form.name.value.length > 25)
	{
		alert("Your name is to long, please fix it.")
		document.Form.name.focus()
		return false;
	}
	if (trim(form.email.value) == "")
	{
		alert("Please enter your Email address.")
		document.Form.email.focus()
		return false;
	}
	if (form.email.value.length > 50)
	{
		alert("Your Email address is to long, please fix it.")
		document.Form.email.focus()
		return false;
	}

	if (trim(form.conemail.value) == "")
	{
		alert("Please confirm your Email address.")
		document.Form.conemail.focus()
		return false;
	}
	if (form.conemail.value.length > 50)
	{
		alert("Your Email address is to long, please fix it.")
		document.Form.conemail.focus()
		return false;
	}
	if (form.email.value !=form.conemail.value )
	{
		alert("Please reconfirm your Email address.")
		document.Form.email.focus()
		return false;
	}
	if (verifyEmail(form.email.value) == false) 
	{
		alert("Please enter a valid email.");
		document.Form.email.focus();
		return false;
	}
	if (form.subject.value == "")
	{
		alert("Please enter the subject.")
		document.Form.subject.focus()
		return false;
	}
	if (form.comments.value == "")
	{
		alert("Please enter the Comments.")
		document.Form.comments.focus()
		return false;
	}
}
function popup()
{
	window.open ("email_policy.php","pop","HEIGHT=30,WIDTH=350,screenX=0,screenY=5,status=no, scrollbars=yes, toolbar=no,directories=no,menubar=no,location=no");
}
function mailprivacy()
{
    window.open("email_privacy.php","","toolbar=no, menubar=no,width=400, height=286, status=no",false)
}

