/* 
 * @copyright 	R. Platenkamp
 * @date		080306
 * @version		080306.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');
  	}
  	
};



// 852x480

function createPlayer(flvfile) {
	var s1 = new SWFObject(siteurl+'downloads/mediaplayer.swf', 'mpl', '440', '260', '7');
	s1.addParam('allowfullscreen',     'true');
	s1.addVariable('start',            '240');
	s1.addVariable('displayheight',    '240');
	s1.addVariable('file',             siteurl+'downloads/'+flvfile);
	s1.addVariable('overstretch',      'false');
	s1.addVariable('showdigits',       'false');
	s1.addVariable('autostart',        'true');
	s1.addVariable('shuffle',          'false');
	s1.addVariable('repeat',           'list');
	s1.addVariable('autorewind',        'true');
	s1.addVariable('showicons',        'false');
	s1.addVariable('enablejs',         'true');
	s1.addVariable('javascriptid',     'mpl');
	s1.addVariable('linkfromdisplay',  'true');
	s1.addVariable('linktarget',       '_self');
	s1.addVariable('backcolor',        '0xffffff');
	s1.addVariable('frontcolor',       '0x404040');
	s1.addVariable('lightcolor',       '0x808080');
	s1.addVariable('screencolor',      '0x000000');
	s1.write('player');
};
