/*
Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
Copyright 2002 by Sharon Paine
Visit http://www.dynamicdrive.com for this script
*/

/* IMPORTANT: Put script after tooltip div or 
put tooltip div just before </BODY>. */

var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie6 = ((navigator.userAgent.indexOf('MSIE 6.0')>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5 && !ie6) ? true : false;

// resize fix for ns4
var origWidth, origHeight;
if (ns4) {
origWidth = window.innerWidth; origHeight = window.innerHeight;
window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

/////////////////////// CUSTOMIZE HERE ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= true; 
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 310;
var offX= 0; // how far from mouse to show tip
var offY= 0; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "9pt";
// 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= "#FFFFFF"; 
var tipBorderColor= "#AAAAAA";
var tipBorderWidth= 1;
var tipBorderStyle= "solid";
var tipPadding= 0;


// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing: 
// image and text for tooltip
// optional: bgColor and color to be sent to tooltip
messages[0] = new Array('products/bolting/1a.jpg','',"#FFFFFF");  
messages[1] = new Array('products/bolting/2a.jpg','',"#FFFFFF"); 
messages[2] = new Array('products/bolting/3a.jpg','',"#FFFFFF");  
messages[3] = new Array('products/bolting/4a.jpg','',"#ffffff");  


messages[4] = new Array('products/rivet/1a.jpg','',"#FFFFFF");  
messages[5] = new Array('products/rivet/2a.jpg','',"#FFFFFF");  
messages[6] = new Array('products/rivet/3a.jpg','',"#FFFFFF");  
messages[7] = new Array('products/rivet/4a.jpg','',"#FFFFFF");  



messages[8] = new Array('products/washers/1a.jpg','',"#FFFFFF");  
messages[9] = new Array('products/washers/2a.jpg','',"#FFFFFF");  
messages[10] = new Array('products/washers/3a.jpg','',"#FFFFFF");  
messages[11] = new Array('products/washers/4a.jpg','',"#FFFFFF");  



messages[12] = new Array('products/assa abloy/1a.jpg','',"#FFFFFF");  
messages[13] = new Array('products/assa abloy/2a.jpg','',"#FFFFFF"); 
messages[14] = new Array('products/assa abloy/3a.jpg','',"#FFFFFF"); 
messages[15] = new Array('products/assa abloy/4a.jpg','',"#FFFFFF"); 



messages[16] = new Array('products/beam/1a.jpg','',"#FFFFFF"); 
messages[17] = new Array('products/beam/2a.jpg','',"#FFFFFF"); 
messages[18] = new Array('products/beam/3a.jpg','',"#FFFFFF"); 
messages[19] = new Array('products/beam/4a.jpg','',"#FFFFFF"); 



messages[20] = new Array('products/deb/1a.jpg','',"#FFFFFF"); 
messages[21] = new Array('products/deb/2a.jpg','',"#FFFFFF"); 
messages[22] = new Array('products/deb/3a.jpg','',"#FFFFFF"); 
messages[23] = new Array('products/deb/4a.jpg','',"#FFFFFF"); 


messages[24] = new Array('products/express/1a.jpg','',"#FFFFFF"); 
messages[25] = new Array('products/express/2a.jpg','',"#FFFFFF"); 
messages[26] = new Array('products/express/3a.jpg','',"#FFFFFF"); 
messages[27] = new Array('products/express/4a.jpg','',"#FFFFFF"); 

messages[28] = new Array('products/fixing/1a.jpg','',"#FFFFFF"); 
messages[29] = new Array('products/fixing/2a.jpg','',"#FFFFFF"); 
messages[30] = new Array('products/fixing/3a.jpg','',"#FFFFFF"); 
messages[31] = new Array('products/fixing/4a.jpg','',"#FFFFFF"); 


messages[32] = new Array('products/hank/1a.jpg','',"#FFFFFF"); 
messages[33] = new Array('products/hank/2a.jpg','',"#FFFFFF"); 
messages[34] = new Array('products/hank/3a.jpg','',"#FFFFFF"); 
messages[35] = new Array('products/hank/4a.jpg','',"#FFFFFF"); 


messages[36] = new Array('products/hardman/1a.jpg','',"#FFFFFF"); 
messages[37] = new Array('products/hardman/2a.jpg','',"#FFFFFF"); 
messages[38] = new Array('products/hardman/3a.jpg','',"#FFFFFF"); 
messages[39] = new Array('products/hardman/4a.jpg','',"#FFFFFF"); 




messages[40] = new Array('products/hardware/1a.jpg','',"#FFFFFF"); 
messages[41] = new Array('products/hardware/2a.jpg','',"#FFFFFF"); 
messages[42] = new Array('products/hardware/3a.jpg','',"#FFFFFF"); 
messages[43] = new Array('products/hardware/4a.jpg','',"#FFFFFF"); 




messages[44] = new Array('products/istrip/1a.jpg','',"#FFFFFF"); 
messages[45] = new Array('products/istrip/2a.jpg','',"#FFFFFF"); 
messages[46] = new Array('products/istrip/3a.jpg','',"#FFFFFF"); 
messages[47] = new Array('products/istrip/4a.jpg','',"#FFFFFF"); 




messages[48] = new Array('products/lindapter/1a.jpg','',"#FFFFFF"); 
messages[49] = new Array('products/lindapter/2a.jpg','',"#FFFFFF"); 
messages[50] = new Array('products/lindapter/3a.jpg','',"#FFFFFF"); 
messages[51] = new Array('products/lindapter/4a.jpg','',"#FFFFFF"); 



messages[52] = new Array('products/machines/1a.jpg','',"#FFFFFF"); 
messages[53] = new Array('products/machines/2a.jpg','',"#FFFFFF"); 
messages[54] = new Array('products/machines/3a.jpg','',"#FFFFFF"); 
messages[55] = new Array('products/machines/4a.jpg','',"#FFFFFF"); 




messages[56] = new Array('products/nails/1a.jpg','',"#FFFFFF"); 
messages[57] = new Array('products/nails/2a.jpg','',"#FFFFFF"); 
messages[58] = new Array('products/nails/3a.jpg','',"#FFFFFF"); 
messages[59] = new Array('products/nails/4a.jpg','',"#FFFFFF"); 




messages[60] = new Array('products/nuts/1a.jpg','',"#FFFFFF"); 
messages[61] = new Array('products/nuts/2a.jpg','',"#FFFFFF"); 
messages[62] = new Array('products/nuts/3a.jpg','',"#FFFFFF"); 
messages[63] = new Array('products/nuts/4a.jpg','',"#FFFFFF"); 




messages[64] = new Array('products/other brands/1a.jpg','',"#FFFFFF"); 
messages[65] = new Array('products/other brands/2a.jpg','',"#FFFFFF"); 
messages[66] = new Array('products/other brands/3a.jpg','',"#FFFFFF"); 
messages[67] = new Array('products/other brands/4a.jpg','',"#FFFFFF"); 




messages[68] = new Array('products/PPE/1a.jpg','',"#FFFFFF"); 
messages[69] = new Array('products/PPE/2a.jpg','',"#FFFFFF"); 
messages[70] = new Array('products/PPE/3a.jpg','',"#FFFFFF"); 
messages[71] = new Array('products/PPE/4a.jpg','',"#FFFFFF"); 





messages[72] = new Array('products/roofing-product/1a.jpg','',"#FFFFFF"); 
messages[73] = new Array('products/roofing-product/2a.jpg','',"#FFFFFF"); 
messages[74] = new Array('products/roofing-product/3a.jpg','',"#FFFFFF"); 
messages[75] = new Array('products/roofing-product/4a.jpg','',"#FFFFFF"); 







messages[76] = new Array('products/self-tapping-screws/1a.jpg','',"#FFFFFF"); 
messages[77] = new Array('products/self-tapping-screws/2a.jpg','',"#FFFFFF"); 
messages[78] = new Array('products/self-tapping-screws/3a.jpg','',"#FFFFFF"); 
messages[79] = new Array('products/self-tapping-screws/4a.jpg','',"#FFFFFF"); 








messages[80] = new Array('products/shelving/1a.jpg','',"#FFFFFF"); 
messages[81] = new Array('products/shelving/2a.jpg','',"#FFFFFF"); 
messages[82] = new Array('products/shelving/3a.jpg','',"#FFFFFF"); 
messages[83] = new Array('products/shelving/4a.jpg','',"#FFFFFF"); 








messages[84] = new Array('products/sscrew/1a.jpg','',"#FFFFFF"); 
messages[85] = new Array('products/sscrew/2a.jpg','',"#FFFFFF"); 
messages[86] = new Array('products/sscrew/3a.jpg','',"#FFFFFF"); 
messages[87] = new Array('products/sscrew/4a.jpg','',"#FFFFFF"); 








messages[88] = new Array('products/spmb/1a.jpg','',"#FFFFFF"); 
messages[89] = new Array('products/spmb/2a.jpg','',"#FFFFFF"); 
messages[90] = new Array('products/spmb/3a.jpg','',"#FFFFFF"); 
messages[91] = new Array('products/spmb/4a.jpg','',"#FFFFFF"); 








messages[92] = new Array('products/stainless/1a.jpg','',"#FFFFFF"); 
messages[93] = new Array('products/stainless/2a.jpg','',"#FFFFFF"); 
messages[94] = new Array('products/stainless/3a.jpg','',"#FFFFFF"); 
messages[95] = new Array('products/stainless/4a.jpg','',"#FFFFFF"); 








messages[96] = new Array('products/studding/1a.jpg','',"#FFFFFF"); 
messages[97] = new Array('products/studding/2a.jpg','',"#FFFFFF"); 
messages[98] = new Array('products/studding/3a.jpg','',"#FFFFFF"); 
messages[99] = new Array('products/studding/4a.jpg','',"#FFFFFF"); 











messages[100] = new Array('products/wire/1a.jpg','',"#FFFFFF"); 
messages[101] = new Array('products/wire/2a.jpg','',"#FFFFFF"); 
messages[102] = new Array('products/wire/3a.jpg','',"#FFFFFF"); 
messages[103] = new Array('products/wire/4a.jpg','',"#FFFFFF"); 














messages[104] = new Array('products/woodscrews/1a.jpg','',"#FFFFFF"); 
messages[105] = new Array('products/woodscrews/2a.jpg','',"#FFFFFF"); 
messages[106] = new Array('products/woodscrews/3a.jpg','',"#FFFFFF"); 
messages[107] = new Array('products/woodscrews/4a.jpg','',"#FFFFFF");


messages[108] = new Array('products/abrasives/AB005_b.jpg','',"#FFFFFF"); 
messages[109] = new Array('products/abrasives/AB004_b.jpg','',"#FFFFFF"); 
messages[110] = new Array('products/abrasives/AB008GP_b.jpg','',"#FFFFFF"); 
messages[111] = new Array('products/abrasives/AB003A_b.jpg','',"#FFFFFF");


//////////////////// END OF CUSTOMIZATION AREA ///////////////////

// preload images that are to appear in tooltip
// from arrays above
if (document.images) {
var theImgs = new Array();
for (var i=0; i<messages.length; i++) {
theImgs[i] = new Image();
theImgs[i].src = messages[i][0];
}
}

// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top"><div align=left>';
var endStr = '</div></td></tr></table>';

////////////////////////////////////////////////////////////
// initTip - initialization for tooltip.
// Global variables for tooltip. 
// Set styles for all but ns4. 
// Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
if (nodyn) return;
tooltip = (ns4)? document.tipDiv.document: (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
tipcss = (ns4)? document.tipDiv: tooltip.style;
if (ie4||ie5||ns5||ie6) { // ns4 would lose all this on rewrites
tipcss.width = tipWidth+"px";
tipcss.fontFamily = tipFontFamily;
tipcss.fontSize = tipFontSize;
tipcss.color = tipFontColor;
tipcss.backgroundColor = tipBgColor;
tipcss.borderColor = tipBorderColor;
tipcss.borderWidth = tipBorderWidth+"px";
tipcss.padding = tipPadding+"px";
tipcss.borderStyle = tipBorderStyle;
}
if (tooltip&&tipFollowMouse) {
if (ns4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = trackMouse;
}
}

window.onload = initTip;

/////////////////////////////////////////////////
// doTooltip function
// Assembles content for tooltip and writes 
// it to tipDiv
/////////////////////////////////////////////////
var t1,t2; // for setTimeouts
var tipOn = false; // check if over tooltip link
function doTooltip(evt,num) {
if (!tooltip) return;
if (t1) clearTimeout(t1); if (t2) clearTimeout(t2);
tipOn = true;
// set colors if included in messages array
if (messages[num][2]) var curBgColor = messages[num][2];
else curBgColor = tipBgColor;
if (messages[num][3]) var curFontColor = messages[num][3];
else curFontColor = tipFontColor;
if (ns4) {
var tip = '<table bgcolor="' + tipBorderColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0"><tr><td><table bgcolor="' + curBgColor + '" width="100%" cellspacing="0" cellpadding="' + tipPadding + '" border="0"><tr><td>'+ startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';"><b>' + messages[num][1] + '</b></span>' + endStr + '</td></tr></table></td></tr></table>';
tooltip.write(tip);
tooltip.close();
} else if (ie4||ie5||ns5) {
var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
tipcss.backgroundColor = curBgColor;
tooltip.innerHTML = tip;
}
if (!tipFollowMouse) positionTip(evt);
else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
// positionTip function
// If 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 (!tipFollowMouse) {
		mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
		mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ns4)? tooltip.width: (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ns4)? tooltip.height: (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns4||ns5)? window.innerWidth-20+window.pageXOffset: document.body.clientWidth+document.body.scrollLeft;
	var winHt = (ns4||ns5)? window.innerHeight-20+window.pageYOffset: document.body.clientHeight+document.body.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	/*if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = (ns4)? mouseX-(tpWd+offX): mouseX-(tpWd+offX)+"px";
	else tipcss.left = (ns4)? mouseX+offX: mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = (ns4)? winHt-(tpHt+offY): winHt-(tpHt+offY)+"px";
	else tipcss.top = (ns4)? mouseY+offY: mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);*/
	
		evt = (evt) ? evt : window.event;
		var x = 0;
		var y = 0;
		if(evt.pageX)
		{
			x = evt.pageX;
			y = evt.pageY;
		}
		else if(evt.clientX)
		{
			//x = e.clientX + document.body.scrollLeft;
			//y = e.clientY + document.body.scrollTop;
			x = evt.clientX + (document.documentElement.scrollLeft ||  document.body.scrollLeft) -  document.documentElement.clientLeft;
			y = evt.clientY + (document.documentElement.scrollTop ||   document.body.scrollTop) -   document.documentElement.clientTop;
		}
		x = parseInt(x) + -330;y = parseInt(y) + -250;
 		tipcss.left = (ns4)? mouseX+offX: x+"px";
		tipcss.top = (ns4)? mouseY+offY:  y+"px";
		if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
 }
/*function positiontip(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
		
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
		
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
		//move the horizontal position of the menu to the left by it's width
		tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
		tipobj.style.left="5px"
		else
		//position the horizontal position of the menu where the mouse is positioned
		tipobj.style.left=curX+offsetxpoint+"px"
		
		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight)
		tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
		else
		tipobj.style.top=curY+offsetypoint+"px"
		tipobj.style.visibility="visible"
	}
}*/



function hideTip() {
if (!tooltip) return;
t2=setTimeout("tipcss.visibility='hidden'",100);
tipOn = false;
}

