// slidhtml v 0.3
//
// Copyright (C) 2003 Christophe Le Bars
//
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

// var IEerror = -1;
var IEerror = 0;

var firstSlide = 0;
var lastSlide = 0;
var activeSlide = 0;
var fsize = 14;

// cross navigator functions

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getTag(id){
 if (isDOM) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}


function getTagStyle(id){
 return (isNS4 ? getTag(id) : getTag(id).style);
} 


function shide(n,effect) {

	page = getTagStyle(n);
	page.visibility = effect;

}

function cascade(x,y,xinc,yinc,w,s) {

	if (w == 0) return;

	// use border (ko with IE :-()
	//document.write(
	//	'<div class="' + c + '" style="left: '
	//	+ x + 'px; top: ' + y + 'px; width: '
	//	+ w + 'px; height: 1px;' + s + '"></div>'
	//);

	document.write(
		'<div style="left: ' 
		+ x + 'px; top: ' + y + 'px; width: '
		+ w + 'px; height: 1px;'
		+ 'background-image: url(iwm_blackdot.png);'
		+ 'background-repeat: no-repeat;'
		+ s + '"></div>'
	);
	
	cascade(x+xinc,y+yinc,xinc,yinc,w-1,s);
}

function move(newSlide) {

   var newSlideStyle;

   if ( newSlideStyle = getTagStyle(newSlide) ) {
	var activeSlideStyle = getTagStyle(activeSlide);
	activeSlideStyle.visibility = "hidden";
	activeSlide = newSlide;
	newSlideStyle.visibility = "visible";
   }
}


function popdown() {

        if ( menuPosition > menuPositionStart ) {
		menuPosition--;
		activeMenu.top = menuPosition + "px";
		var tt = setTimeout("popdown();",10);
	}

}

function popup(n) {

        if ( menuPosition >= menuPositionEnd ) {
		activeMenu.visibility = "hidden";

		activeMenu = getTagStyle(n);

		activeMenu.top = menuPosition + "px";
		activeMenu.visibility = "visible";
		var tt = setTimeout("popdown();",10);
	} else {
		menuPosition++;
		activeMenu.top = menuPosition + "px";
		var tt = setTimeout("popup('" + n + "');",10);
	}

}

function test() {
	//var bg = getTagStyle("1");
	//bg["visibility"] = "visible";
	//bg["z-index"] = "0"; XXX doesn't work
	//popdown();
}


function menu () {


}

function change_font (n) {

	fsize = fsize + n;
	f = getTagStyle('frame');
	f.fontSize = fsize + "px";

}

function start() {

	 move(firstSlide);

	 while (getTagStyle(lastSlide+1)) {
	       lastSlide = lastSlide + 1;
	        }

       // XXX end with error here

       var tt = setTimeout("test();",2000);

}

