// JavaScript Document
// Order of information: image location, href, target frame, alt text
var aryPics= new Array();
var i = 0;
/* This line chnages the file to show only the exterior picture of the hall - used winter 2005 to 6
aryPics[i] = new Array("bethesda/images/yhn_ext.jpg","","","Yr Hen Neuadd");*/
aryPics[i] = new Array("images/tcg01.jpg","","","Scout Activity Weekend");
aryPics[i++] = new Array("images/yw1.JPG","","","Snowdon Summit");
aryPics[i++] = new Array("bethesda/images/yhn_ext.jpg","","","Yr Hen Neuadd");
aryPics[i++] = new Array("bethesda/activities/images/tryfan-wt.jpg","","","Tryfan in winter conditions");
aryPics[i++] = new Array("bethesda/activities/images/cwmidwal.jpg","","","Cwm Idwal");
aryPics[i++] = new Array("bethesda/activities/images/southstack.jpg","","","Elen's Tower, near Holyhead");
aryPics[i++] = new Array("bethesda/activities/images/dyf-og-t.jpg","","","Ogwen Valley and Tryfan");
aryPics[i++] = new Array("bethesda/courses/images/oswe0205.JPG","","","Older Scouts' Weekend");
aryPics[i++] = new Array("images/tcg01.jpg","","","Scout Activity Weekend");
aryPics[i++] = new Array("bethesda/blogpics/Hpim1172.jpg","","","Y Garn, Foel Goch and Llyn Owen");
aryPics[i++] = new Array("bethesda/blogpics/Hpim1303.jpg","","","Lunar Halo");
aryPics[i++] = new Array("bethesda/blogpics/Hpim1332.jpg","","","Y Garn at sunset");

/* use line below as template for extra lines
aryPics[i++] = new Array("image src","link url","target frame","alt text");
*/
// Defaults can be set for link url and target frame
var defaultURL = "bethesda/yhn_index.htm";
var defaultTarget = "_top";

//  The following function returns the link to the picture with a description,
//  A picture is returned at random from the array
//  all pictures should be 236 x 175 pixels
//  Information order is: filename from home page, link address (optional), alt text


// ****************************************************************
function getPic()
{
var strReply = "";
var intPic = Math.round(Math.random()*(aryPics.length-1));  //get a record
//check record contains at least a picture
while ( (typeof aryPics[intPic] == "undefined") || (aryPics[intPic][0] == "") )
	{ intPic = Math.round(Math.random()*(aryPics.length-1)) };

if (aryPics[intPic][1] != "") {
	strReply = '<a href="' + aryPics[intPic][1]};
	else if (defaultURL != "") strReply = '<a href="' + defaultURL +'"';

if (aryPics[intPic][2] != "") {
	strReply = strReply + ' target="' + aryPics[intPic][2] +'">'};
	else 
		if (defaultTarget != "")
		strReply = strReply + 'target="' + defaultTarget +'">';
		else strReply = strReply +'>';

strReply = strReply + '<img class="floatright" width="236" height="175" border="0" src="' + aryPics[intPic][0] +'"';

if (aryPics[intPic][2] != "") {
	strReply = strReply + ' alt="' + aryPics[intPic][3] + '"'};
	
strReply = strReply + '>';

if ((aryPics[intPic][1] != "") || (defaultURL != "")) {
	strReply = strReply + '</a>'};

return (strReply);
}

