<!--
	function join(string1, string2, targetObj, glue)
	{
		var catString = "";

		catString += string1;
		if(string2 != "") {
			catString += (glue + string2);
		}
		targetObj.value = catString;
	}

	function initPage()
	{
			// nothing to see here
	}

	/*	validateForm(formObj)

			The purpose of this function is to check that the items in the form are
			correct.
	*/
	function validateForm(formObj)
	{
		var form_error = "";

		if(formObj.first_name.value == "") {
			form_error += "Please enter your first name.\n\r";
		}
		
		if(formObj.last_name.value == "") {
			form_error += "Please enter your surname.\n\r";
		}
		
		if(formObj.street_address.value == "") {
			form_error += "Please enter your street address.\n\r";
		}
		
		if(formObj.city_suburb.value == "") {
			form_error += "Please enter your city/suburb.\n\r";
		}
		
		if(formObj.state_province.value == "") {
			form_error += "Please enter your state/province.\n\r";
		}
		
		if(formObj.postcode_zip.value == "") {
			form_error += "Please enter your postcode/zip.\n\r";
		}
		
		if(formObj.country.value == "") {
			form_error += "Please enter your country.\n\r";
		}
		
		if(formObj.region.options[formObj.region.selectedIndex].value == 0) {
			form_error += "Please choose a region to which this product is to be delivered.\n\r";
		}
		
		if(formObj.email_address.value == "") {
			form_error += "Please enter an email address.\n\r";
		}

		if(form_error == "") {
			formObj.submit();
		}
		else {
			alert(form_error);
		}
	}

	function calculate_freight(region_code, total_quantity, freight_cost, base_cost, total_cost)
	{
			// Only boot polish has been ordered //
			if(total_quantity == 0)
			{
				freight_cost.value = 0.00;
				total_cost.value = roundOff(parseFloat(base_cost), 2);
			}
			else
			{
				// EUROPE
				if(region_code == "1")
				{
					freight_cost.value = roundOff((60.00 + ((total_quantity - 1) * 35.00)), 2);
					total_cost.value = roundOff(parseFloat(base_cost) + parseInt(freight_cost.value), 2);
				} 
				// USA
				else if (region_code == "2")
				{
					freight_cost.value = roundOff(50.00 + ((total_quantity - 1) * 26.00), 2);
					total_cost.value = roundOff(parseFloat(base_cost) + parseInt(freight_cost.value), 2);
				}
				// Asia Pacific
				else if (region_code == "3")
				{
					freight_cost.value = roundOff(38.00 + ((total_quantity - 1) * 15.00), 2);
					total_cost.value = roundOff(parseFloat(base_cost) + parseInt(freight_cost.value), 2);
				}
				// New Zealand
				else if (region_code == "4")
				{
					freight_cost.value = roundOff(30.00 + ((total_quantity - 1) * 15.00), 2);
					total_cost.value = roundOff(parseFloat(base_cost) + parseInt(freight_cost.value), 2);
				}
				// Australia
				else if (region_code == "5")
				{
					freight_cost.value = roundOff((total_quantity * 13.00), 2);
					total_cost.value = roundOff(parseFloat(base_cost) + parseInt(freight_cost.value), 2);
				}
			}

			update_amount(total_cost.value);
	}

	function update_amount(dollarAmount)
	{
		var reg = /([0-9]*)(\.*)([0-9]*)/;
		var dac = reg.exec(dollarAmount);

		/*  NTS: again a bad way to do this but due to time constraints
			the most efficient way to do it.  Usually the object would
			be passed to the function so that it would be code independent
			and could be used again (the irony)
		*/

		if (dac[1] == "")
		{
			customers_details.amountDollar.value = "0";	
		}
		else
		{
			customers_details.amountDollar.value = dac[1];
		}
		if (dac[3] == null || dac[3] == "")
		{
			customers_details.amountCent.value = "00";
		}
		else
		{
			customers_details.amountCent.value = dac[3];
		}
	}

	function roundOff(value, precision)
	{
		value = "" + value //convert value to string
		precision = parseInt(precision);

		var whole = "" + Math.round(value * Math.pow(10, precision));
		var decPoint = whole.length - precision;

		if(decPoint != 0)
		{
			result = whole.substring(0, decPoint);
			result += ".";
			result += whole.substring(decPoint, whole.length);
		}
		else
		{
			result = whole;
		}
		return result;
	}
//-->