/* 

eSitebuilder 2.6 standard javascript file

*/


function gOb(id){return document.getElementById(id)}

// seite für falsche browser
wrongBrowserPage = 'browser.htm';

// die default seiten id
homedyn = 0;
homePageID = '002trl_00'; 

// wurde die sprache nicht erkannt, diese seite anzeigen
errordyn = 0;
langErrorPage = homePageID; 
langErrorLang = 'de';

// diese sprachen werden unterstüzt
clientLangs = "de, fr"  

function checkbrowser(){
	if(document.getElementById){
		checklang();
	} else {
		self.location.replace(wrongBrowserPage);
	}
}
function checklang(){
	lang = getCookie('mylang');
	if(clientLangs.indexOf(lang)==-1){
		lang = ((navigator.language)?navigator.language:(navigator.systemLanguage)?navigator.systemLanguage:'--').substring(0,2);
		valid = (clientLangs.indexOf(lang)!=-1)?1:0;
	} else {
		valid = 1;
	}
	loadPage(lang,valid);		
}
function loadPage(lang,valid){
	if(valid){
		if(homedyn){self.location.replace('index.taf?id='+homePageID+'&lang='+lang);
		}else{self.location.replace(homePageID+"_"+lang+".htm");}
	} else {
		if(errordyn){self.location.replace('index.taf?id='+langErrorPage+'&lang='+langErrorLang);
		}else{self.location.replace(langErrorPage+"_"+langErrorLang+".htm");}
	}
}
// user lang saver
function setLang(setlang){
	if(document.getElementById){
		var now = new Date();fixDate(now);now.setTime(now.getTime() + 10 * 365 * 24 * 60 * 60 * 1000);
		setCookie('mylang',setlang,now);
	} else {
		self.location.replace(wrongBrowserPage);
	}
}


// window opener

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openSetWindow(theURL,winName,launchWin,features) { //v1.0
  if (launchWin == ''){
    window.open(theURL,winName,features);
  }
  else{
    var controller = window.open(theURL,winName,features);
    if (controller.opener == null){
      controller.opener = self;
    }
    controller.opener.name = launchWin;
    return controller;
  }
}

//preload images
var strImages = new Array(
	"ic_de_a.html",
	"ic_de_p.html",
	"ic_fr_a.html",
	"ic_fr_p.html",
	"ic_it_a.html",
	"ic_it_p.html",
	"ic_en_a.html",
	"ic_en_p.html",
	"ic_newsletter_a.html",
	"ic_newsletter_p.html",
	"ic_kontakt_a.html",
	"ic_kontakt_p.html",
	"ic_sitemap_a.html",
	"ic_sitemap_p.html",
	"ic_print_a.html",
	"ic_print_p.html",
	"ic_top_a.html",
	"ic_top_p.html",
	"ic_go_a.html",
	"ic_go_p.html",
	"ic_home_a.html",
	"ic_home_p.html",
	"ic_anmelden_a.html",
	"ic_anmelden_p.html",
    "ic_agb_a.html",
	"ic_agb_p.html"
);

var objImages = new Array();
for(i = 0;i < strImages.length;i++){
	objImages[i] = new Image;
	objImages[i].src = "images/C49.002/icons/" + strImages[i];
}

function changeImage(imgID,nr,linkID,color){
	gOb(imgID).src = objImages[nr].src
	if(linkID){
		gOb(linkID).style.color = color;
	}
}

function changeNavOver(id){
	gOb("trNav"+id).style.backgroundColor = "#eceff6";
	gOb("aNav"+id).style.color = "#143d75";
	gOb("imgNav"+id).src = "images/C49.002/icons/nav_01_a.gif";
}

function changeNavOut(id){
	gOb("trNav"+id).style.backgroundColor = "#143d75";
	gOb("aNav"+id).style.color = "#ffffff";
	gOb("imgNav"+id).src = "images/C49.002/icons/nav_01_p.gif";
}

function goTo(url){
	self.location.href = url;
}

function printCont(){
	if(document.getElementById){
		c = gOb('contInnerHtml').innerHTML;
		if(c.length){
			document.contentPrintForm.url.value = self.location.href;
			document.contentPrintForm.title.value = document.getElementsByTagName('title')[0].innerHTML;
			document.contentPrintForm.content.value = c;
			document.contentPrintForm.submit();
			return
		}
	}
	self.print();
}

function changeImg(nImg){
	intRnd = (Math.ceil(Math.random() * nImg));
	document.write('<img src="images/C49.002/layout/head_img_0'+intRnd+'.jpg" width="578" height="139" border="0">');
}
