/*

jQuery Plugin
blindToggle

*/

(function($) {
		  
	$.fn.blindToggle = function(speed, easing, callback) {
		return this.each( function(){
								   
		   var obj = $(this);
	   
			var h = obj.outerHeight();
			var parentClass = obj.parent('div').attr("class");
			
			if(parentClass != 'blind_overflow'){
				obj.wrap('<div class="blind_overflow" style="overflow:hidden; width:100%; min-width:980px; position:relative;"></div>');
			}
		
		   obj.animate({marginTop: parseInt(obj.css('marginTop')) <0 ? 0 : -h}, speed, easing)
			.parent().animate({height: parseInt(obj.css('marginTop')) <0 ? h : 0}, speed, easing, callback);
			
		});
	};
	
	$.fn.blindClose = function() {
		return this.each( function(){
			
			var obj = $(this);
			
			var h = obj.outerHeight();
			var parentClass = obj.parent('div').attr("class");
			
			if(parentClass != 'blind_overflow'){
				obj.wrap('<div class="blind_overflow" style="overflow:hidden; width:100%; min-width:980px; position:relative;"></div>');
			}
		
		   obj.css('marginTop', -h + 'px')
			.parent().css('height', '0px');
			
		});
	};
	
})(jQuery);