<!--
// JavaScript to support the IOD Observations home page
//   iod_observations.html.en and iod_observations.html.ja
// Sergey Varlamov, December 2008
//
var stext = 0;
var simg = 0;
var himg = 0;
var jpn = 0;

window.onload = initialize;
function initialize () { if (self.init) self.init();}
window.onunload = remove;
function remove () { if (self.exit) self.exit(); }

function init ()
{
  hide_show_div(document.getElementById("js_cntr"),"flip");
  is_jpn();
  crt_list ();
  update_img();
  document.getElementById("param").onchange = update_img;
}
function crt_list () {
  if(jpn){
    stext  = new Array( /* drop-down list text */
/* 0 */  "熱帯インド洋の海面水温偏差",
/* 1 */  "海上風(QUICK SCAT)",
/* 2 */  "外向き長波放射偏差(NCEP/CDC)",
/* 3 */  "インド洋ダイポールモードインデックス",
/* 4 */  "インド洋の海面高度偏差(SSALTO/DUCAS)",
/* 5 */  "南緯5度、東経95度の水温躍層深度(JAMSTEC Triton)"
    );
    simg = new Array( /* image header */
/* 0 */  "熱帯インド洋の海面水温偏差(1970-2000年間の気候値からの偏差）",
/* 1 */  "海上風(QUICK SCAT)",
/* 2 */  "外向き長波放射偏差(NCEP/CDC)",
/* 3 */  "インド洋ダイポールモードインデックス(Reynolds OIv2)",
/* 4 */  "インド洋の海面高度偏差(SSALTO/DUCAS)",
/* 5 */  "南緯5度、東経95度の水温躍層深度(JAMSTEC Triton)"
    );
  }
  else {
    stext  = new Array( /* drop-down list text */
/* 0 */  "SST anomalies in tropical Indian Ocean",
/* 1 */  "Remote Sensing winds, QUICK SCAT",
/* 2 */  "OLR anomalies from NCEP/CDC",
/* 3 */  "Indian Ocean Dipole Mode Index, Reynolds OIv2",
/* 4 */  "SSH anomalies in the Indian Ocean, SSALTO/DUCAS,CLS",
/* 5 */  "Thermocline depth at 5S and 95E, Jamstec TRITON buoy"
    );
    simg = new Array( /* image header */
/* 0 */  "Recent SST anomalies in tropical Indian Ocean (base period 1970-2000)",
/* 1 */  "QUICK SCAT recent winds",
/* 2 */  "Recent Outgoing Longwave Radiation (OLR) anomalies from NCEP/CDC",
/* 3 */  "Indian Ocean Dipole Mode Index from Reynolds OIv2",
/* 4 */  "Recent SSH anomalies in the Indian Ocean (Calculated from the data obtained from SSALTO/DUCAS,CLS)",
/* 5 */  "Thermocline depth at 5S and 95E from Jamstec TRITON buoy"
    );
  }
  himg = new Array(  /* href,width,height */
/* 0 */  "http://www.jamstec.go.jp/frcgc/research/d1/iod/2007/observations/ssta_recent.jpg",452,655,
/* 1 */  "http://www.jamstec.go.jp/frcgc/research/d1/iod/2007/observations/recent_wind.jpg",494,658,
/* 2 */  "http://www.esrl.noaa.gov/psd/map/images/olr/olr.anom.png",940,940,
/* 3 */  "http://www.jamstec.go.jp/frcgc/research/d1/iod/2007/observations/dmi_recent.jpg",658,524,
/* 4 */  "http://www.jamstec.go.jp/frcgc/research/d1/iod/2007/observations/ssha_recent.gif",800,600,
/* 5 */  "http://www.jamstec.go.jp/frcgc/research/d1/iod/2007/observations/d20_5s95e.gif",800,600
  );

  var x = document.getElementById("param");
  x.options.length=0;
  for (var i=0; i<stext.length; i++){
    x.options[i]=new Option(stext[i], i, false, false)
  }
  x.options[0].selected = true;
}
function is_jpn(){
  var url_len = document.URL.length;
  var url_ext = document.URL.substr(url_len-3,3);
  if(url_ext == ".ja" || url_ext == ".jp") jpn = 1;
  else                                     jpn = 0;
}
function update_img () {
  var x = document.getElementById("param");
  var sInd = x.selectedIndex;
  x = document.images["Graphic0"];
  x.width = himg[sInd*3+1];
  x.height = himg[sInd*3+2];
//  document.getElementById("imgtitle").firstChild.nodeValue=simg[sInd];
  x.src = himg[sInd*3];
//  document.getElementById("imgtitle").firstChild.data = simg[sInd];
  document.getElementById("imgtitle").innerHTML = simg[sInd];
}
function hide_show_div(field, sVisibility){
  try{
    if((field) && (field.style)){
       if (sVisibility=='flip'){
         if (field.style.display == 'none'){
           sVisibility = 'block';
         }
         else {
           sVisibility = 'none';
         }
       }
      field.style.display = sVisibility;
    }
  }
  catch(exception){
    //no handling - just preventing page explosions
  }
}
// -->

