//Create an array to hold field names.
field = new Array()
field[0] = 'firstname';
field[1] = 'lastname';
field[2] = 'title';
field[3] = 'organization';
field[4] = 'address1';
field[5] = 'city';
field[6] = 'country';
field[7] = 'phone';
field[8] = 'email';

message = new Array()
message[0] = 'First Name';
message[1] = 'Last Name';
message[2] = 'Title';
message[3] = 'Organization';
message[4] = 'Address';
message[5] = 'City';
message[6] = 'Country';
message[7] = 'Phone';
message[8] = 'Email Address';

function validateForm(){
	for(i=0;i<field.length;i++){
		newObj = eval("document.theForm."+field[i])
		if(typeof newObj != 'undefined'){
			if(newObj.type == "text"){
				if(newObj.value == ""){
					alert('You must provide your'+" "+message[i]+"."+"\n"+"It is a required field.")
					newObj.focus()
					return false
				}
			}
			if(newObj.type == "select-one" || newObj.type == "select-multiple"){
				if(newObj.value == ""){
					alert('You must provide your'+" "+message[i]+"."+"\n"+"It is a required field.")
					newObj.focus()
					return false
				}
			}
		}
	}
	checkState()
}
function checkState(){
	theCountry = document.theForm.country
	theState = document.theForm.state
	thePostalCode = document.theForm.zip
	if(typeof theCountry != 'undefined'){
		if(theCountry.value == 'USA' || theCountry.value == 'Canada'){
			if(theState.value == ''){
				alert('You must select your state or province.')
				theState.focus()
					return false;
			}
			if(thePostalCode.value == ''){
				alert('You must provide your postal code.')
				thePostalCode.focus()
					return false;
			}
		}
	}
	check_form(f)
}



