wmImg01 = new Array('img01','images/menu/wersindwir.gif','images/menu/wersindwir_h.gif');
wmImg02 = new Array('img02','images/menu/programm2003.gif','images/menu/programm2003_h.gif');
wmImg03 = new Array('img03','images/menu/kontakt.gif','images/menu/kontakt_h.gif');

wmImg10 = new Array('img10','images/menu/subemue/0101.gif','images/menu/subemue/0101_h.gif');
wmImg11 = new Array('img11','images/menu/subemue/0102.gif','images/menu/subemue/0102_h.gif');


wmImg20 = new Array('img20','images/menu/subemue/0202.gif','images/menu/subemue/0202_h.gif');
wmImg21 = new Array('img21','images/menu/subemue/0201.gif','images/menu/subemue/0201_h.gif');

wmImg55 = new Array('img55','images/museumsfest.gif','images/museumsfest_a.gif');

var current_popup     = "";
var current_root = "";
var WMAg = window.navigator.userAgent; 
var WMBVers = parseInt(WMAg.charAt(WMAg.indexOf("/")+1),10);

var wm_chapter = "";
var wm_book    = "";

function wm_preload() {
  if (document.images) {
    var imgFiles = wm_preload.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

wm_preload(wmImg01[2]);
wm_preload(wmImg02[2]);
wm_preload(wmImg03[2]);

function WMReloadPage(init) { 
	if (init==true) with (navigator) {
		if ((appName=="Netscape") && (parseInt(appVersion)==4)) {
    		document.WMpgW=innerWidth; 
    		document.WMpgH=innerHeight; 
    		onresize=WMReloadPage; 
    	}
    } else if (innerWidth!=document.WMpgW || innerHeight!=document.WMpgH) {
    	location.reload();
    }
}
WMReloadPage(true);

function IsIE() { return window.navigator.userAgent.indexOf("MSIE") > 0;}

function wmFindItem(n,ly) { if (WMBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = wmFindItem(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}

function wmSwitch(imageObject, imageAction) {
	var img = null;
	if (document.images) {  
	  if(!(wm_book == imageObject)) { 	
    	if (!IsIE()) img = wmFindItem(imageObject[0],0);
		else img = document.images[imageObject[0]];		     
		if (img) {
			if(imageAction == 'on') {
				img.src = imageObject[2];
			} else {
				img.src = imageObject[1];
			}
		}                          
	  }
	}	                    
}

function WMSetBook(newBook) {
   oldBook = wm_book;
   wmSwitch(newBook, 'on');
   wm_book = newBook;
   wmSwitch(oldBook, 'off');    
}
 
function WMEnterMenu(n,root) {
	wmSwitch(root,'on');
	current_root = root;	
	var layer_id = n;
	if(wm_swLayer(n)) {
		current_popup=n;
	}
}
                
function WMLeaveMenu() {
	wmSwitch(current_root,'off');
	if(current_popup != ""){
		var layer_id = current_popup;
	 	wm_hdLayer(layer_id);
     }
}

function wm_swLayer(layerName){

 if (document.layers) {
	firstBit='document.layers["';
	secondBit='"]';
	styleRef='';
	leftVar='.left';
	topVar='.top';
	heightVar='.clip.height';
	widthVar='.clip.width';
	
	mIncrement = 20;
} else if (document.all) {
	firstBit='document.all["';
	secondBit='"]';
	styleRef='.style';
	leftVar='.posLeft';
	topVar='.posTop';
	heightVar='.clientHeight';
	widthVar='.clientWidth';
	
	mIncrement = 4;
} else if (document.getElementById) {
	firstBit='document.getElementById("';
	secondBit='")';
	styleRef='.style';
	leftVar='.left';
	topVar='.top';
	heightVar='.clientHeight';
	widthVar='.clientWidth';
	mIncrement = 4;
}
	returnvalue = false;
	if(!eval(firstBit+layerName+secondBit)) {
	} else {
		//eval(firstBit+layerName+secondBit+styleRef+'.visibility="visible"');
		if(eval(firstBit+layerName+secondBit)!='undefined') {
		eval(firstBit+layerName+secondBit+styleRef+'.visibility="visible"');
		returnvalue = true;
		}
	}
	return returnvalue;
}

function wm_hdLayer(layerName){

 if (document.layers) {
	firstBit='document.layers["';
	secondBit='"]';
	styleRef='';
	leftVar='.left';
	topVar='.top';
	heightVar='.clip.height';
	widthVar='.clip.width';
	
	mIncrement = 20;
} else if (document.all) {
	firstBit='document.all["';
	secondBit='"]';
	styleRef='.style';
	leftVar='.posLeft';
	topVar='.posTop';
	heightVar='.clientHeight';
	widthVar='.clientWidth';
	
	mIncrement = 4;
} else if (document.getElementById) {
	firstBit='document.getElementById("';
	secondBit='")';
	styleRef='.style';
	leftVar='.left';
	topVar='.top';
	heightVar='.clientHeight';
	widthVar='.clientWidth';
	mIncrement = 4;
}

	eval(firstBit+layerName+secondBit+styleRef+'.visibility="hidden"');
}

function wm_openImpressum() {
	window.open('impressum.html','impressum','width=340,height=400,resizable,scrollbars=yes');
}
