/* 
 * ie-note.js -- alerts users of IE about lack of standards-compliance
 *
 * to use, source this script from the HTML file:
 *
 *   <script type="text/javascript" src="js/ie-note.js"></script>
 *
 * Note that you need an event handler, such as
 *   http://dean.edwards.name/weblog/2005/10/add-event/
 * or insure otherwise that insertNote() is called *after* the whole page has
 * been rendered and the DOM initialised.
 *
 * The notice can be styled with CSS, using the ie-note class name.
 *
 * SVN url: http://svn.madduck.net/pub/web/martin-krafft.net/js/ie-note.js
 *
 * Copyright © martin f. krafft <madduck@madduck.net>
 * Released under the terms of the Artistic Licence 2.0
 *
 * Revision: $Id: dchangesfilename 295 2006-10-07 11:20:26Z madduck $
 */

function isIE()
{
  return navigator.appName.indexOf('Internet Explorer') > 0 ||
    navigator.appName.indexOf('MSIE') > 0;
}

function insertNote()
{
  var query = unescape(location.search);
  if (isIE() || query.indexOf('ie-note') > 0) {
    var container = document.createElement("p");
    container.className = 'ie-note';
    container.innerHTML =
    '<strong>Notice:</strong> you are using Microsoft\'s Internet Explorer, '
    + 'which does not properly support the <a '
    + 'href="http://www.w3.org/MarkUp">XHTML</a> and <a '
    + 'href="http://www.w3.org/Style/CSS">CSS</a> standards used in writing '
    + 'this page the way it is supposed to look. The information is still '
    + 'all there, but for a better result, please consider alternative ' 
    + 'browsers, such as <a href="http://www.mozilla.org/products/firefox">'
    + 'Mozilla Firefox</a>.';
    var body = document.getElementsByTagName("body")[0];
    body.insertBefore(container, body.firstChild);
  }
}

// see http://dean.edwards.name/weblog/2005/10/add-event/
addEvent(window, 'DOMContentLoaded', insertNote);
