<!--

//Validaciones para Centro Comercial

var allsub = false;

function valACarrito(i) {
	var f = document.frmComercial;
	var txtQ = "";
	if (f.cantidad[i].value == null || f.cantidad[i].value == ""){
		alert("Se requiere ingresar la cantidad.");
		f.cantidad[i].focus ();
		return false;
	}
	f.cantidad[i].value = aNumeros0(f.cantidad[i].value);
	if (f.cantidad[i].value <= 0){
		alert("Debe ingresar un valor mayor que cero.");
		f.cantidad[i].focus ();
		return false;
	}
	txtQ += "idProducto=" + f.idProducto[i].value;
	txtQ += "&cantidad=" + f.cantidad[i].value;
	txtQ += "&accion=ins";
	window.navigate("carritoCompras.aspx?" + txtQ);
	return true;
} //end function

function aCarrito(i){
	if ( valACarrito(i) && !allsub ) {
	    	allsub = true;
		return true;	
	}
	return false;
}

function delCarrito(i){
	var f = document.frmComercial;
	var txtQ = "";
	txtQ += "idProducto=" + f.idProducto[i].value;
	txtQ += "&accion=del";
	window.navigate("carritoCompras.aspx?" + txtQ);
	return true;
}

function pagarCompra(boton, servidor){
	submitPagina(boton,servidor+"/Respuestas/pagoCarrito.aspx");
	return true;
}

function verListaProductos(){
	var f = document.aspnetForm;
	var pars = "";
	var destino = "";
	var idE = "";
	idE = leerCampo(f,"idEstablecimiento");
	/*
	if (f.ctl00$contenido$idEstablecimiento != null)
	    idE = f.ctl00$contenido$ddlEstablecimientos.value;
	if (idE == null && f.ctl00_contenido_ddlEstablecimientos != null)
	    idE = f.ctl00_contenido_ddlEstablecimientos.value;
	if (idE == null || idE == "")
	    idE =idEstablecimiento;
	*/
	destino = "/Respuestas/listaProductos.aspx?idEstablecimiento=" + idE;
	nombre = "productos";
	pars = "menubar=0,toolbar=0,scrollbars=1,resizable=1," +
			"width=520,height=550,left=20,top=20,status=0,location=0";
	//alert("abrirInforme " + destino + "?tipoConsulta=" + forma.ddlConsulta.value);
	window.open(destino, nombre, pars);
	return false;
}

function valProducto() {
	var txtNumi = new String ();
	var txtNumi2 = new String ();
	var numi = new Number ();
	var numi2 = new Number ();	
	var txtDia = ""; 
	var txtMes = "";
	var numAnno = "";
	var esFechaCorrecta = new Boolean();	
	var esEmailValido = false;
	var esEmailValidoNuevo = false;
	var f = document.frmProducto;
	//alert("verifica sbmit");
	
	if (f.refAntes.value != f.txtReferencia.value)
		return true;
	if (f.idEstablecimiento.value != f.ddlEstablecimientos.value)
		return true;
	
	with (f){
		if (txtReferencia.value == null || txtReferencia.value == ""){
			alert("Se requiere ingresar la referencia del producto.");
			txtReferencia.focus ();
			return false;
		}
		if (txtNombre.value == null || txtNombre.value == ""){
			alert("Se requiere ingresar el nombre del producto.");
			txtNombre.focus ();
			return false;
		}
		txtNumi = aNumeros(txtValor.value);
		numi = txtNumi;
		txtValor.value = numi;	
		if (txtValor.value == 0){
			if (!confirm("Está seguro de publicar su producto con valor cero (0)?")){
			    txtValor.focus ();
			    return false;
			}
		}
		if (txtDescripcion.value == null || txtDescripcion.value == "") {
			alert("Se requiere la descripción corta del producto.");
			txtDescripcion.focus ();
			return false;
		}	
		if (lstCategoria.value == null || lstCategoria.value == "") {
			alert("Se requiere escoger al menos una categoría no nula.");
			lstCategoria.focus ();
			return false;
		}	
		listoGuardar.value = 1;
		return true;
	}//end with
} //end function

function chkSbmitProducto() 
{
	if ( valProducto() && !allsub ) {
	    	allsub = true;
   		return true;	
	}
	return false;
}

//-->

