﻿window.addEvent('domready', function() {
    if (Browser.Engine.trident4) {
        try { document.execCommand("BackgroundImageCache", false, true); }
        catch (err) { }
    }
    $$('.win7 a').each(function(el) {

        el.win7BG = new Element('div', { 'styles': { 'opacity': 0} }).injectBefore(el);
        el.win7BG.set('morph', { 'duration': 300 });

        el.addEvent('mousemove', function(ev) {
            el.win7BG.setStyle('background-position', -((300 / 2) - (ev.event.layerX || ev.event.offsetX || 0)) + 'px top');
        });

        el.addEvent('mouseenter', function(ev) {
            el.win7BG.morph({ 'opacity': 1 });
        });

        el.addEvent('mouseout', function(ev) {
            el.win7BG.morph({ 'opacity': 0 });
        });

    }); // end each

}); // end domready