// copyright firetiger.net

function displayLink(e)
{
	if (!this || !this.title) return;
//alert(this.title);
	window.status = this.title;
}

function clearLink(e)
{
    window.status = '';
}

// ------------------------------------------------------
// for link mouseovers
YAHOO.util.Event.addListener(window, 'load', function() {
	var elements = document.getElementsByTagName('a');

	if (elements) {
		for (var i = 0; i < elements.length; i++) {
			var elem = elements[i];
			if (elem.title) {
				YAHOO.util.Event.addListener(elem, 'mouseover', displayLink, elem, true);
				YAHOO.util.Event.addListener(elem, 'mouseout', clearLink);
			}
		}
	}
});
// ------------------------------------------------------


// ------------------------------------------------------
// for navigation animations
YAHOO.namespace ("navAnim");

// set these according to your environment

YAHOO.navAnim.FadeInTime = 0.5;	// time in seconds to fade in the arrow
YAHOO.navAnim.FadeOutTime = 0.4;	// time in seconds to fade out the arrow
YAHOO.navAnim.ArrowClassPrefix = 'nav_arrow';	// the prefix to the IDs for the div tags containing the arrow graphic; must start with a letter or underscore
YAHOO.navAnim.Count = 6;	// count of elements. ids should be set 1 to this value, ie: [ArrowClassPrefix]1...nav_arrow6,a1...a6

// do not edit the below code
YAHOO.navAnim.AnimAnimsIn = new Array();
YAHOO.navAnim.AnimAnimsOut = new Array();
YAHOO.navAnim.TryFadeAll = false;

YAHOO.navAnim.tryToFadeIn = function(e, thisOne) {
	// check to see if any other arrows are active and fade them out when necessary
    for (var i = 1; i <= YAHOO.navAnim.Count; i++) {
		if (YAHOO.navAnim.AnimAnimsIn[i].isAnimated())
			YAHOO.navAnim.AnimAnimsIn[i].stop(true);
		else if (YAHOO.util.Dom.getStyle(YAHOO.navAnim.ArrowClassPrefix+i, 'opacity') > 0.1)
			YAHOO.navAnim.tryToFadeOut(e, i);
	}
	
	YAHOO.navAnim.AnimAnimsIn[thisOne].animate();
}

YAHOO.navAnim.tryToFadeOut = function(e, i) {
	if (!YAHOO.navAnim.AnimAnimsOut[i].isAnimated()) {
		if (YAHOO.navAnim.AnimAnimsIn[i].isAnimated())
			YAHOO.navAnim.AnimAnimsIn[i].stop(true);

		YAHOO.navAnim.AnimAnimsOut[i].animate();
	}
}

YAHOO.navAnim.FadeAll = function() {
    for (var i = 1; YAHOO.navAnim.TryFadeAll == true && i <= YAHOO.navAnim.Count; i++) {
		if (!YAHOO.navAnim.AnimAnimsOut[i].isAnimated()) {
			if (YAHOO.navAnim.AnimAnimsIn[i].isAnimated())
				YAHOO.navAnim.AnimAnimsIn[i].stop(true);
			else if (YAHOO.util.Dom.getStyle(YAHOO.navAnim.ArrowClassPrefix+i, 'opacity') > 0.1)
				YAHOO.navAnim.tryToFadeOut(e, i);
		}
	}
}

YAHOO.navAnim.FadeInComplete = function() {
	YAHOO.navAnim.TryFadeAll = true;
}

YAHOO.navAnim.init = function() {
    for (var i = 1; i <= YAHOO.navAnim.Count; i++) {
		YAHOO.navAnim.AnimAnimsIn[i]  = new YAHOO.util.Anim(YAHOO.navAnim.ArrowClassPrefix+i, { opacity: { from: 0, to: 1 } }, YAHOO.navAnim.FadeInTime,  YAHOO.util.Easing.easeOut);
		YAHOO.navAnim.AnimAnimsIn[i].onComplete.subscribe(YAHOO.navAnim.FadeInComplete);
		YAHOO.navAnim.AnimAnimsOut[i] = new YAHOO.util.Anim(YAHOO.navAnim.ArrowClassPrefix+i, { opacity: { from: 1, to: 0 } }, YAHOO.navAnim.FadeOutTime, YAHOO.util.Easing.easeOut);
		YAHOO.util.Event.addListener('a'+i, 'mouseover', YAHOO.navAnim.tryToFadeIn, i, false);
		YAHOO.util.Event.addListener('a'+i, 'mouseout', YAHOO.navAnim.tryToFadeOut, i, false);
	}
	
	// add a listener when the title or page content areas are mouse overed and try to clear any left over arrows that didn't get a mouseout event call
	YAHOO.util.Event.addListener('content', 'mouseover', YAHOO.navAnim.FadeAll);
	
	// remove the fallback CSS hover from the styles
// TODO remove the fallback CSS hover from the styles
};

YAHOO.util.Event.onAvailable('a'+YAHOO.navAnim.Count, YAHOO.navAnim.init);	// initialize code once the last element is loaded
// ------------------------------------------------------

