SettingsVersion = 9.13;
SettingsDate    = "19-Jan-2010";
function loadSettings () {
/* --------------------- ajaxWDwx.js Setup File -------------------------------*\
|  Uncomment those you need to change. All values are set to their defaults.    |
|  You only need to keep those you have changed. The rest can be deleted.       |
|  See how I've done it here: http://www.bashewa.com/ajaxWDwx-settings-bws.js   |
|  Read notes in ajaxWDwx.js                                                    |
\* ----------------------------------------------------------------------------*/

//============================================================================\\
//                 A D D I T I O N A L  S E T T I N G S                       \\
//             P L E A S E   R E A D    T H I S   F I R S T                   \\
// The following entries need to be added to the "ajaxWDwx.js" script so that \\
// the extra functions and features in this script may work.                  \\
// In the following function "function ajaxLoader(url)", the following line:  \\
// 					 clientrawloaded = 1;                                             \\
// needs to be added just below the entry                                     \\
//    ;;;set_ajax_obs('ajaxProgress',rand+'start','-- START --');             \\
//                                                                            \\
// Change the following line:                                                 \\
//    set_ajax_obs("ajaxbigtemp", temp.toFixed(0) + uom.Temp);                \\
// to the following                                                           \\
//    /*      set_ajax_obs("ajaxbigtemp", temp.toFixed(0) + uom.Temp); */     \\
//      			if (temp < 0){                                                  \\
//       				document.getElementById("ajaxbigtemp").src = "./images/bignumb"+useUOM+"/n"+(temp.toFixed(0)*-1)+".png"; \\
//       			} else {                                                        \\
//       				document.getElementById("ajaxbigtemp").src = "./images/bignumb"+useUOM+"/"+temp.toFixed(0)+".png"; \\
//            }                                                               \\
//                                                                            \\
// In the section "switch (wxIcon.useName) {                                  \\
// between the "case 1: and case 9:"	section add the following               \\
//       case wxIcon.useName:                                                 \\
//				tempvar = 'ajax_getIconName'+wxIcon.useName;                        \\
//				if(typeof window[tempvar] == 'function') {                          \\
//					current_conditions_custom(clientraw[48]);                         \\
//					break;                                                            \\ 
//				} else {                                                            \\  
//					set_ajax_obs(wxIcon.useTag ,'<div style="border: 2px solid red">INVALID ICON FUNCTION #'+wxIcon.useName+'"</div>'); \\
//					break;                                                            \\ 
//				}                                                                   \\
//                                                                            \\
// just before the following entry:                                           \\
//     "// now ensure that the indicator flashes on every AJAX fetch"         \\
// add the following entries                                                  \\
// 	// load special scheduled tasks                                           \\
//	if (typeof extra_tasks() == 'function') {                                 \\
//		extra_tasks();                                                          \\
//  }                                                                         \\
// -------------------------------------------------------------------------- \\

wxStation.problemNr= 0; // select problem from below
wxStation.problemMsg[0] = 'No problems';
wxStation.problemMsg[1] = '<b style="color:red">Note: our station is currently out of order.</b><br />We hope to have it up and running by next week.<br />';
wxStation.problemMsg[2] = '<b style="color:red">Note: our anemometer is currently frozen.</b><br />Wind speed and direction may be affected.<br />';
wxStation.problemMsg[3] = '<b style="color:red">Note: our UV meter is currently out of order.</b><br />We hope to have it fixed in due cause.<br />';
wxStation.problemMsg[4] = '<b style="color:red">...your msg here...</b><br />...your msg here...<br />';
//wxStation.stopUpdates = false;
//wxStation.showAlert   = false;
//wxStation.useTag      = "ajaxindicator"; // or "ajaxProblems" or whatever
// -----------------------------------------------------------------------------
//  global $SITE,clientraw;
siteURL = 'http://wawaweather.net';
//useUOM  = 'M';
showUOM = true;
clientrawFile = './clientraw.txt';
clientrawloaded = 0;
MultilingualSystem = true; // if false activates translation below

update.reloadTime  = 5000; // can not be less than 5000 (5 sec)
update.maxupdates  = 0;
update.showRefresh = true;

flash.color = '#00CC00';
flash.red   = '#FF0000';
flash.time  = 3000;


imgDir = './ajax-images/';

// NOTE: do not delete any of the words enclosed in {} in the src parts eg. {PIC}
//       They'll get replaced by their corresponding values later in the script.

// used to set the extension of the wxIcon graphics from various icon groups.
var wxIconExtension = new Array("gif", "jpg", "gif", "gif", "png", "gif", "", "", "", "");

// NOTE: the following line wxIcon.useName= must be commented out for the
//       include-ccicon-switcher.php script to work properly, uncomment if
//       include-ccicon-switcher.php script is not used and assign desired
//       value for preferred icon group.
//wxIcon.useName= 4; // 0=Anole ,1=NWS, 2=Animated1, 3=Animated2, 4=XBMC, 5=EC, 9=Dynamic
wxIcon.src    = imgDir+"icons-current/"+wxIcon.useName+"/{PIC}."+wxIconExtension[wxIcon.useName];
wxIcon.width  = 74;
wxIcon.height = 74;
//wxIcon.hspace = 0;
//wxIcon.vspace = 0;
//wxIcon.border = 0;
//wxIcon.style  = "";
//wxIcon.align  = "";
wxIcon.useTag = "ajaxconditionicon2";

wrImg.src     = imgDir+"wind/wr-{LANG}{DIR}.png";
wrImg.width   = 74;
wrImg.height  = 74;
wrImg.hspace  = 0;
wrImg.vspace  = 0;
wrImg.border  = 0;
wrImg.style   = "";
wrImg.align   = ""; // [ left | right | top | bottom | middle | texttop | absbottom | absmiddle ]
wrImg.lang    = language+"-"; // with trailing dash (e.g. "nl-" will result in graphic name: "./ajax-images/wr-nl-SSE.gif")
wrImg.calm    = "calm"; // substitution for {DIR} (e.g "wr-calm.gif") ... specify "" if not to be shown or not available
wrImg.xlate   = false;   // translate wind direction for icon names (multilingual system)
wrImg.useTag  = "ajaxwindiconwr";

solarHigh = 0; // Update high solar reading
uvHigh = 0;
//uvHighTemp = null;
//solarHighTemp = null;
//maxtemp4todayTemp = null;
//mintemp4todayTemp = null;
maxtemp4today = 0;
mintemp4today = 0;

fireImg.src   = imgDir+"fire/B/Fire-{IMGNR}.gif";
fireImg.width = 60;
fireImg.height= 65;
//fireImg.hspace= 0;
//fireImg.vspace= 0;
//fireImg.border= 0;
//fireImg.style = "border: 2px solid silver;";
//fireImg.align = "";
fireImg.imgNrs[0]= "0"; // {IMGNR} = very low
fireImg.imgNrs[1]="1"; // {IMGNR} = low
fireImg.imgNrs[2]="2"; // {IMGNR} = moderate
fireImg.imgNrs[3]="3"; // {IMGNR} = high
fireImg.imgNrs[4]="4"; // {IMGNR} = extreem
fireImg.useTag   = "ajaxfireimg";


thermometerImg.src   = "./thermometer.php";
thermometerImg.width = 54;
thermometerImg.height= 170;
//thermometerImg.hspace = 0;
//thermometerImg.vspace = 0;
//thermometerImg.border = 0;
//thermometerImg.style  = "";
//thermometerImg.align  = "";
thermometerImg.useTag = "ajaxthermometer";


cloudImg.src    = "./cloud-base.php";
cloudImg.width  = 90;
cloudImg.height = 200;
//cloudImg.hspace = 0;
//cloudImg.vspace = 0;
//cloudImg.border = 0;
//cloudImg.style  = "border: 2px solid silver;";
//cloudImg.align  = "";
//cloudImg.stationAlt = 0;
cloudImg.useTag = "ajaxcloudheightimg";

uvImg.src     = imgDir+"UV{INDEX}.gif";
uvImg.width   = 34;
uvImg.height  = 65;
//uvImg.hspace  = 0;
//uvImg.vspace  = 0;
//uvImg.border  = 0;
//uvImg.style   = "";
//uvImg.align   = "";
uvImg.useTag  = "ajaxuvimg";


moonImg.src   = imgDir+"moon/{BG}/{NS}-moon{AGE}.gif";
moonImg.bg    = "w"; // {BG} = [ w | b ]
moonImg.width = 50;
moonImg.height= 50;
//moonImg.hspace= 0;
//moonImg.vspace= 0;
//moonImg.border= 0;
//moonImg.style = "";
//moonImg.align = "";
moonImg.useTag= "ajaxmoonimg";


webcamImg.src   = "htzwwlcam.gif";
webcamImg.srcNgt= "htzwwlcam.gif";
webcamImg.width = 320;
webcamImg.height= 240;
//webcamImg.hspace= 0;
//webcamImg.vspace= 0;
//webcamImg.border= 0;
webcamImg.style = "border: 2px solid silver;";
//webcamImg.align = "";
webcamImg.webcamUpdate = 1; // minutes
//webcamImg.swapIconWithWebcam = true;
webcamImg.useCamAtNight = true;
//webcamImg.delayDayNight = 15; // wait after sunrise / before sunset
webcamImg.useTag  = "ajaxwebcamimg";



// ENGLISH UOM ---------------
imperialUOM.Temp = '&deg;F';
imperialUOM.Wind = 'mph';
imperialUOM.Baro = 'inHg';
imperialUOM.Rain = 'in';
imperialUOM.Snow = 'in';
imperialUOM.Alti = 'ft';
imperialUOM.Dist = 'miles';
imperialUOM.Deg  = '&deg;';
imperialUOM.dateFmt = "m/d/Y";
imperialUOM.timeFmt = "g:i:s a";
imperialUOM.timeHM  = "g:i a";

// English decimal places
imperialDP.Temp = 1;
imperialDP.Wind = 1;
imperialDP.Baro = 2;
imperialDP.Rain = 2;
imperialDP.Snow = 2;
imperialDP.Alti = 0;
imperialDP.Dist = 2;
imperialDP.UV   = 1;


// METRIC UOM --------------
metricUOM.Temp = '&deg;C';
metricUOM.Wind = 'kph';
metricUOM.Baro = 'hPa';
metricUOM.Rain = 'mm';
metricUOM.Snow = 'cm';
metricUOM.Alti = 'm';
metricUOM.Dist = 'km';
metricUOM.Deg  = '&deg;';
metricUOM.dateFmt = "j-M-Y";
metricUOM.timeFmt = "g:i:s a";
metricUOM.timeHM  = "g:i a";

// Metric decimal places
metricDP.Temp = 1;
metricDP.Wind = 1;
metricDP.Baro = 0;
metricDP.Rain = 1;
metricDP.Snow = 0;
metricDP.Alti = 0;
metricDP.Dist = 2;
metricDP.UV   = 1;
// -----------------------------------------------------------------------------

} // end of loadSettings function


//==============================================================================
//                       CUSTOM CURRENT CONDITIONS                             .
// =========================================================================== .
// A continuation of the function in ajaxWDwx.js script to set the current     .
// conditions icon from various graphic sets.                                  .
// This section allows for custom settings to remain in effect after           .
// ajaxWDwx.js revision updates are applied.                                   .
//==============================================================================
function current_conditions_custom(clientraw48number) {
	  switch (wxIcon.useName) { // dashboard icons

          case 2: set_ajax_obs(wxIcon.useTag ,clientraw48number ,ajax_getIconName2(currIconNr,wxIcon)); break; // Animated icon names set 1
          case 3: set_ajax_obs(wxIcon.useTag ,clientraw48number ,ajax_getIconName3(currIconNr,wxIcon)); break; // Animated icon names set 2
          case 4: set_ajax_obs(wxIcon.useTag ,clientraw48number ,ajax_getIconName4(currIconNr,wxIcon)); break; // XBMC icon names
          case 5: set_ajax_obs(wxIcon.useTag ,clientraw48number ,ajax_getIconName5(currIconNr,wxIcon)); break; // Environment Canada icon names
         default:set_ajax_obs(wxIcon.useTag ,'<div style="border: 2px solid red">INVALID ICON FUNCTION #'+wxIcon.useName+'"</div>');
				 set_ajax_obs(wxIcon.useTag ,'<div style="border: 2px solid red">INVALID ICON FUNCTION #'+wxIcon.useName+'"</div>');
	 }	
}

function ajax_getIconName2 ( iconNr ,iconSet ) {
// perform a lookup and return the graphic for the condition icon
// (using NWS icon nameing convention)
var i0nr, iSrc;
iconList = new Array(
   "animated-0-skc",          //  0 sunny
   "animated-1-nskc",         //  1 clearnight
   "animated-2-bkn",          //  2 cloudy
   "animated-3-sct",          //  3 cloudy2
   "animated-4-nbkn",         //  4 cloudynight
   "animated-5-skc",          //  5 dry
   "animated-6-fg",           //  6 fog
   "animated-7-hazy",         //  7 haze
   "animated-8-hra",          //  8 heavyrain
   "animated-9-few",          //  9 mainlyfine
   "animated-10-mist",        // 10 mist
   "animated-11-nfg",         // 11 nightfog
   "animated-12-nhra",        // 12 nightheavyrain
   "animated-13-novc",        // 13 nightovercast
   "animated-14-nra",         // 14 nightrain
   "animated-15-nshra",       // 15 nightshowers
   "animated-16-nsn",         // 16 nightsnow
   "animated-17-ntsra",       // 17 nightthunder
   "animated-18-ovc",         // 18 overcast
   "animated-19-pcld",        // 19 partlycloudy
   "animated-20-ra",          // 20 rain
   "animated-21-lra",         // 21 rain2
   "animated-22-shra",        // 22 showers2
   "animated-23-ip",          // 23 sleet
   "animated-24-ipra",        // 24 sleetshowers
   "animated-25-sn",          // 25 snow
   "animated-26-snm",         // 26 snowmelt
   "animated-27-snsh",        // 27 snowshowers2
   "animated-28-skc",         // 28 sunny
   "animated-29-scttsra",     // 29 thundershowers
   "animated-30-hi_tsra",     // 30 thundershowers2
   "animated-31-tsra",        // 31 thunderstorms
   "animated-32-nsvrtsra",    // 32 tornado
   "animated-33-windy",       // 33 windy
   "animated-34-ras",         // 34 stopped rainning
   "animated-35-windyrain",   // 35 windy/rain (new with V2.11)
   "animated-36-sunrise",     // 36 sunrise
   "animated-37-sunset"       // 37 sunset
   );

   if (iconNr >= 0 && iconNr <= 37) {
      i0nr = (iconNr).toString().str_pad(2);//,"0","L");
      iSrc = iconSet.src.replace(/(#PIC#|\{PIC\})/i, iconList[iconNr]);
      iSrc =        iSrc.replace(/(#0NR#|\{0NR\})/i, i0nr);
      iSrc =        iSrc.replace(/(#NR#|\{NR\})/i  , iconNr);
      return ('<img src="'+ iSrc
             +'" width="' + iconSet.width
             +'" height="'+ iconSet.height
             +'" border="'+ iconSet.border
             +'" vspace="'+ iconSet.vspace
             +'" hspace="'+ iconSet.hspace
             +'" style="' + iconSet.style
             +'" align="' + iconSet.align
             +'" alt="Current conditions" />');
   }  else return '';
};


function ajax_getIconName3 ( iconNr ,iconSet ) {
// perform a lookup and return the graphic for the condition icon
// (using NWS icon nameing convention)
var i0nr, iSrc;
iconList = new Array(
   "animated-0-skc",          //  0 sunny
   "animated-1-nskc",         //  1 clearnight
   "animated-2-bkn",          //  2 cloudy
   "animated-3-sct",          //  3 cloudy2
   "animated-4-nbkn",         //  4 cloudynight
   "animated-5-skc",          //  5 dry
   "animated-6-fg",           //  6 fog
   "animated-7-hazy",         //  7 haze
   "animated-8-hra",          //  8 heavyrain
   "animated-9-few",          //  9 mainlyfine
   "animated-10-mist",        // 10 mist
   "animated-11-nfg",         // 11 nightfog
   "animated-12-nhra",        // 12 nightheavyrain
   "animated-13-novc",        // 13 nightovercast
   "animated-14-nra",         // 14 nightrain
   "animated-15-nshra",       // 15 nightshowers
   "animated-16-nsn",         // 16 nightsnow
   "animated-17-ntsra",       // 17 nightthunder
   "animated-18-ovc",         // 18 overcast
   "animated-19-pcld",        // 19 partlycloudy
   "animated-20-ra",          // 20 rain
   "animated-21-lra",         // 21 rain2
   "animated-22-shra",        // 22 showers2
   "animated-23-ip",          // 23 sleet
   "animated-24-ipra",        // 24 sleetshowers
   "animated-25-sn",          // 25 snow
   "animated-26-snm",         // 26 snowmelt
   "animated-27-snsh",        // 27 snowshowers2
   "animated-28-skc",         // 28 sunny
   "animated-29-scttsra",     // 29 thundershowers
   "animated-30-hi_tsra",     // 30 thundershowers2
   "animated-31-tsra",        // 31 thunderstorms
   "animated-32-nsvrtsra",    // 32 tornado
   "animated-33-windy",       // 33 windy
   "animated-34-ras",         // 34 stopped rainning
   "animated-35-windyrain",   // 35 windy/rain (new with V2.11)
   "animated-36-sunrise",     // 36 sunrise
   "animated-37-sunset"       // 37 sunset
   );

   if (iconNr >= 0 && iconNr <= 37) {
      i0nr = (iconNr).toString().str_pad(2);//,"0","L");
      iSrc = iconSet.src.replace(/(#PIC#|\{PIC\})/i, iconList[iconNr]);
      iSrc =        iSrc.replace(/(#0NR#|\{0NR\})/i, i0nr);
      iSrc =        iSrc.replace(/(#NR#|\{NR\})/i  , iconNr);
      return ('<img src="'+ iSrc
             +'" width="' + iconSet.width
             +'" height="'+ iconSet.height
             +'" border="'+ iconSet.border
             +'" vspace="'+ iconSet.vspace
             +'" hspace="'+ iconSet.hspace
             +'" style="' + iconSet.style
             +'" align="' + iconSet.align
             +'" alt="Current conditions" />');
   }  else return '';
};


function ajax_getIconName4 ( iconNr ,iconSet ) {
// perform a lookup and return the graphic for the condition icon
// (using NWS icon nameing convention)
// XBMC icon names
iconList = new Array(
   "xbmc-skc",          //  0 sunny
   "xbmc-nskc",         //  1 clearnight
   "xbmc-bkn",          //  2 cloudy
   "xbmc-sct",          //  3 cloudy2
   "xbmc-nbkn",         //  4 cloudynight
   "xbmc-sct",          //  5 dry
   "xbmc-fg",           //  6 fog
   "xbmc-hazy",         //  7 haze
   "xbmc-ra",           //  8 heavyrain
   "xbmc-few",          //  9 mainlyfine
   "xbmc-mist",         // 10 mist
   "xbmc-nfg",          // 11 nightfog
   "xbmc-nra",          // 12 nightheavyrain
   "xbmc-novc",         // 13 nightovercast
   "xbmc-nra",          // 14 nightrain
   "xbmc-nra",          // 15 nightshowers
   "xbmc-nsn",          // 16 nightsnow
   "xbmc-ntsra",        // 17 nightthunder
   "xbmc-ovc",          // 18 overcast
   "xbmc-bkn",          // 19 partlycloudy
   "xbmc-ra",           // 20 rain
   "xbmc-ra",           // 21 rain2
   "xbmc-shra",         // 22 showers2
   "xbmc-ip",           // 23 sleet
   "xbmc-ip",           // 24 sleetshowers
   "xbmc-sn",           // 25 snow
   "xbmc-sn",           // 26 snowmelt
   "xbmc-sn",           // 27 snowshowers2
   "xbmc-skc",          // 28 sunny
   "xbmc-scttsra",      // 29 thundershowers
   "xbmc-hi_tsra",      // 30 thundershowers2
   "xbmc-tsra",         // 31 thunderstorms
   "xbmc-nsvrtsra",     // 32 tornado
   "xbmc-wind",         // 33 windy
   "xbmc-ovc",          // 34 stopped rainning
   "xbmc-windyrain"     // 35 windy/rain (new with V2.11)
   );

   if (iconNr >= 0 && iconNr <= 35) {
      return ('<img src="'+ iconSet.src.replace(/(#PIC#|\{PIC\})/i, iconList[iconNr])
             +'" width="' + iconSet.width
             +'" height="'+ iconSet.height
             +'" border="'+ iconSet.border
             +'" vspace="'+ iconSet.vspace
             +'" hspace="'+ iconSet.hspace
             +'" style="' + iconSet.style
             +'" align="' + iconSet.align
             +'" alt="Current conditions" />');
   }  else return '';
};


function ajax_getIconName5 ( iconNr ,iconSet ) {
// perform a lookup and return the graphic for the condition icon
// (using NWS icon nameing convention)
// Environment Canada icon names
iconList = new Array(
   "ec-00",        //  0 sunny
   "ec-01",        //  1 clearnight
   "ec-02",        //  2 cloudy
   "ec-03",        //  3 cloudy2
   "ec-04",        //  4 cloudynight
   "ec-05",        //  5 dry
   "ec-06",        //  6 fog
   "ec-07",        //  7 haze
   "ec-08",        //  8 heavyrain
   "ec-09",        //  9 mainlyfine
   "ec-10",        // 10 mist
   "ec-01",        // 11 nightfog
   "ec-12",        // 12 nightheavyrain
   "ec-13",        // 13 nightovercast
   "ec-12",        // 14 nightrain
   "ec-12",        // 15 nightshowers
   "ec-16",        // 16 nightsnow
   "ec-17",        // 17 nightthunder
   "ec-06",        // 18 overcast
   "ec-09",        // 19 partlycloudy
   "ec-20",        // 20 rain
   "ec-20",        // 21 rain2
   "ec-22",        // 22 showers2
   "ec-23",        // 23 sleet
   "ec-23",        // 24 sleetshowers
   "ec-26",        // 25 snow
   "ec-25",        // 26 snowmelt
   "ec-27",        // 27 snowshowers2
   "ec-00",        // 28 sunny
   "ec-29",        // 29 thundershowers
   "ec-29",        // 30 thundershowers2
   "ec-31",        // 31 thunderstorms
   "ec-32",        // 32 tornado
   "ec-33",        // 33 windy
   "ec-34",        // 34 stopped rainning
   "ec-22"        // 35 windy/rain (new with V2.11)
   );

   if (iconNr >= 0 && iconNr <= 35) {
      return ('<img src="'+ iconSet.src.replace(/(#PIC#|\{PIC\})/i, iconList[iconNr])
             +'" width="' + iconSet.width
             +'" height="'+ iconSet.height
             +'" border="'+ iconSet.border
             +'" vspace="'+ iconSet.vspace
             +'" hspace="'+ iconSet.hspace
             +'" style="' + iconSet.style
             +'" align="' + iconSet.align
             +'" alt="Current conditions" />');
   }  else return '';
};

// Variables for extra_tasks function
var standarddelay = 0;
var messagecount = 1;
var messagedelay = 0;
var radardelay = 0;
var webcamdelay = 0;
// FWI fire rating loader flag
var fwi_loader = 0;

function extra_tasks() {
	if (standarddelay == 100) {
		standarddelay = 0;
	//	getECAdvisory('1');
	//	getMTORoadClosures('1');
	//	getECForcast('1');
	} else {
		standarddelay++;
	}

	
  // display rotating messages
		if (messagedelay == 2) {
			messagedelay = 0;
			if (messagecount == 1) {
				set_ajax_obs("ajaxmessage","Weather, if it's not live it's history");
			}
			if (messagecount == 2) {
				set_ajax_obs("ajaxmessage","Wawaweather.net, Wawa's first and only live weather web site");
			}
			if (messagecount == 3) {
				set_ajax_obs("ajaxmessage","Live weather from Wawa Ontario Canada");
			}
			if (messagecount == 4) {
				set_ajax_obs("ajaxmessage","Nothing changes like the weather, watch Wawaweather.net for Wawa's latest weather");
                messagecount = 0;
			}
			messagecount++;
		} else {
			messagedelay++;
		}

  // reload radar image
  if (radardelay == 30) {
    radardelay = 0;
	if (document.getElementById("ajaxradar") != null) {
      document.getElementById("ajaxradar").src = siteURL+"/radar.gif"+"?"+new Date();
	}
  } else {
    radardelay++; 
  }

  // reload webcam images
  if (webcamdelay == 15) {
	webcamdelay = 0;
	  if (document.getElementById("ajaxwebcam_mission") != null) {
	    document.getElementById("ajaxwebcam_mission").src = siteURL+"/jpgwebcam.jpg"+"?"+new Date();
    }
	  if (document.getElementById("ajaxwebcam_birdcam") != null) {
	    document.getElementById("ajaxwebcam_birdcam").src = siteURL+"/birdcam.jpg"+"?"+new Date();
    }
	  if (document.getElementById("ajaxwebcam_montreal_river1") != null) {
	    document.getElementById("ajaxwebcam_montreal_river1").src = "http://users.vianet.ca/naturenorth/netcam.jpg"+"?"+new Date();
	  }  
  } else {
	webcamdelay++; 
  }

	// load FWI information for Google Map when page is selected
	// does not run on any other page
	if (fwi_loader == 1) {
		if (typeof fwi_google_map() == 'function') {
			fwi_google_map();
		}
		fwi_loader = 0;
	}

	//	Only process if clientraw data has been loaded
	if (clientrawloaded == 1) {

		//	Update high solar reading via ajax
		if ( typeof( window[ 'solarHighTemp' ] ) != "undefined" ) {
			if (solarHighTemp > solar) {	
				solarHigh = solarHighTemp;
				solarHighTemp = 0;
			}
			if (solar > solarHigh) {	
				solarHigh = solar;
				set_ajax_obs("ajaxsolarhigh",solar.toFixed(0));
				set_ajax_obs("ajaxsolarhightime",WDdt.date("g:i a"));
			}
			if (document.getElementById("ajaxSIimg") != null) {
				document.getElementById("ajaxSIimg").src = siteURL+"/ajax-images/SI"+Math.round((solarpct/10))+".gif";
			}
		}
	
		//	Update high uv reading via ajax
		if ( typeof( window[ 'uvHighTemp' ] ) != "undefined" ) {
			if (uvHighTemp > uv) {	
				uvHigh = uvHighTemp;
				uvHighTemp = 0;
			}
			if (uv > uvHigh) {	
				uvHigh = uv;
				set_ajax_obs("ajaxuvhigh",uv);
				set_ajax_obs("ajaxuvhightime",WDdt.date("g:i a"));
			}
			uvicon = uv;
			if (uvicon > 11) {
				uvicon = 11;
			}
			if (document.getElementById("ajaxSIimg") != null) {
				document.getElementById("ajaxUVimg").src = siteURL+"/ajax-images/UV"+Math.round(uvicon)+".gif";
			}
		}

		// missing parts for ajax-dashboard max/min temp records
		if ( typeof( window[ 'maxtemp4todayTemp' ] ) != "undefined" ) {
			if (Number(maxtemp4todayTemp).convertTemp() > tempmax) {
				maxtemp4today = Number(maxtemp4todayTemp).convertTemp();
				maxtemp4todayTemp = -999;
			}
			if (tempmax > maxtemp4today) {
				maxtemp4today = tempmax;
				set_ajax_obs("ajaxrectempmaxyr",WDdt.date("Y"));
			}
			set_ajax_obs("ajaxrectempmax", maxtemp4today.toFixed(dp.Temp) + uom.Temp);
		}

		if ( typeof( window[ 'mintemp4todayTemp' ] ) != "undefined" ) {
			if (Number(mintemp4todayTemp).convertTemp() < tempmin) {
				mintemp4today = Number(mintemp4todayTemp).convertTemp();
				mintemp4todayTemp = 999;
			}
			if (tempmin < mintemp4today) {
				mintemp4today = tempmin;
				set_ajax_obs("ajaxrectempminyr",WDdt.date("Y"));
			}
			set_ajax_obs("ajaxrectempmin", mintemp4today.toFixed(dp.Temp) + uom.Temp);
		}

	}
}

function getECAdvisory(ECAdvisory) {
  var xmlHttpECAdvisory=null;
  if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlHttpECAdvisory=new XMLHttpRequest();
  }
  else { // code for IE6, IE5
    xmlHttpECAdvisory=new ActiveXObject("Microsoft.XMLHTTP");
  }

  xmlHttpECAdvisory.onreadystatechange = function() {
    if (xmlHttpECAdvisory.readyState == 4 && xmlHttpECAdvisory.status == 200) {
      document.getElementById("ajaxadvisory").innerHTML = xmlHttpECAdvisory.responseText;
    }
  }
  xmlHttpECAdvisory.open("get","loader_advisory.php?modetype=" + ECAdvisory + "&lang=" + language + "&" + Math.random(),true);
  xmlHttpECAdvisory.send(null);
}

function getMTORoadClosures(MTORoadClosures) {
  var xmlHttpMTORoadClosures=null;
  if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlHttpMTORoadClosures=new XMLHttpRequest();
  }
  else { // code for IE6, IE5
    xmlHttpMTORoadClosures=new ActiveXObject("Microsoft.XMLHTTP");
  }

  xmlHttpMTORoadClosures.onreadystatechange = function() {
    if (xmlHttpMTORoadClosures.readyState == 4 && xmlHttpMTORoadClosures.status == 200) {
      document.getElementById("ajaxroadslosure").innerHTML = xmlHttpMTORoadClosures.responseText;
    }
  }
  xmlHttpMTORoadClosures.open("get","loader_road_report.php?modetype=" + MTORoadClosures + "&" + Math.random(),true);
  xmlHttpMTORoadClosures.send(null);
}

function getECForcast(ECForcast) {
  var xmlHttpECForcast=null;
  if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlHttpECForcast=new XMLHttpRequest();
  }
  else { // code for IE6, IE5
    xmlHttpECForcast=new ActiveXObject("Microsoft.XMLHTTP");
  }

  xmlHttpECForcast.onreadystatechange = function() {
    if (xmlHttpECForcast.readyState == 4 && xmlHttpECForcast.status == 200) {
      document.getElementById("ajaxecforecast").innerHTML = xmlHttpECForcast.responseText;
    }
  }
  xmlHttpECForcast.open("get","loader_ec-forecast.php?modetype=" + ECForcast + "&" + Math.random(),true);
  xmlHttpECForcast.send(null);
}

var update = // for ajax update interval
{reloadtime: 5000    // fetch clientraw.txt file every 5 seconds (1000 ms = 1 second )
  ,maxupdates: 0     // Maximum number of updates/fetches allowed (set to zero for unlimited)
                     // maxupdates * reloadtime / 1000 = (number of seconds to update)
                     // i.e. 36 x 5000 / 1000 = 180 seconds (3 minutes)
                     // Note: if you upload your clientraw.txt file every 30 seconds
                     //       then the visitor will see (180/30) = (6 updates in total).
  ,showRefresh: true // show REFRESH hyperlink after "maxupdates" have been exceeded.
};

gotSettings = true; // must not be deleted and must stay true for implementation of above settings


