// JavaScript file for graphical forecast rollover table.
// This file was created for daytime.
// The time zone is set to EST.
 
// Mouse over effect initialized as on -- now set in php page (10/2004)
// var onoroff = "ON"
var imagedisplay = "yes"
 
var imagenumtemp = 1;
var imagecount = 1;
 
var browser = "Explorer";
var temp = navigator.appName;
if (temp == "Netscape"){browser = "Netscape"}
    var blank = "../staticimages/blank.gif"
    var blank2 = "../staticimages/blank.gif"
 
// Netscape does not refresh blank images, so substitute in
// for entries with no forecast with a graphic that has "-"
if (browser == "Netscape"){
    blank = "../staticimages/notavbl.gif"
    blank2 = "../staticimages/notavbl2.gif"
}
 
var ProbWindSpd34cmax = 18;
var ProbWindSpd50cmax = 18;
var ProbWindSpd64cmax = 18;
var ProbWindSpd34imax = 18;
var ProbWindSpd50imax = 18;
var ProbWindSpd64imax = 18;
// Function to handle change of time periods, specific
// to each element displayed
function chgtimes(timeperiod,period,dow){
  weekday = dow
  if (dow != "change"){imageperiod = period}
     if(period == "up"){
       timeperiod = "day" ;
       imageperiod = imageperiod + 1 ;
       if(imageperiod > 12){imageperiod = 0 }
        if (Math.round(imageperiod/2) != imageperiod/2) {timeperiod = "night"}
            weekday = dategif[imageperiod] ;
     }
     if(period == "down"){
        timeperiod = "day" ;
        imageperiod = imageperiod - 1 ;
        if(imageperiod < 0){imageperiod = 12 }
         if (Math.round(imageperiod/2) != imageperiod/2) {timeperiod = "night"}
               weekday = dategif[imageperiod] ;
     }
  document.DayofWeek.src= weekday ;
  if (timeperiod == "day"){
        time1 = "../staticimages/7am.gif" ;
        time2 = "../staticimages/10am.gif" ;
        time3 = "../staticimages/1pm.gif" ;
        time4 = "../staticimages/4pm.gif" ;
        maxmin = "../staticimages/High.gif" ;
        maxtmintperiod = (imageperiod + 1) / 2 ;
        maxtmintperiod = Math.round(maxtmintperiod)
  }
  if (timeperiod == "night"){
        time1 = "../staticimages/7pm.gif" ;
        time2 = "../staticimages/10pm.gif" ;
        time3 = "../staticimages/1am.gif" ;
        time4 = "../staticimages/4am.gif" ;
        maxmin = "../staticimages/Low.gif" ;
        maxtmintperiod = (imageperiod + 1) / 2 ;
        maxtmintperiod = Math.round(maxtmintperiod)
  }
    if (((imageperiod + 1) * 2) > ProbWindSpd34cmax){
        document.ProbWindSpd34c1.src = blank ;
        document.ProbWindSpd34c2.src = blank ;
    }
    else{
    document.ProbWindSpd34c1.src= "../staticimages/ProbWindSpd34c.gif" ;
    document.ProbWindSpd34c2.src= "../staticimages/ProbWindSpd34c.gif" ;
    }
    if (((imageperiod + 1) * 2) > ProbWindSpd50cmax){
        document.ProbWindSpd50c1.src = blank ;
        document.ProbWindSpd50c2.src = blank ;
    }
    else{
    document.ProbWindSpd50c1.src= "../staticimages/ProbWindSpd50c.gif" ;
    document.ProbWindSpd50c2.src= "../staticimages/ProbWindSpd50c.gif" ;
    }
    if (((imageperiod + 1) * 2) > ProbWindSpd64cmax){
        document.ProbWindSpd64c1.src = blank ;
        document.ProbWindSpd64c2.src = blank ;
    }
    else{
    document.ProbWindSpd64c1.src= "../staticimages/ProbWindSpd64c.gif" ;
    document.ProbWindSpd64c2.src= "../staticimages/ProbWindSpd64c.gif" ;
    }
    if (((imageperiod + 1) * 2) > ProbWindSpd34imax){
        document.ProbWindSpd34i1.src = blank ;
        document.ProbWindSpd34i2.src = blank ;
    }
    else{
    document.ProbWindSpd34i1.src= "../staticimages/ProbWindSpd34i.gif" ;
    document.ProbWindSpd34i2.src= "../staticimages/ProbWindSpd34i.gif" ;
    }
    if (((imageperiod + 1) * 2) > ProbWindSpd50imax){
        document.ProbWindSpd50i1.src = blank ;
        document.ProbWindSpd50i2.src = blank ;
    }
    else{
    document.ProbWindSpd50i1.src= "../staticimages/ProbWindSpd50i.gif" ;
    document.ProbWindSpd50i2.src= "../staticimages/ProbWindSpd50i.gif" ;
    }
    if (((imageperiod + 1) * 2) > ProbWindSpd64imax){
        document.ProbWindSpd64i1.src = blank ;
        document.ProbWindSpd64i2.src = blank ;
    }
    else{
    document.ProbWindSpd64i1.src= "../staticimages/ProbWindSpd64i.gif" ;
    document.ProbWindSpd64i2.src= "../staticimages/ProbWindSpd64i.gif" ;
    }
}
 
function getnewimg(imagenam,imagenum,mov) {
         var imagenametemp = imagename
         imagecounttemp = imagecount
     if ((onoroff == "OFF") && (mov == 1)){return;}
     if((imagenam != "up") && (imagenam != "down")){imagename = imagenam}
     imagecounttemp = imagecount
     y = (imageperiod * 4) + imagenum ;
// 20 is the amount of images that are 3 hourly and
// at 21, images become 6 hourly.
     if (y > 20){
          imagetest = ((imageperiod * 4) + imagenum + 1) / 2 ;
          x = Math.round(imagetest);
          if (imagetest == x){
              imagedisplay = "yes"}
          if (imagetest != x){imagedisplay = "no"}
          }
          if (imagename == "MaxTMinT"){
     	      imagenamemaxmin = "MinT" ;
     if (maxmin == "../staticimages/High.gif"){
         imagenamemaxmin = "MaxT" ;
         }
     imagecount = maxtmintperiod
     if(imagenam == "up"){imagecount = imagecounttemp + 1
         if (imagecount > 7){
           window.alert("You are at the last image for this weather element")
           imagecount = imagecount - 1
         imagename = imagenametemp
         }}
     if(imagenam == "down"){imagecount = imagecounttemp - 1
         if (imagecount < 1){
         window.alert("You are at the first image for this weather element")
         imagecount = 1
         imagename = imagenametemp
         }}
     image = "../images/" + sector + "/" + imagenamemaxmin + imagecount + "_" + sector + ".png" ;
     document.the_image.src= image ;
     return;
     }
   if (imagename == "ProbWindSpd34c"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd34cmax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd34cmax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
   if (imagename == "ProbWindSpd50c"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd50cmax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd50cmax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
   if (imagename == "ProbWindSpd64c"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd64cmax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd64cmax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
   if (imagename == "ProbWindSpd34i"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd34imax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd34imax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
   if (imagename == "ProbWindSpd50i"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd50imax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd50imax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
   if (imagename == "ProbWindSpd64i"){
   imagecount = 2 * imageperiod + imagenum ;
   if (imagecount > ProbWindSpd64imax){return;}
   if(imagenam == "up"){imagecount = imagecounttemp + 1
      if (imagecount > ProbWindSpd64imax){
   window.alert("You are at the last image for this weather element.")
   imagecount = imagecount - 1
   }}
   if(imagenam == "down"){imagecount = imagecounttemp - 1
   if (imagecount < 1){
   window.alert("You are at the first image for this weather element.")
   imagecount = 1
  }}
  image = "../images/" + sector + "/" + imagename + imagecount + "_" + sector + ".png" ;
  document.the_image.src= image ;
  imagenumtemp = imagenum ;
  return;
  }
     imagecount = 4 * imageperiod + imagenum ;
     if ((imagedisplay == "no") && (imagename == imagenam)){
     imagecount = imagecounttemp;
return;}
function get_img(imagename) {
        var slct = document.turnoncode.ingredient.selectedIndex;
        onoroff = document.turnoncode.ingredient.options[slct].value;
}

function mouseovereffect(tempvrbl) {
        var onoroff = tempvrbl;
}
}
