function doRequest(email)
{
var AjaxRequest;
	try
	{
		// Firefox, Opera 8.0+, Safari
		AjaxRequest=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			AjaxRequest=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				AjaxRequest=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Disable contact us form somehow
				return false;
			}
		}
	}
	AjaxRequest.onreadystatechange=function()
	{
		if(AjaxRequest.readyState==4)
		{
			DisplaySent();
		}
	}

	var params="required=&email=" + encodeURIComponent(email); 
	params=params+"&SourceURL=" + encodeURIComponent(document.URL);
	AjaxRequest.open("POST","http://funnelback.com/maillist.cgi",true);
	AjaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	AjaxRequest.setRequestHeader("Content-length", params.length);
	AjaxRequest.setRequestHeader("Connection", "close");
	AjaxRequest.send(params);
}

function DisplaySending(){
}

function DisplaySent(){
//	alert("Sent");
//	document.getElementById("maillist").innerHTML="Request recieved, you will be added to the list soon.";
	alert("Request recieved, you will be added to the list soon.");
}

function emailPrompt(){
	var email=prompt("Enter your email address to subscribe to our Mailing List: ");
	if (email != null && email != ""){
	//	if (validate_email(email, "Not a valid e-mail address!")==false){
	//		return false;
	//	}
	//	alert("jim");
		doRequest(email);
		DisplaySending();
	}
}

// Thank you w3schools.com
function validate_email(field,alerttxt)
{
		var apos=value.indexOf("@");
		var dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
		{alert(alerttxt);return false;}
		else {return true;}
}
