/******************************************************************************
 setScore sets the competitor's score.
 ******************************************************************************/
function setScore() {
	if(inRange(this.judge11) && inRange(this.judge21) && inRange(this.judge31) && inRange(this.judge41) && inRange(this.deductions1) &&
	   inRange(this.judge12) && inRange(this.judge22) && inRange(this.judge32) && inRange(this.judge42) && inRange(this.deductions2)) {
	  // The scores are within range, so calculate the score.
	  var score1 = (midScoresSum(this.judge11, this.judge21, this.judge31, this.judge41) / 2) - this.deductions1;
	  var score2 = (midScoresSum(this.judge12, this.judge22, this.judge32, this.judge42) / 2) - this.deductions2;
  	
  	if(score1 > score2) {
  		// The first vault run was the better score.
  	  this.score = scorify(score1);
  	}
  	else {
  		// The second vault run was the better score.
  	  this.score = scorify(score2);
  	}
  }
	else {
	  // Scores were not entered, return non-breaking space.
	  this.score = "&nbsp;";
	}
}

/******************************************************************************
 competitor is an object.  This is the definition for that object.  'new'
 will create a new instance of competitor and stuff parameter data into and
 initialize properties of the object.
 ******************************************************************************/
function competitor(indiv, fName, lName, year, school, judge11, judge21, judge31, judge41, deductions1,
                                                       judge12, judge22, judge32, judge42, deductions2) {
	this.indiv = indiv;											// bool
	this.fName = fName;											// string
	this.lName = lName;											// string
	this.year = year;												// int
	this.school = school;										// string
	this.judge11 = judge11;									// float
	this.judge21 = judge21;									// float
	this.judge31 = judge31;									// float
	this.judge41 = judge41;									// float
	this.deductions1 = deductions1;					// float
	this.judge12 = judge12;									// float
	this.judge22 = judge22;									// float
	this.judge32 = judge32;									// float
	this.judge42 = judge42;									// float
	this.deductions2 = deductions2;					// float
	this.score = "";      								  // string
	this.place = "&nbsp;";									// string
	this.getFullName = getFullName;					// getFullName() returns string with competitor's full name
	this.setScore = setScore;               // setScore() sets the competitor's score
}