/*______________________________________________________________________________                                                                          
            MOUSE PASS.Beta 1.0 MOUSE PASS.Beta 1.0 MOUSE PASS.Beta 1.0 
            MOUSE PASS.Beta 1.0 MOUSE PASS.Beta 1.0 MOUSE PASS.Beta 1.0 
                                
                                
                                HADEEN - 2008
                               -----------------
                            Copyright 10 novembre 2008
Ce script est protegé par un copyright international. Vous pouvez utiliser 
se script gratuitement a certaine condition exprimée si dessous :
  - Vous etes un particulier et vous utilisé le script pour un projet non 
  commercial
  - Vous etes une association (loi 1905) et vous utilisé le script pour un 
  projet non commercial 
Pour toute utilisation par une entreprise ou pour but commercial. 
Merci de contacter la société
Hadeen à :
                                contact@hadeen.fr

Ici vous trouverez la partie Javascript du code. 
______________________________________________________________________________*/

var isIE = (navigator.userAgent.indexOf("MSIE")>-1);
var PosXY = new Array();
var lLeft;
var lTop;
function traceMouse(e,sTextName,Lmarge) {

var x,y;
var PosX = 0;
var PosY = 0;
var obj=document.getElementById("imgSec");
  if(isIE){
    /* si Ie fixe les valeur */
    x = window.event.offsetX ;
    y = window.event.offsetY ;
   
     getPosition(obj);
  }else
  {
 
  if(obj){
    //-- Si propriété existe
  //  if( obj.offsetParent){
      //-- Récup. Position Objet
      PosX = obj.offsetLeft;
      PosY = obj.offsetTop;
      //-- Tant qu'un parent existe
      while( obj = obj.offsetParent){
        //-- Ajout position Parent
        PosX += obj.offsetLeft;
        PosY += obj.offsetTop;
      }
      lLeft=PosX;
      lTop=PosY;
   // }
    }
  
     x = e.pageX - PosX;
    y= e.pageY - PosY;
  
  }
 
  x1= lLeft  + x ;
  y1 =lTop + y ;
 
 FixPos(x, y,x1,y1,sTextName,Lmarge);
}// end function

function CreatImg(lid,Lmarge)
{

        var img = document.createElement('img');
        img.src = 'http://www.clients.hadeen.com/Img/SecuM/pt.jpg';
        img.setAttribute('width', Lmarge);
        img.setAttribute('height', Lmarge);
        img.alt =  (PosXY.length);
        img.id = lid;
        document.getElementById('Ldiv').appendChild(img);

}// end function

function FixPos(posx, posy,X2,Y2,sTextName2,Lmarge) {
var lid;
 // document.getElementById("test2").value = posx;
  PosXY[PosXY.length] = posx + ";" + posy;
    lid='pt'+ PosXY.length ;
    CreatImg(lid,Lmarge);
      document.getElementById(lid).style.position="absolute";
		document.getElementById(lid).style.cursor="default";
    document.getElementById(lid).style.left=X2 - (Lmarge / 2);
    document.getElementById(lid).style.top=Y2 - (Lmarge / 2)  ;
        CompilTabl(sTextName2)
}// end function

function CompilTabl(TextName)
{
  var allXY;
  for(var i=0; i < PosXY.length ; i++)
  {
    if(allXY == null)
    {
        allXY = PosXY[i] + " / ";
    }else
    {
        allXY += PosXY[i] + " / ";
    }
  
  }
    document.getElementById(TextName).value = allXY  ;

}// end function


function ClearAll()
{
  
    var d = document.getElementById('Ldiv');
  var olddiv;
  
   for(var i=1; i < PosXY.length +1 ; i++)
   {
      olddiv = document.getElementById('pt'+i);
      d.removeChild(olddiv);
    }
     PosXY =new Array();
}// end function


//--------------------------------------STUFF
function Ninst(TextName) {


  document.getElementById(TextName).value = "New";
  document.forms[0].submit();
  
}// end function

function GoAncre() {


    window.location="#AntiBot"
}// end function

        
function getPosition(Obj)
{
     lLeft = 0;
     lTop = 0;
lLeft = Obj.offsetLeft;
lTop = Obj.offsetTop;
    while (Obj = Obj.offsetParent)
    {
       

        lLeft += Obj.offsetLeft;
        lTop += Obj.offsetTop;
        
    }
  
}