/* Javascript - Laforet Immobilier */ /***** Sommaire *****/ // 01 - Variables // 02 - Methodes // 05 - Affichage / Masquage layer information // 10 - Debloquage liste secondaire // 15 - Diaporama // 18 - Comparer // 20 - Navigation // 25 - Popup // 30 - Selection region // 50 - Ajax // 55 - Module "Trouver une agence" // 60 - Espace Laforet // 65 - Controle des formulaires // 80 - Google Maps // 99 - onLoad /***** ******** *****/ /***** 01 - Variables *****/ var actURL = document.location.href; var isOpera = (navigator.userAgent.indexOf('Opera') == 55 || navigator.userAgent.indexOf('Opera') == 36 || navigator.userAgent.indexOf('Opera') == 0)? true : false ; var Xpos; var Ypos; var decalY; var offsetAdd; var timeInfo; var tabSearchVilles = new Array(); /***** 02 - Methodes *****/ // Ajoute la fonction trim comme méthode de l'objet String. String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } function resetFormField (name) { var item = document.getElementById(name); if (item) { item.value = ''; item.disabled = false; } } /***** 05 - Affichage / Masquage layer information *****/ function showInfo(){ var layerInfo = document.getElementById('infoLayer'); layerInfo.style.left = (Xpos+50)+'px'; if(document.all && !isOpera){ document.getElementById('flayerinfo').style.left = (Xpos+50)+'px'; document.getElementById('flayerinfo').style.height = document.getElementById('infoLayer').offsetHeight; } if((document.getElementById('infoLayer').offsetHeight+(Ypos-150)) > document.getElementsByTagName('div')[0].offsetHeight){ Ypos = document.getElementsByTagName('div')[0].offsetHeight-document.getElementById('infoLayer').offsetHeight; } else { Ypos = (Ypos-150); } layerInfo.style.top = Ypos+'px'; if(document.all && !isOpera){ document.getElementById('flayerinfo').style.top = Ypos+'px'; } } function hideInfo(){ var layerInfo = document.getElementById('infoLayer'); layerInfo.style.top = '-999px'; layerInfo.style.left = '-999px'; if(document.all && !isOpera){ document.getElementById('flayerinfo').style.left = '-999px'; document.getElementById('flayerinfo').style.top = '-999px'; } } /***** 10 - Debloquage liste secondaire *****/ function unlockSList(obj){ if(obj == "citiesBiens") { document.FormMaRecherche.villeBiens.selectedIndex = 0; document.FormMaRecherche.villeBiens.disabled = (document.FormMaRecherche.regBiens.value != '')? '' : 'disabled' ; document.FormMaRecherche.large[0].disabled = 'disabled'; document.FormMaRecherche.large[1].disabled = 'disabled'; document.FormMaRecherche.large[2].disabled = 'disabled'; document.FormMaRecherche.large[3].disabled = 'disabled'; } else if(obj == "agences") { document.FormTrouverAgence.villeAgences.selectedIndex = 0; document.FormTrouverAgence.villeAgences.disabled = (document.FormTrouverAgence.dptAgences.value != '')? '' : 'disabled' ; } if(obj == "large" || obj == "largeLoad") { var like = document.FormMaRecherche.libre.value; var isville = (like != "" && isNaN(like.substring(0,1)) && like.length >= 4); if(isville) { document.FormMaRecherche.large[0].disabled = ''; document.FormMaRecherche.large[1].disabled = ''; document.FormMaRecherche.large[2].disabled = ''; document.FormMaRecherche.large[3].disabled = ''; } else { isville = (document.FormMaRecherche.villeBiens.value != ''); document.FormMaRecherche.large[0].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[1].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[2].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[3].disabled = (isville)? '' : 'disabled'; } } else if(obj == "largePop" && opener.document.FormMaRecherche && document.FormMaRecherche) { isville = (opener.document.FormMaRecherche.villeBiens.value != ''); document.FormMaRecherche.large[0].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[1].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[2].disabled = (isville)? '' : 'disabled'; document.FormMaRecherche.large[3].disabled = (isville)? '' : 'disabled'; } } /***** 15 - Diaporama *****/ var curPos = 0; function scrollUp(id){ var realID = id.substr(9); eval('var curPos = thumbPos'+realID); if(curPos < 0){ curPos += 10; document.getElementById('scroll'+realID).getElementsByTagName('div')[0].style.top = curPos+'px'; eval('thumbPos'+realID+' = '+curPos+';'); } else { document.getElementById('scroll'+realID).getElementsByTagName('div')[0].style.top = '0px'; } } function scrollDown(id){ var realID = id.substr(9); eval('var curPos = thumbPos'+realID); if(document.getElementById('scroll'+realID).getElementsByTagName('div')[0].offsetHeight + curPos - document.getElementById('scroll'+realID).offsetHeight > 0){ curPos -= 10; document.getElementById('scroll'+realID).getElementsByTagName('div')[0].style.top = curPos+'px'; eval('thumbPos'+realID+' = '+curPos+';'); } } function showPreview(monImg,id){ var i = 0; if(document.getElementById('previewImg'+id).getElementsByTagName('img')[0].id == 360) i++; newSrc = monImg.src.replace('/tn/102x76',''); document.getElementById('previewImg'+id).getElementsByTagName('img')[i].src = newSrc; } function buildDiapo(){ // Scan des DIV var divTable = document.getElementsByTagName('div'); var diapoTable = new Array(); for(i=0; i 0){ for(i=0; i * - " + propertyBien; if (roomsQuantity != "" && roomsQuantity > 0) infosfiche += " " + roomsQuantity + " pièce(s)"; if (surface != "" && surface != "-") infosfiche += " / " + surface; infosfiche += "
" + city + " (" + departementId + ")"; document.getElementById("infosFiche_" + id).innerHTML = infosfiche; if (fees != "" && fees != 0) { document.getElementById("fees1_" + id).innerHTML = fees; document.getElementById("fees_" + id).style.display = "block"; } document.getElementById("descFiche_" + id).innerHTML = description_bien; if (contratPrivilege2 == 1) document.getElementById("contratPrivilege_"+id).style.display = "block"; else document.getElementById("contratPrivilege_"+id).style.display = "none" if (propertyBien != "Terrain" && propertyBien != "Fond de commerce" && propertyBien != "Parking") { if (propertyBien == "Bureau" || propertyBien == "Local commercial") { document.getElementById("type1_"+id).style.display = ""; document.getElementById("surface1_"+id).innerHTML = surface; document.getElementById("heatingNature1_"+id).innerHTML = heatingNature; document.getElementById("parkingInsidesQuantity1_"+id).innerHTML = parkingInsidesQuantity; document.getElementById("parkingOutsidesQuantity1_"+id).innerHTML = parkingOutsidesQuantity; document.getElementById("garagesQuantity1_"+id).innerHTML = garagesQuantity; if (disabledPeopleAccess > 0) document.getElementById("disabledPeopleAccess1_"+id).innerHTML = "Accès handicapé"; } else if (propertyBien == "Immeuble") { document.getElementById("type2_"+id).style.display = ""; document.getElementById("surface2_"+id).innerHTML = surface; document.getElementById("lotsQuantity2_"+id).innerHTML = lotsQuantity; if (lift > 0) document.getElementById("lift2_"+id).innerHTML = "Ascenseur"; document.getElementById("groundSurface2_"+id).innerHTML = groundSurface; document.getElementById("parkingInsidesQuantity2_"+id).innerHTML = parkingInsidesQuantity; document.getElementById("parkingOutsidesQuantity2_"+id).innerHTML = parkingOutsidesQuantity; document.getElementById("garagesQuantity2_"+id).innerHTML = garagesQuantity; document.getElementById("cellar2_"+id).innerHTML = cellar; document.getElementById("constructionYear2_"+id).innerHTML = constructionYear; document.getElementById("heatingNature2_"+id).innerHTML = heatingNature; if (disabledPeopleAccess > 0) document.getElementById("disabledPeopleAccess2_"+id).innerHTML = "Accès handicapé"; } else if (propertyBien == "Maison" || propertyBien == "Appartement") { document.getElementById("type3_"+id).style.display = ""; document.getElementById("livingroomSurface3_"+id).innerHTML = livingroomSurface; document.getElementById("kitchenType3_"+id).innerHTML = kitchenType; document.getElementById("bedroomsQuantity3_"+id).innerHTML = bedroomsQuantity; document.getElementById("groundSurface3_"+id).innerHTML = groundSurface; document.getElementById("bathroomsQuantity3_"+id).innerHTML = bathroomsQuantity; document.getElementById("waterRoomsQuantity3_"+id).innerHTML = waterRoomsQuantity; document.getElementById("heatingNature3_"+id).innerHTML = heatingNature; document.getElementById("constructionYear3_"+id).innerHTML = constructionYear; document.getElementById("parkingInsidesQuantity3_"+id).innerHTML = parkingInsidesQuantity; document.getElementById("parkingOutsidesQuantity3_"+id).innerHTML = parkingOutsidesQuantity; document.getElementById("cellar3_"+id).innerHTML = cellar; document.getElementById("garagesQuantity3_"+id).innerHTML = garagesQuantity; if (propertyBien == "Maison") { document.getElementById("sstype3_1_"+id).style.display = ""; if (basement > 0) document.getElementById("basement3_"+id).innerHTML = "Sous-sol"; if (swimmingPool > 0) document.getElementById("swimmingPool3_"+id).innerHTML = "Piscine"; } else if (propertyBien == "Appartement") { document.getElementById("sstype3_2_"+id).style.display = ""; document.getElementById("balcony3_"+id).innerHTML = balcony+"/"+terrace; if (lift > 0) document.getElementById("lift3_"+id).innerHTML = "Ascenseur"; } if (disabledPeopleAccess > 0) document.getElementById("disabledPeopleAccess3_"+id).innerHTML = "Accès handicapé"; } } else document.getElementById("produitDesc").style.display = "none"; /* Visuels */ if (virtualVisitURL != "") document.getElementById("virtualVisitURL_"+id).innerHTML = "Visite virtuelle"; if (mainVisu != "") document.getElementById("mainVisu_"+id).innerHTML = mainVisu; if (subVisus != "") document.getElementById("subVisus_"+id).innerHTML = subVisus; if (nbVisus > 4) { document.getElementById("infosScrollTop_"+id).style.display = "block"; document.getElementById("infosScrollBot_"+id).style.display = "block"; } agenceInfos = agencyName+"
"; if (rcs != "") agenceInfos += rcs+"
"; agenceInfos += address1+"
"+postalCode+" "+agencyCity; document.getElementById("agenceInfos_"+id).innerHTML = agenceInfos; if (googleMaps == 1) document.getElementById("agenceGoogle_"+id).innerHTML = "> Localiser avec Google Maps"; if (phoneNumber != "") phoneNumber += "
"; else phoneNumber = "-
"; if (faxNumber != "") faxNumber += "
"; else faxNumber = "-
"; if (mailAddress != "") mailAddress = ""+mailAddress+"
"; else mailAddress = "-
"; if (webURL != "") webURL = ""+webURL+ "
"; else webURL = "-
"; document.getElementById("phoneNumber_"+id).innerHTML = phoneNumber; document.getElementById("faxNumber_"+id).innerHTML = faxNumber; document.getElementById("mailAddress_"+id).innerHTML = mailAddress; document.getElementById("webURL_"+id).innerHTML = webURL; document.getElementById("agenceRdv_"+id).href = "javascript:openPopup('/immobilier/popup/rendez-vous.php?agence="+agencyId+"&bien="+propertyId+"','form',560,630,'scrollbars=yes');"; document.getElementById("agenceEcrire_"+id).href = "javascript:openPopup('/immobilier/popup/ecrire-agence.php?agence="+agencyId+"&bien="+propertyId+"','form',560,600,'scrollbars=yes');"; document.getElementById("agenceSelect_"+id).href = "javascript: openPopup('/immobilier/popup/selection.php?id="+propertyId+"&type="+transactionBien+"','selection',330,370);"; document.getElementById("agenceAmi_"+id).href = "javascript:openPopup('/immobilier/popup/envoi-ami.php?id="+propertyId+"','ami',560,400,'scrollbars=yes');"; document.getElementById('detail'+id).style.display = ''; document.getElementById('link'+id).style.display = 'none'; } } } function hideDetail(id){ document.getElementById('detail'+id).style.display = 'none'; document.getElementById('link'+id).style.display = ''; } /***** 20 - Navigation *****/ var lastNav = ''; function showMenu(id){ if(lastNav != ''){ hideMenu(lastNav); } document.getElementById(id).className += ' hover'; lastNav = id; } function hideMenu(id){ document.getElementById(id).className = document.getElementById(id).className.substring(0,document.getElementById(id).className.length-6); lastNav = ''; } /***** 25 - Popup *****/ function openPopup(url,name,w,h,o){ window.open(url,name,'width='+w+',height='+h+',resizable=0,'+o); } /***** 30 - Selection region *****/ var regionFind = false; function selectRegion(id,n){ var optionTab = opener.document.getElementById(id).getElementsByTagName('option'); for(i=0; i\n'; } document.getElementById('helpSyntax').style.display = ''; document.getElementById('helpSyntax').style.visibility = 'visible'; } } } function getReg(obj) { if(document.FormMaRecherche.transactionType[0].checked) transaction_type = document.FormMaRecherche.transactionType[0].value; else if(document.FormMaRecherche.transactionType[1].checked) transaction_type = document.FormMaRecherche.transactionType[1].value; if (obj == "regionsBiensAvance" || obj == "regionsBiensAvanceLoad") { arr_property = new Array(); if(document.FormMaRecherche.maison.checked) arr_property.push(1); if(document.FormMaRecherche.appartement.checked) arr_property.push(2); if(document.FormMaRecherche.terrain.checked) arr_property.push(4); if(document.FormMaRecherche.immeuble.checked) arr_property.push(3); if(document.FormMaRecherche.bureau.checked) arr_property.push(5); if(document.FormMaRecherche.local.checked) arr_property.push(6); if(document.FormMaRecherche.commerce.checked) arr_property.push(7); if(document.FormMaRecherche.parkinggaragebox.checked) arr_property.push(8); property_type = arr_property.join(); urlReg = "/includes/modules/rechercheBiens/getRegionsBiens.php?type="+transaction_type+"&property="+property_type+"&recherche=avance"; } else { arr_property = new Array(); if(document.FormMaRecherche.maison.checked) arr_property.push(1); if(document.FormMaRecherche.appartement.checked) arr_property.push(2); property_type = arr_property.join(); urlReg = "/includes/modules/rechercheBiens/getRegionsBiens.php?type="+transaction_type+"&property="+property_type+"&recherche=normal"; } if(texte = file(urlReg)) { if(texte != "") { writediv(texte,obj); } } } function getVille(loc,obj,dept) { if(loc != "") { if(obj == "agences") { url = "trouverAgence/getVillesAgences.php"; url2 = ""; } else if(obj == "citiesBiens" || obj == "citiesBiensLoad") { if(obj != "citiesBiensLoad") { document.FormMaRecherche.libreCP.value = ""; document.FormMaRecherche.libre.value = ""; } if(document.FormMaRecherche.transactionType[0].checked) transaction_type = document.FormMaRecherche.transactionType[0].value; else if(document.FormMaRecherche.transactionType[1].checked) transaction_type = document.FormMaRecherche.transactionType[1].value; arr_property = new Array(); if(document.FormMaRecherche.maison.checked) arr_property.push(1); if(document.FormMaRecherche.appartement.checked) arr_property.push(2); if (document.FormMaRecherche.terrain) { if(document.FormMaRecherche.terrain.checked) arr_property.push(4); if(document.FormMaRecherche.immeuble.checked) arr_property.push(3); if(document.FormMaRecherche.bureau.checked) arr_property.push(5); if(document.FormMaRecherche.local.checked) arr_property.push(6); if(document.FormMaRecherche.commerce.checked) arr_property.push(7); if(document.FormMaRecherche.parkinggaragebox.checked) arr_property.push(8); } property_type = arr_property.join(); url = "rechercheBiens/getVillesBiens.php"; url2 = "&type="+transaction_type+"&property="+property_type; } else if(obj == "citiesBiensPop") { opener.document.FormMaRecherche.libreCP.value = ""; opener.document.FormMaRecherche.libre.value = ""; if(opener.document.FormMaRecherche.transactionType[0].checked) transaction_type = opener.document.FormMaRecherche.transactionType[0].value; else if(opener.document.FormMaRecherche.transactionType[1].checked) transaction_type = opener.document.FormMaRecherche.transactionType[1].value; if (opener.document.FormMaRecherche.maison || opener.document.FormMaRecherche.appartement) { arr_property = new Array(); if(opener.document.FormMaRecherche.maison.checked) arr_property.push(1); if(opener.document.FormMaRecherche.appartement.checked) arr_property.push(2); property_type = arr_property.join(); } else { arr_property = new Array(); if(document.FormMaRecherche.maison.checked) arr_property.push(1); if(document.FormMaRecherche.appartement.checked) arr_property.push(2); if(document.FormMaRecherche.terrain.checked) arr_property.push(4); if(document.FormMaRecherche.immeuble.checked) arr_property.push(3); if(document.FormMaRecherche.bureau.checked) arr_property.push(5); if(document.FormMaRecherche.local.checked) arr_property.push(6); if(document.FormMaRecherche.commerce.checked) arr_property.push(7); if(document.FormMaRecherche.parkinggaragebox.checked) arr_property.push(8); property_type = arr_property.join(); } url = "rechercheBiens/getVillesBiens.php"; url2 = "&type="+transaction_type+"&property="+property_type+ ((dept != undefined) ? "&dept="+dept : ''); } if(texte = file("/includes/modules/"+url+"?loc="+escape(loc)+url2)) { if(texte != "") { writediv(texte,obj); } } } else { unlockSList(obj); } } function searchPreview(like,nbCaracteresMin) { document.FormMaRecherche.regBiens.value = ""; if(like != "" && isNaN(like.substring(0,1)) && like.length >= nbCaracteresMin) { unlockSList("citiesBiens"); document.FormMaRecherche.large[0].disabled = ''; document.FormMaRecherche.large[1].disabled = ''; document.FormMaRecherche.large[2].disabled = ''; document.FormMaRecherche.large[3].disabled = ''; like = like.toLowerCase(); document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; /* On cherche la chaine dans le tableau javascript s'il existe */ if(tabSearchVilles != "" && tabSearchVilles[0].length > 1 && tabSearchVilles[0].substring(0,1) != '_' && like.length > nbCaracteresMin) { if(tabSearchVilles[0].indexOf("::") == -1) { if(like.indexOf("(") > 0) like = like.substring(0,like.indexOf("(")-1) like = like.trim (); cpt = 0; texthtml = "\n"; var trouve = false; for(keyVar in tabSearchVilles) { tmp = tabSearchVilles[keyVar].split("_"); if(tmp[1].substring(0,like.length) == getNormalizedCity(like)) { dpt = tmp[0]; city = tmp[1]; if ((cpt%2) == 0) rowcls = "gris"; else rowcls = "blanc"; texthtml += ""; trouve = true; cpt++; } } if(trouve == false) texthtml = "Aucun element ne correspond a la demande."; texthtml += "
"+city+" ("+dpt+")
\n"; } else { texthtml = ""+tabSearchVilles[0].replace("::","")+""; } writediv(texthtml,"search"); } else if(texte = file("/includes/modules/rechercheBiens/getVillesSearch.php?search="+escape(like))) { /* On execute sinon le script pour recuperer un tableau des villes commencant par la chaine recherchee */ if(texte != "") { if(texte.indexOf("::") == -1) { cpt = 0; tabSearchVilles = texte.split(","); texthtml = "\n"; for(keyVar in tabSearchVilles) { tmp = tabSearchVilles[keyVar].split("_"); dpt = tmp[0]; city = tmp[1]; if ((cpt%2) == 0) rowcls = "gris"; else rowcls = "blanc"; texthtml += ""; cpt++; } texthtml += "
"+city+" ("+dpt+")
\n"; } else { tabSearchVilles = texte.split(","); texthtml = ""+texte.replace("::","")+""; } writediv(texthtml,"search"); } } } else if(like.length < nbCaracteresMin) { document.FormMaRecherche.large[0].disabled = 'disabled'; document.FormMaRecherche.large[1].disabled = 'disabled'; document.FormMaRecherche.large[2].disabled = 'disabled'; document.FormMaRecherche.large[3].disabled = 'disabled'; document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; if(!isOpera && document.all){ if(document.getElementById('helpSyntax')){ document.getElementById('helpSyntax').style.display = 'none'; document.getElementById('helpSyntax').style.visibility = 'hidden'; } } document.FormMaRecherche.libreCP.value = ""; } else document.FormMaRecherche.libreCP.value = ""; } function searchPreviewMultiple(obj,nbCaracteresMin) { like = obj.value; if(like != "" && isNaN(like.substring(0,1)) && like.length >= nbCaracteresMin) { like = like.toLowerCase(); document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; /* On cherche la chaine dans le tableau javascript s'il existe */ if(tabSearchVilles != "" && like.length > nbCaracteresMin) { if(tabSearchVilles[0].indexOf("::") == -1) { if(like.indexOf("(") > 0) like = like.substring(0,like.indexOf("(")-1) like = like.trim (); cpt = 0; texthtml = "\n"; var trouve = false; for(keyVar in tabSearchVilles) { tmp = tabSearchVilles[keyVar].split("_"); if(tmp[1].substring(0,like.length) == getNormalizedCity(like)) { dpt = tmp[0]; city = tmp[1]; if ((cpt%2) == 0) rowcls = "gris"; else rowcls = "blanc"; texthtml += ""; trouve = true; cpt++; } } if(trouve == false) texthtml = "Aucun element ne correspond a la demande."; texthtml += "
"+city+" ("+dpt+")
\n"; } else { texthtml = ""+tabSearchVilles[0].replace("::","")+""; } writediv(texthtml,"search"); } else if(texte = file("/includes/modules/rechercheBiens/getVillesSearch.php?search="+escape(like))) { /* On execute sinon le script pour recuperer un tableau des villes commencant par la chaine recherchee */ if(texte != "") { if(texte.indexOf("::") == -1) { cpt = 0; tabSearchVilles = texte.split(","); texthtml = "\n"; for(keyVar in tabSearchVilles) { tmp = tabSearchVilles[keyVar].split("_"); dpt = tmp[0]; city = tmp[1]; if ((cpt%2) == 0) rowcls = "gris"; else rowcls = "blanc"; texthtml += ""; cpt++; } texthtml += "
"+city+" ("+dpt+")
\n"; } else { tabSearchVilles = texte.split(","); texthtml = ""+texte.replace("::","")+""; } writediv(texthtml,"search"); } } } else if(like.length < nbCaracteresMin) { document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; if(!isOpera && document.all){ if(document.getElementById('helpSyntax')){ document.getElementById('helpSyntax').style.display = 'none'; document.getElementById('helpSyntax').style.visibility = 'hidden'; } } } } function reg_replace(chaine,char1,char2) { var reg = new RegExp(char1, "ig"); nouv_chaine = chaine.replace(reg,char2); return nouv_chaine; } function getNormalizedCity(chaine) { /* Remplacement des apostrophes par des espaces */ chaine = reg_replace(chaine,"'"," "); /* Remplacement des tirets par des espaces */ chaine = reg_replace(chaine,"-"," "); /* Convertion des caracteres accentues en leur equivalent ASCII */ chaine = reg_replace(chaine,"['àâä']","a"); chaine = reg_replace(chaine,"['éèêë']","e"); chaine = reg_replace(chaine,"['îï']","i"); chaine = reg_replace(chaine,"['ôö']","o"); chaine = reg_replace(chaine,"['ùûü']","u"); /* Mise en majuscule de toutes les premieres lettres de la chaine */ var elements = chaine.split(" "); for(key in elements) { elements[key] = elements[key].substring(0,1).toUpperCase() + elements[key].substring(1,elements[key].length); } chaine = elements.join(" "); return chaine; } function setSearch(str1,str2) { if(str1 != "" && str2 != "") { document.FormMaRecherche.regBiens.value = ""; } unlockSList("citiesBiens"); document.forms.FormMaRecherche.libreCP.value = str1; document.forms.FormMaRecherche.libre.value = str2; if(str1 != "") document.forms.FormMaRecherche.libre.value += " ("+str1+")"; document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; if(!isOpera && document.all){ document.getElementById('helpSyntax').style.display = 'none'; document.getElementById('helpSyntax').style.visibility = 'hidden'; } } function setSearchMultiple(obj,str1,str2) { eval("document.getElementById('"+obj+"CP').value = '"+str1+"'"); eval("document.getElementById('"+obj+"').value = '"+str2+"'"); if(str1 != "") eval("document.getElementById('"+obj+"').value += '("+str1+")'"); document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; if(!isOpera && document.all){ document.getElementById('helpSyntax').style.display = 'none'; document.getElementById('helpSyntax').style.visibility = 'hidden'; } } function rempliMultiple(type) { ch1 = ""; ch2 = ""; libre1 = document.getElementById("libre1").value; libre1CP = document.getElementById("libre1CP").value; libre2 = document.getElementById("libre2").value; libre2CP = document.getElementById("libre2CP").value; libre3 = document.getElementById("libre3").value; libre3CP = document.getElementById("libre3CP").value; libre4 = document.getElementById("libre4").value; libre4CP = document.getElementById("libre4CP").value; /* Noms des villes */ if(libre1 != "") ch1 = libre1; else document.getElementById("libre1CP").value = ""; if(libre2 != "") { if(libre2 != libre1) { if(ch1 != "") ch1 += ", "; ch1 += libre2; } } else document.getElementById("libre2CP").value = ""; if(libre3 != "") { if(libre3 != libre2 && libre3 != libre1) { if(ch1 != "") ch1 += ", "; ch1 += libre3; } } else document.getElementById("libre3CP").value = ""; if(libre4 != "") { if(libre4 != libre3 && libre4 != libre2 && libre4 != libre1) { if(ch1 != "") ch1 += ", "; ch1 += libre4; } } else document.getElementById("libre4CP").value = ""; libre1CP = document.getElementById("libre1CP").value; libre2CP = document.getElementById("libre2CP").value; libre3CP = document.getElementById("libre3CP").value; libre4CP = document.getElementById("libre4CP").value; /* CP des villes */ if(libre1CP != "") { ch2 = libre1CP; } else if (libre1 != "") ch2 = "0"; if(libre2CP != "" && libre2 != libre1) { if(ch2 != "") ch2 += ","; ch2 += libre2CP; } else if (libre2 != "") { if(ch2 != "") ch2 += ","; ch2 += "0"; } if(libre3CP != "" && libre3 != libre2 && libre3 != libre1) { if(ch2 != "") ch2 += ","; ch2 += libre3CP; } else if (libre3 != "") { if(ch2 != "") ch2 += ","; ch2 += "0"; } if(libre4CP != "" && libre4 != libre3 && libre4 != libre2 && libre4 != libre1) { if(ch2 != "") ch2 += ","; ch2 += libre4CP; } else if (libre4 != "") { if(ch2 != "") ch2 += ","; ch2 += "0"; } opener.document.getElementById("libre").value = ch1; opener.document.getElementById("libreCP").value = ch2; opener.document.getElementById(type).options[0].selected = 'selected'; opener.getVille(opener.document.getElementById(type).value,'citiesBiens'); window.close(); } function showFiche(obj,propertyId,nav,cpt) { if (document.all && !isOpera && document.getElementById('flayerinfo') || !document.all || isOpera) { hideInfo (); Xpos = obj.offsetParent.offsetLeft; Ypos = obj.offsetParent.offsetTop; if (propertyId != "" && (texte = file("/immobilier/annonces-immobilieres/getFicheSearch.php?search="+escape(propertyId)+"&nav="+nav+"&cpt="+cpt))) { if (texte != "") { tabSearchFiche = texte.split("|"); transactionType = tabSearchFiche[0]; propertyType = tabSearchFiche[1]; city = tabSearchFiche[2]; contratPrivilege2 = tabSearchFiche[3]; sellingPrice = tabSearchFiche[4]; roomsQuantity = tabSearchFiche[5]; surface = tabSearchFiche[6]; surfaceUnit = tabSearchFiche[7]; departementId = tabSearchFiche[8]; desc = tabSearchFiche[9]; groundSurface = tabSearchFiche[10]; bedroomsQuantity = tabSearchFiche[11]; floorsQuantity = tabSearchFiche[12]; mainVisu = tabSearchFiche[13]; subVisus = tabSearchFiche[14]; fees = tabSearchFiche[15]; deposit = tabSearchFiche[16]; cession = tabSearchFiche[17]; var infoLoc1 = ''; var infoLoc2 = ''; var infoLoc3 = ''; if (transactionType == '2') { var localBureau = (propertyType == "Local commercial" || propertyType == "Bureau"); infoLoc1 = (localBureau) ? " annuel HT HC" : " mensuel CC"; if (fees != '0') { infoLoc2 = '
Honoraires en sus : ' + fees + ' € ' + ((localBureau) ? 'HC' : 'TTC') + '*'; } if (deposit != '0') { infoLoc3 += '
Dépôt de garantie : ' + deposit + ' € ' + 'TTC' + '*'; } if (localBureau) infoLoc3 += '
Cession de bail : ' + cession + ' € ' + 'HT' + '*'; } var infosfiche = ""+sellingPrice+" € " + infoLoc1 + " * - "+ propertyType; if (roomsQuantity != "" && roomsQuantity > 0) infosfiche += " "+roomsQuantity+" pièce(s)"; if (surface != "") infosfiche += "
"+surface+" "+surfaceUnit + ' ' + 'environ'; infosfiche += "

"+city+" ("+departementId+")"; infosfiche += infoLoc2 + infoLoc3; document.getElementById("infosFiche").innerHTML = infosfiche; document.getElementById("descFiche").innerHTML = desc; if (contratPrivilege2 == 1) document.getElementById("contratPrivilege").style.display = "block"; else document.getElementById("contratPrivilege").style.display = "none"; /* Visuels */ if (mainVisu != "") document.getElementById("visuFiche").innerHTML = mainVisu; if (subVisus != "") document.getElementById("thumbFiche").innerHTML = subVisus+"\n
\n"; // Clear & appel clearTimeout(timeInfo); timeInfo = setTimeout("showInfo('',"+obj.offsetTop+","+obj.offsetLeft+");",500); } } buildDiapo(); } } function getForm(nb) { var err = ''; var civ1 = document.FormSubscribtion.civilite[0].checked; var civ2 = document.FormSubscribtion.civilite[1].checked; var civ3 = document.FormSubscribtion.civilite[2].checked; var cprenom = document.FormSubscribtion.cprenom.value; var cnom = document.FormSubscribtion.cnom.value; var ccp = document.FormSubscribtion.cCP.value; var cnum = document.FormSubscribtion.cnum.value; var show = 1; if (cprenom == '' || cnom == '') { err = "Veuillez remplir les champs suivants :
"; if (cprenom == '') err += "- prénom
"; if (cnom == '') err += "- nom"; document.getElementById('alertForm2').innerHTML = err; show = 0; } if ((cprenom != '' && cnom != '' && (ccp != '' || cnum != '')) && (texte = file("/immobilier/mon-espace-laforet/getForm.php?cnom=" + escape (cnom) + '&cprenom=' + escape (cprenom) + '&ccp=' + ccp + '&cnum=' + cnum))) { if (texte != '') { if (texte == '0') { err = "Aucun bien en vente n'est lié aux nom, prénom et numéro saisis. Pour accéder à l'isuivi, vous devez les modifier et cliquer sur Corriger. Sinon, vous créerez un compte sans accès à l'isuivi"; document.getElementById('alertForm2').innerHTML = err; show = 1; } else if (texte.indexOf('::') == -1) { tabForm = texte.split ('|'); civ = tabForm[0]; //cprenom = tabForm[1]; ccp2 = tabForm[2]; cnum2 = tabForm[3]; adresse1 = tabForm[4]; adresse2 = tabForm[5]; cp = tabForm[6]; country = tabForm[7]; ville = tabForm[8]; tel = tabForm[9]; if (nb == 1) { if (civ == "m") document.FormSubscribtion.civilite[0].checked = true; else if (civ == "mme") document.FormSubscribtion.civilite[1].checked = true; else if (civ == "mlle") document.FormSubscribtion.civilite[2].checked = true; if(ccp == '' && cnum != '' && ccp2 != '') { show = 0; openPopup ( '/immobilier/mon-espace-laforet/popup/' + 'profil-contrat-privilege.php', 'contrat', 541, 300); } else document.FormSubscribtion.cCP.value = ccp2; document.FormSubscribtion.cnum.value = cnum2; document.FormSubscribtion.cadrs.value = adresse1; document.FormSubscribtion.cadrs2.value = adresse2; document.FormSubscribtion.cp.value = cp; document.FormSubscribtion.ccountry.value = country; document.FormSubscribtion.cville.value = ville; document.FormSubscribtion.ctel.value = tel; } var arrDisabledFields = new Array (); arrDisabledFields['civilite'] = 1; arrDisabledFields['cprenom'] = 1; arrDisabledFields['cnom'] = 1; arrDisabledFields['cCP'] = 1; arrDisabledFields['cnum'] = 1; arrDisabledFields['cadrs'] = 1; arrDisabledFields['cadrs2'] = 1; arrDisabledFields['cp'] = 1; arrDisabledFields['ccountry'] = 1; arrDisabledFields['cville'] = 1; arrDisabledFields['ctel'] = 1; if (nb == 2) { var arrPericlesFields = new Array (); periclesFields = document.FormSubscribtion.periclesFields.value; arrPericlesFields = periclesFields.split(','); arrDisabledFields['civilite'] = 0; arrDisabledFields['cprenom'] = 0; arrDisabledFields['cnom'] = 0; //arrDisabledFields['cCP'] = 0; arrDisabledFields['cnum'] = 0; arrDisabledFields['cadrs'] = 0; arrDisabledFields['cadrs2'] = 0; arrDisabledFields['cp'] = 0; arrDisabledFields['ccountry'] = 0; arrDisabledFields['cville'] = 0; arrDisabledFields['ctel'] = 0; for (i = 0; i < arrPericlesFields.length; i++) { if (arrPericlesFields[i] == "civilite") arrDisabledFields['civilite'] = 1; if (arrPericlesFields[i] == "cprenom") arrDisabledFields['cprenom'] = 1; if (arrPericlesFields[i] == "cnom") arrDisabledFields['cnom'] = 1; if (arrPericlesFields[i] == "cCP") arrDisabledFields['cCP'] = 1; if (arrPericlesFields[i] == "cnum") arrDisabledFields['cnum'] = 1; if (arrPericlesFields[i] == "cadrs") arrDisabledFields['cadrs'] = 1; if (arrPericlesFields[i] == "cadrs2") arrDisabledFields['cadrs2'] = 1; if (arrPericlesFields[i] == "cp") arrDisabledFields['cp'] = 1; if (arrPericlesFields[i] == "ccountry") arrDisabledFields['ccountry'] = 1; if (arrPericlesFields[i] == "cville") arrDisabledFields['cville'] = 1; if (arrPericlesFields[i] == "ctel") arrDisabledFields['ctel'] = 1; } } if ((document.FormSubscribtion.civilite[0].checked || document.FormSubscribtion.civilite[1].checked || document.FormSubscribtion.civilite[2].checked) && arrDisabledFields['civilite'] == 1) { document.FormSubscribtion.civilite[0].disabled = "disabled"; document.FormSubscribtion.civilite[1].disabled = "disabled"; document.FormSubscribtion.civilite[2].disabled = "disabled"; } if (document.FormSubscribtion.cprenom.value != '' && arrDisabledFields['cprenom'] == 1) document.FormSubscribtion.cprenom.disabled = 'disabled'; if (document.FormSubscribtion.cnom.value != '' && arrDisabledFields['cnom'] == 1) document.FormSubscribtion.cnom.disabled = 'disabled'; if (document.FormSubscribtion.cCP.value != '' && arrDisabledFields['cCP'] == 1) document.FormSubscribtion.cCP.disabled = 'disabled'; if (document.FormSubscribtion.cnum.value != '' && arrDisabledFields['cnum'] == 1) document.FormSubscribtion.cnum.disabled = 'disabled'; if (document.FormSubscribtion.cadrs.value != '' && arrDisabledFields['cadrs'] == 1) document.FormSubscribtion.cadrs.disabled = 'disabled'; if (document.FormSubscribtion.cadrs2.value != '' && arrDisabledFields['cadrs2'] == 1) document.FormSubscribtion.cadrs2.disabled = 'disabled'; if (document.FormSubscribtion.cp.value != '' && arrDisabledFields['cp'] == 1) document.FormSubscribtion.cp.disabled = 'disabled'; if (document.FormSubscribtion.ccountry.value != '' && arrDisabledFields['ccountry'] == 1) document.FormSubscribtion.ccountry.disabled = 'disabled'; if (document.FormSubscribtion.cville.value != '' && arrDisabledFields['cville'] == 1) document.FormSubscribtion.cville.disabled = 'disabled'; if (document.FormSubscribtion.ctel.value != '' && arrDisabledFields['ctel'] == 1) document.FormSubscribtion.ctel.disabled = 'disabled'; } else { show = 0; err = 'yes'; document.getElementById('alertForm2').innerHTML = texte.replace ('::', ''); } } } if (show == 1) { for (i = 0;i <= 12; i++) { document.getElementById('formLine' + i).style.display = ''; } document.getElementById('btn2').style.visibility = 'hidden'; location.href = '#suite'; document.getElementById('vendorRetry').style.visibility = 'visible'; } if (err == '' && document.getElementById('fmkError').value != '1') document.getElementById('alertForm2').innerHTML = ''; } function alerteMail(recherche,val) { if(val == 0 || val == 1) { texte = file("/immobilier/mon-espace-laforet/getFonctions.php?fonction=alerteMail&recherche="+recherche+"&val="+val); if (val == 0) { document.getElementById('alerte'+recherche+'_1').style.display = "none"; document.getElementById('alerte'+recherche+'_0').style.display = ""; } else { document.getElementById('alerte'+recherche+'_0').style.display = "none"; document.getElementById('alerte'+recherche+'_1').style.display = ""; } } } /***** 60 - Espace Laforet *****/ function afficheForm(val) { if(val == 1) { for(i=0;i<=12;i++){ opener.document.getElementById('formLine'+i).style.display = ""; } opener.document.getElementById("btn2").style.visibility = "hidden"; } else if (val == 2) { opener.document.location.href = '/immobilier/mon-espace-laforet/profil.php'; } window.close(); } function submitIdentification (obj) { // Scan des INPUT var inputTable = document.getElementsByTagName('input'); var resultTable = new Array(); j = 0; for(i=0; i 0) { url += "&ville="+ville+"&indexVille="+indexVille; } document.location = url; } } function changePage(objForm,currentpage) { eval("document."+objForm+".currentpage.value = "+currentpage+";"); eval("document."+objForm+".submit();"); } function chargeFiche(agence) { document.FormFicheAgence.agence.value = agence; document.FormFicheAgence.submit(); } /***** 65 - Controle des formulaires *****/ function checkEmail(email) { var re = new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,3}"); var test = email.search(re); if(test != -1) return true; else { alert("Adresse email incorrecte"); return false; } } function testFormHeader() { var cp = document.FormHeaderTrouverAgence.ville.value; var reg = /^\d{0,5}$/; if(!reg.test(cp)) { document.location = document.FormHeaderTrouverAgence.action + "?search=nok"; return false; } else return true; } function testReference() { if(document.FormReference.id.value == "") return false; } function testMaRecherche() { if(!document.FormMaRecherche.maison.checked && !document.FormMaRecherche.appartement.checked && !document.FormMaRecherche.terrain.checked && !document.FormMaRecherche.immeuble.checked && !document.FormMaRecherche.bureau.checked && !document.FormMaRecherche.local.checked && !document.FormMaRecherche.commerce.checked && !document.FormMaRecherche.parkinggaragebox.checked) { document.getElementById('alertForm').innerHTML = "Veuillez choisir au moins un type de bien pour votre recherche"; document.getElementById('alertForm').style.display = "block"; return false; } else { document.getElementById('alertForm').innerHTML = ""; document.getElementById('alertForm').style.display = "none"; } } function testMaRecherche2() { if(!document.FormMaRecherche.maison.checked && !document.FormMaRecherche.appartement.checked) { alert("Veuillez choisir au moins un type de bien pour votre recherche"); return false; } } function testTri (page,query,tri) { if (tri != 00) { var pos = query.indexOf('&tri='); if (pos > -1) location.href = page + "?" + query.substr(0,pos) + "&tri=" + tri; else location.href = page + "?" + query + "&tri=" + tri; } } function plusCriteres (obj) { if (obj == "FormMaRecherche") { document.FormMaRecherche.action = "/immobilier/annonces-immobilieres/annonce-immobilier.php"; document.FormMaRecherche.submit (); } else if (obj == "FormRechercheCiblee") { document.FormRechercheCiblee.action = "/immobilier/annonces-immobilieres/annonce-immobilier.php"; document.FormRechercheCiblee.submit (); } } /***** 80- Google Maps *****/ function openWin(url) { googlemap = window.open(url,'googlemap','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=650,height=450'); } /***** 99 - onLoad *****/ window.onload = function(){ // 05 - Affichage / Masquage layer information if(document.getElementById('infoLayer')){ document.getElementById('infoLayer').onmouseover = function(){ clearTimeout(timeInfo); } document.getElementById('infoLayer').onmousemove = function(){ clearTimeout(timeInfo); } document.getElementById('infoLayer').onmouseout = function(){ clearTimeout(timeInfo); timeInfo = setTimeout("hideInfo();",500); } //ajout de l'iframe pour IE if(document.all && !isOpera){ document.getElementById('resultats').innerHTML += '\n\n'; } } // Scan des DIV var divTable = document.getElementsByTagName('div'); var resultTable = new Array(); diapoTable = new Array(); for(i=0; i\n'; } } } if(document.getElementById("searchbox")) { document.getElementById("searchbox").onclick = function (){ document.getElementById("searchbox").style.visibility = "hidden"; document.getElementById("searchbox").style.display = "none"; document.getElementById("searchbox").innerHTML = ""; if(!isOpera && document.all){ if(document.getElementById('helpSyntax')) { document.getElementById('helpSyntax').style.display = 'none'; document.getElementById('helpSyntax').style.visibility = 'hidden'; } } } } // Affichage du bandeau pub if(document.getElementById("banner")) document.getElementById("banner").innerHTML = "Pub"; } function show_hide (n, v) { if (document.layers) document.layers[n].display = v; else if (document.all) document.all[n].style.display = v; else (document.getElementById) document.getElementById(n).style.display = v; }