﻿Array.prototype.contains = function(value){
    for(var _i = 0; _i < this.length; _i ++ ){
        if(this[_i] === value){
            return true;
        }
    }
    return false;
};

$(document).ready(function() {
    //关键词输入框的提示.

    if ($("#keyword").val() == "") {
        $("#keyword").val("请输入关键词");
        $("#keyword").css("color", "#727272");
    }


    $("#keyword").click(function() {
        var word = $(this).val();
        if (word == "请输入关键词") {
            $(this).val("");
            $(this).css("color", "#000000");
        }
    });

    $("#keyword").blur(function() {
        var word = $(this).val();
        if (word == "") {
            $(this).val("请输入关键词");
            $(this).css("color", "#727272");
        }
    });

    //下侧tabs
    if ($("#tabItemPre").length > 0) {
        $("#tabItemPre").tabs({
            event: 'mouseover'
        });
    }
    $("#r_pf_2").hide();
    $("#r_pf_3").hide();
    $("#r_pf_4").hide();
    $("#r_pf_5").hide();
    $("#r_pf_1").show();
    $("#pf_1").children().eq(0).children().css("color", "#A44809");



    //热点行业.
    if ($("#pf_1").length > 0) {
        $("#pf_1").hover(function() {
            $("#r_pf_2").hide();
            $("#r_pf_3").hide();
            $("#r_pf_4").hide();
            $("#r_pf_5").hide();
            $("#r_pf_1").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#pf_2").children().eq(0).children().css("color", "#005DAA");
            $("#pf_3").children().eq(0).children().css("color", "#005DAA");
            $("#pf_4").children().eq(0).children().css("color", "#005DAA");
            $("#pf_5").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //重点企业.
    if ($("#pf_2").length > 0) {
        $("#pf_2").hover(function() {
            $("#r_pf_1").hide();
            $("#r_pf_3").hide();
            $("#r_pf_4").hide();
            $("#r_pf_5").hide();
            $("#r_pf_2").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#pf_1").children().eq(0).children().css("color", "#005DAA");
            $("#pf_3").children().eq(0).children().css("color", "#005DAA");
            $("#pf_4").children().eq(0).children().css("color", "#005DAA");
            $("#pf_5").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //行政审批.
    if ($("#pf_3").length > 0) {
        $("#pf_3").hover(function() {
            $("#r_pf_1").hide();
            $("#r_pf_2").hide();
            $("#r_pf_4").hide();
            $("#r_pf_5").hide();
            $("#r_pf_3").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#pf_1").children().eq(0).children().css("color", "#005DAA");
            $("#pf_2").children().eq(0).children().css("color", "#005DAA");
            $("#pf_4").children().eq(0).children().css("color", "#005DAA");
            $("#pf_5").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //年度重点.
    if ($("#pf_4").length > 0) {
        $("#pf_4").hover(function() {
            $("#r_pf_1").hide();
            $("#r_pf_2").hide();
            $("#r_pf_3").hide();
            $("#r_pf_5").hide();
            $("#r_pf_4").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#pf_1").children().eq(0).children().css("color", "#005DAA");
            $("#pf_2").children().eq(0).children().css("color", "#005DAA");
            $("#pf_3").children().eq(0).children().css("color", "#005DAA");
            $("#pf_5").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //规划重点.
    if ($("#pf_5").length > 0) {
        $("#pf_5").hover(function() {
            $("#r_pf_1").hide();
            $("#r_pf_2").hide();
            $("#r_pf_3").hide();
            $("#r_pf_4").hide();
            $("#r_pf_5").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#pf_1").children().eq(0).children().css("color", "#005DAA");
            $("#pf_3").children().eq(0).children().css("color", "#005DAA");
            $("#pf_4").children().eq(0).children().css("color", "#005DAA");
            $("#pf_2").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    $("#area-important").children().eq(0).children().css("color", "#A44809");
    //各地区重点项目.
    if ($("#area-important").length > 0) {
        $("#area-important").hover(function() {
            $("#ul-important").hide();
            $("#ul-big-important").hide();
            $("#ul-area-important").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#important").children().eq(0).children().css("color", "#005DAA");
            $("#big-important").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //重点项目
    if ($("#important").length > 0) {
        $("#important").hover(function() {
            $("#ul-big-important").hide();
            $("#ul-area-important").hide();
            $("#ul-important").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#area-important").children().eq(0).children().css("color", "#005DAA");
            $("#big-important").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //重点项目动态.
    if ($("#big-important").length > 0) {
        $("#big-important").hover(function() {
            $("#ul-important").hide();
            $("#ul-area-important").hide();
            $("#ul-big-important").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#area-important").children().eq(0).children().css("color", "#005DAA");
            $("#important").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }

    $("#planing-1").children().eq(0).children().css("color", "#A44809");
    //十二五规划.
    if ($("#planing-1").length > 0) {
        $("#planing-1").hover(function() {
            $("#ul-planing-2").hide();
            $("#ul-planing-3").hide();
            $("#ul-planing-4").hide();
            $("#ul-planing-5").hide();
            $("#ul-planing-1").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#planing-2").children().eq(0).children().css("color", "#005DAA");
            $("#planing-3").children().eq(0).children().css("color", "#005DAA");
            $("#planing-4").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //总体规划
    //    if($("#planing-1").length > 0){
    //        $("#planing-1").hover(function(){
    //            $("#ul-planing-2").hide();
    //            $("#ul-planing-3").hide();
    //            $("#ul-planing-4").hide();
    //            $("#ul-planing-5").hide();
    //            $("#ul-planing-1").show();
    //            $(this).parent().css("background-position", "-325px -29px");
    //        }, function(){;
    //        });
    //    }
    //专项规划
    if ($("#planing-2").length > 0) {
        $("#planing-2").hover(function() {
            $("#ul-planing-1").hide();
            $("#ul-planing-3").hide();
            $("#ul-planing-4").hide();
            $("#ul-planing-5").hide();
            $("#ul-planing-2").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#planing-1").children().eq(0).children().css("color", "#005DAA");
            $("#planing-3").children().eq(0).children().css("color", "#005DAA");
            $("#planing-4").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //区域规划
    if ($("#planing-3").length > 0) {
        $("#planing-3").hover(function() {
            $("#ul-planing-1").hide();
            $("#ul-planing-2").hide();
            $("#ul-planing-4").hide();
            $("#ul-planing-5").hide();
            $("#ul-planing-3").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#planing-2").children().eq(0).children().css("color", "#005DAA");
            $("#planing-1").children().eq(0).children().css("color", "#005DAA");
            $("#planing-4").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    //企业规划
    //    if($("#planing-4").length > 0){
    //        $("#planing-4").hover(function(){
    //            $("#ul-planing-1").hide();
    //            $("#ul-planing-2").hide();
    //            $("#ul-planing-3").hide();
    //            $("#ul-planing-5").hide();
    //            $("#ul-planing-4").show();
    //            $(this).parent().css("background-position", "-145px -29px");
    //        }, function(){;
    //        });
    //    }
    //规划动态.
    if ($("#planing-4").length > 0) {
        $("#planing-4").hover(function() {
            $("#ul-planing-1").hide();
            $("#ul-planing-2").hide();
            $("#ul-planing-3").hide();
            $("#ul-planing-5").hide();
            $("#ul-planing-4").show();
            $(this).children().eq(0).children().css("color", "#A44809");
            $("#planing-2").children().eq(0).children().css("color", "#005DAA");
            $("#planing-3").children().eq(0).children().css("color", "#005DAA");
            $("#planing-1").children().eq(0).children().css("color", "#005DAA");
        }, function() {
            ;
        });
    }
    if ($("#slider").length > 0) {
        $("#slider").easySlider({
            auto: true,
            continuous: true
        });
    }
    $(".tabTable td").hover(function() {
        $(this).parent().children().css("background-color", "#f9e1c5");
    }, function() {
        $(this).parent().children().css("background-color", "#ffffff");
    });

    $(".listTable td").unbind("click");

});

function Search(currect_page){
    if($("#keyword").val() == "请输入关键词"){
        $("#keyword").val("");
    }
    var date = $("#menuDatePicker").val();
    $("#hd-datepicker").val(date);
    if(currect_page != "0"){
        $("#page").val(currect_page);
    }
    else{
        $("#hd-sub").val("");
        $("#page").val("1");
    }
    if($("#column").val() != ""){
        if ($("#column").val() == undefined) {
            $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5357");
        }
        else {
            $("#myform").attr("action", "../Specialtopic/Search.aspx?type=" + $("#column").val());
        }
    }
    $("#myform").submit();
}

function SearchArea(area){
    $("#keyword").val("");
    $("#area").val(area);
    $("#industry").val("");
    $("#hd-time").val("");
    $("#hd-startdate").val("");
    $("#hd-enddate").val("");
    $("#hd-datepicker").val("选择时间");
    $("#hd-sub").val("");
    $("#page").val(1);
    if($("#column").val() != undefined && $("#column").val() != ""){
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=" + $("#column").val());
    }
    else{
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5357");
    }
    $("#myform").submit();
}

function SearchIndustry(industry){
    $("#keyword").val("");
    $("#area").val("");
    $("#industry").val(industry);
    $("#hd-time").val("");
    $("#level").val("");
    $("#hd-startdate").val("");
    $("#hd-enddate").val("");
    $("#hd-datepicker").val("选择时间");
    $("#hd-sub").val("");
    $("#page").val(1);
    if($("#column").val() != undefined && $("#column").val() != ""){
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=" + $("#column").val());
    }
    else{
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5357");
    }
    $("#myform").submit();
}

function SearchViewpoint(industry) {
    $("#keyword").val("");
    $("#area").val("");
    $("#industry").val(industry);
    $("#hd-time").val("");
    $("#level").val("");
    $("#hd-startdate").val("");
    $("#hd-enddate").val("");
    $("#hd-datepicker").val("选择时间");
    $("#hd-sub").val("");
    $("#page").val(1);

    $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5248");
  
    $("#myform").submit();
}

function SearchLevel(level){
    $("#keyword").val("");
    $("#area").val("");
    $("#industry").val("");
    $("#level").val(level);
    $("#hd-time").val("");
    $("#hd-startdate").val("");
    $("#hd-enddate").val("");
    $("#hd-datepicker").val("选择时间");
    $("#hd-sub").val("");
    $("#page").val(1);
    $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5357");
    $("#myform").submit();
}


//search type
function SearchType(id){
    var array1 = [5405, 7293, 8168];
    if(array1.contains(id)){
        $("#keyword").val("");
        $("#area").val("");
        $("#industry").val("");
        $("#hd-time").val("");
        $("#hd-startdate").val("");
        $("#hd-enddate").val("");
        $("#hd-datepicker").val("选择时间");
        $("#hd-sub").val(id);
        $("#page").val(1);
        $("#column").val(5357);
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5357");
        $("#myform").submit();
    }
    var array2 = [8155];
    if(array2.contains(id)){
        $("#keyword").val("");
        $("#area").val("");
        $("#industry").val("");
        $("#hd-time").val("");
        $("#hd-startdate").val("");
        $("#hd-enddate").val("");
        $("#hd-datepicker").val("选择时间");
        $("#hd-sub").val(id);
        $("#page").val(1);
        $("#column").val(5332);
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5332");
        $("#myform").submit();
    }
    var array3 = [5224, 5249, 5250, 5251, 5252, 5361];
    if(array3.contains(id)){
        $("#keyword").val("");
        $("#area").val("");
        $("#industry").val("");
        $("#hd-time").val("");
        $("#hd-startdate").val("");
        $("#hd-enddate").val("");
        $("#hd-datepicker").val("选择时间");
        $("#hd-sub").val(id);
        $("#page").val(1);
        $("#column").val("");
        $("#myform").submit();
    }
    var array4 = [8163, 8164, 8165, 8166, 8167];
    if (array4.contains(id)) {
        $("#keyword").val("");
        $("#area").val("");
        $("#industry").val("");
        $("#hd-time").val("");
        $("#hd-startdate").val("");
        $("#hd-enddate").val("");
        $("#hd-datepicker").val("选择时间");
        $("#hd-sub").val(id);
        $("#page").val(1);
        $("#column").val(5245);
        $("#myform").attr("action", "../Specialtopic/Search.aspx?type=5245");
        $("#myform").submit();
    }
}
