// this is a consolidation of all scripting needed by the WolfNetTech.com site,
// done for no other reason than to expedite download time.

/////////////////////////////////////////////////////////////////////////////////////MENU IMAGE_OVERS
// This just does mouseover menu stuff with a slight delay
//
//              AUTHOR:  Erik Fuller, WolfNetTech
// WITH INSPIRATION BY:  Esprit, Corp.
//                DATE:  August 12, 1999
//             VERSION:  1.0g, as in "giblet"
//

//*** GLOBAL VARIABLES ***

        /*+++++++++++++ CONSTANTS +++++++++++++++*/
if (IMAGE_DIR == null)
{ var IMAGE_DIR = ""; }

var TIMEOUT_LEN = 0;
        
//
// image objects required to maintain the images on the client for
//  faster and smoother menu mouse overs 
//

if (document.images)
{
        /*
         *      The image format is the following:
         *
         *              name_off.gif
         *              name_on.gif
         *      
         *      Where "off" refers to the standard state of the image (i.e. not mouse-overed),
         *      "on" refers to the image when it is being mouse-overed
         */
        
        /*+++++++++++++++++++++++++++++++++++*/
        // this array is the list of images to use, which are also the "NAME" fields
        // of the images in the HTML document
        
	
	if (navArray == null)
	{ navArray = new Array('about', 'rd', 'testing', 'staff', 'clients', 'contact', 'index'); }

        var navOffImageArray = new Array();
        var navOnImageArray = new Array();
        var timerArray = new Array();
        var turnOffArray = new Array();
        
        for (i=0; i < navArray.length; i++)
        {
                navOnImageArray[navArray[i]] = new Image;
                navOnImageArray[navArray[i]].src = IMAGE_DIR + navArray[i] + '.gif';

                navOffImageArray[navArray[i]] = new Image;
                navOffImageArray[navArray[i]].src = IMAGE_DIR + navArray[i] + '_off.gif';

                timerArray[navArray[i]] = 0;
                turnOffArray[navArray[i]] = false;
        }
}

var timerID;

// should only be called by the timeout function
function imgOff()
{
	if (document.images)
	{
		elem = document;
		if (document.layers) { elem = document.floater.document; }
		// deselect images
		for (i=0; i < navArray.length; i++)
		{
			if (turnOffArray[navArray[i]])
			{
				elem.images[navArray[i]].src = navOffImageArray[navArray[i]].src;

			}
		}
	}
}

/*
 *      note that "name" simply is the "NAME" attribute of the
 *      IMG tag.  This, incidentally, should be the filename of
 *  the image minus the extension convention as described above
 */
function imgOver(name)
{
    if (document.images)
   	{
		elem = document;
		if (document.layers) { elem = document.floater.document; }
		
    	clearTimer(name);
          // turn others off
        for (i=0; i < navArray.length; i++)
        {
        	if (navArray[i] != name)
        	{
				if (elem.images[name])
				{
					elem.images[navArray[i]].src = navOffImageArray[navArray[i]].src;

				}
			}
		}
		if (elem.images[name])
		{
			elem.images[name].src = navOnImageArray[name].src;

		}
	}
}

function imgOut(name)
{
        if (document.images)
        { setTimer(name); }
}

function setTimer(name)
{
    if (document.images)
    {
        clearTimer(name);
        turnOffArray[name] = true;
        timerArray[name] = setTimeout('imgOff()', TIMEOUT_LEN);
    }
}

function clearTimer(name)
{
    if (document.images)
    {
        clearTimeout(timerArray[name]);
        turnOffArray[name] = false;
    }
}
/////////////////////////////////////////////////////////////////////////////////////MENU IMAGE_OVERS

/////////////////////////////////////////////////////////////////////////////////////WRITE THE FLOATER
	var NS = (document.layers) ? 1 : 0;
	var IE = (document.all) ? 1: 0;

var floaterWritten = false;
function writeFloater()
{
	if (floaterWritten)
	{ return; }
	
	// use the navigation array to figure out who's who and where's what
	allNav = new Array('about','rd','testing','staff','clients','contact','index');
	linkArray = new Array();
	inNavArray = new Array();

	for (i = 0; i < allNav.length; i++)
	{
		linkArray[allNav[i]] = '<IMG SRC="' + IMAGE_DIR + allNav[i] + '.gif" WIDTH=90 HEIGHT=21 BORDER=0 NAME="' + allNav[i] + '" ALT="">';
		var found = false;
		
		for (j = 0; (j < navArray.length) && (!found); j++)
		{ found = navArray[j] == allNav[i]; }

		if (found)
		{
			linkArray[allNav[i]] = '<A HREF="' + LINK_DIR + allNav[i] + '.html" onMouseOver="imgOver(\'' + allNav[i] + '\')" onMouseOut="imgOut(\'' + allNav[i] + '\')">' +
				'<IMG SRC="' + IMAGE_DIR + allNav[i] + '_off.gif" WIDTH=90 HEIGHT=21 BORDER=0 NAME="' + allNav[i] + '" ALT="">' +
				'</A>';
		}
	}
	
	divtext = '<br>' + linkArray['about'] +'<br>\n' +
		'<br>' + linkArray['rd'] +'<br>\n' +
		'<br>' + linkArray['testing'] +'<br>\n' +
		'<br>' + linkArray['staff'] +'<br>\n' +
		'<br>' + linkArray['clients'] +'<br>\n' +
		'<br>' + linkArray['contact'] +'<br>\n' +
		'<br>' + linkArray['index'] +'<br>\n' +
		'<br><img src="contact_info.gif" width="91" height="92" alt="" border="0"><!--<br><br><a href="mailto:info@ctassociatesinc.com"><img src="email.gif" width="90" height="27" alt="" border="0"></a>-->';

	document.write(divtext);
	floaterWritten = true;
}
