//######## jQuery AutoMouseover ########
//#                                    #
//#  version: 1                        #
//#  last modified: 03/03/2011         #
//#  Author: Alessandro Monopoli       #
//#          @ xister.com              #
//#                                    #
//######################################

(function($) {

	$.fn.autoMouseover = function(settings) {
		settings = $.extend({}, $.fn.autoMouseover.defaults, settings);
		obj = $(this);

		obj.each(function(i) {
			if ($(this).hasClass(settings.selectedClass)) {
				$(this).attr("src",$(this).attr("src").replace(settings.off,settings.on));		
				if (jQuery.browser.msie) { if (parseInt(jQuery.browser.version) < 7) {
					if ($(this).attr("style").indexOf("FILTER:") != -1) { $(this).attr("style",$(this).attr("style").replace(settings.off,settings.on)); }
				} }
			}
			
			obj.live("mouseover",function() {
				$(this).attr("src",$(this).attr("src").replace(settings.off,settings.on));
				if (jQuery.browser.msie) { if (parseInt(jQuery.browser.version) < 7) {
					if ($(this).attr("style").indexOf("FILTER:") != -1) { $(this).attr("style",$(this).attr("style").replace(settings.off,settings.on)); }
				} }
			}).live("mouseout",function() {
				if ($(this).hasClass(settings.selectedClass)) return;
				$(this).attr("src",$(this).attr("src").replace(settings.on,settings.off));
				if (jQuery.browser.msie) { if (parseInt(jQuery.browser.version) < 7) {
					if ($(this).attr("style").indexOf("FILTER:") != -1) { $(this).attr("style",$(this).attr("style").replace(settings.on,settings.off)); }
				} }
			});
			
		});
	}
	
	$.fn.autoMouseover.defaults = {
		off: "_OFF",
		on: "_ON",
		selectedClass: "selected"
	};
	$.fn.autoMouseover.obj = null;

})(jQuery);
