﻿function randomOneOf(list) 
// Given  : list is a nonempty list (array) 
// Returns: a random item from the list 
{    
   	return randomInt(0, list.length-1); 
}

function randomInt(low, high) 
// Given   : low <= high 
// Returns : a random integer in the range [low, high] 
{ 
    return Math.floor(Math.random()*(high-low+1)) + low; 
} 

list = new Array();
athor = new Array();
list[0] = "It does not require many words to speak the truth.";
athor[0] = "Chief Joseph, Nez Perce tribe";
list[1] = "Knowledge is inherent in all things.  The world is a library...";
athor[1] = "Chief Luther Standing Bear of the Oglala Sioux";
list[2] = "The very essence of leadership is that you have to have a vision.";
athor[2] = "Theodore Hesburgh";
list[3] = "If a man loses anything and goes back and looks carefully for it, he will find it.";
athor[3] = "Chief Sitting Bull";
list[4] = "Leadership is a combination of strategy and character. If you must be without one, be without the strategy.";
athor[4] = "Gen. H. Norman Schwarskopf";
list[5] = "The leader who exercises power with honor will work from the inside out, starting with himself.";
athor[5] = "Blaine Lee";



var thePicsZ= new Array() 

thePicsZ[0] = 'http://www.prs.bia.edu/Resources/Random1Z.jpg'
thePicsZ[1] = 'http://www.prs.bia.edu/Resources/Random2Z.jpg'
thePicsZ[2] = 'http://www.prs.bia.edu/Resources/Random3Z.jpg'
thePicsZ[3] = 'http://www.prs.bia.edu/Resources/Random4Z.jpg'
thePicsZ[4] = 'http://www.prs.bia.edu/Resources/Random5Z.jpg'
thePicsZ[5] = 'http://www.prs.bia.edu/Resources/Random6Z.jpg'
thePicsZ[6] = 'http://www.prs.bia.edu/Resources/Random7Z.jpg'
thePicsZ[7] = 'http://www.prs.bia.edu/Resources/Random8Z.jpg'
thePicsZ[8] = 'http://www.prs.bia.edu/Resources/Random9Z.jpg'
thePicsZ[9] = 'http://www.prs.bia.edu/Resources/Random10Z.jpg'
thePicsZ[10] = 'http://www.prs.bia.edu/Resources/Random11Z.jpg'

var d = 0
var h = thePicsZ.length;
var preBuff = new Array()
for (u = 0; u < h; u++){
preBuff[u] = new Image()
preBuff[u].src = thePicsZ[u]
   }
   
var whichImageZ = Math.round(Math.random()*(u-1));
function showPics3(){
document.write('<img src="'+thePicsZ[whichImageZ]+'" alt="Life at Pine Ridge School...Pine Ridge, S.D." height="85" width="200" border="0">');
}



var picText = new Array(
"http://www.prs.bia.edu/Resources/RandomFeature1.jpg><><<b>South Dakota Class A Girls Basketball State Champions 2009!.</b>  The Pine Ridge Lady Thorpes reign victorious over Dell Rapids in what was a highly anticipated Championship Game, Lady Thorpes finished the season 25-1. They were coached by Lyle Dusty Lebeau Asst. by Dale Hammer Pine & Laura Big Crow. Pine Ridge School would like to congratulate the Lady Thorpes on a remarkable season!>",
"http://www.prs.bia.edu/Resources/RandomFeature2.jpg><><Welcome Pine Ridge High School Freshman Class to the 2008-2009 school year!. The photo was took during the homecoming parade>",
"http://www.prs.bia.edu/Resources/RandomFeature3.jpg><><<b>Welcome home to our Champions!</b> The Lady Thorpes were welcomed back by a slew of Thorpe Fans and the rest of the Oglala Lakota Nation, plus many more. (photo: courtesy of Rapid City Journal)>"
); 

	function figureImage() {
	randNum = Math.floor(Math.random()*picText.length);
	chosen = picText.slice(randNum,randNum+1);
	left  = picText.slice(0,randNum);
	right = picText.slice(randNum+1);
	picText = left.concat(right);
	return chosen;
}

function getChosenImage() {		
		pick = 1 ;
		for (i=0 ; i <= pick-1 ; i++ ) {
			vars = figureImage();
			theText = /(.*)><(.*)><(.*)>/g;
			var img = vars[0].replace(theText,"$1");
			var front = vars[0].replace(theText,"$2");
			var textMatter = vars[0].replace(theText,"$3");

document.write('<img src="'+img+'" alt="Our Students are our Life...Pine Ridge School" width="380" border="0"><BR><div class="Separator"></div><div class="BigPicText">');
document.write('<div class="ChooseBigText">'+front+'</div>'+textMatter+'</div>');
	}
}

			
		
		function time(){
		var months=new Array(13);

		months[1]="January";

		months[2]="February";

		months[3]="March";

		months[4]="April";

		months[5]="May";

		months[6]="June";

		months[7]="July";

		months[8]="August";

	    months[9]="September";

		months[10]="October";

		months[11]="November";

		months[12]="December";

		var days=new Array(7);

		days[0] = "Sun";

		days[1] = "Mon";

		days[2] = "Tue";

		days[3] = "Wed";

		days[4] = "Thu";

		days[5] = "Fri";

		days[6] = "Sat";

		var time=new Date();

		var lmonth=months[time.getMonth() + 1];

		var date=time.getDate();
		
		var hour = time.getHours();

		var year=time.getYear();

		var day=days[time.getDay()];

		if (year < 2000)    

		year = year + 1900; 
		
var curTime = ""
var curAMPM = " AM"
  var curTime = ""
  if (hour >= 12){
    hour -= 12
    curAMPM = " PM"
    }
if(hour == 0) hour = 12
curTime = hour + ":" 
    + ((time.getMinutes() <  10) ? "0" : "") + time.getMinutes() + ":" 
    + ((time.getSeconds() <  10) ? "0" : "") + time.getSeconds() 
    + curAMPM

		document.write(""+day+", "+date+" "+lmonth + " "+year );
		}
		
var picJROTCText = new Array(
"http://www.prs.bia.edu/Jrotc/Photos/JROTCFeature1.jpg><><Pine Ridge High School JROTC members prepare to conduct Color Guard for the 2006 Homecoming Game against Cheyenne Eagle Butte. It was a cold and rainy night for football, but the Thorpes were successfull in winning the football game with a score of 34 to 14. Please view our photo section for other homecoming events. >",
"http://www.prs.bia.edu/Jrotc/Photos/JROTCFeature2.jpg><><Pine Ridge ROTC Cadets receive the winning trophy on 6 May for their victory at the recent Raider Challenge against Lower Brule and Fargo West High Schools. Events included an 8 mile road march, 2 and 1 mile runs, pushups, situps, basketball throw, pullups, bar hang, and team events of obstacle course, mile-relay, mystery event, and more.>",
"http://www.prs.bia.edu/Jrotc/Photos/JROTCFeature3.jpg><><Former JROTC Cadet Robert Ten Fingers Graduates from Marine Corps Boot Camp. Bobby returned home over xmas to enjoy 30 days at home for the 2005 holiday season. Next, he will return to Camp Pendelton, California for Combat Training and his follow on training as an Amphibious Combat Vehicle Crewman. Our prayers are with you Marine.>"
); 

	function attemptImage() {
	randNum = Math.floor(Math.random()*picJROTCText.length);
	picked = picJROTCText.slice(randNum,randNum+1);
	left  = picJROTCText.slice(0,randNum);
	right = picJROTCText.slice(randNum+1);
	picJROTCText = left.concat(right);
	return picked;
}

function getJROTCImage() {		
		picks = 1 ;
		for (i=0 ; i <= picks-1 ; i++ ) {
			vars = attemptImage();
			theWords = /(.*)><(.*)><(.*)>/g;
			var imgs = vars[0].replace(theWords,"$1");
			var begin = vars[0].replace(theWords,"$2");
			var textStuff = vars[0].replace(theWords,"$3");

document.write('<img src="'+imgs+'" alt="Our Students are our Life...Pine Ridge School" width="380" border="0"><BR><div class="Separator"></div><div class="BigPicText">');
document.write('<div class="ChooseBigText">'+begin+'</div>'+textStuff+'</div>');
	}
}


var picBaskBallText = new Array(
"http://www.prs.bia.edu/Athletics/Photos/BaskBallFeature1.jpg><><The Pine Ridge High School Boys Basketball Team takes a moment for a photo opportunity when they placed 6th at the 2004 State Tournament.>",
"http://www.prs.bia.edu/Athletics/Photos/BaskBallFeature2.jpg><><The Thorpes Battalion Cadets conduct Color Guard Practice. This training is essential to their proficiency in Color Guard, Drill and Ceremonies, and personal pride. This photo was taken in the Fall of 2004.>",
"http://www.prs.bia.edu/Athletics/Photos/BaskBallFeature3.jpg><><The Pine Ridge High School JROTC cadets and Senior Army Instructor, Major Iwen take time for a photo opportunity at Summer Camp 2003. The camp was held in Park Rapids, Minnesota in June 2003.>"
); 

	function attemptBBImage() {
	randBBNum = Math.floor(Math.random()*picBaskBallText.length);
	pickedBB = picBaskBallText.slice(randBBNum,randBBNum+1);
	leftBB  = picBaskBallText.slice(0,randBBNum);
	rightBB = picBaskBallText.slice(randBBNum+1);
	picBaskBallText = leftBB.concat(rightBB);
	return pickedBB;
}

function getBaskBallImage() {		
		picksBB = 1 ;
		for (i=0 ; i <= picksBB-1 ; i++ ) {
			vars = attemptBBImage();
			theWordsBB = /(.*)><(.*)><(.*)>/g;
			var imgsBB = vars[0].replace(theWordsBB,"$1");
			var beginBB = vars[0].replace(theWordsBB,"$2");
			var textStuffBB = vars[0].replace(theWordsBB,"$3");

document.write('<img src="'+imgsBB+'" alt="Our Students are our Life...Pine Ridge School" width="392" border="0"><BR><div class="Separator"></div><div class="BigPicText">');
document.write('<div class="ChooseBigText">'+beginBB+'</div>'+textStuffBB+'</div>');
	}
}