// JavaScript Document

function get_image(request, image, display){
	document.getElementById("WAIT").style.left = (Screen.getViewportWidth()/2 - (450/2))+"px";
	document.getElementById("WAIT").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-150)+"px";
	document.getElementById("WAIT").style.display = '';

	new ajax ('ajax.php', {postBody: 'method=get_image&id='+request+'&image='+image, onComplete: get_image_callback, userVariable: display});
}

function get_image_callback(request, uservar1){
document.getElementById("WAIT").style.display = 'none';	
	if(request.responseText!=""){
			
			document.getElementById('display').innerHTML = request.responseText;
	}
	else{
		document.getElementById(uservar1).innerHTML = "<strong><center>There was a problem getting image from server !!</center></strong>";
		}
}

/*================================================================================*/
function check_captcha(captcha,email){
	if(captcha==""){
		alert("Please enter Security Code");
		return;
	}else{
		
		new ajax ('ajax.php', {postBody: 'method=check_captcha&security_code='+captcha+'&email='+email, onComplete: checkcaptcha_callback});
		
	}
	
}
function checkcaptcha_callback(request, uservar){
	if(request.responseText=="OK"){
		document.frm_ea_register.submit();
	}else if(request.responseText=="CODE_INVALID"){
		alert("Please enter correct security Code !!");
	}else if(request.responseText=="DUPEMAIL"){
		alert("This email address is already registered !!");
	}

}
/*================================================================================*/
function check_captcha_propertyDetail(captcha){

	if(captcha==""){
		alert("Please enter Verification Code");
		return;
	}else{
		
		new ajax ('ajax.php', {postBody: 'method=check_captcha_for_property_detail&recaptcha_response_field='+captcha, onComplete: check_captcha_propertyDetail_callback});
		
	}
	
}
function check_captcha_propertyDetail_callback(request, uservar){
	if(request.responseText=="OK"){
		document.frm_agent.submit();
	}else if(request.responseText=="CODE_INVALID"){
		alert("Please enter correct Verification Code !!");
	}

}
/*================================================================================*/
/*================================================================================*/
// JavaScript Document

function get_search(request, tag, chkval, display, type){
	document.getElementById("WAIT").style.left = (Screen.getViewportWidth()/2 - (300/2))+"px";
	document.getElementById("WAIT").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-300)+"px";
	document.getElementById("WAIT").style.display = '';

    if(document.getElementById(chkval).checked){

	new ajax ('ajax.php', {postBody: 'method=get_search&main_search='+tag+'&display='+display+'&type='+type, onComplete: get_search_callback, userVariable: display});
	}else{
	new ajax ('ajax.php', {postBody: 'method=get_search&main_search='+tag+'&bed_id='+request+'&type='+type, onComplete: get_search_callback, userVariable: display});
		  }


}

function get_search_callback(request, uservar1){
	document.getElementById("WAIT").style.display = 'none';

	if(request.responseText!=""){
			
			document.getElementById('display').innerHTML = request.responseText;
	}
	else{
		document.getElementById(uservar1).innerHTML = "<strong><center>There was a problem getting image from server !!</center></strong>";
		}
}

/*================================================================================*/
