var wage_idx = 0;
var wage_tot = 8;
var salary = new Array(wage_tot);

// =========================================================================================
salary[0] =  new wage(2008, 'Arkansas State',        'Steve Roberts',          140000, 31042, 0,     171042, 'arkansas_state_fb.pdf');
salary[1] =  new wage(2008, 'Florida Atlantic',      'Howard Schnellenberger', 330163, 1000,  0,     331163, 'florida_atlantic_fb.pdf');
salary[2] =  new wage(2008, 'Florida International', 'Mario Cristobal',        381076, 0,     50000, 381076, 'florida_international_fb.pdf');
salary[3] =  new wage(2008, 'Louisiana Lafayette',   'Rickey Bustle',          160750, 35000, 42375, 195750, 'louisiana_lafayette_fb.pdf');
salary[4] =  new wage(2008, 'Louisiana Monroe',      'Charlie Weatherbie',     155000, 50000, 30000, 205000, 'louisiana_monroe_fb.pdf');
salary[5] =  new wage(2008, 'Middle Tennessee',      'Rick Stockstill',        207955, 75000, 75000, 282955, 'middle_tennessee_fb.pdf');
salary[6] =  new wage(2008, 'North Texas',           'Todd Dodge',             230000, 31000, 82000, 261000, 'north_texas_fb.pdf');
salary[7] =  new wage(2008, 'Troy',                  'Larry Blakeney',         237038, 51000, 22500, 288038, 'troy_fb.pdf');
salary[8] =  new wage(2008, 'Western Kentucky',      'David Elson',            175000, 4600,  94498, 179600, 'western_kentucky_fb.pdf');
// =========================================================================================
/*
Sun Belt Conference coaches slaries
http://www.usatoday.com/sports/college/football/2006-11-16-coaches-salaries-cover_x.htm
*/
// =========================================================================================

build_div_salaries ();

function wage (year, teamname, coachname, salary, other, bonus, total, pdf) {
	this.year = year;
	this.teamname = teamname;
	this.coachname = coachname;
	this.salary = salary;
	this.other = other;
	this.bonus = bonus;
	this.total = total;
	this.pdf = pdf;
}

function build_div_salaries() {
	document.write("<div style=\"width: 300px;\">\n");
	document.write("	<div class=\"s_head\">\n");
	document.write("		<div class=\"s_colhead\">\n");
	document.write("			<span class=\"s_team\">University</span>\n");
	document.write("			<span class=\"s_coach\">Coach</span>\n");
	document.write("			<span class=\"s_link\">&nbsp;</span>\n");
	document.write("		</div>\n");
	document.write("		<div class=\"s_colspace\"></div>\n");
	document.write("	</div>\n");
	for (idx = wage_idx; idx <= wage_tot; idx++) {
		wr_coach ( idx, salary[idx].year, salary[idx].teamname, salary[idx].coachname, salary[idx].salary
				 , salary[idx].other, salary[idx].bonus, salary[idx].total, salary[idx].pdf);
	}
	document.write("</div>\n");
}

function wr_coach (idx, year, teamname, coachname, salary, other, bonus, total, pdf) {
	findvariables (year, teamname);
	document.write("<div class=\"s_row\" style=\"background: url(\'images/teams/bkgnds/" + teamcode + "_bg.png\') repeat-x;\">\n");
	document.write("	<div class=\"s_team_info\">\n");
	document.write("		<span class=\"s_team\">" + teamname + "</span>\n");
	document.write("		<span class=\"s_coach\">" + coachname + "</span>\n");
	document.write("		<span class=\"s_link\" onclick=\"javascript: window.open(\'http://www.usatoday.com/sports/graphics/coaches_contracts07/pdfs2007/" + pdf + "\');\"><img src=\"images/icon.offsite.gif\" width=\"12\" height=\"9\" alt=\"\" border=\"\" /></span>\n");
	document.write("	</div>\n");
	document.write("	<div class=\"s_team_img\" style=\"background: url(\'images/teams/" + teamcode + "_sm.gif\') no-repeat 0px -9px;\"></div>\n");
	document.write("</div>\n");
	document.write("<div class=\"s_row2\" style=\"background: " + seccolor + "\">\n");
	document.write("	<div class=\"s_salary_info\">\n");
	document.write("		<span class=\"s_salary\">Salary: $ " + comma(salary) + "</span>\n");
	document.write("		<span class=\"s_other\">Other: $ " + comma(other) + "</span>\n");
	document.write("	</div>\n");
	document.write("</div>\n");
	document.write("<div class=\"s_row2\" style=\"background: " + seccolor + "\">\n");
	document.write("	<div class=\"s_salary_info\">\n");
	document.write("		<span class=\"s_bonus\">Bonus: $ " + comma(bonus) + "</span>\n");
	document.write("		<span class=\"s_total\" style=\"background: " + pricolor + "\">Total: $ " + comma(total) + "</span>\n");
	document.write("	</div>\n");
	document.write("</div>\n");
}

function comma(number) {
	number = '' + number;
	if (number.length > 3) {
		var mod = number.length % 3;
		var output = (mod > 0 ? (number.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(number.length / 3); i++) {
			if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
		}
		return (output);
	}
	else return number;
}