var imgs = new Array(
"./images/sponsoren/spardabank.gif",
"./images/sponsoren/allianz.gif",
"./images/sponsoren/heinrichs.jpg",
"./images/sponsoren/dege.jpg",
"./images/sponsoren/ddm_huhnstock.jpg",
"./images/sponsoren/malermeister_ficker.jpg",
"./images/sponsoren/volksfuersorge.jpg",
"./images/sponsoren/fliesenscheune.jpg",
"./images/sponsoren/harzsparkasse.jpg",
"./images/sponsoren/lidke.jpg",
"./images/sponsoren/antik_halberstadt.jpg",
"./images/sponsoren/sport_barz.jpg",
"./images/sponsoren/volksbank.jpg",
"./images/sponsoren/unlimited_media.jpg");
var blendzeit = new Array(
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000,
5000);

var current = 0;
var current_back = 0;
var_curent_next = 0;
var faderzeit = 330;
var img_opacity = .99;


window.addEventListener?window.addEventListener("load",slideshow,false):window.attachEvent("onload",slideshow);

function slideshow()
{

    //Abbruch bei letztenbild
    if(current >= (imgs.length -1))
    {
    clearTimeout(op);
    document.getElementById("image").src = imgs[current];
    document.getElementById("image").style.opacity= .99;
    document.getElementById("image").style.MozOpacity= .99;
    document.getElementById("image").style.filter = "alpha(opacity=99)";
    current = 0;
    op = setTimeout(o_fade,(blendzeit[current] - faderzeit));
    return;
    }

    //Bild src schreiben
    document.getElementById("image").src = imgs[current];
    document.getElementById("image").style.opacity= .99;
    document.getElementById("image").style.MozOpacity= .99;
    document.getElementById("image").style.filter = "alpha(opacity=99)";
	op = setTimeout(o_fade,(blendzeit[current] - faderzeit));
	current++;
}

function cliffhanger()
{
    //Clear Funktionen
    if(typeof opb != 'undefined')
    {
    clearTimeout(opb);
    }
    if(typeof op != 'undefined')
    {
    clearTimeout(op);
    }
    if(typeof sh != 'undefined')
    {
    clearTimeout(sh);
    }

    //Abbruch bei letzten Bild
    if(current >= (imgs.length -1))
    {
    clearTimeout(op);
    current_next = imgs.length - 1;
    document.getElementById("image").src = imgs[current];
    document.getElementById("image").style.opacity= .99;
    document.getElementById("image").style.MozOpacity= .99;
    document.getElementById("image").style.filter = "alpha(opacity=99)";
    current = 0;
    op = setTimeout(o_fade,(blendzeit[current] - faderzeit));
    return;
    }

document.getElementById("image").src = imgs[current];
document.getElementById("image").style.opacity= .99;
document.getElementById("image").style.MozOpacity= .99;
document.getElementById("image").style.filter = "alpha(opacity=99)";
op= setTimeout(o_fade,(blendzeit[current] - faderzeit));
current++;
}

function o_fade()
{
img_opacity-= .09;

    if(img_opacity <= 0)
    {
    document.getElementById("image").style.opacity= .01;
    document.getElementById("image").style.MozOpacity= .01;
    document.getElementById("image").style.filter = "alpha(opacity=1)";
    img_opacity = .99;
    sh= setTimeout(slideshow,0);
    return;
    }
    else
    {
    blende();
    }
}

function blende()
{
document.getElementById("image").style.opacity= img_opacity;
document.getElementById("image").style.MozOpacity= img_opacity;
document.getElementById("image").style.filter = "alpha(opacity="+(img_opacity*100)+")";
opb = setTimeout(o_fade,(faderzeit / 11));
}

function MM_preloadImages()
{
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
