function doState(src,onc) {
	
	var type=src;
	var url = '/store/register/get_state' + '/'+$(src+"_country_id").get('value')+'/'+type;
	var req = new Request.HTML ({
			method: 'get',
			url: url,
          	onComplete: function(){
				if(onc)
					$('delivery_state_id').selectedIndex=$('billing_state_id').selectedIndex;
      		},	
			onCancel: function() {
				
			},
			update: $('div_'+src+'_state')  
		}).send();
}

 function copy_billing() {

 $each(['street','suburb','city','postcode'], function(id, index){
   $('delivery_'+id).set('value',$('billing_'+id).get('value'));
 });
  $('delivery_attention').set('value',$('firstname').get('value')+" "+$('lastname').get('value'));
  $('delivery_country_id').selectedIndex=$('billing_country_id').selectedIndex;
  doState('delivery',1);
 }