// ---------------------------------------------------------------------------- // Lauyan Software Javascript Search Engine 1.0 // // This file is the JavaScript search engine for a website created by TOWeb // // Copyright (C) LAUYAN SOFTWARE 2006 // web: http://www.lauyan.com // ----------------------------------------------------------------------------  STR_SEARCH_QUERY_MSG = "Résultats de la recherche pour"; STR_NO_RESULT = "Aucun résultat trouvé"; STR_SEARCH_BUTTON = "Rechercher"; 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 = 0; ONLINE_WEBSITE = 1;  namesArray = new Array(" entreprise peinture travaux devis paris ile-de-france departements 94 ", " peinture decoration renovation  ", " revetements murs sols  ", " devis peinture paris entreprises entreprise travaux renovation hauts seine saint denis val marne peintre batiment murs sols artisan decoration  ", " devis peinture paris travaux ile france departements 91 ", " cas d'urgence contactez-nous via cette page ", " tous devis travaux peinture l'entreprise bachet ", " devis peinture paris entreprises entreprise travaux renovation hauts seine saint denis val marne peintre batiment murs sols artisan decoration  ", " devis peinture paris entreprises entreprise travaux renovation hauts seine saint denis val marne peintre batiment murs sols artisan decoration  ", " devis peinture paris entreprises entreprise travaux renovation hauts seine saint denis val marne peintre batiment murs sols artisan decoration  ", " nos fournisseurs peinture france region parisienne  ", " associations consommateurs france situees region parisienne  ", " unions professionnelles peinture france  ", " instituts formation peinture france  ", " devis definition contenu application ", " peinture definition nature ", " paris capitale francaise region ile france ", "  ", " tarifs nos prestations notre intervention peinture decoration  ", " tarifs nos prestations pose revetements aux murs sols  ", " tarifs nos prestations travaux ravalement facades d'immeubles  ", " tarifs nos prestations maconnerie  ", " entreprise  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  "); urlsArray = new Array("../presentation/index.html", "../peinture/index.html", "../revetementsdesmu/index.html", "../ravalement/index.html", "../devis-travaux-peinture/travaux-devis-peinture-idf-fr10-paris-75116.php", "../mapage8/index.html", "../paris75/index.html", "../devis-travauxpei/index.html", "../devis-travauxpe1/index.html", "../devis-travauxpe2/index.html", "../mapage1/index.html", "../mapage2/index.html", "../mapage3/index.html", "../mapage4/index.html", "../mapage7/index.html", "../mapage5/index.html", "../mapage6/travaux-de-peinture-paris-75.php", "../envoiformail/mioche2.php", "../mapage9/index.html", "../mapage10/index.html", "../mapage11/index.html", "../mapage12/index.html", "../mapage13/indo.html", "../mapage15/index.html", "../entreprise-de-peinture/travaux-devis-peinture-france.php", "../mapage14/form2mail.php", "../redirection/direct.php", "../visiteur/index.php", "../images/index.php", "../textes/index.php", "../sons/index.php", "../videos/index.php"); titlesArray = new Array("Entreprise de Peinture - Travaux Devis Peinture : à PARIS, île-de-France (départements 75,92,93,94)", "Peinture Décoration et Rénovation Peinture", "Revêtements des murs et sols", "Ravalement de Façades d'immeubles : à Paris, région île de France (départements 75,92,93,94)", "contactez sans délai : entreprise bachet peinture pour tous vos travaux devis rénovation peinture bâtiment d'urgence en île de france à paris et banli...", "Cas d'urgence ? contactez-nous via cette page", "basée en europe, france métropolitaine, île-de-france, paris, rue mademoiselle : Bachet - entreprise de peinture en bâtiment pour vos travaux devis ré...", "entreprise bachet peinture : travaux devis rénovation peinture dans les villes de la région île de france dans les hauts de seine - 92 : Antony, Asniè...", "entreprise bachet peinture : travaux devis rénovation peinture dans les villes de la région île de france dans la seine saint denis - 93 : Aubervillie...", "entreprise bachet peinture : travaux devis rénovation peinture dans les villes de la région île de france dans le val de marne - 94 : Alfortville, Cha...", "Fournisseurs en peinture de l'entreprise bachet peinture", "associations agréées pour la protection des consommateurs en France", "Unions professionnelles regroupant les entreprises de peinture", "centres de formation aux métiers de la peinture et décoration", "devis : définition, contenu, application, conséquences, personnes concernées", "peinture : définition et nature", "paris : capitale française", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "Tarifs de nos prestations pour notre intervention en peinture décoration", "Tarifs de nos prestations pour la pose de revêtements aux murs et sols", "Tarifs de nos prestations pour les travaux de ravalement de façades d'immeubles ", "Tarifs de nos prestations en maçonnerie", "entreprise", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant", "entreprise bachet peinture : entreprise de peinture - devis travaux peinture (75) paris (11) ile de france sous 48h00 à prix détaillé intéressant"); descArray = new Array("Entreprise de PEINTURE à PARIS (75), Bachet réalise vos Travaux Peinture avec Devis détaillés et intéressants, Téléphones : 06 03 12 80 30 et 01 44 49...", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); sublinksArray = new Array(32); var linksCount = 32;   // 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 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 = getParam("jse_query");   query = query.replace(/[\++]/g, " ");  // replace any '+' with spaces   query = query.replace(/\</g, "&lt;");   query = query.replace(/[\"+]/g, " ");    // 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>");   }	 	else 	{ 	 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( "" + STR_SEARCH_QUERY_MSG + " : <strong>" +query+"</strong><br>");   }   // init result table information   res_table = new Array(linksCount);   for( t=0; t<linksCount; t++ )   {     res_table[t] = new Array(3);     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)   }    // begin search ...   for( i=0; i<searchWords.length; i++ )   {     keyword = searchWords[i];     if( keyword.length > MIN_WORD_LEN ) // skip small words 	  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 ) 				{ 	        if( res_table[t][3].indexOf( "'" + urlsArray[k] + "'" ) == -1 ) 	        { /*	           		if( BOLD_LINKS ) {  						res_table[t][3] += "<tr><td width='50'>&nbsp</td><td><b><a href='" + urlsArray[k] +"'>" + titlesArray[k] + "</a></b></td></tr>"; 					} else	 */	          res_table[t][3] += "<tr><td width='35'>&nbsp</td><td><a href=\"" + urlsArray[k] + lnktarget + "\">" + titlesArray[k] + "</a></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><b>" + STR_NO_RESULT + "</b></p>");   }    else    { 	 // sort by words found and scores     res_table.sort(SortCompare);	     // display the results     for( q=0; q<found; q++ )       if( res_table[q][1] > 0 ) // display only results with a positive score 	    {         t = res_table[q][0];    // get page index         if( BOLD_LINKS ) {           document.writeln("<br><b>" + (q+1) + ". <a href=\"" + urlsArray[t] + lnktarget + "\">" + titlesArray[t] + "</a></b>" );         } else           document.writeln("<br><b>" + (q+1) + ".</b> <a href=\"" + urlsArray[t] + lnktarget + "\">" + 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;'>" + STR_TERMS + ": " + res_table[q][2] + " - " + STR_SCORE + ": " + res_table[q][1] ); 					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>' + res_table[q][3] + '</table>' );       	} else document.writeln("<br>");       }   }   document.writeln("<br>"); }    
