/*
Image description tooltip - By Dynamic Web Coding (www.dyn-web.com)
Copyright 2002 by Sharon Paine - Visit http://www.dynamicdrive.com for this script
*/
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 ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? 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   ////////////////////
var tipFollowMouse= false;
var tipWidth= 170;
var offX= 20;	// how far from mouse to show tip
var offY= 0;
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "7pt";
var tipFontColor= "#108342";
var tipBgColor= "#FFFFFF";
var tipBorderColor= "#108342";
var tipBorderWidth= 1;
var tipBorderStyle= "solid";
var tipPadding= 5;
// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing image and text for tooltip and optional bgColor and color to be sent to tooltip
messages[0] = new Array('images/logos/egger_s.gif','blank',"#FFFFFF");
messages[1] = new Array('images/logos/egger_s.gif','Egger(UK) Ltd<br />Anick Grange Road<br />Hexham<br />Northumberland<br />NE46 4JS<br /><br />Tel: 01434 602191<br />Fax: 01434 605103<br /><br />Email: <a href="mailto:info.uk@egger.com">info.uk@egger.com</a><br />website: <a href="http://www.egger.co.uk" target="_blank">www.egger.co.uk</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[2] = new Array('images/logos/egger_s.gif','Egger(UK) Ltd<br />Barony<br />Barony Road<br />Auchinleck<br />Cumnock<br />KA18 2LL<br /><br />Tel: 01290 426026<br />Fax: 01290 424420<br />email: <a href="mailto:info.uk@egger.com">info.uk@egger.com</a><br />website: <a href="http://www.egger.co.uk" target="_blank">www.egger.co.uk</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[3] = new Array('images/logos/kronospan.gif','Kronospan Ltd<br />Chirk<br />Wrexham<br />Clwyd<br />LL14 5NT<br /><br />Tel: 01691 773361<br />Fax: 01691 772316<br /><br />Email: <a href="mailto:sales@kronospan.co.uk">sales@kronospan.co.uk</a><br />Website: <a href="http://www.kronospan.co.uk" target="_blank">www.kronospan.co.uk</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[4] = new Array('images/logos/norbord.gif','Norbord Ltd<br />Station Road<br />Cowie, Stirling<br />Stirlingshire<br />FK7 7BQ<br /><br />Tel: 01786 812921<br />Fax: 01786 815622<br /><br />Website: <a href="http://www.norbord.net" target="_blank">www.norbord.net</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[5] = new Array('images/logos/norbord.gif','Norbord Ltd<br />Morayhill<br />Inverness<br />Inverness-shire<br />IV1 2JQ<br /><br />Tel: 01463 792424<br />Fax: 01463 791764<br /><br />Website: <a href="http://www.norbord.net" target="_blank">www.norbord.net</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[6] = new Array('images/logos/norbord.gif','Norbord Ltd<br />Hill Village<br />South Molton<br />Devon<br />EX36 4HP<br /><br />Tel: 01769 572991<br />Fax: 01769 572413<br /><br />Website: <a href="http://www.norbord.net" target="_blank">www.norbord.net</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[7] = new Array('images/logos/smartply_s.gif','Smartply Europe Ltd<br />Belview, Slieverue<br />Waterford<br />Republic of Ireland<br /><br />Tel: 00 353 51 8512 33<br />Fax: 00 353 51 8511 30<br /><br />Email: <a href="mailto:info@smartply.com">info@smartply.com</a><br />Website: <a href="http://www.smartply.com" target="_blank">www.smartply.com</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[8] = new Array('images/logos/sonae_s.gif','Sonae (UK) Ltd<br />Moss Lane<br />Knowsley Industrial Park<br />Knowsley<br />Merseyside<br />L33 7XQ<br /><br />Tel: 0151 545 4000<br />Fax: 0151 545 4090<br /><br />Website: <a href="http://www.sonaeuk.com" target="_blank">www.sonaeuk.com</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[9] = new Array('images/logos/sonae_s.gif','Spanboard Products Ltd<br />10 Curragh Road<br />Castlerea<br />Coleraine<br />Co Londonderry<br />BT51 3RL<br />Northern Ireland<br /><br />Tel: 02870 355 111<br />Fax: 02870 345 700<br /><br />Website: <a href="http://www.sonaeuk.com" target="_blank">www.sonaeuk.com</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[10] = new Array('images/logos/medite.gif','Medite Europe Ltd<br />Redmondstown<br />Clonmel<br />Co. Tipperary<br />Ireland<br /><br />Tel: 00 353 52 21166<br />Fax: 00 353 52 2185<br /><br />Website: <a href="http://www.medite-europe.com" target="_blank">www.medite-europe.com</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#FFFFFF");
messages[11] = new Array('images/logos/FINSA.gif','Finsa Forest Products Ltd<br />Scariff<br />Co Clare<br />Republic of Ireland<br /><br />Tel: 00 353 61 640400<br />Fax: 00 353 61 921129<br /><br />Email: <a href="mailto:ffp@finsa.es">ffp@finsa.es</a><br />Website: <a href="http://www.finsa.es" target="_blank">www.finsa.es</a><br /><br /><em><a href="#" onClick="hideTip()">close</a></em>',"#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">';
var endStr = '</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) {	// 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 + ';">' + messages[num][1] + '</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))-((winWd-850)/2)+"px";
	else tipcss.left = (ns4)? mouseX+offX: mouseX+offX-((winWd-850)/2)+"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);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}
