
function SubmitAddress(Action)
{
	var AfterSaveAddress = function(oXML) {			
		var result = oXML.responseText;
		regularCursor();
		//prompt ('',result);
		alert (result);
	}
	var thepage = '/modules/Addresses/processaddress.asp';
	if (validateAddress()){
		var data = "action=" + Action + "&" + fetchInputFormData('frmAddress');	
		hiddenSubmit(thepage,data, AfterSaveAddress, 0, null, null,true);
	}    
}

function validateAddress(){
	
	var thereturn;
	thereturn = false;


	if (document.frmAddress.txtAddressDesc1.value.trim() != "")
	{
		if (document.frmAddress.txtPostalCode.value.trim() != "")
		{
			if (document.frmAddress.txtCity.value.trim() != "" )
			{	
				if (document.frmAddress.txtProvince.value.trim() != "" )
				{					
					if (document.frmAddress.txtCountry.value.trim() != "" )
					{
						thereturn = true;
					}
					else
					{	
						alert ("Please enter a valid Country Name before continuing");
						document.frmAddress.txtCountry.focus();
					}
				}
				else
				{
					alert ("Please enter a valid Province before continuing");
					document.frmAddress.txtProvince.focus();
				}					
			}
			else
			{
				alert ("Please enter a valid City before continuing");
				document.frmAddress.txtCity.focus();
			}
		}
		else
		{
			alert ("Please enter a valid Postal Code before continuing");
			document.frmAddress.txtPostalCode.focus();
		}
	}
	else
	{
		alert ("Please enter a valid value for Street Address 1 before continuing");
		document.frmAddress.txtAddressDesc1.focus();
	}

	return thereturn;
}