//  Scriptcode der Slideshow ist von der Site: http://www.perlunity.de/javascript/scripts/javascript_0046_main.shtml

if(document.all)var isIE=true;

var fotos = new Array();

function neu(url,text)
{
        Neu = fotos.length;
        fotos[Neu] = new Array();
        fotos[Neu]["text"]=text;
        fotos[Neu]["pic"]=new Image()
        fotos[Neu]["pic"].src=url;
}

// editiere hier das große bild
exakt=false;                //false = runterskalieren | true = die exakte angegebene größe
height=300;                //bei exakt=false sollte die width sehr hoch gesetzt werden!
width=900;

preview=6;        //anzahl der thumbnails in der manual-navi-leiste
time=5000        //'slide'Zeit wie lange ein einzelnes Bild angezeigt wird in ms

function skalieren(x,h,w,e)
{
        H=fotos[x]["pic"].height;
        W=fotos[x]["pic"].width;
        W1=W;
        H1=H;
        if(!e)
        {
                if(H>h)
                {
                        W1=W*h/H;
                        H1=h;
                }
                if(W>w)
                {
                        H1=H*w/W;
                        W1=w;
                }
        }else
        {
                H1=h;
                W1=w;
        }
        var re = new Array();
        re["w"]=W1;
        re["h"]=H1;
        return(re); W1=""; H1=""; W=""; H="";
}
/* thumb_height=height/preview; */
thumb_height=33;
thumb_width=100000;
thumb_exakt=false;

function thumb_table(offset)
{
        table="<table width=100% height=100%>";
        for(var x=offset; x<=offset+preview-1; x++)
        {
                if(fotos[x])
                {
                        var Size = skalieren(x,thumb_height,thumb_width,thumb_exakt);
                        size="width="+Size["w"]+" height="+Size["h"];
                        table+="<tr><th><img "+size+" onclick=\"show('"+x+"',true)\" class='thumb' "+size+" src='"+fotos[x]["pic"].src+"' alt=\""+fotos[x]["text"]+"\"></th></tr>"
                }
        }
        table+="</table>";
        return(table);
}


var nav=0;
function navi(v)
{
        v=Number(v);
        if(nav+v>fotos.length-preview)
        {
                        V=fotos.length-preview;
        }else
        {
                if(nav+v<0)
                {
                        V=0;
                }else
                {
                        V=nav+v;
                }
        }
        nav=V;
        if(isIE)        document.getElementById("thumbs").filters.blendTrans.Apply();
        document.getElementById("thumbs").innerHTML=thumb_table(V);
        if(isIE)        document.getElementById("thumbs").filters.blendTrans.Play();
}
NAV=-1;
function show(x,fs)
{
        x=Number(x);
        if(fotos[x])
        {
                var Size = skalieren(x,height,width,exakt);
                if(fs){size="width="+Size["w"]+" height="+Size["h"]; alt="alt=\"\""; was=false} else {size=""; alt="alt=\"\""; was=true}
                if(isIE)        document.getElementById("inhalt").filters.blendTrans.Apply();
                document.getElementById("inhalt").innerHTML="<table height=100% width=100%><tr><th><b><img  onclick=\"show('"+x+"',"+was+")\" style=\"cursor:hand;\" "+size+" align=\"absmiddle\" src="+fotos[x]["pic"].src+" "+alt+"></th></tr></table>";
                if(isIE)        document.getElementById("inhalt").filters.blendTrans.Play();

                document.getElementById("name").innerHTML=fotos[x]["text"];
                document.getElementById("status").innerHTML=(x+1)+"/"+fotos.length;
        }
        NAV=x
}
var Timer; running=false;
function start()
{
        if(!running)
        {
                slideshow();
                running=true;
        }
}
function slideshow()
{
                NAV++;
                if(NAV>=fotos.length)NAV=0;
                show(NAV,true);
                Timer = setTimeout("slideshow()",time);
                document.getElementById("status2").innerHTML="[ on ]";
}
function kill()
{
        running=false
        document.getElementById("status2").innerHTML="[ off ]";
        if(Timer)clearTimeout(Timer);
}
