
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function changeColor(color){
  var el=event.srcElement
  if (el.tagName=="INPUT"&&el.type=="button")
  event.srcElement.style.backgroundColor=color
}

function setBgImage(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#000000";
}

function setBgImageOver(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#000000";
}

function setBgColor(element,color) {
  element.style.backgroundColor=color;
}

//-->

function RowHighlighter( tableIdName, highlightedClassName, eventList) {


	// initialize class variables
	this.containerId            = tableIdName;
	this.tableElement           = document.getElementById(tableIdName);
	this.highlightedClassName   = highlightedClassName;
	this.selectedRow;
	this.selectedRowOriginalClass;
	
	if( this.tableElement == null ) {
		return false;
	}
		
	// Note about copying this.
	// For some reason, browsers complain about using "this" from an anonymous function like
	// the one below.  I think it has something to do with a scoping change when
	// inside of an anonymous function. Thus you have to copt the "this" for use.
	var copyOfThis = this;	
	var action 	= 	function( e ) {
						if( e == null ) {
							e = this.tableElement.ownerDocument.parentWindow.event;
						}
						copyOfThis.mouseover(e);
					}
	
	// add a listener for onmouseover W3C compatable
	if (this.tableElement.addEventListener) {
		for( i=0; i< eventList.length; i++ ) {
			this.tableElement.addEventListener(eventList[i], action, false);
		}
	}
	// add a listener for onmouseover Microsoft IE compatable
	else if (this.tableElement.attachEvent) {
	    for( i=0; i< eventList.length; i++ ) {
			eventName = "on" + eventList[i];
			this.tableElement.attachEvent(eventName, action);
		}
	}
	
	return;
	
}

RowHighlighter.prototype.mouseover = function( e ) {
	
	// what node are we over?
	var el;
	if( e.target != null ) {
		el = e.target;
	}
	else {
		el = e.srcElement;
	}
	
	// Move up the tree to the first TAG type node that is not the TABLE parent
	while ( el != null && el.nodeType!=1 && el.parentNode!=this.tableElement ) {
		el = el.parentNode;
	}
	
	if(el == this.tableElement) {
		return false;
	}
	
	//alert("t");
	
	// get the row we are over
	rowEl = this.getCurrentRow(el);
	
	
	if( rowEl == null ) {
		return false;
	}
	
	// we're in the same row, do nothing
	if( rowEl == this.selectedRow ) {
		return false;
	}
	
	// return the currently highlighted row to its original form
	if( this.selectedRow ) {
		this.selectedRow.className = this.selectedRowOriginalClass;
	}
	
	// store the selected row element and its original class
	this.selectedRow              = rowEl;
	// store the selected row class
	this.selectedRowOriginalClass = rowEl.className;
	
	// highlight the current row
	rowEl.className = this.highlightedClassName;
	return;
	
}

RowHighlighter.prototype.getCurrentRow = function(el) {
	// cruise up to the TR tag
	//names = el.nodeName + " " + el.id + "\n";
	while ( el != null && el.parentNode.parentNode.id!=this.containerId && el.parentNode != null) {
		el = el.parentNode;
		//names = names + el.nodeName + " " + el.id + "\n";
	}	
	//alert(el.nodeName);
	
	return el;
}


