/*
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 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   ////////////////////
// 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= 300;
var offX= 20;	// how far from mouse to show tip
var 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= "#DDECFF"; 
var tipBorderColor= "#000080";
var tipBorderWidth= 3;
var tipBorderStyle= "ridge";
var tipPadding= 4;

// 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("../images/ClassBad/maBoxAdd1.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[1] = new Array("../images/ClassBad/maBoxAdd2.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[2] = new Array("../images/ClassBad/maBoxAdd3.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[3] = new Array("../images/ClassBad/maBoxAdd4.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[4] = new Array("../images/ClassBad/maBoxAdd5.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[5] = new Array("../images/ClassBad/maBoxAdd6.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[6] = new Array("../images/ClassBad/maBoxAdd7.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[7] = new Array("../images/ClassBad/maBoxAdd8.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[8] = new Array("../images/ClassBad/maBoxAdd9.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[9] = new Array("../images/ClassBad/maBoxAdd10.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[10] = new Array("../images/ClassBad/maBoxAdd11.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[11] = new Array('../images/pub.gif','<B>LARGE</B> Storage Bays for rent. Bright. Phone 0428 894 296');
messages[12] = new Array("../images/ClassBad/maBoxAdd12.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[13] = new Array("../images/ClassBad/maBoxAdd13.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[14] = new Array("../images/ClassBad/maBoxAdd14.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[15] = new Array("../images/ClassBad/maBoxAdd15.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[16] = new Array('../images/tol.gif','<B>4 BEDROOM</B> house, 7kms from Myrtleford at Barwidgee Creek, no pets. Phone early am or late pm 5751 1386.');
messages[17] = new Array("../images/ClassBad/maBoxAdd16.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[18] = new Array("../images/ClassBad/maBoxAdd17.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[19] = new Array("../images/ClassBad/maBoxAdd18.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[20] = new Array("../images/ClassBad/maBoxAdd19.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[21] = new Array("../images/ClassBad/maBoxAdd20.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[22] = new Array("../images/ClassBad/maBoxAdd21.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[23] = new Array('../images/emw.gif','<B>CLEANER</B> required to clean cabins. Must be flexible as weekend work is required. Please contact Bright Holiday Park on 5755 1141 or email info@brightholiday park.com.au.');
messages[24] = new Array("../images/ClassBad/maBoxAdd22.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[25] = new Array('../images/moc.gif','<B>MOTORCYCLE</B> <B>LEARNERS AND LICENCE. </B> Wangaratta. Weekends/weekdays. Ride Smart North East. www.ridesmartnorth east.com. Ph 0458 373 040. Bookings 7 days.');
messages[26] = new Array("../images/ClassBad/maBoxAdd23.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[27] = new Array('../images/wtd.gif','<B>FREEBURGH</B> postmark, preferably a legible strike, on a complete envelope. Fair price paid according to condition. Phone or txt 0428 119 737.');
messages[28] = new Array("../images/ClassBad/maBoxAdd24.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[29] = new Array('../images/wtb.gif','<B>ENGAL</B> <B>or WAECO</B> portable fridge/freezer, 12 & 240 Volt, 80 litre. Must be clean. Ph: 5751 1260');
messages[30] = new Array('../images/wtb.gif','<B>OLD</B> tobacco machinery, sprayers, row crop tractors, etc, any condition, cash paid. Phone  0427 290 626.');
messages[31] = new Array("../images/ClassBad/maBoxAdd25.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[32] = new Array('../images/fos.gif','<B>BLAST/STORAGE</B> FREEZER. Excellent condition, suit new buyer. 3600 x 2400 x 2700 high with 200mm panel and checker plate floor. Kirby 3 phase condensing unit. Designed to operate to minus 30 if needed. As new, used for only 3 months per year for 3 years. Currently in storage near Myrtleford, North East Victoria. Can be shifted on tilt tray truck to save reassembly costs. $11,000. Ph 5756 2788.');
messages[33] = new Array('../images/fos.gif','<B>BRAEMAR</B> Evaporative Cooler. $300. Ph: 57511260');
messages[34] = new Array('../images/fos.gif','<B>COOLROOM.</B> Very good condition. 6000 x 3600 x 2400 high with 75mm panel. 3 phase split system, 3 fan evaporator. Located near Myrtleford. To be dismantled and removed at buyers expense. $5500. Ph 5756 2788.');
messages[35] = new Array("../images/ClassBad/maBoxAdd26.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[36] = new Array("../images/ClassBad/maBoxAdd27.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[37] = new Array("../images/ClassBad/maBoxAdd28.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[38] = new Array("../images/ClassBad/maBoxAdd29.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[39] = new Array("../images/ClassBad/maBoxAdd30.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[40] = new Array("../images/ClassBad/maBoxAdd31.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[41] = new Array("../images/ClassBad/maBoxAdd32.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[42] = new Array("../images/ClassBad/maBoxAdd33.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[43] = new Array("../images/ClassBad/maBoxAdd34.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[44] = new Array("../images/ClassBad/maBoxAdd35.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[45] = new Array('../images/dea.gif','<B>HEYWOOD,</B> Alan Edwin. Sincere condolences to Joy, Nathan and Fairley. Colin and Glenda. Many happy memories from childhood.  - The Smith Cousins.');
messages[46] = new Array('../images/dea.gif','<B>MILLIE,</B> Phil A beautiful lady at rest. Spcial friend of Joyce.');
messages[47] = new Array('../images/fun.gif','<B>BURTON</B> The funeral service for Mr Ronald (Ron) Burton will be held in All Saints Anglican Church, Church Street, Bright on Friday (February 3, 2012) commencing at 1.30pm. Private cremation will take place at a later time. All returned services and personnel are respectfully invited to attend. In lieu of flowers, a donation made to the Bright Hospital would be appreciated. Donation envelopes will be available at the chruch. TATE FUNERAL SERVICES ROBERT TATE Wangaratta and Bright 5722 2525.');
messages[48] = new Array('../images/fun.gif','<B>FUNERAL</B> prayers for Mr. John Showers will be offered in All Saints Anglican Church, Church Street, Bright, TODAY Wednesday February 1, 2012 commencing at 11am. RSL members are respectfully invited to attend. Private cremation will follow. CHRISTOPHER TATE FUNERALS Myrtleford and Bright Tel: 5752 2995.');
messages[49] = new Array("../images/ClassBad/maBoxAdd36.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[50] = new Array("../images/ClassBad/maBoxAdd37.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[51] = new Array("../images/ClassBad/maBoxAdd38.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
messages[52] = new Array("../images/ClassBad/maBoxAdd39.jpg","<CENTER>If you cannot read this add then<BR>just click the LEFT MOUSE BUTTON.</CENTER>");
////////////////////  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)+"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);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

