<!--

// 										//
// Random images for the homepage		//
// Valid source material: .jpg & .swf	//
// v1.3 sagba 26.01.07					//
//										//

// Path to published location of images used
var path = "/webresources/images/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "/images/";
// 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('37325','jpg','Three students walking in the shade of trees outside the main University building on a sunny day','Welsh alt text - awaiting translation','','','','');
images[1] = new Array('38177','jpg','Students walking through a park with cherry trees in flower','CY','','','','');
images[2] = new Array('38182','jpg','Students relaxing and talking amongst the arches','CY','','','','');
images[3] = new Array('38183','jpg','The Glamorgan Building','Adeilad CY CY CY','','','','');
images[4] = new Array('38184','jpg','Students outside the School of Engineering building','5cy','','','','');
images[5] = new Array('38190','jpg','Students walking through the gates outside the University main building','6cy','','','','');
images[6] = new Array('38192','jpg','People relaxing in Cardiff&rsquo;s Civic Centre','7cy','','','','');
//images[7] = new Array('38194','swf','','','456','138','8,0,0,0','#fff');

// images[x] = new Array(
		// 0 - name			- file name
		// 1 - extension	- jpg/swf
		// 2 - alt eng		- string
		// 3 - alt cym		- string
		// 4 - width		- .swf only value
		// 5 - height		- .swf only value
		// 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 {
			document.write("<img src=\""+path+prefix+images[i][0]+suffix+"."+images[i][1]+"\" alt=\""+images[i][langID]+"\" class=\"floatRight\" />");
		}
	}
//
//-->
