$(document).ready(function(){
  $('input#order_use_billing').click(function() {
    show_billing(!$(this).is(':checked'));
  });

  $('#guest_checkout_true').change(function() {
    $('#customer_search').val("");
    $('#user_id').val("");
    $('#checkout_email').val("");
    $('#guest_checkout_false').prop("disabled", true);

    var fields = ["firstname", "lastname", "company", "address1", "address2",
              "city", "zipcode", "state_id", "country_id", "phone"]
    $.each(fields, function(i, field) {
      $('#order_bill_address_attributes' + field).val("");
      $('#order_ship_address_attributes' + field).val("");
    })
  });

  var show_billing = function(show) {
    if(show) {
      $('#shipping').show();
      $('#shipping input').prop("disabled", false);
      $('#shipping select').prop("disabled", false);
    } else {
      $('#shipping').hide();
      $('#shipping input').prop("disabled", true);
      $('#shipping select').prop("disabled", true);
    }
  }

});



@@ -23,16 +23,359 @@
 tion()%7B%0A
+  var show_billing = function(show) %7B%0A    if(show) %7B%0A      $('#shipping').show();%0A      $('#shipping input').prop(%22disabled%22, false);%0A      $('#shipping select').prop(%22disabled%22, false);%0A    %7D else %7B%0A      $('#shipping').hide();%0A      $('#shipping input').prop(%22disabled%22, true);%0A      $('#shipping select').prop(%22disabled%22, true);%0A    %7D%0A  %7D%0A%0A
   $('inp
@@ -987,352 +987,8 @@
 %7D);%0A
-%0A  var show_billing = function(show) %7B%0A    if(show) %7B%0A      $('#shipping').show();%0A      $('#shipping input').prop(%22disabled%22, false);%0A      $('#shipping select').prop(%22disabled%22, false);%0A    %7D else %7B%0A      $('#shipping').hide();%0A      $('#shipping input').prop(%22disabled%22, true);%0A      $('#shipping select').prop(%22disabled%22, true);%0A    %7D%0A  %7D%0A%0A
 %7D);%0A

Define show_billing function in checkouts/edit.js up top, before event binding that uses it