// custom js for deucalion gui
$("#instructions_button").click(function() { $("#actual_unity_container").fadeOut(250, function() { if ($("#instructions").is(":hidden")) { if (!$("#metadata").is(":hidden")) { $("#metadata").fadeOut(250); } $("#instructions").fadeIn(250); } else $("#instructions").fadeOut(250); }); });
$("#metadata_button").click(function() { $("#actual_unity_container").fadeOut(250, function() { if ($("#metadata").is(":hidden")) { if (!$("#instructions").is(":hidden")) $("#instructions").fadeOut(250); $("#metadata").fadeIn(250); } else $("#metadata").fadeOut(250); }); });
$("#instructions_button").mouseover(function() { $("#instructions_tooltip").show(); }); $("#instructions_button").mouseout(function() { $("#instructions_tooltip").hide(); });
$("#metadata_button").mouseover(function() { $("#metadata_tooltip").show(); }); $("#metadata_button").mouseout(function() { $("#metadata_tooltip").hide(); });
$("#instructions .close_button").click(function() { $("#instructions").fadeOut(250, function() { $("#actual_unity_container").fadeIn(250); }); });
$("#metadata .close_button").click(function() { $("#metadata").fadeOut(250, function() { $("#actual_unity_container").fadeIn(250); }); });
$("#metadata, #instructions").hide();
function customAlert(message){ var theMessage = message.split('<br/>').join('\n'); $("#customAlertMessage").html(message + "<br/><div class='grayButton right' onclick='$(\"#customAlert\").css({\"visibility\":\"hidden\", \"height\": 0 }); return true;'>OK</div><br/>"); $("#customAlert").css({"visibility":"visible", "height":($(document).height() - $("#customAlertContent").height()) + "px" }); }

var config = { width:960, height:660, params:{ enableDebugging:"0" } };
var u = new UnityObject2(config);

$(function() {
	var $missingScreen = jQuery("#unityPlayer").find(".missing");
	var $brokenScreen = jQuery("#unityPlayer").find(".broken");
	$missingScreen.hide();
	$brokenScreen.hide();

	u.observeProgress(function (progress) {
		switch(progress.pluginStatus) {
			case "broken":
				$brokenScreen.find("a").click(function (e) {
					e.stopPropagation();
					e.preventDefault();
					u.installPlugin();
					return false;
				});
				$brokenScreen.show();
			break;
			case "missing":
				$missingScreen.find("a").click(function (e) {
					e.stopPropagation();
					e.preventDefault();
					u.installPlugin();
					return false;
				});
				$missingScreen.show();
			break;
			case "installed":
				$missingScreen.remove();
			break;
			case "first":
			break;
		}
	});
	u.initPlugin($("#unityPlayer")[0], "unity/" + unity_object_name);
});