window.onload = function(){
	selectRows();
	changeButttons();
}
window.onresize = function(){
}

/*
Use page_onload if you want a client script to
execute on page load by using the window.load syntax
and want to keep the existing functionality.
USAGE: 
var pfun = window.onload
window.onload = init
function init()
{
	new page_onload(pfun);
	// execute your code here
}
*/
function page_onload(pfun)
{
	this.func = pfun
	this.func();
}
/*
	Selecting table rows on rollover
*/
function mo()
{
	this.classBefore = this.className;
	this.className = "selected";
}
function mot()
{
	this.className = this.classBefore;
	this.classBefore = "";
}

function selectRows() {
	var tables = document.getElementsByTagName("table");
	for (var i = 0; i< tables.length; i++)
		if (tables[i].className == 'table-sort')
		{
			var rows = tables[i].getElementsByTagName("tr");
			for (var j=1;j<rows.length;j++) {
				rows[j].onmouseover = mo
				rows[j].onmouseout = mot
			}
		}
}

/*
	Rollovers for buttons
*/

function changeButttons() {
	var inputs = document.getElementsByTagName("input");
	for(var i = 0; i < inputs.length; i++){
		if(inputs[i].type == 'submit' || inputs[i].type == 'button'){
			inputs[i].onmouseover = function() {
				this.style.backgroundColor = "#2C69F1";
			};
			inputs[i].onmouseout = function() {
				this.style.backgroundColor = "#214FB5";
			};
			inputs[i].onmousedown = function() {
				this.style.backgroundColor = "#183A85";
			};
			inputs[i].onmouseup = function() {
				this.style.backgroundColor = "#214FB5";
			};
		}
	}
}


