/**
 * 
 * Utilizes Flash's External Interface API
 * to control SWF from the browser.
 * 
 */

var flashVideoPlayer;
var vidId = '';

/* Check whether the browser is IE. If so, flashVideoPlayer is
window.videoPlayer. Otherwise, it's document.videoPlayer. The
videoPlayer is the ID assigned to the <object> and <embed> tags. */
function initializeFlash() {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	flashVideoPlayer = (isIE) ? window['videoPlayer'] : document['videoPlayer'];
	vidId = gup('vidId');
	if (vidId == '0' || vidId == '1') {
		// allow some time for flash to load
		var t = setTimeout('launchVideoGroup(vidId,0)', 500);
	}
}

function launchVideoGroup( groupNum, clipNum ) {

	var videoOn = flashVideoPlayer.getVideoState();
	if (!videoOn) {
		flashVideoPlayer.showVideoPlayer(groupNum, clipNum);
	} else {
		flashVideoPlayer.parseLink(groupNum, clipNum);
	}
}

function gup( name ) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function hideElement( theElement ) {
	if(document.getElementById) {
		var el = document.getElementById(theElement);
		if(el) {
			el.style.visibility = "hidden";
		}
	}
}