// JavaScript Document
function calculateWireLoop(form)
// calculate the lengths in decimal feet of vertical
// call other functions (above) to calculate fractional feet/inches and meters
// display results in form fields //
	{
		var frequency;
		var wavelength_factor;
		var velocity_factor;
		var matching_section;
		var total_length;
		var full_wave_dividend = 984;
		frequency = roundNumber(form.frequency.value,3);
		wavelength_factor = Math.floor(form.wavelength_factor.value);
		velocity_factor = parseFloat(form.velocity_factor.value);
		total_length = roundNumber((wavelength_factor/frequency),2);
		matching_section = roundNumber(((246 * velocity_factor) / frequency),2);
		if (total_length > 0)
			{
				form.full_loop.value = String(roundNumber(total_length,2))+" ft";
				form.full_loop_feetinches.value = fractional_feet_inches(total_length);
				form.full_loop_meters.value = String(meters_from_feet(total_length))+" meters";
				form.matching_section.value = String(roundNumber(matching_section,2))+" ft";
				form.matching_section_feetinches.value = fractional_feet_inches(matching_section);
				form.matching_section_meters.value = String(meters_from_feet(matching_section))+" meters";
			}
		else
			{
				clearResults(form);
			}
	}

function clearResults(form)
	{
		form.full_loop.value=0;
		form.full_loop_feetinches.value=0;
		form.full_loop_meters.value=0;
		form.matching_section.value = "";
		form.matching_section_feetinches.value = "";
		form.matching_section_meters.value = "";
	}
	
function checkEnter(form)
	{
		var characterCode
		if (window.event)
			{ 
				e = window.event;
				if (e.keyCode == 13)
					{
						calculateWireLoop(form);
					}
			}
	}
