function callDynamicScript( id, url ) {
  // construct the proper url
  var fullUrl = url + (url.indexOf("?") < 0 ? "?" : "&") + "noCacheIE=" + (new Date()).getTime();

  var elemHead = document.getElementsByTagName("head").item(0);
  var elemOldScript = document.getElementById( id );

  // check if there is a previous script object and delete it if present
  if( elemOldScript ) {
     elemOldScript.parentNode.removeChild( elemOldScript );
  }

  // Create the script tag
  elemScript = document.createElement("script");
      
  // Add script object attributes and assign it to the header
  elemScript.setAttribute("type", "text/javascript");
  elemScript.setAttribute("charset", "utf-8");
  elemScript.setAttribute("src", fullUrl);
  elemScript.setAttribute("id", id);
  elemHead.appendChild( elemScript );
}

function fillValues() {
	for(val in weerdata) {
		if (document.getElementById (weerdata[val][0])) {
			document.getElementById (weerdata[val][0]).innerHTML=weerdata[val][1];
		}
  	}
}

function update() {
//	document.images["OutsideTempHistory"].src = "img/OutsideTempHistory.gif"
//	document.images["BarometerHistory"].src = "img/BarometerHistory.gif"
//	document.images["WindDirectionHistory"].src = "img/WindDirectionHistory.gif"
//	document.images["WindSpeedHistory"].src = "img/WindSpeedHistory.gif"
	document.images["OutsideTempHistory"].src = "getimage.php?img=OutsideTempHistory.gif&noCacheIE=" + (new Date()).getTime()
	document.images["BarometerHistory"].src = "getimage.php?img=BarometerHistory.gif&noCacheIE=" + (new Date()).getTime()
	document.images["WindDirectionHistory"].src = "getimage.php?img=WindDirectionHistory.gif&noCacheIE=" + (new Date()).getTime()
	document.images["WindSpeedHistory"].src = "getimage.php?img=WindSpeedHistory.gif&noCacheIE=" + (new Date()).getTime()
	callDynamicScript( 'weerportlet', 'retrievedata.php' );
//	fillValues ()
}

function switchDetails (id) {


	arrDetails = new Array ();
	arrDetails[0] = "boxIntro";
	arrDetails[1] = "boxTemperatuur";
	arrDetails[2] = "boxWind";
	arrDetails[3] = "boxNeerslag";
	arrDetails[4] = "boxWindchill";
	arrDetails[5] = "boxHitte index";
	arrDetails[6] = "boxDauwpunt";
	arrDetails[7] = "boxBarometer";
	arrDetails[8] = "boxLuchtvochtigheid";

	for(val in arrDetails) {
		if (document.getElementById (arrDetails[val])) {
			document.getElementById (arrDetails[val]).style.display='none';
		}
	}
	if (document.getElementById (id)) {
		document.getElementById (id).style.display='';
	}


}

function switchDayDetails (id, remark) {

document.getElementById ('boxTitle').innerHTML=id;
document.getElementById ('boxContent').innerHTML=remark;
}
