﻿var mylat=43.53;
var mylong=6.46;
var blresults=[];
var fL=[];
var MyT={};
var pon=true;
var fon=true;
var i_1=null;
var i_2=null;
var fOL=[];
var pOL=[];
var d_=null;
var xmap=null;
var zi=0;
var brow=typeof(window.pageYOffset)=="undefined"?1:0;
 var $=function(id) {
 return document.getElementById(id);
 };

 var $$=function(xelement){ var a=document.createElement(xelement);
 a=$I(a);
 a.$s=a.style;
 return a;
 };
 
  var $I=function(a){ try {a.$a=a.appendChild;
	} catch(ee) {};
 try {a.$r=a.removeChild;
} catch(ee) {};
 try {a.$c=a.childNodes;
} catch(ee) {};
 return a;
 };
 
  var Float=function(obj,fl) { obj.$s.styleFloat=fl;
 obj.$s.cssFloat=fl;
 };
  var SP=function(yurl,tab) { var xhr_object = null;
 var xdata = '';
 if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest();
 else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
  if (xhr_object) { xhr_object.open("POST", yurl, false);
  for (var i=0;
i<tab.length;
i++) { xdata += tab[i][0]+'='+tab[i][1]+'&';
 }xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 xhr_object.send(xdata);
 return (xhr_object.status == 200)?xhr_object:false;
 } };
  var sA=function(yurl,tab) { var xhr_object = null;
 var data = '';
 if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest();
 else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
 if (xhr_object) { xhr_object.open("POST", yurl, false);
 for (var i=0;
i<tab.length;
i++) { data += tab[i][0]+'='+tab[i][1]+'&';
 }xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 xhr_object.send(data);
 return (xhr_object.status == 200)?xhr_object:false;
 } };
  var iXML=function(string) { if (window.ActiveXObject) { var obj = new ActiveXObject("Microsoft.XMLDOM" );
 obj.loadXML(string);
} else if (window.XMLSerializer) { var  obj = (new DOMParser()).parseFromString(string,"text/xml" );
 } return obj;
 };
  var iXMLA=function(myxml) { var G=new Array();
 var res=[];
 res=XMLA(myxml.childNodes[0],G);
 return res;
 };
  var XMLA=function(child,Myarr) { try { if ((child.nodeType==1)) { for (var j=0;
j<child.childNodes.length;
j++) { if (((child.childNodes[j].nodeType==3)||(child.childNodes[j].nodeType==4))&&(child.childNodes[j].nodeValue!=null)) { try { Myarr=decodeURIComponent(child.childNodes[j].nodeValue);
 } catch(ee) { Myarr=child.childNodes[j].nodeValue;
 } } else { Myarr.push(XMLA(child.childNodes[j],[]));
 } } } return Myarr;
 } catch(ee) { return [];
 } };
  var geoip=function() {  try {  var geoipg2=google.loader.ClientLocation;
  if ((typeof(geoipg2)!="undefined")&&(geoipg2!=null)) {  mylat=geoipg2.latitude;
 mylong=geoipg2.longitude;
  } else { geoip2();
 }  } catch(ee) { geoip2();
 }  };
  var geoip2=function() {  var p_g=iXML(geoipg.responseText);
 p_g=iXMLA(p_g);
  mylat=p_g[0];
 mylong=p_g[1];
  };
  var loadMap=function() {
  pOL=[];
  fOL=[];
  try {stopanimation();
} catch(ee) {};
  var cmap=document.getElementById('map');
  cmap.innerHTML='';
  var imap=$$('DIV');
 imap.$s.width='100%';
 imap.$s.height='45px';
 imap.$s.marginTop='-10px';
 imap.align='center';
 cmap.appendChild(imap);
 i_1=$$('IMG');
 i_1.src='img/amis_on_en.png';
 i_1.className='mapbutton';
 imap.$a(i_1);
 i_1.onmousedown=function() { if (fon) { fon=false;
 this.src='img/amis_off_en.png';
 fOF();
 } else { fon=true;
 this.src='img/amis_on_en.png';
 fON();
 } };
 i_2=$$('IMG');
 i_2.src='img/annonces_on_en.png';
 i_2.className='mapbutton';
 imap.$a(i_2);
 i_2.onmousedown=function() { if (pon) { pon=false;
 this.src='img/annonces_off_en.png';
 pOF();
 } else { pon=true;
 this.src='img/annonces_on_en.png';
 pON();
 } };
  xmap=$$('DIV');
 xmap.$s.width='100%';
 xmap.$s.height='400px';
 cmap.appendChild(xmap);
   var latlong = new google.maps.LatLng(mylat,mylong);
  var myOptions = { zoom: 5, center: latlong, mapTypeId: google.maps.MapTypeId.ROADMAP, navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT}, streetViewControl: true };
  ymap = new google.maps.Map(xmap,myOptions);
  pON();
  fON();
  try {setTimeout(startanimation,60000);
} catch(ee) {};
  };
  var pON=function() {  if (pOL.length==0) { for(var i=0;i<blresults.length;i++) { try { m_o={};
 m_o.ref=blresults[i][0];
 m_o.title=blresults[i][1];
 m_o.logo=blresults[i][5];
 m_o.address=blresults[i][6];
 m_o.city=blresults[i][7];
 m_o.phoneNumbers=[{number:blresults[i][8]}];
 var m_m = new google.maps.LatLng(blresults[i][3],blresults[i][4]);
  var m_p=function(event) { var e=event||window.event;
if (e.stopPropagation) {e.stopPropagation();
};
e.cancelBubble = true;
 this.$s.zIndex=zi+1;
 zi++;
 xmap.onmousedown=function() {try {this.removeChild(d_);
d_.innerHTML='';
} catch(ee) {};
this.onmousedown=function() {};
};
 var x_x=SP('./mobile/php/getgadget.php',[['ref',this.iw.ref]]);
 if (x_x) { x_x=iXML(x_x.responseText);
 x_x=iXMLA(x_x);
  if (d_==null) { d_=$$('DIV');
 d_.className='gad';
 d_.$s.position='absolute';
 d_.$s.width='60%';
 d_.$s.height='60%';
 d_.$s.marginLeft='20%';
 d_.$s.marginTop='20%';
 d_.$s.zIndex=zi+1;
 } else { d_.innerHTML='';
 } xmap.$a(d_);
  di=$$('IMG');
 di.$s.position='absolute';
 di.$s.left='100%';
 di.$s.width='30px';
 di.$s.height='30px';
 di.$s.marginLeft='-30px';
 di.$s.top='88%';
 di.$s.cursor='pointer';
 di.src='./mobile/img/croix.png';
 d_.$a(di);
  di.onmousedown=function(event) {var e=event||window.event;
if (e.stopPropagation) {e.stopPropagation();
};
e.cancelBubble = true;
xmap.$r(d_);
};
  d_.onmousedown=function(event) {var e=event||window.event;
if (e.stopPropagation) {e.stopPropagation();
};
e.cancelBubble = true;
};
  var dt=$$('DIV');
 dt.$s.height='40px';
 dt.$s.width='96%';
 dt.$s.marginTop='10px';
 dt.$s.marginLeft='2%';
 dt.$s.overflow='hidden';
 dt.$s.fontWeight='800';
 dt.$s.color='#544004';
 dt.align='center';
 dt.innerHTML=this.iw.title+' ('+this.iw.city+') '+this.iw.address+'<br><a href="tel:'+this.x_x+'" style="color:#544004;text-decoration:none">'+this.x_x+'</a>';
 d_.$a(dt);
  var d_2=$$('DIV');
 d_2.className='gad2';
 d_2.$s.width='90%';
 d_2.$s.height='65%';
 d_2.$s.marginLeft='5%';
 d_2.$s.marginTop='10px';
  d_.$a(d_2);
  var ld=function(p) { d_2.innerHTML='';
  for (var i=p;
i<Math.min(p+3,x_x.length);
i++) { var bdiv=$$('div');
 bdiv.align="left";
 bdiv.u=x_x[i][0];
 d_2.$a(bdiv);
  var bdimg=$$('div');
 bdimg.className='height_45';
 bdimg.$s.width='20%';
 bdimg.$s.display='block';
 bdimg.$s.marginTop='5px';
 bdimg.$s.marginBottom='5px';
 bdimg.$s.marginLeft='5%';
 bdimg.$s.overflow='hidden';
 bdimg.align='center';
 Float(bdimg,'left');
 bdiv.$a(bdimg);
  if ((i==p+2)&&(i!=x_x.length)) { var imgi=$$('img');
 imgi.$s.display='inline';
 imgi.$s.marginLeft='-38px';
 imgi.$s.cursor='pointer';
 imgi.src='./mobile/img/plus.png';
 bdimg.$a(imgi);
 bdimg.align='center';
 bdimg.style.width='100%';
 imgi.onmousedown=function() {ld(p+2);
};
 } else {  bdiv.onmousedown=function() {window.open('./mobile/index.php?gadget='+this.u);
};
  var bimg=$$('img');
 bimg.className='height_45';
 Float(bimg,'left');
 bimg.$s.display='block';
 bimg.$s.cursor='pointer';
 bimg.src=x_x[i][4];
 bdimg.$a(bimg);
  var bdiv2=$$('div');
 bdiv2.className='height_45';
 Float(bdiv2,'left');
 bdiv2.$s.width='70%';
 bdiv2.$s.overflow='hidden';
 bdiv2.$s.fontSize='1em';
 bdiv.$a(bdiv2);
  var bdiv2text=$$('div');
 bdiv2text.className='height_45';
 bdiv2text.innerHTML=x_x[i][3];
 bdiv2text.$s.height=brow?'16px':'20px';
 bdiv2text.$s.overflow='hidden';
 bdiv2text.$s.marginLeft='10px';
 bdiv2text.$s.marginTop='20px';
 bdiv2text.$s.cursor='pointer';
 bdiv2text.$s.verticalAlign='middle';
 bdiv2text.$s.color='white';
 bdiv2text.$s.fontWeight='800';
 bdiv2.$a(bdiv2text);
  var imgi=$$('img');
 imgi.$s.height='1px';
 imgi.$s.width=brow?'318px':'100%';
 imgi.$s.display='block';
 Float(imgi,'left');
 imgi.src='./mobile/img/gris.png';
 d_2.$a(imgi);
  } };
 };
 ld(0);
 };
 };
  var m_n = new MyT(m_m, './mobile/img/mbx'+i%10+'.png',ymap,m_o,53,80,48,48,m_p,true);
 pOL.push(m_n);
 zi++;
 } catch(ee) {};
 };
 } else { for (var i=0;
i<pOL.length;
i++) { pOL[i].getPanes().overlayImage.appendChild(pOL[i].x_x5);
 pOL[i].draw();
 } };
 };
  var pOF=function() { for (var i=0;
i<pOL.length;
i++) { pOL[i].onRemove();
 } };
  var fON=function() {  if (fOL.length==0) { for(var i=0;i<fL.length;i++) { try { m_o={};
 m_o.title='';
 m_o.logo=fL[i][0];
 m_o.phoneNumbers=[{number:fL[i][1]}];
  var m_n = new MyT(new google.maps.LatLng(fL[i][2],fL[i][3]),'./mobile/img/me2.png',ymap,m_o,63,73,49,49,function(event) {var e=event||window.event;
if (e.stopPropagation) {e.stopPropagation();
};
e.cancelBubble = true;
this.$s.zIndex=zi+1;
zi++;
document.location.href='tel:'+this.x_x},false);
 fOL.push(m_n);
 zi++;
 } catch(ee) {};
 } } else { for (var i=0;
i<fOL.length;
i++) { fOL[i].getPanes().overlayImage.appendChild(fOL[i].x_x5);
 fOL[i].draw();
 };
 };
 };
  var fOF=function() {  for (var i=0;
i<fOL.length;
i++) { fOL[i].onRemove();
 };
  fOL=[];
  };
  window.onload=function() { MyO.prototype = new google.maps.OverlayView();
  function MyO(x_x1,x_x2,x_x3,x_x4,x_x10,x_x11,x_x12,x_x13,x_x14,x_x15) { this.x_x1 = x_x1;
 this.x_x2 = x_x2;
 this.x_x3 = x_x3;
 this.x_x4 = x_x4;
 this.x_x5 = null;
 this.x_x10 = x_x10;
 this.x_x11 = x_x11;
 this.x_x12 = x_x12;
 this.x_x13 = x_x13;
 this.x_x14 = x_x14;
 this.x_x15 = x_x15;
 this.setMap(x_x3);
 };
  MyO.prototype.onAdd = function() { var x_x5 = $$('DIV');
 x_x5.$s.marginLeft=-parseInt(this.x_x10/2)+'px';
 x_x5.$s.marginTop=-this.x_x11+'px';
 x_x5.$s.borderStyle = "none";
 x_x5.$s.borderWidth = "0px";
 x_x5.$s.position = "absolute";
 x_x5.$s.cursor='pointer';
  if (typeof(this.x_x4.phoneNumbers)=="undefined") {x_x5.x_x=''} else {x_x5.x_x=this.x_x4.phoneNumbers[0].number;
};
  x_x5.iw=this.x_x4;
  x_x5.onmousedown=this.x_x14;
  x_x5.onmouseover=function() { this.d=$$('DIV');
 this.d.className='mt';
 this.d.$s.position='absolute';
 this.d.$s.top='-40px';
 this.d.$s.left='0px';
 this.d.$s.zIndex=zi+1;
 if (brow) {this.d.$s.height='30px';
};
 this.d.innerHTML=this.iw.title;
 this.$a(this.d);
 };
  x_x5.onmouseout=function() { try{this.$r(this.d);}catch(ee){};
 };
  var x_x8 = $$('IMG');
 x_x8.w=this.x_x10;
 x_x8.h=this.x_x11;
 x_x8.src = this.x_x2;
 x_x8.$s.position='absolute';
 x_x8.$s.left='0px';
 x_x8.$s.top='0px';
 x_x8.$s.width = x_x8.w+"px";
 x_x8.$s.height = x_x8.h+"px";
 x_x5.appendChild(x_x8);
   var x_x7 = $$('IMG');
 x_x7.t=Math.max(1,this.x_x11/6);
 x_x7.l=Math.max(1,parseInt(this.x_x10-this.x_x12)/2);
 if (!this.x_x15) {x_x7.t=2;
};
 x_x7.src = this.x_x4.logo;
 x_x7.$s.position='absolute';
 x_x7.$s.left=x_x7.l+'px';
 x_x7.$s.top=x_x7.t+'px';
 x_x7.$s.width = this.x_x12+"px";
 x_x7.$s.height = this.x_x13+"px";
 x_x5.appendChild(x_x7);
 x_x7.className='aI';
 x_x7.$s.webkitAnimationName='a-i';
  var x_x6 = $$('DIV');
 x_x6.fs=Math.max(1,this.x_x11/10);
;
 x_x6.h=Math.max(1,this.x_x11/10);
;
 x_x6.t=Math.max(1,this.x_x11/60);
;
 x_x6.l=Math.max(1,parseInt(this.x_x10-this.x_x12)/2);
;
 x_x6.w=this.x_x12;
 x_x6.$s.height=x_x6.h+'px';
 x_x6.$s.fontSize=x_x6.fs+'px';
 x_x6.$s.position='absolute';
 x_x6.$s.left=x_x6.l+'px';
 x_x6.$s.top=x_x6.t+'px';
 x_x6.$s.overflow='hidden';
 x_x6.$s.width=x_x6.w+'px';
 x_x6.$s.fontWeight='800';
 x_x6.$s.color='black';
 x_x6.innerHTML=this.x_x4.title;
 x_x5.appendChild(x_x6);
  this.x_x5 = x_x5;
 this.x_x6 = x_x6;
 this.x_x7 = x_x7;
 this.x_x8 = x_x8;
  this.getPanes().overlayImage.appendChild(x_x5);
 };
  MyO.prototype.draw = function() {  var x_x = this.getProjection().fromLatLngToDivPixel(this.x_x1);
  var x1_x=parseFloat(this.x_x3.getZoom()/16);
 var xw_x=parseInt(this.x_x8.w*x1_x);
 var xh_x=parseInt(this.x_x8.h*x1_x);
  this.x_x8.$s.width=xw_x+'px';
 this.x_x8.$s.height=xh_x+'px';
 this.x_x6.$s.fontSize=parseInt(this.x_x6.fs*x1_x)+'px';
 this.x_x6.$s.left=Math.max(1,this.x_x6.l*x1_x);
 this.x_x6.$s.top=Math.max(1,this.x_x6.t*x1_x);
 this.x_x6.$s.width=parseInt(this.x_x6.w*x1_x)+'px';
 this.x_x6.$s.height=parseInt(this.x_x6.h*x1_x)+'px';
  this.x_x7.$s.left=Math.max(1,this.x_x7.l*x1_x)+'px';
 this.x_x7.$s.top=Math.max(1,this.x_x7.t*x1_x)+'px';
 this.x_x7.$s.width = xw_x-2*Math.max(1,this.x_x7.l*x1_x)+'px';
 this.x_x7.$s.height =this.x_x7.$s.width;
  this.x_x5.$s.left = x_x.x + 'px';
 this.x_x5.$s.top = x_x.y + 'px';
 this.x_x5.$s.marginLeft=-xw_x/2+'px';
 this.x_x5.$s.marginTop=-xh_x+'px';
 };
    MyO.prototype.onRemove = function() { this.x_x5.parentNode.removeChild(this.x_x5);
 };
  MyT=MyO;
  geoipg=sA('./mobile/php/geoip.php',[['s',1]]);
 if (geoipg) { geoip();
 };
  x_1=sA('./mobile/php/getblimpsme2.php',[['s',1]]);
 if (x_1) { blresults=iXML(x_1.responseText);
 blresults=iXMLA(blresults);
 };
  x_2=sA('./mobile/php/updateGeoLoc.php',[['o',1]]);
 if (x_2) { var tmp=iXML(x_2.responseText);
 tmp=iXMLA(tmp);
 fL=tmp[2];
 };
  loadMap();
  };


