/*

 (C) 2000 www.CodeLifter.com
 http://www.codelifter.com
 Free for all users, but leave in this  header
 NS4-6,IE4-6
 Fade effect only in IE; degrades gracefully
 
 
 
===========================================================
Script:   JavaScript Cross-Browser SlideShow Script
          With Cross-Fade Effect between Images
          Adjustable Timing and Unlimited Images
Function: Displays images continuously in a slideshow
          presentation format, with a fade effect on
          image transitions.
Browsers: All common browsers: NS3-6, IE 4-6
          Fade effect only in IE; others degrade gracefully
Author:   etLux
===========================================================




===========================================================

changelog
 2004-02-23: Edit to fit the site,  By Mikael Sundin
 2004-04-03: Fixed some TODO, 		By Mikael Sundin

===========================================================
*/

// =======================================
// do not edit anything below this line
// =======================================


var slideShowIndex=0;
var slideShowPreLoad = new Array();
var slideShowRunning = false;
var slideShowPic;
var slideShowAlt;
var slideShowTitle;
var slideShowURL;
        
//en knapp som slår på/av slideshowen
function slideShowButton(button, time ,strRun, strNotRun){
    if(slideShowRunning){
        slideShowRunning=false;
        button.value=strRun
    }else{
        slideShowRunning=true;
        button.value = strNotRun;
        slideShowSpeed = time*1000;
        runSlideShow();
    }
}

//visar nästa bild
function nextImage(){
    showImage(++slideShowIndex);
}

//visar förgående bild
function prewImage(){
    showImage(--slideShowIndex);
}

//visar första bild
function firstImage(){
    slideShowIndex=0;
    showImage(slideShowIndex);
}

//visar sista bild
function lastImage(){
    slideShowIndex=(slideShowPic.length-1);
    showImage(slideShowIndex);
}

//visar en bild, laddar den före den visas, fadar in
function showImage(index){
   if(index<0)index=0;
   if(index>(slideShowPic.length-1))index=(slideShowPic.length-1)
   
   if(slideShowPreLoad[index] == null){
        slideShowPreLoad[index] = new Image();
        slideShowPreLoad[index].src = slideShowPic[index];
   }
   
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)";
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.SlideShow.filters.blendTrans.Apply();
   }
   
   document.images.SlideShow.src = slideShowPreLoad[index].src;
   document.images.SlideShow.alt = slideShowAlt[index];
   document.forms['slideshow'].slideshowtitle.value = slideShowTitle[index];
   
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play();
   } 
   
    
}

//kör slideshowen
function runSlideShow(){
   if(!slideShowRunning)return;
   showImage(slideShowIndex);

   slideShowIndex++;
   //börjar om från början
   if (slideShowIndex > (slideShowPic.length-1)) slideShowIndex=0;
   
   setTimeout('runSlideShow()', slideShowSpeed);
}
