/////////
// [ alphaAPI.js ] v1.2
// 2002-03-04
// Author: chrisken
// URL: http://www.cs.utexas.edu/users/chrisken/alphaapi.html
/////

function alphaAPI(id, fadeInDelay, fadeOutDelay, startTrans, stopTrans, offsetTime, deltaTrans) {
	this.obj = ("alphaAPIobj" + alphaAPI._count++); // allow setTimeout references to the current object
	eval(this.obj + " = this");
	this.layerObj = document.getElementById( id );
	this.fadeInDelay = fadeInDelay || 40;
	this.fadeOutDelay = fadeOutDelay || this.fadeInDelay;
	this.startTrans = startTrans;
	this.stopTrans = stopTrans;
	this.offsetTime = (offsetTime || 0) * 1000;
	this.deltaTrans = deltaTrans || 10;
	this.timer = null;
	this.command = null;
	this.paused = false;
	this.repeat = true;
	this.started = false;
	
	this.norepeat = function() {
		this.repeat = false;
	}
	
	this.setTransBy = function(deltaTrans) {
		this.setTrans(this.getTrans() + deltaTrans);
	}
	
	this.toggle = function() {
		if( !this.started ) { // we haven't started fading yet
			this.start();
		} else if( this.paused ) {
			this.paused = false;
			this.unpause();
		} else {
			this.paused = true;
			this.pause();
		}
	}
	
	this.timeout = function(command, delay) {
		this.command = command;
		this.timer = setTimeout(command, delay);
	}
	
	this.setTrans = function(opacity) {
		if( !this.layerObj ) return;
		if( this.layerObj.filters ) {
			this.layerObj.filters.alpha.opacity = opacity;
		}
		if (!document.all && this.layerObj.style.setProperty) this.layerObj.style.setProperty("-moz-opacity", opacity / 100, "");
	}	

	this.getTrans = function() {
		if( !this.layerObj ) return 0;
		if( window.opera ) return 0;
		if (document.all) {
			if( typeof(this.layerObj.filters.alpha.opacity) != "undefined" )
				return this.layerObj.filters.alpha.opacity;
		} else if( this.layerObj.style.getPropertyValue )
				return this.layerObj.style.getPropertyValue("-moz-opacity") * 100;
		return 100;
	}
	
	this.start = function() {
    	if( this.layerObj ) {
    		this.started = true;
        	this.setTrans( this.startTrans );
        	if( this.startTrans > this.endTrans ) this.timeout( this.obj + ".fadeOut()", this.offsetTime );
        	else this.timeout( this.obj + ".fadeIn()", this.offsetTime );
        }
    }
    
    this.unpause = function() {
    	if( !this.started ) { // we never started, so we need to start instead of unpausing
    		this.start();
    	} else eval(this.command); // we were explicitly paused
    }
    
    this.pause = function() {
    	this.stopTimer();
    }
    
    this.stopTimer = function() {
    	clearTimeout(this.timer);
    	this.timer = null;
		this.started = false;
    }
    
    this.stop = function() {
    	this.command = null;
    	this.stopTimer();
    }

    this.fadeOut = function() {
    	this.stopTimer();
	    if (this.getTrans() > this.stopTrans){
	        this.setTransBy(-1 * this.deltaTrans);
	        this.timeout(this.obj + ".fadeOut()", this.fadeOutDelay);
	        }
	    else {
	        if (this.repeat) this.timeout(this.obj + ".fadeIn()", this.fadeInDelay);
	        }
	    }   
    
	this.fadeIn = function() {
		this.stopTimer();
	    if (this.getTrans() < this.startTrans){
	        this.setTransBy(this.deltaTrans);
	        this.timeout(this.obj + ".fadeIn()", this.fadeInDelay);
        }
	    else {
	        if (this.repeat) this.timeout(this.obj + ".fadeOut()", this.fadeOutDelay);
	    }
	}
		
	return this;	
}

alphaAPI._count = 0;

////////////
// [ubertooltip.js] v1.6
// 2002-07-23
// Author: chrisken
// URL: http://www.cs.utexas.edu/users/chrisken/ubertooltip.html
// Supports: alphaAPI.js
////

// wrapper to automate the tooltip install
function installTip() {
	if( document.layers ) return; // ns4 = bad
	function mouseMove(e) { if( window.tip ) tip.mouseMove( e ); } // update tooltip coordinates if the object exists
	document.onmousemove = mouseMove; // capture mouse movement in IE/Opera
	if( document.addEventListener ) document.addEventListener( "mousemove", mouseMove, true ); // capture in Mozilla/NS6
	writeTip( 'tipDiv' );
	
	// Create abstract functions until the page has loaded and a full ubertooltip can be created
	tip = new Object();	
	tip.show = function( x ) { };
	tip.hide = function( x ) { };
	tip.mouseMove = function( x ) { };
	tip.loaded = false;
}

// outputs the tooltip <div> with the minimum amount of css
function writeTip( divName ) {
	if(!window.opera){
		document.write( '<div id="' + divName + '" style="position: absolute; visibility: hidden; top: 0px; left: 0px; ' );
		document.write( 'filter: alpha(opacity=100); -moz-opacity: 0; z-index: 90"></div>' );
	}
	else {
		document.write( '<div id="' + divName + '" style="position: absolute; visibility: hidden; top: 0px; left: 0px; z-index: 90"></div>' );
	}
}

function uberToolTip( id, delay ) {
	this.id = id || "tipDiv";
	this.mouseX = 0;
	this.mouseY = 0;
	this.updateToolTip = false;
	this.obj = null;
	this.fader = null;
	this.delay = delay || 40;
	
	this.getMouseX = function() { return this.mouseX; }
	this.getMouseY = function() { return this.mouseY; }
	
	// display (fade in, if supported) the tooltip and update coords when the mouse moves
	this.show = function( html, wid0r ) {
		
		if( document.layers ) return;
		this.updateToolTip = true;
		if( this.fader ) { // alphaAPI was included and the browser supports fading
			this.fader.setTrans( 0 );
			this.fader.fadeIn();
		}
		this.update();
		writeLayerObj( this.obj, html, wid0r );
		showLayerObj( this.obj );
	}
	
	// update coordinates of the layer based on mouse coords;
	this.update = function() {
			this.obj.style.left = this.getMouseX() + 13 + "px";
			this.obj.style.top = this.getMouseY() + ( document.all? 20: 15 ) + "px";
	}
	
	// hide layer and stop updating with mouse
	this.hide = function() {
		if( document.layers ) return;
		hideLayerObj( this.obj );
		this.updateToolTip = false;
		if( this.fader ) this.fader.setTrans( 0 );
		this.obj.style.left = this.obj.style.top = 0;
		writeLayerObj( this.obj, "" );
	}

	// grab a reference to the <div> and initialize the fader
	this.init = function() {
		if( document.layers ) return;
		this.obj = document.getLayer( this.id );
		if( !this.obj ) {
			alert( 'Error: tooltip layer initialized to "' + this.id + '",\nbut a <div> with that id does not exist.' );
			return;
		}
		this.loaded = true;
		if( window.alphaAPI && !document.layers && ( document.all || ( document.getElementById && document.addEventListener ) ) ) {
			// only allow IE and Mozilla
			this.fader = new alphaAPI( this.id, this.delay, null, 100, 0, null, 10 );
			this.fader.setTrans( 0 );
			this.fader.norepeat( );
		}	
	}
	
	this.mouseMove = function( e ) {
		var mouseX, mouseY;
		if( window.event && !document.layers ) {
			// Internet Explorer & Opera mouse detection
			mouseX = event.clientX;
			mouseX +=  document.body.scrollLeft;	
			mouseY = event.clientY;
			mouseY += document.documentElement.scrollTop;
		} else {
			// Netscape and Mozilla
			mouseX = e.pageX;
			mouseY = e.pageY + 10;
		}
		this.mouseX = mouseX;
		this.mouseY = mouseY;
		if( this.obj && this.updateToolTip ) this.update();
	}
	
	return this;
}

///////
// Mini-dhtml library with NS4 support removed
////

// Use getLayer so that IE 4 works the same as IE 5+ & Mozilla
if( document.getElementById ) document.getLayer = document.getElementById;
else if( document.all ) document.getLayer = function( id ){ return document.all[ id ]; }

// wrapper to showLayerObj
function showLayer( id ) { showLayerObj( document.getLayer( id ) ); }

// show a layer object
function showLayerObj( layer ) { layer.style.visibility = "visible"; }

// wrapper to hideLayerObj
function hideLayer( id ) { hideLayerObj( document.getLayer( id ) ); }

// hide a layer object
function hideLayerObj( layer ) { layer.style.visibility = "hidden"; }

// wrapper to writeLayerObj
function writeLayer( id, html, wid0r ) { writeLayerObj( document.getLayer( id ), html, wid0r ); }

// write html to a layer
function writeLayerObj( layer, html, wid0r ) { // pass in the layer object
	if( typeof( layer.innerHTML ) == "undefined" ) {
		if( !document.layers ) { // Opera
			//alert('Welcome to the Opera');
			layer.innerHTML = html;
			if (typeof wid0r!="undefined") layer.style.width=wid0r+"px"

		} else { // Netscape
		}
	} else { // IE and Mozilla are cool
		//html = html.replace(/&/,"&amp;");
		layer.innerHTML = html;
		if (typeof wid0r!="undefined") layer.style.width=wid0r+"px"

	}
}

// set autoInstall to false if you want to customize your uberTooltip installation
if( !window.autoInstall && window.autoInstall != false) installTip();

function loadTip() {
  	tip = new uberToolTip( null , 30 );
   	tip.init();
   }
try {
	loadTip();
} catch(e) {}
 
