function showform(theForm,a,b)
{
	// THIS FUNCTION SHOWS YOU WHAT A FORM ACTUALLY CONTAINS.
	// THE PARAMETER A ALLOW YOU TO ADD SOME MORE MEANINGFULL INFORMATION, LIKE WHAT FUNCTION YOU ARE IN.
	var txt = "Form name: " + theForm.name + "\r\n";
	txt += "theForm.elements.length = "+theForm.elements.length+"\r\n";
	for (var i=0; i<theForm.elements.length; i++)
		txt += theForm.elements[i].name + " = " + theForm.elements[i].value + "\r\n";
	txt += "a: "+a+"\r\n";
	txt += "b: "+b+"\r\n";
	alert(txt);
}
function echeck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	   return(true);
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		return(true);
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		return(true);
	if (str.indexOf(at,(lat+1))!=-1)
		return(true);
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		return(true);
	if (str.indexOf(dot,(lat+2))==-1)
		return(true);
	if (str.indexOf(" ")!=-1)
		return(true);
	return (false);					
}
function js_start(theForm)
{
	showform(theForm, "js_start", 0);	
	// THIS IS JUST TO SHOW YOU HOW THE FORM LOOKS LIKE!  THE "0" IS TO DISPLAY SOME OTHER PARAMETER, IF WE NEED TO
	// WE CHECK IF THE EMAIL IS BLANK.  IF SO, WE GO BACK
	var x = theForm.elements['email1'];
	email1 = x.value;
	if (echeck(email1))	// DON'T DO ANYTHING UNTIL A VALID EMAIL IS ENTERED
	{
		x.focus();
		return(true);
	}
	email2 = theForm.elements['email2'].value;
	email3 = theForm.elements['email3'].value;
	// THIS IS THE AJAX CALL
	sajax_target_id = 'main'; // THIS IS THE ID OF THE CELL WE ARE GOING TO UPDATE
	x_p_start(email1,email2,email3); // THIS IS THE AJAX CALL ITSELF
	sajax_target_id = ''; // RESET THE TARGET TO NULL
}
function js_show_html()
{
	sajax_target_id = 'main';
	x_p_show_html();
	sajax_target_id = '';
}
function js_send_news()
{
	sajax_target_id = 'main';
	x_p_send_news();
	sajax_target_id = '';
}

