function nuevoAjax() {
    var a = false;
    try {
        a = new ActiveXObject("Msxml2.XMLHTTP")
    } catch (c) {
        try {
            a = new ActiveXObject("Microsoft.XMLHTTP")
        } catch (b) {
            if (!a && typeof XMLHttpRequest != "undefined") {
                a = new XMLHttpRequest()
            }
        }
    }
    return a
}
var listadoSelects = new Array();
listadoSelects[0] = "select1";
listadoSelects[1] = "select2";
listadoSelects[2] = "select3";

function buscarEnArray(c, b) {
    var a = 0;
    while (c[a]) {
        if (c[a] == b) {
            return a
        }
        a++
    }
    return null
}
function cargaContenido(d) {
    var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b, "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
				p.html(q);
                        };
                    var m = jQuery('#'+b);
		    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.bind("change", function () {
                        cargaContenido(m.attr('id'))
                    });
                    if (d == "select1") {
                        var n = jQuery("#select3");
			
			n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};




function cargaContenidoFact(d) {
	var listadoSelects = ["select_fact1", "select_fact2", "select_fact3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_fact1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_fact",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoFact(m.attr('id'))
                    });
                    if (d == "select_fact1") {
                        var n = jQuery("#select_fact3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};






function cargaContenidoFacturaGestion(d) {
	var listadoSelects = ["select_fact_gest1", "select_fact_gest2", "select_fact_gest3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_fact_gest1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_fact_gest",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoFactGestion(m.attr('id'))
                    });
                    if (d == "select_fact_gest1") {
                        var n = jQuery("#select_fact_gest3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};












function cargaContenidoPedidosTienda(d) {
	var listadoSelects = ["select_PedidosTienda1", "select_PedidosTienda2", "select_PedidosTienda3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_PedidosTienda1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_PedidosTienda",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoPedidosTienda(m.attr('id'))
                    });
                    if (d == "select_PedidosTienda1") {
                        var n = jQuery("#select_PedidosTienda3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};












function cargaContenidoPedidosTienda(d) {
	var listadoSelects = ["select_PedidosTienda1", "select_PedidosTienda2", "select_PedidosTienda3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_PedidosTienda1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_PedidosTienda",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoPedidosTienda(m.attr('id'))
                    });
                    if (d == "select_PedidosTienda1") {
                        var n = jQuery("#select_PedidosTienda3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};









function cargaContenidoSalonFacturacion (d) {
	var listadoSelects = ["select_SalonFacturacion1", "select_SalonFacturacion2", "select_SalonFacturacion3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_SalonFacturacion1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_SalonFacturacion",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoSalonFacturacion (m.attr('id'))
                    });
                    if (d == "select_PedidosTienda1") {
                        var n = jQuery("#select_SalonFacturacion3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};







function cargaContenidoProveedoresPago (d) {
	var listadoSelects = ["select_ProveedoresPago1", "select_ProveedoresPago2", "select_ProveedoresPago3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_ProveedoresPago1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_ProveedoresPago",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoProveedoresPago (m.attr('id'))
                    });
                    if (d == "select_PedidosTienda1") {
                        var n = jQuery("#select_ProveedoresPago3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};














function cargaContenidoCanjeadores (d) {
	var listadoSelects = ["select_Canjeadores1", "select_Canjeadores2", "select_Canjeadores3"];
	var g = jQuery.inArray(d,listadoSelects) + 1,
        e = jQuery('#' + d),
        h = e.val();
    if (h == 0 || h == "0") {
        jQuery(listadoSelects).each(function (l, n) {
            if (l < g) {
                return
            }
            var k = jQuery('#' + n);
            k.html('<option value="0">Selecciona Opci&oacute;n...</option>');
            k.attr('disabled', true);
        })
    } else {
        if ( jQuery.inArray(d, listadoSelects) != (listadoSelects.length - 1)) {
            var c = e.val(),
                b = listadoSelects[g],
                i = jQuery('#'+b),
                j = jQuery("#select_Canjeadores1"),
                c = j.val(),
                a = ["/operations/select_dependientes_3_niveles_proceso.php?select=", b.replace("_Canjeadores",""), "&opcion=", h, "&opcionInicial=", c].join(""); /*loading(true,$(b));*/
            var f = jQuery.get(a, function (o) {
                    var k = function (q, p) {
                                p.html(q);
				p.val(p.attr('default')).change();
                        };
                    var m = jQuery('#'+b);
                    m.empty();
                    m.attr('disabled', false);
                    m[0].selectedIndex = 0;
                    m.unbind('change').bind("change", function () {
                        cargaContenidoCanjeadores (m.attr('id'))
                    });
                    if (d == "select_PedidosTienda1") {
                        var n = jQuery("#select_Canjeadores3");
                        n.html('<option value="0">' + "Selecciona Opci&oacute;n..." + '</option>').attr('disabled', true);
                    }
                    k(o, m)
            })
        }
    }
};


