//Die swfobject.js muss ebenfalls in der Seite eingehängt sein und muss geladen sein, bevor dieses Skript funktioniert

/**
* Initialisieren des Videoplayers. Mit Hilfe des swfobjects wird mit dieser Methode der Videoplayer in die Seite geschrieben
*
* @param string sTeaserFormat Übergabe welcher Videoteaser
* @param string sPicture Übergabe der Bild URL
* @param string CMSDocId eindeutige CMS ID
* @param string PopupURL weiterführende URL (ist mit Lupe verlinkt)
* @param string sVideoURL Übergabe der Videodatei
* @param string sVideoFormat Übergabe des Videoformats [dim1,dim2,dim3,dim4]
*/
function mBuildVideoplayer(sTeaserFormat, sPicture, CMSDocId, PopupURL, sDIVName, sVideoURL, sVideoFormat) {
	var flashvars = {};
	var lWidth = 0;
	var lHeigth = 0;
	var lVideoWidth = 284;
	var lVideoHeight = 213;
	
	switch(sVideoFormat){
    case "dim1":
      lVideoWidth = 284;
      lVideoHeight = 213;
      break;
 
    case "dim2":
      lVideoWidth = 400;
      lVideoHeight = 300; 
      break;
 
    case "dim3":
      lVideoWidth = 298;
      lVideoHeight = 167; 
      break;
 
    case "dim4":
      lVideoWidth = 512;
      lVideoHeight = 288; 
      break;
  }
	
	switch(sTeaserFormat) {
	case "RechteSpalte":
		flashvars.autostart = "false";
		flashvars.sFormat = "Video-Flash-100-160x120";
		lWidth = 298;
		lHeigth = 247;
		flashvars.lVideoWidth = lVideoWidth;
		flashvars.lVideoHeight = lVideoHeight;

		
		//Smartclip/Eyewonder  
		flashvars.bSupportEWAds	= "true";
		flashvars.sEWPreroll	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x320;dcmt=text/html;ord=[timestamp]";
  	flashvars.sEWMidroll	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x299;dcmt=text/html;ord=[timestamp]";	
    flashvars.sEWOverlay	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=300x50;dcmt=text/html;ord=[timestamp]";
 		flashvars.sEWPostroll = "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x300;dcmt=text/html;ord=[timestamp]";
		flashvars.lEWOverlayDelay	= "2";
		flashvars.lEWMidrollVideoLength	= "5";
	
		break;
		
	case "ContentSpalte":
		flashvars.autostart = "true";
		flashvars.sFormat = "Video-Flash-400-400x300";
		lWidth = 510;
		lHeigth = 327;
		flashvars.lVideoWidth = lVideoWidth;
		flashvars.lVideoHeight = lVideoHeight;
		
		//Smartclip/Eyewonder 
		flashvars.bSupportEWAds	= "true";
		flashvars.sEWPreroll	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x320;dcmt=text/html;ord=[timestamp]";
  	flashvars.sEWMidroll	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x299;dcmt=text/html;ord=[timestamp]";	
    flashvars.sEWOverlay	= "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=300x50;dcmt=text/html;ord=[timestamp]";
 		flashvars.sEWPostroll = "http://ad.de.doubleclick.net/ad/t.online.boersenradar.smartclip/;sz=400x300;dcmt=text/html;ord=[timestamp]";
		flashvars.lEWOverlayDelay	= "2";
		flashvars.lEWMidrollVideoLength	= "5";

		break;
	}
	
	flashvars.sVideoURL = sVideoURL;
	
	
	flashvars.sFlashFolder = "http://www.t-online.de/boerse/";
	flashvars.sPlayerURL = "http://www.t-online.de/boerse/Videoplayer.swf";
	//flashvars.playlist = "playlistnew.xml";
	flashvars.statisticJsFunction = "gFPPixel";
	flashvars.font = "Arial";
	flashvars.lPortalColor = "407388";
	flashvars.lStandardColor = "a2a2a2";
	flashvars.bLightningcast = "true";
	flashvars.bPlaylist = "false";
	
	flashvars.CMSDocId = CMSDocId;
	flashvars.previewImage_url = sPicture;
	flashvars.sTeaserFormat = sTeaserFormat;
	flashvars.popupUrl = PopupURL.replace(/&/g, "%26");
	
	//Lightningcast
	flashvars.sNetworkId = "106414";
	flashvars.sLevel = "TOI_Portal%3ATOI_Boerse";
	flashvars.bAdBannerJSInterface = "false";
	flashvars.sDefaultBannerAdRegion = "Standardbanner";
	flashvars.sDefaultBannerClickThru = "";
	flashvars.sDefaultBannerURL = "";
	flashvars.sBannerJSFunction = "";
	flashvars.lPLItem = "1";
	
	
	var params = {};
	params.menu = "true";
	params.allowFullScreen = "true";
	params.swliveconnect = "true";
	params.quality = "high";
	params.allowScriptAccess = "always";
	params.align = "center";
	params.scale = "noscale";
	params.wmode = "opaque";
	params.salign = "lt";
	
	var attributes = {};
	attributes.id = sDIVName;
	swfobject.embedSWF("http://www.t-online.de/boerse/Teaser.swf", sDIVName, lWidth, lHeigth, "9.0.0", false, flashvars, params, attributes);
}

/**
* Video Pixel versenden
*
* @param string sVideoURL Übergabe der VideoURL
*/
function gFPPixel(sVideoURL) {
	var sPixel = "";
	
  sPixel += '<img src="http://toi.ivwbox.de/cgi-bin/ivw/CP/22320407;/wirtschaft/boerse/boerse/videos/streams/' + sVideoURL + '.html?d='+Date.parse(new Date())+'" width="1" height="1" alt="" />';
  sPixel += '<img src="http://toi.passul.t-online.de/cgi-bin/CP/22320407;/wirtschaft/boerse/boerse/videos/streams/' + sVideoURL + '.html?d='+Date.parse(new Date())+'" width="1" height="1" alt="" />';
	sPixel += '<img src="http://toi.passul.t-online.de/cgi-bin/CP/00000000;/Flash-Player/Wirtschaft/Boersenradar/' + sVideoURL + '.html?d='+Date.parse(new Date())+'" width="1" height="1" alt="" />';

	document.getElementById("dtag").innerHTML = sPixel;
}




