<!--

// 										//
// Random images for the homepage		//
// Valid source material: .jpg & .swf	//
// v1.3 sagba 30.03.07					//
//										//

// Path to published location of images used
var path = "/125/images/random/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "/125/images/random/";
// 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('001','jpg','Photo competition entry by Cormac West','','495','211','','');
	//images[1] = new Array('002','jpg','Photo competition entry by Cormac West','','495','211','','');
	//images[2] = new Array('003','jpg','Photo competition entry by Cormac West','','495','211','','');
	//images[3] = new Array('004','jpg','Photo competition entry by Cormac West','','495','211','','');
images[1] = new Array('005','jpg','Photo competition entry by Cormac West','','495','211','','');
	//images[5] = new Array('006','jpg','Photo competition entry by Steve Garrington','','495','211','','');
images[2] = new Array('007','jpg','Photo competition entry by Carey Davies','','495','211','','');
images[3] = new Array('008','jpg','Photo competition entry by Carey Davies','','495','211','','');
images[4] = new Array('009','jpg','Photo competition entry by Karen Austin','','495','211','','');
	//images[9] = new Array('010','jpg','Submit a photograph','','495','211','','');
images[5] = new Array('011','jpg','Submit a photograph','','495','211','','');
images[6] = new Array('012','jpg','Photo competition entry by Dan Coe','','495','211','','');
images[7] = new Array('013','jpg','Photo competition entry by Matthew Smith','','495','211','','');
images[8] = new Array('014','jpg','Photo competition entry by Eshrar Latif','','495','211','','');
images[9] = new Array('015','jpg','Photo competition entry by Bicky Ho','','495','211','','');
images[10] = new Array('016','jpg','Photo competition entry by Peter Brabham','','495','211','','');
images[11] = new Array('017','jpg','Photo competition entry by Richard Wood','','495','211','','');
images[12] = new Array('017','jpg','Photo competition entry by Anthony Thomas','','495','211','','');

// 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]+"\" title=\""+images[i][langID]+"\" width=\""+images[i][4]+"\" height=\""+images[i][5]+"\" />");
		}
	}
//

// 										//
// Random images for the homepage		//
// Valid source material: .jpg & .swf	//
// v1.3 sagba 30.03.07					//
//										//

// Path to published location of images used
var path = "/125/images/random/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "/125/images/random/";
// Rx publishing variables
var prefixF = "image-ad-"
var suffixF = "-web";

// Store the elements in arrays
// Create array of images
leftpic = new Array();

// Images used
	// Image name should be the Content ID
	// taken from the published item in Rx
leftpic[0] = new Array('101','jpg','Glamorgan Building','','242','211','','');
leftpic[1] = new Array('102','jpg','Cardiff University main building','','242','211','','');
leftpic[2] = new Array('103','jpg','Cardiff University main building','','242','211','','');

// leftpic[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
		// 8 - Name
		// 9 - Quote
		// 10 - Caption

// 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 
	c = Math.floor(Math.random() * leftpic.length);

// Flash output
	// Uses swfobject.js by Geoff Stearns
	// http://blog.deconcept.com/swfobject/
	// geoff@deconcept.com

	var swfo = new SWFObject(pathF+prefixF+leftpic[c][0]+suffixF+"."+leftpic[c][1], leftpic[c][0], leftpic[c][4], leftpic[c][5], leftpic[c][6], leftpic[c][7]);

	function writeFlash(){
			swfo.write("randomleftpic");
	}

	function randomLeftImg()
	{
		// Hides the image which is displayed if JavaScript is not available
		var noJSimg = document.getElementById('nojsLeftImg');
			//	noJSimg.setAttribute('style', 'display:none;');
			noJSimg.style.display='none';
// Displays Flash or image dependant on array value
	if (leftpic[c][1]=="swf")
		// XHTML Compliant Flash Output
			writeFlash();
		 else {
		// Image Output
			document.write("<img src=\""+path+prefix+leftpic[c][0]+suffix+"."+leftpic[c][1]+"\" alt=\""+leftpic[c][langID]+"\" title=\""+leftpic[c][langID]+"\" width=\""+leftpic[c][4]+"\" height=\""+leftpic[c][5]+"\" />");
		}
	}
//-->
