// JavaScript Document

//var imagePath = "images/random/";
var imageRotateArray = new Array('nitta.jpg','cheer.jpg','cheer2.jpg','stuffed.jpg','girls.jpg','savemarttower.jpg','timeout.jpg','pathill.jpg','timeout2.jpg','cruz.jpg','lab.jpg','usu.jpg','library.jpg','students.jpg','smittcamp.jpg','bronzebulldog.jpg','musicschoolx.jpg','fountain.jpg','stadium.jpg','studlife.jpg','Orient.gif');

function LoadImage(id,imagePath)
{
	var ran = Math.floor(Math.random()*imageRotateArray.length);
	var img = new Image();
	var entireFileName = imagePath + imageRotateArray[ran];
	img.src = entireFileName;
	document.getElementById(id).innerHTML = '<img src="' + entireFileName + '" width="140" />'
}

function preload()
{
	var y = new Image();
	for(var x in imageRotateArray)
	{
		//document.write(x);
		y.src = imagePath + imageRotateArray[x];
	}
	rotateImage();
}

function rotateImage()
{
		
		var size = imageRotateArray.length;
		ran = imageRotateArray[Math.floor(Math.random()*size)];
		//alert(ran);
		document.getElementById('level1_5').innerHTML = '<a><img src="' + imagePath + ran + '"/></a>';
		self.setTimeout('rotateImage()',5000);
}



function leadershipReplace(imageName)
{
	var path = 'http://www.csufresno.edu/studentaffairs/images/leadership/';
	document.leadershipPortraits.src = path + imageName;
	//alert(path + imageName);
}



function getHeaderImage(headerArray)
{
	 	
		var path = "/studentaffairs/images/banner/";
		var picker = Math.floor(Math.random() * headerArray.length);
		document.getElementById('unit_banner').innerHTML = '<img src="' + path + headerArray[picker] + '" alt="" style="margin-right:20px"/>';
		
		setTimeout(function(){
        	picker = Math.floor(Math.random() * headerArray.length);
			document.getElementById('unit_banner').innerHTML = '<a href="http://www.csufresno.edu/studentaffairs/pride/"><img src="' + path + headerArray[picker] + '" alt="" style="margin-right:0px; margin-top:10px; border:none;"/></a>';
    		setTimeout(arguments.callee, 7800);
  		}, 0);
		/*while(true){
		
			picker = Math.floor(Math.random() * headerArray.length);
			document.getElementById('unit_banner').innerHTML = '<img src="' + path + headerArray[picker] + '" alt="Division of Student Affairs Banner" style="margin-right:20px"/>';
			
		}*/
	 
	 
	
	
}

/*
function slideShow(headerArray)
{
	var path = "/studentaffairs/images/header/";
	var picker = Math.floor(Math.random() * headerArray.length);
	document.getElementById('unit_banner').innerHTML = '<img src="' + path + headerArray[picker] + '" alt="Division of Student Affairs Banner" style="margin-right:20px"/>';
	self.setTimeout('slideShow(headerArray)',8000);
}*/
