function hideObjectForDialog(b){if(b===true){$("object").hide()}else{var a=false;$(".ui-dialog-content").each(function(){if($(this).dialog("isOpen")){a=true}});if(!a){$("object").show()}}}var closeDialog=function(){$("#dialog-message").dialog("close")};var openDialog=function(f,e,a,d,h,g){var b=$("#dialog-message");if(b.size()>0){}else{$("body").append('<div id="dialog-message"></div>')}var c="";if(d!=""&&d!="undefined"){c+='<img src="'+DIR_HTTP+"images/"+d+'" class="dialogimg" width="20px" height="20px"/>'}if(e!=""&&e!="undefined"&&e!=undefined){c+=e+'<div style="clear:both;"></div>'}if(c!=""){$("#dialog-message").html(c)}$("#dialog-message").dialog({modal:true,resizable:false,close:function(){hideObjectForDialog(false)},open:function(){hideObjectForDialog(true)}});$("#dialog-message").dialog("option","title",f);$("#dialog-message").dialog("option","width",350);$("#dialog-message").dialog("option","height",140);$("#dialog-message").dialog("option","position","center");$(".ui-dialog img[src$='images/enveloppe_alertemailV2.png']").remove();$(".ui-dialog .ui-dialog-title").css({"margin-left":"0px"});switch(a){case"alert":case"error":case"info":$("#dialog-message").dialog("option","buttons",{Ok:function(){$(this).dialog("close")}});break;case"popin_smartphone":$("#dialog-message").dialog("option","width",300);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Non:function(){$(this).dialog("close");smartphone_choice(0)},Oui:function(){$(this).dialog("close");smartphone_choice(1)}});break;case"ddevis":$("#dialog-message").dialog("option","width",720);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Continuer:function(){if(continueFormDdevis()==true){$(this).dialog("close")}}});$('#ddoc_form #code_cat option:[value^="-"]').css({backgroundColor:"#EEEEEE"});$('#ddoc_form #code_cat option:not([value^="-"])').css({backgroundColor:"#FFFFFF"});$('#ddoc_form #code_cat option:[value="ind"]').css({backgroundColor:"#EEEEEE"});$("#ddoc_form #code_cat").change(function(){val=$("#ddoc_form #code_cat option:selected").val();if(val=="ind"){openCustomDialog("avertissement","Avertissement","Vous devez choisir une prestation!","alert","",function(){})}if(val[0]=="-"){openCustomDialog("avertissement","Avertissement","Vous devez préciser la sous catégorie de cette prestation!","alert","",function(){})}});break;case"ddevis_m_coord":$("#dialog-message").dialog("option","width",720);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{"Revenir sur BureauxLocaux.com":function(){$(this).dialog("close")},"Effectuer une nouvelle demande":function(){if(verifFormDdevis_m_coord()==true){$(this).dialog("close")}}});$('#ddevis_form #code_cat option:[value^="-"]').css({backgroundColor:"#EEEEEE"});$('#ddevis_form #code_cat option:not([value^="-"])').css({backgroundColor:"#FFFFFF"});$('#ddevis_form #code_cat option:[value="ind"]').css({backgroundColor:"#EEEEEE"});$("#ddevis_form #code_cat").change(function(){val=$("#ddevis_form #code_cat option:selected").val();if(val=="ind"){openCustomDialog("avertissement","Avertissement","Vous devez choisir une prestation!","alert","",function(){})}if(val[0]=="-"){openCustomDialog("avertissement","Avertissement","Vous devez préciser la sous catégorie de cette prestation!","alert","",function(){})}});break;case"ddoc_ann":_init_ddoc_ann();$("#dialog-message").dialog("option","width",640);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},Envoyer:function(){if(verifFormDdoc_ann()==true){$(this).dialog("close")}}});break;case"ddoc_territoire":_init_ddoc_territoire();$("#dialog-message").dialog("option","width",670);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},Envoyer:function(){if(verifFormDdoc_territoire()==true){$(this).dialog("close")}}});break;case"popin_alertemail":_init_alert_mail();$("#dialog-message").dialog("option","width",550);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog({buttons:[{text:"Annuler",click:function(){removeCSS_Alert();$(this).dialog("close")}},{text:"Enregistrer",id:"enregistrer_alert",click:function(){if(verifFormAlert_mail()==true){$(this).dialog("close");removeCSS_Alert()}}}]});$("#enregistrer_alert").button("option","icons",{primary:"ui-icon-check",secondary:null});$("#enregistrer_alert").focus();$(".ui-dialog").append('<img style="position:absolute;top:3px;left:0;" src="'+DIR_HTTP+'images/enveloppe_alertemailV2.png"/>');$(".ui-dialog .ui-dialog-title").css({"margin-left":"60px"});break;case"popin_transmettremail":_init_transmettre_mail();$("#dialog-message").dialog("option","width",550);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},Envoyer:function(){if(verifFormTransmettre_mail()==true){$(this).dialog("close")}}});break;case"alertproduit":$("#dialog-message").dialog("option","width",790);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},"Valider l'alerte produit":function(){if(verifFormAlertp()==true){$(this).dialog("close")}}});break;case"publiinfo":$("#dialog-message").dialog("option","width",790);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},"Demander la documentation":function(){val=$("form#popin_publi #id_prod").val();if(g==""||g==null||g=="null"){ddoc_produit(null,val)}else{ddoc_produit([g],val)}}});break;case"transmettre":$("#dialog-message").dialog("option","width",625);$("#dialog-message").dialog("option","height","auto");$("#dialog-message").dialog("option","position","center");$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},Transmettre:function(){verifFormTransmettre();$(this).dialog("close")}});break;case"confirm":$("#dialog-message").dialog("option","buttons",{Annuler:function(){$(this).dialog("close")},Ok:function(){$(this).dialog("close");h()}});break;case"wait":$("#dialog-message").dialog("option","buttons",{});break;default:break}};$.extend($.ui.dialog.prototype,{addbutton:function(a,c){var b=this.element.dialog("option","buttons");b[a]=c;this.element.dialog("option","buttons",b)}});$.extend($.ui.dialog.prototype,{removebutton:function(a){var b=this.element.dialog("option","buttons");delete b[a];this.element.dialog("option","buttons",b)}});var openCustomDialog=function(h,f,e,a,d,g){var b=$("#"+h);if(b.size()>0){$(".ui-dialog img[src$='images/enveloppe_alertemailV2.png']").remove();$(".ui-dialog .ui-dialog-title").css({"margin-left":"0px"})}else{$("body").append('<div id="'+h+'"></div>')}$("#"+h).attr("title",f);var c="";switch(a){case"error":case"alert":case"confirm":icon='<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>';break;case"info":icon='<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>';break;case"wait":icon="";if(d!=""&&d!="undefined"){icon+='<img src="'+DIR_HTTP+"images/"+d+'" class="dialogimg" width="20px" height="20px" />'}break;case"custom_image":icon="";if(d!=""&&d!="undefined"){icon+='<img src="'+DIR_HTTP+"images/"+d+'" class="dialogimg" /><br /><br />'}break;case"success":icon='<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>';break;default:icon="";break}if(e!=""&&e!="undefined"&&e!=undefined){c+="<p>"+icon+e+"</p>"}if(c!=""){$("#"+h).html(c)}$("#"+h).dialog({modal:true,resizable:false,close:function(){hideObjectForDialog(false)},open:function(){hideObjectForDialog(true)}});$("#"+h).dialog("option","width",350);$("#"+h).dialog("option","minHeight",150);$("#"+h).dialog("option","position","center");switch(a){case"no_image":case"custom_image":case"alert":case"error":case"info":$("#"+h).dialog("option","buttons",{Ok:function(){$(this).dialog("close")}});break;case"confirm":$("#"+h).dialog("option","buttons",{Ok:function(){$(this).dialog("close");g()},Annuler:function(){$(this).dialog("close")}});break;case"wait":$("#"+h).dialog("option","buttons",{});break;default:break}};var createFormField=function(l,a,f){if(f==null){f=""}var h="";if(_isset(a)){if(_isset_property(a,"type")){switch(a.type){case"HIDDEN":h='<input type="hidden" id="'+l+'" name="'+l+'" value="'+f+'" />';break;case"DATE":h='<input type="text" id="'+l+'" class="datepicker" value="'+f+'" size="'+a.size+'"/>';break;case"TIME":break;case"INT":var o="";if(_isset_property(a,"onKeyPress")){o=' onKeyPress="javascript:'+a.onKeyPress+'"'}var b="";if(_isset_property(a,"onchange")){b=' onChange="javascript:'+a.onchange+'"'}var p="";if(_isset_property(a,"size")){p='size="'+a.size+'"'}h='<input type="text" name="'+l+'" id="'+l+'" class="text" value="'+f+'" '+p+" "+o+" "+b+" />";break;case"TEXTAREA":if(!_isset_property(a,"rows")){a.rows=2}var o="";if(_isset_property(a,"onKeyPress")){o=' onKeyPress="javascript:'+a.onKeyPress+'"'}var b="";if(_isset_property(a,"onchange")){b=' onChange="javascript:'+a.onchange+'"'}h='<textarea name="'+l+'" id="'+l+'" rows="'+a.rows+'" cols="'+a.size+'" class="text" '+o+" "+b+">"+f+"</textarea>";break;case"CHECKBOX":var n="";if(_isset_property(a,"checked")){n=a.checked}var d="";if(_isset_property(a,"disabled")){d=a.disabled}h='<input type="checkbox" id="'+l+'" name="'+l+'" class="text" value="'+f+'" '+n+" "+d+"/>";break;case"RADIO":var n="";if(_isset_property(a,"checked")){n=a.checked}label=l;if(_isset_property(a,"groupname")){groupname=a.groupname;if(_isset_property(a,"label")){label=a.label}h='<INPUT type="radio" id="'+l+'" name="'+groupname+'" value="'+f+'" '+n+'><label style="padding-right:5px;" for="'+l+'">'+label+"</label>"}else{return""}break;case"SELECT":if(f==""){f="--"}var k="";var c="";if(_isset_property(a,"format")){a.options=new Object();var m=a.format.split(",");g=m.length;for(i=0;i<g;i++){y=m[i];associatif=y.split("=>");if(associatif.length==2){a.options[associatif[0]]=associatif[1]}else{a.options[y]=y}}}if(_isset_property(a,"options")){var j=0;var e=1;var g=a.options.size;current=0;for(x in a.options){if(current>g){break}if(x.substring(0,1)=="-"){current_val=""}else{current_val=x}if(current_val==f){e=0;c="SELECTED"}else{if(f==""||f=="ind"){f=0}if((j==f||f==null)&&f!=0&&e==1){e=0;c="SELECTED"}else{c=""}}option='<option value="'+current_val+'" '+c+" >"+a.options[x]+"</option>\n";k+=option;j++;current++}}else{if(_isset_property(a,"str_options")){var k=a.str_options}}var b="";if(_isset_property(a,"onchange")){b=' onChange="javascript:'+a.onchange+'"'}h='<select name="'+l+'" id="'+l+'" class="text" '+b+" >"+k+"</select>";break;case"CHAR":default:var o="";if(_isset_property(a,"onKeyPress")){o=' onKeyPress="javascript:'+a.onKeyPress+'"'}var b="";if(_isset_property(a,"onchange")){b=' onChange="javascript:'+a.onchange+'"'}var p="";if(_isset_property(a,"size")){p='size="'+a.size+'"'}h='<input type="text" name="'+l+'" id="'+l+'" class="text" value="'+f+'" '+p+" "+o+" "+b+" />";break}}}return h+"\n"};var addCalendar=function(){$("input.datepicker").datepicker({showOn:"button",buttonImage:"../images/calendar.png",buttonImageOnly:true,buttonText:"Calendrier",showAnim:"slideDown",changeMonth:true,changeYear:true,showButtonPanel:true,showOtherMonths:true,selectOtherMonths:true});$("input.datepicker").attr("readonly","readonly");$("input.datepicker").attr("class","text_readonly")};function _isset(a){return(a!="undefined")}function _isset_property(b,a){if(!b){return false}if(!b[a]){return false}return true}function ecrire_cookie(c,a,b){var e=new Date();e.setTime(e.getTime()+(86400*360*1000));a=strtr(a,{"!":"[#EXC#]","$":"[#DOL#]","%":"[#PCT#]","&":"[#ESPERLUETE#]","*":"[#ETOILE#]","+":"[#PLUS#]","\\":"[#ANTISLASH#]",";":"[#PTVIRGULE#]",":":"[#2PTS#]",'"':"[#GUILLEMET#]",",":"[#VIRGULE#]","/":"[#SLASH#]","?":"[#PTINTERRO#]"});document.cookie=c+"="+encodeURIComponent(a)+((b==null)?("; expires="+e.toGMTString()):("; expires="+b.toGMTString()))}function _init_transmettre_mail(){$("form#transmettre_form").submit(function(c){closeDialog();openCustomDialog("waiting","Envoi en cours","Merci de patienter...","wait","wait.gif");var a=$(this).serialize();var b=DIR_HTTP_SCRIPTS+"interface.php?mode=SEND_MAIL_SEL_OR_ANN";var d="Votre annonce/sélection a bien été envoyée.";$.ajax({type:"POST",dataType:"json",url:b,data:a,success:function(e){$("#waiting").dialog("close");closeDialog();openCustomDialog("success","Annonce/sélection envoyée",d,"info","info.png")},error:function(f,e,g){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de l'envoi\r\n Veuillez nous contacter pour prévenir de ce désagrément.\r\n Merci.","error","error.png")}});return false})}function _init_alert_mail(){$("form#alert_form").submit(function(c){closeDialog();openCustomDialog("waiting","Demande en cours","Merci de patienter...","wait","wait.gif");var a=$(this).serialize();var b=DIR_HTTP_SCRIPTS+"save_alerte.php?";var d="Votre alerte email a bien été enregistrée.";$.ajax({type:"POST",dataType:"json",url:b,data:a,success:function(e){ecrire_cookie("blo_alert[mailalerte]",$("form#alert_form #mailalerte").val());$("#waiting").dialog("close");closeDialog();openCustomDialog("success","Alerte email enregistrée",d,"info","info.png")},error:function(f,e,g){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de la demande\r\n Veuillez nous contacter pour prévenir de ce désagrément.\r\n Merci.","error","error.png")}});removeCSS_Alert();return false})}function _init_ddoc_ann(){$("form#ddoc_form").submit(function(e){closeDialog();openCustomDialog("waiting","Demande en cours","Merci de patienter...","wait","wait.gif");var datas=$(this).serialize();donnees_form=datas.split("&");var urlsend=DIR_HTTP_SCRIPTS+"send_mail_popin_doc.php?";var msg_valid="Votre demande de documentation a bien été envoyée.";$.ajax({type:"POST",dataType:"json",url:urlsend,data:datas,success:function(myJSONobject){if(typeof(goog_report_conversion)!="undefined"&&eval("typeof "+goog_report_conversion)=="function"){goog_report_conversion()}for(key in myJSONobject){ecrire_cookie("blo_ddoc["+key+"]",myJSONobject[key])}$("#waiting").dialog("close");closeDialog();openCustomDialog("success","Demande effectuée",msg_valid,"info","info.png")},error:function(a,b,c){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de la demande\r\n"+c,"error","error.png")}});return false})}function _init_ddoc_territoire(){$("form#ddoc_form").submit(function(e){closeDialog();openCustomDialog("waiting","Demande en cours","Merci de patienter...","wait","wait.gif");var datas=$(this).serialize();donnees_form=datas.split("&");var urlsend=DIR_HTTP_SCRIPTS+"send_mail_popin_doc_territoire.php?";var msg_valid="Votre demande de documentation a bien été envoyée.";$.ajax({type:"POST",dataType:"json",url:urlsend,data:datas,success:function(myJSONobject){if(typeof(goog_report_conversion)!="undefined"&&eval("typeof "+goog_report_conversion)=="function"){goog_report_conversion()}for(key in myJSONobject){ecrire_cookie("blo_ddoc_territoire["+key+"]",myJSONobject[key])}$("#waiting").dialog("close");closeDialog();openCustomDialog("success","Demande effectuée",msg_valid,"info","info.png")},error:function(a,b,c){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de la demande\r\n"+c,"error","error.png")}});return false})}function _init_ddevis(){$("form#ddevis_form").submit(function(e){openCustomDialog("waiting","Demande en cours","Merci de patienter...","wait","wait.gif");var datas=$(this).serialize();donnees_form=datas.split("&");var urlsend=DIR_HTTP_SCRIPTS+"send_mail_doc_popin_presta.php?";var msg_valid="Votre demande de documentation a bien été envoyée.";$.ajax({type:"POST",dataType:"json",url:urlsend,data:datas,success:function(myJSONobject){if(typeof(goog_report_conversion)!="undefined"&&eval("typeof "+goog_report_conversion)=="function"){goog_report_conversion()}for(key in myJSONobject){ecrire_cookie("blo_ddevis["+key+"]",myJSONobject[key])}$("#waiting").dialog("close");_success_and_another_ddevis(donnees_form)},error:function(a,b,c){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de la demande\r\n"+c,"error","error.png")}});return false})}function _submit_ddevis(c){var a=get_requesturi_form("form#ddevis_form");var e=get_fields_form("form#ddevis_form");openCustomDialog("waiting","Demande en cours","Merci de patienter...","wait","wait.gif");var b=DIR_HTTP_SCRIPTS+"send_mail_doc_popin_presta.php?";var d="Votre demande de documentation a bien été envoyée.";$.ajax({type:"POST",dataType:"json",url:b,data:a,success:function(f){for(key in f){ecrire_cookie("blo_ddevis["+key+"]",f[key])}$("#waiting").dialog("close");if(c==1){$("#waiting").dialog("close");closeDialog();openCustomDialog("success","Demande effectuée",d,"info","info.png")}else{_success_and_another_ddevis(e)}},error:function(g,f,h){$("#waiting").dialog("close");closeDialog();openDialog("Erreur","Erreur lors de la demande\r\n"+h,"error","error.png")}});return false}function codeTouche(b){var a=b.length;for(prop=1;prop<a;prop++){if(b[prop]=="which"){return(b.which)}}return(b.keyCode)}function scanTouche(e){var d=new RegExp('[";:]',"g");var c=codeTouche(e);switch(c){case 0:case 8:return true;break}var a=String.fromCharCode(c);var b=d.test(a)||pressePapierNS6(e,a);return !b}function scanToucheINT(e){var d=new RegExp("[0-9]","g");var c=codeTouche(e);switch(c){case 0:case 8:case 46:case 32:return true;break}var a=String.fromCharCode(c);var b=d.test(a)||pressePapierNS6(e,a);return b}function pressePapierNS6(d,c){var b=/[cvxz]/i;var a=d.length;for(prop=1;prop<a;prop++){if(d[prop]=="ctrlKey"){isModifiers=true}}if(isModifiers){return d.ctrlKey&&b.test(c)}else{return false}}function scanChamp(a){var b=new RegExp('[":;]',"g");if(b.test(a.value)){origine=a.value;var c=origine.replace(b,"");a.value=c}}function scanChampINT(a){var b=new RegExp("[^0-9 .]","g");if(b.test(a.value)){origine=a.value;var c=origine.replace(b,"");a.value=c}}function strtr(n,q,r){var l="",f=0,e=0,d=0,b=0,c=false,s="",k="",a="";var p=[];var o=[];var m="";var h=false;if(typeof q==="object"){c=this.ini_set("phpjs.strictForIn",false);q=this.krsort(q);this.ini_set("phpjs.strictForIn",c);var g=q.length;for(l=1;l<g;l++){if(q.hasOwnProperty(l)){p.push(l);o.push(q[l])}}q=p;r=o}d=n.length;b=q.length;s=typeof q==="string";k=typeof r==="string";for(f=0;f<d;f++){h=false;if(s){a=n.charAt(f);for(e=0;e<b;e++){if(a==q.charAt(e)){h=true;break}}}else{for(e=0;e<b;e++){if(n.substr(f,q[e].length)==q[e]){h=true;f=(f+q[e].length)-1;break}}}if(h){m+=k?r.charAt(e):r[e]}else{m+=n.charAt(f)}}return m}function krsort(b,m){var c={},j=[],l,e,d,g=this,h=false,a={};switch(m){case"SORT_STRING":l=function(n,k){return g.strnatcmp(k,n)};break;case"SORT_LOCALE_STRING":var f=this.i18n_loc_get_default();l=this.php_js.i18nLocales[f].sorting;break;case"SORT_NUMERIC":l=function(n,k){return(k-n)};break;case"SORT_REGULAR":default:l=function(k,n){var r=parseFloat(n),o=parseFloat(k),q=r+""===n,p=o+""===k;if(q&&p){return r>o?1:r<o?-1:0}else{if(q&&!p){return 1}else{if(!q&&p){return -1}}}return n>k?1:n<k?-1:0};break}nb=b.length;for(e=0;e<nb;e++){if(b.hasOwnProperty(d)){j.push(d[e])}}j.sort(l);this.php_js=this.php_js||{};this.php_js.ini=this.php_js.ini||{};h=this.php_js.ini["phpjs.strictForIn"]&&this.php_js.ini["phpjs.strictForIn"].local_value&&this.php_js.ini["phpjs.strictForIn"].local_value!=="off";a=h?b:a;for(e=0;e<j.length;e++){d=j[e];c[d]=b[d];if(h){delete b[d]}}nb=c.length;for(e=0;e<nb;e++){if(c.hasOwnProperty(e)){a[c[e]]=c[e]}}return h||a}function ini_set(c,b){var e="",d=this;this.php_js=this.php_js||{};this.php_js.ini=this.php_js.ini||{};this.php_js.ini[c]=this.php_js.ini[c]||{};e=this.php_js.ini[c].local_value;var a=function(f){if(typeof f==="undefined"){d.php_js.ini[c].local_value=[]}d.php_js.ini[c].local_value.push(b)};switch(c){case"extension":if(typeof this.dl==="function"){this.dl(b)}a(e,b);break;default:this.php_js.ini[c].local_value=b;break}return e};
