// make sure the $ is pointing to JQuery and not some other library
(function($){
    // add a new method to JQuery

    $.fn.equalHeight = function() {
       // find the tallest height in the collection
       // that was passed in (.column)
        tallest = 0;
        this.each(function(){
            thisHeight = $(this).height();
            if( thisHeight > tallest)
                tallest = thisHeight;
        });

        // set each items height to use the tallest value found
        this.each(function(){
            $(this).height(tallest);
        });
    }

    $.fn.equalWidthAndHeight = function() {
       // find the tallest height in the collection
       // that was passed in (.column)
        tallest = 0;
        widest = 0;		
        this.each(function(){
            thisHeight = $('img',this).height();
            thisWidth = $('img',this).width();			
            if( thisHeight > tallest)
                tallest = thisHeight;
            if( thisWidth > widest)
                widest = thisWidth;				
        });
        // set each items height to use the tallest value found
        this.each(function(){
              thisHeight = $('img',this).height();
              thisWidth = $('img',this).width();			  
			  var difference = (tallest-thisHeight)/2;
			  var difference2 = (widest-thisWidth)/2;			  
//			  alert(tallest+' - '+thisHeight);
//            $(this).height(tallest);
				$(this).attr("style", "float: left; display: block; height: "+(thisHeight+3)+"px; width: "+(thisWidth+3)+"px; padding-right: "+(difference2+3)+"px; padding-left: "+(difference2+3)+"px; padding-top: "+(difference+3)+"px; padding-bottom: "+(difference+3)+"px;");
        });
    }



})(jQuery);
