/***
 * Script: 		PeRL Javascript Functions
 * Script URI:	http://robots.engin.umich.edu/perl/
 * Author:		Paul Tulipana, Design Less Better
 * Author URI:	http://www.designlessbetter.com/
 * Last Updated:2008/04/25 @Pt
 ***/
	 
/*** 
 * Start the image gallery.
 ***/

function startGallery() 
{
	var myGallery = new gallery($('myGallery'), {
		timed: true,
		showInfopane: true
	});
	applyOpacity();
}

/***
 * Because opacity doesn't validate for CSS 2.1, and since you have
 * to have javascript to get the opacity-related functions of this 
 * website anyway (aka. the browse buttons on the AJAX Image Gallery,
 * we're going to use some handy mootools selectors to apply our opacity 
 * settings. Also, because mootools doesn't allow you to set css hover states,
 * we're just adding mouseover and mouseout events to alter the opacity.
 ***/

function applyOpacity()
{
	if ($E('a.right'))
	{
		$E('a.right').setStyle("filter:","alpha(opacity=20)");
		$E('a.right').setStyle("-moz-opacity","0.2");
		$E('a.right').setStyle("-khtml-opacity", "0.2");
		$E('a.right').setStyle("opacity", "0.2");
		$E('a.left').setStyle("filter:","alpha(opacity=20)");
		$E('a.left').setStyle("-moz-opacity","0.2");
		$E('a.left').setStyle("-khtml-opacity", "0.2");
		$E('a.left').setStyle("opacity", "0.2");
		$E('a.right').addEvent('mouseover', function(e) {
			$E('a.right').setStyle("filter:","alpha(opacity=100)");
			$E('a.right').setStyle("-moz-opacity","1.0");
			$E('a.right').setStyle("-khtml-opacity", "1.0");
			$E('a.right').setStyle("opacity", "1.0");	
		});
		$E('a.right').addEvent('mouseout', function(e) {
			$E('a.right').setStyle("filter:","alpha(opacity=20)");
			$E('a.right').setStyle("-moz-opacity","0.2");
			$E('a.right').setStyle("-khtml-opacity", "0.2");
			$E('a.right').setStyle("opacity", "0.2");	
		});
		$E('a.left').addEvent('mouseover', function(e) {
			$E('a.left').setStyle("filter:","alpha(opacity=100)");
			$E('a.left').setStyle("-moz-opacity","1.0");
			$E('a.left').setStyle("-khtml-opacity", "1.0");
			$E('a.left').setStyle("opacity", "1.0");	
		});
		$E('a.left').addEvent('mouseout', function(e) {
			$E('a.left').setStyle("filter:","alpha(opacity=20)");
			$E('a.left').setStyle("-moz-opacity","0.2");
			$E('a.left').setStyle("-khtml-opacity", "0.2");
			$E('a.left').setStyle("opacity", "0.2");	
		});
	}
}

window.addEvent('domready',startGallery);