function FormValidate(o)
{
	if (o.username.value == "") {alert("Create a username."); o.username.select(); return false;}
	if (o.password.value == "") {alert("Enter your password."); o.password.select(); return false;}
	if (o.firstName.value == "") {alert("Enter your first name."); o.firstName.select(); return false;}
	if (o.lastName.value == "") {alert("Enter your last name."); o.lastName.select(); return false;}
	if (o.email.value == "") {alert("Enter your email address."); o.email.select(); return false;}
	if (o.birthDate[0].options[o.birthDate[0].selectedIndex].value == "0") {alert("Select the month your were born."); o.birthDate[0].focus(); return false;}
	if (o.birthDate[1].options[o.birthDate[1].selectedIndex].value == "0") {alert("Select the day your were born."); o.birthDate[1].focus(); return false;}
	if (o.birthDate[2].options[o.birthDate[2].selectedIndex].value == "0") {alert("Select the year your were born."); o.birthDate[2].focus(); return false;}
	if (o.gender[0].checked == false && o.gender[1].checked == false) {alert("Select your gender."); o.gender[0].focus(); return false;}
	if (o.country.options[o.country.selectedIndex].value == "0") {alert("Select a country."); o.country.focus(); return false;}
	if (o.state.options[o.state.selectedIndex].value == "0") {alert("Select a state."); o.state.focus(); return false;}
	if (o.city.options[o.city.selectedIndex].text == "") {alert("Select a city."); o.city.focus(); return false;}
	if (o.agree.checked == false) {alert("You must agree to the 'Terms of Use' and 'Privacy Policy'."); o.agree.focus(); return false;}
	if (o.secCode != null) {if (o.secCode.value == "" || o.secCode.value == "Type code here...") {alert("Enter the security code."); o.secCode.focus(); return false;}}
	return true;
}

function InfoBoxHide()
{
	var o = document.getElementById("infoBox");
	o.style.display = "none";
}

function InfoBoxLoad(i)
{
	var o = document.getElementById("infoBox");
	o.style.display = "block";
	
	if (i == 0)
		o.innerHTML = "<div>Your Username</div><ul><li>Your username is also known as your <span>display name</span> as it will be displayed to the public.</li><li>Do not use your email address here.</li><li>Your username CANNOT be changed later.</li></ul>";
	else if (i == 1)
		o.innerHTML = "<div>Your Password</div><ul><li>Your password is not case sensitive (<span>WashingtonDC</span> is the same as <span>washingtondc</span>).</li><li>Only letters (<span>a-z</span>), numbers (<span>0-9</span>), underscores (<span>_</span>), and dashes (<span>-</span>) are permitted in your password.</li></ul>";
	else if (i == 2)
		o.innerHTML = "<div>Your Real Name</div><ul><li>Entering your real name increases the likelihood that emails will not be delivered to your spam folder.</li><li>We will NEVER send you unsolicited email (spam). Members have complete control over what types of emails they want to receive.</li></ul>";
	else if (i == 3)
		o.innerHTML = "<div>Your Email Address</div><ul><li>Until your email has been verified, you will be unable to use most of the site features.</li><li>We will email you instructions to verify your email address. All members are required to verify their email address.</li><li>We will NEVER send you unsolicited email (spam).</li></ul>";
	else if (i == 4)
		o.innerHTML = "<div>Your Birthday</div><ul><li>Your age in years (<em>example:</em> <span>25-years</span>) will be displayed to the public.</li><li>Your actual birth date (<em>example:</em> <span>July 4th, 1976</span>) will be hidden from the public by default.</li></ul>";
	else if (i == 5)
		o.innerHTML = "<div>Your Location</div><ul><li>Selecting your correct location allows your friends to find you.</li><li>We do not collect, nor ask for your mailing address. Your country, state and city are the only fields displayed to the public.</li></ul>";
}

function UsernameAvailable(o)
{
	if (o.value != "")
	{
		var x = AjaxGet("http://dork.com/join/username/?u=" + escape(o.value), false, true);
		
		if (x.toLowerCase() == "true")
		{
			alert("The username you have entered is already taken. Please enter a different username.");
			o.select();
		}
		else
		{
			alert("The username you have entered is available.");
			document.getElementById("checkAvail").style.display = "none";
		}
	}
}

function UsernameAvailableButton(u, b)
{
	b.style.display = (u.value == "") ? "none" : "inline";
}
