	//PARA LOS CALENDARIOS
	var numDias = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	
	var _editores=Array();
	var ie = (navigator.userAgent.toLowerCase().indexOf("msie")!=-1)?true:false;
  var cmds  =  ["bold","italic","underline","strikethrough","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist"];

	var op_menu="";
	var op_submenu="";


	function parametros(_form)
		{
		alert(_form.titular.value);
		}
	function iniciaEditor(editor)
		{

		document.getElementById(editor).contentWindow.document.designMode = 'On';
		if (ie)
			{
			document.getElementById(editor).contentWindow.document.attachEvent("onclick",function(){actualizaBarra(editor);actualizaTextArea(editor);},true);
			document.getElementById(editor).contentWindow.document.attachEvent("onkeydown",function(){actualizaBarra(editor);},true);
			document.getElementById(editor).contentWindow.document.attachEvent("onkeyup",function(){actualizaTextArea(editor);},true);

			}
		else
			{
			document.getElementById(editor).contentWindow.document.addEventListener("click",function(){actualizaBarra(editor);actualizaTextArea(editor);},true);
			document.getElementById(editor).contentWindow.document.addEventListener("keydown",function(){actualizaBarra(editor);},true);
			document.getElementById(editor).contentWindow.document.addEventListener("keyup",function(){actualizaTextArea(editor);},true);
			}
		var ta=editor.substring(0,editor.length-4);
		if (document.getElementById(ta).value!="")
			document.getElementById(editor).contentWindow.document.body.innerHTML=document.getElementById(ta).value;
		}

	function actualizaBarra(ifr)
		{
		for (i=0;i<cmds.length ;i++ )
			{
			if (document.getElementById(ifr).contentWindow.document.queryCommandState(cmds[i]))
				document.getElementById("b"+cmds[i]+ifr).className='botonOn';
			else
				document.getElementById("b"+cmds[i]+ifr).className='botonOff';
			}
		}
	function actualizaTextArea(ifr)
		{
		var ta=ifr.substring(0,ifr.length-4);
		document.getElementById(ta).value=document.getElementById(ifr).contentWindow.document.body.innerHTML;
		}

	function cargaTextArea(editor)
		{
		document.getElementById(editor).value=document.getElementById(editor+'_ifr').contentWindow.document.body.innerHTML;
		}

	function dentroBoton(id)
		{
		if (document.getElementById(id).className!='botonOn')
			document.getElementById(id).className='botonEncima';
		}
	function fueraBoton(id)
		{
		if (document.getElementById(id).className=='botonEncima')
			document.getElementById(id).className='botonOff';
		}
	function pulsadoBoton(id,cmd,ifr)
		{
		document.getElementById(ifr).contentWindow.focus();
		switch(cmd)
			{
			case 'NEGRITA':		document.getElementById(ifr).contentWindow.document.execCommand('bold', false, null);break;
			case 'SUBRAYADO':	document.getElementById(ifr).contentWindow.document.execCommand('underline', false, null);break;
			case 'CURSIVA':		document.getElementById(ifr).contentWindow.document.execCommand('italic', false, null);break;
			case 'TACHADO':		document.getElementById(ifr).contentWindow.document.execCommand('strikethrough', false, null);break;
			case 'JUST_IZQ':	document.getElementById(ifr).contentWindow.document.execCommand('justifyleft', false, null);break;
			case 'JUST_DER':	document.getElementById(ifr).contentWindow.document.execCommand('justifyright', false, null);break;
			case 'JUST_CEN':	document.getElementById(ifr).contentWindow.document.execCommand('justifycenter', false, null);break;
			case 'JUST_FULL':	document.getElementById(ifr).contentWindow.document.execCommand('justifyfull', false, null);break;
			case 'LISTA_ORD':	document.getElementById(ifr).contentWindow.document.execCommand('insertorderedlist', false, null);break;
			case 'LISTA_DES':	document.getElementById(ifr).contentWindow.document.execCommand('insertunorderedlist', false, null);break;
			}
/*		
		if (document.getElementById(id).className=='botonOn')
			document.getElementById(id).className='botonOff';
		else
			document.getElementById(id).className='botonOn';
*/
		actualizaBarra(ifr);
//		document.getElementById(ifr).contentWindow.document.focus();

		var elemento = document.getElementById(ifr);
		elemento.contentWindow.focus();

		actualizaTextArea(ifr);
		document.getElementById(ifr).contentWindow.focus();
		}

//FUNCION PARA CALENDARIO
function getMes(mes)
	{
	switch(mes)
		{
		case 0:return 'ENERO';break;
		case 1:return 'FEBRERO';break;
		case 2:return 'MARZO';break;
		case 3:return 'ABRIL';break;
		case 4:return 'MAYO';break;
		case 5:return 'JUNIO';break;
		case 6:return 'JULIO';break;
		case 7:return 'AGOSTO';break;
		case 8:return 'SEPTIEMBRE';break;
		case 9:return 'OCTUBRE';break;
		case 10:return 'NOVIEMBRE';break;
		case 11:return 'DICIEMBRE';break;
		}
	}

////FUNCION PARA ALTA DE USUARIOS - ALUMNOS
function ocultaDatosAlumnos()
	{
	if (document.form.alumno.checked==true)
		{
		td=document.getElementById('email');
		td.style.display='none';
		td=document.getElementById('temail');
		td.style.display='none';
		td=document.getElementById('ttitulo3');
		td.style.display='none';
		td=document.getElementById('ttitulo4');
		td.style.display='none';
		}
	else
		{
		td=document.getElementById('email');
		td.style.display='block';
		td=document.getElementById('ttitulo3');
		td.style.display='block';
		td=document.getElementById('temail');
		td.style.display='block';
		td=document.getElementById('ttitulo4');
		td.style.display='block';
		}
	}


/////////////////////////////////////////////////////////////////////
/////////////////////FUNCIONES ANTERIORES
/////////////////////////////////////////////////////////////////////
function cambia_color(src,color)
	{ 

	celda=document.getElementById(src);
	celda.bgColor=color;
//		src.style.cursor="hand"; 
	}
function subeImagenes()
	{ 
	URL="formSubeImagenes.php";
	popup=window.open(URL,"ventana1","left=200,top=50,width=500,height=500");//,scrollbars=NO");
	popup.focus();
	} 
function subeDocumentos()
	{ 
	URL="formSubeDocumentos.php";
	popup=window.open(URL,"ventana1","left=200,top=50,width=500,height=500");//,scrollbars=NO");
	popup.focus();
	} 

function saltaURL()
	{
	param="?nombre="+document.form.nombre.value;
	param=param+"&nif="+document.form.nif.value;
	param=param+"&direccion="+document.form.direccion.value;
	param=param+"&poblacion="+document.form.poblacion.value;
	param=param+"&codpos="+document.form.codpos.value;
	param=param+"&provincia="+document.form.provincia.value;
	param=param+"&email="+document.form.email.value;
	param=param+"&telefono="+document.form.telefono.value;
	switch(document.form.formaPago.value)
		{
		case "0":
			break;
		case "1":
			param=param+"&formaPago=1";
			break;
		case "2":
			param=param+"&formaPago=2";
			break;
		}
	param=param+"&error=1";
	window.location="formAltaPedidos.php"+param;
	}
function habilitaCombo(valor,comboFuente,comboDestino)
	{
//	var cb1 = eval('document.form.'+ comboFuente.name);
//	var cb2 = eval('document.form.'+ comboDestino.name);
//	alert(comboFuente.value);
	if (comboFuente.value!=valor)
		comboDestino.disabled=false;
	else
		{
		comboDestino.selectedIndex=0;
		comboDestino.disabled=true;
		}
	}
function abreGeneradorEnlaces()
	{ 
	document.form.target='ventanaEnlaces';
	document.form.action='/db/enlaces/private/formAltaEnlaces.php';
	popup=window.open('/db/enlaces/private/formAltaEnlaces.php','ventanaEnlaces','left=200,top=50,width=650,height=350');//,scrollbars=NO");
	popup.focus();
	} 
function muestraFormato()
	{
	switch(document.form.formatoNoticia.selectedIndex)
		{
		case 0:
			document.getElementById("idFormatoNoticia").src='/img/imgSin.gif';
			break;
		case 1:
			document.getElementById("idFormatoNoticia").src='/img/imgDer.gif';
			break;
		case 2:
			document.getElementById("idFormatoNoticia").src='/img/imgIzq.gif';
			break;
		}
	}
function habilitaText(combo,text)
	{
	var obj = document.getElementById(combo);
	var t = document.getElementById(text);
	if (obj.selectedIndex==0)
		{
		t.style.background='#FFFFFF';
		t.disabled=false;
		}
	else
		{
		t.style.background='#DDDDDD';
		t.value="";
		t.disabled=true;
		}
	}	
function cargaGrupo()
	{
	document.form.action="formAltaAvisos.php";
	document.form.method="POST";
	document.form.submit();
	}
function cargaAlumnos()
	{
	document.form.action="formAltaAvisos.php";
	document.form.method="POST";
	document.form.submit();
	}

