var site_id;
var scene_id;
var thumbs;

	function showTrailerHover(value)
	{
		var element = document.getElementById('trailer_hover');
		element.style.visibility = value;

	}

	function showScene(in_scene_id, in_thumbs, width, height)
	{

		scene_id = in_scene_id;
		thumbs = in_thumbs;

		if (typeof(height) == "undefined") {
			height=510;
			if (thumbs == true){
				height=590;
			}
		} else if (thumbs == true) {
			height = parseInt(height) + 119;
		}

		$("#previews_remaining").html("Loading...");
		$("blockUI").hide();

		if(typeof showRelatedScenes == 'function') {
			showRelatedScenes();
		}

		//var url = "?action=inc_trailer_views&guimode=ajax&scene_id="+in_scene_id;
		var url = "?action=inc_trailer_views&guimode=ajax&scene_id="+in_scene_id+'&width='+width+'&height='+height;
		$.getScript(url);

	}

	function flashUnlockAsk() {
		from_flash=true;
		unlockPopup();
	}

	function flashUnlock() {
	    from_flash=true;
	    unlockPopup();
	}

	function flashStop() {
	    if(typeof flashStopFunctionToRun != 'function') {
    		loadTrailerContent();
		}
		else
		{
			flashStopFunctionToRun();
		}
	}

	function pageUnlockAsk() {
	    from_flash=false;
	    unlockPopup();
	}

	function unlockPopup() {
	    $.facebox($('#unlockscene').html());
	    $.facebox.settings.opacity = 0.6;
	    $('#facebox').css('z-index', 102);
	}

    function BugReportPopup() {
        $.facebox($('#report_problem').html());
        $.facebox.settings.opacity = 0.6;
        $('#facebox').css('z-index', 102);
    }


    function closeFacebox() {

        loadTrailerContent();
    	$(document).trigger('close.facebox');

    }
