function checkform()
{
	if(document.language.language_name.value=="")
	{
		alert("Please enter the language name.");
		return false;
		
	}
	
	if(document.language.language_currency.value=="")
	{
		alert("Please enter the language currency.");
		return false;
		
	}
	
	if(document.language.currency_symbol.value=="")
	{
		alert("Please enter the currency symbol.");
		return false;
		
	}
	
}

function validatepass()
{
	if(document.form1.newpassword.value=="")
	{
		alert("Password cannot be empty!");
		return false;
	}
}

function validateform()
{
var message="";	
var ischeck = document.form.accepts.checked;


if(document.form.bcinumber.value=="")
{
//message=message+"*Enter username\n";
alert("Upload BCI number.");
return false;
}

if(document.form.username.value=="")
{
//message=message+"*Enter username\n";
alert("Enter username.");
return false;
}

if(document.form.password.value=="")
{
//message=message+"*Enter Password\n";
alert("Please enter Password.");
return false;
}

if(document.form.cpassword.value=="")
{
//message=message+"*Confirm Password\n";
alert("Confirm Password field empty.");
return false;
}

if(document.form.password.value!=document.form.cpassword.value)
{
alert("Mismatch in Passwords");
document.form.password.value="";
document.form.cpassword.value="";
document.form.password.focus();
return false;	
}

if(document.form.companyname.value=="")
{
//message=message+"*Confirm Password\n";
alert("Enter Company name.");
return false;
}

if(document.form.fname.value=="")
{
//message=message+"*Enter first name\n";
alert("Enter First name");
return false;
}

if(!ischeck)
{
//message=message+"*Enter username\n";
alert("Please accept the terms and conditions.");
return false;
}
var fname=document.form.fname.value;

		for(var s=0;s<fname.length;s++)
		{
			 c=fname.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				alert("Name cannot contain numbers.");
				 document.form.fname.value="";
				 document.form.fname.focus();
				 return false;
				 }
				 else{
				 
				 }
		}	

if(document.form.lname.value=="")
{
alert("Enter Last name");
return false;
}

 if(document.form.email.value=="")
		  {
		  alert("Your email address is not valid.");
		  document.form.email.focus();
		  return false;
		  }
		  
		  
		  if(document.form.email.value!="")
  			{
			 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;


      			if (filter.test(document.form.email.value))
        			{

        			}
      			else
					{
						alert("Your email address is not valid.");
						document.form.email.focus();
						return false;
						
					}
  			}
			
		if(document.form.mobile_no.value=="")
			{
			alert("Please enter mobile no.");
			return false;
			}
		
		var phone=document.form.mobile_no.value;
		var c;
		if(phone.length <8)
		{
		alert("Invalid Mobile Phone No. ");
		document.form.mobile_no.value="";
		document.form.mobile_no.focus();
		return false;
		}	
		for(var s=0;s<phone.length;s++)
		{
			 c=phone.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				
				 }
				 else{
				 alert("Enter Valid Mobile Phone No.");
				 document.form.mobile_no.value="";
				 document.form.mobile_no.focus();
				 return false;
				 }
		}	
		
			if(document.form.phone_no.value=="")
			{
			alert("Please enter Telephone no.");
			return false;
			}
		
		var phone1=document.form.phone_no.value;
		var c;
		
		for(var s=0;s<phone1.length;s++)
		{
			 c=phone1.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				
				 }
				 else{
				 alert("Enter valid telephone No.");
				 document.form.phone_no.value="";
				 document.form.phone_no.focus();
				 return false;
				 }
		}	
		
		/*if(document.form.home_no.value=="")
			{
			alert("Please enter work phone no.");
			return false;
			}
		
		var phone2=document.form.work_no.value;
		var c;
		/*if(phone.length <8)
		{
		alert("Invalid Phone No. ");
		document.form.home_no.value="";
		document.form.home_no.focus();
		return false;
		}	
		for(var s=0;s<phone2.length;s++)
		{
			 c=phone2.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				
				 }
				 else{
				 alert("Enter Valid Phone No.");
				 document.form.work_no.value="";
				 document.form.work_no.focus();
				 return false;
				 }
		}*/
		
		if(document.form.address.value=="")
		  {
		  alert("Please enter address");
		  document.form.address.focus();
		  return false;
		  }

	if(document.form.town.value=="")
		  {
		  alert("Please specify a town");
		  document.form.town.focus();
		  return false;
		  }
		 
	/*if(document.form.country.value=="")
		  {
		  alert("Please select a country");
		  document.form.country.focus();
		  return false;
		  }*/
	
	if(document.form.postcode.value=="")
		  {
		  alert("Please enter Postal code");
		  document.form.postcode.focus();
		  return false;
		  }
		  var postcode=document.form.postcode.value;

		for(var s=0;s<postcode.length;s++)
		{
			 c=postcode.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				
				 }
				 else{
				 alert("Invalid postal code");
				 document.form.postcode.value="";
				 document.form.postcode.focus();
				 return false;
				 }
		}	
		  
		  
	/*if(document.form.search_agent_type.value=="")
		  {
		  alert("please enter type");
		  document.form.type.focus();
		  return false;
		  }*/
		  
			
		  
return true;
}

function validate_property()
{
	if(document.property_form.property_name.value=="")
	{
		alert("Property Name field is empty!!")
			return false;
	}
	if(document.property_form.street.value=="")
	{
		alert("Property street field is empty!!")
			return false;
	}
	if(document.property_form.state.value=="")
	{
		alert("Property Postcode field is empty!!")
			return false;
	}
	if(isNaN(document.property_form.state.value))
	{
		alert("Property Postcode value is not a number!!")
			return false;
	}
	if(document.property_form.total_price.value=="")
	{
		alert("Property Price field is empty!!")
			return false;
	}
	if(isNaN(parseInt(document.property_form.total_price.value)))
	{
		document.property_form.total_price.value="";
		alert("Property Price value is not a number!!")
			return false;
	}
	
	if(document.property_form.prop_brief_descp.value=="")
	{
		alert("Property Brief-Description (English) field is empty!!")
			return false;
	}
	if(document.property_form.prop_descp.value=="")
	{
		alert("Property Description (English) field is empty!!")
			return false;
	}
	if(document.property_form.prop_brief_descp_fr.value=="")
	{
		alert("Property Brief-Description (French) field is empty!!")
			return false;
	}
	if(document.property_form.prop_descp_fr.value=="")
	{
		alert("Property Description (French) field is empty!!")
			return false;
	}
	if(document.property_form.prop_brief_descp_nl.value=="")
	{
		alert("Property Brief-Description (Dutch) field is empty!!")
			return false;
	}
	if(document.property_form.prop_descp_nl.value=="")
	{
		alert("Property Description (Dutch) field is empty!!")
			return false;
	}
	
	var image_file=document.property_form.floor_plan.value;
	
	if(image_file!="")
		{
		 image_file_ext=image_file.length-3;
		 
		 file_extension=image_file.substring(image_file_ext);
		  if((file_extension!="gif")&& (file_extension!="jpg")&& (file_extension!="png")&& (file_extension!="JPG")&& (file_extension!="GIF"))
		  {
			alert("You have to upload .gif or .jpg or .png files only!");
			document.property_form.floor_plan.value="";
			return false;
		  }
		}
		
	pdf_file=document.property_form.attachments.value;
	if(pdf_file!="")
		{
			
		 pdf_file_ext=pdf_file.length-3;
		 
		 file_extension=pdf_file.substring(pdf_file_ext);
		  if((file_extension!="pdf")&& (file_extension!="PDF"))
		  {
			alert("You have to upload .pdf files only!");
			document.property_form.attachments.value="";
			return false;
		  }
		}
	
	document.property_form.submit();
}
function update_property()
{
	document.prop_update.submit();
}
function enable_textbox()	{
	if(document.property_form.bedrooms.value==11)
		document.property_form.bedrooms_value.disabled=false;
	else
		document.property_form.bedrooms_value.disabled=true;
}
/*function enable_edittextbox()	{
	if(document.prop_update.bedrooms.value==11)
		document.prop_update.bedrooms_value.disabled=false;
	else
		document.prop_update.bedrooms_value.disabled=true;
}*/


function validateform1()
	{
	var message="";	
	if(document.form.username.value=="")
	{
	alert("Enter username.");
	return false;
	}
	
	if(document.form.companyname.value=="")
	{
	alert("Enter Company name.");
	return false;
	}
	
	if(document.form.fname.value=="")
	{
	alert("Enter First name");
	return false;
	}
	var fname=document.form.fname.value;
	
			for(var s=0;s<fname.length;s++)
			{
				 c=fname.charAt(s);
				 
				 if (c>0 || c<9)
					 {
					alert("Name cannot contain numbers.");
					 document.form.fname.value="";
					 document.form.fname.focus();
					 return false;
					 }
					 else{
					 
					 }
			}
			
		if(document.form.lname.value=="")
		{
		alert("Enter Last name");
		return false;
		}		
	
	
	 if(document.form.email.value=="")
			  {
			  alert("Your email address is not valid.");
			  document.form.email.focus();
			  return false;
			  }
			  
			  
			  if(document.form.email.value!="")
				{
				 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	
					if (filter.test(document.form.email.value))
						{
	
						}
					else
						{
							alert("Your email address is not valid.");
							document.form.email.focus();
							return false;
							
						}
				}
				
			if(document.form.mobile_no.value=="")
				{
				alert("Please enter phone no.");
				return false;
				}
			
			var phone=document.form.mobile_no.value;
			var c;
			if(phone.length <8)
			{
			alert("Invalid Mobile Phone No. ");
			document.form.mobile_no.value="";
			document.form.mobile_no.focus();
			return false;
			}	
			for(var s=0;s<phone.length;s++)
			{
				 c=phone.charAt(s);
				 
				 if (c>0 || c<9)
					 {
					
					 }
					 else{
					 alert("Enter Valid Mobile Phone No.");
					 document.form.mobile_no.value="";
					 document.form.mobile_no.focus();
					 return false;
					 }
			}	
			
			if(document.form.phone_no.value=="")
			{
			alert("Please enter Telephone no.");
			return false;
			}
			
			var phone1=document.form.phone_no.value;
			var c;
		
		for(var s=0;s<phone1.length;s++)
		{
			 c=phone1.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				
				 }
				 else{
				 alert("Enter valid telephone No.");
				 document.form.phone_no.value="";
				 document.form.phone_no.focus();
				 return false;
				 }
		}	
			
			if(document.form.address.value=="")
			  {
			  alert("Please enter address");
			  document.form.address.focus();
			  return false;
			  }
	
		if(document.form.town.value=="")
			  {
			  alert("Please specify a town");
			  document.form.town.focus();
			  return false;
			  }
			 
		/*if(document.form.country.value=="")
			  {
			  alert("Please select a country");
			  document.form.country.focus();
			  return false;
			  }*/
		
		if(document.form.postcode.value=="")
			  {
			  alert("Please enter Postal code");
			  document.form.postcode.focus();
			  return false;
			  }
			  var postcode=document.form.postcode.value;
	
			for(var s=0;s<postcode.length;s++)
			{
				 c=postcode.charAt(s);
				 
				 if (c>0 || c<9)
					 {
					
					 }
					 else{
					 alert("Invalid postal code");
					 document.form.postcode.value="";
					 document.form.postcode.focus();
					 return false;
					 }
			}	
			  
			  
		/*if(document.form.type.value=="")
			  {
			  alert("please enter type");
			  document.form.type.focus();
			  return false;
			  }*/
			  
	return true;
	}
	
function validate_contact()
{
	/*if (document.contact_form.mvdate.value=="")
	{
		alert("Please select the month");
		return false;
	}*/
	if(back==1)
	{
		history.go(-1);
		return false;
	}
	if (document.contact_form.p2sla.value=="")
	{
		alert("Please select whether you have a property to sell!");
		return false;
	}
	if (document.contact_form.p2lta.value=="")
	{
		alert("Please select select whether you have a property to let!");
		return false;
	}
	if (document.contact_form.title.value=="")
	{
		alert("Please enter a title!");
		return false;
	}
	var title=document.contact_form.title.value;

		for(var s=0;s<title.length;s++)
		{
			 c=title.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				alert("Title field cannot contain numbers.");
				 document.contact_form.title.value="";
				 return false;
				 }
				 else{
				 
				 }
		}	
	if (document.contact_form.fname.value=="")
	{
		alert("Please enter a first name!");
		return false;
	}
	var fname=document.contact_form.fname.value;

		for(var s=0;s<fname.length;s++)
		{
			 c=fname.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				alert("First name cannot contain numbers.");
				 document.contact_form.fname.value="";
				 return false;
				 }
				 else{
				 
				 }
		}	
	if (document.contact_form.lname.value=="")
	{
		alert("Please enter a last name!");
		return false;
	}
	var lname=document.contact_form.lname.value;

		for(var s=0;s<lname.length;s++)
		{
			 c=lname.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				alert("Last name cannot contain numbers.");
				 document.contact_form.lname.value="";
				 return false;
				 }
				 else{
				 
				 }
		}	
	if (document.contact_form.email.value=="")
	{
		alert("Please enter a email address!");
		return false;
	}
	if(document.contact_form.email.value!="")
				{
				 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	
					if (filter.test(document.contact_form.email.value))
						{
	
						}
					else
						{
							alert("Your email address is not valid.");
							/*document.contact_form.email.value.focus();*/
							return false;
							
						}
						
				}
				
	var email1=document.contact_form.email.value;
	var email2=document.contact_form.confirm_email.value;
	if(email1!=email2)
	{
		alert("Please retype the email address correctly!!");
		return false;
	}
	if (document.contact_form.telday.value=="")
	{
		alert("Please enter a telephone number!");
		return false;
	}
	var phno=document.contact_form.telday.value;
	var i=0;
	var GoodChars = "0123456789()-+ ";
	for(i=0;i<=phno.length-1;i++)
	{
		if (GoodChars.indexOf(phno.charAt(i)) == -1) 
		{
			alert("The phone number is not valid");
			return false;
		}
	}
	/*var phone=document.contact_form.telday.value;
			var c;
			if(phone.length <8)
			{
			alert("Invalid telephone(day) No. ");
			document.contact_form.telday.value="";
			document.contact_form.telday.focus();
			return false;
			}	
			for(var s=0;s<phone.length;s++)
			{
				 c=phone.charAt(s);
				 
				 if (c>0 || c<9)
					 {
					
					 }
					 else{
					 alert("Enter Valid telephone(day) No.");
					 document.contact_form.telday.value="";
					 document.contact_form.telday.focus();
					 return false;
					 }
			}*/	
	/*if (document.contact_form.televening.value=="")
	{
		alert("Please enter a telephone for evening!");
		return false;
	}
	var phone=document.contact_form.televening.value;
			var d;
			if(phone.length <8)
			{
			alert("Invalid telephone(evening) No. ");
			document.contact_form.televening.value="";
			document.contact_form.televening.focus();
			return false;
			}	
			for(var p=0;p<phone.length;p++)
			{
				 d=phone.charAt(p);
				 
				 if (d>0 || d<9)
					 {
					
					 }
					 else{
					 alert("Enter Valid telephone(evening) No.");
					 document.contact_form.televening.value="";
					 document.contact_form.televening.focus();
					 return false;
					 }
			}*/	
		if(document.contact_form.address.value=="")	
		{
			alert("Please enter an address!");
			return false;
		}
		if(document.contact_form.postcode.value=="")	
		{
			alert("Please enter an postcode!");
			return false;
		}
		var num=parseInt(document.contact_form.postcode.value);
		if(isNaN(num))
		{
			alert("Postcode should be a number");
			return false;
		}
		if(document.contact_form.comments.value=="")	
		{
			alert("Please enter some comment!");
			return false;
		}
}

function validate_feedback()
{
if (document.contact_form1.name.value=="")
	{
		alert("Please enter a  name!");
		return false;
	}
	var name=document.contact_form1.name.value;

		for(var s=0;s<name.length;s++)
		{
			 c=name.charAt(s);
			 
			 if (c>0 || c<9)
				 {
				alert("First name cannot contain numbers.");
				 document.contact_form1.name.value="";
				 return false;
				 }
				 else{
				 
				 }
		}	
		
		if (document.contact_form1.email.value=="")
		{
		alert("Please enter a email address!");
		return false;
		}
	if(document.contact_form1.email.value!="")
				{
				 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	
					if (filter.test(document.contact_form1.email.value))
						{
	
						}
					else
						{
							alert("Your email address is not valid.");
							/*document.contact_form.email.value.focus();*/
							return false;
							
						}
						
				}
				
	if (document.contact_form1.subject.value=="")
		{
		alert("Please enter a subject!");
		return false;
		}
		
	if(document.contact_form1.comment.value=="")	
		{
			alert("Please enter some comment!");
			return false;
		}	
}

function backform()
{	
	property_form.document.history.go(-1);
}

function check_userform()
{
		if(document.user_login.fname.value=="")	
		{
			alert("First name field is empty!!!");
			return false;
		}	
		if(document.user_login.lname.value=="")	
		{
			alert("Last name field is empty!!");
			return false;
		}	
		if(document.user_login.email.value=="")	
		{
			alert("Email field is empty!!");
			return false;
		}	
		if(document.user_login.email.value!="")
		{
			 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
				if (filter.test(document.user_login.email.value))
				{

				}
				else
				{
					alert("Your email address is not valid.");
					/*document.contact_form.email.value.focus();*/
					return false;
				}
		}
		if(document.user_login.mobilep.value=="")	
		{
			alert("Mobile phone field is empty!!");
			return false;
		}	
		if(isNaN(document.user_login.mobilep.value))	
		{
			alert("Mobile phone field value is not a number!!");
			return false;
		}	
		if(document.user_login.address.value=="")	
		{
			alert("Address field is empty!!");
			return false;
		}
		if(document.user_login.postcode.value=="")	
		{
			alert("postcode field is empty!!");
			return false;
		}
		var n=0;
		for(var i=0;i<document.user_login.buy_rent.length;i++)
		{
			if(document.user_login.buy_rent[i].checked)
				{
					n=1;
					//return true;
				}
		
		}	
		if(n==0){
			alert("please select whether you own a house or want to rent!!");
			return false;
		}
		
		if(document.user_login.username.value=="")	
		{
			alert("username field is empty!!");
			return false;
		}
		if(document.user_login.password.value=="")	
		{
			alert("password field is empty!!");
			return false;
		}
}
function check_routemap()
{
		if((document.route.postcode.value==0) && (document.route.toarea.value==""))
		{
			alert("Please fill postcode OR town name field!!");
			return false;
		}
		if(isNaN(document.route.postcode.value))	
		{
			alert("Postcode value is not a number!!");
			return false;
		}
}
var back;
function back_form()
{
		back=1;		
}