var pics=new Array();
var count=0;
var i=0;
var ith=0;
var speed=1000;
var hr="";
var k;
var dateStr="";
var filename="";
var end=16;

  function myWin(frm){
    dateStr=frm.yr.options[frm.yr.selectedIndex].value+frm.mn.options[frm.mn.selectedIndex].value+frm.dy.options[frm.dy.selectedIndex].value;
    newWin = open ("http://www.emc.ncep.noaa.gov/wx20pl/3x_tmp/"+dateStr+"/3X.html", "displayWindow", "width=800,height=600,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes");
  }
                                                                                                                                                             
function preload(img){
     pics[count] = new Image();
     pics[count].src = img;
     count++;
}

function get_speed(frm){
  if(frm.elements["spd"].selectedIndex == 0) speed=1000;
  if(frm.elements["spd"].selectedIndex == 1) speed=100;
  if(frm.elements["spd"].selectedIndex == 2) speed=2000;
  return speed;
}
                                                                                                                                                             
function increse_i(){
   i++;
   return i;
}
             
function animation(){
     if(i>end){
       i=0;
     }
     if(document.form2.timerBox.checked){
       document.my_image.src =  pics[i].src;
       window.setTimeout("increse_i(); animation()", speed);
       ith=i;
     }
     else{
       return;
     }
}

                                                                                                                                                
function show(i){
  ith=i;
  document.my_image.src=pics[ith].src;
}

function next(){
  ith=ith+1;
  if(ith >= end) ith=end;
   document.my_image.src=pics[ith].src;
}
                                                                                                                                                             
function prev(){
  ith=ith-1;
  if(ith < 0) ith=0;
   document.my_image.src=pics[ith].src;
}
                                                                                                                                                             
function rewind(){
  ith=0;
   document.my_image.src=pics[ith].src;
}
                                                                                                                                                             
function last(){
  ith=end;
   document.my_image.src=pics[ith].src;
}
                                                                                                                                                             
function openWin(url) {
  newWin=window.open(url);
}
                                                                                                                                                             
function reload(){
   open(this);
}

function load_image(frm){
  count=0;

    for(k=0; k<=end; k++){

      kk=k*3;

      if( kk<10){
         hr="0"+kk;
      }
      else {
         hr=kk;
      }

      filename="../../"+frm.dy.options[frm.dy.selectedIndex].value+frm.tz.options[frm.tz.selectedIndex].value+"/"+frm.fld.options[frm.fld.selectedIndex].value + frm.lvl.options[frm.lvl.selectedIndex].value + hr + ".gif";
      preload(filename);

    }

  show(0);
}

function get_i(){
 i=ith;
} 
