1?optForm:null)),optInfoWindow);
this.map_.setZMarkerWithInfoWindow(this.idZMarker);
}
ZMarker.prototype.setZInfoWindowPosition = function(){
this.map_.getInfoWindow().reset(this.getPoint(),null,new GSize(620,280),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().reset( zMarkerManager.markers['+this.idZMarker+'].getPoint(), null, new GSize(620,280), new GSize(0,' + (-this.getIcon().iconSize.height-offsetHeight) + '))',(500/this.getIcon().maxHeight));
}
}
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 || '';
this.cancelLabel_ = options.cancelLabel || "";
this.saveLabel_ = options.saveLabel || "";
this.cancelFn_ = options.cancelFn || "";
this.saveFn_ = options.saveFn || "";
this.lang_ = options.lang || "";
//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(){
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,this.lang_);
element = document.createElement('div');
element.id='buttons';
var button = document.createElement('input');
button.id='annuler';
button.setAttribute('type','button');
button.setAttribute('value',this.cancelLabel_);
GEvent.addDomListener(button,'click',this.cancelFn_);
element.appendChild(button);
button = document.createElement('input');
button.id='valider';
button.setAttribute('type','button');
button.setAttribute('value',this.saveLabel_);
GEvent.addDomListener(button,'click',this.saveFn_);
element.appendChild(button);
info_window.appendChild(element);
return info_window;
}
ZMarkerTemp.prototype.openZInfoWindow = function(options){
options.pixelOffset=new GSize(0,-this.getIcon().iconSize.height);
this.map_.setZMarkerTempWithInfoWindow();
this.openInfoWindow(this.getZInfoWindowContent(),options);
}
ZMarkerTemp.prototype.setZInfoWindowPosition = function(){
this.map_.getInfoWindow().reset(this.getPoint(), null, new GSize(620,280),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().reset(zMarkerTemp.getPoint(), null, new GSize(620,280),new GSize(0,'+(-this.getIcon().iconSize.height-offsetHeight)+'))',(500/this.getIcon().maxHeight));
}
}
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, zoomolevel, options ) {
this.isZMarkerGeocoded = true;
this.idZMarkerGeocoded = null;
this.drawn = false;
this.isDrawn_ = false;
this.zoomLevel_ = zoomolevel;
this.labels_ = options ? ( options.labels || null ) : null;
this.postFormFn_ = options ? ( options.postFormFn || null ) : null;
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.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 div = document.createElement('div');
div.id = 'info_geocoded';
var h5 = document.createElement('h5');
h5.appendChild( document.createTextNode( this.labels_.title + ' : ' ) );
div.appendChild( h5 );
div.appendChild(document.createTextNode(this.location_));
var formDiv = document.createElement('div');
formDiv.id = 'info_geocoded_toform';
formDiv.appendChild( document.createTextNode( this.labels_.directions + ' : ') );
var span = document.createElement('span');
span.appendChild( document.createTextNode( this.labels_.to ) );
formDiv.appendChild( span );
formDiv.appendChild( document.createTextNode( ' - ' ) );
var a = document.createElement('a');
a.setAttribute( 'href', 'javascript:zMarkerManager.geocodedMarkers['+this.idZMarkerGeocoded+'].switchForm();' );
a.appendChild( document.createTextNode( this.labels_.from ) );
formDiv.appendChild( a );
formDiv.appendChild( document.createElement('br') )
span = document.createElement('label');
span.setAttribute('for', 'txtIfFrom');
span.appendChild( document.createTextNode( this.labels_.startAddress ) );
formDiv.appendChild( span );
var input = document.createElement('input');
input.id = 'txtIfFrom';
input.setAttribute('type', 'text');
formDiv.appendChild( input );
input = document.createElement('input');
input.id = 'bt_txtFrom';
input.setAttribute('type', 'button');
input.setAttribute('value', this.labels_.ok);
formDiv.appendChild( input );
div.appendChild(formDiv);
var zMarkerGeocoded_ = this;
GEvent.addDomListener(input, 'click', function(e)
{
zMarkerGeocoded_.postForm();
}
);
formDiv = document.createElement('div');
formDiv.id = 'info_geocoded_fromform';
formDiv.appendChild( document.createTextNode( this.labels_.directions + ' : ' ) );
a = document.createElement('a');
a.setAttribute( 'href', 'javascript:zMarkerManager.geocodedMarkers['+this.idZMarkerGeocoded+'].switchForm();' );
a.appendChild( document.createTextNode( this.labels_.to ) );
formDiv.appendChild( a );
formDiv.appendChild( document.createTextNode( ' - ' ) );
span = document.createElement('span');
span.appendChild( document.createTextNode( this.labels_.from ) );
formDiv.appendChild( span );
formDiv.appendChild( document.createElement('br') )
span = document.createElement('label');
span.setAttribute('for', 'txtIfTo');
span.appendChild( document.createTextNode( this.labels_.endAddress ) );
formDiv.appendChild( span );
var input = document.createElement('input');
input.id = 'txtIfTo';
input.setAttribute('type', 'text');
formDiv.appendChild( input );
input = document.createElement('input');
input.id = 'bt_txtTo';
input.setAttribute('type', 'button');
input.setAttribute('value', this.labels_.ok);
formDiv.appendChild( input );
div.appendChild(formDiv);
GEvent.addDomListener(input, 'click', function(e)
{
zMarkerGeocoded_.postForm();
}
);
this.openInfoWindow( div, options);
this.map_.setZMarkerGeoWithInfoWindow(this.getId());
}
ZMarkerGeocoded.prototype.switchForm = function()
{
var fromForm = document.getElementById('info_geocoded_fromform');
var toForm = document.getElementById('info_geocoded_toform');
if(fromForm && toForm)
{
if(fromForm.style.display != 'block')
{
toForm.style.display = 'none';
fromForm.style.display = 'block';
}
else
{
fromForm.style.display = 'none';
toForm.style.display = 'block';
}
}
}
ZMarkerGeocoded.prototype.postForm = function()
{
var from, to;
var fromForm = document.getElementById('info_geocoded_fromform');
var toForm = document.getElementById('info_geocoded_toform');
if(fromForm && toForm)
{
if(fromForm.style.display != 'block')
{
to = this.location_;
from = document.getElementById('txtIfFrom').value;
}
else
{
to = document.getElementById('txtIfTo').value;
from = this.location_;
}
if(from && to && this.postFormFn_)
this.postFormFn_(from, to);
}
}
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]+'
'
html = ''
+ '';
for( var i = 1; i <= 5; i++ )
{
html += '';
}
html += '
'
+''
+ ''
+ ''
+ ''
+ ''
+ ''
+ ''
+'
'
+''
+ ''
+ ''
+'
';
corps.innerHTML = html;
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");
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 document.getElementById(id_field+'_'+codeLangue).value.trim();
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 document.getElementById(id_field).value.trim();
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;i this.minWidth_;
}
ZPanel.prototype.displayDirectionsPanel = function()
{
this.searchPanel_.style.display = 'none';
this.directionsPanel_.style.display = 'inline';
}
ZPanel.prototype.displaySearchPanel = function()
{
gDirections.clear();
this.directionsPanel_.style.display = 'none';
this.searchPanel_.style.display = 'inline';
}
ZPanel.prototype.swapDirectionsFormValues = function()
{
var temp = document.getElementById('txtFrom').value;
document.getElementById('txtFrom').value = document.getElementById('txtTo').value;
document.getElementById('txtTo').value = temp;
}
ZPanel.prototype.display = function()
{
if( this.isOpen() )
{
this.resetSearchForm();
this.resetFastSearchForm();
var offset = (this.maxWidth_ - this.minWidth_) / 2;
this.container_.style.width = this.minWidth_ + 'px';
this.tab_.style.right = this.minWidth_ + 'px';
this.tab_.style.backgroundImage='url(img/show-arrow.png)';
if(isIE6())
this.map_.getContainer().style.width = ((document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth) - this.minWidth_) + 'px';
else
this.map_.getContainer().style.right = this.minWidth_ + 'px';
this.fastSearchForm_.style.visibility="visible";
this.markerManager_.removeGeocodedMarkers();
this.centerCross_.style.display = 'none';
this.displaySearchPanel();
if(this.onCloseFn_)
this.onCloseFn_();
}
else
{
this.buildList();
var offset = (this.minWidth_ - this.maxWidth_) / 2;
this.container_.style.width = this.maxWidth_ + 'px';
this.tab_.style.right = this.maxWidth_ + 'px';
this.tab_.style.backgroundImage='url(img/hide-arrow.png)';
if(isIE6())
this.map_.getContainer().style.width = ((document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth) - this.maxWidth_) + 'px';
else
this.map_.getContainer().style.right = this.maxWidth_ + 'px';
this.fastSearchForm_.style.visibility="hidden";
this.centerCross_.style.display = 'block';
if(this.onOpenFn_)
this.onOpenFn_();
}
this.map_.checkResize()
this.map_.panBy(new GSize(offset,0));
}
ZPanel.prototype.buildList = function()
{
var idCateg=0;
var dt=null;
var dd=null;
var span = null;
this.emptyList();
if(this.markerManager_.geocodedMarkers.length)
{
var center = this.map_.getCenter();
dt = document.createElement('dt');
if(isIE())
dt.style.setAttribute('cssText','color:#ff2020;');
else
dt.setAttribute('style','color:#ff2020;');
dt.appendChild( document.createTextNode( this.markerManager_.listGeolocalisationLabel ) );
this.listContainer_.appendChild(dt);
for(var i in this.markerManager_.geocodedMarkers)
{
if(!isNaN(i))
{
dd = document.createElement('dd');
dd.setAttribute('id','list_eltg' + this.markerManager_.geocodedMarkers[i].getId());
dd.setAttribute('zmarkergeoid',this.markerManager_.geocodedMarkers[i].getId());
if(isIE())
dd.style.setAttribute('cssText','color:#000000;');
else
dd.setAttribute('style','color:#000000;');
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(this.markerManager_.geocodedMarkers[i].getPoint()),2)+' km') );
dd.appendChild( document.createTextNode(this.markerManager_.geocodedMarkers[i].getLocation()+' ') );
dd.appendChild( span );
ZEvent.addEventListener(dd, 'mouseout', this.listElementMouseEvent,false);
ZEvent.addEventListener(dd, 'mouseover', this.listElementMouseEvent,false);
ZEvent.addEventListener(dd, 'click', this.listElementMouseEvent,false);
this.listContainer_.appendChild( dd );
}
}
}
if(this.markerManager_.markers.length)
{
for(var i in this.markerManager_.markers)
{
if(!isNaN(i) && this.markerManager_.markers[i].isOnMap)
{
if(idCateg != this.markerManager_.markers[i].categorie_.id)
{
dt=document.createElement('dt');
if(isIE())
dt.style.setAttribute('cssText','color:#'+this.markerManager_.markers[i].categorie_.color+';');
else
dt.setAttribute('style','color:#'+this.markerManager_.markers[i].categorie_.color+';');
dt.appendChild(document.createTextNode(this.markerManager_.markers[i].categorie_.name));
this.listContainer_.appendChild(dt);
idCateg = this.markerManager_.markers[i].categorie_.id;
}
var dd=document.createElement('dd');
dd.setAttribute('id','list_elt'+this.markerManager_.markers[i].idZMarker);
dd.setAttribute('zmarkerid',this.markerManager_.markers[i].idZMarker);
span = document.createElement('span');
if(isIE())
span.style.setAttribute('cssText','font-weight:bold;');
else
span.setAttribute('style','font-weight:bold;');
span.appendChild( document.createTextNode(this.markerManager_.markers[i].title_[this.markerManager_.markers[i].lang_]+' ') );
dd.appendChild( span );
span = document.createElement('span');
if(isIE())
span.style.setAttribute('cssText','color:#'+this.markerManager_.markers[i].categorie_.color+';');
else
span.setAttribute('style','color:#'+this.markerManager_.markers[i].categorie_.color+';');
span.appendChild( document.createTextNode(meterToKM(this.markerManager_.markers[i].getDistanceToCenter(),2)+' km') );
dd.appendChild(span);
dd.appendChild(document.createElement('br'));
dd.appendChild(document.createTextNode( this.markerManager_.markers[i].address_[this.markerManager_.markers[i].lang_]) );
ZEvent.addEventListener(dd, 'mouseout', this.listElementMouseEvent,false);
ZEvent.addEventListener(dd, 'mouseover', this.listElementMouseEvent,false);
ZEvent.addEventListener(dd, 'click', this.listElementMouseEvent,false);
this.listContainer_.appendChild( dd );
}
}
}
this.addResultWarning();
}
ZPanel.prototype.emptyList = function()
{
while(this.listContainer_.hasChildNodes())
{
ZEvent.dispatchEvent(this.listContainer_.firstChild, 'MouseEvents', 'mouseout');
ZEvent.removeEventListener(this.listContainer_.firstChild, 'mouseout', this.listElementMouseEvent,false);
ZEvent.removeEventListener(this.listContainer_.firstChild, 'mouseover', this.listElementMouseEvent,false);
ZEvent.removeEventListener(this.listContainer_.firstChild, 'click', this.listElementMouseEvent,false);
this.listContainer_.removeChild(this.listContainer_.firstChild);
}
}
ZPanel.prototype.addResultWarning = function()
{
if( this.markerManager_.visibleMarkers == 0 || this.markerManager_.visibleMarkers == this.markerManager_.maxMarkers )
{
var dt = document.createElement('dt');
if(isIE())
dt.style.setAttribute('cssText','color:#bf282d;');
else
dt.setAttribute('style','color:#bf282d;');
if( this.markerManager_.visibleMarkers ==0 )
{
dt.appendChild(document.createTextNode(this.markerManager_.listNoResultLabel));
this.listContainer_.appendChild(dt);
}
else
{
dt.appendChild(document.createTextNode(this.markerManager_.listMaxResultsLabel));
this.listContainer_.insertBefore(dt,this.listContainer_.firstChild);
}
}
}
ZPanel.prototype.resetSearchForm = function()
{
this.resetForm( this.searchForm_ )
}
ZPanel.prototype.resetFastSearchForm = function()
{
this.resetForm( this.fastSearchForm_ )
}
ZPanel.prototype.resetForm = function( form )
{
var inputs = form.getElementsByTagName('input');
for(var i = 0; i < inputs.length; i++)
{
if(inputs[i].getAttribute('type') != 'button')
{
if(inputs[i].getAttribute('type') == 'radio' || inputs[i].getAttribute('type')=='checkbox')
inputs[i].checked = false;
else
inputs[i].value = inputs[i].getAttribute('default_value') ? inputs[i].getAttribute('default_value') : '';
}
}
var selects = form.getElementsByTagName('select');
for(var i = 0; i < selects.length; i++)
{
selects[i].value = selects[i].getAttribute('default_value') ? selects[i].getAttribute('default_value') : '';
}
}
function ZCategoriesManager(categories, options)
{
this.categories_ = categories || [];
this.selected_ = [];
this.idPrefix_ = options.id_Prefix || 'a-category-';
this.classPrefix_ = options.classPrefix || 'cl-category-';
this.onUpdateFn_ = options.onUpdateFn || null;
}
ZCategoriesManager.prototype.update = function( id )
{
var elt = document.getElementById( this.idPrefix_ + id );
var exp = new RegExp('^'+this.classPrefix_+'(\\d+)-(on|off)$');
exp.exec(elt.className);
var state = RegExp.$2;
if( state == 'on' )
{
elt.className = this.classPrefix_ + id + '-off';
this.removeFromSelected( id );
}
else if( state == 'off' )
{
elt.className = this.classPrefix_ + id + '-on';
this.addToSelected( id );
}
this.setGroup( this.categories_[id] );
if( this.onUpdateFn_ )
this.onUpdateFn_(true);
}
ZCategoriesManager.prototype.setGroup = function( id )
{
var a = document.getElementById('ul-category-' + id).getElementsByTagName('a');
var selected = false, i = 0, exp = new RegExp('^'+this.classPrefix_+'(\\d+)-(on|off)$');
while( !selected && i < a.length )
{
exp.exec(a[i].className);
if( RegExp.$2 == 'on' )
selected = true;
i++;
}
if( selected )
document.getElementById('a-group-' + id).className = "cl-groups-" + id;
else
document.getElementById('a-group-' + id).className = "cl-groups-off";
}
ZCategoriesManager.prototype.updateGroup = function( id )
{
var group = document.getElementById('a-group-' + id);
var a = document.getElementById('ul-category-' + id).getElementsByTagName('a');
var select, i = 0, exp = new RegExp('^'+this.classPrefix_+'(\\d+)-(on|off)$');
if( group.className != "cl-groups-off" )
{
group.className = "cl-groups-off";
select = false;
}
else
{
group.className = "cl-groups-" + id;
select = true;
}
while( i < a.length )
{
exp.exec(a[i].className);
if( !select && RegExp.$2 == 'on' )
{
a[i].className = this.classPrefix_ + RegExp.$1 + '-off';
this.removeFromSelected( RegExp.$1 );
}
else if( select && RegExp.$2 == 'off' )
{
a[i].className = this.classPrefix_ + RegExp.$1 + '-on';
this.addToSelected( RegExp.$1 );
}
i++;
}
if( this.onUpdateFn_ )
this.onUpdateFn_(true);
}
ZCategoriesManager.prototype.getSelected = function(){
return this.selected_.join(';');
}
ZCategoriesManager.prototype.setSelected = function( arr ){
this.selected_ = arr;
}
ZCategoriesManager.prototype.addToSelected = function( id )
{
this.selected_.push(id);
}
ZCategoriesManager.prototype.removeFromSelected = function( id )
{
var idx = this.selected_.search(id);
while( idx != -1 )
{
this.selected_.splice(idx, 1);
idx = this.selected_.search(id);
}
}
ZCategoriesManager.prototype.init = function(str_categ)
{
var values = str_categ.split(';');
this.setSelected( values );
var ul = document.getElementById('header').getElementsByTagName('ul');
var exp = new RegExp('^'+this.classPrefix_+'(\\d+)-(on|off)$');;
for( var i = 0; i < ul.length; i++ )
{
if(ul[i].id.indexOf('ul-category') >= 0)
{
var a = ul[i].getElementsByTagName('a');
for( var j = 0; j < a.length; j++ )
{
exp.exec(a[j].className);
if( values.search( RegExp.$1 ) >= 0 )
a[j].className = this.classPrefix_ + RegExp.$1 + '-on';
else
a[j].className = this.classPrefix_ + RegExp.$1 + '-off';
this.setGroup( this.categories_[RegExp.$1] );
}
}
}
delete values;
}
ZCategoriesManager.prototype.updateAll = function( state )
{
this.setSelected( [] );
var ul = document.getElementById('header').getElementsByTagName('ul');
var exp = new RegExp('^'+this.classPrefix_+'(\\d+)-(on|off)$');;
for( var i = 0; i < ul.length; i++ )
{
if(ul[i].id.indexOf('ul-category') >= 0)
{
var a = ul[i].getElementsByTagName('a');
for( var j = 0; j < a.length; j++ )
{
exp.exec(a[j].className);
a[j].className = this.classPrefix_ + RegExp.$1 + '-' + state;
this.setGroup( this.categories_[RegExp.$1] );
if(state == 'on')
this.addToSelected( RegExp.$1 );
}
}
}
}
function resetSearchCriteria()
{
if(sText != '' || sCategory != '')
{
sText = '';
sCategory = '';
loadPOI(true);
}
}