
title = new Object();
desc = new Object();
links= new Object();
matched= new Object();
keywords= new Object();
found= new Object();
var temp=0;

title[0]=26
//no of keywords after parsing
keywords[0]=0
//no of  matches found.
found[0]=0

<!-- Begin List of Searchable Items -->

<!--put the list of the links and descriptions here!!-->

title[1]="mision misión marco legal"
desc[1]="Misión de la Guardia Real - Marco legal"
links[1]="./hacemos/mision/indice.html"
matched[1]=0

title[2]="actividades presencia familia honores "
desc[2]="Actividades con presencia de la Familia Real"
links[2]="./hacemos/actividades/apfr/indice.html"
matched[2]=0

title[3]="automoviles automóviles motos dos ejes w150 W150 w31 W31 ejes"
desc[3]="Restauración de los mercedes del Patrimonio Nacional"
links[3]="http://www.guardiareal.org/somos/organizacion/logistica/enlaces.html"
matched[3]=0

title[4]="visita dignatarios extranjeros honores presidente presidentes"
desc[4]="Visitas de dignatarios Extranjeros"
links[4]="./hacemos/actividades/vdpe/indice.html"
matched[4]=0


title[5]="relevo guardia palacio real ceremonia"
desc[5]="Relevo de la Guardia Real"
links[5]="./hacemos/actividades/rgpr/indice.html"
matched[5]=0

title[6]="paradas militares solemnes fiesta nacional españa desfile"
desc[6]="Paradas Militares Solemnes"
links[6]="./hacemos/actividades/pms/indice.html"
matched[6]=0

title[7]="actividades tacticas tácticas ejercito tierra aire armada infanteria infantería"
desc[7]="Actividades Tácticas"
links[7]="./hacemos/actividades/at/indice.html"
matched[7]=0

title[8]="colaboracion colaboración colaboraciones nacion nación presidenciales"
desc[8]="Colaboraciones con otras Guardias Reales"
links[8]="./hacemos/actividades/c/indice.html"
matched[8]=0


title[9]="otras actividades buceo gimnasia grupo montaña bombero bomberos"
desc[9]="Otras Actividades"
links[9]="./hacemos/actividades/oa/indice.html"
matched[9]=0


title[10]="organización organizacion grupo grupos coronel guardia real"
desc[10]="Organización de la Guardia Real"
links[10]="./somos/organizacion/indice.html"
matched[10]=0

title[11]="grupo plana mayor de mando guardia real"
desc[11]="Grupo de Plana Mayor de Mando"
links[11]="./somos/organizacion/grplmm/indice.html"
matched[11]=0

title[12]="grupo escoltas guardia real"
desc[12]="Grupo de Escoltas"
links[12]="./somos/organizacion/escoltas/indice.html"
matched[12]=0

title[13]="grupo honores guardia real"
desc[13]="Grupo de Honores"
links[13]="./somos/organizacion/honores/indice.html"
matched[13]=0

title[14]="grupo logistica logística guardia real"
desc[14]="Grupo de Logística"
links[14]="./somos/organizacion/logistica/indice.html"
matched[14]=0

title[15]="unidad musica música guardia real conciertos auditorio"
desc[15]="Unidad de Música"
links[15]="./somos/organizacion/musica/indice.html"
matched[15]=0

title[16]="ideario guardia real"
desc[16]="Ideario de la Guardia Real"
links[16]="./somos/ideario/indice.html"
matched[16]=0

title[17]="roles uniformidad gastador guardia real alabarderos coraceros lanceros bateria batería real guardia militar guias perros motorista uniformes uniforme"
desc[17]="Roles y Uniformidad"
links[17]="./somos/roles/indice.html"
matched[17]=0

title[18]="himno guardia real letra música musica comandante jose josé lopez lópez calvo"
desc[18]="Himno de la Guardia Real"
links[18]="./somos/himno/indice.html"
matched[18]=0

title[19]="localización localizacion estamos instalacion instalación instalaciones cuartel rey principe príncipe reina escuadron escuadrón"
desc[19]="Dónde Estamos"
links[19]="./estamos/indice.html"
matched[19]=0

title[20]="eramos éramos historia evolucion evolución reinados"
desc[20]="Cómo Éramos"
links[20]="./eramos/indice.html"
matched[20]=0

title[21]="como cómo ser guardia real vacante vacantes fuerzas profesionales"
desc[21]="Cómo ser de la Guardia Real"
links[21]="./ser/indice.html"
matched[21]=0

title[22]="bases convocatoria proceso selección seleccion formación formacion"
desc[22]="Condiciones de acceso a las Fuerzas Profesionales"
links[22]="./ser/indicecivil.html"
matched[22]=0


title[23]="condiciones acceso mptm solicitud vacante ejercito ejército ejercitos"
desc[23]="Condiciones de acceso para MPTM"
links[23]="./ser/indicemptm.html"
matched[23]=0


title[24]="casa real majestad rey cuarto militar"
desc[24]="Cuarto Militar - Casa de S.M. el Rey"
links[24]="http://www.guardiareal.org/bienvenida/indice.html"
matched[24]=0

title[25]="mercedes patrimonio nacional restauracion restauración "
desc[25]="Restauración de los mercedes del Patrimonio Nacional"
links[25]="http://www.guardiareal.org/somos/organizacion/logistica/enlaces.html"
matched[25]=0

title[26]="grupo montaña guardia real elbruss Elbruss elbrus europa pico cima monte "
desc[26]="El Grupo de Montaña de la Guardia Real asciende al Elbruss"
links[26]="http://www.guardiareal.org/actos/otras_actv/montaña/indices.html"
matched[26]=0

<!-- End list of Searchable items -->

function search(){

if (searchengine.keywords.value==""){
	alert("Escriba una palabra, por favor");
}
else{

var skeyword=document.searchengine.keywords.value.toLowerCase();
var check=1;
var pos=0;
var i=0;
var j=0;
var  itemp=0;
var config='';

while (true)
	{
	if (skeyword.indexOf("+") == -1 )
		{
		keywords[check]=skeyword;
		break;
		}
	pos=skeyword.indexOf("+");
	if (skeyword !="+")	
	{
	keywords[check]=skeyword.substring(0,pos);
	check++;
	}
	else
	{
	check--;
	break;
	}
	skeyword=skeyword.substring(pos+1, skeyword.length);	
	if (skeyword.length ==0)
		{
		check--;
		break;
		}
			 
	}
// the keywords have been put in keywords object.
keywords[0]=check;

// matching and storing the matches in matched
for ( i=1; i<=keywords[0];i++)
	{
	for (j=1;j<=title[0];j++)
		{
		if (title[j].toLowerCase().indexOf(keywords[i]) > -1 )
			{
			  matched[j]++;
			}
		}	
	}
// putting all the indexes of the matched records  in found

for (i=1;i<=title[0];i++)
{
	if (matched[i] > 0 )
		{
		  found[0]++;
		// increment the found 	
		  found[found[0]]=i;
			
		}	
}



for (i=1;i<=found[0]-1;i++)
	{
	for(j=i+1;j<=found[0];j++)
		{
		if ( matched[found[i]]< matched[found[j]] )
			{
			temp= found[j];
			found[j]=found[i];
			found[i]=temp;
			}
		}
	}

// end of sort


output = self;
output.document.write('<html>');
output.document.write('<head>');
output.document.write('<script>');
output.document.write('window.onerror=new Function("return true")');
output.document.write('<\/script>');

output.document.write('<title> Resultados de la Búsqueda </title>');
output.document.write('<style>');
output.document.write('h2 {font-family: verdana; color: #040484}');
output.document.write('h3 {font: bold x-small verdana; color: "yellow"}');
output.document.write('p {font: xx-small verdana; color: #666666}');
output.document.write('b {font: x-small verdana; color: #666666}');
output.document.write('a {font: x-small verdana; color: #546e99}');
output.document.write('a:hover {color: #E6CC00}');
output.document.write('a.inicio {font: xx-small verdana; color: #546e99; text-decoration: none}');
output.document.write('</style>');
output.document.write('</head>');
output.document.write('<BODY bgcolor=white  background="./imagenes/fondogr.jpg" text=#666666  link=#6a0079 vlink =#339966 >');
output.document.write('<center><img src="./imagenes/resultado_busqueda.gif"></center>');

//output.document.write('<div style="position: absolute; top: 20; left: 15"><A href="http://www.fn.mde.es/index.htm"><br>');
//output.document.write('<img align=top src="./imagenes/grtransp2.gif" border="0"><br>');
//output.document.write('</A><A class=inicio href="http://www.guardiareal.org/indice.html"></A></div>'); 

output.document.write('<center><img src="./imagenes/buscar_prueba.gif"></center><br>');    
            
output.document.write('<hr>');
output.document.write('<p>');
output.document.write(' Palabra(s) a buscar : '.big() )
for (i=1;  i<=keywords[0]; i++)
	{
	output.document.write ("<b>");
	output.document.write( keywords[i].bold() +"   ");
	output.document.write ("</b>");
	}
output.document.write('</p>');


if (found[0]==0)
	{
	//alert(found[0]);
	output.document.write('<hr>');
	output.document.write("<b>No se han encontrado resultados </b> <br>");
	}
else
	{
	// data has been found
	output.document.write(" <hr> <b> Documentos encontrados  : </b>  ");
	output.document.write( found[0] );
	
	output.document.write('<br><br>');

	output.document.write("<table border=1 width=100%>");
	for (i=1; i<=found[0];i++)
		{
		output.document.write("<tr><td align=center valign=middle bgcolor=#040484>");
		output.document.write("<h3>" +i +"</h3>");
		output.document.write("<td valign=top>");
		itemp=found[i];
		output.document.write(desc[itemp].bold() +"<br>" +
		links[itemp].link(links[itemp])+"<br>");
		temp= (matched[itemp]/keywords[0])*100
		output.document.write("<i> Eficacia de búsqueda : " +temp+" %  </i>" );
		matched[itemp]=0
		} 
	found[0]=0;
	output.document.write("</table>");
	}
output.document.write ('<br>');
output.document.write ('<br>'); 
output.document.write ('<center>'); 
output.document.write ('<a href="./busqueda.html"');
output.document.write ('<img src="./imagenes/volver2.gif" border="0"></a>');

output.document.write('<div style="position: absolute; "><A href="./busqueda.html"><br>');
output.document.write('<img align=top src="./imagenes/volver2.gif" border="0"><br>');
output.document.write('</A><A class=inicio href="http://www.guardiareal.org/indice.html"></A></div>'); 


output.document.write ('</body></html>'); 
//window.close();
}
}

document.onkeydown = keyDown;
function keyDown() {
	if (document.activeElement.id=="texto"){
		var keycode = event.keyCode	
		if (keycode==13) {search()}	// if "a" key is pressed
	}
}