//-----------------------------------------------
//---------------E-manager - Admin-----------------
//-----------------------------------------------


function unavailable () {
	vbMsgInfo ("Opción actualmente no disponible");
}

function showSubmenu(itemName) {
	i = 1;
	obj = document.getElementById(itemName+i);
	do {
		if (obj.style.display == 'none') {
			obj.style.display = 'block';
		}
		else {
			obj.style.display = 'none';
		}
		i++;
		obj = document.getElementById(itemName+i);
	}while (obj);
}

function mostrarOcultarSeries (i) {
	obj = document.getElementById("item"+i);
	if (obj.style.display == 'none') {
		obj.style.display = 'block';
	}
	else {
		obj.style.display = 'none';
	}
}


//Funciones para combobox dependientes "categorias"------------------------------------



	//funciones de uso-----------------------------------------------------
	

//Navigation functions-----------------------------------------------------------------

function submitPage (pag) {
	currentForm = document.navigation;
	currentForm.pagina.value = pag;
	currentForm.submit();
}

function goBack() {
	history.back();
}

function mostrar (cual) {
	abrirVentana(cual+".php", cual, 610, 300);
}

//Login----------------------------------------------------------------------------------

function checkLoginForm() {
	currentForm = document.login;
	allOK = true;
	errorMsg = "Imposible ingresar al sistema debido a los siguientes problemas:";
	
	if (currentForm.txtUsuario.value == "") {
		errorMsg = errorMsg + "\n-Debe digitar su nombre de usuario";
		allOK = false;
	}
	if (currentForm.txtContrasena.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe proporcionar su contrase&ntilde;a correspondiente";
	}
	
	if (!allOK) {
		vbMsgError (errorMsg);
	}
	return (allOK);
}


function doLogin() {
	if (checkLoginForm()) {
		document.login.startLogin.value = 1;
		document.login.submit();
	}
}

function logout () {
	document.navigation.logoutProcess.value = 1;
	document.navigation.submit();
}

//Generador de passwords-------------------------------------------------------------------------------

function generarContrasena(frmName) {
	currentForm = eval("document."+frmName);
	pwd = createRandomText();
	currentForm.txtContrasena.value = pwd;
}

function createRandomText() { //crea una hilera de 8 caracteres aleatorios
	hilera = "";
	cods = new Array();
	for (i = 0; i < 8; i++) {
		if (i % 2 != 0) {
			randomNum = Math.round(Math.random()*9) + 48;
		}
		else {
			randomNum = Math.round(Math.random()*25) + 97;
		}
		cods[i] = randomNum;
	}//for
	hilera = String.fromCharCode(cods[0], cods[1], cods[2], cods[3], cods[4], cods[5], cods[6], cods[7]);
	return (hilera);
}

//Seleccionadores-------------------------------------------------------------------------------------

function seleccionarDirector () {
	abrirVentana ("seleccion.php?cualDato=director", "directorSel", 450, 400);
}

function seleccionarProducto () {
	currentForm = document.insertar;
	if (currentForm.cboProveedor.value != -1) {
		abrirVentana ("seleccion.php?cualDato=producto&proveedor="+currentForm.cboProveedor.value, "actorSel", 450, 400);
	}
	else {
		vbMsgError ("Debe elegir el proveedor");
	}
}
function seleccionarProducto2 () {
	currentForm = document.seleccionador;
	abrirVentana ("products.php?cualDato=producto2&proveedor2="+currentForm.proveedor.value, "actorSel", 450, 400);
}

function seleccionarCliente () {
	currentForm = document.seleccionador;
	abrirVentana ("seleccion.php?cualDato=cliente", "actorSel", 450, 400);
}

function seleccionarInventario () {
	currentForm = document.seleccionador;
	abrirVentana ("seleccion.php?cualDato=inventario", "actorSel", 450, 400);
}

function detallesCliente (valor) {

	abrirVentana ("detalles.php?cliente=1&Cedula="+valor, "actorSel", 450, 400);
}
function detallesProducto (valor) {

	abrirVentana ("detalles.php?producto=1&codinventario="+valor, "actorSel", 450, 400);
}
function elegirPagina (numPag) {
	theForm = document.seleccionador;	
	theForm.pag.value = numPag;
	theForm.submit();
}

function asignarDirector (itemNumber) {
	window.close();
	window.opener.focus();
	txtField = window.opener.document.getElementById('txtCodDirector');
	txtField.value = itemNumber;
	txtField.focus();
	button = window.opener.document.getElementById('cmdDirector');
	button.focus();
}

function asignarProducto (itemNumber) {
	window.close();
	window.opener.focus();
	txtField = window.opener.document.getElementById('txtCodProducto');
	txtField.value = itemNumber;
	txtField.focus();
	button = window.opener.document.getElementById('Buscar');
	button.focus();
}

function asignarCliente (itemNumber) {
	window.close();
	window.opener.focus();
	txtField = window.opener.document.getElementById('Cedula');
	txtField.value = itemNumber;
	txtField2 = window.opener.document.getElementById('txtNombre');
	txtField2.focus();
	button = window.opener.document.getElementById('cmdAddC');
	button.focus();
}

function FiltroProducto(FrmName){
	currentForm = document.seleccionador;
	errorMsg = "Problemas para filtrar.";
	allOK = true;
	if (currentForm.txtNombre.value == ""){
		allOK = false;
		errorMsg = errorMsg + "\n-Debe elegir el tipo del usuario";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);

}
//Listas de actores------------------------------------------------------------------------

function agregarActor() {
	txtCodActor = document.getElementById('txtCodActor');
	idActor = txtCodActor.value;

	txtNomActor = document.getElementById('txtNomActor');
	nomActor = txtNomActor.value;

	txtCodActor.value = '';
	txtNomActor.value = '';
	
	lista = document.getElementById('lstActores');
	total = lista.length;
	lista[total] = new Option (nomActor, idActor, false, false);
}

function removerActor() {
	lista = document.getElementById('lstActores');
	total = lista.length;
	if (total > 0) {
		cual = lista.selectedIndex;
		lista[cual] = null;
	}
	else {
		vbMsgError ("No hay actores en la lista");
	}
}

//Recogedores de información--------------------------------------------------------------

function buscarInfoDirector (cod) {
	ifrm = document.getElementById('retriever');
	ifrm.src = "actordirectorInfo.php?cual=director&codIngresado="+cod;
}

function buscarInfoProducto (cod) {
	ifrm = document.getElementById('retriever');
	ifrm.src = "ListadeProducto.php?cual=producto&codIngresado="+cod;
}
function buscarInfoSeries (cantidad) {
	rdo = document.getElementById('rdoS1');
	if (rdo.checked){
		ifrm = document.getElementById('retriever2');
		ifrm.src = "ListadeSeries.php?cual=producto&cantidadIngresada="+cantidad;
		ifrm.height = cantidad * 180;
		ifrm.width = 750;
	}
}

function buscarInfoCliente (cod) {
	ifrm = document.getElementById('retriever');
	ifrm.src = "clienteinfo.php?codIngresado="+cod;
}

function buscarInfoInventario (cod) {
	ifrm = document.getElementById('retriever');
	ifrm.src = "productoinfo.php?codInventario="+cod;
}

//Funciones especiales de control---------------------------------------------------------------------

function bloquearCategoria (cod) {
	theForm = document.insertar;
	for (i = 0; i < theForm.elements.length; i++) {
		if (theForm.elements[i].type == "checkbox") {
			if (theForm.elements[i].name == "chkCategorias[]") {
				theForm.elements[i].checked = false;
				if (theForm.elements[i].value == cod) {
					theForm.elements[i].disabled = "disabled";
				}
				else {
					theForm.elements[i].disabled = "";
				}
			}
		}
	}//for
}

//Usuarios--------------------------------------------------------------------------------------------

function checkCamposUsuario (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del usuario:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.cboTipo.value == "" || currentForm.cboTipo.value == -1) {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe elegir el tipo del usuario";
	}
	if (currentForm.txtNombre.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre completo del usuario";
	}
	if (currentForm.txtUsuario.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar un nombre de usuario";
	}
	if (currentForm.txtContrasena.value == "" || currentForm.txtConfirmar.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar una contraseña y escribirla nuevamente para confirmarla";
	}
	else {
		if (currentForm.txtContrasena.value != currentForm.txtConfirmar.value) {
			allOK = false;
			errorMsg = errorMsg + "\n-La contraseña y la confirmación no coinciden";
		}	
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarUsuario() {
	if (checkCamposUsuario('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdModificarUsuario() {
	if (checkCamposUsuario('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarUsuario(cod) {
	if (confirm("Está a punto de eliminar un usuario. ¿Está seguro?")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}

//Detalle de factura--------------------------------------------------------------------------------------
function addSerie(frmName, numItem, cont, id, id2){
	eval("currentForm = document."+frmName+";");
	allOKC = true;
	errorMsg = "Problemas con la serie del producto a incluir:";
	
	for (i = 0; i <= cont; i++){
		a = i + 1;
		eval("obj = currentForm.txtSerie"+numItem+i+";");
		eval("obj1 = currentForm.txtGarantia"+numItem+i+";");
		eval("obj2 = currentForm.cboEstado"+numItem+i+";");
		eval("obj3 = currentForm.cboLugar"+numItem+i+";");
		eval("obj4 = currentForm.txtdesc"+numItem+i+";");
		eval("obj5 = currentForm.cboLugar2"+numItem+i+";");
		if (obj.value == "") {
			allOKC = false;				
			errorMsg = errorMsg + "\n-Debe indicar el numero de serie "+a;
		}
		if (obj1.value == "") {
			allOKC = false;
			errorMsg = errorMsg + "\n-Debe indicar el numero de meses de garantia "+a;
		}
		if (obj2.value == -1) {
			allOKC = false;
			errorMsg = errorMsg + "\n-Debe indicar un estado de serie "+a;
		}
		if (obj3.value == -1) {
			allOKC = false;
			errorMsg = errorMsg + "\n-Debe indicar una ubicacion general de la serie "+a;
		}
		if (obj4.value == "") {
			allOKC = false;
			errorMsg = errorMsg + "\n-Debe indicar una descripcion de la ubicacion de la serie "+a;
		}
		if (obj5.value == -1) {
			allOKC = false;
			errorMsg = errorMsg + "\n-Debe indicar una ubicacion general de la serie "+a;
		}
	}
	if (allOKC) {
		if (frmName == 'Series') { 
			currentForm.cmdSerie.value = 1;
		}
		currentForm.cmdidProdProv.value = id2;
		currentForm.cmdidDetalle.value = id;
		currentForm.cmdidItemActual.value = numItem;
		currentForm.cmdContador.value = cont;
		currentForm.cmdInsertarSerie.value = 1;
		currentForm.submit();
	}
	else {
		vbMsgError(errorMsg);
	}
}

function addDetalle(frmName){
	currentForm = eval("document."+frmName);
	allOKC = true;
	errorMsg = "Problemas con el detalle de factura a incluir:";
	if (currentForm.txtNumeroFactura.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar el numero de factura";
	}
	if (currentForm.txtFechaIngreso.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar la fecha en el detalle de factura";
	}
	if (currentForm.txtDescripcion.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una descripcion para el producto seleccionado";
	}
	if (currentForm.txtPrecioU.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una precio unitario para el producto seleccionado";
	}
	if (currentForm.txtCantidad.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una cantidad para el producto seleccionado";
	}
	if (currentForm.txtPuntoR.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar un punto de reorden para el producto seleccionado";
	}
	if (currentForm.txtCantidadR.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una cantidad de recompra para el producto seleccionado";
	}
	if (currentForm.cboFamilia.value == -1) {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe elegir una familia para agregar";
	}
	if (currentForm.cboSubFamilia.value == -1) {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe elegir una subfamilia para agregar";
	}
	if (currentForm.cboTipoProducto.value == -1) {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe elegir un tipo de producto para agregar";
	}
	if (currentForm.cboMarca.value == -1) {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe elegir una marca para agregar";
	}
	if (allOKC) {
		if (frmName == 'insertar') { 
			currentForm.cmdAddNew.value = 1;
		}
		
		currentForm.cmdAddProducto.value = 1;
		
		currentForm.submit();
	}
	else {
		vbMsgError(errorMsg);
	}
}

function addDetalleFactura(frmName,cantidad){//factura de compra

	currentForm = eval("document."+frmName);
	allOKC = true;
	errorMsg = "Problemas con el detalle de factura a incluir:";

	if (currentForm.txtFecha.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar la fecha en el detalle de factura";
	}
	if (currentForm.txtDescripcion.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una descripcion para el producto seleccionado";
	}
	if (currentForm.txtCantidad.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una cantidad para el producto seleccionado";
	}
		if (currentForm.txtCantidad.value == "0") {
		allOKC = false;
		errorMsg = errorMsg + "\n-No puede especificar 0 como cantidad";
	}
	if(parseInt(currentForm.txtExistencia.value) < parseInt(cantidad)){
		allOKC = false;
		errorMsg = errorMsg + "\n-Cantidad insuficiente";
	}
	if (allOKC) {
		if (frmName == 'facturar') { 
			currentForm.cmdAddNew.value = 1;

		}
		currentForm.cmdAddProducto.value = 1;
		
		currentForm.submit();
	}
	else {
		vbMsgError(errorMsg);
	}
}

function removeDetalleFactura(frmName, pos) {//factura de compra
	currentForm = eval("document."+frmName);
	
	if (frmName == 'facturar') { 
		currentForm.cmdAddNew.value = 1;	
	}
	currentForm.cmdRemoveProducto.value = 1;
	currentForm.posRemover.value = pos;
	currentForm.submit();
}

function seldescuento(valor){//asigna el valor de descuento segun el combobox
	currentForm = eval("document.facturar");
	currentForm.document.getElementById('txtDescuento').value = valor;
	currentForm.submit();
}

function selutilidad(valor){//asigna el valor de utilidad segun el combobox
	currentForm = eval("document.facturar");
	currentForm.document.getElementById('txtUtilidad').value = valor;
	currentForm.submit();
}
//Direcciones y medios de comunicacion-----------------------------------------------------------------------------------------------

function addAddress(frmName) {
	currentForm = eval("document."+frmName);
	allOK = true;
	errorMsg = "Problemas con la dirección a incluir:";
	if (currentForm.cboProvincias.value == -1) {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe elegir una provincia para la dirección";
	}
	if (currentForm.cboCantones.value == -1) {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe elegir un canton de la provincia elegida ";
	}
	if (currentForm.txtdireccion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe indicar una descripcion en esta dirección";
	}	
	if (allOK) {
		if (frmName == 'insertar') { 
			currentForm.cmdAddNew.value = 1;
		}
		else {
			currentForm.cmdModifySelected.value = 1;
		}
		currentForm.cmdAddAddress.value = 1;
		currentForm.submit();
	}
	else {
		vbMsgError(errorMsg);
	}
}

function removeDetalle(frmName, pos) {
	currentForm = eval("document."+frmName);
	if (frmName == 'insertar') { 
		currentForm.cmdAddNew.value = 1;
	}
	
	currentForm.cmdRemoveProducto.value = 1;
	currentForm.posRemover.value = pos;
	currentForm.submit();
}


function removeAddress(frmName, pos) {
	currentForm = eval("document."+frmName);
	if (frmName == 'insertar') { 
		currentForm.cmdAddNew.value = 1;
	}
	else {
		currentForm.cmdModifySelected.value = 1;
	}
	currentForm.cmdRemoveAddress.value = 1;
	currentForm.posRemover.value = pos;
	currentForm.submit();
}

function addcomunication(frmName){
	currentForm = eval("document."+frmName);
	allOKC = true;
	errorMsg = "Problemas con el medio de comunicacion a incluir:";
	if (currentForm.descripcion.value == "") {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe indicar una descripcion para el medio seleccionado";
	}
	if (currentForm.cboTipoMedio.value == -1) {
		allOKC = false;
		errorMsg = errorMsg + "\n-Debe elegir un medio para agregar";
	}
	if (allOKC) {
		if (frmName == 'insertar') { 
			currentForm.cmdAddNew.value = 1;
		}
		else {
			currentForm.cmdModifySelected.value = 1;
		}
		currentForm.cmdAddMedio.value = 1;
		currentForm.submit();
	}
	else {
		vbMsgError(errorMsg);
	}
}

function removeComunication(frmName, pos) {
	currentForm = eval("document."+frmName);
	if (frmName == 'modificar') { 
		currentForm.cmdModifySelected.value = 1;
	}
	else {
		currentForm.cmdAddNew.value = 1;
	}
	currentForm.cmdRemoveMedio.value = 1;
	currentForm.posRemoverMedio.value = pos;
	currentForm.submit();
}


//Clientes, Proveedore y empleados--------------------------------------------------------------------------------------------

function checkCamposCliente (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del cliente:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtNombre.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre completo del cliente";
	}
	if (currentForm.cboTipoCliente.value == 1) {
		if (currentForm.txtCedula.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar un número de cédula válido del cliente";
		}
		if (currentForm.txtApellido1.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar el primer apellido del cliente";
		}
		if (currentForm.txtApellido2.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el segundo apellido del cliente";
		}
	}
	else{
		if (currentForm.txtCedulaJ.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar un número de cédula juridica válido del cliente";
		}
	}
	
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposEmpleado (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del empleado:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtNombre.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre  del empleado";
	}
	if (currentForm.txtApellido1.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el primer apellido del empleado";
	}
	if (currentForm.txtApellido2.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el segundo apelido del empleado";
	}
	if (currentForm.txtCedula.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar un número de cédula válido del empleado";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposProveedor (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del proveedor:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtNombre.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre completo del proveedor";
	}
	if (currentForm.cboTipoCliente.value == 1) {
		if (currentForm.txtCedula.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar un número de cédula válido del proveedor";
		}
		if (currentForm.txtApellido1.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar el primer apellido del proveedor";
		}
		if (currentForm.txtApellido2.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el segundo apellido del proveedor";
		}
	}
	else{
		if (currentForm.txtCedulaJ.value == "") {
			allOK = false;
			errorMsg = errorMsg + "\n-Debe ingresar un número de cédula juridica válido del proveedor";
		}
	}
	
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}


function cmdInsertarEmpleado() {
	if (checkCamposEmpleado('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdInsertarProveedor() {
	if (checkCamposProveedor('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdInsertarCliente() {
	if (checkCamposCliente('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}


function cmdModificarProveedor() {
	if (checkCamposProveedor('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarEmpleado() {
	if (checkCamposEmpleado('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarCliente() {
	if (checkCamposCliente('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarProveedor(cod) {
	if (confirm("Está a punto de eliminar un proveedor. ¿Está seguro?")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarEmpleado(cod) {
	if (confirm("Está a punto de eliminar un empleado. ¿Está seguro?")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarCliente(cod) {
	if (confirm("Está a punto de eliminar un cliente. ¿Está seguro?")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}

function TipoCliente(currentValue) {
	ocultar = document.getElementById('ap1');
	ocultar1 = document.getElementById('ap2');
	ocultar2 = document.getElementById('ced');
	ocultar3 = document.getElementById('cedJ');
 	if (currentValue == 1) {
   		 ocultar.style.display = 'block'; //para aparecerlo
		 ocultar1.style.display = 'block'; //para aparecerlo
		 ocultar2.style.display = 'block'; //para aparecerlo
  		 ocultar3.style.display = 'none';
	}
	else {
   		ocultar.style.display = 'none'; //para desaparecerlo
   		ocultar1.style.display = 'none'; //para desaparecerlo
  		ocultar2.style.display = 'none'; //para desaparecerlo
 		ocultar3.style.display = 'block';
	}
}

function DatosOpcionales(currentValue) {
	ocultar = document.getElementById('dc');
	
 	if (currentValue == 'S') {
   		 ocultar.style.display = 'block'; //para aparecerlo
  	}
	else {
   		ocultar.style.display = 'none'; //para desaparecerlo
 	}
}

//Películas--------------------------------------------------------------------------------------------

function checkCamposPelicula (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la película:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtNombreOriginal.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre original de la película";
	}
	if (currentForm.txtNombreOriginal.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre doblado/traducido de la película";
	}
	/*
	if (currentForm.txtImagen.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe seleccionar la imagen del producto";
	}
	*/

	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarPelicula() {
	if (checkCamposPelicula('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdModificarPelicula() {
	if (checkCamposPelicula('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarPelícula(cod) {
	if (confirm("Está a punto de eliminar una película. ¿Está seguro?")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}


//Productos--------------------------------------------------------------------------------------------
function checkCamposProducto2 (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del producto";

	currentForm = eval("document."+frmName);
	
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del producto";
	}
	if (currentForm.txtPrecio.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el precio unitario del producto";
	}
	if (currentForm.txtCodigoProducto.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el codigo del producto";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarProducto() {
	currentForm = document.insertar;
	currentForm.cmdInsertar.value = 1;
	currentForm.cmdSerie.value = 1;
	currentForm.submit();

}

function cmdInsertarSerie() {
	currentForm = document.Series;
	currentForm.cmdInsertar.value = 0;
	currentForm.cmdInsertarSerie.value = 0;
	currentForm.cmdSerie.value = 0;
	currentForm.cmdAddNew.value = 1;
	currentForm.submit();
}
function cmdInsertarProducto2() {
	if (checkCamposProducto2('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdFacturarProducto() {
	currentForm = document.facturar;
	allOK = true;
	errorMsg = "Problemas con la información del producto";
	
	if (currentForm.Cedula.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar un cliente";
	}
	if (currentForm.txtSubtotal.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar un producto";
	}
	if (currentForm.Moneda.value == "-1") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe seleccionar una moneda";
	}
	if(allOK==true){
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	} else  {
		vbMsgError(errorMsg);
	}
		
}

function cmdCancelarProducto() {
	window.close();
}
function cmdModificarProducto() {
	if (checkCamposProducto('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarProducto(cod) {
	if (confirm("Está a punto de eliminar un producto. ¿Está seguro? (Si hay combos asociados con el producto, éste no podrá; ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}

//Catalogos--------------------------------------------------------------------------------------------

function checkCamposTipoUbicacion(frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del tipo de ubicacion de producto:";
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del tipo";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}
function checkCamposEstadoFactura (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del estado de la factura:";
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del estado de la factura";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}
function checkCamposSubfamilia (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la subfamilia:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción de la subfamilia";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}
function checkCamposTipoProducto (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del tipo de producto:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del tipo de producto";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}
function checkCamposMarca (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la marca:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción de la marca";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposRol (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del rol de la persona:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del rol de la persona";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposEstadoSerie (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del estado de la serie del producto:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del estado de la serie";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposFamilia (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la familia:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción de la familia";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposMoneda (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la moneda:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción de la moneda";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function checkCamposBanco (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del banco:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtnombre.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del banco";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarTipoUbicacion() {
	if (checkCamposTipoUbicacion('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarEstadoFactura() {
	if (checkCamposEstadoFactura('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarSubfamilia() {
	if (checkCamposSubfamilia('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarTipoProducto() {
	if (checkCamposTipoProducto('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarMarca() {
	if (checkCamposMarca('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarRol() {
	if (checkCamposRol('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarFamilia() {
	if (checkCamposFamilia('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarEstadoSerie() {
	if (checkCamposEstadoSerie('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarMoneda() {
	if (checkCamposMoneda('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
function cmdInsertarBanco() {
	if (checkCamposBanco('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}
//------------------modificacion catalogos
function cmdModificarTipoUbicacion() {
	if (checkCamposTipoUbicacion('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarEstadoFactura() {
	if (checkCamposEstadoFactura('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarSubfamilia() {
	if (checkCamposSubfamilia('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarTipoProducto() {
	if (checkCamposTipoProducto('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarMarca() {
	if (checkCamposMarca('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarRol() {
	if (checkCamposRol('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarMoneda() {
	if (checkCamposMoneda('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarEstadoSerie() {
	if (checkCamposEstadoSerie('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarFamilia() {
	if (checkCamposFamilia('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
function cmdModificarBanco() {
	if (checkCamposBanco('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}
//------eliminacion catalogos
function eliminarTipoUbicacion(cod) {
	if (confirm("Está a punto de eliminar un tipo. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarEstadoFactura(cod) {
	if (confirm("Está a punto de eliminar un estado. ¿Está seguro? (Si hay facturas asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}

function eliminarSubfamilia(cod) {
	if (confirm("Está a punto de eliminar una subfamilia. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarTipoProducto(cod) {
	if (confirm("Está a punto de eliminar un tipo de producto. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarMarca(cod) {
	if (confirm("Está a punto de eliminar una marca. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarRol(cod) {
	if (confirm("Está a punto de eliminar un rol de persona. ¿Está seguro? (Si hay personas asociadas al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarFamilia(cod) {
	if (confirm("Está a punto de eliminar una familia. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarEstadoSerie(cod) {
	if (confirm("Está a punto de eliminar un Estado de serie. ¿Está seguro? (Si hay productos asociados al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarMoneda(cod) {
	if (confirm("Está a punto de eliminar una moneda. ¿Está seguro? (Si hay transacciones asociadas al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
function eliminarBanco(cod) {
	if (confirm("Está a punto de eliminar un banco. ¿Está seguro? (Si hay facturas asociadas al tipo, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}
//Formatos--------------------------------------------------------------------------------------------

function checkCamposFormato (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información del formato:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción del formato de disco";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarFormato() {
	if (checkCamposFormato('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdModificarFormato() {
	if (checkCamposFormato('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarFormato(cod) {
	if (confirm("Está a punto de eliminar un formato de disco. ¿Está seguro? (Si hay películas asociadas al formato, éste no podrá ser eliminado)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}


//Categorias--------------------------------------------------------------------------------------------

function checkCamposCategoria (frmName) {
	allOK = true;
	errorMsg = "Problemas con la información de la categoría:";
	
	currentForm = eval("document."+frmName);
	if (currentForm.txtDescripcion.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe ingresar el nombre o descripción de la categoría";
	}
	if (!allOK) {
		vbMsgError(errorMsg);
	}
	return (allOK);
}

function cmdInsertarCategoria() {
	if (checkCamposCategoria('insertar')) {
		currentForm = document.insertar;
		currentForm.cmdInsertar.value = 1;
		currentForm.submit();
	}
}

function cmdModificarCategoria() {
	if (checkCamposCategoria('modificar')) {
		currentForm = document.modificar;
		currentForm.cmdModificar.value = 1;
		currentForm.submit();
	}
}

function eliminarCategoria(cod) {
	if (confirm("Está a punto de eliminar una categoría. ¿Está seguro? (Si hay películas asociadas a la categoría, ésta no podrá ser eliminada)")) {
		currentForm = document.mantenimiento;
		currentForm.cmdEliminar.value = 1;
		currentForm.codigoActual.value = cod;
		currentForm.submit();
	}
}


//Funciones generalizadas para los mantenimientos------------------------------------------------

function insertar() {
	currentForm = document.mantenimiento;
	currentForm.cmdAddNew.value = 1;
	currentForm.submit();
}

function modificar(cod) {
	currentForm = document.mantenimiento;
	currentForm.cmdModifySelected.value = 1;
	currentForm.codigoActual.value = cod;
	currentForm.submit();
}

function facturar(cod) {
	currentForm = document.facturar;
	currentForm.cmdModifySelected.value = 1;
	currentForm.codigoActual.value = cod;
	currentForm.submit();}
	
function nueva() {
	currentForm = document.facturar;
	currentForm.cmdNueva.value = 1;
	currentForm.submit();
}

function activar (cod, status) {
	currentForm = document.mantenimiento;
	currentForm.cmdActivar.value = 1;
	currentForm.codigoActual.value = cod;
	currentForm.activeStatus.value = status;
	currentForm.submit();
}

function destacar (cod, status) {
	currentForm = document.mantenimiento;
	currentForm.cmdDestacar.value = 1;
	currentForm.codigoActual.value = cod;
	currentForm.activeStatus.value = status;
	currentForm.submit();
}

function cmdCancelar(formName) {
	currentForm = eval("document."+formName);
	currentForm.submit();
}

function cmdCancelarFacturaVenta(formName) {
	currentForm = eval("document."+formName);
	currentForm.Cancelar.value=1;
	currentForm.submit();
}

function cmdLimpiar(formName) {
	currentForm = eval("document."+formName);
	currentForm.reset();
}

function filtrar() {
	currentForm = document.mantenimiento;
	currentForm.cmdFiltrar.value = 1;
	currentForm.submit();
}

//Funciones globales----------------------------------------------------------------------

function activateField (valor, nombreForm, cual) {
	eval("document."+nombreForm+"."+cual+".disabled = "+!valor+";");
	eval("document."+nombreForm+"."+cual+".value = '';");
}

function activateCombo (valor, nombreForm, cual) {
	eval("document."+nombreForm+"."+cual+".disabled = "+!valor+";");
	eval("document."+nombreForm+"."+cual+".value = -1;");
}

//Ventanas Pop-Up ------------------------------------------------------------------------

function abrirVentana (pagina, nombre, width, height) {
	var address = pagina; //dirección de la página
	var op_tool = 0;  //barra de herramientas
	var op_loc_box = 0; //barra de direcciones
	var op_dir =  0; //vinculos/links
	var op_stat = 1;  //barra de estado  
	var op_menu = 0; //barra de menú
	var op_scroll = 1; //visibilidad de scrolls
	var op_resize = 0; //permitir cambiar el tama&ntilde;o de la ventana
	if (width == "" || width == undefined) {
		var op_wid = 500; //ancho de la ventanta
	}
	else {
		var op_wid = width; //ancho de la ventanta
	}
	if (height == "" || height == undefined) {
		var op_heigh = 500; //alto de la ventana
	}
	else {
		var op_heigh = height; //alto de la ventana
	}
	var option = "toolbar=" + op_tool + ",location=" + op_loc_box + ",directories=" + op_dir + ",status=" + op_stat 
	+ ",menubar=" + op_menu + ",scrollbars="  + op_scroll + ",resizable=" + op_resize 
	+ ",width=" + op_wid + ",height=" + op_heigh;
	//var win3 = window.open("", "FotoGaleria", option);  
	//alert(address);

	var newWindow = window.open(address, nombre, option);
	window.opener = self;
	newWindow.moveTo(screen.width/2 - (op_wid/2), screen.height/2-(op_heigh/2));
	newWindow.focus();
}

//Javascript & VBScript compatibility--------------------------------------------------

function callVBMsgError (msg) {
	vbMsgError (msg);
}

function callVBMsgInfo (msg) {
	vbMsgInfo (msg);
}

function callVBMsgWarning (msg) {
	vbMsgWarning (msg);
}

function callVBMsgConfirm (msg) {
	vbMsgConfirm (msg);
}

//------------------------------------------------------------

/*
function checkDatos() {
	currentForm = document.infoOrden;
	allOK = true;
	errorMsg = "Problemas con el envío de la información:";
	
	if (currentForm.txtNombre.value == "") {
		errorMsg = errorMsg + "\n-Debe digitar su nombre completo";
		allOK = false;
	}
	if (currentForm.txtCorreo.value == "") {
		allOK = false;
		errorMsg = errorMsg + "\n-Debe proporcionar una dirección de correo electrónico";
	}
	else {
		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
		strEmail = currentForm.txtCorreo.value;
		if (strEmail.search(validRegExp) == -1) {
			allOK = false;
			errorMsg = errorMsg + "\n-El correo electrónico proporcionado parece no ser válido";
		}
	}
	if (currentForm.txtDireccion.value == "") {
		errorMsg = errorMsg + "\n-Debe digitar su dirección física";
		allOK = false;
	}
	if (currentForm.txtTelHabitacion.value == "" && currentForm.txtTelOficina.value == "" && currentForm.txtTelCelular.value == "") {
		errorMsg = errorMsg + "\n-Debe digitar al menos un número telefónico donde podamos contactarle";
		allOK = false;
	}
	if (!currentForm.chkTerminos.checked) {
		errorMsg = errorMsg + "\n-Debe aceptar los términos y condiciones para poder enviar su pedido";
		allOK = false;
	}
	
	if (!allOK) {
		vbMsgError (errorMsg);
	}
	return (allOK);
}

function enviar () {
	if (checkDatos()) {
		currentForm = document.infoOrden;
		currentForm.cmdCompleto.value = 1;
		currentForm.submit();
	}
}
*/