	function MakeArray(n)
	{
		this.length = n;
		for(var i=1; i<=n; i++)
		{
			this[i] = 0;
		}
		return this;
	}

		var m_fields = new MakeArray(18);
		m_fields[0]	=	"SUBMIT"
		m_fields[1]	=	"TO";
		m_fields[2]	=	"CC";
		m_fields[3]	=	"SUBJECT";
		m_fields[4]	=	"NAME_FIRST";
		m_fields[5]	=	"NAME_LAST";
		m_fields[6]	=	"NAME";
		m_fields[7]	=	"COMPANY";
		m_fields[8]	=	"ADDRESS1";
		m_fields[9]	=	"ADDRESS2";
		m_fields[10]	=	"TOWN";
		m_fields[11]	=	"STATE";
		m_fields[12]	=	"CODE";
		m_fields[13]	=	"COUNTRY";
		m_fields[14]	=	"PHONE";
		m_fields[15]	=	"FAX";
		m_fields[16]	=	"MOBILE";
		m_fields[17]	=	"COMMENTS";
		

	function cd_emailform(button)
	{
		theform = button.form;
		formname = theform.name;
		head = "Validating " + formname + " ...\nTO=";
		m_to		= theform.TO.value;
		//m_to		= "holidaygor.com.au";
		//m_cc		= "CC=";
		//if(theform.CC.value.length)
		//{
		//	m_cc	= "CC=" + theform.CC.value;
		//}
		m_cc		= "CC=info@greatoceanroad.com.au";
		m_subject	= "SUBJECT=" + theform.SUBJECT.value;
		m_body		= "BODY=";
		//newline		= "%0A";
		newline		= "\n%0A";
		
		// Loop through the array of common form element names
		for(var i=4; i<=m_fields.length;i++)
		{
			// Loop through all the elements in the passed form
			for(var j=0;j<theform.elements.length; j++)
			{
				// If the name of the element in the form matches
				// the current common form element name
				if(theform.elements[j].name == m_fields[i])
				{
					// This is one of the common form elements
					// If the user has not entered anything, do nothing
					if(theform.elements[j].value.length > 0)
					{
						// Check to see if it is a field that needs
						// a little further explanation ...
						if(m_fields[i] == "COMMENTS")
						{
							m_body += newline + "Comments:" + newline;
						}
						if(m_fields[i] == "PHONE")
						{
							m_body += "Tel: ";
						}
						if(m_fields[i] == "FAX")
						{
							m_body += "Fax: ";
						}
						// Print the contents of the element value
//						m_body += m_fields[i] + " = " + theform.elements[j].value + newline;
						m_body += theform.elements[j].value + newline;
					}
				}
			}
		}
		// Separate the common elements (above) from any
		// uncommon or unique elements (below)
		m_body += newline + "-----" + newline;
		var used = 0;
		// Loop through all of the elements in the passed form
		for(var j=0; j<theform.elements.length; j++)
		{
			// Loop through all of the common element names again
			for(var i=0; i<m_fields.length;i++)
			{
				// Because if this element has already been added
				// above we don't want to add it again
				if(theform.elements[j].name == m_fields[i])
				{
					used = 1;
				}
			}
			if(used == 0)
			{
				// We haven't used it yet, so we want to add it
				m_body += theform.elements[j].name + " = ";
				// If it's a SELECT element, we need to correctly
				// receive the selected value
				if(theform.elements[j].type == "select-one")
				{
					selindex = theform.elements[j].options.selectedIndex; 
					m_body += theform.elements[j].options[selindex].value + newline;
				}
				else
				{
					 m_body += theform.elements[j].value + newline;
				}
			}
			else
			{
				used = 0;
			}
		}
		theform.action = "mailto:" + m_to + "?" + m_subject + "&" + m_cc + "&" + m_body;
		//alert(theform.action); // for testing purposes only
		self.location = theform.action;
		return false;
	}
