// by Pan W.F. build 20100724
$(function() {
    $("#Navigation ul li  div span.bg").css("opacity", 0.5);
    $("#Navigation>ul>li").hover(function() {
        $(this).siblings().children("a").addClass("out");
        $(">div", this).slideDown().hover(function() {
            $(this).parent().children("a").addClass("hover");
            $(this).parent().siblings().children("a").addClass("out");
        });
        if ($.browser.msie && $.browser.version == "6.0") {
            var h = ($(this).find("ul").children("li").length + 2) * 24;
            $(">div .bg", this).height(h)
        }
    }, function() {
        $(">div", this).slideUp();
        $(">a", this).removeClass("hover")
        $(this).siblings().children("a").removeClass("out");
    })

    var inputText = $("#Search input[type=text]").val();
    $("#Search input[type=text]").focus(function() {
        var t = $(this).val();
        if (t == inputText) {
            $(this).val("").css("color", "#666");
        }
    }).blur(function() {
        var t = $(this).val();
        if (t == "") {
            $(this).val(inputText).css("color", "#b7b7b7");
        }
    })

    var inputText2 = $("#Search2 input[type=text]").val();
    $("#Search2 input[type=text]").focus(function() {
        var t = $(this).val();
        if (t == inputText2) {
            $(this).val("").css("color", "#666");
        }
    }).blur(function() {
        var t = $(this).val();
        if (t == "") {
            $(this).val(inputText2).css("color", "#b7b7b7");
        }
    })

    var RHeight;
    $("#Right").height($("#Content").height() + 130);
    if ($("#Left").height() < $("#Content").height() + 110) {
        $("#Left").height($("#Content").height() + 110);
        RHeight = $("#Right").height();
    } else {
        $("#Content .txt").height($("#Left").height() - 25);
        $(".wrapper").height($("#Left").height() + 318);
        RHeight = $("#Left").height() + 95;
    }

    //	$(window).scroll(function(){
    //		if (document.documentElement.scrollTop > 0 || document.body.scrollTop > 0 ){
    //			$("#BackTop").css("margin-top",RHeight-16).fadeIn();
    //		}else{
    //			$("#BackTop").fadeOut();
    //		}
    //	});

    $("#HRList dt").click(function() {
    $(this).next("dd").slideDown(function() { heightAuto() }).siblings("dd").slideUp();
    })
})

function heightAuto() {
    var tH = $("#Content .txt").height();
    $("#Right").height(tH + 240);
    $("#Left").height(tH + 145);
    RHeight = $("#Right").height();

//    function backTopPosition() {
//        if (document.documentElement.scrollTop > 0 || document.body.scrollTop > 0) {
//            $("#BackTop").css("margin-top", RHeight - 16).fadeIn();
//        } else {
//            $("#BackTop").fadeOut();
//        }
//    }
//    backTopPosition();

//    $(window).scroll(function() {
//        backTopPosition();
//    });
}
