<!--

// 										//
// 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 = "/sport/images/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "/sport/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('61713','jpg','Developing sporting talent','','233','61','','');
images[1] = new Array('61741','jpg','Excellent value','','233','61','','');
images[2] = new Array('61740','jpg','Get active and enjoy the benefits','','233','79','','');

// 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]+"\" />");
		}
	}
//
//-->
