function signup()
{	
	//EMAIL VALIDATION
	var goodEmail 	= $F("emailnews").match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	apos		= $F("emailnews").indexOf("@");
	dotpos		= $F("emailnews").lastIndexOf(".");
	lastpos		= $F("emailnews").length-1;
	var badEmail 	= (apos<1 || dotpos-apos<2 || lastpos-dotpos<2);

    if (($F("emailnews") == "") || (!goodEmail && badEmail))		
	{
		alert("Please enter a valid email");
		$("emailnews").focus();
		return false;
	}
	//YOU MAY WANT TO CHANGE THE URL IN THE LINE BELOW
	var url = "http://www.123vendors.com/common/newsletter/optIn.asp";
	var params='emailnews='+$F("emailnews");
	new Ajax.Request(url, {onComplete:showResponse, onException:showException, onFailure:showException, asynchronous:true, method:"post", evalScripts:false, postBody:params});
//	$("submit").hide();
	$("loading").show();

	function showResponse(req)
	{	
		if (req.responseText=="1" || req.responseText=="0")	//1. added to contacts	//2.already in contacts
		{
			$("loading").hide();
			$("okmessage").show();
//			$("submit").hide();
			$("emailnews").hide();
			$("emailsub").hide();
			$("submitbox").hide();
		}
		if (req.responseText=="error")	
		{
			alert("An error has occured. Please try again.");
			$("loading").hide();
			$("okmessage").hide();
//			$("submit").show();
			
		}
	}
	function showException()
	{
		alert("Error occured while talking to the server. Please try again.");
		$("loading").hide();
		$("okmessage").hide();
//		$("submit").show();
		$("emailnews").clear();
	}
}

