posicionarMenu();

$(window).scroll(function () {
    posicionarMenu();
});

function posicionarMenu() {
    var altura_del_header = $('.header').outerHeight(true);
    var altura_del_menu = $('.menu').outerHeight(true);

    if ($(window).scrollTop() >= altura_del_header) {
        $('.menu').addClass('fixed');
        $('.wrapper').css('margin-top', (altura_del_menu) + 'px');
    } else {
        $('.menu').removeClass('fixed');
        $('.wrapper').css('margin-top', '0');
    }
}

function enviar_tabla(id) {
    $("#datos_a_enviar").val($("<div>").append($("#" + id).eq(0).clone()).html());
    $("#FormularioExportacion").submit();
}

function mostrarIndex() {
    $destino = "layout/navBar.php";
    $.post($destino)
            .done(function (data) {
                $("#nav").html(data);
            });
    $destino = "banner.php";
    /*if (index == 1) {
     $destino = "vista/ventas/venta.php";
     }*/
    $.post($destino)
            .done(function (data) {
                $("#page-wrapper").html(data);
            });
}

function modal(boton) {
    $destino = boton.dataset.value;
    $id = boton.id;
    $("#" + $id).hide();
    $("#S" + $id).show();
    $("#modal").empty();
    $.post($destino)
            .done(function (data) {
                $("#modal").html(data);
                $("#" + $id).show();
                $("#S" + $id).hide();
            });
}

function editarCotizacion(boton) {
    var i = boton.parentNode.parentNode.rowIndex;
    $idCliente = boton.id;
    $destino = "vista/cotizacion/form_cotizacion.php";
    modal2($destino, $idCliente, i);
}

function seguimiento($id) {
    $destino = "vista/cotizacion/form_seguimiento.php?idCoti=" + $id;
    $("#modal").empty();
    $.post($destino)
            .done(function (data) {
                $("#modal").html(data);
            });
}

function recargarDrop() {

}



function pastel(series, nombre, container) {
    Highcharts.chart(container, {
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: 1, //null,
            plotShadow: false
        },
        title: {
            text: '<b>' + nombre + '</b>',
        },
        tooltip: {
            pointFormat: 'Total:<b>{point.y}</b><br>Procentaje: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: false,
                    format: '<b>{point.name}</b>: {point.y}',
                    //format: '{point.name}: <b>{point.percentage:.1f}%</b>',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
                    }
                },
                showInLegend: true
            }
        },
        series: [{
                type: 'pie',
                data: series
            }]
    });
}