﻿// JScript 文件
function GetXmlHttp()
{
    var A=null; 
    try
     { 
	    A=new ActiveXObject("Msxml2.XMLHTTP"); 
     }
    catch(e)    
    { 
	    try
	    { 
		    A=new ActiveXObject("Microsoft.XMLHTTP"); 
	    }
	    catch(oc)
	    { 
			A=null;
    	}
    } 
	if ( !A && typeof XMLHttpRequest != "undefined" )
	{ 
	 	A=new XMLHttpRequest() ;
    } 
    return A ;
}


//检测邮箱
    function validateEmail(str)
    {  
         var patn = /^\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,6}$/;
        if(patn.test(str))
        {
            return true;
        }
        else
        {
            return false; //incorrect format
        }
    }       
        
function AddPuMailgroup(UserMail)
{
    var xmlhttp = GetXmlHttp();
    if(xmlhttp==null) return;
    xmlhttp.open("GET","/ajax.aspx?umail="+escape(UserMail)+"&type=mailgroup",true,null);
    xmlhttp.onreadystatechange=function()
    {
	    if(xmlhttp.readyState==4&&xmlhttp.status==200)
	    {
	        if(parseInt(xmlhttp.responseXML.getElementsByTagName("num")[0].firstChild.nodeValue,2)!=0)
	        {
	            alert("You have joined IPS email group successfully, thank you!");
	            UserMail.value ="";
	        }
	        else
	        {
	            alert("Sorry, your requset has failed, please try again later!");
	        }
	    }
	}
	xmlhttp.send (null);
} 

  
