/* Name: getStylesheet-main.js
 * Purpose: Make link to cascading stylesheets according to browser/OS.
 * Description:
 *   For main stylesheet for entire site.
 *   We give the main stylesheet first in the page itself,
 *     (defaulting to the standards-compliant browsers)
 *      and then provide stylesheet with diffs for non-compliant browsers.
 *   09 mar 2007 jw - modified for tibetanwomen.org.
 *   26 jan 2007 jw - made for standards-default.
 *   22 aug 2005 jw - made for msie-default.
 */

  // All our stylesheets begin with this name:
  var cssname = 'twa';
  var lib     = '/lib/styles/site/';
  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;
  // var version = navigator.appVersion;
  var agent = navigator.userAgent;

  // alert(navigator.userAgent);

  // Stylesheets for browser/os:
  if ( navigator.userAgent.indexOf("Windows") > 0 ) {
    stylesheet = cssname + '-msie.css';
    style_link = style_beg + stylesheet + style_end;
    document.write(style_link);
  }
  if ( navigator.userAgent.indexOf("MSIE") > 0 ) {
    stylesheet = cssname + '-msie.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..

