function TradeRate() {
  this.cards = new Array();

  this.constructor = function() {
    var i, j, k, temp;
    this.cards.push(new Array(1, 1, 1, 2, 2));
    this.cards.push(new Array(1, 1, 2, 2, 2));
    this.cards.push(new Array(1, 1, 2, 2, 3));
    this.cards.push(new Array(1, 2, 2, 2, 3));
    this.cards.push(new Array(1, 2, 2, 3, 3));
    for (i=0; i<2; i++) {
      for (j=0; j<this.cards.length; j++) {
        k = Math.floor(Math.random() * this.cards.length);
        temp = this.cards[j];
        this.cards[j] = this.cards[k];
        this.cards[k] = temp;
      }
    }
  }

  this.start = function() {
    var i, j;
    document.getElementById("tradeRate").style.visibility = "visible";
    for (i=0; i<5; i++) {
      j = i + 1;
      document.getElementById("tradeRate" + j).innerHTML = this.cards[0][i];
    }
  }

  this.get = function(card) {
    var i = card.cost;
    i--;
    return this.cards[0][i];
  }

  this.end = function() {
    var tmp = this.cards.shift();
    this.cards.push(tmp);
    document.getElementById("tradeRate").style.visibility = "hidden";
  }
}
