	function isDigit(c)
	{
		var test = "" + c;
		if (test == "0" || test == "1" || test == "2" || test == "3" || test == "4" 
		|| test == "5" || test == "6" || test == "7" || test == "8" || test == "9")
		{
			return true;
		}
		return false;
	}
	function isAllDigits(s)
	{
		var test = "" + s;
		for (var k=0; k < test.length; k++)
		{
			var c = test.substring(k, k+1);
			if(isDigit(c) == false)
			{
				return false;
			}
		}
		return true;
	}
	function zipOK(zip)
	{
		if (zip.length == 5)
		{
			var result = isAllDigits(zip);
			return result;
		}
		else if (zip.length == 10)
		{
			var result = isAllDigits(zip.substring(0,5));
			if (result == true)
			{
				if (zip.substring(5,6) != "-")
				{
					result = false;
				}
				else
				{
					result = isAllDigits(zip.substring(6,10));
				}
			}
			return result;
		}
		else
		{
			return false;
		}
	}
	function ValidateForm()
	{
		var errors = "";
		/*if(document.getElementById('sub_months').value=="") {
			errors += 'Please specify the subscription duration.\n';
		}
		if(!isAllDigits(document.getElementById('sub_months').value)) {
			errors += 'Invalid characters were found in the subscription duration. Please enter a number of months.\n';
		}*/
		if(document.getElementById('card_first_name').value=="") {
			errors += 'Please specify the first name on your credit card.\n';
		}
		if(document.getElementById('card_last_name').value=="") {
			errors += 'Please specify the last name on your credit card.\n';
		}
		if(document.getElementById('card_number').value=="") {
			errors += 'Please specify your credit card number.\n';
		}
		if(document.getElementById('card_exp_month').value=="" || document.getElementById('card_exp_year').value=="") {
			errors += 'Please specify the month and year of your card\'s expiration.\n';
		}
		if(!isAllDigits(document.getElementById('card_exp_month').value)) {
			errors += 'Invalid characters were found in the card expiration month. Please use only digits.\n';
		}
		if(!isAllDigits(document.getElementById('card_exp_year').value)) {
			errors += 'Invalid characters were found in the card expiration year. Please use only digits.\n';
		}
		if(document.getElementById('csc').value=="") {
			errors += 'Please specify the card security code (CSC) for your credit card.\n';
		}
		if(!isAllDigits(document.getElementById('csc').value)) {
			errors += 'Invalid characters were found in the CSC. Please use only digits.\n';
		}
		if(document.getElementById('country_code').options[document.getElementById('country_code').selectedIndex].value=="") {
			errors += 'Please specify the billing address country for this credit card.\n';
		}
		if(document.getElementById('street').value=="") {
			errors += 'Please specify the billing street address for this credit card.\n';
		}
		if(document.getElementById('city').value=="") {
			errors += 'Please specify the billing address city for this credit card.\n';
		}
		if(document.getElementById('state').options[document.getElementById('state').selectedIndex].value=="") {
			errors += 'Please specify the billing address state for this credit card.\n';
		}
		if(document.getElementById('zip').value=="") {
			errors += 'Please specify the billing address zip code for this credit card.\n';
		}
		if(!zipOK(document.getElementById('zip').value)) {
			errors += 'The zip code provided is not in a valid format. Please use one of the formats "XXXXX" or "XXXXX-XXXX".\n';
		}
		if(document.getElementById('tc_accept').checked==false) {
			errors += 'You must accept the terms and conditions in order to sign up.\n';
		}
		if(errors != "") {
			alert("There are some problems with the information you provided:\n" + errors);
			return false;
		}

		return true;
	}
