(function ($) {
    $.fn.showHide = function (options) {

		//default vars
        var defaults = {
            speed: 1000,
			easing: '',
			changeText: 0,
			showText: 'Show',
			hideText: 'Hide'
			
        };
        var options = $.extend(defaults, options);

        $(this).click(function () {	
           
             $('.toggleDiv').slideUp(options.speed, options.easing);	
			 // stores which hyperlink you've clicked
             var toggleClick = $(this);
		     // looks at the rel attribute of the hyperlink to determine which div id to toggle
		     var toggleDiv = $(this).attr('rel');
		     // toggle show/hide the correct div at the right speed and using which easing effect
		     $(toggleDiv).slideToggle(options.speed, options.easing, function() {
		     // only fires once the animation is completed
			 if(options.changeText==1){
			     $(toggleDiv).is(":visible") ? toggleClick.text(options.hideText).css('background-image', 'url(/images/icon_hideAvailablePrograms.gif)') : toggleClick.text(options.showText).css('background-image', 'url(/images/icon_viewAvailablePrograms.gif)');
			 }
              });
		   
		  return false;
		   	   
        });

    };
})(jQuery);
