// JavaScript Document

var classNamePrefixes = new Array();
classNamePrefixes["SearchButton"] = "SearchButton";
classNamePrefixes["SearchButtonUp"] = "SearchButton";
classNamePrefixes["SearchButtonDown"] = "SearchButton";
classNamePrefixes["SearchButtonFlat"] = "SearchButton";
classNamePrefixes["SearchButtonFocus"] = "SearchButton";
classNamePrefixes["SearchButtonDisabled"] = "SearchButton";
classNamePrefixes["OpenButton"] = "OpenButton";
classNamePrefixes["OpenButtonUp"] = "OpenButton";
classNamePrefixes["OpenButtonDown"] = "OpenButton";
classNamePrefixes["OpenButtonFlat"] = "OpenButton";
classNamePrefixes["OpenButtonFocus"] = "OpenButton";
classNamePrefixes["DateButton"] = "DateButton";
classNamePrefixes["DateButtonUp"] = "DateButton";
classNamePrefixes["DateButtonDown"] = "DateButton";
classNamePrefixes["DateButtonFlat"] = "DateButton";
classNamePrefixes["DateButtonFocus"] = "DateButton";
classNamePrefixes["DateButtonDisabled"] = "DateButton";
classNamePrefixes["Button"] = "Button";
classNamePrefixes["ButtonUp"] = "Button";
classNamePrefixes["ButtonDown"] = "Button";
classNamePrefixes["ButtonFlat"] = "Button";
classNamePrefixes["ButtonFocus"] = "Button";
classNamePrefixes["ButtonDisabled"] = "Button";
classNamePrefixes["ButtonAlt"] = "ButtonAlt";
classNamePrefixes["ButtonAltUp"] = "ButtonAlt";
classNamePrefixes["ButtonAltDown"] = "ButtonAlt";
classNamePrefixes["ButtonAltFlat"] = "ButtonAlt";
classNamePrefixes["ButtonAltFocus"] = "ButtonAlt";
classNamePrefixes["GridDataSelectableUp"] = "GridDataSelectable";
classNamePrefixes["GridDataSelectable"] = "GridDataSelectable";
classNamePrefixes["GridColumnHeaderSortableUp"] = "GridColumnHeaderSortable";
classNamePrefixes["GridColumnHeaderSortable"] = "GridColumnHeaderSortable";
classNamePrefixes["GridColumnHeaderSortableDownAsc"] = "GridColumnHeaderSortable";
classNamePrefixes["GridColumnSubHeaderSortable"] = "GridColumnSubHeaderSortable";
classNamePrefixes["GridColumnSubHeaderSortableUp"] = "GridColumnSubHeaderSortable";
classNamePrefixes["GridColumnSubHeaderSortableDownAsc"] = "GridColumnSubHeaderSortable";
classNamePrefixes["ReportLink"] = "ReportLink";
classNamePrefixes["ReportLinkUp"] = "ReportLink";
classNamePrefixes["ReportLinkDown"] = "ReportLink";

function setButtonEffects() {
	inputArray = document.getElementsByTagName("input");
	for (var i = 0; i < inputArray.length; i++) {
		if ((inputArray[i].type == "button") && (typeof(classNamePrefixes[inputArray[i].className]) != 'undefined')) {
			inputArray[i].onmouseover = function () { if (!this.disabled) this.className = classNamePrefixes[this.className] + "Up";}
			inputArray[i].onmouseout = function () { if (!this.disabled) this.className = classNamePrefixes[this.className] + "";}
			inputArray[i].onmousedown = function () { if (!this.disabled) this.className = classNamePrefixes[this.className] + "Down";}
			inputArray[i].onmouseup = function () { if (!this.disabled) this.className = classNamePrefixes[this.className] + "Up";}
			inputArray[i].setDisabled = function (pDisable) { this.disabled = pDisable; this.className = (pDisable) ? classNamePrefixes[this.className] + "Disabled" : classNamePrefixes[this.className]; }
		}
	}
	inputArray = getElementsByClassName(document, "td", "GridDataSelectable");
	for (var i = 0; i < inputArray.length; i++) {
		if (typeof(classNamePrefixes[inputArray[i].className]) != 'undefined') {
			inputArray[i].onmouseover = function () { if (this.className != "GridDataSelected") setCellsClassName(this.parentNode, classNamePrefixes[this.className] + "Up");}
			inputArray[i].onmouseout = function () { if (this.className != "GridDataSelected") setCellsClassName(this.parentNode, classNamePrefixes[this.className] + "");}
			inputArray[i].onmousedown = function () { if (this.className != "GridDataSelected") setCellsClassName(this.parentNode, classNamePrefixes[this.className] + "");}
			inputArray[i].onmouseup = function () { if (this.className != "GridDataSelected") setCellsClassName(this.parentNode, classNamePrefixes[this.className] + "Up");}
			inputArray[i].onclick = function () { 
																						if (this.className != "GridDataSelected") {
																							setCellsClassName(this.parentNode, "GridDataSelected");
																							if (this.parentNode.parentNode.selectedIndex > -1) setCellsClassName(this.parentNode.parentNode.rows[this.parentNode.parentNode.selectedIndex], "GridDataSelectable");
																							this.parentNode.parentNode.selectedIndex = this.parentNode.rowIndex; 
																						}			
																					}
		}
	}
	
	inputArray = getElementsByClassName(document, "td", "GridColumnHeaderSortable");
	for (var i = 0; i < inputArray.length; i++) {
		if (typeof(classNamePrefixes[inputArray[i].className]) != 'undefined') {
			inputArray[i].onmouseover = function () { this.className = classNamePrefixes[this.className] + "Up";}
			inputArray[i].onmouseout = function () { this.className = classNamePrefixes[this.className] + ""}
			inputArray[i].onmousedown = function () { this.className = classNamePrefixes[this.className] + "DownAsc"}
			inputArray[i].onmouseup = function () { this.className = classNamePrefixes[this.className] + "Up"}
		}
	}
	
	inputArray = getElementsByClassName(document, "td", "GridColumnSubHeaderSortable");
	for (var i = 0; i < inputArray.length; i++) {
		if (typeof(classNamePrefixes[inputArray[i].className]) != 'undefined') {
			inputArray[i].onmouseover = function () { this.className = classNamePrefixes[this.className] + "Up";}
			inputArray[i].onmouseout = function () { this.className = classNamePrefixes[this.className] + ""}
			inputArray[i].onmousedown = function () { this.className = classNamePrefixes[this.className] + "DownAsc"}
			inputArray[i].onmouseup = function () { this.className = classNamePrefixes[this.className] + "Up"}
		}
	}	
	
	var linkArray = getElementsByClassName(document, "li", "Link");
	for (var i=0; i < linkArray.length; i++) {
		linkArray[i].onmouseover = function () { this.className = "LinkUp";}
		linkArray[i].onmouseout = function () { this.className = "Link";}
		linkArray[i].onmousedown = function () { this.className = "LinkDown";}
		linkArray[i].onmouseup = function () { this.className = "LinkUp";}
	}	
	
  var linkArray = getElementsByClassName(document, "td", "ReportLink");
	for (var i=0; i < linkArray.length; i++) {
		linkArray[i].onmouseover = function () { this.className = "ReportLinkUp";}
		linkArray[i].onmouseout = function () { this.className = "ReportLink";}
		linkArray[i].onmousedown = function () { this.className = "ReportLinkDown";}
		linkArray[i].onmouseup = function () { this.className = "ReportLinkUp";}
	}	
}

function setCellsClassName(pRow, pClassName) {
	for (var i = 0; i < pRow.cells.length; i++) {
		pRow.cells[i].className = pClassName;
	}
}

