﻿// JavaScript Document
function WindowOpen(page, larg_haut)
{
if (larg_haut == "largeur")
	{
	window.open(page,'index','top=0, left=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, history=0, resizable=0, width=467px, height=198');
	}
else
	{
	window.open(page,'index','top=0, left=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, history=0, resizable=0, width=467px, height=198');
	}
}

var ie = document.all;
var nn6 = document.getElementById &&! document.all;

var isdrag = false;
var x = null;
var y = null;
var tx;
var ty;
var dobj;
var divMask;


function movemouse( e )
{   
    if( isdrag ) {        
        var xPos = nn6 ? (tx + parseInt(e.clientX) - x) : (tx + parseInt(event.clientX) - x);
        var yPos = nn6 ? (ty + parseInt(e.clientY) - y) : (ty + parseInt(event.clientY) - y);
        
        minx = parseInt(getStyle(dobj, "marginLeft", "margin-left"));
        miny = parseInt(getStyle(dobj, "marginTop", "margin-top"));
        
        dobj.style.left = Math.max(-minx, xPos) + 'px';
        dobj.style.top  = Math.max(-miny, yPos) + 'px';
        return false;
    }

}

function getStyle(elem,stylePropIE, stylePropFF)
{
	if (elem.currentStyle)
	{
		var returnValue = elem.currentStyle[stylePropIE];
	}
	else if (window.getComputedStyle)
	{
		var returnValue = document.defaultView.getComputedStyle(elem,null).getPropertyValue(stylePropFF);
	}
	return returnValue;
}

function selectmouse( e )
{   
    var fobj = nn6 ? e.target : event.srcElement;
    var topelement = nn6 ? "HTML" : "BODY";
 
    while (fobj.tagName != "HTML" &&  fobj.tagName != "BODY" && fobj.className != "dragme")
    {
        fobj = nn6 ? fobj.parentNode : fobj.parentElement;   
    }
    
    if (fobj.className == "dragme")
    {
        isdrag = true;
        dobj = nn6 ? fobj.parentNode : fobj.parentElement;
        divMask  = nn6 ? dobj.parentNode : dobj.parentElement;
        
        tx = parseInt(dobj.offsetLeft) - parseInt(getStyle(dobj, "marginLeft", "margin-left"));
        ty = parseInt(dobj.offsetTop) - parseInt(getStyle(dobj, "marginTop", "margin-top"));
        
        x = nn6 ? parseInt(e.clientX) : parseInt(event.clientX);
        y = nn6 ? parseInt(e.clientY) : parseInt(event.clientY);
        
        document.onmousemove = movemouse;
        return false;
    }
    
}

document.onmousedown=selectmouse;
document.onmouseup = new Function("isdrag=false");