var theTitle = new Array();
var theLine = new Array();
var theImage = new Array();
			

function tempFuncToTest() {
			
			theTitle[0] = "<a href='/service/Design_and_Build/' title='Design and Build'>Design and Build</a>";
			theTitle[1] = "<a href='/service/Operate_and_Support/' title='Operate and Support'>Operate and Support</a>";
			theTitle[2] = "<a href='/service/Measure_and_Control/' title='Measure and Control'>Measure and Control</a>";
			
			theLine[0] = "Our Network Design and Build team is well known within the industry for it's expertise in data installations...";
			theLine[1] = "belcom has built a strong reputation for its expertise in supporting global telecommunications networks...";
			theLine[2] = "If like belcom your mantra is 'Monitor, Understand & Manage' or MUM's the word...";
			
			theImage[0] = "design_build.jpg";
			theImage[1] = "operate_support.jpg";
			theImage[2] = "measure_control.jpg";
}
function prepareCarousel() {
			if (!document.getElementById("carousel")) return;
			//Run this for now
			tempFuncToTest();
			//Create the valid HTML
			var container = document.getElementById("carousel");
			var carouselText = document.getElementById("carousel-text");
			var htmlList = document.createElement('ul');
			htmlList.setAttribute('id', "carousel-list");
			carouselText.appendChild(htmlList);
			
			for(var i=0; i<3; i++) {
				var list = document.createElement('li');
				list.innerHTML = '<a href="#" title="tester" onclick="display('+ i + ')">Test<\/a>';
				//list.setAttribute('id', "diplay"); 
				//temp for now
				if(i==0)
				{
					list.setAttribute('class', "carousel-selected"); 
				}
				//------
				htmlList.appendChild(list);
			}
		}
		
function display(num) {
	//Unset button being pressed
	var carouselList = document.getElementById("carousel-list");
	
	//Loop through the list and unset them all apart from the new selected one
	for (var i=0; i < carouselList.childNodes.length; i++) {
	if(num != i) {
		carouselList.childNodes[i].setAttribute('class', "");
	} else {
		carouselList.childNodes[i].setAttribute('class', "carousel-selected");
	}
	}
	//Swap Image out and text here
	var carouselText = document.getElementById("carousel-text");
	var title = carouselText.getElementsByTagName("h3");
	var sentence = carouselText.getElementsByTagName("p");
	var image = document.getElementById("carousel");
	
	//When ready use this
	image.style.backgroundImage = 'url(../img/' + theImage[num] +')';
	//Alter
	title[0].innerHTML = theTitle[num];
	sentence[0].innerHTML = theLine[num];
	return false;
}

addLoadEvent(prepareCarousel);
//window.onload = ;