aRolloverImg = new Array();
aRolloverCnt = 0;
(function($) {
	$.fn.rollover = function(postfix) {
		postfix = (postfix != null) ? postfix : '_on';
		return jQuery.each(this.not('[src*="'+ postfix +'."]'), function() {
			var img = $(this);
			var src = img.attr('src');
			var src_on = src.substr(0, src.lastIndexOf('.')) + postfix + src.substring(src.lastIndexOf('.'));
			aRolloverImg[aRolloverCnt] = new Image();
			aRolloverImg[aRolloverCnt].src = src_on;
			img.attr('src_on', src_on);
			img.attr('src_off', src);
			img.hover(
				function() { img.attr('src', img.attr('src_on')); },
				function() { img.attr('src', img.attr('src_off')); }
			);
			aRolloverCnt++;
		});
	};
})(jQuery);

(function($) {
	$.fn.imgswitch = function(classname, postfix) {
		postfix = (postfix != null) ? postfix : '_on';
		return jQuery.each(this.not('[src*="'+ postfix +'."]'), function() {
			var img = $(this);
			var src = img.attr('src');
			var src_on = src.substr(0, src.lastIndexOf('.')) + postfix + src.substring(src.lastIndexOf('.'));
			aRolloverImg[aRolloverCnt] = new Image();
			aRolloverImg[aRolloverCnt].src = src_on;
			img.attr('src_on', src_on);
			img.attr('src_off', src);
			img.click(
				function() {
					$('img.' + classname).each(function () { $(this).attr('src', $(this).attr('src_off')); });
					img.attr('src', img.attr('src_on'));
				}
			);
			aRolloverCnt++;
		});
	};
})(jQuery);

(function($) {
	$.fn.setonimg = function(postfix) {
		postfix = (postfix != null) ? postfix : '_on';
		return jQuery.each(this.not('[src*="'+ postfix +'."]'), function() {
			var img = $(this);
			var src = img.attr('src');
			var src_on = src.substr(0, src.lastIndexOf('.')) + postfix + src.substring(src.lastIndexOf('.'));
			aRolloverImg[aRolloverCnt] = new Image();
			aRolloverImg[aRolloverCnt].src = src_on;
			img.attr('src_on', src_on);
			img.attr('src_off', src);
			aRolloverCnt++;
		});
	};
})(jQuery);

//(function($) {
//	$.hoverFade = {
//		defaults: {
//			newClass: "hover-anims",
//			classToRemove: "hover-css",
//			onClass: "on",
//			trigger: "a",
//			faderTemplate: "<span />"
//		}
//	};
//	
//	$.fn.extend({
//		hoverFade:function(userConfig) {
//																
//			//use defaults or properties supplied by user
//			var config = $.extend({}, $.hoverFade.defaults, userConfig),
//				el = $(this),
//				fader = config.faderTemplate.replace("<", "").replace(">", "").replace(" /", "");
//			
//			//add fader to target el(s)
//			el.removeClass(config.classToRemove).addClass(config.newClass).children().each(function() {
//				$(this).find(config.trigger).append(config.faderTemplate).find(fader).css("opacity", 0);
//			});
//			
//			//show element with on class
//			$("." + config.onClass, el).find(fader).css("opacity", 1);
//						
//			//fade in on hover, fade out on off
//			$(el).find(config.trigger).not("." + config.onClass).hover(function(){
//				$(this).find(fader).stop().animate({
//					opacity: 1
//				});
//			}, function(){
//				$(this).find(fader).stop().animate({
//					opacity: 0
//				});
//			});
//			
//			//return the jquery object for chaining
//			return this;
//		}
//	});
//})(jQuery);

