var stopPage =
{
    show: function(subscription) {
        if ($("#backgroundOverlayTemp").length == 0) {
            var bgOverlay = $("#backgroundOverlay").clone(true);
            bgOverlay.width($("#container").width());
            bgOverlay.attr("id", "backgroundOverlayTemp");


            $("#container").prepend(bgOverlay);
            $("#container").prepend($("#stopPageOverlay"));

        }

        $("#backgroundOverlayTemp").height($(document).height()).show();
        scroll(0, 0);
        var subscriptionOverlay = this.GetSubscriptionOverlay(subscription);

        $("#stopPageOverlay").empty().html($(subscriptionOverlay).html());
        $("#stopPageOverlay").show();

        var allVisibleInputs = $("select:visible");
        var count = $(allVisibleInputs).length;
        $(allVisibleInputs).each(function() {
            $(this).attr("ThisWasVisible", "true");
            $(this).hide();
        });
        return false;
    }
    ,
    hide: function() {
        $("#backgroundOverlayTemp").hide();
        $("#stopPageOverlay").hide();
        $("embed,object").css("visibility", "visible");
        $("[ThisWasVisible=true]").show();
        return false;
    },
    GetSubscriptionOverlay: function(subscription) {
        if (subscription) {
            var subscriptions = subscription.split(',');
            for (var i = 0; i < subscriptions.length; i++) {
                if (subscriptions[i].match("(ABH_F|ABH_N)")) {
                    return "#stopPageOverlayABH";
                }
                if (subscriptions[i].match("(ASIC_F|ASIC_N)")) {
                    return "#stopPageOverlayASIC";
                }
                if (subscriptions[i].match("(ASH_F|ASH_N)")) {
                    return "#stopPageOverlayASH";
                }
            }
        }
        return "#stopPageOverlayABH";
    }
};
