

function validaForo(accion){
	
	var nombre = document.getElementById("nombre");
	var descripcion = document.getElementById("descripcion");
	document.getElementById("accion").value=accion;
	if(nombre.value==""){
		alert("Debe ingresar un nombre para el foro");
		return false;
	}
	if(descripcion.value==""){
		alert("Debe ingresar una descripción para el foro");
		return false;
	}
	return true;
}

function envioPaginaForo(idForm,act,met, hiddens, params){
	
	var arrHiddens = hiddens.split(";");
	var arrParams = params.split(";");
	for(i=0; i< arrHiddens.length; i++){
		
		document.getElementById(arrHiddens[i]).value=arrParams[i];
		//alert(document.getElementById(arrHiddens[i]).value);
	}
	var frm = document.getElementById(idForm);
	frm.action = act;
	frm.method = met;
	
	
	frm.submit();
}

function validaCambioEstadoForo(){
	var estado = document.getElementById("estadosForo");
	//alert(estado.options[estado.selectedIndex].text);
	document.getElementById("strEstado").value = estado.options[estado.selectedIndex].text;
	document.getElementById("accion").value=4;
	if(confirm(" Esta seguro que desea "+estado.options[estado.selectedIndex].text+" el foro?")){
		if(estado.value==-1){
			document.getElementById("accion").value=3;
			
		}
		document.getElementById("formForo").submit();
		
	}
}

function validaTema(accion){
	
	var nombre = document.getElementById("nombre");
	var descripcion = document.getElementById("descripcion");
	document.getElementById("accion").value=accion;
	var contador = document.getElementById("contador");
	if(nombre.value==""){
		alert("Debe ingresar un nombre para el tema");
		return false;
	}
	if(descripcion.value==""){
		alert("Debe ingresar una descripción para el tema");
		return false;
	}
	oEditor = FCKeditorAPI.GetInstance('editorTemas');
     texto= oEditor.GetXHTML(true);
     if(texto==""){
    	 alert("Debe ingresar el contenido del tema");
 		return false;
     }else if(parseInt(contador.value)<0){
    	 alert("Ha excedido la capacidad del contenido");
  		return false;
     }
     //texto=texto.replace(/&/g, "|");
	return true;
}

function validaComentario(accion){
	
	var nombre = document.getElementById("titulo");
	
	document.getElementById("accion").value=accion;
	var contador = document.getElementById("contador");
	if(nombre.value==""){
		alert("Debe ingresar un titulo para el comentario");
		return false;
	}
	
	oEditor = FCKeditorAPI.GetInstance('editorComentarios');
     texto= oEditor.GetXHTML(true);
     if(texto==""){
    	 alert("Debe ingresar el contenido del comentario");
 		return false;
     }else if(parseInt(contador.value)<0){
    	 alert("Ha excedido la capacidad del contenido");
  		return false;
     }
     //texto=texto.replace(/&/g, "|");
	return true;
}


function validaCambioEstadoTema(){
	var estado = document.getElementById("estadosTema");
	//alert(estado.options[estado.selectedIndex].text);
	document.getElementById("strEstado").value = estado.options[estado.selectedIndex].text;
	document.getElementById("accion").value=4;
	if(confirm(" Esta seguro que desea "+estado.options[estado.selectedIndex].text+" el tema?")){
		if(estado.value==-1){
			document.getElementById("accion").value=3;
			
		}
		document.getElementById("formularioTema").submit();
		
	}
}


function validaCambioEstadoComentario(){
	var estado = document.getElementById("estadoComentario");
	//alert(estado.options[estado.selectedIndex].text);
	document.getElementById("strEstado").value = estado.options[estado.selectedIndex].text;
	document.getElementById("accion").value=4;
	if(confirm(" Esta seguro que desea "+estado.options[estado.selectedIndex].text+" el comentario?")){
		if(estado.value==-1){
			document.getElementById("accion").value=3;
			
		}
		document.getElementById("formularioComentario").submit();
		
	}
}


