/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function calcularRuta(){
    var aux = document.URL.split(location.host).pop();

    var url = aux.split('/');

    var a = 0;
    while(url.length > 0){
        var pos = url.pop();
        if(pos != '')
            a++
    }

    var ruta = '';
    for (i=1;i<=a;i=i+1){
        ruta += 'default.htm';
    }

    return ruta;
}


$(document).ready( function(){
    $("input.unidades").bind("change", function(){
        $.ajax({
            type: "GET",
            data: "",
            url: calcularRuta()+'tienda/carrito/updateelement/id/'+$(this).attr('id')+'/uds/'+$(this).val(),
            success: function(msg){
                $('#total').html(msg+'€');
            }
        });
    })
});
