// JavaScript Document
  
var xmlObj = false;
var xmlResult;
try {
xmlObj=new XMLHttpRequest;
}
catch(e) {
try {
xmlObj=new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e2) {
try {
xmlObj=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e3) {
xmlObj=false;
}
}
}
if (!xmlObj) {
alert("XMLHttpRequest init Failed!");
} 
 
function AjaxSearchb() {
var searchword;
var installurl;
  searchword=escape(document.getElementById("searchwordb").value);
   installurl=escape(document.getElementById("installurlb").value);
  if(searchword=="") {
   document.getElementById("search_resultb").innerHTML="";
alert("请选择要比较的产品！");
  return;
 }
   strs=searchword.split("%2C");
 if(strs.length==2)
 {
	 alert("请选择两种以上的产品进行比较！");
	 return false;
 }
  document.getElementById("search_resultb").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在更新....";
  xmlObj.open("POST",installurl+"compare.asp",true);
  xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 xmlObj.onreadystatechange=function() {
 if(xmlObj.readyState==4) {
 if(xmlObj.status==200) {
  xmlResult=xmlObj.responseXML;
   AjaxShowResultb();
}
}
}
xmlObj.send("searchword="+searchword);
  }
 
function AjaxShowResultb() {
 var typeid;
 typeid=escape(document.getElementById("typeid").value);
  var results,i,strTemp;
 results=xmlResult.getElementsByTagName("result");
 
if(typeid==1)
{

strTemp="<table border=1 align=center bordercolor=#FAFAFA  cellpadding=0 cellspacing=0 width='778'><tr><td height=25 bgcolor=#FAFAFA  colspan=2><font color=#0099CC><b>产品比较如下</b></font>：</td></tr><tr>";
 if(results[0].getElementsByTagName("logid")[0].firstChild.data=="#")
 strTemp=strTemp+"<td align=center> ....对不起,暂无信息...... </td>";
else
{
  for(i=0,j=1;i<results.length;i++,j++)
{
 strTemp = strTemp + "<td>(<font color=#E1160C>"+j+"</font>)&nbsp;"+ results[i].getElementsByTagName("content")[0].firstChild.data + "<br><font color=red>■</font>商品名称： <"+results[i].getElementsByTagName("logid")[0].firstChild.data +" target=_blank>"+ results[i].getElementsByTagName("logtitle")[0].firstChild.data + "</a><br><font color=red>■</font>公司名称： <"+results[i].getElementsByTagName("comid")[0].firstChild.data +">"+ results[i].getElementsByTagName("comname")[0].firstChild.data + "</a></td>";　
 if(j % 2==0)
  {
 strTemp = strTemp +"</tr><tr><td colspan=2 height=12 bgcolor=#FFF9EB></td></tr><tr>";
 }
  
 }
 
}
strTemp=strTemp+"</tr><tr><td colspan=2 align=center><font color=#666666>一共有<font color=red>"+(j-1)+"</font>种产品进行比较</font></td></tr></table>";
 }


if(typeid==0)
{

strTemp="<table border=1 align=center bordercolor=#FAFAFA  cellpadding=0 cellspacing=0 width='778'><tr><td height=25 bgcolor=#FAFAFA  colspan=2><font color=#0099CC><b>产品比较如下</b></font>：</td></tr>";
 if(results[0].getElementsByTagName("logid")[0].firstChild.data=="#")
 strTemp=strTemp+"....对不起,暂无信息......";
else
{
 for(i=0,j=1;i<results.length;i++,j++)
{
 strTemp = strTemp + "<tr><td>(<font color=#E1160C>"+j+"</font>)&nbsp;"+ results[i].getElementsByTagName("content")[0].firstChild.data + " <font color=red>■</font>商品名称： <"+results[i].getElementsByTagName("logid")[0].firstChild.data +" target=_blank>"+ results[i].getElementsByTagName("logtitle")[0].firstChild.data + "</a> <font color=red>■</font>公司名称： <"+results[i].getElementsByTagName("comid")[0].firstChild.data +">"+ results[i].getElementsByTagName("comname")[0].firstChild.data + "</a></td></tr><tr><td colspan=2 height=12 bgcolor=#FFF9EB></td></tr>";　
  }
 
}
strTemp=strTemp+"<tr><td colspan=2 align=center><font color=#666666>一共有<font color=red>"+(j-1)+"</font>种产品进行比较</font></td></tr></table>";
 }
document.getElementById("search_resultb").innerHTML = strTemp
}