// ============================================================================
// Marinsoft, Inc. website header including toolbar menu
// (C) Copyright 2001-2009 by Marinsoft, Inc. All Rights Reserved.
//

// ----------------------------------------------------------------------------
// header()
//
// Creates the Marinsoft menu navigation header
//
//  sCurrentPage    String name of current page to be highlighted
//  nSubdirectories Number of subdirectories down from the root
//
function header(sCurrentPage, nSubdirectories)
{
    var sPath = '';
    for (j=0; j<nSubdirectories; j++) { 
        sPath += '../';
    }
    document.writeln('<table align=center cellspacing=0 cellpadding=0 border=0 cols=2 nowrap>');
    document.writeln('  <tr>');
    document.writeln('    <td width=89 valign=top align=left>');
    document.writeln('      <a href="');
    document.write(sPath + 'home.htm"><img src="');
    document.write(sPath + 'images/marinsoftlogo3.gif" alt="Marinsoft, Inc." border=0></a><br>');
    document.writeln('    </td>');
    document.writeln('    <td width=100%>');
    document.writeln('      <table cellspacing=0 cellpadding=0 border=0>');
    document.writeln('        <tr>');
    document.writeln('          <td align=left valign=top>');
    document.writeln('            <img src="');
    document.write(sPath + 'images/marinsoftlogobig.jpg" alt="Marinsoft, Inc.">');
    document.writeln('          </td>');
    document.writeln('        </tr>');
    document.writeln('      </table>  ');
    document.writeln('    </td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
    document.writeln('<table width=100% cellspacing=0 cellpadding=0 border=0>');
    document.writeln('  <tr>');
    document.writeln('    <td align=left">');
    document.writeln('      <hr size=1 noshade>');
    writeMenuItem(sCurrentPage, sPath + "home.htm", "Home", "Home");
    document.writeln('      &nbsp|&nbsp');
    writeMenuItem(sCurrentPage, sPath + "projects/prj_mfg.htm", "Manufacturing", "Projects");
    document.writeln('      &nbsp|&nbsp');
    writeMenuItem(sCurrentPage, sPath + "products/prod_mpd.htm", "Products", "Products");
    document.writeln('      &nbsp|&nbsp');
    writeMenuItem(sCurrentPage, sPath + "manufacturers/manufacturers.htm", "Manufacturers", "Manufacturers");
    document.writeln('      &nbsp|&nbsp');
    writeMenuItem(sCurrentPage, sPath + "about/about.htm", "About Marinsoft", "About");
    document.writeln('    </td>');
    document.writeln('  </tr>');
    document.writeln('  <tr><td height=20></td></tr>');
    document.writeln('</table>');
}


// ----------------------------------------------------------------------------
// sidebar()
//
// Marinsoft sidebar navigation menu
//
//  sCurrentPage
//  nSubdirectories
//  nPage: 0=projects, 1=manufacturers
//  nSubmenu: Projects page: 0=manufacturering, 1=SW Developers, 2=Government 3=R&D
//
function sidebar(sCurrentPage, nSubdirectories, nPage, nSubmenu)
{
    var sPath = '';
    for (j=0; j<nSubdirectories; j++) { 
        sPath += '../';
    }
    
    document.writeln('<table align=left valign=center width=100% cellspacing=0 cellpadding=0 border=0 cols=2>');
    document.writeln('  <tr>');
//    document.writeln('    <td style="text-decoration:none;cursor:hand;">');
    document.writeln('    <td>');
    switch (nPage) {
        case 1:
        case 0:
        default:
            document.writeln('      <span class="submenu" nowrap>');
            writeMenuItem(sCurrentPage, sPath + "projects/prj_mfg.htm", "Manufacturing", "Manufacturing");
            document.writeln('      </span>');
          document.writeln('<br>');
            if (nSubmenu == 0) {
                // Manufacturing submenu items
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#ACME", "ACME", "ACME");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#Falcon", "Falcon", "Falcon");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#Weyerhaeuser", "Weyerhaeuser", "Weyerhaeuser");
                document.writeln('      </span>');
              document.writeln('<br>');
              document.writeln('<br>');
            }
            if (nSubmenu == 1) {
                 document.writeln('<br>');
            }    
            document.writeln('      <span class="submenu" nowrap>');
            writeMenuItem(sCurrentPage, sPath + "projects/prj_sw.htm",  "Software Developers", "Software Developers");
            document.writeln('      </span>');
          document.writeln('<br>');
            if (nSubmenu == 1) {
                // Software Developers submenu items
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#Autodesk", "Autodesk", "Autodesk");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#Pantek", "Pantek", "Pantek");
                document.writeln('      </span>');
              document.writeln('<br>');
              document.writeln('<br>');
            }
            if (nSubmenu == 2) {
               document.writeln('<br>');
            }
            document.writeln('      <span class="submenu" nowrap>');
            writeMenuItem(sCurrentPage, sPath + "projects/prj_gov.htm", "Government", "Government");
            document.writeln('      </span>');
          document.writeln('<br>');
            if (nSubmenu == 2) {
                // Government submenu items
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#Singapore-BCA", "Singapore-BCA", "Singapore-BCA");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#US-CIEE", "US-CIEE", "US-CIEE");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#US-DOE", "US-DOE", "US-DOE");
                document.writeln('      </span>');
              document.writeln('<br>');
              document.writeln('<br>');
            }
            if (nSubmenu == 3) {
               document.writeln('<br>');
            }
            document.writeln('      <span class="submenu" nowrap>');
            writeMenuItem(sCurrentPage, sPath + "projects/prj_rnd.htm", "R & D", "R & D");
            document.writeln('      </span>');
             document.writeln('<br>');
            if (nSubmenu == 3) {
                // R&D submenu items
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#ASHRAE", "ASHRAE", "ASHRAE");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#IAI", "IAI", "IAI");
                document.writeln('      </span>');
              document.writeln('<br>');
                document.writeln('      <span class="submenu2" nowrap>');
                writeMenuItem(sCurrentPage, "#LBNL", "LBNL", "LBNL");
                document.writeln('      </span>');
            }
            break;
    }
    document.writeln('      </span>');
    document.writeln('    </td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
}

// ----------------------------------------------------------------------------
// writeMenuItem()
//
// Header/Sidebar helper function
//
function writeMenuItem(sCurrentPage, sUrl, sName, sMenu, bSubmenu)
{
      document.writeln('<a class=menu');
    if (sCurrentPage == sMenu) {
        document.write(' style="color:#aa0000"');
    }
    document.write(' href=');
    document.write(sUrl);
    document.write('>');
    document.write(sMenu);
    document.write('</a>');
}

// ----------------------------------------------------------------------------
// footer()
//
// Creates the Marinsoft page footer
//
//  nSubdirectories Number of subdirectories down from the root
//
function footer(nSubdirectories)
{
    document.writeln('<table width=100% cellspacing=0 cellpadding=0>');
    document.writeln('  <tr>');
    document.writeln('    <td>');
    document.writeln('       <hr size=1 noshade>');
    document.writeln('          <a class=copyright href="');
    for (j=0; j<nSubdirectories; j++) { 
        document.write('../');
    }
    document.write('legal.htm">&copy;2009 Marinsoft, Inc. All rights reserved.</a>');
    document.writeln('    </td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
}

// ----------------------------------------------------------------------------
// cataloglaunch(sCatalog, bCustom)
//
// launches a specifed PartDrop Catalog in a new browser
//
//  sCatalog Name of PartDrop Catalog to launch
//  bCustom  Whether or not to display custom transformations
//
function cataloglaunch(sCatalog, bCustom){
    if (navigator.appName == "Microsoft Internet Explorer") {
        version=0
        if (navigator.appVersion.indexOf("MSIE")!=-1){
            temp=navigator.appVersion.split("MSIE")
            version=parseFloat(temp[1])
        }
        if (version>=6) {
            sCatalog = "http://www.marinsoft.net/partdrop/html/mrinpartdropcatalog.htm?catID=" + sCatalog + "&custom=" + bCustom;
            window.open(sCatalog, '_blank', 'scrollbars=yes,resizable=yes,menubar=no,toolbar=no');
        }
        else {
            alert('Your browser (' + navigator.appName + ' ' + version + ') version is currently not supported. You need Microsoft Internet Explorer 6.0 or later.');
        }
    }    
    else {
        alert('Your browser (' + navigator.appName + ') is currently not supported. You need Microsoft Internet Explorer 6.0 or later.');
    }
}


// ----------------------------------------------------------------------------
// newlaunch(sUrl)
//
// launches a new browser with the specified url
//
//  sUrl Qualified url
//
function newlaunch(sUrl) {
    window.open(sUrl, '_blank');
}
