// ------ Check for NS4, IE4, IE5 ------



var minNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var minIE4 = (document.all) ? 1 : 0;
var minIE5 = (minIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;



// ------ Set homeLoc="file:///C:/WINDOWS/Desktop/KWT/draft4/" for local use
// ------   and homeLoc = "http://www.keywesttechnologies.com/" for remote use

homeLoc = "http://www.keywesttechnologies.com/"

// ------ Contents of the menus ------

var menu1 = new Array();
var menu2 = new Array();
var menu3 = new Array();
var menu4 = new Array();

var mTop = 170;

var m1Left = 74;
var m2Left = 190;
var m3Left = 346;
var m4Left = 497;
var m1Width = 115;
var m2Width = 220;
var m3Width = 200;
var m4Width = 200;
var m1Height = 80;
var m2Height = 200;
var m3Height = 350;
var m4Height = 60;

if (minNS4) mTop -= 9;
if (minNS4) m1Left += 4;
if (minNS4) m2Left += 4;
if (minNS4) m3Left += 4;
if (minNS4) m4Left += 4;



menu1[0] = new Array("The Company", homeLoc+"about/index.html");
menu1[1] = new Array("About Us", homeLoc+"about/aboutus.html");
menu1[2] = new Array("Our Clients", homeLoc+"about/clients.html");
menu1[3] = new Array("Affiliate Tools", homeLoc+"about/affiliate.html");
menu1[4] = new Array("Contact Us", homeLoc+"about/contactus.html");

menu2[0] = new Array("Products and Services", homeLoc+"prodserv/index.html");
menu2[1] = new Array("Business Conceptualization and Planning Services",homeLoc+"prodserv/planning.html");
menu2[2] = new Array("Business DevelopmentTools and Services", homeLoc+"prodserv/business_devtools.html");
menu2[3] = new Array("Business Modeling", homeLoc+"prodserv/business_model.html");
menu2[4] = new Array("Corporate and SEC Legal Services", homeLoc+"prodserv/legal.html");
menu2[5] = new Array("Corporate Director - Board Governance Pages", homeLoc+"prodserv/legal.html");
menu2[6] = new Array("Financial Services", homeLoc+"prodserv/financial.html");
menu2[7] = new Array("Intellectual Property Services", homeLoc+"prodserv/intellectual_property.html");
menu2[8] = new Array("Product Development Services", homeLoc+"prodserv/product_dev.html");

menu3[0] = new Array("Technology Reports", homeLoc+"techreports/index.html");
menu3[1] = new Array("A Business Plan - HOTELpc", homeLoc+"secure/hotelpc_2.html");
menu3[2] = new Array("A Connected Perspective circa Jan. 2001", homeLoc+"techreports/connected.html");
menu3[3] = new Array("A Digital Surveillance Camera MSP Model", homeLoc+"techreports/digicam.html");
menu3[4] = new Array("A Security Venture Strategy circa Nov. 2001", homeLoc+"techreports/securityventure.html");
menu3[5] = new Array("A Perishable Foods Tracking and Monitoring Model", homeLoc+"techreports/a perishable Foods tracking and monitoring model.html");
menu3[6] = new Array("Company Valuation: a Quantitative Approach", homeLoc+"techreports/compvaluation.html");
menu3[7] = new Array("Differential Cascode Logic", homeLoc+"techreports/cascodelogic.html");
menu3[8] = new Array("Rx Prescription and Bulk Drug Tracking and Authentication White Paper circa July 2003", homeLoc+"techreports/Rx.html");
menu3[9] = new Array("Key West Telecommunications Perspective - Service Provider Profitability", homeLoc+"techreports/ServiceProviderProfitability.html");
menu3[10] = new Array("Key West Wireless Solution Presentation", homeLoc+"techreports/WirelessSolutionPresentation.html");
menu3[11] = new Array("Report Archive", homeLoc+"techreports/archive.html");

menu4[0] = new Array("Projects", homeLoc+"secure/activeprojects.html");
menu4[1] = new Array("Condensation Technologies", homeLoc+"secure/condensation.html");
menu4[2] = new Array("Active Projects", homeLoc+"secure/activeprojects.html");
menu4[3] = new Array("Project Archives", homeLoc+"secure/projectarchives.html");

// ------ Build the menus, using layers (NS) or divs (IE) ------

// menu 1 ********

if (minIE4){
var codeStr = '<div id="m1" style="position:absolute; width:' + m1Width + 'px; height:' + m1Height + 'px;'
        + 'z-index:1; left:' + m1Left + 'px; top:' + mTop + 'px; background-color:#666699; display:none;'
        + 'border-style: solid; border-width: thin; background-image: url(images/kw4blueback.gif);"'
        + ' onMouseOut="hideM1()">';
        }
if (minNS4){
var codeStr = '<layer name="m1" width=' + m1Width + ' height=' + m1Height + ' left=' + m1Left
        + ' top=' + (mTop-8) + ' bgcolor=#666699 visibility="hide" onMouseOut="hideM1(event,m1)">';
}

codeStr        += '<table width=100% border=0 cellpadding=0 cellspacing=2>';
for (i=1;i<menu1.length;i++){
        codeStr += '<tr><td><p class=menutext><a href="' + menu1[i][1] + '">' + menu1[i][0] + '</a></p></td></tr>';
        }
codeStr += '</table>';

if (minIE4)
codeStr += '</div>';
if (minNS4)
codeStr += '</layer>';



// menu 2 ************

if (minIE4){
codeStr += '<div id="m2" style="position:absolute; width:' + m2Width + 'px; height:' + m2Height + 'px;'
        + 'z-index:2; left:' + m2Left + 'px; top:' + mTop + 'px; background-color:#666699; display:none;'
        + 'border-style: solid; border-width: thin; background-image: url(images/kw4blueback.gif);"'
        + ' onMouseOut="hideM2()">';
        }
if (minNS4){
codeStr += '<layer name="m2" width=' + m2Width + ' height=' + m2Height + ' left=' + m2Left
        + ' top=' + (mTop-8) + ' bgcolor=#666699 visibility="hide">';
}

codeStr        += '<table width=100%>';
for (i=1;i<menu2.length;i++){
        codeStr += '<tr><td><p class=menutext><a href="' + menu2[i][1] + '">' + menu2[i][0] + '</a></p></td></tr>';
        }
codeStr += '</table>';

if (minIE4)
codeStr += '</div>';
if (minNS4)
codeStr += '</layer>';


// menu 3 ********

if (minIE4){
codeStr += '<div id="m3" style="position:absolute; width:' + m3Width + 'px; height:' + m3Height + 'px;'
        + 'z-index:2; left:' + m3Left + 'px; top:' + mTop + 'px; background-color:#666699; display:none;'
        + 'border-style: solid; border-width: thin; background-image: url(images/kw4blueback2.gif);"'
        + ' onMouseOut="hideM3()">';
        }
if (minNS4){
codeStr += '<layer name="m3" width=' + m3Width + ' height=' + m3Height + ' left=' + m3Left
        + ' top=' + (mTop-8) + ' bgcolor=#666699 visibility="hide">';
}

codeStr        += '<table width=100%>';
for (i=1;i<menu3.length;i++){
        codeStr += '<tr><td><p class=menutext><a href="' + menu3[i][1] + '">' + menu3[i][0] + '</a></p></td></tr>';
        }
codeStr += '</table>';

if (minIE4)
codeStr += '</div>';
if (minNS4)
codeStr += '</layer>';


// menu 4 ********

if (minIE4){
codeStr += '<div id="m4" style="position:absolute; width:' + m4Width + 'px; height:' + m4Height + 'px;'
        + 'z-index:4; left:' + m4Left + 'px; top:' + mTop + 'px; background-color:#666699; display:none;'
        + 'border-style: solid; border-width: thin; background-image: url(images/kw4blueback.gif);"'
        + ' onMouseOut="hideM4()">';
        }
if (minNS4){
var codeStr = '<layer name="m4" width=' + m4Width + ' height=' + m4Height + ' left=' + m4Left
        + ' top=' + mTop + ' bgcolor=#666699 visibility="hide" onMouseOut="hideM4(event,m4)">';
}

codeStr        += '<table width=100% border=0 cellpadding=0 cellspacing=2>';
for (i=1;i<menu4.length;i++){
        codeStr += '<tr><td><p class=menutext><a href="' + menu4[i][1] + '">' + menu4[i][0] + '</a></p></td></tr>';
        }
codeStr += '</table>';

if (minIE4)
codeStr += '</div>';
if (minNS4)
codeStr += '</layer>';


// put invisible menu layers or divs into document as one big string of code

document.write(codeStr);



// ------ Cross-browser functions for layer visibility ------



function showLayer(name){

        if (minNS4)
        name.visibility = "inherit";
        if (minIE4) {
        var divisions = document.all.tags("div");
        name.style.display = "block";
        }
}

function hideLayer(name){

        if (minNS4)
        name.visibility="hide";
        if (minIE4) {
        var divisions = document.all.tags("div")
        name.style.display = "none"
        }
}


// ------ Track the mouse x,y position

var posX = 0;
var posY = 0;

// -- currently dormant code:

if (minNS4){
        document.captureEvents(Event.MOUSEMOVE);
        document.onmousemove = savePos;
}

function savePos(e) {

  if (minNS4) {
    posX = e.pageX;
    posY = e.pageY;
  }
  if (minIE4) {
    posX = window.event.clientX + document.body.scrollLeft;
    posY = window.event.clientY + document.body.scrollTop;
  }
}
// -- end dormant code


// ------ Hide menus after checking that mouse is not over menus; use for MouseOut on tabs
// NStest:
function clickHandler(eventObject) {
        alert(eventObject.pageX+","+ eventObject.pageY)
}




function hideM1(eventObject,name){
        if (minIE4) {
        posX = window.event.clientX + document.body.scrollLeft;
        posY = window.event.clientY + document.body.scrollTop;
        }
        if (minNS4) {
        posX = eventObject.pageX;
        posY = eventObject.pageY;
        }
        if (posX < (m1Left+2)  || posX > (m1Left + m1Width) || posY < mTop || posY > (mTop + m1Height)) {
                if (minIE4) {
                hideLayer(m1);
                }
                if (minNS4) {
                name.visibility="hide";
                }
}
}

function hideM2(eventObject,name){
        if (minIE4) {
        posX = window.event.clientX + document.body.scrollLeft;
        posY = window.event.clientY + document.body.scrollTop;
        }
        if (minNS4) {
        posX = eventObject.pageX;
        posY = eventObject.pageY;
        }
        if (posX < (m2Left+2)  || posX > (m2Left + m2Width) || posY < mTop || posY > (mTop + m2Height)) {
                if (minIE4) {
                hideLayer(m2);
                }
                if (minNS4) {
                name.visibility="hide";
                }
}
}

function hideM3(eventObject,name){
        if (minIE4) {
        posX = window.event.clientX + document.body.scrollLeft;
        posY = window.event.clientY + document.body.scrollTop;
        }
        if (minNS4) {
        posX = eventObject.pageX;
        posY = eventObject.pageY;
        }
        if (posX < (m3Left+2)  || posX > (m3Left + m3Width) || posY < mTop || posY > (mTop + m3Height)) {
                if (minIE4) {
                hideLayer(m3);
                }
                if (minNS4) {
                name.visibility="hide";
                }
}
}


function hideM4(eventObject,name){
        if (minIE4) {
        posX = window.event.clientX + document.body.scrollLeft;
        posY = window.event.clientY + document.body.scrollTop;
        }
        if (minNS4) {
        posX = eventObject.pageX;
        posY = eventObject.pageY;
        }
        if (posX < (m4Left+2)  || posX > (m4Left + m4Width) || posY < mTop || posY > (mTop + m4Height)) {
                if (minIE4) {
                hideLayer(m4);
                }
                if (minNS4) {
                name.visibility="hide";
                }
}
}