var flashcolor = '#6495ED';
var flashtime  = '2000';
var ie4=document.all;
var browser = navigator.appName;


function ajax_wxIcon ( iconWD ) { 
// perform a lookup and return the graphic for the condition icon
  $iconList = new Array(
	"clearnight.gif",           //  0 imagesunny.visible
	"clearnight.gif",         //  1 imageclearnight.visible
	"day_partly_cloudy.gif",   //  2 imagecloudy.visible
	"day_partly_cloudy.gif",   //  3 imagecloudy2.visible
	"night_partly_cloudy.gif", //  4 imagecloudynight.visible
	"day_clear.gif",           //  5 imagedry.visible
	"fog.gif",                 //  6 imagefog.visible
	"haze.gif",                //  7 imagehaze.visible
	"day_heavy_rain.gif",      //  8 imageheavyrain.visible
	"day_mostly_sunny.gif",    //  9 imagemainlyfine.visible
	"mist.gif",                // 10 imagemist.visible
	"fog.gif",                 // 11 imagenightfog.visible
	"night_heavy_rain.gif",    // 12 imagenightheavyrain.visible
	"night_cloudy.gif",        // 13 imagenightovercast.visible
	"night_rain.gif",          // 14 imagenightrain.visible
	"night_light_rain.gif",    // 15 imagenightshowers.visible
	"night_snow.gif",          // 16 imagenightsnow.visible
	"night_tstorm.gif",        // 17 imagenightthunder.visible
	"day_cloudy.gif",          // 18 imageovercast.visible
	"day_partly_cloudy.gif",   // 19 imagepartlycloudy.visible
	"day_rain.gif",            // 20 imagerain.visible
	"day_rain.gif",            // 21 imagerain2.visible
	"day_light_rain.gif",      // 22 imageshowers2.visible
	"day_sleet.gif",           // 23 imagesleet.visible
	"day_sleet.gif",           // 24 imagesleetshowers.visible
	"day_snow.gif",            // 25 imagesnow.visible
	"day_snow.gif",            // 26 imagesnowmelt.visible
	"day_snow.gif",            // 27 imagesnowshowers2.visible
	"day_clear.gif",           // 28 imagesunny.visible
	"day_tstorm.gif",          // 29 imagethundershowers.visible
	"day_tstorm.gif",          // 30 imagethundershowers2.visible
	"day_tstorm.gif",          // 31 imagethunderstorms.visible
	"tornado.gif",             // 32 imagetornado.visible
	"windy.gif",               // 33 imagewindy.visible
	"day_partly_cloudy.gif",   // 34 stopped rainning
	"windyrain.gif"            // 35 windy/rain (new with V2.11)
	);					
  if (iconWD >= 0 && iconWD <= 35) { 
    return ("<img src=\"./images/myicons/" + $iconList[iconWD] + "\" " + "width=\"145\" height=\"95\" alt=\"Current condition icon\" />" );
  } else {
	return '';
  }
}

var HeatWords = new Array (
 ' --- ', 'Extreem gevaarlijk warm', 'Gevaarlijk<br>Warm', 'Extreem Warm Opletten', 'Extreem<br>Warm', 'Oncomfortabel<br>Warm',
 'Zeer<br>Warm', 'Warm', 'Comfortabel', 'Koel', 'Koud', 'Oncomfortabel<br>Koud', 'Zeer<br>Koud', 'Extreem<br>Koud' );

function heatColor(temp,WindChill,Humidex) {
  var hcWord = HeatWords[0];
 if (temp > 32 && Humidex > 29) {
  if (Humidex > 54) { return ('<span style="color: white; background-color: #BA1928;">'+HeatWords[1]+'</span>'); }
  if (Humidex > 45) { return ('<span style="color: white; background-color: #E02538;">'+HeatWords[2]+'</span>'); }
  if (Humidex > 39) { return ('<span style="color: black; background-color: #E178A1;">'+HeatWords[4]+'</span>'); }
  if (Humidex > 29) { return ('<span style="color: white; background-color: #CC6633;">'+HeatWords[6]+'</span>'); }
 } else if (WindChill < 16 ) {
  if (WindChill < -18) { return ('<div style="width:90%;border:1px solid #91ACFF;padding:1px;text-align:center;color:#91ACFF;">'+HeatWords[13]+'</div>'); }
  if (WindChill < -9)  { return ('<div style="width:90%;border:1px solid #806AF9;padding:1px;text-align:center;color:#806AF9;">'+HeatWords[12]+'</div>'); }
  if (WindChill < -1)  { return ('<div style="width:90%;border:1px solid #3366FF;padding:1px;text-align:center;color:#3366FF;">'+HeatWords[11]+'</div>'); }
  if (WindChill < 8)   { return ('<div style="width:90%;border:1px solid #6699FF;padding:1px;text-align:center;color:#6699FF;">'+HeatWords[10]+'</div>'); }
  if (WindChill < 16)  { return ('<div style="width:90%;border:1px solid #89B2EA;padding:1px;text-align:center;color:#89B2EA;">'+HeatWords[9]+'</div>'); }
 }  else if (WindChill >= 16 && temp <= 32) {
  if (temp < 26) { return ('<span style="color: black; background-color: #C6EF8C;">'+HeatWords[8]+'</span>'); }
  if (temp <= 32) { return ('<span style="color: black; background-color: #CC9933;">'+HeatWords[7]+'</span>'); }
  }
  return hcWord;
}

function beaufortcalc (windspeedKM) {
	if (windspeedKM > 116) windspeedbft = "12 Bft"
	if (windspeedKM < 116) windspeedbft = "11 Bft"
	if (windspeedKM < 101) windspeedbft = "10 Bft"
	if (windspeedKM < 89) windspeedbft = "9 Bft"
	if (windspeedKM < 75) windspeedbft = "8 Bft"
	if (windspeedKM < 62) windspeedbft = "7 Bft"
	if (windspeedKM < 49) windspeedbft = "6 Bft"
	if (windspeedKM < 38) windspeedbft = "5 Bft"
	if (windspeedKM < 29) windspeedbft = "4 Bft"
	if (windspeedKM < 19) windspeedbft = "3 Bft"
	if (windspeedKM < 11) windspeedbft = "2 Bft"
	if (windspeedKM < 5) windspeedbft = "1 Bft"
	if (windspeedKM < 1.8) windspeedbft = "0 Bft"
return windspeedbft;
}

function windDir ($winddir)
{
   $windlabel = new Array("N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW");
   return $windlabel[Math.floor(((parseInt($winddir) + 11) / 22.5) % 16 )];
}
function windDir_text ($winddir_txt)
{
   $windlabeltxt = new Array("N", "NNO", "NO", "ONO", "O", "OZO", "ZO", "ZZO", "Z", "ZZW", "ZW", "WZW", "W", "WNW", "NW", "NNW");
   return $windlabeltxt[Math.floor(((parseInt($winddir_txt) + 11) / 22.5) % 16 )];
}
function ajaxLoader(url) {
	if (document.getElementById) {
		var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(url);
	}
	if (x) {
		x.onreadystatechange = function() {
		if (x.readyState == 4 && x.status == 200) {
		var clientrawx = x.responseText.split(' ');
			ajaxdatetimeformat = clientrawx[32];
			set_ajax_obs("LIVE_DATETIME", ajaxdatetimeformat.split('-')[1]);
			set_ajax_obs("TEMP", clientrawx[4] + " &deg;C");
				if (clientrawx[4] < 0) {
					set_ajax_obs("KOUD", "<img src=./images/koud.gif height=20 align=absmiddle alt=KOUD title=KOUD>");
					set_ajax_obs("THERMOMETER", "<img src=./images/thermometer_blauw.gif height=48 alt=THERMOMETER title=THERMOMETER>");
					}
				if (clientrawx[4] >= 0) {
					set_ajax_obs("KOUD", "&nbsp;");
					set_ajax_obs("THERMOMETER", "<img src=./images/thermometer_rood.gif height=48 alt=THERMOMETER title=THERMOMETER>");
					}
  		var heatColorWord = heatColor(clientrawx[4],clientrawx[44],clientrawx[45]);
      set_ajax_obs("TEMPWORD",heatColorWord);
			set_ajax_obs("WINDCHILL", clientrawx[44] + " &deg;C");
			set_ajax_obs("TODAYMINTEMP", clientrawx[47] + " &deg;C");
			set_ajax_obs("TODAYMAXTEMP", clientrawx[46] + " &deg;C");
			set_ajax_obs("RAINRATE", clientrawx[10]);			
			set_ajax_obs("HUM", clientrawx[5] + "% ");
			set_ajax_obs("BAROMETER", clientrawx[6] + " hPa ");

			val1 = clientrawx[3];
			set_ajax_obs("DIR", windDir_text(val1) + " ");
			set_ajax_obs("DIRICONLARGE", "<img src=./images/windicon/" + windDir(val1) + "_3.gif>");
			set_ajax_obs("WIND_GRADEN", val1 + "&deg; ");
			set_ajax_obs("WSPEED", "" + (clientrawx[1]* 1.852).toFixed(1) + " km/h ");
			set_ajax_obs("GUST", "" + (clientrawx[2]* 1.852).toFixed(1) + " km/h ");

			var windspeed_inmeters = clientrawx[1] * 0.5144;
			var windspeed_inkmh = windspeed_inmeters / 0.5144 * 1.852;
			if (windspeed_inkmh > 116 ) { beaufort = 12; beauforttext = "Orkaan<br> Winkracht 12 Bft" }
			if (windspeed_inkmh < 116) { beaufort = 11; beauforttext = "Zeer zware storm<br> Winkracht 11 Bft" }
			if (windspeed_inkmh < 101) { beaufort = 10; beauforttext = "Zware storm<br> Winkracht 10 Bft" }
			if (windspeed_inkmh < 87) { beaufort = 9; beauforttext = "Storm<br> Winkracht 9 Bft" }
			if (windspeed_inkmh < 74) { beaufort = 8; beauforttext = "Stormachtige wind<br> Winkracht 8 Bft" }
			if (windspeed_inkmh < 61) { beaufort = 7; beauforttext = "Harde wind<br> Winkracht 7 Bft" }
			if (windspeed_inkmh < 49) { beaufort = 6; beauforttext = "Krachtige wind<br> Winkracht 6 Bft" }
			if (windspeed_inkmh < 38) { beaufort = 5; beauforttext = "Vrij krachtige wind<br> Winkracht 5 Bft" }
			if (windspeed_inkmh < 29) { beaufort = 4; beauforttext = "Matige wind<br> Winkracht 4 Bft" }
			if (windspeed_inkmh < 19) { beaufort = 3; beauforttext = "Vrij matige wind<br> Winkracht 3 Bft" }
			if (windspeed_inkmh < 11) { beaufort = 2; beauforttext = "Zwakke wind<br> Winkracht 2 Bft" }
			if (windspeed_inkmh < 5) { beaufort = 1; beauforttext = "Zeer zwakke wind<br> Winkracht 1 Bft" }
			if (windspeed_inkmh < 1.8) { beaufort = 0; beauforttext = "Windstil<br> Winkracht 0 Bft" }
				set_ajax_obs("BEAUFORT", beaufort + "&nbsp;Bft ");
				set_ajax_obs("BEAUFORTTEXT", beauforttext + "<br>" + "<img src=./images/bft_" + beaufort + ".png alt=WINDKRACHT title=WINKRACHT>");
				set_ajax_obs("WINDMETERS", windspeed_inmeters.toFixed(1) + " m/s");
			if (beaufort > 4) set_ajax_obs("WINDMETER", "&nbsp;" + "<img src=./images/windmeter.gif height=20 align=absmiddle>");
			if (beaufort <= 4) set_ajax_obs("WINDMETER", "&nbsp;");

			conditie = clientrawx[49].split('\/')[1];
			set_ajax_obs("RAIN", rain = clientrawx[7] + " mm ");
			if (conditie >= 2 || conditie == "Sleet_fall" || conditie == "Recent_showers") { 
				set_ajax_obs("PARAPLU_ICON", "&nbsp;<img src=./images/paraplu4.gif height=16 alt=NEERSLAG title=NEERSLAG>");
				set_ajax_obs("RAIN_ICON", "&nbsp;<img src=./images/rain_ani.gif height=28 alt=NEERSLAG title=NEERSLAG>");
				}
			if (conditie < 2 || conditie == "Windy" || conditie == "Fog") {
				set_ajax_obs("PARAPLU_ICON", "&nbsp;");
				set_ajax_obs("RAIN_ICON", "&nbsp;<img src=./images/rain2.gif height=28 alt=NEERSLAG title=NEERSLAG>");
				}
			if (conditie == 0) set_ajax_obs("WEERCONDITIE", "Regen is gestopt")
			if (conditie == 1) set_ajax_obs("WEERCONDITIE", "");
			if (conditie == 2) set_ajax_obs("WEERCONDITIE", "Lichte (mot)regen")
			if (conditie == 3) set_ajax_obs("WEERCONDITIE", "Lichte regen")
			if (conditie == 4) set_ajax_obs("WEERCONDITIE", "Matige regen")
			if (conditie == 5) set_ajax_obs("WEERCONDITIE", "Zware regenval")
			if (conditie == 6) set_ajax_obs("WEERCONDITIE", "Zware buien")
			if (conditie == "Sleet_fall") set_ajax_obs("WEERCONDITIE", "Natte sneeuw")

			var uvindex = clientrawx[79];
			if (uvindex >= 9 && uvindex <= 10) uvindextext = "Zeer sterk <img src=./images/uv5.png alt=UV5 title=UV5>"
			if (uvindex >= 7 && uvindex < 9) uvindextext = "Sterk <img src=./images/uv4.png alt=UV4 title=UV4>"
			if (uvindex >= 5 && uvindex < 7) uvindextext = "Matig <img src=./images/uv3.png alt=UV3 title=UV3>"
			if (uvindex >= 3 && uvindex < 5) uvindextext = "Zwak <img src=./images/uv2.png alt=UV2 title=UV2>"
			if (uvindex >= 1 && uvindex < 3) uvindextext = "Zeer zwak <img src=./images/uv1.png alt=UV1 title=UV1>"
			if (uvindex > 0 && uvindex < 1) uvindextext = "Weinig zon <img src=./images/uv1a.png alt=UV title=UV>"
			if (uvindex <= 0) uvindextext = "Geen UV <img src=./images/uv1a.png alt=UV title=UV>"

			if (uvindex >= 10 && uvindex < 11) UvIndexIcon = "<img src=./images/uv-index10.gif alt=UV10 title=UV10>"
			if (uvindex >= 9 && uvindex < 10) UvIndexIcon = "<img src=./images/uv-index9.gif alt=UV9 title=UV9>"
			if (uvindex >= 8 && uvindex < 9) UvIndexIcon = "<img src=./images/uv-index8.gif alt=UV8 title=UV8>"
			if (uvindex >= 7 && uvindex < 8) UvIndexIcon = "<img src=./images/uv-index7.gif alt=UV7 title=UV7>"
			if (uvindex >= 6 && uvindex < 7) UvIndexIcon = "<img src=./images/uv-index6.gif alt=UV6 title=UV6>"
			if (uvindex >= 5 && uvindex < 6) UvIndexIcon = "<img src=./images/uv-index5.gif alt=UV5 title=UV5>"
			if (uvindex >= 4 && uvindex < 5) UvIndexIcon = "<img src=./images/uv-index4.gif alt=UV4 title=UV4>"
			if (uvindex >= 3 && uvindex < 4) UvIndexIcon = "<img src=./images/uv-index3.gif alt=UV3 title=UV3>"
			if (uvindex >= 2 && uvindex < 3) UvIndexIcon = "<img src=./images/uv-index2.gif alt=UV2 title=UV2>"
			if (uvindex >= 1 && uvindex < 2) UvIndexIcon = "<img src=./images/uv-index1.gif alt=UV1 title=UV1>"
			if (uvindex < 1) UvIndexIcon = "<img src=./images/uv-index0.gif alt=UV0 title=UV0>"
		
			set_ajax_obs("UV_INDEX", uvindex + " ");
			set_ajax_obs("UV_INDEX_ICON", UvIndexIcon);
			set_ajax_obs("UV_INDEX_TEXT", uvindextext);

			var solar = clientrawx[127];
	        solarpct = clientrawx[34];
    			solardescription = clientrawx[49];	        
			set_ajax_obs("SOLARPCT", "(" + solarpct + "%)");
			set_ajax_obs("SOLAR", solar + " W/m2 ");
			if (solarpct >= 72) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/zonuren-zonnig.gif>")
			if (solarpct < 72) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/zonuren-lichtbewolkt.gif>")
			if (solarpct < 50) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/zonuren-bewolkt.gif>")
			if (solarpct < 25) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/zonuren-zwaarbewolkt.gif>")
if (solardescription.split('\/')[0] == "Night_time" && solarpct < 1) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/moon.gif height=16>")
//			if (solardescription == "Night_time/1" && solarpct < 1) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/moon.gif height=16>")
//			if (solardescription == "Night_time/2" && solarpct < 1) set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/moon.gif height=16>")

//			if (test.substring(0,4) == "Dusk") set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/myicons/sunset.gif height=16 width=26>")
//			if (test.substring(0,4) == "Dawn") set_ajax_obs("SOLAR_ICON", "&nbsp;<img src=./images/myicons/sunrise.gif height=16 width=26>")			
		}
	}
	x.open("GET", url, true);
	x.send(null);
		setTimeout("reset_ajax_color('')",flashtime); 
        setTimeout("ajaxLoader('beemsterweer_weerdata/clientraw.txt?'+new Date())", 6000);
	}
}
function ajaxLoader3(url) {
	if (document.getElementById) {
		var x1 = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(url);
	}
	if (x1) {
		x1.onreadystatechange = function() {
		if (x1.readyState == 4 && x1.status == 200) {
		var wx2 = x1.responseText.split('|');
				set_ajax_obs("TEMPYESTERDAY", wx2[1]);
				set_ajax_obs("AVTEMPWEEK", wx2[2]);				
				set_ajax_obs("TEMPMINTIME", wx2[3]);
				set_ajax_obs("TEMPMAXTIME", wx2[4]);
				set_ajax_obs("TEMPMAXYESTERDAY", parseFloat(wx2[5]).toFixed(1));
				set_ajax_obs("TEMPMAXYESTERDAYTIME", wx2[6]);	
				set_ajax_obs("TEMPTRENDLASTHOUR", wx2[7]);	
				set_ajax_obs("TEMPTREND24HOUR", parseFloat(wx2[8]).toFixed(1));				
				set_ajax_obs("TRENDARROWTEMP5MIN", trendpijl(wx2[9], wx2[10]));
				set_ajax_obs("TRENDARROWTEMP60MIN", trendpijl(wx2[9], wx2[11]));
				set_ajax_obs("TRENDARROWTEMP24UUR", trendpijl(wx2[9], wx2[12]));	

				set_ajax_obs("HUM24HOURSAGO", strip(wx2[24]));
				set_ajax_obs("AVHUMWEEK", strip(wx2[14]));	
				set_ajax_obs("HUMMIN", strip(wx2[15]));
				set_ajax_obs("HUMMINTIME", wx2[16]);
				set_ajax_obs("HUMMAX", strip(wx2[17]));
				set_ajax_obs("HUMMAXTIME", wx2[18]);	
				set_ajax_obs("HUMTRENDLASTHOUR", strip(wx2[19]));
				set_ajax_obs("HUMTREND24HOUR", wx2[20]);
				set_ajax_obs("HUMTRENDARROW5MIN", trendpijl(wx2[21], wx2[22]));
				set_ajax_obs("HUMTRENDARROW60MIN", trendpijl(wx2[21], wx2[23]));
				set_ajax_obs("HUMTRENDARROW24UUR", trendpijl(wx2[21], wx2[24]));

				set_ajax_obs("PRESSUREYESTERDAY", wx2[25]);			
				set_ajax_obs("PRESSUREAVWEEK", wx2[26]);
				set_ajax_obs("PRESSUREMIN", strip(wx2[27]));
				set_ajax_obs("PRESSUREMINTIME", wx2[28]);
				set_ajax_obs("PRESSUREMAX", strip(wx2[29]));
				set_ajax_obs("PRESSUREMAXTIME", wx2[30]);
				pressurelasthour = wx2[31];
				set_ajax_obs("PRESSURELASTHOUR", pressurelasthour.substring(0,pressurelasthour.search(/\//)));
				pressuretrendname = strip(wx2[32]);
				if (pressuretrendname == "Falling") set_ajax_obs("PTN", "Dalend <img src=./images/baro_omlaag.gif align=absmiddle alt=DALEND title=DALEND> ");
				if (pressuretrendname == "Falling slowly") set_ajax_obs("PTN", "Langzaam dalend <img src=./images/baro_omlaag.gif align=absmiddle alt=LANGZAAM DALEND title=LANGZAAM DALEND> ");
				if (pressuretrendname == "Steady") set_ajax_obs("PTN", "Stabiel");
				if (pressuretrendname == "Rising") set_ajax_obs("PTN", "Stijgend <img src=./images/baro_omhoog.gif align=absmiddle alt=STIJGEND title=STIJGEND> ");
				if (pressuretrendname == "Rising slowly") set_ajax_obs("PTN", "Langzaam stijgend <img src=./images/baro_omhoog.gif align=absmiddle alt=LANGZAAM STIJGEND title=LANGZAAM STIJGEND> ");
				set_ajax_obs("BAROTRENDARROW5MIN", trendpijl(wx2[33], wx2[34]));
				set_ajax_obs("BAROTRENDARROW60MIN", trendpijl(wx2[33], wx2[35]));
				set_ajax_obs("BAROTRENDARROW24UUR", trendpijl(wx2[33], wx2[36]));
				set_ajax_obs("WINDAVWEEK", wx2[37]);
				set_ajax_obs("MAXGUSTHOUR", wx2[38]);
				set_ajax_obs("MAXGUSTTODAY", wx2[39]);
				veelwind = beaufortcalc(wx2[39].substr(0,2));
				set_ajax_obs("MAXGUSTTODAYBFT", veelwind);
				windav10min = wx2[40];
				if (strip(windav10min.substr(0,4))*10/10 > "36") set_ajax_obs("STORMWARNING", "HARDE WIND<br>WAARSCHUWING");
				if (strip(windav10min.substr(0,4))*10/10 < "36") set_ajax_obs("STORMWARNING", " ");
				set_ajax_obs("WINDAV10MIN", windav10min);
				set_ajax_obs("WINDTRENDARROW5MIN", trendpijl(wx2[41], wx2[42]));
				set_ajax_obs("WINDTRENDARROW60MIN", trendpijl(wx2[41], wx2[43]));
				set_ajax_obs("WINDTRENDARROW24UUR", trendpijl(wx2[41], wx2[44]));

				set_ajax_obs("DATEOFLASTRAIN", strip(wx2[45]));
				set_ajax_obs("TIMEOFLASTRAIN", wx2[46]);
				set_ajax_obs("YESTERDAYRAIN", wx2[47]);
				set_ajax_obs("DAYSNORAIN", wx2[48]);
				set_ajax_obs("RAINCURRENTWEEK", wx2[49]);
				set_ajax_obs("RAINMONTH", wx2[50]);
				set_ajax_obs("HOURRAIN", wx2[51]);
				set_ajax_obs("TOTALRAIN24UUR", wx2[52]);
				set_ajax_obs("RAINTRENDARROW5MIN", trendpijl(wx2[53], wx2[54]));
				set_ajax_obs("RAINTRENDARROW60MIN", trendpijl(wx2[53], wx2[55]));
				set_ajax_obs("RAINTRENDARROW24UUR", trendpijl(wx2[53], wx2[47]));				

				set_ajax_obs("SUNHOURSTODAY", wx2[56]);
				set_ajax_obs("SUNHOURSYESTERDAY", wx2[57]);
				set_ajax_obs("SUNHOURSMONTH", wx2[85]);
				set_ajax_obs("HIGHUV", wx2[58]);
				set_ajax_obs("HIGHUVTIME", wx2[59]);
				set_ajax_obs("HIGHUVYESTERDAY", wx2[60]);
				set_ajax_obs("HIGHUVYESTERDAYTIME", wx2[61]);
				set_ajax_obs("BURNTIME", wx2[62]);
				set_ajax_obs("UVTRENDARROW5MIN", trendpijl(wx2[63], wx2[64]));
				set_ajax_obs("UVTRENDARROW60MIN", trendpijl(wx2[63], wx2[65]));
				set_ajax_obs("UVTRENDARROW24UUR", trendpijl(wx2[63], wx2[66]));					

				set_ajax_obs("SOLAR24HOURSAGO", wx2[67]);
				set_ajax_obs("THSW", wx2[68]);
				set_ajax_obs("HIGHSOLAR", wx2[69]);
				set_ajax_obs("HIGHSOLARTIME", wx2[70]);
				set_ajax_obs("HIGHSOLARYESTERDAY", wx2[71]);
				set_ajax_obs("HIGHSOLARYESTERDAYTIME", wx2[72]);
				set_ajax_obs("MAXSOLARFORTIME", wx2[73]);
				set_ajax_obs("SOLARTRENDARROW5MIN", trendpijl(wx2[74]*10/10, wx2[75]*10/10));
				set_ajax_obs("SOLARTRENDARROW60MIN", trendpijl(wx2[74]*10/10, wx2[76]*10/10));
				set_ajax_obs("SOLARTRENDARROW24UUR", trendpijl(wx2[74]*10/10, wx2[67]*10/10));

//				set_ajax_obs("WINDCHILL", parseFloat(wx2[81]) + " &deg;C");
				set_ajax_obs("DEWPOINT", parseFloat(wx2[82]) + " &deg;C");
				set_ajax_obs("WETBULB", parseFloat(wx2[77]).toFixed(1));
				set_ajax_obs("CLOUDHEIGHT", wx2[83]);	
				set_ajax_obs("ET", wx2[78]);
				set_ajax_obs("ETMONTH", wx2[79]);
				set_ajax_obs("APPTEMP", wx2[84] + " &deg;C");
				set_ajax_obs("VAPOURPRESSURE", wx2[80]);
		}
	}
	x1.open("GET", url, true);
	x1.send(null);
		setTimeout("reset_ajax_color('')",flashtime); 
        setTimeout("ajaxLoader3('beemsterweer_weerdata/wx2.php?'+new Date())", 20000);
	}
}

function ajaxLoader2(url) {
	if (document.getElementById) {
		var x2 = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(url);
	}
	if (x2) {
		x2.onreadystatechange = function() {
		if (x2.readyState == 4 && x2.status == 200) {
		var clientrawxx = x2.responseText.split(' ');
		
			set_ajax_obs("TEMP2", clientrawxx[4] + " &deg;C");
			set_ajax_obs("WSPEED2", "" + (clientrawxx[1]* 1.852).toFixed(1) + " km/h ");
			set_ajax_obs("GUST2", "" + (clientrawxx[2]* 1.852).toFixed(1) + " km/h ");
			set_ajax_obs("HUM2", clientrawxx[5] + "% ");
			set_ajax_obs("BAROMETER2", clientrawxx[6] + " hPa ");
			
			valDir = clientrawxx[3];
			set_ajax_obs("DIR2", windDir_text(valDir) + " ");
			set_ajax_obs("DIRICON2", "<img src=./images/windicon/" + windDir(valDir) + "_2.gif>");
			set_ajax_obs("WIND_GRADEN2", valDir + "&deg; ");
			
			var windspeed_inknots = clientrawxx[1];
			var windspeed_inmeters = windspeed_inknots * 0.5144;
			var windspeed_inkmh = windspeed_inmeters / 0.5144 * 1.852;
			if (windspeed_inkmh > 116) beaufort = 12;
			if (windspeed_inkmh < 116) beaufort = 11;
			if (windspeed_inkmh < 101) beaufort = 10;
			if (windspeed_inkmh < 87) beaufort = 9;
			if (windspeed_inkmh < 74) beaufort = 8;
			if (windspeed_inkmh < 61) beaufort = 7;
			if (windspeed_inkmh < 49) beaufort = 6;
			if (windspeed_inkmh < 38) beaufort = 5;
			if (windspeed_inkmh < 29) beaufort = 4;
			if (windspeed_inkmh < 19) beaufort = 3;
			if (windspeed_inkmh < 11) beaufort = 2;
			if (windspeed_inkmh < 5) beaufort = 1;
			if (windspeed_inkmh < 1.8) beaufort = 0;
			set_ajax_obs("BEAUFORT2", beaufort + "&nbsp;Bft ");
			set_ajax_obs("WINDMETERS2", windspeed_inmeters.toFixed(1) + " m/s");
			set_ajax_obs("WINDKNOTS2", windspeed_inknots + " kts");

			var solar = clientrawxx[127];
	        solarpct = clientrawxx[34];
    			solardescription = clientrawxx[49];	        
			if (solarpct >= 72) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/zonuren-zonnig.gif>");
			if (solarpct < 72) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/zonuren-lichtbewolkt.gif>");
			if (solarpct < 50) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/zonuren-bewolkt.gif>");
			if (solarpct < 25) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/zonuren-zwaarbewolkt.gif>");
if (solardescription.split('\/')[0] == "Night_time" && solarpct < 1) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/moon.gif height=16>")
//			if (solardescription == "Night_time/1" && solarpct < 1) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/moon.gif height=16>")
//			if (solardescription == "Night_time/2" && solarpct < 1) set_ajax_obs("SOLAR_ICON2", "&nbsp;<img src=./images/moon.gif height=16>")
      set_ajax_obs("UV2", clientrawxx[79]);
			set_ajax_obs("RAIN2", clientrawxx[7] + " mm ");
			icontype = clientrawxx[48];
			if (icontype == 0) icon = "<img src=./beemsterweer_weerdata/forecasticon.gif width=145 height=95 border=1 alt=' '>";
			if (icontype == 1) icon = "<img src=./images/myicons/clearnight.gif width=145 height=95 border=1 alt='heldere nacht'>";
			if (icontype == 3) icon = "<img src=./beemsterweer_weerdata/forecasticon.gif width=145 height=95 border=1 alt=' '>";
			if (icontype == 5) icon = "<img src=./beemsterweer_weerdata/forecasticon.gif width=145 height=95 border=1 alt=' '>";
			if (icontype == 6) icon = "<img src=./images/myicons/mist.gif width=145 height=95 border=1 alt='mist'>";
			if (icontype == 11) icon = "<img src=./images/myicons/clearnight.gif width=145 height=95 border=1 alt='mistige nacht'>";
			if (icontype == 13) icon = "<img src=./beemsterweer_weerdata/forecasticon.gif width=145 height=95 border=1 alt=' '>";
			if (icontype == 14) icon = "<img src=./images/myicons/nightrain.gif width=145 height=95 border=1 alt='Nachtelijke regen'>";
			if (icontype == 15) icon = "<img src=./images/myicons/nightrain.gif width=145 height=95 border=1 alt='Nachtelijke regen'>";
			if (icontype == 18) icon = "<img src=./images/myicons/mainly_cloudy2.jpg width=145 height=95 border=1 alt='Voornamelijk bewolkt'>";
			if (icontype == 19) icon = "<img src=./images/myicons/mainly_cloudy2.jpg width=145 height=95 border=1 alt='Voornamelijk bewolkt'>";
			if (icontype == 20) icon = "<img src=./images/myicons/rain.gif width=145 height=95 border=1 alt='Regen'>";
			if (icontype == 21) icon = "<img src=./images/myicons/lightrain.gif width=145 height=95 border=1 alt='Lichte regen'>";
			if (icontype == 23) icon = "<img src=./images/myicons/sleet.gif width=145 height=95 border=1 alt='Natte sneeuw'>";
			if (icontype == 33) {
				if (beaufort == 3) windyicon = "<img src=./images/myicons/windy3.gif width=145 height=95 border=1 alt=3 Beaufort>" + "<br>Wind: 3 Beaufort";
				if (beaufort == 4) windyicon = "<img src=./images/myicons/windy4.gif width=145 height=95 border=1 alt=4 Beaufort>" + "<br>Wind: 4 Beaufort";
				if (beaufort == 5) windyicon = "<img src=./images/myicons/windy5.gif width=145 height=95 border=1 alt=5 Beaufort>" + "<br>Wind: 5 Beaufort";
				if (beaufort == 6) windyicon = "<img src=./images/myicons/windy6.gif width=145 height=95 border=1 alt=6 Beaufort>" + "<br>Wind: 6 Beaufort";
				if (beaufort == 7) windyicon = "<img src=./images/myicons/windy7.gif width=145 height=95 border=1 alt=7 Beaufort>" + "<br>Wind: 7 Beaufort";
				if (beaufort == 8) windyicon = "<img src=./images/myicons/windy8.gif width=145 height=95 border=1 alt=8 Beaufort>" + "<br>Wind: 8 Beaufort";
				if (beaufort == 9) windyicon = "<img src=./images/myicons/windy9.gif width=145 height=95 border=1 alt=9 Beaufort>" + "<br>Wind: 9 Beaufort";
			}
			weather = clientrawxx[49];
			weather_sky_night="";
			weather_condition="&nbsp;";
      
			if (weather.split('\/')[0] == "Night_time" || "Dawn" || "Dusk") {
				if (weather.split('\/')[2] == "Cloudy_with_clear_patches_") { weather_sky_night = "Wolkenvelden"; icon = "<img src=./images/myicons/cloudywithclearpatches.jpg width=145 height=95 border=1 alt=WOLKENVELDEN>"; }
				if (weather.split('\/')[2] == "Cloudy_with_clear_p") { weather_sky_night = "Wolkenvelden"; icon = "<img src=./images/myicons/cloudywithclearpatches.jpg width=145 height=95 border=1 alt=WOLKENVELDEN>"; }
				if (weather.split('\/')[2] == "Overcast") weather_sky_night = "Geheel bewolkt";
				if (weather.split('\/')[2] == "Overcast_") weather_sky_night = "Geheel bewolkt";
				if (weather.split('\/')[2] == "overcast_") weather_sky_night = "Geheel bewolkt";				
				if (weather.split('\/')[2] == "Scattered_clouds_") weather_sky_night = "Kleine wolkenvelden";
				if (weather.split('\/')[2] == "Clear") weather_sky_night = "Nauwelijks bewolking";
				if (weather.split('\/')[2] == "A_few_clouds_") weather_sky_night = "Enkele wolkenvelden";
				if (weather.split('\/')[2] == "obscured_") weather_sky_night = "Geheel bewolkt";
				if (weather.split('\/')[2] == "mostly_clear_-__p") weather_sky_night = "Voornamelijk helder";
				if (weather.split('\/')[2] == "mostly_cloudy_-"){ weather_sky_night = "Overwegend bewolkt"; icon = "<img src=./images/myicons/cloudywithclearpatches.jpg width=145 height=95 border=1 alt=OVERWEGEND BEWOLKT>"; }
				if (weather.split('\/')[2] == "mostly_cloudy") { weather_sky_night = "Overwegend bewolkt"; icon = "<img src=./images/myicons/cloudywithclearpatches.jpg width=145 height=95 border=1 alt=OVERWEGEND BEWOLKT>"; }
				if (weather.split('\/')[2] == "partly_cloudy_-") { weather_sky_night = "Gedeeltelijk bewolkt"; icon = "<img src=./images/myicons/cloudy_night2.jpg width=145 height=95 border=1 alt=GEDEELTELIJK BEWOLKT>"; }
				if (weather.split('\/')[2] == "partly_cloudy") { weather_sky_night = "Gedeeltelijk bewolkt"; icon = "<img src=./images/myicons/cloudy_night2.jpg width=145 height=95 border=1 alt=GEDEELTELIJK BEWOLKT>"; }				
				if (weather.split('\/')[1] >= 2) icon = "<img src=./beemsterweer_weerdata/forecasticon.gif width=145 height=95 border=1>";
				if (weather.split('\/')[1] == "Windy") icon = windyicon;
			}
			if (weather.split('\/')[0] == "Dusk") { weather_sky = "- Zonsondergang -<br>"; icon = "<img src=./images/myicons/sunset.gif width=150 height=95 border=1 alt=ZONSONDERGANG>"; }
			if (weather.split('\/')[0] == "Dawn") { weather_sky = "- Zonsopkomst -<br>"; icon = "<img src=./images/myicons/sunrise.gif width=150 height=95 border=1 alt=ZONSOPGANG>"; }
			if (weather.split('\/')[0] == "Night_time") weather_sky = "(Nacht)<br>";
			if (weather.split('\/')[0] == "Sunny") { weather_sky = "Zonnig"; } //icon = "<img src=./images/myicons/sunny.gif width=145 height=95 border=1>"; }
			if (weather.split('\/')[0] == "Partly_cloudy") { weather_sky = "Licht bewolkt"; } //icon = "<img src=./images/myicons/cloudyperiods.gif width=145 height=95 border=1>"; }
			if (weather.split('\/')[0] == "Cloudy"){ weather_sky = "Bewolkt"; } //icon = "<img src=./images/myicons/cloudy.gif width=145 height=95 border=1>"; }
			if (weather.split('\/')[0] == "Mainly_cloudy") { weather_sky = "Overwegend bewolkt"; } //icon = "<img src=./images/myicons/mainly_cloudy.jpg width=145 height=95 border=1>"; }
			if (weather.split('\/')[0] == "Overcast_and_gloomy") weather_sky = "Zwaar bewolkt";
				if (weather.split('\/')[1] >= 2) set_ajax_obs("PARAPLU_ICON2", "&nbsp;<img src=./images/paraplu4.gif height=16 alt=NEERSLAG>");
				if (weather.split('\/')[1] < 2) set_ajax_obs("PARAPLU_ICON2", "&nbsp;");
				if (weather.split('\/')[1] == 0) { 
					if (weather.split('\/')[0] == "Night_time") { weather_condition = "Regen is gestopt<br>"; icon = "<img src=./images/myicons/stoppedraining_night.gif width=145 height=95 border=1 alt=REGEN IS GESTOPT>"; }
					else { weather_condition = "Regen is gestopt<br>"; }
				}
				if (weather.split('\/')[1] == 1) weather_condition = "";
				if (weather.split('\/')[1] == 2) weather_condition = "Lichte (mot)regen<br>";
				if (weather.split('\/')[1] == 3) weather_condition = "Lichte regen<br>";
				if (weather.split('\/')[1] == 4) weather_condition = "Matige regen<br>";
				if (weather.split('\/')[1] == 5) weather_condition = "Zware regenval<br>";
				if (weather.split('\/')[1] == 6) weather_condition = "Zware buien<br>";
				if (weather.split('\/')[1] == "Recent_showers") weather_condition = "Net geregend<br>";
				if (weather.split('\/')[1] == "Windy") icon = windyicon; //weather_condition = "Harde wind<br>";
				if (weather.split('\/')[1] == "Fog") weather_condition = "MIST<br>";
				if (weather.split('\/')[1] == "Sleet_fall") weather_condition = "Natte sneeuw<br>";				
// set_ajax_obs("ICONTYPE", ajax_wxIcon(clientrawxx[48]));
			set_ajax_obs("ICONTYPE", icon);		
			set_ajax_obs("WEATHERDESCRIPTION", weather_condition + weather_sky + weather_sky_night);
		}
	}
	x2.open("GET", url, true);
	x2.send(null);
		setTimeout("reset_ajax_color('')",flashtime); 
        setTimeout("ajaxLoader2('beemsterweer_weerdata/clientraw.txt?'+new Date())", 6000);
	}
}

function winddirection(wd) {
	wd = strip(wd);
	if (wd == "N") wd = "N"
	if (wd == "NNE") wd = "NNO"
	if (wd == "NE") wd = "NO"
	if (wd == "ENE") wd = "ONO"
	if (wd == "E") wd = "O"
	if (wd == "ESE") wd = "OZO"
	if (wd == "SE") wd = "ZO"
	if (wd == "SSE") wd = "ZZO"
	if (wd == "S") wd = "Z"
	if (wd == "SSW") wd = "ZZW"
	if (wd == "SW") wd = "ZW"
	if (wd == "WSW") wd = "WZW"
	if (wd == "W") wd = "W"
	if (wd == "WNW") wd = "WNW"
	if (wd == "NW") wd = "NW"
	if (wd == "NNW") wd = "NNW"
	if (wd == "") wd = "N."
	return wd;
}
function ajaxLoader_trends(url) {
	if (document.getElementById) {
		var x3 = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(url);
	}
	if (x3) {
		x3.onreadystatechange = function() {
		if (x3.readyState == 4 && x3.status == 200) {
		var wx3 = x3.responseText.split('|');
			set_ajax_obs("TIJD", wx3[263]);
			for (b=0; b<=250; b++) {
				for (a=0;a<=120;a=a+5) {
					set_ajax_obs("TEMP"+a, wx3[b+1]);
					set_ajax_obs("DEW"+a, wx3[b+2]);
					set_ajax_obs("WIND"+a, wx3[b+3]);
					set_ajax_obs("GUST"+a, wx3[b+4]);
					set_ajax_obs("DIR"+a, winddirection(wx3[b+5]));
					set_ajax_obs("HUM"+a, wx3[b+6]);
					set_ajax_obs("BARO"+a, wx3[b+7]);
					set_ajax_obs("RAIN"+a, wx3[b+8]);
					set_ajax_obs("VPUV"+a, wx3[b+9]);
					set_ajax_obs("VPSOLAR"+a, wx3[b+10]);
					b=b+10;
				}
			}
			set_ajax_obs("TEMP24", wx3[251]);
			set_ajax_obs("DEW24", wx3[252]);
			set_ajax_obs("WIND24", wx3[253]);
			set_ajax_obs("GUST24", wx3[254]);
			set_ajax_obs("DIR24", windDir_text(wx3[264]));			
			set_ajax_obs("HUM24", wx3[255]);
			set_ajax_obs("BARO24", wx3[256]);
			set_ajax_obs("VPUV24", wx3[257]);
			set_ajax_obs("VPSOLAR24", wx3[258]);
			set_ajax_obs("TEMPHOOGSTE", parseFloat(wx3[259]).toFixed(1));
			set_ajax_obs("TEMPHOOGSTETIME", wx3[260]);
			set_ajax_obs("TEMPLAAGSTE", parseFloat(wx3[261]).toFixed(1));
			set_ajax_obs("TEMPLAAGSTETIME", wx3[262]);			
		}
	}
	x3.open("GET", url, true);
	x3.send(null);
		setTimeout("reset_ajax_color('')",flashtime); 
        setTimeout("ajaxLoader_trends('beemsterweer_weerdata/wx3.php?'+new Date())", 20000);
	}
}

function ajaxLoader_visitors(url) {
	if (document.getElementById) {
		var vis = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(url);
	}
	if (vis) {
		vis.onreadystatechange = function() {
		if (vis.readyState == 4 && vis.status == 200) {
			num_visitors = vis.responseText.replace(/[0-9/./\n]/g, '').length;
			if (num_visitors < 2) document.getElementById("ONLINE").innerHTML = "Er is 1 bezoeker online";
			if (num_visitors > 1) document.getElementById("ONLINE").innerHTML = "Er zijn " + num_visitors + " bezoekers online";
		}
	}
	vis.open("GET", url, true);
	vis.send(null);
        setTimeout("ajaxLoader_visitors('visitors.txt?'+new Date())", 15000);
	}
}

function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('the_iframe').height=
the_height + 5;
}


var ie4=document.all;
var browser = navigator.appName;
var ie4=document.all;
var browser = navigator.appName;
var ie8 = false;
if (ie4 && /MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8) {
   ie4=false;
   ie8=true;
 }
}


var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
function handleError() {
	return true;
}
window.onerror = handleError;
function hidestatus(){
window.status=''
return true
}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hidestatus
document.onmouseout=hidestatus
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}

function trendpijl(trend1, trend2) {
	if (trend1 < trend2) trendimage = "<img src=../images/arrow_reddown2.gif height=21 alt=OMLAAG>"
	if (trend1 > trend2) trendimage = "<img src=../images/arrow_greenup2.gif height=21 ALT=OMHOOG>"
	if (trend1 == trend2) trendimage = "<img src=../images/gray_arrow_gelijk.gif height=15 ALT=GELIJK>"
return trendimage;
}
function strip(str) {
	str = str.replace(/^\s*|\s*$/g,"");
	return str;
}
function get_ajax_tags ( ) {
if (ie4 && browser != "Opera" && ! ie8) {  
    var elem = document.body.getElementsByTagName('span');
	var lookfor = 'className';
  } else {
    var elem = document.getElementsByTagName('span');
	var lookfor = 'class';
  }
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute(lookfor);
          if(att == 'ajaxclass') {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}
function reset_ajax_color( usecolor ) {
      var elements = get_ajax_tags();
	  var numelements = elements.length;
	  for (var index=0;index!=numelements;index++) {
         var element = elements[index];
	     element.style.color=usecolor;
      }
}
function set_ajax_obs( name, value ) {
		var element = document.getElementById(name);
		var lastobs = element.getAttribute("lastobs");
		element.setAttribute("lastobs",value);
		if (value != lastobs) {
          element.style.color=flashcolor;
		}
		element.innerHTML =  value;
}
function strip_units ($data) {
  preg_match('/([\d\.\+\-]+)/',$data,$t);
  return $t[1];
}