function fValidarMensaje (strIr,intTema){
	if (intTema == "1"){
		if (document.frmMensaje.txtTitulo.value==""){alert(fM("IntroduzcaTitulo"));return;}
	}
	if (document.frmMensaje.txtMensaje.value==""){alert(fM("IntroduzcaTextoMensaje"));return;}
	
	if(strIr == "v"){
		if (document.frmMensaje.txtFichero.value!=""){
			alert(fM("NoPrevisualizarConFichero"));return;
		}else{
			document.frmMensaje.action="index.php?pg=4";
		}
	}else{
		document.frmMensaje.action="index.php?pg=5";
	}
	
	document.frmMensaje.submit();
}
//***************************************
function fIrAForo (){
	intForo = document.frmPie.CodForo.value;
	location.href='index.php?pg=2&CodForo='+intForo;
}
//***************************************
function fAseguraBorrarMensaje (intForo,intMensaje){
	if(confirm(fM("SeguroBorrarMensaje"))){
		location.href = 'index.php?pg=7&CodForo='+intForo+'&CodMensaje='+intMensaje;
	}else{return;}
}
//***************************************
function fAseguraBorrarAdjunto (intForo,intMensaje){
	if(confirm(fM("SeguroBorrarAdjunto"))){
		location.href = 'index.php?pg=9&CodForo='+intForo+'&CodMensaje='+intMensaje;
	}else{return;}
}
//***************************************
function fCorregir (){
	document.frmMensaje.action="index.php?pg=3&Corregir=1";
	document.frmMensaje.submit();
}
//***************************************
function fValidarForo (strTipo,intModerador){
	if(document.frmNuevo.txtNombre.value==""){alert(fM("IntroduzcaNombre"));return;}
	if(document.frmNuevo.txtDescripcion.value==""){alert(fM("IntroduzcaDescripcion"));return;}
	strInicio = document.frmNuevo.txtInicio.value;
	strFin = document.frmNuevo.txtFin.value;
	if (strInicio != ""){
		if(!fValidarDia(strInicio)){return;}
		if (strFin != ""){
			if(!fValidarDia(strFin)){return;}
			if(!fValidarFechas(strInicio,strFin)){return;}
		}
	}else{
		if (strFin != ""){
			if (strInicio == ""){alert(fM("IntroduzcaFechaInicio"));return;}
		}
	}
	if (strTipo == "g"){//GUARDA el foro
		document.frmNuevo.submit();
	}else{
		if(strTipo == "a"){//Guarda el foro y AŅADE un moderador
			document.frmNuevo.hdnAnhadir.value=1;
			if(intModerador != ""){
				document.frmNuevo.action = "index.php?pg=3&CodModerador="+intModerador;
			}
			document.frmNuevo.submit();
		}else{
			if(strTipo == "b"){//Guarda el foro y BORRAR los moderadores seleccionados
				if(confirm(fM("SeguroQuitarModeradores"))){
					document.frmNuevo.hdnAnhadir.value=2;
					document.frmNuevo.submit();
				}else{return;}
			}
		}
	}
}
//***************************************
function fQuitarModeradores (intForo){
	intCuantos = document.frmModeradores.Cuantos.value;
	i=0;
	sw=0;
	if (intCuantos=="1"){if (document.frmModeradores.chkModerador.checked){sw=1;}
	}else{
		while (i<intCuantos){
			if (document.frmModeradores.chkModerador[i].checked){sw=1;}
			i++;
		}
	}
	if (sw=="1"){
		if (confirm(fM("SeguroQuitarModeradores"))){
			document.frmModeradores.action = 'index.php?pg=7&CodForo='+intForo;
			document.frmModeradores.submit();
		}else{return;}
	}else{alert(fM("SeleccioneModeradoresQuitar"));return;}
}
//***************************************
function fAseguraBorrarForos (){
	intCuantos = document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	strForos = "";
	if (intCuantos=="1"){
		if (document.frmLista.chkForo.checked){
			sw=1;
			strForos = document.frmLista.chkForo.value;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.chkForo[i].checked){
				if (sw==0){
					strForos = document.frmLista.chkForo[i].value;
				}else{
					strForos = strForos + "," + document.frmLista.chkForo[i].value;
				}
				sw=1;
			}
			i++;
		}
	}
	document.frmLista.hdnForos.value = strForos;
	if (sw=="1"){
		if (confirm(fM("SeguroBorrarForos"))){document.frmLista.submit();}
		else{return;}
	}else{alert(fM("SeleccioneForosBorrar"));return;}
}
//***************************************
function fValidarSeleccion (){
	intCuantos = document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	if (intCuantos=="1"){
		if (document.frmLista.chkForo.checked){
			intCodForo = document.frmLista.chkForo.value;
			sw++;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.chkForo[i].checked){
				intCodForo = document.frmLista.chkForo[i].value;
				sw++;
			}
			i++;
		}
	}
	if (sw=="0"){alert(fM("SeleccioneForo"));return;}
	else{
		if (sw>"1"){alert(fM("SeleccioneSoloUnForo"));return;}
		else{
			location.href = 'index.php?pg=9&CodForo='+intCodForo;
		}
	}
}
//***************************************
function fBorrarTemas()
{	intCuantos=document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	if (intCuantos=="1"){
		if (document.frmLista.chkTema.checked){
			intCodTema=document.frmLista.chkTema.value;
			sw++;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.chkTema[i].checked){
				intCodTema=document.frmLista.chkTema[i].value;
				sw++;
			}
			i++;
		}
	}
	if (sw=="0"){alert(fM("SeleccioneTemasBorrar"));return;}
	else{
		if (confirm(fM("SeguroBorrarTemas"))){document.frmLista.submit();}
		else{return;}
	}
}
//***************************************
function fAseguraBorrarTema(intForo,intTema){
	if(confirm(fM("SeguroBorrarTema"))){
		location.href = 'index.php?pg=13&chkTema='+intTema+'&CodForo='+intForo;
	}else{return;}
}
//***************************************
function fAseguraBorrarMensajeMant(intForo,intMensaje){
	if(confirm(fM("SeguroBorrarMensaje"))){
		location.href = 'index.php?pg=12&Mant=1&CodForo='+intForo+'&CodMensaje='+intMensaje;
	}else{return;}
}
//***************************************
function fValidarAnhadirUsuarios (){
	intCuantos = document.frmUsuarios.Cuantos.value;
	strUsuarios = "";
	i=0;
	sw=0;
	if (intCuantos=="1"){if (document.frmUsuarios.chkUsuario.checked){
		sw=1;
		strUsuarios = document.frmUsuarios.chkUsuario.value;
	}
	}else{
		while (i<intCuantos){
			if (document.frmUsuarios.chkUsuario[i].checked){
				if (sw==0){
					strUsuarios = document.frmUsuarios.chkUsuario[i].value;
				}else{
					strUsuarios = strUsuarios + "," + document.frmUsuarios.chkUsuario[i].value;
				}
				sw=1;
			}
			i++;
		}
	}
	document.frmUsuarios.hdnUsuarios.value = strUsuarios;
	if (sw!="1"){alert(fM("SeleccioneUsuariosAnhadir"));return;}
	document.frmUsuarios.submit();
}
//***************************************
function fLimpiarBuscadorModeradores (){
	document.frmBuscar.txtNombre.value = "";
	document.frmBuscar.cboNivel.value = "WEB";
	return;
}