var last_clicked_product_article = null;

function addProductToCart(article, count)
{
    var url = '/put-to-cart';
    var myAjax = new Ajax.Request(url, {
        method: 'post',
        parameters: {'article':article, 'count': count},
        onLoading: loading,
        onComplete: response
    });

}


function loading()
{

}


function response(transport) 
{
    //$('cartpic').style.display = '';
    //alert('Спасибо за Ваш выбор. Товар добавлен в корзину.');
    //eval("var respons_data = " + transport.responseText);
    var messageDiv = $("addCartMessage");
    new Effect.Appear(messageDiv, {
        duration: 0.7,
        afterFinish: function(){
            new Effect.Fade(messageDiv, {
                duration: 0.7,
                delay: 2
            });
        }
    });
}


function checkEntryProductCount()
{
    if (!$('product_count').value.search(/^-?[0-9]+$/)) return true;
    else $('product_count').value = $('product_count').value.replace(/^([0-9]+)$/,'');
}

