﻿var originalWidth = [];
var cancelExpand = [];

jQuery(document).ready(function () {
    // Destroys page in Firefox when leaving so that -Back- works properly.
    window.onunload = function () { };

    jQuery("input[type=button]").button();
    jQuery("input[type=submit]").button();

    jQuery("a").click(function (e) {
        if (e.which && e.which == 1) {
            if (!jQuery(this).hasClass("no-redirect") && jQuery(this).attr("href") != "#" && jQuery(this).attr("target") != "_blank") {
                fadeOutPage();
                showWorking();
            }
        }
    });

    fadeInPage();
    setSidebarHeight();
});

jQuery(window).load(function () {
});

function setSidebarHeight() {
    var centerHeight = jQuery("div#page-content div.center").height();
    jQuery("div#page-content div.left").height(centerHeight);
    jQuery("div#page-content div.right").height(centerHeight);
}


function startSidebarTimer() {
    setTimeout(startSidebarTimer, 500);
    setSidebarHeight();
}

function fadeOutPage() {
    jQuery("div#page-wrapper").fadeOut(300);
}

function fadeInPage() {
    jQuery("div#page-wrapper").fadeIn(600);
}

function showWorking() {
    jQuery("#progressBackgroundFilter").show();
    jQuery("#processMessage").show();
}

function hideWorking() {
    jQuery("#progressBackgroundFilter").hide();
    jQuery("#processMessage").hide();
}

function modal(message, title) {
    jQuery("div#dialog-modal p").html(message);
    jQuery("div#dialog-modal").attr("title", title);
    jQuery("div#dialog-modal").dialog({ modal: true, title: title, show: "fadeIn", hide: "fadeOut" });
}

