/* 
|-----------------------------------|
| Copyright Erik Lodewyckx	|
| 1* Instructeur		|
| Duikschool De Zeester	|
| Mei 2002		- Januari 2005|
|-----------------------------------|
*/
// Set slideShowSpeed (milliseconds)
var speed=4000;
// Duration of crossfade (seconds)
var faddur = 2;
var loc;
var wdw;
var foto = new Array(); 
var txt = new Array(); 
var coll;
var fi=0;
var fn;
var hfdtit=window.document.title;

function insertbuttons()
{
var buttonstr = "<CENTER><H1>"+hfdtit+"</H1><FORM>";
buttonstr += "<input type='button' class='button' VALUE='alles bekijken' onClick='sliderm()'> (Navigeren via pijltjes)";
buttonstr += "</FORM></CENTER>";
document.body.insertAdjacentHTML("afterBegin",buttonstr);
}

//---------------------------------------------------------------------------
// start slider with first image
//---------------------------------------------------------------------------

function sliderm()
{
getFotos();
loc=document.images(0).src;
fi=0;
openWindow(loc,fi);
}

//---------------------------------------------------------------------------
// get the location and title of all images in the window
//---------------------------------------------------------------------------

function getFotos()
{
coll = document.all.tags("A"); 
if (coll!=null) 
{ 
for (i=0; i<coll.length; i++) 
{
var a = coll[i].href;
foto[i] = a.substr(a.lastIndexOf("/")+1); 
txt[i] = coll[i].title;
}
}
}

//----------------------------------------------------------------------------
// open new window with selected + resize to its size
//----------------------------------------------------------------------------

function openWindow(loc,fi)
{
wdw = window.open(loc, "Slideshow", "fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=300");
wdw.document.write("<html><head>");
wdw.document.writeln("<script language='JavaScript'>");
wdw.document.writeln("var asc = true;");
wdw.document.writeln("var f = "+fi+";");
wdw.document.writeln("var intID = null;");
wdw.document.write("var foto = new Array(");
for (i=0; i<coll.length; i++) 
{
if (i!=0) wdw.document.write(", ");	
wdw.document.write("'"+foto[i]+"'");	
}
wdw.document.writeln(");");	
wdw.document.write("var txt = new Array(");
for (i=0; i<coll.length; i++) 
{
if (i!=0) wdw.document.write(", ");	
wdw.document.write("'"+txt[i]+"'");	
}
wdw.document.writeln(");");
wdw.document.writeln("function preloadimg() {");
	wdw.document.writeln("var preLoad = new Array();");
	wdw.document.writeln("for (i = 0; i < foto.length; i++) {");
	wdw.document.writeln("   preLoad[i] = new Image();");
	wdw.document.writeln("   preLoad[i].src = foto[i];");
	wdw.document.writeln("}");	
wdw.document.writeln("}");
wdw.document.writeln("function vorige() {");
wdw.document.writeln("if (f>0) {");
wdw.document.writeln("f = f - 1;");
wdw.document.writeln("toonfoto();");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("function volgende() {");
wdw.document.writeln("if (f<foto.length-1) {");
wdw.document.writeln("f = f + 1;");
wdw.document.writeln("toonfoto();");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("function toonfoto() {");
	wdw.document.writeln("if (document.all) {");
	// wdw.document.writeln("   document.images.ft.style.filter='revealTrans(Duration="+faddur+", Transition=23);'");
	wdw.document.writeln("   document.images.ft.filters.revealTrans.Apply();");      
	wdw.document.writeln("}");
wdw.document.writeln("window.document.ft.src = foto[f];");
	wdw.document.writeln("if (document.all) {");
	wdw.document.writeln("   document.images.ft.filters.revealTrans.Play();");
	wdw.document.writeln("}");
wdw.document.writeln("window.document.title = '"+hfdtit+" - "+"' + "+"foto[f];");
wdw.document.writeln("txtdiv.innerText = txt[f];");
wdw.document.writeln("begineinde();");
wdw.document.writeln("}");
wdw.document.writeln("function begineinde() {");
wdw.document.writeln("if (f==0) {");
wdw.document.writeln("window.document.vor.src='http://users.belgacom.net/DeZeester/images/vorige1.gif';");
wdw.document.writeln("window.document.vor.style.cursor='default';");
wdw.document.writeln("}");
wdw.document.writeln("else {");
wdw.document.writeln("window.document.vor.src='http://users.belgacom.net/DeZeester/images/vorige0.gif';");
wdw.document.writeln("window.document.vor.style.cursor='hand';");
wdw.document.writeln("}");
wdw.document.writeln("if (f==foto.length-1) {");
wdw.document.writeln("window.document.vol.src='http://users.belgacom.net/DeZeester/images/volgende1.gif';");
wdw.document.writeln("window.document.vol.style.cursor='default';");
wdw.document.writeln("}");
wdw.document.writeln("else {");
wdw.document.writeln("window.document.vol.src='http://users.belgacom.net/DeZeester/images/volgende0.gif';");
wdw.document.writeln("window.document.vol.style.cursor='hand';");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("var isNav4, isIE4; ");
wdw.document.writeln("if (parseInt(navigator.appVersion.charAt(0)) >= 4) {");
wdw.document.writeln("isNav4 = (navigator.appName == 'Netscape') ? 1 : 0;")
wdw.document.writeln("isIE4 = (navigator.appName.indexOf('Microsoft') != -1) ? 1 : 0;");
wdw.document.writeln("} ");
wdw.document.writeln("function fitWindowSize() {");
wdw.document.writeln("if (isNav4) {");
wdw.document.writeln("innerWidth = document.layers[0].document.ft.width;");
wdw.document.writeln("innerHeight = document.layers[0].document.ft.height;");
wdw.document.writeln("} ");
wdw.document.writeln("if (isIE4) {");
wdw.document.writeln("window.resizeTo(100, 100);");
wdw.document.writeln("width = 100 - (document.body.clientWidth -  document.ft.width);");
wdw.document.writeln("height = 100 - (document.body.clientHeight -  document.ft.height);");
wdw.document.writeln("window.resizeTo(width, height);");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("function auto() {");
wdw.document.writeln("if (intID==null) {");
wdw.document.writeln("intID = setInterval('changeFoto()', "+speed+");");
wdw.document.writeln("window.document.aut.src='http://users.belgacom.net/DeZeester/images/auto1.gif';");
wdw.document.writeln("window.document.aut.title='stop';");
wdw.document.writeln("}");
wdw.document.writeln("else {");
wdw.document.writeln("clearInterval(intID);");
wdw.document.writeln("intID=null;");
wdw.document.writeln("window.document.aut.src='http://users.belgacom.net/DeZeester/images/auto0.gif';");
wdw.document.writeln("window.document.aut.title='automatisch';");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("function changeFoto() {");
wdw.document.writeln("if (asc==true) {");
wdw.document.writeln("if (f<foto.length-1) volgende();");
wdw.document.writeln("else {");
wdw.document.writeln("asc = false;");
wdw.document.writeln("vorige();");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("else {");
wdw.document.writeln("if (f>0) vorige();");
wdw.document.writeln("else {");
wdw.document.writeln("asc = true;");
wdw.document.writeln("volgende();");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("function keys(evt) {");
wdw.document.writeln("var keyCode = ");
wdw.document.writeln("document.layers ? evt.which : ");
wdw.document.writeln("document.all ? event.keyCode : ");
wdw.document.writeln("document.getElementById ? evt.keyCode : 0; ");
wdw.document.writeln("switch (keyCode) {");
wdw.document.writeln("case 10: // return");
wdw.document.writeln("case 13: // enter");
wdw.document.writeln("case 32: // spacebar");
wdw.document.writeln("case 34: // page down");
wdw.document.writeln("case 39: // rightkey");
wdw.document.writeln("case 40: // downkey");
wdw.document.writeln("volgende();");
wdw.document.writeln("break;");
wdw.document.writeln("case 33: // page up");
wdw.document.writeln("case 37: // leftkey");
wdw.document.writeln("case 38: // upkey");
wdw.document.writeln("vorige();");
wdw.document.writeln("break;");
wdw.document.writeln("}");
wdw.document.writeln("}");
wdw.document.writeln("document.onkeydown = keys");
wdw.document.writeln("</script><STYLE>.nav {cursor:hand;position:relative;left:0;top:0;z-index:+1;margin:0px}</STYLE></head><body style='overflow:hidden;' onload='preloadimg();' style='margin-top:0; margin-left:0; margin-right:0; margin-bottom:0; behavior:url(http://users.skynet.be/erik.lodewyckx/css/ZSbody.htc);'>");
wdw.document.writeln("<table align=center width=100%><tr><td align=left>");
wdw.document.writeln("<img class='nav' name='vor' src='http://users.belgacom.net/DeZeester/images/vorige1.gif' onclick='vorige();' title='Vorige'>");
wdw.document.writeln("</td><td align=center>");
wdw.document.writeln("<img class='nav' name='aut' src='http://users.belgacom.net/DeZeester/images/auto0.gif' onclick='auto();' title='Automatisch'>");
wdw.document.writeln("</td><td align=right>");
wdw.document.writeln("<img class='nav' name='vol' src='http://users.belgacom.net/DeZeester/images/volgende0.gif' onclick='volgende();' title='Volgende'>");
wdw.document.writeln("</td></tr></table>");
wdw.document.writeln("<img style='position:absolute;left:0;top:0;filter:revealTrans(Duration="+faddur+", Transition=1);' name=ft src='" + foto[fi] + "' onload='fitWindowSize();'>");
wdw.document.writeln("<div style='position:absolute;left:0;top:0;z-index:+1;text-align:right;width:100%'><span id='txtdiv' style='background:#ffff80;padding:1px;border:1px inset black;font-size:8pt;font-family:serif;color:#0000a0'>"+txt[0]+"</span></div>");
wdw.document.writeln("</body></html>");
wdw.document.close();
wdw.document.title=hfdtit+" - "+foto[0];
wdw.focus();
}