/* Funktionen für Navigation */
/* ********************************************************************************************************************************************* */	

		var myimages=new Array();
		function preloadimages()
		{
			for (i=0;i<preloadimages.arguments.length;i++)
			{
				myimages[i]=new Image()
				myimages[i].src=preloadimages.arguments[i]
			}
		}


		function wechsel(id, url) 
		{
			
			if(id == 'infosvideo')
			{
				window.document.getElementById(id).src = url;
				window.document.getElementById("einstellungen").src = '/img/flashplayer/btn_einstellungen_off.gif';		
			}

			else if(id == 'einstellungen')
			{
				window.document.getElementById(id).src = url;
				window.document.getElementById("infosvideo").src = '/img/flashplayer/btn_infosvideo_off.gif';
			}

			else
			{
				window.document.getElementById("infosvideo").src = '/img/flashplayer/btn_infosvideo_off.gif';
				window.document.getElementById("einstellungen").src = '/img/flashplayer/btn_einstellungen_off.gif';		
			}
		}



/* Aufruf nach Werbevideo */
/* ********************************************************************************************************************************************* */	
		
		function onComplete(args)
		{
			
			//document.cookie     = "ADVIDEO=1";
			var tmpcontrols     = "false";  
			var tmpfunction     = "onVideoComplete";
			var tmpfile         = tmpvideofile;
			var tmpbandwith     = "null";	
			
			/*Titel des aktuellen Videos ausgeben*/
			document.flashform.flashtitle.value = tmpfiletitle;
			
			showvideo(tmpmode,tmpbandwith,tmpfile,tmpcontrols,tmpfunction,tmpargument);
			resize(0);
		}


/* Aufruf nach normalem Video*/
/* ********************************************************************************************************************************************* */	
		
		function onVideoComplete(args)
		{	
			var tmpcontrols     = "false";  
			var tmpfunction     = "onVideoComplete";
			var tmpfile         = tmpvideofile;
			var tmpbandwith     = "null";
			document.cookie     = "Up=1";
			document.cookie     = "VIDEOUP=1";
			
			/*Titel des aktuellen Videos ausgeben*/
			document.flashform.flashtitle.value = tmpfiletitle;
			
			/*Automatischer Durchlauf*/
			if(args == 0)
			{
			//showvideo(tmpmode,tmpbandwith,tmpfile,tmpcontrols,tmpfunction,tmpargument);
			resize(0);
			}
			else
			{
			resize(0);
			window.setTimeout(loadwindow, 600);
			}
		}


		function loadwindow()
		{
			location.reload();
		}

/* Weitere Videos */
/* ********************************************************************************************************************************************* */

		function showMoreVideos() {
			wechsel('archiv', '/img/flashplayer/btn_archiv_on.gif');
	
			var cb = document.getElementById("archiveli").firstChild; 	
			if (navigator.appName.indexOf("Explorer") != -1) {
				cb.fireEvent("onclick");			
			} else {
				var evt = document.createEvent("MouseEvents");
				evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
				cb.dispatchEvent(evt);		
			}
		}

/* Tracking */
/* ********************************************************************************************************************************************* */

        function track(event, trackingId) { 
                var ns_flashact = ns_flashn; 
                if (event == 'ON_VIDEO_START') { 
                        ns_flashact += '.start'; 
                } else if (event == 'ON_VIDEO_END') { 
                        ns_flashact += '.ende'; 
                } 
                if (event == 'ON_VIDEO_START') { 
                        var ns_flash = "http://de.sitestat.com/idgcom-de/" + ns_objectname + "/s?" + ns_flashact + "&amp;ns_type=flash" + "&amp;ns__t=" + (new Date()).getTime(); 
                        document.ns_flashp.src=ns_flash; 
                } 
                if (event == 'ON_VIDEO_END' && !(ns_endflag)) { 
                        var ns_flash = "http://de.sitestat.com/idgcom-de/" + ns_objectname + "/s?" + ns_flashact + "&amp;ns_type=flash" + "&amp;ns__t=" + (new Date()).getTime(); 
                        document.ns_flashp.src=ns_flash; 
                        ns_endflag = true; 
                }                         
        } 

/* Vollbildmodus */
/* ********************************************************************************************************************************************* */

		function resize(mode){
			if(mode==1){
				var windowheight = 576;
				var windowwidth = 768;
			} else {
				var windowheight = 289;
				var windowwidth = 340;	
			}
			var frame = document.getElementById("flashcontent");
			frame.style.height = windowheight + "px";
			frame.style.width = windowwidth + "px";
			var flash = document.getElementById("flash");
			flash.setAttribute("width",windowwidth);
			flash.setAttribute("height",windowheight);
		}

/* Anzeige Video */
/* ********************************************************************************************************************************************* */		

		function showvideo(smode,sbandwith,sfile,scontrols,sfunction,sargs,videonr,cat,noads,object,adVideoWidth,adVideoHeight,roadblockWidth,roadblockHeight,is16_9,showTeaserScreen,showMoreVideosBtn)
		{
			var domain = document.domain;
			var config = "config_live.xml";
			if (domain.indexOf("cp-webstage.cp") >= 0) {
				config = "config_dev.xml";
			} else if (domain.indexOf("cp.stage") >= 0) {
				config = "config_stage.xml";				
			}
			
			if (is16_9 == "false") {
				var so = new SWFObject("/videoplayer/player/preloader.swf", "flash", "340", "289", "8", "#FFFFFF");
			} else {
				var so = new SWFObject("/videoplayer/player/preloader_16_9.swf", "flash", "340", "229", "8", "#FFFFFF");				
			}
			so.addParam("allowFullScreen", "true");			
			so.addVariable("mode",smode);
			so.addVariable("bandwidth",sbandwith);
			so.addVariable("file", sfile);
			so.addVariable("skinConfig", "/videoplayer/player/config/" + config);
			so.addVariable("disableControl", scontrols);
			so.addVariable("playbackCallback", sfunction);
			so.addVariable("playbackCallbackArguments", sargs);
			so.addVariable("dartConfig", "/videoplayer/player/config/dart_config.xml");
			so.addVariable("object", object);
			so.addVariable("videonr", videonr);
			so.addVariable("cat", cat);
			so.addVariable("noads", noads);
			so.addVariable("adVideoWidth", "3");
			so.addVariable("adVideoHeight", "3");
			so.addVariable("roadblockWidth", "1");
			so.addVariable("roadblockHeight", "1");
			so.addVariable("playbackCallback", "onComplete");
			so.addVariable("playbackCallbackArguments", "");
			so.addVariable("isPaused", "false");
			so.addVariable("is16_9", is16_9);
			so.addVariable("showTeaserScreen", showTeaserScreen);
			so.addVariable("teaserXml", "teaserScreen.cfm%3Fvideoid=" + videonr);
			so.addVariable("trackingId", videonr);
			so.addVariable("showMoreVideosBtn", showMoreVideosBtn);
			so.write("flashcontent");
		}