var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

function showVideo(html, width, height, downloadLink) {
    
    if (downloadLink.length > 0) height -= 15;
    
	resizeVideoBox(width, height);
	centerVideoBox(width + 30, height + 30); // add 30px because the real width and height is 30px larger (counting the padding)
    
    if (IE6) $("#videoBox").addClass('videoBox-ie6');
    
	$("#videoBox").css("visibility", "visible");
    
    $("#videoBox").append('<a id="close-video-btn" href="javascript:void(0);" class="close" onClick="closeVideoScreen(); return false;"></a>');
	$("#videoBox").append(html);
	
	if (downloadLink.length > 0) {
	   $("#videoBox").append('\
        <div class="footer"> \
            <a href="'+downloadLink+'" class="download"> \
                <img src="images/download_video_button.gif" title="download" class="download_image" /> \
           </a> \
        </div>');
    }
    
	return false;
}

function hideVideo() {
	$("#videoBox").css("visibility", "hidden");
	$("#videoBox").html("");
}

function closeVideoScreen() {
	$("#main_flash")[0].closeVideoScreen(); // call the function in flash to remove and hide the video
}

function resizeVideoBox(width, height) {
	$("#videoBox").width(width + "px");
	$("#videoBox").height(height + "px");
}

function centerVideoBox(width, height) {
	$("#videoBox").css("margin-left", (-1 * width / 2) + "px");
	$("#videoBox").css("margin-top", (-1 * height / 2) + "px");    
}