﻿var xmlhttp;
var ahrefid;
function createxmlhttp()
{
  if(window.ActiveXObject)
  {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    return xmlhttp;
  }
  else if(window.XMLHttpRequest)
  {
    xmlhttp=new XMLHttpRequest();
    return xmlhttp;
  }
}
function seachpiaohao(piaohao,dianhua)
{  
  var piaohaotext=document.getElementById(piaohao);
  var dianhuatext=document.getElementById(dianhua);
  if(piaohaotext.value!=""|| dianhuatext.value!="")
  {
  xmlhttp=createxmlhttp();
  var url="ajaxasch/wbway.ashx?piaohao="+encodeURIComponent(piaohaotext.value)+"&dianhua="+encodeURIComponent(dianhuatext.value)+"&type=1";
  xmlhttp.open("Get",url,true);
  xmlhttp.onreadyStatechange=getgoodurl;
  xmlhttp.send(null);
  }
  else
  window.alert("请输入货单号或电话");
}
function goodsearch(KeyWord)
 {
 
    var goodblurr=document.getElementById(KeyWord);
    if(goodblurr.value!="")
    {
      xmlhttp=createxmlhttp();
      var url="ajaxasch/wbway.ashx?goodblurr="+encodeURIComponent(goodblurr.value)+"&type=2";
      xmlhttp.open("Get",url,true);
      xmlhttp.onreadyStatechange=getgoodurl;
      xmlhttp.send(null);
    }
    else
    {
      window.alert("请输入产品相关信息");
    }
 }
 function getgoodurl()
  {
    if(xmlhttp.readyState==4)
    {
      if(xmlhttp.status==200)
      {
      
        document.location.href=xmlhttp.responseText;
       }
    }
  }
function inforsearch(downloadWord)
{
  var goodblurr=document.getElementById(downloadWord);
 
    if(goodblurr.value!="")
    {
      xmlhttp=createxmlhttp();
      var url="ajaxasch/wbway.ashx?inforblurr="+encodeURIComponent(goodblurr.value)+"&type=3";
      xmlhttp.open("Get",url,true);
      xmlhttp.onreadyStatechange=getgoodurl;
      xmlhttp.send(null);
    }
    else
    {
      window.alert("请输入下载相关信息");
    }
}
function questionsearch(quesWord)
 { 
    var quesblurr=document.getElementById(quesWord);
    if(quesblurr.value!="")
    {
      xmlhttp=createxmlhttp();
      var url="ajaxasch/wbway.ashx?quesblurr="+encodeURIComponent(quesblurr.value)+"&type=4";
      xmlhttp.open("Get",url,true);
      xmlhttp.onreadyStatechange=getgoodurl;
      xmlhttp.send(null);
    }
    else
    {
      window.alert("请输入问题相关信息");
    }
  }
 function download(aid,filename)
 {
     ahrefid=aid;
     xmlhttp=createxmlhttp();
     var url="ajaxasch/wbway.ashx?aid="+encodeURIComponent(aid)+"&filename="+encodeURIComponent(filename)+"&type=6";
     xmlhttp.open("Get",url,true);
     xmlhttp.onreadyStatechange=getahrel;
     xmlhttp.send(null);
 }
 function getahrel()
 {

   if(xmlhttp.readyState==4)
    {
      if(xmlhttp.status==200)
      {  
        document.getElementById(ahrefid).href=xmlhttp.responseText;
       }
    }
 }

