sliderwidth=550;
sliderheight=115;
slidespeed=1;
slidebgcolor="transparent";
imagegap=" " ;
slideshowgap=3;

var copyspeed=slidespeed;
var actualwidth='';
var cross_slide, ns_slide;
leftrightslide = '';

function fillup()
{
    cross_slide  = document.getElementById("test2_slideshow");
    cross_slide2 = document.getElementById("test3_slideshow");
    cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide;
    actualwidth=document.getElementById("temp_slideshow").offsetWidth+16;
    cross_slide2.style.left=actualwidth+slideshowgap+"px";
    lefttime=setInterval("slideleft()",100);
}

function slideshow(largeur_caroussel, hauteur_caroussel, id_name)
{
    if (largeur_caroussel)
        sliderwidth = parseInt(largeur_caroussel);
    if (hauteur_caroussel)
        sliderheight = parseInt(hauteur_caroussel);

    var affich = '<table border="0" cellspacing="0" cellpadding="0"><td>';
    affich += '<div style="position:relative;width:'+sliderwidth+'px;height:'+sliderheight+'px;overflow:hidden">'
    affich += '<div style="position:absolute;width:'+sliderwidth+'px;height:'+sliderheight+'px;background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">'
    affich += '<div id="test2_slideshow" style="position:absolute;left:0px;top:0px"></div>'
    affich += '<div id="test3_slideshow" style="position:absolute;left:-1000px;top:0px"></div>'
    affich += '</div></div>'
    affich += '</td></table>';


    if (! $('myslideshow'))
    {
        myslideshow = document.createElement ('div');
        myslideshow.setAttribute('id', 'myslideshow');
    }

    $(id_name).appendChild(myslideshow);
    myslideshow.innerHTML = affich;


    leftrightslide = '<nobr> ';
    if(document.getElementsByClassName("slideshow_image"))
    {
        var image5 = document.getElementsByClassName("slideshow_image");
        for(i=0; i < image5.length; i++)
        {
            var lien = image5[i].parentNode.href;
            var lien_deb = '';
            var lien_fin = '';
            if (lien)
            {
                lien_deb = '<a href="'+lien+'">';
                lien_fin = '</a>';
            }

            var imageheight = sliderheight;
            var imagewidth = sliderheight * image5[i].width / image5[i].height ;

            leftrightslide += lien_deb + '<img src="'+ image5[i].src +'" border="0" width="'+imagewidth+'" height="'+imageheight+'" />' + lien_fin + imagegap;
        }
    }
    leftrightslide += '</nobr> ';

    $('temp_slideshow').innerHTML = leftrightslide;

    //window.onload=fillup ;
    fillup() ;
}


function slideleft()
{
    if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
        cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
    else
        cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

    if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
        cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
    else
        cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
