﻿
(function($) {
    $.fn.hoverDelay = function(options) {
        var defaults = {
            hoverDuring: 0,
            outDuring: 1000,
            hoverEvent: function() {
                $.noop();
            },
            outEvent: function() {
                $.noop();
            }
        };
        var sets = $.extend(defaults, options || {});
        var hoverTimer, outTimer, that = this;
        $(this).hover(function() {


            clearTimeout(outTimer);
            $(this).css({ 'background': '#18A9FF' });

            hoverTimer = setTimeout(function() { sets.hoverEvent.apply(that) }, sets.hoverDuring);

        }, function() {
            clearTimeout(hoverTimer);
            $(this).css({ 'background': 'none' });

            outTimer = setTimeout(function() { sets.outEvent.apply(that) }, sets.outDuring);

        });
    }
})(jQuery);


$(document).ready(function() {


    ///原来没有延迟的方法
    //
    $("ul#topnav li").hover(function() { //Hover over event on list item
        $(this).css({ 'background': '#18A9FF' }); //Add background color + image on hovered list item
        hideSpan();
        mouseOverEvent();
        $(this).find("span").show(); //Show the subnav
    }, function() { //on hover out...
        $(this).css({ 'background': 'none' }); //Ditch the background
        //$(this).find("span").hide(); //Hide the subnav
        var span = $(this).find("span");

        mouseOutEvent(span[0]);

    });
    //
    //原来没有延迟的方法

    $('.logobar').cycle({
        fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    });

});
function hideSpan() {
    $("ul#topnav li").each(function() {
        $(this).find("span").hide();
    });


}
var flyoutTimer;
function mouseOutEvent(span) {
    //Hide flyout after 1 second when the mouse move out of the flyout zone
    flyoutTimer = setTimeout(function() {
        hideFlyout(span);
    }, 1000);
}
function mouseOverEvent() {
    //Clear the timer when the mouse move over the flyout
    clearTimeout(flyoutTimer);
}
function hideFlyout(span) {
    if (span != null) {
        span.style.display = "none";
    }
}
function loaddiv() {

    for (var i = 0; i < RowID.length; i++) {

        document.getElementById("ttl" + RowID[i]).style.display = "none";

    }
}
function showChangeC(id) {
    loaddiv();
    document.getElementById("ttl" + id).style.display = "block";

}
function showChangeLK(id) {

    for (var i = 0; i < ID.length; i++) {

        document.getElementById("mlk" + ID[i]).className = "LK2";
        document.getElementById("lk" + ID[i]).style.display = "none";

    }
    document.getElementById("lk" + id).style.display = "block";
    document.getElementById("mlk" + id).className = "LK1";
}
function checknull() {
    var aa = document.getElementById("ctl00_searchkey").value;
    if (aa.length < 1) {
        alert('请输入查询内容');
        return false;
    }
    else {
        window.location.href = "SelectList.aspx?Title=" + escape(aa);

    }
    return true;
}
