///////////////////////////////////////////////////////////////////////////////////////////////
// Customized JavaScript function library for Walker 2/e
// Created:	16 April 2003
// Revised:	16 April 2003	First separated as .js library
//				Browser-sniffing expanded to all browsers
//				Code conforms to W3C standards  
//
// Programmer:	Ron Turner	Soph-Ware Associates
///////////////////////////////////////////////////////////////////////////////////////////////

function changeimage(fromwhat,towhat,url)
{
   if (document.images)
   {
 //     document.images.targetimage.src=towhat.src
      fromwhat.src=towhat.src
      gotolink=url
   }
}

function openAnswer(url)
{
        answerWindow = window.open(url, 'Answer',
    'height=150,width=200,toolbar=no,resizable=yes,scrollbars=no');
        if(answerWindow.opener == null) answerWindow.opener = window;
}


function preloadimages()
{
    for (i=0;i<preloadimages.arguments.length;i++)
    {
        myimages[i]=new Image()
        myimages[i].src=preloadimages.arguments[i]
    }
}

function getCursor(e)
{

// Save cursor position using browser-specific code.

if (document.layers)
	{
    mouseX = e.pageX;
    mouseY = e.pageY;
	}

if (document.all)
	{
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
	}

if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
	{
    mouseX = e.pageX;
    mouseY = e.pageY;
	}

    return true;
}

function showToolTip(name)
{

var tip = getHandle(name);


// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Position the tool tip.

//  for (propName in tip.clip)
    {
//      alert(propName + ': ' + tip.clip[propName]);
    }

    if (mouseX < 400) {
        tip.left = mouseX - 10;
        tip.top  = mouseY + 15;

        }
    else {

//begin alignment right side of screen
        var width;

        if (document.layers)
        {
            width = tip.clip.width;
        }
        else if (document.all)
        {
            width = tip.width.substring(0, tip.width.indexOf('px'));
        }

        tip.left = mouseX - width + 10;

        tip.top  = mouseY + 15;
    }


// Show the tool tip using browser-specific code.


    if (document.layers)
        tip.visibility = "show";
    if (document.all)
        tip.visibility = "visible";
 	if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
        tip.visibility = "visible";
// Set timer to hide the tool tip.

    tip.timerID = setTimeout("hideToolTip('" + name + "')", 300000);
}


function hideToolTip(name)
{
    var tip = getHandle(name);

// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Hide the tool tip using browser-specific code.

    if (document.layers)
        tip.visibility = "hide";
    if (document.all)
        tip.visibility = "hidden";
 	if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
        tip.visibility="hidden";
}


function waitForHandle(name, count, interval)
{
    if (document.layers)
    {
        if (document.layers[name])
        {
            return document.layers[name];
        }
        else
        {
            window.setTimeout('waitForHandle(' + name + ', ' + --count + ', ' + interval + ');', interval);
        }
    }
    if (document.all)
    {
        var block = eval('document.all.' + name);
        if (block)
        {
            return eval(block + '.style');
        }
        else
        {
            window.setTimeout('waitForHandle(' + name + ', ' + --count + ', ' + interval + ');', interval);
        }
    }
 	if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
    {
	var block = eval('!document.all  && document.getElementById.' + name);
	if (block)
        {
	   return eval(block + '.style');
        }
        else
        {
           window.setTimeout('waitForHandle(' + name + ', ' + --count + ', ' + interval + ');', interval);
        }
    }
  }


function getCursor(ee)
{
// Save cursor position using browser-specific code.

if (document.layers)
	{
    	mouseX = ee.pageX;
    	mouseY = ee.pageY;
	}

if (document.all)
	{
    	mouseX = event.clientX + document.body.scrollLeft;
    	mouseY = event.clientY + document.body.scrollTop;
	}
if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
	{
    	mouseX = ee.pageX;
    	mouseY = ee.pageY;
	}

    return true;
}


function showAnswer(name)
{

var tip = getHandle(name);

// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Position the answer display.

    tip.left = mouseX + 10;
    tip.top  = mouseY + 15;

// Show the answer using browser-specific code.

    if (document.layers)
    {
        if (openTip != null)
        {
            openTip.visibility = "hide";
        }
        tip.visibility = "show";
    }
    if (document.all)
    {
        if (openTip != null)
        {
            openTip.visibility = "hidden";
        }
        tip.visibility = "visible";
    }
    if(!document.all  && document.getElementById)
//thisbrowser="NN6";
	{
        if (openTip != null)
        {
        	openTip.visibility="hidden";
        }
      	tip.visibility = "visible";
    }

    openTip = tip;

// Set timer to hide the answer display.

    tip.timerID = setTimeout("hideAnswer('" + name + "')", 9000000);
}


function hideAnswer(name)
{
    var tip = getHandle(name);

    if (openTip == tip)
    {
        openTip = null;
    }
// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Hide the answer display using browser-specific code.

    if (document.layers)
        tip.visibility = "hide";
    if (document.all)
        tip.visibility = "hidden";
	if (!document.all  && document.getElementById)
     tip.visibility	="hidden";
}


function getHandle(name)
{
// Get a handle to the named answer display using browser-specific code.

    if (document.layers)
        return(document.layers[name]);
    if (document.all)
    {
        var block = eval('document.all.' + name + '.style');
    	return(block);
	}
 	if(!document.all  && document.getElementById)
     //thisbrowser="NN6";
    {
        var block = eval('!document.all  && document.getElementById("' + name + '").style');
    	return(block);
    }
}


function getCursor(ee) 
{

// Save cursor position using browser-specific code.

if (document.layers) 
    {
    mouseX = ee.pageX;
    mouseY = ee.pageY;
    }

if (document.all) 
    {
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
    }
if(!document.all  && !document.all  && document.getElementById)
     //thisbrowser="NN6";
    {
    mouseX = ee.pageX;
    mouseY = ee.pageY;
    }

    return true;
}


function showAnswer(name) 
{

var tip = getHandle(name);

// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Position the answer display.

    tip.left = mouseX + 10;
    tip.top  = mouseY + 15;

// Show the answer using browser-specific code.

    if (document.layers)
    {
        if (openTip != null)
        {
            openTip.visibility = "hide";
        }
        tip.visibility = "show";
    }
    if (document.all)
    {
        if (openTip != null)
        {
            openTip.visibility = "hidden";
        }
        tip.visibility = "visible";
    }
    if(!document.all  && document.getElementById)
	//thisbrowser="NN6";
	{
        if (openTip != null)
        {
        	openTip.visibility="hidden";
        }
      	tip.visibility = "visible";
    }

    openTip = tip;

// Set timer to hide the answer display.

    tip.timerID = setTimeout("hideAnswer('" + name + "')", 9000000);
}


function hideAnswer(name) 
{

    var tip = getHandle(name);

    if (openTip == tip)
    {
        openTip = null;
    }
// Clear out any pending timer.

    if (tip.timerID)
    clearTimeout(tip.timerID);

// Hide the answer display using browser-specific code.

    if (document.layers)
        tip.visibility = "hide";
    if (document.all)
        tip.visibility = "hidden";
	if (!document.all  && document.getElementById)
     tip.visibility	="hidden";
}


function getHandle(name)
{

// Get a handle to the named answer display using browser-specific code.

    if (document.layers)
        return(document.layers[name]);
    if (document.all)
    {
        var block = eval('document.all.' + name + '.style');
    	return(block);
	}
 	if(!document.all  && document.getElementById)
     	//thisbrowser="NN6";
        var block = eval('!document.all  && document.getElementById("' + name + '").style');
    	return(block);
}


function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
}

