﻿var loader = null;
var button = null;
window.addEvent('domready', function() {

    //loader = new Asset.image(static + '/images/ajax-loader.gif', { id: 'ajaxLoaderImg' });
    loader = new Element('img', { 'src': static + '/images/spinner-dark.gif', 'style': {
        'width': '28px',
        'height': '28px'
        }
    });
    //	new NumberBox('quantityBox', {
    //		min: 1,
    //		max: 999
    //	});
    $$('form.shopItem').addEvent('submit', function(e) {

        e.stop();
        button = this.getElement('input[type=submit]').dispose();
        loader.clone().inject(this);

        this.async.value = true;
        this.set('send', {
            onComplete: LM.CartFunctions.UpdateLoader.bind(this)
        });

        this.send();
    });
});

//LM.BackIssue = {
//	SendComplete: function(resp, text) {
//		var obj = JSON.decode(resp);
//		if (obj.IsUpdate && $chk($('item_' + obj.Key)))
//			LM.CartFunctions.UpdateItem(obj);
//		else
//			LM.CartFunctions.AddItem(obj);
//		button.replaces(this.getElement('input + img'));
//	}
//}
