// JavaScript Document
$(document).ready(function(){
// Copy Address Button
	$('#copybutton button').click(function(){
		
		// select the shipping title
		$('#shipping select[@name="ship-title"]').val($('#invoice select[@name="inv-title"] option:selected').val());
		
		// copy the invoice field values over to the shipping fields
		$('#invoice input[@name^="inv-"]').each(function(){
			var $val = $(this).val();
			var $name = $(this).attr('name').replace(/^inv/,"ship");
			$('#shipping input[@name="'+$name+'"]').val($val);
		});
		return false;
	});
});