/* 
 * @copyright 	R. Platenkamp
 * @date		090401
 * @version		090401.02.v2
 */

var playItem = 0;
var playlistLength = 0;
function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else {
		return document[movieName];
	}
};

function sendEvent(typ, prm) {
	thisMovie('mpl').sendEvent(typ, prm);
};

function checkTime(i) {
	if (i<10)
  		i="0" + i;
	return i;
}

function getUpdate(typ,pr1,pr2,mpl) { 
	
	playlistLength = thisMovie('mpl').getLength();
	
	if( typ == 'time' && playItem == 0 ) {
		
		var thisDate = new Date();
		thisDate.setHours(0);
		thisDate.setMinutes(0);
		thisDate.setSeconds(seconds+pr1-5);
		
		document.getElementById('id_time').value = checkTime(thisDate.getHours()) +":"+checkTime(thisDate.getMinutes()) +":"+ checkTime(thisDate.getSeconds());
		
	}
	
	if( typ == 'item' && pr1 == 1)
		playItem=1;
	
	if( typ == 'time' && pr1 == 4 && playItem == 1 ) {
		playItem = 0;
		sendEvent('playitem', 0);
		sendEvent('stop');
  	}
  	
};

function createPlayer(flvfile) {
	var params = {allowfullscreen : 'true' };
	var vars = {
		start : '0',
		displayheight : '184',
		file : siteurl+'content/' + flvfile,
		overstretch : 'false',
		showdigits : 'false',
		autostart : 'false',
		shuffle : 'false',
		repeat : 'list',
		autorewind : 'true',
		image : siteurl+'images/img_start2.jpg',
		smoothing : 'true',
		icons : 'false',
		enablejs : 'true',
		javascriptid : 'mpl',
		linkfromdisplay : 'true',
		linktarget : '_self',
		backcolor : '0xffffff',
		frontcolor : '0x404040',
		lightcolor : '0x808080',
		screencolor : '0x000000' }
	
	swfobject.embedSWF(siteurl+'js/player.swf', 'player', '294', '184', '7', '', vars, params);
};
