<!--

// 										//
// 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 = "images/homepageimages/";
// Rx publishing variables
var prefix = "image-";
var suffix = "-web";

var pathF = "images/homepageimages/";
// 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('1','jpg','Cardiff School of Journalism, Media and Cultural Studies, Bute Building.','','341','225','','','The School, based in Bute Building, is a world-renowned centre for the study of all aspects of journalism, mass media and cultural studies.','http://www.cf.ac.uk/jomec/aboutus/index.html', 'About the School');
images[1] = new Array('2','jpg','Masters programmes offer a wide range of study pathways.','','341','225','','','The School’s Masters programmes offer a unique blend of scholarly excellence combined with a renowned vocational tradition.','http://www.cf.ac.uk/jomec/degreeprogrammes/pgmasters/index.html','Masters Programmes');
images[2] = new Array('3','jpg','The Broadcast Diploma accredited by the BJTC.','','341','225','','','Broadcast Journalism  covers both radio and television journalism training and it is aimed at those wishing to pursue a career in these industries.','http://www.cf.ac.uk/jomec/degreeprogrammes/pgdiploma/broadcastoption/index.html','Broadcast Journalism');
images[3] = new Array('4','jpg','The Magazine Diploma accredited by the PTC.','','341','225','','','Magazines are the most exciting and diverse media products of all, incorporating everything from frothy celebrity glossies to heavyweight political and business weeklies.','http://www.cf.ac.uk/jomec/degreeprogrammes/pgdiploma/magazineoption/index.html','Magazine Journalism');
images[4] = new Array('5','jpg','The Newspaper Diploma accredited by the NCTJ.','','341','225','','','Newspaper Journalism covers the basics of writing news, features and opinion. You will learn how to research stories, build up contacts and work a news patch.','http://www.cf.ac.uk/jomec/degreeprogrammes/pgdiploma/newspaperoption/index.html','Newspaper Journalism');
images[5] = new Array('6','jpg','Journalism, Media and Cultural Studies (BA Hons).','','341','225','','','The Journalism, Media and Cultural Studies (BA) aims to equip students to become well informed citizens in a media saturated society.','http://www.cf.ac.uk/jomec/degreeprogrammes/undergraduate/index.html','Undergraduate Programmes');
images[6] = new Array('7','jpg','PhD and MPhil study.','','341','225','','','The School offers opportunities across a wide range of research topics for full-time and part-time study leading to the degrees of PhD and MPhil.','http://www.cf.ac.uk/jomec/degreeprogrammes/pgresearch/index.html','Postgraduate Research');
// 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
		// 8 - caption		- string
		// 9 - link caption - string
		// 10 - link title  - string

// 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 
	//During the Masters Advert in Agenda magazine the Masters will have preference from 02/11/06 to 23/11/09
	
	//As of 11/06/2010 the randomiser was turned back on
	i = Math.floor(Math.random() * images.length);
	//The randomiser above hass been disabled to force the Masters to be chosen
	//i = 1
	
// 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("<a href=\""+images[i][9]+"\"><img style=padding:5px src=\""+path+prefix+images[i][0]+suffix+"."+images[i][1]+"\" alt=\""+images[i][langID]+"\" width=\""+images[i][4]+"\" height=\""+images[i][5]+"\" /></a>");
			document.write("<div class=random-caption><p><em>");
			document.write(images[i][8]);
			document.write(" </em><br/><a href=\""+images[i][9]+"\" class=linkIcon>");
			document.write(images[i][10]);
			document.write("</a></p></div>");
		}
	}
//
//-->
