// ----------------------------------------------------------------------------
// Lauyan Software Javascript Search Engine 1.1
//
// This file is the JavaScript search engine for a website created by TOWeb
//
// Copyright (C) LAUYAN SOFTWARE
// web: http://www.lauyan.com
// ----------------------------------------------------------------------------

STR_SEARCH_QUERY_MSG = "Résultats de la recherche pour";
STR_NO_RESULT = "Aucun résultat trouvé";
STR_SCORE = "Score";
STR_TERMS = "Termes";
STR_SEARCH_SIZE = "40";
MIN_WORD_LEN = 2;
DISPLAY_SRCH_INFO = 1;
USE_UTF8 = 0;
REMOVE_ACCENTS = 1;
BOLD_LINKS = 1;
ONLINE_WEBSITE = 1;
ALLWORDSONLY = 0;
namesArray = new Array(" <title>ifmpe< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description institut formations aux metiers petite enfance keywords nice cap bep carrieres sanitaires sociales bac sms secretaire medicale auxiliaire puericulture aide soignante language identifier-url http www ifmpe com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar revisit-after day head> <title>ifmpe formation france< http-equiv=content-type http-equiv=imagetoolbar content=no> http-equiv=language content=fr> sociales haccp name=description> ifpe 'cap enfance' 'bep sociales' 'auxiliaire puericulture' 'aide soignante' 'petite 'formation continue' 'contrat qualification' enseignement france name=keywords> content=index name=robots> name=revisit-after> <title>ecoles bilingues< ecoles bilingues cote d'azur ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs ecolesbilingues rating general distribution global days ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" trouverez ici toutes nouveautes sur l'ecole son mini-club attention dernieres news sont toujours bas liste ",
" mini-club  ",
" trouverez ici toutes nouveautes sur l'ecole son mini-club attention dernieres news sont toujours bas liste ",
" mini-club pegomas  ",
" trouverez ici toutes nouveautes sur l'ecole son mini-club baby club attention dernieres news sont toujours bas liste ",
" mini-club 4-11 ans  ",
" baby club 2-4ans  ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" <title>ifmpe< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description institut formations aux metiers petite enfance keywords summer camp france day daycamp nice cote d'azurecole bilingue camps d'ete d'azur d'eted'azur ecoles internationales college international colleges bilingues mini-club section internationale ecole cagnes sur mer ecole cagners pegomas pegomas maternelle maternelle primaire primaire pedagogie active enfants precoces classes musique petits effectifs language identifier-url http www ifmpe com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar revisit-after head> <title>ifmpe formation france< http-equiv=content-type http-equiv=imagetoolbar content=no> http-equiv=language content=fr> carrieres sanitaires sociales cap bep auxiliaire puericulture aide soignante haccp name=description> ifpe 'cap enfance' 'bep sociales' 'auxiliaire puericulture' 'aide soignante' 'petite 'formation continue' 'contrat qualification' enseignement name=keywords> content=index name=robots> name=revisit-after> <title>ecoles bilingues< bilingues riviera riviera colleges differenciee ecole maternelle ecolesbilingues rating general distribution global days ",
" emploi  ",
" annonce particulier  ",
" programmes bilinguisme utilisez modele commencer page vierge ",
" <title>ecoles bilingues< title> <meta http-equiv= content-type content= text html charset=iso-8859-1 name= description ecoles bilingues cote d'azur keywords ecole bilingue internationales internationale riviera riviera d'azur college international colleges pedagogie differenciee mini-club section internationale nice cagnes sur mer cagners pegomas pegomas maternelle maternelle primaire primaire active enfants precoces classes musique petits effectifs language identifier-url http www ecolesbilingues com reply-to ifpe@wanadoo author paulin robots index follow imagetoolbar rating general distribution global revisit-after days head> ",
" projet educatif pedagogique  ",
" vie scolaire  ",
" enseignants  ",
" enseignants ",
" programmes bilinguisme  ",
" vie scolaire  ",
" activites sportives culturelles  ",
" photos pegomas  ",
" activites periscolaires  ",
" vacances paques  ",
" conge individuel formation  ",
" programmes mini-club 2008  ",
" college acces prive  ",
"  ",
" photos activite cuisine  ",
" photos l'ecole pegomas  ",
"  ",
"  ",
" diaporama acceuil  ",
"  ",
" materiel montessori  ",
"  ",
" titre album  ",
" titre album utilisez modele commencer nouvel photo vide defaut bordure simple sera appliquee photos pourrez changer l'enlever retoucher images avec l'editeur d'images integre ");
urlsArray = new Array("../topic/index.html",
"../valeurseducative/index.html",
"../bilinguisme/index.html",
"../maternelle/index.html",
"../primaire/index.html",
"../college-lycee/index.html",
"../ifmpe/index.html",
"../menuspaindesucre/index.html",
"../mini-clubs/index.html",
"../groupederubrique/index.html",
"../mini-clubps/index.html",
"../groupederubriqu1/index.html",
"../mini-clubpegomas/index.html",
"../groupederubriqu2/index.html",
"../mini-clubpe/index.html",
"../mapage1/index.html",
"../situation/index.html",
"../liens/index.html",
"../monblog/index.html",
"../avendre/index.html",
"../primaireprgetbil/index.html",
"../liensenfants/index.html",
"../projeteducatifet/index.html",
"../primaireviescola/index.html",
"../maternelleenseig/index.html",
"../primaireenseign1/index.html",
"../maternelleprogra/index.html",
"../maternelleviesco/index.html",
"../maternelleactivi/index.html",
"../photosdepegomas/index.html",
"../primaireactivite/index.html",
"../vacancespaquespe/index.html",
"../fongecif/index.html",
"../programmesmini-c/index.html",
"../collegeaccespriv/index.html",
"../photoscuisinepe/index.html",
"../photosactivitecu/index.html",
"../photostheatre17/index.html",
"../fetedefindannee/index.html",
"../photos/index.html",
"../diaporamaacceuil/index.html",
"../photosfetedefind/index.html",
"../albumphoto/index.html",
"../albumphoto1/index.html",
"../albumphoto2/index.html",
"../buggygilles/index.html");
titlesArray = new Array("Ecoles Bilingues",
"Ecoles Bilingues de la côte d'azur",
"Bilinguisme",
"Maternelle",
"La classe de Primaire",
"Collège International Privé LAFAYETTE Une école ouverte sur le monde",
"IFMPE",
"Menus",
"Mini-clubs",
"Ecoles Bilingues de la côte d'azur",
"Mini-club PS",
"Ecoles Bilingues de la côte d'azur",
"Mini-club PEGOMAS",
"Ecoles Bilingues de la côte d'azur",
"Mini-club PE 4-11 ANS",
"Baby club 2-4ans",
"Situation",
"Liens favoris",
"EMPLOI",
"ANNONCE DE PARTICULIER",
"Programmes et bilinguisme",
"Ecoles Bilingues",
"projet educatif et pédagogique",
"Vie scolaire",
"Enseignants",
"Enseignants",
"Programmes et bilinguisme",
"Vie scolaire",
"Activités sportives et culturelles",
"Photos de Pégomas",
"Activités Périscolaires",
"vacances pâques PE",
"LE CONGE INDIVIDUEL DE FORMATION",
"Programmes Mini-club 2008",
"Collège accès privé",
"Ecoles Bilingues de la côte d'azur",
"Photos activité cuisine",
"Photos de l'Ecole de Pégomas",
"Ecoles Bilingues de la côte d'azur",
"Ecoles Bilingues de la côte d'azur",
"Diaporama acceuil",
"Ecoles Bilingues de la côte d'azur",
"MATERIEL MONTESSORI",
"Ecoles Bilingues de la côte d'azur",
"Titre de votre album",
"Titre de votre album");
descArray = new Array("<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>CAP PETITE ENFANCE NICE</TITLE> <HEAD><head> <TITLE>IFMPE</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <META na...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"Vous trouverez ici toutes les nouveautés sur l'Ecole et son Mini-Club. Attention les dernières news sont toujours en bas de la liste!",
"",
"Vous trouverez ici toutes les nouveautés sur l'Ecole et son Mini-Club. Attention les dernières news sont toujours en bas de la liste!",
"",
"Vous trouverez ici toutes les nouveautés sur l'Ecole, son Mini-Club et son Baby club. Attention les dernières news sont toujours en bas de la liste!",
"",
"",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"<TITLE>http://www.happylandsummercamp.com</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=...",
"",
"",
"Utilisez ce modèle pour commencer une page vierge",
"<TITLE>ECOLES BILINGUES</TITLE> <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1> <meta name=description content=ECOLES BILINGUES c...",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Utilisez ce modèle pour commencer un nouvel album photo vide.  Par défaut une bordure simple sera appliquée à vos photos, mais vous pourrez la changer...");
sublinksArray = new Array(46);
var linksCount = 46;


function SubmitSearch(n)
{
	var p = document.getElementsByName("jse_query");
	var idx = n;  if( p < 0) return false;
	if( p && p[idx] && p[idx].value != "" ) {
	if( (p[idx].value).replace(/^\s+|\s+$/g, '') != "" ) {
		p = document.getElementsByName("jse_form");
		if( p && p[idx] )
			p[idx].submit();
		return true;
	  }
	}
	return false;
}
function switchSearchLang(lang,emptycart)
{
	var params = "";
	var currURL = document.location.href;
	var newURL = (currURL.lastIndexOf('_frame/search2') >= 0) ? "search2":"search";
	if( lang != "" )
		newURL += "-"+lang;
	newURL += ".html";
	var paramIndex = currURL.lastIndexOf('?');
	if( paramIndex > -1 )
		newURL += "?" + currURL.substr( paramIndex + 1 );
	if( emptycart && typeof(CleanShopcart) != "undefined" )
		CleanShopcart();
	document.location.href = newURL;
	return false;
}

// getParam returns the value of the specified GET parameter
function getParam(paramName)
{
    paramStr = document.location.search;
    if( paramStr == "" )
        return "";
    if( paramStr.charAt(0) == "?" )
        paramStr = paramStr.substr(1);
    arg = (paramStr.split("&"));
    for( i=0; i<arg.length; i++ ) 
    {
      arg_values = arg[i].split("=")
      if( unescape(arg_values[0]) == paramName ) 
      {
         if( USE_UTF8 == 1 && self.decodeURIComponent ) // check if decodeURIComponent() is defined
            ret = decodeURIComponent(arg_values[1]);
         else
            ret = unescape(arg_values[1]);  // IE 5.0 and older does not have decodeURI
         return ret;
      }
    }
    return "";
}

function getQueryParam()
{
  var query = getParam("jse_query");
  query = query.replace(/[\++]/g, " ");  // replace any '+' with spaces
  query = query.replace(/\</g, "&lt;");
  query = query.replace(/[\"+]/g, " ");
	return query;
}

function replaceAll(str,from,to) 
{
    var idx = str.indexOf(from);
    while( idx > -1 ) {
        str = str.replace(from, to); 
        idx = str.indexOf(from);
    }
    return str;
}

// lowercase, remove quotes and accents
function formatChars(str) 
{
    str = str.toLowerCase();
    if( REMOVE_ACCENTS ) 
    {
      var a = "àáâãäåòóôõöèéêëçìíîïùúûüÿñ";
      var b = "aaaaaaoooooeeeeciiiiuuuuyn";
      for( i=0; i<a.length; i++ )
        str = replaceAll( str, a.charAt(i), b.charAt(i) );
    }
    str = replaceAll( str, "'", " " );
    return str;
}

function SortCompare(a, b)
{
  if( a[2] == b[2] )
  {  
    if (a[1] < b[1]) return 1;
    else if (a[1] > b[1]) return -1;
    else return 0;
  }
  else if (a[2] < b[2]) return 1;
    else return -1;
}

function jseSearch( internal )
{
  // get params
  var rootURL = '';
	var SelfURL = document.location.href;
  var paramIndex = SelfURL.indexOf("?");    
  if (paramIndex > -1)
     SelfURL = SelfURL.substr(0, paramIndex);
  paramIndex = SelfURL.indexOf("#");
  if (paramIndex > -1)
    SelfURL = SelfURL.substr(0, paramIndex);        
	if (ONLINE_WEBSITE) 
	{
		paramIndex = SelfURL.lastIndexOf('/');
		if (paramIndex > -1) 
		{
			rootURL = SelfURL.substr(0, paramIndex);
			paramIndex = rootURL.lastIndexOf('/');
			if (paramIndex > -1) {
				rootURL = SelfURL.substr(0, paramIndex+1);
			} else
			  rootURL = '';
		}
	}	
  SelfURL = SelfURL.replace(/\</g, "&lt;");
  SelfURL = SelfURL.replace(/\"/g, "&quot;");

  var query = getQueryParam();

  // display the search form
  var lnktarget = "";
/*	if( internal == null || internal != 1 )
	{
    document.writeln("<form method=\"get\" action=\"" + SelfURL + "\">");
    document.writeln("<input type=\"text\" name=\"jse_query\" size=\"" + STR_SEARCH_SIZE + "\" value=\"" + query + "\" />");
    document.writeln("<input type=\"submit\" value=\"" + STR_SEARCH_BUTTON + "\" />");
    document.writeln("</form>");
  }
  */
  if( internal == 1 ) {
	 lnktarget = "\" target=\"_blank";
  }
	
  query = formatChars(query);
  if( query.length == 0 ) return;
  
  var found=0, t=0, k=0, score=0, subscore=0, i=0;
  var keyword = "", tmp = "";
  var searchWords = new Array();

  // split search query by spaces
  searchWords = query.split(" ");
	if( internal == null || internal != 1 ) {
		document.writeln( "<span class='wg-paragraph'>" + STR_SEARCH_QUERY_MSG + " : <strong>" +query+"</span></strong><br>");
  }
  // init result table information
  res_table = new Array(linksCount);
  for( t=0; t<linksCount; t++ )
  {
    res_table[t] = new Array(4);
    res_table[t][0] = 0;  // index
    res_table[t][1] = 0;  // score
    res_table[t][2] = 0;  // words found
    res_table[t][3] = ""; // sublinks (output string)
  }
  var significantwords = 0;

  // begin search ...
  for( i=0; i<searchWords.length; i++ )
  {
    keyword = searchWords[i];
    if( keyword.length > MIN_WORD_LEN ) // skip "small" words
	{
	  significantwords++;
	  for(var q=0; q<linksCount; q++ )
	  {
	    t = q;
	    score = 0;
	
	    // search for keywords (an exact word doubles the score)
		  tmp = formatChars(descArray[t]);
	    if( tmp.indexOf(keyword) != -1 ) score++;
	    if( tmp.indexOf(' '+keyword+' ') != -1 ) score+=2;
		  tmp = formatChars(titlesArray[t]);
	  	if( tmp.indexOf(keyword) != -1 ) score++;
		  if( tmp.indexOf(' '+keyword+' ') != -1 ) score+=2;
	    if( namesArray[t].indexOf(keyword) != -1 ) score++;
	    if( namesArray[t].indexOf(' '+keyword+' ') != -1 ) score+=2;
	
		// search for keywords in sublinks (i.e. bookmarks)
	    k = q+1;
		while( k <= linksCount )
		{
			tmp = descArray[k];
			if( tmp == null || tmp.charAt(0) != '&' ) break;
			subscore = 0;
			tmp = formatChars(descArray[k]);
			if( tmp.indexOf(keyword) != -1 ) subscore++;
			if( tmp.indexOf(' '+keyword+' ') != -1 ) subscore+=2;
			tmp = formatChars(titlesArray[k]);
			if( tmp.indexOf(keyword) != -1 ) subscore++;
			if( tmp.indexOf(' '+keyword+' ') != -1 ) subscore+=2;
			if( namesArray[k].indexOf(keyword) != -1 ) subscore++;
			if( namesArray[k].indexOf(' '+keyword+' ') != -1 ) subscore+=2;
			
			if( subscore > 0 )
			{
				var idx = urlsArray[t].indexOf('@');
				if( idx > 0 ) 
				{
					var lnk = urlsArray[k].substr(0, idx)
					if( res_table[t][3].indexOf( lnk ) == -1 )
						res_table[t][3] += "<tr><td width='35'>&nbsp;</td><td><a href=\"" + urlsArray[k].substr(idx+1) + "\" name=\"" + lnk + "\">" + titlesArray[k] + "</a></td></tr>";
				} else if( res_table[t][3].indexOf( "\"" + urlsArray[k] + "\"" ) == -1 )
					res_table[t][3] += "<tr><td width='35'>&nbsp;</td><td><a href=\"" + urlsArray[k] + lnktarget + "\">" + titlesArray[k] + "</a></td></tr>";
//	           		if( B OLD_LINKS )  res_table[t][3] += "<tr><td width='50'>&nbsp</td><td><b><a href='" + urlsArray[k] +"'>" + titlesArray[k] + "</a></b></td></tr>";
				score += subscore;
			}	
			k++;
		}
		q = k-1;
				
	    if( score > 0 )
	    {
	      res_table[t][0] = t;
	      res_table[t][1] += score;
	      res_table[t][2]++;
	      found++;
	    }
	  }
	}
  }
  if( found == 0 ) {
    document.write("<p class='wg-paragraph'><b>" + STR_NO_RESULT + "</b></p>");
  } 
  else 
  {
/*	if( ALLWORDSONLY )
	{
		//  if all words only then we recount and filter amoung the results to get the total of found items
		found = 0;
		for( var z=0; z<itemsCount; z++ )
			if( res_table[z][1] > 0 ) // display only results with a positive score
			if( !ALLWORDSONLY || (ALLWORDSONLY && res_table[z][2] == significantwords) )
				found++;
	}
  */
	// sort by words found and scores
    res_table.sort(SortCompare);	
    // display the results
	document.writeln( '<div class="wg-paragraph">' );
    for( q=0; q<found; q++ )
      if( res_table[q][1] > 0 ) // display only results with a positive score
	  if( !ALLWORDSONLY || (ALLWORDSONLY && res_table[q][2] == significantwords) )
	  {
		t = res_table[q][0];    // get page index

		var lnk = urlsArray[t] + lnktarget;
		var idx = urlsArray[t].indexOf('@');
		if( idx > 0 ) 
			lnk = urlsArray[t].substr(idx+1);
			
		if( BOLD_LINKS ) {
		  document.writeln("<br><b>" + (q+1) + ". <a href=\"" + lnk + "\">" + titlesArray[t] + "</a></b>" );
		} else
		  document.writeln("<br><b>" + (q+1) + ".</b> <a href=\"" + lnk + "\">" + titlesArray[t] + "</a>" );
        if( descArray[t].length > 2 )
          document.writeln("<br>" + descArray[t] );
        if( DISPLAY_SRCH_INFO ) 
		{
			document.write("<br><span style='font-size: 80%; font-style: italic;'>");
			if( !ALLWORDSONLY )
			  document.write("" + STR_TERMS + ": " + res_table[q][2] + " - " );
			document.write("" + STR_SCORE + ": " + res_table[q][1] );
			if( urlsArray[t].indexOf('@') > 0 ) {
			  document.writeln(" - URL: 'TOWeb demonstration'</span>");
			} else if(ONLINE_WEBSITE) {
			  document.writeln(" - URL: " + rootURL + urlsArray[t].substr(3) + "</span>");
			} else
			  document.writeln(" - URL: " + urlsArray[t] + "</span>");
      	}
		if( res_table[q][3].length > 0 ) { 
      	  document.writeln( '<table class="wg-paragraph">' + res_table[q][3] + '</table>' );
      	} else document.writeln("<br>");
      }
 	document.writeln( '</div>' );
  }
  document.writeln("<br>");
}
