// 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(); 
			//console.log(thisHeight);
			if( thisHeight > tallest) 
			tallest = thisHeight; 
			}); 
		// set each items height to use the tallest value found 
		this.each(function(){ 
			$(this).height(tallest); 
			}); 
		} 
})(jQuery);

// Vertical Align Function
(function ($) {
	$.fn.vAlign = function(container) {
		//return this.each(function(i){
		return this.each(function(i){
			if(container == null) {
				container = 'div';
			}
			// fix pentru scripturile care ruleaza inaine si modifica structura DOM-ului
			// $(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
			var el = $(this).children(container + ":first");
			var elh = $(el).height(); //new element height
			var ph = $(this).height(); //parent height
			var nh = (ph - elh) / 2; //new height to apply
			$(el).css('margin-top', nh);
		});
	};
})(jQuery);
