﻿var helpFlag = false;

function scrollInfo() {
    $(".scrollText ul").fadeOut("fast");
    $(".scrollText ul").fadeIn("fast");
    $(".scrollText ul").append($(".scrollText ul li:first"));
}

function setTabsItem(objId) {
    $("#" + objId + " .tabTitle a").bind("mouseover",function() {
        $("#" + objId + " div").removeClass("c");
        $($(this).attr("href")).addClass("c");
        $("#" + objId + " .tabTitle li").removeClass("c");
        $(this).parent().addClass("c");
        $(this).blur();
        return false;
    });
}

function showHelp() {
    //window.alert(helpFlag);
    if (helpFlag) {
        $("#helpCenter div").removeClass("hide");
        helpFlag = false;
    } else {
        $("#helpCenter div").addClass("hide");
        helpFlag = true;
    }
}

function showChild(obj) {
    //window.alert($(obj).html());
    if ($(obj).parent().hasClass("c")) {
        $(obj).parent().removeClass("c");

    } else {
        $(obj).parent().addClass("c");
    }

}

//出登录框
function showLogin() {
    if ($("#loginForm").length > 0) {
        $("#loginForm").show();
        $.blockUI({ message: $('#loginForm'),
            css: {
                border: '0px',
                padding: '0px',
                width: '400px',
                top: ($(window).height() - 200) / 2 + 'px',
                left: ($(window).width() - 400) / 2 + 'px'
            }
        });

    } else {
        //页面没有登录部分的html
    }
}
function clearUI() {
    $.unblockUI({
        onUnblock: function() { $("#loginForm").css("display", "none"); }
    });
}
//检测用户登录
function chkUserLogin() {
    var tUser, tPwd;
    tUser = $("#txtUsername").val();
    if (tUser == "") {
        $("#errLogin").html("请填写用户名");
        return false;
    }
    setTimeout(function() {
        $.unblockUI({
            onUnblock: function() { $("#loginForm").css("display", "none"); }
        });
    }, 1000);

    return false;
}

function showMoreMenu() {
    $("#moreMenuDiv").show();
}
$(document).ready(function() {
    //滚动公告
    showinfo = setInterval("scrollInfo()", 4000);
    //Tab
    if ($("#topNewsTab").length > 0) {
        setTabsItem("topNewsTab");
    }
    if ($("#col2Tabs").length > 0) {
        setTabsItem("col2Tabs");
    }
    if ($("#col2Tabs2").length > 0) {
        setTabsItem("col2Tabs2");
    }
    if ($("#col3Tabs1").length > 0) {
        setTabsItem("col3Tabs1");
    }
    if ($("#col3Tabs2").length > 0) {
        setTabsItem("col3Tabs2");
    }
    if ($("#col3Tabs3").length > 0) {
        setTabsItem("col3Tabs3");
    }

    if ($("#col4Tabs").length > 0) {
        setTabsItem("col4Tabs");
    }

    if ($("#col5Tabs").length > 0) {
        setTabsItem("col5Tabs");
    }
    
    if ($("#companyList").length > 0) {
        setTabsItem("companyList");
    }
    if ($("#proCenTabs").length > 0) {
        setTabsItem("proCenTabs");
    }

    //圆角修复
    $(".reBox").append("<span class=\"t1\"></span><span class=\"t2\"></span><span class=\"t3\"></span><span class=\"t4\"></span>");
    //帮助隐藏
    if ($("#helpCenter").length > 0) {
        $("#helpCenter").hover(function() { $("#helpControl").show() }, function() { $("#helpControl").hide() });
        $("#helpCenter").css("top", $(window).height() / 2);
    }
    //更多导航链接
    if ($("#moreMenuDiv").length > 0) {
        $("#topNav li:last-child").hover(function() {
            $("#moreMenuDiv").show();
        }, function() {
            $("#moreMenuDiv").hide();
        });
    }

});

$(window).scroll(function() {
    $("#helpCenter").css("top", $(document).scrollTop() + ($(window).height() / 2) - 30);
});
$(document).click(function() {

});


