
/**
 * Layer 1.1
 *
 * by Aloys Maue (aloys.maue@javaxml.org), March 2001
 *
 * Feel free to use this code (see copyright notices below).
 * We would appreciate your modifications will be emailed to us.
 * Latest versions will be published at
 * http://www.javaxml.org
 *
 * Copyright (c) 2000-2001 javaxml.org
 *
 * We grant you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS", without a warranty of any kind.
 *
 * This script should be "cross browser compatible"
 * It is testet on Netscape 4.03, 4.05, 4.07, 4.51, 4.7, 6 and InternetExplorer 4.0, 5.0 and 5.5
 * Browser which do not support layers like Netscape versions below 4
 * and InternetExplorer versions below 4 causes no errors and they ignore the functions.
 *
 * Layer offers the possibility to access layers and change their properties.
 * This script is very easy to use. Don't care about browsers and versions anymore!
 *
 * New in version 1.1: - Netscape 6 and IE 5.5 BugFixes
 *
 */
	function screenWidth() {
		if (window.screen)
			return window.screen.width;
		return 0;
	}
	function screenHeight() {
		if (window.screen)
			return window.screen.height;
		return 0;
	}
	function windowWidth() {
		if (window.innerWidth)
			return window.innerWidth;
		else if (document.all)
			return document.body.clientWidth;
		return 0;
	}
	function windowHeight() {
		if (window.innerHeight)
			return window.innerHeight;
		else if (document.all)
			return document.body.clientHeight;
		return 0;
	}
	function documentLeft(doc) {
		if (doc == null)
			doc = document;
		if (doc.all)
			return document.body.scrollLeft;
		else {
			return pageXOffset;
		}
	}
	function documentTop(doc) {
		if (doc == null)
			doc = document;
		if (doc.all)
			return document.body.scrollTop;
		else {
			return pageYOffset;
		}
	}
	function documentWidth(doc) {
		if (doc == null)
			doc = document;
		if (doc.width)
			return doc.width;
		else if (document.all)
			return doc.body.scrollWidth;
		return 0;
	}
	function documentHeight(doc) {
		if (doc == null)
			doc = document;
		if (doc.height)
			return doc.height;
		else if (document.all)
			return doc.body.scrollHeight;
		return 0;
	}
	/**
	 * The layer access functions
	 * first parameter is always the layer to which the function should be applied.
	 * This could be a name (as String) or the layer object itself.
	 * other parameters can be ommitted.
	 * parameters which should be ommitted in between can be set to null:
	 * fi.
	 * layerShow(myLayer, null, null, "status text");
	 * This would result in showing the layer and displaying status text
	 * but without moving the layer
	 */
	// depreciated, use layerShow
	function showLayer( aLayer, x, y, text) {
		return layerShow( aLayer, x, y, text);
	}
	// depreciated, use layerHide
	function hideLayer( aLayer ) {
		return layerHide( aLayer, null, null, " ");
	}
	function layerShow( aLayer, x, y, text) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		layerMoveTo(lay, x, y);
		var obj = lay.style ? lay.style : lay;
		obj.visibility = document.layers ? "show" : "visible";
		if (text) self.status = text;
		return true;
	}
	function layerHide( aLayer, x, y, text ) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		layerMoveTo(lay, x, y);
		var obj = lay.style ? lay.style : lay;
		obj.visibility = "hidden";
		if (text) self.status = text;
		return true;
	}
	function layerMoveTo( aLayer, x, y) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		var obj = lay.style ? lay.style : lay;
		if (x) obj.left = x;
		if (y) obj.top = y;
		return true;
	}
	function layerMoveBy( aLayer, x, y) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		if (x) layerMoveTo(lay, layerLeft(lay) + x, null);
		if (y) layerMoveTo(lay, null, layerTop(lay) + y);
		return true;
	}
	function layerLeft(aLayer, x) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		layerMoveTo(lay, x);
		if ( document.layers ) {
			return lay.left;
		} else if ( document.getElementById ) {
			return lay.offsetLeft;
		} else if ( document.all ) {
			return lay.style.posLeft != 0 ? lay.style.posLeft : lay.offsetLeft;
		}
		return 0;
	}
	function layerTop(aLayer, y) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		layerMoveTo(lay, null, y);
		if ( document.layers ) {
			return lay.top;
		} else if ( document.getElementById ) {
			return lay.offsetTop;
		} else if ( document.all ) {
			return lay.style.posTop != 0 ? lay.style.posTop : lay.offsetTop;
		}
		return 0;
	}
	/**
	 * Setting the width smaller than the layer is
	 * would result in different results for different browsers!
	 * Netscape 4.x returns the width of the content of the layer,
	 * not the width specified in a style sheet!
	 */
	function layerWidth(aLayer, w) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (lay.style) {
			if (w) lay.style.width = w;
			return lay.style.pixelWidth ? lay.style.pixelWidth : lay.offsetWidth;
		} else {
			// This changes previous clipped layers in Netscape 4.x!!! workaround needed
			if (w) lay.clip.width = w;
			return lay.clip.width;
		}
		return 0;
	}
	/**
	 * Setting the height smaller than the layer is
	 * would result in different results for different browsers!
	 */
	function layerHeight(aLayer, h) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (lay.style) {
			if (h) lay.style.height = h;
			return lay.style.pixelHeight ? lay.style.pixelHeight : lay.offsetHeight;
		} else {
			// This changes previous clipped layers in Netscape 4.x!!! workaround needed
			if (h) lay.clip.height = h;
			return lay.clip.height;
		}
		return 0;
	}
	function layerClipLeft(aLayer, x) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (x) layerClip(lay, x, null, null, null);
		if ( document.layers ) {
			return lay.clip.left;
		} else {
			return clipRect(lay, 0);
		}
		return 0;
	}
	function layerClipTop(aLayer, y) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (y) layerClip(lay, null, y, null, null);
		if ( document.layers ) {
			return lay.clip.top;
		} else {
			return clipRect(lay, 1);
		}
		return 0;
	}
	function layerClipWidth(aLayer, w) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (w) layerClip(lay, null, null, w, null);
		if ( document.layers ) {
			return lay.clip.width;
		} else {
			return clipRect(lay, 2);
		}
		return 0;
	}
	function layerClipHeight(aLayer, h) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		if (h) layerClip(lay, null, null, null, h);
		if ( document.layers ) {
			return lay.clip.height;
		} else {
			return clipRect(lay, 3);
		}
		return 0;
	}
	/**
	 * parses the layer clip string into usable values:
	 * parameter str: "rect(tpx rpx bpx lpx)" is rect string
	 * with (t = top, r = right, b = bottom, l = left)
	 * returns in case of parameter pos
	 * 0: left, 1: top, 2: width, 3: height;
	 * return values are all relative to the layer position
	 */
	function clipRect(aLayer, pos) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return 0;
		var obj = lay.style ? lay.style : lay;
		var str = obj.clip;
			// minlength = "rect(0px 0px 0px 0px)".length = 21
		if (str == null || str.length < 21 || pos == null) return 0;
		var arr = new Array();
			 // lengths: "rect(" = 5, ")" = 1
		str = str.substring(5, str.length - 1);
		arr = str.split(" ");
		var l =  ("auto" == arr[3]) ? 0 : parseInt(arr[3]);
		var t =  ("auto" == arr[0]) ? 0 : parseInt(arr[0]);
		var w = (("auto" == arr[1]) ? layerWidth(lay)  : parseInt(arr[1])) - l;
		var h = (("auto" == arr[2]) ? layerHeight(lay) : parseInt(arr[2])) - t;
		arr = null;
		if (pos == 0) return l;
		if (pos == 1) return t;
		if (pos == 2) return w;
		if (pos == 3) return h;
		return 0;
	}
	function layerClip(aLayer, x, y, w, h) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		var obj = lay.style ? lay.style : lay;
		if( document.layers ) {
			if (x != null) obj.clip.left = x;
			if (y != null) obj.clip.top = y;
			if (w != null) obj.clip.width = w;
			if (h != null) obj.clip.height = h;
		} else {
			var l = (x == null) ? "auto" : x + "px";
			var t = (y == null) ? "auto" : y + "px";
			var r = (w == null) ? "auto" : (x + w) + "px";
			var b = (h == null) ? "auto" : (y + h) + "px";
			obj.clip = 'rect(' + t + ' ' + r + ' ' + b + ' ' + l + ')';
		}
		return true;
	}
	
	function layerFGColor(aLayer, c) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		if (lay.style) {
			if (c) lay.style.color = c;
			return lay.style.color;
		} else {
			if (c) lay.document.fgColor = c; 
			// without effect in current content in Netscape 4.x
			// content has to be rewritten to have an effect
			return lay.document.fgColor;
		}
		return false;
	}
	function layerBGColor(aLayer, c) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		if (lay.style) {
			if (c) lay.style.backgroundColor = c;
			return lay.style.backgroundColor;
		} else {
			if (c) lay.bgColor = c;
			return lay.bgColor;
		}
		return false;
	}
	function getLayer(aLayer) {
		if (typeof aLayer != "string")
			return aLayer;		
		if ( document.layers) {
			return getLayerNetscape(document, aLayer);
		} else if (document.getElementById) {
			return document.getElementById(aLayer);
		} else if ( document.all ) {
			return eval("document.all." + aLayer);
		}
		return null;
	}
	function getLayerNetscape(doc, layerName) {
		var lay = eval("doc.layers." + layerName);
		if ( lay != null) return lay;
		for ( var i=0; i<doc.layers.length; i++ ) {
			lay = getLayerNetscape(doc.layers[i].document, layerName);
			if ( lay != null) return lay;
		}
		return null;
	}
	function props(obj) {
		s = "";
		for (all in obj) {
			value = "" + obj[all.toString()];
			if (value.length > 30)
				value = value.substring(0, 30) + "...";
			s += all.toString() + ":" + value + "|\t";
		}
		return s;
	}
  
  
//**********************************************************************
//*** here ends Layer 1.1 by Aloys Maue ********************************
//*** additional functions by Stanislav Saric / sanafir AG *************
//**********************************************************************
 function layerContent(aLayer, c) {
		var lay = getLayer(aLayer);
		if ( lay == null ) return false;
		if (lay.style) {
			if (c) lay.innerHTML = c;
			} else {
			if (c){ lay.document.open();lay.document.write(c);lay.document.close();}
			}
	}
function imageSwapLayer(imagename, imagefile, aLayer) {
         var lay = getLayer(aLayer);
		     if ( lay == null ) return false;
         if (document.layers && eval("document.layers['" + aLayer + "'].document.images." + imagename)){
         eval("document.layers['" + aLayer + "'].document.images." + imagename + ".src='" + imagefile + "';");
         }
         else if (document.all && eval("document.images." + imagename)){
         eval("document.images." + imagename + ".src='" + imagefile + "';");
         }else if ( eval("document.images." + imagename)){
        eval("document.images." + imagename + ".src='" + imagefile + "';");
        }       
}
function imageSwap(imagename, imagefile) {
        if (document.images){
        eval("document.images." + imagename + ".src='" + imagefile + "';");
        }
        else{
       eval("document." + imagename + ".src='" + imagefile + "';");
        }
}
function restoreLayers() {
    for (i=0;i<arguments.length;i++){    
          layerHide(arguments[i],null,null,'');
  }  
}
function leer(){
null;
}
function initialisieren(){
	
         if (document.layers){
         document.captureEvents(Event.MOUSEUP);
         //document.onmouseup = restoreMenu;
         }
         else{
         //document.onclick = restoreMenu;
         }
    }
function restoreMenu() {
restoreLayers('Menu1','Menu2','Menu3','Menu4','Menu5');
restoreImages();
}
// Slideshow Funktionen (funktion initbilder wird bei onload einmalig gestartet)
function initbilder(){

if (startcheck == 0){
	bildausgabe(0);
	startcheck = 1;
}
if (zustand == 1){
	if (alle>1)document.images.links.src = '../../../images/SlideTable_15_low.gif';
	if(alle==1){
	document.images.links.src = '../../../images/SlideTable_15_low.gif';
	document.images.rechts.src = '../../../images/SlideTable_16_low.gif';
	}
}else{
	document.images.links.src = 'images/SlideTable_15.gif';
}
if (zustand == parseInt(alle - 3) || alle==1){
	document.images.rechts.src = '../../../images/SlideTable_16_low.gif';
}else{
	document.images.rechts.src = '../../../images/SlideTable_16.gif';
}
document.images.b1.src= eval("bild" + zustand + ".src");
if (alle >1)document.images.b2.src= eval("bild" + parseInt(zustand+1) + ".src");
if (alle >2)document.images.b3.src= eval("bild" + parseInt(zustand+2) + ".src");
if (alle >3)document.images.b4.src= eval("bild" + parseInt(zustand+3) + ".src");
}

function bilderzaehlen(){
if (zustand<anzahlbilder){
	zustand = zustand + 1;
}
initbilder();
restoreImages();
}

function bilderrunterzaehlen(){
if (zustand>1){
	zustand = zustand - 1;
}
initbilder();
restoreImages();
}

function bildausgabe(thumbnail){
var tempo = eval("gbild" + parseInt(thumbnail+zustand) + ".src");
// E-COM version (C) 2001 David Florian, E-COM s.r.o. 
//var diesesbild = vorbild + tempo + nachbild;
var tempo2 = eval("fbild" + parseInt(thumbnail+zustand) + ".src");
var diesesbild = vorbild + tempo2  + midbild + tempo + nachbild;
	
var diesebeschreibung = dvorbild + eval("Beschreibung" + parseInt(thumbnail + zustand)) + dnachbild;
layerContent('highimage',diesesbild);
layerContent('showdescription',diesebeschreibung);
restoreImages();
}
function bildtitel(thumbnail){
var diesertitel = eval("titel" + parseInt(thumbnail + zustand));
var diesenanzeigen = tvorbild + diesertitel + tnachbild;
layerContent('showtitle',diesenanzeigen);
window.status = diesertitel;
}
function clearbildtitel(){
layerContent('showtitle',' ');
window.status = ' ';
}
