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


  function myWin(){
    newWin = open ("http://wwwt.emc.ncep.noaa.gov/mmb/aq/fvs/web/html/regular.html", "displayWindow", "width=950,height=800,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes");
  }

  function myWindow(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/5x_tmp/"+dateStr+"/5X.html", "displayWindow", "width=800,height=800,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 anim(){
     if(i>=47){
       i=0;
     }
     document.my_image.src =  pics[i].src;
     window.setTimeout("increse_i(); anim()", speed);
}
             
function animation(){
     if(i>=47){
       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 >= 47) ith=47;
   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=47;
   document.my_image.src=pics[ith].src;
}
                                                                                                                                                             
function openWin(url) {
  newWin=window.open(url);
}
                                                                                                                                                             
function reload(){
   open(this);
}

function load_image(frm){
  count=0;
  if(frm.typ.options[frm.typ.selectedIndex].value=="max.html" || frm.typ.options[frm.typ.selectedIndex].value=="maxX.html" ) {   
    filename="../../"+frm.yr.options[frm.yr.selectedIndex].value+frm.mn.options[frm.mn.selectedIndex].value+frm.dy.options[frm.dy.selectedIndex].value+"/"+frm.fld.options[frm.fld.selectedIndex].value+""+frm.rg.options[frm.rg.selectedIndex].value+"_"+frm.tz.options[frm.tz.selectedIndex].value+".gif";
    preload(filename);
  }
  if(frm.typ.options[frm.typ.selectedIndex].value=="2Dfield.html" || frm.typ.options[frm.typ.selectedIndex].value=="2DXfield.html" || frm.typ.options[frm.typ.selectedIndex].value=="quickvfs.html" ){
    for(k=1; k<=48; k++){
      if(k<10) data="0"+k;
      else data=k;
      filename="../../"+frm.yr.options[frm.yr.selectedIndex].value+frm.mn.options[frm.mn.selectedIndex].value+frm.dy.options[frm.dy.selectedIndex].value+"/"+frm.fld.options[frm.fld.selectedIndex].value+frm.tz.options[frm.tz.selectedIndex].value+"_"+data+".gif";
      preload(filename);
    }
  }
  if(frm.typ.options[frm.typ.selectedIndex].value=="species.html"){
    for(k=1; k<=48; k++){
      if(k<10) data="0"+k;
      else data=k;
      filename="../../"+frm.yr.options[frm.yr.selectedIndex].value+frm.mn.options[frm.mn.selectedIndex].value+frm.dy.options[frm.dy.selectedIndex].value+"/"+frm.fld.options[frm.fld.selectedIndex].value+frm.lvl.options[frm.lvl.selectedIndex].value+"_"+frm.tz.options[frm.tz.selectedIndex].value+"_"+data+".gif";
      preload(filename);
    }
  }


  show(0);
}

function get_i(){
 i=ith;
} 
