/*
  use flashembed to place flowplayer into HTML element 
  whose id is "example" (below this script tag)

  modified for QTV Webservice by R. Neubauer 200809
  modified for "small"=384x216 by J. Liebers, 2009-09-11
  modified for qtv_autoplay by J. Liebers, 2010-03-04
  modified with qtv_divselect by J. Liebers, 2010-12-02
  modified with qtv_splashimage by J. Liebers, 2011-01-17
*/

function flowembed (size,serverurl,video) {
// divid: id of the div element which will contain the player component
// size: either "norm" for 4:3 or "wide" for 16:9 aspect ratio player
// barcolor: hex color value for the preshaded player control bar
// location: url of the .flv video file

//  qtv_autoplay soll global 'yes'/'no' gesetzt werden und kann dann hier abgefragt werden.
//  Danach wird flow_autoplay auf true/false gesetzt und unten an den Player übergeben.
    var import_autoplay = window.qtv_autoplay || 'yes';
    if (import_autoplay == 'no') { flow_autoplay = false; } else { flow_autoplay = true; }

//  qtv_divselect ist entweder gesetzt oder wird per default gefüllt und unten übergeben:
    var qtv_divselect = window.qtv_divselect || 'clipdiv';

//  qtv_splashimage ist entweder '' oder URL zu einem Splash-Image
    var qtv_splashimage = window.qtv_splashimage || '';

	var video_width;
	var video_height;

	if (size == "norm") {
		video_width = 448;
		video_height = 366;
	}

	if (size == "wide") {
		video_width = 512;
		video_height = 318;
	}

	if (size == "small") {
		video_width = 384;
		video_height = 246;
	}

    if (qtv_splashimage == '') // mit und ohne splashImageFile
    {
    	flashembed(qtv_divselect, 
    	{
    		src:'http://www.quintessenz.de/webservices/FLOWPLAYER/FlowPlayerLight.swf',
    		w3c: true,
    		width: video_width, 
    		height: video_height,
    		version: [9, 115]
    	},
    	{config: {   
    		autoPlay: flow_autoplay,
    		loop: false,
    		autoRewind: true,
    		controlBarBackgroundColor: '0x808080',
    		initialScale: 'scale',  // frueher: 'orig'
    		bufferLength: 5,
    		startingBufferLength: 2,
    		streamingServerURL: serverurl, 
    		videoFile: video,
    		showMenu: false
    	}} 
    	);
   	}
   	else
   	{
    	flashembed(qtv_divselect, 
    	{
    		src:'http://www.quintessenz.de/webservices/FLOWPLAYER/FlowPlayerLight.swf',
    		w3c: true,
    		width: video_width, 
    		height: video_height,
    		version: [9, 115]
    	},
    	{config: {   
    		autoPlay: flow_autoplay,
    		loop: false,
    		autoRewind: true,
    		controlBarBackgroundColor: '0x808080',
    		initialScale: 'scale',  // frueher: 'orig'
    		bufferLength: 5,
    		startingBufferLength: 2,
    		streamingServerURL: serverurl, 
    		videoFile: video,
    		showMenu: false,
    		scaleSplash: true,
    		splashImageFile: qtv_splashimage
    	}} 
    	);
    }
	
//	$("#clipdiv").css("width", video_width);
//	$("#clipdiv").css("height", video_height);
//	$("#clipdiv h2").css("margin-top", "0");
//	$("#clipdiv h2").css("padding-top", "50");


} //end
