
/*--------------------------------------------------
 scholarship.js

 Date: 10/29/2008
 Purpose: WC scholarship functionality
/--------------------------------------------------*/




//--- Global variables ------------------------------

// Our list of finalists
var _finalists = [];

// The roll-over image url template
var _imagePath = "/images/gfx_images/scholarship/finalists/";






/***************************************************
 loadFinalists()

 Date: 10/29/2008
 Purpose: Load the finalists list and preload images
***************************************************/

function loadFinalists() {
	// Load all description id's into the list
	$$( ".FinalistDescription" ).each( function(element) {
			if( element.id.toLowerCase().indexOf( "default" ) == -1 ) {
				_finalists.push( element.id );
			}
		} );
	// Preload the images
	preloadFinalistImages();
}



/***************************************************
 preloadFinalistImages()

 Date: 10/29/2008
 Purpose: Preload the finalist roll-over images
***************************************************/

function preloadFinalistImages() {
	var img = [];
	var i = 0;
	_finalists.each( function(name) { 
			img[i] = new Image();
			img[i].src = _imagePath + name + ".jpg";
			i++;
		 } );
}



/***************************************************
 showDescription()

 Date: 10/29/2008
 Purpose: Show the specfied finalist description
***************************************************/

function showDescription( index ) {
	// Hide all descriptions
	$$( ".FinalistDescription" ).invoke( "hide" );
	// Show the selected finalist's description
	$( _finalists[index] ).show();
	// Set the image
	$( "FinalistsImage" ).src = _imagePath + _finalists[index] + ".jpg";
}







