
/**********************************************************************************************************************/
/**********************************************************************************************************************/
/**********************************************************************************************************************/

	/* to find and change color in the Header Navigation for
	   the page currently on */
	function findPageInNav(pageNameID){
		document.getElementById(pageNameID).style.color="#cc0011" //change color to red
	}


	function toggleColorMouseOut(thisNav,heading){
		var curHeading = document.getElementById(heading);
		if(curHeading.style.display == "block"){
			//the current heading is shown and will be red, leave it alone
			document.getElementById(thisNav).style.textDecoration = 'none';
		}
		else{
			document.getElementById(thisNav).style.color = "#114477"; //change color to blue
			document.getElementById(thisNav).style.textDecoration = 'none';
		}
	}
	function toggleColorMouseOver(thisNav,heading){
		var curHeading = document.getElementById(heading);
		if(curHeading.style.display == "block"){
			//the current heading is shown and will be red, leave it alone
			document.getElementById(thisNav).style.textDecoration = 'underline'; //underlines and gives same color (red)

		}
		else{
			document.getElementById(thisNav).style.color = "#cc0011"; //change color to red
			document.getElementById(thisNav).style.textDecoration = 'underline'; //underlines and gives same color (red)
		}
	}




	/* for testimonials and candidate corner*/
	function showThisInfo(headings,clickedNav){
		// toggles the individual testimonials and current positions
		var curHeading;
		
		for (var count = 0; count < headings.length; count++){
			curHeading = document.getElementById(headings[count]);

			if (curHeading.style.display == "block"){
				curHeading.style.display = "none";
				document.getElementById(clickedNav).style.color="#114477"; //change color to blue
				document.getElementById(clickedNav).style.textDecoration = 'none';
			}
			else{
				curHeading.style.display = "block";
				document.getElementById(clickedNav).style.color="#cc0011"; //change color to red
				document.getElementById(clickedNav).style.textDecoration = 'none';
			}
		}
		return(false);
	}



	/* for Client Services and Testimonial pages to toggle display of divs */
	function showInfo(heading, mainInfo, clickedNav, otherNavs){
		// heading - what to toggle between 'block' and 'none' - this is what the user wants to see
		// mainInfo - what to toggle between 'block' and 'none' - this is what is originally seen
		// clickedNav - the link that was clicked - to toggle between red and blue
		// otherNav - the other link(s) - to make blue

		var curHeading = document.getElementById(heading);

		//var mainHeading = document.getElementById(mainInfo);
		var mainHeading = null;
		if (mainInfo != null)
		{
			mainHeading = document.getElementById(mainInfo);
		}

		// set both Navs to Blue
		document.getElementById(clickedNav).style.color="#114477"; //change color to blue
		for(var count = 0; count < otherNavs.length; count++){
			document.getElementById(otherNavs[count]).style.color="#114477";  //change color to blue
			document.getElementById(otherNavs[count]).style.textDecoration = 'none';
		}

		if (curHeading.style.display == "block"){
			//if already displaying, leave alone
			//curHeading.style.display = "none";
			//mainHeading.style.display = "block";

			//since leaving alone, make sure color stays red
			document.getElementById(clickedNav).style.color="#cc0011"; //change clicked color to red
			document.getElementById(clickedNav).style.textDecoration = 'none';

		}
		else {
			curHeading.style.display = "block";
			//mainHeading.style.display = "none";
			if (mainHeading != null)
			{
				mainHeading.style.display = "none";
			}
			document.getElementById(clickedNav).style.color="#cc0011"; //change clicked color to red
			document.getElementById(clickedNav).style.textDecoration = 'none';

		}	
		return(false);
	}

	/* used by both Testimonials and Client Services and Candidate Corner Pages*/
	function hideInfo(headings,navs){
		var curHeading;
		var count;
		for(count = 0; count < navs.length; count++){
			document.getElementById(navs[count]).style.color="#114477"; //change color to blue
			document.getElementById(navs[count]).style.textDecoration = 'none';

		}
		for(count = 0; count < headings.length; count++){
			curHeading = document.getElementById(headings[count]);
			curHeading.style.display = "none";	//hide
		}
		return(true);
	}
	/* end  */
/**********************************************************************************************************************/
/**********************************************************************************************************************/
/**********************************************************************************************************************/



	/* to format the date for the logo */
	function mdy(todaysdate) {
		//calls this function to get our date
		var sMonth = " ";
		var iMonth = todaysdate.getMonth() + 1;
		switch (iMonth)
		{
		  case 1: sMonth = 'January'; break;
		  case 2: sMonth = 'February'; break;
		  case 3: sMonth = 'March'; break;
		  case 4: sMonth = 'April'; break;
		  case 5: sMonth = 'May'; break;
		  case 6: sMonth = 'June'; break;
		  case 7: sMonth = 'July'; break;
		  case 8: sMonth = 'August'; break;
		  case 9: sMonth = 'September'; break;
		  case 10: sMonth = 'October'; break;
		  case 11: sMonth = 'November'; break;
		  case 12: sMonth = 'December'; break;
		  default: sMonth = 'Unknown';
		}
		var iYear = todaysdate.getYear();
		if (iYear < 2000)
		{
		  iYear = iYear + 1900;
		}
		return sMonth + " " + todaysdate.getDate() + ", " + iYear;
	}
	/*********** end of date for logo js ***********/



	// Browser Slide-Show script. With image cross fade effect for those browsers
	// that support it.
	// Script copyright (C) 2004-2008 www.cryer.co.uk.
	// Script is free to use provided this copyright header is included.
	var FadeDurationMS=1000;
	function SetOpacity(object,opacityPct)
	{
	  // IE.
	  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
	  // Old mozilla and firefox
	  object.style.MozOpacity = opacityPct/100;
	  // Everything else.
	  object.style.opacity = opacityPct/100;
	}
	function ChangeOpacity(id,msDuration,msStart,fromO,toO)
	{
	  var element=document.getElementById(id);
	  var msNow = (new Date()).getTime();
	  var opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
	  if (opacity>=100)
	  {
		SetOpacity(element,100);
		element.timer = undefined;
	  }
	  else if (opacity<=0)
	  {
		SetOpacity(element,0);
		element.timer = undefined;
	  }
	  else 
	  {
		SetOpacity(element,opacity);
		element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",10);
	  }
	}
	function FadeInImage(foregroundID,newImage,backgroundID)
	{
	  var foreground=document.getElementById(foregroundID);
	  if (foreground.timer) window.clearTimeout(foreground.timer);
	  if (backgroundID)
	  {
		var background=document.getElementById(backgroundID);
		if (background)
		{
		  if (background.src)
		  {
			foreground.src = background.src; 
			SetOpacity(foreground,100);
		  }
		  background.src = newImage;
		  background.style.backgroundImage = 'url(' + newImage + ')';
		  background.style.backgroundRepeat = 'no-repeat';
		  var startMS = (new Date()).getTime();
		  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "'," + FadeDurationMS + "," + startMS + ",100,0)",10);
		}
	  } else {
		foreground.src = newImage;
	  }
	}
	var slideCache = new Array();
	function RunSlideShow(pictureID,backgroundID,imageFiles,displaySecs)
	{
	  var imageSeparator = imageFiles.indexOf(";");
	  var nextImage = imageFiles.substring(0,imageSeparator);
	  FadeInImage(pictureID,nextImage,backgroundID);
	  var futureImages = imageFiles.substring(imageSeparator+1,imageFiles.length)+ ';' + nextImage;
	  setTimeout("RunSlideShow('"+pictureID+"','"+backgroundID+"','"+futureImages+"',"+displaySecs+")",displaySecs*1000);
	  // Cache the next image to improve performance.
	  imageSeparator = futureImages.indexOf(";");
	  nextImage = futureImages.substring(0,imageSeparator);
	  if (slideCache[nextImage] == null)
	  {
		slideCache[nextImage] = new Image;
		slideCache[nextImage].src = nextImage;
	  }
	}
	/************ end ****************/



/**************************************************************************/
/* functions for manageTestimonial */
	function reset_values() {
		//alert ("here in reset_values");
		//need to go through and reset each individual field 
		//  since can't tell if came from an error or the user typed
		//  the values in.  Reset works on fields that have been typed
		//  in before the submit button has been clicked.
		
		//this goes to the server
		location.reload(true);
		
		return(true);
	}
	function check_values() {
			// required fields
			//jname = document.getElementById('name').value;
	
			//alert( "Made it here !!!!!!!!!!");
			return(true);
	}
/**************************************************************************/


/**************************************************************************/
/* functions for submittedTestimonials and submittedPositions*/

	//the selections are not stored from page to page.
	function confirmDeletion(){
		var result = "\n";
		var elRow;
		var icount=0;
		/** format a list of selected testimonials to delete */
		for (var i=0; i <= (document.forms[0].elements.length - 1); i++){
			if (document.forms[0].elements[i].checked){
				icount++;
				elRow = document.getElementById(document.forms[0].elements[i].name + 'x'); //'x' added to identify the element from the 'name'
																						   //    see submittedTestimonials and submittedPositions
				result = result + "*  " +elRow.innerHTML + "\n";
			}				
		}

		if (icount == 0){
			alert("Please choose at least 1 Testimonial to Delete");
			return(false);
		}
		else {
			var confirmed = window.confirm("Please confirm to delete the following testimonials\n\n" +  result + "\nClick OK to continue. Click Cancel to stop.");
			if (confirmed)
			{
				//window.alert("You clicked OK");
				return(true);
			} 
			else 
			{
				//window.alert("You clicked Cancel");
				return(false);
			}
		}
	}

/**************************************************************************/

