// ----------------------------------------------------------------------------
// 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 = "20";
MIN_WORD_LEN = 2;
DISPLAY_SRCH_INFO = 1;
USE_UTF8 = 0;
REMOVE_ACCENTS = 1;
BOLD_LINKS = 0;
ONLINE_WEBSITE = 1;
ALLWORDSONLY = 0;
namesArray = new Array(" <meta name= keywords content= bijoux accessoires nacre sine naturelle broderie tissu feutre laine colliers broches boucles d'oreilles bagues gravure sur artisanat fabrication main peinture rets mariage mat riaux naturels non allergisants  ",
" comment contacter  ",
" mes creations bijoux chaque prix article comprend frais transport ",
" boucles nacre travaillee resine naturelle motif dentelle coloris orange ",
" boucles nacre naturelle coloris naturel vert d'eau ",
" boucles nacre naturelle gomme vegetale coloris naturel noir mat brillant ",
" boucles nacre naturelle gomme vegetale coloris naturel chocolat ",
" boucles nacre naturelle coloris naturel vert d'eau ",
" boucles nacre naturelle coloris naturel ",
" boucles nacre naturelle coloris naturel bleu ciel oreilles non percees ",
" boucles nacre naturelle coloris naturel chocolat oreilles non percees ",
" boucles nacre naturelle coloris naturel chocolat ",
" boucles nacre naturelle coloris naturel chocolat ",
" boucles nacre naturelle coloris naturel bleu ciel ",
" boucles nacre naturelle coloris naturel bleu ciel ",
" boucles nacre naturelle coloris naturel bleu ciel ",
" boucles nacre naturelle coloris naturel violet ",
" boucles nacre naturelle coloris chocolat violet ",
" boucles nacre naturelle coloris chocolat gris perle tahiti ",
" boucles resine naturelle coloris rouge ",
" boucles resine naturelle coloris rouge ",
" boucles resine naturelle coloris rouge ",
" boucles argile pigments coloris turquoise ",
" boucles argile pigments coloris violet clair ",
" boucles argile pigments coloris prune aubergine ",
" pendentif cœur nacre travaillee resine naturelle lien cuir fin tres leger taille unique ",
" pendentif cœur nacre travaillee resine naturelle lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif metal cuivre argent veritable piece nacre naturelle lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif metal cuivre argent veritable piece nacre naturelle lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif metal argent veritable piece nacre naturelle lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif piece nacre fine transparente sertie argent veritable tubes naturelle lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif fleur nacre naturelle perle tube lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif nacre naturelle coloris naturel vert d'eau lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif nacre naturelle coloris naturel vert d'eau sequins metalliques cuivre bronze lien cuir fin tres leger taille unique ",
" saisissez description article ici ",
" pendentif forme ronde peinture sur nacre teintee naturellement lien coton glace jaune coloris fond bleu marine ajustable ",
" pendentif forme ronde peinture sur nacre teintee naturellement lien coton glace vert coloris fond anis ajustable ",
" pendentif forme ronde peinture sur nacre teintee naturellement lien coton glace blanc coloris fond gris ajustable ",
" pendentif forme ronde peinture sur nacre teintee naturellement lien coton glace turquoise coloris fond ajustable ",
" pendentif forme ronde peinture sur nacre teintee naturellement lien coton glace vert anis coloris fond ajustable ",
" pendentif forme ronde argile naturelle pigments coloris turquoise ajustable ",
" pendentif forme ronde argile naturelle pigments coloris violet clair ",
" pendentif forme ronde argile naturelle pigments coloris prune aubergine ",
" pendentif forme ronde argile naturelle pigments coloris bleu nuit ",
" collier nacre travaillee resine naturelle lien alcantara motif toile jouy coloris lin framboise ",
" collier nacre travaillee resine naturelle lien coton glace motif dentelle coloris noir blanc ",
" collier nacre travaillee resine coloris prune motif raye ",
" nacre travaillee resine naturelle motif dentelle coloris bleu blanc pratique fermer gilet tenir etole dimension cm ",
" epingle strass  coloris strass dominance bleue ",
" epingle strass  coloris strass dominance verte ",
" epingle strass  coloris strass dominance rose ",
" epingle strass  coloris strass motif visage ",
" epingle nacre  coloris noir naturel ",
" epingle nacre  coloris naturel ",
" epingle nacre  coloris naturel ",
" pendentif resine avec coquillage inclusion ruban coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban vert kaki coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris clair coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris fonce coloris parme discret vieilli tour cou ",
" pendentif resine avec coquillage inclusion ruban gris clair coloris parme discret vieilli tour cou ",
" perles resine naturelle telle argile lien lin coloris chocolat ajustable ",
" collier resine naturelle telle argile lien noir coloris rouge tour cou large tres leger ",
" collier resine naturelle telle argile lien noir coloris rouge tour cou large tres leger ",
" collier resine naturelle telle argile lien transparent coloris galet tour cou large tres leger ",
" collier tour cou metal soie coloris chocolat tres leger ",
" mes creations feutre chaque prix article comprend frais transport ",
" pochette feutree main laine chevre tres retro  ",
" pochette feutre portable carte fidelite tres retro coloris vert rouge fonce preciser moment commande  ",
" bloc note couverture feutre rouge fonce motif resine avec inclusion tres retro ",
" bloc note couverture feutre bleu marine motif resine avec inclusion tres retro ",
" bloc note couverture feutre gris anthracite motif resine avec inclusion tres retro ",
" bijou sac feutre rouge fonce strass  ",
" bijou sac feutre noir strass  ",
" bijou sac feutre vert  ",
" mes creations laine chaque prix article comprend frais transport ",
" beret pur laine broderie main mouton coloris noir rouge taille unique ",
" beret pur laine broderie main mouton coloris noir grise taille unique ",
" beret pur laine broderie main mouton coloris noir verte taille unique ",
" beret pur laine broderie main mouton coloris rouge chocolat taille unique ",
" beret pur laine broderie main mouton coloris noir rose taille unique ",
" collier tricotin coloris prune tres retro ",
" collier tricotin coloris prune tres retro ",
" collier tricotin coloris bleu tres retro ",
" accessoires mariage chaque prix article comprend frais transport ",
" colliers collection mariage tour cou metal fleurs blanches beiges nacre perles plumes… taille unique  ",
" grande petite fleur blanche nacre perle motif dimension env cm ",
" turban collection mariage ceremonie  abaca 100 chanvre coloris  rouge sobre perles tres leger taille unique sur commande ",
" collier broderie sur tissu dentelle coloris champagne collection mariage ceremonie voir selon tour cou commande uniquement ",
" collier broderie rose collection mariage ceremonie taille unique ",
" peigne broderie rose collection mariage ceremonie taille unique ",
" collier broderie sur tissu dentelle coloris noir collection mariage ceremonie taille unique ",
" accessoires mode chaque prix article comprend frais transport ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris rose  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris vert fonce  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris chocolat  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" dentelle laine coloris bleu nuit  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" gris resine avec inclusion retro coloris coquelicot parfait sur sac  ",
" turban elastique cheveux fleurs velours coloris rose rouge discret taille unique ",
" turban elastique cheveux fleurs velours coloris bleu vert discret taille unique ",
" turban elastique cheveux fleurs velours coloris rose discret taille unique ",
" mes salons expos  ",
" liens favoris  ");
urlsArray = new Array("../topic/index.html",
"../topic3/index.html",
"../bijoux/index.html",
"../bijoux/page1.html",
"../bijoux/page2.html",
"../bijoux/page3.html",
"../bijoux/page4.html",
"../bijoux/page5.html",
"../bijoux/page6.html",
"../bijoux/page7.html",
"../bijoux/page8.html",
"../bijoux/page9.html",
"../bijoux/page10.html",
"../bijoux/page11.html",
"../bijoux/page12.html",
"../bijoux/page13.html",
"../bijoux/page14.html",
"../bijoux/page15.html",
"../bijoux/page16.html",
"../bijoux/page17.html",
"../bijoux/page18.html",
"../bijoux/page19.html",
"../bijoux/page20.html",
"../bijoux/page21.html",
"../bijoux/page22.html",
"../bijoux/page23.html",
"../bijoux/page24.html",
"../bijoux/page25.html",
"../bijoux/page26.html",
"../bijoux/page27.html",
"../bijoux/page28.html",
"../bijoux/page29.html",
"../bijoux/page30.html",
"../bijoux/page31.html",
"../bijoux/page32.html",
"../bijoux/page33.html",
"../bijoux/page34.html",
"../bijoux/page35.html",
"../bijoux/page36.html",
"../bijoux/page37.html",
"../bijoux/page38.html",
"../bijoux/page39.html",
"../bijoux/page40.html",
"../bijoux/page41.html",
"../bijoux/page42.html",
"../bijoux/page43.html",
"../bijoux/page44.html",
"../bijoux/page45.html",
"../bijoux/page46.html",
"../bijoux/page47.html",
"../bijoux/page48.html",
"../bijoux/page49.html",
"../bijoux/page50.html",
"../bijoux/page51.html",
"../bijoux/page52.html",
"../bijoux/page53.html",
"../bijoux/page54.html",
"../bijoux/page55.html",
"../bijoux/page56.html",
"../bijoux/page57.html",
"../bijoux/page58.html",
"../bijoux/page59.html",
"../bijoux/page60.html",
"../bijoux/page61.html",
"../bijoux/page62.html",
"../bijoux/page63.html",
"../bijoux/page64.html",
"../bijoux/page65.html",
"../bijoux/page66.html",
"../bijoux/page67.html",
"../bijoux/page68.html",
"../bijoux/page69.html",
"../bijoux/page70.html",
"../bijoux/page71.html",
"../bijoux/page72.html",
"../bijoux/page73.html",
"../catalogue/index.html",
"../catalogue/page1.html",
"../catalogue/page2.html",
"../catalogue/page3.html",
"../catalogue/page4.html",
"../catalogue/page5.html",
"../catalogue/page6.html",
"../catalogue/page7.html",
"../catalogue/page8.html",
"../topic1/index.html",
"../topic1/page1.html",
"../topic1/page2.html",
"../topic1/page3.html",
"../topic1/page4.html",
"../topic1/page5.html",
"../topic1/page6.html",
"../topic1/page7.html",
"../topic1/page8.html",
"../accessoiresmaria/index.html",
"../accessoiresmaria/page1.html",
"../accessoiresmaria/page2.html",
"../accessoiresmaria/page3.html",
"../accessoiresmaria/page4.html",
"../accessoiresmaria/page5.html",
"../accessoiresmaria/page6.html",
"../accessoiresmaria/page7.html",
"../mode/index.html",
"../mode/page1.html",
"../mode/page2.html",
"../mode/page3.html",
"../mode/page4.html",
"../mode/page5.html",
"../mode/page6.html",
"../mode/page7.html",
"../mode/page8.html",
"../mode/page9.html",
"../mode/page10.html",
"../mode/page11.html",
"../mode/page12.html",
"../mode/page13.html",
"../mode/page14.html",
"../mode/page15.html",
"../mode/page16.html",
"../mode/page17.html",
"../mode/page18.html",
"../mode/page19.html",
"../mode/page20.html",
"../mode/page21.html",
"../mode/page22.html",
"../mode/page23.html",
"../mode/page24.html",
"../mode/page25.html",
"../mode/page26.html",
"../mode/page27.html",
"../mode/page28.html",
"../mode/page29.html",
"../mode/page30.html",
"../mode/page31.html",
"../mode/page32.html",
"../mode/page33.html",
"../expos/index.html",
"../liens/index.html");
titlesArray = new Array("LOUPARUM ACCESSOIRES",
"Comment me contacter",
"Louparum, Artiste libre, création artisanale, bijoux fantaisie, nacre",
"BOUCLES 0024",
"BOUCLES 0018",
"PETITES BOUCLES 0220",
"PETITES BOUCLES 0221",
"PETITES BOUCLES 0226",
"PETITES BOUCLES 0227",
"PETITES BOUCLES 0228",
"PETITES BOUCLES 0229",
"PETITES BOUCLES 0230",
"PETITES BOUCLES 0231",
"PETITES BOUCLES 0232",
"PETITES BOUCLES 0233",
"PETITES BOUCLES 0234",
"PETITES BOUCLES 0235",
"PETITES BOUCLES 0236",
"PETITES BOUCLES 0237",
"PETITES BOUCLES 0238",
"PETITES BOUCLES 0239",
"PETITES BOUCLES 0240",
"PETITES BOUCLES 0241",
"PETITES BOUCLES 0242",
"PETITES BOUCLES 0243",
"TOUR DE COU 0102",
"TOUR DE COU 0103",
"Nom de l'article",
"TOUR DE COU 0234",
"Nom de l'article",
"TOUR DE COU 0237",
"Nom de l'article",
"TOUR DE COU 0201",
"Nom de l'article",
"TOUR DE COU 0203",
"Nom de l'article",
"TOUR DE COU 0209",
"Nom de l'article",
"TOUR DE COU 0210",
"Nom de l'article",
"TOUR DE COU 0215",
"Nom de l'article",
"PENDENTIF 0175",
"PENDENTIF 0178",
"PENDENTIF 0181",
"PENDENTIF 0183",
"PENDENTIF 0184",
"PENDENTIF 0185",
"PENDENTIF 0186",
"PENDENTIF 0187",
"PENDENTIF 0188",
"COLLIER 0132",
"COLLIER 0122",
"COLLIER 0129",
"EPINGLE 0089",
"EPINGLE 0073",
"EPINGLE 0074",
"EPINGLE 0075",
"EPINGLE 0076",
"EPINGLE 0077",
"EPINGLE 0078",
"EPINGLE 0079",
"PENDENTIF 0099",
"PENDENTIF 0101",
"PENDENTIF 0150",
"PENDENTIF 0151",
"PENDENTIF 0152",
"PENDENTIF 0154",
"PENDENTIF 0155",
"PENDENTIF 0007",
"PENDENTIF 0157",
"COLLIER 0195",
"COLLIER 0144",
"COLLIER 0145",
"COLLIER 0149",
"COLLIER 0139",
"Louparum, Artiste libre, création artisanale",
"POCHETTE 0058",
"POCHETTE 0029",
"BLOC NOTE 0062",
"BLOC NOTE 0065",
"BLOC NOTE 0068",
"BIJOU DE SAC 0030",
"BIJOU DE SAC 0031",
"BIJOU DE SAC 0032",
"Louparum, Artiste libre, création artisanale, articles en laine, laine, beret",
"BERET 0008",
"BERET 0005",
"BERET 0009",
"BERET 0010",
"BERET ENFANT 0012",
"COLLIER 055",
"COLLIER 056",
"COLLIER 057",
"Louparum, Artiste libre, création artisanale, mariage, accessoires de mariage",
"COLLIER 036",
"BOUTONNIERE 039",
"TURBAN 191",
"COLLIER 255",
"COLLIER 0168",
"PEIGNE 0171",
"COLLIER 019",
"Accessoires de mode",
"BOULE COUTURE  00001",
"BOULE COUTURE  00003",
"BOULE COUTURE  00004",
"BOULE COUTURE  00004",
"BOULE COUTURE  00005",
"BOULE COUTURE  00006",
"BOULE COUTURE  00007",
"BOULE COUTURE  00008",
"BOULE COUTURE  00009",
"BOULE COUTURE  00010",
"BOULE COUTURE  00011",
"BOULE COUTURE  00012",
"BOULE COUTURE  00013",
"BOULE COUTURE  00014",
"BOULE COUTURE  00015",
"BOULE COUTURE  00016",
"BOULE COUTURE  00017",
"BOULE COUTURE  00018",
"BOULE COUTURE  00019",
"BOULE COUTURE  00020",
"BOULE COUTURE  00021",
"BOULE COUTURE  00022",
"BOULE COUTURE  00023",
"BOULE COUTURE  00024",
"GRIS GRIS  0033",
"GRIS GRIS  0034",
"GRIS GRIS  0035",
"GRIS GRIS  0036",
"GRIS GRIS  0037",
"GRIS GRIS  0038",
"TURBAN 0048",
"TURBAN 0054",
"TURBAN 0051",
"Mes salons, mes expos",
"Liens favoris");
descArray = new Array("<META NAME=DESCRIPTION CONTENT=site destin? ? faire d?couvrir bijoux et accessoires, fabriqu?s artisanalement dans des mat?riaux naturels non allergis...",
"",
"NB : Chaque prix par article comprend les frais de transport",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"NB : Chaque prix par article comprend les frais de transport",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"NB : Chaque prix par article comprend les frais de transport",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"NB : Chaque prix par article comprend les frais de transport",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"NB : Chaque prix par article comprend les frais de transport",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"&",
"",
"");
sublinksArray = new Array(138);
var linksCount = 138;


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>");
}

