var pauze=10000 // aantal milliseconden
var displaymode="auto"
if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.newsitem{display:none;}\n')
document.write('</style>\n')}
var selectedDiv=0
var totalDivs=0

function getElementbyClass(classname){
partscollect=new Array()
var inc=0
var alltags=document.all? document.all.tags("DIV") : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
partscollect[inc++]=alltags[i]}}

function contractall(){
var inc=0
while (partscollect[inc]){
partscollect[inc].style.display="none"
inc++}}

function expandone(){
var selectedDivObj=partscollect[selectedDiv]
contractall()
selectedDivObj.style.display="block"
temp.options[selectedDiv].selected=true
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
if (displaymode=="auto")
autocontrolvar=setTimeout("expandone()",pauze)}

function inhoud_naar_menu(){
temp=document.gallerycontrol.menu
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<totalDivs;i++){
var onderwerp=partscollect[i].getAttribute("subject")
onderwerp=(onderwerp=="" || onderwerp==null)? "HTML Content "+(i+1) : onderwerp
temp.options[i]=new Option(onderwerp,"")}
temp.options[0].selected=true}

function manueelcontrol(menuobj){
if (displaymode=="manueel"){
selectedDiv=menuobj
expandone()}}

function keuze_optie(themode){
displaymode=themode
if (typeof autocontrolvar!="undefined")
clearTimeout(autocontrolvar)
if (themode=="auto"){
document.gallerycontrol.menu.disabled=true
autocontrolvar=setTimeout("expandone()",pauze)}
else document.gallerycontrol.menu.disabled=false}

function startgallery(){
document.getElementById("controldiv").style.display="none"
getElementbyClass("newsitem")
totalDivs=partscollect.length
inhoud_naar_menu()
for (i=0; i<document.gallerycontrol.mode.length; i++){
if (document.gallerycontrol.mode[i].checked)
displaymode=document.gallerycontrol.mode[i].value}
if (displaymode=="auto")
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