

// BROWSER SNIFFER (Sniff out the good and bad browsers)

/////////////////////////////////////////////////////
//                                                 //
//  SECTION 5: BROWSER SNIFFER & DOMS              //
//  ---------------------------------------------  //
//  Document Object switch routine used to         //
//  maintain cross-browser compatibility.          //
//                                                 //
/////////////////////////////////////////////////////


// BROWSER SNIFFER (Sniff out the good and bad browsers)

function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}

var is = new Is();

function onerror() {
    document.location.href = "javascript:";
}

// DOCUMENT OBJECT SWITCH (Used for building cross_browser functions)

if(is.ns4) {
    doc = "document";
    sty = "";
    htm = ".document"
} else if(is.ie4) {
    doc = "document.all";
    sty = ".style";
    htm = ""
}

/////////////////////////////////////////////////////
//                                                 //
//  SECTION 6: PRELOADING                          //
//  ---------------------------------------------  //
//  Preload images memory for realtime animation.  //
//                                                 //
/////////////////////////////////////////////////////

var count = 0;

function preLoad() {

        fireHall_1 = new Image();
        fireHall_1.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_1.src = "images/firehall1.jpg";
        
    fireHall_2 = new Image();
        fireHall_2.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_2.src = "images/firehall2.jpg";
        
        fireHall_3 = new Image();
        fireHall_3.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_3.src = "images/firehall3.jpg";
        
        fireHall_4 = new Image();
        fireHall_4.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_4.src = "images/firehall4.jpg";
        
        fireHall_5 = new Image();
        fireHall_5.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_5.src = "images/firehall5.jpg";
        
        fireHall_6 = new Image();
        fireHall_6.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_6.src = "images/firehall6.jpg";
        
        fireHall_7 = new Image();
        fireHall_7.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_7.src = "images/firehall7.jpg";
        
        fireHall_8 = new Image();
        fireHall_8.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_8.src = "images/firehall8.jpg";
        
        fireHall_9 = new Image();
        fireHall_9.onload = (is.ns4b) ? loadCheck() : loadCheck;
        fireHall_9.src = "images/firehall9.jpg";    
}

function loadCheck() {
    count++;
    if(count == 9) {
        var status = eval(doc + '["msgLyr"]' + sty);
        status.visibility = "hidden";
        positionLayers();
    } else {
        var status = eval(doc + '["msgLyr"]' + htm);
        var msg = '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=300><TR><TD WIDTH=' + Math.round((count/9)*100) + '% BGCOLOR=#FF0000 ALIGN=RIGHT>' + '<FONT class="status" color="White">' + Math.round((count/9)*100) + '%</FONT>' +'</TD><TD BGCOLOR=#800000 VALIGN=MIDDLE>&nbsp;</TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><H5>Percent Images Loaded</h5></TD></TR></TABLE>';
        if(is.ns4) {
            status.write(msg);
            status.close();
        } else if(is.ie4) {
            status.innerHTML = msg;
        }
    }
}

/////////////////////////////////////////////////////
//                                                 //
//  SECTION 7: POSITIONING                         //
//  ---------------------------------------------  //
//  Build layer objects then position using        //
//  screen width and height dimensions, then       //
//  turn on layer visibility.                      //
//                                                 //
/////////////////////////////////////////////////////

function positionLayers() {

        homeImg = eval(doc + '["homeLyr"]' + '.document');
        homeImg.home_img.src = "images/firehall1.jpg";
        homeObj = eval(doc + '["homeLyr"]' + sty);
        homeObj.top = 150;
        homeObj.left = (available_width/2) - 225;
        homeObj.visibility = "visible"; 
        
        menuImg = eval(doc + '["menuLyr"]' + '.document');
        menuObj = eval(doc + '["menuLyr"]' + sty);
        menuObj.top = 150;
        menuObj.left = 15;
        menuObj.visibility = "visible";
}

function NewPersonnelWindow(field)//opens new window for person whose name is passed in the "field" parameter.
{
        var name = field + ".htm";
        var subwindow = window.open(name,"def","height=300,width=500");
}
