//---------------------------------------------------------------------------------------//
// name:       js-slideShow                                                                                  //
// version:   2.1                                                                                                //
// made by:  melko                                                                                             //
// email: melko@gmx.at                                                                                      //
//                                                                                                                    //
// info:                                                                                                             //
//         this script enables you to use so many slideShows as you want to                //
//         have on your page without any extra-programming.                                    //
//         Only you must do is to set the paths and image-names!                               //
//                                                                                                                     //
// features:                                                                                                       //
//              - so many slideShows as you want to have                                             //
//              - easy implementation in the sourcecode                                              //
//              - each slideShow has its own slideShowSpeed and crossFadeDuration      //
//              - choose between random or in the order                                   //
//              - set a fix picture at the start of a slideShow                           //
//											  //
// important:										  //
//	       - The slideShow MUST be initialized with the same number as the index      //
//                of the images it is containing!! example: images[1] = slideShowNr 1     //
//             - You should never have more slideShows than images defined!!              //
//----------------------------------------------------------------------------------------//

//Specify the global path to the directory
var bigPath="";

// pic arrays! FIRST POSITION IN THE ARRAY is the SMALLPATH to the pictures!
// if you no path want, then set "" !! Images starts allways with 0 !
var images = new Array();
// The FIRST slideShow with slideNr = 0 and so on... 

// HeadSlide "Hotel"
images[0] = ["","ess.jpg","image_slide-hotel02.jpg","image_slide-hotel03.jpg","image_slide-hotel04.jpg","img_hotel07.jpg","veranda.jpg","img_hotel06.jpg"];
// HeadSlide "Kinder"
images[1] = ["","image_slide-kinder01.jpg","image_slide-kinder02.jpg","image_slide-kinder03.jpg","image_slide-kinder04.jpg","image_slide-kinder05.jpg","image_slide-kinder06.jpg"];
// HeadSlide "SportFreizeit"
images[2] = ["","image_slide-sportfreizeit01.jpg","image_slide-sportfreizeit02.jpg","image_slide-sportfreizeit03.jpg","image_slide-sportfreizeit04.jpg","image_slide-sportfreizeit05.jpg","image_slide-sportfreizeit06.jpg"];
// HeadSlide "WellnessErholung"
images[3] = ["","image_slide-wellnesserholung01.jpg","image_slide-wellnesserholung02.jpg","image_slide-wellnesserholung03.jpg","image_slide-wellnesserholung04.jpg","image_slide-wellnesserholung05.jpg","image_slide-wellnesserholung06.jpg","image_slide-wellnesserholung07.jpg"];
// HeadSlide "Tradition"
images[12] = ["","image_slide-tradition01.jpg","image_slide-tradition02.jpg","image_slide-tradition03.jpg","image_slide-tradition04.jpg","image_slide-tradition05.jpg"];
// HeadSlide "Berg"
images[13] = ["","image_slide-berg01.jpg","image_slide-berg02.jpg","image_slide-berg03.jpg","image_slide-berg04.jpg","image_slide-berg05.jpg"];
// HeadSlide "Massage"
images[14] = ["","image_slide-massage01.jpg","image_slide-massage02.jpg","image_slide-massage03.jpg","image_slide-massage04.jpg"];
// HeadSlide "Nordic Walking"
images[15] = ["","image_slide-nordicwalking01.jpg","image_slide-nordicwalking02.jpg","image_slide-nordicwalking03.jpg","image_slide-nordicwalking04.jpg"];
// HeadSlide "Rad"
images[16] = ["","image_slide-rad01.jpg","image_slide-rad02.jpg","image_slide-rad03.jpg","image_slide-rad04.jpg"];
// HeadSlide "Seesauna"
images[17] = ["","image_slide-seesauna01.jpg","image_slide-seesauna02.jpg","image_slide-seesauna03.jpg","image_slide-seesauna04.jpg","image_slide-seesauna05.jpg"];
// HeadSlide "Thermen"
images[18] = ["","image_slide-thermen01.jpg","image_slide-thermen02.jpg","image_slide-thermen03.jpg"];
// HeadSlide "Golf"
images[19] = ["","image_slide-golf01.jpg","image_slide-golf02.jpg","image_slide-golf03.jpg"];
// HeadSlide "Wassersport"
images[20] = ["","image_slide-wassersport01.jpg","image_slide-wassersport02.jpg","image_slide-wassersport03.jpg","image_slide-wassersport04.jpg","image_slide-wassersport05.jpg"];
// HeadSlide "Burgen"
images[21] = ["","image_slide-burgen01.jpg","image_slide-burgen02.jpg","image_slide-burgen03.jpg","image_slide-burgen04.jpg"];
// HeadSlide "Kultur"
images[22] = ["","image_slide-kultur01.jpg","image_slide-kultur02.jpg","image_slide-kultur03.jpg","image_slide-kultur04.jpg","image_slide-kultur05.jpg","image_slide-kultur06.jpg"];
// HeadSlide "Sehenswertes"
images[23] = ["","image_slide-sehenswertes01.jpg","image_slide-sehenswertes02.jpg","image_slide-sehenswertes03.jpg","image_slide-sehenswertes04.jpg","image_slide-sehenswertes05.jpg","image_slide-sehenswertes06.jpg"];
// HeadSlide "Start"
images[24] = ["","image_slide-start01.jpg","image_slide-start02.jpg","st3.jpg"];
// HeadSlide "Verpflegung"
images[25] = ["","image_slide-verpflegung01.jpg","image_slide-verpflegung02.jpg","image_slide-verpflegung03.jpg","image_slide-verpflegung04.jpg","image_slide-verpflegung05.jpg"];
// HeadSlide "Wörthersee Festspiele"
images[26] = ["","image_slide-wfestspiele01.jpg","image_slide-wfestspiele02.jpg","image_slide-wfestspiele03.jpg","image_slide-wfestspiele04.jpg","image_slide-wfestspiele05.jpg"];
// HeadSlide "Carinthischer Sommer"
images[27] = ["","image_slide-carintsommer01.jpg","image_slide-carintsommer02.jpg","image_slide-carintsommer03.jpg","image_slide-carintsommer04.jpg"];
// HeadSlide "Ferienwohnungen"
images[34] = ["","image_slide-ferienwohnung01.jpg","image_slide-ferienwohnung02.jpg","image_slide-ferienwohnung03.jpg","image_slide-ferienwohnung04.jpg","image_slide-ferienwohnung05.jpg","image_slide-ferienwohnung06.jpg","image_slide-ferienwohnung07.jpg"];
// HeadSlide "Tennis"
images[35] = ["","image_slide-tennis01.jpg","image_slide-tennis02.jpg","image_slide-tennis03.jpg","image_slide-tennis04.jpg"];
// HeadSlide "Burgarena"
images[40] = ["","image_slide-burgarena01.jpg","image_slide-burgarena02.jpg","image_slide-burgarena03.jpg"];

// ContentSlide Zimmer B/C
images[28] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","1477506200536031815.JPG","1283553201040011611.JPG"];
// ContentSlide Zimmer D
images[29] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","506037200531031621.JPG","230720200509121122.JPG"];
// ContentSlide Appartement A1
images[30] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","1477201200536031815.JPG","230519200509121122.JPG"];
// ContentSlide Appartement A2
images[36] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","1477303200536031815.JPG","273943200528121722.JPG"];
// ContentSlide Appartement A3
images[37] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","1477404200536031815.JPG","273743200528121722.JPG"];
// ContentSlide Ferienwohnung A
images[4] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","427943200516121815.JPG","428043200516121815.JPG","428144200516121815.JPG"];
// ContentSlide Ferienwohnung B
images[5] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","428245200516121815.JPG","428347200516121815.JPG","428448200516121815.JPG"];
// ContentSlide Ferienwohnung C
images[6] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","428549200516121815.JPG","428650200516121815.JPG"];
// ContentSlide Ferienwohnung D
images[7] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","428751200516121815.JPG","427842200516121815.JPG"];

// PopupSlide Zimmer B/C
images[31] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","240115200542121222.JPG","1282155201036011611.JPG"];
// PopupSlide Zimmer D
images[32] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","240319200542121222.JPG","240420200542121222.JPG"];
// PopupSlide Appartement A1
images[33] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","240624200542121222.JPG","240726200542121222.JPG"];
// PopupSlide Appartement A2
images[38] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","240827200542121222.JPG","274609200532121722.JPG"];
// PopupSlide Appartement A3
images[39] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","240929200542121222.JPG","274508200532121722.JPG"];
// PopupSlide Ferienwohnung A
images[8] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","241031200542121222.JPG","241133200542121222.JPG","241235200542121222.JPG"];
// PopupSlide Ferienwohnung B
images[9] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","241337200542121222.JPG","241439200542121222.JPG","241541200542121222.JPG"];
// PopupSlide Ferienwohnung C
images[10] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","241643200542121222.JPG","241745200542121222.JPG"];
// PopupSlide Ferienwohnung D
images[11] = ["http://www.seerose.info/wcms/Clients/118200516021015/Images/","241847200542121222.JPG","241949200542121222.JPG"];


// do not edit anything below this line 
//-------------------------------------------------------------------------------------//
var slideSpeed = new Array();
var crossFade = new Array();  
var index = new Array(); 
var pic = new Array(); 
var smallPath = new Array();
var preLoad = new Array(); 

// Initialize the slideShow... 
// @param slideNr - The slideNr of the slideShow... Every slide shoud start with 1
// @param slideShowSpeed - The speed of the slideShow in ms! (1sec. = 1000ms)
// @param crossFadeDuration - The duration of the crossFade (changing one picture through an other) values: 1, 2, 3,...
// @param random - Indicates if the slideShow shoud choose the pictures randomly or in the order. values; true, false
// @param fixStartPic - Indicates if the slideShow, with random = true, should have a fixStart picture at refreshing the page. Its the first image in the array. values: true, false
function init(slideNr, slideShowSpeed, crossFadeDuration, random, fixStartPic) {

index[slideNr] = 0;
slideSpeed[slideNr] = slideShowSpeed;
crossFade[slideNr] = crossFadeDuration;
smallPath[slideNr] = images[slideNr][0];
pic[slideNr] = new Array();
for(var i = 0; i < images[slideNr].length-1; i++){
pic[slideNr][i] = images[slideNr][i+1];
}

prepareSlide(slideNr, fixStartPic, random, pic[slideNr].length);
}

// Prepare the slideShow, set the pictures-order, fixStartPic and load it into PreLoad-Object
// @param slideNr - The slideNr of the slideShow... Every slide shoud start with 1
// @param fixStartPic - Indicates if the slideShow, with random = true, should have a fixStart picture at refreshing the page. Its the first image in the array. values: true, false 
// @param random - Indicates if the slideShow shoud choose the pictures randomly or in the order. values; true, false
// @param picLength - It's the length of the pic-Array of this slideShow
function prepareSlide(slideNr, fixStartPic, random, picLength){
	
	var duplicate = false;
	var reihenfolge = new Array();
	var z=0;
	
	if(fixStartPic){
		reihenfolge[0] = 0;
		z=1;
	}
	
	while (z != picLength){
		y=Math.floor(Math.random()*(picLength));
		for(i=0;i<reihenfolge.length;i++){	
			if (y==reihenfolge[i]){	
				duplicate=true;
			}
		}
		if (duplicate==true){ 
			duplicate=false;
			continue;
		} 
		else if (duplicate==false) { 
			reihenfolge[z] = y; z+=1; 
			
		}
	}
	preLoad[slideNr] = new Array();
	
if(random) {
for(i = 0; i < picLength; i++){
preLoad[slideNr][i] = new Image();
preLoad[slideNr][i].src = bigPath + smallPath[slideNr] + pic[slideNr][reihenfolge[i]];
}
} 
else {
for (i = 0; i < picLength; i++) { 
preLoad[slideNr][i] = new Image(); 
preLoad[slideNr][i].src = bigPath + smallPath[slideNr] + pic[slideNr][i]; 
} 
}
}

// Run the slideShow with the slideNr that indicates the special slide
// @param slideNr - The slideNr of the slideShow... Every slide shoud start with 1
function runSlideShow(slideNr) { 
	var element = document.getElementById("slide"+slideNr);
	
	if (document.all) { 
		element.style.filter='blendTrans(duration='+crossFade[slideNr]+')'
		element.filters.blendTrans.Apply(); 
	} 
	element.src = preLoad[slideNr][index[slideNr]].src; 
	
	if (document.all) { 
		element.filters.blendTrans.Play(); 
	} 
	index[slideNr] += 1; 
	
	if (index[slideNr] > (preLoad[slideNr].length - 1)) {
		index[slideNr] = 0;
	}
	setTimeout('runSlideShow('+slideNr+')', slideSpeed[slideNr]); 
}