function hover(elem,init){
	var className = "";
	if (elem.type == undefined)
	{
		className="rowHighlight";
	} else {
		className="buttonHighlight";	
	}
	elem.onmouseover = function(){appendClass(this,className);};
	elem.onmouseout  = function(){removeClass(this,className);};
	if(init == null){
		appendClass(elem,className);		
	}



}

function appendClass(elm, appClass)
{
	/* only add space if currClass non-empty */
	elm.className += (elm.className? ' ':'') + appClass;
}

function removeClass(elm, className)
{
	/* Replace className, and surrounding spaces, with a single space;
	Trim end (since space may have been added to end) */
	elm.className = elm.className.replace(new RegExp('\s*'+className+'\s*'),' ').trim();
}

/* always handy */ 
String.prototype.trim = function(){ return this.replace(/^\s*?\s*$/g,"")} 
