﻿// ----------------------------------------------------------------
function ipcWipoInit()
{
  // Answers numbers
  top.firstPageAnswerNumber  = 5;
  top.secondPageAnswerNumber = 30;

  // Structure lsDemoMain
  top.lsDemoMain = new LsMain();
  top.lsDemoMain.getQueryAnalysis = true;  // We always want the query analysis in local test mode...
  top.lsDemoMain.currentApplication = top.prefixApplication + top.currentLanguage;
  top.lsDemoMain.maxAnswer          = secondPageAnswerNumber;
  top.lsDemoMain.lsServerUrl = top.lsDemoMain.lsServerUrl.replace(/lrCgi\d+/, tacsyCgi);
  top.lsDemoMain.lrApiAlias = "/" + top.tacsyApi;
  top.lsDemoMain.lrCgiAlias = "/" + top.tacsyCgi;
  top.lsDemoMain.lsServerHost       = top.currentHost;
  top.lsDemoMain.lsServerPort = top.tacsyPort;
  top.stringIpcVersion += "<b>" +ipcVersion.substring(0,4) + "." + ipcVersion.substring(4,6) + "</b>";

  // Search language
  top.languages = new Array();
  top.languages["Fr"] = top.stringLanguageFr;
  top.languages["En"] = top.stringLanguageEn;

  // Answer level
  top.searchEngineLabel = new Array();
  top.searchEngineLabel["gradual"]  = top.stringGradual;
  top.searchEngineLabel["IPC_LMax"] = top.stringMaxDeep;
  top.searchEngineLabel["IPC_L4"]   = top.stringMainGroup;
  top.searchEngineLabel["IPC_L3"]   = top.stringSubClass;

  top.levelAnswerGradual = new Array();
  top.levelAnswerGradual[1] = "IPC_LMax";
  top.levelAnswerGradual[2] = "IPC_L4";
  top.levelAnswerGradual[3] = "IPC_L3";

  top.levelAnswer = new Array();
  top.levelAnswer["a"] = top.stringAdvanced;
  top.levelAnswer["c"] = top.stringCore;

  // MHC parameters
  top.mhcUserFactor     = 80;
  top.mhcDistanceFactor = 15;
  top.mhcIndexFactor    =  5;

  // Thresholds for automatic search
  top.thresholdBest1  = 750; // score of best subgroup  <= 75% -> maingroup
  top.thresholdBest2  = 600; // score of best maingroup <= 60% -> subclass

  // Threshold for each number of stars
  top.starThreshold = new Array();
  top.starThreshold[1]  = 400; // *     score <= 40%
  top.starThreshold[2]  = 600; // **    40% < score <=  60%
  top.starThreshold[3]  = 750; // ***   60% < score <=  75%
  top.starThreshold[4]  = 900; // ****  75% < score <=  90%
  top.starThreshold[5] = 1000; // ***** 90% < score <= 100%

  // MHC parameters
  top.mhcUserFactor     = 80;
  top.mhcDistanceFactor = 15;
  top.mhcIndexFactor    =  5;

  // IPC languages & URLs
  top.codeIBIS   = "";
  top.pageHtmIpc = "";

  top.ipcLang = new Array();
  top.ipcLang["default"] = top.stringIpcLanguageDefault;
  top.ipcLang["Fr"] = top.stringIpcLanguageFr;
  top.ipcLang["En"] = top.stringIpcLanguageEn;
  if (top.mode == "Expert")
  {
//     top.ipcLang["De"] = top.stringIpcLanguageDe;
//     top.ipcLang["Es"] = top.stringIpcLanguageEs;
//     top.ipcLang["Ru"] = top.stringIpcLanguageRu;
  }
  top.wipoLanguage = new Array();
  top.wipoLanguage["Fr"] = "fr";
  top.wipoLanguage["En"] = "en";
//   top.wipoLanguage["De"] = "de";
//   top.wipoLanguage["Es"] = "es";
//   top.wipoLanguage["Ru"] = "ru";

  var aliasIndex = window.location.href.lastIndexOf("/");
  top.baseUrl    = window.location.href.substring(0, aliasIndex);
}

// ----------------------------------------------------------------
function lsClearWindows()
{
  //  ftouitou;12/07/2; Ligne à effacer : lsClearWindow(top.lsAnswerFrame);
  displayWipoWindow();
}

// ----------------------------------------------------------------
function displayWipoWindow(symbol, subclass, full)
{
  if (symbol == undefined)   symbol = "";
  if (subclass == undefined) subclass = "";
  if (full == undefined)     full = 0;

  if (top.mode == "Expert")
  {
  }
  else // Version officielle
  {
  }
  top.IBISMain.location = buildWipoUrl(symbol, subclass, top.currentLevel, top.currentIPCLang, full);
}

// ----------------------------------------------------------------
// Affichage de la position dans l'arborescence WIPO
// ----------------------------------------------------------------
function lsGenerate(pFrame, pCode, pLanguage)
{
  var doc = pFrame.document;
     // var doc = window.document;
  doc.open();
  doc.writeln("<html>");
  doc.writeln("<head>");
  doc.writeln("<link href='styles/wipo.css' rel='stylesheet' type='text/css'>");
  doc.writeln("</head>");
  doc.writeln("<body>");
  doc.writeln(" <SCRIPT LANGUAGE=JavaScript>");
  doc.writeln("  IDC = '" + pCode + "';");
  doc.writeln("  PathToIBIS = '';");
  doc.write(" <"); doc.writeln("/SCRIPT>");
  doc.writeln(" <SCRIPT LANGUAGE=JavaScript SRC='bridge_jump.js'></SCRIPT>");
  doc.writeln(" <SCRIPT LANGUAGE=JavaScript>");
  doc.writeln("  window.location.href=A" + pLanguage + ";");
  doc.write(" <"); doc.writeln("/SCRIPT>");
  doc.writeln("</body>");
  doc.writeln("</html>");
  doc.close();
}

// ----------------------------------------------------------------------
// Affichage des réponses, avec dialogue de correction ortho-phonétique
// ----------------------------------------------------------------------

function lsPrintCorrectionDialog(pDialogDoc, pLsResult, pErrorNumber, pCorrectionPresent, pIsCoherent, pBgColor)
{
  pDialogDoc.open();
  pDialogDoc.writeln("<html>");
  pDialogDoc.writeln("<head>");
  pDialogDoc.writeln("<link href='styles/wipo.css' rel='stylesheet' type='text/css'>");
  pDialogDoc.writeln("</head>");
  pDialogDoc.writeln("<BODY BGCOLOR=" + pBgColor + ">");
  pDialogDoc.writeln("<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>");
  pDialogDoc.writeln("<TR bgcolor=#DDDDDD><TD align=left>");
  pDialogDoc.write("<FONT SIZE=-1><I>");
  (pErrorNumber == 1) ?
     pDialogDoc.write(correctionString1)
   : pDialogDoc.write(correctionString21 + pErrorNumber + correctionString22);

  pDialogDoc.writeln("</I></FONT></TD></TR>");
  pDialogDoc.writeln("<TR><TD><FONT SIZE=-1>");

  // Affichage des mots inconnus.
  var iterWord = 0;
  var alreadyDisplayed = false;
  for (iterWord in pLsResult.queryAnalysis.words)
  {
    var currentWord = pLsResult.queryAnalysis.words[iterWord];
    if (currentWord.wordAnalysis.known == LS_WORD_KNOWN.NO && currentWord.wordAnalysis.occurrencesInIndex == 0)
    {
      if (alreadyDisplayed) { pDialogDoc.write(", "); }
      pDialogDoc.write( "<B>" + currentWord.wordAnalysis.lemma + "</B>");
      alreadyDisplayed = true;
    }
  }

  if ((!pIsCoherent) || (!pCorrectionPresent))
  {
    pDialogDoc.writeln("</FONT></TD></TR>\n</TABLE>");
    pDialogDoc.writeln("</BODY>");
    pDialogDoc.writeln("</HTML>");
    pDialogDoc.close();
    return;
  }

  pDialogDoc.writeln("</FONT></TD></TR>");
  pDialogDoc.writeln("<FORM NAME=_corrections ACTION=\"javascript:void(null)\" onSubmit='top.lsMakeCorrectionString();top.lsSubmitQueryFromForm();return false'>");
  pDialogDoc.writeln("<TR bgcolor=#DDDDDD><TD align=left>");
  if (pCorrectionPresent)
  {
    pDialogDoc.writeln("<FONT SIZE=-1><I>" + top.correctionPropositions + "&nbsp;:</I></FONT></TD></TR>");
  }
  // On récupère la question initiale directement du formulaire d'où elle provient,
  //   plutôt que de pLsResult.initialQuery, où elle a pu subir des transformations
  //   (p.ex. remplacement des quotes par les #xxx;, etc.), ce qui perturbe les offsets
  //   de correction...
  var initialQuery = top.lsQueryFrame.document.forms.lsQueryForm.query.value;
  var offsetArray = new Array;
  lsMakeCorrectionArray(pLsResult, offsetArray);
  pDialogDoc.correctionArray = new Array;    // Va servir à former la question corrigée...
  var previousOffset = 0;
  var iterOffset = 0;
  for (iterOffset in offsetArray)
  {
    var currentOffset = offsetArray[iterOffset];
    // On doit afficher tel quel tout le texte compris entre la dernière position affichée
    //   et l'offset courant...
    if (previousOffset != currentOffset.offset)
    {
      var leftOffsetQuery = initialQuery.substring(previousOffset, currentOffset.offset);
      pDialogDoc.writeln("<TR><TD><FONT size=-1>" + leftOffsetQuery + "</FONT></TD></TR>");
      pDialogDoc.correctionArray[pDialogDoc.correctionArray.length] = leftOffsetQuery;
    }
    // Affichage de la combo affichant les corrections (si présentes) du mot courant.
    if (currentOffset.word.corrections && currentOffset.word.corrections.length > 0)
    { // Corrections présentes sur le mot courant...
      pDialogDoc.write("<TR><TD><SELECT NAME=_correction_" + pDialogDoc.correctionArray.length + " onChange='top.lsMakeCorrectionString();'>");
      pDialogDoc.correctionArray[pDialogDoc.correctionArray.length] = "";
      var iterCorrection = 0;
      for (iterCorrection in currentOffset.word.corrections)
      {
        var currentCorrection = currentOffset.word.corrections[iterCorrection];
        var currentSpelling = currentCorrection.spelling.replace(/&#8217;/, "'");
        pDialogDoc.write("<OPTION>" + currentSpelling);
      }
      pDialogDoc.write("</SELECT></TD></TR>\n");
    }
    else
    { // Pas de corrections sur le mot courant
      // On le place dans une edit box (avec le même format de nom que la select ci-dessus),
      //   pour que le lsMakeCorrectionString fonctionne...
      pDialogDoc.write("<TR><TD><INPUT TYPE=EDIT NAME=_correction_" + pDialogDoc.correctionArray.length);
      pDialogDoc.correctionArray[pDialogDoc.correctionArray.length] = "";
      pDialogDoc.write(" SIZE=" + currentOffset.word.wordAnalysis.lemma.length);
      pDialogDoc.write(" VALUE=" + currentOffset.word.wordAnalysis.lemma);
      pDialogDoc.write("></TD></TR>\n");
    }
    // Mise à jour de l'offset affiché précédent...
    previousOffset = currentOffset.offset + currentOffset.word.queryLength;
  }
  // Ne pas oublier d'afficher la portion restante de la question initiale...
  if (previousOffset < initialQuery.length)
  {
    var trailingQuery = initialQuery.substring(previousOffset);
    pDialogDoc.writeln("<TR><TD><FONT size=-1>" + trailingQuery + "</FONT></TD></TR>");
    pDialogDoc.correctionArray[pDialogDoc.correctionArray.length] = trailingQuery;
  }
  pDialogDoc.writeln("</TD></TR>");
  pDialogDoc.writeln("<TR><TD align=left>");
  pDialogDoc.writeln("<INPUT TYPE=BUTTON VALUE='" + top.correctionSubmit + "' onClick='top.lsMakeCorrectionString();top.lsSubmitQueryFromForm();'>");
  pDialogDoc.writeln("</TD></TR>");
  pDialogDoc.writeln("</FORM>");
  pDialogDoc.writeln("</TABLE>");
  pDialogDoc.writeln("</BODY>");
  pDialogDoc.writeln("</HTML>");
  pDialogDoc.close();
}


// ----------------------------------------------------------------------
function lsPrintAnswerAndCorrections(pAnswerDoc, pLsResult, pErrorNumber, pCorrectionPresent, pIsCoherent, pBgColor)
{
  var factor = (pCorrectionPresent == "1") ? 1 : 2;

  pAnswerDoc.open();
  pAnswerDoc.writeln("<HTML>");
  pAnswerDoc.writeln("<FRAMESET ROWS=\"*," + factor + "*\" border=1 framespacing='0' bordercolor=gray>");
  pAnswerDoc.writeln("<FRAME NAME=lsDialogFrame       SRC=\"javascript:void(null)\" SCROLLING=AUTO>");
  pAnswerDoc.writeln("<FRAME NAME=lsActualAnswerFrame SRC=\"javascript:void(null)\" SCROLLING=AUTO>");
  pAnswerDoc.writeln("</FRAMESET>");
  pAnswerDoc.writeln("</HTML>");
  pAnswerDoc.close();

  lsPrintCorrectionDialog(top.lsAnswerFrame.lsDialogFrame.document, pLsResult, pErrorNumber, pCorrectionPresent, pIsCoherent, pBgColor);
  IpcPrintAnswer(top.lsAnswerFrame.lsActualAnswerFrame.document, pLsResult, pBgColor, true);
}


// ----------------------------------------------------------------------
// Gestion du cas "aucune réponse", ou appel fonction affichage des réponses

function lsPrintAnswer(pAnswerDoc, pLsResult, pBgColor)
{
  IpcPrintAnswer(pAnswerDoc, pLsResult, pBgColor, true);
}


// ----------------------------------------------------
function IpcPrintAnswer(pAnswerDoc, pLsResult, pBgColor, pFirstPage)
{
  var lsAnswerText;
  var noAnswer = false;

  if (!pLsResult.classArray || !pLsResult.classArray.length)
  {
    lsAnswerText = top.stringNoMatch;
    noAnswer = true;
  }

  if (! noAnswer)
  {
    // IPC codes filter
    var ipcCodeFilter = top.lsQueryFrame.document.forms.lsQueryForm.ipcCodeFilter.value;
    var filter = {high:"", low:""}
    standardizeIpcCode(ipcCodeFilter, filter);
    var nbAnswers = countAnswers(pLsResult, filter);

    if (nbAnswers == 0)
    {
      lsAnswerText = top.stringNoMatchWithFilter;
      noAnswer = true;
    }
  }

  pAnswerDoc.open();
  pAnswerDoc.writeln("<HTML>");
  pAnswerDoc.writeln("<head>");
  pAnswerDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/default_2010.css' rel='stylesheet' type='text/css'>");
  pAnswerDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/wipo_2010.css' rel='stylesheet' type='text/css'>");
  pAnswerDoc.writeln("<link href='styles/wipo.css' rel='stylesheet' type='text/css'>");
  pAnswerDoc.writeln("</head>");
  pAnswerDoc.writeln("<body>");
  pAnswerDoc.writeln("<style type='text/css'>");
  pAnswerDoc.writeln("<!-- body {font-family: Arial, Verdana Geneva;font-size: 90%;  a:link {color: #0039B0; text-decoration: none;} /* bleu */ a:hover		{color: #E80005; text-decoration: underline} /* rouge */ -->");
  pAnswerDoc.writeln("</style>");


  // Demande de l'indice de satisfaction
  if (top.satisfactionFlag == 1)
  {
    displaySatisfactionChoices(pAnswerDoc, pLsResult);
  }
  pAnswerDoc.writeln("<!-- body {font-family: Arial, Verdana Geneva;font-size: 90%;  a:link {color: #0039B0; text-decoration: none;} /* bleu */ a:hover		{color: #E80005; text-decoration: underline} /* rouge */ -->");
 lsPrintUserFeedBack(pAnswerDoc);

  if (noAnswer)
  {
    pAnswerDoc.writeln("<FONT size =-1><i>" + lsAnswerText + "</i></FONT>");
    displayWipoWindow();
  }
  else
  {
    var reSubmit = 0;

    // Si mode de recherche "progressif", 
    // test du type et du score de la première réponse
    if (top.searchMode = "gradual")
    {
      var firstClass = pLsResult.classArray[0];
      var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
      var score = calculateMhcScore(firstClass);

      // Si 1ere réponse est un sous-groupe de score insuffisant
      // Ou si c'est un groupe de score insuffisant
      if (
      		((top.gradualLevel == 1) && (score <= top.thresholdBest1)) ||
          ((top.gradualLevel == 2) && (score <= top.thresholdBest2))
         )
      {
          ++ top.gradualLevel;
          selectedEngine = top.levelAnswerGradual[top.gradualLevel];
          top.lsSubmitQuery(queryForm.query.value, selectedEngine);
          reSubmit = 1;
      }
    }
    if (reSubmit == 0)
    {
      lsPrintListAnswers(pAnswerDoc, pLsResult, pBgColor, pFirstPage, filter, nbAnswers);
    }
  }

  pAnswerDoc.writeln("</P>");
  pAnswerDoc.writeln("</BODY>");
  pAnswerDoc.writeln("</HTML>");
  pAnswerDoc.close();
}

// ----------------------------------------------------
// Normalisation d'un code CIB
function normalize(symbol)
{
  var reSubclass  = new RegExp;
  reSubclass.compile( "^([A-Z])([0-9]+)?([A-Z])?$" );
  if (reSubclass.test(symbol)) return(symbol);
  
  var reGroup     = new RegExp;
  reGroup.   compile( "^([A-Z][0-9]+[A-Z])([0-9]{4})([0-9]{2}[1-9]*)0*$" );
  
   var reGroup2 = new RegExp;
  reGroup2.   compile( "^([A-Z][0-9]+[A-Z])([0-9]{4})([0-9]*[1-9])0*$" );
    
  if (reGroup.test(symbol))
  {
    var subclass = symbol.replace(reGroup, "$1");
    var group    = symbol.replace(reGroup, "$2");
    var subgroup = symbol.replace(reGroup, "$3");
      
    var re = /^0+/;
    var newgroup = group.replace(re, "");
    var code = subclass+" "+newgroup+"/"+subgroup;
    //    alert(code);
    return code;
  }
  
  if (reGroup2.test(symbol))
  {
    var subclass = symbol.replace(reGroup2, "$1");
    var group    = symbol.replace(reGroup2, "$2");
    var subgroup = symbol.replace(reGroup2, "$3");
      
    var re = /^0+/;
    var newgroup = group.replace(re, "");
    var code = subclass+" "+newgroup+"/"+subgroup;
    //    alert(code);
    return code;
  } 

  return "";
}

function standardizeIpcCode(pIpcCode, filter)
{
  if (pIpcCode == null || pIpcCode == "") return;

  pIpcCode=pIpcCode.toUpperCase();
  var s = "";
  for (i=0; i < pIpcCode.length; ++i)
  {
    if (pIpcCode.substring(i,i+1) != " ") s += pIpcCode.substring(i,i+1);
  }
  
  var reSection   = new RegExp;
  var reClass     = new RegExp;
  var reSubClass  = new RegExp;
  var reGroup     = new RegExp;

  reSection. compile( "^([A-H])$" );
  reClass.   compile( "^([A-H])([0-9]+)$" );
  reSubClass.compile( "^([A-Z])([0-9]+)([A-Z])$" );
  reGroup.   compile( "^([A-Z])([0-9]+)([A-Z])([0-9]+\/[0-9]+)$" );

  if (reSection .test(s))  filter.high = s;
  if (reClass   .test(s))  filter.high = s.replace(reClass,    "$1-$2");
  if (reSubClass.test(s))  filter.high = s.replace(reSubClass, "$1-$2-$3");
  if (reGroup   .test(s))
  {
    filter.high = s.replace(reGroup, "$1-$2-$3");
    filter.low  = s.replace(reGroup, "$4");
  }
  if (s != "" && filter.high == "") alert(ipcCodeFilterError);
  return;
}

// ----------------------------------------------------
// Test du filtre (code CIB)

function testFilter(pCode, pFilter)
{
  if (pFilter.high == "") return 1;
  if (pCode.substring(0, pFilter.high.length) != pFilter.high) return 0;
  if (pFilter.low != "")
  {
    if (pCode.indexOf(pFilter.low) == -1)  return 0;
  }
  return 1;
}

// ----------------------------------------------------
// Compter le nb de réponses correspondant au filtre

function countAnswers(pLsResult, pFilter)
{
  var count = 0;

  for (indice in pLsResult.classArray)
  {
    var currentClass = pLsResult.classArray[indice];
    if (currentClass.score == 0) continue;

    var folderAddress = currentClass.folderPath + "-" + currentClass.folderCode;
    // Filtre et inialisation de la première réponse pour la frame de droite
    if (testFilter(folderAddress, pFilter)) ++count;
  }
  return count;
}

// ----------------------------------------------------
// Affichage user feedback

function lsPrintUserFeedBack(pAnswerDoc)
{
  pAnswerDoc.writeln("<FONT size=-1>");
  pAnswerDoc.writeln("<a href=" + top.baseUrl + "/TACSYfeedback.htm target=_blank>" + top.stringUserFeedback+"</a>");
  pAnswerDoc.writeln("</FONT>");
  pAnswerDoc.writeln("<br>");
}

// ----------------------------------------------------
// Affichage liste de réponses

function lsPrintListAnswers(pAnswerDoc, pLsResult, pBgColor, pFirstPage, pFilter, pNbAnswers)
{
  // Formulaire pour le codage
  top.__LSRESULT__ = pLsResult;

  pAnswerDoc._pLsResult = pLsResult;
  var classNumber = pLsResult.classArray.length;

  pAnswerDoc.writeln("<p align=center class='Title' style='font-size: 1em;'><b>");
  if (pNbAnswers > 1)
  {
   pAnswerDoc.write(top.stringCodesFound);
  }
  else
  {
   pAnswerDoc.write(top.stringCodeFound);
  }
  pAnswerDoc.writeln("</b></p>");

  // Affichage de chaque réponse (chaque entrée CIB)

  pAnswerDoc.writeln("<TABLE align=center CELLPADDING=2 CELLSPACING=0 BORDER=1 bordercolorlight='#999999' style='border-collapse: collapse' WIDTH='30%'>");
  pAnswerDoc.writeln("<tr>");
  pAnswerDoc.writeln("<td bgcolor='#E7F2F7'><br><FONT size=-1><b>" + top.resultNumber + "</b></FONT></td>");
  pAnswerDoc.writeln("<td bgcolor='#E7F2F7'><br><FONT size=-1><b>" + top.ipcSymbol + "</b></FONT></td>");
  pAnswerDoc.writeln("<td bgcolor='#E7F2F7'><br><FONT size=-1><b>" + top.confidence + "</b></FONT></td>");
  pAnswerDoc.writeln("</tr>");
  // Affichage de chaque classe.
  var currentRank = 0;
  var lastMhcScore = 0;
  var firstAnswer = -1;

  for (indice in pLsResult.classArray)
  {
    var currentClass = pLsResult.classArray[indice];
    if (currentClass.score == 0) continue;

    var folderAddress = currentClass.folderPath + "-" + currentClass.folderCode;
    // Filtre et inialisation de la première réponse pour la frame de droite
    if (! testFilter(folderAddress, pFilter)) continue;
    if (firstAnswer == -1) firstAnswer = indice;

    ++currentRank;

    var symbol   = getSymbol(currentClass.folderUrl);
    var code     = normalize(symbol);
    var subclass = (symbol.length > 4) ? symbol.substring(0, 4) : symbol;

    pAnswerDoc.writeln("<TR>");
    // Numéro d'ordre de la réponse
    pAnswerDoc.write("<TD NOWRAP ALIGN=left VALIGN=MIDDLE bgcolor='#33CCFF'><FONT SIZE=-2>(");
    pAnswerDoc.write(currentRank);
    pAnswerDoc.writeln(")&nbsp;</FONT></TD>");
    // Affichage du code CIB + ancrage sur Path Navigator)
    pAnswerDoc.write("<td nowrap align=left valign=middle bgcolor='#33CCFF'><font size=-1>");
    pAnswerDoc.write("&nbsp;");
    pAnswerDoc.write("<a title='" + top.stringIpcPublication + "' target='_blank' href='");
    pAnswerDoc.write(buildWipoUrl(symbol, subclass, top.currentLevel, top.currentIPCLang, 1));
    pAnswerDoc.write("'>");
    pAnswerDoc.write(code);
    pAnswerDoc.write("</a>");
    pAnswerDoc.writeln("</font></td>");
  /*COMMENTED BY CCY  pAnswerDoc.write("<td nowrap align=right valign=middle>");
    pAnswerDoc.write("<a title='" + top.stringIpcPublication + "' target='_blank' href='");
    pAnswerDoc.write(buildWipoUrl(symbol, subclass, top.currentLevel, top.currentIPCLang, 1));
    pAnswerDoc.write("'>");
    pAnswerDoc.write  ("<img border=0 src=" + top.baseUrl + "/images/");
    pAnswerDoc.write(top.currentLevel == "a" ? "advanced.gif" : "core.gif");
    pAnswerDoc.write("></a>");
    pAnswerDoc.writeln("</td>"); */
    pAnswerDoc.write("<TD NOWRAP ALIGN=right VALIGN=MIDDLE bgcolor='#33CCFF'>");
    var currentMhcScore = calculateMhcScore(currentClass);
    if (lastMhcScore > 0 && currentMhcScore > lastMhcScore)
    { // Il ne faut pas que ce calcul bouleverse l'ordre des réponses !!!
      currentMhcScore = lastMhcScore;
    }
    lastMhcScore = currentMhcScore;
    printStars(pAnswerDoc, currentMhcScore);

    //    pAnswerDoc.write("<FONT SIZE=-1>[" + scoreToDisplay + "&nbsp;%]</FONT>" );
    //pAnswerDoc.write("<FONT SIZE=-1>[" + scoreToDisplay + extraString + "&nbsp;%]</FONT>" );


    if (pFirstPage && currentRank == top.firstPageAnswerNumber &&
        top.firstPageAnswerNumber < top.secondPageAnswerNumber &&
        pLsResult.totalAnswer > top.firstPageAnswerNumber)
    { // On a atteint le nombre maximal de réponses à afficher dans la première page.
      // On affiche le bouton "More" donc, qui permettra l'affichage des réponses restantes.
      pAnswerDoc.write("<TR><TD COLSPAN=4 ALIGN=right><font size=-1>");
      top._answerDoc = pAnswerDoc;
      top._lsResult  = pLsResult;
      top._bgColor   = pBgColor;
      pAnswerDoc.write("<A HREF=\"javascript:top.IpcPrintAnswer(top._answerDoc, top._lsResult, top._bgColor, false)\">");
      pAnswerDoc.write(top.stringButtonMore);
      pAnswerDoc.write("</A>");
      pAnswerDoc.writeln("</font></TD></TR>");
      break;
    }
  }

  pAnswerDoc.writeln("</TABLE>");

  // Affichage de l'arborescence de la première réponse
  var symbol   = getSymbol(pLsResult.classArray[firstAnswer].folderUrl);
  var subclass = (symbol.length > 4) ? symbol.substring(0, 4) : symbol;
  displayWipoWindow(symbol, subclass);
}

// ----------------------------------------------------
function getSymbol(folderUrl)
{
  var i = folderUrl.indexOf("@@");
  if (i == -1) return folderUrl;
  var symbolA = folderUrl.substring(0, i);
  var symbolC = folderUrl.substring(i+2);
  return (top.currentLevel == "a" || symbolC == "") ? symbolA : symbolC;
}
// ----------------------------------------------------
// Affichage liste de réponses

function displaySatisfactionChoices(pAnswerDoc, pLsResult)
{
  printValidationFormBegin(pAnswerDoc);
  printValidationForm(pAnswerDoc, pLsResult.sanitizedQuery, top.lsDemoMain.currentApplication);
  pAnswerDoc.writeln("<br><br><FONT size=-1>" + top.satisfactionString + "</FONT>");

  pAnswerDoc.writeln("<SELECT NAME=commentaire onChange='top.lsTempFrame.focus();top.lsChangeValidation();'>");
  for (iterSatisfaction in top.satisfactions)
  {
    pAnswerDoc.write("<OPTION VALUE=" + iterSatisfaction);
    pAnswerDoc.write(">" + top.satisfactions[iterSatisfaction]);
  }
  pAnswerDoc.write  ("</SELECT>");
  printValidationSubmitButton(pAnswerDoc);
  printValidationFormEnd(pAnswerDoc);
  //  pAnswerDoc.writeln("<hr>");
}
// ----------------------------------------------------

function printStars(pAnswerDoc, pScore)
{
  for (var iterStar in top.starThreshold)
  {
    if (pScore <= top.starThreshold[iterStar])
    {
      var starsCounter = iterStar;
      break;
    }
  }

  for (iterStar = 0; iterStar < starsCounter; ++iterStar)
  {
    pAnswerDoc.write("<img id='confidence' src='../tacsy/images/star.gif'>");
  }

}
// ----------------------------------------------------

function changeLanguage()
{
  var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
  top.currentLanguage = queryForm.selectLanguage[queryForm.selectLanguage.selectedIndex].value;
  (top.currentLanguage == "Fr") ? top.setStringsFr() : top.setStringsEn();
  top.currentIPCLang    = top.currentLanguage;
  top.ipcWipoInit();
  top.lsClearWindows();
  top.lsClearWindow(top.lsAnswerFrame);
  top.lsPrintQueryFrame();
  top.lsPrintHeaderFrame();
}
// ----------------------------------------------------
function changeLanguageRightSide()
{
  var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
  top.currentLanguage = queryForm.selectLanguage[queryForm.selectLanguage.selectedIndex].value;
  if (top.currentLanguage == "Fr")
  {
	top.setStringsEn();
      queryForm.selectLanguage[queryForm.selectLanguage.selectedIndex].value="En"
	top.currentIPCLang = "En";
	top.currentLanguage = "En";
	currentLanguage = "En";
  }
else{
	top.setStringsFr();
      queryForm.selectLanguage[queryForm.selectLanguage.selectedIndex].value="Fr"
	top.currentIPCLang == "Fr";
	top.currentLanguage = "Fr";
	currentLanguage = "Fr";
}

  top.ipcWipoInit();
  top.lsClearWindows();
  top.lsClearWindow(top.lsAnswerFrame);
  top.lsPrintQueryFrame();
  top.lsPrintHeaderFrame();
}
// ----------------------------------------------------
function changeIpcVersion()
{
  var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
  top.currentIpcVersion = queryForm.selectIpcVersion[queryForm.selectIpcVersion.selectedIndex].value;
  top.ipcWipoInit();
  top.lsClearWindows();
  top.lsClearWindow(top.lsAnswerFrame);
  top.lsPrintQueryFrame();
  top.lsPrintHeaderFrame();
}
// ----------------------------------------------------

function changeIPCLang()
{
  var oldIPCLang = top.currentIPCLang;

  var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
  top.currentIPCLang = queryForm._selectIPCLang[queryForm._selectIPCLang.selectedIndex].value;
  if (top.currentIPCLang == "default")
  {
    top.currentIPCLang = top.currentLanguage;
  }

  top.displayWipoWindow();
}
// ----------------------------------------------------

function changeLevel()
{
  var queryForm = top.lsQueryFrame.document.forms.lsQueryForm;
  top.currentLevel = queryForm.selectLevel[queryForm.selectLevel.selectedIndex].value;
  top.lsSubmitQueryFromForm();
}

// ----------------------------------------------------
function lsQueryReInit()
{
  top.codeIBIS = "";
  top.lsClearWindow(top.lsAnswerFrame);
  top.displayWipoWindow();
}

// ----------------------------------------------------
function lsPrintQueryFrame()
{
  var thisDoc = top.lsQueryFrame.document.open();
  thisDoc.writeln("<html>");
  thisDoc.writeln("<head>");
  thisDoc.writeln("<link href='styles/wipo.css' rel='stylesheet' type='text/css'>");
  thisDoc.writeln("<link href='styles/default.css' rel='stylesheet' type='text/css'>");
  thisDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/default_2010.css' rel='stylesheet' type='text/css'>");
  thisDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/wipo_2010.css' rel='stylesheet' type='text/css'>");
  thisDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/ipc.css' rel='stylesheet'>");
  thisDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/reset.css' rel='stylesheet'>");
  thisDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/grid.css' rel='stylesheet'>");
  thisDoc.writeln("<link media='screen' type='text/css' href='http://wipo.int/ipcpub/shared/css/ipcpub.css' rel='stylesheet'>");
  thisDoc.writeln("<link media='screen' type='text/css' href='http://wipo.int/ipcpub/shared/css/ripcis.css' rel='stylesheet'>");
  thisDoc.writeln("</head>");
  thisDoc.writeln("<body>");
  if (top.mode != "Expert")
  {
    thisDoc.writeln("<form method=post action=\"javascript:void(null)\" name=lsQueryForm onSubmit='return top.lsSubmitQueryFromForm()'>");
  }
  else
  {
    thisDoc.writeln("<form method=post action=\"javascript:void(null)\" name=lsQueryForm onSubmit='return top.lsSubmitQueryFromForm()'>");
  }
  // Fin Look WIPO
  
  thisDoc.writeln("<div class='dl15 mr-1000' id='menu'>");
  thisDoc.write("                <div class='dl15 mb4'><p class='menu'>&nbsp;<a target='_blank' href='http://www.wipo.int/classifications/ipc/" + top.currentLanguage.toLowerCase() + "' id='ipc_home_page' class='xtrnl'><span id='ipc_home_page' class='trans'>" + top.stringIPCHomePage + "</span></a>&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;<a title='" + top.stringHelp + "' target='lsAnswerFrame' href='HelpWipo" + top.currentLanguage + ".htm' id='ipc_pub_help' class='xtrnl'><span id='help' class='trans'>" + top.stringHelp + "</span></a></p></div>");
  thisDoc.writeln("<div class='dl15 mb4'><p class='menu'><td nowrap><strong>" + stringQueryLabel + "</strong><input type=text name=query value='' size=30 onChange='top.codeIBIS='''><br><strong>" + top.ipcCodeFilterString +"</strong>");
  thisDoc.writeln("<p class='menu'><input type=text name=ipcCodeFilter value='' maxlength=14 size=7>");
  thisDoc.writeln("<p class='menu'><input type=submit value="+ top.stringSubmit + "></td>");
  thisDoc.writeln("<p class='menu'><div class='brdrtop'><img alt='' src='http://wipo.int/ipcpub/shared/img/null.gif'></div>");
  // Select search language
  thisDoc.writeln("<p class='menu'><td ALIGN=left VALIGN=BOTTOM nowrap><strong>" + stringLanguageLabel + "</strong><br> ");
  // Il faut déplacer le focus pour que IE puisse le remettre au bon endroit.
  // C'est comme ça.
  thisDoc.writeln("<select name=selectLanguage onChange='top.lsTempFrame.focus();top.changeLanguage();'>");
  for (iterLanguage in top.languages)
  {
    thisDoc.write("<option value=" + iterLanguage);
    if (iterLanguage == top.currentLanguage)
    {
        thisDoc.write(" selected");
    }
    thisDoc.write(">" + top.languages[iterLanguage]);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");
  thisDoc.writeln("<p class='menu'><div class='brdrtop'><img alt='' src='http://wipo.int/ipcpub/shared/img/null.gif'></div>");
  if (top.mode == "Expert")
  {
    // Select Ipc version
    thisDoc.writeln("<td align=left valign=bottom nowrap>" + top.stringIpcVersionChoice + " ");
    thisDoc.writeln("<select name=selectIpcVersion onChange='top.changeIpcVersion()'>");
    for (iterVersion in top.nameIpcVersion)
    {
      thisDoc.write("<option value=" + iterVersion);
      if (iterVersion == top.currentIpcVersion)
      {
        thisDoc.write(" selected");
      }
      thisDoc.write(">" +  top.nameIpcVersion[iterVersion]);
    }
    thisDoc.write  ("</select>");
    thisDoc.writeln("</td>");
  }


  // Select Ipc language
  
  
  thisDoc.writeln("<p class='menu'><td align=left valign=bottom nowrap><strong>" + stringModeIpcLabel + "</strong> ");
  thisDoc.writeln("<p class='menu'><select name=_selectIPCLang onChange='top.changeIPCLang()'>");
  for (iterLanguage in top.ipcLang)
  {
    thisDoc.write("<option value=" + iterLanguage + ">" +  top.ipcLang[iterLanguage]);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");
  
  
  thisDoc.writeln("<p class='menu'><div class='brdrtop'><img alt='' src='http://wipo.int/ipcpub/shared/img/null.gif'></div>");
  thisDoc.writeln("<p class='menu'><td align=left valign=bottom nowrap><strong>" + top.stringSEAnswer + "</strong> ");
  thisDoc.writeln("<p class='menu'><select name=searchEngineSelect onChange='top.lsSubmitQueryFromForm()'>");
  for (iterLevel in top.searchEngineLabel)
  {
    var currentSearchEngine = top.searchEngineLabel[iterLevel];
    thisDoc.write("<option value=" + iterLevel + ">" + currentSearchEngine);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");
  thisDoc.writeln("</div>");
  thisDoc.writeln("</div>");
  /*thisDoc.writeln("<table cellpadding=0 cellspacing=2 border=0 width=100%>");
  thisDoc.writeln("<tr>");
  thisDoc.writeln("<td nowrap class='Title'>" + top.stringTacsyVersion + "</td>");
  //	thisDoc.writeln("<td align=right colspan=2>Powered by <a href='http://www.lingway.com' style='text-decoration: none;' target=_blank><span class='logo'>&gt;lingway</span></a></td>");
  thisDoc.writeln("</tr>");
  thisDoc.writeln("</table>\n");

  thisDoc.writeln("<table cellpadding=0 cellspacing=2 border=0 width=100%>");
  thisDoc.writeln("<tr>");
  thisDoc.writeln("<td>");
  if (top.mode != "Expert")
  {
    thisDoc.writeln(top.stringIpcVersion);
  }
  else
  {
    thisDoc.writeln(top.stringLastIpcVersion);
  }
  thisDoc.writeln("</td>");
  thisDoc.writeln("</tr>\n");

  // Query
  thisDoc.writeln("<tr>");
  $length = (top.currentLanguage == "En") ? "60":"65";
  thisDoc.write("<td nowrap><b>" + stringQueryLabel + "</b>");
  thisDoc.write("<input type=text name=query value=\"\" size=" + $length + " onChange='top.codeIBIS=\"\"'>");

  // IPC code filter
  if (top.ipcCodeFilterFlag == 1)
  {
    thisDoc.writeln("&nbsp;&nbsp;" + top.ipcCodeFilterString + " ");
    thisDoc.writeln("<input type=text name=ipcCodeFilter value=\"\" maxlength=14 size=7>");
  }
  thisDoc.writeln("&nbsp;&nbsp;<input type=submit value=Search></td>");

  thisDoc.writeln("</tr>\n");

  thisDoc.writeln("</table>\n");
  thisDoc.writeln("<table cellpadding=0 cellspacing=2 border=0 width=100%>");
  thisDoc.writeln("<tr>");

  // Select search language
  thisDoc.writeln("<td ALIGN=left VALIGN=BOTTOM nowrap>" + stringLanguageLabel + " ");
  // Il faut déplacer le focus pour que IE puisse le remettre au bon endroit.
  // C'est comme ça.
  thisDoc.writeln("<select name=selectLanguage onChange='top.lsTempFrame.focus();top.changeLanguage();'>");
  for (iterLanguage in top.languages)
  {
    thisDoc.write("<option value=" + iterLanguage);
    if (iterLanguage == top.currentLanguage)
    {
        thisDoc.write(" selected");
    }
    thisDoc.write(">" + top.languages[iterLanguage]);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");

  if (top.mode == "Expert")
  {
    // Select Ipc version
    thisDoc.writeln("<td align=left valign=bottom nowrap>" + top.stringIpcVersionChoice + " ");
    thisDoc.writeln("<select name=selectIpcVersion onChange='top.changeIpcVersion()'>");
    for (iterVersion in top.nameIpcVersion)
    {
      thisDoc.write("<option value=" + iterVersion);
      if (iterVersion == top.currentIpcVersion)
      {
        thisDoc.write(" selected");
      }
      thisDoc.write(">" +  top.nameIpcVersion[iterVersion]);
    }
    thisDoc.write  ("</select>");
    thisDoc.writeln("</td>");
  }

  // Select Ipc language
  thisDoc.writeln("<td align=left valign=bottom nowrap>" + stringModeIpcLabel + " ");
  thisDoc.writeln("<select name=_selectIPCLang onChange='top.changeIPCLang()'>");
  for (iterLanguage in top.ipcLang)
  {
    thisDoc.write("<option value=" + iterLanguage + ">" +  top.ipcLang[iterLanguage]);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");

  // Select search engine
  thisDoc.writeln("<td align=left valign=bottom nowrap>" + top.stringSEAnswer + " ");
  thisDoc.writeln("<select name=searchEngineSelect onChange='top.lsSubmitQueryFromForm()'>");
  for (iterLevel in top.searchEngineLabel)
  {
    var currentSearchEngine = top.searchEngineLabel[iterLevel];
    thisDoc.write("<option value=" + iterLevel + ">" + currentSearchEngine);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");

  // Select level answer
  thisDoc.writeln("<td align=left valign=bottom nowrap>" + top.stringTitleLevel);
  thisDoc.writeln(" <select name=selectLevel onChange='top.changeLevel()'>");
  for (iterLevel in top.levelAnswer)
  {
    thisDoc.write("<option value=" + iterLevel);
    if (iterLevel == top.currentLevel)
    {
        thisDoc.write(" selected");
    }
    thisDoc.write(">" + top.levelAnswer[iterLevel]);
  }
  thisDoc.write  ("</select>");
  thisDoc.writeln("</td>");

  if (top.mode != "Expert")
  {
    // We can move in expert mode
//     thisDoc.writeln("<td align=right>");
//     thisDoc.write  ("<a href=tacsy.wipo.htm target=_top>");
//     thisDoc.write  (top.expertMode);
//     thisDoc.write  ("</a>");
//     thisDoc.writeln("</td>");
  }

  thisDoc.writeln("</tr>\n");
  thisDoc.writeln("<tr>");
  // Help
  thisDoc.write  ("<td align=left>");
  thisDoc.write  ("<a href=HelpWipo" + top.currentLanguage + ".htm target='lsAnswerFrame'>");
  thisDoc.writeln(stringHelpWipo);
  thisDoc.writeln("</a>");
  thisDoc.writeln("</td>");
  thisDoc.writeln("</tr>\n");
  
  thisDoc.write  ("</table>");
*/
  // Look WIPO
  thisDoc.writeln("</td>");
  thisDoc.writeln("</tr>");

  // Fin Look WIPO

  thisDoc.writeln("</form>");


  thisDoc.writeln("</body>");
  thisDoc.writeln("</html>");
  thisDoc.close();
}


function lsPrintHeaderFrame()
{
	
	
  var thisHeaderDoc = top.lsHeaderFrame.document.open();
  
  thisHeaderDoc.writeln("<html>");
  thisHeaderDoc.writeln("<head>");
  thisHeaderDoc.writeln("<link href='styles/wipo.css' rel='stylesheet' type='text/css'>");
  thisHeaderDoc.writeln("<link href='styles/default.css' rel='stylesheet' type='text/css'>");
  thisHeaderDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/default_2010.css' rel='stylesheet' type='text/css'>");
  thisHeaderDoc.writeln("<link href='http://wipo.int/export/sites/www/shared/css/wipo_2010.css' rel='stylesheet' type='text/css'>");
  thisHeaderDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/ipc.css' rel='stylesheet'>");
  thisHeaderDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/reset.css' rel='stylesheet'>");
  thisHeaderDoc.writeln("<link media='screen,print' type='text/css' href='http://wipo.int/ipcpub/shared/css/grid.css' rel='stylesheet'>");
  thisHeaderDoc.writeln("<link media='screen' type='text/css' href='http://wipo.int/ipcpub/shared/css/ipcpub.css' rel='stylesheet'>");
  thisHeaderDoc.writeln("<link media='screen' type='text/css' href='http://wipo.int/ipcpub/shared/css/ripcis.css' rel='stylesheet'>");
 // thisHeaderDoc.writeln("<script type='text/javascript' src='http://wipo.int/export/sites/www/shared/scripts/udm4.5/menu-wipo.js'></script>");
  thisHeaderDoc.writeln("</head>");
  thisHeaderDoc.writeln("<body>");
  thisHeaderDoc.writeln('<div id="header">');
  thisHeaderDoc.writeln('<div id="leftHeader">');
  thisHeaderDoc.write('<div id="mainLogo"><a target="_parent" href="http://www.wipo.int/portal/index.html.');
  thisHeaderDoc.write(top.currentLanguage.toLowerCase());
  thisHeaderDoc.write('"><img src="http://www.wipo.int/export/sites/www/shared/images/toplogo/');
  thisHeaderDoc.write(top.currentLanguage.toLowerCase());
  thisHeaderDoc.write('/logo_2010.gif" alt="WIPO Home" border="0"></a></div>');
  thisHeaderDoc.write('<div id="siteLogo"><IMG SRC="http://www.wipo.int/export/sites/www/shared/images/toplogo/');
  thisHeaderDoc.write(top.currentLanguage.toLowerCase());
  thisHeaderDoc.write('/services_2010.gif" alt="services"></div>');
  thisHeaderDoc.writeln('</div>');
  thisHeaderDoc.write('<div id="rightHeader"><ul class="barSeparated"><li class="listFirst"><a style="font-weight:normal"  class="tools languageLink" onMouseOver="this.style.cursor=&#39;pointer&#39;" onClick="top.lsTempFrame.focus();top.changeLanguageRightSide();return;">');
  if (top.currentLanguage=="En")  {
     thisHeaderDoc.write(top.stringLanguageFr + "&nbsp;&nbsp;");
  }
  else  {
  thisHeaderDoc.write(top.stringLanguageEn + "&nbsp;&nbsp;");
  }
  thisHeaderDoc.writeln('</a></li></ul>');

  thisHeaderDoc.writeln('<ul class="barSeparated">');
  
  
  
  
  
  
  thisHeaderDoc.writeln('<div class="tools" id="searchBox">');
thisHeaderDoc.writeln('<form id="searchbox_000395567151317721298:aqrs59qtjb0" action="http://www.wipo.int/tools/en/gsearch.html">');
            thisHeaderDoc.writeln('<label for="sitesearchbox">');
            thisHeaderDoc.writeln('<input type="hidden" name="cx" value="000395567151317721298:aqrs59qtjb0"><input type="hidden" name="cof" value="FORID:11"><input size="20" name="q" id="sitesearchbox" class="searchbox"></label>');
            thisHeaderDoc.writeln('<input class="trans" type="submit" id="search" name="sa" value="Search">');
thisHeaderDoc.writeln('</form>');
            
            thisHeaderDoc.writeln('<ul>');

  if (top.currentLanguage=="En")  {
  thisHeaderDoc.writeln('<li class="listFirst"><a style="font-weight:normal" class="tools" id="contactus" target=_blank href="http://www.wipo.int/contact/en/">Contact us</a></li>');
  thisHeaderDoc.writeln('<li><a style="font-weight:normal" class="tools" id="accessibility" target=_blank href="http://www.wipo.int/accessibility/en/">Accessibility</a></li>');
  thisHeaderDoc.writeln('<li><a style="font-weight:normal" class="tools"  id="sitemap" target=_blank href="http://www.wipo.int/tools/en/sitemap.html">Site map</a> </li>');
  }
  else {
  thisHeaderDoc.writeln('<li class="listFirst"><a style="font-weight:normal"class="tools" target=_blank id="contactus" href="http://www.wipo.int/contact/fr/">Contactez-nous</a></li>');
  thisHeaderDoc.writeln('<li><a style="font-weight:normal" class="tools"  target=_blank id="accessibility" href="http://www.wipo.int/accessibility/fr/">Accessibilité</a></li>');
  thisHeaderDoc.writeln('<li><a style="font-weight:normal" class="tools"  target=_blank id="sitemap" href="http://www.wipo.int/tools/fr/sitemap.html">Site map</a> </li>');
  }  
  
            


thisHeaderDoc.writeln('</div>');
  
  
  
  
 
  thisHeaderDoc.writeln('</div>');
  thisHeaderDoc.writeln('</div>');

  
  //	thisDoc.writeln("<td align=right colspan=2>Powered by <a href='http://www.lingway.com' style='text-decoration: none;' target=_blank><span class='logo'>&gt;lingway</span></a></td>");

  thisHeaderDoc.writeln('</div>');
  thisHeaderDoc.writeln('</div>');
  thisHeaderDoc.writeln('<br>');
  thisHeaderDoc.writeln('<br>'); 
  thisHeaderDoc.writeln('<br>'); 
  thisHeaderDoc.writeln('<br>'); 
  thisHeaderDoc.writeln('<br>'); 
  thisHeaderDoc.writeln('<br>'); 
  thisHeaderDoc.writeln('<br>');
  thisHeaderDoc.writeln('<p align=CENTER style="font-size:1.5em;"><strong>' + top.stringTacsyVersion + '</strong>');
  thisHeaderDoc.writeln('<p align=CENTER>' + top.stringIpcVersion);

  thisHeaderDoc.writeln('<br>');  
  
  thisHeaderDoc.writeln('<br>');
  thisHeaderDoc.writeln('<br>');
  thisHeaderDoc.writeln('<br>');
  thisHeaderDoc.writeln('<br>');
  
  thisHeaderDoc.writeln('<table cellpadding=0 cellspacing=2 border=0 width=100%>');
  thisHeaderDoc.writeln('<tr>');
  thisHeaderDoc.writeln('<td ALIGN=left VALIGN=BOTTOM nowrap>Search language ');
  thisHeaderDoc.writeln('<select name=selectLanguage onChange="top.lsTempFrame.focus();top.changeLanguage();">');
  thisHeaderDoc.writeln('<option value=Fr>Fran&ccedil;ais<option value=En selected>English</select></td>');
  thisHeaderDoc.writeln('<td align=left valign=bottom nowrap>IPC language ');
  thisHeaderDoc.writeln('<select name=_selectIPCLang onChange="top.changeIPCLang()">');
  thisHeaderDoc.writeln('<option value=default>Default<option value=Fr>Fran&ccedil;ais<option value=En>English</select></td>');
  thisHeaderDoc.writeln('<td align=left valign=bottom nowrap>Answer depth ');
  thisHeaderDoc.writeln('<select name=searchEngineSelect onChange="top.lsSubmitQueryFromForm()">');
  thisHeaderDoc.writeln('<option value=gradual>Automatic<option value=IPC_LMax>Sub-group<option value=IPC_L4>Main group<option value=IPC_L3>Sub-class</select></td>');
  thisHeaderDoc.writeln('<td align=left valign=bottom nowrap>Level');
   thisHeaderDoc.writeln('<select name=selectLevel onChange="top.changeLevel()">');
  thisHeaderDoc.writeln('<option value=a selected>Advanced<option value=c>Core</select></td>');
  thisHeaderDoc.writeln('</tr>');

  thisHeaderDoc.writeln('</table></td>');
  thisHeaderDoc.writeln('</tr>');
  thisHeaderDoc.writeln('<div id="navigationBarBackground">&nbsp;</div>');
  thisHeaderDoc.writeln('<div id="siteIdentifier"><img src="http://wipo.int/export/sites/www/shared/images/toplogo/en/wipo-grey.gif" ALT="World Intellectual Property Organization"></div></div>');
  thisHeaderDoc.writeln('<div id="navigation">');
  thisHeaderDoc.writeln('<!-- breadcrumb end --></div>');
  

	
  thisHeaderDoc.writeln('</body>');
  thisHeaderDoc.writeln('</html>');
  thisHeaderDoc.close();
}

