/**
 * Show a video player in a container with the given swfContainerId and load the
 * playlist for the video with the given id and groupId.
 */
function showVideoPlayer(swfContainerId, width, height, style, videoId, videoGroupId, registerPlayButton, autoPlay) {
	var swfObjectId = swfContainerId + '_swf';
	var fo = new SWFObject('/_swf/videoplayer/videoplayer.swf', swfObjectId,
			width + 'px', height + 'px', "8", "#FFFFFF");
	fo.addParam("quality", "high");
	fo.addParam("menu", "false");
	fo.addParam("allowFullScreen", "true");
	fo.addParam("allowScriptAccess","always");
	fo.addParam("pluginspage", "http://www.macromedia.com/go/getflashplayer");
	fo.addParam("flashVars", 'config_xml=' + escape(createVideoConfigXmlUri(style)) + '&amp;' +
			'playlist_xml=' + escape(createVideoPlaylistXmlUri(videoId, videoGroupId)) + '&amp;' +
			'registerPlayButton=' + (registerPlayButton ? 'true' : 'false')  + '&amp;' +
			'autoPlay=' + (autoPlay ? 'true' : 'false'));
	fo.addParam("align","left");
	fo.addParam("wmode", "transparent");
	fo.addParam("play", "true");
	fo.addParam("loop", "true");
	fo.addParam("devicefont", "false");
	fo.addParam("class", "video_player_swf");
	writeSWFObject(fo, swfContainerId, 8);
}

/**
 * Change the video in the video player that has been plac/data/video/playlistxml?videoId=besteidee_schenkhulp&groupId=besteideeed in the container with the
 * given swfContainerId. The playlist will be loaded for the video with the given id and
 * groupId.
 */
function changeVideo(swfContainerId, videoId, videoGroupId) {
	if (deconcept.SWFObjectUtil.getPlayerVersion().major >= 8) {
		var swfObjectId = swfContainerId + '_swf';
		document.getElementById(swfObjectId).loadPlaylist(
				createVideoPlaylistXmlUri(videoId, videoGroupId));
	}
}

/**
 * Create the URI to the playlist XML for the given video.
 */
function createVideoPlaylistXmlUri(videoId, videoGroupId) {
	var playlistXml = '/data/video/playlistxml';
	if (typeof videoId != 'undefined') {
		playlistXml = playlistXml + '?videoId=' + videoId;
		if (typeof videoGroupId != 'undefined') {
			playlistXml = playlistXml + '&groupId=' + videoGroupId;
		}
	}

	return playlistXml;
}

/**
 * Create the URI to the config XML for the videoplayer.
 */
function createVideoConfigXmlUri(style) {
	var configXml = '/data/video/configxml';
	if (typeof style != 'undefined') {
		configXml = configXml + '?styleId=' + style;
	}

	return configXml;
}


// call to sitestat when play button pressed
function registerPlayButton(videoId) {
       if (typeof videoId != 'undefined' && videoId != '') sitestatTellerFlash('video.'+videoId);
}        


