// Ultimate client-side JavaScript client sniff. 
// (C) Netscape Communications 1999.  Permission granted to reuse and distribute. 
function Is() 
{   // convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    // *** BROWSER VERSION *** 
    // Note: On IE5, these return 4, so use is.ie5up to detect IE5. 
    this.major = parseInt(navigator.appVersion); 
    this.minor = parseFloat(navigator.appVersion); 

    this.nav  = ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera') == -1) 
                && (agt.indexOf('webtv') == -1)); 
    this.nav2 = (this.nav && (this.major == 2)); 
    this.nav3 = (this.nav && (this.major == 3)); 
    this.nav4 = (this.nav && (this.major == 4)); 
    this.nav4up = (this.nav && (this.major >= 4)); 
    this.navonly      = (this.nav && ((agt.indexOf(";nav") != -1) || 
                          (agt.indexOf("; nav") != -1)) ); 
    this.nav5 = (this.nav && (this.major == 5)); 
    this.nav5up = (this.nav && (this.major >= 5));

	this.nav4x  = (this.nav4up && !this.nav5up);

    this.ie   = (agt.indexOf("msie") != -1); 
    this.ie3  = (this.ie && (this.major < 4)); 
    this.ie4  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0") == -1) ); 
    this.ie4up  = (this.ie && (this.major >= 4)); 
    this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0") != -1) ); 
    this.ie5up  = (this.ie && !this.ie3 && !this.ie4);
	this.ie55   = (this.ie && (agt.indexOf("msie 5.5") != -1))
	this.ie55up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser 
    // or if this is the first browser window opened.  Thus the 
    // properties is.aol, is.aol3, and is.aol4 aren't 100% reliable. 
    this.aol   = (agt.indexOf("aol") != -1); 
    this.aol3  = (this.aol && this.ie3); 
    this.aol4  = (this.aol && this.ie4); 

    this.opera = (agt.indexOf("opera") != -1); 
    this.webtv = (agt.indexOf("webtv") != -1); 

    // *** PLATFORM *** 
    this.win   = ( (agt.indexOf("win") != -1) || (agt.indexOf("16bit") != -1) ); 
    this.mac   = (agt.indexOf("mac") != -1); 
} 

var is = null; 
var isIE3Mac = false; 
// this section is designed specifically for IE3 for the Mac 

if ((navigator.appVersion.indexOf("Mac") != -1)
	&& (navigator.userAgent.indexOf("MSIE") != -1)
	&& (parseInt(navigator.appVersion) ==3)) 
       
	  isIE3Mac = true; 

else is = new Is();




function getLayer(name) {
    if(is.nav4x)
        return findLayer(name, document);
    if(is.ie4up)
        return eval(name);
    if(is.nav5up)
        return document.getElementById(name);
    return null;
}

function findLayer(name, doc) {
  var i, layer;
  for (i = 0; i < doc.layers.length; i++) {;
    layer = doc.layers[i];
    if (layer.name == name) {
      return layer;
	}
    if (layer.document.layers.length > 0) {
      layer = findLayer(name, layer.document);
      if (layer != null) {
        return layer;
	  }
    }
  }
  return null;
}
