/* ------------------------------------------------------------------------
	edRollOver

	Author: Hirohisa Nagai
	Copyright: eternity design ( http://eternitydesign.net/ )
	Version: 1.00
	License: MIT License

------------------------------------------------------------------------- */

(function($) {
	$.fn.edRollOver = function(settings) {
		settings = $.extend({
			postfix: '_on'
		}, settings);
		
		var target = $(this);

		target.hover(mouseOverEvent, mouseOutEvent).each(function() {
			$("<img />").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1" + settings.postfix + "$2"));
		});
		
		function mouseOverEvent(e) {
			$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1" + settings.postfix + "$2"));
		}
	
		function mouseOutEvent(e) {
			$(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
		}
		
		return this;
	}
})(jQuery);

