function runSlideShow(runShowFlag) {

    SlideShowSpeed = 4000;
    if(typeof(document.images.PictureBox) == "undefined")
    {
        return;
    }

    if (document.all){
        document.images.PictureBox.style.filter="blendTrans(duration=2)";
        document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
        document.images.PictureBox.filters.blendTrans.Apply();
    }

    if (document.getElementById) // If we`re not in Netscape 4.x
    {
        featImage = featImageArray[jss];
        document.images.PictureBox.src = featImage;
        if (document.getElementById) {
			var x = cssQuery("li[class='feat']");
			var sfEls = cssQuery("a", x);
			for (var i=0; i<sfEls.length; i++)
			{
				sfEls[i].style.background = "#dcd7c1";
			}
			document.getElementById(jss).style.background = "#ffffff";
            document.getElementById("featTitle").innerHTML = featTitleArray[jss];
            //document.getElementById("featPrice").innerHTML = featPriceArray[jss];
            document.getElementById("featLocation").innerHTML = featLocationArray[jss];
            document.getElementById("featBrok").innerHTML = featBrokArray[jss];

        }
        if (document.all) document.images.PictureBox.filters.blendTrans.Play();
        featID = featIDArray[jss];
        jss = jss + 1;
        if (jss > (pss)) jss=0;
        //if (runShowFlag){
            tss = setTimeout('runSlideShow()', SlideShowSpeed);
         //   }
    }
}

//pss is length of image array - 1....
//jss is the current image number
//tss is the timer

function skipTo(number) {
    jss = number;
    clearTimeout(tss);
    runSlideShow(true);
}

function stop(number) {
    jss = number;
    clearTimeout(tss);
}

function control(direction){

//jss will tell the script which element in the array to load
//alert(jss);

//if forward is clicked, then the current index is the next in the array
if (direction=="f") 
{
    jss = jss;
    //if the selected index is greater than the last index of the array
    //then set the current index to 0 which is the first image in the array
    if (jss > (pss)) jss = 0;

    //if the selected index is less than 1
    //then set the current index to the last index in the array
    if (jss < 0) jss = pss;
    
}

//if previous is clicked then we need to subtract 2 from the current
//index because the current index is always one ahead of the slide number
if (direction=="b")
{ 
    jss = jss-2; 
    //alert(jss);
    
    

    //if the selected index is greater than the last index of the array
    //then set the current index to 0 which is the first image in the array
    if (jss > (pss)) jss = 0;

    //if the selected index is less than 1
    //then set the current index to the last index in the array
    //if (jss = -2) jss = pss -1;
    
    //if (jss = -1) jss = pss;
    
    if(jss < 0) jss = jss + featImageArray.length;

}

//stop the slideshow
clearTimeout(tss);
runSlideShow(false);
}