function IE6Hover()//IE6下拉专用
 {
    var sfEls = document.getElementById("MainMenu").getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) 
        {
          sfEls[i].onmouseover=function() {
            this.className+=" hover";
        }
        sfEls[i].onmouseout=function() {
           this.className=this.className.replace(new RegExp("( ?|^)hover\\b"),"");
        }
      }
 }
function ShowItem(id,url)
 {
    var obj=document.getElementById(id);
    if( obj==null)
     {
       return;
     }
    if(obj.style.display=="none")
     {
      obj.style.display="";
     }
   else
     {
      obj.style.display="none";
     }
 }


function FontZoom(Size,LineHeight,Id)
 {
   var Obj=document.getElementById(Id);
   Obj.style.fontSize=Size; 
   Obj.style.lineHeight=LineHeight; 
 }

function  ShowImage(Url)
 {
   window.open("/include/showimage.aspx?src="+Url, "newwindow", "top=50,left=50,height=550, width=850, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no") 
 }

function  k_search(Language)
 {
 var Obj=document.getElementById("P_type");
  if(Obj.checked)
   {
     if(Language=="en")
      {
        En_search_1(Language)
      }
     else
      {
        search_1(Language)
      }
   }
  else
   {
      if(Language=="en")
      {
        En_search_2(Language)
      }
     else
      {
        search_2(Language)
      }
   }
 }




//-------------------中文版-----------------//
function search_1(Language)
 {
  var Keycode=escape(Trim(document.getElementById("Search_Keycode").value));
   if(Keycode=="")
    {
     alert("请输入要搜索的产品名称或型号关键字!");
     return;
    }
   else
    { 
     if(Keycode.length<2)
      {
     alert("关键字必须大于2个字符!");
     return;
      }
     else
     {
       location.href="/include/search.aspx?keycode="+Keycode+"&type=1&language="+Language;
     }
    }
 }

function search_2(Language)
 {
  var Keycode=escape(Trim(document.getElementById("Search_Keycode").value));
   if(Keycode=="")
    {
     alert("请输入要搜索的文章标题或简介关键字!");
     return;
    }
   else
    { 
     if(Keycode.length<2)
      {
     alert("关键字必须大于2个字符!");
     return;
      }
     else
     {
       location.href="/include/search.aspx?keycode="+Keycode+"&type=2&language="+Language;
     }
    }
 }


//feedback
 function Check_Feedback()
  {  

   var fb_value=Trim(document.getElementById("fb_truename").value);
   if(fb_value=="")
    {
      alert("请输入联系人姓名!");
      document.getElementById("fb_truename").focus();
      return false;
    }
   fb_value=Trim(document.getElementById("fb_tel").value);
   if(fb_value.length<5)
    {
      alert("请输入联系电话!");
      document.getElementById("fb_tel").focus();
      return false;
    }

  fb_value=Trim(document.getElementById("fb_email").value);
   if(fb_value=="")
    {
     alert("请输入您的邮箱!");
     document.getElementById("fb_email").focus();
     return false;
     }
     if (fb_value.charAt(0)=="." || fb_value.charAt(0)=="@" || fb_value.indexOf('@', 0) == -1 || fb_value.indexOf('.', 0) == -1 || fb_value.lastIndexOf("@")==fb_value.length-1 || fb_value.lastIndexOf(".")==fb_value.length-1)
        {
           alert("邮箱格式错误，请重新输入!");
          document.getElementById("fb_email").focus();
          return false;
        }

  fb_value=Trim(document.getElementById("fb_content").value);
   if(fb_value=="")
    {
      alert("请输入留言内容!");
      document.getElementById("fb_content").focus();
      return false;
    }

  fb_value=Trim(document.getElementById("fb_yzm").value);
   if(fb_value=="")
    {
      alert("请输入验证码!");
      document.getElementById("fb_yzm").focus();
      return false;
    }


  }
//feedback

//英文版


function En_search_1(Language)
 {
  var Keycode=escape(Trim(document.getElementById("Search_Keycode").value));
   if(Keycode=="")
    {
     alert("Please enter your search product name or type keywords!");
     return;
    }
   else
    { 
     if(Keycode.length<2)
      {
     alert("Keyword must be greater than two characters!");
     return;
      }
     else
     {
       location.href="/include/search.aspx?keycode="+Keycode+"&type=1&language="+Language;
     }
    }
 }

function En_search_2(Language)
 {
  var Keycode=escape(Trim(document.getElementById("Search_Keycode").value));
   if(Keycode=="")
    {
     alert("Please enter your search to the title of the article or profile keyword!");
     return;
    }
   else
    { 
     if(Keycode.length<2)
      {
     alert("Keyword must be greater than two characters!");
     return;
      }
     else
     {
       location.href="/include/search.aspx?keycode="+Keycode+"&type=2&language="+Language;
     }
    }
 }


//feedback
 function En_Check_Feedback()
  {  

   var fb_value=Trim(document.getElementById("fb_truename").value);
   if(fb_value=="")
    {
      alert("Please enter a contact name!");
      document.getElementById("fb_truename").focus();
      return false;
    }
   fb_value=Trim(document.getElementById("fb_tel").value);
   if(fb_value.length<5)
    {
      alert("Please enter a contact telephone!");
      document.getElementById("fb_tel").focus();
      return false;
    }

   fb_value=Trim(document.getElementById("fb_email").value);
   if(fb_value=="")
    {
     alert("Please enter your E-mail!");
     document.getElementById("fb_email").focus();
     return false;
     }
     if (fb_value.charAt(0)=="." || fb_value.charAt(0)=="@" || fb_value.indexOf('@', 0) == -1 || fb_value.indexOf('.', 0) == -1 || fb_value.lastIndexOf("@")==fb_value.length-1 || fb_value.lastIndexOf(".")==fb_value.length-1)
        {
           alert("E-mail format error!");
          document.getElementById("fb_email").focus();
          return false;
        }

   fb_value=Trim(document.getElementById("fb_content").value);
   if(fb_value=="")
    {
      alert("Please enter a message!");
      document.getElementById("fb_content").focus();
      return false;
    }

   fb_value=Trim(document.getElementById("fb_yzm").value);
   if(fb_value=="")
    {
      alert("Please enter the verification code!");
      document.getElementById("fb_yzm").focus();
      return false;
    }


  }
//feedback

//评论输入验证
 function Check_Comments(Language)
  {  
   var C_value=Trim(document.getElementById("c_content").value);
   if(C_value=="")
    {
      if(Language=="en")
       {
        alert("Please enter a comment!");
       }
      else
       {
        alert("请输入评论内容!");
       }
      document.getElementById("c_content").focus();
      return false;
    }
   C_value=Trim(document.getElementById("c_yzm").value);
   if(C_value=="")
    {
     if(Language=="en")
       {
        alert("Please enter the verification code!");
       }
      else
       {
        alert("请输入验证码!");
       }
      document.getElementById("c_yzm").focus();
      return false;
    }

  }

//自定义表单必填项验证
 function Check_ZdyForm(formName,language)
  { 
   var Js1="不能为空!",Js2="请输入验证码!";
   var Names=document.forms[formName].mustname.value;
   var Fields=document.forms[formName].mustfield.value;
   document.forms[formName].zdyform_url.value=location.href;
   var ANames,AFields,Obj;
    if(Fields!="")
     {
       ANames=Names.split(',');
       AFields=Fields.split(',');
       for(i=0;i<AFields.length-1;i++)
        {
          Obj=document.forms[formName][AFields[i]];
          if(Obj.value=="")
           {
            alert(ANames[i]+Js1); 
            Obj.focus();
            return false;
           }
        }
     }
    Obj=document.forms[formName].hscode;
    if(Obj.value=="1")
     {
       if(Trim(document.forms[formName].vcode.value)=="")
        {
          alert(Js2); 
          document.forms[formName].vcode.focus();
          return false;
        }
     }

  }

//改变验证码
function Code_Change(Id)
 {
  Obj=document.getElementById(Id);
  if(Obj.src.indexOf("yzm.aspx")>=0)
   {
    Obj.src="/incs/yzm1.aspx";
   }
  else
   {
    Obj.src="/incs/yzm.aspx"
   }
 }

//控制pagea_control
function Go_Page(PageCount,CurrentPage)
 {
  var P1=document.getElementById("P_First");
  var P2=document.getElementById("P_Prev");
  var P3=document.getElementById("P_Next");
  var P4=document.getElementById("P_Last");
   if(CurrentPage>=PageCount)
    {
      P3.disabled="disabled";
      P3.href="#";
      P4.disabled="disabled";
      P4.href="#";
    }

    if(CurrentPage<=1)
    {
      P1.disabled="disabled";
      P1.href="#";
      P2.disabled="disabled";
      P2.href="#";
    }
   document.getElementById("P_Page").selectedIndex=CurrentPage-1;
 }


//基础函数

function Trim(str)  //去除空格 
 { 
  var Astr=str.split('');
  var str1="";
  for(i=0;i<Astr.length;i++)
   {
    str1+=Astr[i].replace(" ","");
   }
  return str1;
 }


function Change_Display(id)
 {
  var obj=document.getElementById(id);
  if(obj.style.display=="none")
   {
     obj.style.display="";
   }
  else
   {
     obj.style.display="none";
   }
 }

function IsNum(str)
 {
   var str1="0123456789";
   var Astr=str.split('');
   for(i=0;i<Astr.length;i++)
    {
      if(str1.indexOf(Astr[i])<0)
       {
        return false;
       }
    }
  return true;

 }

function replaceAll(str,str1,str2)
{
  str=str.toLowerCase();
  while(str.indexOf(str1)>= 0)
  {
   str=str.replace(str1,str2);
  }
  return str;
}




