function CheckForm( theform ) { 
	var bMissingFields = false; 
	var strFields = "";     
		if( theform.b_first.value.length < 2 ){ 
			bMissingFields = true; 
			strFields += "   * Billing: First Name\n"; } 
		if( theform.b_last.value.length < 2 ){ 
			bMissingFields = true; 
			strFields += "   * Billing: Last Name\n"; }
		if( theform.b_addr.value.length < 5 ){ 
			bMissingFields = true; 
			strFields += "   * Billing: Address\n"; }
		if( theform.b_city.value == '' ){ 
			bMissingFields = true; 
			strFields += "   * Billing: City\n";  }
		if( theform.b_state.value.length != 2 ){ //State should be a 2 letter code
			bMissingFields = true;                   //If you want to use full state names then pls change != 2 into <5
			strFields += "   * Billing: State\n"; }
		if( theform.b_zip.value.length != 5 ){ //validate postalcode - invalid if entry is <> 6
			bMissingFields = true; 
			strFields += "   * Billing: Zip\n"; }
		if( theform.b_phone.value.length != 12 ){ //validate phone number - invalid if entry is <> 12 digits
			bMissingFields = true; 
			strFields += "   * Billing: Phone\n"; }
		if( theform.b_email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1 ){ //validate email
			bMissingFields = true; 
			strFields += "   * Billing: Email\n"; }
		if( bMissingFields ) { 
			alert( "I'm sorry, but you must provide the\nfollowing field(s) before continuing:\n\n" + strFields +"\nPlease check the field(s) for completeness\nand accuracy, then resubmit your order." ); 
    	return false; }
   	return true; }

function PayPalPass() { 
document.ppform.amount.value = document.infoform.amount.value;
document.ppform.last_name.value = document.infoform.b_last.value; 
document.ppform.first_name.value = document.infoform.b_first.value; 
document.ppform.address1.value = document.infoform.b_addr.value;
document.ppform.address2.value = document.infoform.b_addr2.value;
document.ppform.city.value = document.infoform.b_city.value;
document.ppform.state.value = document.infoform.b_state.value; 
document.ppform.zip.value = document.infoform.b_zip.value;
document.ppform.email.value = document.infoform.b_email.value;
document.ppform.item_name.value = document.infoform.item_name.value;
} //End PayPal pass variables

function emailsubmit() {
	document.ppform.submit();
	document.infoform.submit();
}

function validate1(form) {
  if (form.ADDITIONALINFO1.selectedIndex == 0) {
    alert('Please make a selection!');
    return false;
  }
  return true;
}

function validate2(form) {
  if (form.ADDITIONALINFO1.selectedIndex == 0 || form.ADDITIONALINFO2.selectedIndex == 0) {
    alert('Please make a selection!');
    return false;
  }
  return true;
}

function validate3(form) {
  if (form.ADDITIONALINFO1.selectedIndex == 0 || form.ADDITIONALINFO2.selectedIndex == 0 || form.ADDITIONALINFO3.selectedIndex == 0) {
    alert('Please make a selection!');
    return false;
  }
  return true;
}

function validate4(form) {
  if (form.ADDITIONALINFO1.selectedIndex == 0 || form.ADDITIONALINFO2.selectedIndex == 0 || form.ADDITIONALINFO3.selectedIndex == 0 || form.ADDITIONALINFO4.selectedIndex == 0) {
    alert('Please make a selection!');
    return false;
  }
  return true;
}

function validate5(form) {
  if (form.ADDITIONALINFO1.selectedIndex == 0 || form.ADDITIONALINFO2.selectedIndex == 0 || form.ADDITIONALINFO3.selectedIndex == 0 || form.ADDITIONALINFO4.selectedIndex == 0 || form.ADDITIONALINFO5.selectedIndex == 0) {
    alert('Please make a selection!');
    return false;
  }
  return true;
}

function newQty() {
	location.href=location.href;
}

function emptyCart() {
	if ( confirm("This will remove all items from your cart.\nAre you sure you want to do this?\n\nClick 'OK' to proceed or 'Cancel' to escape:") ) {
		SetCookie('PFANumberOrdered', 0, null, '/');
		location.href=location.href;
	}
}
