function Remove_Spaces_Editor(content,id,msg)
{
	//alert("fi");
  //alert("content="content);alert("msg="msg);
  //content = content.replace("<p>&nbsp;</p><p>&nbsp;</p>", "");
  content = content.replace("<p>&nbsp;</p>", "");
  content = content.replace(/&nbsp;/g, "");
  content = content.replace("<p></p>", "");
  content = content.replace("<br />", "");
  content = content.replace("<p></p>", "");
  content = content.replace("<br>", "");
  content = content.replace(" ", "");
  content = content.replace("<p></p>", "");
  //alert("."+content+".");
  if (content == ""){
	  alert(msg);
	  //id.selection.selectNode(inst.getBody(), true, true);
	  id.contentWindow.focus();
	  return false;
  }
 }
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}
function defaultfocus()
{
	document.frmlogin.txtusername.focus();
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}
function PriceValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@#$%^&*()+-=[]\\\;/{}|\"<>?`~,:.'";
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please don't enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}
function DecimalValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = ".";
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please don't enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}

function SpecialValidate2(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = '!@#$%^&*()\"{}[]`~';
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please don't enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}


function AlphaValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	//var iChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@#$%^&*()£+-=[]\\\;/{}|\"<>?`~,:'";
	var iChars = "1234567890.";
	//return false;
	for (var i = 0; i < txtCtrl.value.length; i++) {
		//alert(iChars.indexOf(txtCtrl.value.charAt(i)));
		if (iChars.indexOf(txtCtrl.value.charAt(i)) == -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please don't enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}


function PriceValidate2(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@#$%^&*()+-=[]\\\;/{}|\"<>?`~,:'";
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}

function QuoteValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = '"';
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			alert ("The "+ctrName+" has double quotes.");
			//alert ("Please enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}

function PhoneValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}
	var iChars = "@#$%^&*+=[]\\\;/{}|\"<>?`~,:'";
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			alert ("Please enter your phone number with out special characters");
			//alert ("Please enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}
function SpecialValidate(txtCtrl, val) 
{
	var ctrName = val;
	/*if (trim(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();	
		return false;		
	}*/
	var iChars = '@#$%^*+=[]\\\;{}|\"<>?`~';
	for (var i = 0; i < txtCtrl.value.length; i++) {
		if (iChars.indexOf(txtCtrl.value.charAt(i)) != -1) {
			//alert ("The "+ctrName+" has special characters. \nThese are not allowed.\n Please remove them.");
			alert ("Please enter "+ctrName);
			txtCtrl.select();
			txtCtrl.focus();
			return false;
		}
 	 }	
}

function  checkEnter(e){ 
	//alert("in");//e is event object passed from function invocation
	var characterCode //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	e = event
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		Validate();
	}
}

function changePwdvalidate()
{
	var form_name=document.frmpassword;
	if(TextValidate(form_name.admin_name,"Administrator Name")==false){return false;}
	if(TextValidate(form_name.old_password,"Old Password")==false){return false;}	
	if(SpecialValidate(frmpassword.old_password,"Old Password with out special characters")==false){return false;}
	if(TextValidate(form_name.new_password,"New Password")==false){return false;}
	if(SpecialValidate(frmpassword.new_password,"New Password with out special characters")==false){return false;}
	if(TextValidate(form_name.confirm_password,"Confirm Password")==false){return false;}
	if(SpecialValidate(frmpassword.confirm_password,"Confirm Password with out special characters")==false){return false;}
	if(Comparetextboxes(form_name.new_password,form_name.confirm_password)==false){return false;}
}

function validate(){
		if(TextValidate(document.frmlogin.txtusername,"the User Name")==false){ return false;}
		if(TextValidate(document.frmlogin.txtpassword,"the Password")==false){ return false;}
		document.frmlogin.submit();
}
function validateagent()
{
	if(TextValidate(document.frmagent.agent_firstname,"the First name")==false){ return false;}
	if(SpecialValidate(document.frmagent.agent_firstname,"the First name with out special characters")==false){return false;}
	if(TextValidate(document.frmagent.agent_lastname,"the Last name")==false){ return false;}
	if(SpecialValidate(document.frmagent.agent_lastname,"the Last name with out special characters")==false){return false;}
	if(TextValidate(document.frmagent.agent_email,"the Email address")==false){ return false;}
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(document.frmagent.agent_email.value == "")
	{
		alert("Please enter a valid email address\ne.g. username@domainname.com");		
		document.frmagent.agent_email.focus();   	
		return false;		
	}	else if (!filter.test(document.frmagent.agent_email.value)) 	{
		alert("Please enter a valid email address\ne.g. username@domainname.com");
		document.frmagent.agent_email.focus();	   	
		document.frmagent.agent_email.select();
		return false;
	}
	if(TextValidate(document.frmagent.agent_address1,"the Address")==false){ return false;}
	if(SpecialValidate(document.frmagent.agent_address1,"the Address with out special characters")==false){return false;}
	if(TextValidate(document.frmagent.agent_town,"the Town/City")==false){ return false;}
	if(SpecialValidate(document.frmagent.agent_town,"the Town/City with out special characters")==false){return false;}
	if(TextValidate(document.frmagent.agent_postcode,"the Post/Zip code")==false){ return false;}
	if(SpecialValidate(document.frmagent.agent_postcode,"the Post/Zip code with out special characters")==false){return false;}
	if(document.frmagent.agent_country.value == "")
	{
		alert("Please select a Country");
		document.frmagent.agent_country.focus();
		return false;
	}
	//if(TextValidate(document.frmagent.agent_languagespoken,"the Languages spoken")==false){ return false;}
	//if(SpecialValidate(document.frmagent.agent_languagespoken,"the Languages spoken with out special characters")==false){return false;}
	if(document.frmagent.agent_find.value == "")
	{
		alert("Please select an option from How did you find us");
		document.frmagent.agent_find.focus();
		return false;
	}
	if(TextValidate(document.frmagent.agent_username,"the Username")==false){ return false;}
	if(trim(document.frmagent.agent_username.value).length < 6)
	{
		alert("The Username must be atleast 6 characters");	
		document.frmagent.agent_username.focus();
		return false;
	}
	/*if(SpecialValidate(document.frmagent.agent_username,"the Username with out special characters")==false){return false;}*/
	if(TextValidate(document.frmagent.agent_password,"the Password")==false){ return false;}
	if(trim(document.frmagent.agent_password.value).length < 6 )
	{
		alert("The password must be atleast 6 characters");	
		document.frmagent.agent_password.focus();
		return false;
	}
	if(document.frmagent.agent_alerts.checked == true)
	{
		
		if(trim(document.frmagent.agent_mobile.value) == "")
		{
 			alert("Please enter a mobile number");
			document.frmagent.agent_mobile.focus();
			return false;
		}
	}
	/*if(SpecialValidate(document.frmagent.agent_password,"the Password with out special characters")==false){return false;}*/
	//if(TextValidate(document.frmagent.agent_phone,"the Telephone")==false){ return false;}
	//if(TextValidate(document.frmagent.agent_mobile,"the Mobile phone")==false){ return false;}
	document.frmagent.action="agent.php";
	document.frmagent.submit();
}
function validatetemplate()
{
	if(TextValidate(document.frmtemplate.template_name,"the Template name")==false){ return false;}
                if(TextValidate(document.frmtemplate.template_subject,"the Template subject")==false){ return false;}
	var editor_id = tinyMCE.getInstanceById('template_text');
	if(Remove_Spaces_Editor((tinyMCE.getContent('template_text')),editor_id,"Please enter the Content")==false) {
		return false; 
	}
	document.frmtemplate.action="template.php";
	document.frmtemplate.submit();
}
function validatemember()
{
	if(TextValidate(document.frmmember.member_firstname,"the First name")==false){ return false;}
	if(SpecialValidate(document.frmmember.member_firstname,"the First name with out special characters")==false){return false;}
	if(TextValidate(document.frmmember.member_lastname,"the Last name")==false){ return false;}
	if(SpecialValidate(document.frmmember.member_lastname,"the Last name with out special characters")==false){return false;}
	if(TextValidate(document.frmmember.member_email,"the Email address")==false){ return false;}
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(document.frmmember.member_email.value == "")
	{
		alert("Please enter a valid email address\ne.g. username@domainname.com");		
		document.frmmember.member_email.focus();   	
		return false;		
	}	else if (!filter.test(document.frmmember.member_email.value)) 	{
		alert("Please enter a valid email address\ne.g. username@domainname.com");
		document.frmmember.member_email.focus();	   	
		document.frmmember.member_email.select();
		return false;
	}
 	if(TextValidate(document.frmmember.member_password,"the Password")==false){ return false;}
	if(document.frmmember.member_password.value.length < 6 )
	{
		alert("The password must be atleast 6 characters");	
		document.frmmember.member_password.focus();
		return false;
	}
 	document.frmmember.action="member.php";
	document.frmmember.submit();
}

function deletemember(id)
{
	if(confirm("Do you want to delete this member?"))
	{
		window.location.href = "member_view.php?status=delete&member_id="+id;
 	}
}
function deletetopic(id)
{
	if(confirm("Do you want to delete this blog item?"))
	{
		window.location.href = "blog_view.php?status=delete&blog_id="+id;
 	}
}
function deletetemplate(id)
{
	if(confirm("Do you want to delete this template?"))
	{
		window.location.href = "template_view.php?status=delete&template_id="+id;
 	}
}
function textfocus(){
		document.frmlogin.txtusername.focus();
		return false;
}
function ClearValue(field, strCheck)
{
	//alert(strCheck);
	if(field.value == strCheck)
	field.value = "";				
}
function ClearValue_email(field, strCheck)
{
	if(field.value == strCheck)
	field.value = "";				
}
function Repopulate_email(field, strCheck)
{
	if(field.value == "")
	field.value = strCheck;
}
function validateemailtype()
{
	if(document.getElementById('email_type').value == "test")
	{
		document.getElementById('test').style.display = "";
	}else{
		document.getElementById('test').style.display = "none";
	}	
}
function validateemail()
{
	if(document.frmtemplate.email_type.value == "")
	{
		alert("Please select a type");
		document.frmtemplate.email_type.focus();
		return false;
	}
	if(document.getElementById('test').style.display == "")
	{
 		if(document.frmtemplate.test_email.value == "")
		{
			alert("Please enter a test email address");	
			document.frmtemplate.test_email.focus();
			return false;
		}
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if(document.frmtemplate.test_email.value == "")
		{
			alert("Please enter a valid email address\ne.g. username@domainname.com");		
			document.frmtemplate.test_email.focus();   	
			return false;		
		}	else if (!filter.test(document.frmtemplate.test_email.value)) 	{
			alert("Please enter a valid email address\ne.g. username@domainname.com");
			document.frmtemplate.test_email.focus();	   	
			document.frmtemplate.test_email.select();
			return false;
		}		
 	}
	if(document.frmtemplate.email_template.value == "")
	{
		alert("Please select a template");
		document.frmtemplate.email_template.focus();
		return false;
	}
	document.frmtemplate.action = "email.php?status=mail";
	document.frmtemplate.submit();
}
function changetype()
{
	if((document.getElementById('typetext').style.display == "") && (document.getElementById('typepassword').style.display == "none")){
		//alert("inside");
		document.getElementById('typetext').style.display = "none";
		document.getElementById('typepassword').style.display = "";
 		document.getElementById('txtpassword2').focus();
	}
}

function Repopulate(field, strCheck)
{
	if(field.value == ""){
		document.getElementById('typetext').style.display = "";	
		document.getElementById('typepassword').style.display = "none";	
		field.value = strCheck;
	}else{
		document.getElementById('typetext').style.display = "none";	
		document.getElementById('typepassword').style.display = "";	
	}
}
function showcontent()
{
	if(document.getElementById("content_footer").style.display == "none")
	{
		document.getElementById("content_footer").style.display = "";
		document.getElementById("plus_image").src = "beachLetsImages/plusOver.jpg";
	}else{
		document.getElementById("content_footer").style.display = "none";	
		document.getElementById("plus_image").src = "beachLetsImages/plusOn.jpg";
	}
}
function changecolor(id)
{
	//document.getElementById(id).style.background = "#effbff";
	document.getElementById(id).style.background = "#efefef";
}
function restorecolor(id)
{
	document.getElementById(id).style.background = "#FFFFFF";
}
function validateblog()
{
	if(TextValidate(document.frmblog.blog_title,"the Title")==false){ return false;}
	if(QuoteValidate(document.getElementById("blog_title"),"Title field") == false){return false;}
	var editor_id = tinyMCE.getInstanceById('blog_description');
	if(Remove_Spaces_Editor((tinyMCE.getContent('blog_description')),editor_id,"Please enter the Description")==false) {
		return false; 
	}
 	document.frmblog.action="blog.php";
	document.frmblog.submit();
}
function changestatus()
{
	if(document.frmblog.blog_status.checked == true)
	{
		document.frmblog.blog_hidden_status.value = 1;
	}else{
		document.frmblog.blog_hidden_status.value = 0;
	}
}
function changediv(id)
{
	if(document.getElementById("image_temp").style.display == ""){
		document.getElementById("image_temp").style.display = "none";
	}
	if(document.getElementById("rental-temp").style.display == ""){
		document.getElementById("rental-temp").style.display = "none";
	}
	document.getElementById("tab_id_hidden").value = id;
	/*if(document.getElementById("rental-conditions").style.display == ""){
		document.getElementById("rental-conditions").style.display = "none";
	}*/
	if(id == 5)
	{
		document.getElementById("rental-conditions").style.display = "";
	}else{
		document.getElementById("rental-conditions").style.display = "none";	
	}
	for(var i=1;i<=6;i++)
	{	
		
		if(i == id)
		{
			document.getElementById(i).style.display = "";
			document.getElementById("tab"+i).className = "propertyactive";
			//alert(document.getElementById(i).className);
		}else{
			document.getElementById(i).style.display = "none";
			document.getElementById("tab"+i).className = "propertytab";
			//document.getElementById(i).className = "propertytab";
		}
	}
}
/*function changetab(id)
{
	alert(id);
	return false;
	if(document.getElementById("image_temp").style.display == ""){
		document.getElementById("image_temp").style.display = "none";
	}
	if(document.getElementById("rental-temp").style.display == ""){
		document.getElementById("rental-temp").style.display = "none";
	}
	document.getElementById("tab_id_hidden").value = id;
	/*if(document.getElementById("rental-conditions").style.display == ""){
		document.getElementById("rental-conditions").style.display = "none";
	}
	if(id == 5)
	{
		document.getElementById("rental-conditions").style.display = "";
	}else{
		document.getElementById("rental-conditions").style.display = "none";	
	}
	for(var i=1;i<=6;i++)
	{	
		
		if(i == id)
		{
			document.getElementById(i).style.display = "";
			document.getElementById("tab"+i).className = "propertyactive";
			//alert(document.getElementById(i).className);
		}else{
			document.getElementById(i).style.display = "none";
			document.getElementById("tab"+i).className = "propertytab";
			//document.getElementById(i).className = "propertytab";
		}
	}
}
*/
function deleteproperty(property_id)
{
	if(confirm("Are you sure you want to delete the property?"))
	{
		document.frmproperty.action = "property_view.php?status=delete&property_id="+property_id;
		document.frmproperty.submit();
	}
}
function validateproperty()
{
	var form_name = document.frmproperty;
	if(TextValidate(document.frmproperty.property_name,"the Property Name")==false){ return false;}
	if(QuoteValidate(document.getElementById("property_name"),"Property Name field") == false){return false;}
	if(document.frmproperty.property_type.value == "")
	{
		alert("Please select a Property type");	
		document.frmproperty.property_type.focus();
		return false;
	}
	//if(TextValidate(document.frmproperty.property_address,"the Address")==false){ return false;}
	//if(TextValidate(document.frmproperty.property_postcode,"the Post/Zip Code")==false){ return false;}
	if(document.frmproperty.property_bedrooms.value == "")
	{
		alert("Please select No.of bedrooms");	
		document.frmproperty.property_bedrooms.focus();
		return false;
	}
	if(document.frmproperty.property_sleeps.value == "")
	{
		alert("Please select No.of Sleeps");	
		document.frmproperty.property_sleeps.focus();
		return false;
	}
	if(document.frmproperty.property_summary.value == "")
	{
		alert("Please enter the Summary");	
		document.frmproperty.property_summary.focus();
		return false;
	}
	if(document.frmproperty.property_summary.value.length > 200)
	{
		alert("The maximum allowed charactes is 200");
		document.frmproperty.property_summary.focus();
		return false;		
	}
	if(document.frmproperty.property_description.value == "")
	{
		alert("Please enter the Description");	
		document.frmproperty.property_description.focus();
		return false;
	}
	if(form_name.property_postcode.value!="")
	{
		if(QuoteValidate(document.getElementById("property_postcode"),"Property postcode field") == false){return false;}	
	}	
	if(form_name.property_website.value!="")
	{
		if(QuoteValidate(document.getElementById("property_website"),"Property website field") == false){return false;}	
	}	
	if(document.frmproperty.property_airport.value!="")
	{
		if(QuoteValidate(document.getElementById("property_airport"),"airport field") == false){return false;}
	}
	
	if(document.frmproperty.property_station.value!="")
	{
		if(QuoteValidate(document.getElementById("property_station"),"station field") == false){return false;}
	}
	
	if(document.frmproperty.property_port.value!="")
	{
		if(QuoteValidate(document.getElementById("property_port"),"port field") == false){return false;}
	}
	if(document.frmproperty.property_beach.value!="")
	{
		if(QuoteValidate(document.getElementById("property_beach"),"beach field") == false){return false;}
	}
	if(document.frmproperty.property_pub.value!="")
	{
		if(QuoteValidate(document.getElementById("property_pub"),"pub field") == false){return false;}
	}
	
	if(document.frmproperty.property_restaurant.value!="")
	{
		if(QuoteValidate(document.getElementById("property_restaurant"),"restaurant field") == false){return false;}
	}
	
	if(document.frmproperty.property_supermarket.value!="")
	{
		if(QuoteValidate(document.getElementById("property_supermarket"),"supermarket field") == false){return false;}
	}
	
	if(document.frmproperty.property_golf.value!="")
	{
		if(QuoteValidate(document.getElementById("property_golf"),"golf field") == false){return false;}
	}	
	/*var editor_id = tinyMCE.getInstanceById('property_summary');
	if(Remove_Spaces_Editor((tinyMCE.getContent('property_summary')),editor_id,"Please enter the Summary")==false) {
		return false; 
	}
	var editor_id = tinyMCE.getInstanceById('property_description');
	if(Remove_Spaces_Editor((tinyMCE.getContent('property_description')),editor_id,"Please enter the Description")==false) {
		return false; 
	}
	/*var editor_id = tinyMCE.getInstanceById('property_guestcomment');
	if(Remove_Spaces_Editor((tinyMCE.getContent('property_guestcomment')),editor_id,"Please enter the Guest comment")==false) {
		return false; 
	}*/
	if(document.frmproperty.image_path.value!="")
	{
		var file_type = document.getElementById("image_path").value.split(".");
		var final = file_type.length;
		if(file_type[final-1]!="jpg" && file_type[final-1]!="gif" && file_type[final-1]!="jpeg" && file_type[final-1]!="JPG" && file_type[final-1]!="GIF")
		{
			alert("Please upload JPEG or GIF images");
			return false;
		}
	}
	document.frmproperty.action = "property.php";
	document.frmproperty.submit();
}
function changeyear(year,type) {
	//alert(year);
	var type = type;
	var year = year;
 	var xmlhttp = false;
	// If the user is using Mozilla/Firefox/Safari/etc	
	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Set the mime type
			//xmlhttp.overrideMimeType('text/xml');
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
		//var year = ;	
		//alert(year);
		var property_id = document.getElementById("property_id").value;
		var url = 'changeyear2.php?property_id='+property_id+'&type='+type+'&year='+year;				
 		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
			//alert(xmlhttp.readyState);
  			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
					//alert(trim(xmlHttp.responseText));
					//alert(xmlHttp.responseText);
					var response     = xmlhttp.responseText;	
					//alert(response);
					//alert(type);calender_content_new				
					document.getElementById("calender_content").innerHTML = response;		
					if(type == "next")
					{
						document.getElementById("nextyear").innerHTML = Number(year)+1;
						document.getElementById("prevyear").innerHTML = Number(year)-1;
					}
					if(type == "prev")
					{
						document.getElementById("prevyear").innerHTML = Number(document.getElementById("prevyear").innerHTML)-1;
						document.getElementById("nextyear").innerHTML = Number(document.getElementById("nextyear").innerHTML)-1;
					}
								
 			}
		}
		xmlhttp.send(null);  
}
/*function datediff(from_date,to_date){
	var fromarray = from_date.split("-");
	var toarray = to_date.split("-");
	var fromdate = new Date(fromarray[0],fromarray[1],fromarray[2]);
	var todate  =  new Date(toarray[0],toarray[1],toarray[2]);
	if (fromdate.getTime()>=todate.getTime()) {
		document.getElementById("choosen_date").value = "";
		alert("wrong selection");	
		return false;
	}else {
		return true;	
	}
}

function selectdate(date)
{
	alert(date);
	return false;
 	var final_date;
	if(document.getElementById("choosen_date").value == "") {
		final_date = date;
		document.getElementById("choosen_date").value = final_date;
		//alert("inside1");
	}else {
		var current_date = document.getElementById("choosen_date").value;
		var property_id = document.getElementById("property_id").value;
		final_date = current_date+","+date;
		//var fromdate_display = current_date.split("-");
  		//var fromdate_popup = dateFormat(current_date);
		//var todate_display = date.split("-");
  		//var todate_popup = dateFormat(date);
		if(datediff(current_date,date)) {
			var Div = "<div class='popupDate' id='popup-status'>"+current_date+" to "+date+"<div class='popupDateInn'><a style='cursor:pointer;' onclick='javascript:availablecheck(1,"+property_id+");'><img src='belt-images/booked.jpg' alt='' border='0' /></a> <a style='cursor:pointer;' onclick='javascript:availablecheck(2,"+property_id+");'><img src='belt-images/available.jpg' alt='' width='74' height='23' border='0'  /></a><input type='text' name='availability_text' id='availability_text' maxlength='20'></div> </div>";
 			Tip(Div, FADEIN, 500, FADEOUT, 500,BORDERWIDTH,'0',FOLLOWMOUSE,true,ABOVE,true,STICKY, true);
			document.getElementById("choosen_date").value = final_date;
		}else {
			document.getElementById("choosen_date").value = "";
		}
		//alert(final_date);
	}
	
}
function availablecheck(type,id)
{
	//alert(id);
	//return false;
	//alert(document.getElementById("booking_date").value);
	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Set the mime type
			//xmlhttp.overrideMimeType('text/xml');
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
		//var year = ;	
		//alert(year);
		var url = 'availablecheck.php?date='+document.getElementById("choosen_date").value+"&type="+type+"&property_id="+id+"&text="+document.getElementById("availability_text").value;
		alert(url);
 		return false;
 		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
			//alert(xmlhttp.readyState);			
  			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
					//alert(trim(xmlHttp.responseText));
 					tt_HideInit();
 					var response     = trim(xmlHttp.responseText);
					//alert(response);
					//return false;
					var response_temp = response.split("#");
					document.getElementById("choosen_date").value = "";
					document.getElementById("availability_text").value = "";
					document.getElementById("curyear_hidden").value = response_temp[2];
					document.getElementById("prevyear_hidden").value = Number(response_temp[2]-1);
					document.getElementById("nextyear_hidden").value = Number(response_temp[2]+1);					
					if(response_temp[0]=="0") {						
						alert(response_temp[3]);
					}else {
						changeyear2(response_temp[2],response_temp[1]);		
					}
					
			}
		}
		xmlhttp.send(null);  
}*/
function changeyear2(year,property_id) {
	//alert(year);
	//var type = type;
	var year = year;
 	var xmlhttp = false;
	// If the user is using Mozilla/Firefox/Safari/etc	
	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Set the mime type
			//xmlhttp.overrideMimeType('text/xml');
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
 		var url = 'changeyear2.php?year='+year+'&property_id='+property_id;	
		//alert(url);
 		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
 					var response     = trim(xmlHttp.responseText);	
					//alert(response);
					//return false;
					//alert(type);calender_content_new				
					document.getElementById("calender_content").innerHTML = response;		
					//if(type == "next")
					//{
						document.getElementById("nextyear").innerHTML = Number(year)+1;
						document.getElementById("prevyear").innerHTML = Number(year)-1;
					//}
					/*if(type == "prev")
					{
						document.getElementById("prevyear").innerHTML = Number(document.getElementById("prevyear").innerHTML)-1;
						document.getElementById("nextyear").innerHTML = Number(document.getElementById("nextyear").innerHTML)-1;
					}*/
								
 			}
		}
		xmlhttp.send(null);  
}
function validaterental(id,special_offer)
{
	var id = id;
	var special_offer = special_offer;
 	var xmlhttp = false;
	//alert(id);
	// If the user is using Mozilla/Firefox/Safari/etc	
	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
 		var url = 'rentaldisplay-process.php?period_id='+id+'&specialoffer='+special_offer;	
		//alert(url);
 		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				var response_array = response.split("#");
				//alert(response);
				//return false;
				document.getElementById("rental-temp").style.display = "";
				document.getElementById("period_name").value = response_array[0];
				var first_night = response_array[1].split("-");
				var firstnight_final = first_night[2]+"-"+first_night[1]+"-"+first_night[0]
				document.getElementById("period_firstnight").value = firstnight_final;
				var last_night = response_array[2].split("-");
				var lastnight_final = last_night[2]+"-"+last_night[1]+"-"+last_night[0];
				if(special_offer == 1){					
 					document.getElementById("period_lastnight").style.display = "none";
					document.getElementById("todate_calander").style.display = "none";
					document.getElementById("lastnight_text").innerHTML = "&nbsp;";
					//document.getElementById("period_lastnight").value = lastnight_final;
				}else{
					document.getElementById("lastnight_text").innerHTML = "<p><strong>Last Night</strong></p>";
 					document.getElementById("period_lastnight").style.display = "";
					document.getElementById("todate_calander").style.display = "";
					document.getElementById("period_lastnight").value = lastnight_final;	
				}
				document.getElementById("period_weeklyrate").value = response_array[4];
				document.getElementById("period_nightlyrate").value = response_array[5];
				document.getElementById("period_minstay").value = response_array[6];
				document.getElementById("specialoffer_hidden").value = response_array[7];
				document.getElementById("rentalid_hidden").value = id;
  			}
		}
		xmlhttp.send(null);  
}
function activateproperty(propertyid)
{
	if(confirm("Are you sure do you want to change the property status?")){
		if(document.getElementById("property_active").checked == true)
		{
			updatestatus("1",propertyid);	
		}else{
			updatestatus("0",propertyid);
		}
	}
}

function updatestatus(status,propertyid)
{
	var status = status;
	var propertyid = propertyid;
 	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling 
 		var url = 'updatestate.php?status='+status+'&property_id='+propertyid;	
  		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				//alert(response);
				//return false;
				window.location.href = "property_view.php?status="+status;
  			}
		}
		xmlhttp.send(null);  
}
function updaterental(period_id,property_id)
{
	/*if(document.getElementById("period_name").value == "")
	{
		alert("Please enter the period name");
		document.getElementById("period_name").focus();
		return false;
	}*/
	if(document.getElementById("period_weeklyrate").value == "")
	{
		alert("Please enter the Weekly rate");
		document.getElementById("period_weeklyrate").focus();
		return false;
	}
	if(PriceValidate(document.getElementById("period_weeklyrate"),"numeric values for Weekly rate") == false){return false;}
	if(document.getElementById("period_nightlyrate").value == "")
	{
		alert("Please enter the Nightly rate");
		document.getElementById("period_nightlyrate").focus();
		return false;
	}
	if(PriceValidate(document.getElementById("period_nightlyrate"),"numeric values for Nightly rate") == false){return false;}
	if(document.getElementById("period_minstay").value == "")
	{
		alert("Please select the Min stay");
		document.getElementById("period_minstay").focus();
		return false;
	}
	//alert("crossed the validation");
	//return false;

	var period_id  = period_id;
	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
		var period_name = document.getElementById("period_name").value;
		var period_firstnight = document.getElementById("period_firstnight").value;
		var period_firstnight_temp = period_firstnight.split("-");
		var period_firstnight_final = period_firstnight_temp[2]+"-"+period_firstnight_temp[1]+"-"+period_firstnight_temp[0];
		//alert(period_firstnight_final);
		//return false;
		var period_lastnight = document.getElementById("period_lastnight").value;
		var period_lastnight_temp = period_lastnight.split("-");
		var period_lastnight_final = period_lastnight_temp[2]+"-"+period_lastnight_temp[1]+"-"+period_lastnight_temp[0];
 		var period_weeklyrate = document.getElementById("period_weeklyrate").value;
		var period_nightlyrate = document.getElementById("period_nightlyrate").value;
		var period_minstay = document.getElementById("period_minstay").value;
 		var url = "rental-process.php?status=update&period_id="+period_id+"&property_id="+property_id+"&period_name="+period_name+"&period_firstnight="+period_firstnight_final+"&period_lastnight="+period_lastnight_final+"&period_weeklyrate="+period_weeklyrate+"&period_nightlyrate="+period_nightlyrate+"&period_minstay="+period_minstay;	
  		//alert(url);
		//return false;
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
 				document.getElementById('5').innerHTML = response;		
				document.getElementById("rental-temp").style.display = "none";
				document.getElementById("rentalid_hidden").value = "";
  			}
		}
		xmlhttp.send(null);  

}
function deleterental(period_id,property_id)
{
	if(confirm("Are you sure to delete the Period?"))
	{
		document.getElementById("rental-temp").style.display = "none";
		deleterentalprocess(period_id,property_id)
	}
}
function deleterentalprocess(period_id,property_id)
{
	var period_id  = period_id;
	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
			//Intiate the object
			xmlhttp = new XMLHttpRequest();
	}
	// If the user is using IE
	else if (window.ActiveXObject) { 
			//Intiate the object
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//xmlhttp.setHeader("Cache-Control", "no-cache");
			//Http.get(params, callback_args)
	}	
	//Calling 
 		var url = "rental-deleteprocess.php?status=delete&period_id="+period_id+"&property_id="+property_id;
  		//alert(url);
		//return false;
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);
				//alert(response);
				//return false;
				document.getElementById("5").innerHTML = response;
  			}
		}
		xmlhttp.send(null);  

}


function divshow(div_id){
	var divArray=new Array();
	divArray[0]="chooseus";
	divArray[1]="advertisewithus";
	divArray[2]="register";
	for(var i=0;i<3;i++){		
		if(divArray[i]==div_id){			
			if(document.getElementById(divArray[i])) document.getElementById(divArray[i]).style.display ="block";
		}else{
			if(document.getElementById(divArray[i])) document.getElementById(divArray[i]).style.display ="none";
		}
	}
}
function div_detail_show(div_id){
	if(document.getElementById("tab_alert")){
		var divArray=new Array();
		divArray[0]="description1";
		divArray[1]="feature";
		divArray[2]="location";
		divArray[3]="availability";
		divArray[4]="rates";
		divArray[5]="contact";
		for(var i=0;i<6;i++){		
			if(divArray[i]==div_id){			
				if(document.getElementById(divArray[i])) document.getElementById(divArray[i]).style.display ="block";
			}else{				
				if(document.getElementById(divArray[i])) document.getElementById(divArray[i]).style.display ="none";
			}			
		}	
	}else{
		alert("Please wait while the tab loads...");	
	}
}


/*Search Function*/

var xmlHttp;
function GetXmlHttpObject() {
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function ListRegions(countryid,temp)
{
		var temp;
 	//if(countryid > 0 ){
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		if(temp == "temp")
		{
			document.frmproperty.property_country.value = countryid;
		}
		var url="searchlisting.php?getlist=region&country_id="+countryid;
		document.frmproperty.property_region.length= 0;		
		document.frmproperty.property_region.options[0] = new Option("Loading....",0);
		
		document.frmproperty.property_subregion.length= 0;		
		document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		
		
 		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data_final = trim(xmlHttp.responseText).split("@"); 	
				var data	   = data_final[0];
				//alert(data_final[0]);
 				document.frmproperty.property_region.length= 0;
				if(data!="" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
					var optionarray = data.split("#");
					document.frmproperty.property_region.options[0] = new Option("All Regions",0) ;
 					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_region.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;								
						}
  						ListSubRegions(0,countryid);
 					}
				} else {
						document.frmproperty.property_region.options[0] = new Option("No Regions",0) ;
						ListSubRegions(0,countryid);
   				}
			} 
		}
		xmlHttp.send(null);
	//} 
}
function ListSubRegions(regionid,countryid)
{
  	//if(regionid > 0){
		if(regionid == 246)
		{
 			ListRegions(4,"temp");
		}else{
			xmlHttp = GetXmlHttpObject();
			if (xmlHttp==null)
			{
			 alert ("Browser does not support HTTP Request");
			 return;
			}
			//alert("above"); 
			var url="searchlisting.php?getlist=subregion&region_id="+regionid+"&country_id="+countryid;
			document.frmproperty.property_subregion.length = 0;		
			document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
			
			document.frmproperty.property_town.length= 0;		
			document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		
			//alert(url);
			//return false;
			xmlHttp.open("GET",url,true);
			
			xmlHttp.onreadystatechange=function() { 
				if (xmlHttp.readyState==4){ 
				//	return false;
					var data_final = trim(xmlHttp.responseText).split("@");
					//alert(data_final);
					var data	   = data_final[0];
					document.frmproperty.property_subregion.length= 0;
					if(data != "" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
						var optionarray = data.split("#");
						document.frmproperty.property_subregion.options[0] = new Option("All Sub Regions",0) ;
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									document.frmproperty.property_subregion.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
							}
							ListTowns(regionid,0,countryid);
						}
					} else {
							document.frmproperty.property_subregion.options[0] = new Option("No Sub Regions",0) ;
							ListTowns(regionid,0,countryid);
					}
				} 
			}
			xmlHttp.send(null);
	}
}

function ListTowns(regionid,subregionid,countryid)
{
 	//if(subregionid > 0){
		//alert(regionid);
		//alert(subregionid);
		//alert(countryid);
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		//if(regionid == 0 && subregionid == 0 && countryid == 0){
			//var url="searchlisting.php?option=none&getlist=town&subregion_id="+subregionid+"&region_id="+regionid+"&country_id="+countryid;
		//}else{
			var url="searchlisting.php?getlist=town&subregion_id="+subregionid+"&region_id="+regionid+"&country_id="+countryid;
			//alert(url);
		//}
		//Loading text
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
 		//return false;
		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			
			if (xmlHttp.readyState==4){ 
				var data_final = trim(xmlHttp.responseText).split("@"); 
 				var data	   = data_final[0];
  				document.frmproperty.property_town.length= 0;
				if(data!="" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
					var optionarray = data.split("#");
					if(regionid == 0 && subregionid == 0 && countryid == 0){
						//alert("if");
						document.frmproperty.property_town.options[0] = new Option("All Towns",0);
					}else{
						//alert("else");
						document.frmproperty.property_town.options[0] = new Option("All Towns",0) ;					 
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									document.frmproperty.property_town.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
									
							}
						}
 					}
				}else {
						document.frmproperty.property_town.options[0] = new Option("No Towns",0) ;
 				}
			} 
		}
		xmlHttp.send(null);
	//}
}
function Timeout()
{
	setTimeout ('ListTownsTemp(0,0)',3000);	
}
function ListTownsTemp(regionid,subregionid)
{
 	//if(subregionid > 0){
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		 
		var url="searchlisting-temp.php?getlist=town&subregion_id="+subregionid+"&region_id="+regionid;
 	//	alert(url);
		//return false;
		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				//alert(trim(xmlHttp.responseText));
				//return false;
 				var data_final = trim(xmlHttp.responseText).split("@"); 	
				var data	   = data_final[0];
				
 				document.frmproperty.property_town.length= 0;
				if(data!="" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
					var optionarray = data.split("#");
					document.frmproperty.property_town.options[0] = new Option("All Towns",0) ;
					 
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split(",");
								document.frmproperty.property_town.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
								
						}
					}
				}else {
						document.frmproperty.property_town.options[0] = new Option("No Towns",0) ;
 				}
			} 
		}
		xmlHttp.send(null);
	//}
}

function CountLetter() {
   var message = document.frmdescription.property_summary.value;
   if(message.length>200){		
     alert("Your summary property description can be upto 200 characters");
     document.frmdescription.property_summary.value = message.substr(0,200);
     return false;
   }
}

function validatefacility(id) {
	//alert(document.getElementById("facilitycount").value);
	var count = document.getElementById("facilitycount").value;
	var facilityvalue= "";
	for(var i=1;i<=count;i++) {
		var id = "property_facility"+i;		
		if(document.getElementById(id).checked==true) {
			if(facilityvalue =="") {
				facilityvalue = document.getElementById(id).value;
			}else {
				facilityvalue = facilityvalue+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("facility_hidden").value = facilityvalue;
}

function validateoutdoorfacility(id) {
 	var count1 = document.getElementById("outdoorfacilitycount").value;
	var outdoorfacilityvalue= "";
	for(var j=1;j<=count1;j++) {
		var id = "property_outdoorfacilities"+j;
		if(document.getElementById(id).checked==true) {
			if(outdoorfacilityvalue =="") {
				outdoorfacilityvalue = document.getElementById(id).value;
			}else {
				outdoorfacilityvalue = outdoorfacilityvalue+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("outdoorfacility_hidden").value = outdoorfacilityvalue;
}

function validatelocalactivity(id) {
 	var count1 = document.getElementById("localcount").value;
	var localactivity= "";
	for(var j=1;j<=count1;j++) {
		var id = "property_localactivities"+j;
 		if(document.getElementById(id).checked==true) {
			if(localactivity =="") {
				localactivity = document.getElementById(id).value;
			}else {
				localactivity = localactivity+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("local_hidden").value = localactivity;
 }

function approveallimages(noofimages){
	if(document.getElementById('chkapprovestatus').checked==true){
		for(i=1;i<=noofimages;i++){
			var imagetextfieldname='image_status'+i;
			document.getElementById(imagetextfieldname).checked=true;
		}
		document.getElementById("approveall-button").style.display='';
		//document.getElementById("decline-button").style.display='none';
	}else{
		for(i=1;i<=noofimages;i++){
			var imagetextfieldname='image_status'+i;
			document.getElementById(imagetextfieldname).checked=false;
		}
		//document.getElementById("approveall-button").style.display='none';
		//document.getElementById("decline-button").style.display='';
	}
}
 
function validateimagestatus(property_id,image_id,image_status)
{
	var image_status = image_status;
	var property_id = property_id;
	var image_id = image_id;
 	var xmlhttp = false;
 	if(document.getElementById(image_status).checked == false){
		image_status1=0;
	}else{
		image_status1=1;
	}
    if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling
		
 		var url = 'updateimagestatus.php?status=update&image_status='+image_status1+'&property_id='+property_id+'&image_id='+image_id;	
  		//alert(url);
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				var response_final = response.split("@");
				document.getElementById("summaryimage_count").value = response_final[1];
				if(document.getElementById(image_status).checked == false)
				{
					alert("Image has been de-activated");	
				}else{
					alert("Image has been activated");	
				}
				//alert(response);
				//return false;
				//document.getElementById(6).innerHTML = response;
  			}
		}
		xmlhttp.send(null);  

}

function validateimageapprovecheck(chkstatusid){
	//alert(chkstatusid);
	//alert(document.getElementById(chkstatusid).checked);
	if(document.getElementById(chkstatusid).checked==false){
	  // alert("Inside");
	   document.getElementById('chkapprovestatus').checked=false;
	}
}


function validateallimagestatus(noofimages,property_id)
{
  var i;
  var imageids="";
  var imgarray="";
 for(i=1;i<=noofimages;i++){
	 var imagecheck='image_status'+i;
	if(document.getElementById(imagecheck).checked==true){
		var imageselectid=document.getElementById(imagecheck).value;
		if(imageids){
			imageids=imageids+","+imageselectid;
		}else{
			imageids=imageselectid;
		}
	}
 }
 
 //alert(imageids);
if(imageids){
	var confirmmessage="Are you sure to approve the selected images?";
}else{
	var confirmmessage="Are you sure to decline all the images?";
}
	
  if(confirm(confirmmessage)){
	var property_id=property_id;
	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling
		
 		var url = 'updateallimagestatus.php?status=update&property_id='+property_id+'&imageids='+imageids;	
  		//alert(url);
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				var response_final = response.split("@");
				document.getElementById("summaryimage_count").value = response_final[1];
				if(imageids=="")
				{
					alert("Images has been de-activated");	
				}else{
					alert("Images has been activated");	
				}
				
  			}
		}
		
		xmlhttp.send(null);  
		
		
		imgarray=imageids.split(",");
		
		if(imgarray.length==noofimages){
			document.getElementById('chkapprovestatus').checked=true;
		}else{
			document.getElementById('chkapprovestatus').checked=false;
		}
		
   }
}



function validateimage(image_id)
{
	var image_id = image_id;
 	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling
		
 		var url = 'changeimage.php?status=update&image_id='+image_id;	
  		//alert(url);
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				var response_final = response.split("#");
				//alert(response);
				//return false;
				document.getElementById("image_temp").style.display = "";
				document.getElementById("imageid_hidden").value = image_id;
				document.getElementById("image_temp").innerHTML = response_final[0];
				document.getElementById("is_summary").value = response_final[1]
  			}
		}
		xmlhttp.send(null);  
}
function deleteimage(image_id,property_id)
{
	if(confirm("Are you sure to delete the image?"))
	{
		deleteimage_confirm(image_id,property_id)
	}
}
function deleteimage_confirm(image_id,property_id)
{
 	var property_id = property_id;
	var image_id = image_id;
 	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling
		
 		var url = 'deleteimage.php?status=delete&property_id='+property_id+'&image_id='+image_id;	
  		//alert(url);
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);	
				var response_final = response.split("@");
				//alert(response);
				//return false;
				document.getElementById("image_temp").style.display = "none";
				document.getElementById(6).innerHTML = response_final[0];
				document.getElementById("summaryimage_count").value = response_final[1];
  			}
		}
		xmlhttp.send(null);  
}
function validatesubscription()
{
	if(document.frmagent.agent_newsletter.checked == true)
	{
		document.frmagent.hidden_subscribe.value = 1;
	}else{
		document.frmagent.hidden_subscribe.value = 0;	
	}
}

function validatemembernewsletter()
{
	if(document.frmmember.member_newsletter.checked == true)
	{
		document.frmmember.hidden_newsletter.value = 1;
	}else{
		document.frmmember.hidden_newsletter.value = 0;		
	}
}
function changepropertystatus(property_id,status,completed)
{
	//alert(completed);
	//return false;
	var summary_count = document.getElementById("summaryimage_count").value;
	var country_count = document.getElementById("country_hidden").value;
	var region_count = document.getElementById("region_hidden").value;
	var town_count = document.getElementById("town_hidden").value;
	if(country_count == 0 || region_count == 0 || town_count == 0)
	{
		alert("This property has no proper location");
		changediv(3);
		return false;
	}
	if(summary_count == 0)
	{
		alert("Please activate the summary image before activating the property");
		changediv(6);
		return false;
	}
	
	if(status == 1)
	{
		var alert_message = "Are you sure you want to Approve the property?";
	}else{
		var alert_message = "Are you sure you want to De-activate the property?";
	}
	if(completed == "Completed"){
		if(confirm(alert_message)){
				document.frmproperty.action = "changeproperty_status.php?property_id="+property_id+'&status='+status;
				document.frmproperty.submit();
		}
	}else{
		alert("The Advert status is not completed");
		return false;
	}
	
	
	/*if(current_status == 1 && status == 1)
	{
		alert("The Property is already activated");
		return false;
	}
	if(current_status == 0 && status == 0)
	{
		alert("The Property is already de activated");
		return false;
	}
	if(status == 1)
	{
		var confirm_message = "Are you sure to activate the property?";	
	}else{
		var confirm_message = "Are you sure to decline the property?";	
	}
	if(confirm(confirm_message)){
		var property_id = property_id;
		var status = status;
		var xmlhttp = false;
		if (window.XMLHttpRequest) {
				xmlhttp = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) { 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}	
		//Calling
			
			var url = 'changeproperty_status.php?status='+status+'&property_id='+property_id;	
			//alert(url);
			//return false;
			//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
			xmlhttp.open('GET', url, true);
			//Check that the PHP script has finished sending us the result
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					//Replace the content of the "result" DIV with the result returned by the PHP script
					var response = trim(xmlhttp.responseText);
					var response_final = response.split("@");
					if(status == 1)
					{
						alert("Property activated");	
					}else{
						alert("Property de activated");
					}
					//document.getElementById("property_status_display").innerHTML = response_final[0];
					//document.getElementById("status_text").innerHTML = response_final[1];
				}
			}
			xmlhttp.send(null); 
	}*/
}
function updatelocationstatus(propety_id,location_id,status)
{
 	var xmlhttp = false;
 	if (window.XMLHttpRequest) {
 			xmlhttp = new XMLHttpRequest();
	}
 	else if (window.ActiveXObject) { 
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}	
	//Calling
		
 		var url = 'updatelocationstatus.php?propety_id='+propety_id+'&location_id='+location_id+'&status='+status;	
  		//alert(url);
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
 		xmlhttp.onreadystatechange = function() {
   			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 				//Replace the content of the "result" DIV with the result returned by the PHP script
				var response = trim(xmlhttp.responseText);
				if(status == 1)
				{
					alert("Property activated");	
				}else{
					alert("Property de activated");
				}
  				document.getElementById("property_status_display").innerHTML = response;
  			}
		}
		xmlhttp.send(null);  
}
function validatecurrency()
{
 	var form_name=document.frmcurrency;
	if(TextValidate(form_name.currency_poundvalue,"Currency value")==false){return false;}
	if(PriceValidate2(document.getElementById("currency_poundvalue"),"numeric values for Currency value") == false){return false;}
	document.frmcurrency.action = "currency.php";
	document.frmcurrency.submit();
}
function activatenewcountry(continent_id,country_name,property_id,action)
{
	if(trim(document.frmproperty.country_new.value) == "")
	{
		alert("Please enter a country");
		document.frmproperty.country_new.focus();
		return false;
	}
	if(action == 1){
			var xmlhttp = false;
			if (window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
			}
			else if (window.ActiveXObject) { 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}	
			//Calling
				
				var url = 'activatenewcountry.php?country_name='+country_name+'&property_id='+property_id+'&continent_id='+continent_id;	
				//alert(url);
				//return false;
				//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
				xmlhttp.open('GET', url, true);
				//Check that the PHP script has finished sending us the result
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						//Replace the content of the "result" DIV with the result returned by the PHP script
						var response = trim(xmlhttp.responseText);
						
						var response_final = response.split("#");
						//alert(response);
						//return false;
						document.getElementById("country_box_temp").style.display = "none";
						document.getElementById("country_link_temp").style.display = "none";
						document.getElementById("country_temp").innerHTML = response_final[0];
						document.getElementById("country_hidden").value = response_final[1];
					}
				}
				xmlhttp.send(null); 
	}else{
			document.getElementById("country_box_temp").style.display = "none";
			document.getElementById("country_link_temp").style.display = "none";
	}
}
function activatenewregion(region_name,property_id,action)
{
	if(trim(document.frmproperty.region_new.value) == "")
	{
		alert("Please enter a region");
		document.frmproperty.region_new.focus();
		return false;
	}
	if(action == 1){
			var xmlhttp = false;
			if (window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
			}
			else if (window.ActiveXObject) { 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}	
			//Calling
				
				var url = 'activatenewregion.php?region_name='+region_name+'&property_id='+property_id;	
				//alert(url);
				//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
				xmlhttp.open('GET', url, true);
				//Check that the PHP script has finished sending us the result
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						//Replace the content of the "result" DIV with the result returned by the PHP script
						var response = trim(xmlhttp.responseText);
						var response_final = response.split("#");
						//alert(response);
						//return false;
						document.getElementById("region_box_temp").style.display = "none";
						document.getElementById("region_link_temp").style.display = "none";
						document.getElementById("region_temp").innerHTML = response_final[0];
						document.getElementById("region_hidden").value = response_final[1];
					}
				}
				xmlhttp.send(null); 
	}else{
			document.getElementById("region_box_temp").style.display = "none";
			document.getElementById("region_link_temp").style.display = "none";
	}
}
function activatenewsubregion(subregion_name,property_id,action)
{	
	if(trim(document.frmproperty.subregion_new.value) == "")
	{
		alert("Please enter a sub region");
		document.frmproperty.subregion_new.focus();
		return false;
	}
	if(action == 1){
			var xmlhttp = false;
			if (window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
			}
			else if (window.ActiveXObject) { 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}	
			//Calling
				
				var url = 'activatenewsubregion.php?subregion_name='+subregion_name+'&property_id='+property_id;	
				//alert(url);
				//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
				xmlhttp.open('GET', url, true);
				//Check that the PHP script has finished sending us the result
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						//Replace the content of the "result" DIV with the result returned by the PHP script
						var response = trim(xmlhttp.responseText);
						//alert(response);
						//return false;
						document.getElementById("subregion_box_temp").style.display = "none";
						document.getElementById("subregion_link_temp").style.display = "none";
						document.getElementById("subregion_temp").innerHTML = response;
					}
				}
				xmlhttp.send(null); 
	}else{
			document.getElementById("subregion_box_temp").style.display = "none";
			document.getElementById("subregion_link_temp").style.display = "none";
	}
}
function activatenewtown(town_name,property_id,action)
{
	if(trim(document.frmproperty.town_new.value) == "")
	{
		alert("Please enter a town");
		document.frmproperty.town_new.focus();
		return false;
	}
	if(action == 1){
			var xmlhttp = false;
			if (window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
			}
			else if (window.ActiveXObject) { 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}	
			//Calling
				
				var url = 'activatenewtown.php?town_name='+town_name+'&property_id='+property_id;	
				//alert(url);
				//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method		
				xmlhttp.open('GET', url, true);
				//Check that the PHP script has finished sending us the result
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						//Replace the content of the "result" DIV with the result returned by the PHP script
						var response = trim(xmlhttp.responseText);
						var response_final = response.split("#");
						//alert(response);
						//return false;
						document.getElementById("town_box_temp").style.display = "none";
						document.getElementById("town_link_temp").style.display = "none";
						document.getElementById("town_temp").innerHTML = response_final[0];
						document.getElementById("town_hidden").value = response_final[1];
					}
				}
				xmlhttp.send(null); 
	}else{
			document.getElementById("town_box_temp").style.display = "none";
			document.getElementById("town_link_temp").style.display = "none";
	}
}

//BOF Abhishek Yadav 29-04-2010. this function is used for populating country list according to continent.

function ListCountryNew(continentid,temp)
{
	
 	//if(countryid > 0 ){
		/*if(countryid == 0)
		{
			alert("Please select a country to select google map");
			document.getElementById("country_new").disabled  = false;
			return false;
		}*/
		if(temp == "temp")
		{
			document.frmproperty.property_continent_new.value = continentid;
		}
 		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		
		
		//alert(document.frmproperty.property_country_new.value);
		var url="../searchlisting.php?getlist=country&continent_id="+continentid;

	    document.frmproperty.property_country_new.length= 0;		
		document.frmproperty.property_country_new.options[0] = new Option("Loading....",0);

		document.frmproperty.property_region_new.length= 0;		
		document.frmproperty.property_region_new.options[0] = new Option("Loading....",0);
		
 		document.frmproperty.property_subregion_new.length= 0;		
		document.frmproperty.property_subregion_new.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town_new.length= 0;		
		document.frmproperty.property_town_new.options[0] = new Option("Loading....",0);
		
		
 		xmlHttp.open("GET",url,true);
 		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data = trim(xmlHttp.responseText);
				var data_final = data.split("@");
				//alert(data);
				//return false;
				//alert(document.frmproperty.property_region_new.length);
 				document.frmproperty.property_country_new.length= 0;
				//alert(data);
				//return false;if(data!=""
				if(data_final[0]!=""){
					var optionarray = data_final[0].split("#");
					document.frmproperty.property_country_new.options[0] = new Option("Select Country",0);
				 
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_country_new.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
						}
 						ListRegionsNew(0,continentid);
					}
				} else {
						document.frmproperty.property_country_new.options[0] = new Option("No Country",0) ;
						ListRegionsNew(0,continentid);
						 
				}
				document.getElementById("address_country").value = data_final[1];
				//showAddress(document.getElementById("address_country").value);
				
 			} 
		}
		xmlHttp.send(null);
	//} 
}
//EOF for Country listing Drop Down

function ListRegionsNew(countryid,temp)
{
	//alert(temp);
 	//if(countryid > 0 ){
		/*if(countryid == 0)
		{
			alert("Please select a country to select google map");
			document.getElementById("country_new").disabled  = false;
			return false;
		}*/
		if(temp == "temp")
		{
			document.frmproperty.property_country_new.value = countryid;
		}
 		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		if(countryid!=0) 	{
			//alert(document.getElementById("country_new").disabled);
			document.getElementById("country_new").disabled  = true;
			//alert(document.getElementById("country_new").disabled);
			//document.getElementById("country_new").readOnly = "readonly";
			document.getElementById("country_new").value  = "";
			//alert(document.getElementById("country_new").value);
 		} else {
			document.getElementById("country_new").disabled  = false;	
			document.getElementById("country_new").value  = "Enter Country";
		}
		
		//alert(document.frmproperty.property_country_new.value);
		var url="../searchlisting.php?getlist=region&country_id="+countryid;
		

		document.frmproperty.property_region_new.length= 0;		
		document.frmproperty.property_region_new.options[0] = new Option("Loading....",0);
		
 		document.frmproperty.property_subregion_new.length= 0;		
		document.frmproperty.property_subregion_new.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town_new.length= 0;		
		document.frmproperty.property_town_new.options[0] = new Option("Loading....",0);
		
		
 		xmlHttp.open("GET",url,true);
 		xmlHttp.onreadystatechange=function() { 

			if (xmlHttp.readyState==4){ 
				var data = trim(xmlHttp.responseText);
				var data_final = data.split("@");
				//alert(xmlHttp.responseText);
				//alert(data);
				//return false;
				//alert(document.frmproperty.property_region_new.length);
 				document.frmproperty.property_region_new.length= 0;
				//alert(data);
				//return false;if(data!=""
				if(data_final[0]!=""){
					var optionarray = data_final[0].split("#");
					document.frmproperty.property_region_new.options[0] = new Option("Select Region",0);
				
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
							
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
						
								document.frmproperty.property_region_new.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
						}
 						ListSubRegionsNew(0,countryid);
					}
				} else {
						document.frmproperty.property_region_new.options[0] = new Option("No Regions",0) ;
						ListSubRegionsNew(0,countryid);
						 
				}
				document.getElementById("address_country").value = data_final[1];
				//showAddress(document.getElementById("address_country").value);
				
 			} 
		}
		xmlHttp.send(null);
	//} 
}

function ListSubRegionsNew(regionid,countryid)
{
 	
	//if(regionid > 0){
		/*if(document.getElementById("property_country_new").value == 0)
		{
			alert("Please select a country to select google map");
			document.getElementById("region_new").disabled  = false;
			return false;
		}*/
		if(regionid == 246)
		{
 			ListRegionsNew(4,"temp");
		}else{
			xmlHttp = GetXmlHttpObject();
			if (xmlHttp==null)
			{
			 alert ("Browser does not support HTTP Request");
			 return;
			}
			
			var countryid = document.frmproperty.property_country_new.options[document.frmproperty.property_country_new.selectedIndex].value;
			if(regionid!=0){
					document.getElementById("country_new").disabled  = true;
					document.getElementById("region_new").disabled  = true;
					document.getElementById("country_new").value  = "";
					document.getElementById("region_new").value  = "";
					document.getElementById("subregion_new").disabled  = false;	
					document.getElementById("town_new").disabled  = false;				
					document.getElementById("subregion_new").value  = "Enter Sub Region";
					document.getElementById("town_new").value  = "Enter Town";
					
			} else if (countryid!=0) {
					document.getElementById("country_new").disabled  = true;
					document.getElementById("country_new").value  = "";
					document.getElementById("region_new").disabled  = false;
					document.getElementById("subregion_new").disabled  = false;	
					document.getElementById("town_new").disabled  = false;
					document.getElementById("region_new").value  = "Enter Region";
					document.getElementById("subregion_new").value  = "Enter Sub Region";
					document.getElementById("town_new").value  = "Enter Town";
			}else {
					document.getElementById("country_new").disabled  = false;
					document.getElementById("region_new").disabled  = false;
					document.getElementById("subregion_new").disabled  = false;
					document.getElementById("town_new").disabled  = false;
					document.getElementById("country_new").value  = "Enter Country";
					document.getElementById("region_new").value  = "Enter Region";
					document.getElementById("subregion_new").value  = "Enter Sub Region";
					document.getElementById("town_new").value  = "Enter Town";
			}	
	
			var url="../searchlisting.php?getlist=subregion&region_id="+regionid+"&country_id="+countryid;
			 
			document.frmproperty.property_subregion_new.length= 0;		
			document.frmproperty.property_subregion_new.options[0] = new Option("Loading....",0);
			
			document.frmproperty.property_town_new.length= 0;		
			document.frmproperty.property_town_new.options[0] = new Option("Loading....",0);
			
			xmlHttp.open("GET",url,true);
			
			xmlHttp.onreadystatechange=function() { 
				if (xmlHttp.readyState==4){ 
					var data = trim(xmlHttp.responseText); 		
					//return false;
					var data_final = data.split("@");
					 
					if(document.frmproperty.property_subregion_new){
						document.frmproperty.property_subregion_new.length= 0;
					}
				 
					if(data_final[0] != ""){
						document.frmproperty.property_subregion_new.style.display = "";
						var optionarray = data_final[0].split("#");
						if(document.frmproperty.property_subregion_new){
							document.frmproperty.property_subregion_new.options[0] = new Option("Select Sub Region",0) ;
						}
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									if(document.frmproperty.property_subregion_new){
										document.frmproperty.property_subregion_new.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
									}
							}
							ListTownsNew(regionid,0,countryid);
						}
					} else {
							if(document.frmproperty.property_subregion_new){
								document.frmproperty.property_subregion_new.options[0] = new Option("No Sub Regions",0) ;
							}
							document.frmproperty.property_subregion_new.style.display = "";
							ListTownsNew(regionid,0,countryid);
					}
					document.getElementById("address_region").value = data_final[1];
					if(document.getElementById("address_country").value!="")
					{
						var region_name = document.getElementById("address_country").value+","+document.getElementById("address_region").value;
					}else{
						var region_name = document.getElementById("address_region").value;
					}
					//showAddress(region_name);
				} 
			}
			xmlHttp.send(null);
	}
}

function ListTownsNew(regionid,subregionid,countryid)
{
	//if(subregionid > 0){
		/*if(document.getElementById("property_country_new").value == 0)
		{
			alert("Please select a country to select google map");
			//document.getElementById("map_address").value = "";
			return false;
		}*/
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		
		
	 var countryid = document.frmproperty.property_country_new.options[document.frmproperty.property_country_new.selectedIndex].value;
	 if(subregionid!=0){
				document.getElementById("country_new").disabled  = true;
				document.getElementById("region_new").disabled  = true;
				document.getElementById("subregion_new").disabled  = true;	
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").value  = "";
				document.getElementById("subregion_new").value  = "";
				document.getElementById("town_new").disabled  = false;
				document.getElementById("town_new").value  = "Enter Town";
		} else if(regionid!=0){
				document.getElementById("country_new").disabled  = true;
				document.getElementById("region_new").disabled  = true;
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").value  = "";
				document.getElementById("subregion_new").disabled  = false;	
				document.getElementById("town_new").disabled  = false;
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
				
		} else if (countryid!=0) {
				document.getElementById("country_new").disabled  = true;
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").disabled  = false;
				document.getElementById("subregion_new").disabled  = false;	
				document.getElementById("town_new").disabled  = false;
				document.getElementById("region_new").value  = "Enter Region";
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
		} else {
				document.getElementById("country_new").disabled  = false;
				document.getElementById("region_new").disabled  = false;
				document.getElementById("subregion_new").disabled  = false;
				document.getElementById("town_new").disabled  = false;
				document.getElementById("country_new").value  = "Enter Country";
				document.getElementById("region_new").value  = "Enter Region";
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
		}	

		var url="../searchlisting.php?getlist=town&subregion_id="+subregionid+"&region_id="+regionid+"&country_id="+countryid;
		 
			document.frmproperty.property_town_new.length= 0;		
			document.frmproperty.property_town_new.options[0] = new Option("Loading....",0);
 		//alert(url);
		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data = trim(xmlHttp.responseText); 	
				var data_final = data.split("@");
 		 		//alert(data);
				//return false;
				document.frmproperty.property_town_new.length= 0;
				if(data_final[0]!=""){
					var optionarray = data_final[0].split("#");
					
					
					if(regionid == 0 && subregionid == 0 && countryid == 0){
						//alert("if");
						document.frmproperty.property_town_new.options[0] = new Option("Select Town",0);
					}else{
						//alert("else");
						document.frmproperty.property_town_new.options[0] = new Option("Select Town",0) ;					 
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									document.frmproperty.property_town_new.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
									
							}
						}
 					}
					
					/*document.frmproperty.property_town_new.options[0] = new Option("Select Town",0) ;					 
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_town_new.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
						}
					}*/
					
					
				}else {
						document.frmproperty.property_town_new.options[0] = new Option("No Towns",0) ;
						 
				}
				document.getElementById("address_subregion").value = data_final[1];
				if(document.getElementById("address_country").value!="" && document.getElementById("address_region").value!="")
				{
					var subregion_name = document.getElementById("address_country").value+","+document.getElementById("address_region").value+","+document.getElementById("address_subregion").value;
				}else if(document.getElementById("address_country").value!="" && document.getElementById("address_region").value==""){
					var subregion_name = document.getElementById("address_country").value+","+document.getElementById("address_subregion").value;
				}
				//showAddress(subregion_name);
							
			} 
		}
		xmlHttp.send(null);
	//}
}


function ListCountryNew2(continentid,temp)
{
	
 	//if(countryid > 0 ){
		/*if(countryid == 0)
		{
			alert("Please select a country to select google map");
			document.getElementById("country_new").disabled  = false;
			return false;
		}*/
		if(temp == "temp")
		{
			document.frmproperty.property_continent_new.value = continentid;
		}
 		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		
		
		//alert(document.frmproperty.property_country_new.value);
		var url="../searchlisting.php?getlist=country&continent_id="+continentid;

	    document.frmproperty.property_country.length= 0;		
		document.frmproperty.property_country.options[0] = new Option("Loading....",0);

		document.frmproperty.property_region.length= 0;		
		document.frmproperty.property_region.options[0] = new Option("Loading....",0);
		
 		document.frmproperty.property_subregion.length= 0;		
		document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		
		
 		xmlHttp.open("GET",url,true);
 		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data = trim(xmlHttp.responseText);
				var data_final = data.split("@");
				//alert(data);
				//return false;
				//alert(document.frmproperty.property_region_new.length);
 				document.frmproperty.property_country.length= 0;
				//alert(data);
				//return false;if(data!=""
				if(data_final[0]!=""){
					var optionarray = data_final[0].split("#");
					document.frmproperty.property_country.options[0] = new Option("Select Country",0);
				 
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_country.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
						}
 						ListRegionsNew2(0,continentid);
					}
				} else {
						document.frmproperty.property_country.options[0] = new Option("No Country",0) ;
						ListRegionsNew2(0,continentid);
						 
				}
				document.getElementById("address_country").value = data_final[1];
				//showAddress(document.getElementById("address_country").value);
				
 			} 
		}
		xmlHttp.send(null);
	//} 
}
//EOF for Country listing Drop Down

function ListRegions2(countryid,temp)
{
		var temp;
 	//if(countryid > 0 ){
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		if(temp == "temp")
		{
			//alert(countryid);
			document.frmproperty.property_country.value = countryid;
		}
		var url="../searchlisting.php?getlist=region&country_id="+countryid;
		
		document.frmproperty.property_region.length= 0;		
		document.frmproperty.property_region.options[0] = new Option("Loading....",0);
		
		document.frmproperty.property_subregion.length= 0;		
		document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		
		
 		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data_final = trim(xmlHttp.responseText).split("@"); 	
				var data	   = data_final[0];
				//alert(data_final[0]);
 				document.frmproperty.property_region.length= 0;
				if(data!="" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
					var optionarray = data.split("#");
					document.frmproperty.property_region.options[0] = new Option("All Regions",0) ;
 					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_region.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;								
						}
  						ListSubRegions2(0,countryid);
 					}
				} else {
						document.frmproperty.property_region.options[0] = new Option("No Regions",0) ;
						ListSubRegions2(0,countryid);
   				}
			} 
		}
		xmlHttp.send(null);
	//} 
}
function ListSubRegions2(regionid,countryid)
{
  	//if(regionid > 0){
		//alert(countryid);
	//	return false;
		if(regionid == 246)
		{
 			ListRegions2(4,"temp");
		}else{
			xmlHttp = GetXmlHttpObject();
			if (xmlHttp==null)
			{
			 alert ("Browser does not support HTTP Request");
			 return;
			}
			//alert("above"); 
			var url="../searchlisting.php?getlist=subregion&region_id="+regionid+"&country_id="+countryid;
			document.frmproperty.property_subregion.length = 0;		
			document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
			
			document.frmproperty.property_town.length= 0;		
			document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		
			//alert(url);
			//return false;
			xmlHttp.open("GET",url,true);
			
			xmlHttp.onreadystatechange=function() { 
				if (xmlHttp.readyState==4){ 
				//	return false;
					var data_final = trim(xmlHttp.responseText).split("@");
					//alert(data_final);
					var data	   = data_final[0];
					document.frmproperty.property_subregion.length= 0;
					if(data != "" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
						var optionarray = data.split("#");
						document.frmproperty.property_subregion.options[0] = new Option("All Sub Regions",0) ;
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									document.frmproperty.property_subregion.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
							}
							ListTowns2(regionid,0,countryid);
						}
					} else {
							document.frmproperty.property_subregion.options[0] = new Option("No Sub Regions",0) ;
							ListTowns2(regionid,0,countryid);
					}
				} 
			}
			xmlHttp.send(null);
	}
}

function ListTowns2(regionid,subregionid,countryid)
{
 	//if(subregionid > 0){
//		alert(countryid)
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		 
		var url="../searchlisting.php?getlist=town&subregion_id="+subregionid+"&region_id="+regionid+"&country_id="+countryid;
		//alert(url);
		//Loading text
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
 		//return false;
		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			
			if (xmlHttp.readyState==4){ 
				var data_final = trim(xmlHttp.responseText).split("@"); 
 				var data	   = data_final[0];
				//alert(data);
				//return false;
  				document.frmproperty.property_town.length= 0;
				if(data!="" && data!= "<script language='javascript'>window.parent.location.reload();</script>"){
					var optionarray = data.split("#");
					
					if(regionid == 0 && subregionid == 0 && countryid == 0){
						//alert("if");
						document.frmproperty.property_town.options[0] = new Option("All Towns",0);
					}else{
						//alert("else");
						document.frmproperty.property_town.options[0] = new Option("All Towns",0) ;					 
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split("$");
									document.frmproperty.property_town.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
									
							}
						}
 					}
					
					/*document.frmproperty.property_town.options[0] = new Option("All Towns",0) ;					 
					if(optionarray.length > 0) {
						for(var i=0;i<optionarray.length;i++){
								var n = i;
								n = n + 1;
								var optionnamevaluearray = optionarray[i].split("$");
								document.frmproperty.property_town.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
								
						}
					}*/
				}else {
						document.frmproperty.property_town.options[0] = new Option("No Towns",0) ;
 				}
			} 
		}
		xmlHttp.send(null);
	//}
}
function validatefacility(id) {
	//alert(document.getElementById("facilitycount").value);
	var count = document.getElementById("facilitycount").value;
	var facilityvalue= "";
	for(var i=1;i<=count;i++) {
		var id = "property_facility"+i;
		//alert(id);
		if(document.getElementById(id).checked==true) {
			if(facilityvalue =="") {
				facilityvalue = document.getElementById(id).value;
			}else {
				facilityvalue = facilityvalue+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("facility_hidden").value = facilityvalue;
 }
function validateoutdoorfacility(id) {
  	var count1 = document.getElementById("outdoorfacilitycount").value;
	var outdoorfacilityvalue= "";
	for(var j=1;j<=count1;j++) {
		var id = "property_outdoorfacilities"+j;
  		if(document.getElementById(id).checked == true) {
			if(outdoorfacilityvalue =="") {
				outdoorfacilityvalue = document.getElementById(id).value;
			}else {
				outdoorfacilityvalue = outdoorfacilityvalue+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("outdoorfacility_hidden").value = outdoorfacilityvalue;
 }
function validatelocalactivity(id) {
 	var count1 = document.getElementById("localcount").value;
	var localactivity= "";
	for(var j=1;j<=count1;j++) {
		var id = "property_localactivities"+j;
 		if(document.getElementById(id).checked==true) {
			if(localactivity =="") {
				localactivity = document.getElementById(id).value;
			}else {
				localactivity = localactivity+","+document.getElementById(id).value;
			}	
			
		}
	}
 	document.getElementById("local_hidden").value = localactivity;
 }

function faqshow(id){
	if(id == "holiday"){
		document.getElementById("owner").style.display ="none";
		document.getElementById("holiday").style.display ="";		
	}else{
		document.getElementById("holiday").style.display ="none";	
		document.getElementById("owner").style.display ="";		
	}
	for(var i=1;i<=48;i++){				
		document.getElementById(i).style.display = "none";	
	}
}

function showans(id){		
	for(var i=1;i<=48;i++){
		if(i == parseInt(id) && document.getElementById(i).style.display == "none"){						
			document.getElementById(i).style.display = "";
			document.getElementById("question"+i).style.color = "#00B0F0";
		}else if(i == parseInt(id) && document.getElementById(i).style.display == ""){						
			document.getElementById(i).style.display = "none";		
			document.getElementById("question"+i).style.color = "";
		}else{			
			document.getElementById(i).style.display = "none";
			document.getElementById("question"+i).style.color = "";
		}
		
	}
}

function showmessage(id){		
	var total_count = document.getElementById("hidden_enquiry_count").value; 
	for(var i=1;i<=total_count;i++){
		if(i == parseInt(id) && document.getElementById(i).style.display == "none"){						
			document.getElementById(i).style.display = "";
 		}else if(i == parseInt(id) && document.getElementById(i).style.display == ""){						
			document.getElementById(i).style.display = "none";		
 		}else{			
			document.getElementById(i).style.display = "none";
 		}
 	}
}


function validateconsider()
{
	if(document.frmproperty.rental_consider_longterm.checked == true)
	{
		document.frmproperty.hidden_consider_long.value = 1;	
	}else{
		document.frmproperty.hidden_consider_long.value = 0;	
	}
	if(document.frmproperty.rental_consider_shortterm.checked == true)
	{
		document.frmproperty.hidden_consider_short.value = 1;	
	}else{
		document.frmproperty.hidden_consider_short.value = 0;	
	}
}
function showtown(town)
{
		if(document.frmproperty.property_town_new.value!=0 && (document.frmproperty.subregion_new.value == "Enter Sub Region" || document.frmproperty.subregion_new.value == ""))
		{
			//alert("inside");
			document.getElementById("subregion_new").value = "";
			document.getElementById("subregion_new").disabled = true;
			//document.getElementById("town_new_box_disabled").style.display = "";
		}/*else{
			document.getElementById("town_new_box").style.display = "";
			document.getElementById("town_new").value = "Enter Town";
			document.getElementById("town_new_box_disabled").style.display = "none";
		}*/
		
		var countryid = document.frmproperty.property_country_new.options[document.frmproperty.property_country_new.selectedIndex].value;
		var regionid = document.frmproperty.property_region_new.options[document.frmproperty.property_region_new.selectedIndex].value;
		if(document.frmproperty.property_subregion_new){
			var subregionid = document.frmproperty.property_subregion_new.options[document.frmproperty.property_subregion_new.selectedIndex].value;
		}
	 	
		if(town!=0){
				document.getElementById("country_new").disabled  = true;
				document.getElementById("region_new").disabled  = true;
				//document.getElementById("subregion_new").disabled  = true;
				document.getElementById("town_new").disabled  = true;
				
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").value  = "";
				//document.getElementById("subregion_new").value  = "";
				document.getElementById("town_new").value  = "";				
		}else if(subregionid!=0){
				document.getElementById("country_new").disabled  = true;
				document.getElementById("region_new").disabled  = true;
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").value  = "";
				document.getElementById("subregion_new").disabled  = true;	
				document.getElementById("town_new").disabled  = false;
				document.getElementById("town_new").value  = "Enter Town";
		} else if(regionid!=0){
				document.getElementById("country_new").disabled  = true;
				document.getElementById("region_new").disabled  = true;
				document.getElementById("country_new").value  = "";
				document.getElementById("region_new").value  = "";
				document.getElementById("subregion_new").disabled  = false;	
				document.getElementById("town_new").disabled  = false;
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
				
		} else if (countryid!=0) {
				document.getElementById("country_new").disabled  = true;
				document.getElementById("country_new").value  = "";
 				document.getElementById("region_new").disabled  = false;
				document.getElementById("subregion_new").disabled  = false;	
				document.getElementById("town_new").disabled  = false;
				document.getElementById("region_new").value  = "Enter Region";
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
		} else {
				document.getElementById("country_new").disabled  = false;
				document.getElementById("region_new").disabled  = false;
				document.getElementById("subregion_new").disabled  = false;
				document.getElementById("town_new").disabled  = false;
				document.getElementById("country_new").value  = "Enter Country";
				document.getElementById("region_new").value  = "Enter Region";
				document.getElementById("subregion_new").value  = "Enter Sub Region";
				document.getElementById("town_new").value  = "Enter Town";
		}	
		
		
 	 
		var townname = document.frmproperty.property_town_new.options[document.frmproperty.property_town_new.selectedIndex].text;
   		//showAddress(townname);
			

}

function Search(base) {
		document.frmproperty.from.value = "";
		document.frmproperty.quicksearch.value='';
		
		if(document.frmproperty.propertysorting){
			document.frmproperty.propertysorting.selectedIndex = 1;
		}
		if(document.frmproperty.propertysortingbottom){
			document.frmproperty.propertysortingbottom.selectedIndex = 1;
		}
		
 		if(document.frmproperty.search_arrival.value!='' || document.frmproperty.search_departure.value!=''){
 				if(document.frmproperty.search_arrival.value==''){
						alert("Please select arrival date");
 						return false;
				}
				
				if(document.frmproperty.search_departure.value==''){
						alert("Please select departure date");
 						return false;
				}
 				if(CompareSearchdate(document.frmproperty.search_arrival,document.frmproperty.search_departure)==false){return false;}
 		}
		
		
		document.frmproperty.method = "get";
		document.frmproperty.action = base+"searchResults.php";
		document.frmproperty.submit();
}

//To compare the from date with to date
function CompareSearchdate(fdate,tdate)
{
	var strarr = fdate.value.split("/");
	
	splitter=fdate.value.substr(2,1);
	strarr = fdate.value.split(splitter);	
	var d = strarr[0];
	var m = strarr[1];
	var y = strarr[2];

	splitter=tdate.value.substr(2,1);
	var strarr = tdate.value.split(splitter);
	var d1 = strarr[0];
	var m1 = strarr[1];
	var y1 = strarr[2];
	if( y == y1)
	{
		if(m == m1)
		{
			if(d > d1)
			{
				alert("Arrival date exceeds departure date");		
				tdate.focus();
				tdate.select();
				return false;
			}
		}
		else if (m > m1)
		{
			alert("Arrival date exceeds departure date");		
			tdate.focus();
			tdate.select();
			return false;
		}
	}	
	if(y > y1)				
	{
		alert("From date exceeds To date");		
		tdate.focus();
		tdate.select();
		return false;			
	}
}


function EnterSearch(event,base){
  	if (event.keyCode==13) 
	{
 		QuickSearch(base);
	}
}
function EnterLogin(event,base){
  	if (event.keyCode==13) 
	{
 		Quicklogin(base);
	}
}
function Quicklogin(base)
{
	document.frmlogin.action = base+"validateagentlogin.php";
	document.frmlogin.submit();
}
function QuickSearch(base) {		
		if(document.frmproperty.propertysorting){
			document.frmproperty.propertysorting.selectedIndex = 1;
		}
		if(document.frmproperty.propertysortingbottom){
			document.frmproperty.propertysortingbottom.selectedIndex = 1;
		}
		document.frmproperty.from.value = "quicksearch";
 		/*****BOF commented by Abhishek Yadav 20-04-2010. Because now we are not using drop down lidt in left panel for searching properties.*******/
		/*document.frmproperty.property_country.selectedIndex = 0;
		document.frmproperty.property_region.selectedIndex = 0;
		document.frmproperty.property_town.selectedIndex = 0;
		document.frmproperty.property_type.selectedIndex = 0;
		document.frmproperty.property_bedrooms.selectedIndex = 0;
  		document.frmproperty.property_beachdistance.selectedIndex = 0;*/
		/*****EOF***********************************************************************************************************************************/
		
		arrival = document.getElementById('search_arrival').value;
		departure = document.getElementById('search_departure').value;
     
	 if (CompareSearchdate(document.getElementById('search_arrival'),document.getElementById('search_departure'))==false)
	 {
       // alert ("Arrival date exceeds departure date");
		return false;
     }
		
      if(arrival!="")
	   {
		var ar = arrival.split("/");
		arrival = ''+ar[0]+ar[1]+ar[2]+'';
		var dr = departure.split("/");
		departure = ''+dr[0]+dr[1]+dr[2]+'';
		var date_url = "arr-"+arrival+"/dep-"+departure+"/";
	  }
	  else
	  {
	    var date_url = "";
	  }
//alert(date_url);
/************************************BOF*********************************/
//Abhishek Yadav 06-05-2010.
//This block of code is used for making seo friendly url values.

		search_term = document.getElementById('quicksearch').value;
		search_term=search_term.toLowerCase();
	    search_term = search_term.replace(/[\s\'/]+/g, '-');
		search_term = search_term.replace(",", "");
		
		search_term = stripVowelAccent(search_term);

/************************************EOF*********************************/
		document.frmproperty.method = "POST";
		document.frmproperty.action = base+"rentals/"+search_term+"/"+date_url;
 		document.frmproperty.submit();
}
function AdvertSearch() {
		document.frmproperty.method = "GET";
		document.frmproperty.action = "../searchResults.php";
		document.frmproperty.submit();
}

function AdvertQuickSearch(event){
  	if (event.keyCode==13) 
	{
 		AdvertQuickSearch();
	}
}

function AdvertQuickSearch() {
		document.frmproperty.method = "GET";
		document.frmproperty.action = "../searchResults.php?from=quicksearch";
		document.frmproperty.submit();
}

function Paging(pagenumber)
{
	document.frmproperty.method = "POST";          // Chnage GET to POST 26-04-2010
	document.frmproperty.page.value = pagenumber;
 	document.frmproperty.action = "?page="+pagenumber;       //Abhishek Yadav 08-05-2010. Remove the url searchResults.php because now we are going through seo friendly url 
	document.frmproperty.submit();	
}
function BlogPaging(pagenumber)
{
 	document.frmproperty.method = "POST";
	document.frmproperty.page.value = pagenumber;
 	document.frmproperty.action = "?page="+pagenumber;
 	document.frmproperty.submit();	
}
function StatisticsPaging(pagenumber,propertyid)
{
 	document.frmproperty.method = "POST";       
	document.frmproperty.page.value = pagenumber;
 	document.frmproperty.action = "advertStatics.php?page="+pagenumber+"&property_id="+propertyid;
 	document.frmproperty.submit();	
}

function SpecialOffersPaging(pagenumber)
{
 	document.frmproperty.method = "POST";
	document.frmproperty.page.value = pagenumber;
 	document.frmproperty.action = "?page="+pagenumber;
	document.frmproperty.submit();	
}
function SpecialOffersCountryPaging(pagenumber,country)
{
 	document.frmproperty.method = "GET";
	document.frmproperty.page.value = pagenumber;
 	document.frmproperty.action = "?page="+pagenumber;
 	document.frmproperty.submit();	
}

function Sorting(str)
{
	var sorting = document.frmproperty.propertysorting.value;
	document.frmproperty.propertysorting.selectedIndex;  //document.frmproperty.propertysortingbottom.selectedIndex=
 	document.frmproperty.method = "POST"; // Chnage GET to POST 26-04-2010
	document.frmproperty.value = sorting;
 	document.frmproperty.action = str+sorting+"/"; //Abhishek Yadav 08-05-2010. Remove searchResults.php?"+str because now we are going through seo friendly url.
	document.frmproperty.submit();	
}

/*function BottomSorting(str)
{
	document.frmproperty.propertysorting.selectedIndex=document.frmproperty.propertysortingbottom.selectedIndex;
 	document.frmproperty.method = "POST";                 // Chnage GET to POST  26-04-2010
 	document.frmproperty.action = "";      //Abhishek Yadav 08-05-2010. Remove searchResults.php?"+str because now we are going through seo friendly url.
	document.frmproperty.submit();	
}
*/

function SpecialoffersSorting(str)
{
	var sorting = document.frmproperty.propertysorting.value;
	document.frmproperty.propertysorting.selectedIndex;  //document.frmproperty.propertysortingbottom.selectedIndex=
 	document.frmproperty.method = "POST";
 	document.frmproperty.action = str+sorting+"/";
	document.frmproperty.submit();	
}

/*function SpecialoffersBottomSorting()
{
	document.frmproperty.propertysorting.selectedIndex=document.frmproperty.propertysortingbottom.selectedIndex;
 	document.frmproperty.method = "POST";
 	document.frmproperty.action = "";
	document.frmproperty.submit();	
}
*/


function SpecialoffersCountrySorting(country,str)
{
	var sorting = document.frmproperty.propertysorting.value;
	document.frmproperty.propertysorting.selectedIndex; //document.frmproperty.propertysortingbottom.selectedIndex=
 	document.frmproperty.method = "POST";
 	document.frmproperty.action = str+country+"/"+sorting+"/";
	document.frmproperty.submit();	
}

/*function SpecialoffersBottomCountrySorting(country)
{
	document.frmproperty.propertysorting.selectedIndex=document.frmproperty.propertysortingbottom.selectedIndex;
 	document.frmproperty.method = "POST";
 	document.frmproperty.action = "";
	document.frmproperty.submit();	
}
*/


function MM_openBrWindow(theURL,winName,features) { //v2.0
  win = window.open(theURL,winName,features);
}

//Property locaion page sctript
function NewCountry() {
		var newcountryname = document.getElementById("country_new").value;
		if(newcountryname != "Enter Country" && newcountryname != ""){
				document.getElementById("property_country_new").disabled  = true;
 				document.getElementById("property_region_new").disabled  = true;
 				if(document.getElementById("property_subregion_new")){
					document.getElementById("property_subregion_new").disabled  = true;
				}
				if(document.getElementById("property_town_new")){
					document.getElementById("property_town_new").disabled  = true;
				}
				//showAddress(newcountryname);
		} else {
				document.getElementById("property_country_new").disabled  = false;
 				if(document.getElementById("region_new").value != "Enter Region" && document.getElementById("region_new").value != ""){
						document.getElementById("property_region_new").disabled  = true;
						//document.getElementById("property_subregion_new").disabled  = true;
						document.getElementById("property_town_new").disabled  = true;
				} else {
					document.getElementById("property_region_new").disabled  = false;	
					if(document.getElementById("subregion_new")){
						if(document.getElementById("subregion_new").value != "Enter Sub Region" && document.getElementById("subregion_new").value != ""){
							//document.getElementById("property_subregion_new").disabled  = true;
							document.getElementById("property_town_new").disabled  = true;
						}	else {
								//document.getElementById("property_subregion_new").disabled  = false;	
							if(document.getElementById("town_new").value != "Enter Town" && document.getElementById("town_new").value != ""){
								document.getElementById("property_town_new").disabled  = true;
							} else {
								document.getElementById("property_town_new").disabled  = false;
							}
						}
					}
				}
				//ShowGoogle();	
  		}
}


function NewRegion() {
		var newregionname = document.getElementById("region_new").value;
		if(newregionname != "Enter Region" && newregionname != ""){
				if(document.getElementById("country_new").value != "Enter Country" && document.getElementById("country_new").value != ""){
						document.getElementById("property_country_new").disabled  = true;
 				} else { 
						document.getElementById("property_country_new").disabled  = false;
 				}
				document.getElementById("property_region_new").disabled  = true;
				if(document.getElementById("property_subregion_new")){
					document.getElementById("property_subregion_new").disabled  = true;
				}
				document.getElementById("property_town_new").disabled  = true;
 				//showAddress(newregionname);
		} else {				
				document.getElementById("property_region_new").disabled  = false;
 				if(document.getElementById("subregion_new").value != "Enter Sub Region" && document.getElementById("subregion_new").value != ""){
					if(document.getElementById("property_subregion_new")){
						document.getElementById("property_subregion_new").disabled  = true;
					}
					document.getElementById("property_town_new").disabled  = true;
				}	else {
					if(document.getElementById("property_subregion_new")){
						document.getElementById("property_subregion_new").disabled  = false;	
					}
					if(document.getElementById("town_new").value != "Enter Town" && document.getElementById("town_new").value != ""){
						document.getElementById("property_town_new").disabled  = true;
					} else {
						document.getElementById("property_town_new").disabled  = false;
					}
				}
				//ShowGoogle(); 
		} 
}


function NewSubRegion() {
		if(document.getElementById("subregion_new")){
			var newsubregionname = document.getElementById("subregion_new").value;
			if(newsubregionname != "Enter Sub Region" && newsubregionname != ""){
					if(document.getElementById("country_new").value != "Enter Country" && document.getElementById("country_new").value != ""){
							document.getElementById("property_country_new").disabled  = true;
					} else { 
							document.getElementById("property_country_new").disabled  = false;
					}
					
					if(document.getElementById("region_new").value != "Enter Region" && document.getElementById("region_new").value != ""){
							document.getElementById("property_region_new").disabled  = true;
					} else { 
							document.getElementById("property_region_new").disabled  = false;
					}
					if(document.getElementById("property_subregion_new")){
						document.getElementById("property_subregion_new").disabled  = true;				
					}
					document.getElementById("property_town_new").disabled  = true;
					document.getElementById("property_town_new").value  = 0;
					document.getElementById("town_new").disabled  = false;
					//showAddress(newsubregionname);
			} else {
					if(document.getElementById("property_subregion_new")){
						document.getElementById("property_subregion_new").disabled  = false;	
					}
					if(document.getElementById("town_new").value != "Enter Town" && document.getElementById("town_new").value != ""){
						document.getElementById("property_town_new").disabled  = true;
					} else {
						document.getElementById("property_town_new").disabled  = false;
					}
					//ShowGoogle();
			}
		} else {
					if(document.getElementById("property_subregion_new")){
						document.getElementById("property_subregion_new").disabled  = false;	
					}
					if(document.getElementById("town_new").value != "Enter Town" && document.getElementById("town_new").value != ""){
						document.getElementById("property_town_new").disabled  = true;
					} else {
						document.getElementById("property_town_new").disabled  = false;
					}
					//ShowGoogle();
			}
 }

function NewTown() {
		//alert(document.frmproperty.property_subregion_new.value);
		/*if(document.frmproperty.town_new.value!="" && document.frmproperty.town_new.value != "Enter Town" && document.frmproperty.property_subregion_new.value == 0 && (document.frmproperty.subregion_new.value == "" || document.frmproperty.subregion_new.value == "Enter Sub Region"))
		{
 			document.getElementById("subregion_new").value = "";
			document.getElementById("subregion_new").disabled = true;
  			document.getElementById("property_subregion_new").disabled  = true;
			//alert(document.getElementById("property_subregion_new").disabled);
 		}else if(document.frmproperty.town_new.value!="" && document.frmproperty.town_new.value != "Enter Town" && document.frmproperty.subregion_new.value != "" && document.frmproperty.subregion_new.value != "Enter Sub Region"){
			//document.getElementById("subregion_new").value = "Enter Sub Region";
			document.getElementById("subregion_new").disabled = false;
			document.getElementById("property_subregion_new").disabled  = true;
		}else{
			document.getElementById("subregion_new").value = "Enter Sub Region";
			document.getElementById("subregion_new").disabled = false;
			document.getElementById("property_subregion_new").disabled  = false;
		}*/
		
		if(document.frmproperty.town_new.value!="" && document.frmproperty.town_new.value != "Enter Town" && (document.frmproperty.subregion_new.value == "" || document.frmproperty.subregion_new.value == "Enter Sub Region"))
		{
			document.getElementById("subregion_new").value = "";
			document.getElementById("subregion_new").disabled = true;
			if(document.frmproperty.property_subregion_new.value == 0) {
				document.getElementById("property_subregion_new").disabled  = true;		
			}
		}else{
			if(document.frmproperty.property_subregion_new.value == 0 && (document.frmproperty.subregion_new.value == "" || document.frmproperty.subregion_new.value == "Enter Sub Region")) {
				document.getElementById("subregion_new").value = "Enter Sub Region";
				document.getElementById("subregion_new").disabled = false;
			}
			document.getElementById("property_subregion_new").disabled  = false;
		}
		
		var newtownname = document.getElementById("town_new").value;
		if(newtownname != "Enter Town" && newtownname != ""){
				if(document.getElementById("country_new").value != "Enter Country" && document.getElementById("country_new").value != ""){
						document.getElementById("property_country_new").disabled  = true;
 				} else { 
						document.getElementById("property_country_new").disabled  = false;
 				}
				
				if(document.getElementById("region_new").value != "Enter Region" && document.getElementById("region_new").value != ""){
						document.getElementById("property_region_new").disabled  = true;
 				} else { 
						document.getElementById("property_region_new").disabled  = false;
 				}
				if(document.getElementById("property_subregion_new")){					
					if(document.frmproperty.town_new.value!="" && document.frmproperty.town_new.value != "Enter Town" && (document.frmproperty.subregion_new.value == "" || document.frmproperty.subregion_new.value == "Enter Sub Region")){
							//document.getElementById("property_subregion_new").disabled  = true;
					} else if(document.getElementById("subregion_new").value != "Enter Sub Region" && document.getElementById("subregion_new").value != ""){
 							document.getElementById("property_subregion_new").disabled  = true;
					} else { 
 							document.getElementById("property_subregion_new").disabled  = false;
					}
				}
 				document.getElementById("property_town_new").disabled  = true;
				//showAddress(newtownname);
		} else {
 				document.getElementById("property_town_new").disabled  = false;
				//ShowGoogle();
 		} 
  		
}

function ShowGoogle(){
	
   /* if(document.getElementById("town_new").value!="" && document.getElementById("town_new").value!="Enter Town"){
			showAddress(document.getElementById("town_new").value);
	} else if(document.getElementById("subregion_new").value!="" && document.getElementById("subregion_new").value!="Enter Sub Region"){
			showAddress(document.getElementById("subregion_new").value);
	} else if(document.getElementById("region_new").value!="" && document.getElementById("region_new").value!="Enter Region"){
			showAddress(document.getElementById("region_new").value);
	} else if(document.getElementById("country_new").value!="" && document.getElementById("country_new").value!="Enter Country"){
			showAddress(document.getElementById("country_new").value);
	}*/
		
}


function ApproveChanges(propertyid) {
		var summary_count = document.getElementById("summaryimage_count").value;
		var country_count = document.getElementById("country_hidden").value;
		var region_count = document.getElementById("region_hidden").value;
		var town_count = document.getElementById("town_hidden").value;
		if(country_count == 0 || region_count == 0 || town_count == 0)
		{
			alert("This property has no proper location");
			changediv(3);
			return false;
		}
		if(summary_count == 0)
		{
			alert("Please activate the summary image before activating the property");
			changediv(6);
			return false;
		}
		if(confirm("Are you sure you want to Approve the updated changes ?")){
				document.frmproperty.action = "approvechangesprocess.php?propertyid="+propertyid;
				document.frmproperty.submit();
		}
}

function DeclineChanges(propertyid) {
		/*var summary_count = document.getElementById("summaryimage_count").value;
		if(summary_count == 0)
		{
			alert("Please activate the summary image before activating the property");
			changediv(6);
			return false;
		}*/
		if(confirm("Are you sure you want to Decline the updated changes ?")){
				document.frmproperty.action = "declinechangesprocess.php?propertyid="+propertyid;
				document.frmproperty.submit();
		}
}

function Applystyle() {
 	//Getting the Current Borwser name.
	var browserName = navigator.appName;	
	if (browserName=="Microsoft Internet Explorer")	{
		document.frmproperty.property_region.setAttribute('className', 'inputField');
	} else {
		document.frmproperty.property_region.setAttribute('class', 'inputField');	
	}
 	
	if (browserName=="Microsoft Internet Explorer")	{
		document.frmproperty.property_subregion.setAttribute('className', 'inputField');
	} else {
		document.frmproperty.property_subregion.setAttribute('class', 'inputField');	
	}
	
	if (browserName=="Microsoft Internet Explorer")	{
		document.frmproperty.property_town.setAttribute('className', 'inputField');
	} else {
		document.frmproperty.property_town.setAttribute('class', 'inputField');	
	}
	
 	
}


function ListSubRegionsAll()
{
	 
	//if(regionid > 0){
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		
		document.frmproperty.property_region.length= 0;		
		document.frmproperty.property_region.options[0] = new Option("Loading....",0);
 
		document.frmproperty.property_subregion.length= 0;		
		document.frmproperty.property_subregion.options[0] = new Option("Loading....",0);
		
		
		document.frmproperty.property_town.length= 0;		
		document.frmproperty.property_town.options[0] = new Option("Loading....",0);
		 
		var url="searchlisting-subregion.php";
		//alert(url);
 		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data_final = trim(xmlHttp.responseText); 				
				//alert(data_final);
				var response_temp = data_final.split("@");
				//alert(response_temp[0]);
				if(response_temp[0]){
					document.frmproperty.property_subregion.length = 0;
					if(response_temp[0] != "" && response_temp[0]!= "<script language='javascript'>window.parent.location.reload();</script>"){
						//alert("if");
						var optionarray = response_temp[0].split("#");
						document.frmproperty.property_subregion.options[0] = new Option("All Sub Regions",0) ;
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split(",");
									document.frmproperty.property_subregion.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
							}
						}
					} else {
 							document.frmproperty.property_subregion.options[0] = new Option("No Sub Regions",0) ;
 					}
				}
				//alert(response_temp[1]);
				if(response_temp[1]){
					document.frmproperty.property_region.length = 0;
					if(response_temp[1] != "" && response_temp[1]!= "<script language='javascript'>window.parent.location.reload();</script>"){
						//alert("if");
						var optionarray = response_temp[1].split("#");
						document.frmproperty.property_region.options[0] = new Option("All Regions",0) ;
						if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split(",");
									document.frmproperty.property_region.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
							}
						}
					} else {
							//alert("else");
							document.frmproperty.property_subregion.options[0] = new Option("No Regions",0);
 					}
				}
				
				if(response_temp[2]){
					document.frmproperty.property_town.length = 0;
					if(response_temp[2] != "" && response_temp[2]!= "<script language='javascript'>window.parent.location.reload();</script>"){
						//var optionarray = response_temp[2].split("#");
						document.frmproperty.property_town.options[0] = new Option("All Towns",0) ;
 						/*if(optionarray.length > 0) {
							for(var i=0;i<optionarray.length;i++){
									var n = i;
									n = n + 1;
									var optionnamevaluearray = optionarray[i].split(",");
									document.frmproperty.property_town.options[n] =new Option(optionnamevaluearray[1],optionnamevaluearray[0]) ;
							}
						}*/
					} else {
							//alert("else");
							document.frmproperty.property_subregion.options[0] = new Option("No Towns",0);
							//ListTowns(regionid,0);
					}
				}
				
				
			} 
		}
		xmlHttp.send(null);
	//}
}



function ClearSearch() {
		document.frmproperty.property_country.selectedIndex =0;
		document.frmproperty.property_region.selectedIndex =0;
		document.frmproperty.property_subregion.selectedIndex = 0;
		document.frmproperty.property_town.selectedIndex =0;
		//document.frmproperty.property_subregion.options[0] = new Option("No Sub Regions",0) ;
 		document.frmproperty.property_bedrooms.selectedIndex =0;
		document.frmproperty.property_type.selectedIndex =0;
		document.frmproperty.property_beachdistance.selectedIndex =0;
		document.frmproperty.search_arrival.value = '';
		document.frmproperty.search_departure.value = '';
 		ListSubRegionsAll();
		dp_cal1 = new Epoch('dp_cal1','popup',document.getElementById('search_arrival'),false); 	
	    dp_cal2 = new Epoch('dp_cal2','popup',document.getElementById('search_departure'),false);
}

function getPreviousSelectedValue(){
		var prevselectedindex = document.frmproperty.property_currency.selectedIndex;
		document.frmproperty.property_currency_hidden.value = prevselectedindex;
}

function RentalCurrencyConversion(currency,property_id,prevselectedindex) {
 	
	if(!confirm("This will change the currency symbol on all rates entered for this property. Click OK to proceed?")){
   		document.frmproperty.property_currency.selectedIndex = document.frmproperty.property_currency_hidden.value;
 		return false;
	}
	
	xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		{
		 alert ("Browser does not support HTTP Request");
		 return;
		}
		 
		var url="rentalcurrencyconversion.php?currency="+currency+"&property_id="+property_id;
 		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=function() { 
			if (xmlHttp.readyState==4){ 
				var data = trim(xmlHttp.responseText); 	
 				document.getElementById("rental_display").innerHTML = data;
 			} 
		}
		xmlHttp.send(null);
}
function Clearagent()
{
	document.form1.searchtxt.value = "";
	window.location.href = "agents_view.php";
}
function Clearmember()
{
	document.form1.searchtxt.value = "";
	window.location.href = "member_view.php";
}
function validatesmsalert2()
{
	if(document.frmagent.agent_alerts.checked == true)
	{		
		document.frmagent.agent_alerts_hidden.value = 1;
	}else{
		document.frmagent.agent_alerts_hidden.value = 0;
	}
}
/************************************BOF*********************************/
//Abhishek Yadav 06-05-2010.
//This block of code is used for making seo friendly url values.

function stripVowelAccent(str)
{
//alert(str);
var s=str;

var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];

var repChar=['A','a','E','e','I','i','O','o','U','u'];

for(var i=0; i<rExps.length; i++)
s=s.replace(rExps[i],repChar[i]);
//alert(s);
return s;
}

/************************************EOF*********************************/