
function textformblur(element, text){
	if(element.value == ""){
		element.value = text;
	}
}

function textformfocus(element, text){
	if(text == element.value){
		element.value = "";
	}
	
}

function showlocation(){
	jQuery("#div-recherchevente").hide();
	jQuery("#div-rechercheagence").hide();
	jQuery("#div-recherchelocation").show();
}

function showvente(){
	jQuery("#div-recherchelocation").hide();
	jQuery("#div-rechercheagence").hide();
	jQuery("#div-recherchevente").show();	
}


function showagence(){
	jQuery("#div-recherchelocation").hide();
	jQuery("#div-recherchevente").hide();
	jQuery("#div-rechercheagence").show();
}

function fixed_back(select,offX,offY){
	if (offX.lastIndexOf("%") != -1){
		var img = new Image();
		img.src = select.currentStyle.backgroundImage.substring(5,Number(select.currentStyle.backgroundImage.length-2));
		var tempX = Number(offX.substring(0,offX.lastIndexOf("%")));
		tempX = Number((((document.documentElement.clientWidth-img.width)*tempX)/100)+document.documentElement.scrollLeft-select.offsetLeft)+'px';
	} else {
		var tempX = Number(offX.split("px")[0]);
		tempX = Number(tempX+document.documentElement.scrollLeft-select.offsetLeft)+'px';
	}
	if (offY.lastIndexOf("%") != -1){
		var img = new Image();
		img.src = select.currentStyle.backgroundImage.substring(5,Number(select.currentStyle.backgroundImage.length-2));
		var tempY = Number(offY.substring(0,offY.lastIndexOf("%")));
		tempY = Number((((document.documentElement.clientHeight-img.height)*tempY)/100)+document.documentElement.scrollTop-select.offsetTop)+'px';
	} else {
		var tempY = Number(offY.split("px")[0]);
		tempY = Number(tempY+document.documentElement.scrollTop-select.offsetTop)+'px';
	}
	return tempX+' '+tempY;
}


//Limiter les champs du formulaire de recherche Ã  des entiers
jQuery('#ventecodepostal, #ventecodepostal2, #ventecodepostal3, #ventecodepostal4, #ventebudgetmini, #ventebudgetmaxi'+
		'#ventesurfacemini, #ventesurfacemaxi, #locationcodepostal, #locationcodepostal2, #locationcodepostal3'+
		' #locationcodepostal4, #locationbudgetmini, #locationbudgetmaxi, #locationsurfacemini, #locationsurfacemaxi').keyup(function(){
 var value=jQuery(this).val();
 var orignalValue=value;
 value = value.replace(/[0-9]*/g, "");

 if (value!=''){
	    orignalValue=orignalValue.replace(/([^0-9].*)/g, "");
	    jQuery(this).val(orignalValue);
 }
});

//Limiter le code postal des champs du formulaire Ã  5 chiffres maximum
jQuery('#ventecodepostal, #ventecodepostal2, #ventecodepostal3, #ventecodepostal4, #locationcodepostal'+
			' #locationcodepostal2, #locationcodepostal3, #locationcodepostal4').keyup(function(){
	var value  = jQuery(this).val();
	if (value.length > 5 ){
		value = value.substr(0,5);
		jQuery(this).val(value);
	}
});


