var $ = function(tid)
{
  return document.getElementById(tid);
}
function isIE()
{
  if (window.navigator.userAgent.toLowerCase().indexOf("msie") >= 1)
  return true;
  else
  return false;
}

if( ! isIE())
{
  HTMLElement.prototype.__defineGetter__("innerText",
  function()
  {
    var anyString = "";
    var childS = this.childNodes;
    for(var i = 0; i < childS.length; i ++ )
    {
      if(childS[i].nodeType == 1)
      anyString += childS[i].innerText;
      else if(childS[i].nodeType == 3)
      anyString += childS[i].nodeValue;
    }
    return anyString;
  }
  );
  HTMLElement.prototype.__defineSetter__("innerText",
  function(sText)
  {
    this.textContent = sText;


  }
  );
}

String.prototype.Trim = function() {
  var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
  return (m == null) ? "" : m[1];
}
var checkemail = function(str)
{
  var pattern_cn = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  if(pattern_cn.test(str)) return true;
  return false;
}
String.prototype.isMobile = function() {
  return (/^(?:13\d|15[012689])-?\d{5}(\d{3}|\*{3})$/.test(this.Trim()));
}

String.prototype.isTel = function()
{
  return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
}





var ShowArrow = function()
{
  var menusA = document.getElementsByName('item');
  var len = menusA.length;
  for(var i = 0; i < len; i ++ )
  {
    menusA[i].onmouseover = function(i)
    {
      return function()
      {
        for(var j = 0; j < len; j ++ )
        {
          menusA[j].className = "item";
        }
        menusA[i].className = "hover";
      }
    }
    (i)
    ;
  }
}

var hasthis = function(str)
      {
         var scr = window.location.href.toLowerCase();
         if(scr.indexOf(str.toLowerCase()) > 0)
         return true;
         return false;
      }
var has = function(str,str1)
      {
         if(str.indexOf(str1.toLowerCase()) > 0)
         return true;
         return false;
      }
var InitNav=function()
{
 if(hasthis('index')) ShowNav(0);
  else if(hasthis('about')) ShowNav(1);
  else if(hasthis('history')) ShowNav(1);
  else if(hasthis('Chairman')) ShowNav(1);
  else if(hasthis('Mission')) ShowNav(1);
  else if(hasthis('news')) ShowNav(1);
  else if(hasthis('detail')) ShowNav(1);
  
  else if(hasthis('product')) ShowNav(2);
  else if(hasthis('standard')) ShowNav(2);
  else if(hasthis('pdetail')) ShowNav(2); 
  
  else if(hasthis('Tool-Design')) ShowNav(3);
  else if(hasthis('Tool-Room')) ShowNav(3);
  else if(hasthis('Die-Casting-Moulds')) ShowNav(3);
  else if(hasthis('Annealing')) ShowNav(3);
  
  else if(hasthis('testing')) ShowNav(4);
  else if(hasthis('Design')) ShowNav(4);
  else if(hasthis('Process')) ShowNav(4);
  else if(hasthis('Certification')) ShowNav(4);
  
  else if(hasthis('Marketing')) ShowNav(5);
  else if(hasthis('Business')) ShowNav(5);
  else if(hasthis('Order')) ShowNav(5);
  
  else if(hasthis('Contact')) ShowNav(6);
  else if(hasthis('Quality')) ShowNav(6);
  else if(hasthis('Welding')) ShowNav(6);

  else ShowNav(0);
}
var ShowNav=function(i)
{
  var menusA = document.getElementsByName('item');
  menusA[i].className = "hover";
}
 

function searchpro()
{

   var k = escape($('keywords').value);
   if((k.length > 0) && (k!='&nbsp;')) 
   {
      var url = "products_0_"+k+"_1.html";
      location.href=url;
   }
}

function show(obj,t)
{
  if(t=='1')
  {
    $('cc1').style.display='block';
    obj.className='hover';
    $('cc2').style.display='none';
    $('tab2').className='';
  }
  else
  {
    $('cc2').style.display='block';
    obj.className='hover';
    $('cc1').style.display='none';
    $('tab1').className='';
  }

}

















