/* getStylesheet.js
 * Make link to cascading stylesheets according to browser/OS.
 * Description:
 *   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.
 *   26 jan 2007 - made for standards-default.
 */

  // All our stylesheets begin with this name:
  var cssname = 'tibgeeks';
  var csslib  = '/lib/styles/site/';

  // Our common stuff:
  var stylesheet_beg = '<link rel="stylesheet" type="text/css" media="all" href="';
  var stylesheet_end = '" />';

  // *** Now determine OS and browser, and give alternate(s): 

  // Possibles: 
  // Full string of app names, codebase, version, OS:
  var agent = navigator.userAgent;
  // name of the browser app maker - not always useful:
  var name = navigator.appName;
  // this gives version of original codebase - not always useful:
  var version = navigator.appVersion;

  var stylesheet = cssname;

  // Write the alternate stylesheet links:
  if ( agent.indexOf("MSIE") > 0 ) {
    stylesheet += '-msie.css';
    document.write(stylesheet_beg + csslib + stylesheet + stylesheet_end);
  }
  if ( agent.indexOf("Mac") > 0 ) {
    stylesheet += '-mac.css';
    document.write(stylesheet_beg + csslib + stylesheet + stylesheet_end);
  }

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

// -- EOF 
