//GENERATED AND POWERED BY XADIA //AT 27/04/2024 14:11:36 //// $(function () { var urlService = $('#hfAutocompleteSearchCommune').val(); InitAutoCompleteField($('[id$="tbCommune"]'), urlService); $("*[data-type='note']").rating({ maxrating: 10, maskcolorclass: 'xr-black' }); $('[id$="wucGallery1"]').gallery({ itemtag: 'li', titretag: 'h3', timer: 10000, bottom_text: 'info', link_button: 'linksite' }); $('[id$="wucHorizontaleUne1"]').hgallery({ labeldatatag: 'label', timer: 5500 }); $('.localise').unbind('click', loadMap).bind('click', loadMap); $('[id$="wucActuBox1"]').actu({ timer: 5000 }); $('[id$="wucAnnonceurs1"]').annonceur({ timer: 8000 }); $('#btnRecherche').unbind('click', submitSearch).bind('click', submitSearch); $('#btnRechercheArtisanName').unbind('click', searchName).bind('click', searchName); $('#contacter').unbind('click', loadContact).bind('click', loadContact); $('#devis').unbind('click', loadDevis).bind('click', loadDevis); if ($("#banniereAvis").length>0){ loadGalleryAvis(); }; if ($("#banniereActuArtiguide").length > 0) { loadGalleryActuArtiguide(); }; $('.recherche').keyup(function (e) { if (e.keyCode == 13) { submitSearch(e); } }); }); var evRotateAvis; var iVisibleAvis = 0; function loadGalleryAvis() { $("#banniereAvis li").hide(); rotateAvis(0, true); $("#banniereAvis").bind("mouseover", function (e) { clearTimeout(evRotateAvis); }).bind("mouseleave", function () { rotateAvis(iVisibleAvis, false); }); } function rotateAvis(nb, bfadeIn) { $("#banniereAvis li").hide(); if (nb > $("#banniereAvis li").length - 1) { //rotateAvis(0, true); } else { $("#banniereAvis li").each(function (i) { if (i == nb) { if (bfadeIn) { $(this).fadeIn("slow"); } else { $(this).show(); } evRotateAvis = window.setTimeout(function () { iVisibleAvis = i + 1; rotateAvis(i + 1, true); }, 10000); } }); } } var evRotateActuArtiguide; var iVisibleActuArtiguide = 0; function loadGalleryActuArtiguide() { $("#banniereActuArtiguide li").hide(); rotateActuArtiguide(0, true); $("#banniereActuArtiguide").bind("mouseover", function (e) { clearTimeout(evRotateActuArtiguide); }).bind("mouseleave", function () { rotateActuArtiguide(iVisibleActuArtiguide, false); }); } function rotateActuArtiguide(nb, bfadeIn) { $("#banniereActuArtiguide li").hide(); if (nb > $("#banniereActuArtiguide li").length - 1) { //rotateActuArtiguide(0, true); } else { $("#banniereActuArtiguide li").each(function (i) { if (i == nb) { if (bfadeIn) { $(this).fadeIn("slow"); } else { $(this).show(); } evRotateActuArtiguide = window.setTimeout(function () { iVisibleActuArtiguide = i + 1; rotateActuArtiguide(i + 1, true); }, 10000); } }); } } function InitAutoCompleteField(control, urlService) { var a = control.autocomplete({ source: function (request, response) { $.ajax({ url: urlService, async: true, data: "{ 'inputdata': '" + escape(request.term) + "' }", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data, status) { response($.map(data.d, function (item) { return { label: item.Commune, value: item.Commune, id: item.CommuneID, uri: item.CommuneUri } })); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }, minLength: 0, close: function (event, ui) { }, select: function (event, ui) { $('[id$="tbCommune"]').attr('data-communeid', ui.item.id); $('[id$="tbCommune"]').attr('data-communeuri', ui.item.uri); } }).focusout(function () { if (control.val() == '') { $('[id$="tbCommune"]').attr('data-communeid', ''); $('[id$="tbCommune"]').attr('data-communeuri', ''); } }).focus(function () { $(this).autocomplete('search'); }); }; function submitSearch(e) { var CommuneID = $('[id$="tbCommune"]').attr('data-communeid'); var CommuneURI = $('[id$="tbCommune"]').attr('data-communeuri'); var CommuneName = $('[id$="tbCommune"]').attr('data-communeid'); var MetierID = $('[id$="ddlMetiers"]').find(':selected').attr('data-id'); var MetierURI = $('[id$="ddlMetiers"]').find(':selected').val(); var MetierName = $('[id$="ddlMetiers"]').find(':selected').text(); var RayonActionID = $('[id$="ddlRayonAction"]').find(':selected').attr('data-id'); var RayonActionURI = $('[id$="ddlRayonAction"]').find(':selected').val(); var sRecommande = ""; if ($('.CBRecommande input').is(':checked')) { sRecommande = "/recommande"; } var sRayonAction = ""; if (RayonActionID != -1) { sRayonAction = "/" + RayonActionURI; } if ((MetierURI != undefined) && (MetierID != -1) && (CommuneURI != undefined)) { location.href = location.protocol + "//" + location.host + "/" + MetierURI + "/" + CommuneURI + sRecommande + sRayonAction; return false; }; if (CommuneURI != undefined) { location.href = location.protocol + "//" + location.host + "/" + CommuneURI + sRecommande + sRayonAction; return false; }; if ((MetierURI != undefined) && (MetierID != -1)) { location.href = location.protocol + "//" + location.host + "/" + MetierURI + "/vendee" + sRecommande + sRayonAction; return false; }; return false; } function searchName() { var Name = $('#TB_Nom').val(); if (Name != "") { location.href = location.protocol + "//" + location.host + "/nom/" + Name; return false; } return false; } function loadMap() { $("#dialogMap").remove(); $('body').append(''); var Lat = parseFloat($(this).data("lat").replace(",", ".")); var Lng = parseFloat($(this).data("lng").replace(",", ".")); var Contenu_Vignette = $(this).find("input").val(); var map = new google.maps.Map( document.getElementById('map_canvas'), { center: new google.maps.LatLng(Lat, Lng), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow({ content: Contenu_Vignette }); var marker = new google.maps.Marker({ position: new google.maps.LatLng(Lat, Lng), map: map }); $("#dialogMap").dialog({ autoOpen: true, Height: 600, width: "auto", modal: true, title: "Localisation de l'entreprise", draggable: false, buttons: { "Fermer": function () { $(this).dialog('close'); } }, close: function (event, ui) { $(this).dialog("destroy"); $("#dialogMap").remove(); }, resizeStop: function (event, ui) { lastCenter = map.getCenter(); google.maps.event.trigger(map_canvas, 'resize'); map.setCenter(lastCenter); infowindow.open(map, marker); }, open: function (event, ui) { lastCenter = map.getCenter(); google.maps.event.trigger(map_canvas, 'resize'); map.setCenter(lastCenter); infowindow.open(map, marker); } }); return false; } function loadContact() { var dlg = $('
'); $iframe = $('

Chargement du formulaire...

'); dlg.html($iframe); dlg.dialog({ autoOpen: true, width: "auto", modal: true, title: "Formulaire de contact", draggable: false }); $iframe.load(function () { $("#msgload").remove(); $(this).contents().find('.Close').bind('click', function () { $("#dialogContact").dialog("close"); }); }); return false; }