﻿//种子频道 菜单 更多栏目下拉列表
$(function () {
    $(".nowSearch").mouseover(function () { $(".selOption").slideDown("fast"); });
    $(".nowSearch").click(function () { $(".selOption").slideDown("fast"); });
    $(document).click(function (event) {
        if ($(event.target).attr("id") != "headSel") {
            $(".selOption").hide();
        }
    });
})

//认证情况下拉列表
$(function () {
    $("#select3").children("span").toggle(
            function () {
                $(".option").slideDown("fast");
            },
             function () {
                 $(".option").slideUp("fast");
             }
            );

    $(".option li").click(function () {
        $(".option").slideUp("fast");
        $("#select3").children("span").html($(this).html());
        $("#renzheng").val($(this).attr("tip"));
    })
    /*点击任何地方关闭层*/
    $(document).click(function (event) {
        if ($(event.target).attr("class") != "select3") {
            $(".option").slideUp("fast");
        }
    });
});
//销售渠道下拉列表
$(function () {
    $("#select4").children("span").toggle(
            function () {
                $(".option1").slideDown("fast");
            },
             function () {
                 $(".option1").slideUp("fast");
             }
            );

    $(".option1 li").click(function () {
        $(".option1").slideUp("fast");
        $("#select4").children("span").html($(this).html());
        $("#sellTyle").val($(this).attr("tip1"));
    })
    /*点击任何地方关闭层*/
    $(document).click(function (event) {
        if ($(event.target).attr("class") != "select4") {
            $(".option1").slideUp("fast");
        }
    });
});

$(document).ready(function () {
	//产品供应 产品分类 按首字母查找分类
	$('.side').mousemove(function () {
         $(this).find('.p-list').show();
         $(this).find('p').addClass('hover');
    });
    $('.side').mouseleave(function () {
         $(this).find('.p-list').hide();
         $(this).find('p').removeClass('hover');
    });
    //分类
    $('.sidelist').mousemove(function () {
        $(this).find('.i-list').show();
        $(this).find('p').addClass('hover');
    });
    $('.sidelist').mouseleave(function () {
        $(this).find('.i-list').hide();
        $(this).find('p').removeClass('hover');
    });
    //特殊选种
    $('.sidelist1').mousemove(function () {
        $(this).find('#i-list').show();
        $(this).find('#hg_jt').addClass('hover');
    });
    $('.sidelist1').mouseleave(function () {
        $(this).find('#i-list').hide();
        $(this).find('#hg_jt').removeClass('hover');
    });
    //小频道顶部更多    
    $('.selSearch2').mousemove(function () {
        $(this).find('.d-list').show();
        $(this).find('.nowSearch1').addClass('hover');
    });
    $('.selSearch2').mouseleave(function () {
        $(this).find('.d-list').hide();
        $(this).find('.nowSearch1').removeClass('hover');
    });
});

function TabClick(region, tab, tabs) {
    for (var i = 1; i <= tabs; i++) {
        $("#" + region + "Title" + i).removeAttr("class");
        $("#" + region + "Title" + i).attr("class", "");

        $("#" + region + i).hide();
    }
    $("#" + region + "Title" + tab).attr("class", "tab_current");
    $("#" + region + tab).show();
}

function Clear(obj) {
    if (obj.value == "请输入查询内容") {
        obj.value = "";
    }
}

function Go() {
    var q = $('#q').val();
    var type = $("input[name=RadioGroup]:checked:").attr("value");
    if (q == "" || q == "请输入查询内容") {
        alert("请输入要查询的内容！");
    }
    else {
        if (type + "" == "undefined") {
            alert("请选择查询类别！");
        }
        else {
            switch (type + "") {
                case "0":
                    location.href = "/Sell/List?q=" + encodeURI(q);
                    break;
                case "1":
                    location.href = "/Buy/List?q=" + encodeURI(q);
                    break;
                case "2":
                    var url = encodeURIComponent("http://zs.vegnet.com.cn/ClassificationHall/List");
                    window.open("/Home/Jump?url=" + url + "&q=" + encodeURI(q));
                    break;
                case "3":
                    location.href = "/Company/List?q=" + encodeURI(q);                    
                    break;
                case "4":
                    location.href = "/News/List?q=" + encodeURI(q);
                    break;
                case "5":
                    location.href = "/Price/List?q=" + encodeURI(q);
                    break;
                case "6":
                    location.href = "/Tech/List?q=" + encodeURI(q);
                    break;
            }
        }
    }
    return false;
}

function ListGo() {
    var q = $('#listq').val();
    var type = $("input[name=listRadioGroup]:checked:").attr("value");
    if (q == "" || q == "请输入查询内容") {
        alert("请输入要查询的内容！");
    }
    else {
        switch (type + "") {
            case "0":
                location.href = "/Sell/List?q=" + encodeURI(q);
                break;
            case "1":
                location.href = "/Buy/List?q=" + encodeURI(q);
                break;
            case "2":
                var url = encodeURIComponent("http://zs.vegnet.com.cn/ClassificationHall/List");
                window.open("/Home/Jump?url=" + url + "&q=" + encodeURI(q));
                break;
            case "3":
                location.href = "/Company/List?q=" + encodeURI(q);
                break;
            case "4":
                location.href = "/News/List?q=" + encodeURI(q);
                break;
            case "5":
                location.href = "/Tech/List?q=" + encodeURI(q);
                break;
                break;
        }
    }
    return false;
}

function listSeedGo() {
    var q = $('#listq').val();
    var type = $("input[name=listRadioGroup]:checked:").attr("value");
    if (q == "" || q == "请输入查询内容") {
        alert("请输入要查询的内容！");
    }
    else {
        switch (type + "") {
            case "0":
                location.href = "/Seed/SellList?q=" + encodeURI(q);
                break;
            case "1":
                location.href = "/Seed/Buy?q=" + encodeURI(q);
                break;
            case "2":
                var url = encodeURIComponent("http://zs.vegnet.com.cn/SeedInvestment/List");
                window.open("/Home/Jump?url=" + url + "&q=" + encodeURI(q));
                break;
            case "3":
                location.href = "/Company/SeedList?q=" + encodeURI(q);
                break;
            case "4":
                location.href = "/News/SeedList?q=" + encodeURI(q);
                break;
            default:
                location.href = "/Seed/SellList?q=" + encodeURI(q);
                break;
        }
    }
    return false;
}

function ChannelGo(channel) {
    var q = $('#listq').val();
    var type = $("input[name=listRadioGroup]:checked:").attr("value");
    if (q == "" || q == "请输入查询内容") {
        alert("请输入要查询的内容！");
    }
    else {
        switch (type + "") {
            case "0":
                location.href = "/Channel/Seed?q=" + encodeURI(q) + "&ename=" + channel;
                break;
            case "1":
                location.href = "/Channel/Buy?q=" + encodeURI(q) + "&ename=" + channel;
                break;
            case "2":
                var url = encodeURIComponent("http://zs.vegnet.com.cn/ClassificationHall/List");
                window.open("/Home/Jump?url=" + url + "&q=" + encodeURI(q));
                break;
            case "3":
                location.href = "/Channel/Company?q=" + encodeURI(q) + "&ename=" + channel;
                break;
            case "4":
                location.href = "/Channel/News?q=" + encodeURI(q) + "&ename=" + channel;
                break;
            default:
                location.href = "/Channel/Seed?q=" + encodeURI(q) + "&ename=" + channel;
                break;
        }
    }
    return false;
} 

//种子顶部Tab切换时改变样式
function tabChange(obj) {
    $("[name=RadioGroup][class=sort]").attr("class", "");
    $(obj).attr("class", "sort");
}
//种子搜索-搜索类型：1:供应 2:企业 3:求购 4:招商 5:新闻
function SeedSearch() {
    var q = $('#seedq').val();
    var arr = new Array()
    arr[0] = "sell";
    arr[1] = "company";
    arr[2] = "buy";
    arr[3] = "invest";
    arr[4] = "news";
    if (q == "" || q == "请输入查询内容") {
        alert("请输入要查询的内容！");
    }
    else {
        for (var i = 0; i < arr.length; i++) {
            var classes = $("#" + arr[i]).attr("class");
            var url = $("#" + arr[i]).attr("url");
            if (classes == "sort") {
                if (i == 3) {
                    window.open("/Home/Jump?url=http://zs.vegnet.com.cn/ClassificationHall/List&q=" + encodeURI(q));
                }
                else {                  
                    var channelUrl = "/" + url + "?q=" + encodeURI(q);
                    window.open(channelUrl);
                }
            }
        }
    }
    return false;
}   

//根据省获取市
function GetCityArea(areaID) {
    for (i = 0; i < areas.length; i++) {
        if (areas[i][2] == areaID) {
            if (areas[i][1].substring(2, 3) > 0)
                $("#selectCityArea").append("<option value='" + areas[i][1] + "'>" + areas[i][0] + "</option>");
            else if (areas[i][1].substring(3, 4) > 0)
                $("#selectCityArea").append("<option value='" + areas[i][1] + "'>" + areas[i][0] + "</option>");
        }
    }
}



