$(document).ready(function(){

if ( $.browser.msie && parseInt(jQuery.browser.version)<7 )
 ie6ImageSwap();
 else fancyPage();	
						   
						   
function fancyPage(){
	fadeImagesIn();
	imageHover();
	imageSwap();
}						   
	
function fadeImagesIn(){	
$(".thumbNails").hide().fadeIn(2000);
	$("img#myImage").hide().fadeIn(2000);
	$("img#myCornerImage").hide().fadeIn(2000)
}

	function imageSwap(){
$(".thumbNails a").click(function(event){
								event.preventDefault();
									var image = $(this).attr("href");
									
							var description1 = $(this).attr("invNum");
							var description2 = $(this).attr("desc");
							var description3 = $(this).attr("year");
							var description4 = $(this).attr("dimensions");
							
							
							$('#bigImage').addClass('loading');

							

 
		  $("img#myImage").fadeOut("normal", function () {
			  
				
				$("#invNum").empty().append(description1);
				$("#desc").empty().append(description2);
				$("#year").empty().append(description3);
				$("#dimensions").empty().append(description4);	
				
				$("img#myImage").empty().attr("src", image).load(function(){
				
				
				
					$("img#myImage").fadeIn("normal");
					
					
				
					$('#bigImage').removeClass('loading');
					});
				
				});
		  
		  
	    });
	}

function imageHover(){
 $(".thumbNails a").hover(
      function () {
        $(this).fadeTo("slow", 0.35);

      }, 
      function () {
        $(this).fadeTo("slow", 1);

      }
    );
}

function ie6ImageSwap(){
$(".thumbNails a").click(function(event){
								event.preventDefault();
									var image = $(this).attr("href");
							var description1 = $(this).attr("invNum");
							var description2 = $(this).attr("desc");
							var description3 = $(this).attr("year");
							var description4 = $(this).attr("dimensions");
				
				$("img#myImage").attr("src", image);
				$("#invNum").empty().append(description1);
				$("#desc").empty().append(description2);
				$("#year").empty().append(description3);
				$("#dimensions").empty().append(description4);	
				
		 });
	
}

});
