﻿// Ab hier kann man die Variablen ändern

var fadeDuration = 300; // Wie lange dauert Fade Effekt
var slideshowDuration = 6000; // Wie lange solln die Bilder angezeigt werden

var blenddiv = 'bgImg';
var blendImg = 'content';

var Pic = new Array() 

var startPath = 'url(img/slideshow/';

Pic[0] = startPath + '1.jpg)' 
Pic[1] = startPath + '2.jpg)' 
Pic[2] = startPath + '3.jpg)' 
Pic[3] = startPath + '4.jpg)' 
Pic[4] = startPath + '5.jpg)' 
Pic[5] = startPath + '6.jpg)'
Pic[6] = startPath + '7.jpg)'
Pic[7] = startPath + '8.jpg)'
Pic[8] = startPath + '9.jpg)'
Pic[9] = startPath + '10.jpg)'



// Ab hier nichts mehr ändern

var index = 0;

window.onload = function() {changeImg();}

function changeImg() 
{       

    if ( index == Pic.length )
        index = 0;
    
    
    document.getElementById(blendImg).style.backgroundImage = Pic[index];

    
    setTimeout("blendimage('" + blenddiv + "','" + blendImg + "', '" + Pic[index] + "'," + fadeDuration + ")", slideshowDuration);
    
    index++;   
}


function blendimage(divid, imageid, imagefile, millisec) 
{
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
    document.getElementById(divid).style.backgroundImage = document.getElementById(blendImg).style.backgroundImage;
    
    
    //make image transparent
    changeOpac(0, imageid);
    
    //make new image
    document.getElementById(imageid).style.backgroundImage = imagefile;
    

    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
    
    
    changeImg();
} 

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
