/* l_intro.js
 * Version 2.3 - 11/02/2009
 * Role : cours - scripts pour page Introduction
 * Projet : The Web Language Lab
 * Auteur : Etienne CHEVILLARD
 *
 * Copyright (C) 2003 Etienne CHEVILLARD
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 */

// donnees specifiques a la page
var titrePage = txtLng[2];
var hauteurPage = 400;


// insere un lien pour la premiere URL de l'introduction
function insererLien(txt) {
  var idx;
  var idx2;
  var lien;
  var tmp = txt.toLowerCase();
  var tmp2;
  var result;
  // recherche une URL
  idx = tmp.indexOf("http://");
  if (idx == -1) idx = tmp.indexOf("https://");
	// ajoute le lien si necessaire
  if (idx != -1) {
  	// recherche la fin de l'URL
  	tmp2 = tmp.substring(idx);
	  idx2 = tmp2.indexOf("\n");
	  if (idx2 == -1) idx2 = tmp2.indexOf(" ");
	  if (idx2 == -1)
	  	idx2 = txt.length;
	  else
	  	idx2 = idx+idx2;
	  // cree le lien
    lien = "<a href=\"" + txt.substring(idx, idx2) + "\" target=\"_blank\">";
    result = txt.substring(0, idx) + lien + txt.substring(idx, idx2) + "</a>"
        + txt.substring(idx2, txt.length);
  } else {
  	result = txt;
  }
	return (result);
} // fin insererVoc()

// retourne le code pour l'introduction
function codeIntro() {
  var txt;
  var txt2;
  // insertion des liens HTML
	txt2 = insererLien(introC);
  // mise en forme du texte d'introduction
  txt2 = txt2.split("''").join("\"");
  txt2 = txt2.split("\n").join("</p><p class=\"script1\">");
  // code a retourner
  txt = "<p class=\"script1\">";
  txt+= txt2;
  txt+= "</p><p class=\"script1\">&nbsp;";
  txt+= "<table summary=\"properties\" border=1 cellspacing=0 cellpadding=5><tr>";
  txt+= "<td bgcolor=\"#FFFFFF\">";
  txt+= "<table summary=\"properties2\" border=0 cellspacing=0 cellpadding=5><tr><td>";
  txt+= "<img src=\"../../images/prof.gif\" alt=\"\" border=0 align=\"MIDDLE\">";
  txt+= "</td><td>";
  txt+= "<p class=\"liste1\"><b>" + txtLng[15] + "&nbsp;:</b> &nbsp;";
  txt+= lessName;
  txt+= "<p class=\"liste1\"><b>" + txtLng[16] + "&nbsp;:</b> &nbsp;";
  txt+= lessThem;
  txt+= "<p class=\"liste1\"><b>" + txtLng[17] + "&nbsp;:</b> &nbsp;";
  txt+= lessAuth;
  txt+= "<p class=\"liste1\"><b>" + txtLng[18] + "&nbsp;:</b> &nbsp;";
  txt+= lessDate;
  txt+= "</td></tr></table>";
  txt+= "</td></tr></table>";
  return (txt);
} // fin codeIntro()

// charge la page
function chargerPage() {
  // elements communs
  chargerCommun();
  // informations specifiques
  modifierCodeDivision("infos1", codeInfos(txtLng[19]));
  // elements specifiques
  modifierCodeDivision("cont1", codeIntro());
  deplacerDivisionVers("cont1", 135, 40);
  montrerDivision("cont1");
  return;
} // fin chargerPage()
