var isolationobj = new Object();
$(function() {
	$("#tabs li a").click(function() {
		$("#tabs li").removeClass("active-tab");
		$(this).parent().addClass("active-tab");
		$(".tab").hide()
		$(this.hash).show();
        if (this.href.indexOf("#tab-source")!=-1) $("#codeview").get(0).focus();
		return false;
	});
	$(".tab").hide()
	$($(".active-tab a")[0].hash).show();
	$("#button-run").click(function() {
		$(".run-target-tab a").click();
		$("#button-run").attr('disabled', 'disabled');
        $("#isolation").bind("load", function(event) {
            $(this).unbind(event);
            $("#status").html("Running...");
            isolationobj.run($("#codeview").get(0).value);
    		$("#button-run").attr('disabled', null);
			$("#status").html("Ready.");
        }).get(0).src = "iframe.html";
	});
    $("#codeview").get(0).focus();
    $("#status").html("Ready.");
});

