function datetoday(){

// get the date information
//
var today = new Date();
var the_day = today.getDate();
var the_month = today.getMonth();

var the_year = today.getYear();
// correct for the month starting from zero
//
the_month = the_month + 1;

// create the string you want to print
//
var the_whole_date = the_month + "/" + the_day + "/" + the_year;
//
if(document.theform.joindate!=null)
    document.theform.joindate.value = the_whole_date;
}	

		function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {				// cannot be empty
				return false
			}

			for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}

			atPos = email.indexOf("@",1)	// there must be one "@" symbol
			if (atPos == -1) {
				return false
			}

			if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
				return false
			}

			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {		// and at least one "." after the "@"
				return false
			}

			if (periodPos+3 > email.length)	{ // must be at least 2 characters after the "."
				return false
			}

			return true
		}

		// Check the input is digit 0--9
		function isNum(passedVal) {			// Is this a number?
			if (passedVal == "") {
  				return false				
			}

			for (i=0; i<passedVal.length; i++) {
				if (passedVal.charAt(i) < "0") {
					return false
				}
				if (passedVal.charAt(i) > "9") {
					return false
				}
			}
			return true
		}
               // Check the input is letter A--Z, a--z
		function isLetter(passedVal) {		// Is this a number?
			if (passedVal == "") {
  				return false				
			}

			for (i=0; i<passedVal.length; i++) {
				if (passedVal.charAt(i) < "A") {
					return false
				}
				if (passedVal.charAt(i) > "z") {
					return false
				}
				if ((passedVal.charAt(i) < "a") && 
				    (passedVal.charAt(i) > "Z")) {
					return false
				}
			}
			return true
		}


		function submitIt(theform) {

			// make sure the Name valid
			if (theform.uname.value == "") {
				alert("You must enter contact person name")
				theform.uname.focus()
				return false
			}
			if (theform.company_title.value == "") {
				alert("You must enter company title")
				theform.company_title.focus()
				return false
			}
			if (theform.company_name.value == "") {
				alert("You must enter company name")
				theform.company_name.focus()
				return false
			}
			if (theform.agent.value == "") {
				alert("You must enter Accredited Agent")
				theform.agent.focus()
				return false
			}
			if (theform.owner.value == "") {
				alert("You must enter Company Owner Name")
				theform.owner.focus()
				return false
			}
				          // make sure the Phone valid
			if (theform.dphone.value == "") {
				alert("Please enter your day phone number.")
				theform.dphone.focus()
				return false
			}
			if (theform.ephone.value == "") {
				alert("Please enter your cell phone number.")
				theform.ephone.focus()
				return false
			}
			// check to see if the email's valid
			if (!validEmail(theform.email.value)) {
				alert("Invalid email address")
				theform.email.focus()
				theform.email.select()
				return false
			}
			if (theform.address.value == "") {
				alert("Please enter your address.")
				theform.address.focus()
				return false
			}
			if (theform.city.value == "") {
				alert("Please enter a city.")
				theform.city.focus()
				return false
			}
			    
			if (theform.state.value == "") {
				alert("Please enter Province Name.")
				theform.state.focus()
				return false
			}		    
			    
			if (theform.zip.value == "") {
				alert("Please enter your zip code.")
				theform.zip.focus()
				return false
			}
			if (theform.paym_type.value == "") {
				alert("Please select a card type.")
				theform.paym_type.focus()
				return false
			}
			// check to see if the num valid
			if (!isNum(theform.paym_number.value)) {
				alert("Please enter numbers")
				theform.paym_number.focus()
				theform.paym_number.select()
				return false
				} else if (theform.paym_number.value.length !==16){
				alert("Please enter correct number")
				theform.paym_number.focus()
				theform.paym_number.select()
				return false
				}
				if (theform.paym_expmonth.value == "") {
				alert("Please select a month.")
				theform.paym_expmonth.focus()
				return false
			}
			if (theform.paym_expyear.value == "") {
				alert("Please select a year.")
				theform.paym_expyear.focus()
				return false
			}
			if (theform.paym_name.value == "") {
				alert("Please enter the name on credit card.")
				theform.paym_name.focus()
				return false
			}
			// If we made it to here, everything's valid, so return true
			return true
		}


