 function getHttpRequestObject(handler) {
   // 建立XMLHttpRequest对象
  // 建立XMLHttpRequest对象
var httpRequest = false;
try {
httpRequest=new XMLHttpRequest;
}
catch(e) {
try {
httpRequest=new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e2) {
try {
httpRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e3) {
httpRequest=false;
}
}
}
if (!httpRequest) {
alert("XMLHttpRequest init Failed!");
}
     
   httpRequest.onreadystatechange = handler;
   return httpRequest;
}
function makeRequest(httpRequest, url) {
   httpRequest.open("GET", url, true); // 打开
   httpRequest.send(null);             // 发送
}
var xmlHttp;
// 发送HTTP请求来验证用户名称
function validateUser(name) {
   var str=""; 
   var ids = document.getElementsByName(name);  
   var arr = new Array(); 
   for (var i = 0; i < ids.length; i++)    
    {          
           if(ids[i].checked == true)   
         {   
              str=str+ids[i].value+",";  
         }   
         
   }   
   str=str.substring(0,str.length-1);
   xmlHttp = getHttpRequestObject(showUser);
   if ( xmlHttp != null ) 
   {
      var url = "yxpd.asp";  // 建立URL网址
      url = url + "?user=" + str;
      randNo = parseInt(Math.random()*999999999);
      // 新增随机数避免缓冲区问题
      url = url + "&rand=" + randNo;      
      makeRequest(xmlHttp, url); // 建立HTTP请求
   }
   else 
   {
      alert ("错误! 浏览程序不支持XMLHttpRequest对象!");
      return;
   }
}
// 显示用户是否已经存在
function showUser() {
	mailsubject=document.getElementsByName("mailsubject")
	var result=document.getElementById("result");
	result.style.display="block";
   if ( xmlHttp.readyState == 4 ) {
      // 获取响应
      var xmlResult = xmlHttp.responseXML;
      var str = xmlResult.getElementsByTagName("msg")[0];
	  var  str1=str.childNodes[0].nodeValue;
      var str3 = "|";
	  var s = str3.indexOf(str1); 
if(s<0)
{
	if (str1=="错误!")
	{loading();
		document.getElementById("result").innerHTML="<table   border=1 cellpadding=0 cellspacing=0 ><tr><td valign=middle bordercolor=#FFFFFF bgcolor=#FFFFFF><img src='../../images/websen.gif' width=16 height=16><font color=#FF0000><strong><a href='javascript:location.reload();'>错误！没有选择会员序号！</a>&nbsp;</strong></font></td></tr></table>";
		}
		else{
	  	arrInfo=str1.split("|");
		setTimeout(txt,5000) 
		      function txt()
			  {  for (i=0 ; i<arrInfo.length-1;i++)
		          { document.getElementById(arrInfo[i]).innerHTML="邮件发送成功!";
		          }
              }
         for (i=0 ; i<arrInfo.length-1;i++)
		 {
		     document.getElementById(arrInfo[i]).innerHTML=""
			 document.getElementById(arrInfo[i]).innerHTML="<img src='../../images/loading.gif' width=18 height=18>";
			 }
		 }
}
else
{} }}





