

var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;

// 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= false;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 140;
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= "#ffffff";
var tipBgColor= "#4e6a86"; 
var tipBorderColor= "#000000";
var tipBorderWidth= 1;
var tipBorderStyle= "ridge";
var tipPadding= 6;

// 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('ims/modernart.jpg','Scottish Gallery of Modern Art','white','black');
messages[1] = new Array('ims/deangal.jpg','Dean Gallery','white','black');
messages[2] = new Array('ims/portgall.jpg','Scottish National Portrait Gallery','white','black');
messages[3] = new Array('ims/natgal.jpg','Scottish National Gallery','white','black');
messages[4] = new Array('ims/fruitm.jpg','Fruitmarket Gallery','white','black');
messages[5] = new Array('ims/waverley.jpg','Waverley Station','white','black');
messages[6] = new Array('ims/knox.jpg','John Knox House','white','black');
messages[7] = new Array('ims/stgiles.jpg','St Giles Cathedral','white','black');
messages[8] = new Array('ims/gladstones.jpg','Gladstones Land','white','black');
messages[9] = new Array('ims/trafalgar.jpg','Calton Hill Nelson Monument','white','black');
messages[10] = new Array('ims/observ.jpg','Observatory','white','black');
messages[11] = new Array('ims/holyrood.jpg','Palace of Holyrood House','white','black');
messages[12] = new Array('','Scottish Parliament','white','black');
messages[13] = new Array('','Conference Centre','white','black');
messages[14] = new Array('ims/botanics.jpg','Edinburgh Royal Botanic Gardens','white','black');
messages[15] = new Array('ims/arthursseat.jpg','Arthurs Seat','white','black');
messages[16] = new Array('ims/saliscrags3.jpg','Salisbury Crags','white','black');
messages[17] = new Array('ims/stmargarets.jpg','St Margarets Loch','white','black');
messages[18] = new Array('ims/duddingston.jpg','Duddingston Loch','white','black');
messages[19] = new Array('','University','white','black');
messages[20] = new Array('','The Meadows','white','black');
messages[21] = new Array('ims/princesst.jpg','Princes Street','white','black');
messages[22] = new Array('','George Street links two beautiful Georgian squares, Charlotte and St Andrews, and has good shops, restaurants and bars','white','black');
messages[23] = new Array('ims/royalmile.jpg','Royal Mile','white','black');
messages[24] = new Array('ims/leith.jpg','Leith, Some of Edinburgh\'s best restaurants are in this area','white','black');
messages[25] = new Array('ims/castle.jpg','Edinburgh Castle','white','black');
messages[26] = new Array('../cambridgeph/cambridge5780.jpg','2, Cambridge Street, Romantic, quiet, civilized, Victorian bed and breakfast');
messages[27] = new Array('../fingalph/fingalfrontsm.jpeg','2 Fingal Place, B and B, 2 twin bedrooms with en suite bathrooms.');
messages[28] = new Array('../belfordph/extsm.jpeg','Belford Terrace, 1 Double, private shower, 1 Twin, en-suite shower, further single');
messages[29] = new Array('../belfplaceph/facade5780.jpg','11, Belford Place, 1 Double and 1 Twin bedroom, with en suite and private bath-rooms');
messages[30] = new Array('../heriottparkph/heriottpark5780.jpg','Heriott Park, Guest House bed and breakfast with a range of accommodation');
messages[31] = new Array('../inverleithph/invf5780.jpg','Inverleith Hotel Guest House. Family run, licenced bar, 8 bedrooms, close to Royal Botanic Gardens');
messages[32] = new Array('../ardmorph/ardmor5780.jpg','Ardmor House. Friendly and contemporary bed and breakfast. Free parking.');
messages[33] = new Array('../channingsph/channings5780.jpg','Channings, Country House style hotel with a cosy club like atmosphere');
messages[34] = new Array('../london10ph/london105780.jpg','10, London Street. 2 quiet garden-facing bedrooms in this Georgian house.');
messages[35] = new Array('../orchardph/viewsm.jpeg','Drumfin (Orchard Road South), 1 Double, 1 Twin and 1 Single bedroom, en-suite and private bathrooms');
messages[36] = new Array('../gloucesterph/gloucester5780.jpg','7 Gloucester Place, Family home offering bed and breakfast. Warm, friendly and quiet.');
messages[37] = new Array('../howardph/howard5780.jpg','The Howard, Discreet elegant Georgian House luxury boutique hotel');
messages[38] = new Array('../londonph/londonstreet5780.jpg','20 London Street. 3 quiet garden-facing bedrooms in Georgian house');
messages[39] = new Array('../ravelestonph/ravelston5780.jpg','1c Ravelston Dykes. Family home bed and breakfast close to Modern Art Gallery.');
messages[40] = new Array('../morayplaceph/moraypl5780.jpg','11 Moray Place. Very fine Georgian circular Place. Garden keys');
messages[41] = new Array('../royalscotsclub/titleph/scface80sm.jpeg','The Royal Scots Club, Bed and breakfast, dinner, and executive conference facilities');
messages[42] = new Array('../guestroomph/guestroom5780.jpg','The Guest Room, Hideaway bed and breakfast for 2 or 4.');
messages[43] = new Array('../broughtonph/broughton5780.jpg','16, Broughton Place. Paintings, drawings, quiet Georgian top floor.');
messages[44] = new Array('../braemarph/braemar5780.jpg','Braemar, between city and airport, free parking good buses, 5 bedrooms');
messages[45] = new Array('../albionph/viewsm.jpeg','Albion, B and B, 15 mins by regular bus from Princes Street. En suite and private bathrooms');
messages[46] = new Array('../avenueph/facade5783.jpeg','The Avenue. In a tree lined street, friendly family Bed and Breakfast Guest house with 9 bedrooms');
messages[47] = new Array('../abercromph/abercromb5780.jpg','21b, Abercromby Place, charming, cosy Bed and Breakfast with 2 double bedrooms');
messages[48] = new Array('../bonhamph/bonham5780.jpg','The Bonham Hotel, stylish, modern, hi-tech, relaxed and informal');
messages[49] = new Array('../castlevph/facadesm.jpeg','Castleview Guest House, the most central Guest House with views of the Castle');
messages[50] = new Array('../heriotrowph/heriotrow5780.jpg','30 Heriot Row. Garden-level B&amp;B in one of Edinburgh\'s most elegant Georgian streets.');
messages[51] = new Array('../athollph/westsussex5780.jpg','37 Atholl Crescent Lane. Very central, cosy and quiet bed and breakfast home.');
messages[52] = new Array('../ardgarthph/ardgarth5780.jpg','Ardgarth Guest House. Warm, friendly, family run, 10 bedrooms, disabled access, good bus route');
messages[53] = new Array('../glenfinlas/glenfinlas5780.jpg','10 Glenfinlas Street, fully serviced rental with breakfast');
messages[54] = new Array('../sandemanph/sandeman5780.jpg','Sandeman House, family home bed and breakfast, double, twin and single bedrooms');
messages[55] = new Array('../tipperlinnph/tipperlinn5780.jpg','1 Tipperlinn Road. 1800s Graeco-Italianate Villa in gardens, free parking.');
messages[56] = new Array('../albertterraceph/albertt5780.jpg','1, Albert Terrace. Peaceful and quiet, beautiful garden. bed and breakfast.');
messages[57] = new Array('../4morningsideph/4morning5780.jpg','4 Morningside Place, B&#38;B at a family home in a lovely garden shaded by great cedar trees.');
messages[58] = new Array('../fairholmeph/fairholme5780.jpg','Fairholme Guest House. Quiet Victorian residential area. Free parking. Good buses.');
messages[59] = new Array('../summerhouseph/summerhouse5780.jpg','The Summer House, bed and breakfast in a Summer House in the garden');
messages[60] = new Array('../merbankph/merbank5780.jpg','Allens, 3 Merchiston Bank Avenue. Quiet Victorian Terrace B and B');
messages[61] = new Array('../regentph/regent5780.jpg','29 Regent Terrace. B and B in Georgian Terrace on Calton Hill');
messages[62] = new Array('../royalcircusph/royalcircus5780.jpg','One Royal Circus. Exclusive use rental (up to 12) or bed and breakfast, magnificent Georgian town house');
messages[63] = new Array('../eildonph/eildon5780.jpg','18 Eildon Street. Great breakfast table views of Edinburgh skyline.');
messages[64] = new Array('../saxecoburgph/saxecoburg5780.jpg','24 Saxe-Coburg Place, Quiet leafy square, Georgian house B&amp;B.');
messages[65] = new Array('../craigmossph/craigmoss5780.jpg','Craigmoss, Victorian charm, 5 double or twin bedrooms.');
messages[66] = new Array('../royalcircus22ph/royalcircus225780.jpg','22 Royal Circus, warm quiet B&amp;B with garden.');
messages[67] = new Array('../gardenlodgeph/gardenlodge5780.jpg','B&amp;B in a house in the garden of Kildonan House Hotel. Guests welcome in hotel too.');
messages[68] = new Array('../india21ph/india215780.jpg','21 India Street. Two bedrooms in a fine Georgian house.');
messages[69] = new Array('../glencairnph/glencairn5780.jpg','17 Glencairn Crescent. One large bedroom overlooking garden.');
messages[70] = new Array('../sandaigph/sandaig5780.jpg','Sandaig. Friendly guest house overlooking park.');
messages[71] = new Array('../greatkingstreetph/greatkingstreet5780.jpg','80 Great King Street. Georgian proportions, modern comfort and informality.');
messages[72] = new Array('../botanicsph/botanics5780.jpg','Botanics B&amp;B, Quiet, friendly, garden-wing hide-away, just across the road from the Royal Botanic Gardens.');
messages[73] = new Array('../queensph/queens5780.jpg','Queens Guest House. 12 smart bedrooms and bathrooms, Georgian house from the 1790s. Complimentary key to Queen Street Gardens.');
messages[74] = new Array('../arthouseph/arthouse5780.jpg','Wallace\'s Arthouse Scotland. Warmly welcoming B&amp;B in a Georgian building with many excellent restaurants around about');

////////////////////  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
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = 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) {
		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 (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) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.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) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

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

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')