var exec_onresize = '';

if(typeof parseHTML != 'function') { //controleer of functie al bestaat
	function parseHTML(innerHTMLElement, htmlContent)
	{
		var s1, s2, e1, e2, i, scripts = new Array();
		
		// filter script tags
		while(htmlContent.indexOf("<script") > -1 || htmlContent.indexOf("</script") > -1) {
			s1 = htmlContent.indexOf("<script");
			s2 = htmlContent.indexOf(">", s1);
			e1 = htmlContent.indexOf("</script", s1);
			e2 = htmlContent.indexOf(">", e1);
			scripts.push(htmlContent.substring(s2+1, e1));
			htmlContent = htmlContent.substring(0, s1) + htmlContent.substring(e2+1);
		}
		
		innerHTMLElement.innerHTML = htmlContent;
		
		for(var parseHTML_i = 0; parseHTML_i < scripts.length; parseHTML_i++) {
			eval(scripts[parseHTML_i]);
		}
	}
}

if(typeof getXmlHttp != 'function') { //controleer of functie al bestaat
	function getXmlHttp()
	// vraag pagina op m.b.v. POST request
	{
		var xmlHttp;
		try // Firefox, Opera, Safari
		{
			xmlHttp=new XMLHttpRequest();
		}
		catch (e) // Internet Explorer
		{
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		
		return xmlHttp;	
	}
}

if(typeof FillWithHtmlContent != 'function') { //controleer of functie al bestaat
	function FillWithHtmlContent(thisHtmlTag, htmlPage, params, loadingMessage)
	{
		if (loadingMessage == true)
			document.getElementById(thisHtmlTag).innerHTML = '<img src="/img/loading.gif" alt="loading..." />';
		
		// haal HTML
		var xmlHttp = getXmlHttp();
		xmlHttp.open("POST", htmlPage, true);
		
		// Voor POST request zijn deze headers nodig
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) // Ok
			{
				parseHTML(document.getElementById(thisHtmlTag), xmlHttp.responseText);
			}
		}
		xmlHttp.send(params);			
	}
}

if(typeof OpenWindow != 'function') { //controleer of functie al bestaat
	function OpenWindow(url, title, width, height)
	{
		w = (typeof(width) == 'undefined') ? 800 : width;
		h = (typeof(height) == 'undefined') ? 600 : height;
		x = (window.screen.width / 2) - (w / 2); // borders niet meegenomen
		y = (window.screen.height / 2) - (h / 2); // borders niet meegenomen
		
		p = window.open(url, title.replace(" ", "_"), "status=no,width=" + w + ",height=" + h + ",resizable=yes,left=" + x + ",top=" + y + ",screenX=" + x + ",screenY=" + y + ",toolbar=no,menubar=no,scrollbars=yes,location=no,directories=no");
		p.focus();
	}
}
