function showOverlay() {
	if (arguments.length == 0) return;
	contents = arguments[0];
	if (arguments.length > 0) width = arguments[1];
	if (arguments.length > 1) height = arguments[2];
	
	if (document.getElementById('overlay') == null) {
		var transBG = document.createElement("div");
		var dialog = document.createElement("div");	
	} else {
		var transBG = document.getElementById('overlay');
		var dialog = document.getElementById('dialog');	
	}
	
	transBG.id = "overlay";
	document.body.appendChild(transBG);
	dialog.id = "dialog";
	dialog.innerHTML = contents;
	document.body.appendChild(dialog);
	if (typeof(height) != 'undefined') {
		dialog.style.height = height + 'px';
	} else {
		dialog.style.height = 'auto';
	}
	if (typeof(width) != 'undefined') {
		dialog.style.width = width + 'px';
		dialog.style.marginLeft = ((width/2)*-1) + 'px';;		// move relative to center point negative half the width
	}
	transBG.onclick = function()
	{
		removeOverlay();
	};
	return;
}

var refresh_on_remove = false;
function removeOverlay() {
	if (arguments.length > 0) refresh_on_remove = arguments[0];
	var transBG = document.getElementById('overlay');
	var dialog = document.getElementById('dialog');
	try {
		transBG.parentNode.removeChild(transBG);
		dialog.parentNode.removeChild(dialog);
	} catch(e) {
		// do nothing
	}
	if (refresh_on_remove) location.reload(true);
	return;
}

function playThrillerVideo() {
	html = '<embed src="http://services.brightcove.com/services/viewer/federated_f8/416542555" bgcolor="#FFFFFF" flashVars="videoId=1417354856&playerId=416542555&viewerSecureGatewayURL=https://console.brightcove.com/services/amfgateway&servicesURL=http://services.brightcove.com/services&cdnURL=http://admin.brightcove.com&domain=embed&autoStart=false&" base="http://admin.brightcove.com" name="flashObj" width="510" height="550" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><\/embed>';
	showOverlay(html);
	return;
}

function popUpVideo(URL) {
	window.open(URL, 'videoPlayer', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=988,height=610,left = 50,top = 50');
	return false;
}

function popUpAudio(URL) {
  window.open(URL, 'audioPlayer', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=850,height=430,left = 50,top = 50');
  return false;
}