
function validationcal()
	{
	
	if(document.getElementById('res_type').value=='1')
	{
		alert("Please Choose The Type of Listing");
		document.cal.res_type.focus();
		return false;
	}
	if(document.getElementById('company_name').value=="")
		{
		alert("Please Enter Your Company Name");
		document.cal.company_name.focus();
		return false;
		}
	if(document.getElementById('contact_name').value=="")
		{
		alert("Please Enter Your Contact Name");
		document.cal.contact_name.focus();
		return false;
		}
	if(document.getElementById('classifed_address').value=="")
		{
		alert("Please Enter The Address ");
		document.cal.classifed_address.focus();
		return false;
		}
	if(document.getElementById('city').value=='0')
		{
		alert("Please Choose The City ");
		document.cal.city.focus();
		return false;
		}
	if(document.getElementById('classified_country').value=='0')
		{
		alert("Please Choose The Country");
		document.cal.classified_country.focus();
		return false;
		}
	if(document.getElementById('classified_zip').value=="")
		{
		alert("Please Enter The Zip Code");
		document.cal.classified_zip.focus();
		return false;
		}
		
		var string=document.getElementById('classified_zip').value;
		   
   // var string=document.product_details.quentity.value;
  if(string.length > 7)
	{    	
            alert("Please Provide Only 5-7 Character ");
       	    document.cal.classified_zip.focus();
            document.cal.classified_zip.value="";
            return false;
     	}
	if(document.getElementById('phone').value=="")
		{
		alert("Please Enter The Phone");
		document.cal.phone.value="";
		document.cal.phone.focus();
		return false;
		}
		
		var string=document.getElementById('phone').value;
		    var Chars = "0123456789";
   // var string=document.product_details.quentity.value;
  if(string.length >4)
	{
    	for (var i = 0; i < string.length; i++)
    	{
       
       		if (Chars.indexOf(string.charAt(i)) == -1)
       		{
            alert("Please Provide Only Numeric values");
       	    document.cal.phone.focus();
            document.cal.phone.value="";
            return false;
       		}
    	}
	}	
	
	if(document.getElementById('classified_email').value=="")
		{
		alert("Please Enter The Email");
		document.cal.classified_email.focus();
		return false;
		}
		
	 if (document.getElementById('classified_comp_desc').value == "")
		{    
	    alert("Please Enter The  Company Description");
		return false;
    	}
	
	 if (document.getElementByID('tandc0').value != 1)
		{    
	    alert("Accept Terms of Services");
		return false;
    	}
	
	
	}
	
function check(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");
		   document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		     alert("Invalid Email Address");
			 document.cal.classified_email.value="";
			 document.cal.classified_email.focus();
		   return false;
		}


		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		   alert("Invalid Email Address");
		   document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		      alert("Invalid Email Address");
			  document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		      alert("Invalid Email Address");
			  document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address");
			document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email Address");
			document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		 }
		 
}		 

function valid()
  {
  	
		if(document.getElementById('ad_type').value=='1')
	{
		alert("Please Choose The Type of Listing");
		document.ad.ad_type.focus();
		return false;
	}
	if(document.getElementById('ad_company_name').value=="")
		{
		alert("Please Enter Your Company Name");
		document.ad.ad_company_name.focus();
		return false;
		}
	if(document.getElementById('contact_name').value=="")
		{
		alert("Please Enter Your Contact Name");
		document.ad.contact_name.focus();
		return false;
		}
	if(document.getElementById('title').value=="")
		{
		alert("Please Enter The Title");
		document.ad.title.focus();
		return false;
		}
	if(document.getElementById('address').value=="")
		{
		alert("Please Enter The Address");
		document.ad.address.focus();
		return false;
		}
    if(document.getElementById('city').value=='0')
	   {
		alert("Please Choose The Type of Listing");
		document.ad.city.focus();
		return false;
	   }
	   
	   	if(document.getElementById('ad_tel').value=="")
		{
		alert("Please Enter The Phone");
		document.ad.ad_tel.value="";
		document.ad.ad_tel.focus();
		return false;
		}
		
		var string=document.getElementById('ad_tel').value;
		    var Chars = "0123456789";
   // var string=document.product_details.quentity.value;
  if(string.length >4)
	{
    	for (var i = 0; i < string.length; i++)
    	{
       
       		if (Chars.indexOf(string.charAt(i)) == -1)
       		{
            alert("Please Provide Only Numeric values");
       	    document.ad.ad_tel.focus();
            document.ad.ad_tel.value="";
            return false;
       		}
    	}
	}	
	
	if(document.getElementById('ad_zip').value=="")
		{
		alert("Please Enter The Zip Code");
		document.cal.ad_zip.focus();
		return false;
		}
		
		var string=document.getElementById('ad_zip').value;
		    var Chars = "0123456789";
   // var string=document.product_details.quentity.value;
  if(string.length >7)
	{
    	
            alert("Please Provide Only 5-7 Character");
       	    document.ad.ad_zip.focus();
            document.ad.ad_zip.value="";
            return false;
       	
	}
	
	
	var str=document.getElementByID('ad_email').value;
	
	 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");
		   document.ad.ad_email.value="";
		   document.ad.ad_email.focus();
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		     alert("Invalid Email Address");
			 document.ad.ad_email.value="";
			 document.ad.ad_email.focus();
		   return false;
		}


		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		   alert("Invalid Email Address");
		   document.ad.ad_email.value="";
		   document.ad.ad_email.focus();
		     return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		      alert("Invalid Email Address");
			  document.ad.ad_email.value="";
		   document.ad.ad_email.focus();
		     return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		      alert("Invalid Email Address");
			  document.ad.ad_email.value="";
		   document.ad.ad_email.focus();
		     return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address");
			document.cal.classified_email.value="";
		   document.cal.classified_email.focus();
		     return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email Address");
			document.ad.ad_email.value="";
		   document.ad.ad_email.focus();
		     return false;
		 }
		 if(document.getElementById('comp_desc').value=="")
		{
		alert("Please Enter The Zip Code");
		document.ad.comp_desc.focus();
		return false;
		}
	
	   
 }
