//GLOBALS
//====================================================================

//browser check
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;

//constants
var tipColor = "#695d51";
var tipFont = "Arial,Helvetica";
var tipFontSize = "-1";
var tipFontColor = "#ff9900";

var mouseY;
var mouseX;

var hlpVisible = false;



var tip;	//the reference to the style property of the div containing the tip

/*********************************************************************
init()

Called by the body onload() eventhandler. Initializes the cross-browser
tip reference and starts the trapping of the mouse movement event
*********************************************************************/
function init() {
	if (ns4) tip = document.tipDiv;
	if (ie4) tip = tipDiv.style;
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = mouseMove;
}


/*********************************************************************
showTip()

Displays a tooltip close to where the mouse is positioned.

msg	- the message that we put in the tooltip (string)
tipWidth - the width of the tooltip (numeric)
xOffset	- the offset to the tooltip from the mouse in the x-axis (numeric)
yOffset	- the offset to the tooltip from the mouse in the y-axis (numeric
*********************************************************************/
function showTip(msg, tipWidth, xOffset, yOffset) {

        if (!hlpVisible) return;

	if (!ns4 && !ie4) return;	//this only works on new browsers

	msg = "<TABLE WIDTH="+tipWidth+" BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=#FF9900><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR='"+tipColor+"'><TR><TD><FONT FACE='"+tipFont+"' COLOR='"+tipFontColor+"' SIZE='"+tipFontSize+"'>"+msg+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
		
	//we do it a little differenly in netscape and internet explorer.
	if (ns4) {
		var tipLayer = document.tipDiv.document;
		tipLayer.write(msg);
		tipLayer.close();
	} else if (ie4) {
		tipDiv.innerHTML = msg;
	}
	
	//put the tooltip in the correct position
	tip.left = mouseX + xOffset;
	tip.top = mouseY + yOffset;
	
	showObject(tip);
}


function showTipHome(msg, tipWidth, xOffset, yOffset) {

	if (!ns4 && !ie4) return;	//this only works on new browsers

	msg = "<TABLE WIDTH="+tipWidth+" BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=#FF9900><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR='"+tipColor+"'><TR><TD><FONT FACE='"+tipFont+"' COLOR='"+tipFontColor+"' SIZE='"+tipFontSize+"'>"+msg+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
		
	//we do it a little differenly in netscape and internet explorer.
	if (ns4) {
		var tipLayer = document.tipDiv.document;
		tipLayer.write(msg);
		tipLayer.close();
	} else if (ie4) {
		tipDiv.innerHTML = msg;
	}
	
	//put the tooltip in the correct position
	tip.left = mouseX + xOffset;
	tip.top = mouseY + yOffset;
	
	showObject(tip);
}




/*********************************************************************
hideTip()

Hides the tooltip
*********************************************************************/
function hideTip() {
	if (!ns4 && !ie4) return;	//this only works on new browsers

	hideObject(tip);
}

/*********************************************************************
showObject()

A cross-browser utility funtion that shows an object

obj - a reference to the object we want to shows
*********************************************************************/
function showObject(obj) {
	if (ns4) obj.visibility = "show";
	else if (ie4) obj.visibility = "visible";
}

/*********************************************************************
hideObject()

A cross-browser utility funtion that hides an object.

obj - a reference to the object we want to hide
*********************************************************************/
function hideObject(obj) {
	if (ns4) obj.visibility = "hide";
	else if (ie4) obj.visibility = "hidden";
}

/*********************************************************************
mouseMove()

This function is called whenever the mouse is moved.

e - the netscape event
*********************************************************************/
function mouseMove(e) {
	if (ns4) {
		mouseX = e.pageX;
		mouseY = e.pageY;
	} else if (ie4) {
		mouseX = event.x + document.body.scrollLeft;
		mouseY = event.y + document.body.scrollTop;
	}
}

function showHlp() {

imgs = document.images;
  for (x=0; x < (imgs.length);x++) {
    if (imgs[x].name == 'hlpicon')
      if (hlpVisible) {
	imgs[x].src = "http://www.e-cologis.com/img/pix_trans.gif";
      } else {
	imgs[x].src = "http://www.e-cologis.com/img/info.gif";
      }
  }
  if (hlpVisible) 
    hlpVisible = false;
  else
    hlpVisible = true;	



}


function goHelp(link) {
    if (hlpVisible) 
	document.location = link;
    else
	return;
	
}










