﻿// Ab hier kann man die Variablen ändern

var fadeDuration = 500; // Wie lange dauert Fade Effekt
var slideshowDuration = 6000; // Wie lange solln die Bilder angezeigt werden

var blenddiv = 'startpage_top';
var blendImg = 'startpage_top_innerdiv';

var pic = new Array();
var link = new Array();

var startPath = 'url(/img/slideshow/';

pic[0] = startPath + 'HeaderScanner.jpg)';
pic[1] = startPath + 'HeaderAlpinfraSchrauber.jpg)';
pic[2] = startPath + 'HeaderAlpinfraBau.jpg)';
pic[3] = startPath + 'HeaderAusblick.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)';


// pic[0] gehört zum letzten link => pic[x] = link[x-1]
link[3] = "/Abgeschlossene_und_aktuelle_F_E___Projekte.aspx";

link[0] = "/Philosophie.aspx";
link[1] = "/ÖBA___Bauwirtschaft.aspx";
link[2] = "/Arbeitsweise.aspx";

//link[4] = "/#5";
//link[5] = "/#6";
//link[6] = "/#7";
//link[7] = "/#8";
//link[8] = "/#9";
//link[9] = "/#10";


// Ab hier nichts mehr ändern

var slideshowIndex = 0;

function changeImg() 
{       

    if ( slideshowIndex == pic.length )
        slideshowIndex = 0;
    
    
    document.getElementById(blendImg).style.backgroundImage = pic[slideshowIndex];

    
    setTimeout("blendimage('" + blenddiv + "','" + blendImg + "', '" + pic[slideshowIndex] + "', " + fadeDuration + ", '" + link[slideshowIndex] + "')", slideshowDuration);
    
    slideshowIndex++;   
}


function blendimage(divid, imageid, imagefile, millisec, link) 
{
    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));
        if(i == 100)
            setTimeout("changeLink('" + link + "')", (-100 * speed));
        timer++;
    }
    //alert(link)
    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 + ")";
}

// change link
function changeLink(link)
{
    document.getElementById("startpage_top_link").href = link;
}
