// THIS IS FOR THE REG.PHP PAGE *****************

function validateThis(item) { 

        if(item.first.value == "") {

                alert("Please enter your first name.");

                item.first.focus();

                return false;

        }

		if(item.last.value == "") {

                alert("Please enter your last name.");

                item.last.focus();

                return false;

        }

		var nEmail = item.email.value;      

        if(nEmail == "") {

                alert("Please enter your current email address. We may need to email you about important updates to our service. PackagePickup.com respects your privacy and will not share or abuse your email address.");

                item.email.focus();

                return false;

        } else {

			if( (nEmail.indexOf('@') == -1) || (nEmail.indexOf('.') == -1) || (nEmail.indexOf('@') == 0) ) {

				alert("This is not a valid email address");	

				item.email.focus();	

				return false;

			}

		}

		if(item.company.value == "") {

                alert("Please enter the company you work for. This only helps us to know which companies our service is popular with.");

                item.company.focus();

                return false;

        }

		if(item.cell_number_1.value == "") {

                alert("Please enter your 10 digit cell phone number.");

                item.cell_number_1.focus();

                return false;

        } 

		if(item.cell_number_2.value == "") {

                alert("Please enter your 10 digit cell phone number.");

                item.cell_number_2.focus();

                return false;

        } 

		if(item.cell_number_3.value == "") {

                alert("Please enter your 10 digit cell phone number.");

                item.cell_number_3.focus();

                return false;

        } 

		if(document.form1.cell_provider.selectedIndex == 0) {

                alert("Please choose the service provider for your cell phone.");

                item.cell_provider.focus();

                return false;

        } 

 		if(item.selected_email.value == "") {

                alert("Please choose a User Name. This will be the name you give your customers if you want to receive messages from them.");

                item.selected_email.focus();

                return false;

        } 

 		if(item.login.value == "") {

                alert("Please choose a PackagePickup.com login name.");

                item.login.focus();

                return false;

        }

		if(item.pass.value == "") {

                alert("Please choose a login password.");

                item.pass.focus();

                return false;

        }

	return true;    

}



// THIS IS FOR THE LOGIN PAGE *************************

function validateLogin(item) { 

alert("u");

		if(item.login.value == "") {

                alert("Please enter your PackagePickup.com login name.");

                item.login.focus();

                return false;

        }

		if(item.pass.value == "") {

                alert("Please enter your login password.");

                item.pass.focus();

                return false;

        }		   

	return true;    

}









// THIS VALIDATES THE LOGIN ON THE CHECKOUT PAGE *********************

function validateLogin(item) { 

	var nEmail = item.email.value; 	 			     

        if(nEmail == "") {

                alert("Please enter an email address");

                item.email.focus();

                return false;

        } else {

			if( (nEmail.indexOf('@') == -1) || (nEmail.indexOf('.') == -1) || (nEmail.indexOf('@') == 0) ) {

				alert("This is not a valid email address");	

				item.email.focus();	

				return false;

			}

		}   

        if(item.pass2.value == "") {

                alert("Please enter your password");

                item.pass2.focus();

                return false;

        }			 

	return true;    

}



// THIS VALIDATES THE PAGE WHERE ARE CUSTOMER INFO IS ENTERED ******************

function validateInfo(item) { 

	var pass = item.pass.value;

	var nEmail = item.email.value; 

        if(item.first.value == "") {

                alert("Please enter your first name");

                item.first.focus();

                return false;

        }	

        if(item.last.value == "") {

                alert("Please enter your last name");

                item.last.focus();

                return false;

        }			

        if(nEmail == "") {

                alert("Please enter an email address");

                item.email.focus();

                return false;

        } else {

			if( (nEmail.indexOf('@') == -1) || (nEmail.indexOf('.') == -1) || (nEmail.indexOf('@') == 0) ) {

				alert("This is not a valid email address");	

				item.email.focus();	

				return false;

			}

		} 

        if(item.street.value == "") {

                alert("Please enter the street address");

                item.street.focus();

                return false;

        }			

        if(item.city.value == "") {

                alert("Please enter your city");

                item.city.focus();

                return false;

        }			

        if(item.state.value == "") {

                alert("Please enter your state");

                item.state.focus();

                return false;

        }			 	

        if(item.zip.value == "") {

                alert("Please enter your zip");

                item.zip.focus();

                return false;

        }				

        if(item.phone.value == "") {

                alert("Please enter your phone number");

                item.phone.focus();

                return false;

        }			

        if(item.pass.value == "") {

                alert("Please enter your password");

                item.pass.focus();

                return false;

        }		 			     

  

	return true;    

}



// THIS VALIDATES THE PAGE chng_add.php ******************

function validateChange(item) { 

        if(item.first_form.value == "") {

                alert("Please enter your first name");

                item.first_form.focus();

                return false;

        }	

        if(item.last_form.value == "") {

                alert("Please enter your last name");

                item.last_form.focus();

                return false;

        }			

        if(item.street_form.value == "") {

                alert("Please enter the street address");

                item.street_form.focus();

                return false;

        }			

        if(item.city_form.value == "") {

                alert("Please enter your city");

                item.city_form.focus();

                return false;

        }			

        if(item.state_form.value == "") {

                alert("Please enter your state");

                item.state_form.focus();

                return false;

        }			 	

        if(item.zip_form.value == "") {

                alert("Please enter your zip");

                item.zip_form.focus();

                return false;

        }

	return true;    

}



function submitForm(subNum,theAction) {

	if (subNum == 1) {

		document.form1.action = theAction;

		document.form1.submit();

	} 

	if (subNum == 2) {

		document.form2.action = theAction;

		document.form2.submit();

	} 

	if (subNum == 3) {

		document.form3.action = theAction;

		document.form3.submit();

	} 

	if (subNum == 4) {

		document.form4.action = theAction;

		document.form4.submit();

	} 

	if (subNum == 5) {

		document.form5.action = theAction;

		document.form5.submit();

	} 			

	if (subNum == 6) {

		document.form6.action = theAction;

		document.form6.submit();

	} 

	if (subNum == 7) {

		document.form7.action = theAction;

		document.form7.submit();

	} 

	if (subNum == 8) {

		document.form8.action = theAction;

		document.form8.submit();

	} 

	if (subNum == 9) {

		document.form9.action = theAction;

		document.form9.submit();

	} 					

	if (subNum == 10) {

		document.form10.action = theAction;

		document.form10.submit();

	} 	

}



// THIS VALIDATES THE PAGE client_send.php ******************

WhichSubmit=0;
function validateClientSend(item) { 

        if(item.name.value == "") {
		
				alert("Please enter your First Name.  It's sent with your message, showing the driver who the message is from.");
				
				item.name.focus();
				
				return false;
				
		}
		
		if(item.company.value == "") {

                alert("Please enter your Company Name. It's sent with your message, showing the driver who the message is from.");

                item.company.focus();

                return false;

        }	

        if(item.address.value == "") {

                alert("Please enter your Street Address. It's sent with your message, giving the driver your location.");

                item.address.focus();

                return false;

        }			

        if(item.close.value == "") {

                alert("Please enter your Company Close Time. It's sent with your message, showing the driver what time your company closes.");

                item.close.focus();

                return false;

        }	
		
		if(item.phone1.value == "") {

                alert("Please enter your Phone Number. This will allow the driver to call or text you back if need be.");

                item.phone1.focus();

                return false;

        }			

        if(item.driverE.value == "") {

                alert("Please enter your driver's User Name. You must know his/her User Name to be able to send them messages.");

                item.driverE.focus();

                return false;

        }
        
        if (WhichSubmit != 5) {  // any submit button other than 5
          Message3=item.message_other3.value;
          if (Message3 != '') {  // custom text was entered
            ConfirmMessage="The Custom Message text you entered will NOT be sent with the message you clicked on. To send only the message you clicked on, click OK. To send a Custom Message, click CANCEL and then send a Custom Message."
            Confirmed=confirm(ConfirmMessage);
            if (!Confirmed) { return false; }
          }
        }
        if (WhichSubmit == 1) {  // NO PICKUP NEEDED TODAY, thanks!
          ConfirmMessage="You chose 'NO PICKUP NEEDED TODAY'. Sending this message will cancel your pickup for today. Please only send this message if you will definitely NOT be needing a pickup today. If you want to send this message, click OK."
          Confirmed=confirm(ConfirmMessage);
          if (!Confirmed) { return false; }
        }
        if (WhichSubmit == 2) {  // WE NEED A PICKUP TODAY, it is ready now.
          ConfirmMessage="You chose 'WE NEED A PICKUP TODAY'. If you send this message now, your driver may show up earlier than usual, possibly right away. Please only send this message once you are done processing your packages and will not have anything else to ship today. If you want to send this message, click OK."
          Confirmed=confirm(ConfirmMessage);
          if (!Confirmed) { return false; }
        }
        if (WhichSubmit == 3) {  // MORE THAN USUAL, save room or call for backup!
          ConfirmMessage="You chose 'MORE THAN USUAL'. Sending this message may result in an additional driver showing up to make your pickup today. Please only send this message if you know you have more packages than your regular driver can take. If you want to send this message, click OK."
          Confirmed=confirm(ConfirmMessage);
          if (!Confirmed) { return false; }
        }
        if (WhichSubmit == 4) {  // NOT ON SCHEDULE, please give us an extra 10 minutes.
          ConfirmMessage="You chose 'BRING YOUR HAND CART'. Most drivers have a hand cart they can bring. Sending this message will let them know they need it today. If you want to send this message, click OK."
          Confirmed=confirm(ConfirmMessage);
          if (!Confirmed) { return false; }
        }
        if (WhichSubmit == 5) {  // Send Custom Message Above
          Message3=item.message_other3.value;
          if (Message3 == '') {
            alert("Please click on a message to send, or enter a custom message to send.");
            item.message_other3.focus();
            return false;
          }
          ConfirmMessage="You chose to send a 'CUSTOM MESSAGE'. This may be a good option, but could lead to abuse of our service. Please be curtious and understand that your driver may not be able to accomidate your request. If you want to send this message, click OK."
          Confirmed=confirm(ConfirmMessage);
          if (!Confirmed) { return false; }
        }
		  
return true;    

}