$(document).ready(function() {
	
	/*
	(function ($) {
	if (!$) return;
	$.fn.extend({
	    fixPNG: function(sizingMethod, forceBG) {
	            if (!($.browser.msie)) return this;
	            var emptyimg = "/images/x.gif"; //Path to empty 1x1px GIF goes here
	            sizingMethod = sizingMethod || "scale"; //sizingMethod, defaults to scale (matches image dimensions)
	            this.each(function() {
	                    var isImg = (forceBG) ? false : jQuery.nodeName(this, "img"),
	                            imgname = (isImg) ? this.src : this.currentStyle.backgroundImage,
	                            src = (isImg) ? imgname : imgname.substring(5,imgname.length-2);
	                    this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
	                    if (isImg) this.src = emptyimg;
	                    else this.style.backgroundImage = "url(" + emptyimg + ")";
	            });
	            return this;
	    }
	});
	})(jQuery);
	*/
	
	$('.thumbbox').attr('class', 'thumbbox off');
	$('.thumbinfo').attr('class', 'thumbinfo off');
	
	$('.thumbbox').hover(function() {
		$("img", this).stop().animate({'opacity': '1'}, 400);
	}, function() {
		$("img", this).stop().animate({'opacity': '0'}, 1200);
	});
	
	$('.thumbbox').mousedown(function() {
		$('.thumbbox').attr('class', 'thumbbox off');
		$(this).attr('class', 'thumbbox on');
		$("img", this).attr('class', 'on');
		//$('.thumbinfo').stop().animate({'opacity': '0'}, 1200);
		$('.thumbinfo').attr('class', 'thumbinfo off');
		$(".thumbinfo", this).attr('class', 'thumbinfo on');
		//$(".thumbinfo", this).stop().animate({'opacity': '1'}, 400);
	}, function() {
		$(this).attr('class', 'thumbbox off');
		$("img", this).attr('class', 'off');
		//$('.thumbinfo').stop().animate({'opacity': '0'}, 1200);
		$('.thumbinfo').attr('class', 'thumbinfo off');
	});
	
	$('a.close').click(function() {
		//$(this).parent().stop().animate({'opacity': '0'}, 1200);
		$(this).parent().parent().attr('class', 'thumbbox off');
		$(this).parent().attr('class', 'thumbinfo off');
		//$('.thumbpic a').attr('class', 'off');
		//$(this).parent().attr('class', 'thumbinfo off');
		return false;
	});
	
	var oldHeight = $('#thumbs').height();
	
	var newHeight = Math.ceil(oldHeight / 28) * 28;
	
	$('#thumbs').height(newHeight);
	
});
