
//  The following functions return the link to the picture with a description,
//  they reference the picture, just to simplify things
//  all pictures are 150 pixels high, but varaiable width
//  Information order is: filename from root, link address, alt text
// When calling the functions, the required parameter is "L" for Landscape, "P" for Portrait, or "" for no preference

// ****************************************************************
function getRockPic(strFormat)
{
var strReply = "";
var intPic = Math.round(Math.random()*(aryRockPics.length-1));  //get a record
//check record contains at least a picture
while (( ( (typeof aryRockPics[intPic] == "undefined") || (aryRockPics[intPic][0] == "") ) || ((aryRockPics[intPic][3] != strFormat) ) ) && (strFormat != ""))
	 intPic = Math.round(Math.random()*(aryRockPics.length-1)) ;

if (aryRockPics[intPic][1] != "") {
	strReply = '<a href="' + aryRockPics[intPic][1] +'">'};
strReply = strReply + '<img border="0" src="' + aryRockPics[intPic][0] +'"';
if (aryRockPics[intPic][2] != "") {
	strReply = strReply + ' alt="' + aryRockPics[intPic][2] + '"'};
strReply = strReply + '>';
if (aryRockPics[intPic][1] != "") {
	strReply = strReply + '</a>'};

return (strReply);
}
// ****************************************************************
function getWaterPic(strFormat)
{
var strReply = "";
var intPic = Math.round(Math.random()*(aryWaterPics.length-1)); 

while (( ( (typeof aryWaterPics[intPic] == "undefined") || (aryWaterPics[intPic][0] == "") ) || ((aryWaterPics[intPic][3] != strFormat) ) ) && (strFormat != ""))
	intPic = Math.round(Math.random()*(aryWaterPics.length-1)) ;

if (aryWaterPics[intPic][1] != "") {
	strReply = strReply + '<a href="' + aryWaterPics[intPic][1] +'">'};
strReply = strReply + '<img border="0" src="' + aryWaterPics[intPic][0] +'"';
if (aryWaterPics[intPic][2] != "") {
	strReply = strReply + ' alt="' + aryWaterPics[intPic][2] + '"'};
strReply = strReply + '>';
if (aryWaterPics[intPic][1] != "") {
	strReply = strReply + '</a>'};

return (strReply);
}
// ****************************************************************
function getMountainPic(strFormat)
{
var strReply = "";
var intPic = Math.round(Math.random()*(aryMountainPics.length-1)); 

while (( ( (typeof aryMountainPics[intPic] == "undefined") || (aryMountainPics[intPic][0] == "") ) || ((aryMountainPics[intPic][3] != strFormat) ) ) && (strFormat != ""))
	 intPic = Math.round(Math.random()*(aryMountainPics.length-1)) ;

if (aryMountainPics[intPic][1] != "") {
	strReply = strReply + '<a href="' + aryMountainPics[intPic][1] +'">'};
strReply = strReply + '<img border="0" src="' + aryMountainPics[intPic][0] +'"';
if (aryMountainPics[intPic][2] != "") {
	strReply = strReply + ' alt="' + aryMountainPics[intPic][2] + '"'};
strReply = strReply + '>';
if (aryMountainPics[intPic][1] != "") {
	strReply = strReply + '</a>'};

return (strReply);
}
// ****************************************************************
// added 150405 BL
function getOnMountainsPic(strFormat)
// randomly selects either Mountain or Rock picture set, then uses the functions above to get a picture 
{
var strReply = "";
var intPic = Math.round(Math.random());

switch (intPic){
	case 0:  strReply = getMountainPic(strFormat); break;
	case 1:  strReply = getRockPic(strFormat); break;
	default: strReply = getMountainPic(strFormat); break;
	}

return (strReply);
}
