var Browser ="";
var aktiv = "";
var i = 0;
var BlenderStand = "Aus";
var Sprachsperre = 0;
if (navigator.userAgent.indexOf("MSIE")!= -1){
   Browser = ("IE");
}
   else if (navigator.userAgent.indexOf("Netscape")!= -1){
   Browser = ("Netscape");
}
   else if (navigator.userAgent.indexOf("Opera")!= -1){
   Browser = ("Opera");
}
   else if (navigator.userAgent.indexOf("Firefox")!= -1){
   Browser = ("Firefox");
}
   else if (navigator.userAgent.indexOf("Safari")!= -1){
   Browser = ("Safari");
}
   if(navigator.userAgent.indexOf("iPhone")!= -1){
   		Browser = ("iPhone");	
}
	if (navigator.userAgent.indexOf("iPad")!= -1){
   		Browser = ("iPhone");	
}
	if (navigator.userAgent.indexOf("Win")!= -1){
   		Betriebssystem = ("Windows");
}
  		 else if (navigator.userAgent.indexOf("Mac")!= -1){
   		Betriebssystem = ("Mac");
   }else{
   		Betriebssystem = navigator.userAgent;
}

//SubMenue/***************************************





function MediaBlenderEin(Film){
	
	//
	//alert(Browser);
	if(Browser == "iPhone"){
		Ausgabe = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="160" HEIGHT="136" >';
		Ausgabe += '<PARAM NAME="src" VALUE="Film/'+Film+'.mp4" >';
		Ausgabe += '<PARAM NAME="autoplay" VALUE="true" >';
		Ausgabe += '<EMBED SRC="Film/'+Film+'.mp4" TYPE="image/x-macpaint" PLUGINSPAGE="http://www.apple.com/quicktime/download" WIDTH="160" HEIGHT="136" AUTOPLAY="true"></EMBED>';
		Ausgabe += '</OBJECT>';
		Ausgabe += '<br/><a href="#" onclick="javascript:QTVRBlenderAus();" title="Panorama">Schliessen</a> ';
		document.getElementById("IPhoneContainer").innerHTML= Ausgabe;
		FilmHerunterladen(Film);
	}
	
	
	
	//alert (Betriebssystem);
	if(BlenderStand == "Aus"){
		BlenderStand = "Faden";
		
		if(Browser == "IE"){
//**********************************************************************************************************	
			document.getElementById('FilmFenster').SetVariable("FilmTyp",Film); //film laden
//**********************************************************************************************************
		//Deckblatt = schwarzer Hintergrund	
			FensterBreite = document.documentElement.clientWidth;
			FensterHoehe = document.documentElement.clientHeight;
			BildschirmBreite = screen.width;
			BildschirmHoehe = screen.height;
			//alert(FensterBreite);
			TopPosition =document.documentElement.scrollTop+20;
			document.getElementById("Deckblatt").style.width = BildschirmBreite;
			document.getElementById("Deckblatt").style.height = BildschirmHoehe;
			//document.getElementById("DeckblattInhalt").style.width = 460;
			//document.getElementById("DeckblattInhalt").style.height = 450;
			//document.getElementById("DeckblattInhalt").style.left = (FensterBreite/4);
			//document.getElementById("DeckblattInhalt").style.top = 30;
			document.getElementById("Deckblatt").style.display = "block";
			//document.getElementById("DeckblattInhalt").style.display = "block";
			//document.getElementById("Film1").style.display = "block";
			//document.getElementById("BGBildergalerie").style.display = "block";
			
			document.getElementById("Film1").style.left = FensterBreite/2-200;
			document.getElementById("Film1").style.top = 150;
			
			
			
			aktiv = window.setInterval("Faden('Ein')", 10);//Aufruf in x Millisekunden
			
			
			
			
			
		}else{
//**********************************************************************************************************
			//document.getElementById("FilmFenster").SetVariable("FilmTyp",Film); //film laden
			if(document.FilmFenster) document.FilmFenster.SetVariable("FilmTyp",Film);
			

//**********************************************************************************************************
			FensterHoehe = window.innerHeight  ;
			FensterBreite = window.innerWidth ;
			//FensterHoehe = window.outerHeight  ;
			//FensterBreite = window.outerWidth ;
			BildschirmBreite = window.screen.width;
			BildschirmHoehe = window.screen.height;
			TopPosition = window.pageYOffset+20+"px";
			
			//document.getElementById("BGBildergalerie").style.opacity = 1;
			//document.getElementById("BGBildergalerie").style.display = "block";
			
			document.getElementById("Deckblatt").style.opacity = 0;
			document.getElementById("Deckblatt").style.width = BildschirmBreite+"px";
			document.getElementById("Deckblatt").style.height = BildschirmHoehe+"px";
			document.getElementById("Deckblatt").style.left = "0px";
			document.getElementById("Deckblatt").style.top = "0px";
			
			document.getElementById("Deckblatt").style.display = "block";
			//alert(FensterBreite);
			//document.getElementById("Film1").style.display = "block";
			
			document.getElementById("Film1").style.left = FensterBreite/2-200+"px";
			document.getElementById("Film1").style.top = "150px";
			
			if(Betriebssystem=="Mac"){
				//document.getElementById("DeckblattInhalt").style.left = "0px";
				//document.getElementById("DeckblattInhalt").style.top = "0px";
			}
			
			
			aktiv = window.setInterval("Faden('Ein')", 10);//Aufruf in x Millisekunden
			
		}
	
		
	}
	
}



function MediaBlenderAus(){
	if(Browser == "IE"){
		//document.FilmFenster.StopPlay(1);//Flash Bearbeiten, damit Film entladen wird.
		document.FilmFenster.SetVariable("FilmTyp","undefined");
		if(BlenderStand == "Ein"){
		BlenderStand = "Faden";
		aktiv = window.setInterval("Faden('Aus')", 10);//Aufruf in x Millisekunden
		}
	}else{
		
//**********************************************************************************************************
		//if(window.FilmFenster) window.document["FilmFenster"].SetVariable("FilmTyp","undefined");
  		//if(document.FilmFenster) document.FilmFenster.SetVariable("FilmTyp","undefined");
		if(document.FilmFenster) document.FilmFenster.SetVariable("FilmTyp","undefined");
//**********************************************************************************************************
		if(BlenderStand == "Ein"){
			BlenderStand = "Faden";
			aktiv = window.setInterval("Faden('Aus')", 10);//Aufruf in x Millisekunden
		}
		
	}
	
	//if(window.FilmFenster) window.document["FilmFenster"].SetVariable("flashvars","FilmTyp=Hallo");
	//document.getElementById("FilmFenster").SetVariable("flashvars","FilmTyp='Hallo'");
	
	
	
}



function Faden(Richtung) {
	
		
	if(Browser == "IE"){
		if(Richtung == "Ein"){
			i=i+7;
		}else{
			i=i-7;
		}
		ii=i-20;
		document.getElementById("Deckblatt").style.filter="alpha(opacity="+ii+")";
		document.getElementById("Film1").style.filter="alpha(opacity="+i+")";
		document.getElementById("FilmFenster").style.filter="alpha(opacity="+i+")";
		
		//document.getElementById("DeckblattInhalt").style.filter="alpha(opacity="+1.4*i+")"; //2*i ergibt 100
		//document.getElementById("BGBildergalerie").style.filter="alpha(opacity="+i+")";
		
		
	}else{
		if(Richtung == "Ein"){
			i=i+0.05;
		}else{
			i=i-0.05;
		}
		document.getElementById("Deckblatt").style.opacity =i-0.2;
		document.getElementById("Film1").style.opacity =i;
		document.getElementById("filmfenster").style.opacity =i;
		//document.getElementById("DeckblattInhalt").style.opacity =i; //2*i ergibt 100
		//document.getElementById("BGBildergalerie").style.opacity =i;
	}
	if(Browser == "IE"){
  		if (i > 100){
    		window.clearInterval(aktiv);
			i = 100;
			BlenderStand = "Ein";
		}
		if(i < 0){
			window.clearInterval(aktiv);
			i = 0;
			document.getElementById("Deckblatt").style.display = "none";
			//document.getElementById("Film1").style.display = "none";
			//document.getElementById("FilmFenster").style.display = "none";
			//document.getElementById("DeckblattInhalt").style.display = "none";
			BlenderStand = "Aus";
			document.getElementById("Film1").style.left = -1000;
			document.getElementById("Film1").style.top = -1000;
			
			//Sprachsperre = 1;
		}
	}else{
		if (i > 1.0){
    		window.clearInterval(aktiv);
			i = 1.0;
			BlenderStand = "Ein";
		}
		if(i < 0){
			window.clearInterval(aktiv);
			i = 0;
			document.getElementById("Deckblatt").style.display = "none";
			
			//document.getElementById("DeckblattInhalt").style.display = "none";
			BlenderStand = "Aus";
			document.getElementById("Film1").style.left = "-1000px";
			document.getElementById("Film1").style.top = "-1000px";
			//Sprachsperre = 1;
		}
	}
}

//***************************************************************************
