﻿//导航
function initMenu() {
$(".nav_li").hover(
  function(){
  $(this).find(".nav_nav").addClass("nav_div_hover");
  },
  function(){
   $(this).find(".nav_nav").removeClass("nav_div_hover");
  }
);

//回车提交事件
$("#txtSeach").bind("keydown", function(event){
 if(event.keyCode==13)
 {
   var txt=$("#txtSeach").val();
   if(txt=="輸入關鍵字"||txt=="")
   {
   alert("查找關鍵字為空或不存在");return false;
   }
   window.location.href="Seach.aspx?keyword="+txt;
   event.preventDefault();
 }
});

$("#links").change(
  function(){
     var txt=$("#links option:selected").val();
     window.open(txt);
  }
);

//搜索效果
$("#txtSeach").focus(
  function(){
   $("#txtSeach").attr("value",'');
   $("#txtSeach").css("color","");
   }  
);

//搜索操作
$("#btSeach").click(
  function(){
    var txt=$("#txtSeach").val();
    if(txt==""||txt=="輸入關鍵字")
    {
    alert("查找關鍵字為空或不存在");return false;
    }
    else
    {
      window.location.href="Seach.aspx?keyword="+txt;
    }
  }
);


//首页下属公司导航
$("#UrlClick").click(
    function(){
        var op = $("#DropDownList1 option:selected");
        if(op.val()=='0')
        { ;}
        else
        {
        window.open("about.aspx?id="+op.val());
        }
  });
  
}

function getCookie(NameOfCookie)
{
if (document.cookie.length > 0)
{

begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1)    
{
begin += NameOfCookie.length+1;//cookie值的初始位置
end = document.cookie.indexOf(";", begin);//结束位置
if (end == -1) end = document.cookie.length;//没有;则end为字符串结束位置
return unescape(document.cookie.substring(begin, end)); }
}
return null;
}


function setCookie(NameOfCookie, value, expiredays)
{

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) +
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

$(document).ready(function() {initMenu();});

