var xmlHttp;

function createXMLHttpRequest()
{
	if( window.ActiveXObject ) 
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if( window.XMLHttpRequest ) 
	{
		xmlHttp = new XMLHttpRequest();
	}
}
		
function doStart(obj)
{	
	createXMLHttpRequest();	
	var url = "email/saveemail.aspx?email="+obj.value+"&r="+Math.random();
	xmlHttp.open("get",url,true);
	xmlHttp.onreadystatechange = startCallback;
	xmlHttp.send(null);
}

function startCallback()
{
	if(xmlHttp.readyState == 4 )
	{
		if(xmlHttp.status == 200)
		{
			deal();
		}
	}			
}

function deal()
{
	var result = xmlHttp.responseText;
	var begin = result.indexOf("<begin>");
	var location=result.indexOf("</end>");
	var Count= result.substring(begin+7,location);		
	if(Count==1)
	{
		alert("邮箱地址已存在！");
	}
	else if(Count==2)
	{
		alert("订阅成功！");
	}
	else
	{
		alert("订阅失败！");
	}
}