// Cross-browser code.
//
// Conventions: all variables and methods starting with "x", are private
// to this module and should not be used by clients.  All other variables
// and methods are public.
//
var browserVersion = parseInt(navigator.appVersion);
var browserVersionF = parseFloat(navigator.appVersion);

var ie   = navigator.appName.indexOf("Microsoft") != -1;
var ns   = navigator.appName.indexOf("Netscape") != -1;
var ns4  = (document.layers) ? true : false;
var ie4  = (document.all && browserVersion >= 4) ? true : false;
var ie5  = false;
var ver4 = (ns4 || ie4);
var dom = false;
if ((document.getElementById)&&(!(ie4)))
		dom=true;

if (ie4 && navigator.userAgent.indexOf('MSIE 5') > 0) {
    ie5 = true;
    browserVersion = 5;
}

var isMac  = (navigator.appVersion.indexOf("Mac") != -1);
var isMenu = (ns4 || (ie4 && !isMac));
var isMIE5 = isMac && ie5;

// For debugging on Win/IE5:
// isMIE5 = true;

// Private variables.
var xBrowserLoaded = 0;
var xEventHandlers = new Array(100);
var xEventHandlerCount = 0;
var xResizing = 0;

var xOnLoadHandlers = new Array(100);
var xOnLoadHandlerCount = 0;
var xOnLoadFunctions = new Array(100);
var xOnLoadFunctionCount = 0;
var xLoaded = 0;
var xUnloading = 0;


// Check the version of the browser.
function browserCheck(minimumVersion) {
    if (browserVersion < minimumVersion) {
        alert("Votre navigateur : " + browserVersion + ".\n" +
              "est trop ancien, la version minimal demandée est : " + minimumVersion);
        location.href = "http://www.netscape.com";
    }
}
    
// Returns the object used to set the object's style properties.
function objectStyle(objName) {
    if (ie4) {
        return document.all[objName].style;
    }
    if (ns4) {
        // NOTE: this only works for toplevel layers;
        //       something else is needed for nested layers!
        return document.layers[objName];
    }
    return null;
}

// Shows an object, specified by its style object.
function showObject(style) {
    if (ie4) {
        style.visibility = 'visible';
    }
    if (ns4) {
        style.visibility = 'show';
    }
}

// Hides an object, specified by its style object.
function hideObject(style) {
    if (ie4) {
        style.visibility = 'hidden';
    }
    if (ns4) {
        style.visibility = 'hide';
    }
}

// Set the cursor when the mouse pointer is above the element.
function setCursor(obj, type) {
    if (ie4||dom)
	{
        obj.style.cursor = type;
    }
}

// Moves the object given by its style to the given position within the page.
function moveTo(style, x, y) {
    if (ie4) {
	style.left = x;
	style.top = y;
    }
    if (ns4) {
	style.x = x;
	style.y = y;
    }
}

// Get the window's (inner) width.
function getWindowWidth() {
    if (ie4) return document.body.offsetWidth;
    if (dom||ns4) return window.innerWidth; //cor ?
    return 0;
}

// Get the window's (inner) height.
function getWindowHeight() {
    if (ie4) return document.body.offsetHeight;
    if (dom||ns4) return window.innerHeight;  //cor ?
    return 0;
}

// Get the document's width.
function getDocumentWidth() {
    if (ie4) {
        // NOT RIGHT!
        return document.body.style.width;
    }
    if (ns4) {
        return document.width;
    }
    return 0;
}

// Get the document's height.
function getDocumentHeight() {
    if (ie4) {
        // NOT RIGHT!
        return document.body.offsetHeight;
    }
    if (ns4) {
        return document.height;
    }
    return 0;
}

// Shows a layer.
function showLayer(layer) {
    if (ie4) {
        layer.style.visibility = 'visible';
    }
    if (ns4) {
        layer.visibility = 'show';
    }
}

// Hides a layer.
function hideLayer(layer) {
    if (ie4) {
        layer.style.visibility = 'hidden';
    }
    if (ns4) {
        layer.visibility = 'hide';
    }
}

// Returns whether a layer is currently visible.
function isLayerVisible(layer) {
    if (ie4) {
        return layer.style.visibility != 'hidden';
    }
    if (ns4) {
        return layer.visibility != 'hide';
    }
    return 0;
}



// Writes a text to a layer.
function writeLayer(layer, txt) {
    if (ns4) {
	layer.document.write(txt);
	layer.document.close();
    }
    if (ie4) {
	layer.innerHTML = txt;
    }
}

// Get a top layer, i.e. a layer that is a direct child of the body.
function getTopLayer(layerName) {
    if (ie4) {
        return document.all[layerName];
    }
    if (ns4) {
	return document.layers[layerName];
    }
    return null;
}


// Given an array with layer names, return the layer object at the given index.
function getLayerAt(layersPath, index) {
    var layer;
    if (ie4) layer = document.all[ layersPath[index] ];// For IE, the layer is just the layer at the given index of the path.
		if (dom) layer = document.getElementById( layersPath[index] );
		if (ns4) {
        // For NS, we need to build the path to the containing layer.
        if (layersPath.length == 0) {
            return null;
        }

        var i, path = "";
        for( i = 0; i < index+1; ++i ) {
            if (i < index+1) {
                path += "document.";
            }
            path += layersPath[i];
            if (i+1 < index+1) {
                path += ".";
            }
        }
        layer = eval(path);
        // alert("PATH: " + path + " L: " + layer);
    }
    return layer;
}


// Get a layer's x-position.
function getLayerX(layer) {
    if (ie4||dom) {
        return layer.offsetLeft; // mod ?
    }
    if (ns4) {
        return layer.x;
    }
    return 0;
}

// Get a layer's y-position.
function getLayerY(layer) {
    if (ie4||dom) {
        return layer.offsetTop; //mod ?
    }
    if (ns4) {
        return layer.y;
    }
    return 0;
}
// Get a layer's z-index.
function getLayerZ(layer) {
    if (ns4) {
	return layer.zIndex;
    }
    if (ie4) {
        return layer.style.zIndex;
    }
    return 0;
}


// Get a layer's width.
function getLayerWidth(layer) {
    if (ie4){
        return layer.offsetWidth; //Mod 
		}
		if (dom) {
				//alert(document.body.scrollWidth);
				return document.body.scrollWidth;
				//return document.defaultView.getComputedStyle(layer, '').getPropertyValue("width");
				//window.status=document.documentElement.offsetWidth;
				//document.write(" <!-- "+document.documentElement.offsetWidth+" -->");
				/*var saf   = navigator.userAgent.indexOf("Safari") != -1;
				if (navigator.userAgent.indexOf("Firefox/1.5") != -1){
					saf=true;
				}
				if (saf)
								return document.body.scrollWidth; //Mod 
				else
								return document.documentElement.offsetWidth; //Mod*/ 
	  }
	  if (ns4) {
        return layer.document.width;
    }
    return 0;
}

// Get a layer's height.
function getLayerHeight(layer) {
    if (ie4||dom) {
        return layer.offsetHeight; //Mod 
	  }
    if (ns4) {
        return layer.document.height;
    }
    return 0;
}

// Move a layer to the given (absolute) position.
function moveLayerTo(layer, x, y) {
    if (ie4) {
	layer.style.pixelLeft = x;
	layer.style.pixelTop = y;
    }
		if (dom) {
	layer.style.left = x;
	layer.style.top = y;
		}
    if (ns4) {
	layer.x = x;
	layer.y = y;
    }
}

// Move a layer by the specified distances.
function moveLayerBy(layer, dx, dy) {
    if (ie4) {
        if (dx != 0) {
            layer.style.pixelLeft += dx;
        }
        if (dy != 0) {
            layer.style.pixelTop += dy;
        }
    }
    if (ns4) {
        if (dx != 0) {
            layer.x += dx;
        }
        if (dy != 0) {
            layer.y += dy;
        }
    }
}

// Get a layer's z-index.
function setLayerZ(layer, newZ) {
    if (ns4) {
	layer.zIndex = newZ;
    }
    if (ie4) {
        layer.style.zIndex = newZ;
    }
}

// Set a layer's foreground color.
function setLayerFgColor(layer, fg) {
    if (ie4) {
        layer.style.color = fg;
    }
    if (ns4) {
        layer.fgColor = fg;
    }
}

// Retrieve a layer's foreground color.
function getLayerFgColor(layer) {
    if (ie4) {
        return layer.style.color;
    }
    if (ns4) {
        return layer.fgColor;
    }
    return "";
}

// Set a layer's background color.
function setLayerBgColor(layer, bg) {
    if (ie4) {
        layer.style.backgroundColor = bg;
    }
    if (ns4) {
        layer.bgColor = bg;
    }
}

// Retrieve a layer's background color.
function setLayerBgColor(layer) {
    if (ie4) {
        return layer.style.backgroundColor;
    }
    if (ns4) {
        return layer.bgColor;
    }
    return "";
}

// Create the HTML for a new layer.
function makeLayer(name, handlers, style, contents) {
    return '<DIV ID="' + name + '" ' + handlers + style + 
	   ' STYLE="position: absolute; left: 0; top:0; visibility: hidden">' +
           contents + '</DIV>';
}

// Create a new layer, which is initially hidden.
function createLayer(layerText) {
    var layer;
    if (ie4) {
	var theDiv = layerText;
//alert("LAYER: " + theDiv);
	document.open("text/html");
	document.write( theDiv );
	document.close();
	var allDivs = document.all.tags("DIV");
	layer = allDivs[allDivs.length - 1];
    }
    if (ns4) {
	var layer = new Layer(1);
	layer.document.open("text/html");
	layer.document.write( contents );
	layer.document.close();
    }

    hideLayer(layer);
    return layer;
}

// Retrieves an image object from a layer, given its name.
function getLayerImage(layer, imageName) {
    var img;
    if (ie4||dom)	img = document.images[imageName];// For IE, the image is always in the "images" array.
    if (ns4) {
        // For NS, we need to access the document contained within the layer.
        if (layer == null) {
            img = document.images[imageName];
        } else {
	    img = layer.document.images[imageName];
        }
    }
    return img;
}


// Returns the width of an image.
function getImageWidth(img) {
    if (ie4) {
        return img.offsetWidth;
    }
    if (ns4) {
        return img.width;
    }
    return 0;
}

// Returns the height of an image.
function getImageHeight(img) {
    if (ie4) {
        return img.offsetHeight;
    }
    if (ns4) {
        return img.height;
    }
    return 0;
}


// Returns the absolute x-position of the image in the page.
function getImagePageX(img, layersPath) {
    if (ie4||dom) {
	var x = 0;
	var current = img;
	while( current.offsetParent != null ) {
	    x += current.offsetLeft;
	    current = current.offsetParent;
        }
	return x;
    }
    if (ns4) {
        var x = img.x;
        var i;
        for( i = 0; i < layersPath.length; ++i ) {
            x += getLayerAt(layersPath, i).x;
        }
        return x;
    }
    return 0;
}

// Returns the absolute x-position of the image in the page.
function getImagePageY(img, layersPath) {
    if (ie4||dom) {
	var y = 0;
	var current = img;
	while( current.offsetParent != null ) {
	    y += current.offsetTop;
	    current = current.offsetParent;
        }
	return y;
    }
    if (ns4) {
        var i, y = img.y;
        for( i = 0; i < layersPath.length; ++i ) {
            y += getLayerAt(layersPath, i).y;
        }
        return y;
    }
    return 0;
}

// Returns the absolute x-position of the image in the page.
function getImageX(obj) {
    // IE returns offsetLeft relative to current container
    // so we walk the hierarchy and sum them up
    if( obj.offsetParent ) {
	var current = obj;
	var the_x = 0;
	while( current.offsetParent != null ) {
	    the_x += current.offsetLeft;
	    current = current.offsetParent;
	}
	return the_x;
    } else if( obj.x ) {
	// todo: need to do the same for Netscape if image is inside a layer
	return obj.x;
    }
    return 0;
}

// Returns the absolute y-position of the image in the page.
function getImageY(obj) {
    // IE returns offsetTop relative to current container
    // so we walk the hierarchy and sum them up
    if( obj.offsetParent ) {
	var current = obj;
	var the_y = 0;
	while( current.offsetParent != null ) {
	    the_y += current.offsetTop;
	    current = current.offsetParent;
	}
	return the_y;
    } else if( obj.y ) {
	// todo: need to do the same for Netscape if image is inside a layer
	return obj.y;
    }
    return 0;
}

// Given a layer object, return whether the given (absolute) coordinates are
// within the layer's bounds.
function isAboveLayer(layer, x, y) {
    var layerX = getLayerX(layer);
    var layerY = getLayerY(layer);
    var layerW = getLayerWidth(layer);
    var layerH = getLayerHeight(layer);

    return !(x < layerX || x > layerX + layerW || y < layerY || y > layerY + layerH);
}

// Given an image object, return whether the given (absolute) coordinates are
// whitin the image's bounds.  The path must be the path of layer names to the
// layer that contains the image.
function isAboveImage(image, x, y, path) {
    var imgX = getImagePageX(image, path);
    var imgY = getImagePageY(image, path);
    var imgW = getImageWidth(image);
    var imgH = getImageHeight(image);

    return x >= imgX && x <= imgX + imgW && y >= imgY && y <= imgY + imgH;
}















// Event interface and wrappers.
//
// An object wishing to catch events may define the following interface.
// E.g. if the object wants to track mouse motion, it should define the
// mouseMove() method, and add itself to the event handler list using
// addEventHandler().  Remove the handler using removeEventHandler().
//
//    interface EventHandler {
//        bool mouseMove(e);
//        bool mouseDown(e);
//        bool mouseUp(e);
//        bool keyDown(e);
//        bool keyUp(e);
//    }
//
// All methods should return true or false to indicate whether the event
// should be passed on to other handlers or not; if true is returned, the
// event is first passed to all other registered handlers, and if all returned
// true, the event handler itself returns true to indicate that the browser
// should handle the event as usual. So if a handler is not interested in
// the event or does nothing with it, it should return true so that other
// handlers get the chance to handle the event.
//

function xSetupEventHandling() {
    // Supported events.
    document.onmousemove = xMouseMoveHandler;
    document.onmousedown = xMouseDownHandler;
    document.onmouseup   = xMouseUpHandler;
    document.onkeydown   = xKeyDownHandler;
    document.onkeyup     = xKeyUpHandler;

    if (ns4) {
        document.captureEvents(Event.MOUSEMOVE |
                               Event.MOUSEUP |
                               Event.MOUSEDOWN |
                               Event.KEYDOWN |
                               Event.KEYUP );

	// Handle Netscape resizing (destroys layer layout, so we have to reload).
        if (browserVersionF >= 4.5) {
	    window.captureEvents(Event.RESIZE);
	    window.onresize = xHandleResize;
	}
    }

    xUnloading = 0;
}

function xCleanup() {
    xUnloading = 1;

    document.onmousemove = null;
    document.onmousedown = null;
    document.onmouseup   = null;
    document.onkeydown   = null;
    document.onkeyup     = null;

    if (ns4) {
        document.releaseEvents(Event.MOUSEMOVE |
                               Event.MOUSEUP |
                               Event.MOUSEDOWN |
                               Event.KEYDOWN |
                               Event.KEYUP );

	window.releaseEvents(Event.RESIZE);
	window.onresize = null;
    }
}

function xHandleResize() {
    if (!xResizing) {
	xResizing = 1;
	location.reload();
	xResizing = 0;
    }
    return false;
}

function xMouseMoveHandler(e) {
    var i;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h.mouseMove && !h.mouseMove(ie4 ? window.event : e)) {
            return false;
        }
    }
    return true;
}

function xMouseDownHandler(e) {
    var i;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h.mouseDown && !h.mouseDown(ie4 ? window.event : e)) {
	    return false;
        }
    }
    return true;
}

function xMouseUpHandler(e) {
    var i;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h.mouseUp && !h.mouseUp(ie4 ? window.event : e)) {
            return false;
        }
    }
    return true;
}

function xKeyDownHandler(e) {
    var i;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h.keyDown && !h.keyDown(ie4 ? window.event : e)) {
            return false;
        }
    }
    return true;
}

function xKeyUpHandler(e) {
    var i;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h.keyUp && !h.keyUp(ie4 ? window.event : e)) {
            return false;
        }
    }
    return true;
}

// Add an event handler.
function addEventHandler(handler) {
    xEventHandlers[xEventHandlerCount] = handler;
    ++xEventHandlerCount;
}

// Remove an event handler.
function removeEventHandler(handler) {
    var i, found = 0;
    for( i = 0; i < xEventHandlerCount; ++i ) {
        var h = xEventHandlers[i];
        if (h == handler) {
            found = 1;
            break;
        }
    }
    if (found) {
        // Shift array down from xEventHandlerCount+1 to remove the handler.
        for( ; i < xEventHandlerCount-1; ++i ) {
            xEventHandlers[i] = xEventHandlers[i+1];
        }
	--xEventHandlerCount;
    }
}




// OnLoad Handling.
//
// General mechanism to add "OnLoad" handlers to a document.  The OnLoad
// handler of the BODY must always be set to "bodyLoaded()". This handler
// then invokes all handlers that have been registered using addOnLoadHandler.
//

function addOnLoadHandler(object) {
    xOnLoadHandlers[xOnLoadHandlerCount++] = object;
}

function addOnLoadFunction(func) {
    xOnLoadFunctions[xOnLoadFunctionCount++] = func;
}

function bodyLoaded() {
    // Call all object handlers.
    var i;
    for( i = 0; i < xOnLoadHandlerCount; ++i ) {
        var h = xOnLoadHandlers[i];
        if (h.bodyLoaded) {
	    h.bodyLoaded();
        }
    }

    // Call all function handlers.
    for( i = 0; i < xOnLoadFunctionCount; ++i ) {
        var f = xOnLoadFunctions[i];
        f();
    }

    //Does not work:
    //document.onunload = xCleanup();

    xLoaded = 1;
}

// Returns true if the document has been loaded, i.e. if bodyLoaded() has
// been called.
function isBodyLoaded() {
    return xLoaded;
}

// Returns true if the document is unloading.
function bodyUnloading() {
    return xUnloading;
}


// Get the (absolute) mouse x-coordinate from the event, ignoring any scrolling.
function getEventX(e) {
    if (ie4)  return document.body.scrollLeft + window.event.clientX ;
		if (dom) return document.body.scrollLeft + e.clientX ;
    if (ns4) return e.pageX;
    return 0;
}

// Get the (absolute) mouse x-coordinate from the event, ignoring any scrolling.
function getEventY(e) {
    if (ie4) return document.body.scrollTop + window.event.clientY;
		if (dom) return document.body.scrollTop + e.clientY ;
		if (ns4) return e.pageY;
    return 0;
}

// Get the pressed key.
function getEventKey(e) {
    if (ie4||dom) {
        return e.keyCode;
    }
    if (ns4) {
        return e.which;
    }
    return 0;
}

// Get the amount the window contents has scrolled in the x-direction.
function getScrolledX() {
    if (ie4||dom) {
        return document.body.scrollLeft;
    }
    if (ns4) {
	return window.pageXOffset;
    }
    return 0;
}

// Get the amount the window contents has scrolled in the y-direction.
function getScrolledY() {
    if (ie4||dom) {
        return document.body.scrollTop;
    }
    if (ns4) {
	return window.pageYOffset;
    }
    return 0;
}
// cross-browser screen properties
var xScreenProps = new Object();

function getScreenProperties() {
    // monitor bit & pixel depth
    if (screen.pixelDepth) {
	xScreenProps.color_depth = screen.colorDepth;
	xScreenProps.depth = screen.pixelDepth;
    } else {
	xScreenProps.color_depth = screen.colorDepth;
	xScreenProps.depth = screen.bufferDepth; // eh, not really...
    }

    // available height and width (need to add workarounds for
    // Macintosh/IE, which calculates things incorrectly according to DHTML:TDR)
    if (screen.availHeight) {
	xScreenProps.availWidth = screen.availWidth;
	xScreenProps.availHeight = screen.availHeight;
    }

    // height and width - same cross-browser
    if (screen.height) {
	xScreenProps.width = screen.width;
	xScreenProps.height = screen.height;
    }
    return xScreenProps;
}

// Setup all event handling stuff.
xSetupEventHandling();

xBrowserLoaded = 1;

function browserLoaded() {
    return 1;
}

// Drag an image in the browser window using the mouse.

// User constructor.
function ImageDragger(imageName) {
    ImageDragger_constructor(this, imageName);
}

// Real constructor.
function ImageDragger_constructor(self, imageName) {
    // Customizable properties.
    self.imageName = imageName;

    // Method properties.
    self.setImagePath = ImageDragger_setImagePath;
    self.layer = ImageDragger_layer;
    self.image = ImageDragger_image;
    self.mouseDown = ImageDragger_mouseDown;
    self.mouseMove = ImageDragger_mouseMove;
    self.mouseUp = ImageDragger_mouseUp;
    self.bodyLoaded = ImageDragger_activate;

    //addOnLoadHandler(self);
}

// This method must be called as soon as the document has been loaded
// to initialize the event handler.
function ImageDragger_activate() {
    this.imgX = getImagePageX(this.image(), this.path);
    this.imgY = getImagePageY(this.image(), this.path);

    this.layerWidth = getLayerWidth(this.layer());
    this.layerHeight = getLayerHeight(this.layer());

    setCursor(this.image(), "move");

    addEventHandler(this);
}

// Set the layer path to the layer that contains the images.
function ImageDragger_setImagePath(newPath) {
    this.path = newPath;
}

function ImageDragger_layer() {
    if (!this._layer) {
        this._layer = getLayerAt(this.path, this.path.length-1);
    }
    if (!this._layer) {
        alert("Document contains no DIV named '" + this.path[this.path.length-1] + "'.");
    }
    return this._layer;
}

function ImageDragger_image() {
    if (!this._image) {
        this._image = getLayerImage(this.layer(), this.imageName);
    }
    if (!this._image) {
        alert("Document contains no IMG named '" + this.imageName + "'.");
    }
    return this._image;
}

// Start dragging the image.  Any following mouse move events
// will cause the image to scroll within the browser window.
//
function ImageDragger_mouseDown(e) {
    if (!this.dragging) {
	var x = getEventX(e);
	var y = getEventY(e);

	this.dragging = 1;
	this.previousX = x;
	this.previousY = y;
    } 
    return false;
}

// Drag the image as many pixels as the mouse has moved.
//
function ImageDragger_mouseMove(e) {
    if (this.dragging) {
	var x = getEventX(e);
	var y = getEventY(e);

        var winW = getWindowWidth();// - (ie4 ? 12 : 0); // Remove width of scrollbar for IE.
        var winH = getWindowHeight();// - (ie4 ? 12 : 0);

        var newX = getLayerX(this.layer(), this.path) + x - this.previousX;
        var newY = getLayerY(this.layer(), this.path) + y - this.previousY;

//window.status = "LX: " + getLayerX(this.layer(), this.path) + " WW: " + winW + " IX: " + this.imgX + " NX: " + newX + " LW: " + this.layerWidth;
//window.status = "LY: " + getLayerY(this.layer(), this.path) + " WH: " + winH + " IY: " + this.imgY + " NY: " + newY + " LH: " + this.layerHeight;

        if (newX > 0) {
            newX = 0;
        } else if (newX + this.imgX + this.layerWidth < Math.min(winW, this.layerWidth)) {
            newX = -this.layerWidth - this.imgX + Math.min(winW, this.layerWidth);
        }

        if (newY > 0) {
            newY = 0;
        } else if (newY + this.layerHeight < Math.min(winH, this.layerHeight)) {
            newY = -this.layerHeight + Math.min(winH, this.layerHeight);
        }

//window.status = "move to " + newX + "," + newY;

        moveLayerTo(this.layer(), newX, newY);

        this.previousX = x;
        this.previousY = y;
    }
    return false;
}

// Stop dragging the window.  Any following mouse move events
// will be ignored.
//
function ImageDragger_mouseUp(e) {
    if (this.dragging) {
	this.dragging = 0;
    }
    return false;
}


var pagLoaded = 0;
var imgLoaded = 0;
var activated = 0;

function imageLoaded() {
    imgLoaded = 1;

    if (ie4 && pagLoaded && !activated) {
	dragger.bodyLoaded();
	activated = 1;
        return;
    }
	if (dom&&pagLoaded&& !activated) {
	dragger.bodyLoaded();
	activated = 1;
        return;
    }

 	if (!ie4 && !ns4) 
	{
 		//location.reload(); ...Euh pourquoi ça ???
	}

    if (ns4) 
	{
		dragger.bodyLoaded();
		activated = 1;
    }
}

function pageLoaded() {
    bodyLoaded();

    pagLoaded = 1;

    if (ie4 && imgLoaded && !activated) {
	dragger.bodyLoaded();
	activated = 1;
	   }
    if (dom && imgLoaded && !activated) {
	dragger.bodyLoaded();
	activated = 1;
	   }
}

var dragger = new ImageDragger('img');
dragger.setImagePath(['imgLayer']);

