/*
	ATA Nationals scripts
	Developed by BrandEvolve
*/


/* --- Popup window functions --- */

// Fixed popup window
function popup(URL, width, height) {
	popWin = window.open(URL, "popWin", "width=" + width + ",height=" + height + ",resizable=0,scrollbars=0,location=0,toolbar=0");
	popWin.focus();
	return false;
}

// Resizable and scrollable popup window
function popupResize(URL, width, height) {
	popWin = window.open(URL, "popWin", "width=" + width + ",height=" + height + ",resizable=1,scrollbars=1,location=0,toolbar=0");
	popWin.focus();
	return false;
}


/* --- Display enhancements --- */

// Alternate data table rows
function tableRows() {
	var evenodd, tables, rows;

	tables = document.getElementsByTagName("table");

	for (var i = 0; i < tables.length; i++)
		// If a "data" table
		if (tables[i].className.indexOf("data") >= 0) {
			rows = tables[i].getElementsByTagName("tr");
			evenodd = "even";

			// Traverse each row
			for (var j = 0; j < rows.length; j++)

				// Check for at least one data cell in row (skip header rows)
				if (rows[j].getElementsByTagName("td").length > 0) {
					evenodd = (evenodd == "even") ? "odd" : "even";

					// Insert/append new class name
					rows[j].className += (rows[j].className == null) ? evenodd : (rows[j].className == "odd" || rows[j].className == "even") ? "" : " " + evenodd;
				}
		}
}


/* --- Page initialization --- */

// Add function to any event handler (multibrowser)
function addEvent(obj, evType, fn) {

	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	} else
		return false;
}

// Run all onload functions
if (document.getElementById) {
	addEvent(window, 'load', tableRows);
}