﻿// JavaScript Document
geoscenicImageGallery = {};
// Set up the image files to be used.
geoscenicImageGallery.theImages = [
	['P711484.jpg', 'Aerial views of flooding in the Cumbria and Dumfries areas - 20th November 2009. Lochmaben area. '],
	['P711477.jpg', 'Aerial views of flooding in the Cumbria and Dumfries areas - 20th November 2009. Lochmaben area. '],
	['P595602.jpg', 'SHALDRIL - April 2005. Prince Gustav Channel.'],
	['P593899.jpg', 'Image of water droplets. '],
	['P550284.jpg', 'Hexaplex tripteroides, a gastropod from the Eocene.'],
	['P550277.jpg', 'Pseudodiadema, a fossil echinoid.'],
	['P550271.jpg', 'Temnocidaris (Stereocidaris) sceptifera, a fossil echinoid.'],
	['P549568.jpg', 'Lingulella, a Cambrian brachiopod.'],
	['P549503.jpg', 'Amphoracrinus portlocki, a fossil crinoid.'],
	['P544093.jpg', 'Gold specimen, close up. High grade gold from the Gwynfyndd mine. 40 feet below the N6 or deep adit level. Mined in 1984. Chidlaw link. Dolgellau gold belt.'],
	['P527602.jpg', 'Muscovite mica from the Loch Nevis Mica Prospect, Knoydart, Invernessshire. '],
	['P527598.jpg', 'Iron ore from a vein at the east end of Loch Monar, Ross and Cromarty. '],
	['P550293.jpg', 'Euomphalus pentangulatus, from the Silurian of Ireland.'],
	['P505729.jpg', 'Aerial view of the River Forth meandering, outskirts of Stirling. '],
	['P215988.jpg', 'Ben Nevis.'],
	['P054617.jpg', 'Chalcedony. Photomicrograph. Light: XPL. Objective: X2.5. Sample: ED1225. '],
    ['P572413.jpg', 'Iceland, Dettifoss area.'],
    ['P527900.jpg', 'Concretionary ironstone from Lecht, Tomintoul, Banffshire.'],
    ['P513276.jpg', 'Atar sheet. Sodalite-syenite. '],
    ['P524769.jpg', 'Pyrite mineral specimen. '],
	['P500099.jpg', 'Icebergs and proglacial lake Jokulsarton, Breidamerkarjokull on the southern side of Vatnajokull, southern Iceland. '],
    ['P521540.jpg', 'Mineral specimen of prehnite. Castle Hill, 3.2 km west-south-west of Kilbirnie, Ayrshire.'],
    ['P521542.jpg', 'rargh'],
    ['P521538.jpg', 'Mineral specimen of thomsonite with analcime. North-west end of Loanhead Quarry, c. 2 miles north-north-east of Beith Station, Ayrshire. '],
    ['P521057.jpg', 'A fossil specimen of Alethopteris lonchitica Schlotheim. A fossil plant. (Plantae.) Hamilton, Lanarkshire, Scotland. '],
    ['P521009.jpg', 'A fossil specimen of Metarnioceras aff. subpellati Spath. A fossil ammonite. (Mollusca, Cephalopoda, Ammonoidea.) Broadford, Skye, Sutherland, Scotland. '],
    ['P211238.jpg', 'Speke\'s Mill Mouth. Looking ESE. '],
	['P064542.jpg', 'Force Crag mine, Braithwaite. Sphalerite and siderite. '],
    ['P064209.jpg', 'Volcano, Montserrat.'],
    ['P063932.jpg', 'Volcanologist measuring temperature, Soufriere Hills Volcano, Montserrat, West Indies. '],
    ['P018501.jpg', 'Meta-peridolite, Lewisian. (Granulite facies). Photomicrograph. Light: XPL. Objective: X2.5. Sample: S3946. Loch Assynt, Sutherland. '],
    ['P006030.jpg', 'Lanyon, near Madron. Looking N. '],
	['P006017.jpg', 'Great Hogus, Marazion. '],
    ['P002751.jpg', 'The Glencoe Boundary Fault, Stob Mhic Mhartuin, Lochaber. '],
	['P006094.jpg', 'Trendrine Hill. Looking N. '],
    ['P001393.jpg', 'Statfjord A production platform in the Norwegian sector. '],
	['P000968.jpg', 'Inchnadamph, looking north-west towards Quinag. Sutherland. Monument to Peach and Horne. Ardvreck Castle can just be seen in the middle distance beside Loch Assynt. Spidean Coinich and Sail Gharbh (parts of Quinag) can be seen in the background. '],
	['P000958.jpg', 'Suilven, west face, a relict mountain of Torridonian sandstone rising from a basement of Lewisian gneiss. Sutherland. '],
	['P000100.jpg', 'Corncockle Quarry, Lochmaben. Dumfriesshire. A photograph taken at the base of the quarry. Close-up view of splitting the sandstone by the \'chisel wedge\' method. ']
    ];

geoscenicImageGallery.homepageImages = [
0,
1,
9,
10,
15,
11,
13,
18,
19,
17,
20,
24,
29
]


geoscenicImageGallery.showRandomImage = function() {
    geoscenicImageGallery.showImage(Math.floor(Math.random() * geoscenicImageGallery.theImages.length), 'width="189"');	
}

geoscenicImageGallery.showRandomHomepageImage = function() {
    var index = geoscenicImageGallery.homepageImages[Math.floor(Math.random() * geoscenicImageGallery.homepageImages.length)];
	geoscenicImageGallery.showImage(index, 'style="border:solid 2px #7399c6; width:300px;"');
}

//For openGeoscience page:
geoscenicImageGallery.showImage = function(index, styling)
{
   $('#geoscenicImages').append('<img src="/opengeoscience/images/geoScenicPhotoArchive/'+geoscenicImageGallery.theImages[index][0] +'" ' + styling + ' alt="'+geoscenicImageGallery.theImages[index][1] +'" title="'+geoscenicImageGallery.theImages[index][1] +'">');
	
}

geoscenicImageGallery.getGeoscenicImages = function() 
{
	var r=0;
	for (r=0; r<+geoscenicImageGallery.theImages.length; r++) {
	    geoscenicImageGallery.loadImage(r);	
	}
};

geoscenicImageGallery.loadImage = function(index) {
	var geoscenicImg = new Image();
	geoscenicImg.onload = function(){
		if (170 > geoscenicImg.height && 160 < geoscenicImg.height)
		{
			
			document.getElementsByTagName('body')[0].appendChild(document.createTextNode(index + ","));
			document.getElementsByTagName('body')[0].appendChild(document.createElement('br'));
		}
	};
	geoscenicImg.src = '/opengeoscience/images/geoScenicPhotoArchive/'+geoscenicImageGallery.theImages[index][0];
}
