function selectRow( element ) {
	changeRowStyle( element, "row-hover" );
}

function unselectRow( element ) {
	changeRowStyle( element, "" );
}

function changeRowStyle( rowElement, className ) {
	actual_style=rowElement.className;
	actual_style_left=actual_style.lastIndexOf("row-hover");
	if(actual_style_left>=0){
		left_style=actual_style.substr(0,actual_style_left-1);
	}
	else{
		left_style=rowElement.className;
	}			
	rowElement.className=left_style + " " + className;
}

/*
function changeRowStyle( element, className ) {
	var parent = element;
	while ( parent ){
		if ( parent.tagName == "TR" ) {			
			actual_style=parent.className;
			actual_style_left=actual_style.lastIndexOf("aon-table-row-hover");
			if(actual_style_left>=0){
				left_style=actual_style.substr(0,actual_style_left-1);
			}
			else{
				left_style=parent.className;
			}			
			parent.className=left_style + " " + className;
			break;
		}
		parent = parent.parentNode;
	}
}
*/

rowEnabled = true;

function enableRowSubmit( prop) {
	rowEnabled = prop;
}

function sendRow( e ){
	if ( rowEnabled ) {
		element = e.firstChild;
		link = getTblLink( element );
		if ( link ) {
			link.onclick();
		}
	}
}

function getTblLink( e ){
	while ( e ){
		//e.tagName.toUpperCase() == "A" &&
		if (  e.className=="row-selector") {
			return e;
		} else {
			child = e.firstChild;
			if (child) {
				r = getTblLink( child );
				if (r) {
					return r
				}
			}
			e = e.nextSibling;
		}
	}
	return null;
}

/*
function getTblLink( e ){
	while ( e ){
		if ( e.tagName == "A" && e.className=="aon-table-row-selected") {
			return e;
		} else {
			child = e.firstChild;
			if (child) {
				r = getTblLink( child );
				if (r) {
					return r
				}
			}
			e = e.nextSibling;
		}
	}
	return null;
}
*/

function cssJsMenu(elemId) {
  if (document.getElementById(elemId)) {
    var navroot = document.getElementById(elemId);
    var lis=navroot.getElementsByTagName("LI");

    for (i=0; i<lis.length; i++) {
      for (j=0; j<lis[i].getElementsByTagName("UL").length; j++) {
        lis[i].onmouseover = function() {
          this.getElementsByTagName("UL")[j].style.visibility = 'visible';
        }

        lis[i].onmouseout = function() {
          this.getElementsByTagName("UL")[j].style.visibility = 'hidden';
        }
      }
    }
  }
}
