/*****************************************************************************************************
* Easy Javascript Validation by Daniel Boorn
* http://dboorn.com/javascript_form_validation.php?catID=69
* Copyright 2006, All Rights reserved by Daniel Boorn
* Contact: daniel.boorn@gmail.com - wwww.dboorn.com
* In any form element add the following form attributes to validate
* required ="yes"
* validate = { "int", "float", "text", "email" }
* message = "Error Message for Element"
* Example: <input type="text" validate="int" message="Please enter valid zip code" name="zip">
*
* It is required that you add the following to any submit button
*     onClick="validate(this.form); return document.formSubmit;"

Step 1:
Create form and add form element with additional attributes in element tag.
required="yes" validate="email" message="Please enter a valid email address."
Where:
required = form field is required
validate = type of validation required { "email" or "int" or "float" or "text" }
message = message to be displayed "error message to alert"

Step 2:
Add the following onClick event to your submit button in your HTML form.
onClick="validate(this.form); return document.formSubmit;"
******************************************************************************************************/

	// Validator Object
    var valid = new Object();

	// REGEX Elements

	// matches zip codes
	valid.zipCode = /\d{5}(-\d{4})?/;

	// matches $17.23 or $14,281,545.45 or ...
	valid.Currency = /\$\d{1,3}(,\d{3})*\.\d{2}/;

	// matches 5:04 or 12:34 but not 75:83
	valid.Time = /^([1-9]|1[0-2]):[0-5]\d$/;

	//matches email
	valid.emailAddress = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;

	// matches phone ###-###-####
	valid.phoneNumber = /^\(?\d{3}\)?\s|-\d{3}-\d{4}$/;

	// International Phone Number
	valid.phoneNumberInternational = /^\d(\d|-){7,20}/;

	// IP Address
	valid.ipAddress = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;

	// Date xx/xx/xxxx
	valid.Date = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;

	// State Abbreviation
	valid.State = /^(AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NB|NC|ND|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VT|WA|WI|WV|WY)$/i;

	// Social Security Number
	valid.SSN = /^\d{3}\-\d{2}\-\d{4}$/;

	// CC Date xx/xx/xxxx
	valid.ccDate = /^\d{2}(\-|\/|\.)\d{2}$/;

	// Simple CC no xxxxxxxxxxxxxxxx (9-16)
	valid.SimpleCC = /^\d{9,16}/;
    
	// Simple CVV no Credit card Security code (3-4)
	valid.CVV = /^\d{3,4}/;

	function validateForm(theForm) {
           
		var error = "";
		//for each form element
		for(var i=0; i<theForm.length; i++){
			var element = theForm[i];
			var toTest = false;
			var Req = "";
			//if exists required element
			// alert(element.name);

			Req = element.getAttribute("required");
			if(element.getAttribute("required") != "") {
				toTest = true;
			}
			if(element.getAttribute("condition") != null) {
				 //alert(element.name +" - "+ element.getAttribute("condition"));
				var parent = document.getElementById(element.getAttribute("condition"));
				var ret = "ret = document."+theForm.name+"."+parent.name+"[0].checked;";
				eval(ret);
				// alert("element name, parent value, checked - "+ element.name +","+ parent.value +","+ ret);
				if(ret) {
					toTest = true;
				}
				else {
					Req = "no";
				}
			}

			if(toTest) {
				// alert(element.name +"="+ element.value +" -"+ element.getAttribute("validate") +"-"+ Req);
				//if form element if empty
				if( ! isvalid(element.value,element.getAttribute("validate"),Req) ) {
					if (error=="") {
						element.select();
						element.focus(); 
					}
					error += element.getAttribute("message") + "\r\n";	
					
				}
			}
		}
		if(error != ""){
			alert(error);
			document.formSubmit = false;
		}
		else
			document.formSubmit = true;
/*			if(error != ""){
				alert(error);
				return false
			}
			else
				return  true;*/
			
	};

	function isvalid(value,type,req){
		if(req=="yes")
			if(value=="" || value==null)
				return false;
		if(type=="" || type==null)
			return true;
		switch(type){
			case "int":
				if(isNaN(parseInt(value)))
					return false;
				break;
			case "float":
				if(isNaN(parseFloat(value)))
					return false;
				break;
			case "email":
				var p = value.indexOf('@');
				if(p<1 || p==(value.length-1))
					return false;
			default://string
				if(type!="" && type!="string") {
					// alert("value="+value+" type="+type+" req="+req);
					var thePat = valid[type];
					var gotIt = thePat.exec(value); 
					if(! gotIt){
						if (value!="")
							return false;
						else
							return true;
					}
				}
				break;
		}
		return true;
	};

/*******************************************************************************************************/
function carryValues(matrix, object) {
	switch(matrix) {
		//am run changes
		case "am1": //first row
			//set default values to implement
			var default_time = document.frmcontactus.am_1_monTime.value;
			var default_miles = document.frmcontactus.am_1_monMileage.value;

			if (document.frmcontactus.am_1_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.am_1_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.am_1_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "am_1_tueAffected":
						document.frmcontactus.am_1_tueTime.value = default_time;
						document.frmcontactus.am_1_tueMileage.value = default_miles;
						document.frmcontactus.am_1_2_location1.checked = default_home;
						document.frmcontactus.am_1_2_location2.checked = default_sitter;
						document.frmcontactus.am_1_2_location3.value = default_other;
					break;

					case "am_1_wedAffected":
						document.frmcontactus.am_1_wedTime.value = default_time;
						document.frmcontactus.am_1_wedMileage.value = default_miles;
						document.frmcontactus.am_1_3_location1.checked = default_home;
						document.frmcontactus.am_1_3_location2.checked = default_sitter;
						document.frmcontactus.am_1_3_location3.value = default_other;
					break;

					case "am_1_thuAffected":
						document.frmcontactus.am_1_thuTime.value = default_time;
						document.frmcontactus.am_1_thuMileage.value = default_miles;
						document.frmcontactus.am_1_4_location1.checked = default_home;
						document.frmcontactus.am_1_4_location2.checked = default_sitter;
						document.frmcontactus.am_1_4_location3.value = default_other;
					break;

					case "am_1_friAffected":
						document.frmcontactus.am_1_friTime.value = default_time;
						document.frmcontactus.am_1_friMileage.value = default_miles;
						document.frmcontactus.am_1_5_location1.checked = default_home;
						document.frmcontactus.am_1_5_location2.checked = default_sitter;
						document.frmcontactus.am_1_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "am_1_tueAffected":
						document.frmcontactus.am_1_tueTime.value = "";
						document.frmcontactus.am_1_tueMileage.value = "";
						document.frmcontactus.am_1_2_location1.checked = false;
						document.frmcontactus.am_1_2_location2.checked = false;
						document.frmcontactus.am_1_2_location3.value = "";
					break;

					case "am_1_wedAffected":
						document.frmcontactus.am_1_wedTime.value = "";
						document.frmcontactus.am_1_wedMileage.value = "";
						document.frmcontactus.am_1_3_location1.checked = false;
						document.frmcontactus.am_1_3_location2.checked = false;
						document.frmcontactus.am_1_3_location3.value = "";
					break;

					case "am_1_thuAffected":
						document.frmcontactus.am_1_thuTime.value = "";
						document.frmcontactus.am_1_thuMileage.value = "";
						document.frmcontactus.am_1_4_location1.checked = false;
						document.frmcontactus.am_1_4_location2.checked = false;
						document.frmcontactus.am_1_4_location3.value = "";
					break;

					case "am_1_friAffected":
						document.frmcontactus.am_1_friTime.value = "";
						document.frmcontactus.am_1_friMileage.value = "";
						document.frmcontactus.am_1_5_location1.checked = false;
						document.frmcontactus.am_1_5_location2.checked = false;
						document.frmcontactus.am_1_5_location3.value = "";
					break;
					
					default: break;
				}
				
			}
		break;
/*
 * AM 2		AM 2	AM 2		AM 2	AM 2		AM 2	AM 2		AM 2	
*/
		case "am2":
			//set default values to implement
			var default_time = document.frmcontactus.am_2_monTime.value;
			var default_miles = document.frmcontactus.am_2_monMileage.value;

			if (document.frmcontactus.am_2_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.am_2_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.am_2_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "am_2_tueAffected":
						document.frmcontactus.am_2_tueTime.value = default_time;
						document.frmcontactus.am_2_tueMileage.value = default_miles;
						document.frmcontactus.am_2_2_location1.checked = default_home;
						document.frmcontactus.am_2_2_location2.checked = default_sitter;
						document.frmcontactus.am_2_2_location3.value = default_other;
					break;

					case "am_2_wedAffected":
						document.frmcontactus.am_2_wedTime.value = default_time;
						document.frmcontactus.am_2_wedMileage.value = default_miles;
						document.frmcontactus.am_2_3_location1.checked = default_home;
						document.frmcontactus.am_2_3_location2.checked = default_sitter;
						document.frmcontactus.am_2_3_location3.value = default_other;
					break;

					case "am_2_thuAffected":
						document.frmcontactus.am_2_thuTime.value = default_time;
						document.frmcontactus.am_2_thuMileage.value = default_miles;
						document.frmcontactus.am_2_4_location1.checked = default_home;
						document.frmcontactus.am_2_4_location2.checked = default_sitter;
						document.frmcontactus.am_2_4_location3.value = default_other;
					break;

					case "am_2_friAffected":
						document.frmcontactus.am_2_friTime.value = default_time;
						document.frmcontactus.am_2_friMileage.value = default_miles;
						document.frmcontactus.am_2_5_location1.checked = default_home;
						document.frmcontactus.am_2_5_location2.checked = default_sitter;
						document.frmcontactus.am_2_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "am_2_tueAffected":
						document.frmcontactus.am_2_tueTime.value = "";
						document.frmcontactus.am_2_tueMileage.value = "";
						document.frmcontactus.am_2_2_location1.checked = false;
						document.frmcontactus.am_2_2_location2.checked = false;
						document.frmcontactus.am_2_2_location3.value = "";
					break;

					case "am_2_wedAffected":
						document.frmcontactus.am_2_wedTime.value = "";
						document.frmcontactus.am_2_wedMileage.value = "";
						document.frmcontactus.am_2_3_location1.checked = false;
						document.frmcontactus.am_2_3_location2.checked = false;
						document.frmcontactus.am_2_3_location3.value = "";
					break;

					case "am_2_thuAffected":
						document.frmcontactus.am_2_thuTime.value = "";
						document.frmcontactus.am_2_thuMileage.value = "";
						document.frmcontactus.am_2_4_location1.checked = false;
						document.frmcontactus.am_2_4_location2.checked = false;
						document.frmcontactus.am_2_4_location3.value = "";
					break;

					case "am_2_friAffected":
						document.frmcontactus.am_2_friTime.value = "";
						document.frmcontactus.am_2_friMileage.value = "";
						document.frmcontactus.am_2_5_location1.checked = false;
						document.frmcontactus.am_2_5_location2.checked = false;
						document.frmcontactus.am_2_5_location3.value = "";
					break;
					
					default: break;
				}
			}	
		break;
/*
 * AM 3		AM 3	AM 3		AM 3	AM 3		AM 3	AM 3		AM 3	
*/

		case "am3":
				//set default values to implement
			var default_time = document.frmcontactus.am_3_monTime.value;
			var default_miles = document.frmcontactus.am_3_monMileage.value;

			if (document.frmcontactus.am_3_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.am_3_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.am_3_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "am_3_tueAffected":
						document.frmcontactus.am_3_tueTime.value = default_time;
						document.frmcontactus.am_3_tueMileage.value = default_miles;
						document.frmcontactus.am_3_2_location1.checked = default_home;
						document.frmcontactus.am_3_2_location2.checked = default_sitter;
						document.frmcontactus.am_3_2_location3.value = default_other;
					break;

					case "am_3_wedAffected":
						document.frmcontactus.am_3_wedTime.value = default_time;
						document.frmcontactus.am_3_wedMileage.value = default_miles;
						document.frmcontactus.am_3_3_location1.checked = default_home;
						document.frmcontactus.am_3_3_location2.checked = default_sitter;
						document.frmcontactus.am_3_3_location3.value = default_other;
					break;

					case "am_3_thuAffected":
						document.frmcontactus.am_3_thuTime.value = default_time;
						document.frmcontactus.am_3_thuMileage.value = default_miles;
						document.frmcontactus.am_3_4_location1.checked = default_home;
						document.frmcontactus.am_3_4_location2.checked = default_sitter;
						document.frmcontactus.am_3_4_location3.value = default_other;
					break;

					case "am_3_friAffected":
						document.frmcontactus.am_3_friTime.value = default_time;
						document.frmcontactus.am_3_friMileage.value = default_miles;
						document.frmcontactus.am_3_5_location1.checked = default_home;
						document.frmcontactus.am_3_5_location2.checked = default_sitter;
						document.frmcontactus.am_3_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "am_3_tueAffected":
						document.frmcontactus.am_3_tueTime.value = "";
						document.frmcontactus.am_3_tueMileage.value = "";
						document.frmcontactus.am_3_2_location1.checked = false;
						document.frmcontactus.am_3_2_location2.checked = false;
						document.frmcontactus.am_3_2_location3.value = "";
					break;

					case "am_3_wedAffected":
						document.frmcontactus.am_3_wedTime.value = "";
						document.frmcontactus.am_3_wedMileage.value = "";
						document.frmcontactus.am_3_3_location1.checked = false;
						document.frmcontactus.am_3_3_location2.checked = false;
						document.frmcontactus.am_3_3_location3.value = "";
					break;

					case "am_3_thuAffected":
						document.frmcontactus.am_3_thuTime.value = "";
						document.frmcontactus.am_3_thuMileage.value = "";
						document.frmcontactus.am_3_4_location1.checked = false;
						document.frmcontactus.am_3_4_location2.checked = false;
						document.frmcontactus.am_3_4_location3.value = "";
					break;

					case "am_3_friAffected":
						document.frmcontactus.am_3_friTime.value = "";
						document.frmcontactus.am_3_friMileage.value = "";
						document.frmcontactus.am_3_5_location1.checked = false;
						document.frmcontactus.am_3_5_location2.checked = false;
						document.frmcontactus.am_3_5_location3.value = "";
					break;
					
					default: break;
				}
			}	
		break;

/*
 * NOON 1		NOON 1	NOON 1		NOON 1	NOON 1		NOON 1	NOON 1		NOON 1	
*/

		//noon run changes
		case "noon1":
			//set default values to implement
			var default_time = document.frmcontactus.noon_1_monTime.value;
			var default_miles = document.frmcontactus.noon_1_monMileage.value;

			if (document.frmcontactus.noon_1_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.noon_1_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.noon_1_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "noon_1_tueAffected":
						document.frmcontactus.noon_1_tueTime.value = default_time;
						document.frmcontactus.noon_1_tueMileage.value = default_miles;
						document.frmcontactus.noon_1_2_location1.checked = default_home;
						document.frmcontactus.noon_1_2_location2.checked = default_sitter;
						document.frmcontactus.noon_1_2_location3.value = default_other;
					break;

					case "noon_1_wedAffected":
						document.frmcontactus.noon_1_wedTime.value = default_time;
						document.frmcontactus.noon_1_wedMileage.value = default_miles;
						document.frmcontactus.noon_1_3_location1.checked = default_home;
						document.frmcontactus.noon_1_3_location2.checked = default_sitter;
						document.frmcontactus.noon_1_3_location3.value = default_other;
					break;

					case "noon_1_thuAffected":
						document.frmcontactus.noon_1_thuTime.value = default_time;
						document.frmcontactus.noon_1_thuMileage.value = default_miles;
						document.frmcontactus.noon_1_4_location1.checked = default_home;
						document.frmcontactus.noon_1_4_location2.checked = default_sitter;
						document.frmcontactus.noon_1_4_location3.value = default_other;
					break;

					case "noon_1_friAffected":
						document.frmcontactus.noon_1_friTime.value = default_time;
						document.frmcontactus.noon_1_friMileage.value = default_miles;
						document.frmcontactus.noon_1_5_location1.checked = default_home;
						document.frmcontactus.noon_1_5_location2.checked = default_sitter;
						document.frmcontactus.noon_1_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "noon_1_tueAffected":
						document.frmcontactus.noon_1_tueTime.value = "";
						document.frmcontactus.noon_1_tueMileage.value = "";
						document.frmcontactus.noon_1_2_location1.checked = false;
						document.frmcontactus.noon_1_2_location2.checked = false;
						document.frmcontactus.noon_1_2_location3.value = "";
					break;

					case "noon_1_wedAffected":
						document.frmcontactus.noon_1_wedTime.value = "";
						document.frmcontactus.noon_1_wedMileage.value = "";
						document.frmcontactus.noon_1_3_location1.checked = false;
						document.frmcontactus.noon_1_3_location2.checked = false;
						document.frmcontactus.noon_1_3_location3.value = "";
					break;

					case "noon_1_thuAffected":
						document.frmcontactus.noon_1_thuTime.value = "";
						document.frmcontactus.noon_1_thuMileage.value = "";
						document.frmcontactus.noon_1_4_location1.checked = false;
						document.frmcontactus.noon_1_4_location2.checked = false;
						document.frmcontactus.noon_1_4_location3.value = "";
					break;

					case "noon_1_friAffected":
						document.frmcontactus.noon_1_friTime.value = "";
						document.frmcontactus.noon_1_friMileage.value = "";
						document.frmcontactus.noon_1_5_location1.checked = false;
						document.frmcontactus.noon_1_5_location2.checked = false;
						document.frmcontactus.noon_1_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;
/*
 * NOON 2		NOON 2	NOON 2		NOON 2	NOON 2		NOON 2	NOON 2		NOON 2	
*/
		case "noon2":
			//set default values to implement
			var default_time = document.frmcontactus.noon_2_monTime.value;
			var default_miles = document.frmcontactus.noon_2_monMileage.value;

			if (document.frmcontactus.noon_2_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.noon_2_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.noon_2_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "noon_2_tueAffected":
						document.frmcontactus.noon_2_tueTime.value = default_time;
						document.frmcontactus.noon_2_tueMileage.value = default_miles;
						document.frmcontactus.noon_2_2_location1.checked = default_home;
						document.frmcontactus.noon_2_2_location2.checked = default_sitter;
						document.frmcontactus.noon_2_2_location3.value = default_other;
					break;

					case "noon_2_wedAffected":
						document.frmcontactus.noon_2_wedTime.value = default_time;
						document.frmcontactus.noon_2_wedMileage.value = default_miles;
						document.frmcontactus.noon_2_3_location1.checked = default_home;
						document.frmcontactus.noon_2_3_location2.checked = default_sitter;
						document.frmcontactus.noon_2_3_location3.value = default_other;
					break;

					case "noon_2_thuAffected":
						document.frmcontactus.noon_2_thuTime.value = default_time;
						document.frmcontactus.noon_2_thuMileage.value = default_miles;
						document.frmcontactus.noon_2_4_location1.checked = default_home;
						document.frmcontactus.noon_2_4_location2.checked = default_sitter;
						document.frmcontactus.noon_2_4_location3.value = default_other;
					break;

					case "noon_2_friAffected":
						document.frmcontactus.noon_2_friTime.value = default_time;
						document.frmcontactus.noon_2_friMileage.value = default_miles;
						document.frmcontactus.noon_2_5_location1.checked = default_home;
						document.frmcontactus.noon_2_5_location2.checked = default_sitter;
						document.frmcontactus.noon_2_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "noon_2_tueAffected":
						document.frmcontactus.noon_2_tueTime.value = "";
						document.frmcontactus.noon_2_tueMileage.value = "";
						document.frmcontactus.noon_2_2_location1.checked = false;
						document.frmcontactus.noon_2_2_location2.checked = false;
						document.frmcontactus.noon_2_2_location3.value = "";
					break;

					case "noon_2_wedAffected":
						document.frmcontactus.noon_2_wedTime.value = "";
						document.frmcontactus.noon_2_wedMileage.value = "";
						document.frmcontactus.noon_2_3_location1.checked = false;
						document.frmcontactus.noon_2_3_location2.checked = false;
						document.frmcontactus.noon_2_3_location3.value = "";
					break;

					case "noon_2_thuAffected":
						document.frmcontactus.noon_2_thuTime.value = "";
						document.frmcontactus.noon_2_thuMileage.value = "";
						document.frmcontactus.noon_2_4_location1.checked = false;
						document.frmcontactus.noon_2_4_location2.checked = false;
						document.frmcontactus.noon_2_4_location3.value = "";
					break;

					case "noon_2_friAffected":
						document.frmcontactus.noon_2_friTime.value = "";
						document.frmcontactus.noon_2_friMileage.value = "";
						document.frmcontactus.noon_2_5_location1.checked = false;
						document.frmcontactus.noon_2_5_location2.checked = false;
						document.frmcontactus.noon_2_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;
/*
 * NOON 3		NOON 3	NOON 3		NOON 3	NOON 3		NOON 3	NOON 3		NOON 3	
*/
		case "noon3":
			//set default values to implement
			var default_time = document.frmcontactus.noon_3_monTime.value;
			var default_miles = document.frmcontactus.noon_3_monMileage.value;

			if (document.frmcontactus.noon_3_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.noon_3_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.noon_3_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "noon_3_tueAffected":
						document.frmcontactus.noon_3_tueTime.value = default_time;
						document.frmcontactus.noon_3_tueMileage.value = default_miles;
						document.frmcontactus.noon_3_2_location1.checked = default_home;
						document.frmcontactus.noon_3_2_location2.checked = default_sitter;
						document.frmcontactus.noon_3_2_location3.value = default_other;
					break;

					case "noon_3_wedAffected":
						document.frmcontactus.noon_3_wedTime.value = default_time;
						document.frmcontactus.noon_3_wedMileage.value = default_miles;
						document.frmcontactus.noon_3_3_location1.checked = default_home;
						document.frmcontactus.noon_3_3_location2.checked = default_sitter;
						document.frmcontactus.noon_3_3_location3.value = default_other;
					break;

					case "noon_3_thuAffected":
						document.frmcontactus.noon_3_thuTime.value = default_time;
						document.frmcontactus.noon_3_thuMileage.value = default_miles;
						document.frmcontactus.noon_3_4_location1.checked = default_home;
						document.frmcontactus.noon_3_4_location2.checked = default_sitter;
						document.frmcontactus.noon_3_4_location3.value = default_other;
					break;

					case "noon_3_friAffected":
						document.frmcontactus.noon_3_friTime.value = default_time;
						document.frmcontactus.noon_3_friMileage.value = default_miles;
						document.frmcontactus.noon_3_5_location1.checked = default_home;
						document.frmcontactus.noon_3_5_location2.checked = default_sitter;
						document.frmcontactus.noon_3_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "noon_3_tueAffected":
						document.frmcontactus.noon_3_tueTime.value = "";
						document.frmcontactus.noon_3_tueMileage.value = "";
						document.frmcontactus.noon_3_2_location1.checked = false;
						document.frmcontactus.noon_3_2_location2.checked = false;
						document.frmcontactus.noon_3_2_location3.value = "";
					break;

					case "noon_3_wedAffected":
						document.frmcontactus.noon_3_wedTime.value = "";
						document.frmcontactus.noon_3_wedMileage.value = "";
						document.frmcontactus.noon_3_3_location1.checked = false;
						document.frmcontactus.noon_3_3_location2.checked = false;
						document.frmcontactus.noon_3_3_location3.value = "";
					break;

					case "noon_3_thuAffected":
						document.frmcontactus.noon_3_thuTime.value = "";
						document.frmcontactus.noon_3_thuMileage.value = "";
						document.frmcontactus.noon_3_4_location1.checked = false;
						document.frmcontactus.noon_3_4_location2.checked = false;
						document.frmcontactus.noon_3_4_location3.value = "";
					break;

					case "noon_3_friAffected":
						document.frmcontactus.noon_3_friTime.value = "";
						document.frmcontactus.noon_3_friMileage.value = "";
						document.frmcontactus.noon_3_5_location1.checked = false;
						document.frmcontactus.noon_3_5_location2.checked = false;
						document.frmcontactus.noon_3_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;
/*
 * PM 1		PM 1	PM 1		PM 1	PM 1		PM 1	PM 1		PM 1	
*/
		//pm run changes
		case "pm1":
			//set default values to implement
			var default_time = document.frmcontactus.pm_1_monTime.value;
			var default_miles = document.frmcontactus.pm_1_monMileage.value;

			if (document.frmcontactus.pm_1_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.pm_1_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.pm_1_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "pm_1_tueAffected":
						document.frmcontactus.pm_1_tueTime.value = default_time;
						document.frmcontactus.pm_1_tueMileage.value = default_miles;
						document.frmcontactus.pm_1_2_location1.checked = default_home;
						document.frmcontactus.pm_1_2_location2.checked = default_sitter;
						document.frmcontactus.pm_1_2_location3.value = default_other;
					break;

					case "pm_1_wedAffected":
						document.frmcontactus.pm_1_wedTime.value = default_time;
						document.frmcontactus.pm_1_wedMileage.value = default_miles;
						document.frmcontactus.pm_1_3_location1.checked = default_home;
						document.frmcontactus.pm_1_3_location2.checked = default_sitter;
						document.frmcontactus.pm_1_3_location3.value = default_other;
					break;

					case "pm_1_thuAffected":
						document.frmcontactus.pm_1_thuTime.value = default_time;
						document.frmcontactus.pm_1_thuMileage.value = default_miles;
						document.frmcontactus.pm_1_4_location1.checked = default_home;
						document.frmcontactus.pm_1_4_location2.checked = default_sitter;
						document.frmcontactus.pm_1_4_location3.value = default_other;
					break;

					case "pm_1_friAffected":
						document.frmcontactus.pm_1_friTime.value = default_time;
						document.frmcontactus.pm_1_friMileage.value = default_miles;
						document.frmcontactus.pm_1_5_location1.checked = default_home;
						document.frmcontactus.pm_1_5_location2.checked = default_sitter;
						document.frmcontactus.pm_1_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "pm_1_tueAffected":
						document.frmcontactus.pm_1_tueTime.value = "";
						document.frmcontactus.pm_1_tueMileage.value = "";
						document.frmcontactus.pm_1_2_location1.checked = false;
						document.frmcontactus.pm_1_2_location2.checked = false;
						document.frmcontactus.pm_1_2_location3.value = "";
					break;

					case "pm_1_wedAffected":
						document.frmcontactus.pm_1_wedTime.value = "";
						document.frmcontactus.pm_1_wedMileage.value = "";
						document.frmcontactus.pm_1_3_location1.checked = false;
						document.frmcontactus.pm_1_3_location2.checked = false;
						document.frmcontactus.pm_1_3_location3.value = "";
					break;

					case "pm_1_thuAffected":
						document.frmcontactus.pm_1_thuTime.value = "";
						document.frmcontactus.pm_1_thuMileage.value = "";
						document.frmcontactus.pm_1_4_location1.checked = false;
						document.frmcontactus.pm_1_4_location2.checked = false;
						document.frmcontactus.pm_1_4_location3.value = "";
					break;

					case "pm_1_friAffected":
						document.frmcontactus.pm_1_friTime.value = "";
						document.frmcontactus.pm_1_friMileage.value = "";
						document.frmcontactus.pm_1_5_location1.checked = false;
						document.frmcontactus.pm_1_5_location2.checked = false;
						document.frmcontactus.pm_1_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;
/*
 * PM 2		PM 2	PM 2		PM 2	PM 2		PM 2	PM 2		PM 2	
*/

		case "pm2":
			var default_time = document.frmcontactus.pm_2_monTime.value;
			var default_miles = document.frmcontactus.pm_2_monMileage.value;

			if (document.frmcontactus.pm_2_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.pm_2_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.pm_2_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "pm_2_tueAffected":
						document.frmcontactus.pm_2_tueTime.value = default_time;
						document.frmcontactus.pm_2_tueMileage.value = default_miles;
						document.frmcontactus.pm_2_2_location1.checked = default_home;
						document.frmcontactus.pm_2_2_location2.checked = default_sitter;
						document.frmcontactus.pm_2_2_location3.value = default_other;
					break;

					case "pm_2_wedAffected":
						document.frmcontactus.pm_2_wedTime.value = default_time;
						document.frmcontactus.pm_2_wedMileage.value = default_miles;
						document.frmcontactus.pm_2_3_location1.checked = default_home;
						document.frmcontactus.pm_2_3_location2.checked = default_sitter;
						document.frmcontactus.pm_2_3_location3.value = default_other;
					break;

					case "pm_2_thuAffected":
						document.frmcontactus.pm_2_thuTime.value = default_time;
						document.frmcontactus.pm_2_thuMileage.value = default_miles;
						document.frmcontactus.pm_2_4_location1.checked = default_home;
						document.frmcontactus.pm_2_4_location2.checked = default_sitter;
						document.frmcontactus.pm_2_4_location3.value = default_other;
					break;

					case "pm_2_friAffected":
						document.frmcontactus.pm_2_friTime.value = default_time;
						document.frmcontactus.pm_2_friMileage.value = default_miles;
						document.frmcontactus.pm_2_5_location1.checked = default_home;
						document.frmcontactus.pm_2_5_location2.checked = default_sitter;
						document.frmcontactus.pm_2_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "pm_2_tueAffected":
						document.frmcontactus.pm_2_tueTime.value = "";
						document.frmcontactus.pm_2_tueMileage.value = "";
						document.frmcontactus.pm_2_2_location1.checked = false;
						document.frmcontactus.pm_2_2_location2.checked = false;
						document.frmcontactus.pm_2_2_location3.value = "";
					break;

					case "pm_2_wedAffected":
						document.frmcontactus.pm_2_wedTime.value = "";
						document.frmcontactus.pm_2_wedMileage.value = "";
						document.frmcontactus.pm_2_3_location1.checked = false;
						document.frmcontactus.pm_2_3_location2.checked = false;
						document.frmcontactus.pm_2_3_location3.value = "";
					break;

					case "pm_2_thuAffected":
						document.frmcontactus.pm_2_thuTime.value = "";
						document.frmcontactus.pm_2_thuMileage.value = "";
						document.frmcontactus.pm_2_4_location1.checked = false;
						document.frmcontactus.pm_2_4_location2.checked = false;
						document.frmcontactus.pm_2_4_location3.value = "";
					break;

					case "pm_2_friAffected":
						document.frmcontactus.pm_2_friTime.value = "";
						document.frmcontactus.pm_2_friMileage.value = "";
						document.frmcontactus.pm_2_5_location1.checked = false;
						document.frmcontactus.pm_2_5_location2.checked = false;
						document.frmcontactus.pm_2_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;
/*
 * PM 3		PM 3	PM 3		PM 3	PM 3		PM 3	PM 3		PM 3	
*/
		case "pm3":
			var default_time = document.frmcontactus.pm_3_monTime.value;
			var default_miles = document.frmcontactus.pm_3_monMileage.value;

			if (document.frmcontactus.pm_3_1_location1.checked == true) {
				default_home = true;
			}else{
				default_home = false;
			}
			
			if (document.frmcontactus.pm_3_1_location2.checked == true) {
				default_sitter = true;
			}else{
				default_sitter = false;
			}

			var default_other = document.frmcontactus.pm_3_1_location3.value;
			
			//if checked, deploy the default values, else clear them out for that particular object set
			if (object.checked == true) {
				switch(object.name) {
					//assign values
					case "pm_3_tueAffected":
						document.frmcontactus.pm_3_tueTime.value = default_time;
						document.frmcontactus.pm_3_tueMileage.value = default_miles;
						document.frmcontactus.pm_3_2_location1.checked = default_home;
						document.frmcontactus.pm_3_2_location2.checked = default_sitter;
						document.frmcontactus.pm_3_2_location3.value = default_other;
					break;

					case "pm_3_wedAffected":
						document.frmcontactus.pm_3_wedTime.value = default_time;
						document.frmcontactus.pm_3_wedMileage.value = default_miles;
						document.frmcontactus.pm_3_3_location1.checked = default_home;
						document.frmcontactus.pm_3_3_location2.checked = default_sitter;
						document.frmcontactus.pm_3_3_location3.value = default_other;
					break;

					case "pm_3_thuAffected":
						document.frmcontactus.pm_3_thuTime.value = default_time;
						document.frmcontactus.pm_3_thuMileage.value = default_miles;
						document.frmcontactus.pm_3_4_location1.checked = default_home;
						document.frmcontactus.pm_3_4_location2.checked = default_sitter;
						document.frmcontactus.pm_3_4_location3.value = default_other;
					break;

					case "pm_3_friAffected":
						document.frmcontactus.pm_3_friTime.value = default_time;
						document.frmcontactus.pm_3_friMileage.value = default_miles;
						document.frmcontactus.pm_3_5_location1.checked = default_home;
						document.frmcontactus.pm_3_5_location2.checked = default_sitter;
						document.frmcontactus.pm_3_5_location3.value = default_other;
					break;
					
					default: break;
				}
			}else{
				switch(object.name) {
					//assign values to blank
					case "pm_3_tueAffected":
						document.frmcontactus.pm_3_tueTime.value = "";
						document.frmcontactus.pm_3_tueMileage.value = "";
						document.frmcontactus.pm_3_2_location1.checked = false;
						document.frmcontactus.pm_3_2_location2.checked = false;
						document.frmcontactus.pm_3_2_location3.value = "";
					break;

					case "pm_3_wedAffected":
						document.frmcontactus.pm_3_wedTime.value = "";
						document.frmcontactus.pm_3_wedMileage.value = "";
						document.frmcontactus.pm_3_3_location1.checked = false;
						document.frmcontactus.pm_3_3_location2.checked = false;
						document.frmcontactus.pm_3_3_location3.value = "";
					break;

					case "pm_3_thuAffected":
						document.frmcontactus.pm_3_thuTime.value = "";
						document.frmcontactus.pm_3_thuMileage.value = "";
						document.frmcontactus.pm_3_4_location1.checked = false;
						document.frmcontactus.pm_3_4_location2.checked = false;
						document.frmcontactus.pm_3_4_location3.value = "";
					break;

					case "pm_3_friAffected":
						document.frmcontactus.pm_3_friTime.value = "";
						document.frmcontactus.pm_3_friMileage.value = "";
						document.frmcontactus.pm_3_5_location1.checked = false;
						document.frmcontactus.pm_3_5_location2.checked = false;
						document.frmcontactus.pm_3_5_location3.value = "";
					break;
					
					default: break;
				}
			}
		break;

		default: 
			alert("Script Error!");
		break;
	}
}
