function byid(d){return document.getElementById(d);}
var uniqnum_counter = (new Date).getTime();;
function UniqueNum() {
  ++uniqnum_counter;
  return uniqnum_counter;
}
function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) {
    document.write('浏览器不支持XMLHTTP技术，请更换您的浏览器，推荐Firefox,GreenBrowser');
    return null;
  }
  this.connect = function(sURL, sMethod, sTarget,return_type)
  {
    if (!sTarget)
    {
        sTarget="";
    }
    if (!return_type)
    {
        return_type=0;
    }
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"&rand="+ UniqueNum(), true);
      }
      else
      {
        xmlhttp.open(sMethod, sURL + "&rand="+ UniqueNum(), true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          s=xmlhttp.responseText;
          if (return_type==1)
          {
          }
          if(return_type==0){
              byid(sTarget).innerHTML=s;
          }
		  if(return_type==2){
              byid(sTarget).innerHTML=s;
              start_upload_progress();
		  }
        }};
      xmlhttp.send(null);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}

function ajax(g,url){
    var myConn = new XHConn();
    myConn.connect(url, "GET", g);
}
