
//Feature Cycler for April Fools version of home page
//Modified by Brian Gray March 31, 2008

var num_features = 5;
var top = Math.floor(Math.random()*(num_features-1));

var f_photos = new Array(num_features);
var t_photos = new Array(num_features);
var titles = new Array(num_features);
var text = new Array(num_features);
var links = new Array(num_features);

f_photos[0] = "../assets/images/April_Fools/2008/alligator.jpg";
f_photos[1] = "../assets/images/April_Fools/2008/demontodarling.jpg";
f_photos[2] = "../assets/images/April_Fools/2008/FacultyRelocation.jpg";
f_photos[3] = "../assets/images/April_Fools/2008/JuicyCampus.jpg";
f_photos[4] = "../assets/images/April_Fools/2008/MinkusQuad.jpg";
t_photos[0] = "../assets/images/misc/thumbnails/alligator105t.jpg";
t_photos[1] = "../assets/images/misc/thumbnails/demontodarling105t.jpg";
t_photos[2] = "../assets/images/misc/thumbnails/FacultyRelocation105t.jpg";
t_photos[3] = "../assets/images/misc/thumbnails/JuicyCampus105t.jpg";
t_photos[4] = "../assets/images/misc/thumbnails/MinkusQuad105t.jpg";
titles[0] = "Alligator Awareness Week"
titles[1] = "\"Demon Deacon\" to \"Darling Deacon\""
titles[2] = "Faculty Relocates to Johnson"
titles[3] = "Juicy Campus Postings Revealed"
titles[4] = "Minkus Outbids Manchester for Quad"
text[0] = "Come to Lake Catherine at Reynolda Gardens for instructions on tracking alligators ... (<a class=\"blacklink\" style=\"text-decoration: none;\" href=\"/home/\">More</a>)"
text[1] = "Strategic planning committee decided that the word \"demon\" is warding off potential students. Recent polls ... (<a class=\"blacklink\" style=\"text-decoration: none;\" href=\"/home/\">More</a>)"
text[2] = "Ever thought your freshman roommate might be your religion professor? Class of 2012 is in for a surprise ... (<a class=\"blacklink\" style=\"text-decoration: none;\" href=\"/home/\">More</a>)"
text[3] = "Lawsuit forces Juicy Campus to reveal all previously anonymous postings ... (<a class=\"blacklink\" style=\"text-decoration: none;\" href=\"/home/\">More</a>)"
text[4] = "\"Boy Meets World\" paid better than we thought. Minkus makes a surprise comeback ... (<a class=\"blacklink\" style=\"text-decoration: none;\" href=\"/home/\">More</a>)"
links[0] = "/home/"
links[1] = "/home/"
links[2] = "/home/"
links[3] = "/home/"
links[4] = "/home/"

//PRELOAD
for(var i=0; i<num_features; i++) {
	tmp = new Image();
	tmp.src = f_photos[i];
	tmp2 = new Image();
	tmp2.src = t_photos[i];
}

function init() {
	document.getElementById("pos1_photo").src = f_photos[top];
	document.getElementById("pos1_title").innerHTML = titles[top];
	document.getElementById("pos1_link").href = links[top];
	document.getElementById("pos2_photo").src = t_photos[(top+1)%num_features];
	document.getElementById("pos2_title").innerHTML = titles[(top+1)%num_features];
	document.getElementById("pos2_text").innerHTML = text[(top+1)%num_features];
	document.getElementById("pos2_link").href = links[(top+1)%num_features];
	document.getElementById("pos3_photo").src = t_photos[(top+2)%num_features];
	document.getElementById("pos3_title").innerHTML = titles[(top+2)%num_features];
	document.getElementById("pos3_text").innerHTML = text[(top+2)%num_features];
	document.getElementById("pos3_link").href = links[(top+2)%num_features];
	document.getElementById("pos4_photo").src = t_photos[(top+3)%num_features];
	document.getElementById("pos4_title").innerHTML = titles[(top+3)%num_features];
	document.getElementById("pos4_text").innerHTML = text[(top+3)%num_features];
	document.getElementById("pos4_link").href = links[(top+3)%num_features];
}

function rotate(dir) {
	if(dir == "cw") {
		top = ++top % num_features;
	}
	else {
		if(top-1 >= 0) newTop = --top;
		else {
			top = num_features-1;
		}
	}
	newTop = top;
	document.getElementById("pos1_photo").src = f_photos[newTop];
	document.getElementById("pos1_title").innerHTML = titles[newTop];
	document.getElementById("pos1_link").href = links[newTop];
	
	document.getElementById("pos2_photo").src = t_photos[(newTop+1)%num_features];
	document.getElementById("pos2_title").innerHTML = titles[(newTop+1)%num_features];
	document.getElementById("pos2_text").innerHTML = text[(newTop+1)%num_features];
	document.getElementById("pos2_link").href = links[(newTop+1)%num_features]
	
	document.getElementById("pos3_photo").src = t_photos[(newTop+2)%num_features];
	document.getElementById("pos3_title").innerHTML = titles[(newTop+2)%num_features];
	document.getElementById("pos3_text").innerHTML = text[(newTop+2)%num_features];
	document.getElementById("pos3_link").href = links[(newTop+2)%num_features]
	
	document.getElementById("pos4_photo").src = t_photos[(newTop+3)%num_features];
	document.getElementById("pos4_title").innerHTML = titles[(newTop+3)%num_features];
	document.getElementById("pos4_text").innerHTML = text[(newTop+3)%num_features];
	document.getElementById("pos4_link").href = links[(newTop+3)%num_features];	
}

