function validateEmail(form)
{
	if 	(checkString(form.elements["email"],sEmail,false))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function check_state_code(form) 
{
	if (isStateCode(form.elements["state_id"].options[form.elements["state_id"].selectedIndex].value, false)) 
	{
		return true;
	} 
	else 
	{
		form.elements["state_id"].focus()
		alert ("Please select a State.");
		return false;
	}
}

function check_state_code2(form) 
{
	if (isStateCode(form.elements["state_id"].value, false)) 
	{
		return true;
	} 
	else 
	{
		form.elements["state_id"].focus()
		alert ("Please Select Your State From The Drop Down List.");
		return false;
	}
}

function check_passwords(form) 
{
	if (form.elements["password1"].value != form.elements["password2"].value) 
	{
		alert ("Your provided passwords do not match.");
		return false;
	} 
	else 
	{
		return true;
	}
}
 
function check_password_length(form) 
{
 	if (form.elements["password1"].value.length < 6) 
 	{
 		form.elements["password1"].focus()
		alert ("Your password must be at least 6 characters in length.");
		return false;
	} 
	else 
	{
		return true;
	}
}		 

function check_expiration_month(form) 
{
	var temp = isMonth(form.elements["ExpirationMonth"].options[form.elements["ExpirationMonth"].selectedIndex].value,false);
	if (temp) 
	{
		return true;
	} 
	else 
	{
		form.elements["ExpirationMonth"].focus();
		alert ("You must select an expiration month.");
		return false;
	}
}

function check_cc_type(form) 
{
	var temp = form.elements["cc_type"].options[form.elements["cc_type"].selectedIndex].value;
	if (temp != "null") 
	{
		return true;
	} 
	else 
	{
		form.elements["cc_type"].focus();
		alert ("You must select an accepted Credit Card.");
		return false;
	}
}

function check_expiration_year(form) 
{
	var temp = isYear(form.elements["ExpirationYear"].options[form.elements["ExpirationYear"].selectedIndex].value,false);
	if (temp) 
	{
		return true;
	} 
	else 
	{
		form.elements["ExpirationYear"].focus();
		alert ("You must select an expiration year.");
		return false;
	}
}

function check_cc_number(form_element) 
{
	if ( isCreditCard(form_element.value)) 
	{
		return true;
	}
	else 
	{
		form_element.focus();
		alert ("You must enter a valid credit card number.");
		return false;
	}
	
}

function validate_creditcard_information(form)
{
	if 	(
		check_cc_type(form) && 
		checkString(form.elements["cc_number"],sCreditCardNumber,false) && 
		check_cc_number(form.elements["cc_number"]) && 
		check_expiration_month(form) && 
		check_expiration_year(form)
		)
	{
		return true;	
	} 
	else 
	{
		return false;
	}

}

function validateAccountRequest(form)
{
	if 	(
		checkString(form.elements["email"],sEmail,false) &&
		checkString(form.elements["password1"],sPassword,false) &&
		checkString(form.elements["password2"],sReenterPassword,false) &&
		check_passwords(form) &&
		check_password_length(form) &&
		checkString(form.elements["firstname"],sUSFirstName) &&
		checkString(form.elements["lastname"],sUSLastName) &&
		checkString(form.elements["street"],sUSAddress) &&
		checkString(form.elements["city"],sCity) &&
		check_state_code2(form) &&
		checkZIPCode(form.elements["zipcode"]) &&
		checkUSPhone(form.elements["phone"]) &&
		checkString(form.elements["BirthYear"],sDateOfBirth) &&
		checkString(form.elements["BirthMonth"],sDateOfBirth) &&
		checkString(form.elements["BirthDay"],sDateOfBirth) &&
		checkdate(form.elements["BirthYear"], form.elements["BirthMonth"], form.elements["BirthDay"],sDateOfBirth,false) &&
		isDay(form.elements["BirthDay"].value,false)
		)
	{
		return true;
	} 
	else 
	{
		return false;
	}
}