/* 

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 = '001xxx_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;
  }
}

// navigation

// Navi
function goTo(url){
	self.location.href = url;
}

function changeNavOver(id){
	gOb("tdNav"+id).style.backgroundColor = "#cccccc";
	gOb("aNav"+id).style.color = "#fff";
}

function changeNavOut(id){
	gOb("tdNav"+id).style.backgroundColor = "#AAACAE";
	gOb("aNav"+id).style.color = "#ffffff";
}
function changeNavOver2(id){
	gOb("tdNav2"+id).style.backgroundColor = "#eae7e7";
	gOb("aNav2"+id).style.color = "#ed1c24";
}

function changeNavOut2(id){
	gOb("tdNav2"+id).style.backgroundColor = "#cccccc";
	gOb("aNav2"+id).style.color = "#000000";
}

function changeNavOver3(id){
	gOb("tdNav3"+id).style.backgroundColor = "#eae7e7";
	gOb("aNav3"+id).style.color = "#ed1c24";
}

function changeNavOut3(id){
	gOb("tdNav3"+id).style.backgroundColor = "#cccccc";
	gOb("aNav3"+id).style.color = "#000000";
}


// Mouse Over

arrimages = new Array (
"../images/C67.001/layout/logo_malen.gif", // 0
"../images/C67.001/layout/logo_malen_over.gif", // 1
"../images/C67.001/layout/logo_gestalten.gif", // 2
"../images/C67.001/layout/logo_gestalten_over.gif", // 3
"../images/C67.001/layout/logo_gipsen.gif", // 4
"../images/C67.001/layout/logo_gipsen_over.gif", // 5
"../images/C67.001/layout/logo_isolieren.gif", // 6
"../images/C67.001/layout/logo_isolieren_over.gif", // 7
"../images/C67.001/layout/logo_schweizercombi.gif", // 8
"../images/C67.001/layout/logo_schweizercombi_over.gif", // 9
"../images/C67.001/layout/logo_bottom_zuerich.gif", // 10
"../images/C67.001/layout/logo_bottom_zuerich_over.gif", // 11
"../images/C67.001/layout/logo_bottom_buelach.gif", // 12
"../images/C67.001/layout/logo_bottom_buelach_over.gif", // 13
"../images/C67.001/layout/logo_bottom_winterthur.gif", // 14
"../images/C67.001/layout/logo_bottom_winterthur_over.gif", // 15
"../images/C67.001/layout/logo_bottom_thalwil.gif", // 16
"../images/C67.001/layout/logo_bottom_thalwil_over.gif", // 17
"../images/C67.001/layout/logo_bottom_wetzikon.gif", // 18
"../images/C67.001/layout/logo_bottom_wetzikon_over.gif" // 19

);

objectImages = new Array ();
		for(i=0; i<arrimages.length; i++){
			objectImages[i] = new Image();
			objectImages[i].src = arrimages[i];	
}

function changeimg(id,imgnr){
	gOb(id).src = objectImages[imgnr].src; 
}
