// Array von Objekten { width, height, file, aspect, id, autoplay : ja/nein, fileType, embedCode }
var movies = [];
var heightFlashCtrls = 44;
$(function(){
	for( var i=0; i<movies.length; i++ ){
		var movie = movies[i];
		if( movie.fileType == "youtube" ){
			$( '#video_' + movie.id ).html( Acu.phpUrlDecode( movie.embedCode ) );
		}else{
			movie_path = "./images/videos/" + movie.file;
			var video = document.createElement( "video" );
			if( typeof video.canPlayType == 'undefined' || video.canPlayType('video/mp4') == '' ){
				// kein html5-video, oder kein h.264 Support -> Flash
				if( !$.flash.hasVersion(10) ){
					$( '#video_' + movie.id ).html( 'Bitte lade Dir den aktuellen Flash-Player herunter' );
				}else{
					var player = (movie.aspect=="16x9") ? "./player16x9.swf" : "./player4x3.swf";
					$( '#video_' + movie.id ).flash({
						swf 					: player,
						width					: movie.width,
						height				: movie.height + heightFlashCtrls,
	//					height				: 308,
						allowFullScreen	: true,
						wmode					: 'direct',
						flashvars:{ film:movie_path, aplay:movie.autoplay }
					});
				}
			} else {
				// HTML5 Video
				var autoplay_tag = (movie.autoplay=="ja") ? " autoplay" : "";
				var html5video = '<div class="video-js-box">' +
				'<video class="video-js" width="' + movie.width + '" height="' + movie.height + '" controls' + autoplay_tag + '>' +
				'<source src="' + movie_path + '" type="video/mp4; codecs="avc1.42E01E, mp4a.40.2" />' +
				'</video></div>';
				$( '#video_' + movie.id ).html( html5video );
			}
		}
	}
	$( "video" ).VideoJS();
});

