/*
*  August 5, 2009 mb: added setAcronymTagsEvent and the cross browser add and remove event listener functions
*
*/

function setAcronymTagsEvent() {
  var acronymTags = document.getElementsByTagName("acronym");

	for (var i=0; i < acronymTags.length; i++) {
		addEvent(acronymTags[i], 'mouseover', function(){highlightOn(this);});
		addEvent(acronymTags[i], 'mouseout', function(){highlightOff(this);});
	}
}

function highlightOn(targetElement) {
	Spry.Effect.DoHighlight(targetElement, 
		{duration:1000, from:'#F3F5E8', to:'#FFFF99', restoreColor:'#FFFF99', toggle:false, setup: setupFuncHiliteOn});
}

function highlightOff(targetElement) {
	Spry.Effect.DoHighlight(targetElement, 
		{duration:1000, from:'#FFFF99', to:'#F3F5E8', restoreColor:'#F3F5E8', toggle:false, finish: finishFuncHiliteOff});
}

function setupFuncHiliteOn(elmentObj, AppearFadeObj) {
	elmentObj.style.color= "#811801";
}

function finishFuncHiliteOff(elmentObj , AppearFadeObj) {
	elmentObj.style.color= "#000000"; 
}

// cross browser add and remove event listener from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
	} else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn ) {
	if (obj.removeEventListener) {
		obj.removeEventListener( type, fn, false );
	} else if (obj.detachEvent) {
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}