﻿function CargarProductosInternos(idioma) {

    var strProducto = '';

    strProducto = $("#txtProducto").val();

    if (strProducto != '') {

        var params = new Object();

        params.strProducto = strProducto;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosInternos",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosExternos(idioma) {

    var strProducto = '';

    strProducto = $("#txtProducto").val();

    if (strProducto != '') {

        var params = new Object();

        params.strProducto = strProducto;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosExternos",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzInterno(idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iCategoria = $("#ContentPlaceHolder1_ddlCategoria").val();
    iSubCategoria = $("#ContentPlaceHolder1_ddlSubCategoria").val();
    iLinea = $("#ContentPlaceHolder1_ddlLinea").val();

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

    var params = new Object();

    params.iCategoria = iCategoria;
    params.iSubCategoria = iSubCategoria;
    params.iLinea = iLinea;
    params.iIdioma = idioma;

    var query = $.toJSON(params);
  
        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzInterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzInternoXCategoria(idcat, idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iCategoria = idcat;

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

        var params = new Object();

        params.iCategoria = iCategoria;
        params.iSubCategoria = iSubCategoria;
        params.iLinea = iLinea;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzInterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzInternoXLinea(idlinea, idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iLinea = idlinea;

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

        var params = new Object();

        params.iCategoria = iCategoria;
        params.iSubCategoria = iSubCategoria;
        params.iLinea = iLinea;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzInterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzExterno(idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iCategoria = $("#ContentPlaceHolder1_ddlCategoria").val();
    iSubCategoria = $("#ContentPlaceHolder1_ddlSubCategoria").val();
    iLinea = $("#ContentPlaceHolder1_ddlLinea").val();

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

        var params = new Object();

        params.iCategoria = iCategoria;
        params.iSubCategoria = iSubCategoria;
        params.iLinea = iLinea;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzExterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function ShowColorBox(url, width, height) {
    $.fn.colorbox({
        href: url, width: width, height: height, iframe: true
    })
}

function LevantarContacto(url, value) {
    var iValue = '';

    iValue = value;

    if (iValue != '') {

        var params = new Object();

        params.iValue = iValue;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/LevantarContacto",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d) {
                    document.location.href=url
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzExternoXCategoria(idcat, idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iCategoria = idcat;

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

        var params = new Object();

        params.iCategoria = iCategoria;
        params.iSubCategoria = iSubCategoria;
        params.iLinea = iLinea;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzExterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

function CargarProductosAvanzExternoXSubCategoria(idsubcat, idioma) {

    var iCategoria = '';
    var iSubCategoria = '';
    var iLinea = '';

    iSubCategoria = idsubcat;

    if (iCategoria != '' || iSubCategoria != '' || iLinea != '') {

        var params = new Object();

        params.iCategoria = iCategoria;
        params.iSubCategoria = iSubCategoria;
        params.iLinea = iLinea;
        params.iIdioma = idioma;

        var query = $.toJSON(params);

        $.ajax({
            type: "POST",
            url: "../GetDataWithAjax.asmx/CargarProductosAvanzExterno",
            data: $.toJSON(params),
            contentType: "application/json",
            dataType: "json",
            async: true,
            success: function (msg) {
                if (msg.d != "") {
                    $(".search_results").html(msg.d);
                    $(".producto").colorbox({ width: "850", height: "800", iframe: true });
                }
                else if (msg.d == "") {
                    $(".search_results").html("");
                }
            }
        });
    }
    else {

    }
}

