// JavaScript Document
function formval()
{
	
	var flg = validateBlank('add_propertynow','title',"'Title' is a required field.");	
	if(flg)
		flg = validateBlank('add_propertynow','address',"'Address' is a required field.");
	if(flg)
		flg = validateBlank('add_propertynow','postcode',"'PostCode' is a required field.");
	/*if(flg)
		flg = validateImage('add_propertynow','img1',"'Image' is a required field.");*/
	if(flg)
		flg = validateNumber('add_propertynow','price',"'Price' is a required field. Please type a number without spaces, commas or pound signs.");
	if(flg)
		flg = validatephone('add_propertynow','contact',"'Phone / Mobile Number' is a required field. Please type your number with no spaces.");
	if(flg)
		flg = validateBlank('add_propertynow','short_desc',"'Short Description' is a required field.");
	/*if(flg)
		flg = validateBlank('add_propertynow','Description1',"'Description' is a required field.");*/
	if(flg)
		return true;
	return false;
}
function picture()
{
	  
	  var leng =document.add_propertynow.img1.value.length;
	  var ind=document.add_propertynow.img1.value.indexOf(".");
	  ind=ind+1;
	  var exet=document.add_propertynow.img1.value.substr(ind,leng-ind);
  	  exet = exet.toLowerCase();
	  if(exet=='jpg'||exet=='jpeg'||exet=='JPG'||exet=='JPEG'|| exet=='gif' || exet=='GIF' ||  exet=='png' || exet=='PNG' ||  exet=='bmp' || exet=='BMP')
	  {
		  return true;
	  }
	  else
	  {
		   alert('Your image is Invalid. Upload only JPEG,GIF,PNG or BMP Image.'); 
		   return false;
	  }
}
function addproperty_category()
{
//	alert(document.category.propertyPurpose.value);
	
	var property_cat = document.category.propertyPurpose.value;
	document.category.ppurpose.value = property_cat;
	if(property_cat=='S' || property_cat=='R')
	{
		document.category.action = "addyour-propertynow.php";
		return true;
	}
	else if(property_cat=='A' || property_cat=='O')
	{
		document.category.action = "addyour-propertynow-agent.php";
		return true;
	}
	return false;
}