

$(document).ready(function () {

    if ($(window).width() > 1080) {
        $("#top").css("margin", "0 40px");
        $("#footer .bottom").css("margin", "0 40px");
        $("#flash_contests").css("margin", "0 40px");
    }
    $(window).bind("resize", function () {
        if ($(window).width() > 1080) {
            $("#top").css("margin", "0 40px");
            $("#footer .bottom").css("margin", "0 40px");
            $("#flash_contests").css("margin", "0 40px");
        }
        else {
            $("#top").css("margin", "0");
            $("#footer .bottom").css("margin", "0");
            $("#flash_contests").css("margin", "0");
        }
    });

    $("a[rel=dialog]").live("click", function (e) {
        $link = $(this);
        $alertbox = $(document.createElement("div"));
        $alertbox.attr("id", "alertbox").appendTo($("body"));
        $alertbox.attr("title", $(this).attr("title")).load(this.href, function () {
            $(this).dialog({
                width: 430,
                position: "center",
                closeOnEscape: false,
                modal: true,
                draggable: false,
                resizable: false,
                close: function () {
                    if ($link.hasClass("submit")) document.location.href = document.location;
                    $("#alertbox").dialog("destroy").remove();
                }
            });
        });
        return false;
    });

    $("a[rel^='lightbox']").prettyPhoto({
        theme: "facebook",
        opacity: 0.3
    });

    $("input.toggle").live("focus", function () {
        if ($(this).attr("initial") == $(this).val()) {
            $(this).val("");
        }
    });
    $("input.toggle").live("blur", function () {
        if ($(this).val() == "") {
            $(this).val($(this).attr("initial"));
        }
    });

});


