
//
// JS function for page header
// insidx: instrument selection
//   0  --  HOME
//   1  --  AIRS
//   2  --  MODIS
//   3  --  IASI
//   4  --  AMSU
//
function header(insidx) {
  var insary = ['HOME', 'AIRS', 'MODIS', 'IASI', 'CrIS', 'AMSU'];
  var inslen = insary.length;

  if((insidx < 0) || (insidx >= inslen)) {
    alert("Invalid insidx: " + insidx);
    return;
  }

  var insbt = [
               ['btn_home_bg.png',
                'btn_airs_bg.png',
                'btn_modis_bg.png',
                'btn_iasi_bg.png',
                'btn_cris_bg.png',
                'btn_amsu_bg.png'
               ],
               ['btn_home_curr.png',
                'btn_airs_curr.png',
                'btn_modis_curr.png',
                'btn_iasi_curr.png',
                'btn_cris_curr.png',
                'btn_amsu_curr.png'
               ],
               ['btn_home_over.png',
                'btn_airs_over.png',
                'btn_modis_over.png',
                'btn_iasi_over.png',
                'btn_cris_over.png',
                'btn_amsu_over.png'
               ]
              ];
  var imobj = [
               ['home_item',
                'airs_item',
                'modis_item',
                'iasi_item',
                'cris_item',
                'amsu_item'
               ],
               ['btn_home_curr',
                'btn_airs_curr',
                'btn_modis_curr',
                'btn_iasi_curr',
                'btn_cris_curr',
                'btn_amsu_curr'
               ],
               ['btn_home_over',
                'btn_airs_over',
                'btn_modis_over',
                'btn_iasi_over',
                'btn_cris_over',
                'btn_amsu_over'
               ]
              ];

  var maa = navigator.userAgent.toLowerCase();
//alert("maa: " + maa);

  var wie = 1;
  if(maa.indexOf("gecko") != -1) {
    wie = 0;
  }
//alert('wie: ' + wie);

  if(wie == 1) {
    var ptop = 76;
  }
  else {
    var ptop = 70;
  }
  var slft =  5;
  var dlft = 65;
  var plft;
  var zidx;

  var bpath = "./";                      // base path
  var ipath = bpath + "common/imgs/";    // image directory

  var i, j;


  // define image object to used in changeImage JS call
  // Note: need define image object in document.writeln to make
  //       onMouseover, onFocus, onMouseout JS calls work
  document.writeln("<script language='javascript'>");
  for(i = 1; i <=2; i++) {
    for(j = 0; j < inslen; j++) {
      document.writeln(imobj[i][j] + " = new Image();");
      document.writeln(imobj[i][j] + ".src = '" + ipath + insbt[i][j] +"';");
    }
  }
  document.writeln("</script>");


  // print Tabs
  for(i = 0; i < inslen; i++) {
    plft = i*dlft + slft;

    if(i == insidx) {
      zidx = 100;
      document.writeln("<div style='position:absolute; top: "
                     + ptop + "px; left: "
                     + plft + "px; z-index: " + zidx
                     + "'><img src='" + ipath + insbt[2][i]
                     + "' border='0' alt='" + insary[i]
                     + "' id='" + imobj[0][i] + "'></div>");
    }
    else {
      zidx = i + 1;
      document.writeln("<div style='position:absolute; top: "
                     + ptop + "px; left: "
                     + plft + "px; z-index: " + zidx
                     + "'><a href='javascript:submit_form0(" + i + ")'"
                     + " onMouseover=\"changeImage('"
                     + imobj[0][i] + "', " + imobj[2][i] + ");\""
                     + " onFocus=\"changeImage('"
                     + imobj[0][i] + "', " + imobj[2][i] + ");\""
                     + " onMouseout=\"changeImage('"
                     + imobj[0][i] + "', " + imobj[1][i] + ");\">"
                     + "<img src='" + ipath + insbt[1][i]
                     + "' border='0' alt='" + insary[i]
                     + "' id='" + imobj[0][i] + "'></a></div>");
    }
  }


  document.writeln("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");

  document.writeln("<tr>");

//document.writeln("<td class='hdimg' width='65' align='left' valign='top'>");
  document.writeln("<td width='65' align='left' valign='top' style='padding-left: 6px; padding-top: 9px;'>");
  document.writeln("<a href=\"javascript:openNewWin('http://www.nesdis.noaa.gov/')\">");
  document.writeln("<img src='./japplets/noaa_logo.png' border='0' width='63' height='60' alt='NOAA'>");
  document.writeln("</a>");
  document.writeln("</td>");

  document.writeln("<td class='hdimg' align='left' valign='top'>");
  document.writeln("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");

  document.writeln("<tr><td>");
  document.writeln("<applet code=FadingText1ech.class width=720 height=45 codebase=./japplets/ archive=FadingText1.jar>");
  document.writeln("<param name=COPYRIGHT value='FadingText applet, Copyright 1999, Eric Harshbarger'>");
  document.writeln("<param name=AUTHOR value='Eric Harshbarger, http://www.ericharshbarger.org'>");
  document.writeln("<param name=BGCOLOR value='113,200,254'>");
  document.writeln("<param name=FGCOLOR value='0,0,255'>");
  document.writeln("<param name=FONTNAME value='TimesRoman'>");
  document.writeln("<param name=FONTSTYLE value='bolditalic'>");
  document.writeln("<param name=FONTSIZE value='14'>");
  document.writeln("<param name=ON.PAUSE value='2500'>");
  document.writeln("<param name=OFF.PAUSE value='1500'>");
  document.writeln("<param name=FADE.SPEED value='100'>");
  document.writeln("<param name=FADE.STEPS value='10'>");
  document.writeln("<param name=ALIGN value='c'>");
  document.writeln("<param name=VALIGN value='c'>");
  document.writeln("<param name=CYCLES value='0'>");
  document.writeln("<param name=TEXT.0 value='Nation Oceanic & Atmospheric Administration (NOAA) | 255,203,0 | http://www.noaa.gov/ | _blank'>");
  document.writeln("<param name=TEXT.1 value='National Environmental Satellite, Data, and Information Service (NESDIS) | 255,139,0 | http://www.nesdis.noaa.gov/ | _blank'>");
  document.writeln("<param name=TEXT.2 value='Center for Satellite Applications and Research (STAR) | 255,75,0 | http://www.orbit.nesdis.noaa.gov/star/index.php | _blank'>");
  document.writeln("<param name=TEXT.3 value='Satellite Meteorology & Climatology Division (SMCD) | 255,11,0 | http://www.orbit.nesdis.noaa.gov/smcd/ | _blank'>");
  document.writeln("<param name=TEXT.4 value='Integrated Observing System Science and Product Development Team (IOSSPDT) | 197,0,0 | http://www.orbit2.nesdis.noaa.gov/smcd/spb/iosspdt/iosspdt.php | _blank'>");
  document.writeln("</applet>");
  document.writeln("</td></tr>");

  document.writeln("<tr><td align='left'>");
  document.writeln("<applet code=LedDisplay2.class width=720 height=28 codebase=./japplets/>");
  document.writeln("<param name=text value='Welcome to NOAA/NESDIS/STAR/SMCD/SPB/IOSSPDT Home Page&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'>");
  document.writeln("<param name=brightColor value='ff0000'>");
  document.writeln("<param name=darkColor value='71c8fe'>");
  document.writeln("<param name=backColor value='71c8fe'>");
  document.writeln("<param name=speed value='100'>");
  document.writeln("<param name=fontFamily value='TimesRoman'>");
  document.writeln("<param name=fontStyle value='3'>");
  document.writeln("<param name=fontSize value='10'>");
  document.writeln("</applet>");
  document.writeln("</td></tr>");

  document.writeln("</table>");
  document.writeln("</td>");
  document.writeln("</tr>");

  document.writeln("<tr><td height='17' colspan='2'></td></tr>");
  document.writeln("<tr><td height='12' colspan='2' background='"
                 + ipath + insbt[0][insidx] + "'></td></tr>");

  document.writeln("</table>");

  document.close();
}

