// JavaScript Document
	var imgList = new Array(3);
	var selCP = "";
	var selID = 0;
	var interval;
	var iFirst = 0;

	var divList = new Array(2);
	divList[0] = "titleDiv";
	divList[1] = "cpDiv";
	divList[2] = "blurbDiv";

	var imgLink = new Array(4);
	var imgAlt = new Array(4);



	function increaseInterval() {
		if (selID >= imageCount) {
			selID = 0;
		} else {
			selID = selID + 1;
		}

		interval = window.setInterval(setDefaults, 5000);
//		if (selID == 1) {
//			interval = window.setInterval(setDefaults, 5000);
//		} else {
//			interval = window.setInterval(setDefaults, 5000);
//		}
	}


	// Make sure this is updated accordingly image count -1 for array
	var imageCount = 4;

	function fileItemClick() {
		for(i=0;i<=imageCount;i++) {
			if (document.getElementById("img" + i).className == "imageOn") {
				window.location = imgLink[i];
				return;
			}
		}
	}

	function filmItemclick(obj) {
		var objID = obj.id;
		var strLen = objID.length;
		var newID = objID.substr(strLen - 1, 1);
		for(i=0;i<=imageCount;i++) {
			document.getElementById("img" + i).className = "imageOff";
		}
		document.getElementById(obj.id).className = "imageOn";
		//window.clearInterval(interval);
		selID = parseInt(newID);
		selCP = obj.id;
		adjustDisplay();
	}

	function changeCP(obj) {
		// imageCount addition
		for(i=0;i<=imageCount;i++) {
			document.getElementById("img" + i).className = "imageOff";
		}
		document.getElementById(obj.id).className = "imageOn";
		window.clearInterval(interval);
		adjustDisplay();
		selCP = obj.id;
	}

	function setDefaults() {
		changeCP(document.getElementById("img" + selID));
		increaseInterval();
	}

	function adjustDisplay() {
		// This loop is for the number of items stored in the divlist
		for(x=0;x<3;x++) {
			// This loop is for the number of pictures on the site
			for(y=0;y<=imageCount;y++) {
				if (x != 1) {
					document.getElementById(divList[x] + y).style.display = "none";
				}
			}
			document.getElementById(divList[x] + selID).style.display = "block";

		}
//		for(i=0;i<3;i++) {
//			document.getElementById(divList[i] + selID).style.display = "block";
//		}
		document.getElementById("imageCP").src = imgList[selID];
		document.getElementById("imageCP").alt = imgAlt[selID];
//		alert(document.getElementById("imageCP").clientHeight);
//		alert(document.getElementById(divList[2] + selID).clientHeight);
		// Take the height of the image minus the height of the text 
		var height =  document.getElementById("imageCP").clientHeight - document.getElementById(divList[2] + selID).clientHeight;

		document.getElementById(divList[2] + selID).style.top = height -10 + "px";
	}

	function changeDisplay(obj,itype) {
		if (obj.id != selCP) {
			if (itype==0) {
				document.getElementById(obj.id).className = "imageOff";
			} else {
				document.getElementById(obj.id).className = "imageOn";
			}
		}
	}


