function showInfo(header,data,type){
    if(type=='error'){
        block_class = 'msg_error';
    }else{
        block_class = 'msg_info';
    }
    getInfo = false;
    if(typeof showInfoIE == 'function'){
        getInfo = showInfoIE(header,data);
    }
    if(getInfo == false){
        position_left = $('#showInfo').css('left');
        $('#showInfo').addClass(block_class)
                             //.css('left', position_left)
                             .fadeIn('def');
        $('#showInfo span').html('<b>'+header+'</b>: <span>'+data+'</span>')
        $('#showInfo').click(function() {
            $(this).fadeOut('fast');
        });
    }
}

function addToCart(productId, r){
   var form_data = 'product='+productId;
   //var d = new Date();
    $.ajax({
        url: '/?show=basket&act=add&r='+r+'&_=',//+d.getTime(),
        dataType : "json",                     
        type: "POST",
        cache: false,
        data: form_data,
        beforeSend: function () {
             $('#showInfo').fadeOut('fast');
        },
        success: function (data) {
           if('basket_total' in data){
               $('#basket_total').attr('value',data.basket_total);
           }
           if('basket_amount' in data){
               $('#basket_amount').attr('value',data.basket_amount);
           }
           if('header' in data && 'info' in data){
               //showInfo(data.header,data.info,'info');
               window.location = "/?show=basket#contents";
           }
        }
    });
}
