var sekunden=7000
var anz="auto"
var auswahl=0
var alle=0
if (document.getElementById){document.write('<style type="text/css"> &nbsp;  .gallerycontent{display:none;} &nbsp;</style>')}
function getElementbyClass(classname){ sammel=new Array()
var acc=0
var sammeln=document.all? document.all.tags("DIV") : document.getElementsByTagName("*")
for (i=0; i<sammeln.length; i++){
if (sammeln[i].className==classname)
sammel[acc++]=sammeln[i]
}}
function contractall(){
var acc=0
while (sammel[acc]){
sammel[acc].style.display="none"
acc++
}
}

function expandone(){
var auswahlObj=sammel[auswahl]
contractall()
auswahlObj.style.display="block"
if (document.gallerycontrol)
temp.options[auswahl].selected=true
auswahl=(auswahl<alle-1)? auswahl+1 : 0
if (anz=="auto")
autocontrolvar=setTimeout("expandone()",sekunden)
}

function populatemenu(){
temp=document.gallerycontrol.menu
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<alle;i++){
var thesubject=sammel[i].getAttribute("subject")
thesubject=(thesubject=="" || thesubject==null)? "HTML Content "+(i+1) : thesubject
temp.options[i]=new Option(thesubject,"")
}
temp.options[0].selected=true
}

function manualcontrol(menuobj){
if (anz=="manual"){
auswahl=menuobj
expandone()
}
}

function preparemode(themode){
anz=themode
if (typeof autocontrolvar!="undefined")
clearTimeout(autocontrolvar)
if (themode=="auto"){
document.gallerycontrol.menu.disabled=true
autocontrolvar=setTimeout("expandone()",sekunden)
}
else
document.gallerycontrol.menu.disabled=false
}
function startgallery(){
if (document.getElementById("controldiv")) //if it exists
document.getElementById("controldiv").style.display="block"
getElementbyClass("gallerycontent")
alle=sammel.length
if (document.gallerycontrol){
populatemenu()
if (document.gallerycontrol.mode){
for (i=0; i<document.gallerycontrol.mode.length; i++){
if (document.gallerycontrol.mode[i].checked)
anz=document.gallerycontrol.mode[i].value
}
}
}
if (anz=="auto" && document.gallerycontrol)
document.gallerycontrol.menu.disabled=true
expandone()
}

if (window.addEventListener)
window.addEventListener("load", startgallery, false)
else if (window.attachEvent)
window.attachEvent("onload", startgallery)
else if (document.getElementById)
window.onload=startgallery
