﻿function aaaaa()
{
    alert('');
}

// JScript 文件
//<![CDATA[
var goto_top_type = -1;
var goto_top_itv = 0;

function goto_top_timer()
{
var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;
var moveby = 15;

y -= Math.ceil(y * moveby / 100);
if (y < 0) {
y = 0;
}

if (goto_top_type == 1) {
document.documentElement.scrollTop = y;
}
else {
document.body.scrollTop = y;
}

if (y == 0) {
clearInterval(goto_top_itv);
goto_top_itv = 0;
}
}

function goto_top()
{
if (goto_top_itv == 0) {
if (document.documentElement && document.documentElement.scrollTop) {
goto_top_type = 1;
}
else if (document.body && document.body.scrollTop) {
goto_top_type = 2;
}
else {
goto_top_type = 0;
}

if (goto_top_type > 0) {
goto_top_itv = setInterval('goto_top_timer()', 50);
}
}
}

//]]>
//搜索JS
function frmSubmit(frm)
{ 
   var word =document.getElementById("txtWord").value;
   if(word=="Part Number")
   {
   alert("Part number must be in more than 4 digits and/or letters.");
   return false;
   }
   if(document.getElementById("SelType").value=="Sup")
   {
       if(word.length==0)
        {alert("Please input part number!"); return false;}
        
       if(word.length<4 || word=="Part number / Keyword ")
       {
           alert("Part number must be in more than 4 digits and/or letters."); 
           document.getElementById("txtWord").focus();
           return false;
       }
       else
       {    
             chk("Sup");
             return true;
        }
   }
   else
   {
       if(word.length<3 || word=="Part number / Keyword ")
       {
           alert("Part number must be in more than 3 digits and/or letters."); 
           document.getElementById("txtWord").focus();
           return false;
       }
       else
       {    
             chk("Dat");
             return true;
        }
   }
}
function allchk(chk)
{
    var flag;
    if(chk.checked)
    flag=true;
    else
    flag=false;
    var obj=document.getElementsByTagName("INPUT");
    for(var i=0;i<obj.length;i++) 
    { 
       if(obj[i].name!="Macth" && obj[i].name!="raiType")
       obj[i].checked=flag; 
    } 
}

function toPdfDown(id)
{
  window.open("/pdfDown/" + id + "/Down.html");
  //window.open("http://www.chinaicmart.com/pdf/pdf_down.asp?id=" + id);
}
function chk(type)
{

   if(type=="Dat")
    {frm.action="/SearchPdf.html";}
   else
    {frm.action="/Search.html";}

}
function toPage(Pages,Dat,Word)
{
   var page=1;
   try
   {
      page=parseInt(Pages);
      if(page<1) page=1;
   }
   catch(e) 
   {
       
   }
   document.getElementById("txtWord").value=Word;
   document.getElementById("Pages").value=page;
   chk(Dat);
   frm.submit(); 
}
function toSend(No)
{
   //
   if(No=="Send")
   {
       No="";
       var obj=document.all.xh;
        for(var i=0;i<obj.length;i++) 
        { 
           if(obj[i].checked)
           {
               No += obj[i].value + ",";
           }
        }
        if(No.length>0)
        {
          No=No.substring(0,No.length-1);
          window.open("/Inquiry-" + No + ".html");
        }
        else
        {
            window.open("/Inquiry.html");
        }
   }
   else
   {
       window.open("/Inquiry-" + No + ".html");
   }

  
}
function toSends(No)
{
   window.open("/Inquiry-" + No + ".html");
}
function toPdf(No)
{
    chk("Dat");
    document.getElementById("txtWord").value=No;
    frm.submit(); 
}
function toPageBuy(Pages)
{
   var page=1;
   try
   {
      page=parseInt(Pages);
      if(page<1) page=1;
   }
   catch(e) 
   {
       
   }
   document.getElementById("Pagesd").value=page;
   frmBuy.submit(); 
}
function frmchk()
{
    var word=document.getElementById("txtxinghao").value;
    if(word.length<=3)
    {
           alert("Part number must be in more than 4 digits and/or letters."); 
           document.getElementById("txtxinghao").focus();
           return false;
    }
    else
    {
      document.getElementById("panel").style.display="none";
      return true;
    }
}
function alllist_load()
{
    var word=document.getElementById("txtxinghao").value;
    if(word.length>3)
    {
      document.getElementById("panel").style.display="none";
      document.getElementById("panel2").style.display="";
    }
}
function SetValue(obj,xh)
{
   var temp = document.getElementById("xinghao").value + ",";
   temp=temp.replace(/(^\s*)|(\s*$)/g,"");   
   if(obj.checked)
   {
      if(temp.indexOf(xh + ",")>-1)
      return;
      else
      {
          if(temp.length>4)
          temp = temp + "," + xh + ",";
          else
          temp=xh + ",";
      }
      tValue(xh,true)
   }
   else
   {   tValue(xh,false)
       temp=temp.replace(xh + ",","");
   }
   temp =temp.replace(",,",",");
   if(temp.length>0)
   temp=temp.substring(0,temp.length-1);
   document.getElementById("xinghao").value=temp;
   
}
function tValue(vs,k)
{

    var obj=document.getElementsByTagName("input");
    for(var i=0;i<obj.length;i++) 
    { 
       if(obj[i].type == 'checkbox')
       {
          if(obj[i].value==vs)
          obj[i].checked=k;
       } 
    } 
}
function toSubmit(form)
{
if(form.PartNo.value=="")
{
   alert("Please enter the model you want advice!");
   return false;
}
if(form.PartNo.value=="Part Number")
{
   alert("Please enter the model you want advice!");
   return false;
}
return true;
}
