//This is a simple procedure that will place the correct cameo image and group image depending on which person the user hovers over 
//Author: Bryan Black 
//Created: May 21, 2008 
//==============================================================

//This is going to be a crappy work around but im just going to test to see if the user is focused on the text box if they are then don't show the cameo pic 
//But if anyone can figure out how to make the z-index stuff work in IE7 & 6 the feel free to remove this work around 
var inTextBox = false; //This is the variable that we will use for testing if we are in the textbox or not Damn! IE !!! :) 


function preventCameo(){
	//This function will prevent the auto completion overlap bug in IE 
	
	//get the cameo pic 
	image_cameo = document.images.cameo_pic;
	//hide the cameo pic 
	image_cameo.style.visibility = "hidden"; 
	//get the cameo txt 
	cameo_text = document.getElementById('cameo_txt'); 
	//clear the text 
	cameo_text.innerHTML = ""; 
	//Set the boolean true to indicate that we are in the text box 
	inTextBox = true 
	//This will clear the Interval if the hover over the group images to stop the animation 
	clearInterval(interval);
}

function allowCameo(){
	//indicates that the user is not in the textbox and allows the cameo pictures to appear 
	inTextBox = false; 
}


function defaultPose(){
	//This function is used when a user clicks on a thumbnail that isn't of a person that is in the group on the top of the page 
	//We need to get the group pic, cameo pic, and cameo text nodes 
	group_pic = document.getElementById('group_pic');
	cameo_pic = document.getElementById('cameo_pic'); 
	cameo_txt = document.getElementById('cameo_txt'); 
	
	//set the source of the group picuture 
	group_pic.src = "images/rollover/group/group_stage1.jpg";
	//hide the cameo_pic 
	cameo_pic.style.visibility = "hidden"; 
	//clear out the cameo text 
	cameo_txt.innerHTML = ""; 
	
	
}


//laura = 0 ;; genique = 1 ;; david = 2 ;; justin = 3 ;; jenny = 4 ;; alyson = 5 ;; patrick = 6 
function setImageSrc(num){
	//This will clear the Interval if the hover over the group images to stop the animation 
	clearInterval(interval);
	
	switch(num){

		
		case 0:
		//This is for laura's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/laura_cameo.jpg"
				image_cameo.style.visibility = "visible";
				laura_video = "videos/laura.flv";
				laura_links = "laura";
				
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>Laura</span><br />Interior Design</p>I play golf for ETSU women's golf team...two days ago we won the conference the first time in ETSU history women's golf won their conference.<br />"+
				'<a onclick="loadFLV(laura_video,laura_links)" href="#">Watch My Video!</a>';

				
			}
		//This is for laura's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_laura.src;
			break;
			
		case 1: 
		//This is for genique's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/genique_cameo.jpg";
				image_cameo.style.visibility = "visible";
				genique_video ="videos/genique.flv";
				genique_links ="genique";
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>Genique</span><br />Surveying and Mapping</p>In Surveying we cover a lot of stuff. We cover pretty much applied Trigonometry, Geographic Information Systems, Real-estate Law so you got some law background.<br />"+
				'<a onclick="loadFLV(genique_video,genique_links)" href="#">Watch My Video!</a>';;
			}
		//This is for genique's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_genique.src;
			break;
		case 2: 
		//This is for david's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			if(!inTextBox){			
				image_cameo.src = "images/rollover/cameo/david_cameo.jpg";
				image_cameo.style.visibility = "visible";
				david_video = "videos/david.flv";
				david_links = "david"; 
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>David</span><br />Economics</p>The one instructor and class I really did enjoy was intermediate microeconomics with Dr. Shelley...he would also relate it to current issues... <br />"+
				'<a onclick="loadFLV(david_video,david_links)" href="#">Watch My Video!</a>';;
			}
		//This is for david's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_david.src;
			break;
		case 3:
		//This is for justin's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/justin_cameo.jpg";
				image_cameo.style.visibility = "visible";
				justin_video = "videos/justin.flv";
				justin_links = "justin";
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>Justin</span><br />Finance</p>My favorite class probably on the cooperate finance side was financial analysis with Dr. Mason. He taught me everything I knew again and better... <br />"+
				'<a onclick="loadFLV(justin_video,justin_links)" href="#">Watch My Video!</a>';;
			}
		//This is for Justin's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_justin.src;
			break;
		case 4: 
		//This is for jenny's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/jenny_cameo.jpg";
				image_cameo.style.visibility = "visible";
				jenny_video = "videos/jenny.flv";
				jenny_links = "jenny";
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>Jennifer</span><br />Economics</p>When I graduate I will have a Bachelors in Economics, a minor in Finance, and a minor in Military Science...Military Science and ROTC adds a more typical physical aspect to your life. <br />"+
				'<a onclick="loadFLV(jenny_video,jenny_links)" href="#">Watch My Video!</a>';; 
			}
		//This is for jenny's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_jenny.src;
			break;
		case 5:
		//This is for alyson's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/alyson_cameo.jpg";
				image_cameo.style.visibility = "visible";
				alyson_video = "videos/alyson.flv";
				alyson_links = "alyson";
				cameo_text.innerHTML = "<p class='cameo_head'><span class='cameo_name'>Alyson</span><br />Accountancy</p>I am a cheerleader here at ETSU. Cheerleading is probably the most fun thing I do while I'm here at school. <br />"+
				'<a onclick="loadFLV(alyson_video,alyson_links)" href="#">Watch My Video!</a>';;
			}
		//This is for alyson's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_alyson.src;
			break;
		case 6:
		//This is for patrick's cameo pic 
			image_cameo = document.images.cameo_pic;
			cameo_text = document.getElementById('cameo_txt'); 
			
			if(!inTextBox){
				image_cameo.src = "images/rollover/cameo/patrick_cameo.jpg";
				image_cameo.style.visibility = "visible";
				patrick_video = "videos/patrick.flv";
				patrick_links = "patrick"
				cameo_text.innerHTML ="<p class='cameo_head'><span class='cameo_name'>Patrick</span><br />Digital Media</p>My outside interests at school is my skateboard business. I create T-shirt designs, skateboard designs, shooting and editing video of skaters...everything I do I learned at ETSU.<br />"+
				'<a onclick="loadFLV(patrick_video,patrick_links)" href="#">Watch My Video!</a>';;
			}
		//This is for patrick's group pic 
			image_group = document.images.group_pic; 
			image_group.src = document.images.group_pic_patrick.src;
			break;
		
	}
}

//First put the stage images in one array 

var stageImage = new Array(
	"images/rollover/group/group_stage1.jpg",
	"images/rollover/group/group_stage2.jpg",
	"images/rollover/group/group_stage3.jpg" 
	);

//Get the length of the array which should be 2 
var stageCount = stageImage.length; 			
var thisStage = 0; //Set the iterator value to 0 
	
	
	function rotate() {
		//This function will rotate through each image and then finally select one random image at the end then clear the Timer 
		if(thisStage != (stageCount - 1)){
			thisStage++; 
			document.group_pic.src = stageImage[thisStage]; 
			
		}else {
			randomNum = Math.floor((Math.random() * 6));
			setImageSrc(randomNum); 

		}//End of thisStage if 			
	}//End of Rotate Function 
	










