/*
layercontrol.js

created 26-04-05 dg

*/

//---------------------------------
// jede Sprache muss hier eingetragen werden
var exiLang=new Array;
exiLang[0]='en';
exiLang[1]='fr';
exiLang[2]='es';
exiLang[3]='it';
exiLang[4]='de';
//---------------------------------

function Activate(activeLang) {

	var tempName;
	var tempSrc;
	
	//hide all images and layers
	for (i=0; i<exiLang.length; i++) {
		tempName = "img_" + exiLang[i];
		tempSrc = "gfx/img_" + exiLang[i] + "-p.gif";
		document.images[tempName].src=tempSrc;
	
		tempName = "txt_"  + exiLang[i];
		obj=FindObject(tempName);
		obj.style.visibility='hidden';
	}
	
	for (i=0; i<exiLang.length; i++) {
		tempNameFooter = "footer_"  + exiLang[i];
		objFooter=FindObject(tempNameFooter);
		if(objFooter != null){
			objFooter.style.display='none';
		}
	}
	
	//show required image and layer
	tempName = "img_" + activeLang;
	tempSrc = "gfx/img_" + activeLang + "-a.gif";
	
	document.images[tempName].src=tempSrc;
	
	tempName = "txt_"  + activeLang;
	if ((obj=FindObject(tempName))!=null){ 
				obj.style.visibility='visible'; 
	}
	
	tempNameFooter = "footer_"  + activeLang;
	if ((objFooter=FindObject(tempNameFooter))!=null){ 
				objFooter.style.display='table-row'; 
	}
}

function FindObject(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=FindObject (n, d.layers[i].document); 
    }
	// netscape 6.0  
	if (!x && d.getElementById){
		x=d.getElementById(n);
	}
	return x;
}

