// JavaScript file for graphical forecast rollover table.
// This file was created for daytime.
// The time zone is set to EDT.
 
// 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"
}

// 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 = "evening" ;
       imageperiod = imageperiod + 1 ;
       if(imageperiod > 9){
         window.alert("You are at the end of this model run.")
         imageperiod = 9
       }
       if(imageperiod == 1 || imageperiod == 5 || imageperiod == 9) {timeperiod = "night"}
       if(imageperiod == 2 || imageperiod == 6) {timeperiod = "morning"}
       if(imageperiod == 3 || imageperiod == 7) {timeperiod = "afternoon"}
	 weekday = dategif[imageperiod] ;
     }
     if(period == "down"){
       timeperiod = "evening" ;
       imageperiod = imageperiod - 1 ;
       if(imageperiod < 0){
         window.alert("You are at the beginning of this model run.")
         imageperiod = 0
       }
       if(imageperiod == 1 || imageperiod == 5 || imageperiod == 9) {timeperiod = "night"}
       if(imageperiod == 2 || imageperiod == 6) {timeperiod = "morning"}
       if(imageperiod == 3 || imageperiod == 7) {timeperiod = "afternoon"}
	 weekday = dategif[imageperiod] ;
     }
  document.DayofWeek.src= weekday ;
  if (timeperiod == "morning"){
        time1 = "staticimages/8am.gif" ;
        time2 = "staticimages/9am.gif" ;
        time3 = "staticimages/10am.gif" ;
        time4 = "staticimages/11am.gif" ;
        time5 = "staticimages/12pm.gif" ;
        time6 = "staticimages/1pm.gif" ;
  }
  if (timeperiod == "afternoon"){
        time1 = "staticimages/2pm.gif" ;
        time2 = "staticimages/3pm.gif" ;
        time3 = "staticimages/4pm.gif" ;
        time4 = "staticimages/5pm.gif" ;
        time5 = "staticimages/6pm.gif" ;
        time6 = "staticimages/7pm.gif" ;
  }
  if (timeperiod == "evening"){
        time1 = "staticimages/8pm.gif" ;
        time2 = "staticimages/9pm.gif" ;
        time3 = "staticimages/10pm.gif" ;
        time4 = "staticimages/11pm.gif" ;
        time5 = "staticimages/12am.gif" ;
        time6 = "staticimages/1am.gif" ;
  }
  if (timeperiod == "night"){
        time1 = "staticimages/2am.gif" ;
        time2 = "staticimages/3am.gif" ;
        time3 = "staticimages/4am.gif" ;
        time4 = "staticimages/5am.gif" ;
        time5 = "staticimages/6am.gif" ;
        time6 = "staticimages/7am.gif" ;
  }
    
document.T1.src= time1 ;
document.T2.src= time2 ;
document.T3.src= time3 ;
document.T4.src= time4 ;
document.T5.src = time5 ;
document.T6.src = time6 ;

document.Td1.src= time1 ;
document.Td2.src= time2 ;
document.Td3.src= time3 ;
document.Td4.src= time4 ;
document.Td5.src = time5 ;
document.Td6.src = time6 ;

document.Wind1.src= time1 ;
document.Wind2.src= time2 ;
document.Wind3.src= time3 ;
document.Wind4.src= time4 ;
document.Wind5.src = time5 ;
document.Wind6.src = time6 ;

document.Wx1.src= time1 ;
document.Wx2.src= time2 ;
document.Wx3.src= time3 ;
document.Wx4.src= time4 ;
document.Wx5.src = time5 ;
document.Wx6.src = time6 ;

document.SLP1.src= time1 ;
document.SLP2.src= time2 ;
document.SLP3.src= time3 ;
document.SLP4.src= time4 ;
document.SLP5.src = time5 ;
document.SLP6.src = time6 ;

document.Sky1.src= time1 ;
document.Sky2.src= time2 ;
document.Sky3.src= time3 ;
document.Sky4.src= time4 ;
document.Sky5.src = time5 ;
document.Sky6.src = time6 ;

document.hrPcp1.src= time1 ;
document.hrPcp2.src= time2 ;
document.hrPcp3.src= time3 ;
document.hrPcp4.src= time4 ;
document.hrPcp5.src = time5 ;
document.hrPcp6.src = time6 ;

document.Radar1.src= time1 ;
document.Radar2.src= time2 ;
document.Radar3.src= time3 ;
document.Radar4.src= time4 ;
document.Radar5.src = time5 ;
document.Radar6.src = time6 ;

document.mb850HTW1.src= time1 ;
document.mb850HTW2.src= time2 ;
document.mb850HTW3.src= time3 ;
document.mb850HTW4.src= time4 ;
document.mb850HTW5.src = time5 ;
document.mb850HTW6.src = time6 ;

document.mb850HRO1.src= time1 ;
document.mb850HRO2.src= time2 ;
document.mb850HRO3.src= time3 ;
document.mb850HRO4.src= time4 ;
document.mb850HRO5.src = time5 ;
document.mb850HRO6.src = time6 ;

document.mb850F1.src= time1 ;
document.mb850F2.src= time2 ;
document.mb850F3.src= time3 ;
document.mb850F4.src= time4 ;
document.mb850F5.src = time5 ;
document.mb850F6.src = time6 ;

document.mb700HTW1.src= time1 ;
document.mb700HTW2.src= time2 ;
document.mb700HTW3.src= time3 ;
document.mb700HTW4.src= time4 ;
document.mb700HTW5.src = time5 ;
document.mb700HTW6.src = time6 ;

document.mb700HRO1.src= time1 ;
document.mb700HRO2.src= time2 ;
document.mb700HRO3.src= time3 ;
document.mb700HRO4.src= time4 ;
document.mb700HRO5.src = time5 ;
document.mb700HRO6.src = time6 ;

document.mb700F1.src= time1 ;
document.mb700F2.src= time2 ;
document.mb700F3.src= time3 ;
document.mb700F4.src= time4 ;
document.mb700F5.src = time5 ;
document.mb700F6.src = time6 ;

document.mb500HTW1.src= time1 ;
document.mb500HTW2.src= time2 ;
document.mb500HTW3.src= time3 ;
document.mb500HTW4.src= time4 ;
document.mb500HTW5.src = time5 ;
document.mb500HTW6.src = time6 ;

document.mb500HRO1.src= time1 ;
document.mb500HRO2.src= time2 ;
document.mb500HRO3.src= time3 ;
document.mb500HRO4.src= time4 ;
document.mb500HRO5.src = time5 ;
document.mb500HRO6.src = time6 ;

document.mb500HV1.src= time1 ;
document.mb500HV2.src= time2 ;
document.mb500HV3.src= time3 ;
document.mb500HV4.src= time4 ;
document.mb500HV5.src = time5 ;
document.mb500HV6.src = time6 ;

document.mb250H1.src= time1 ;
document.mb250H2.src= time2 ;
document.mb250H3.src= time3 ;
document.mb250H4.src= time4 ;
document.mb250H5.src = time5 ;
document.mb250H6.src = time6 ;

document.BL1.src= time1 ;
document.BL2.src= time2 ;
document.BL3.src= time3 ;
document.BL4.src= time4 ;
document.BL5.src = time5 ;
document.BL6.src = time6 ;

document.PW1.src= time1 ;
document.PW2.src= time2 ;
document.PW3.src= time3 ;
document.PW4.src= time4 ;
document.PW5.src = time5 ;
document.PW6.src = time6 ;

document.FZ1.src= time1 ;
document.FZ2.src= time2 ;
document.FZ3.src= time3 ;
document.FZ4.src= time4 ;
document.FZ5.src = time5 ;
document.FZ6.src = time6 ;

document.Cape1.src= time1 ;
document.Cape2.src= time2 ;
document.Cape3.src= time3 ;
document.Cape4.src= time4 ;
document.Cape5.src = time5 ;
document.Cape6.src = time6 ;

document.BestCape1.src= time1 ;
document.BestCape2.src= time2 ;
document.BestCape3.src= time3 ;
document.BestCape4.src= time4 ;
document.BestCape5.src = time5 ;
document.BestCape6.src = time6 ;

if(imageperiod == 1 || imageperiod == 3 || imageperiod == 5 || imageperiod == 7 || imageperiod == 9){
	document.hr12Pcp6.src = time6 ;
}else {
	document.hr12Pcp6.src = "staticimages/blank.gif";
}

if(imageperiod == 3 || imageperiod == 7){
	document.hr24Pcp6.src = time6 ;
}else {
	document.hr24Pcp6.src = "staticimages/blank.gif";
}

}
 
function getnewimg(imagenam,imagenum,mov) {
var imagenametemp = imagename
imagecounttemp = imagecount

	if ((onoroff == "OFF") && (mov == 1)){return;}
	if((imagenam != "up") && (imagenam != "down")){imagename = imagenam}
  
	imagecount = 6 * imageperiod + imagenum ;
	if ((imagedisplay == "no") && (imagename == imagenam)){
		imagecount = imagecounttemp;
		return;}

     tempmax = 60;
     if(imagenam == "up"){
         if(imagecounttemp <= tempmax){imagecount = imagecounttemp + 1}
         if(imagecount > tempmax){
         window.alert("You are at the last picture for this weather element.")
         imagecount = imagecount - 1
          }}
     if(imagenam == "down"){
         if(imagecounttemp <= tempmax){imagecount = imagecounttemp - 1}
         if (imagecount < 1){
         window.alert("You are at the first picture for this weather element.")
         imagecount = 1
         }}
	
	if(imagecount < 10){
		image = "images/" + imagename + "_0" + imagecount + ".gif" ;
	}else {
		image = "images/" + imagename + "_" + imagecount + ".gif" ;
	}

document.the_image.src= image ;
imagenumtemp = imagenum ;
return;
}

function loopimage(imagenam,imagenum,mov) {
var imagenametemp = imagename
imagecounttemp = imagecount

if ((onoroff == "OFF") && (mov == 1)){return;}
  
imagecount = 6 * imageperiod + imagenum ;
if ((imagedisplay == "no") && (imagename == imagenam)){
	imagecount = imagecounttemp;
	return;}

tempmax = 60;
if(imagecounttemp <= tempmax){imagecount = imagecounttemp + 1}
if(imagecount > tempmax){imagecount = 1}

if(imagecount < 10){
	image = "images/" + imagename + "_0" + imagecount + ".gif" ;
}else {
	image = "images/" + imagename + "_" + imagecount + ".gif" ;
}

document.the_image.src= image ;
imagenumtemp = imagenum ;
timer = setTimeout(loopimage,500)
}

function stoploop() {
  clearInterval(timer);
  timer = null;
}

function get_img(imagename) {
        var slct = document.turnoncode.ingredient.selectedIndex;
        onoroff = document.turnoncode.ingredient.options[slct].value;
}

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

