function cut_fstat(sName, sKat) {
$.get('/C12574DE003C12AD/agStatistik?OpenAgent', { base : 'C12576C4003272F8', key: 'N282GDUF101MFRKDE', name: sName, Kat: sKat } )
}

var player;
var g_item;
var g_item_save;
var templink;

var g_hinweistext = "Nutzen Sie die Pfeile zum Navigieren oder klicken Sie direkt auf ein Bild in der Bilderleiste.";
var g_flashtext = "<div style='padding:5px;'>Zum Betrachten der Videos / Bilder ist ein aktueller Flash-Player erforderlich.</div>";

function playerReadyCallback(obj) {
	player = document.getElementById(obj['id']);
	player.addModelListener("STATE","stateListener");
	player.addControllerListener('ITEM', 'itemMonitor');
	
		
};
	
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
	currentState = obj.newstate; 
		
	if (currentState == "COMPLETED") {
		fstat('Medium fertig - ' + g_item, 'Video_DE');
	}
	
	if (currentState == "PLAYING") {//alert("playing");
	
	
	
	//alert("templink "+templink);
		if (templink != ""){//alert("popup");
		MeinFenster = window.open(templink, "extwin", "width=900,height=600,left=100,top=200,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
	  MeinFenster.focus();}
	  
	
		fstat('Medium gestartet - ' + g_item, 'Video_DE');
		/*
		$(".thickbox").filter(function(index) {
			return $(this).attr("href") == g_item.replace(/vwcontentbykey/gi, "CurrentBaseLink");
		}).click();
		*/
	}

}	

var tempplayer;
var temptitle;

function itemMonitor(obj) {
;
	temptitle = thisMovie(obj.id).getPlaylist();
	g_item = temptitle[obj.index].file;
	
	
	templink = temptitle[obj.index].link;	
	g_item_save = g_item;
	g_item = g_item.toLowerCase();
	if (g_item.indexOf(".jpg") > -1 || g_item.indexOf(".png") > -1 || g_item.indexOf(".gif") > -1)
	{thisMovie(obj.id).sendEvent('PLAY');}
	g_item = g_item_save;

//alert("der link "+templink);
	//alert("titel: "+temptitle[obj.index].file);
    //fstat("testname","testkategorie");
}




var lowquality = new Array(); 
var highquality = new Array();
var sVideo = new Array();
var playercount = -1;
var hasdiffres = 'none';


function sendEvent(swf,typ,prm) {
thisMovie(swf).sendEvent(typ,prm);
};

function thisMovie(swf) {
if(navigator.appName.indexOf("Microsoft") != -1) 
{return window[swf];} 
else 
{return document[swf];}
};



function writeplaylist(count){
//document.write("<div style='margin:5px 5px 5px 0px; background-color:#ffffff;border:1px solid #D8DFE9'><div style='padding:2px;background-color:#ffffff;' name='videocontainer"+count+"' id='videocontainer"+count+"'></div></div>");
document.write("<div style='background-color:#ffffff;border:0px solid #D8DFE9;margin-left:-10px;margin-top:-5px;margin-right:-10px;'><div style='padding:0px;background-color:#ffffff;' name='videocontainer"+count+"' id='videocontainer"+count+"'>"+g_flashtext+"</div><div id='videohelp"+count+"' class='videohelp' style='border-top: 1px solid #d10019; border-bottom: 1px solid #d10019;padding:5px;'>"+g_hinweistext+"</div></div>");

var so = new SWFObject('/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/player.swf','swfplayer'+count,'488','455','10');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('width','488');
so.addVariable('height','455');
so.addParam('wmode','opaque');
so.addVariable('javascriptid','swfplayer'+count);
so.addVariable('enablejs','true');
so.addParam('flashvars','&playerready=playerReadyCallback&file=/C12576C4003272F8/pgplaylist?openpage%26playlist='+sVideo[count]+'&screencolor=FFFBCE&skin=/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/verpoorten.zip&dock=false&controlbar.position=bottom&plugins=/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/flow.swf&flow.position=bottom&flow.titleoffset=0&flow.descriptionoffset=12&flow.coverheight=80&flow.size=150&flow.showtext=true&flow.color=000000&flow.coverangle=60&flow.covergap=80&flow.coveroffset=0&flow.coverdepth=200&flow.font=Arial');
so.write('videocontainer'+count);
}

function writeplaylistRezepte(count){
//document.write("<div style='margin:5px 5px 5px 0px; background-color:#ffffff;border:1px solid #D8DFE9'><div style='padding:2px;background-color:#ffffff;' name='videocontainer"+count+"' id='videocontainer"+count+"'></div></div>");
//document.write("<div style='background-color:#ffffff;border:0px solid #D8DFE9;margin-left:-10px;margin-top:-5px;margin-right:-10px;'><div style='padding:0px;background-color:#ffffff;' name='videocontainer"+count+"' id='videocontainer"+count+"'>"+g_flashtext+"</div><div id='videohelp"+count+"' class='videohelp' style='border-top: 1px solid #d10019; border-bottom: 1px solid #d10019;padding:5px;margin-bottom: 10px;width:478px;'>"+g_hinweistext+"</div></div>");

$("#videocontainer"+count).after("<div id='videohelp"+count+"' class='videohelp' style='border-top: 1px solid #d10019; border-bottom: 1px solid #d10019;padding:5px;margin-bottom: 10px;width:478px;'>"+g_hinweistext+"</div>");

var so = new SWFObject('/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/player.swf','swfplayer'+count,'488','455','10');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('width','488');
so.addVariable('height','455');
so.addParam('wmode','opaque');
so.addVariable('javascriptid','swfplayer'+count);
so.addVariable('enablejs','true');
so.addParam('flashvars','&playerready=playerReadyCallback&file='+sVideo[count]+'&screencolor=FFFBCE&skin=/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/verpoorten.zip&dock=false&controlbar.position=bottom&plugins=/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/flow.swf&flow.position=bottom&flow.titleoffset=0&flow.descriptionoffset=12&flow.coverheight=80&flow.size=150&flow.showtext=true&flow.color=000000&flow.coverangle=60&flow.covergap=80&flow.coveroffset=0&flow.coverdepth=200&flow.font=Arial');
so.write('videocontainer'+count);
}


function playlow(count){thisMovie('swfplayer'+count).sendEvent('STOP');thisMovie('swfplayer'+count).sendEvent('ITEM',1);thisMovie('swfplayer'+count).sendEvent('playpause');} 
function playmed(count){thisMovie('swfplayer'+count).sendEvent('STOP');thisMovie('swfplayer'+count).sendEvent('ITEM',0);thisMovie('swfplayer'+count).sendEvent('playpause');} 
function playhigh(count){var itemcount = 1; if (lowquality[count] == 'on') itemcount = 2;thisMovie('swfplayer'+count).sendEvent('STOP');thisMovie('swfplayer'+count).sendEvent('ITEM',itemcount);thisMovie('swfplayer'+count).sendEvent('playpause');} 
function checklinks(count){hasdiffres = 'none';if (lowquality[count] == 'on') {lowlink='XL';hasdiffres='block';} else lowlink='';if (highquality[count] == 'on') {highlink='HD';hasdiffres='block';} else highlink='';if (highlink=='' && lowlink=='') medlink = ''; else medlink='XXL';}



function writevideo(count){
checklinks(count);
document.write("<div style='margin:5px 5px 5px 0px; background-color:#ffffff;border:1px solid #D8DFE9'><div style='padding:2px;background-color:#ffffff;' name='videocontainer"+count+"' id='videocontainer"+count+"'></div><div id='resdiv' style='display:"+hasdiffres+";'><table border=0 cellspacing=0 cellpadding=0 width=460><tr><td width=33%>&nbsp;&nbsp;&nbsp;<a href='javascript:playlow("+count+");'>"+lowlink+"</a></td><td width=33% align=center><a href='javascript:playmed("+count+");'>"+medlink+"</a></td><td width=33% align=right>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:playhigh("+count+");'>"+highlink+"</a>&nbsp;&nbsp;</td></tr></table></div></div>");
var so = new SWFObject('/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/player.swf','swfplayer'+count,'460','290','8');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('width','460');
so.addVariable('height','290');
so.addVariable('backcolor','0x000000');
so.addVariable('frontcolor','0xffffff');
so.addVariable('lightcolor','0x9B8E61');
so.addVariable('screencolor','FFD642');
so.addVariable('javascriptid','swfplayer'+count);
so.addVariable('enablejs','true');
so.addParam('wmode','opaque');
so.addParam('flashvars','&playerready=playerReadyCallback&file=/C12576C4003272F8/pgplaylist?openpage%26playlist='+sVideo[count]+'&skin=/C1256CEF0045FD9B/RepositoryFile/NewPlayer/$File/verpoorten.zip&dock=false&controlbar.position=bottom');
so.write('videocontainer'+count);}



