tinyMCE.init({
			mode : "exact",
				elements : "texto",
				theme : "advanced",
				plugins : "paste",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_path_location : "bottom",
				file_browser_callback : "mcFileManager.filebrowserCallBack",
				theme_advanced_resize_horizontal : false,
				theme_advanced_resizing : true,
				relative_urls : false,
				theme_advanced_fonts : "Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif",
				content_css : "/example_data/example_full.css"
		});

function focusTiny()
{
tinyMCE.execCommand('mceFocus', false, "mce_editor_0");
}

		
/*******************************************************************************/
/*********** funciones de la validacion de los campos por javascript ***********/


var error="";

function checkForm()
{	
	var _titulo  = document.getElementById('titulo').value;
	var _texto   = document.getElementById('texto').value;
	var _remite  = document.getElementById('remite').value;
	var _email   = document.getElementById('email').value;

	var _ereg_email= /^[^@ ]+@[^@ ]+.[^@ .]+$/;
	var t1=_ereg_email.test(_email);
	
	var flag  = '- ';
	var error = '';
	
	if (_titulo == ""){
		document.getElementById('tituloText').className = 'text error';
		document.getElementById('titulo').className = 'fieldFormError';
		error+= flag+error2;//REMITEVACIO_ERROR_TXT
		flag='<br>- ';
	}else{
		document.getElementById('tituloText').className = 'text';
		document.getElementById('titulo').className = 'fieldForm';
	}
	
	if (_texto == ""){
		document.getElementById('textoText').className = 'text error';
		//document.getElementById('texto').className = 'fieldFormError';
		error+= flag+error3;//REMITEVACIO_ERROR_TXT
		flag='<br>- ';
	}else{
		document.getElementById('textoText').className = 'text';
		//document.getElementById('texto').className = 'fieldForm';
	}
	
	if (_remite == ""){
		document.getElementById('remiteText').className = 'text error';
		document.getElementById('remite').className = 'fieldFormError';
		error+= flag+error4;//REMITEVACIO_ERROR_TXT
		flag='<br>- ';
	}else{
		document.getElementById('remiteText').className = 'text';
		document.getElementById('remite').className = 'fieldForm';
	}
	
	if (_email == "" || !t1){
		document.getElementById('emailText').className = 'text error';
		document.getElementById('email').className = 'fieldFormError';
		error+= flag+error5;//EMAIL_ERROR_TXT
		flag='<br>- ';
	}else{
		document.getElementById('emailText').className = 'text';
		document.getElementById('email').className = 'fieldForm';
	}
	
	
	if (error != "")
	{	
		document.getElementById('error').style.display = '';
		document.getElementById('error').className = 'errorRojoCaja';
		document.getElementById('error').innerHTML = "<span> "+info_error+": <br> </span>";
		document.getElementById('error').innerHTML += error;
		
		return false;			
	}
	else
	{
		document.getElementById('error').style.display = '';
		document.getElementById('error').className = 'infoNaranjaCaja';
		document.getElementById('error').innerHTML = "<span> "+info_enviando+" <br> </span>";
		
		return true;
	}
	
}
















	
	
function checkForm2222(){

	tinyMCE.triggerSave(); //linea para guardar los datos del editor antes de comprobar.

	//var a = new NtsValidator();
	var my_array = new Array;
	var texto=/^[a-zA-Z0-9ñÑçÇ_-]+([ ]*[a-zA-Z0-9ñÑçÇ_-]*)*$/;
	var email= /^[^@ ]+@[^@ ]+.[^@ .]+$/;
	var fecha=/^(0?[1-9]|[12][0-9]|3[01])\/(0?[1-9]|1[012])\/[0-9]{4}/;
	var hora= /^[012]?[0-9]:[0-5][0-9]$/;
	
	var error="";
	
	//var t1=fecha.test(document.formulario.fecha.value);
	var t2=texto.test(document.formulario.titulo.value);
	var t3=texto.test(document.formulario.texto.value);
	var t4=texto.test(document.formulario.remite.value);
	
/*
	if( document.formulario.fecha.value.length<1 || !t1){
		error+=error1+"\n"; //El campo fecha está vacío o es incorrecto.
		my_array['fecha']=false;
	}
	else
		my_array['fecha']=true;*/
	
	if( document.formulario.titulo.value.length<1 ){//|| !t2){
		error+=error2+"\n"; //El campo titulo está vacío. 
		my_array['titulo']=false;
	}
	else
		my_array['titulo']=true;

	if( document.formulario.texto.value.length<1 ){//|| !t3){
		error+=error3+"\n"; //El campo texto está vacío.
		my_array['texto']=false;
	}
	else
		my_array['texto']=true;
	
	if( document.formulario.remite.value.length<1 ){//|| !t4){
		error+=error4+"\n"; //"El campo remite está vacío.
		my_array['remite']=false;
	}
	else
		my_array['remite']=true;
	
	
	if(error!=""){
		
		showErrors(error,my_array);
		return false;
	}
	showErrors('',my_array);
	
	return true;
	
	

}

function showErrors(s,a){

	if(document.getElementById('error2'))
		eval("document.getElementById('error2').className = 'textoError3'");
		
	primero = true;
	for(var i in a) 
		//if( i=='fecha' || i=='titulo' || i=='texto' || i=='remite' ){
		if(i=='titulo' || i=='texto' || i=='remite' ){
			if(!a[i]){
				eval("document.getElementById('"+i+"Text').className = 'textoFormularioError'");
				eval("document.getElementById('"+i+"').className = 'campoFormularioError'");
				if(primero){
					eval("document.getElementById('"+i+"').focus();");
					primero = false;
				}
			}else{
				eval("document.getElementById('"+i+"Text').className = 'textoFormulario'");
				eval("document.getElementById('"+i+"').className = 'campoFormulario'");
			}
		}

	if(error!=null)
		while(error.firstChild != undefined)
			error.removeChild(error.firstChild);
			
	error = document.getElementById('error');
	
	var oo= s.split("\n");
	
	for(i=0;i<oo.length;i++){
		var mySpan = document.createElement('p');
	
		mySpan.setAttribute('class','datosUsuarioError');
	
		var texto=document.createTextNode(oo[i]);
	
		mySpan.appendChild(texto);
	
		error.appendChild(mySpan);
	}
	location.href="#";

}
