//---------------------------------------------------------------------------------------	
//scripte fuer Raumausstattung Michael Krebs, 2004-2011
//author michael schulze, www.jms-design.de
//---------------------------------------------------------------------------------------	


//---------------------------------------------------------------------------------------	
//Bilder tauschen
	function swapImage(where, to, ebene) { 
		if ((ebene) && (document.layers))	{eval('window.document.' + ebene + '.document.' + where + '.src=' + to + '.src');} // Netscape 4.x und bild in layer
		else 								{eval('window.document.' + where + '.src=' + to + '.src');}
	}
	

//---------------------------------------------------------------------------------------	
//allgemeine scripts
	// Styleswitch und LayerRef
	// Funktionsaufruf fuer NS 4-Reload
	function initBrowser(){
		if (document.layers) {
			layerStyleRef="layer.";
			layerRef="document.layers";
			styleSwitch="";
			ns6="";
			pix="";
		}
		else if (document.getElementById) { //Netscape 6,7, IE 5,6
			layerStyleRef="layer.";
			layerRef="document.getElementById(";
			styleSwitch=").style";
			ns6=")";
			pix="px";
		}
		else {
			layerStyleRef="layer.style.";
			layerRef="document.all";
			styleSwitch=".style";
			ns6="";
			pix="";
		}
		
	}
	
	
//---------------------------------------------------------------------------------------	
//Ebenenfunktionen
	// Layer zeigen - verbergen
	function showLayer(layerName) {
		initBrowser();
		if (eval(layerRef + '["'+ layerName + '"]' + ns6)) {eval(layerRef + '["'+layerName+'"]' + styleSwitch + '.visibility="visible"');}
	}
	function hideLayer(layerName) {
		initBrowser();
	    if (eval(layerRef + '["'+ layerName + '"]' + ns6)) {eval(layerRef + '["'+layerName+'"]' + styleSwitch +'.visibility="hidden"');}
	}
	function dispLayer(layerName) {
		if (eval('document.getElementById("'+ layerName + '")')) {eval('document.getElementById("'+layerName+'").style.display="block"');}
	}
	function nodispLayer(layerName) {
		if (eval('document.getElementById("'+ layerName + '")')) {eval('document.getElementById("'+layerName+'").style.display="none"');}
	}
	
	//alle verstecken
	function hideAll(bereich) {
		initBrowser();
		for(count=1; count<25; count++){
			if (eval(layerRef + '["'+ bereich + count + '"]' + ns6)) {eval(layerRef + '["' + bereich + count + '"]' + styleSwitch +'.visibility="hidden"');}
		}	
	}
	
	function noDispAll(bereich) {
		initBrowser();
		for(count=0; count<25; count++){
			if (eval('document.getElementById("'+ bereich + count + '")')) {eval('document.getElementById("'+ bereich + count +'").style.display="none"');}
		}	
	}
	
	// Style setzen
	function setStyle(layerName,stil,wert) {
		if (eval('document.getElementById("'+ layerName + '")')) {eval('document.getElementById("'+layerName+'").style.' + stil + '="' + wert + '"');}
	}
	
		
	// Netscape Layer Bug (Dreamweaver-Loesung)
	function MM_reloadPage(init) {  file:
	  if (init==true) with (navigator) {
		  	if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		    	document.MM_pgW=innerWidth; 
				document.MM_pgH=innerHeight; 
				onresize=MM_reloadPage; 
			}
		}
	  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	MM_reloadPage(true);
	
	

//---------------------------------------------------------------------------------------	
//Formular-Funktionen
	function initForm(name){
		if (document.layers) {eval('ref="document.formular.document.' + name + '";');}
		else				 {eval('ref="document.' + name + '";');}
	}
	
	function clearForm(name, lang){
		if (lang=='de') { satz = 'Wollen Sie Ihre Angaben wirklich verwerfen?';}
		else			{ satz = 'Do you really want to reset your entered information?';}
		
		if (confirm(satz) == true) {
			initForm(name);
			eval(ref + '.reset()');
		}
	}
	

//---------------------------------------------------------------------------------------	
// Email-Schutz
	function writeEmail(lay){
		var domain='krebs-raumausstattung.de'; 
		var adr='info'; 
		document.write("<a class='" + lay + "' href='mailto:" + adr + "@" + domain + "'>" + adr + "@" + domain + "</a>");
	}
	
//---------------------------------------------------------------------------------------	
// Flash-Animationen	
	function writeFlash(file){
		var flash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="792" height="336" id="rak_ani_bsp" align="middle">';
		flash +='<param name="allowScriptAccess" value="sameDomain" />';
		flash +='<param name="movie" value="../_swf/' + file + '" />';
		flash +='<param name="quality" value="high" />';
		flash +='<param name="wmode" value="transparent" />';
		flash +='<param name="bgcolor" value="#ffffff" />';
		flash +='<embed src="../_swf/' + file + '" quality="high" wmode="transparent" bgcolor="#ffffff" width="792" height="336" name="rak_ani_bsp" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></OBJECT>';
		document.write(flash); 
	}
	
//---------------------------------------------------------------------------------------	
// Lightbox-Funktion
	function showLightbox(bildnr){
		document.getElementById("lightBox").style.height = document.getElementsByTagName('body')[0].scrollHeight + 'px';
		dispLayer('lightBox');
		dispLayer('hinweis');
		dispLayer('zoombild' + bildnr);
		// Zoombild verschieben
		topoffset = 200 + (bildnr * 170);
		setStyle('hinweis','top',topoffset);
	}
	
	function hideLightbox(){
		nodispLayer('hinweis');
		nodispLayer('lightBox');
		noDispAll('zoombild');
	}	
	
