﻿$(document).ready(function () {
    
    //$('#nav').hide();
    //$("body").css("display", "none");

    $("#thumbs a").hover(function () {
       height = $(this).find('.large').width();
       width = $(this).find('.large').height();
       
       $(this).find('.large').css({ width: 'auto', height: 'auto' });
       real_width = $(this).find('.large').width();
       real_height = $(this).find('.large').height();

       $(this).find('.large').css({ width: 'auto', height: height +'px' });

       if(real_width >= real_height){
        
        uri = $(this).attr('href');
        $(this).find('.large').css({ 'z-index': '10' }).show().addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
        .animate({
		    
            marginTop: '-190px', /* The next 4 lines will vertically align this image */
		    marginLeft: '-220px',
		    top: '50%',
		    left: '50%',
		    height: '300px', /* Set new height */
		   
		}, 200).click(function(){ window.open(uri); delete uri}); /* this value of "200" is the speed of how fast/slow this hover animates */
        }else{
        
        uri = $(this).attr('href');
        $(this).find('.large').css({ 'z-index': '10' }).show().addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
        .animate({
		    marginTop: '-190px', /* The next 4 lines will vertically align this image */
		    marginLeft: '-220px',
		    top: '50%',
		    left: '150%',
		    height: '300px', /* Set new height */
		   
		}, 200).click(function(){ window.open(uri); delete uri}); /* this value of "200" is the speed of how fast/slow this hover animates */
            
        }
    }, function () {
        delete uri;
        $(this).find('.large').css({ 'z-index': '0' }).hide().removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
		    marginTop: '0', /* Set alignment back to default */
		    marginLeft: '0',
		    top: '-65px',
		    left: '50px',
            height: '100%',
		}, 400);
    });

});

   $(window).load(function () {
       //$('#nav').slideToggle();
    });

