/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
document.observe("dom:loaded", function() {
function schowekToggle(e){
    try{this.removeClassName('ss_basket_add');}catch(e){}
    try{this.removeClassName('ss_basket_delete');}catch(e){}
    this.addClassName('ss_loading');
    new Ajax.Request(BASEURI+this.pathname, {
        parameters: $H({ajax: true}),
        link_helper: e,
        onSuccess: function(transport) {
            a=transport.request.options.link_helper.target
            if(transport.responseJSON.in_basket){
                a.removeClassName('ss_loading');
                a.addClassName('ss_basket_delete');
            }else{
                a.removeClassName('ss_loading');
                a.addClassName('ss_basket_add');
            }
        }
    });
    e.stop();
    return false;
}
/**/
/**/
/**/
function schowekStatus(e){
    new Ajax.Request('/locker/check_offer_status', {
        parameters: $H({
            ajax: true,
            link: e.pathname
        }),
        method:'post',
        onSuccess: function(transport) {
            if(transport.responseJSON.in_basket){
                e.removeClassName('ss_loading');
                e.addClassName('ss_basket_delete');
            }else{
                e.removeClassName('ss_loading');
                e.addClassName('ss_basket_add');
            }
        }
    });
}
/**/
    $$('a.schowek').each(schowekStatus,this);
    $$('a.schowek').invoke('observe','click',schowekToggle);
});