function Bid(parentViewModel, value) {
    var self = this;

    self.value = value;
    self.name = CinchApp.bidNames[value] || value.toString(); //If bid name exists for value use it, otherwise use value
    self.isValid = ko.computed(function() {
        if(self.value === CinchApp.bids.pass) {
            //Can always pass unless you're the dealer and everyone else has passed
            return parentViewModel.isActivePlayer() &&
                !(parentViewModel.dealer() === CinchApp.players.south && parentViewModel.highBid() <= CinchApp.bids.pass);
        }
        else if(self.value === CinchApp.bids.cinch) {
            //Can always bid Cinch if you're the dealer
            return parentViewModel.isActivePlayer() &&
                (parentViewModel.highBid() < CinchApp.bids.cinch || parentViewModel.dealer() === CinchApp.players.south);
        }
        else {
            return parentViewModel.isActivePlayer() && parentViewModel.highBid() < self.value;
        }
    });
    self.submit = function() {
        CinchApp.socket.emit('bid', self.value);
    };
}
//Represents a possible bid to be made by the player
Represents a possible bid to be made by the player
Represents a possible bid to be made by the player
function Bid(parentViewModel, value) {
    var self = this;
    self.value = value;
    self.name = CinchApp.bidNames[value] || value.toString(); 
    self.isValid = ko.computed(function() {
        if(self.value === CinchApp.bids.pass) {
            return parentViewModel.isActivePlayer() &&
                !(parentViewModel.dealer() === CinchApp.players.south && parentViewModel.highBid() <= CinchApp.bids.pass);
        }
        else if(self.value === CinchApp.bids.cinch) {
            return parentViewModel.isActivePlayer() &&
                (parentViewModel.highBid() < CinchApp.bids.cinch || parentViewModel.dealer() === CinchApp.players.south);
        }
        else {
            return parentViewModel.isActivePlayer() && parentViewModel.highBid() < self.value;
        }
    });
    self.submit = function() {
        CinchApp.socket.emit('bid', self.value);
    };
}
function Bid ( parentViewModel , value ) { var self = this ; self . value = value ; self . name = CinchApp . bidNames [ value ] || value . toString ( ) ; self . isValid = ko . computed ( function ( ) { if ( self . value === CinchApp . bids . pass ) { return parentViewModel . isActivePlayer ( ) && ! ( parentViewModel . dealer ( ) === CinchApp . players . south && parentViewModel . highBid ( ) <= CinchApp . bids . pass ) ; } else if ( self . value === CinchApp . bids . cinch ) { return parentViewModel . isActivePlayer ( ) && ( parentViewModel . highBid ( ) < CinchApp . bids . cinch || parentViewModel . dealer ( ) === CinchApp . players . south ) ; } else { return parentViewModel . isActivePlayer ( ) && parentViewModel . highBid ( ) < self . value ; } } ) ; self . submit = function ( ) { CinchApp . socket . emit ( 'bid' , self . value ) ; } ; }
Represents a possible bid to be made by the player
Represents a possible bid to be made by the player
//If bid name exists for value use it, otherwise use value //Can always pass unless you're the dealer and everyone else has passed //Can always bid Cinch if you're the dealer