﻿$(function() {
    $(document).ready(function() {
        $.get("/ajax/HotKeyWords.aspx", function(data) {
            $("#hotKeyWords").html(data);
            gundong("hotKeyWords", 2000, 5, 20);

        })
        //        $("img").lazyload({ threshold: 100, placeholder: "/images/space.gif" });
    });
    $("#txtName").dblclick(function() {
        $(this).val("");

    });
    $("#fristMenu li").click(function() {
        $("#fristMenu li").removeClass("no-selected").removeClass("selected").addClass("no-selected");
        $(this).removeClass("no-selected").addClass("selected");
    });

    $("#m_menu_li1").hover(function() {
        $("#m_subcate ul li").eq(0).show();
        $("#m_subcate ul li").eq(1).hide();
        $("#m_subcate ul li").eq(2).hide();
    });
    $("#m_menu_li2").hover(function() {
        $("#m_subcate ul li").eq(1).show();
        $("#m_subcate ul li").eq(0).hide();
        $("#m_subcate ul li").eq(2).hide();
    });
    $("#m_menu_li3").hover(function() {
        $("#m_subcate ul li").eq(2).show();
        $("#m_subcate ul li").eq(1).hide();
        $("#m_subcate ul li").eq(0).hide();
    });
    $("#m_menu_li4").hover(function() {
        $("#m_subcate ul li").eq(2).hide();
        $("#m_subcate ul li").eq(1).hide();
        $("#m_subcate ul li").eq(0).hide();
    });
    $(".CategoryList dd").hover(function() {
        $(this).addClass("hover");
        $(this).children("ul").css("top", $(this).css("top"));
        $(this).children("ul").css("left", $(this).width() + "px");
        $(this).children("span").hide();
        $(this).children("ul").show();
    }, function() { $(this).children("ul").hide(); $(this).children("span").show(); $(this).removeClass("hover"); })
    var CateSetTimeOut;
    $("#allcatesq").mouseover(function() {
        $(this).attr("class", "m_a_s");
        $("#allsubcate").show()
        CateSetTimeOut = window.setTimeout(allsubcateHide, 3000);
    });

    $("#allsubcate dl").hover(function() { clearTimeout(CateSetTimeOut); }, function() { CateSetTimeOut = window.setTimeout(allsubcateHide, 3000) });
    $("#allsubcate dd").hover(function() { clearTimeout(CateSetTimeOut); }, function() { CateSetTimeOut = window.setTimeout(allsubcateHide, 2000) });
    $("#allsubcate dt").hover(function() { clearTimeout(CateSetTimeOut); }, function() { CateSetTimeOut = window.setTimeout(allsubcateHide, 3000) });
    $("#HomeDiv").hover(function() { $(this).addClass("HomeDivHover"); $("#HomeSub").show(); }, function() { });
    $("#HomeSub").hover(function() { }, function() { $(this).hide(); $("#HomeDiv").removeClass("HomeDivHover"); });
    $(".skin_red").hover(function() { $(this).css("background-position", "left -119px") }, function() { $(this).css("background-position", "left -97px") })
    $(".skin_blue").hover(function() { $(this).css("background-position", "left -75px") }, function() { $(this).css("background-position", "left -53px") })

    KISSY().use("suggest", function(S) {
        S.Suggest('txtName', '/ajax/KeyWordsFill.ashx', {
            resultFormat: '约%result%件'
        });
    });
})
 
function allsubcateHide() {

    $("#allsubcate").hide();
    $("#allcatesq").attr("class", "m_a_z");

}
function login() {
    location.href = "http://passport.wagest.com/login.html?ReturnUrl=" + escape(location.href);
}
function dialog() {
    window.open("http://www.wagest.com/dialog_1.htm?arg=wagest&style=1&kflist=on&kf=02,01,03,04,05,06&zdkf_type=1&language=cn&charset=gbk&lytype=0&referer=" + document.URL + "&keyword=http%3A%2F%2Fwww.wagest.com%2F&tpl=crystal_blue", "newwindow", "height=470, width=700, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no")
}

function openwin() {
    window.open("http://action.wagest.com/alipay/index.html")
}
function search() {
    if ($("#txtName").val() != null)
        document.location.href = 'http://www.wagest.com/search.aspx?K=' + escape($("#txtName").val());
}
