//--BEGIN global variables, do not edit   --//
var pictures = new Array();
var userAgent = window.navigator.userAgent;
var bVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
var preLoadIsComplete = false;
//--END global variables, do not edit   --//

//--BEGIN Delete temporary Preload-Arrays--//
// checked 06/02/00 by sweih
// im body-Tag ff einfuegen:
// --copy--
// onUnload="destroy();"
// --end copy--

function destroy() {
	destroyPreloads();
}

function destroyPreloads() {
	window.status="CLEARING CACHE...";
	if(document.layers){
		if(pictures) {
			delete pictures;
		}
		if(pic) {
			delete pic;	
		}	
	}
} 
//--end cleaning memory map for Netscape--//


//--BEGIN Netscape layer functionality  --//
function findElement(n,ly)
	{
	var curDoc = ly ? ly.document : document;
	var elem = curDoc[n];
	if (bVers < 4)
		return document[n];
	if (!elem)
		{
		for (var i=0;i<curDoc.layers.length;i++)
			{
			elem = findElement(n,curDoc.layers[i]);
			if (elem)
				return elem;
			}
		}
	return elem;
	}
//--END Netscape layer functionality  --//

//--BEGIN Netscape layer access  --//
function NSStyle(s)
	{
	return findElement(s,0);
	}
//--END Netscape layer access  --//

//--BEGIN Constructor for interactive image obbjects  --//
function activeImageConstructor(aName,aLowlightSrc,aHighlightSrc,layerName)
	{
	this.name  = aName;
	this.lowLight  = new Image();
	this.lowLight.src  = aLowlightSrc;
	this.highLight  = new Image();
	this.highLight.src  = aHighlightSrc;
	this.layerid = layerName;
	}
//--END Constructor for interactive image obbjects  --//

//--BEGIN preLoad fundtion  --//
function preLoad()
	{
	var preLoadedImgs = "";
	if (document.all)
		for (i=0; i<document.all.tags("div").length; i++)
			{
			for (j=0; j<document.all.tags("div")[i].document.images.length; j++)
				{
				if (document.all.tags("div")[i].document.images[j].name)
					{
					if ( preLoadedImgs.indexOf(document.all.tags("div")[i].document.images[j].name) < 0)
						{
						var imgSrc = document.all.tags("div")[i].document.images[j].src;
						var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
						var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
						if ((tmpSuffix == ".gif") || (tmpPrefix.substr(tmpPrefix.length-2,tmpPrefix.length) != "-a")){
							var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
							var IEFix = new activeImageConstructor(document.all.tags("div")[i].document.images[j].name,document.all.tags("div")[i].document.images[j].src,tmpActiveSrc,'');
							var tmpData = new Array(IEFix);
							pictures = pictures.concat(tmpData);
							preLoadedImgs = preLoadedImgs.concat(document.all.tags("div")[i].document.images[j].name);
						}
						}
					}
				}
			}
	else
		for (i=0; i<document.layers.length; i++)
			{
			for (j=0; j<document.layers[i].document.images.length; j++)
				{
				if (document.layers[i].document.images[j].name)
					{
					var imgSrc = document.layers[i].document.images[j].src;
					var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
					var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
					if ((tmpSuffix == ".gif") || (tmpPrefix.substr(tmpPrefix.length-2,tmpPrefix.length) != "-a")){
						var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
						var IEFix = new activeImageConstructor(document.layers[i].document.images[j].name,document.layers[i].document.images[j].src,tmpActiveSrc,document.layers[i].name);
						var tmpData = new Array(IEFix);
						pictures = pictures.concat(tmpData);
					}
					}
				}
			}
	for (i=0; i<document.images.length; i++)
		{
		if (document.images[i].name)
			{
			if ( preLoadedImgs.indexOf(document.images[i].name) == -1)
				{
				var imgSrc = document.images[i].src;
				var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
				var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
				if ((tmpSuffix == ".gif") || (tmpPrefix.substr(tmpPrefix.length-2,tmpPrefix.length) != "-a")){
					var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
					var IEFix = new activeImageConstructor(document.images[i].name,document.images[i].src,tmpActiveSrc);
					var tmpData = new Array(IEFix);
					pictures = pictures.concat(tmpData);
				}
				}
			}
		}
	preLoadIsComplete = true;
	}
//--END preLoad fundtion  --//

//--BEGIN mouseOver function for body document --//
function mouseOver(aPic)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				{
				eval("document.images." + aPic + ".src = pictures[" + i + "].highLight.src");
				}
			}
		}
	else
		preLoad();
	}
//--END mouseOver function for body document --//

//--BEGIN mouseOut function for body document --//
function mouseOut(aPic)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				eval("document.images." + aPic + ".src = pictures[" + i + "].lowLight.src");
			}
		}
	else
		preLoad();
	}
//--END mouseOut function for body document --//

//--BEGIN mouseOver function in layers --//
function layerMouseOver(aPic,aLayer)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				if (document.layers)
					eval("NSStyle('"+aLayer+"').document.images['"+aPic+"'].src = pictures["+i+"].highLight.src");
				else
					eval("document.all.tags('div')."+aLayer+".document.images['"+aPic+"'].src = pictures["+i+"].highLight.src");
			}
		}
	else
		preLoad();
	}
//--END mouseOver function in layers --//

//--BEGIN mouseOut function in layers --//
function layerMouseOut(aPic,aLayer)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				if (document.layers)
					eval("NSStyle('"+aLayer+"').document.images['"+aPic+"'].src = pictures["+i+"].lowLight.src");
				else
					eval("document.all.tags('div')."+aLayer+".document.images['"+aPic+"'].src = pictures["+i+"].lowLight.src");
			}
		}
	else
		preLoad();
	}
//--BEGIN mouseOut function in layers --//

//--BEGIN Internet Explorer layer access  --//
function IEStyle(s)
	{
	return document.all.tags("div")[s].style;
	}
//--END Internet Explorer layer access  --//

//--BEGIN visibility switch for layers  --//
function vSwitch(aLayer,aBool)
	{
	if (preLoadIsComplete)
		{
		if (document.all)
			IEStyle(aLayer).visibility = (aBool == 0) ? "hidden" : "visible";
		else
			{
				
				NSStyle(aLayer).visibility = (aBool == 0) ? 'hide' : 'show';
			}
		}
	else
		preLoad();
	}
//--END visibility switch for layers  --//


//--BEGIN Image rotate function --//
var rotateArray = new Array();
var imgCounter = new Array();

function rotateImg (aPic, num, thisBild) { //-- 'name' of image, 'number' of images to rotate, the number for the bild rotation on the specific page i.e. 0 if only one bild rotation on page   1 if 2 bild rotations on page  etc. --//
	rotateArray[thisBild] = new Array();
	var imgSrc = eval("document.images['" + aPic + "'].src");
	var tmpImgSrc = imgSrc.substring(0,imgSrc.length-5);
	var tmpImgEnd = imgSrc.substring(imgSrc.length-4,imgSrc.length)
	for (p=0;p<num;p++){
		rotateArray[thisBild][p] = new Image();
		rotateArray[thisBild][p].src = tmpImgSrc + p + tmpImgEnd;
	}
	imgCounter[thisBild] = 0;
	rotateGo(aPic, num, thisBild);
}


function rotateGo(aPic, num, thisBild) {
	if (imgCounter[thisBild] == num){imgCounter[thisBild] = 0;}
	eval("document.images['"+aPic+"'].src = rotateArray["+thisBild+"]["+imgCounter[thisBild]+"].src");
	imgCounter[thisBild]++;
	setTimeout('rotateGo(\''+aPic+'\','+num+','+thisBild+')', 2000);
}
//--END Image rotate function --//


//--BEGIN Navigation Highlighting function --//


var rollName;
var rollName2;
var navbutt = "document.images";
var imgSource;
var imgSource2;

/********* highlights the given image - must be used with stopMenueOut() ***********/

function setNavHi(name,name2){
	rollName = name;
	rollName2 = name2;	
	for (p=0;p<pictures.length;p++){
		if (pictures[p].name == name){
			if (pictures[p].layerid){
				navbutt = "document.layers['" + pictures[p].layerid + "'].document.images";
			}
			imgSource = eval(navbutt + "['" + name + "']");
		}
		if (imgSource != null){
			if (imgSource.src == pictures[p].lowLight.src){
				imgSource.src = pictures[p].highLight.src;
			}
		}
		if (pictures[p].name == name2){
			imgSource2 = eval(navbutt + "['" + name2 + "']");
		}
		if (imgSource2 != null){
			if (imgSource2.src == pictures[p].lowLight.src){
				imgSource2.src = pictures[p].highLight.src;
			}
		}
	}
}


/**** stops the "onMouseOut" event for the navigation button of the question which is currently visible                ****/
/**** "stopRollOut('img name')" must replace the mouseOut('img name');" function in the "onMouseOut" event. ****/
/**** The "which" argument is the number of the layer to be visible.                                                   ****/
/**** "stopLayerRollOut('img name','layer name');" must replace the layerMouseOut('img name');" function.                ****/	



function stopRollOut(name){
	if ((name != rollName) && (name != rollName2)){
		mouseOut(name);
	}
}

function stopLayerRollOut(name,layer){
	if ((name != rollName) && (name != rollName2)){
		layerMouseOut(name,layer);
	}
}


//-- END Navigation Highlighting function --//


//-- General open Window function --//

function openWindow(url,width,height,name,resize){
	if (resize){resizable = 'yes';}
	else {resizable = 'no';}
	eigenschaften = "width="+width+",height="+height+",resizable="+resizable+",scrollbars=no";
	popup = window.open(url,name,eigenschaften);
}	