String.prototype.trim = function(){
return( this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), "") );
}
 function infoBox(val)
{
		var myDiv = document.getElementById("moreinfo"+val);
		var showhide = document.getElementById("minmax"+val);
		
		if ( myDiv.style.display != "none" )
		{
			myDiv.style.display = 'none';
			showhide.innerHTML = '<a href="javascript:void(0)"  onclick="javascript:infoBox('+val+')"><span style="text-decoration:underline;" class="style1">+ Click for More Info </span></a>';

		}
	else 
		{
			myDiv.style.display = '';
			showhide.innerHTML = '<br /><a href="javascript:void(0)"  onclick="javascript:infoBox('+val+')"><span style="text-decoration:underline;" class="style1">- Click to Hide More Info</span></a>';
		}
		
} 



function processContacts(val)
{
	var email = document.getElementById("q_email"+val);
	var fullname = document.getElementById("q_fullname"+val);
	var phone = document.getElementById("q_phone"+val);
	var propertyid = document.getElementById("q_propertyid"+val);

	if(V2validateData("req",fullname,"Please enter your Full Name")== false) return false;
	if(V2validateData("req",phone,"Please enter your Phone Number")== false) return false;
	if(V2validateData("req",email,"Please enter your email Address")== false) return false;
	if(V2validateData("email",email,"Email Address is not valid")== false) return false;
	 
	
	 document.getElementById("cnt"+val).style.display="none";
	 document.getElementById("resultDiv"+val).style.display="";
	 document.getElementById("resultDiv"+val).innerHTML = "<img src='images/home/loader.gif'> Processing ... Please Wait";
	 
	 var url = "http/home/contactinquiry_process.php?email="+email.value
	 											   +"&fullname="+fullname.value
												   +"&phone="+phone.value
												   +"&propertyid="+propertyid.value
												   +"&val="+val;
	 xmlHttp=GetXmlHttpObject(handler_cnt_inq);
	
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null);
	
}


function handler_cnt_inq()
{

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
        
		 var res = xmlHttp.responseText.trim();
		document.getElementById("resultDiv"+res).innerHTML = "Thank you for submitting your request<br> You will receive an email in few moments containing complete Contact details for this property.";
		
		 
		 
	} 
	
	
}


function showContactBox(val, total)
{

if(!total) total =1;
if(document.getElementById("cnt"+val).style.display== "none") document.getElementById("cnt"+val).style.display= "";
else document.getElementById("cnt"+val).style.display= "none"; 

for(var v=1; v<total; v++)
{

//alert(v);
if(v!=val && document.getElementById("cnt"+v)) document.getElementById("cnt"+v).style.display= "none";
}


}
