function MostrarElemento (Elemento) {
	document.getElementById(Elemento).style.visibility = "visible";
}

function OcultarElemento (Elemento) {
	document.getElementById(Elemento).style.visibility = "hidden";
}

function MostrarListadoElementos(v) {
	var tmp = v.split(",");
	for (i=0;i<tmp.length;i++)
		MostrarElemento(tmp[i]);
}

function OcultarListadoElementos(v) {
	var tmp = v.split(",");
	for (i=0;i<tmp.length;i++)
		OcultarElemento(tmp[i]);
}

/* ---------------------------------------------------------------------- */
function ElementoAbsoluto (Elemento) {
	document.getElementById(Elemento).style.position ="absolute";
}

function ElementoRelativo (Elemento) {
	document.getElementById(Elemento).style.position = "relative"
}

function ListadoElementosAbsolutos(v) {
	var tmp = v.split(",");
	for (i=0;i<tmp.length;i++)
		ElementoAbsoluto(tmp[i]);
}

function ListadoElementosRelativos(v) {
	var tmp = v.split(",");
	for (i=0;i<tmp.length;i++)
		ElementoRelativo(tmp[i]);
}



function MostrarZonaDinamica(capa,contenido){
	document.getElementById(capa).innerHTML=contenido;
}


/* ---------------------------------------------------------------------- */

/* ---------------------------------------------------------------------- */
/* ********************************************************************************************************************************** */


function Mostrar_AspectoMensajeForo(campo_formulario,elemento){
/*
	Campo_Aux = campo_formulario;
	if (Campo_Aux.value == "[b]" || Campo_Aux.value == "[B]") {Campo_Aux.value = '<B>';}


	if( campo_formulario.value ){ elemento.innerHTML = Campo_Aux.value;}
	else {elemento.innerHTML = '';}
*/
}



/* FUNCION PARA INTRODUCIR EN EL MENSAJE EL FORMATO (NEGRITA, CURSIVA, LINK, IMAGEN,... */
function InsertarTags(tagOpen, tagClose, sampleText) {
	var txtarea = document.foro_formulario.foro_editor;
	// IE
	if(document.selection) {
		var theSelection = document.selection.createRange().text;
		if(!theSelection) { theSelection=sampleText;}
		txtarea.focus();
		if(theSelection.charAt(theSelection.length - 1) == " "){
			theSelection = theSelection.substring(0, theSelection.length - 1);
			document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
		} else {
			document.selection.createRange().text = tagOpen + theSelection + tagClose;
		}
	// Mozilla
	} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		var myText = (txtarea.value).substring(startPos, endPos);
		if(!myText) { myText=sampleText;}
		if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
			subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " "; 
		} else {
			subst = tagOpen + myText + tagClose; 
		}
		txtarea.value = txtarea.value.substring(0, startPos) + subst + txtarea.value.substring(endPos, txtarea.value.length);
		txtarea.focus();
		var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
		txtarea.selectionStart=cPos;
		txtarea.selectionEnd=cPos;
	// All others
	} else {
		tagOpen=tagOpen.replace(/\n/g,"");
		tagClose=tagClose.replace(/\n/g,"");
		document.infoform.infobox.value=tagOpen+sampleText+tagClose;
		txtarea.focus();
	}
	if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}

function Verificar(){
	if(document.getElementById('foro_formulario').nombre.value==""){alert("Debes indicar un nombre");document.foro_formulario.nombre.focus();return false}
	if(document.getElementById('foro_formulario').subject.value==""){alert("Debes indicar un asunto");document.foro_formulario.subject.focus();return false}

	var Num_Max_Caracteres = 80;
	Mensaje = document.getElementById('foro_formulario').mensaje.value;
	Vector_Palabras = Mensaje.split(/\s/);

	for (i=0;i<Vector_Palabras.length;i++){
		Num_Caracteres = Vector_Palabras[i].length
		if (Num_Caracteres > Num_Max_Caracteres){
			window.alert("La "+(i+1)+"a. palabra que ha escrito : \n\n'"+Vector_Palabras[i]+"'\n\n es demasiado larga, tiene mas de "+Num_Max_Caracteres+" caracteres.\n\n... USE ESPACIOS EN BLANCO !!!.");return false
		}
	}

	return true;
}

function RAE (){
	
	/* IE */if (document.selection){var Palabra = document.selection.createRange().text;}
	else {var Palabra = document.getSelection();}

	if(!Palabra){void(Palabra=prompt('Palabra que desea consultar:',''))}
	if(Palabra){
		ventana=window.open ('http://buscon.rae.es/draeI/SrvltGUIBusUsual?TIPO_HTML=2&TIPO_BUS=3&LEMA='+escape(Palabra)+' ','DiccionarioRAE','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=490,height=400');
		ventana.focus();
	}
}