﻿
function ShowVideo(url, width, height) {

	$(window).resize(function() {
		positionVideo(width, height);
	});

	$(window).scroll(function() {
		positionVideo(width, height);
	});

	positionVideo(width, height);

	var $doc = $(document);
	

    $("#divTransbox").css("visibility", "visible")
		.css("opacity", "0.75")
		.css("filter", "alpha(opacity=75)")
		.height( $doc.height() );

    $("#divVid").html('<object width="' + width + '" height="' + height + '"><param id="paramMovie" name="movie" value="' + url + '" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed src="' + url + '" id="embed" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="90%" /></object><br/><br/><center><table><tr><td class="searchborder"><a href="javascript:void(0)" onclick="CloseVideo();"><div id="searchButton"><span class="viewdemolink">Close</span></div></a></td></tr></table></center><br/>').css("visibility", "visible");
}

function CloseVideo() {
	$("#divVid").html('').css("visibility", "hidden");
    
    $("#divTransbox").css("visibility", "hidden");
   }

function positionVideo(width,height) {
	$("#divVid").css("left", $(window).width() / 2 - width / 2)
		.css("top", $(window).height() / 2 - ((height + 40) / 2) + $(window).scrollTop())
		.css("width", width + "px")
		.css("height", (height + 40) + "px");
}
