
var loaded = false;
var txtthere = false;
var vid = 0;

$(document).ready(function()
{
	
	$("#video").hide();	
	$("#movie").hide();	
	$("#bg").hide();	
	$("#text").hide();	
		
	if(window.location.hash != "")
	{
	 loaded = false;
	 txtthere = false;
	 
	 vid = num(window.location.hash.substr(1));
	 
	 if(!vid)
	 {
	   $("#tool").hide();
	 	return;
	 }
	 
	 $("#text").hide();	
	 $("#movie").html('<img src="gif/loader.gif" alt="" border="0" />');	 
	 $("#movie").show();
     $("#video").animate({ height: 'show', opacity: 'show' }, 1000);
	 $("#bg").fadeTo(0,0);
	 $("#bg").show();	
     $("#bg").fadeTo(1000,0.8);
	 	
	 window.setTimeout('$("#movie").load();', 1500);
	 window.setTimeout('$("#movie").click();', 1000);
	 
	 $("#description").html("<strong>"+tit(window.location.hash.substr(1))+"</strong><br/>"+des(window.location.hash.substr(1))+"<br/>"+len(window.location.hash.substr(1))); 
	}
		
   $("a.film").click(function(){	
							  
	 loaded = false;
	 txtthere = false;
	 
	 vid = num($(this).attr("name"));
	 
	 
	 $("#text").hide();	
	 $("#movie").html('<img src="gif/loader.gif" alt="" border="0" />');	 
	 $("#movie").show();
     $("#video").animate({ height: 'show', opacity: 'show' }, 1000);
	 $("#bg").fadeTo(0,0);
	 $("#bg").show();	
     $("#bg").fadeTo(1000,0.8);
	 
	 window.setTimeout('$("#movie").load();', 1500);
	 window.setTimeout('$("#movie").click();', 1000);
	 
	 $("#description").html("<strong>"+tit($(this).attr("name"))+"</strong><br/>"+des($(this).attr("name"))+"<br/>"+len($(this).attr("name"))); 
	 preload("films/"+vid+".jpg");
	 
   });
   

   $("#close").click(function(){
  if(loaded)
  {
	$("#movie").hide();	
     $("#video").animate({ height: 'hide', opacity: 'hide' }, 'slow');
     $("#bg").fadeTo(1000,0);
	 window.setTimeout('$("#bg").hide();', 1000);
  }
		
   });
   
   $("#movie").load(function(){
							 
	$("#movie").show();	
	var s1 = new SWFObject("swf/mediaplayer.swf","mediaplayer","400","320","7");
	s1.addParam("allowfullscreen","true");
	s1.addVariable("width","400");
	s1.addVariable("height","320");
	s1.addVariable("showstop","true");
	s1.addVariable("file","../films/"+vid+".flv");
	s1.addVariable("image","films/"+vid+".jpg");
	s1.write("movie");	
	loaded = true;
	 
	 
	 });
		
   $("#movie").click(function(){	
							  if(!txtthere)
							  {
	 $("#text").fadeTo(0,0);
	 $("#text").show();	
     $("#text").fadeTo(1000 , 1);	
	 txtthere = true;
							  }
	 });	
   
   
		
	 $("#tool").fadeTo(0,0.8);
	   $("#tool").hide();
	 
	$(".film").mouseenter(function(){
	 $("#tool").show();	
	 $("#tool").html(des($(this).attr('name'))+"<br/><strong>"+len($(this).attr('name'))+"</strong>");
	 //$("#tool").fadeTo(200,0.9);
	 });
	
	$(".film").mouseleave(function(){
	   //$("#tool").fadeTo(0,0);
	   $("#tool").hide();
   });
	
	$("").mousemove(function(e){
							  
	 $("#tool").css("top",(e.pageY+10)+"px");
	 $("#tool").css("left",(e.pageX+10)+"px");

							  });
	
 });

function des(vidid)
{
	if(vidid == "vid1")
		return "Dialog der Gernerationen<br/>Dokumentation &uuml;ber die 68er - NDR";
	else if(vidid == "vid2")
		return "Dokumentation &uuml;ber die ev. Jugendarbeit - Jugendleiterausbildung";
	else if(vidid == "vid3")
		return "Puppenfilm f&uuml;r Kinder zur Kariesprophylaxe in Kinderg&auml;rten";
	else if(vidid == "vid4")
		return "Sparkasse Bremen<br/>Interne Kommunikation";
	else if(vidid == "vid5")
		return "Sparkasse Bremen<br/>Dokumentation";
	else if(vidid == "vid6")
		return "Begr&uuml;&szlig;ungsfilm f&uuml;r Besucher der Achterbahn ''H&ouml;llenblitz''";
	else if(vidid == "vid7")
		return "Dokumentation &uuml;ber den Bau einer<br/>Achterbahn";
	else if(vidid == "vid8")
		return "Kinospot f&uuml;r die Uni Bremen<br/>";
	else if(vidid == "vid9")
		return "Unsichtbarer Feind<br/>Reportage &uuml;ber Sch&uuml;lerprojekt";
	else if(vidid == "vid10")
		return "RADIO WESER TV<br/>Interviewfilm ''Unsichtbarer Feind''";
};
function len(vidid)
{
	if(vidid == "vid1")
		return "Ausschnitt: 3:25 Min (45 Min)";
	else if(vidid == "vid2")
		return "Ausschnitt: 1:36 Min (22:30 Min)";
	else if(vidid == "vid3")
		return "Ausschnitt: 3:21 Min (15 Min)";
	else if(vidid == "vid4")
		return "L&auml;nge: 0:50 Min";
	else if(vidid == "vid5")
		return "Ausschnitt: 2:05 Min (120 Min)";
	else if(vidid == "vid6")
		return "L&auml;nge: 1:14 Min";
	else if(vidid == "vid7")
		return "Ausschnitt: 7:22 Min (45 Min)";
	else if(vidid == "vid8")
		return "L&auml;nge: 0:35 Min";
	else if(vidid == "vid9")
		return "Trailer: 2:03 Min (31:30 Min)";
	else if(vidid == "vid10")
		return "Ausschnitt: 4:11 Min (23 Min)";
};

function tit(vidid)
{
	if(vidid == "vid1")
		return "Die F&auml;hrhausrebellen und ihre Kinder";
	else if(vidid == "vid2")
		return "Wer's glaubt ... wird selig ...";
	else if(vidid == "vid3")
		return "Kalle, Klops und Karies";
	else if(vidid == "vid4")
		return "Logo-Computeranimation";
	else if(vidid == "vid5")
		return "Kick-Off Veranstaltung";
	else if(vidid == "vid6")
		return "Rusty";
	else if(vidid == "vid7")
		return "H&ouml;llenblitz - der Coaster";
	else if(vidid == "vid8")
		return "Weltretter";
	else if(vidid == "vid9")
		return "Sch&uuml;ler machen Klimafilm";
	else if(vidid == "vid10")
		return "Premierenfeier";
};
function num(vidid)
{
	if(vidid == "vid1")
		return "1";
	else if(vidid == "vid2")
		return "2";
	else if(vidid == "vid3")
		return "3";
	else if(vidid == "vid4")
		return "4";
	else if(vidid == "vid5")
		return "5";
	else if(vidid == "vid6")
		return "6";
	else if(vidid == "vid7")
		return "7";
	else if(vidid == "vid8")
		return "8";
	else if(vidid == "vid9")
		return "9";
	else if(vidid == "vid10")
		return "10";
};

function preload()
{
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
