// JavaScript Document

//Submit Rate Request
function rateRequest()
{
	var textContent, isPallet, additions;
	additions = "";
	for (var i=0; i < document.formInfo.pallet.length; i++)
   {
   if (document.formInfo.pallet[i].checked)
      {
      var isPallet = document.formInfo.pallet[i].value;
      }
   }
	 for (var j=0; j < document.formInfo.additional.length; j++)
   {
   if (document.formInfo.additional[j].checked)
      {
			if (additions > "" )
			{
				additions = additions + ", ";
			}
      additions = additions + document.formInfo.additional[j].value;
      }
   }
	textContent = "<p>Company Name: " + document.getElementById('compCharge').value + "<br>";
	textContent = textContent + "Requester's Name: " + document.getElementById('subName').value + "<br>";
	textContent = textContent + "Email Address: " + document.getElementById('subEmail').value + "<br>";
	textContent = textContent + "Phone Number: " + document.getElementById('subNumber').value + "&nbsp Ext: " + document.getElementById('subExt').value + "<br>";
	textContent = textContent + "How did you find out about Liberty Linehual: " + document.getElementById('source').value + "<br>";
	textContent = textContent + "Origin:" + "<br>";
	textContent = textContent + "City: " + document.getElementById('orCity').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('orProvince').value + "<br>";
	textContent = textContent + "Postal/Zip: " + document.getElementById('orPost').value + "<br>";
	textContent = textContent + "Destination:" + "<br>";
	textContent = textContent + "City: " + document.getElementById('deCity').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('deProvince').value + "<br>";
	textContent = textContent + "Postal/Zip: " + document.getElementById('dePost').value + "<br>";
	textContent = textContent + "Commodity: " + document.getElementById('commodity').value + "<br>";
	textContent = textContent + "Freight Class: " + document.getElementById('freightClass').value + "<br>";
	textContent = textContent + "Quantity: " + document.getElementById('qtyProd').value + "<br>";
	textContent = textContent + "Palletized: " + isPallet + "<br>";
	textContent = textContent + "Other: " + document.getElementById('palletNon').value + "<br>";
	textContent = textContent + "Dimensions (LxWxH): " + document.getElementById('proLength').value + " x " + document.getElementById('proWidth').value + " x " + document.getElementById('proHeight').value + " - " + document.getElementById('unitOfMeas').value + "<br>";
	textContent = textContent + "Multiple Dimensions: " + document.getElementById('multDim').value + " - " + document.getElementById('unitOfMeas').value + "<br>";
	textContent = textContent + "Additions: " + additions + "<br>";
	textContent = textContent + "Special equipment or services required: " + document.getElementById('reqServ').value + "</p>";
	
	document.getElementById('collection').value = textContent
	
	document.formInfo.submit();
}
//Clear Forms
function clearAll(formName)
{
	document[formName].reset();
}

//Submit App
function submitApp()
{
	var textContent, isOwner, licSusp, hasAbstract, hadPolice, hasFast, drugTest, drug1, drug2, drug3;
	textContent = "";
	// Collect radio buttons from the form.
	for (var i=0; i < document.onlineApplication.appOwner.length; i++)
	{
		if (document.onlineApplication.appOwner[i].checked)
		{
			var isOwner = document.onlineApplication.appOwner[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appSusp.length; i++)
	{
		if (document.onlineApplication.appSusp[i].checked)
		{
			var licSusp = document.onlineApplication.appSusp[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appAbstract.length; i++)
	{
		if (document.onlineApplication.appAbstract[i].checked)
		{
			var hasAbstract = document.onlineApplication.appAbstract[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appPoliceCheck.length; i++)
	{
		if (document.onlineApplication.appPoliceCheck[i].checked)
		{
			var hadPolice = document.onlineApplication.appPoliceCheck[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appFast.length; i++)
	{
		if (document.onlineApplication.appFast[i].checked)
		{
			var hasFast = document.onlineApplication.appFast[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appDrug.length; i++)
	{
		if (document.onlineApplication.appDrug[i].checked)
		{
			var drugTest = document.onlineApplication.appDrug[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appEmpDrug1.length; i++)
	{
		if (document.onlineApplication.appEmpDrug1[i].checked)
		{
			var drug1 = document.onlineApplication.appEmpDrug1[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appEmpDrug2.length; i++)
	{
		if (document.onlineApplication.appEmpDrug2[i].checked)
		{
			var drug2 = document.onlineApplication.appEmpDrug2[i].value;
		}
	}
	for (var i=0; i < document.onlineApplication.appEmpDrug3.length; i++)
	{
		if (document.onlineApplication.appEmpDrug3[i].checked)
		{
			var drug3 = document.onlineApplication.appEmpDrug3[i].value;
		}
	}

	//Applicant's Contact
	textContent = "<p>Applicant's Contact Information" + "<br>";
	textContent = textContent + "Name: " + document.getElementById('appName').value + "<br>";
	textContent = textContent + "Address: " + document.getElementById('appAddress').value + "<br>";
	textContent = textContent + "City: " + document.getElementById('City').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('appProvince').value + "<br>";
	textContent = textContent + "Postal Code/Zip: " + document.getElementById('appCode').value + "<br>";
	textContent = textContent + "Phone Number: " + document.getElementById('appPhone').value + "<br>";
	textContent = textContent + "Alternative Phone Number: " + document.getElementById('appAltPhone').value + "<br>";
	textContent = textContent + "Fax: " + document.getElementById('appFax').value + "<br>";
	textContent = textContent + "Email Address: " + document.getElementById('appEmail').value + "<br>";
	textContent = textContent + "Date Available: " + document.getElementById('appDate').value + "<br>";
	textContent = textContent + "Owner/Operator: " + isOwner + "<br>";
	textContent = textContent + "Preferred Method of Contact: " + document.getElementById('appConMethod').value + "<br>" + "</p>";
	
	//Applicant's Education
	textContent = textContent + "<p>Applicant's Education and License Information" + "<br>";
	textContent = textContent + "Highest Level of Education: " + document.getElementById('highEdu').value + "<br>";
	textContent = textContent + "Last School Attended: " + document.getElementById('lastSchoolN').value + ", " + document.getElementById('lastSchoolC').value + "<br>";
	textContent = textContent + "License Number: " + document.getElementById('appDriveNum').value + "<br>";
	textContent = textContent + "License Class: " + document.getElementById('appClass').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('appLProvince').value + "<br>";
	textContent = textContent + "Expiration Date: " + document.getElementById('appExpDate').value + "<br>";
	textContent = textContent + "Tickets in the Past 3 Years: " + document.getElementById('appTickets').value + "<br>";
	textContent = textContent + "Preventable Accidents: " + document.getElementById('appPreventable').value + "<br>";
	textContent = textContent + "License Ever Suspended: " + licSusp + "<br>";
	textContent = textContent + "Reason: " + document.getElementById('appReason').value + "<br>";
	textContent = textContent + "Current Driver Abstract: " + hasAbstract + "<br>";
	textContent = textContent + "Current Police Check: " + hadPolice + "<br>";
	textContent = textContent + "FAST Card: " + hasFast + "<br>";
	textContent = textContent + "Involved in Drug Testing: " + drugTest + "<br>" + "</p>";
	
	//Applicant's Employment History
	textContent = textContent + "<p>Employment History" + "<br>";
	textContent = textContent + "Employer 1" + "<br>";
	textContent = textContent + "Name: " + document.getElementById('appEmpName1').value + "<br>";
	textContent = textContent + "Address: " + document.getElementById('appEmpAdd1').value + ", " + document.getElementById('lastSchoolC').value + "<br>";
	textContent = textContent + "City: " + document.getElementById('appEmpCity1').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('appEmpProv1').value + "<br>";
	textContent = textContent + "Postal Code: " + document.getElementById('appEmpPostal1').value + "<br>";
	textContent = textContent + "Contact Name: " + document.getElementById('appEmpCont1').value + "<br>";
	textContent = textContent + "Phone Number: " + document.getElementById('appEmpPhoneCont1').value + "&nbsp Ext: " + document.getElementById('appEmpExt1').value + "<br>";
	textContent = textContent + "Performed Drug Testing: " + drug1 + "<br>";
	textContent = textContent + "Start Date: "+ document.getElementById('appEmpFromMonth1').value + " - " + document.getElementById('appEmpFromYear1').value + "<br>";
	textContent = textContent + "End Date: "+ document.getElementById('appEmpToMonth1').value + " - " + document.getElementById('appEmpToYear1').value + "<br>";
	textContent = textContent + "Position: " + document.getElementById('appEmpPos1').value + "<br>";
	textContent = textContent + "Reason For Leaving: " + document.getElementById('appEmpReas1').value + "<br>" + "</p>";

	textContent = textContent + "<p>Employer 2" + "<br>";
	textContent = textContent + "Name: " + document.getElementById('appEmpName2').value + "<br>";
	textContent = textContent + "Address: " + document.getElementById('appEmpAdd2').value + ", " + document.getElementById('lastSchoolC').value + "<br>";
	textContent = textContent + "City: " + document.getElementById('appEmpCity2').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('appEmpProv2').value + "<br>";
	textContent = textContent + "Postal Code: " + document.getElementById('appEmpPostal2').value + "<br>";
	textContent = textContent + "Contact Name: " + document.getElementById('appEmpCont2').value + "<br>";
	textContent = textContent + "Phone Number: " + document.getElementById('appEmpPhoneCont2').value + "&nbsp Ext: " + document.getElementById('appEmpExt2').value + "<br>";
	textContent = textContent + "Performed Drug Testing: " + drug2 + "<br>";
	textContent = textContent + "Start Date: "+ document.getElementById('appEmpFromMonth2').value + " - " + document.getElementById('appEmpFromYear2').value + "<br>";
	textContent = textContent + "End Date: "+ document.getElementById('appEmpToMonth2').value + " - " + document.getElementById('appEmpToYear2').value + "<br>";
	textContent = textContent + "Position: " + document.getElementById('appEmpPos2').value + "<br>";
	textContent = textContent + "Reason For Leaving: " + document.getElementById('appEmpReas2').value + "<br>" + "</p>";

	textContent = textContent + "<p>Employer 3" + "<br>";
	textContent = textContent + "Name: " + document.getElementById('appEmpName3').value + "<br>";
	textContent = textContent + "Address: " + document.getElementById('appEmpAdd3').value + ", " + document.getElementById('lastSchoolC').value + "<br>";
	textContent = textContent + "City: " + document.getElementById('appEmpCity3').value + "<br>";
	textContent = textContent + "Province/State: " + document.getElementById('appEmpProv3').value + "<br>";
	textContent = textContent + "Postal Code: " + document.getElementById('appEmpPostal3').value + "<br>";
	textContent = textContent + "Contact Name: " + document.getElementById('appEmpCont3').value + "<br>";
	textContent = textContent + "Phone Number: " + document.getElementById('appEmpPhoneCont3').value + "&nbsp Ext: " + document.getElementById('appEmpExt3').value + "<br>";
	textContent = textContent + "Performed Drug Testing: " + drug2 + "<br>";
	textContent = textContent + "Start Date: "+ document.getElementById('appEmpFromMonth3').value + " - " + document.getElementById('appEmpFromYear3').value + "<br>";
	textContent = textContent + "End Date: "+ document.getElementById('appEmpToMonth3').value + " - " + document.getElementById('appEmpToYear3').value + "<br>";
	textContent = textContent + "Position: " + document.getElementById('appEmpPos3').value + "<br>";
	textContent = textContent + "Reason For Leaving: " + document.getElementById('appEmpReas3').value + "</p>";
		
	document.getElementById('collection').value = textContent
	
	
	document.onlineApplication.submit();
}