// Validating the Contact Us Form
function ContactCheck() {
	d = document.cntctus;

	if (d.AdTitle.value.length<2) {
	   alert("Please enter the Ad Title...");
	   d.AdTitle.select();
	   d.AdTitle.focus();
           return false;
	}
	
	if (d.AdTitle.value.length>100) {
	   alert("Ad Title should be less than 100 characters");
	   d.AdTitle.select();
	   d.AdTitle.focus();
           return false;
	}


	if (d.AdTitle.value.charAt(0) == " " ) {
	   alert("Please enter the Ad Title...");
	   d.AdTitle.select();
	   d.AdTitle.focus();
           return false;
	}
	
		if (d.Ad_Content.value.length < 5) {
		alert("Please enter the Your Ad Content... ");
  		d.Ad_Content.focus();
		d.Ad_Content.select();
		return false;
        } 
        if (d.Ad_Content.value.length >1000) {
		alert("Ad Content should be less than 1000 characters");
  		d.Ad_Content.focus();
		d.Ad_Content.select();
		return false;
        }
	if (d.Ad_Content.value.charAt(0) == " "){
		alert("Please enter the Your Ad Content... ");
  		d.Ad_Content.focus();
		d.Ad_Content.select();
		return false;
         }
	 if (d.Company.value.length >50) {
		alert("Company should be less than 50 characters");
  		d.Company.focus();
		d.Company.select();
		return false;
        }

/*	if (d.Contact_Person.value.length<2) {
	   alert("Please enter the Contact Person...");
	   d.Contact_Person.select();
	   d.Contact_Person.focus();
           return false;
	}if (d.Contact_Person.value.charAt(0) == " " ) {
	   alert("Please enter the Contact Person...");
	   d.Contact_Person.select();
	   d.Contact_Person.focus();
           return false;
	}*/
if (d.Contact_Person.value.length>50) {
	   alert("Contact Person should be less than 50 characters");
	   d.Contact_Person.select();
	   d.Contact_Person.focus();
           return false;
	}
	
 if (d.Address.value.length<2) {
	   alert("Please enter the Address...");
	   d.Address.select();
	   d.Address.focus();
           return false;
	}
	if (d.Address.value.length>200) {
	   alert("Address should be less than 200 characters");
	   d.Address.select();
	   d.Address.focus();
           return false;
	}
	if (d.Address.value.charAt(0) == " " ) {
	   alert("Please enter the Address...");
	   d.Address.select();
	   d.Address.focus();
           return false;
	}
	if (d.Area.value.length>50) {
	   alert("Area should be less than 50 characters");
	   d.Area.select();
	   d.Area.focus();
           return false;
	}
	if (d.City.value.length>50) {
	   alert("City should be less than 50 characters");
	   d.City.select();
	   d.City.focus();
           return false;
	}
if (d.Zip_Code.value.length>6) {
	   alert("Zip_Code should be in 6 characters");
	   d.Zip_Code.select();
	   d.Zip_Code.focus();
           return false;
	}
	if (d.Phone.value.length>50) {
	   alert("Phone should be less than 50 characters");
	   d.Phone.select();
	   d.Phone.focus();
           return false;
	}
	if( (d.Mobile.value.length<6)  ) {
		alert("Please enter the Mobile No... ");
  		d.Mobile.focus();
		d.Mobile.select();
		return false;
        } 
if (d.Mobile.value.length>50) {
	   alert("Mobile No. should be less than 50 characters");
	   d.Mobile.select();
	   d.Mobile.focus();
           return false;
	}

	if (d.Mobile.value.charAt(0) == " "){
		alert("Please enter the Mobile No...");
  		d.Mobile.focus();
		d.Mobile.select();
		return false;
        }

if (d.Website.value.length>50) {
	   alert("Website should be less than 50 characters");
	   d.Website.select();
	   d.Website.focus();
           return false;
	}
	if (d.Email.value.length<4){
		alert("Please enter your Email-ID");
  		d.Email.focus();
		d.Email.select();
		return false;
        }
    	if(d.Email.value.indexOf('@')<1){
		alert("Please note the e-mail id must have @")
		d.Email.focus();
		d.Email.select();
		return false;
	}
if (d.Email.value.length>50) {
	   alert("Email should be less than 50 characters");
	   d.Email.select();
	   d.Email.focus();
           return false;
	}	
	if(d.Email.value.indexOf('.')<4){
		alert("Please enter your correct e-mail")
		d.Email.focus();
		d.Email.select();
		return false;
	}
	 
		var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		if(d.Email.value.match(emailExp)){}else{
			alert('Please Enter valid EmailId.');
			d.Email.focus();
			return false;
		}

 document.getElementById('B1').disabled='true';

	return true;
}

