//=====================================================================||
//               NOP Design Media Cycling Script                       ||
//                                                                     ||
// For more information on SmartSystems, or how NOPDesign can help you ||
// Please visit us on the WWW at http://www.nopdesign.com              ||
//                                                                     ||
// The media cycler is available as freeware from NOP Design, under the||
// GNU Public License.  You must keep this comment unchanged in your   ||
// code.  For more information contact Scott@NopDesign.com             ||
//                                                                     ||
// MediaCyle Script Module, V.1.0.0                                    ||
//=====================================================================||
//---------------------------------------------------------------------||
// INTERNAL GLOBAL VARIABLES                                           ||
// PURPOSE:     Internal use only, do not modify.                      ||
//---------------------------------------------------------------------||
var xMediaContent  = new Array();
var xMediaImage    = new Image;
var iCurrentImage  = 0;
var iInternalCount = 5000;
var xTimerHandle   = null;
var bTimerRunning  = false;


//---------------------------------------------------------------------||
// USER DEFINED VARIABLES                                              ||
// PURPOSE:     Set these variables to customize your script           ||
//              TimeInSecondsBetweenCycles - Seconds to wait before    ||
//                                           cycling to the next image ||
//              LoadInNewWindow            - When true, the link will  ||
//                                           be opened in a new window ||
//                                           otherwise, it will load in||
//                                           the current window.       ||
//              WrapAtEnd                  - Wraps to start at end.    ||
//                                                                     ||
//              MEDIAIMAGE                - Needs defined in your HTML ||
//                                           page as an image name.    ||
//---------------------------------------------------------------------||
var TimeInSecondsBetweenCycles = 4.0;
var LoadInNewWindow = false;
var WrapAtEnd       = true;


//---------------------------------------------------------------------||
// MEDIA FILES TO LOAD                                                 ||
// PURPOSE:     This is the image that you wish displayed, followed by ||
//              the URL to link to.  All images should be on even      ||
//              numbered lines, URLS on odd.  Pay careful attention to ||
//              increment the counter inside of the [] symbols when you||
//              add more images.  There is no maximum to the amount of ||
//              images you can load.                                   ||
//---------------------------------------------------------------------||
xMediaContent[0] = "./images/la287.JPG";
xMediaContent[1] = "robe-creole.html";

xMediaContent[2] = "./images/maillot/crochet-trikini-6.JPG"; 
xMediaContent[3] = "maillot-catherine-jeandel.html";

xMediaContent[4] = "./images/la283.JPG";
xMediaContent[5] = "ensembles.html";

xMediaContent[6] = "./images/beachwear-11.jpg";
xMediaContent[7] = "divers.html";

xMediaContent[8] = "./images/phe-front.jpg";
xMediaContent[9] = "bakoua.html";

xMediaContent[10] = "./images/maillot/trikini-panthere-3.JPG";
xMediaContent[11] = "maillot.html";

xMediaContent[12] = "./images/la468.JPG";
xMediaContent[13] = "beachwear.html";

xMediaContent[14] = "./images/mariee/robe-cyn0042-small.JPG";
xMediaContent[15] = "accessoires.html";

xMediaContent[16] = "./images/jupe-flyer.JPG";
xMediaContent[17] = "jupe.html";

xMediaContent[18] = "./images/soiree/robe-mariage-small.jpg";
xMediaContent[19] = "robe-mariee-bustier.html";

xMediaContent[20] = "./images/la92.JPG";
xMediaContent[21] = "coiffe.html";

xMediaContent[22] = "./images/maillot-bikini-media.jpg";
xMediaContent[23] = "maillot-trikini-catherine-jeandel.html";

xMediaContent[24] = "./images/mariee/bra0055-small.JPG";
xMediaContent[25] = "soutien-gorge-ss-bretelles.html";

xMediaContent[26] = "./images/la163.JPG";
xMediaContent[27] = "maillot-trikini-catherine-jeandel-2.html";

xMediaContent[28] = "./images/la49.JPG";
xMediaContent[29] = "jupe.html";

xMediaContent[30] = "./images/la13.JPG";
xMediaContent[31] = "ensembles.html";

xMediaContent[32] = "./images/la121.JPG";
xMediaContent[33] = "flash.html";

xMediaContent[34] = "./images/soiree/robe-al.jpg";
xMediaContent[35] = "robe-mariee-bustier.html";

xMediaContent[36] = "./images/la97.JPG";
xMediaContent[37] = "maillot-trikini-catherine-jeandel.html";

xMediaContent[38] = "./images/la124.JPG";
xMediaContent[39] = "robe-creole.html";

xMediaContent[40] = "./images/short0127-small.JPG";
xMediaContent[41] = "ensemble.html";

xMediaContent[42] = "./images/golle-dos-110-small.JPG";
xMediaContent[43] = "robe-creole.html";

xMediaContent[44] = "./images/short-phe.jpg";
xMediaContent[45] = "top.html";

xMediaContent[46] = "./images/la240.JPG";
xMediaContent[47] = "accessoires.html";

xMediaContent[48] = "./images/chapeau-paille-1.JPG";
xMediaContent[49] = "bakoua.html";

xMediaContent[50] = "./images/lingerie/busep9890-small.JPG";
xMediaContent[51] = "nuisette-sexy.html";

xMediaContent[52] = "./images/soiree/yasmine909-s3.JPG";
xMediaContent[53] = "robe-bal-soiree.html";

xMediaContent[54] = "./images/cdj-defile-small.JPG";
xMediaContent[55] = "defile.html";

xMediaContent[56] = "./images/soiree/sido-fendue-3s.jpg";
xMediaContent[57] = "robe-soiree.html";




//---------------------------------------------------------------------||
// FUNCTION:    MediaStop                                              ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Moves the media                                        ||
//---------------------------------------------------------------------||
function MediaStop()
{
    if( bTimerRunning )
        clearTimeout( xTimerHandle );

    bTimerRunning = false;
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaGoBack                                            ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Moves the media                                        ||
//---------------------------------------------------------------------||
function MediaGoBack()
{
    MediaStop();

    if (WrapAtEnd)
      (iCurrentImage == 0) ? iCurrentImage = (xMediaContent.length - 2) : iCurrentImage-=2;
    else
      (iCurrentImage == 0) ? iCurrentImage = 0 : iCurrentImage-=2;

    document.MEDIAIMAGE.src = xMediaContent[iCurrentImage];
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaGoForward                                         ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Moves the media                                        ||
//---------------------------------------------------------------------||
function MediaGoForward()
{
    MediaStop();

    if (WrapAtEnd)
      (iCurrentImage == (xMediaContent.length - 2)) ? iCurrentImage = 0 : iCurrentImage+=2;
    else
      (iCurrentImage == (xMediaContent.length - 2)) ? iCurrentImage = iCurrentImage : iCurrentImage+=2;

    document.MEDIAIMAGE.src = xMediaContent[iCurrentImage];
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaInternalCycle                                     ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Internal media cycle routine                           ||
//---------------------------------------------------------------------||
function MediaInternalCycle()
{
    (iCurrentImage == (xMediaContent.length - 2)) ? iCurrentImage = 0 : iCurrentImage+=2;
    if( document.MEDIAIMAGE ) document.MEDIAIMAGE.src = xMediaContent[iCurrentImage];

    xTimerHandle   = setTimeout("MediaInternalCycle()", iInternalCount);
    bTimerRunning  = true;
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaStart                                             ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Starts the media cycling. Call with 'OnLoad' from body ||
//              tag to have an image start cycling on page load.       ||
//---------------------------------------------------------------------||
function MediaStart()
{
    iInternalCount = TimeInSecondsBetweenCycles * 1000;
    MediaStop();
    MediaInternalCycle();
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaClick                                             ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Clicks straight through to your media URL              ||
//---------------------------------------------------------------------||
function MediaClick()
{
    if( LoadInNewWindow ) {
        URL = xMediaContent[iCurrentImage+1];
        win=window.open(URL,"NewWindow","");
        if (!win.opener)win.opener=self;
    } else
        document.location.href = xMediaContent[iCurrentImage+1];
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaClickWithInfo                                     ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Clicks to the URL you have listing in your media, plus ||
//              the value passed in as 'ADDITIONAL INFO'.  This is     ||
//              useful if you have defined your media URL's as         ||
//              directories, and have multiple files in those directori||
//---------------------------------------------------------------------||
function MediaClickWithInfo( AdditionalInfo )
{
    if( LoadInNewWindow ) {
        URL = xMediaContent[iCurrentImage+1] + AdditionalInfo;
        win=window.open(URL,"NewWindow","");
        if (!win.opener)win.opener=self;
    } else
        document.location.href = (xMediaContent[iCurrentImage+1] + AdditionalInfo);
}


