// Start the form with the cursor in the first field in demand_letter_wda.php -- or any other form
function pointToFirstField(theField) {
// Replace field1 in the script with the field name of which you want to place the focus.
	theField.focus(theField);
}

function validateform(){

// Check for cust_name
	if(document.new_passenger.passenger_name.value=="") {
		document.new_passenger.passenger_name.focus();
		window.alert ("Please provide a name.\n\nAliases and aliens from distant galaxies also welcome!");
		return false;
	}

// Check for valid email address
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.new_passenger.passenger_email.value)){
//		return (true)

	} else {
	document.new_passenger.passenger_email.focus();
	alert("Please provide a valid E-mail Address")
	return (false)
	}

// Check for bday_yr
	if(document.new_passenger.bday_yr.value=="") {
		document.new_passenger.bday_yr.focus();
		window.alert ("Please provide a Year.");
		return false;
	}

// Check for bday_yr
	if(document.new_passenger.bday_yr.value=="0") {
		document.new_passenger.bday_yr.focus();
		window.alert ("Please provide a Year.\n\nZero is not a valid year..");
		return false;
	}

// Check for valid year number -- dcode_yr
	if(/^[0-9]{4}/.test(document.new_passenger.bday_yr.value)){
//		return (true)

	} else {
	document.new_passenger.bday_yr.focus();
	alert("Please provide a valid Year.\n\nYears must be four digits.")
	return (false)
	}

}

// Validate Year for decoder
function validatedecoder()
{
// Check for dcode_yr
	if(document.decoder.dcode_yr.value=="") {
		document.decoder.dcode_yr.focus();
		window.alert ("Please provide a Year.");
		return false;
	}

// Don't allow 0 as a year
	if(document.decoder.dcode_yr.value=="0") {
		document.decoder.dcode_yr.focus();
		window.alert ("Please provide a Year.\n\nZero is not a valid year..");
		return false;
	}

// Check for valid year number -- dcode_yr
	if(/^[0-9]{1,4}/.test(document.decoder.dcode_yr.value)){
//		return (true)

	} else {
	document.decoder.dcode_yr.focus();
	alert("Please provide a valid Year.\n\nYears must be whole numbers one to four digits long.")
	return (false)
	}
}



// Validate Suggestions form
function ValidateSuggestions()
{
// Check for dcode_yr
	if(document.suggestion.suggestion_note.value=="") {
		document.suggestion.suggestion_note.focus();
		window.alert ("Please provide a Suggestion.\n\nWe're open to whatever's on your Mind...\n\nPlease use up to 1,000 characters to express yourself.");
		return false;
	}

	if(document.suggestion.suggestion_note.value=="Type whatever you like...") {
		document.suggestion.suggestion_note.focus();
		window.alert ("Please provide a Suggestion.\n\nWe're open to whatever's on your Mind...\n\nPlease use up to 1,000 characters to express yourself.");
		return false;
	}
}

// Limit the number of chars in the text area boxes
/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function ismaxlength(obj)
{
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
}

function LoadCountDown() {
	countdown('1', "December 21, 2012 00:00:00", 0, '');
}
