/**
 * Copyright (c) 2001, DACHCOM digital AG
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, is not permitted without the explicit acknowledgment
 * from DACHCOM digital AG.
 *
 * Navigation Rheinpark
 *
 * Author Walter Canal, wcanal@dachcomdigital.com
 * Version 1.0, 04.02.2003
 *
 * History:
 *  1.0	04.02.2003	wal	initial release
 */

var active_layer = new Array();
var active_image = '';


function preload(imgObj,imgSrc) {
	var d=document;
	if(d.images) {
		eval(imgObj+' = new Image()')
    	eval(imgObj+'.src = "'+imgSrc+'"')
  	}
}


// objekte (layer und image)
function findObj(n, d) {
	var p,i,x;  if(!d) d=document;
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	if (!(x=d[n]) && d.all) {
		x = d.all[n];
	}
	for (i=0;!x && i < d.forms.length;i++) {
		x = d.forms[i][n];
	}
	for (i=0;!x && d.layers && i < d.layers.length;i++) {
		x = findObj(n,d.layers[i].document);
	}
	if (!x && d.getElementById) {
		x = d.getElementById(n);
	}
	return x;
}

function showLayers() {
	var i,v,obj,args=showLayers.arguments;
	// alle layers verschwinden lassen
	for (i=0; i < (active_layer.length); i++) {
		if ((obj=findObj(active_layer[i]))!=null) {
			if (obj.style) {
				obj=obj.style;
				obj.visibility='hidden';
			}
			else {
				obj.visibility='hide';
			}
		}
	}

	// gewünschte layers anzeigen
	for (i=0; i < (args.length); i++) {
		if ((obj=findObj(args[i]))!=null) {
			if (obj.style) {
				obj=obj.style;
				obj.visibility='visible';
			}
			else {
				obj.visibility='show';
			}
		}
	}
	active_layer = args;
}

// bildwechsel
function swapImage(img, imgSrc) {
	var i,j=0,x;
	document.MM_sr=new Array;
	if ((x=findObj(img))!=null) {
		document.MM_sr[j++]=x;
		if (!x.oSrc) {
			x.oSrc=x.src;
		}
		x.src=imgSrc;
	}
}

// bild zeigen
function showImage(imgName, newImg){
	if (active_image != imgName) {
		swapImage(imgName, eval(newImg+".src"));
	}
}

// bild verbergen
function hideImage(lastImg, imgName, newImg){
	if (active_image != lastImg) {
		swapImage(imgName, eval(newImg+".src"));
	}
}


function setImg(image){
	// aktives bild deaktivieren
	if (active_image != '') {
		hideImage(image, active_image, active_image+'_up');
	}
	// aktives bild setzten
	showImage(image, image+'_over');
	active_image = image;
}