var isNav = navigator.appName.indexOf("Netscape") != -1;
var isIE  = navigator.appName.indexOf("Microsoft") != -1;
var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0);
var gVersion = browser_version();

//
//	Returns the URL to the custom stylesheet for the client.  For IE, if the
//	client is not a Mac, they get a custom stylesheet.  For Netscape, if the
//	client is a Mac with Mozilla they get the same custom stylesheet other
//	Netscape users get.  Other Macs and (and other platforms and browsers)
//	will get the generic stylesheet, on the offhand hope that they will 
//	respect it.
//
function get_sheet() 
{
 var sCSS="";
 if (isIE) {
  if (!isMac){
    sCSS = "/css/ie_style.css";
  }
 } else if (isNav) {
  if (!isMac){
    sCSS = "/css/netscape_style.css";
  } else if (gVersion >= 5){
    sCSS = "/css/ie_style.css";
  }
 }
 return sCSS;
}

function write_extra_styles()
{
 var sCSS = get_sheet();
 if (sCSS.length > 0){
   document.write("<link rel=\"stylesheet\" href=\"" + sCSS + "\">");
 }
}

function browser_version(){
 var s = navigator.appVersion;
 var n = s.indexOf("MSIE");
 var v = 0;

 if (n != -1) {
  v = parseFloat(s.substr(n + 4));
 } else {
  v = parseFloat(s);
 }
 return v;
}

//required by system builder
function sbChComp(f,comp_id)
{
  var i,e,j;
 
  for(i=0;i<f.elements.length;i++){
    e = f.elements[i];
    if(e.name.substr(0,3) == "cat"){
      if(typeof(e)=="object"){      
        if(typeof(e.options)=="object"){
          for(j=0;j<e.options.length;j++){
            if(e.options[j].value==comp_id){
              e.options.selectedIndex=j;
              return;
            }
          }          
        }        
        if(typeof(e.checked)=="boolean"){
          if(e.value==comp_id){
            e.checked = true;
            return;
          }       
        }        
      }  
    }  
  }

  return;
}

