// some simple, non-invasive javascript for brushed-up buttons
// (you gotta give them something .... ;^)

var srclist = new Array(
    "images/menubg.gif",
    "images/menu.jpg",
    "images/button01n.gif",
    "images/button02n.gif",
    "images/button03n.gif",
    "images/button04n.gif",
    "images/button05n.gif",
    "images/button06n.gif",
    "images/button01h.gif",
    "images/button02h.gif",
    "images/button03h.gif",
    "images/button04h.gif",
    "images/button05h.gif",
    "images/button06h.gif");
var butlist = new Array(
    "btn01",
    "btn02",
    "btn03",
    "btn04",
    "btn05",
    "btn06");
var buthint = new Array(
    "Startseite ...",
    "Doenitz ProLab stellt sich vor ...",
    "Produktkatalog ...",
    "Mikrobiologische Labordienstleistungen ...",
    "Beratung im Bereich Mikrobiologie ...",
    "Wie Sie uns erreichen koennen ...");
var timerID;
var defbut;

function preload(idx, len) {
// preload the len sources starting with idx (from the srclist)
	if (document.images) {
		var ia = new Array();
		for (var i = 0; i < len; i++) {
		  ia[i] = new Image();
		  ia[i].src = srclist[ idx + i];
		}
	}
}

function mover(but, def) {
// the mouse-in function
// takes the number of the hot button (starting with 1) and the number of the default button of this page
// note that def can be zero, in this case the page does not have a default button
  clearTimeout(timerID);
	if ((def != 0) && (but != def)) document.images[butlist[def-1]].src = srclist[def+1]; // deactivate default button
	document.images[butlist[but-1]].src = srclist[but+7]; // activate the hot button
	window.status = buthint[but-1]; // show status line hint
}

function mout(but, def) {
// the mouse-out function
// takes the number of the hot button (starting with 1) and the number of the default button of this page
// note that def can be zero, in this case the page does not have a default button
	if (but != def) document.images[butlist[but-1]].src = srclist[but+1]; // deactivate hot button
	defbut = def; // remember which button to activate should no other button become hot within the timeout time
	timerID = window.setTimeout("highlightdef()", 50); // set timeout to 50ms
}

function highlightdef() {
// timeout function
	window.status = ""; // clear statusline
	if (defbut != 0) document.images[butlist[defbut-1]].src = srclist[defbut+7]; // reactivate the default button
}

var pwin = null;

function picWin(pic, sze, tit) {
	if (pwin && pwin.open && !pwin.closed) pwin.close();
	pwin = window.open("", "picWin", sze+",top=180,screenY=180,left=140,screenX=140,dependent");
	if (pwin && pwin.open && !pwin.closed) {
		with (pwin.document) {
		  open("text/html", "replace");
		  var str = "";
		  if ((tit=="Gebrauchsanleitung") && window.print) {
		  	str = "<BR><CENTER><FORM><INPUT type='button' name='print' value='Diese Seite drucken' " +
		  	      "onClick='javascript:window.print()'></FORM></CENTER><BR>'";
			}
		  write("<HTML><HEAD><TITLE>"+tit+"</TITLE></HEAD><SCRIPT LANGUAGE='JavaScript'>function loadIt(){if(document.all){"+
		        "document.all.loader.style.visibility='hidden';document.all.img.style.visibility='visible';}else{"+
          	"document.loader.visibility='hide';document.img.visibility='visible';}}</SCRIPT><STYLE type='text/css'>"+
						"#loader{position:absolute;left:100;top:100;color:#1C1A4A;font-weight:bold;font-size:8pt;font-family:"+
						"Tahoma,Verdana,Arial,Sans Serif;}#img {position:absolute;left:0;top:0;visibility:hide;}</STYLE>"+
  					"<BODY OnLoad='loadIt()' topmargin='0' leftmargin='0'><DIV id='loader' class='stressed' align='center'>"+
  					"Loading ...</DIV><DIV id='img' style='visibility:hidden'>"+str+"<IMG src='images/pic_"+pic+"' alt=''></DIV></BODY></HTML>");
		  close();
		}		
	}	
}

function MOver(picid, hintnex, hintex) {
	var oPic = document.getElementById(picid);
	if (oPic.src.indexOf('plus')>0) {
		oPic.src = 'images/plushot.gif';
		window.status = hintnex;
	} else {
		oPic.src = 'images/minushot.gif';
		window.status = hintex;
	}
	return true;
}

function MOut(picid) {
	var oPic = document.getElementById(picid);
	if (oPic.src.indexOf('plus')>0) {
		oPic.src = 'images/pluscold.gif';
	} else {
		oPic.src = 'images/minuscold.gif';
	}
	window.status = "";
}

function ToggleExpander(exid, picid, hintnex, hintex) {
	var oPic = document.getElementById(picid);
	var ex = document.getElementById(exid);
	if (ex.style.display == "block") {
		ex.style.display = "none";
		oPic.src = 'images/plushot.gif';
		window.status = hintnex;
	} else {
		ex.style.display = "block";
		oPic.src = 'images/minushot.gif';
		window.status = hintex;
	}
}

// at first load the menu background
preload(0,2);
