﻿// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth = 250;
defaultHeight = 900;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================

////// SCROLLER CONFIGURATION ///////////////////////////////////////////////////////////////////  
var marqueeTimer = 0;
vitesse = 50; //vitesse de défilement - 1 rapide, 100 très lent	
courant = 0;

orientation = "vertical"        // Orientation of scroller (horizontal or vertical)
scrollerWidth = "250"             // Width of entire scroller.
scrollerHeight = "900"             // Height of Scroller.
borderWidth = 0                   // Width of border. (use 0 for no border).
borderColour = "#ffffff"          // Colour of scroller border. (Use either hexadecimal or text values. e.g. "#FF0000" or "Red") 
backColour = "#ffffff"              // Colour of scroller background. (Use either hexadecimal or text values. e.g. "#FF0000" or "Red") 
staticColour = "#013300"          // Colour of scroller items that are NOT a link. (including scrollerDivider characters)
stopScroll = 1                    // Pause the scroller on mouseOver. (use 0 for no.)
textAlignment = "left"            // Alignment of each scroller item.  Only really makes a difference on vertical scroller
// (center, left, right, justify)

// Scroller Links
linkFont = "verdana, arial"                // Font of scroller links;
linkWeight = "normal"             // Weight of scroller links;
linkColour = "#ffffff"            // Colour of scroller links
linkSize = "10"                   // Size of links (in points)
linkDecoration = "none"           // Decoration of links. (underline, overline, none)

// Scroller Links On MouseOver
slinkFont = "verdana, arial"               // Font of scroller links;
slinkWeight = "normal"            // Weight of scroller links;
slinkColour = "#cc0000"           // Colour of scroller links
slinkSize = "10"                  // Size of links (in points)
slinkDecoration = "underline"     // Decoration of links. (underline, overline, none)

scrollerDivider = "" // Character to place between each scroller item. 
// <img> tags can be used if an image is required. 
// Use "0" for nothing.  For Vertical scrollers, it is best to use "<br>"
newWidth = 0;

////// DO NOT EDIT BELOW THIS LINE  ///////////////////////////////////////////////////////////////////

function buildScroller() {
    scroller = '<table border="0" cellpadding="0" cellspacing="0" style="width:' + scrollerWidth + ';height:' + scrollerHeight + ';border:' + borderWidth + 'px solid ' + borderColour + ';background-color:' + backColour + '">';
    scroller += '<tr><td valign="middle"><div id="div" style="';
    if (orientation == "horizontal")
        scroller += 'height:' + scrollerHeight + ';';
    if (orientation == "vertical")
        scroller += 'width:' + scrollerWidth + ';';
    scroller += ' position:relative; background-color:' + backColour + '; overflow:hidden">';
    scroller += '<div id="div1" style="position:relative; left:0; z-index:1">';
    scroller += '<table cellpadding=0 cellspacing=0 border="0" name="table" id="table"';
    scroller += ' style="width:' + scrollerWidth + '"';
    scroller += '><tr>';
    y = 0;
    while (y < 4) {
        for (x = 0; x < (Article.length); x++) {
            if (orientation.toLowerCase() == "vertical") {
                scroller += '<tr>';
            }
            scroller += '<td ';
            if (orientation.toLowerCase() == "horizontal") {
                scroller += 'nowrap';
            }
            if (stopScroll == 1) {
                scroller += ' onMouseOver="stopScroller();" onMouseOut="setWidth()"';
            }
            scroller += '>';
            scroller += '<img src="' + Article[x] + '" width="' + scrollerWidth + '"/><br/><br/>';
            scroller += '<\/td><td>&nbsp;</td>';

            if (orientation.toLowerCase() == "vertical") { scroller += '<\/tr>'; }

            if (scrollerDivider.toLowerCase() != "none") { scroller += '<td nowrap=nowrap>' + scrollerDivider + '<\/td>'; }
        }
        y++
    }
    scroller += '<\/tr><\/table><\/div><\/div><\/td><\/tr><\/table>';
    document.writeln(scroller);
}

// Ensure the width of the scroller is divisible by 2. This allows smooth flowing of the scrolled content
function setWidth() {
    tableObj = document.getElementById("table");
    obj = document.getElementById("div1");
    objWidth = (orientation.toLowerCase() == "horizontal") ? getOffset(tableObj, "width") : getOffset(tableObj, "height");
    HalfWidth = Math.floor(objWidth / 2);
    newWidth = (HalfWidth * 2) + 2;
    obj.style.width = newWidth;
    moveLayer();
}

// Move the layer by one pixel to the left
function moveLayer() {
    obj = document.getElementById("div1");
    maxLeft = (0 - (newWidth / 2) + 2) / 2
    if (orientation.toLowerCase() == "horizontal") {
        document.getElementById("div1").style.left = (parseInt(document.getElementById("div1").style.left.replace("px", "")) <= maxLeft) ? 0 : (parseInt(document.getElementById("div1").style.left.replace("px", "")) - 1) + "px";
    }
    else {
        if (document.getElementById("div1").style.top == "") {
            document.getElementById("div1").style.top = "0px";
        }
        if (parseInt(document.getElementById("div1").style.top.replace("px", "")) < (0 - (newWidth / 2) + 6)) {
            document.getElementById("div1").style.top = "0px";
        }
        else {
            document.getElementById("div1").style.top = (parseInt(document.getElementById("div1").style.top.replace("px", "")) - 1) + "px";
        }
    }
    marqueeTimer = setTimeout("moveLayer()", vitesse);
}

// Get width and height of layer
function getOffset(obj, dim) {
    if (dim == "width") {
        oWidth = obj.offsetWidth;
        return oWidth;
    }
    else if (dim == "height") {
        oHeight = obj.offsetHeight;
        return oHeight;
    }
}

function stopScroller() {
    clearTimeout(marqueeTimer);
}

function runScroller() {
    setWidth();
}
