/* Name: getStylesheet.js
 * Purpose: Make link to cascading stylesheets according to browser/OS.
 * Description:
 *   We give the main stylesheet first in the page itself,
 *     (defaulting to the most common MSIE browsers)
 *      and then provide stylesheet with diffs for other browsers/OSs.
 *   22 aug 2005 - the latest and greatest version.
 */

  // All our stylesheets begin with this name:
  var cssname = 'freespirit';
  var lib     = '/lib/styles/site';
  var style_beg = '<link rel="stylesheet" type="text/css" media="all" href="' + lib;
  var style_end = '" />';

  // Give the default stylsheet:
  stylesheet = cssname + '-main.css';
  // We're going to show the default stylesheet in the page -
  //   if they have javascript turned off, they won't see any styles!


  // Now determine OS and browser, and give alternate(s):
  // var name = navigator.appName;
  // var version = navigator.appVersion;
  var agent = navigator.userAgent;

  // Stylesheets for browser/os:
  if ( navigator.userAgent.indexOf("Firefox") > 0 ) {

    stylesheet = cssname + '-linux.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }
  if ( navigator.userAgent.indexOf("X11") > 0 ) {
    stylesheet = cssname + '-linux.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }
  if ( navigator.userAgent.indexOf("Mac") > 0 ) {
    stylesheet = cssname + '-mac.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }

  // Special stylesheet for admin section:
  if ( location.href.indexOf("admin") > 0 ) {
    stylesheet = cssname + '-admin.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }

// -- EOF 

