/**
 * ---------------------------------------------------------------------------------
 * jQuery-Plugin "autoMouseOver"
 * Version: 1.0, 2009.10.01
 * by Mark Wadden, http://www.m79.ca
 *
 * Copyright (c) 2009 Mark Wadden
 * Licensed under GPLv3 (http://www.opensource.org/licenses/gpl-3.0.html)
 *
 * This function automatically adds mouseover effects to any image ending in "-out."
 * ---------------------------------------------------------------------------------
 */

(function($) {

    $.fn.autoMouseOver = function(settings) {
        settings = $.extend({
            outStr: "_off.",    // default string to replace for the "out" images (eg. home_off.png)
            overStr: "_on."   // default string to replace for the "over" images (eg. home_on.png)
        }, settings || {});

        // Preload the images
        var preloadImageArray = new Array();
        $(this).filter("img").each(function() {
            var overImg = $(this).attr("src").replace(settings.outStr, settings.overStr);
            var img = new Image();
            img.src = overImg;
            preloadImageArray.push(img); 
        });

        // Set the hover handler
       
        	
        $(this).filter("img").hover(function() {
        		if($(this).parent().parent().attr('class')!="active"){
            	$(this).attr("src", $(this).attr("src").replace(settings.outStr, settings.overStr));
            }
        }, function() {
        		if($(this).parent().parent().attr('class')!="active"){
            	$(this).attr("src", $(this).attr("src").replace(settings.overStr, settings.outStr));
            }
        });
      

	    return $;
    };

})(jQuery);
