if(document.documentElement){
	document.documentElement.className = "hasjs";
};

function init() {
	if (!document.getElementById || !document.createElement) return;
	random_image(); 
}

window.onload = init;

function random_image() {
	var random_pics = new Array();
	random_pics[0] = ["All Saints Chapel","all_saints"];
	random_pics[1] = ["Wrought Iron Cedar Grove Cemetery Sign","cemetery_sign"];
	random_pics[2] = ["Civil War Veteran Marker Over a Grave","civil_war_marker"];
	random_pics[3] = ["A Cross and Plant Mark a Grave","cross_marker"]	
	random_pics[4] = ["Pink Flowers Adroning Gravestones","flowers"]
	random_pics[5] = ["Pink Flowers Adroning Gravestones","flowers2"]
	random_pics[6] = ["Pink Flowers Adroning Gravestones","flowers_tombstone"];
	random_pics[7] = ["The Grotto at Night","grotto_night"];
	random_pics[8] = ["Tulips Leading up to the Grotto","grotto_tulips"];
	random_pics[9] = ["Statue of Jesus in front of All Saints Chapel","jesus_chapel"]
	random_pics[10] = ["A Statue of Jesus Stands as a Grave Marker","jesus_marker2"]
	random_pics[11] = ["A Statue of Mary as seen from Surrounding Bushes","mary_bush"];
	random_pics[12] = ["A Statue of Mary Overlooking the Graves","mary_gravestone"];
	random_pics[13] = ["A Statue of Mary Overlooking the Graves","mary_statue"];
	random_pics[14] = ["A Yellow Flower on top of a Grave","yellow_flower"]
	random_pics[15] = ["Yellow and Purple Flowers on top of a Grave","yellow_purple_flowers"]
	random_pics[16] = ["The Golden Dome through the trees","dometrees"];
	random_pics[17] = ["The Dome Seen behind the Notre Dame Flag","flagmary"];
	random_pics[18] = ["The grotto at night time","grottonight"]
	random_pics[19] = ["Sun beams shine down on the grotto","grottosun"]
	random_pics[20] = ["Campus as seen from across the lake","lake"];
	random_pics[21] = ["A statue stands tall on campus","moses"]
	random_pics[22] = ["Touchdown jesus looks over campus","tdjesus"]
	var random_pic = random_pics[rand(23)];

	var div	= $('featured');
	if (!div) return;

	var imgs = div.getElementsByTagName('img');
	if (imgs.length == 0) return;
	
	img = imgs[0];
	
	newimg = document.createElement('img');
	newimg.src = 'http://cemetery.nd.edu/images/homepage/' + random_pic[1] + '.jpg';
	newimg.alt = random_pic[0]; 
	img.parentNode.insertBefore(newimg,img);
	img.parentNode.removeChild(img);	
}

function rand(n) {
  return (Math.floor(Math.random() * n));
}