/* Name: getStylesheet.js
 * Purpose: Make link to cascading stylesheets according to browser/OS.
 *  - They are *cascading*, i.e., we call the default 
 *    (standards-compliant) stylesheet directly in the page, 
 *    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 = 'tibetsun';
  var lib     = '/stylesheets/site/';
  // Our common stuff:
  var style_beg = '<link rel="stylesheet" type="text/css" media="all" href="' + lib;
  var style_end = '" />';

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

// alert(navigator.appVersion);
// 4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
// alert(navigator.userAgent);
// Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

  if ( navigator.userAgent.indexOf('MSIE 6') > 0 ) {
    stylesheet = cssname + '-msie.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }
  if ( navigator.appVersion.indexOf("X11") > 0 ) {
    stylesheet = cssname + '-linux.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }
  // Firefox , Safari
  if ( navigator.appVersion.indexOf("Macintosh") > 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 
