function addCart( stock_no, attribute_value_id ){

  $.ajax({
    type: 'POST',
    url: ajaxUris.addCart,
    data: 'stock_no='+stock_no,
    dataType: 'json',
    success: function(response){
      if ( response.success == true ){
          
        basketPaging(1);

        $('.basket-button-enabled').hide();
        $('.basket-button-disabled').show();

        if ( attribute_value_id > 0 )
        $('#in_basket-'+attribute_value_id).val(1);

        if($('#top-cart-wrap').is(':hidden')){
          $('#top-cart-wrap').slideDown();
          $('.bt-cart').addClass('selected');
        }       
        
        $('#header-cart-tooltip')
          .fadeIn(200)
          .delay(2000)
          .fadeOut(300);

      }
      else{
        /*
        $.each(response.message, function(key, val){
          $('#errors-update-user').html('');
          $('#errors-update-user').show();
          $('#errors-update-user').append("<li>"+val+"</li>");
        });
        */
      }
    },
    error: function(response){

    }

  });

  return false;

}


function basketPaging(page_no){

  $.ajax({
    type: "GET",
    url: '/sepet/'+page_no,
    async: false,
    success: function(response){
      $('#load-basket').html(response);
    },
    error: function(msg){

    }

  });

  Cufon.refresh();

}



function basketRemove(stock_no){

  $.ajax({
    type: "GET",
    url: '/sepet/sil/'+stock_no,
    dataType: 'json',
    async: false,
    success: function(response){
      if ( response.success == true ){
        basketPaging(1);
      }
    },
    error: function(msg){

    }

  });

}





function followPaging(page_no){

  $.ajax({
    type: "GET",
    url: '/takip-ettiklerim/'+page_no,
    success: function(response){
      $('#load-follow').html(response);
    },
    error: function(msg){

    }

  });

}



function followRemove(stock_no){

  $.ajax({
    type: "GET",
    url: '/takip-ettiklerim/sil/'+stock_no,
    dataType: 'json',
    success: function(response){
      if ( response.success == true ){
        followPaging(1);
      }
    },
    error: function(msg){

    }

  });

}


