﻿
$(function () {
    if ($("#map_frame"))
        $("#map_frame").height(420);
    if ($("#currentTemplate").length == 0) {
        $(".maincontent dt").hide();

        $(".sidebar_hide").remove();
        $(".edit_title").remove();
        $(".edit_content").remove();
        $(".temp_item .edit").remove();
        if ($("#template_select").attr("href") && $("#template_select").attr("href").indexOf("template.1column.css") == -1)
            $(".sortable").show();

        $(".banner").click(function () {
            window.open("/register", "_self");
        });
        //clearIntervalId = setInterval(clearAbsolute, 200);
    } else {
        if ($("#template_select").attr("href") && $("#template_select").attr("href").indexOf("template.1column.css") > -1)
            $(".sortable").hide();
        else
            $(".sortable").show();
        //clearIntervalId = setInterval(clearAbsolute, 200);
    }

    if (
    !window.location.href.match(/\/$/) &&
    ($("#template_select").attr("href").indexOf("/theme/theme") > -1 || window.location.href.indexOf("template0") > -1) &&
    $("#template_select").attr("href").indexOf("/theme/theme5.css") == -1
    ) {
        $("#logo_bar").hide();

        $(".main_content").css({
            float: "none",
            width: "auto"
        });
    }
    if ($("#template_select").attr("href").indexOf("1column_right") > -1) {
        $(".widgets").hide();
    }
    if (window.location.href.indexOf('agilechina') > 0) {
        $("#column_register a").text("报名注册");
        $("#column_register").show();
    }

    if (window.location.href.indexOf('getTicketInfo') > 0) {
        $(".pay_type :radio").eq(0).attr("checked", true);
    }

});

function clearAbsolute() {
    if ($("#currentTemplate").length != 0)
        $(".sortable").sortable("refresh");
    var height = $(".logo_bar").height();
    if ($(".widgets").height() > height) height = $(".widgets").height();
    if ($(".mova_content .content").height() > height) height = $(".mova_content .content").height();
    if ($(".sider").css("position") == "absolute" && $(".widgets").height() + $(".logo_bar").height() > height)
        height = $(".widgets").height() + $(".logo_bar").height();
    $(".mova_content").height(height + 48);
}

function displaySubMenu(li) {
    var subMenu = li.getElementsByTagName("ul")[0];
    subMenu.style.display = "block";
}
function hideSubMenu(li) {
    var subMenu = li.getElementsByTagName("ul")[0];
    subMenu.style.display = "none";
}
