document.observe("dom:loaded", function() {

   $$('.top_product img, .partners img').each(function(el) {
       Pixastic.process(el, "desaturate");
    });
    //clear slect
    $$('.clickclear').each(function(element) {
        Event.observe(element, 'focus', function(event){
            Event.element(event).clear();
            Event.element(event).stopObserving('focus');
        });
    });
    $$("abbr.details").each( function(input) {
        new Tooltip(input, {
            backgroundColor: "#FFF",
            borderColor: "#A2DCEA",
            textColor:"#418FA5",
            maxWidth:"250",
            opacity:"90"
        });
    });

    $$('.top_product, .top_product a, .partners a').invoke('observe','mouseover',saturate);
    $$('.top_product, .top_product a, .partners a').invoke('observe','mouseout',desaturate);
    function saturate(event){
        Pixastic.revert(event.target);
    }
    function desaturate(event){
        Pixastic.process(event.target, "desaturate");
    }


    $$('.sorter a').each(function(e){
        if(e.href.endsWith(window.location.href)){
            e.addClassName('active');
        }
    });

    function grid_show() {
        if(window.location.href.endsWith("#showgrid")) {
            $$('div.container').each(function(element) {
                element.addClassName('showgrid');
            });
        }
    }
    grid_show ();
});
