// JavaScript Document
	function call_search(){
		var doc=document.search;
		if((doc.type.value!='none') || (doc.city.value!='none') ||(doc.budget.value!=0) || (doc.no_bedrm.value!=0)){
			document.search.submit();
			return true;
		} else {
			document.getElementById('search_form_msg').style.display="block";
			document.getElementById('search_form_msg').innerHTML="<font size='1' face='ARIAL' color='red'>* Please select atleast one option for search.</font>";
		}	
	}

	function displayMore(){
		if(navigator.appName == "Microsoft Internet Explorer"){
			document.getElementById('morebox').style.position="absolute";
			document.getElementById('morebox').style.display="block";
			document.getElementById('morebox').style.zIndex='5';				
			//document.getElementById('morebox').style.right="250px";
		} else {
			document.getElementById('morebox').style.position="absolute";
			document.getElementById('morebox').style.display="block";
			document.getElementById('morebox').style.zIndex='5';
			//document.getElementById('morebox').style.right="250px";
		}
	}	
	
	function hideMore(){
		document.getElementById('morebox').style.display="none";
	}
	
	function prop_detail(a, b, c){
		var top_dis=(b*20);
		//var right_dis=(c*6.8);
		document.getElementById('main_id'+a).style.position="relative";
		document.getElementById('pop_dis'+a+b).style.display="block";
		document.getElementById('pop_dis'+a+b).style.zIndex=5;
		document.getElementById('pop_dis'+a+b).style.top=top_dis+"px";
		document.getElementById('pop_dis'+a+b).style.left="150px";
		document.getElementById('prop_name'+a+b).style.background="url(http://www.investinnest.com/properties/images/prop_name.jpg) repeat-x";
		//document.getElementById('prop_name'+a+b).style.backgroundRepeat="repeat-x";
		
		var xmlhttp = createRequestObject();
		xmlhttp.open("GET", "http://www.investinnest.com/detail_show.php?id="+c, true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState != 4){
				document.getElementById('detail_msg'+a+b).innerHTML="<div style=\"margin-top:15px; font-size:15px; margin-left:85px; width:80px; height:20px; background-color:#FFFFC1; font-weight:500\" align=\"center\">Loading...</div>";
			}
			if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){//when the state is 4 i.e the response has arrived
				//alert('Status :'+xmlhttp.status);
				if(xmlhttp.status == 200) { // 200 relays ok
					//alert("xmlhttp responce :"+xmlhttp.responseText);//test
					document.getElementById('detail_msg'+a+b).innerHTML=xmlhttp.responseText;
				}
			}
		}
		xmlhttp.send(null);	
	}
	
	function over_prop_detail(a, b){
		var top_dis=(b*20);
		//var right_dis=(c*6.8);
		document.getElementById('main_id'+a).style.position="relative";
		document.getElementById('pop_dis'+a+b).style.display="block";
		document.getElementById('pop_dis'+a+b).style.zIndex=5;
		document.getElementById('pop_dis'+a+b).style.top=top_dis+"px";
		document.getElementById('pop_dis'+a+b).style.left="150px";
		document.getElementById('prop_name'+a+b).style.background="url(http://www.investinnest.com/properties/images/prop_name.jpg) repeat-x";
	}

	function prop_out(a, b){
		document.getElementById('pop_dis'+a+b).style.display="none";
		document.getElementById('main_id'+a).style.position="";
		document.getElementById('prop_name'+a+b).style.background="";
	}
	
	function search_detail(a, b, c){
		var top_dis=(a*30);
		var right_dis=(b*6);
		document.getElementById('search'+a).style.display="block";
		document.getElementById('search'+a).style.zIndex=5;
		document.getElementById('search'+a).style.top=top_dis+"px";
		document.getElementById('search'+a).style.left="250px";
		document.getElementById('search_name'+a).style.background="url(http://www.investinnest.com/properties/images/prop_name.jpg) repeat-x";
		
		var xmlhttp = createRequestObject();
		xmlhttp.open("GET", "http://www.investinnest.com/detail_show.php?id="+c, true);
		xmlhttp.onreadystatechange=function(){

			if(xmlhttp.readyState != 4){
				document.getElementById('search_detail'+a).innerHTML="<div style=\"margin-top:15px; font-size:15px; margin-left:85px; width:80px; height:20px; background-color:#FFFFC1; font-weight:500\" align=\"center\">Loading...</div>";
			}
			if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){//when the state is 4 i.e the response has arrived
				//alert('Status :'+xmlhttp.status);
				if(xmlhttp.status == 200) { // 200 relays ok
					//alert("xmlhttp responce :"+xmlhttp.responseText);//test
					document.getElementById('search_detail'+a).innerHTML=xmlhttp.responseText;
				}
			}
		}
		xmlhttp.send(null);	
	}
	
	function over_search_detail(a, b){
		var top_dis=(a*30);
		var right_dis=(b*6);
		document.getElementById('search'+a).style.display="block";
		document.getElementById('search'+a).style.zIndex=5;
		document.getElementById('search'+a).style.top=top_dis+"px";
		document.getElementById('search'+a).style.left="250px";
		document.getElementById('search_name'+a).style.background="url(http://www.investinnest.com/properties/images/prop_name.jpg) repeat-x";
	}
	
	function search_out(a){
		document.getElementById('search'+a).style.display="none";
		document.getElementById('search_name'+a).style.background="";
	}
	
	function checkEmail(email_id) {
		//alert('inside check mail function');
		var result = true;
		var email_Str = new String(email_id);
		var Expression = /^[_a-z0-9-]+[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		if(!email_Str.match(Expression)) {
			//document.getElementById('enquiry61').style.display = "block";
			document.getElementById('email_row').style.display = "block";
			//document.getElementById('email_err').style.display = "block";
			document.getElementById('email_row').innerHTML = "<font size='1' face='ARAIL' color='red'>* Please enter the valid email id.</font>";
			result = false;
		}
		if(email_Str == ''){
			//document.getElementById('enquiry61').style.display = "block";
			document.getElementById('email_row').style.display = "block";
			//document.getElementById('email_err').style.display = "block";
			document.getElementById('email_row').innerHTML = "<font size='1' face='ARIAL' color='red'>* Email address cannot be empty.</FONT>";
			result = false;
		}
		/*if(result == false){
			document.form1.email.focus;
		}*/
		if(result == true) {
			document.getElementById('email_row').style.display = "none";
			//document.getElementById('email_row').style.display = "none";	
		}
		return result;
	}
	
	function checkName(name){
		//alert('inside check name function');
		var result = true;
		var name_Str = new String(name);
		var Expression = /^[a-zA-Z .\,\-\'\ ]+$/;
		if(name_Str == ''){
			//document.getElementById('enquiry51').style.display = "block";
			document.getElementById('name_row').style.display = "block";
			//document.getElementById('name_err').style.display = "block";
			document.getElementById('name_row').innerHTML = "<font size='1' face='ARIAL' color='red'>* Name cannot be empty</font>";
			result = false;
		}
		if(!name_Str.match(Expression)){
			//document.getElementById('enquiry51').style.display = "block";
			document.getElementById('name_row').style.display = "block";
			//document.getElementById('name_err').style.display = "block";
			document.getElementById('name_row').innerHTML = "<font size='1' face='ARIAL' color='red'>* Name cannot Have special characters</font>";
			result = false;
		}
		if(name_Str.length < 3){
			document.getElementById('name_row').style.display = "block";	
			//document.getElementById('enquiry51').style.display = "block";
			//document.getElementById('name_err').style.display = "block";
			document.getElementById('name_row').innerHTML = "<font size='1' face='ARIAL' color='red'>* Name cannot be less than three Characters</font>";		
			result = false;
		}
		/*if(result == false){
			document.getElementById('cname').focus;
		}*/
		if(result == true) {
			document.getElementById('name_row').style.display = "none";
			//document.getElementById('name_err').style.display = "none";	
		}
		return result;
	}
	
	/* Making a request.*/
	function createRequestObject() {
		var http_request = null;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
				// set type accordingly to anticipated content type
				//http_request.overrideMimeType('text/xml');
				http_request.overrideMimeType('text/html');
			}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if (!http_request) {
			alert('Cannot create XMLHTTP instance');
			return false;
		} else {
			return http_request;
		}
	}
	
	function send_query() {
		var chkname = checkName(document.query_form.cname.value);
		var chkemail = checkEmail(document.query_form.email.value);
		if(chkname && chkemail){
			//alert('abcdefghijkl'); //again for test
			var xmlhttp = createRequestObject(); //calling xmlhttp object
			//alert('XML '+xmlhttp);
			if(xmlhttp == null) {
				alert("Xml is null, Browser is not supporting http");//this is viewing the XMLHTTP object
				exit();
			}
			xmlhttp.open("GET", "http://www.investinnest.com/ajaxpost.php?cname="+document.query_form.cname.value+"&email="+document.query_form.email.value+"&phone="+document.query_form.phone.value+"&comments="+document.query_form.query.value, true);
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){//when the state is 4 i.e the response has arrived
					//alert('Status :'+xmlhttp.status);
					if(xmlhttp.status == 200) { // 200 relays ok
						//alert("xmlhttp responce :"+xmlhttp.responseText);//test
						document.getElementById('buyer11').style.display='none';
						document.getElementById('buyer12').style.display='none';
						document.getElementById('buyer21').style.display='none';
						document.getElementById('buyer22').style.display='none';
						document.getElementById('buyer31').style.display='none';
						document.getElementById('buyer32').style.display='none';
						document.getElementById('buyer41').style.display='none';
						document.getElementById('buyer42').style.display='none';
						document.getElementById('buyer51').style.display='none';
						document.getElementById('query_msg').style.display='none';
						document.getElementById('query_box').style.height="203px";
						document.getElementById('query_box').innerHTML="<div id=\"name_div\" style=\"margin-top:20px\"><font color=\"#000000\" size=\"2\">Thank you! Your enquiry has been submitted. Mr Hitesh will get back to you soon. Otherwise, you can always reach us at below numbers.</font></div>"
					}
				}
			}
			//alert('xml reasponce '+xmlhttp.responseText);
			//calling the function doenquiry
			//xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
			xmlhttp.send(null);
//xmlhttp.send("cname="+document.form1.cname.value+"email="+document.form1.email.value+"phone="+document.form1.phone.value+"comment"+document.form1.comments.value);
			//document.getElementById('enquiry_table').style.display = 'none';
		} else {
			return false;
		}
	}
		
	function landing_query() {
		var chkname = checkName(document.query_form.cname.value);
		var chkemail = checkEmail(document.query_form.email.value);
		if(chkname && chkemail){
			//alert('abcdefghijkl'); //again for test
			var xmlhttp = createRequestObject(); //calling xmlhttp object
			//alert('XML '+xmlhttp);
			if(xmlhttp == null) {
				alert("Xml is null, Browser is not supporting http");//this is viewing the XMLHTTP object
				exit();
			}
			xmlhttp.open("GET", "http://www.investinnest.com/ajaxpost.php?cname="+document.query_form.cname.value+"&email="+document.query_form.email.value+"&phone="+document.query_form.phone.value+"&comments="+document.query_form.query.value, true);
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){//when the state is 4 i.e the response has arrived
					//alert('Status :'+xmlhttp.status);
					if(xmlhttp.status == 200) { // 200 relays ok
						//alert("xmlhttp responce :"+xmlhttp.responseText);//test
						document.getElementById('buyer11').style.display='none';
						document.getElementById('buyer12').style.display='none';
						document.getElementById('buyer21').style.display='none';
						document.getElementById('buyer22').style.display='none';
						document.getElementById('buyer31').style.display='none';
						document.getElementById('buyer32').style.display='none';
						document.getElementById('buyer41').style.display='none';
						document.getElementById('buyer42').style.display='none';
						document.getElementById('buyer51').style.display='none';
						document.getElementById('query_msg').style.display='none';
						document.getElementById('query_box').innerHTML="<div id=\"name_div\" style=\"margin-top:20px\"><font color=\"#000000\" size=\"2\">Thank you! Your enquiry has been submitted. Mr Hitesh from sales team will get back to you soon. Else, you can always reach us at below numbers.</font></div><div id=\"phone_box\" style=\"margin-top:5px;\"><div id=\"phone_top_left\"></div><div id=\"phone_top\" style=\"font-size:18px; color:#0033FF\">Call Us:</div><div id=\"phone_top_right\"></div><div id=\"phone_mid\"><div style=\"background-color:#FFFFFF; width:120px; height:60px; margin-top:5px\"><div style=\"margin-top:10px; color:#c30; font-size:15px\">UK</div><div style=\"color:#666; font-size:14px\">+44 (845) 43 00015</div><div style=\"color:#666; font-size:14px\">+44 020 8090 4217</div></div><div style=\"background-color:#FFFFFF; width:120px; height:40px; margin-top:5px\"><div style=\"margin-top:10px; color:#c30; font-size:15px\">UAE</div><div style=\"color:#666; font-size:14px\">+971 50 644 6852</div></div><div style=\"background-color:#FFFFFF; width:120px; height:55px; margin-top:5px\"><div style=\"margin-top:10px; color:#c30; font-size:15px\">USA</div><div style=\"color:#666; font-size:14px\">+1 917 338 6416</div><div style=\"color:#666; font-size:14px\">+1 323 300 6502</div></div><div style=\"background-color:#FFFFFF; width:120px; height:40px; margin-top:5px\"><div style=\"margin-top:10px; color:#c30; font-size:15px\">Canada</div><div style=\"color:#666; font-size:14px\">+1 613 482 9788</div></div><div style=\"background-color:#FFFFFF; width:120px; height:55px; margin-top:5px\"><div style=\"margin-top:10px; color:#c30; font-size:15px\">India</div><div style=\"color:#666; font-size:14px\">+91-9871511433</div><div style=\"color:#666; font-size:14px\">+91-9871511466</div></div></div><div id=\"phone_bottom_left\"></div><div id=\"phone_bottom\"></div><div id=\"phone_bottom_right\"></div></div>";
					}
				}
			}
			xmlhttp.send(null);
		} else {
			return false;
		}
	}

