<!--
// 										//
// Random images for the homepage		//
// Valid source material: .jpg & .swf	//
// v1.3 sagba 30.03.07					//
// v1.3.1 sagba 05.01.10				//

// Path to published location of images used
var path = "http://www.cardiff.ac.uk/biosi/images/homepage/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "http://www.cardiff.ac.uk/biosi/images/homepage/";
// Rx publishing variables
var prefixF = "image-ad-"
var suffixF = "-web";

// Store the elements in arrays
// Create array of images
images = new Array();

// Images used
	// Image name should be the Content ID
	// taken from the published item in Rx
images[0] = new Array('169807','jpg','Professor Alun Davies FRS','','354','215','','','Professor Alun Davies elected Fellow of the Royal Society - May 2011.<a href=\"http://www.cf.ac.uk/biosi/newsandevents/news/newsstories/Cardiff%20Biosciences%20Scientist%20honoured%20by%20The%20Royal%20Society.html\">Read more .....</a>');
images[1] = new Array('155295','jpg','3D reconstruction of the corpus callosum ','','354','215','','','<strong>High-resolution MRI at EMRIC: </strong>3D reconstruction of the corpus callosum generated from a Diffusion Tensor MRI scan of a live rat. For details and more MRI examples see <a href=\"http://www.cardiff.ac.uk/biosi/researchsites/emric/\">www.cardiff.ac.uk/biosi/researchsites/emric/</a>');
images[2] = new Array('140509','JPG','Prof Borri','','354','215','','','Professor Paola Borri is a physicist working in the area of Biophotonics at the physics-life science interface. Prof Borri was awarded a Marie Curie Excellence Award for outstanding achievements in her field');
images[3] = new Array('155296','jpg','3D structure of subtilisin protease ','','354','215','','','The 3D structure of the first subtilisin protease that works exclusively inside the cell has recently been determined by Dafydd Jones\' group. The work has discovered a novel inbuilt inhibition mechanism that has so far not been observed in any other proteases and is important for regulating its activity within the cell.');
images[4] = new Array('145035','jpg','Borneo Elephant','','354','215','','','Collaborative Cardiff University research tracking the movements of three Bornean elephants will inform protection of their habitat. This is run jointly by Cardiff University and Sabah Wildlife Department');
images[5] = new Array('140522','JPG','Professor Duance','','354','215','','','Professor Vic Duance, Director of the new interdisciplinary Arthritis Research Campaign Biomechanics and Bioengineering Centre studying causes and treatment of osteoarthritis. <a href=\"http://www.cf.ac.uk/arcbbc/\">www.cf.ac.uk/arcbbc/</a>');
images[6] = new Array('166184','jpg','3 institute directors','','354','215','','','Research Institutes Officially Launched: the 3 institute directors/leads and their plaques (NMHRI, SPRI and ECSCRI). <a href=\"http://www.cf.ac.uk/biosi/newsandevents/news/newsstories/research-institutes-officially-launched.html\">Read more .....</a>');

// images[x] = new Array(
		// 0 - name			- file name
		// 1 - extension	- jpg/swf
		// 2 - alt eng		- string
		// 3 - alt cym		- string
		// 4 - width		- width in pixels
		// 5 - height		- height in pixels
		// 6 - version		- .swf only value
		// 7 - background	- .swf only value

// Amend tag to reflect location of lang attribute
	var bod = document.getElementsByTagName('body')[0];
	// retrieve value of lang attribute
	var lang = bod.getAttribute('lang');
	var langID = 0;

		if (lang == "cy" || lang == "cy-gb")
				langID = 3 // Welsh
			else {
				langID = 2 // English
			}
// Randomiser 
	i = Math.floor(Math.random() * images.length);
	
// Flash output
	// Uses swfobject.js by Geoff Stearns
	// http://blog.deconcept.com/swfobject/
	// geoff@deconcept.com

	var swfo = new SWFObject(pathF+prefixF+images[i][0]+suffixF+"."+images[i][1], images[i][0], images[i][4], images[i][5], images[i][6], images[i][7]);

	function writeFlash(){
			swfo.write("random");
	}

	function randomImg()
	{
		// Hides the image which is displayed if JavaScript is not available
		var noJSimg = document.getElementById('nojs');
			//	noJSimg.setAttribute('style', 'display:none;');
			noJSimg.style.display='none';
// Displays Flash or image dependant on array value
	if (images[i][1]=="swf")
		// XHTML Compliant Flash Output
			writeFlash();
		 else {
		// Image Output
			document.write("<img src=\""+path+prefix+images[i][0]+suffix+"."+images[i][1]+"\" alt=\""+images[i][langID]+"\" width=\""+images[i][4]+"\" height=\""+images[i][5]+"\" />");
			document.write("<p><span>"+images[i][8]+"</span></p>");
		}
	}
//
//-->

