function cargapagina(codmenu,idioma)
{
  sendRequestVariables(codmenu,idioma);
}
function recarga()
{
  codelemento=document.getElementById('codmenu');
  codmenu=codelemento.value;
  codelemento=document.getElementById('idiomas');
  idiomas=codelemento.value;
  codelemento=document.getElementById('nivel');
  nivel=codelemento.value;
  codelemento=document.getElementById('tipocontenido');
  tipocontenido=codelemento.value;
  codelemento=document.getElementById('nivel1');
  nivel1=codelemento.value;
  codelemento=document.getElementById('nivel2');
  nivel2=codelemento.value;
  codelemento=document.getElementById('nivel3');
  nivel3=codelemento.value;
  codelemento=document.getElementById('nombre1');
  nombre1=codelemento.value;
  codelemento=document.getElementById('nombre2');
  nombre2=codelemento.value;
  codelemento=document.getElementById('nombre3');
  nombre3=codelemento.value;
  codelemento=document.getElementById('idblog');
  idblog=codelemento.value;
  sendRequestMenu(codmenu,idiomas,nivel,nivel1,nivel2,nivel3,nombre1,nombre2,nombre3);
  sendRequestMenuPpal(codmenu,idiomas,nivel,nivel1);
  if(idblog==0)
	sendRequest(codmenu,idiomas,nivel,tipocontenido); 
  else
	sendRequestContenidoBlog(codmenu,idiomas,nivel,tipocontenido,idblog); 	
  sendRequestIndicador(codmenu,idiomas,nivel,nivel1,nivel2,nivel3,nombre1,nombre2,nombre3);
}
function escribeCapa(capa,texto){ 
//texto=formulario.caja.value; 
document.getElementById(capa).innerHTML=texto; 
} 
function resalta(objeto,i)
{
  capa=document.getElementById(objeto); 
  //capa.style['background']='#CCEBF9';
  if(i<10)
  {
    i=i+1;
    capa.style['left']=i+"px";
    setTimeout("resalta('"+objeto+"',"+i+")",2);
  }
}
function resalta1(objeto,i,n,pre)
{
  for(j=1;j<=n;j++)
  {
    elemento=document.getElementById('tercer'+pre+'_'+j); 
	elemento.style['background']='';
  }
  capa=document.getElementById(objeto); 
  capa.style['background']='#CCEBF9';
  if(i<10)
  {
    i=i+1;
    capa.style['left']=i+"px";
    setTimeout("resalta('"+objeto+"',"+i+")",2);
  }
}
function resalta2(objeto,i,n,pre)
{
  capa=document.getElementById(objeto); 
  capa.style['background']='#CCEBF9';
  if(i<10)
  {
    i=i+1;
    capa.style['left']=i+"px";
    setTimeout("resalta('"+objeto+"',"+i+")",2);
  }
}
function devuelve(objeto,i)
{
  capa=document.getElementById(objeto); 
  //capa.style['background']='';
  if(i>0)
  {
    i=i-1;
    capa.style['left']=i+"px";
    setTimeout("devuelve('"+objeto+"',"+i+")",2);
  }
}
function selecciona(tabla,obj) {
  tab=document.getElementById(tabla);  
  for (i=0; ele=tab.getElementsByTagName('td')[i]; i++) {
    ele.style.background = '#FFFFFF';
  }
  fila=document.getElementById(obj);  
  fila.style.background = '#CCEBF9';
}
function limpia(tabla) {
  tab=document.getElementById(tabla);  
  for (i=0; ele=tab.getElementsByTagName('td')[i]; i++) {
    ele.style.background = '#FFFFFF';
  }
}
function hacerollover(objeto)
{
  elemento=document.getElementById(objeto); 
  elemento.style['background-image']='url(imagenes/boton5.gif);';
}
function evaluapalabra()
{
if ((document.getElementById('palabrabusqueda').value!='')&&(document.getElementById('palabrabusqueda').value.length>2)) 
  cargapagina('586',document.getElementById('idiomas').value);
else
{
  document.getElementById('palabrabusqueda').value='';
  alert('Para realizar una búsqueda debe colocar una palabra de 3 o más caracteres.');
}
}
function evaluapalabra1()
{
if ((document.getElementById('palabrabusqueda').value!='')&&(document.getElementById('palabrabusqueda').value.length>2)) 
  a=1;
else
{
  document.getElementById('palabrabusqueda').value='';
}
}
function envia()
{
}
function abre() 
{
  ancho=window.screen.width-10;
  alto=window.screen.height-50;
  if(ancho<1000)
    esnuvi=open("http://www.envirtual.comunidadescuelanueva.org/index0.php","PROYECT","toolbar=no,directories=no,menubar=no,status=no,height="+alto+",width="+ancho+",top=0,left=0,scrollbars=yes");
  else
    esnuvi=open("http://www.envirtual.comunidadescuelanueva.org/index0.php","PROYECT","toolbar=no,directories=no,menubar=no,status=no,height="+alto+",width="+ancho+",top=0,left=0,scrollbars=no");
  return true
}

function colocatitle()
{
    if(document.getElementById('idiomas').value==1)
      nombrefundacion='Fundación Escuela Nueva Volvamos a la Gente';
	else
      nombrefundacion='Escuela Nueva Foundation';	
  
	if(document.getElementById('nivel').value==1)
	  document.title=document.getElementById('nombre1').value+' - '+nombrefundacion;
	else if(document.getElementById('nivel').value==2)
	  document.title=document.getElementById('nombre2').value+' - '+nombrefundacion;
	else if(document.getElementById('nivel').value==3)
	  document.title=document.getElementById('nombre3').value+' - '+nombrefundacion;	
	else
	  document.title=nombrefundacion;	
}

var tipocambiohistorial=0;
var llamadohistorial=0;
function PromptMe() {
	var stateVar = "nothin'", displayDiv = document.getElementById("HistoryState");
	this.historyListener = function(historyHash) {
	stateVar = historyHash;
	if(tipocambiohistorial==0)
	{
	  var valor=new String(historyHash);
	  if(valor.length>16)
	  {
		  var codmenu='';
		  var idioma='';
		  var etapa=0;
		  var i=0;
		  for(i=0;i<=valor.length-1;i++)
		  {
			codigo=valor.charCodeAt(i);
			if((codigo==61)&&(etapa==0)) 
			{
			  etapa=1;
			}
			else if((codigo==38)&&(etapa==1)) 
			{
			  etapa=2;
			}	
			else if((codigo==61)&&(etapa==2)) 
			{
			  etapa=3;
			}		
			else if(etapa==1)
			{
			  codmenu = codmenu + valor.charAt(i);
			}		
			else if(etapa==3)
			{
			  idioma = idioma + valor.charAt(i);
			}		
		  }
		  llamadohistorial=1;
		  sendRequestLinks(codmenu,idioma); 
		  sendRequestSuperior(codmenu,idioma);
		  cargapagina(codmenu,idioma);
      }	
	}
	else
	  tipocambiohistorial=0;
	};
	unFocus.History.addEventListener('historyChange', this.historyListener);
	//this.historyListener(unFocus.History.getCurrent());
};

function RecogeHash()
{
  var valor=new String(location.hash);
  if(valor.length>16)
  {
	  var codmenu='';
	  var idioma='';
	  var etapa=0;
	  var i=0;
	  for(i=0;i<=valor.length-1;i++)
	  {
		codigo=valor.charCodeAt(i);
		if((codigo==61)&&(etapa==0)) 
		{
		  etapa=1;
		}
		else if((codigo==38)&&(etapa==1)) 
		{
		  etapa=2;
		}	
		else if((codigo==61)&&(etapa==2)) 
		{
		  etapa=3;
		}		
		else if(etapa==1)
		{
		  codmenu = codmenu + valor.charAt(i);
		}		
		else if(etapa==3)
		{
		  idioma = idioma + valor.charAt(i);
		}		
	  }
	  llamadohistorial=1;
	  location.replace('index.php?codmenu='+codmenu+'&idioma='+idioma);
	  //sendRequestLinks(codmenu,idioma); 
	  //sendRequestSuperior(codmenu,idioma);
	  //cargapagina(codmenu,idioma);
  }	
}

var demoApp;