function fValidarDatosProveedor (intNuevo,intTipo){
	if(document.frmNuevo.txtNombre.value==""){alert(fM("IntroduzcaNombre"));return;}
	if(document.frmNuevo.txtEmail.value==""){alert(fM("IntroduzcaEmail"));return;}
	if (intNuevo==""){
		if(document.frmNuevo.txtLogo.value==""){alert(fM("IntroduzcaLogoProveedor"));return;}
	}
	if (document.frmNuevo.txtWai.value=="" || document.frmNuevo.txtDWai.value==""){
		alert(fM("IntroduzcaWaiFoto"));return;
	}
	if(document.frmNuevo.txtDescripcion.value==""){alert(fM("IntroduzcaDescripcion"));return;}
	document.frmNuevo.Donde.value=intTipo;
	document.frmNuevo.submit();
}
//*****************************************
function fCambiarEstado (intCodProveedor,intEstado){
	if (intEstado == "1"){
		intEstado = 0;
	}else{
		intEstado = 1;
	}
	location.href='index.php?pg=4&CodProveedor='+intCodProveedor+'&Estado='+intEstado;
}
//*****************************************
//***************************************** FAMILIAS
function fValidarDatosFamilia (intTipo){
	if(document.frmNuevo.CodProveedor.value=="0"){alert(fM("SeleccioneProveedor"));return;}
	if(document.frmNuevo.txtNombre.value==""){alert(fM("IntroduzcaNombre"));return;}
	document.frmNuevo.Donde.value=intTipo;
	document.frmNuevo.submit();
}
//*************************************
function fAseguraBorrarFamilias (){
	intCuantos=document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	strFamilias="";
	if (intCuantos=="1"){
		if (document.frmLista.chkFamilia.checked){
			sw=1;
			strFamilias = document.frmLista.chkFamilia.value;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.chkFamilia[i].checked){
				if (sw==0){
					strFamilias = document.frmLista.chkFamilia[i].value;
				}else{
					strFamilias = strFamilias + "," + document.frmLista.chkFamilia[i].value;
				}
				sw=1;
			}
			i++;
		}
	}
	document.frmLista.hdnFamilias.value = strFamilias;
	if (sw=="1"){
		if (confirm(fM("SeguroBorrarFamiliasIdioma"))){document.frmLista.submit();}
		else{return;}
	}else{alert(fM("SeleccioneFamiliasBorrar"));return;}	
}
//****************************************
function fAsegurarBorrarFamilia (strCodIdioma){
	if (confirm(fM("SeguroBorrarFamilia"))){
		document.frmNuevo.action='index.php?pg=8&CodIdioma='+strCodIdioma;
		document.frmNuevo.submit();
	}else{return;}
}
//*****************************************
//***************************************** PRODUCTOS
function fValidarDatosProducto (){
	if(document.frmNuevo.CodFamilia.value=="0"){alert(fM("SeleccioneFamilia"));return;}
	if(document.frmNuevo.txtCod.value==""){alert(fM("IntroduzcaCodigoProducto"));return;}
	if(document.frmNuevo.txtNombre.value==""){alert(fM("IntroduzcaNombre"));return;}
	if(document.frmNuevo.txtFoto.value!=""){
		if (document.frmNuevo.txtWai.value=="" || document.frmNuevo.txtDWai.value==""){
			alert(fM("IntroduzcaWaiFoto"));return;
		}
	}
	if(document.frmNuevo.txtPrecio.value==""){alert(fM("IntroduzcaPrecio"));return;}
	else{if (isNaN(document.frmNuevo.txtPrecio.value)){alert(fM("PrecioIncorrecto"));return;}}
	if(document.frmNuevo.txtDescripcion.value==""){alert(fM("IntroduzcaDescripcion"));return;}
	document.frmNuevo.submit();
}
//*************************************
function fAseguraBorrarProductos (){
	intCuantos=document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	strProductos="";
	if (intCuantos=="1"){
		if (document.frmLista.chkProducto.checked){
			sw=1;
			strProductos = document.frmLista.chkProducto.value;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.chkProducto[i].checked){
				if (sw==0){
					strProductos = document.frmLista.chkProducto[i].value;
				}else{
					strProductos = strProductos + "," + document.frmLista.chkProducto[i].value;
				}
				sw=1;
			}
			i++;
		}
	}
	document.frmLista.hdnProductos.value = strProductos;
	if (sw=="1"){
		if (confirm(fM("SeguroBorrarProductosIdioma"))){document.frmLista.submit();}
		else{return;}
	}else{alert(fM("SeleccioneProductosBorrar"));return;}	
}
//****************************************
function fAsegurarBorrarProducto (intCodProducto,strCodIdioma,intCodProveedor){
	if (confirm(fM("SeguroBorrarDocumento"))){
		location.href='index.php?pg=14&CodProducto='+intCodProducto+'&CodIdioma='+strCodIdioma+'&CodProveedor='+intCodProveedor;
	}else{return;}
}
//*****************************************
//***************************************** WEB
function fValidarUnidades (intCual){
	intUnidades = eval('document.frmProducto'+intCual+'.txtUnidades.value');
	if (intUnidades=="" || intUnidades=="0"){alert(fM("IntroduzcaUnidades"));return false;}
	if (isNaN(intUnidades)){alert(fM("UnidadesIncorrectas"));return false;}
	return true;
}
//*****************************************
function fValidarUnidadGuardar (intCodLinea){
	intUnidades = eval('document.frmPedido.txtUnidades'+intCodLinea+'.value');
	if (intUnidades=="" || intUnidades=="0"){alert(fM("IntroduzcaUnidades"));return;}
	if (isNaN(intUnidades)){alert(fM("UnidadesIncorrectas"));return;}
	document.frmPedido.action="index.php?pg=8&CodLinea="+intCodLinea;
	document.frmPedido.submit();
}
//*****************************************
function fAseguraCancelarPedidoTemp (){
	if(confirm(fM("SeguroCancelarPedido"))){
		location.href='index.php?pg=7';
	}else{return;}
}
//*****************************************
function fAseguraBorrarProductosTemp (){
	intCuantas=document.frmPedido.Cuantas.value;
	i=0;
	sw=0;
	if (intCuantas=="1"){
		if (document.frmPedido.chkLinea.checked){
			sw=1;
		}
	}else{
		while (i<intCuantas){
			if (document.frmPedido.chkLinea[i].checked){
				sw=1;
			}
			i++;
		}
	}
	if (sw=="1"){
		if (confirm(fM("SeguroBorrarProductosTemp"))){
			document.frmPedido.action="index.php?pg=6";
			document.frmPedido.submit();
		}else{return;}
	}else{alert(fM("SeleccioneProductosQuitar"));return;}
}
//*****************************************
function fAseguraEnviarPedido (){
	if(confirm(fM("SeguroEnviarPedido"))){
		location.href='index.php?pg=9';
	}else{return;}
}

