/*<![CDATA[*/
		   
// Initialise the effects.
var containerHeight;
var opacities = new Object (); // Use a simple object instead of forcing an array as associative.
var opacity_eIds = [ 'index_feature-1', 'index_feature-2', 'index_feature-3', 'index_feature-4', 'index_feature-5', 'index_feature-6', 'index_feature-7', 'index_feature-8', 'index_feature-9', 'index_feature-10', 'index_feature-11' ];

window.onload = function ()
{
	// MOO.FX OPACITY
	// Create an opacity object in opacities for each element id in opacity_eIds.
	for ( var i = 0; i < opacity_eIds.length; i++ )
	{
		var eId = opacity_eIds[i];
		if ( $(eId) )
		{
			opacities[eId] = new Fx.Opacity ( eId, { duration: 300, wait: false, fps: 15, onComplete: function () { } } );
			opacities[eId].set ( 0 );
		}
	}
	
}

// HIDE/DISPLAY FUNCTIONS 
// (to combat moo.fx's weak "hide" function that doesn't truly hide elements...now links aren't clickable 
//	on elements that aren't shown)
//function displayAbout() { document.getElementById('aboutContent').style.display = ''; }
//function hideAbout() { document.getElementById('aboutContent').style.display = 'none'; }

/*
Given opacities, reference each opacity object to clear existing timers and set it to 0.
*/
function hideAll ( eId_exception )
{
	// Assign default values to missing arguments.
	var eId_exception = ( eId_exception === undefined ) ? '' : eId_exception;
	
	// For each key in the associative array,
	for ( var key in opacities )
	{
		//alert('key is: ' + key + ', value is: ' + myArray[i]);
		if ( key != eId_exception && opacities[key].clearTimer !== undefined )
		{
			opacities[key].clearTimer ();
			opacities[key].set ( 0 );
			//opacities[key].setStyle ( opacities[key].element, 'opacity', 0 );
		}
	}
}

/*
Given an element id as a string, reference its opacity object to clear existing timers and toggle it.
Manual toggle on/off's are being used for better control of the toggles.
*/
function toggleOpacity ( eId )
{
	hideAll ( eId );
	opacities[eId].clearTimer ();
	opacities[eId].toggle ();
}

/*
Manual toggles to control mouseovers vs mouseouts.
*/
function toggleOn ( eId )
{
	hideAll ( eId );
	//alert(opacities[eId].now);
	if ( opacities[eId].now < 1 ) return opacities[eId].custom ( opacities[eId].now, 1 );
}

function toggleOff ( eId )
{
	hideAll ( eId );
	if ( opacities[eId].now >= 0 ) return opacities[eId].custom ( opacities[eId].now, 0 );
}

/*]]>*/