var videoContainer;
function playInLightbox(isAudio, videoId, portalId, title, width, height)
{
	var movie = "";
	if (isAudio)
		movie = "mp3";
	else
		movie = "uvg";

	var name = window.navigator.appName; 
	var ver   = window.navigator.appVersion; 
	if(name == "Microsoft Internet Explorer") 
	{ 
		var n = parseInt(ver.substr(ver.indexOf("MSIE")+5, 3)); 
		if(n==6) 
		{ 
			tb_show(title.replace("[SQM]","'"), uvgPath + "Swf.aspx?ItemId=" + videoId + "&portalId=" + portalId + "&movie=" + movie + "&height=" + height + "&width=" + width + "&?TB_iframe=true&height=" + (height - 17) + "&width=" + (width-5) + "", null);
			return;
		} 
	} 

	ensureVideoContainer();

	var swf = uvgPath + movie + ".swf?vId=" + videoId + "&portalId=" + portalId + "&baseUrl=" + uvgPath;
	var code = "<object allowFullScreen='True' allowScriptAccess='always' allowNetworking='all' width='" + width + "' height='" + height + "'><param name='movie' value='" + swf + "' /><param name='allowFullScreen' value='true' /><embed src='" + swf + "' type='application/x-shockwave-flash' allowFullScreen='True' allowScriptAccess='always' allowNetworking='all' width='" + width + "' height='" + height + "'></embed></object>";
	videoContainer.innerHTML = code;
	tb_show(title.replace("[SQM]","'"), "#TB_inline?height=" + height + "&width=" + width + "&inlineId=" + videoContainer.id, null);
}

function playInLightbox2(title, code)
{
	ensureVideoContainer();

	code = code.replace(/\[SQM\]/g,"'");
	videoContainer.innerHTML = code;

	var width = jQuery(videoContainer).width();
	var height = jQuery(videoContainer).height();

	tb_show(title.replace("[SQM]","'"), "#TB_inline?height=" + height + "&width=" + width + "&inlineId=" + videoContainer.id, null);
}

function playInLightbox_EX(title, code, width, height)
{
	ensureVideoContainer();
	videoContainer.innerHTML = code;
	tb_show(title, "#TB_inline?height=" + height + "&width=" + width + "&inlineId=" + videoContainer.id, null);
}

function ensureVideoContainer()
{
	if (!videoContainer)
	{
		videoContainer = document.createElement("div");
		videoContainer.style.display = "none";
		videoContainer.id = "videoContainer";
		document.body.appendChild(videoContainer);
	}
}

var j$ = jQuery.noConflict();

