let map, infoWindow; var urlIndex = "./es_search/prodesbcb"; var urlIndexPharmacie = "./es_search/pharmacies"; var tableScores = [22,19,16,13,10,7,5]; var livretVal = new Array(); var lstPharmacies = null; var proddoc = new Array(); try{proddoc=JSON.parse(sessionStorage.getItem("proddoc"));}catch(err){} window.onload=function(){ init(); }; function init() { if (window.location.pathname.indexOf("infos-panier")>-1) { document.getElementById("chargement").style.display = "block"; document.getElementById("phraseLibelle").style.display = "none"; if (getUrlParameter("id") != undefined) { chargerInfosPanier(false,getUrlParameter("id"),null,null); } else if (getUrlParameter("seg") != undefined) { chargerInfosPanier(false,null,getUrlParameter("seg"),null); } else if (getUrlParameter("codeLabo") != undefined) { chargerInfosPanier(false,null,null,getUrlParameter("codeLabo")); } if (getUrlParameter("libelle") != undefined) { var lstDivLibelle = document.getElementsByClassName("nomPanier"); for (var i = 0; i < lstDivLibelle.length; i++) { lstDivLibelle[i].innerText = getUrlParameter("libelle"); } } } else if (window.location.pathname.indexOf("paniers-tp-sante")>-1) { getLstPaniers(); if($id("inputSearch")) { $("#inputSearch").keydown(function(e){ eventKeySearch(e); }); $("#autocompleteDiv").keydown(function(e){ eventKeySearch(e); }); } } else if (window.location.pathname.indexOf("pharmacies-partenaires")>-1) { // doGet("", "loadPharmacies_callback()", "./LoadPharmacies"); } } function loadPharmacies_callback(result) { console.log(result); } function chargerInfosPanier(fromFilter, codePanier, segmentation, lab) { console.log("fromFilter="+fromFilter+"\ncodePanier="+codePanier+"\nsegmentation="+segmentation+"\nlab="+lab); doGet("","chargerInfosPanier_callback("+fromFilter+","+segmentation+","+lab+")","./GetTpSantePanier?codePanier="+codePanier+"&codeSegment="+segmentation+"&codeLabo="+lab); } function filterTable(type) { var table = $('#tableProduitsPanier').DataTable(); var p = null; var codePanier = getUrlParameter("id"); var codeLabo = getUrlParameter("codeLabo"); if (type == "usage") { var p = document.getElementById("usage-filter").value; } if (p != null) { //table.search(p).draw(); chargerInfosPanier(true,codePanier,p,codeLabo); } } function chargerInfosPanier_callback(fromFilter,segmentation,lab,result) { var tabUsages = new Array(); var usage = ""; var p = getUrlParameter("p"); var dataSet = JSON.parse(result.responseText); var nbProduits = dataSet.length; for (var i = 0; i < dataSet.length; i++) { var chaine = dataSet[i].usage+"@"+dataSet[i].codeSegment; if (!tabUsages.includes(chaine)) { tabUsages.push(chaine); } } if (tabUsages.length > 0) { //tri alpha tabUsages.sort(); var sel = document.getElementById("usage-filter"); for (var i = 0; i < tabUsages.length; i++) { var value = tabUsages[i].split("@")[1]; var text = tabUsages[i].split("@")[0]; if (!sel.querySelector('[value="' + value + '"]')) { var opt = document.createElement("option"); opt.value = value; opt.text = text; sel.add(opt,null); } } } $('#tableProduitsPanier').DataTable().destroy(); var table = $('#tableProduitsPanier').DataTable( { "lengthChange": false, "pageLength": 100, "destroy":true, "data": dataSet, "columns": [ { "data": null, "defaultContent": "", "width":"10px"}, { "data" : "libelle" }, { "data" : "usage"}, { "data" : "forme" }, { "data" : "laboratoire" }, { "data" : "panier" }, { "data" : "baseDeRemboursement" }, { "data" : "cipAcl" }, { "data" : "souscripteur" }, { "data" : "idTypeCategorie" }, { "data": null, "defaultContent": "", "width":"10px"}, { "data": "codeActe"} ], "language": { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json" }, "order": [[ 1, "asc" ]], "columnDefs":[ {"targets": 0,"orderable": false}, { "visible": false, "targets": 8 }, { "visible": false, "targets": 9 }, { "visible": false, "targets": 11 }, { "targets": 7, "data": "cipAcl", "render": function(data, type, full, meta){ var renderData = data; if (full.idTypeCategorie == 2) { if (full.souscripteur) { renderData = "" + data + ""; } } else { if (full.codeActe.length == 0) { renderData = "" + data + ""; } } return renderData; } }, { "targets": 6, "data": "baseDeRemboursement", "render": function(data, type, full, meta){ var renderData = data + " €"; return renderData; } }, { "targets": 10, "data": null, "render": function(data, type, full, meta){ var renderData = data; if (full.idTypeCategorie == 2) { if (full.souscripteur) { // renderData = ""; renderData = ""; } } else { if (full.codeActe.length == 0) { // renderData = ""; renderData = ""; } } return renderData; } } ], responsive:true } ); document.getElementById("chargement").style.display = "none"; document.getElementById("phraseLibelle").style.display = "block"; if (segmentation == null || fromFilter) { var url = new URL(self.location.href) if (url.searchParams.get("codeLabo") != null) { libelleLabo = url.searchParams.get("lib"); var lstDivLibelle = document.getElementsByClassName("nomPanier"); for (var i = 0; i < lstDivLibelle.length; i++) { lstDivLibelle[i].innerText = libelleLabo; } if (nbProduits == 0) { document.getElementById("phraseLibelle").innerHTML = "Le laboratoire " + libelleLabo + " ne comporte aucun produit TP Santé"; } else { document.getElementById("phraseLibelle").innerHTML = "Liste des produits TP Santé du laboratoire " + libelleLabo + ""; } } else { libellePanier = dataSet[0].panier; var lstDivLibelle = document.getElementsByClassName("nomPanier"); for (var i = 0; i < lstDivLibelle.length; i++) { lstDivLibelle[i].innerText = libellePanier; } } } else { var url = new URL(self.location.href) if (usage != "") { document.getElementById("phraseLibelle").innerHTML = "Liste des produits TP Santé pour l'usage : " + usage + ""; document.getElementsByClassName("nomPanier")[0].innerText = usage; } else if (url.searchParams.get("lib") != null) { if (nbProduits == 0) { document.getElementById("phraseLibelle").innerHTML = "Il n'existe pas de produit TP Santé pour l'usage : " + url.searchParams.get("lib") + ""; } else { document.getElementById("phraseLibelle").innerHTML = "Liste des produits TP Santé pour l'usage : " + url.searchParams.get("lib") + ""; } document.getElementsByClassName("nomPanier")[0].innerText = url.searchParams.get("lib"); } else { document.getElementById("phraseLibelle").style.display = "none"; } } //Recherche du produit passé en paramètres if (p != undefined) { table.search(p).draw(); } $("#filterbox").keyup(function() { table.search(this.value).draw(); }); } function getMonographie(cip) { doGet("","getMonographie_callback()","./GetMonographie?cip="+cip); } function getMonographie_callback(result) { result = JSON.parse(result.responseText); var monographieString = bin2String(result.monographieHTML.monographie); if (monographieString.length > 0) windowBoostrapModal("Monographie","","",monographieString,true,true,"60%"); } function getLstPaniers() { doGet("","getLstPaniers_callback()","./GetLstPaniers") } function getLstPaniers_callback(result) { var lstPaniers = JSON.parse(result.responseText); var divPaniers = document.getElementById("listePaniers"); if (lstPaniers != null) { document.getElementById("nbPaniers").innerHTML = lstPaniers.length; for (var i = 0; i < lstPaniers.length; i++) { // var categoriePanier = getCategoriePanier(lstPaniers[i].codePanier); // console.log(categoriePanier + " - " + lstPaniers[i].codePanier); var html = ""; html += "
"; html += "
"; html += "
"; // html += "

" + lstPaniers[i].libellePanier + "

"; html += "

" + lstPaniers[i].libellePanier + "

"; html += "
"; html += "
"; divPaniers.innerHTML += html; } } } function goToPanier(codePanier) { document.location.href = "./infos-panier.html?id="+codePanier; } /** Partie RECHERCHE PRODUIT **/ function eventKeySearch(e) { if(e.keyCode!=40 && e.keyCode!=38 && e.keyCode!=13) { sleepingSearch(e); } else { if(e.keyCode===40) //Down { e.preventDefault(); var allEl = $id("autocompleteDiv").querySelectorAll(".focus"); if(allEl.length>0) { if(allEl[0].parentElement.nextSibling) { if(allEl[0].parentElement.nextSibling.className=="horsAmmIntercal") { allEl[0].parentElement.nextSibling.nextSibling.firstChild.className += " focus"; allEl[0].parentElement.nextSibling.nextSibling.firstChild.focus(); allEl[0].className = allEl[0].className.replace("focus",""); } else { allEl[0].parentElement.nextSibling.firstChild.className += " focus"; allEl[0].parentElement.nextSibling.firstChild.focus(); allEl[0].className = allEl[0].className.replace("focus",""); } } } else { $id("autocompleteDiv").firstChild.firstChild.focus(); $id("autocompleteDiv").firstChild.firstChild.className += " focus"; } } if(e.keyCode===38) //Up { e.preventDefault(); var allEl = $id("autocompleteDiv").querySelectorAll(".focus"); if(allEl.length>0) { if(allEl[0].parentElement.previousSibling) { if(allEl[0].parentElement.previousSibling.className=="horsAmmIntercal") { allEl[0].parentElement.previousSibling.previousSibling.firstChild.className += " focus"; allEl[0].className = allEl[0].className.replace("focus",""); allEl[0].parentElement.previousSibling.previousSibling.firstChild.focus(); } else { allEl[0].parentElement.previousSibling.firstChild.className += " focus"; allEl[0].className = allEl[0].className.replace("focus",""); allEl[0].parentElement.previousSibling.firstChild.focus(); } } } else { var all = $id("autocompleteDiv").getElementsByTagName("li"); all[all.length-1].firstChild.focus(); all[all.length-1].firstChild.className += " focus"; } } } return false; } //RECHERCHE PRODUIT var sleepingSearchLock=false; var initSS=true; var d = new Date(); var n = d.getTime(); var delaiFrappe=0; function sleepingSearch(e) { sleepingSearchLock=true; var d1 = new Date(); var n1 = d1.getTime(); delaiFrappe=(n1-n); d=d1; n=n1; if(initSS==true) { delaiFrappe=0; initSS=false; sleepingSearch_listener(); } } function sleepingSearch_listener() { if(sleepingSearchLock==true) { //Réinit du lock et vérification dans x secondes sleepingSearchLock=false; var newDelai=200; if(delaiFrappe>0) newDelai=delaiFrappe+50; setTimeout(function(){ sleepingSearch_listener(); },newDelai) } else { initSS=true; stepByStepSegmentation(); } } function stepByStep() { if(document.getElementById("inputSearch").value.length>2) { var txt = document.getElementById("inputSearch").value.trim(); txt = txt.sansAccent(); txt = txt.replaceAll("-"," "); txt = txt.toLowerCase(); var explode = txt.split(" "); var search = ""; var modeCode=false; var obj=[]; for(var i = 0; i < explode.length; i++) { obj.push({"wildcard": {"libellerecherche":"*"+explode[i]+"*"}}); } var urlGeneral = ""; if((txt.length==7 || txt.length==13) && isNaN(txt)==false) { obj.push({"term": {"cip13":txt}}); obj.push({"term": {"cip7":txt}}); obj.push({"term": {"cip13referent":txt}}); modeCode=true; } { //Generatiion de l'ID requete var dateActuelle=new Date(); var id_search=dateActuelle.getTime(); CS_ID_SEARCH=id_search; var data = { "sort" : [ "_score", { "libellerecherche.keyword" : {"order" : "asc"} } ], "query":{ "bool":{ "must":[ ], "must_not":[ ], "should":[ ], "minimum_should_match": 0 } }, "size":1000 } if(modeCode) data.query.bool.should.push(obj); else data.query.bool.must.push(obj); //Boost pour debut de nom if(modeCode==false) { data.query.bool.should.push({"match_phrase_prefix": {"libellerecherche":txt}}); data.query.bool.should.push({"term": {"libellerecherche":{"value":txt,"boost":2}}}); } $.ajax({ method: "POST", url: urlIndex+"/_search", data: JSON.stringify(data), dataType : 'json', }) .done(function(result) { stepByStepGeneral_callback(txt,search,id_search,modeCode,result); }) .fail(function( data ) { console.log(data); }); } } else { $id("autocompleteDiv").innerHTML=""; closeAutocomplete(); } } function stepByStepGeneral_callback(mot,search,id_search,fromCode,result) { if(id_search!=CS_ID_SEARCH && id_search!="bypass") { return; } var autocomplete = document.getElementById("autocompleteDiv"); autocomplete.style.display="block"; autocomplete.scrollTop=0; var tabs = ""; if(result.responseText!=undefined) tabs = JSON.parse(result.responseText); else if(result!=undefined) tabs = result; console.log(tabs); var html = ""; var table = scoriserResults(mot,tabs.hits.hits); // var indexHA = localStorage.getItem("orderResults").split(",").indexOf("7"); // var indexUCD = localStorage.getItem("orderResults").split(",").indexOf("5"); var faitHA = false; var faitUCD = false; var motSplitte = mot.sansAccent(); motSplitte = motSplitte.toUpperCase(); motSplitte = motSplitte.split(" "); var htmlFinal =""; var htmlUcd = ""; var htmlLabo = ""; var htmlLaboTemp = ""; var htmlUcdTemp = ""; var htmlUcdLivret = ""; var htmlLabo = ""; var date = new Date(); var dateToday = date.yyyymmdd(); if (table.length > 0) { for(var i = 0; i < table.length;i++) { var hit = table[i]; console.log(hit); var libelle1 = hit.libelle.replace("","~"); //Algo de surbrillance, voir si decodeHtml ne prend pas trop de temps var libelle2 = decodeHtml(libelle1); for(var j = 0; j < motSplitte.length; j++) { var pos1 = libelle2.toUpperCase().sansAccent().indexOf(motSplitte[j].toUpperCase().sansAccent()); var pos2 = pos1 + motSplitte[j].length; if(motSplitte[j].length>2 && pos1>-1) { libelle2 = [libelle2.slice(0, pos2), "", libelle2.slice(pos2)].join(''); libelle2 = [libelle2.slice(0, pos1), "", libelle2.slice(pos1)].join(''); } }//Fin d'algo var libelle = libelle2.replace("~",""); console.log("type="+hit.type); switch(hit.type) { case "produitsmc": { if (hit.supprime == "") { var continuer = true; var code = ""; if(fromCode==true) { if(table.length>1 && i==0) continuer=false; else { } } if(continuer==true) { var htmlUcdTemp = ""; var htmlLien = ""; var htmlIcon = ""; var href = "javascript:void(0);"; var color = "style='color:grey;cursor:default;'"; var backgroundLabel = "#88898a"; var padding = ""; var libelleLabel = "Produit"; if (hit.codepanier != 0 && hit.codepanier != undefined) { htmlIcon = ""; htmlUcdTemp += ""; htmlUcdTemp += "" + libelleLabel + ""; htmlUcdTemp += libelle + " - "+hit.codeReferent+""; if (htmlIcon.length > 0) htmlUcdTemp += htmlIcon; htmlUcdTemp += ""; htmlUcd += htmlUcdTemp; } } } } break; case "laboratoire": { var href = "./infos-panier.html?codeLabo="+hit.code+"&lib="+hit.libelle; htmlLabo += "
  • "; htmlLabo += ""; htmlLabo += "Laboratoire"; htmlLabo += libelle + "
  • "; } break; } } html+= htmlLabo + htmlUcd; autocomplete.innerHTML += html; var interUcd = document.querySelectorAll(".ucdIntercal"); if(interUcd.length>0) $(htmlLabo + htmlUcdLivret + htmlUcd).insertAfter(interUcd[0]); } $('[data-toggle="tooltip"]').tooltip() } function scoriserResults(tableMots,tableResults) { var spMot = tableMots.split(" "); var tableFinal = new Array(); // var orderResults = localStorage.getItem("orderResults").split(","); /*Id des categories * 1:Laboratoire * 2:Indication * 3:Composant * 4:DC * 5:UCD * 6:Gammes * 7:Sans AMM * */ var tableUcd = new Array(); var tableTpSante = new Array(); var tableLabo = new Array(); for(var i =0; i < tableResults.length;i++) { score = 0; var code = 0; var codeReferent = 0; var referent=""; var generique=""; var hospitalier=""; var dopant = ""; var idproduit=0; var codepanier=0; var supprime = ""; switch(tableResults[i]._type) { case "produitsmc": // var index = orderResults.indexOf("5"); if (tableResults[i]._source.cip13.length > 0) code = tableResults[i]._source.cip13; else code = tableResults[i]._source.cip7; code = tableResults[i]._source.cip13; codeReferent = tableResults[i]._source.cip13referent; idproduit=tableResults[i]._source.idProduit; codepanier=tableResults[i]._source.flags.code_panier_tp_sante; supprime=tableResults[i]._source.supprime; break; case "laboratoire": code = tableResults[i]._source.Code; libelle = tableResults[i]._source.libellelaboratoire break; } if(tableResults[i]._type=="produitsmc") { var libelle = tableResults[i]._source.libellecourt; if (codepanier != 0) { tableTpSante.push({'libelle':libelle,'type':tableResults[i]._type,'code':code,'idproduit':idproduit,'codepanier':codepanier,"nomTri":tableResults[i]._source.libelleHtml, "codeReferent":codeReferent, "supprime":supprime}); } else { tableUcd.push({'libelle':libelle,'type':tableResults[i]._type,'code':code,'idproduit':idproduit,'codepanier':codepanier,"nomTri":tableResults[i]._source.libelleHtml, "codeReferent":codeReferent, "supprime":supprime}); } } if(tableResults[i]._type=="laboratoire") { tableLabo.push({'libelle':libelle,'type':tableResults[i]._type,'code':code,"nomTri":libelle}); } } tableTpSante.sort(function (a, b) { //Algo de tri sur value json if (a.nomTri < b.nomTri) return -1; if (a.nomTri > b.nomTri) return 1; return 0; }); tableLabo.sort(function (a, b) { //Algo de tri sur value json if (a.nomTri < b.nomTri) return -1; if (a.nomTri > b.nomTri) return 1; return 0; }); for(var i = 0; i < tableLabo.length; i++) { tableFinal.push(tableLabo[i]); } for(var i = 0; i < tableTpSante.length; i++) { tableFinal.push(tableTpSante[i]); } tableUcd.sort(function (a, b) { //Algo de tri sur value json if (a.nomTri < b.nomTri) return -1; if (a.nomTri > b.nomTri) return 1; return 0; }); for(var i = 0; i < tableUcd.length; i++) { tableFinal.push(tableUcd[i]); } return tableFinal; } /**Partie "CONTACT **/ function sendFormContact(objForm) { document.getElementById("form_contact_result").innerHTML="Veuillez patienter ..."; var nom=objForm.nom.value; var prenom=objForm.prenom.value; var mail=objForm.email.value; var tel=objForm.telephone.value; var sujetMessage=objForm.sujet.value; var message=objForm.message.value; if(nom=="" || prenom=="" || mail=="" || sujet=="" || message=="") { document.getElementById("form_contact_result").innerHTML="Merci de renseigner tous les champs."; return false; } if(isMailFormat(mail)==false) { document.getElementById("form_contact_result").innerHTML="L'email saisi n'est pas une adresse valide."; return false; } var dest=encode64("info@tp-sante.fr"); var sujet=encode64("TP Santé - Formulaire contact"); var msg="Le message suivant a été envoyé via le formulaire \"contact\" :

    "; msg+="Nom : "+nom+"
    "; msg+="Prénom : " + prenom+"
    "; msg+="Mail : "+mail+"
    "; msg+="Téléphone : "+tel+"
    "; msg+="Sujet : " + sujetMessage + "
    "; msg+="Contenu du message :

    "+message+"
    "; msg=encode64(msg); doPost("","sendFormContact_callback","","./SendMail",true,"dest="+dest+"&datas="+msg+"&sujet="+sujet); return false; } function sendFormContact_callback(result) { var res=JSON.parse(result.responseText); if(res.result==1) { document.getElementById("form_contact_result").innerHTML="Votre message a été envoyé. Merci !"; document.getElementById("frm_contact").reset(); } else { document.getElementById("form_contact_result").innerHTML="Echec. Merci de réessayer."; } } /** GOOGLE MAPS **/ //var lstPharmacies; function getLstTpSantePharmacies() { //doGet("", "getLstTpSantePharmacies_callback()", "./LoadPharmacies"); $.ajax({ method: "GET", url: urlIndexPharmacie+"/_search", data:{ size:5000 }, dataType : 'json', }) .done(function(result) { getLstTpSantePharmacies_callback(result); }) .fail(function( data ) { console.log(data); }); } function getLstTpSantePharmacies_callback(result) { // lstPharmacies = JSON.parse(result.responseText); if (result != undefined && result != null) { lstPharmacies = result.hits.hits; console.log(lstPharmacies); const map = new google.maps.Map(document.getElementById("map"), { center: { lat: 46.227, lng: 2.213749}, zoom: 5, mapTypeId: "roadmap", }); var markers = []; var datePrecedente = "00/00/0000"; var datePlusRecente; var infoWin = new google.maps.InfoWindow(); var markers = lstPharmacies.map(function(pharmacie, i) { pharmaData = pharmacie._source; if (estPlusRecente(pharmaData.Date_de_maj, datePrecedente)) { datePlusRecente = pharmaData.Date_de_maj; } // var marker = codeAddress(pharmacie.adresse + " " + pharmacie.cp + " " + pharmacie.ville); var latLng = new google.maps.LatLng(pharmaData.gps[1], pharmaData.gps[0]); var marker = new google.maps.Marker({ position: latLng, icon: './assets/img/pin-removebg-preview.png' }); var contentString = '
    ' + pharmaData.RaisonSociale + "
    " + pharmaData.Voie + "
    " + pharmaData.codePostal + "
    " + pharmaData.Ville + "

    " + " Pharmacie TP Santé" '
    '; datePrecedente = pharmaData.Date_de_maj; google.maps.event.addListener(marker, 'click', function(evt) { infoWin.setContent(contentString); infoWin.open(map, marker); }) return marker; }); document.getElementById("dateMajPhcie").innerText = datePlusRecente; // Add a marker clusterer to manage the markers. // @ts-ignore MarkerClusterer defined via script new MarkerClusterer(map, markers, { imagePath: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m", calculator: function(markers, numStyles) { var index = 0; var title = ""; var count = markers.length.toString(); var dv = count; while (dv !== 0) { dv = parseInt(dv / 10, 10); index++; } index = Math.min(index, numStyles); return { text: "", index: index, title: "" }; } }); // Create the search box and link it to the UI element. const input = document.getElementById("pac-input"); const searchBox = new google.maps.places.SearchBox(input); map.controls[google.maps.ControlPosition.TOP_LEFT].push(input); // Bias the SearchBox results towards current map's viewport. map.addListener("bounds_changed", () => { searchBox.setBounds(map.getBounds()); }); // let markers = []; // Listen for the event fired when the user selects a prediction and retrieve // more details for that place. searchBox.addListener("places_changed", () => { const places = searchBox.getPlaces(); if (places.length == 0) { return; } // Clear out the old markers. markers.forEach((marker) => { marker.setMap(null); }); markers = []; // For each place, get the icon, name and location. const bounds = new google.maps.LatLngBounds(); places.forEach((place) => { console.log(place.geometry.location); if (!place.geometry) { console.log("Returned place contains no geometry"); return; } const icon = { url: place.icon, size: new google.maps.Size(71, 71), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 34), scaledSize: new google.maps.Size(25, 25), }; // Create a marker for each place. markers.push( new google.maps.Marker({ map, icon, title: place.name, position: place.geometry.location, }) ); if (place.geometry.viewport) { // Only geocodes have viewport. bounds.union(place.geometry.viewport); } else { bounds.extend(place.geometry.location); } }); map.fitBounds(bounds); }); } } function estPlusRecente(date1, date2) { // Convertir les dates en objets Date var d1 = convertirEnDate(date1); var d2 = convertirEnDate(date2); // Comparer les timestamps des dates if (d1.getTime() > d2.getTime()) { return true; // date1 est plus récente que date2 } else { return false; // date1 est égale ou antérieure à date2 } } function convertirEnDate(dateString) { var dateParts = dateString.split("/"); // Notez que pour JavaScript, les mois vont de 0 à 11, donc on soustrait 1 var jsDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); return jsDate; } // This example adds a search box to a map, using the Google Place Autocomplete // feature. People can enter geographical searches. The search box will return a // pick list containing a mix of places and predicted search terms. // This example requires the Places library. Include the libraries=places // parameter when you first load the API. For example: //