/***
* Klappt das gew&uuml;nschte Video auf
* 
***/
function showMovie(name,code,videoWidth,videoHeight)
{
  inHtml = $('#'+name).html();
  
  if(inHtml.indexOf("<") == -1)
  {
    var movieHtml;
    movieHtml = "";
    //Object generieren
    movieHtml += '<a href="#'+name+'" style="float:right;" onclick="hideMovie(\''+name+'\');" class="movieLink">[Video schlie&szlig;en]</a><br><br>';
    movieHtml += '<object width="'+videoWidth+'" height="'+videoHeight+'">';
    //movieHtml += ' <param name="movie" value="http://www.youtube.com/v/'+code+'?fs=1&hl=de_DE&rel=0;">';
    movieHtml += ' <param name="movie" value="http://www.youtube.com/v/'+code+'?fs=1&hl=de_DE&rel=0;autoplay=1">';
    movieHtml += ' </param>';
    movieHtml += ' <param name="allowFullScreen" value="true">';
    movieHtml += ' </param>';
    movieHtml += ' <param name="allowscriptaccess" value="always">';
    movieHtml += ' </param>';
    //movieHtml += ' <embed src="http://www.youtube.com/v/'+code+'?fs=1&hl=de_DE&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoWidth+'" height="'+videoHeight+'">';
    movieHtml += ' <embed src="http://www.youtube.com/v/'+code+'?fs=1&hl=de_DE&rel=0;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoWidth+'" height="'+videoHeight+'">';
    movieHtml += ' </embed>';
    movieHtml += ' </object><br><br>';
    
    //In DIV schreiben
    $('#'+name).html(movieHtml);
  }
}

function hideMovie(name)
{
  $('#'+name).html('');
}
var thumbNail;
var playButton;
var spanText;
function setFlowplayer(movieDivName){
	$f(movieDivName, "/base/3rd/flowplayer/flowplayer.swf", {	
		clip:  {
			autoPlay: true,
			autoBuffering: true,
			scaling: "orig"
		},
			plugins: {
				controls: {
					stop:true
			}
		},
		// perform custom stuff before default click action
		onBeforeClick: function() {		
			// unload previously loaded player
			$f().unload();
			// get wrapper element as jQuery object
			var wrap = $(this.getParent());		
			// hide nested play button
			wrap.find("img").hide();		
			wrap.find("span").hide();
			// start growing animation
			wrap.animate({width:580, height:324}, 500, function() {			
				//wrap.find("span").hide();
				$f(this).load();					
			});			
			// disable default click behaviour (player loading)
			return false; 
		}, 
		// unload action resumes to original state		
		onUnload: function() {
			$(this.getParent()).animate({width:160, height:130}, 500, function()  {				
				// make play button visible again
				$(this).find("img").fadeIn();
				$(this).find("span").fadeIn();
			});				
		},
		onStop: function() {			
			this.unload();				
		},	
		// when playback finishes perform our custom unload action
		onFinish: function() {
			this.unload();	
		}	
	});	
}

function resizeFlowPlayer(movieDivName){
$('#'+movieDivName).css('float','left');

$f().unload();
}
