// Contact Form ******************************************************************

// On Load ************************************

	addLoadEvent(setDefaultAddress);
	
/* Set Form Address Type **********************************************************
*
*	TAKES:		NOTHING
*	RETURNS:	NOTHING
*	NOTE:		Sets the default address type.
*
**************************************************************************/

	function setDefaultAddress()
	{
		var defaultAddress = "usAddress";
		var addressElement = getElement("defaultAddress");
		
		if (addressElement != undefined)
		{
			defaultAddress = addressElement.value; 	
		}
		
		if (getElement(defaultAddress) != undefined)
		{
			setFormAddressType(defaultAddress);
		}
	}

/* Set Form Address Type **********************************************************
*
*	TAKES:		Address Type (usAddress | mexicoAddress | canadaAddress | otherAddres)
*	RETURNS:	NOTHING
*	NOTE:		Sets the form address type.
*
**************************************************************************/

	function setFormAddressType(addressType)
	{
		if (addressType)
		{
			
			switch(addressType)
			{
				case "usAddress":
				
					hideElement("otherAddress");
					showElement("standardAddress");
					hideAllStates();
					showElement("usStates");
					break;
			
				case "mexicoAddress":
				
					hideElement("otherAddress");
					showElement("standardAddress");
					hideAllStates();
					showElement("mexicoStates");
					break;
					
				case "canadaAddress":
				
					hideElement("otherAddress");
					showElement("standardAddress");
					hideAllStates();
					showElement("canadaStates");
					break;
					
				case "otherAddress":
				
					hideElement("standardAddress");
					showElement("otherAddress");
					break;
			}
			
			
		}
	}

/* Hide All States **********************************************************
*
*	TAKES:		NOTHING
*	RETURNS:	NOTHING
*	NOTE:		Hides all address elements.
*
**************************************************************************/

	function hideAllStates()
	{
		hideElement("usStates");
		hideElement("mexicoStates");
		hideElement("canadaStates");
	}