function Upper () {
	this.ones = new Score ()
	this.twos = new Score ()
	this.threes = new Score ()
	this.fours = new Score ()
	this.fives = new Score ()
	this.sixes = new Score ()
}

function Lower () {
	this.tKind = new Score ()
	this.fKind = new Score ()
	this.fHouse = new Score ()
	this.low = new Score ()
	this.high = new Score ()
	this.chance = new Score ()
	this.yahtzee = new Score ()
}

function addUBonus () {
	this.uBonus.val = 35
}

function addLBonus () {
	this.lBonus.val += 100
}

function Scores () {
	this.uBonus = new Score ()
	this.lBonus = new Score ()
	this.addUBonus = addUBonus
	this.addLBonus = addLBonus

	this.yScored = false
	this.yMissed = false
	this.yJustScored = false

	this.upper = new Upper ()
	this.lower = new Lower ()
	this.upperTotal = upperTotal
	this.lowerTotal = lowerTotal
	this.high = 0

	this.getHigh = getHigh
	this.setHigh = setHigh
}

function upperTotal () {
	var t = 0
	t += this.upper.ones.val
	t += this.upper.twos.val
	t += this.upper.threes.val
	t += this.upper.fours.val
	t += this.upper.fives.val
	t += this.upper.sixes.val

	return t + this.uBonus.val
}

function lowerTotal () {
	var t = 0
	t += this.lower.tKind.val
	t += this.lower.fKind.val
	t += this.lower.fHouse.val
	t += this.lower.low.val
	t += this.lower.high.val
	t += this.lower.chance.val
	t += this.lower.yahtzee.val

	return t + this.lBonus.val
}

function getHigh () {
	return this.high
}

function setHigh (x) {
	this.high = x
}
