/*  
JAVASCRIPT IMAGE GALLERY W/ mootools
Description: A easy, non destructive javascript image gala.
Version: 1.1.3
Author: Devin Ross
Author URI: http://tutorialdog.com
*/

/*
Release notes:
	1.1 - Adds loading animation, and properly fades in images when fully loaded
	1.1.1 - Fixes displaying description, Fades out current image, Works with Mootools 1.2
	1.1.2 - Corrects IE Problem with Transitioning to Next Image (Note: this fix undo's release 1.1's to fade image in smoother)
	1.1.3 - Corrects First Image Text Problem
*/

var imgSource=[];
var url=null;

$(document).ready(function(){
						  
		url = $('#items').find('a').eq(0).attr('rel');
		$('#items').find('a').each(function(n){
												imgSource[n]=$(this).attr('href');
												$(this).attr('instance',n);
												});
		$('#fullimg img').attr('src',imgSource[0]);
		$('#items').find('a').bind('click', showImage);
		
		$('#fullimg img').css('cursor','pointer');
		$('#fullimg img').bind('click',function(){
													window.location.href = 	url;
														
												  });
		
		function showImage(e)
		{	
			url = $(this).attr('rel');
			e.preventDefault();
			var num=Number($(this).attr('instance'));
			$('#fullimg img').attr('src',imgSource[num]);
			
		
		}
	
				 });
