﻿  // JScript 文件
function sr_onfocus(o){
    var v = o.value;
    if(v.substring(0,3) =="请输入" || v=="搜索关键字" || v=="关键字")
    {
     o.value = "";
    o.style.color="#000";
    }
}

function sr_onblur_1(o){
    var v = o.value;
    if(v=="") 
    {
     o.value="搜索关键字";
     o.style.color="#999999";
    }
}
function checkKeyword(obj)
{
   if(obj.value=="搜索关键字" || obj.value=="关键字" || obj.value=="")
   {
    alert("请输入搜索关键字");
    return false;
   }
   return true;
}

//搜索类
var SearchJs = Class.create(); 
SearchJs.prototype = { 
initialize:function()
{
  this.url="";
},
initialize: function(page){ 
       this.url = page; 
},  

add:function(name,val){ 


    if(val.length>0)
    {
        if(name=="en")
        {
             if(this.url.indexOf('?')>-1)
                this.url=this.url+"&"+name+"="+encodeURI(val);//encodeURI
            else
                this.url=this.url+"?"+name+"="+encodeURI(val);
        }
        else
        {
            if(this.url.indexOf('?')>-1)
            this.url=this.url+"&"+name+"="+UrlEncode(val);//encodeURI
            else
            this.url=this.url+"?"+name+"="+UrlEncode(val);
        }
    }
   },
   
submit:function()
{

  if(this.url.length>0)
  {
  window.location.href=this.url;
  }
  else
  {
    window.location.reload();
  }
}
}











   function UrlEncode(str){
   /*-- Modify from qiushuiwuhen --*/
  var i,temp,p,q;
    var result="";
   for(i=0;i<str.length;i++){
     temp = str.charCodeAt(i);
    if(temp>=0x4e00){
    execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript");
    result+=ascCode.replace(/(.{2})/g, "%$1");
    }else{
     result+=escape(str.charAt(i));
     }
  }
    return result;
   }
   
   function UrlDecode(str){
   var i,temp;
    var result="";
    for(i=0;i<str.length;i++){
    if(str.charAt(i)=="%"){
      if(str.charAt(++i)=="u"){
      temp=str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i);
       result += unescape("%" + temp);
      }else{
      temp = str.charAt(i++) + str.charAt(i);
       if(eval("0x"+temp)<=160){
        result += unescape("%" + temp);
       }else{
        temp += str.charAt(++i) + str.charAt(++i) + str.charAt(++i);
        result += Decode_unit("%" + temp);
      }
      }
     }else{
      result += str.charAt(i);
     }
    }
    return result;
  }
    
   function Decode_unit(str){
    var p,q = "";
    if(str.GetCount("%")!=2)return str;
    p=eval("0x" + str.split("%")[1]);
    q=eval("0x" + str.split("%")[2]);
    if(p<160 || q<160)return unescape(str);
    str=str.replace(/%/g,"");
    execScript("temp=&H"+str, "vbscript");
    execScript("result=chr("+temp+")", "vbscript");
    return result;
   }
