﻿/// <reference path="jquery-1.3.2.min-vsdoc.js">
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
    }
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
$(document).ready(function() {
    $('#topNavTr img.mainNavImg').each(function() {
        //alert($("#NavCate").val() + ":" +$(this).attr("alt"));
        if ($("#NavCate").val() == $(this).attr("alt")) {
            var src = $(this).attr("src");
            if (src.indexOf("_on.gif") == -1) {
                src = src.replace(".gif", "_on.gif");
                $(this).attr("IsOn", 1);
                $(this).attr("src", src);
            }
        }
    });
    $("#topNavTr img.mainNavImg").hover(
    function() {
        var src = $(this).attr("src");
        if (src.indexOf("_on.gif") == -1) {
            src = src.replace(".gif", "_on.gif");
            $(this).attr("IsOn", 0);
        }
        else {
            $(this).attr("IsOn", 1);
        }
        $(this).attr("src", src);

        var left = $(this).position().left;
        alt = $(this).attr('alt');
        var sub = $("#topSubNav div[title=" + alt + "]");
        var notsub = $("#topSubNav div[title!=" + alt + "]");
        notsub.hide();
        sub.show().css("left", sub.width() / -2 + left);
    }
    ,
     function() {
         if ($(this).attr("IsOn") != 1) {
             $(this).attr("src", $(this).attr('src').replace("_on", ""));
         }
     });
});

$(document).ready(function() {
    if ($("#play_list").size() > 0) {
        var showAuto = function() {
            n = n >= (count - 1) ? 0 : ++n;
            $("#play_text li").eq(n).trigger('click');
        };
        var t = n = 0, count = $("#play_list a").size();
        $(function() {
            for (var i = 0; i < count; i++) {
                $('#play_text ul').append($('<li>' + (i + 1) + '</li>'));
            }
            $('#play_text').css('margin-left',300-(count*35))
            $("#play_list a:not(:first-child)").hide();
            $("#play_text li:first-child").css({ 'color': '#fff', 'background': 'url(/images/red.gif) no-repeat center center', 'border': '0', 'font-weight': 'bold', 'font-size': '1.4em', 'line-height': '21px', 'height': '21px', 'width': '21px', 'margin': '0 6px' });
            //$("#play_text li:first-child").addClass("handon").removeClass("handoff");
            $("#play_text li").click(function() {
                var i = $(this).text() - 1;
                n = i;
                if (i >= count) return;
                $("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
                $(this).css({ 'color': '#fff', 'background': 'url(/images/red.gif) no-repeat center center', 'border': '0', 'font-weight': 'bold', 'font-size': '1.4em', 'line-height': '21px', 'height': '21px', 'width': '21px', 'margin': '0 6px' });
                $(this).siblings().css({ 'float': 'left', 'display': 'inline', 'color': 'red', 'text-align': 'center', 'line-height': '16px', 'width': '16px', 'height': '16px', 'font-family': 'Arial', 'font-size': '.9em', 'cursor': 'pointer', 'overflow': 'hidden', 'margin': '3px 6px', 'background': 'url(/images/white.gif) no-repeat center center' });
                //$(this).addClass("handon").removeClass("handoff");		
                //$(this).siblings().addClass("handoff").removeClass("handon");
            });
            t = setInterval(showAuto, 3000);
            $("#play").hover(function() { clearInterval(t) }, function() { t = setInterval(showAuto, 3000); });
        })


    }
});

$(function() {
    return;
    $("#aa").hover(function() {
        $('#img2').hide(); $('#img1').show();
        $('#img1').slideUp(100, function() { $('#img2').slideDown(100); })
    },
     function() {
         $('#img2').show(); $('#img1').hide();
         $('#img2').slideUp(100, function() { $('#img1').slideDown(100); });
     });

});

$(document).ready(function() {

    $("#his li").click(function() {
        $("#his li .his_item1").removeClass("his_item1").addClass("his_item");
        $(".his_item", this).addClass("his_item1").removeClass("his_item");
        $('div.hisListYear').hide(200);
        $("#his" + $(this).attr('year')).show(200);

        
    });
    $("#hisList div:last-child").show();
    $("#his li:last-child .his_item").addClass("his_item1").removeClass("his_item");
});

