// Copyright 721z - Toute reproduction interdites

  // fonction de zoom
  function zoom(cur_mouseX, cur_mouseY) {
    if (cur_mouseX>plan[3] && cur_mouseX<eval(plan[3]+plan[1]) && cur_mouseY>plan[4] && cur_mouseY<eval(plan[4]+plan[2])) {

      var indefinie;
	  
	  

      z = 4; // zoom factor
      ps = 400; // popup size  
      cur_x = ps/2-(cur_mouseX-50)*z;
      cur_y = ps/2-(cur_mouseY-20)*z;
      h = plan[2]*z;
      w = plan[1]*z;
      
      style = 'position: absolute; top: '+cur_y+'; left: '+cur_x+'; height: '+h+'; width: '+w+';';

      // open a new popup and display zoomed map
      zoomPopup = window.open('', 'zoomPopup', 'height='+ps+',width='+ps+',toolbar=0,menubar=no,scrollbars=0,resizable=0,status=1,location=0,hotkeys=0');
      content = '<html>\n <head>\n  <title>'+plan[5]+'.</title>\n';
      content += '  <script language=\'javascript\'>\n';
      content += '    function position(e) {\n';
      content += '      x = (navigator.appName.substring(0,3) == \'Net\') ? e.pageX : (event.x+document.body.scrollLeft);\n'; // mouse position
      content += '      y = (navigator.appName.substring(0,3) == \'Net\') ? e.pageY : (event.y+document.body.scrollTop);\n';
      content += '      if (x>0 && x<'+ps+' && y>0 && y<'+ps+') {\n';
      content += '        x = Math.round(x/'+z+')-'+ps+'/('+z+'*2);\n'; // non zoomed position relative to center
      content += '        y = Math.round(y/'+z+')-'+ps+'/('+z+'*2);\n';
      content += '        x = '+cur_mouseX+'-51+x;\n'; // real position in map
      content += '        y = '+eval(plan[2]+1+plan[4])+'-'+cur_mouseY+'-y;\n';
      content += '        if (x>0 && x<'+plan[1]+' && y>0 && y<'+plan[2]+') window.status = \'X=\'+x+\' / Y=\'+y; else window.status = \'Souris hors carte\';\n';
      content += '      }\n';
      content += '      else {\n';
      content += '        window.status = \'Souris hors zoom\';\n';
      content += '      }\n';
      if (!persos_hidden) {
        for (i=0; i<persos.length; i++) {
          content += '      if (x=='+persos[i][1]+' && y=='+persos[i][2]+' ) { window.status += " ('+persos[i][0]+')"; }\n';
        }
      }
      content += '    }\n';
      content += '    if (navigator.appName.substring(0,3) == \'Net\') { document.captureEvents(Event.MOUSEMOVE); }\n';
      content += '    document.onmousemove = position;\n';
      content += '  </script>\n';
      content += ' </head>\n <body onclick=\'window.close()\' style=\'margin: 0 0 0 0\'>\n';
      content += '  <div style=\'position: absolute; clip: rect(0px '+ps+'px '+ps+'px 0px);\'>\n';
      content += '   <img src=\''+plan[10]+'\' border=0 style=\''+style+' z-index: 1;\' />\n';
      if (!others_hidden)
        content += '   <img src=\''+plan[6]+'\' border=0 style=\''+style+' z-index: 4;\' />\n';
      if (!geo_hidden)
        content += '   <img src=\''+plan[7]+'\' border=0 style=\''+style+' z-index: 2;\' />\n';
      if (!objets_hidden)
      	content += '   <img src=\''+plan[8]+'\' border=0 style=\''+style+' z-index: 3;\' />\n';
      if (!persos_hidden){
        for (i=0; i<persos.length; i++) {
          X = persos[i][1];
          Y = persos[i][2];
          if (X >= eval(cur_mouseX-plan[3]+1-ps/2) && X <= eval(cur_mouseX-plan[4]+1+ps/2) && Y >= eval(plan[2]+plan[4]+1-cur_mouseY-ps/2) && Y<= eval(plan[2]+plan[4]+1-cur_mouseY+ps/2)) {
            X = cur_x+X*z-3;
            Y = cur_y+(plan[2]-Y)*z-3;
            content += '   <img src=\''+plan[9]+'\' border=0 style=\'position: absolute; top: '+Y+'; left: '+X+'; height: 10; width: 10; z-index: 4;\' />\n';
          }
        }
      }
      content += '  </div>\n </body>\n</html>\n';
      zoomPopup.document.write(content);
      zoomPopup.document.close();
	  zoomPopup.focus();
    }
  }

  
 
  
  

