function eCart_copyBillingToShipping(cb){
	if(cb.checked){ // Only copy when the checkbox is checked.
		var theForm = cb.form;
		// The number of elements must match in billingFields and shippingFields. The type of input element must also match between the arrays.
		var billingFields = new Array('firstname', 'lastname', 'email', 'phone', 'fax', 'street1', 'street2', 'city', 'state_province', 'postcode', 'country');
		var shippingFields = new Array('shipping_firstname', 'shipping_lastname', 'shipping_email', 'shipping_phone', 'shipping_fax', 'shipping_street1', 'shipping_street2', 'shipping_city', 'shipping_state_province', 'shipping_postcode', 'shipping_country');
		
		for(var i=0;i<billingFields.length;i++){
			var billingObj = theForm.elements[billingFields[i]];
			var shippingObj = theForm.elements[shippingFields[i]];
			if(billingObj && shippingObj){
				if(billingObj.tagName){ // non-radio groups
					var tagName = billingObj.tagName.toLowerCase();
					if(tagName == 'select'){
						shippingObj.selectedIndex = billingObj.selectedIndex;
					}
					else if((billingObj.type && shippingObj.type ) && (billingObj.type == 'checkbox' || billingObj.type == 'radio')){
						shippingObj.checked = billingObj.checked;
					}
					else{ // textareas and other inputs
						shippingObj.value = billingObj.value;
					}					
				}
				else if(billingObj.length){ // radio group
					for(var r=0;r<billingObj.length;r++){
						shippingObj[r].checked = billingObj[r].checked;
					}
				}
			}
		}
	}
}