/*************************************************
 * Auteur :         Rémi Chéno <remi@cheno.org>
 * Nom du fichier : commun/fenetre.js
 * Date création :  01/03/2003
 * Mise à jour :    06/03/2003
 * Contenu :        JavaScript
 *************************************************/
 
 /*
  * Ouverture d'une fenêtre - renvoie une handle sur la fenêtre
  */
 
function ouvrirFenetre(url, nom) {
	var nouvelleFenetre = window.open(url, nom, "resizable=yes, toolbar=no, menubar=no, scrollbars=yes, width=500, height=200");
	return nouvelleFenetre;
}

/*
 * Ouverture d'une fenêtre d'aide, avec le texte d'aide pour les tags HTLM de base
 */

function aide() {
	fenetre = ouvrirFenetre("", "fenetreAide");

// Entête XHTML

	fenetre.document.writeln("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>");
	fenetre.document.writeln("<!DOCTYPE html ");
	fenetre.document.writeln("PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"");
	fenetre.document.writeln("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\" >");
	fenetre.document.writeln("<html xmlns=\"http://www.w3.org/1999/xhtml\" >\n<head>");
	fenetre.document.writeln("<title>Aide-mémoire</title>");
	fenetre.document.writeln("<link type=\"text/css\" href=\"../commun/styles.css\" title=\"Mes styles\" rel=\"stylesheet\" />");
	fenetre.document.writeln("<meta content=\"text/html; charset=iso-8859-1\" />");
	fenetre.document.writeln("<body>");

// Le texte de l'aide

	fenetre.document.writeln("<p class=\"erreur\">pour les <b>caractères gras</b>, écrire <b>&lt;b&gt;le texte&lt;/b&gt;</b><br />");
	fenetre.document.writeln("pour les <em>caractères italiques</em>, écrire <b>&lt;em&gt;</b><em>le texte</em><b>&lt;/em&gt;</b><br />");
	fenetre.document.writeln("pour aller à la ligne, utilisez <b>&lt;br /&gt;</b><br />");
	fenetre.document.writeln("pour une espace insécable, utilisez <b>&amp;nbsp;</b> (avec le «&nbsp;<b>;</b>&nbsp;»&nbsp;!)<br />");
	fenetre.document.writeln("évitez les guillemets anglais <b>\"</b> (ou <b>&amp;quote;</b>)<br />");
	fenetre.document.writeln("utilisez plutôt les guillemets français<br />");
	fenetre.document.writeln("<b>«</b> (ou <b>&amp;laquo;</b>) et <b>»</b> (ou <b>&amp;raquo;</b>)<br />");
	fenetre.document.writeln("enfin pour écrire le signe <b>&amp;</b> lui-même, il faut écrire <b>&amp;amp;</b>");
	fenetre.document.writeln("</p>");
	fenetre.document.writeln("<p><a href=\"#\" onclick=\"window.close();\">Fermer</a></p>");
	fenetre.document.writeln("</body>");
        fenetre.document.writeln("</html>");
}

/*
 * Ouverture d'une fenêtre pour afficher le texte mis en forme
 */

function visualiser(message) {
	fenetre = ouvrirFenetre("", "fenetreVisu");

// Entête XHTML

	fenetre.document.writeln("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>");
	fenetre.document.writeln("<!DOCTYPE html ");
	fenetre.document.writeln("PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"");
	fenetre.document.writeln("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\" >");
	fenetre.document.writeln("<html xmlns=\"http://www.w3.org/1999/xhtml\" >\n<head>");
	fenetre.document.writeln("<title>Visualisation</title>");
	fenetre.document.writeln("<link type=\"text/css\" href=\"../commun/styles.css\" title=\"Mes styles\" rel=\"stylesheet\" />");
	fenetre.document.writeln("<meta content=\"text/html; charset=iso-8859-1\" />");
	fenetre.document.writeln("<body>");

// Le texte de l'aide

	fenetre.document.writeln("<p class=\"noindent\"><em>Votre texte mis en forme&nbsp;:</em></p>");
	fenetre.document.writeln("<p class=\"noindent\">");
	fenetre.document.writeln(message);
	fenetre.document.writeln("</p>");
	fenetre.document.writeln("<p><a href=\"#\" onclick=\"window.close();\">Fermer</a></p>");
	fenetre.document.writeln("</body>");
        fenetre.document.writeln("</html>");
}

