anchor.diff:       return '/cards?page=' + (pag.length > 0 ? pag.text() : "1")
     }
   
  -  var deck = {
  -    entries : {},
  -    get : function(code) {
  -      return this.entries[code]
  -    },
  -    add : function(card) {
  -      var card_entry = this.entries[card.code]
  -      if(!card_entry) {
  -        card_entry = this.entries[card.code] = {card : $.extend({}, card), amount : 0}
  -      } 
  -      card_entry.amount += 1
  -      return card_entry
  -    },
  -    remove : function(code) {
  -      delete this.entries[code]
  -    },
  -    cost : function() {
  -      return  _.reduce(this.entries, function(memo, card_entry) {
  -        return memo + card_entry.amount * card_entry.card.cost()
  -      }, 0)
  -    }
  -  }
  - 
  -  var costMap = function() {
  -    return mageMap[mage()]
  -  } 
  -
     $('#mage_select').one('change', 'input', function() {
  -
  -    var aoDataToMap = function(aoData) {
  -      return _.reduce(aoData, function(memo, data) {
  -        memo[data.name] = data.value
  -        return memo
  -      }, {})
  -    }
   
       var extendCard = function(card) {
         return $.extend({
  
positive.code:     }
    }
  
    var mage = function() {
       return $('input[name="mage"]:checked').val()
    }
  
negative.code:   <% for mage in Mage.all %> mageMap['<%= mage.name %>'] = {}; <% end  %>
    <% for ms in MageSchool.all %> mageMap['<%= ms.mage_name %>']['<%= ms.school_name %>'] = <%= ms.cost %>; <% end %>
  
    var costMap = function() {
      return mageMap[mage()]
    } 
  
    var deck = {
      _entries : {},
      get : function(code) {
        return this._entries[code]
      },
      add : function(card) {
        var card_entry = this._entries[card.code]
        if(!card_entry) {
          card_entry = this._entries[card.code] = {card : $.extend({}, card), amount : 0}
        } 
        card_entry.amount += 1
        return card_entry
      },
      remove : function(code) {
        delete this._entries[code]
      },
      cost : function() {
        return  _.reduce(this._entries, function(memo, card_entry) {
          return memo + card_entry.amount * card_entry.card.cost()
        }, 0)
      },
      codes : function() {
        return _.keys(this._entries)
      },
      entries : function() {
        return _.values(this._entries)
      }
    }
   
    var buildParams = function() {
      return {
        for_type : _.map($("#for_type input:checked"), function(e) {
  