﻿if (window.location.toString().indexOf("info.u69cn.com") == -1) { document.writeln("<script type=\"text/javascript\" src=\"http://www.u69cn.com/tools/ajax.aspx?t=changevod\"></script>"); }
$(document).ready(function() {
    $("img").error(function() {
        $(this).attr("src", "/images/dftPro.jpg");
    });
    if (window.location.toString().indexOf("http://search.") > -1) {
        $("#search").attr("target", "_self");
    }
    var action;
    $("div.search_form>div.menu>a").each(function(i) {
        if ($("#selected").val() == "{menu_selected}")
            return false;
        if ($("#selected").val() == i)
            $(this).addClass("selected");
        else
            $(this).removeClass("selected");
        $(this).click(function() {
            if ($("#search>input[name$=keyword]").val() != "" && $("#search>input[name$=keyword]").val() != "请输入产品名称" && window.location.toString().indexOf("http://search") > -1) {
                $(this).removeAttr("href");
                switch (i) {
                    case 0:
                    case 3:
                        action = "http://search.u69cn.com/supply/s.shtml";
                        break;
                    case 1:
                        action = "http://search.u69cn.com/company/s.shtml";
                        break;
                    case 2:
                        action = "http://search.u69cn.com/demand/s.shtml";
                        break;
                }
                $("#search").attr("action", action).submit();
            }
        });
    });
    $("div.nav-bottom>ul>li").each(function(i) {
        if ($("#selectbaner").val() == "{menu1_selected}")
            return false;
        if ($("#selectbaner").val() == i)
            $(this).addClass("selected");
        else
            $(this).removeClass("selected");
    });
    switch ($("#selected").val()) {
        case "0":
        case "3":
            action = "http://search.u69cn.com/supply/s.shtml";
            break;
        case "1":
            action = "http://search.u69cn.com/company/s.shtml";
            break;
        case "2":
            action = "http://search.u69cn.com/demand/s.shtml";
            break;
    }
    $("#search").attr("action", action);
    $("div.nav-bottom>ul>li").each(function() {
        if ($(this).attr("class") != "selected")
            $(this).hover(function() { $(this).addClass("selected") }, function() { $(this).removeClass("selected") });
    });
    try {
        $.post(
            "/Tools/Ajax.aspx",
            "t=checkloginstate",
            function(xml, success) {
                if ($(xml).find("result").attr("value") == "1")
                    $("#login").html($(xml).find("result").attr("text") + "：您好，欢迎来到中华商机网！").css("line-height", "20px");
            },
            "xml"
        );
    }
    catch (e) {
    }
    $("#top-img").slideToggle("flow", function() {
        var iThis = this;
        $(iThis).append("<div class=\"close-ico\"></div>").find("img").css("position", "relative");
        $("div.close-ico").css({ top: "0px", left: $(iThis).find("img").width() + 10 + "px" }).click(function() {
            $(iThis).slideToggle("flow");
        });
        window.setTimeout("close()", 10000);
    });
    navMenu("HomeNav", "_head_index_content", 0);
    navMenu("ProductNav", "_head_product_content", 0);
    navMenu("navMenu", "_menuNav", -270);
    
    
     navMenu("ProductNav1", "_head_product_content1", 0);
      navMenu("ProductNav11", "_head_product_content11", 0);
       navMenu("ProductNav111", "_head_product_content111", 0);
});

function close() { 
    if ($("#top-img").css("display") == "block")
        $("#top-img").slideToggle("flow");
}

function navMenu(menuid, boxid, left) {
    var iThis = $("#" + menuid + "");
    iThis.mouseover(function() {
        $(this).css("position", "relative");
        $("#" + boxid + "").css({ display: "block", left: iThis.offset().left + left, top: iThis.offset().top + 12 + "px" }).mousemove(function() {
            $(this).css({ display: "block", left: iThis.offset().left + left, top: iThis.offset().top + 12 + "px" });
        }).mouseout(function() {
            $(this).css("display", "none");
        });
    }).mouseout(function() {
        $("#" + boxid + "").css("display", "none");
    }).mousemove(function() {
        $("#" + boxid + "").css({ display: "block", left: iThis.offset().left + left, top: iThis.offset().top + 12 + "px" }).mouseout(function() {
            $(this).css("display", "none");
        });
    });
}
