﻿//初始化菜单导航栏
function InitNav() {
    var LiArray = $("#pageNavBody li");
    var beFind = false;
    var url = (document.location.href + "").toLowerCase();
    LiArray.each(function() {
        var currLi = $(this);
        currLi.find("a").each(function() {
            var currAHref = $(this).attr("href").toLowerCase();
            if (url.indexOf(currAHref) > -1) {
                currLi.addClass("curr");
                beFind = true;
                return false;
            } else if (currAHref == "default.aspx") {
                var pathName = document.location.pathname.toLowerCase();
                if (pathName == "/" || pathName == "/website/") {
                    currLi.addClass("curr");
                    beFind = true;
                    return false;
                }
            }
        });
        if (beFind) return false;
    });

    LiArray.find("a.navFather").mouseover(function() {
                $(this).parent("li").addClass("hover");
            });

    LiArray.hover(
        function(){},
        function() {
            $(this).removeClass("hover");
        }
        );
}

////设置离开幕时间
//function SetTime() {
//    setTimeout("SetTime()", 1000);
//    var second = parseInt(document.getElementById("lbl_second").innerHTML);

//    if (!isNaN(second) && second < 60 && second > 1) {
//        second--;
//        document.getElementById("lbl_second").innerText = second;
//    } else {
//        var targetDate = new Date("07/28/2011 09:00:00"); //这个日期是可以修改的 
//        var today = new Date();
//        var second = Math.floor((targetDate.getTime() - today.getTime()) / 1000);
//        var msPerDay = 24 * 60 * 60;
//        var day_all = second / msPerDay;
//        var day = Math.floor(day_all);
//        var hour_all = (day_all - day) * 24;
//        var hour = Math.floor(hour_all);
//        var minute_all = (hour_all - hour) * 60;
//        var minute = Math.floor(minute_all);
//        var second_all = (minute_all - minute) * 60;
//        second = Math.floor(second_all);

//        document.getElementById("lbl_day").innerHTML = day;
//        document.getElementById("lbl_hour").innerHTML = hour;
//        document.getElementById("lbl_minute").innerHTML = minute;
//        document.getElementById("lbl_second").innerHTML = second;
//    }
//}


//设置离开幕时间
function SetTime() {
    var targetDate = new Date("07/28/2011 09:00:00"); //这个日期是可以修改的 
    var today = new Date();
    var second = Math.floor((targetDate.getTime() - today.getTime()) / 1000);
    var msPerDay = 24 * 60 * 60;
    var day_all = second / msPerDay;
    var day = Math.floor(day_all);

    var lblDay = document.getElementById("lbl_day");
    if (typeof (lblDay) != "undefinded" && lblDay) {
        lblDay.innerHTML = day;
    }
}

//初始化顶部大图
function InitImgsChange() {
    $("#div_imgsChange").ImgChange();
}

//初始化赞助商滚动
function InitSponsor() { 
    $("#div_sponsors").ScrollBox({
        containerExpr: "#div_sponsors",
        content1Expr: "#div_sponsors1",
        content2Expr: "#div_sponsors2",
        direction: "y",
        speed: 30,
        step: 1
    });
}


//初始化合作媒体滚动
function InitMedia() {
    $("#div_media").ScrollBox({
        containerExpr: "#div_media",
        content1Expr: "#div_media1",
        content2Expr: "#div_media2",
        direction: "y",
        speed: 30,
        step: 1
    });
}

//初始化广告专区滚动
function InitAD() {
    $("#div_ad").ScrollBox({
        containerExpr: "#div_ad",
        content1Expr: "#div_ad1",
        content2Expr: "#div_ad2",
        direction: "y",
        speed: 30,
        step: 1
    });
}

//初始化合作伙伴滚动
function InitHZHB() {
    $("#div_HZHB").ScrollBox({
        containerExpr: "#div_HZHB",
        content1Expr: "#div_HZHB1",
        content2Expr: "#div_HZHB2",
        direction: "y",
        speed: 30,
        step: 1
    });
}

function hideTextTip(sender, tipStr) {
    if (sender.value == tipStr) {
        sender.value = '';
        sender.style.color = '';
    }
}

function showTextTip(sender, tipStr, color) {
    if (sender.value == '') {
        sender.value = tipStr;
        sender.style.color = color;
    }
}

function Search(textTipStr) {
    if ($get("txtKeyword").value == "" || $get("txtKeyword").value == textTipStr) {
        alert("Please enter the keywords you want to query！");
        $get("txtKeyword").focus();
        return;
    }
    var searchType = "文章";
    window.open("Search.aspx?c=" + escape(searchType) + "&k=" + escape($get("txtKeyword").value) + "&p=1");
}
