(function($) {
	$.fn.showhideTab = function(opt) {
		var opts = $.extend({multi:false,offClass:"imgoff",onClass:"imgon", color:"#fff", hovercolor:"#ffffff", textElement:"h2"}, opt);
		var current = null;
		return this.each(function(){
			var odd = $(">div:odd", $(this));
			$(odd).hide();
			var even = $(">div:even", $(this));
			$("." +opts.onClass,$(even)).hide();
			$(even).hover( function() {
				$(this).addClass('on');
			}, function(){
				if($(this).get(0) != $(current).get(0) ) {
					$(this).removeClass('on');
				}
			});
			
			$(even).click(function() {
				
				if(!$(this).next().is(':visible')) {
					$(even).removeClass('on');
					//$(current).css('background-Color',opts.color);
					if(!opts.multi) {
						$(odd).slideUp("slow");
						//$(this).css('background-Color',opts.hovercolor);
						//$(odd).css('background-Color',opts.hovercolor);
						
						if($(current).get(0) == $(this).get(0) ) { 
							$("img:." + opts.onClass,$(current)).hide();
							$("img:." + opts.offClass,$(current)).show();
							current = null; 
							return;
						}
					}
					
					$(this).next().slideDown("slow");
			
					if($(this).next().is(':visible')){
						$("img:." + opts.onClass,$(this)).show();
						$("img:." + opts.offClass,$(this)).hide();
					} else {
						$("img:." + opts.onClass,$(this)).hide();
						$("img:." + opts.offClass,$(this)).show();
					}
				
					if(!opts.multi) {
						$("img:." + opts.onClass,$(current)).hide();
						$("img:." + opts.offClass,$(current)).show();
					}
					current = $(this);
					current.addClass('on');
				}
				return false;
			});
			$(even).eq(0).click();
		});	
	}
})(jQuery);

$(document).ready(function() {
	$("#slider").showhideTab();
});
