﻿// JScript 文件

var request;
function createRequest() {
  try {
    request = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        request = false;
      }
    }
  }
  if (!request)
    alert("Error initializing XMLHttpRequest!");
}
//*******
//第一个请求
//*******
function getCustomerInfo(page,perpage,ct,lc,ha,ty,lo,bh,ft,fv,le,ky,id,mi,mo) {
  createRequest();
  var url='21.html?Page='+page+'&perpage='+perpage+'&ct='+ct+'&lc='+lc+'&ha='+ha+'&ty='+ty+'&lo='+lo+'&bh='+bh+'&ft='+ft+'&fv='+fv+'&le='+le+'&ky='+encodeURIComponent(ky)+'&id='+id+'&mi='+mi+'&mo='+mo;
  request.open("GET",url,true);
  request.onreadystatechange=updatepage;
  request.send(null);
}
function updatepage(){
    if(request.readyState==4){
        if(request.status==200){
           printmsg();//处理服务器端返回的信息.
           
        }
    }
    else{
  document.getElementById("bgdiv").style.width = document.body.offsetWidth + "px";
  document.getElementById("bgdiv").style.height = document.body.offsetHeight + "px"; 
  document.getElementById("listmsg").style.left=(document.documentElement.clientWidth/2-100)+"px";
  document.getElementById("listmsg").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight/2-15)+"px";
  document.getElementById("listmsg").style.display="block";
  document.getElementById("bgdiv").style.display="block";
    }
}

function printmsg(){
    var xml=request.responseXML; 
    var date=new Date();                             //获得数据
if(xml==null)return;

var root=xml.documentElement;
if(root)                                                //如果存在

{
       document.getElementById("listmsg").style.display="none";
       document.getElementById("bgdiv").style.display="none";
    //遍历每条数据，添加到mydiv
     var list=document.getElementById("mydiv");
     var s="<table border='0' width='98%' cellpadding='2' cellspacing='0'align='center'>";
         
for(var i=0;i<root.childNodes.length;i++)//遍历行
     {
        var rootlist=root.childNodes[i];
           var s1="<tr>";
            s1+="<td><table border='0' width='100%' cellpadding='2' cellspacing='0'><tr><td class='sec-title' height='18'><a class='d' href='2010world-expo-apartment"+rootlist.childNodes[0].firstChild.nodeValue+".html'>"+rootlist.childNodes[1].firstChild.nodeValue+"&nbsp;(ID"+rootlist.childNodes[0].firstChild.nodeValue+")</a></td><td align='right' class='sec-title'>"+rootlist.childNodes[9].firstChild.nodeValue+"&nbsp;&nbsp;<a class='d' href='javascript:' onclick='mapclick("+rootlist.childNodes[0].firstChild.nodeValue+");return false;'>Map</a>&nbsp;&nbsp;"+rootlist.childNodes[6].firstChild.nodeValue+"&nbsp;&nbsp;"+rootlist.childNodes[7].firstChild.nodeValue+" </td></tr></table></td>";
            s1+="</tr>";
            s1+="<tr><td height='18'>";
            s1+="<table border='0' width='100%' cellpadding='2' cellspacing='0'><tr><td width='120'>";
            s1+="<table border='0' width='100%' cellpadding='2' cellspacing='0' height='80'><tr><td class='border4' height='80' width='120' align='center'><img src='/minpic.html?im="+rootlist.childNodes[4].firstChild.nodeValue+"&pw=120&ph=80' border='0' onclick='picclick("+rootlist.childNodes[0].firstChild.nodeValue+")' style='cursor:pointer' alt='More pictures'></td></tr></table>";
            s1+="</td><td valign='top'>";
            s1+="<table border='0' width='100%' cellpadding='2' cellspacing='0'><tr><td height='20' valign='top' class='miaoshu'>";
            s1+=rootlist.childNodes[5].firstChild.nodeValue+"<a class='red' href='2010world-expo-apartment"+rootlist.childNodes[0].firstChild.nodeValue+".html'>[Details]</a></td></tr></table>";
            s1+="</td></tr></table>";
            s1+="</td></tr>";
            s1+="<tr><td height='2'></td></tr>";

        s+=s1
}
        list.innerHTML=s+"</table>"; 
    
}

}
