function echeck(str) 
{
	var at = "@";
	var dot = ".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1) {
		alert("Invalid Email Address");
		return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("Invalid Email Address");
		return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid Email Address");
		return false;
	}
	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid Email Address");
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid Email Address");
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid Email Address");
		return false;
	}
	if (str.indexOf(" ")!=-1){
		alert("Invalid Email Address");
		return false;
	}
	return true;
}

function checkval()
{
	if(document.advForm.title.value=="")
	{
		alert("Please mention title here");
		document.advForm.title.focus();
		return false;
	}
	if(document.advForm.url.value=="http://")
	{
		alert("Please mention url here");
		document.advForm.url.focus();
		return false;
	}
	if(document.advForm.Category.value=="select")
	{
		alert("Please select one Category here");
		document.advForm.Category.focus();
		return false;
	}
	if(document.advForm.description.value=="")
	{
		alert("Please mention description here");
		document.advForm.description.focus();
		return false;
	}
	if(document.advForm.contact_name.value=="")
	{
		alert("Please mention contact name here");
		document.advForm.contact_name.focus();
		return false;
	}
	if(document.advForm.contact_email.value=="")
	{
		alert("Please mention contact email here");
		document.advForm.contact_email.focus();
		return false;
	}
	if (echeck(document.advForm.contact_email.value)==false)
	{
		document.advForm.contact_email.focus();
		return false;
	}
	if (document.advForm.Category.selectedIndex<=0 && document.advForm.other_category.value == "")
	{
		    alert("Please select category");
			document.advForm.Category.focus();
			return false	    		
	}
	return true;
}
