var languages=new Array();languages['en']='English';languages['fr']='French';languages['de']='German';languages['it']='Italian';languages['ja']='Japanese';languages['pt']='Portuguese';languages['ru']='Russian';languages['es']='Spanish';languages['vi']='Vietnamese';function GetMap(){ if (GBrowserIsCompatible()) { //var opts = {"defaultLocation":{lat:38,lng:-97,zoom:5,type:G_NORMAL_MAP}, var opts = {"defaultLocation":{lat:48.875554,lng:2.301979,zoom:12,type:G_NORMAL_MAP}, "onMouseMoveFn":infoPosition, "onMoveEndFn":loadPOI, "onZoomEndFn":myZoomEndEvent, "onClickFn":myClickEvent, "onLoadFn":myLoadEvent, "maxMarker":200, "countryCode":"US", "lblGeoList":"Geolocalisation", "lblNoResult":"No result", "lblMaxResults":"Max : 200 results returned" }; zMap = new ZMap('myMap',opts); ZForm.languages=languages; ZForm.labels={name:'Name',nameTitle:'Name of the point of interest', category:'Category',categoryTitle:'Category of the point of interest',categFirstOpt:'Choose...', address:'Contact',addressTitle:'Contact', description:'Description',descriptionTitle:'Description', link:'Link',linkTitle:'Associated link', langFirstOpt:'Choose...',addButton:'Add', languagesTableTitle:'Remove a language',aDelTitle:'Remove' }; ZForm.categories=''; ZForm.lblLanguages='Languages'; ZForm.languagesTableCols=5; } else alert('Incompatible Browser'); } function infoPosition(position){ var events ="Position WGS84 : " + position.lng + " ; " + position.lat +". Zoom : "+position.zoom; document.getElementById('position').innerHTML = events; } function myClickEvent(map,overlay,point){ if(overlay){ if(overlay.isZMarker || overlay.isZMarkerGeocoded) overlay.openZInfoWindow({maxWidth:400,suppressMapPan:true,onOpenFn:fitInfoWindowInMap}); } else{ if (point != null){ if (zTarget != null) zTarget.setPoint(point); else{ zTarget = new ZIcon(point, "http://www.zoomolocal.com/img/pos_actuel.gif",G_MAP_MAP_PANE); map.addOverlay(zTarget); } } } } function myZoomEndEvent(map,zoom_level){ if(map.zMarkerTempWithInfoWindow() || (map.zMarkerWithInfoWindow() && zMarkers[map.zMarkerWithInfoWindow()].draggable() && zMarkers[map.zMarkerWithInfoWindow()].draggingEnabled())){ if(map.zMarkerTempWithInfoWindow()){ if(map.isOutOfBounds(zMarkerTemp.getPoint())) resetZMarkersState(); } else if(map.zMarkerWithInfoWindow()){ if(map.isOutOfBounds(zMarkers[map.zMarkerWithInfoWindow()].getPoint())) resetZMarkersState(); } } } function myLoadEvent(categ,ids){ if(ids != null) id_zMarkers=ids; initCategories(categ); } function fitInfoWindowInMap(){ var opts = {"paddingTop":50, "paddingLeft":80, "paddingRight":30, "paddingBottom":70, "offsetX":45, "offsetY":105, "iconList":icon_list_div, "listNode":outter_container_div }; zMap.fitInfoWindow(opts); } function doSearch(button_id){ id_zMarkers=''; if(button_id=='bt_fast_search'){ resetSearchForm(); document.getElementById('txtMot').value=trim(document.getElementById('txtFsMot').value); document.getElementById('txtLieu').value=trim(document.getElementById('txtFsLieu').value); document.getElementById('chk_all_map').checked=true; visible_only=false; openList(); document.getElementById('form_fast_search').style.visibility="hidden"; document.getElementById('txtFsMot').value=''; document.getElementById('txtFsLieu').value=''; } removeGeocodedMarkers(); var lieu=trim(document.getElementById('txtLieu').value); if(lieu!='') geolocalize(lieu); else searchText(false); } function geolocalize(lieu){ loading(true); zMap.zGeocoder.getLocations(lieu,function(response){ if (!response || response.Status.code != 200) { alert("Sorry, we were unable to geocode that address"); var geolocalized=false; } else{ for(var i=0;i0){ success=true; temp= new ZMarker(new GLatLng(markers[0].getElementsByTagName('lat')[0].firstChild.nodeValue,markers[0].getElementsByTagName('lng')[0].firstChild.nodeValue), {lblEditLink:"Edit", addPhotosLink:"pictures.php", lblAddPhotosLink:"Add pictures", lblMoreInfoLink:"More info...", lblLanguages:languages, loadDataFn:loadPOIText }, markers[0]); zMap.addOverlay(temp); GEvent.clearListeners(zMap, "infowindowbeforeclose"); } } if(success){ ZForm.resetDialog(); ZForm.dialog('Your POI has been saved',true); window.setTimeout('onAfterSave(temp,'+(id_poi>0?true:false)+');',2000); } else if(editable=='false' && !isNaN(new_id) && new_id>0){ alert('You must be logged in to do this operation',false); resetZMarkersState(); is_saving=false; } else{ ZForm.dialog('An error occured while trying to save your POI, please try again',false); is_saving=false; } } } ); } } function onAfterSave(temp,edit){ var id_marker=temp.idZMarker; if(edit){ zMarkers[id_marker]=zMarkers[id_marker].removeFromMap(); delete zMarkers[id_marker]; } else zMarkerTemp=zMarkerTemp.removeFromMap(); zMarkers[id_marker] = temp; delete temp; window.setTimeout('GEvent.trigger(zMarkers['+id_marker+'],"click")',500); is_saving=false; } function unloadPOI(){ zMap.clearOverlays(); zMarkers.splice(0,zMarkers.length); zMarkersGeocoded.splice(0,zMarkersGeocoded.length); if(zTarget != null) zTarget=zTarget.removeFromMap(); buildList(zMap,zMarkers,zMarkersGeocoded); } function loadPOI(map,fromDB){ drawGeocodedPOI(map); if(fromDB){ loading(true); var bounds = map.getBounds(); var center= map.getCenter(); var SW = bounds.getSouthWest(); var NE = bounds.getNorthEast(); var data = "min_lng="+SW.lng()+"&max_lng="+NE.lng()+"&min_lat="+SW.lat()+"&max_lat="+NE.lat()+"&langue=en"; data += "&level="+map.getZoom(); if(visible_only) data += "&visible="+visible_only; else visible_only=true; if(categories!='') data += "&categories="+categories; if(id_zMarkers!='') data += "&ids="+id_zMarkers; if(search_keyword!=''){ data += "&search_keyword="+search_keyword; search_keyword=''; } if(search_category!=''){ data += "&search_category="+search_category; search_category=''; } //GLog.write(data); if(zTarget != null && !bounds.contains(zTarget.getPoint())) zTarget=zTarget.removeFromMap(); processXMLHttpRequest('scripts/load_poi.php',data,'POST',true, function(xml_doc,responseCode){ if(responseCode==4){ if(xml_doc!=null){ zMarkers=drawPOI(map,xml_doc); var position = zMap.getCurrentPosition(); if(position.marker && isPOIDrawn(parseInt(position.marker))) GEvent.trigger(zMarkers[parseInt(position.marker)],"click"); if(map.getNbVisibleMarkers()0) buildList(map,zMarkers,zMarkersGeocoded); else if(force_list_open && (map.getNbVisibleMarkers()==map.getMaxMarkers() || id_zMarkers)) openList(); } loading(false); } } ); } else{ updateZMarkersVisibilty(); if(map.getNbVisibleMarkers()0) buildList(map,zMarkers,zMarkersGeocoded); else if(force_list_open && (map.getNbVisibleMarkers()==map.getMaxMarkers() || id_zMarkers)) openList(); } } function loadPOIText(id,language){ loading(true); var data = "id="+id+"&langue="+language; processXMLHttpRequest('scripts/load_poitext.php',data,'POST',true, function(xml_doc,responseCode){ if(responseCode==4){ if(xml_doc!=null){ var id_poi=parseInt(xml_doc.getElementsByTagName("id_poi")[0].firstChild.nodeValue); if(isPOIDrawn(id_poi)){ zMarkers[id_poi].setImgTitles(xml_doc.getElementsByTagName("vignette")[0]); zMarkers[id_poi].setTextFields(xml_doc.getElementsByTagName("textes")[0]); zMarkers[id_poi].displayLanguageTab(zMarkers[id_poi].getLoadingLanguage()) } } loading(false); } } ); } function editPOI(id){ id=parseInt(id); if(isPOIDrawn(id)){ loading(true); zMap.closeInfoWindow(); zMap.resetInfoWindowState() var data = "id="+id+"&langue=en"; processXMLHttpRequest('scripts/edit_poi.php',data,'POST',true, function(xml_doc,responseCode){ if(responseCode==4){ if(xml_doc!=null){ var markers = xml_doc.getElementsByTagName("item"); if(markers.length){ var id_poi=parseInt(trim(markers[0].getElementsByTagName('id_poi')[0].firstChild.nodeValue)); var editable=trim(markers[0].getElementsByTagName('editable')[0].firstChild.nodeValue); if(editable=='true' && id==id_poi){ zMarkers[id].setEditMode(true); zMarkers[id].openZInfoWindow({maxWidth:450,suppressMapPan:true,onOpenFn:fitInfoWindowInMap}, {cancelLabel:'Cancel', saveLabel:'Save', cancelFn:function(){zMap.closeInfoWindow()}, saveFn:savePOI} ); var selectedLanguages= trim(markers[0].getElementsByTagName('textes')[0].getElementsByTagName('languages')[0].firstChild.nodeValue).split(';'); ZForm.initialize(document.getElementById('info_forms'),selectedLanguages); ZForm.setFieldValue('hidIdPoi',markers[0].getElementsByTagName('id_poi')[0].firstChild.nodeValue); var id_categ=markers[0].getElementsByTagName('categorie')[0].getAttribute('id'); var texts = markers[0].getElementsByTagName('textes')[0].getElementsByTagName('texte'); for(var i=0;i1){ if(!on_screen) map.setCenter(zMarkersGeocoded[1].getPoint(),map.getZoom()); } else GEvent.trigger(zMarkersGeocoded[1],'click'); } } } function saveIdZMarkers(id){ if(id_zMarkers!='') id_zMarkers+=';'; id_zMarkers+=id; } function isPOIDrawn(id){ var res=false; if(id>0 && typeof(zMarkers[id])!='undefined'&& typeof(zMarkers[id])=='object') res=true; return res; } function isGeocodedPOIDrawn(id){ var res=false; if(id>0 && typeof(zMarkersGeocoded[id])!='undefined'&& typeof(zMarkersGeocoded[id])=='object' && zMarkersGeocoded[id].isDrawn()) res=true; return res; } function removeMarkersForCategory(id){ if(zMarkers.length){ loading(true); for(var i in zMarkers){ if(zMarkers[i].getCategoryId()==id){ GEvent.clearInstanceListeners(zMarkers[i]) zMarkers[i]=zMarkers[i].removeFromMap(); delete zMarkers[i]; } } loading(false); } } function removeGeocodedMarkers(){ if(zMarkersGeocoded.length){ for(var i in zMarkersGeocoded){ if(zMarkersGeocoded[i].isDrawn()){ GEvent.clearInstanceListeners(zMarkersGeocoded[i]) zMarkersGeocoded[i]=zMarkersGeocoded[i].removeFromMap(); } } zMarkersGeocoded.splice(0,zMarkersGeocoded.length); } } function getNewPOIPoint(){ var id=false; var point=false; if(zMarkersGeocoded.length){ var mapBounds = zMap.getBounds(); for(var i in zMarkersGeocoded){ if(zMarkersGeocoded[i].isDrawn() && mapBounds.contains(zMarkersGeocoded[i].getPoint())){ if(zMap.zMarkerGeoWithInfoWindow()==i){ id=i; break; }else if(!id) id=i; } } if(id){ point=zMarkersGeocoded[id].getPoint(); //zMap.removeOverlay(zMarkersGeocoded[id]); //zMarkersGeocoded[id].setIsDrawn(false); zMap.closeInfoWindow(); } } return point; } function loading(on){ if(on) document.getElementById('loading_state').style.visibility='visible'; else document.getElementById('loading_state').style.visibility='hidden'; } function getCurrentUrl(){ var link=window.location; if(categories!='') link += "&view="+categories; if(zMap.zMarkerWithInfoWindow()) link += "&marker="+zMap.zMarkerWithInfoWindow(); if(id_zMarkers!='') link += "&add="+id_zMarkers; return link; } function openDisplayUrlDiv(){ var input = document.getElementById('i_url'); var div = document.getElementById('display_url'); var div_content = document.getElementById('content'); input.value=getCurrentUrl(); /*if (input.setSelectionRange) return this.value.substring(this.selectionStart, this.selectionEnd); else if (document.selection) { this.focus(); return document.selection.createRange().text; }*/ if(div.offsetHeight && div_content.offsetHeight){ var div_height=div.offsetHeight; var content_height=div_content.offsetHeight; } else{ var div_height=100; var content_height=document.documentElement.clientHeight-document.getElementById('header').style.height-document.getElementById('footer').style.height; } var ombre=document.getElementById('shadow_url'); if(!ombre.offsetHeight || !ombre.offsetWidth){ ombre.style.height="95px"; ombre.style.width="450px"; } div.style.top=((content_height-div_height)/2)+"px"; div.style.left=(((div_content.offsetWidth-div.offsetWidth)/2>0)?(div_content.offsetWidth-div.offsetWidth)/2:0)+"px"; div.style.visibility = "visible"; input.focus(); input.select(); } function closeDisplayUrlDiv(){ document.getElementById('display_url').style.visibility = "hidden"; } function login(isLogged){ var url = encodeURIComponent(getCurrentUrl()); if(isLogged) document.location='http://www.zoomolocal.com/logout.php?url='+url; else document.location='http://www.zoomolocal.com/login.php?url='+url; } function flag_poi(){ if(zMap.zMarkerWithInfoWindow()) openPopUp('ads/flag.php?id='+zMap.zMarkerWithInfoWindow(),'zm_popup',400,450); } function in_array(needle,haystack){ var found=false,i=0; while(!found && i/g,'>').replace(/"/g,'"'); } delete temp; } return s; } function nl2br(text){ if(typeof(text)=='string' && text!=''){ text = text.replace(/\r\n/g,'
'); text = text.replace(/\n/g,'
'); } return text; } function getTextNodes(text){ var res = new Array(); if(typeof(text)=='string' && text!=''){ var temp = text.split("\r\n"); if(temp.length==1) temp = text.split("\n"); for(var i=0;inumChar){ text=text.substring(0,numChar); text=text.substring(0,text.lastIndexOf(' ')); text+='...'; } return text; } function maxlength(text,nbChar){ if(text.length Type : '+balises[i].nodeType+'\r\na '+a.nodeName+' -> Type : '+a.nodeType+'\r\nb '+b.nodeName+' -> Type : '+b.nodeType); } return d; } function createXMLHttp() { if (typeof XMLHttpRequest != "undefined") { return new XMLHttpRequest(); } else if (window.ActiveXObject) { var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp" ]; for (var i = 0; i < aVersions.length; i++) { try { var oXmlHttp = new ActiveXObject(aVersions[i]); return oXmlHttp; } catch (oError) { //Do nothing } } } throw new Error("XMLHttp object could be created."); } function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } function processXMLHttpRequest(url,formData,method,xml,processFunction){ xhr = null; var data=null; var responseCode=null; /*if(window.XMLHttpRequest) // Firefox et autres xhr = new XMLHttpRequest(); else if(window.ActiveXObject){ // Internet Explorer try{ xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e){ try{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e1){ xhr = null; } } }*/ xhr=createXMLHttp(); if(xhr){ xhr.onreadystatechange = function(){ responseCode=xhr.readyState; if(responseCode==4 && xhr.status == 200){ if(xml) data = cleanXML(xhr.responseXML.documentElement); else data = xhr.responseText; } processFunction(data,responseCode); } if(formData!=null && formData!='' && method=='POST'){ xhr.open('POST', url, true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.send(formData); } else{ if(formData!=null && formData!=''){ if (!url.indexOf('?')) url += '?'; url += formData; } xhr.open('GET', url, true); xhr.send(null); } } } function ZMap(id_container,options) { this.containerId_=id_container || null; this.defaultPosition=options.defaultLocation || {lat:48.8532,lng:2.3488,zoom:10,type:G_PHYSICAL_MAP}; this.loadPosition=null; this.prevent_reload_=false; this.onMouseMoveFn_=options.onMouseMoveFn || null; this.onMoveEndFn_=options.onMoveEndFn || null; this.onZoomEndFn_=options.onZoomEndFn || null; this.onClickFn_=options.onClickFn || null; this.onLoadFn_=options.onLoadFn || null; this.maxMarker_=options.maxMarker || null; this.nbMarker_=0; this.nbVisibleMarkers_=0; this.lblNoResult_=options.lblNoResult || ""; this.lblMaxResults_=options.lblMaxResults || ""; this.zGeocoder = new ZGeocoder((options.countryCode || null),(options.lblGeoList || null)); this.zMarkerInfoWindowOn_=false; this.zMarkerTempInfoWindowOn_=false; this.zMarkerGeoInfoWindowOn_=false; this.hoveredZMarker_ = null; GMap2.apply(this,new Array(document.getElementById(id_container),{'mapTypes':[G_PHYSICAL_MAP,G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP]})); this.currentPosition=this.setCurrentPosition(); GMap2.prototype.setCenter.apply(this,new Array(new GLatLng(this.currentPosition.lat, this.currentPosition.lng), this.currentPosition.zoom)); GMap2.prototype.setMapType.apply(this,new Array(this.currentPosition.type)); GMap2.prototype.addControl.apply(this,new Array(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10, 30)))); GMap2.prototype.addControl.apply(this,new Array(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10, 5)))); GMap2.prototype.addControl.apply(this,new Array(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(80, 5)))); GMap2.prototype.enableDoubleClickZoom.apply(this); GMap2.prototype.enableContinuousZoom.apply(this); GMap2.prototype.enableScrollWheelZoom.apply(this); GEvent.addListener(this, "click", this.onClick); GEvent.addListener(this, "mousemove", this.onMouseMove); GEvent.addListener(this, "moveend", this.onMoveEnd); GEvent.addListener(this, "zoomend", this.onZoomEnd); GEvent.addListener(this, "addoverlay", this.onAddOverlay); GEvent.addListener(this, "removeoverlay", this.onRemoveOverlay); GEvent.addListener(this, "clearoverlays", this.onClearOverlays); GEvent.addListener(this, "infowindowclose", this.resetInfoWindowState); if(this.onLoadFn_!=null && (this.currentPosition.view || this.currentPosition.ids)) this.onLoadFn_((this.currentPosition.view?this.currentPosition.view:''),(this.currentPosition.ids?this.currentPosition.ids:'')); this.onMoveEnd(); document.getElementById(id_container+'Loading').style.visibility='hidden'; } for(var prop in GMap2.prototype) ZMap.prototype[prop] = GMap2.prototype[prop]; ZMap.prototype.setCurrentPosition = function(){ var current_position; if(window.location.hash!=''){ var ancre = window.location.hash.replace('#',''); var param = ancre.split("&"); for(var i=0;ideltaX) x=deltaX; if(y>deltaY) y=deltaY; if(this.position_=='TOP_RIGHT' || this.position_=='BOTTOM_RIGHT') x-=(this.div_.offsetWidth+this.offsetX_); else if(this.position_=='TOP_LEFT' || this.position_=='BOTTOM_LEFT') x+=this.offsetX_; if(this.position_=='BOTTOM_LEFT' || this.position_=='BOTTOM_RIGHT') y-=(this.div_.offsetHeight+this.offsetY_); else if(this.position_=='TOP_LEFT' || this.position_=='TOP_RIGHT') y+=this.offsetY_; if(xthis.maxElements_){ this.menu_.getElementsByTagName('ul')[0].style.height=this.maxHeight_+'px'; this.menu_.getElementsByTagName('ul')[0].style.overflowY='scroll'; } this.div_.style.visibility = "visible"; } ZContextMenu.prototype.mouseoverEvent = function(e){ var zEvent = new ZEvent(e); if(zEvent.type=='mouseout'){ zEvent.source.style.cursor='auto' zEvent.source.style.background='#ffffff' } else if(zEvent.type=='mouseover'){ zEvent.source.style.cursor='pointer' zEvent.source.style.background='#2d3ccd' } zEvent.consume(); } ZContextMenu.prototype.addListEventHandler = function(event,handler){ var li = this.menu_.getElementsByTagName('ul')[0].getElementsByTagName('li'); for(var i=0;i0){ document.getElementById(this.listEltName_+this.idZMarker).style.background='#fdf06a'; document.getElementById(this.listEltName_+this.idZMarker).style.cursor='pointer'; } if(this.map_.getBounds().contains(this.getPoint())){ if(this.zInfoBulle_!=null) this.zInfoBulle_.setPoint(this.getPoint()); else{ if(this.map_.hasHoveredZMarker()) GEvent.trigger(this.map_.getHoveredZMarker(),'mouseout'); this.zInfoBulle_ = new ZInfoBulle(this.getPoint(),this.getZInfoBulleDOMContent()); this.map_.addOverlay(this.zInfoBulle_); this.map_.setHoveredZMarker(this); } } } ); GEvent.addListener(this,'mouseout',function(){ this.setImage(this.srcIcon_); if(parseInt(document.getElementById(this.listId_).style.width)>0){ document.getElementById(this.listEltName_+this.idZMarker).style.background='#ffffff'; document.getElementById(this.listEltName_+this.idZMarker).style.cursor='auto'; } if(this.zInfoBulle_!=null){ if(this.map_.hasHoveredZMarker() && this.map_.getHoveredZMarker().idZMarker!=this.idZMarker) GEvent.trigger(this.map_.getHoveredZMarker(),'mouseout'); this.zInfoBulle_=this.zInfoBulle_.removeFromMap(); this.map_.setHoveredZMarker(null); } } ); } } } ZMarker.prototype.getZInfoBulleContent= function(){ return '

'+this.categorie_.name+'
'+this.title_[this.lang_]+'

'; } ZMarker.prototype.getZInfoBulleDOMContent= function(){ var p = document.createElement('p'); p.id = 'infobulle_'+this.getCategoryId(); p.appendChild(document.createTextNode(this.categorie_.name)); p.appendChild(document.createElement('br')); var span = document.createElement('span'); span.setAttribute("class","titre"); span.setAttribute("className","titre"); span.appendChild(document.createTextNode(this.title_[this.lang_])); p.appendChild(span); return p; } ZMarker.prototype.getZInfoWindowDOMContent = function(optForm){ if(!this.inEditMode()){ var info_window = document.createElement('div'); info_window.id='info_window'; var element = document.createElement('div'); element.setAttribute("class","titre categ_"+this.getCategoryId()); element.setAttribute("className","titre categ_"+this.getCategoryId()); var p = document.createElement('p'); p.id='if_title'; p.setAttribute("class","titre"); p.setAttribute("className","titre"); var text = document.createTextNode(this.title_[this.lang_]); p.appendChild(text); element.appendChild(p); p = document.createElement('p'); p.setAttribute("class","clear"); p.setAttribute("className","clear"); text = document.createTextNode('\u00a0'); p.appendChild(text); element.appendChild(p); info_window.appendChild(element); element = document.createElement('h5'); element.setAttribute("class","categ_"+this.categorie_.color); element.setAttribute("className","categ_"+this.categorie_.color); element.appendChild(document.createTextNode(this.categorie_.name)); info_window.appendChild(element); element = document.createElement('div'); element.id = 'info_desc'; if(this.img_){ var img = document.createElement('img'); img.setAttribute('src',this.img_.src); img.setAttribute('width',this.img_.width); img.setAttribute('height',this.img_.height); img.setAttribute('align','left'); if(typeof(this.img_.title[this.lang_])!='undefined') img.setAttribute('title',htmlEntities(this.img_.title[this.lang_])); if(this.moreInfoLink_!=''){ var a = document.createElement('a'); a.id='a-img'; a.setAttribute('href',this.moreInfoLink_+'/'); a.setAttribute('target','_blank'); a.appendChild(img); element.appendChild(a); } else element.appendChild(img); } var span = document.createElement('span'); span.id='if_address'; var texts = getTextNodes(this.address_[this.lang_]); if(texts.length){ for(var i=0;ithis.selectedLanguages_.length) element.appendChild(this.buildMoreLanguageTab()); for(var i=this.selectedLanguages_.length-1;i>=0;i--){ element.appendChild(this.buildTabForLanguage(this.selectedLanguages_[i])); } info_window.appendChild(element); } else{ var info_window = document.createElement('div'); info_window.id='info_window'; var element = document.createElement('h4'); element.appendChild(document.createTextNode(this.title_[this.lang_])); info_window.appendChild(element); element = document.createElement('p'); element.id='form_res'; element.appendChild(document.createTextNode('\u00a0')); info_window.appendChild(element); element = document.createElement('input'); element.id='hidIdPoi'; element.setAttribute('name','hidIdPoi'); element.setAttribute('type','hidden'); info_window.appendChild(element); element = document.createElement('div'); element.id='info_forms'; info_window.appendChild(element); element = document.createElement('div'); element.id='buttons'; var button = document.createElement('input'); button.id='annuler'; button.setAttribute('type','button'); button.setAttribute('value',optForm.cancelLabel); ZEvent.addEventListener(button,'click',optForm.cancelFn,false); element.appendChild(button); button = document.createElement('input'); button.id='valider'; button.setAttribute('type','button'); button.setAttribute('value',optForm.saveLabel); ZEvent.addEventListener(button,'click',optForm.saveFn,false); element.appendChild(button); info_window.appendChild(element); } return info_window; } ZMarker.prototype.displayLanguageTab = function(langue){ if(!this.draggingEnabled() && this.lang_!=langue && !this.isLoadingLang_ && in_array(langue,this.availableLanguages_)){ if(typeof(this.title_[langue])=='undefined' && this.loadDataFn_){ this.isLoadingLang_=true; this.loadingLang_=langue; this.loadDataFn_(this.idZMarker,langue); } else if(typeof(this.title_[langue])!='undefined'){ this.lang_=langue; if(this.loadingLang_==langue) this.loadingLang_=''; if(!in_array(langue,this.selectedLanguages_)) this.addLanguageTab(this.lang_); this.displayTextForLanguage(this.lang_); this.setSelectedTab(this.lang_); } } } ZMarker.prototype.addLanguageTab = function(langue){ var new_tab=this.buildTabForLanguage(langue); var container = document.getElementById('langue_selector'); var divs = container.getElementsByTagName('div'); if(divs[0].id!='bt_lng_sel_more') container.replaceChild(divs[0]); else container.removeChild(divs[1]); container.appendChild(new_tab); var temp = new Array(); temp.push(langue); var i=0; while(temp.length1?optForm:null)),optInfoWindow); this.map_.setZMarkerWithInfoWindow(this.idZMarker); if(optInfoWindow.onOpenFn) this.onOpenFn=optInfoWindow.onOpenFn; } ZMarker.prototype.setZInfoWindowPosition = function(){ this.map_.getInfoWindow().reposition(this.getPoint(),new GSize(0,-this.getIcon().iconSize.height-this.getIcon().maxHeight)); } ZMarker.prototype.fitZInfoWindow = function(){ var offsetHeight=this.getIcon().maxHeight; while(offsetHeight>0){ offsetHeight--; setTimeout('zMap.getInfoWindow().reposition(zMarkers['+this.idZMarker+'].getPoint(),new GSize(0,'+(-this.getIcon().iconSize.height-offsetHeight)+'))',(500/this.getIcon().maxHeight)); } if(this.onOpenFn) this.onOpenFn(); } ZMarker.prototype.getCategoryId = function(){ return this.categorie_.id; } ZMarker.prototype.getDistanceToCenter = function(){ return this.distance_; } ZMarker.prototype.setDistanceToCenter = function(distance){ this.distance_=distance; } ZMarker.prototype.inEditMode = function(){ return (this.draggable_ && this.draggingEnabled()); } ZMarker.prototype.drawLineToCenter = function(){ if(this.zPolyline) this.removeLineToCenter(); this.zPolyline = new ZPolyline(new Array(this.map_.getCenter(),this.getPoint()), '#'+this.categorie_.color, 3, 0.7, null, 'dash'); this.map_.addOverlay(this.zPolyline); } ZMarker.prototype.removeLineToCenter = function(){ if(this.zPolyline){ this.map_.removeOverlay(this.zPolyline); delete this.zPolyline; } } ZMarker.prototype.getMarkerIcon = function(){ var icon = new GIcon(); icon.image = this.srcIcon_; icon.iconSize = new GSize(37, 51); icon.shadow = this.srcIconShadow_; icon.shadowSize = new GSize(57, 51); icon.iconAnchor = new GPoint(18, 51); icon.infoWindowAnchor = new GPoint(17,1); icon.maxHeight=13; icon.transparent=this.srcIconTransparent_; icon.imageMap=[1,1,1,33,13,33,14,37,15,41,16,49,17,50,19,50,20,49,21,41,35,33,35,1]; //icon.imageMap=[0,0,36,0,36,33,22,33,18,48,14,33,0,33]; /*icon.printImage=''; icon.mozPrintImage=''; icon.printShadow=''; */ return icon; } function ZMarkerTemp(point,options) { this.isZMarkerTemp=true; this.srcIcon_= options.srcIcon || "img/marker_edit.png"; this.srcIconShadow_= options.srcIconShadow || "img/marker_shadow.png"; this.srcIconTransparent_ = options.srcIconTransparent || "img/marker_transparent.png"; this.icon_= this.getMarkerIcon(); //this.icon_=new GIcon(G_DEFAULT_ICON); this.title_=options.title || ''; //var arguments = new Array(point, {icon:this.icon_, dragCrossMove:false, clickable:true, draggable:true, bouncy:false, bounceGravity:1}); GMarker.apply(this,new Array(point, {icon:this.icon_, dragCrossMove:false, clickable:true, draggable:true, bouncy:false, bounceGravity:1})); GEvent.addListener(this,'drag',this.setZInfoWindowPosition); GEvent.addListener(this,'dragend',this.fitZInfoWindow); } ZMarkerTemp.prototype = new GMarker(new GLatLng(0, 0)); ZMarkerTemp.prototype.initialize = function(map) { GMarker.prototype.initialize.call(this, map); this.map_ = map; } ZMarkerTemp.prototype.redraw = function(force) { GMarker.prototype.redraw.call(this, this.map_); } ZMarkerTemp.prototype.remove = function() { GMarker.prototype.remove.call(this); } ZMarkerTemp.prototype.removeFromMap = function() { this.map_.removeOverlay(this); return null; } ZMarkerTemp.prototype.getZInfoWindowContent = function(optForm){ var info_window = document.createElement('div'); info_window.id='info_window'; var element = document.createElement('h4'); element.appendChild(document.createTextNode(this.title_)); info_window.appendChild(element); element = document.createElement('p'); element.id='form_res'; element.appendChild(document.createTextNode('\u00a0')); info_window.appendChild(element); element = document.createElement('input'); element.id='hidIdPoi'; element.setAttribute('name','hidIdPoi'); element.setAttribute('type','hidden'); info_window.appendChild(element); element = document.createElement('div'); element.id='info_forms'; info_window.appendChild(element); ZForm.initialize(element,optForm.lang); element = document.createElement('div'); element.id='buttons'; var button = document.createElement('input'); button.id='annuler'; button.setAttribute('type','button'); button.setAttribute('value',optForm.cancelLabel); ZEvent.addEventListener(button,'click',optForm.cancelFn,false); element.appendChild(button); button = document.createElement('input'); button.id='valider'; button.setAttribute('type','button'); button.setAttribute('value',optForm.saveLabel); ZEvent.addEventListener(button,'click',optForm.saveFn,false); element.appendChild(button); info_window.appendChild(element); return info_window; } ZMarkerTemp.prototype.openZInfoWindow = function(options,optForm){ options.pixelOffset=new GSize(0,-this.getIcon().iconSize.height); this.map_.setZMarkerTempWithInfoWindow(); this.map_.openInfoWindow(this.getPoint(),this.getZInfoWindowContent(optForm),options); if(options.onOpenFn) this.onOpenFn=options.onOpenFn; } ZMarkerTemp.prototype.setZInfoWindowPosition = function(){ this.map_.getInfoWindow().reposition(this.getPoint(),new GSize(0,-this.getIcon().iconSize.height-this.getIcon().maxHeight)); } ZMarkerTemp.prototype.fitZInfoWindow = function(){ var offsetHeight=this.getIcon().maxHeight; while(offsetHeight>0){ offsetHeight--; setTimeout('zMap.getInfoWindow().reposition(zMarkerTemp.getPoint(),new GSize(0,'+(-this.getIcon().iconSize.height-offsetHeight)+'))',(500/this.getIcon().maxHeight)); } if(this.onOpenFn) this.onOpenFn(); } ZMarkerTemp.prototype.getMarkerIcon = function(){ var icon = new GIcon(); icon.image = this.srcIcon_; icon.shadow = this.srcIconShadow_; icon.iconSize = new GSize(37, 51); icon.maxHeight=13; icon.shadowSize = new GSize(57, 51); icon.iconAnchor = new GPoint(18, 51); icon.infoWindowAnchor = new GPoint(17,1); icon.transparent=this.srcIconTransparent_; icon.imageMap=[1,1,1,33,13,33,14,37,15,41,16,49,17,50,19,50,20,49,21,41,35,33,35,1]; return icon; } function ZMarkerGeocoded(placemark,options) { this.isZMarkerGeocoded=true; this.idZMarkerGeocoded=null; this.drawn=false; this.isDrawn_=false; this.zoomLevel_=0; this.srcIcon_ = options?(options.srcIcon || "img/marker_geoloc.png"):"img/marker_geoloc.png"; this.srcIconShadow_ = options?(options.srcIconShadow || "img/marker_geolocshadow.png"):"img/marker_geolocshadow.png"; this.srcIconHighlight_ = options?(options.srcIconHighlight || "img/marker_geolocroll.png"):"img/marker_geolocroll.png"; this.srcIconTransparent_ = options?(options.srcIconTransparent || "img/marker_geoloctransparent.png"):"img/marker_geoloctransparent.png"; this.listId_='list_zmarker'; this.listEltName_ = 'list_eltg'; if(this.srcIcon_!="") this.icon_= this.getMarkerIcon(); else this.icon_= G_DEFAULT_ICON; this.placemark_ = placemark; if(this.placemark_.Point) this.point_ = new GLatLng(this.placemark_.Point.coordinates[1],this.placemark_.Point.coordinates[0]); else this.point_ = new GLatLng(0,0); if(this.placemark_.address) this.location_=this.placemark_.address; else this.location_=''; GMarker.apply(this,new Array(this.point_, {title:this.location_,icon:this.icon_})); } ZMarkerGeocoded.prototype = new GMarker(new GLatLng(0,0)); ZMarkerGeocoded.prototype.initialize = function(map) { GMarker.prototype.initialize.call(this, map); this.map_ = map; this.zoomLevel_ = this.map_.zGeocoder.getZoomLevel(this.placemark_); this.drawn=true; } ZMarkerGeocoded.prototype.redraw = function(force) { GMarker.prototype.redraw.call(this, this.map_); } ZMarkerGeocoded.prototype.remove = function() { GMarker.prototype.remove.call(this); } ZMarkerGeocoded.prototype.removeFromMap = function() { this.map_.removeOverlay(this); return null; } ZMarkerGeocoded.prototype.getLocation = function() { return this.location_; } ZMarkerGeocoded.prototype.getZoomLevel = function() { return this.zoomLevel_; } ZMarkerGeocoded.prototype.setId = function(id){ this.idZMarkerGeocoded=id; this.addMouseEvents(); } ZMarkerGeocoded.prototype.getId = function(){ return this.idZMarkerGeocoded; } ZMarkerGeocoded.prototype.setIsDrawn = function(value){ this.isDrawn_=value; } ZMarkerGeocoded.prototype.isDrawn = function(){ return this.isDrawn_; } ZMarkerGeocoded.prototype.openZInfoWindow = function(options){ options.pixelOffset=new GSize(0,-this.getIcon().iconSize.height); var p = document.createElement('p'); p.id='info_geocoded'; p.appendChild(document.createTextNode(this.location_)); this.map_.openInfoWindow(this.getPoint(),p,options); this.map_.setZMarkerGeoWithInfoWindow(this.getId()); if(options.onOpenFn) this.onOpenFn=options.onOpenFn; } ZMarkerGeocoded.prototype.drawLineToCenter = function(){ if(this.zPolyline) this.removeLineToCenter(); this.zPolyline = new ZPolyline(new Array(this.map_.getCenter(),this.getPoint()), '#ff2020', 3, 0.7, null, 'dash'); this.map_.addOverlay(this.zPolyline); } ZMarkerGeocoded.prototype.removeLineToCenter = function(){ if(this.zPolyline){ this.map_.removeOverlay(this.zPolyline); delete this.zPolyline; } } ZMarkerGeocoded.prototype.getMarkerIcon = function(){ var icon = new GIcon(); icon.image = this.srcIcon_; icon.shadow = this.srcIconShadow_; icon.iconSize = new GSize(21, 47); icon.shadowSize = new GSize(35, 47); icon.iconAnchor = new GPoint(9, 45); icon.infoWindowAnchor = new GPoint(10,0); icon.transparent=this.srcIconTransparent_; icon.imageMap=[2,2,2,28,8,28,8,47,11,47,11,28,18,28,18,2]; return icon; } ZMarkerGeocoded.prototype.addMouseEvents = function(){ if(this.srcIconHighlight_!=""){ GEvent.clearListeners(this,'mouseover'); GEvent.clearListeners(this,'mouseout'); GEvent.addListener(this,'mouseover',function(){ this.setImage(this.srcIconHighlight_); if(parseInt(document.getElementById(this.listId_).style.width)>0){ document.getElementById(this.listEltName_+this.idZMarkerGeocoded).style.background='#fdf06a'; document.getElementById(this.listEltName_+this.idZMarkerGeocoded).style.cursor='pointer'; } } ); GEvent.addListener(this,'mouseout',function(){ this.setImage(this.srcIcon_); if(parseInt(document.getElementById(this.listId_).style.width)>0){ document.getElementById(this.listEltName_+this.idZMarkerGeocoded).style.background='#ffffff'; document.getElementById(this.listEltName_+this.idZMarkerGeocoded).style.cursor='auto'; } } ); } } function ZPolyline(points, color, weight, opacity, tooltip, dash) { this.tooltip_ = tooltip; this.dash_ = (dash != null) ? dash : "solid"; this.color_ = color; this.weight_ = weight; this.opacity_ = opacity; this.domId_='zpolyline'; this.usesVml = (navigator.userAgent.indexOf("MSIE") != -1); GPolyline.call(this,points,color,weight,opacity); } ZPolyline.prototype = new GPolyline(new Array(new GLatLng(0,0))); ZPolyline.prototype.initialize = function(map) { GPolyline.prototype.initialize.call(this,map); } ZPolyline.prototype.remove = function() { GPolyline.prototype.remove.call(this); } ZPolyline.prototype.redraw = function(force) { GPolyline.prototype.redraw.call(this,force); var elt=null; if(this.usesVml){ var shps = document.getElementsByTagName("shape"); if(shps.length){ elt = shps[shps.length-1]; if(this.tooltip != null){ elt.style.cursor = "help"; elt.title = this.tooltip; } if(this.domId_) elt.id = this.domId_; } } else{ var shps = document.getElementsByTagName("path"); if(shps.length){ elt = shps[shps.length-1]; if(this.tooltip != null){ elt.style.cursor = "help"; elt.setAttribute("title",this.tooltip); } elt.setAttribute("id",this.domId_); elt.setAttribute("pointer-events","stroke"); } } if(elt!=null){ this.setColor(this.color_); this.setDash(this.dash_); this.setOpacity(this.opacity_); this.setWeight(this.weight_); } } ZPolyline.prototype.setColor = function(color){ this.color_ = color; var elt = document.getElementById(this.domId_); if(this.usesVml) elt.stroke.color = this.color_; else elt.setAttribute("stroke",this.color_); } ZPolyline.prototype.getColor = function(){ return this.color_; } ZPolyline.prototype.setDash = function(dash) { this.dash_ = dash; var elt = document.getElementById(this.domId_); if(this.usesVml){ if(this.dash_ == "dash") elt.stroke.dashstyle = "dash"; else if (this.dash_ == "dot") elt.stroke.dashstyle = "dot"; else elt.stroke.dashstyle = ""; } else{ if(this.dash_ == "dash") elt.setAttribute("stroke-dasharray","10,10"); else if (this.dash_ == "dot") elt.setAttribute("stroke-dasharray","3,17"); else elt.setAttribute("stroke-dasharray",""); } } ZPolyline.prototype.getDash = function() { return this.dash_; } ZPolyline.prototype.setWeight = function(weight) { this.weight_ = weight; var elt = document.getElementById(this.domId_); if(this.usesVml) elt.stroke.weight = this.weight_+"px"; else elt.setAttribute("stroke-width",this.weight_+"px"); } ZPolyline.prototype.getWeight = function() { return this.weight_; } ZPolyline.prototype.setOpacity = function(opacity) { this.opacity_ = opacity; var elt = document.getElementById(this.domId_); if(this.usesVml) elt.stroke.opacity = this.opacity_; else elt.setAttribute("stroke-opacity",this.opacity_); } ZPolyline.prototype.getOpacity = function() { return this.opacity_; } ZPolyline.prototype.setDOMId = function(id) { this.domId_=id; } function ZForm(){} ZForm.prototype=ZForm; ZForm.prototype.buildOnglet = function(codeLangue, selected){ var onglet = document.createElement('div'); onglet.setAttribute('id','onglet_'+codeLangue); if(ZForm.languages[codeLangue]) onglet.setAttribute('title',ZForm.languages[codeLangue]); if (isIE()){ onglet.setAttribute("className","div-onglet"); onglet.onmouseover=function(){this.style.cursor='pointer'}; onglet.onmouseout=function(){this.style.cursor='auto'}; onglet.onclick=ZForm.showOnglet; } else{ onglet.setAttribute("class","div-onglet"); onglet.setAttribute("onclick","ZForm.showOnglet('"+codeLangue+"')"); onglet.setAttribute("onmouseover","this.style.cursor='pointer'"); onglet.setAttribute("onmouseout","this.style.cursor='auto'"); } onglet.setAttribute("title",ZForm.languages[codeLangue]); onglet.innerHTML=codeLangue; if(selected) onglet.style.fontWeight='bold'; return onglet; } ZForm.prototype.buildForm = function(codeLangue,labels, selected){ var corps = document.createElement('div'); corps.setAttribute('id','form_'+codeLangue); corps.setAttribute("class","div-form"); corps.setAttribute("className","div-form"); //corps.innerHTML='
'+ZForm.languages[codeLangue]+'
' corps.innerHTML='
' +'' +'' +'' +'' +'' +'' +'
' +'
' +'' +'' +'
' +'' +''; if(selected) corps.style.display='block'; else corps.style.display='none'; return corps; } ZForm.prototype.buildFormPicture = function(codeLangue,labels, seleted){ var corps = document.createElement('div'); corps.setAttribute('id','form_'+codeLangue); corps.setAttribute("class","div-form"); corps.setAttribute("className","div-form"); var html = '
'+ZForm.languages[codeLangue]+'
'; for(var i=0;i<9;i++){ reste=i-(Math.floor(i/2)*2); html +='
' +'' +'
'; } corps.innerHTML=html; if(selected) corps.style.display='block'; else corps.style.display='none'; return corps; } ZForm.prototype.buildOngletLangue = function(){ var onglet = document.createElement('div'); onglet.setAttribute('id','onglet_lang'); if (isIE()){ onglet.onmouseover=function(){this.style.cursor='pointer'}; onglet.onmouseout=function(){this.style.cursor='auto'}; onglet.onclick=ZForm.showOnglet; } else{ onglet.setAttribute("onclick","ZForm.showOnglet('lang')"); onglet.setAttribute("onmouseover","this.style.cursor='pointer'"); onglet.setAttribute("onmouseout","this.style.cursor='auto'"); } onglet.innerHTML=ZForm.lblLanguages; return onglet; } ZForm.prototype.buildFormLangue = function(selLang){ var corps = document.createElement('div'); corps.setAttribute('id','form_lang'); corps.setAttribute("class","div-form"); corps.setAttribute("className","div-form"); var element = document.createElement('select'); element.setAttribute('id','selLangue'); element.setAttribute('name','selLangue'); element.setAttribute("title","Ajouter une langue"); var option = document.createElement('option'); option.setAttribute('id','selLangue_0'); option.setAttribute('value',''); option.innerHTML=ZForm.labels.langFirstOpt; element.appendChild(option); for(var codeLangue in ZForm.languages){ option = document.createElement('option'); option.setAttribute('id','selLangue_'+codeLangue); option.setAttribute('value',codeLangue); option.innerHTML=ZForm.languages[codeLangue]; element.appendChild(option); } delete option; corps.appendChild(element); var element= document.createElement('input'); element.setAttribute('type','button'); element.setAttribute("name","add_langue"); element.setAttribute("id","add_langue"); element.setAttribute("value",ZForm.labels.addButton); if (isIE()) element.onclick=ZForm.addLanguage; else element.setAttribute("onclick","ZForm.addLanguage()"); corps.appendChild(element); var element= document.createElement('h6'); element.innerHTML=ZForm.labels.languagesTableTitle; corps.appendChild(element); var element= document.createElement('table'); element.setAttribute("id","list_lang"); element.setAttribute("cellspacing","0"); element.setAttribute("cellpadding","0"); element.setAttribute("id","list_lang"); var tbody=document.createElement('tbody'); ZForm.buildListLanguages(tbody,selLang); element.appendChild(tbody); delete tbody; corps.appendChild(element); delete element; return corps; } ZForm.prototype.initialize = function(parentDiv,selLang,labels){ if(parentDiv) { var divOnglets=document.createElement('div'); divOnglets.setAttribute('id','onglets'); var divForms=document.createElement('div'); divForms.setAttribute('id','forms'); for(var i=0;i'+ZForm.languages[codeLangue]+''; tr.appendChild(td); td_count++; reste=td_count-(Math.floor(td_count/cols)*cols); if(reste==0) parent.appendChild(tr); } i++; } if(!td_count){ tr = document.createElement('tr'); td = document.createElement('td'); td.innerHTML='Aucune'; tr.appendChild(td); parent.appendChild(tr); } //return tbody; } ZForm.prototype.languageExists = function(codeLangue){ var exists=false, divOnglets=document.getElementById('onglets'), i=0; while(!exists && i2 && document.getElementById('onglet_'+codeLangue) && document.getElementById('onglet_'+codeLangue).parentNode.getAttribute('id')=='onglets'){ divOnglets.removeChild(document.getElementById('onglet_'+codeLangue)); divForms.removeChild(document.getElementById('form_'+codeLangue)); ZForm.clearListLanguages(); ZForm.listLanguages(); } } } ZForm.prototype.addForm = function(codeLangue) { var divOnglets=document.getElementById('onglets'); var divForms=document.getElementById('forms'); divOnglets.insertBefore(ZForm.buildOnglet(codeLangue),divOnglets.childNodes[divOnglets.childNodes.length-1]); if(divForms.parentNode.getAttribute('id')=='titles') divForms.insertBefore(ZForm.buildFormPicture(codeLangue),divForms.childNodes[divForms.childNodes.length-1]); else divForms.insertBefore(ZForm.buildForm(codeLangue),divForms.childNodes[divForms.childNodes.length-1]); } ZForm.prototype.setFieldValueForLanguage = function(id_field,codeLangue,value){ if(document.getElementById(id_field+'_'+codeLangue)){ document.getElementById(id_field+'_'+codeLangue).value=value; return true; } else return false; } ZForm.prototype.getFieldValueForLanguage = function(id_field,codeLangue){ if(document.getElementById(id_field+'_'+codeLangue)) return trim(document.getElementById(id_field+'_'+codeLangue).value); else return ''; } ZForm.prototype.setFieldValue = function(id_field,value){ if(document.getElementById(id_field)){ document.getElementById(id_field).value=value; return true; } else return false; } ZForm.prototype.getFieldValue = function(id_field){ if(document.getElementById(id_field)) return trim(document.getElementById(id_field).value); else return ''; } ZForm.prototype.setValuesFor = function(name,value){ var div=document.getElementById('forms'); for(var i=0;i0) dLanguages+=';'; dLanguages+=lang; var j=0; while(j'+text+''; } ZForm.prototype.resetDialog = function(){ document.getElementById('form_res').style.background='none'; document.getElementById('form_res').innerHTML=' '; } ZForm.prototype.proccessingDialog = function(text){ document.getElementById('form_res').style.background='url(img/loading_16x16.gif) 5px 0px no-repeat'; document.getElementById('form_res').innerHTML=text; } ZForm.prototype.lock = function(on){ if(on) ZForm.locked=true; else ZForm.locked=false; var forms=document.getElementById('forms').getElementsByTagName('div'); for(var i=0;i0){ setFsDefaultValue(); resetSearchForm(); resetSearchCriteria(); var direction=-1; } else{ buildList(zMap,zMarkers,zMarkersGeocoded); var direction=1; } widthes=getWidthes(outter_container_width,direction,20); movediv(outter_container_div,icon_list_div,0,10); } function movediv(div,divTab,step,timelaps){ if (step0){ document.getElementById('form_fast_search').style.visibility="hidden"; document.getElementById(divTab).style.backgroundImage='url(img/hide-arrow.png)'; } else{ setDefaultValue(); removeGeocodedMarkers(); document.getElementById(divTab).style.backgroundImage='url(img/show-arrow.png)'; document.getElementById('form_fast_search').style.visibility="visible"; } //zMap.panBy(new GSize(direction*outter_container_width*(-1)/2,0)); delete widthes; fitInfoWindowInMap(); clearTimeout(moveid); } } function getWidthes(bound,direction,nb_steps){ var res=new Array(),i=0,width=(direction>0?0:bound); while((direction>0 && width0)){ width=0.5*(1-(direction*Math.cos(Math.PI*i/nb_steps)))*bound; if(width>bound) width=bound; else if(width<0) width=0; res[i]=width; i++; } return res; } function buildList(map,markers,geocodedMarkers){ var idCateg=0; var dt=null; var dd=null; var span = null; emptyList(); var dl = document.getElementById('dl_list_content'); if(geocodedMarkers.length){ var center = map.getCenter(); dt=document.createElement('dt'); if(isIE()) dt.style.setAttribute('cssText','color:#ff2020;'); else dt.setAttribute('style','color:#ff2020;'); dt.appendChild(document.createTextNode(map.zGeocoder.getListLabel())); dl.appendChild(dt); for(var i in geocodedMarkers){ dd=document.createElement('dd'); dd.setAttribute('id','list_eltg'+geocodedMarkers[i].getId()); dd.setAttribute('zmarkergeoid',geocodedMarkers[i].getId()); if(isIE()) dd.style.setAttribute('cssText','color:#000000;'); else dd.setAttribute('style','color:#000000;'); ZEvent.addEventListener(dd,'mouseout',listElementMouseEvent,false); ZEvent.addEventListener(dd,'mouseover',listElementMouseEvent,false); ZEvent.addEventListener(dd,'click',listElementMouseEvent,false); span = document.createElement('span'); if(isIE()) span.style.setAttribute('cssText','color:#ff2020;'); else span.setAttribute('style','color:#ff2020;'); span.appendChild(document.createTextNode(meterToKM(center.distanceFrom(geocodedMarkers[i].getPoint()),2)+' km')); dd.appendChild(document.createTextNode(geocodedMarkers[i].getLocation()+' ')); dd.appendChild(span); dl.appendChild(dd); } } if(markers.length){ for(var i in markers){ if(markers[i].isOnMap){ if(idCateg!=markers[i].categorie_.id){ dt=document.createElement('dt'); if(isIE()) dt.style.setAttribute('cssText','color:#'+markers[i].categorie_.color+';'); else dt.setAttribute('style','color:#'+markers[i].categorie_.color+';'); dt.appendChild(document.createTextNode(markers[i].categorie_.name)); dl.appendChild(dt); idCateg=markers[i].categorie_.id; } var dd=document.createElement('dd'); dd.setAttribute('id','list_elt'+markers[i].idZMarker); dd.setAttribute('zmarkerid',markers[i].idZMarker); if(isIE()) dd.style.setAttribute('cssText','color:#000000;'); else dd.setAttribute('style','color:#000000;'); ZEvent.addEventListener(dd,'mouseout',listElementMouseEvent,false); ZEvent.addEventListener(dd,'mouseover',listElementMouseEvent,false); ZEvent.addEventListener(dd,'click',listElementMouseEvent,false); span = document.createElement('span'); if(isIE()) span.style.setAttribute('cssText','color:#'+markers[i].categorie_.color+';'); else span.setAttribute('style','color:#'+markers[i].categorie_.color+';'); span.appendChild(document.createTextNode(meterToKM(markers[i].getDistanceToCenter(),2)+' km')); dd.appendChild(document.createTextNode(markers[i].title_[markers[i].lang_]+' ')); dd.appendChild(span); dl.appendChild(dd); } } } //GLog.write(innerHTML); addListResultWarning(map); } function emptyList(){ var dl = document.getElementById('dl_list_content'); while(dl.hasChildNodes()){ ZEvent.dispatchEvent(dl.firstChild,'MouseEvents','mouseout'); ZEvent.removeEventListener(dl.firstChild,'mouseout',listElementMouseEvent,false); ZEvent.removeEventListener(dl.firstChild,'mouseover',listElementMouseEvent,false); ZEvent.removeEventListener(dl.firstChild,'click',listElementMouseEvent,false); dl.removeChild(dl.firstChild); } } function addListResultWarning(map){ if(map.getNbVisibleMarkers()==0 || map.getNbVisibleMarkers()==map.getMaxMarkers()){ var dl = document.getElementById('dl_list_content'); var dt = document.createElement('dt'); if(isIE()) dt.style.setAttribute('cssText','color:#bf282d;'); else dt.setAttribute('style','color:#bf282d;'); if(map.getNbVisibleMarkers()==0){ dt.appendChild(document.createTextNode(map.getListNoResultLabel())); dl.appendChild(dt); } else{ dt.appendChild(document.createTextNode(map.getListMaxResultsLabel())); dl.insertBefore(dt,dl.firstChild); } } } function listElementMouseEvent(e){ var zEvent = new ZEvent(e); var zMarkerId = zEvent.source.getAttribute('zmarkerid')?zEvent.source.getAttribute('zmarkerid'):(zEvent.source.parentNode.getAttribute('zmarkerid')?zEvent.source.parentNode.getAttribute('zmarkerid'):null); var zMarkerGeoId = zEvent.source.getAttribute('zmarkergeoid')?zEvent.source.getAttribute('zmarkergeoid'):(zEvent.source.parentNode.getAttribute('zmarkergeoid')?zEvent.source.parentNode.getAttribute('zmarkergeoid'):null); if(zMarkerId && isPOIDrawn(zMarkerId)){ GEvent.trigger(zMarkers[zMarkerId],zEvent.type); if(zEvent.type=='click' && zMap.getZoom()<14) zMap.setCenter(zMarkers[zMarkerId].getPoint(),14); else if(zEvent.type=='mouseover') zMarkers[zMarkerId].drawLineToCenter(); else if(zEvent.type=='mouseout') zMarkers[zMarkerId].removeLineToCenter(); } else if(zMarkerGeoId && isGeocodedPOIDrawn(zMarkerGeoId)){ GEvent.trigger(zMarkersGeocoded[zMarkerGeoId],zEvent.type); if(zEvent.type=='click') zMap.setCenter(zMarkersGeocoded[zMarkerGeoId].getPoint(),zMarkersGeocoded[zMarkerGeoId].getZoomLevel()); else if(zEvent.type=='mouseover') zMarkersGeocoded[zMarkerGeoId].drawLineToCenter(); else if(zEvent.type=='mouseout') zMarkersGeocoded[zMarkerGeoId].removeLineToCenter(); } } function setElementState(elt,state,refresh){ if (refresh || state != elt.getAttribute('state')) { elt.setAttribute('state', state); if (elt.nodeName.toLowerCase() == 'th') { elt.setAttribute("class","th_icon_"+elt.getAttribute('value')+'_'+state); elt.setAttribute("className","th_icon_"+elt.getAttribute('value')+'_'+state); checkOthersState((state == 'on' ? true : false)); } else{ if(state=='on'){ elt.setAttribute("class","cl_icon_"+elt.getAttribute('value')); elt.setAttribute("className","cl_icon_"+elt.getAttribute('value')); } else{ elt.setAttribute("class","cl_icon_off"); elt.setAttribute("className","cl_icon_off"); } } } } function updateSelectedCategories(elt){ if(!elt && isIE()) elt=window.event.srcElement; var state=elt.getAttribute('state'); var value=elt.getAttribute('value'); if(state=='on'){ if(value!='autres'){ setElementState(elt,'off',false); removeFromSelectedCategories(value); } else{ var th=document.getElementById('categ_sub_list').getElementsByTagName('th'); for(var i=0;i