
function getEmbeddedVideoObject(video_file, isAutostart) {
	var get_flash_url = "http://get.adobe.com/flashplayer";
	var get_flash_text = "Adobe Flash is required to view this video.";
	var video_width = "390";
	var video_height = "260";
	var preview_img = "preview.jpg";
	if (video_file == "")
		video_file = "media/video/ministry_intro_1.flv";
	else
		video_file = "media/video/" + video_file;
	var autostart;
	if (isAutostart) 
		autostart = "true";
	else
		autostart = "false";

	return "<object id=\"player\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" name=\"player\" width=\"" + video_width + "\" height=\"" + video_height + "\"> <param name=\"movie\" value=\"player.swf\" /> <param name=\"allowfullscreen\" value=\"true\" /> <param name=\"allowscriptaccess\" value=\"always\" /> <param name=\"flashvars\" value=\"file=" + video_file + "&image=" + preview_img + "&autostart=" + autostart + "\" /> <object type=\"application/x-shockwave-flash\" data=\"player.swf\" width=\"" + video_width + "\" height=\"" + video_height + "\"> <param name=\"movie\" value=\"player.swf\" /> <param name=\"allowfullscreen\" value=\"true\" /> <param name=\"allowscriptaccess\" value=\"always\" /> <param name=\"flashvars\" value=\"file=" + video_file + "&image=" + preview_img + "&autostart=" + autostart + "\" /> <p><a href=\"" + get_flash_url + "\">" + get_flash_text + "</a></p> </object> </object>";

}

function displayVideoDiv(my_select) {
	var video_file = my_select.options[my_select.selectedIndex].value;
	var video_div = document.getElementById("video_div");
	displayVideoSelected(video_file);
}

function displayVideoSelected(video_file) {
	video_div.innerHTML = getEmbeddedVideoObject(video_file, true);
}

/*==================================================*/
function displayVideoFromParam() {
  var vParam = "video";
    var regexS = "[\\?&]"+vParam+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return;
  var video_file = results[1];
  displayVideoSelected(video_file);
}