


// contact.php
function contactForm() {
		
		
		var warningText = "Please complete the following information:\n"
		var warningTrack = 0
		selectWhichField = ""
		if (document.theForm.contact_name.value == "")	{
			warningText += "Your Name\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.contact_name	}
		}
		if (document.theForm.email.value == "")	{
			warningText += "Email Address\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.email	}
		}
		if (document.theForm.comments.value == "")	{
			warningText += "Comments\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.comments	}
		}


		if (warningTrack>0)	{
			alert(warningText)
			
			// it will only be "" if How did you hear about us? was not checked
			if (selectWhichField != "") {
				selectWhichField.select()
			}
				
		}	else	{
			//now, submit the form
			document.theForm.submit()
		}
		return true	// needed to make it not display an error in Netscape
		
}


// cart.php
function changeQty() {
	//numbersOnly(this.name,this.value,form.name)
	for (var i=0; i<document.theForm.length; i++) {
		var thisLine = document.theForm.elements[i]
		if (thisLine.type == "text") {
			numbersOnly(thisLine.name,thisLine.value,document.theForm.name)
		}
	}
	
	document.theForm.submit()
}

// cart.php
function removeItem(getSKU)	{
	if(confirm("Are you certain that you want to remove this item?"))	{
		document.theCart.whichLineItem.value = getSKU
		document.theCart.formType.value = "remove"
		document.theCart.submit()
	}
}


// cart.php
function changeCart() {
	document.theCart.submit()
}

// cart.php
function goToCheckOut() {
	// don't submit the form, since we don't allow changing quantities anymore (except to remove)
	
	document.theCart.goto_orderform.value = "yes"
	document.theCart.submit()
}

// customize.php
function signupForm() {
	alert("test mode")
}

// orderform.php - this was moved to the page to allow for PHP integration
function submitOrder_MOVED_TO_PAGE() {
	
		var warningText = "Please complete the following information:\n"
		var warningTrack = 0
		selectWhichField = ""
		if (document.theForm.fname.value == "")	{
			warningText += "First Name\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.fname	}
		}
		if (document.theForm.lname.value == "")	{
			warningText += "Last Name\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.lname	}
		}
		if (document.theForm.street.value == "")	{
			warningText += "Street\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.street	}
		}
		if (document.theForm.city.value == "")	{
			warningText += "City\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.city	}
		}
		if (document.theForm.state.selectedIndex == 0)	{
			warningText += "State\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.state	}
		}
		//
		//if (document.theForm.country.selectedIndex == 0)	{
		//	warningText += "Country\n"
		//	warningTrack++
		//	if (selectWhichField == "") {	selectWhichField = document.theForm.country	}
		//}
		
		if (document.theForm.zip.value == "")	{
			warningText += "ZIP Code\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.zip	}
		}
		if (document.theForm.phone.value == "")	{
			warningText += "Phone number\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.phone	}
		}

		if (document.theForm.email.value == "")	{
			warningText += "Email Address\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.email	}
		}
		
		// THESE ORDERS ARE ONLY FOR AUSTIN, THIS IS NOT NEEDED
		// if (document.theForm.ship_city.value == "") {
		// 	document.theForm.ship_state.selectedIndex = 0
		// }
		
		
		// check the ZIP code
		var delivery_zip = document.theForm.ship_zip
		if (delivery_zip.value == "") {
			delivery_zip = document.theForm.zip
		}
		
		if (checkZIP(delivery_zip.value) == "no") {
			warningText += "The delivery ZIP Code is outside our current delivery area\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = delivery_zip	}
		}
		


		if (warningTrack>0)	{
			alert(warningText)
			
			// it will only be "" if How did you hear about us? was not checked
			if (selectWhichField != "") {
				selectWhichField.focus()
			}
				
		}	else	{
			//now, submit the form
			document.theForm.submit()
		}
		return true	// needed to make it not display an error in Netscape
}


// orderform.php
function registerForm() {
	
		var warningText = "Please complete the following information:\n"
		var warningTrack = 0
		selectWhichField = ""
		if (document.theForm.fname.value == "")	{
			warningText += "First Name\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.fname	}
		}
		if (document.theForm.lname.value == "")	{
			warningText += "Last Name\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.lname	}
		}
		if (document.theForm.street.value == "")	{
			warningText += "Street\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.street	}
		}
		if (document.theForm.city.value == "")	{
			warningText += "City\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.city	}
		}
		if (document.theForm.state.selectedIndex == 0)	{
			warningText += "State\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.state	}
		}
		
		if (document.theForm.zip.value == "")	{
			warningText += "ZIP Code\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.zip	}
		}
		if (document.theForm.phone.value == "")	{
			warningText += "Phone number\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.phone	}
		}

		if (document.theForm.email.value == "")	{
			warningText += "Email Address\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.email	}
		}
		

		if (document.theForm.pass.value == "") {
				warningText += "Password\n"
				warningTrack++
				if (selectWhichField == "") {	selectWhichField = document.theForm.pass	}
		}	else	{
			if (document.theForm.pass.value != document.theForm.verify_pass.value) {
				warningText += "Password and Verify Password do not match\n"
				warningTrack++
				document.theForm.verify_pass.value = ""
				document.theForm.pass.value = ""
				if (selectWhichField == "") {	selectWhichField = document.theForm.pass	}
			}
		
		}
		

		if (warningTrack>0)	{
			alert(warningText)
			
			// it will only be "" if How did you hear about us? was not checked
			if (selectWhichField != "") {
				selectWhichField.focus()
			}
				
		}	else	{
			//now, submit the form
			document.theForm.submit()
		}
		return true	// needed to make it not display an error in Netscape
}



// cust_repeat.php
function addRepeats() {
	document.theCart.action = "cust_repeat-add.php"
	document.theCart.submit()
}



// payment.php
function submitPayment() {
		
		// remove dashes from the credit card number 
		numbersOnly_no_decimal(document.theForm.card_accountNumber.name,document.theForm.card_accountNumber.value,document.theForm.name)
		
		var warningText = "Please complete the following information:\n"
		var warningTrack = 0
		selectWhichField = ""
		if (document.theForm.card_accountNumber.value == "")	{
			warningText += "Credit Card Number\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.card_accountNumber	}
		}
		if (document.theForm.card_cvNumber.value == "")	{
			warningText += "Security Code\n"
			warningTrack++
			if (selectWhichField == "") {	selectWhichField = document.theForm.card_cvNumber	}
		}


		if (warningTrack>0)	{
			alert(warningText)
			
			// it will only be "" if How did you hear about us? was not checked
			if (selectWhichField != "") {
				selectWhichField.select()
			}
				
		}	else	{
			//now, submit the form
			document.theForm.submit()
		}
		return true	// needed to make it not display an error in Netscape
		
}


