function embedPlayer(tag, resPath, type, zilla, url, width, height, autoHide, autoStart, repeat, previewImg, backColor, frontColor, lightColor) {
	var div = document.getElementById(tag);
	if (swfobject.hasFlashPlayerVersion('8.0.0') == false) {
		if (div != null)
			div.innerHTML += '<br /><br />This content requires the Adobe Flash Player. <a href="http://www.adobe.com/go/getflash/" target="_blank">Get Flash</a>';
			return;
	}

	/*
	tag:				id of div tag to replace
	resPath			location of include folder containing player.swf
	type:				1=Flash, 2=MP3, 3=MPEG, 4=M4V
	url:				path to media file
	autoHide:		0 or 1, hides control bar when mouse not over player
	autoStart:		0 or 1, plays immediately when loaded
	repeat:			0 or 1, repeats playback continuously
	previewImg:	url to image file displayed when not playing
	*/

	//defaults
	if (type == null)	type = 0;
	if (resPath == null) resPath = '';
	if (zilla == null) zilla = 0;
	if (url == null) url = '';
	if (width == null) width = 320;
	if (height == null) height = 240;
	if (autoHide == null) autoHide = 0;
	if (autoStart == null) autoStart = 0;
	if (repeat == null) repeat = 0;
	if (previewImg == null) previewImg = '';
	if (backColor == null) backColor = '000000';
	if (frontColor == null) frontColor = 'EEEEEE';
	if (lightColor == null) lightColor = '999999';

	//checks
	url = escape(url);
	if (height < 20) {
		autoHide = 0;
		height = 20;
	}
	var playerHeight = height;
	if (autoHide == 0 && height > 20)
		playerHeight = height + 20;

	//variables
	var flashvars = {};
	var params = {};
	var attributes = {};
	params.allowfullscreen = true;
	params.allowscriptaccess = 'always';
	flashvars.width = width;
	flashvars.height = playerHeight;
	if (autoHide == 1)
		flashvars.displayheight = height;
	flashvars.searchbar = false;
	flashvars.autostart = (autoStart == 1);
	flashvars.repeat = (repeat == 1);
	flashvars.backcolor = '0x' + backColor;
	flashvars.frontcolor = '0x' + frontColor;
	flashvars.lightcolor = '0x' + lightColor;
	flashvars.image = previewImg;
	flashvars.overstretch = 'fit';
	flashvars.smoothing = true;

	//resources
	var zacc = 'ricnor';
	var flvinstall = resPath + 'include/swfobject/expressInstall.swf';
	var flvplayer = resPath + 'include/mediaPlayer/player.swf';
	var flvscript = 'http://st1.streamzilla.jet-stream.nl/'+zacc+'/StroboScope4.php';
	var rtmpstream = 'rtmp://fl1.streamzilla.jet-stream.nl:80/VOD';
	var mediasrv = 'http://dl1.streamzilla.jet-stream.nl/'+zacc+'/';

	//type selection
	if (zilla) {
		switch(type) {
			case 1:
				//flash stream
				if (navigator.userAgent.indexOf('Firefox') != -1) {
					//firefox bug with http streaming, switch to rtmp
					flashvars.file = rtmpstream;
					flashvars.id = zacc + '/' + url.replace('.flv', '');
				}
				else {
					flashvars.file = url;
					flashvars.streamscript = flvscript;
				}
				break;
			case 2:
				//MP3 etc
				flashvars.file = mediasrv + url;
				flashvars.link = mediasrv + url;
				flashvars.showdownload = true;
				break;
			case 4:
				//iPod M4V
				flashvars.file = mediasrv + url;
				flashvars.link = mediasrv + url;
				flashvars.showdownload = true;
				break;
			default:
				flashvars.file = mediasrv + url;
				break;
		}
	}
	else {
		flashvars.file = url;
	}

	swfobject.embedSWF(flvplayer, tag, width, playerHeight, '8.0.0', flvinstall, flashvars, params, attributes);
}

function previewMediaWindow(previewFile, type, zilla, url, width, height) {
	var win = window.open(previewFile + '?type=' + type + '&zilla=' + zilla + '&url=' + url + '&width=' + width + '&height=' + height, 'mediaPreview', 'width=100,height=50,scrollbars=0,status=1');
	win.focus();
}