// ----------------------------------------------------------------------------
// Lauyan Software Javascript Search Engine 1.0
//
// 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_SEARCH_BUTTON = "Rechercher";
STR_SCORE = "Score";
STR_TERMS = "Termes";
STR_SEARCH_SIZE = "40";
MIN_WORD_LEN = 2;
DISPLAY_SRCH_INFO = 0;
USE_UTF8 = 0;
REMOVE_ACCENTS = 1;
BOLD_LINKS = 1;
ONLINE_WEBSITE = 1;

namesArray = new Array(" olivier baboin educateur specialise education accompagnement ime cat art contemporain sessad institution etablissement partenariat expositions deglingues pictura projet creativite acte createur creer creation libre expression plastique artiste plasticien sensibiliser environnement culture socialisation enfant personne handicap handicape difficulte publier ",
" olivier baboin art education specialisee libre expression artistique creation creativite acte createur educateur specialise ",
" sessad olivier baboin educateur specialise education accompagnement ime cat art contemporain etablissement partenariat deglingues pictura projet creativite createur creation libre expression artiste sensibiliser environnement enfant plastique handicap difficulte  ",
" qu'est-ce sessad  ",
" services soins domicile  ",
" art institution specialisee activite creativite acte createur creation educateur temps ",
" avant-propos  ",
" pourquoi l'art a-il place dans l'institution specialisee  ",
" art activite  ",
" creativite acte createur creation camus arno stern  ",
" educateur presence accompagnement marie-claude joulia mitz congruence carl rogers jerome bruner maniere d'etre  ",
" temps objectif subjectif education specialisee specialise  ",
" autres experiences projets artistiques  ",
" genese projet espace pictural d'expression libre  ",
" fondements lieux espace interet deplacement rencontre support  ",
" beau art contemorain sensibiliser environnement respect land acceder exterieur pratique artistique  ",
" reamenagement projet libre expression plastique 2008 2009  ",
" realisation d'une peinture murale sessad  ",
" titre album  ",
" objectis travail items groupe  ",
" photos 2008-2009  ",
" pieces realisees 08-09  ",
" pieces realisees 2008-2009  ",
" pieces realisees 2008-2009  ",
" pieces realisees 2008-2009  ",
" pieces realisees 2008-2009  ",
" micro videos  ",
" revue presse  ",
" pourquoi contacter libre expression plastique site est comme precise page d'accueil fonde sur reflexion personnelle quelques experiences projets j'ai mettre oeuvre institution n'est pas reserve seul handicap mental bien adresse l'accompagnement specialise aboutissement s'inscrit dans continuite demarche travail d'interrogation peut apporter pratique artistique etape plus mon parcours d'investigation fois personnel professionnel deux aspects pouvant etre dissocies avoir conscience c'est favoriser savoir particulierement important relation autrui voila ces doivent d'etre remis question risque sinon fonctionner automates avec evidences peuvent dommageable qualite notre quotidien aupres personnes accompagnees parce-qu'elles sont toutes differentes leur histoire leurs difficultes atouts devons meme adapter rendre disponible rencontre depend elle conditionne immanquablement suite fait presenter biais d'internet vouloir partager susciter reflexions debats aussi elargir reseau contacts alimenter projet cours creer dynamique vaste bases sous ses formes danse chant photographique video partageons nos savoirs enrichissons-nous mutuellement pratiques l'education specialisee artistes plasticiens investi association simplement interesse themes abordes n'hesitez faites part merci ",
" projets cette rubrique est reservee libre expression artistique voulez faire partager librexplast@hotmail contactez-lep ",
" atelier d'expression ime chardonnets veyre-monton cet libre expression ete cree joelle martin educatrice specialisee formation ayant egalement suivi enseignements art therapie l'ecole l'art cru remercie ainsi collaborateurs stagiaires enfants adolescents l'ime chardonnet font vivre espace dedie artistique mme directrice l'interet confiance qu'ils portent site lep ",
" projet ceramique ime chardonnet  ",
" atelier peinture  ",
" peintures aux ocres  ",
" videotheque ime chardonnet d'autres videos vont rapidement venir completer patientez quelques secondes telechargement chaque fichier ",
" mentions legales  ",
" http libre-expression-plastique tinc key=hlmdghba start=-1 reverse=1 ",
" http libre-expression-plastique tinc key=zwwwdjm1 start=-1 reverse=1 ",
" http pagesperso-orange galeriepictura index htm ",
" http www argos asso fr ",
" http pagesperso-orange jipol ",
" http membres lycos sculpteurgaland ",
" reflexion sur handicap  ",
" fauteuil roulant  ",
" projet jardin imaginaire  ",
" pieces realisees rapport projet jardin imaginaire  ");
urlsArray = new Array("../introduction/index.html",
"../accueil/index.html",
"../lesessad/index.html",
"../quest-cequeleses/index.html",
"../lesdifferentstyp/index.html",
"../arteducationspec/index.html",
"../avant-propos/index.html",
"../eninstitutionspe/index.html",
"../artactivite/index.html",
"../creativiteactecr/index.html",
"../leducateur/index.html",
"../letemps1/index.html",
"../autresexperience/index.html",
"../lagenese/index.html",
"../leprojetpeinture/index.html",
"../leprojet/index.html",
"../mapage3/index.html",
"../mapage6/index.html",
"../albumphoto5/index.html",
"../leprojetdinterac/index.html",
"../2008-2009/index.html",
"../pieces08-09/index.html",
"../serie13/index.html",
"../serie12/index.html",
"../mapage/index.html",
"../albumphoto/index.html",
"../mapage4/index.html",
"../revuedepresse1/index.html",
"../contacterlibreex/index.html",
"../vosprojets/index.html",
"../mapage1/index.html",
"../albumphoto1/index.html",
"../albumphoto2/index.html",
"../albumphoto3/index.html",
"../mapage2/index.html",
"../mentionslegales/index.html",
"../forumlep/index.html",
"../livredorlep/index.html",
"../pictura/index.html",
"../argos/index.html",
"../siteweb/index.html",
"../siteweb1/index.html",
"../fauteuilroulant/index.html",
"../albumphoto6/index.html",
"../mapage5/index.html",
"../albumphoto4/index.html");
titlesArray = new Array("LIBRE EXPRESSION PLASTIQUE ",
"LE HASARD N'EXISTE PAS ...",
"LE SESSAD",
"QU'EST-CE QUE LE SESSAD ?",
"LES SERVICES DE SOINS A DOMICILE",
"ART & EDUCATION SPECIALISEE",
"AVANT-PROPOS",
"POURQUOI L'ART A-IL SA PLACE DANS L'INSTITUTION SPECIALISEE ?",
"ART / ACTIVITE",
"CREATIVITE, ACTE CREATEUR, CREATION, COMMENT LES DEFINIR ?",
"LA PRESENCE DE L'EDUCATEUR",
"LE TEMPS UN ALLIE IMPORTANT",
"AUTRES EXPERIENCES DE PROJETS ARTISTIQUES",
"LA GENESE DU PROJET espace pictural d'expression libre en C.A.T",
"LE PROJET peinture murale en IMPRO",
"LE PROJET LIBRE EXPRESSION PLASTIQUE",
"Réaménagement du projet Libre Expression Plastique 2008.2009",
"Réalisation d'une peinture murale au SESSAD",
"Titre de votre album",
"LE PROJET D'INTERACTION EDUCATIVE",
"phoTos 2008-2009",
"pIèceS réAliséeS en 08-09",
"pièces réalisées en 2008-2009",
"pièces réalisées en 2008-2009",
"pièces réalisées en 2008-2009",
"pièces réalisées en 2008-2009",
"Micro vidéos 2",
"REVUE DE PRESSE",
"POURQUOI CONTACTER LIBRE EXPRESSION PLASTIQUE ?",
"VOS PROJETS",
"Atelier d'expression  IME Les Chardonnets à VEYRE-MONTON",
"projet céramique IME Le chardonnet",
"atelier peinture",
"peintures aux ocres",
"Vidéothèque IME Le Chardonnet",
"MENTIONS LEGALES",
"http://libre-expression-plastique.fr/tinc?key=hlmdGHBa&start=-1&reverse=1",
"http://libre-expression-plastique.fr/tinc?key=zWWwdJM1&start=-1&reverse=1",
"http://pagesperso-orange.fr/galeriepictura/index.htm",
"http://www.argos.asso.fr/",
" http://pagesperso-orange.fr/jipol",
"http://membres.lycos.fr/sculpteurgaland/",
"Réflexion sur le handicap",
"fauteuil roulant",
"Projet le jardin imaginaire",
"pièces réalisées en rapport au projet le jardin imaginaire");
descArray = new Array("Art et éducation spécialisée se rejoignent pour mieux interroger les liens qu'ils entretiennent dans la relation d'aide, Olivier Baboin : *la pratique...",
"Olivier Baboin, éducateur spécialisé en SESSAD se sert de la pratique artistique comme soutien à son accompagnement éducatif.",
"Olivier Baboin éducateur spécialisé en SESSAD se sert de la pratique artistique dans son accompagnement éducatif",
"",
"",
"",
"",
"",
"Dans cette rubrique, j'aborde les notions de RITUEL, de CADRE et de CULTURE.",
"             Dans ce rubrique, j'illustre ces notions au travers d'une expérience vécue avec Le cas de A.  ",
"",
"",
"",
"",
"",
"OLIVIER BABOIN, Art et éducation spécialisée se rejoignent pour mieux interroger les liens qu'ils entretiennent dans la relation d'aide",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"            Ce site est comme je le précise en page d'accueil, fondé sur une réflexion personnelle et quelques expériences de projets que j'ai pu mett...",
"                       Cette rubrique est réservée à vos projets de libre expression artistique que vous voulez nous faire partager.librexplast@hotmai...",
"Cet atelier de libre expression a été créé par JOELLE MARTIN , éducatrice spécialisée de formation ayant également suivi les enseignements en Art et T...",
"",
"",
"",
" D'autres vidéos vont rapidement venir compléter la vidéothèque. Patientez quelques secondes pour le téléchargement de chaque fichier.",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"");
sublinksArray = new Array(46);
var linksCount = 46;


ALLWORDSONLY = 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 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)
  }
  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 )
			{
				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><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
	  if( !ALLWORDSONLY || (ALLWORDSONLY && res_table[q][2] == significantwords) )
	    {
        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;'>");
			if( !ALLWORDSONLY )
				document.write("" + STR_TERMS + ": " + res_table[q][2] + " - " );
			document.write("" + 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>");
}
