var PilePopup_Array = new Array;
function PilePopup_Push (fct) {
PilePopup_Array.push(fct);
}
function PilePopup_Pop (temps) {
if (PilePopup_Array.length) {
if(jQuery_mdtr('#backgroundPopup').is(":visible")) {
// rien a faire il y en a déjà une popup ouverte
} else {
// if(jQuery_mdtr('#div_griser').length) return; // pas encore
PilePopup_Array.pop()();
}
setTimeout('PilePopup_Pop('+ temps +')', temps); // on continura d'essayer plus tard, car il en reste
} else {
call_complement_in_pile = false; // on peut en remettre du coup
}
/*
setTimeout('PilePopup_Pop()', temps); // on continura d'essayer plus tard
if(jQuery_mdtr('#backgroundPopup').is(":visible")) {
// pas encore
return;
}
// if(jQuery_mdtr('#div_griser').length) return; // pas encore
!PilePopup_Array.length || PilePopup_Array.pop()();
*/
}
function ValiderNewAnn() {
// document.mdp.submit();
jQuery_mdtr("#Part_NewAnn").submit();
}
jQuery_mdtr(document).ready(function() {
tab_desc_langsToGet = jQuery_mdtr("#tab_desc_langsToGet").val().split(",");
// var Part_NewAnn_encours = false;
// function Part_NewAnn() {
// var forfait = jQuery_mdtr(".rad:checked").val();
// var typeann = jQuery_mdtr('#id_fiche_type_id option:selected').val();
// var bienann = jQuery_mdtr('#id_fiche_bien_id option:selected').val();
// var cp = VerifInputText('#id_client_cp');
// var prix = VerifInputText('#id_fiche_prix');
// var IsPrix = 0;
// if(jQuery_mdtr('#id_fiche_prix_masque').is(':checked'))
// IsPrix = 1;
// var nbpieces = VerifInputText('#id_fiche_nbpieces');
// var nbchambres = VerifInputText('#id_fiche_nbchambres');
// var surfhab = VerifInputText('#id_fiche_superficie_hab');
// var surfter = VerifInputText('#id_fiche_superficie_terrain');
// var typesurf = VerifInputText('#id_fiche_type_de_surface');
// var IsPiscine = 0;
// if(jQuery_mdtr('#id_fiche_piscine').is(':checked'))
// IsPiscine = 1;
// var dpe_nrj = VerifInputText('#id_fiche_dpe_nrj');
// var dep_ges = VerifInputText('#id_fiche_dpe_ges');
// var nbetages = VerifInputText('#id_fiche_nbetages');
// var nbplaces = VerifInputText('#id_fiche_nbplaces');
// var tdr = VerifInputText('#id_fiche_tdr');
// var ca = VerifInputText('#maxChambre');
// var nom = VerifInputText('#id_client_nom');
// var prenom = VerifInputText('#id_client_prenom');
// var adresse = VerifInputText('#id_client_adresse');
// var ville = VerifInputText('#id_client_ville');
// var tel1 = VerifInputText('#id_client_tel1');
// var tel2 = VerifInputText('#id_client_tel2');
// var mail = VerifInputText('#id_client_email');
// var mdp = VerifInputText('#id_client_mdp');
// var mdp2 = VerifInputText('#id_client_mdp2');
// var log_mail = VerifInputText('#id_clientlog_email');
// var log_mdp = VerifInputText('#id_clientlog_mdp');
// }
function Part_NewAnn() {
document.mdp.submit();
}
function Part_NewAnnEchec(){
jQuery_mdtr('.popup_warning .contenu_texte').html(jQuery_mdtr.validity.end().popupmsg);
lancementPopup("popup_warning.croix");
}
var OngletActif = 1;
jQuery_mdtr('#milieu1').click(function(){
if(OngletActif!=1){
jQuery_mdtr('.Content_DejaCompte').fadeOut("fast",function(){
jQuery_mdtr('.Content_Coord').fadeIn("fast");
enableOngletNiv1(1);
disableOngletNiv1(2);
// jQuery_mdtr('.FormAlerte').attr('id','InscriptionAlerte');
});
OngletActif=1;
}
});
jQuery_mdtr('#milieu2').click(function(){
if(OngletActif!=2){
jQuery_mdtr('.Content_Coord').fadeOut("fast",function(){
jQuery_mdtr('.Content_DejaCompte').fadeIn("fast");
disableOngletNiv1(1);
enableOngletNiv1(2);
// jQuery_mdtr('.FormAlerte').attr('id','CreaAlerte');
});
OngletActif=2;
}
});
//GESTION AFFICHAGE ONGLET NIV1
function enableOngletNiv1(num) {
jQuery_mdtr("#gauche" + num).removeClass("gaucheoff").addClass("gauche");
jQuery_mdtr("#milieu" + num).removeClass("milieuoff").addClass("milieu");
jQuery_mdtr("#droit" + num).removeClass("droitoff").addClass("droit");
}
function disableOngletNiv1(num) {
jQuery_mdtr("#gauche" + num).removeClass("gauche").addClass("gaucheoff");
jQuery_mdtr("#milieu" + num).removeClass("milieu").addClass("milieuoff");
jQuery_mdtr("#droit" + num).removeClass("droit").addClass("droitoff");
}
//GESTION AFFICHAGE ONGLET NIV1 //
function VerifInputText(leChamp){
var variable;
if(jQuery_mdtr(leChamp).val() == jQuery_mdtr(leChamp).attr('default'))
variable = "";
else
variable = jQuery_mdtr(leChamp).val();
return variable;
}
jQuery_mdtr('input[type="radio"][name="duree"]').click(function() {
var actu_val = $("#id_fiche_type_id").val();
if ($(this).val() == 4) { // uniquement loca saisonniaire
$("option", "#id_fiche_type_id").remove();
$("#id_fiche_type_id").append('');
$('#restric_categ').css('color','#ff6412');
$('#restric_categ').css('line-height','12px');
$('#restric_categ').html(Offre_loc_vac);
} else if ($(this).val() == 3) { // uniquement vente
$("option", "#id_fiche_type_id").remove();
$("#id_fiche_type_id").append('');
$('#restric_categ').css('color','#b61026');
$('#restric_categ').css('line-height','20px');
$('#restric_categ').html(Offre_vente);
} else {
$("option", "#id_fiche_type_id").remove();
$("#id_fiche_type_id").append('');
for (var i = 1; i <= 3 ; i++) {
$("#id_fiche_type_id").append('');
}
$('#restric_categ').html('');
}
$("#id_fiche_type_id").val(actu_val);
jQuery_mdtr('#id_fiche_type_id').change();
});
jQuery_mdtr('#id_fiche_type_id').change(function() {
var actu_val = $("#id_fiche_bien_id").val();
var this_val = $(this).val();
if (this_val == '') this_val = 0;
$("option", "#id_fiche_bien_id").remove();
$("#id_fiche_bien_id").append('');
var idx;
for (var i = 0 ; i < window["TypeBienByCateg"][this_val].length ; i++) {
idx = window["TypeBienByCateg"][this_val][i];
$("#id_fiche_bien_id").append('');
}
$("#id_fiche_bien_id").val(actu_val);
});
jQuery_mdtr('#id_fiche_type_id').change(function(){
jQuery_mdtr('#id_fiche_type_id').css('border','1px solid #999');
jQuery_mdtr('#id_fiche_type_id').css('color','#000');
if(jQuery_mdtr(this).attr('titre') != undefined) {
var idDestination = jQuery_mdtr(this).attr('titre');
obj_titre = jQuery_mdtr('#'+idDestination);
jQuery_mdtr(obj_titre).css("color","#666");
}
GestionPortails();
});
jQuery_mdtr('#id_fiche_bien_id').change(function(){
jQuery_mdtr('#id_fiche_bien_id').css('border','1px solid #999');
jQuery_mdtr('#id_fiche_bien_id').css('color','#000');
if(jQuery_mdtr(this).attr('titre') != undefined) {
var idDestination = jQuery_mdtr(this).attr('titre');
obj_titre = jQuery_mdtr('#'+idDestination);
jQuery_mdtr(obj_titre).css("color","#666");
}
GestionPortails();
EcrireDetails(jQuery_mdtr(this).val());
});
initLocalisation("#id_fiche_cpville");
jQuery_mdtr("#id_fiche_pays").bind("change", function(){
// on remet a zero la localisation si on change de pays
jQuery_mdtr("#id_fiche_cpville").val('');
jQuery_mdtr("#id_fiche_ville").val('');
jQuery_mdtr("#id_fiche_villereal").val('');
jQuery_mdtr("#id_fiche_cp").val('');
jQuery_mdtr("#id_fiche_departement_id").val('');
jQuery_mdtr("#id_fiche_secteur_id").val('');
});
jQuery_mdtr('#lab_cpville').click(function(){
popup_ville();
});
// initLocalisationClient("#id_client_cpville");
jQuery_mdtr("#id_fiche_description")
.keydown(function() {
textCounter(jQuery_mdtr(this), '#id_remLen', jQuery_mdtr("#maxlength_text").val());
})
.keyup(function() {
textCounter(jQuery_mdtr(this), '#id_remLen', jQuery_mdtr("#maxlength_text").val());
ChangeDesc();
})
.focus(function(){
if (jQuery_mdtr(this).val() == form_texte_tradAuto) {
jQuery_mdtr(this).val('');
}
})
jQuery_mdtr("#id_pub_text_trad_type").change(function(){
ChangeModeTrad(jQuery_mdtr(this).val());
// ChangeModeTrad(jQuery_mdtr("#id_pub_text_trad_type").val());
});
jQuery_mdtr("#id_lang").change(function(){
ChangeLang(jQuery_mdtr(this).val());
});
jQuery_mdtr('.rad').click(function(){
jQuery_mdtr('#lab_offre').css('color','#646077');
});
jQuery_mdtr('#Part_NewAnn').bind('succes',Part_NewAnn);
jQuery_mdtr('#Part_NewAnn').bind('echec',Part_NewAnnEchec);
jQuery_mdtr("#Part_NewAnn").validity(function(){
jQuery_mdtr(".rad").assert(jQuery_mdtr(".rad:checked").length != 0, form_texte_doitEtreCoche);
jQuery_mdtr('#id_fiche_type_id').require();
jQuery_mdtr('#id_fiche_bien_id').require();
jQuery_mdtr('#id_fiche_cpville').require().match('nonHtml');
jQuery_mdtr('#id_fiche_prix').require().match('nonHtml').match('number');
jQuery_mdtr('#id_fiche_description').require().match('nonHtml');
if(OngletActif == 1){
jQuery_mdtr('#id_client_nom').require().match('nonHtml');
jQuery_mdtr('#id_client_prenom').require().match('nonHtml');
jQuery_mdtr('#id_client_adresse').require().match('nonHtml');
if ($.inArray($('#id_client_pays').val(), window["PAYS_BD_VILLES"]) == -1) {
jQuery_mdtr('#id_client_cp').require().match('nonHtml');
jQuery_mdtr('#id_client_ville').require().match('nonHtml');
} else {
jQuery_mdtr('#id_client_cpville').require().match('nonHtml');
}
jQuery_mdtr('#id_client_tel1').require().match('nonHtml');
jQuery_mdtr('#id_client_email').require().match('nonHtml').match('email');
if (jQuery_mdtr('#id_client_pass2').length) {
if ($('#newuser').val() == 1) {
// si nouvel utlilisateur
jQuery_mdtr('#id_client_pass2').require().match('nonHtml');
jQuery_mdtr('#id_client_pass3').require().match('nonHtml');
} else {
if (jQuery_mdtr('#id_client_pass3').val().length || jQuery_mdtr('#id_client_pass').val().length) jQuery_mdtr('#id_client_pass2').require().match('nonHtml');
if (jQuery_mdtr('#id_client_pass2').val().length || jQuery_mdtr('#id_client_pass').val().length) jQuery_mdtr('#id_client_pass3').require().match('nonHtml');
if (jQuery_mdtr('#id_client_pass2').val().length || jQuery_mdtr('#id_client_pass3').val().length) jQuery_mdtr('#id_client_pass').require().match('nonHtml');
}
}
jQuery_mdtr('#id_clientlog_email').val('');
jQuery_mdtr('#id_clientlog_mdp').val('');
} else if(OngletActif == 2){
jQuery_mdtr('#id_clientlog_email').require().match('nonHtml').match('email');
jQuery_mdtr('#id_clientlog_mdp').require().match('nonHtml');
}
jQuery_mdtr(".gestion_portail input[type=checkbox][titre=liste_portails]").assert(jQuery_mdtr(".gestion_portail input[type=checkbox][titre=liste_portails]:checked").length != 0, form_texte_doitEtreCoche);
});
var val_fiche_bien_id = jQuery_mdtr('select[name=fiche_bien_id], input[name=fiche_bien_id]')[0].value;
// Par défaut 1
EcrireDetails((val_fiche_bien_id == 0) ? 1 : val_fiche_bien_id);
if (jQuery_mdtr("#session_categorie").val() != 2) {
ToutEstCoche();
GestionPortails();
}
jQuery_mdtr('.popup_nv_ville .popup_bouton.valider').click(function(){
popup_valider();
});
jQuery_mdtr('.popup_nv_ville .popup_bouton.annuler').click(function(){
popup_close();
});
});
function initLocalisation(obj) {
var blur_to = 'id_fiche_mandatnum';
if ($('#session_categorie').val() == 2) {
//sur une fiche client donc blur se ferra sur le prix
blur_to = 'id_fiche_prix';
}
autoCompleteGeo(
jQuery_mdtr(obj)
, {
id_fiche_ville: ''
, id_fiche_villereal: 'ville_nom'
, id_fiche_cp: 'ville_cp'
, id_fiche_departement_id: 'ville_depcode'
, id_fiche_secteur_id: 'ville_secteur'
, localisation_format_base: '%id_fiche_villereal'
, localisation_format: '%id_fiche_villereal (%id_fiche_cp)'
, localisation_format_id: ['id_fiche_villereal', 'id_fiche_cp']
, no_result: Err_autocompleteGeo
, blur_to: blur_to
, id_pays: 'id_fiche_pays'
, id_site: (jQuery_mdtr("#from_site_id").length ? jQuery_mdtr("#from_site_id").val() : 0)
, liste_ids: ["id_fiche_cpville", "id_fiche_ville", "id_fiche_villereal", "id_fiche_cp", "id_fiche_departement_id", "id_fiche_secteur_id"]
}
);
}
// function initLocalisationClient(obj) {
// autoCompleteGeo(
// jQuery_mdtr(obj)
// , {
// id_client_ville: 'ville_nom'
// , id_client_cp: 'ville_cp'
// , localisation_format_base: '%id_client_ville'
// , localisation_format: '%id_client_ville (%id_client_cp)'
// , localisation_format_id: ['id_client_ville', 'id_client_cp']
// , no_result: Err_autocompleteGeo
// , blur_to: 'id_client_tel1'
// , id_pays: 'id_client_pays'
// , liste_ids: ["id_client_cpville", "id_client_ville", "id_client_cp"]
// }
// );
// }
function GetFicheVille() {
return jQuery_mdtr('#id_fiche_ville').val();
}
function SetFicheVille(ville) {
jQuery_mdtr('#id_fiche_ville').val(ville);
}
var arr_type_bien = new Array;
// Par defaut
var j = 0;
arr_type_bien[0] = new Array;
arr_type_bien[0][j] = new Array;
arr_type_bien[0][j ][0] = '';
arr_type_bien[0][j++][1] = '';
function update_nrj() {
jQuery_mdtr('#id_fiche_dpe_nrj_note').html(getNoteNRJ(jQuery_mdtr('#id_fiche_dpe_nrj').val()));
}
function update_ges() {
jQuery_mdtr('#id_fiche_dpe_ges_note').html(getNoteGES(jQuery_mdtr('#id_fiche_dpe_ges').val()));
}
var dpe_upd_nrj = "onKeyUp=\"update_nrj()\" onChange=\"update_nrj()\"";
var dpe_upd_nrj_note = "
";
var dpe_upd_ges = "onKeyUp=\"update_ges()\" onChange=\"update_ges()\"";
var dpe_upd_ges_note = "";
// Les apparts + Par défaut
for (var i = 1; i <= 5; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Villas - Mas / bastides - Maisons de village / ville - Châteaux
for (var i = 6; i <= 9; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Divers
for (var i = 10; i <= 10; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Terrains
for (var i = 11; i <= 11; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
}
// Commerces / entreprises
for (var i = 12; i <= 12; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' €';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' €';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Bureaux / locaux
for (var i = 13; i <= 13; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
// arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' €';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' €';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Immeubles
for (var i = 14; i <= 14; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Lofts - Chalets
for (var i = 15; i <= 16; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' m²';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
// Garages / parkings
for (var i = 17; i <= 17; ++i) {
var j = 0;
arr_type_bien[i] = new Array;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = '';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ' ';
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_nrj_note;
arr_type_bien[i][j] = new Array;
arr_type_bien[i][j ][0] = '';
arr_type_bien[i][j++][1] = ''+dpe_upd_ges_note;
}
var arr_save_bien = new Array;
/*
.details
.col_g
.col_d
*/
function EcrireDetails(categ) {
if (typeof(arr_type_bien[categ]) == 'undefined' || categ == 0) return;
SaveContenuDetails();
var tab = arr_type_bien[categ];
jQuery_mdtr('.details .col_g').html('');
jQuery_mdtr('.details .col_d').html('');
jQuery_mdtr(".details>.sep").height('10');
var col1 = '';
var col2 = '';
for (var i = 0; i < tab.length; ++i) {
if (i%2 == 1) {
col2 += '
';
col2 += '
'+tab[i][0]+'
';
col2 += '
'+tab[i][1]+'
';
col2 += '
';
} else {
col1 += '
';
col1 += '
'+tab[i][0]+'
';
col1 += '
'+tab[i][1]+'
';
col1 += '
';
}
}
jQuery_mdtr('.details .col_g').html(col1);
jQuery_mdtr('.details .col_d').html(col2);
LoadContenuDetails();
jQuery_mdtr(".details>.sep").height(jQuery_mdtr(".details").height());
// refreshDOM();
}
function SaveContenuDetails () {
jQuery_mdtr('.details input, .details select').each(function(){
arr_save_bien["'"+jQuery_mdtr(this).attr("name")+"'"] = jQuery_mdtr(this).val();
});
}
function LoadContenuDetails () {
jQuery_mdtr('.details input, .details select').each(function(){
if (typeof(arr_save_bien["'"+jQuery_mdtr(this).attr("name")+"'"]) != 'undefined') {
jQuery_mdtr(this).val(arr_save_bien["'"+jQuery_mdtr(this).attr("name")+"'"]);
if (jQuery_mdtr(this).onchange) jQuery_mdtr(this).onchange();
}
});
}
function AjouterInfosPortails(portail, ref_plugin, values) {
if (typeof(ValsPortails[portail]) == 'undefined') ValsPortails[portail] = new Array;
ValsPortails[portail][ref_plugin] = values;
WriteInputsPortails();
}
function InputsEnvoiePortails() {
for(var d = "", a = 0;a < ValsPortails.length;++a) {
if(jQuery_mdtr.isArray(ValsPortails[a])) {
for(var b = 0;b < ValsPortails[a].length;++b) {
if(jQuery_mdtr.isArray(ValsPortails[a][b])) {
for(var c = 0;c < ValsPortails[a][b].length;++c) {
if(typeof ValsPortails[a][b][c] != "undefined") {
d += '\n";
}
}
}
}
}
}
return d;
}
function WriteInputsPortails() {
if (jQuery_mdtr('#inputValsPortails').length == 0) {
jQuery_mdtr('#Part_NewAnn').append('');
}
jQuery_mdtr('#inputValsPortails').html(InputsEnvoiePortails());
}
/*
// [1,2,3].merge([undefined,4,5,6]) = [1,4,5,6]
Array.prototype.merge = function(a) {
if(typeof a == "undefined" || typeof a.constructor == "undefined" || this.constructor != a.constructor) {
return this
}
for(var c = this.slice(0, this.length), b = 0;b < a.length;++b) {
if(typeof a[b] != "undefined") {
c[b] = a[b]
}
}
return c
};
*/
function ActiverGestionPortails() {
if (!jQuery_mdtr('.gestion_portail').length) return;
// jQuery_mdtr('.gestion_portail')[0].setOpacity(1);
jQuery_mdtr('.gestion_portail').css('opacity', 1);
// jQuery_mdtr('.gestion_portail_dessus')[0].style.zIndex = -1;
jQuery_mdtr('.gestion_portail_dessus').css('zIndex', -1);
if (jQuery_mdtr("#disabled_infos").val()) return;
var nbChecked = jQuery_mdtr('.gestion_portail input:checked').length;
jQuery_mdtr('.gestion_portail input').each(function(i, obj){
obj.disabled = false;
var perso = obj.name.substr(1,1);
var portail = parseInt(obj.name.substr(3));
if (perso == 0 && needComplement(portail, document.mdp) > 0) obj.checked=false;
});
// tab_complements_done.clear();
tab_complements_done.length = 0;
ToutEstCoche();
if (jQuery_mdtr('.gestion_portail input:checked').length != nbChecked) alert('Des portails ont été décoche, vous devez les reconfigurer.');
}
function DesactiverGestionPortails() {
if (!jQuery_mdtr('.gestion_portail').length) return;
// jQuery_mdtr('.gestion_portail')[0].setOpacity(0.5);
jQuery_mdtr('.gestion_portail').css('opacity', 0.5);
// jQuery_mdtr('.gestion_portail_dessus')[0].style.zIndex = 1;
jQuery_mdtr('.gestion_portail_dessus').css('zIndex', 1);
jQuery_mdtr('.gestion_portail input').each(function(i){i.disabled=true});
}
function GestionPortails() {
// if (parseInt(document.mdp.fiche_bien_id.value) && parseInt(document.mdp.fiche_type_id.value)) ActiverGestionPortails();
if (parseInt(jQuery_mdtr('#id_fiche_bien_id').val()) && parseInt(jQuery_mdtr('#id_fiche_type_id').val())) ActiverGestionPortails();
// if (parseInt(document.mdp.fiche_id.value) && parseInt(document.mdp.fiche_bien_id.value) && parseInt(document.mdp.fiche_type_id.value)) ActiverGestionPortails();
else DesactiverGestionPortails();
}
function needComplement(portail, form) {
// form = jQuery_mdtr(form).serialize(true);
var fiche_type_id = form["fiche_type_id"].value;
var fiche_bien_id = form["fiche_bien_id"].value;
switch (portail) {
case 1 : // SELOGER
case 2 : // SNPI
case 3 : // IMMOSTREET
case 13 : // ANNONCES_JAUNES
case 14 : // PRO-A-PART
case 16 : // REFLEXIMMO
case 17 : // LES_CLES_DU_MIDI
case 18 : // SIX-FOURS.NET
case 19 : // IMMO-SUDANNONCES
case 20 : // A_VENDRE_A_LOUER
case 21 : // ARKADIA
case 22 : // LE_SITE_IMMO
switch(fiche_type_id) {
case "1":
if (fiche_bien_id == 12) return 1; // Commerce / Entreprise
return 2;
break;
case "2":
case "3":
if (fiche_bien_id == 12) return 11; // Commerce / Entreprise
return 12;
break;
}
break;
case 6 : // FNAIM
switch(fiche_type_id) {
case "1":
switch(fiche_bien_id) {
case "6": // Villa
case "8": // Maison de village / Ville
case "15": // Loft
case "18": // Chalet
return 1; //Maisons
break;
case "9": // Château
case "7": // Mas / Bastides
return 2; //Demeures
break;
case "14": //Immeubles
return 3;
break;
case "12": // Commerce / Entreprise
return 4; //Fond Commerce
break;
case "13": // Bureau / Local
return 5; //Local
break;
case "17": // Garage / Parking
return 6; //Parking
break;
case "1": // Appartement T1 / Studio
case "2": // Appartement T2
case "3": // Appartement T3
case "4": // Appartement T4
case "5": // Appartement T5 ou plus
return 7; //Appartements
break;
case "11": //Terrains
return 8;
break;
}
break;
case "2":
switch(fiche_bien_id) {
case "6": // Villa
case "8": // Maison de village / Ville
case "15": // Loft
case "18": // Chalet
return 11; //Maisons
break;
case "9": // Château
case "7": // Mas / Bastides
return 12; //Demeures
break;
case "14": //Immeubles
return 13;
break;
case "12": // Commerce / Entreprise
return 14; //Fond Commerce
break;
case "13": // Bureau / Local
return 15; //Local
break;
case "17": // Garage / Parking
return 16; //Parking
break;
case "1": // Appartement T1 / Studio
case "2": // Appartement T2
case "3": // Appartement T3
case "4": // Appartement T4
case "5": // Appartement T5 ou plus
return 17; //Appartements
break;
case "11": //Terrains
return 18;
break;
}
break;
case "3":
switch(fiche_bien_id) {
case "6": // Villa
case "8": // Maison de village / Ville
case "15": // Loft
case "18": // Chalet
return 21; //Maisons
break;
case "9": // Château
case "7": // Mas / Bastides
return 22; //Demeures
break;
case "14": //Immeubles
return 23;
break;
case "12": // Commerce / Entreprise
return 24; //Fond Commerce
break;
case "14": //Local Professionel
return 25;
break;
case "17": // Garage / Parking
return 26; //Parking
break;
case "1": // Appartement T1 / Studio
case "2": // Appartement T2
case "3": // Appartement T3
case "4": // Appartement T4
case "5": // Appartement T5 ou plus
return 27; //Appartements
break;
case "11": //Terrains
return 28;
break;
}
break;
}
case 10 : // PARU_VENDU
if (fiche_bien_id == "13") return 1; // Bureau / Local
if (fiche_bien_id == "7") return 2; // Mas / Bastides
break;
case 11 : // FFIP
return 1; break;
case 9 : // LOGICIMMO
case 12 : // SITIMMOPRO
case 15 : // ACHAT_TERRAIN
switch(fiche_type_id) {
case "1":
return 1; break;
case "2":
case "3":
return 2; break;
}
break;
}
return -1;
}
function classCSS() {
this.style_sheet = document.createElement('style');
this.cstr = "";
if (this.style_sheet) {
this.style_sheet.setAttribute('type', 'text/css');
}
this.addRule = function(class_name, css) {
this.cstr += '.' + class_name + ' {' + css + '}\n';
}
this.saveCSS = function() {
if (this.style_sheet) {
var rules = document.createTextNode(this.cstr);
if(this.style_sheet.styleSheet){// IE
this.style_sheet.styleSheet.cssText = rules.nodeValue;
} else {
this.style_sheet.appendChild(rules);
}
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(this.style_sheet);
}
}
}
}
var consoEnergie = new Array();
consoEnergie[0] = 0; // A (0 => 50)
consoEnergie[1] = 51; // B (51 => 90)
consoEnergie[2] = 91; // C (91 => 150)
consoEnergie[3] = 151; // D (151 => 230)
consoEnergie[4] = 231; // E (231 => 330)
consoEnergie[5] = 331; // F (331 => 450)
consoEnergie[6] = 451; // G ( > 450 )
var consoEnergieCouleur = new Array();
// couleur du fond de la note, couleur du texte
consoEnergieCouleur[0] = new Array("#339933", "#000000"); // A
consoEnergieCouleur[1] = new Array("#33CC33", "#000000"); // B
consoEnergieCouleur[2] = new Array("#CCFF33", "#000000"); // C
consoEnergieCouleur[3] = new Array("#FFFF00", "#000000"); // D
consoEnergieCouleur[4] = new Array("#FFCC00", "#000000"); // E
consoEnergieCouleur[5] = new Array("#FF9933", "#000000"); // F
consoEnergieCouleur[6] = new Array("#FF0000", "#FFFFFF"); // G
var EmissionGES = new Array();
EmissionGES[0] = 0; // A (0 => 5)
EmissionGES[1] = 6; // B (6 => 10)
EmissionGES[2] = 11; // C (11 => 20)
EmissionGES[3] = 21; // D (21 => 35)
EmissionGES[4] = 36; // E (36 => 55)
EmissionGES[5] = 56; // F (56 => 80)
EmissionGES[6] = 81; // G ( > 80)
var EmissionGESCouleur = new Array();
// couleur du fond de la note, couleur du texte
EmissionGESCouleur[0] = new Array("#F6EDFD", "#000000"); // A
EmissionGESCouleur[1] = new Array("#E1C2F8", "#000000"); // B
EmissionGESCouleur[2] = new Array("#D4A9F5", "#000000"); // C
EmissionGESCouleur[3] = new Array("#CB95F3", "#000000"); // D
EmissionGESCouleur[4] = new Array("#BA73EF", "#000000"); // E
EmissionGESCouleur[5] = new Array("#A74DEB", "#000000"); // F
EmissionGESCouleur[6] = new Array("#8A19DF", "#FFFFFF"); // G
function Chr(AsciiNum) {
return String.fromCharCode(AsciiNum)
}
function Ord(Ascii) {
return Ascii.charCodeAt(0);
}
function getIdNoteFromNote(note) {
return Ord(note) - 65;
}
function getNoteFromIdNote(id) {
return Chr(65 + id);
}
function getMinEnergieFromNote(note) {
return getMinEnergieFromId(getIdNoteFromNote(note));
}
function getMinEnergieFromId(id) {
return consoEnergie[id];
}
function getMaxEnergieFromNote(note) {
return getMaxEnergieFromId(getIdNoteFromNote(note));
}
function getMaxEnergieFromId(id_temp) {
if ( (id_temp + 1) < consoEnergie.length ) {
return (consoEnergie[id_temp + 1] - 1);
} else {
return 9999;
}
}
function getMinGESFromNote(note) {
return getMinGESFromId(getIdNoteFromNote(note));
}
function getMinGESFromId(id) {
return EmissionGES[id];
}
function getMaxGESFromNote(note) {
return getMaxGESFromId(getIdNoteFromNote(note));
}
function getMaxGESFromId(id_temp) {
if ( (id_temp + 1) < EmissionGES.length ) {
return (EmissionGES[id_temp + 1] - 1);
} else {
return 9999;
}
}
function getNoteNRJ(value) {
if (value.length == 0) return '';
if (value <= 0) return '';
for (var i = 0 ; i < consoEnergie.length ; i++) {
if (consoEnergie[i] <= parseInt(value)) {
if ((i + 1) == consoEnergie.length || value < consoEnergie[i + 1]) {
// trouvé
return Chr(65 + i);
}
}
}
return '';
}
function getNoteGES(value) {
if (value.length == 0) return '';
if (value <= 0) return '';
for (var i = 0 ; i < EmissionGES.length ; i++) {
if (EmissionGES[i] <= parseInt(value)) {
if ((i + 1) == EmissionGES.length || value < EmissionGES[i + 1]) {
// trouvé
return Chr(65 + i);
}
}
}
return '';
}
function dpe_draw(note, id, wich) {
var pointille = themePath + "pointille.gif";
var biseau_droit = themePath + "fleche.gif";
var biseau_gauche = themePath + "fleche2.gif";
if (wich == 'NRJ') {
var pas_de_fleche = false;
var getNote = getNoteNRJ;
var tabInfo = consoEnergie;
var tabCouleur = consoEnergieCouleur;
var libBest = "Logement économe";
var libWorst = "Logement énergivore";
var getMinFromId = getMinEnergieFromId;
var getMaxFromId = getMaxEnergieFromId;
var formule = "kWhEP/m².an";
} else if (wich == 'GES') {
var pas_de_fleche = true;
var getNote = getNoteGES;
var tabInfo = EmissionGES;
var tabCouleur = EmissionGESCouleur;
var libBest = "Faible émission de GES";
var libWorst = "Forte émission de GES";
var getMinFromId = getMinGESFromId;
var getMaxFromId = getMaxGESFromId;
var formule = "kgéqCO2/m².an";
}
note = parseInt(note);
var obj = document.getElementById(id);
if (!obj) return;
var obj_width = parseInt(obj.style.width);
var obj_height = parseInt(obj.style.height);
obj.style.position = 'relative';
var titre_size = 14;
var note_size = 16;
var echelle_size = 11;
var formule_size = 9;
if (obj_height < 150) {
note_size = 10;
echelle_size = 10;
formule_size = 6;
} else if (obj_height < 200) {
note_size = 11;
formule_size = 7;
} else if (obj_height <= 250) {
note_size = 14;
formule_size = 7;
} else if (obj_height <= 300) {
note_size = 14;
formule_size = 8;
}
if (obj_width < 200) {
var titre_size = 9;
} else if (obj_width < 250) {
var titre_size = 12;
}
var isIE = false;
if (navigator.userAgent.toLowerCase().indexOf('msie') > 0) {
isIE = true;
}
var height_temp = Math.round( (obj_height - 20 - 20 - (6*4) - (!isIE && pas_de_fleche ? (6*2) : 0) ) / 7);
var col1_width = (parseInt(obj_width * 75 / 100));
var idNote = getIdNoteFromNote(getNote(note));
//var note_height = Math.round(2 + idNote * height_temp + (2 * idNote) + (!isIE && pas_de_fleche ? (2 * idNote) : 0));
var note_height = Math.round(2 + idNote * height_temp + (2 * idNote) + (!isIE && pas_de_fleche ? (2 * idNote) : 0));
var graph_delta = Math.round((col1_width - 60 - (col1_width * 15 / 100)) / 7);
var myCss = new classCSS();
myCss.addRule(id+'_dpe_table', 'background-color: #000000; border-collapse:collapse; border-color:#000000; border-width: 1px; font-weight: bold; font-family:arial; font-size:'+ titre_size +'px;');
myCss.addRule(id+'_dpe_table_col1', 'width:'+ col1_width +'px; height: '+ obj_height +'px; background-color: #FFFFFF; ');
myCss.addRule(id+'_dpe_table_col2', 'background-color: #FFFFFF; ');
myCss.addRule(id+'_dpe_ligne_reglette', 'z-index: 0; margin-left: 4px; background: url('+ pointille +') repeat-x; height: 1px; overflow: hidden; position: relative; top: '+ (note_height + 20 + Math.round(height_temp / 2)) +'px');
myCss.addRule(id+'_dpe_zone_note', 'z-index: 1; position: absolute;');
myCss.addRule(id+'_dpe_lib_best', 'height: 20px; line-height: 20px; overflow:hidden; font-style: italic;padding-left: 4px; font-weight: bold; font-family:arial; font-size:'+ titre_size +'px;');
myCss.addRule(id+'_dpe_lib_worst', 'height: 20px; line-height: 20px; overflow:hidden; font-style: italic; padding-left: 4px;');
myCss.addRule(id+'_dpe_formule', 'font-weight: normal; font-size:'+ formule_size +'px');
myCss.addRule(id+'_dpe_reglette_fond', 'margin: '+ (note_height) +'px 2px 2px 2px; height: '+ height_temp +'; background-color:#000000; color:#FFFFFF;');
myCss.addRule(id+'_dpe_reglette_valeur', 'float:left;font-weight: bold; font-size: '+ note_size +'px; line-height:'+ height_temp +'px;');
myCss.addRule(id+'_dpe_reglette_titre', 'font-size:'+ (titre_size - 2) +'px; height: 20px;line-height: 18px; padding:0 2px 0 2px;');
var etiquette = '
'
+ '
'
+ '
'
+ '
'
+ '
'+ libBest +'
';
for (var i = 0 ; i < tabInfo.length ; i ++) {
if (i == 0) {
echelle = "≤ "+ getMaxFromId(i);
} else if ((i + 1) == tabInfo.length) {
echelle = "> "+ getMinFromId(i);
} else {
echelle = getMinFromId(i) +" à "+ getMaxFromId(i);
}
myCss.addRule(id+'_dpe_echelle_fond_'+ i, 'margin: 2px 0 2px 4px; width: '+ (60 + (i * graph_delta)) +'px; overflow: hidden; height: '+ height_temp +'px; '+ (pas_de_fleche ? 'border: 1px solid #777777;' : '') +' background-color:' + tabCouleur[i][0] +'; color:'+ tabCouleur[i][1]);
myCss.addRule(id+'_dpe_echelle_valeurs_'+ i, 'float:left; padding-left: 4px; line-height:'+ height_temp +'px; font-size: '+ echelle_size +'px');
myCss.addRule(id+'_dpe_echelle_note_'+ i, 'float:right;font-weight: bold; font-size: '+ note_size +'px; line-height:'+ height_temp +'px;');
etiquette += '
'+ echelle +'
'+ (!pas_de_fleche ? '' : ' ') +'
'+ getNoteFromIdNote(i) +'
'
}
etiquette += '
'+ libWorst +'
'
+ '
'
+ '
'
+ '
Logement
'
+ '
'+ note +'
'
+ '
'+ formule +'
'
+ '
'
+ '
';
myCss.saveCSS();
obj.innerHTML = etiquette;
}
function dpe_setNrjNote(note, id) {
dpe_draw(note, id, 'NRJ');
}
function dpe_setGESNote(note, id) {
dpe_draw(note, id, 'GES');
}
var tab_complements_done = new Array;
function click_on_check(elem, perso, portail_id, portail, prod_id, ref_plugin) {
if (ref_plugin <= 0) {
// if (jQuery_mdtr(elem).previous()) jQuery_mdtr(elem).previous().click();
if (jQuery_mdtr(elem).prev()) jQuery_mdtr(elem).prev().click();
return;
}
ref_plugin = String(ref_plugin);
var id = [perso, portail_id, portail, prod_id, ref_plugin].join(';');
// quand la fonction est lancer le check est déjà changer
// si on coche && non valide on ouvre le popup
if (elem.checked && tab_complements_done.indexOf(id) == -1) open_complement(perso, portail_id, portail, prod_id, ref_plugin);
}
function click_on_label(elem, perso, portail_id, portail, prod_id, ref_plugin) {
// quand la fct est appeler, le check n'est pas changer
// si c'était décocher, on ouvre le popup
if (ref_plugin <= 0) {
// if (jQuery_mdtr(elem).previous()) jQuery_mdtr(elem).previous().click();
if (jQuery_mdtr(elem).prev()) {
jQuery_mdtr(elem).prev().click();
}
return;
}
ref_plugin = String(ref_plugin);
// if (!jQuery_mdtr(elem).previous().checked) open_complement(perso, portail_id, portail, prod_id, ref_plugin);
if (!jQuery_mdtr(elem).prev().attr('checked')) {
open_complement(perso, portail_id, portail, prod_id, ref_plugin);
jQuery_mdtr(elem).prev().attr('checked', true);
} else {
jQuery_mdtr(elem).prev().attr('checked', false);
// cas fnaim
// if (Object.isElement(jQuery_mdtr(elem).next())) jQuery_mdtr(elem).next().checked = false;
if (jQuery_mdtr(elem).next().is("element")) {
jQuery_mdtr(elem).next().attr('checked', false);
}
}
}
var call_complement_in_pile = false;
function open_complement_in_pile(temps) {
if (call_complement_in_pile) return;
call_complement_in_pile = true; // pas besoin de l'appeler plein de fois.
if (typeof temps == 'undefined') temps = 100;
setTimeout('PilePopup_Pop('+ temps +')',temps);
}
function open_complement(perso, portail_id, portail, prod_id, ref_plugin) {
// Si j'ai déjà un popup d'ouvert
// if (!!jQuery_mdtr('div_griser')) {
// if (!jQuery_mdtr('#div_griser')) {
if (jQuery_mdtr('#backgroundPopup').is(":visible")) {
eval('PilePopup_Push(function(){open_complement("'+perso+'", "'+portail_id+'", "'+portail+'", "'+prod_id+'", "'+ref_plugin+'")})');
open_complement_in_pile();
} else {
// chargementBackground(); //on met le background tout de suite pour que les suivants se mettent en queue
Window('popup_complements', 'elem_portails_complements.php?window_name=popup_complements&prod_id=' +prod_id +'&perso=' + perso +'&portail=' + portail_id +'&portail_name=' + portail +'&ref_plugin=' + ref_plugin, 600, 560, true);
openModal('popup_complements');
}
}
function libererAnn(obj, limite, doit) {
if (!doit) {
setTimeout(function(){libererAnn(obj, limite, true)}, 10);
return;
}
if (limite && !obj.checked) {
alert(check_form_texte_plusDAnnonces);
} else if (!obj.checked) {
alert(check_form_texte_plusDAnnoncesContact);
}
obj.checked = false;
}
function IsToutEstCoche () {
var LesInputs = jQuery_mdtr('.gestion_portail input');
// On commence à 1 pour pas prendre le "tout selectionner"
for (var i = 1; i < LesInputs.length; ++i) {
if (!LesInputs[i].checked) return false;
}
return true;
}
function ToutEstCoche() {
var IsToutCocher = IsToutEstCoche();
var InputTout = jQuery_mdtr('.gestion_portail input')[0];
InputTout.parentNode.lastChild.nodeValue = ((IsToutCocher) ? ToutDeselectionnez : ToutSelectionnez);
var InputTout = jQuery_mdtr('.gestion_portail input')[0];
InputTout.checked = IsToutCocher;
}
function ToutCocher() {
var LesInputs = jQuery_mdtr('.gestion_portail input');
var InputTout = jQuery_mdtr('.gestion_portail input')[0];
var EstCocher = InputTout.checked;
for (var i = 1; i < LesInputs.length; ++i) {
if (EstCocher) LesInputs[i].click();
LesInputs[i].checked = EstCocher;
}
// InputTout.parentNode.lastChild.nodeValue = ((EstCocher) ? ToutDeselectionnez : ToutSelectionnez);
// InputTout.checked = IsToutEstCoche();
ToutEstCoche();
}
Array.prototype.in_array = function (valeur) {
for (var i in this) { if (this[i] == valeur) return i; }
return -1;
}
function textCounter(field, countfield, maxlimit) {
if (jQuery_mdtr(field).val().length > maxlimit) {
jQuery_mdtr(field).val(jQuery_mdtr(field).val().substring(0, maxlimit));
} else {
jQuery_mdtr(countfield).html(maxlimit - jQuery_mdtr(field).val().length);
if (parseInt(jQuery_mdtr(countfield).html()) > 1) {
jQuery_mdtr(countfield + 'Txt').html(form_texte_caracRestants);
} else {
jQuery_mdtr(countfield + 'Txt').html(form_texte_caracRestant);
}
}
}
function ChangeDesc() {
jQuery_mdtr("#id_pub_text_trad_type").val(1);
// var obj_trad_type = document.mdp.pub_text_trad_type;
// SI change ALORS noter que ça change
// obj_trad_type.selectedIndex = 1;
//document.getElementById('traduction_en_cours').style.visibility = 'hidden';
// Faire sauter la requête sur la langue
// tab_desc_langsToGet.shift(document.mdp.cur_lang.value);
tab_desc_langsToGet.shift(jQuery_mdtr("#id_lang").val());
// SI c'est pas le français et que c'est vide ALORS en traduction automatique
// if ( document.mdp.cur_lang.value != jQuery_mdtr("#fiche_lang_ref").val() && document.mdp.fiche_description.value.length == 0 ) {
// obj_trad_type.selectedIndex = 0;
// }
if ( jQuery_mdtr("#id_lang").val() != jQuery_mdtr("#fiche_lang_ref").val() && jQuery_mdtr("#id_fiche_description").val().length == 0 ) {
jQuery_mdtr("#id_pub_text_trad_type").val(0);
}
}
var tab_desc_langsToGet = new Array();
/*
function ChangeLang(lang) {
jQuery_mdtr('#id_desc_lang' + jQuery_mdtr('#id_cur_lang').val()).val(jQuery_mdtr('#id_fiche_description').val());
jQuery_mdtr('#id_fiche_description').val(jQuery_mdtr('#id_desc_lang' + lang).val());
jQuery_mdtr('#id_cur_lang').val(lang);
// eval("document.mdp.desc_lang" + document.mdp.cur_lang.value + ".value = document.mdp.fiche_description.value;");
// eval("document.mdp.fiche_description.value = document.mdp.desc_lang" + lang + ".value;");
// document.mdp.cur_lang.value = lang;
textCounter('#id_fiche_description', '#id_remLen', jQuery_mdtr("#maxlength_text").val());
}
*/
function ChangeLang(lang) {
if (jQuery_mdtr('#id_pub_text_trad_type').val() == 1) {
jQuery_mdtr("#id_desc_lang" + jQuery_mdtr("#id_cur_lang").val()).val(jQuery_mdtr("#id_fiche_description").val());
}
jQuery_mdtr('#id_desc_lang' + jQuery_mdtr('#id_cur_lang').val()).val(jQuery_mdtr('#id_fiche_description').val());
jQuery_mdtr('#id_fiche_description').val(jQuery_mdtr('#id_desc_lang' + lang).val());
jQuery_mdtr('#id_pub_text_trad_type').val(jQuery_mdtr('#id_pub_text_trad_type' + lang).val());
jQuery_mdtr('#id_cur_lang').val(lang);
textCounter('#id_fiche_description', '#id_remLen', jQuery_mdtr("#maxlength_text").val());
//var obj2 = document.getElementById('traduction_en_cours');
//affichage ou pas du type de traduction
if (lang != jQuery_mdtr('#fiche_lang_ref').val()) {
jQuery_mdtr('#mode_traduction').css('visibility', "visible");
/*
//affichage ou pas de l'indication de traduction automatique
if ( tab_desc_langsToGet.in_array(lang) >= 0 ) {
if (obj2) obj2.style.visibility = 'visible';
} else {
if (obj2) obj2.style.visibility = 'hidden';
}
*/
// ChangeModeTrad(jQuery_mdtr('#id_pub_text_trad_type'+ jQuery_mdtr('#id_cur_lang').val()).val());
jQuery_mdtr('#id_pub_text_trad_type').val(jQuery_mdtr('#id_pub_text_trad_type'+ jQuery_mdtr('#id_cur_lang').val()).val());
ChangeModeTrad(jQuery_mdtr('#id_pub_text_trad_type').val());
} else {
jQuery_mdtr('#mode_traduction').css('visibility', "hidden"); // pas de type de traduction
//if (obj2) obj2.style.visibility = "hidden"; // pas de traduction en cours
}
}
function ChangeModeTrad(trad_type_val) {
jQuery_mdtr('#id_pub_text_trad_type' + jQuery_mdtr('#id_cur_lang').val()).val(trad_type_val);
if (trad_type_val == 0 && jQuery_mdtr('#id_fiche_description').val() == '') {
jQuery_mdtr('#id_fiche_description').val(form_texte_tradAuto);
} else {
jQuery_mdtr('#id_fiche_description').val(jQuery_mdtr('#id_desc_lang' + jQuery_mdtr('#id_cur_lang').val()).val());
}
/* PB : QUAND SI ON CHANGE LA LANG ON PERD LA TRAD */
if (trad_type_val == 0) {
//document.mdp.fiche_description.value = eval("document.mdp.desc_lang" + document.mdp.cur_lang.value + ".value");
//ChangeLang($jQuery_mdtr('select[name=lang]')[0].options[$jQuery_mdtr('select[name=lang]')[0].selectedIndex].value);
} else {
//document.mdp.fiche_description.value = '';
}
}
function popup_ville() {
lancementPopup('popup_nv_ville');
document.form_nv_ville.input_nv_ville.value = parent.GetFicheVille();
// Window('nvannonce_ch_ville', 'nvannonce_ch_ville.php', 400, 300, false);
// openModal('nvannonce_ch_ville');
}
function popup_valider () {
parent.SetFicheVille(PreparerChaine(document.form_nv_ville.input_nv_ville.value));
popup_close();
}
function popup_close () {
parent.hideModal('nvannonce_ch_ville');
// parent.document.mdp.pub_text_trad_type.style.visibility = '';
eventFermeturePopup();
}
function PreparerChaine (chaine) {
chaine = new String(chaine).trim();
// Au moins une lettre dans le nouveau nom
var regex = new RegExp("[a-zA-Z]");
return regex.test(chaine) ? chaine : '';
}