// JavaScript Document

var xmlHttpSus

function suscribir() //up, down
{  	
	
	var email=document.getElementById("email_suscripcion").value			
	
	if ((email.indexOf(".") > 2) && (email.indexOf("@") > 0)) {
				
		xmlHttpSus=GetXmlHttpObjectSus()
		if (xmlHttpSus==null)
		 {
			alert ("Browser does not support HTTP Request")
			return
		 }
		 
		var url="suscripciones.php"
		url=url+"?email="+email		
		url=url+"&sid="+Math.random()
		//alert(url);
		xmlHttpSus.onreadystatechange=stateChangedSus	
		xmlHttpSus.open("GET",url,true)
		xmlHttpSus.send(null)

		document.getElementById("email_suscripcion").value=""	
		return (true)

	} else {
		alert("La dirección de email es incorrecta.")
		document.getElementById("email_suscripcion").value=""
		return (false)
	}
}


function stateChangedSus() 
{ 		
	
	if (xmlHttpSus.readyState==4 || xmlHttpSus.readyState=="complete")
	{ 		 		
	 	alert (xmlHttpSus.responseText);
	}
}

function GetXmlHttpObjectSus()
{
	var xmlHttp=null;
	try
	 {
		 // Firefox, Opera 8.0+, Safari
		 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
		 try
		  {
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		 catch (e)
		  {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
	 }
	return xmlHttp;
}