// SwapImage.js

//Fades the main picture, swapping it with the object passed in via swap(obj).  The images literally trade places.

	var s_animationManager = new AnimationManager( 10 );	
	var s_animation;
	var s_nextImage;
	
		
	s_animationManager.on_finished = function()
	{
  	 	var big = document.getElementById("mainPicture"); 	 									
 		var swap = s_nextImage.src; 
 		var alt = s_nextImage.getAttribute("alt");	
 	 	
 	 	//swap the next image with the big image				
		s_nextImage.src = big.src;				
		s_nextImage.setAttribute("alt",big.getAttribute("alt"));
		big.src = swap;
		big.setAttribute("alt",alt);
		
		big.style.MozOpacity = "100";
  		big.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity="100")'; 

	}
			
	function swap(obj){
		var img = document.getElementById("swapPicture");
		img.src = obj.src; 
		s_nextImage = obj;
		var img = document.getElementById("mainPicture");
		var ii = new ImageInfo(img.src, img.width, img.height, img);
		s_animation = new Animation(s_animationManager,ii,1,[new KenBurnsFader(ii,100)]);
		s_animation.start();		
	}
	
	