//  RSCOB Random Image Script
//  Last updated 12-5-06
// 

// Array push() Function
Array.prototype.push=function()
{
	var i=0;
	b=this.length,a=arguments;
	for(i;i<a.length;i++)this[b+i]=a[i];
	return this.length
}
//  Begin Varibale Declarations
var url = document.URL;
var photos = new Array(10); //  Array fo Photos
photos[0] = new Array(); //  About the College
photos[1] = new Array(); //  Undergraduate Students
photos[2] = new Array(); //  Graduate Students
photos[3] = new Array(); //  Academic Programs
photos[4] = new Array(); //  Faculty / Staff
photos[5] = new Array(); //  Alumni
photos[6] = new Array(); //  Business / Community
photos[7] = new Array(); //  News
photos[8] = new Array(); //  Contact Pictures
var maxLength=0; //  Number of Photos Per Catagory
var cat=0;		 //  Catagory to be Displayed
var ranNum1=0;  //  First Random Number
var ranNum2=0;	//  Second Random Number
var ranNum3=0;	//  Third Random Number

// ==================== DO NOT EDIT ABOVE THIS LINE ==========================

/*
								+INSTRUCTIONS+

Category 0 contains pictures for: About the College
Category 1 contains pictures for: Undergraduate Students
Category 2 contains pictures for: Graduate Students
Category 3 contains pictures for: Academic Programs
Category 4 contains pictures for: Faculty / Staff
Category 5 contains pictures for: Alumni
Category 6 contains pictures for: Business / Community
Category 7 contains pictures for: News

To add a new picture to the list type "photos[category number].push(“file name”);" 
in the appropriate section below.

EXAMPLE: photos[0].push("pic1.jpg"); Adds the file pic1.jpg in to the About the 
         College category (category 0)

NOTE: All images that apply to more than one category must be entered 
      individually in each applicable section below.
	  
EXAMPLE: If pic1.jpg applies to both Alumni and Faculty /Staff you would enter
		 photos[4].push("pic1.jpg");
		 photos[5].push("pic1.jpg");
		 in the appropriate section below.

NOTE: All images need to be the same size: 131 pixels wide x 83 pixels high


								+END INSTRUCTIONS+
*/

//  Defines the Photos for About the College
photos[0].push("pic1.jpg");
photos[0].push("pic2.jpg");
photos[0].push("pic3.jpg");
photos[0].push("pic4.jpg");

//  Defines the Photos for Undergraduate Students
photos[1].push("pic1.jpg");
photos[1].push("pic2.jpg");
photos[1].push("pic3.jpg");
photos[1].push("pic4.jpg");

// Defines the Photos for Graduate Students
photos[2].push("pic1.jpg");
photos[2].push("pic2.jpg");
photos[2].push("pic3.jpg");
photos[2].push("pic4.jpg");
photos[2].push("pic5.jpg");

//  Defines the Photos for Academic Programs
photos[3].push("pic1.jpg");
photos[3].push("pic2.jpg");
photos[3].push("pic3.jpg");
photos[3].push("pic4.jpg");

//  Defines the Photos for Faculty/Staff
photos[4].push("pic1.jpg");
photos[4].push("pic2.jpg");
photos[4].push("pic3.jpg");
photos[4].push("pic4.jpg");

//  Defines the Photos for Alumni
photos[5].push("pic1.jpg");
photos[5].push("pic2.jpg");
photos[5].push("pic3.jpg");
photos[5].push("pic4.jpg");

//  Defines the Photos for Buisness/Community
photos[6].push("pic1.jpg");
photos[6].push("pic2.jpg");
photos[6].push("pic3.jpg");


//  Defines the Photos for News
photos[7].push("pic1.jpg");
photos[7].push("pic2.jpg");
photos[7].push("pic3.jpg");

//  Defines the Photos for Contact section
photos[8].push("pic1.jpg");
photos[8].push("pic2.jpg");
photos[8].push("pic3.jpg");

// ==================== DO NOT EDIT BELOW THIS LINE ==========================

//  Get selected directory array size
if (url.indexOf('/about')!=-1)
{
	maxLength = photos[0].length-1;
	randomize(maxLength, 0);
}else if(url.indexOf('/undergrad')!=-1)
{
	maxLength = photos[1].length-1;
	randomize(maxLength, 1);
}else if(url.indexOf('/grad')!=-1)
{
	maxLength = photos[2].length-1;
	randomize(maxLength, 2);
}else if(url.indexOf('/acad')!=-1)
{
	maxLength = photos[3].length-1;
	randomize(maxLength, 3);
}else if(url.indexOf('/facstaff')!=-1)
{
	maxLength = photos[4].length-1;
	randomize(maxLength, 4);
}else if(url.indexOf('/alumni')!=-1)
{
	maxLength = photos[5].length-1;
	randomize(maxLength, 5);
}else if(url.indexOf('/biscom')!=-1)
{
	maxLength = photos[6].length-1;
	randomize(maxLength, 6);
}else if (url.indexOf('/news')!=-1)
{
	maxLength = photos[7].length-1;
	randomize(maxLength, 7);
}else if (url.indexOf('/contact')!=-1)
{
	maxLength = photos[8].length-1;
	randomize(maxLength, 8);
}else 
{
	maxLength = photos[0].length-1;
	randomize(maxLength, 0);
}

function randomize(maxLength, cat)
{
	ranNum1= Math.round(Math.random()*maxLength);
	ranNum2= Math.round(Math.random()*maxLength);
	ranNum3= Math.round(Math.random()*maxLength);
	while(ranNum2 == ranNum1 || ranNum2 == ranNum3 || ranNum1 == ranNum3)
	{
		ranNum2= Math.round(Math.random()*maxLength);
		ranNum3= Math.round(Math.random()*maxLength);
	}
	display(cat);
}

function display(cat)
{
	document.write('<table cellpadding="0" cellspacing="0" border="0" height="83" width="394">');
	document.write('<tr>');
	document.write('<td height="83" width="131" background="/rscob/images/random/'+photos[cat][ranNum1]+'" valign="bottom">');
	document.write('<img src="/rscob/images/random/corner.gif" height="20" width="20"></td>');
	document.write('<td height="83" width="133" valign="bottom"><img src="/rscob/images/random/'+photos[cat][ranNum2]+'" hspace="1" height="83" width="131">');
	document.write('</td>');
	document.write('<td height="83" width="131" valign="bottom"><img src="/rscob/images/random/'+photos[cat][ranNum3]+'" height="83" width="131">');
	document.write('</td></tr></table>');
}
