﻿function CheckSearch()
{     
    
    var inputObj = document.getElementById('v');
    if (inputObj.value == "")
    {
        alert("请输入搜索条件!");
        inputObj.focus();
        return false;
    }  
     if(CheckTime())
    {
       return true;
    }else
    { return false;}
}
// JScript 文件


//设置搜索时间
  function CheckTime()
  {
     var   today   =   new   Date(); 
     var Settime =today.getTime();
     var OldTime = GetCookie("TimeControler");
     var realtime = parseInt(Settime);
     var nowtime = parseInt(OldTime)+10000;
     //document.writeln(Settime);
   if(realtime>=nowtime)
   {
  
      SetCookie("TimeControler",Settime);
      return true;
   }
   if(OldTime==null)
   {
      SetCookie("TimeControler",Settime);
   }
   alert("您搜索太频繁了，请过5秒后重试！");
   return false;
  }
 
  /************Cookies处理方法*****Start*************/
function GetCookie (name) { //取
var arg = name + "="; 
var alen = arg.length; 
var clen = window.document.cookie.length; 
var i = 0; 
while (i < clen) { 
var j = i + alen; 
if (window.document.cookie.substring(i, j) == arg) return getCookieVal (j); 
i = window.document.cookie.indexOf(" ", i) + 1; 
if (i == 0) break; 
} 
return null;
}

function getCookieVal (offset) { //取
var endstr = window.document.cookie.indexOf (";", offset); 
if (endstr == -1) endstr = window.document.cookie.length; 
return unescape(window.document.cookie.substring(offset, endstr));
}

function SetCookie (name, value) { //设
var exp = new Date(); 
exp.setTime(exp.getTime() + (30*24*60*60*1000));
window.document.cookie = name + "=" + escape (value) + "; expires=" + exp.toGMTString()+";path=/";
}

function DeleteCookie (name) { //删
var exp = new Date(); 
exp.setTime (exp.getTime() - 1); 
var cval = GetCookie (name); 
window.document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString()+";path=/";
} 
/************Cookies处理方法*****End*************/
