var imageIx=0;

function setFpImage(i){	
	if(document.getElementById){
		var picArray=new Array(1);
		var altArray=new Array(1);
		var linkArray=new Array(1);
		var titleArray=new Array(1);
		var imgPath='/images/frontPage/';
		var imgIx=0;
		var theImg=document.getElementById('fpImage');
		var theLink=document.getElementById('fpImageLink');

		/*picArray[0]='P000732.jpg';
		altArray[0]="Oblique aerial view of Glen Coe. Inverness-shire. (Ref P000732) - link to UK Geology research";
		titleArray[0]="Oblique aerial view of Glen Coe. Inverness-shire. Looking south-west from Beinn a' Chrulaiste showing igneous contacts between the Moor of Rannoch Granite, Lower Old Red Sandstone lavas and the Cruachan Granite (Ref P000732)";
		linkArray[0]='/research/what/UKGeology.html';
		
		picArray[1]='P002842.jpg';
		altArray[1]="Errochty Hydro-electric Dam, Glen Errochty, Perthshire. (Ref P002842) - link to UK Geology research";
		titleArray[1]="Errochty Hydro-electric Dam, Glen Errochty, Perthshire. Dalradian metasedimentary rocks in the foreground (Ref P002842)";
		linkArray[1]='/research/what/UKGeology.html';

		picArray[2]='P002852.jpg';
		altArray[2]="Russel Burn, Ross and Cromarty. (Ref P002852) - link to UK Geology research";
		titleArray[2]="Russel Burn, looking north-west into Coire nan Arr below Sgurr a' Chaorachain, Ross and Cromarty. A U-shaped glaciated valley in Torridonian sandstone (Ref P002852)";
		linkArray[2]='/research/what/UKGeology.html';

		picArray[3]='P006482.jpg';
		altArray[3]="Giant's Causeway. (Ref P006482) - link to UK Geology research";
		titleArray[3]="Giant's Causeway. Looking east. The top of the Grand Causeway in the foreground, with the cliffs of Roveran Valley Head and Spaniard Rock across Port Noffer. The upper part of the cliffs including the Chimney Tops, is in three flows of tholeiitic basalt. The red Interbasaltic Bed appears half-way up the cliffs and is underlain by irregular flows of the Lower Basalts (Ref P006482)";
		linkArray[3]='/research/what/UKGeology.html';

		picArray[4]='P008654.jpg';
		altArray[4]="Granite by the River Roy. (Ref P008654) - link to UK Geology research";
		titleArray[4]="River Roy, 1 km east of Falls of Roy. Folded veins of granite cutting Leven Schist. An axial-planar schistosity in the veins extends into the schist as a crenulation cleavage. The relationship of vein thickness to fold wavelength is well displayed (Ref P008654)";
		linkArray[4]='/research/what/UKGeology.html';
		
		picArray[5]='P3210092.jpg';
		altArray[5]="Soufriere Hills volcano, Montserrat (Ref P3210092) - link to International research";
		titleArray[5]="Soufriere Hills volcano, Montserrat (Ref P3210092)";
		linkArray[5]='/research/International/home.html';
		
		picArray[6]='P000773.jpg';
		altArray[6]="The Great Face, Staffa. (Ref P000773) - link to UK Geology research";
		titleArray[6]="Oblique aerial view of The Great Face, the south end of the island of Staffa. Argyll and Bute. The Boat Cave is on the left and Fingal's Cave on the right. Massive, straight, well-formed columnar jointing in the Tertiary volcanic lava flow (Ref P000773)";
		linkArray[6]='/research/what/UKGeology.html';
		
		picArray[7]='Hazards.jpg';
		altArray[7]="Landslide at Holbeck Hall - link to Land development research";
		titleArray[7]="Landslide at Holbeck Hall";
		linkArray[7]='/research/what/landUseAndDevelopment.html';
		
		picArray[8]='Minerals.jpg';
		altArray[8]="Mineral exploration - link to Minerals research";
		titleArray[8]="Mineral exploration";
		linkArray[8]='/research/what/minerals.html';*/
		
		picArray[0]='world_geology_globe.jpg';
		altArray[0]="LINK TO: OneGeology Homepage";
		titleArray[0]="LINK TO: OneGeology Homepage";
		linkArray[0]='http://www.onegeology.org';
		
		picArray[1]='Cape_Farewell_Special_Feature.jpg';
		altArray[1]="LINK TO: Cape Farewell website - follow BGS marine geoscientist Carol Cotterill's blog";
		titleArray[1]="LINK TO: Cape Farewell website - follow BGS marine geoscientist Carol Cotterill's blog";
		linkArray[1]='http://www.capefarewell.com/climate-science/collaborations/bgs.html';
		
		picArray[2]='Wealth_Beneath_Britain.jpg';
		altArray[2]="LINK TO: Video Clip - Geovisionary 3D visualisation for virtual field reconnaissance as featured on Britain from Above, presented by Andrew Marr. ";
		titleArray[2]="LINK TO: Video Clip - Geovisionary 3D visualisation for virtual field reconnaissance as featured on Britain from Above, presented by Andrew Marr. ";
		linkArray[2]='/research/what/technologies_epo.html#BBC_clip';
		
		picArray[3]='web-map-services.jpg';
		altArray[3]="LINK TO: Free downloads of geological map and earthquake data - WMS, KML, OGC, GeoRSS";
		titleArray[3]="LINK TO: Free downloads of geological map and earthquake data - WMS, KML, OGC, GeoRSS";
		linkArray[3]='/data/services/';
		
		picArray[4]='Archive_tours.jpg';
		altArray[4]="LINK TO: Archive Awareness Campaign (AAC) - Free guided tours of our archives on Saturday 29 November 2008 at Keyworth, near Nottingham.";
		titleArray[4]="LINK TO: Archive Awareness Campaign (AAC) - Free guided tours of our archives on Saturday 29 November 2008 at Keyworth, near Nottingham.";
		linkArray[4]='/education/archive_awareness/home.html';
		
		switch(i){
			case -1:
				// previous image
				imgIx=imageIx-1;
				if(imgIx < 0){imgIx=picArray.length;}
				break;
			case 1:
				// next image
				imgIx=imageIx+1;
				if(imgIx >= picArray.length){imgIx=0;}
				break;
			default:
				// random image
				imgIx=Math.floor(Math.random() * picArray.length);
				break;
			}
		
		imageIx=imgIx;

		theImg.src=imgPath + picArray[imgIx];
		theImg.alt=altArray[imgIx];
		theImg.title=titleArray[imgIx];
		theLink.href=linkArray[imgIx];
		}
	}
