/***********************************************
* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
* Copyright 2002-2007 by Sharon Paine
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* IMPORTANT: Put script after tooltip div or 
	 put tooltip div just before </BODY>. */

var tooltip_dom = (document.getElementById) ? true : false;
var tooltip_ns5 = (!document.all && tooltip_dom || window.opera) ? true: false;
var tooltip_ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && tooltip_dom) ? true : false;
var tooltip_ie4 = (document.all && !tooltip_dom) ? true : false;
var tooltip_nodyn = (!tooltip_ns5 && !tooltip_ie4 && !tooltip_ie5 && !tooltip_dom) ? true : false;

//var tooltip_origWidth, tooltip_origHeight;

// avoid error of passing event object in older browsers
if (tooltip_nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tooltip_tipFollowMouse= true;	
var tooltip_tipWidth= 260;  // width of the div
var tooltip_offX= 20;	// how far from mouse to show tip
var tooltip_offY= 12; 
//var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
//var tipFontSize= "8pt";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
//var tipFontColor= "#000000";
var tipBgColor= "#dddddd"; 
var tipBorderColor= "#000080";
var tipBorderWidth= 0;
var tipBorderStyle= "ridge";
var tipPadding= 4;

////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

// to layout text, 2-row table, (header row, body row)
// these go in var tip in doTooltip function
// startStr goes before header row, midStr goes between rows

var startStr = '<table width="' + tooltip_tipWidth + '" border=0><tr><td width="100%" class=';
var midStr = '</td></tr><tr><td valign="top" class=';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//
//  Global variables for tooltip. 
//  Set styles.
//  Set up mousemove capture if tooltip_tipFollowMouse set true.
//
////////////////////////////////////////////////////////////

var tooltip, tipcss;
function initTip() {
	if (tooltip_nodyn) return;
	tooltip = (tooltip_ie4)? document.all['tipDiv']: (tooltip_ie5||tooltip_ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (tooltip_ie4||tooltip_ie5||tooltip_ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tooltip_tipWidth+"px";
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tooltip_tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//
//  Assembles content for tooltip and writes it to tipDiv
//
/////////////////////////////////////////////////

var tooltip_t1,tooltip_t2,tooltip_t3;	// for setTimeouts
var tooltip_tipOn = false;	            // check if over tooltip link

function doTooltip(evt,num) {
	if (!tooltip) return;
	if (tooltip_t1) clearTimeout(tooltip_t1);
	if (tooltip_t2) clearTimeout(tooltip_t2);
	if (tooltip_t3) clearTimeout(tooltip_t3);
	tooltip_tipOn = true;
	// set color if included in messages array
	if (messages[num][2])	var curBgColor = messages[num][2];
	else curBgColor = tipBgColor;
	if (tooltip_ie4||tooltip_ie5||tooltip_ns5) {
		var tip = startStr + messages[num][3] + '>' + messages[num][0] + midStr + messages[num][4] + '>' + messages[num][1] + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tooltip_tipFollowMouse) positionTip(evt);
	else tooltip_t1=setTimeout("tipcss.visibility='visible'",500);
	
	if (document.getElementById('delivery_arrow') != null && messages[num][5] == "true")
		tooltip_t3=setTimeout("document.getElementById('delivery_arrow').style.visibility = 'visible'",500);

}

var tooltip_mouseX, tooltip_mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	tooltip_mouseX = (tooltip_ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	tooltip_mouseY = (tooltip_ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tooltip_tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//
// If tooltip_tipFollowMouse set false, so trackMouse function
// not being used, get position of mouseover event.
// Calculations use mouseover event position, offset amounts
// and tooltip width to position tooltip within window.
//
/////////////////////////////////////////////////////////////

function positionTip(evt) {
	if (!tooltip_tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		tooltip_mouseX = (tooltip_ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		tooltip_mouseY = (tooltip_ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (tooltip_ie4||tooltip_ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (tooltip_ie4||tooltip_ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (tooltip_ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (tooltip_ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((tooltip_mouseX+tooltip_offX+tpWd)>winWd) 
		tipcss.left = tooltip_mouseX-(tpWd+tooltip_offX)+"px";
	else tipcss.left = tooltip_mouseX+tooltip_offX+"px";
	if ((tooltip_mouseY+tooltip_offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+tooltip_offY)+"px";
	else tipcss.top = tooltip_mouseY+tooltip_offY+"px";
	if (!tooltip_tipFollowMouse)
	{
		tooltip_t1=setTimeout("tipcss.visibility='visible'",500);
		if (document.getElementById('delivery_arrow') != null && messages[num][5] == "true")
			tooltip_t3=setTimeout("document.getElementById('delivery_arrow').style.visibility = 'visible'",500);
	}
}

function hideTip() {
	if (!tooltip) return;
	if (tooltip_t1) clearTimeout(tooltip_t1);
	if (tooltip_t3) clearTimeout(tooltip_t3);
	//tooltip_t2=setTimeout("tipcss.visibility='hidden'",100);
	tipcss.visibility='hidden';
	tooltip_tipOn = false;

	if (document.getElementById('delivery_arrow') != null)
	{
		//setTimeout("document.getElementById('delivery_arrow').style.visibility = 'hidden'",100);
		document.getElementById('delivery_arrow').style.visibility = 'hidden';
	}
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:1000"></div>')


