function AddEdit_Checkout_AddressForm ( cn  ) {

		var theform = $('AddEditForm');

		if (theform.UseAs.selectedIndex==0) {
		    alert("Please select how you want to use this address.");
			theform.UseAs.focus();
			return true;
		}
		
        if (theform.nickname.value=="") {
			    theform.nickname.focus();
				alert("Please enter how you would like to save this address. ie. nickname.");
				return false;
			}
			
	        if (theform.firstname.value=="") {
			    theform.firstname.focus();
				alert("Please enter the first name for this address.");
				return false;
			}
			
	        if (theform.lastname.value=="") {
			    theform.lastname.focus();
				alert("Please enter the last name for this address.");
				return false;
			}
			
	        if (theform.address1.value=="") {
			    theform.address1.focus();
				alert("Please enter the street address for this new address.");
				return false;
			}
			
	        if (theform.city.value=="") {
			    theform.city.focus();
				alert("Please enter the city this new address.");
				return false;
			}
			
	        if (theform.zip.value=="") {
			    theform.zip.focus();
				alert("Please enter the zip code this new address.");
				return false;
			}
			
			var c = theform.country.options[theform.country.selectedIndex].value;
			var p = theform.phone.value;
			p = ReturnPhone ( p )
	
			if (p.length==0) {
			    theform.phone.focus();
				alert("Please enter the phone number this new address.");
				return false;
			} else {
			    if (c=="United States" || c=="Canada") {
				    if (p.length < 10) {
					    theform.phone.focus();
				        alert("Please enter a valid 10 digit phone number this new address.");
				        return false;
					    }
				} else {
				    if (p.length < 8) {
					    theform.phone.focus();
				        alert("Please enter a valid international phone number for this new address.");
				        return false;
					    }
				   }
			}
		
theform.submit();
}
//-----------------------------------------------------------------------------------------

function ReturnPhone (strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;

   if (strString.length == 0) return "";

   var nstr = ""
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length; i++)
      {
      strChar = strString.charAt(i);
	  //alert(strChar+ " " + strValidChars.indexOf(strChar));
      if (strValidChars.indexOf(strChar) != -1){
         nstr = nstr + strChar;
         }
      }
   return nstr;
   }
 //-----------------------------------------------------------------------------------------		
	
