////////////////////////////////sIGN uP ////////////////////////////////////
function validate(signupform)
{
  //alert(signupform.name);
  var fname = signupform.fname.value;
  var lname = signupform.lname.value;
  var bill_address1 = signupform.bill_address1.value;
  var country = signupform.country.value;
  var state = signupform.state.value;
  var city = signupform.city.value;
  var zip_code = signupform.zip_code.value;
  var contact_phone = signupform.contact_phone.value;
  var alternate_phone = signupform.alternate_phone.value;
  var captcha = signupform.captcha.value;
  var cap_code = signupform.cap_code12.value;
  var email = signupform.email.value;
  var password = signupform.password.value;
  var conf_pass = signupform.conf_pass.value;
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/  ;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
 
   var contact_fax = signupform.contact_fax.value;
   var skype = signupform.skype.value;
   var facebook = signupform.facebook.value;
   var twitter = signupform.twitter.value;
   ///var bussiness_name = signupform.bussiness_name.value;
  // var neither = signupform.neither.value;
   
  	   if(fname=="") 
		   {
			inlineMsg('fname','<strong>You must enter your name.</strong>',2);
			return false;
		   }
		   
		   
		  
		  if(lname == "") 
		   {
			inlineMsg('lname','<strong>You must enter your last name.</strong>',2);
			return false;
		   }
		   
		   if(!lname.match(nameRegex))
		   {
			inlineMsg('lname','<strong>You have entered an invalid last name.</strong>',2);
			return false;
		  }
		  
		   if(bill_address1 == "") 
		   {
			inlineMsg('bill_address1','<strong>You must enter your billing address.</strong>',2);
			return false;
		   }
			
		  if(city == "") 
		   {
			inlineMsg('city','<strong>You must enter your city name.</strong>',2);
			return false;
		  }
		  
		  if(!city.match(nameRegex)) 
		  {
			inlineMsg('city','<strong>You have entered an invalid  city name.</strong>',2);
			return false;
		  }
		  
		  if(zip_code == "") 
		  {
			inlineMsg('zip_code','<strong>You must enter the zip code.</strong>',2);
			return false;
		  }
		  
		  if(isNaN(zip_code))
		  {
		  inlineMsg('zip_code','Invalid Number',2);
		  return false;
		  }
		
		  if(country == "") 
		  {
		  inlineMsg('country','<strong>You must select your country.</strong>',2);
		  return false;
		  }
		  
		  if(state == "select") 
		  {
		  inlineMsg('state','<strong>You must select the state.</strong>',2);
		  return false;
		  }
		  
		 
		  if(contact_phone == "xxx-xxx-xxxx") 
		  {
		  inlineMsg('contact_phone','<strong>You must enter contact phone number.</strong>',2);
		  return false;
		  }
		  rePhoneNumber = new RegExp(/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/);
	
	if (!rePhoneNumber.test(contact_phone)) {

           inlineMsg('contact_phone','Invalid Format',2);
          return false;

     }
	 if(contact_phone.length != 12)
	 {
	 inlineMsg('contact_phone','Invalid Format',2);
          return false;
	 }
		 
		 
		 
		if(alternate_phone != "xxx-xxx-xxxx") 
		  {
			rePhoneNumber_cel = new RegExp(/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/);
			
			if (!rePhoneNumber_cel.test(alternate_phone)) {
			
			inlineMsg('alternate_phone','Invalid Format',2);
			return false;
			}
				if(alternate_phone.length != 12)
				{
				inlineMsg('alternate_phone','Invalid Format',2);
				return false;
				}
		  }
		  
		  
		  if(contact_fax != "xxx-xxx-xxxx") 
		  {
			rePhoneNumber_fax = new RegExp(/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/);
			
			if (!rePhoneNumber_fax.test(contact_fax)) {
			
			inlineMsg('contact_fax','Invalid Format',2);
			return false;
			
			}
			 if(contact_fax.length != 12)
				{
				inlineMsg('contact_fax','Invalid Format',2);
				return false;
				}
		  }
		 
		
		
		
		  if(email == "")
		  {
		   inlineMsg('email','You must enter your email.',2); 
		   return false;
		  }
		  
		  if(!email.match(emailRegex)) 
		  {
			inlineMsg('email','<strong>You have entered an invalid email.</strong>',2);
			return false;
		  }
		  
		   if(facebook != "")
		  {
		   if(!facebook.match(emailRegex)) 
		  {
			inlineMsg('facebook','<strong>You have entered an invalid facebook id.</strong>',2);
			return false;
		  }
		  }
		  
		  
		    if(twitter != "")
		  {
		   if(!twitter.match(emailRegex)) 
		  {
			inlineMsg('twitter','<strong>You have entered an invalid twitter id.</strong>',2);
			return false;
		  }
		  }
		  
		  
		  if(password == "")
		  {
			  inlineMsg('password','<strong>You must enter your password.</strong>',2);	
			  return false;
		  }
		  
		   if(password.length < 6)
		  {
			  inlineMsg('password','<strong>You must enter atleast 6 characters.</strong>',2);	
			  return false;
		  }
		  
		  if(conf_pass == "")
		  {
			  inlineMsg('conf_pass','<strong>You must confirm password.</strong>',2);	
			  return false;
		  }
			if(conf_pass != password)
		  {
			  inlineMsg('conf_pass','<strong>Password Mismatch.</strong>',2);	
			  return false;
		  }
		   //if(!neither.checked) 
		  // {
			//inlineMsg('neither','<strong>At least select one check box.</strong>',2);
			//return false;
		   //}
  
		  // if(bussiness_name == "") 
//		  {
//		  inlineMsg('bussiness_name','<strong>You must enter your business name.</strong>',2);
//		  return false;
//		  } 
//		  
//		  if(!bussiness_name.match(nameRegex))
//		  {
//			inlineMsg('bussiness_name','<strong>You have entered an invalid  business name.</strong>',2);
//			return false;
//		  }
		
		 if(captcha=='')
		 {
			inlineMsg('captcha','<strong>Please enter the  Solution.</strong>',2);
			return false; 
		 }
		 
		  if(captcha!='')
		 {
			if(captcha!=cap_code)
			{
			inlineMsg('captcha','<strong>Please enter correct Solution.</strong>',2);
			return false; 
			}
		 }
  
}



//////////////////////Edit SIGN UP  /////////////////////////

function edit_profile(form1)
{
//alert(form1.name);

 var fname =form1.fname.value;
 var lname = form1.lname.value;
 var bussiness_name =form1.bussiness_name.value;
 var bill_address1 = form1.bill_address1.value;
 var zip_code = form1.zip_code.value;
 var country = form1.country.value;
 var state = form1.state.value;
 var city =form1.city.value;
 var contact_phone =form1.contact_phone.value;
 var old_pass = form1.old_pass.value;
 var nu_pass = form1.nu_pass.value;
 var re_nu_pass = form1.re_nu_pass.value;
 var email = form1.email.value;
 
 var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
 var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/  ;
 var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);


if(fname == "") 
   {
    inlineMsg('fname','<strong>You must enter your name.</strong>',2);
    return false;
  }
  if(!fname.match(nameRegex)) {
    inlineMsg('fname','<strong>You have entered an invalid  first name.</strong>',2);
    return false;
  }
if(lname == "") 
   {
    inlineMsg('lname','<strong>You must enter your last name.</strong>',2);
    return false;
  }
   if(!lname.match(nameRegex)) {
    inlineMsg('lname','<strong>You have entered an invalid last name.</strong>',2);
    return false;
  }
  
  if(bill_address1 == "") 
   {
    inlineMsg('bill_address1','<strong>You must enter your billing address.</strong>',2);
    return false;
  }
  
  if(city == "") 
   {
    inlineMsg('city','<strong>You must enter your city name.</strong>',2);
    return false;
  }
  if(!city.match(nameRegex)) {
    inlineMsg('city','<strong>You have entered an invalid  city name.</strong>',2);
    return false;
  }
  
   if(country == "") 
   {
    inlineMsg('country','<strong>You must select your country.</strong>',2);
    return false;
  }
  if(state == "select") 
   {
    inlineMsg('state','<strong>You must select the state.</strong>',2);
    return false;
  }
  
   if(zip_code == "") 
   {
    inlineMsg('zip_code','<strong>You must enter the zip code.</strong>',2);
    return false;
  }
   if(isNaN(zip_code))
		  {
				inlineMsg('zip_code','Invalid Number',2);
				return false;
		  }

  
 
/*if(!bill_address1.match(nameRegex)) {
    inlineMsg('bill_address1','<strong>You have entered an invalid  billing address.</strong>',2);
    return false;
  }*/
  
    if(contact_phone == "") 
   {
    inlineMsg('contact_phone','<strong>You must enter contact phone number.</strong>',2);
    return false;
  }
  
 rePhoneNumber = new RegExp(/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/);
	
	if (!rePhoneNumber.test(contact_phone)) {

          inlineMsg('contact_phone','Invalid Number',2);

          return false;

     }
 
 
   if(email == "")
 {
   //  alert('1');
	inlineMsg('email','You must enter your email.',2); 
	 return false;
  }
  
  
  
  
  
  if(!email.match(emailRegex)) 
  {
    inlineMsg('email','<strong>You have entered an invalid email.</strong>',2);
    return false;
  }
  
   if(bussiness_name == "") 
   {
    inlineMsg('bussiness_name','<strong>You must enter your business name.</strong>',2);
    return false;
  }
if(!bussiness_name.match(nameRegex)) {
    inlineMsg('bussiness_name','<strong>You have entered an invalid  business name.</strong>',2);
    return false;
  }
 

if(old_pass != "") 
  {/*
 inlineMsg('old_pass','<strong>You must enter  old password.</strong>',2);
return false;*/

if(nu_pass == "") 
 {
inlineMsg('nu_pass','<strong>You must enter  new password.</strong>',2);
return false;
 }
 
 if(nu_pass.length < 6)
  {
	  inlineMsg('nu_pass','<strong>You must enter atleast 6 characters.</strong>',2);	
	  return false;
  }
 
 
if(nu_pass != re_nu_pass) 
  {
 inlineMsg('re_nu_pass','<strong>Password Mismatch.  </strong>',2);
 return false;
  }				

  }

   return true;
}



//////////////// End of user profile




/////////////Start login form validation///

function check_validation()
{
	var email_id=document.getElementById('email_id').value;
	var passwrd=document.getElementById('passwrd').value;
	
	if(!email_id)
	{
		//alert("Please enter email id");	
		inlineMsg('email_id','You must enter your email.',2);
		//document.getElementById('email1').focus();
		return false;
		
	}
	if(!email_id.match(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/))
	 {
		inlineMsg('email_id','<strong>Error</strong><br />You have entered an invalid email.',2);
		//email1=""
		return false;
  	}
	if(!passwrd)
	{
		 inlineMsg('passwrd','You must enter your password.',2);
		//passsword1=""
		//document.getElementById('password1').focus();
		return false;
		
	}
	return true;

}
////////////////////////////////////////////////////Trainears////////////////////////
function validate_trainears(signupform)
{

  var first_name = signupform.first_name.value;
  var last_name = signupform.last_name.value;
  var billing_address1 = signupform.billing_address1.value;

  //var country = signupform.country.value;
  //var state = signupform.state.value;
   
  var city = signupform.city.value;
  var zip_code = signupform.zip_code.value;
  var ad_title = signupform.ad_title.value;
  var ad_text = signupform.ad_text.value;
  var discipline = signupform.discipline.value;
  var contact_phone = signupform.contact_phone.value;
  var email = signupform.email.value;
  
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/  ;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
 
   var contact_fax = signupform.contact_fax.value;
   var skype = signupform.skype.value;
      var age = signupform.age.value;
   var facebook = signupform.facebook.value;
    
	
	if(first_name=="") 
		   {
			     
			inlineMsg('first_name','<strong>You must enter your name.</strong>',2);
			return false;
		   }
		   
		  if(last_name == "") 
		   {
			inlineMsg('last_name','<strong>You must enter your last name.</strong>',2);
			return false;
		   }
		   
		   if(!last_name.match(nameRegex))
		   {
			inlineMsg('last_name','<strong>You have entered an invalid last name.</strong>',2);
			return false;
		  }
		  
		   if(billing_address1 == "") 
		   {
			inlineMsg('billing_address1','<strong>You must enter your billing address.</strong>',2);
			return false;
		   }
		  //  if(country == "") 
//		  {
//		  inlineMsg('country','<strong>You must select your country.</strong>',2);
//		  return false;
//		  }
//		  
//		  if(state == "select") 
//		  {
//		  inlineMsg('state','<strong>You must select the state.</strong>',2);
//		  return false;
//		  }
			
		  if(city == "") 
		   {
			inlineMsg('city','<strong>You must enter your city name.</strong>',2);
			return false;
		  }
		  
		  if(!city.match(nameRegex)) 
		  {
			inlineMsg('city','<strong>You have entered an invalid  city name.</strong>',2);
			return false;
		  }
		  
		  if(zip_code == "") 
		  {
			inlineMsg('zip_code','<strong>You must enter the zip code.</strong>',2);
			return false;
		  }
		  
		  if(isNaN(zip_code))
		  {
		  inlineMsg('zip_code','Invalid Number',2);
		  return false;
		  }
		  if(ad_title == "") 
		  {
		  inlineMsg('ad_title','<strong>You must enter your Stable/Barn/Company Name.</strong>',2);
		  return false;
		  } 
		  
		  if(!ad_title.match(nameRegex))
		  {
			inlineMsg('ad_title','<strong>You have entered an invalid  Stable/Barn/Company Name .</strong>',2);
			return false;
		  }
		if(ad_text == "") 
		  {
		  inlineMsg('ad_text','<strong>You must enter your Ad text.</strong>',2);
		  return false;
		  } 
		   if(discipline == "select") 
		  {
		  inlineMsg('discipline','<strong>You must select the discipline.</strong>',2);
		  return false;
		  }
		  if(contact_phone == "") 
		  {
		  inlineMsg('contact_phone','<strong>You must enter contact phone number.</strong>',2);
		  return false;
		  }
		  rePhoneNumber = new RegExp(/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/);
	
	if (!rePhoneNumber.test(contact_phone)) {

          inlineMsg('contact_phone','Invalid Number',2);

          return false;

     }
		 if(contact_fax != "") 
		  {
			 if(isNaN(contact_fax))
			  {
			  inlineMsg('contact_fax','Invalid Number',2);
			  return false;
			  }
		  }
		  if(skype == "") 
		  {
			
			  inlineMsg('skype','You must enter your Skype',2);
			  return false;
			
		  }
		  if(skype != "")
		  {
		   if(!skype.match(emailRegex)) 
		  {
			inlineMsg('skype','<strong>You have entered an invalid skype id.</strong>',2);
			return false;
		  }
		  }
		 if(email == "")
		  {
		   inlineMsg('email','You must enter your email.',2); 
		   return false;
		  }
		  
		  if(!email.match(emailRegex)) 
		  {
			inlineMsg('email','<strong>You have entered an invalid email.</strong>',2);
			return false;
		  }
		  
		   if(facebook != "")
		  {
		   if(!facebook.match(emailRegex)) 
		  {
			inlineMsg('facebook','<strong>You have entered an invalid facebook id.</strong>',2);
			return false;
		  }
		  }
		  if(age == "select") 
		  {
		  inlineMsg('age','<strong>You must select the Age.</strong>',2);
	  return false;
		  }
		  
	
}



////////////////////////End Login form validataion ////////////////////////////

function check_validationfor()
{
	var email_id=document.getElementById('email_id').value;
		
	if(!email_id)
	{
		//alert("Please enter email id");	
		inlineMsg('email_id','You must enter your email.',2);
		//document.getElementById('email1').focus();
		return false;
		
	}
	if(!email_id.match(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/))
	 {
		inlineMsg('email_id','<strong>Error</strong><br />You have entered an invalid email.',2);
		//email1=""
		return false;
  	}
	
	return true;

}
/////////////////////////Posting and editing Horse Pony Miniature Ad Posting form validation //////////////////

function detail_validate(editform)
{
 	 ///alert(editform.name);
		var  horse_name = editform.horse_name.value;
		var horse_city = editform.horse_city.value;
		var horse_state = editform.horse_state.value;
		var zip_code = editform.zip_code.value;
		var ad_title =editform.ad_title.value;
		var ad_text = editform.ad_text.value;
		var primary_breed = editform.primary_breed1.value;
		var secondary_breed = editform.secondary_breed.value;
		var month = editform.month.value;
		var year = editform.year.value;
		var gender = editform.gender1.value;
		var base_color = editform.base_color1.value;
		var hands_high = editform.hands_high.value;
		//var approx_wt = editform.approx_wt.value;
		var temp = editform.temp.value;
		var category = editform.category.value;
	    var img = editform.img.value;
		var discipline =editform.discipline1.value;
		var age=editform.age.value;
		var ad_type = editform.ad_type.value;
		//var price=editform.price.value;
		//var leaseprice=editform.leaseprice.value;
		var youtube=editform.youtube.value;
		var experience =editform.experience1.value;
		var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/  ;
        var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
        var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
		
			if(horse_name=="") 
			{  
			inlineMsg('horse_name','<strong>You must enter  horse name.</strong>',2);
			return false;
			}
			
			/*if(!horse_name.match(nameRegex))
			{
			inlineMsg('horse_name','<strong>You have entered an invalid  horse name.</strong>',2);
			return false;
			}*/
			
			if(horse_city == "") 
			{
			inlineMsg('horse_city','<strong>You must select  horse country.</strong>',2);
			return false;
		    }
			
			
			if(zip_code == "") 
			{
			inlineMsg('zip_code','<strong>You must enter zip  code</strong>',2);
			return false;
			}
            
			if(isNaN(zip_code))
		    {
			inlineMsg('zip_code','Invalid Number',2);
			return false;
		    }
			
			if(horse_state == "select") 
			{
			inlineMsg('horse_state','<strong>Please select the state</strong>',2);
			return false;
			 }
			 
			
			
			if(ad_title == "") 
			{
			inlineMsg('ad_title','<strong>You must enter  ad title.</strong>',2);
			return false;
			}
			
			/*if(!ad_title.match(nameRegex))
			{
			inlineMsg('ad_title','<strong>You have entered an invalid  title name.</strong>',2);
			return false;
			 }*/
			 
			if(discipline == "select") 
			{
			inlineMsg('discipline1','<strong>Please select the discipline</strong>',2);
			return false;
			}
				  
			 
			 if(ad_text == "") 
			  {
			  inlineMsg('ad_text','<strong>You must enter  ad text.</strong>',2);
			  return false;
			 }
			
			if(primary_breed == "select") 
			{
			inlineMsg('primary_breed1','<strong>Please select the primary breed type</strong>',2);
			return false;
			}
			
		/*	if(secondary_breed == "select") 
		    {
			inlineMsg('secondary_breed','<strong>Please select the secondary breed type</strong>',2);
			return false;
		    }*/
			
			if(age == "select") 
			{
			inlineMsg('age','<strong>Please select the age.</strong>',2);
			return false;
			 }
				  
			
			
			if(month == "select") 
			{
			inlineMsg('month','<strong>Please select the month</strong>',2);
			return false;
			}
			
			if(year == "select") 
			{
			inlineMsg('year','<strong>Please select the year</strong>',2);
			return false;
			}
			
			if(gender == "select") 
			{
			inlineMsg('gender1','<strong>Please select the gender</strong>',2);
			return false;
			}
			
		
			
			if(category == "select") 
			{
			inlineMsg('category','<strong>Please select the category</strong>',2);
			return false;
			}
			
			if(hands_high == "select") 
			{
			inlineMsg('hands_high','<strong>Please select the height</strong>',2);
			return false;
			}
			
				
			if(experience == "select") 
			{
			inlineMsg('experience1','<strong>Please select the experience</strong>',2);
			return false;
			}
			
			if(temp == "select") 
			{
			inlineMsg('temp','<strong>Please select the temperament</strong>',2);
			return false;
			}
			
			if(base_color == "select") 
			{
			inlineMsg('base_color1','<strong>Please select the base color</strong>',2);
			return false;
			}
			/*
			if(img == '') 
			{
			inlineMsg('img','<strong>Please upload primary image </strong>',2);
			return false;
			} */
			if(img!='')
			{
			if(img.indexOf(".jpg") == -1 && img.indexOf(".JPG") == -1 && img.indexOf(".gif") == -1 && img.indexOf(".GIF") == -1 && img.indexOf(".png") == -1 && img.indexOf(".PNG") == -1)
			{
			inlineMsg('img','<strong>Please upload .jpg/.gif/.png files only</strong>',5);
			return false;
			}	
			}
			
			if(ad_type == "select") 
			{
			inlineMsg('ad_type','<strong>Please select the ad type</strong>',2);
			return false;
			}
			//if(price=="")
//			{
//			inlineMsg('price','<strong>Please enter the price value.</strong>',2);
//			return false;
//			}
//			
//			if(isNaN(price))
//			{
//			inlineMsg('price','<strong>Please enter the price value.</strong>',2);
//			return false;
//			}
//		
//			if(leaseprice=="")
//			{
//			inlineMsg('leaseprice','<strong>Please enter the leaseprice value.</strong>',2);
//			return false;
//			}
//			
//			if(isNaN(leaseprice))
//			{
//			inlineMsg('leaseprice','<strong>Please enter the leaseprice value.</strong>',2);
//			return false;
//			}
//			
			if(youtube!='')
			{
			
				if(youtube.indexOf("youtube.com")==-1)
				{
				inlineMsg('youtube','<strong>Please enter the correct youtube link.</strong>',2);
				return false;
				}
			}
		
		
}

function trailer_validate(editform)
{
 	//alert("singh");
		var  adtitle = editform.adtitle.value;
		var horse_city = editform.horse_city.value;
		var horse_state = editform.horse_state.value;
		var zip_code = editform.zip_code.value;
		var city = editform.city.value;
		var brands =editform.brands.value;
		var ad_text =editform.ad_text.value;
		var year = editform.year.value;
		var price = editform.price.value;
		var noofhorse = editform.noofhorse.value;
		var condition =editform.condition.value;
		var pulltype =editform.pulltype.value;
		var bodytypo =editform.bodytypo.value;
		var loption =editform.loption.value;
		var img =editform.img.value; 
				
			if(adtitle=="") 
			{  	
			inlineMsg('adtitle','<strong>You must enter  adtitle name.</strong>',2);
			return false;
			}
			
			if(horse_city == "") 
			{
			inlineMsg('horse_city','<strong>You must select  horse country.</strong>',2);
			return false;
		    }
			
			
			if(zip_code == "") 
			{
			inlineMsg('zip_code','<strong>You must enter zip  code</strong>',2);
			return false;
			}
			
            
			if(isNaN(zip_code))
		    {
			inlineMsg('zip_code','Invalid Number',2);
			return false;
		    }
			
			
			if(horse_state == "select") 
			{
			inlineMsg('horse_state','<strong>Please select the state</strong>',2);
			return false;
			 }
			 
			if(city == "") 
			{
			inlineMsg('city','<strong>You must enter City  code</strong>',2);
			return false;
			}
			
			if(bodytypo == "select") 
			{
			inlineMsg('bodytypo','<strong>Please select the Body Type</strong>',2);
			return false;
			}
			if(brands == "select") 
			{
			inlineMsg('brands','<strong>Please select the Manufacturers </strong>',2);
			return false;
			}
			if(ad_text == "") 
			{
			inlineMsg('ad_text','<strong>You must enter brief introduction.</strong>',2);
			return false;
			}
			
			
			if(year == "select") 
			{
			inlineMsg('year','<strong>Please select the year</strong>',2);
			return false;
			}
			
			if(noofhorse == "select") 
			{
			inlineMsg('noofhorse','<strong>Please select the No.of Horses</strong>',2);
			return false;
			}
			if(price == "") 
			{
			inlineMsg('price','<strong>You must enter Price</strong>',2);
			return false;
			}
			if(condition == "select") 
			{
			inlineMsg('condition','<strong>Please select the condition</strong>',2);
			return false;
			}
			if(isNaN(price))
		    {
			inlineMsg('price','Invalid Number',2);
			return false;
		    }
			if(pulltype == "select") 
			{
			inlineMsg('pulltype','<strong>Please select the Pull Type</strong>',2);
			return false;
			}
			if(loption == "select") 
			{
			inlineMsg('loption','<strong>Please select the Loading Option</strong>',2);
			return false;
			}
			if(img!='')
				{
				if(img.indexOf(".jpg") == -1 && img.indexOf(".JPG") == -1 && img.indexOf(".gif") == -1 && img.indexOf(".GIF") == -1 && img.indexOf(".png") == -1 && img.indexOf(".PNG") == -1)
				{
				inlineMsg('img','<strong>Please upload .jpg/.gif/.png files only</strong>',5);
				return false;
				}	
				}
			
						
}

function trainer123validation(editform)
{
 		var  tname = editform.tname.value;
		var bname = editform.bname.value;
		var zip_code = editform.zip_code.value;
		var city = editform.city.value;
		var discipline123 = editform.discipline123.value;
		var ad_text = editform.ad_text.value;
		var baddress_text = editform.baddress.value;
		var img = editform.img.value;
		
				
			if(tname=="") 
			{  	
			inlineMsg('tname','<strong>You must enter  Trainers Name.</strong>',2);
			return false;
			}
			
			if(bname == "") 
			{
			inlineMsg('bname','<strong>You must select  Barn Name.</strong>',2);
			return false;
		    }
			if(city == "") 
			{
			inlineMsg('city','<strong>You must enter city.</strong>',2);
			return false;
		    }
			
			
			if(zip_code == "") 
			{
			inlineMsg('zip_code','<strong>You must enter zip  code</strong>',2);
			return false;
			}
			
            
			if(isNaN(zip_code))
		    {
			inlineMsg('zip_code','Invalid Number',2);
			return false;
		    }
			if(discipline123 =="") 
			{
			inlineMsg('discipline123','<strong>Please select the Discipline</strong>',2);
			return false;
			 }
			 
			if(ad_text == "") 
			{
			inlineMsg('ad_text','<strong>You must enter ad text</strong>',2);
			return false;
			}
			
			if(baddress_text == "") 
			{
			inlineMsg('baddress','<strong>You must enter Street Address</strong>',2);
			return false;
			}
			
			if(img!='')
				{
				if(img.indexOf(".jpg") == -1 && img.indexOf(".JPG") == -1 && img.indexOf(".gif") == -1 && img.indexOf(".GIF") == -1 && img.indexOf(".png") == -1 && img.indexOf(".PNG") == -1)
				{
				inlineMsg('img','<strong>Please upload .jpg/.gif/.png files only</strong>',5);
				return false;
				}	
				}
						
}



function event_validate(editform)
{
 	 ///alert(editform.name);
		var  ename = editform.ename.value;
		var horse_city = editform.horse_city.value;
		var horse_state = editform.horse_state.value;
		var city = editform.city.value;
		var ad_text = editform.ad_text.value;
		var primary_breed = editform.primary_breed1.value;
		var secondary_breed = editform.secondary_breed.value;
	   var img = editform.img.value;
		var discipline123 =editform.discipline123.value;
		var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/  ;
        var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
        var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
		
			if(ename=="") 
			{  
			inlineMsg('ename','<strong>You must enter  Event name.</strong>',2);
			return false;
			}
			
			/*if(!horse_name.match(nameRegex))
			{
			inlineMsg('horse_name','<strong>You have entered an invalid  horse name.</strong>',2);
			return false;
			}*/
			
			if(horse_city == "") 
			{
			inlineMsg('horse_city','<strong>You must select  horse country.</strong>',2);
			return false;
		    }
			
			
			if(city == "") 
			{
			inlineMsg('city','<strong>You must enter City name</strong>',2);
			return false;
			}
            
			
			if(horse_state == "select") 
			{
			inlineMsg('horse_state','<strong>Please select the state</strong>',2);
			return false;
			 }
			 
			 
			if(discipline123 == "select") 
			{
			inlineMsg('discipline123','<strong>Please select the discipline</strong>',2);
			return false;
			}
				  
			 
			 if(ad_text == "") 
			  {
			  inlineMsg('ad_text','<strong>You must enter  ad text.</strong>',2);
			  return false;
			 }
			
			if(primary_breed == "select") 
			{
			inlineMsg('primary_breed1','<strong>Please select the primary breed type</strong>',2);
			return false;
			}
			
}

function saddles_validate123(editform)
{
 	///alert("singh");
		var  adtitle = editform.adtitle.value;
		var horse_city = editform.horse_city.value;
		var horse_state = editform.horse_state.value;
		var zip_code = editform.zip_code.value;
		var city = editform.city.value;
		var bodytypo =editform.bodytypo.value;
		var brands =editform.brands.value;		
		var ad_text =editform.ad_text.value;
		var size =editform.size.value;
		var price = editform.price.value;
		var color =editform.color.value;
		var condition =editform.condition.value;
		var tree =editform.tree.value;
		var img =editform.img.value;
	//var features =editform.features.value; 
				
			if(adtitle=="") 
			{  	
			inlineMsg('adtitle','<strong>You must enter  adtitle name.</strong>',2);
			return false;
			}
			
			if(horse_city == "") 
			{
			inlineMsg('horse_city','<strong>You must select  horse country.</strong>',2);
			return false;
		    }
			
			
			if(zip_code == "") 
			{
			inlineMsg('zip_code','<strong>You must enter zip  code</strong>',2);
			return false;
			}
			
            
			if(isNaN(zip_code))
		    {
			inlineMsg('zip_code','Invalid Number',2);
			return false;
		    }
			
			
			if(horse_state == "select") 
			{
			inlineMsg('horse_state','<strong>Please select the state</strong>',2);
			return false;
			 }
			 
			if(city == "") 
			{
			inlineMsg('city','<strong>You must enter City  code</strong>',2);
			return false;
			}
				
			if(bodytypo == "select") 
			{
			inlineMsg('bodytypo','<strong>Please select the Body Type</strong>',2);
			return false;
			}
			
			if(brands == "select") 
			{
			inlineMsg('brands','<strong>Please select the Brand</strong>',2);
			return false;
			}
			if(ad_text == "") 
			{
			inlineMsg('ad_text','<strong>You must enter brief introduction.</strong>',2);
			return false;
			}
			if(size =="select") 
			{
			inlineMsg('size','<strong>Please select the Size</strong>',2);
			return false;
			}
			
			if(price == "") 
			{
			inlineMsg('price','<strong>You must enter Price</strong>',2);
			return false;
			}
			
			if(isNaN(price))
		    {
			inlineMsg('price','Invalid Number',2);
			return false;
		    }
					
			if(img!='')
				{
				if(img.indexOf(".jpg") == -1 && img.indexOf(".JPG") == -1 && img.indexOf(".gif") == -1 && img.indexOf(".GIF") == -1 && img.indexOf(".png") == -1 && img.indexOf(".PNG") == -1)
				{
				inlineMsg('img','<strong>Please upload .jpg/.gif/.png files only</strong>',5);
				return false;
				}	
				}
			if(color == "select") 
			{
			inlineMsg('color','<strong>Please select the Color</strong>',2);
			return false;
			}
			if(condition =="select") 
			{
			inlineMsg('condition','<strong>Please select the tree</strong>',2);
			return false;
			}
			if(tree =="select") 
			{
			inlineMsg('tree','<strong>Please select the size</strong>',2);
			return false;
			}
			
			
			
}


function realstatevalidation(editform)
{ 		
		
		var zip_code = editform.zip_code.value;
		var city = editform.city.value;
		var bname = editform.bname.value;
		var ad_text = editform.ad_text.value;
		var website = editform.website.value;
		var stalls = editform.stalls.value;
		var acres = editform.acres.value;
		var sqft = editform.sqft.value;
		var bedrooms = editform.bedrooms.value;
		var baths = editform.baths.value;
		var hbaths = editform.hbaths.value;
		var year = editform.year.value;
		var hprice = editform.hprice.value;
		var baddress = editform.baddress.value;
		var ad_type = editform.ad_type.value;
		
		//var outdoor = editform.outdoor.value;

		 if(bname == "") 
			{
			inlineMsg('bname','<strong>You must select  Barn Name.</strong>',2);
			return false;
		    }
		 if(city == "") 
			{
			inlineMsg('city','<strong>You must enter city.</strong>',2);
			return false;
		    }
			if(website=="") 
			{  	
			inlineMsg('website','<strong>You must enter  Website Name.</strong>',2);
			return false;
			}
			if(zip_code == "") 
			{
			inlineMsg('zip_code','<strong>You must enter zip  code</strong>',2);
			return false;
			}
			if(isNaN(zip_code))
		    {
			inlineMsg('zip_code','Invalid Number',2);
			return false;
		    }
		 	if(stalls == "select") 
			{
			inlineMsg('stalls','<strong>Please select the Stalls</strong>',2);
			return false;
			}		 
			if(ad_text == "") 
			{
			inlineMsg('ad_text','<strong>You must enter Ad text</strong>',2);
			return false;
			}
			
			if(acres == "select") 
			{
			inlineMsg('acres','<strong>Please select the Acres</strong>',2);
			return false;
			}
			
			//if ( ( editform.outdoor[0].checked == false ) && ( editform.outdoor[1].checked == false ) ) 
//			{ inlineMsg('outdoor','<strong>Please choose your outdoor: Yes or No.</strong>',2);
//			return false; }

			/*
			if(rprice == "") 
			{
			inlineMsg('rprice','<strong>You must enter Price</strong>',2);
			return false;
			}
			
			if(isNaN(rprice))
		    {
			inlineMsg('rprice','Invalid Number',2);
			return false;
		    }
			*/
			
			if(baddress == "") 
			{
			inlineMsg('baddress','<strong>You must enter your street address</strong>',2);
			return false;
			}
			if(sqft == "") 
			{
			inlineMsg('sqft','<strong>You must enter Sqft</strong>',2);
			return false;
			}
			
			if(bedrooms == "select") 
			{
			inlineMsg('bedrooms','<strong>Please select the Bedrooms</strong>',2);
			return false;
			}
			if(baths == "select") 
			{
			inlineMsg('baths','<strong>Please select the Baths</strong>',2);
			return false;
			}
			if(hbaths == "select") 
			{
			inlineMsg('hbaths','<strong>Please select the half-baths</strong>',2);
			return false;
			}
			if(ad_type == "select") 
			{
			inlineMsg('ad_type','<strong>Please select the ad type</strong>',2);
			return false;
			}
			
			if(year== "select") 
			{
			inlineMsg('year','<strong>Please select the Year.</strong>',2);
			return false;
			}
			/*
			if(hprice == "") 
			{
			inlineMsg('hprice','<strong>You must enter Price</strong>',2);
			return false;
			}
			if(isNaN(hprice))
		    {
			inlineMsg('hprice','Invalid Number',2);
			return false;
		    } */
			
				
			
}

function tackvalidation(editform)
{ 
 		var headline = editform.headline.value;
		var ad_text = editform.ad_text.value;
		var  price = editform.price.value;
		var category = editform.category.value;
		var subcategory = editform.subcategory.value;
		var img = editform.img.value;
				
		if(headline == "") 
			{
			inlineMsg('headline','<strong>You must enter headline.</strong>',2);
			return false;
		    }
												 
			if(price=="") 
			{  	
			inlineMsg('price','<strong>You must enter  price.</strong>',2);
			return false;
			}
			if(isNaN(price))
		    {
			inlineMsg('price','Invalid Number',2);
			return false;
		    }
			if(category == "select") 
			{
			inlineMsg('category','<strong>Please select the Category</strong>',2);
			return false;
			}
			if(ad_text == "") 
			{
			inlineMsg('ad_text','<strong>You must enter Ad text</strong>',2);
			return false;
			}
			if(subcategory == "select") 
			{
			inlineMsg('subcategory','<strong>Please select the Sub Category</strong>',2);
			return false;
			}
			if(img!='')
			{
			if(img.indexOf(".jpg") == -1 && img.indexOf(".JPG") == -1 && img.indexOf(".gif") == -1 && img.indexOf(".GIF") == -1 && img.indexOf(".png") == -1 && img.indexOf(".PNG") == -1)
			{
			inlineMsg('img','<strong>Please upload .jpg/.gif/.png files only</strong>',5);
			return false;
			}	
			}
					
}
function postjobs_validate(editform)
{
 	 //alert(editform.name);
		var  country = editform.country.value;
		var city = editform.city.value;
		var job_title = editform.job_title.value;
		var job_type = editform.job_type.value;
		var nofpositions = editform.nofpositions.value;
		var topeofjobposition = editform.topeofjobposition.value;
		var yearsexperience = editform.yearsexperience.value;
		var jobsstartdate = editform.jobsstartdate.value;
		var jobsenddate = editform.jobsenddate.value;
		var per = editform.per.value;
		var livein = editform.livein.value;
		var bringowm = editform.bringowm.value;
		var jobdetails = editform.jobdetails.value;
	   //var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
        var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
		if(job_title == "") 
			{
			inlineMsg('job_title','<strong>You must enter Job Title</strong>',2);
			return false;
			}
		if(country == "select") 
			{
			inlineMsg('country','<strong>Please select the Country</strong>',2);
			return false;
			 }
		 if(city == "") 
			{
			inlineMsg('city','<strong>You must enter  City.</strong>',2);
			return false;
		    }
		
      if(job_type == "select") 
			{
			inlineMsg('job_type','<strong>Please select the Jobs Type</strong>',2);
			return false;
			 }
		if(nofpositions == "select") 
			{
			inlineMsg('nofpositions','<strong>You must enter No of Positions</strong>',2);
			return false;
			}
			if(isNaN(nofpositions))
			{
			inlineMsg('nofpositions','<strong>Please enter the Void No of Positions.</strong>',2);
			return false;
			}
			if(topeofjobposition == "select") 
			{
			inlineMsg('topeofjobposition','<strong>You must enter Type of jobs Position</strong>',2);
			return false;
			}
		if(yearsexperience == "0") 
			{
			inlineMsg('yearsexperience','<strong>Please select the Type of jobs Position</strong>',2);
			return false;
			}
			if(jobsstartdate == "") 
			{
			inlineMsg('jobsstartdate','<strong>You must enter Start Date</strong>',2);
			return false;
			}
			if(jobsenddate == "") 
			{
			inlineMsg('jobsenddate','<strong>You must enter End Date</strong>',2);
			return false;
			}
		var endDate = new Date(jobsstartdate);
		var startDate = new Date(jobsenddate);
		if(jobsstartdate != '' && jobsenddate != '' && startDate < endDate)
    	{
		inlineMsg('jobsenddate','<strong>Please ensure that the End Date is greater than or equal to the Start Date.</strong>',2);
		return false;
    	}
		
		 if(per == "select") 
			{
			inlineMsg('per','<strong>Please select the Salary/Pay Rate</strong>',2);
			return false;
			 }
		if(livein == "select") 
			{
			inlineMsg('livein','<strong>Please select the Live in </strong>',2);
			return false;
		}
		if(bringowm == "select") 
			{
			inlineMsg('bringowm','<strong>Please select the  bring own</strong>',2);
			return false;
		}	
		if(jobdetails == "") 
			{
			inlineMsg('jobdetails','<strong>You must enter Jobs Details</strong>',2);
			return false;
			}
		
		}
		
		

///////////////////////// End of Horse,pony and Miniature form validation


// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) {
    msg = document.createElement('div');
    msg.id = 'msg';
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    msg.alpha = 0;
  } else {
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;
  var targetdiv = document.getElementById(target);
  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

// preload the arrow //
if(document.images) {
  arrow = new Image(7,80); 
  arrow.src = "images/msg_arrow.gif"; 
}