 /*--------------------------------------------------------------------
* The following source code is a modified version of the original plugin "EqualHeights" for jQuery.
*
* JQuery Plugin: "EqualHeights"
* by:    Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
*
* Copyright (c) 2009 Filament Group
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)

* JQuery Plugin : "EqualHeights-Light"
* Modified by : Michael (http://www.webdevcodex.com)
* Description : Does not use px-em dependencies based from the original version. Also fixes a small bug which does not allow divs to be of equal heights if there are more than 2 divs.

------------------------------------------------------------------------*/


$.fn.equalheight = function() {
$(this).each(function(){
//first create equal heights to the span tags
var currentTallestspan = 0; //create currentTallesth4 var

$("h4", this).each(function(i){
//keep checking every child's height and get the height of the tallest span
if ($(this).height() > currentTallestspan) { currentTallestspan = $(this).height(); }

});

//set currentTallestspan as pixels
currentTallestspan = currentTallestspan+"px";

//If browser is Microsoft Internet explorer, then use css "height: yypx"
if ($.browser.msie && $.browser.version == 6.0) {
$("span", this).css({'height': currentTallestspan}); }

//use css "min-height: yypx"
$("span", this).css({'min-height': currentTallestspan});
});


//then create equal height to the pictures
$(this).each(function(){
var currentTallest = 0; //create currentTallest var

//go through every child of the mother div
$(this).children().each(function(i){
//keep checking every child's height and get the height of the tallest div
if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }

});

//set currentTallest as pixels
currentTallest = currentTallest+"px";

//If browser is Microsoft Internet explorer, then use css "height: yypx"
if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest});
}

//use css "min-height: yypx"
$(this).children().css({'min-height': currentTallest});
});

return this;
};