function limitTable(tableobj, columnnum, limitvalue) {
	var dolimit = true;
	var showrow;

	if ( !tableobj )
		return false;

	if ( isNaN(columnnum) )
		columnnum = null;

	if ( limitvalue == null || limitvalue == undefined || limitvalue == '' ) {
		dolimit = false;
	} else {
		limitvalue = limitvalue.toUpperCase();
	}

	for ( var i = 1; i < tableobj.rows.length; i++ ) {
		// check to see if this row has a class of limitable
		if ( tableobj.rows[i].className.indexOf('limitable') == -1 ) {
			continue;	// off limits, so to speak
		}

		// make sure this row's cells array is large enough
		if ( columnnum && !tableobj.rows[i].cells[columnnum] ) {
			continue;
		}

		showrow = false;	// assume we hide the row
		if ( !dolimit ) {	// if we are undoing a limit
			showrow = true;
		} else {
			if ( columnnum ) {	// if we have a specific column to test
				testtext = tableobj.rows[i].cells[columnnum].innerHTML.toUpperCase();
				if ( testtext.indexOf(limitvalue) != -1 ) {	// if found
					showrow = true;
				}
			} else {	// no specific column to test, so check all of them
				for ( var j = 0; j < tableobj.rows[i].cells.length; j++ ) {
					testtext = tableobj.rows[i].cells[j].innerHTML.toUpperCase();
					if ( testtext.indexOf(limitvalue) != -1 ) {	// if found
						showrow = true;
						break;	// no reason to continue the for loop
					}
				}
			}
		}

		// after testing, we know whether or now to show the row
		if ( showrow ) {
			tableobj.rows[i].style.display = 'table-row';	// show the row
		} else {
			tableobj.rows[i].style.display = 'none';		// hide the row
		}
	}

	return true;
}

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
	var vars = [], hash;
	if ( window.location.href.indexOf('?') + 1 > 0 ) {
		var hashes = window.location.href.substr(window.location.href.indexOf('?') + 1).split('&');

		for(var i = 0; i < hashes.length; i++)
		{
			hash = hashes[i].split('=');
			vars[hash[0]] = hash[1];
		}
	}

	return vars;
}

function focusFirstFormField(formid) {
	var form = document.getElementById(formid);

	if ( form ) {
		for ( var i = 0; i < form.elements.length; i++ ) {
			if ( form.elements[i].type != 'hidden' ) {
				if ( form.elements[i].select ) {
					form.elements[i].select();
				} else {
					form.elements[i].focus();
				}
				break;
			}
		}
	}
}

function siteOnLoad() {
	focusFirstFormField('focusform');
	if (typeof pageOnLoad == 'function') {
		pageOnLoad();
	}
	if (typeof initPopup == 'function') {
		initPopup();
	}
}

window.onload = siteOnLoad;
