// JavaScript Document

var DYK = [];
DYK[0] = ["John Stuart, 3rd Earl of Bute, was the first 'director' of Kew Gardens and largely responsible for the development of Kew as a botanical garden","History"];
DYK[1] = ["In the 1870's, the 3rd Marquess of Bute gathered a menagerie of exotic creatures, including wallabies - which were free to jump around the grounds","History"];
DYK[2] = ["On the outbreak of the war in 1914, the 4th Marquess and Marchioness of Bute offered Mount Stuart for use as a hospital. For the next five years, the hospital treated over 2,100 people. In recognition of her hospital work, Lady Bute was made a Dame of the British Empire by King George V","History"];
DYK[3] = ["The swimming pool at Mount Stuart was the first heated pool in any house","Exploring"];
DYK[4] = ["Mount Stuart was the first house in Scotland to be lit by electricity","Exploring"];
DYK[5] = ["The gardeners have developed a cunning method of tobogganning down the steep slopes of the Rock Garden in order to take care of it.","Exploring"];
DYK[6] = ["The Stuarts of Bute lived in Rothesay Castle until its final demise in May 1685","History"];
DYK[7] = ["In 1876 Prince Leopold, a son of Queen Victoria, attended vespers in The Burges Chapel at Mount Stuart","Exploring"];
DYK[8] = ["The 4th Marquess of Bute had a passion for sport and even took boxing lessons from Jack Petersen, a world champion boxer in the 1920's","History"];
DYK[9] = ["The 7th Marquess of Bute is known simply as \'Johnny Bute\'. He had a successful career in motor racing, driving in British Formula 1 in the 1986 season and winning the Le Mans 24-hour race in 1988.","History"];
DYK[10] = ["The 3rd Marquess of Bute did not hunt, shoot or fish, banned the use of gin traps on his estates and supported the anti-vivisection movement.","History"];
DYK[11] = ["The Mount Stuart's Swimming Pool originally adjoined a Turkish Bath (since removed) for which Rowand Anderson designed a scheme of tiles decorated with mermaids.","Exploring"];
DYK[12] = ["The Henry VIII room contains a portrait of the monarch by an artist working in the style of Hans Holbein II.","Hospitality"];
DYK[13] = ["In medieval times, the inhabitants of Bute developed a close association with St Brandan. To this day, somebody born on Bute is referred to as a 'Brandane'. You can see St Brandan being chased by a mythical sea cat in the Marble Chapel.","Exploring"];
DYK[14] = ["A spider and his web are featured in the carving on a pillar in The Drawing Room.","Exploring"];
DYK[15] = ["Lord Bute chose a red silk wall for Lady Bute’s room, because he said it matched her rosy complexion. ","Exploring"];
DYK[16] = ["The Crichton-Stuart family can trace their ancestry back to Walter Fitz-alan, who became Steward to Kind David I and is said to be the grandson of Fleance who escaped when his father, Banquo, was murdered by Macbeth.","History"];
DYK[17] = ["The Award-winning Visitor Centre was opened by Richard Attenborough in June 2001.","Visiting"];
DYK[18] = ["Seasonal vegetables, fruits and herbs from our Victorian Kitchen Garden are available in the Garden Centre.","Visiting"];
DYK[19] = ["Many items in our Gift Shop are exclusive to Mount Stuart and inspired by its collections.","Visiting"];
DYK[20] = ["The Gift Shop sells a range of crockery inspired by the designs of the 3rd Marquess' favourite architect, William Burges.","Visiting"];
DYK[21] = ["Lady Bute was instrumental in introducing one of the first Dahlias into this country.","Exploring"];

var EVN = [];
//EVN[0] = ["<strong>eatBute08<br \/>Friday 23rd - Saturday 24th May<\/strong><br \/>Event showcasing the very best local produce available","www.eatBute.com","event_001.jpg"];
//EVN[1] = ["<strong>Isle of Bute Jazz Festival Concert<br \/>Friday 2nd May<\/strong><br \/>Jazz Concert in the Marble Hall","www.butejazz.com",""];
//EVN[0] = ["<strong>Visual Arts Exhibition<br \/>11th May - 30th September (incl.)<\/strong><br \/>Mount Stuart 2008 Visual Arts Programme<br \/>Mark Neville:<br \/>New Film and Photographic work","","event_002.jpg"];
//EVN[2] = ["<strong>Artist Talk<br \/>Sunday 11th May at 3pm<br \/>Mount Stuart Visitor Centre<\/strong><br \/>Artist Mark Neville in conversation about his new film and photographic work for Mount Stuart Visual Arts Programme. Booking advisable.","",""];
//EVN[1] = ["<strong>Peter Pan<br \/>Wednesday 16th July<\/strong><br \/>Open Air Theatre Performance by Heartbreak Productions","","event_003.jpg"];

// FUNCTION THAT CHECKS THE DOM 
function getObj(name){
if (document.getElementById)
{
	//if (typeof(document.getElementById.name) != "undefined") {
	this.obj = document.getElementById(name);
			   }
	//}
else if (document.all)
{this.obj = document.all[name];}
else if (document.layers)
{this.obj = document.layers[name];}
}

function getRandomNum(theNumber) {
	var rndm = Math.floor(Math.random()*theNumber);
	return rndm;
}

function doDYK() {
	var thisDYK = new getObj("theOption");
	if (typeof(thisDYK) != "undefined") {
	var thisNum = getRandomNum(DYK.length);
	var thisText = DYK[thisNum][0];
	var thisLink = DYK[thisNum][1]
	var thisDYKContent = "<dl id=\"DYK\"><dt>Did you know?</dt><dd id=\"DYK_dd\">" + thisText + "<div id='dd_link'>Read more in <a href=\"\/" + thisLink + "\">" + thisLink + "<\/a><\/div></dd></dl>";
	if (document.getElementById || document.all) {thisDYK.obj.innerHTML = thisDYKContent;}
	else {
		thisDYK.obj.document.open();
		thisDYK.obj.document.write(thisDYKContent);
		thisDYK.obj.document.close();
	}
	}
}

function doEVN() {
	var thisEVN = new getObj("theOption");
	if (typeof(thisEVN) != "undefined") {
	var thisNum = getRandomNum(EVN.length);
	var thisText = EVN[thisNum][0];
	var thisLink = EVN[thisNum][1];
	var thisImage = EVN[thisNum][2];
	var thisEVNContent = "<div id=\"EVN\"><div id=\"EVN_inner\">"
	if (thisImage) {
	thisEVNContent = thisEVNContent + "<img src=\"\/images\/events\/" + thisImage + "\" alt=\"Events at Mount Stuart\" \/>";
	}
	thisEVNContent = thisEVNContent + thisText + "<br \/>Tel 01700 503877"
	if (thisLink) {
		thisEVNContent = thisEVNContent + "&nbsp;&nbsp;<a href=\"http:\/\/" + thisLink + "\">" + thisLink + "<\/a>"
		}
		thisEVNContent = thisEVNContent + "<br \/><!-- <a href='\/More\/Events\/'>Click here<\/a> for complete events calendar --><\/div><\/div>";
	if (document.getElementById || document.all) {thisEVN.obj.innerHTML = thisEVNContent;}
	else {
		thisEVN.obj.document.open();
		thisEVN.obj.document.write(thisEVNContent);
		thisEVN.obj.document.close();
	}
	}	
	}

function doChoose() {
	var thisNum = getRandomNum(2);
	// Cut out one or the other - DYK only = 0, EVN only = 1
	thisNum = 0;
	if (thisNum==1){ doEVN();}
	else {doDYK();};
	}

//window.onload = function() {
//doDYK();
//doEVN();
//}

//alert(DYK[getRandomNum(DYK.length)]);