// JavaScript Document
// jQuery_Auto 0.9
// Automatic functions for webpages (using the wonderful jQuery library)
// Copyright: (c) 2006, Michal Tatarynowicz (tatarynowicz@gmail.com)
// Licenced as Public Domain (http://creativecommons.org/licenses/publicdomain/)
// $Id: jquery_auto.js 532 2006-05-24 21:54:03Z Micha&#322; $
// Initialization
$.auto = {
    init: function() {
        for (module in $.auto) {
            if ($.auto[module].init)
            $.auto[module].init();
        }
    },
    init_on_load: function() {
        for (module in $.auto) {
            if ($.auto[module].init_on_load)
            $.auto[module].init_on_load();
        }
    }
};
$(document).ready($.auto.init);
$(window).load($.auto.init_on_load);
// Auto-hidden elements
$.auto.hide = {
    init: function() {
        $('.Hide').hide();
    }
};
// Mouse hover
$.auto.hover = {
    init: function(obj) {
        var auto = $.auto.hover;
        $(obj || '.hover').each(function(){
            var handle = this;
            var img = this.src? handle: $('IMG', this).get(0);
            if (handle != img) handle.img = img;
            $(handle).bind('mouseover', auto.enter)
            .bind('mouseout',  auto.exit)
            .each(auto.preload);
        })
    },
    preload: function() {
        var img = this.src? this: this.img;
        img.preloaded = new Image;
        img.preloaded.src = img.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
    },
    enter: function() {
        var img = this.src? this: this.img;
        img.src = img.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
    },
    exit: function() {
        var img = this.src? this: this.img;
        img.src = img.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
    }
};





