var c_OTRO1 = new Array();
c_OTRO1[0] = 0
var c_OTRO2 = new Array();
c_OTRO2[0] = 0
var c_OTRO3 = new Array();
c_OTRO3[0] = 0

function ActualizaPrecioArmado (txtCategoria, txtPrecio, tieneCant, txtCantidad){
/*	    $PrecioTotal = "c_" . $nomCatCanonizada . "[this.form.mnu$nomCatCanonizada.options[this.form.mnu$nomCatCanonizada.selectedIndex].value]";

	    $CambCant = "";

	    if (in_array($nomCat, $IndiceCant)) {
	        $PrecioTotal .= " * [this.form.txtCant$nomCatCanonizada.value]";
	        $CambCant = "this.form.txtCant$nomCatCanonizada.value = 1";
	    }
	    $script_precios = " $CambCant; this.form.txtPrecio$nomCatCanonizada.value = $PrecioTotal;";

        if (tieneCant){
            Cantidad.value = 1;
            Categoria.value = ;
        } else {
            Precio.value = ; parse
        }
*/
}

/*------------------------------------------------------------------------
        NOMBRE:		    OcultaListas
        DESCRIPCION:	Oculta todas las listas (comboboxes) de un rubro especifico
        PARÁMETROS:	    subrubros   array con la lista de subrubros
                        rubro       Rubro del cual ocultar listas (canonizado)
        VERSION:		1.0.0
------------------------------------------------------------------------*/

function OcultaListas (subrubros, rubro) {
    // primero ocultamos el que incluye a Todos
    cmbMostrar = document.getElementById('mnu' + rubro + '_Todos');
    cmbMostrar.style.display = 'none';

    // ahora el resto
    for (x=0; x < subrubros.length; x++) {
        txt_elemento = 'mnu' + rubro + '_' + subrubros[x];
        cmbMostrar = document.getElementById(txt_elemento);
        cmbMostrar.style.display = 'none';
    }


}

/*------------------------------------------------------------------------
        NOMBRE:		    MuestraDetalles
        DESCRIPCION:	Abre la ventana de detalles del artículo
        PARÁMETROS:	    articuloID  El artículo a mostrar
        VERSION:		1.0.0
        NOTAS:          El parámetro enviado al script significa de
                        donde obtener las caracteristicas:
                            0     No obtenerlas
                            1     De html solamente
                            2     Solo de la base de datos
                            3     HTML, si no existe, buscar en la base de datos
------------------------------------------------------------------------*/
function MuestraDetalles (articuloID) {
    zoomDetalle(articuloID, 'OrigenCar=2');
//    return false;
}


/*---------------------------------------------------------------------------------------*/ /*!
 Borra un select o una lista

   \param  OptionList		El select a borrar
*/////-----------------------------------------------------------------------------------------
function ClearOptions(OptionList) {

	if (OptionList != null) {
   // Always clear an option list from the last entry to the first
	   for (x = OptionList.length; x >= 0; x--) {
	      OptionList[x] = null;
	   }
	}
}


/*---------------------------------------------------------------------------------------*/ /*!
 Agrega un elemento a un select o una lista.

   \param  OptionList		El select adonde agregar
   \param  OptionValue		El valor a agregar
   \param  OptionText		El texto a mostrar

*/////-----------------------------------------------------------------------------------------
function AddToOptionList(OptionList, OptionValue, OptionText, seleccionado) {

   // Add option to the bottom of the list
	if (OptionList != null)
   		OptionList[OptionList.length] = new Option(OptionText, OptionValue, seleccionado);
   	else
   		OptionList[0] = new Option(OptionText, OptionValue, seleccionado);
}

/*---------------------------------------------------------------------------------------*/ /*!
 Funcion para arreglar errores del internet explorer con settimeout y setinterval


*/////-----------------------------------------------------------------------------------------
/*@cc_on
(function(f){
 window.setTimeout =f(window.setTimeout);
 window.setInterval =f(window.setInterval);
})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
@*/

/*---------------------------------------------------------------------------------------*/ /*!
 Reemplaza el contenido de un select por el array indicado

   \param  nombreOptionList		El select adonde agregar
   \param  arrDatos				Array con los valores a agregar

*/////-----------------------------------------------------------------------------------------
function LlenarOptionList(nombreOptionList, arrDatos, seleccionado) {


	OptionList = document.getElementById('mnu' + nombreOptionList);


	CuadroMsgActualizando = document.getElementById('msgActualizando' + nombreOptionList);
	
	CuadroMsgActualizando.style.display = 'block';

	var indiceSeleccionado;

	switch (nombreOptionList) {
		case 'mnuOTRO1':
			c_OTRO1 = new Array();
			c_OTRO1[0] = 0;
			break;
		case 'mnuOTRO2':
			c_OTRO2 = new Array();
			c_OTRO2[0] = 0;
			break;
		case 'mnuOTRO3':
			c_OTRO3 = new Array();
			c_OTRO3[0] = 0;
			break;
		default:
			break;
	}

	ClearOptions(OptionList);

	if (seleccionado == 0)
		AddToOptionList(OptionList, 0, 'Ninguno', true);
	else
		AddToOptionList(OptionList, 0, 'Ninguno');

	if (arrDatos != null) {
		for (i=0; i<arrDatos.length;i++) {
	
			valor = arrDatos[i][0];
	//		opera.postError('select: ' + valor + ', ' + arrDatos[i][1]);
	
			if (valor == seleccionado) 
				AddToOptionList(OptionList, valor, arrDatos[i][1], true);
			else
				AddToOptionList(OptionList, valor, arrDatos[i][1]);
				
			switch (nombreOptionList) {
				case 'mnuOTRO1':
					c_OTRO1[valor] = arrDatos[i][2];
	//				opera.postError('agregado: ' + valor + ' - ' + c_OTRO1[valor]);
					break;
				case 'mnuOTRO2':
					c_OTRO2[valor] = arrDatos[i][2];
					break;
				case 'mnuOTRO3':
					c_OTRO3[valor] = arrDatos[i][2];
					break;
				default:
					break;
			}
			if (valor == seleccionado)  {
				indiceSeleccionado = i+1;
			}
		}
		// Mostramos el cartel de "llenado"
		CuadroMsgActualizando.style.display = 'none';
		CuadroMsg = document.getElementById('msgListoTodos' + nombreOptionList);
		
		CuadroMsg.style.display = 'block';
/*
		funcionALlamar = 'desapareceCuadroMsg("' + nombreOptionList + '")';
		
		window.setTimeout(eval(funcionALlamar), 2500);
//		msgListoTodos$llaveCanonica
*/

		var i = setTimeout(function(nombreOptionList){
			CuadroMsg = document.getElementById('msgListoTodos' + nombreOptionList);
			CuadroMsg.style.display = 'none';

		 }, 2500, nombreOptionList);


		OptionList.selectedIndex = indiceSeleccionado;
//		OptionList.selectedIndex = 0;
	}
}

/*---------------------------------------------------------------------------------------*/ /*!
 Hace desaparecer el cuadro indicado de mensajes de option list

   \param  nombreOptionList		El cuadro a desaparecer

*/////-----------------------------------------------------------------------------------------
function desapareceCuadroMsg(nombreOptionList) {

	window.alert('msgListoTodos' + nombreOptionList);
	CuadroMsg = document.getElementById('msgListoTodos' + nombreOptionList);
	CuadroMsg.style.display = 'none';

}
	