<!--
// 
// Modified by: Catherine Finnegan
// Date:  10/17/2008
// 

	var W3CDOM = (document.createElement && document.getElementsByTagName);     // is this a modern browser?
	var tipIcon = new Array();                                                  // sets up array for icon graphic
	var tipTitle = new Array();                                                 // sets up array for tip title
	var iconHeights = new Array();                                              // sets up array for icon Heights
	var iconWidths = new Array();                                               // sets up array for icon Widths
	var tipDescription = new Array();                                           // sets up array for tip description
	window.onload = init;                                                       // runs init function upon loading the page

	function init()
	{
		if (!W3CDOM) return;              						                // stops running script if viewed in ancient browser
		var anchortags = document.getElementsByTagName("*");                    // looks at all anchor tags on the page
		var cIndex = 0;                                                         // This holds the index of the currently used tooltip
		var liCntr = 0;
		
		changeAlt();    
		
		for (liCntr = 0;liCntr < anchortags.length; liCntr++)                   // iterates through each anchor tag to see if it uses a tooltip , 
		{                                                                       //   this is indicated by the <a> tag having a tooltip='yes' attribute
			if ( anchortags[liCntr].getAttribute("tooltip") == 'yes' && 
			      anchortags[liCntr].getAttribute("title").indexOf(":") >= 0 && 
			      anchortags[liCntr].getAttribute("icon").length > 0)
			{
				anchortags[liCntr].onmousemove = mouseMovesOver;                // loads onMousemove script for anchor
				anchortags[liCntr].onmouseout = mouseMovesOut;                  // loads onMouseout script for anchor
				elementattribute = anchortags[liCntr].getAttribute("title");    // gets the TITLE attribute from anchor
				thedelimiter = elementattribute.indexOf (":");                  // sets the delimiter
				thetitle = elementattribute.substring (0,thedelimiter);         // gets the first part of TITLE
				thedescription = elementattribute.substring (thedelimiter+1,elementattribute.length);  //gets the last part of TITLE
				tipIcon[cIndex] = anchortags[liCntr].getAttribute("icon");      // saves the ICON attribute to the array
				tipTitle[cIndex] = thetitle;                                    // saves the title to the array
				tipDescription[cIndex] = thedescription;                        // saves the description to the array
				anchortags[liCntr].number = cIndex;                             // saves the unique number of the anchor		
				
				/* SETUP OF ICON HEIGHTS IF THEY ARE SPECIFIED, OTHERWISE DEFFAULT TO 20x20 */
				if(anchortags[liCntr].getAttribute("icon_height") != null && anchortags[liCntr].getAttribute("icon_width") != null)
				{
					icon_height = anchortags[liCntr].getAttribute("icon_height");
					icon_width  = anchortags[liCntr].getAttribute("icon_width");
				}
				else
				{
					icon_height = 20;
					icon_width =  20;
				}
				iconHeights[cIndex] =  icon_height;
				iconWidths[cIndex] =   icon_width;
				cIndex++;
			}   //<----------  end if tooltip == yes

		}   //<---------------  end for loop

	}   // end 	function init()
function changeAlt()
{
                // Display all the images
                var theimages = document.images;
                var lsImages = "";
                var lsImage = "";
                var liImageLength = 0;
                var lsAltString = "";
                var lsAlt = "";
                liCntr = 0;
                
                //document.write("The images in this document are<br>");
                lsImages = "The images in this document are: \n";
                
                for(var liCntr = 0; liCntr < theimages.length; liCntr++)
                {
                    // document.write(theimages[i].src + "<br>");
                    lsImage =  theimages[liCntr].src;
                    var lsImageArray = lsImage.split("/");
                    liImageLength = lsImageArray.length;
                                        
                    if (!theimages[liCntr].alt)
                    {
                       lsAltString = lsAlt;
                    }
                    else
                    {
                        lsAltString = trim(theimages[liCntr].alt);
                    }
                    theimages[liCntr].alt = lsAltString;
                    

                    lsImages = lsImages + lsImageArray[liImageLength - 1] + " " + "alt=" +  lsAltString + "\n";
                } 	
                //  alert(lsImages);	  testing
}
function trim(asString) 
{
    return asString.replace(/^\s+|\s+$/g,"");
}        

	function mouseMovesOver(e)
	{
		var mousePositionX, mousePositionY, element    							// sets up the variables
		window.temp = this.title; this.title = '';     							// empties the TITLE attribute momentarily
		if (!e) var e = window.event;                  							// sets event to work properly with Internet Explorer
		mousePositionX = e.clientX + document.body.scrollLeft-350;              // captures the horizontal position of pointer
		mousePositionY = e.clientY + document.body.scrollTop-100;               // captures the vertical position of pointer
        
		element = document.getElementById("theIcon");  							// finds the element containing id="theIcon"
		
       element.innerHTML = "<img src='" + tipIcon[this.number] + 
       "' height='" + iconHeights[this.number] + "' width='" + 
       iconWidths[this.number] + "' alt='' border='0'>";                        // loads theIcon element
       
       element = document.getElementById("theTitle");                           // finds the element containing id="theTitle"
       element.innerHTML = tipTitle[this.number];                               // loads theTitle element
       element = document.getElementById("theDesc");                            // finds the element containing id="theDesc"
       element.innerHTML = tipDescription[this.number];                         // loads theDesc element
       element = document.getElementById("tipholder");                          // finds the element containing id="tipholder"
       element.style.left = "200" + "px";                                       // sets the horizontal position of tipholder
        //element.style.left = mousePositionX + "px";                           // sets the horizontal position of tipholder
        element.style.top = (mousePositionY+60) + "px";                         // sets the vertical position of tipholder
        element.style.visibility = "visible";                                   // displays tipholder
	}

	function mouseMovesOut()
	{
		msg = document.getElementById("tipholder");                             // finds the element containing id="tipholder"
		msg.style.visibility = "hidden";                                        // hides tipholder
	}
	
	
//-->

/* 

RULES 

RULE #1

THE FOLLOWING DIV TAG MUST BE PLACED IN THE <BODY> FOR THIS FUNCTION TO BE USED
------------------------------------------------------------------------------------------------
			<div id="tipholder" style="visibility:hidden; position:absolute; width:350px;">
				<div align="center" style="padding: 0px; width:25px; height:27px;float:left; 
					font: 8pt/10pt Arial, Helvetica, sans-serif;
					border-top: 1px solid black; 
					border-left: 1px solid black; 
					border-bottom: 1px solid black; 
					background-color: #FFFFFF;">
					<span id="theIcon"></span>
				</div>
				<div style="padding: 3px; width:325px; height:27px; float:left;
					font: 8pt/10pt Arial, Helvetica, sans-serif;
					border-top: 1px solid black; 
					border-left: 1px solid black; 
					border-right: 1px solid black; 
					border-bottom: 1px solid black; 
					background-color: #EFEFEF;">
					<span id="theTitle" class='TextBlack' style="vertical-align: middle;">T</span>
				</div>
				<div style="padding: 3px; 
					font: 8pt/10pt Arial, Helvetica, sans-serif;
					border-left: 1px solid black; 
					border-right: 1px solid black; 
					border-bottom: 1px solid black; 
					background-color: #FFFFFF;">
					<span id="theDesc">Description Goes Here</span>
				</div>
			</div>
------------------------------------------------------------------------------------------------

RULE #2

THE 
*/


