/**
 * Java Script funktionen für OpenAir St. Gallen
 *
 * Copyright 2004 by DACHCOM digital AG.
 * All rights reserved.
 *
 * Author: Walter Canal, wcanal@dachcomdigital.com
 * Version 1.0, 29.01.2004
 *
 * History:
 *  1.0 29.01.2004	wcanal	initial relase
 *
 */

var active_image   = '';
var active_tr   = '';

if (parent.location.href == self.location.href) {
	window.location.replace ('index.html');
}

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;
}

// 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;
	}
	return true;
}

// 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"));
	}
}
