var myrules = {
  '.prod_quantity' : function(el){
    el.onchange = function(){
      $('basketForm').submit();
    }
  },
  '#delivery_select' : function(el){
    el.onchange = function(){
      $('basketForm').submit();
    }
  },
  '.delete' : function(el){
    el.onclick = function(){
      return confirm('Are you sure you want to delete this product?');
    }
  },
  '#same_as_invoice' : function(el){
    el.onclick = function() {
      if($('same_as_invoice').checked == true) {
        //alert($('invoice_title').selectedIndex);
        $('delivery_title').selectedIndex = $('invoice_title').selectedIndex;
        $('delivery_firstname').value = $('invoice_firstname').value;
        $('delivery_surname').value = $('invoice_surname').value;
        $('delivery_address1').value = $('invoice_address1').value;
        $('delivery_address2').value = $('invoice_address2').value;
        $('delivery_town').value = $('invoice_town').value;
        $('delivery_county').value = $('invoice_county').value;
        $('delivery_country').options[$('invoice_country').selectedIndex].value;
        $('delivery_postcode').value = $('invoice_postcode').value;
        $('delivery_country').selectedIndex = $('invoice_country').selectedIndex;
      }
    }
  },
 '#proceed_to_checkout' : function(el){
   el.onclick = function() {
     if($('confirm').checked == true) {
       return true;
     }
	 else {
       alert('Please agree to our terms of sale before proceeding to payment.'); 
       $('confirm_text').style.textDecoration = "underline";
       return false;
     }
   }
 }
};

Behaviour.register(myrules);
