/* -----------------------------------------------
   XMLHTTP Connector - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.
   Please inform us of any improvements made.
   When usefull we will add your credits.
  ------------------------------------------------ */


<!--
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    xmlhttp = false;
   }
  }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
  xmlhttp = new XMLHttpRequest();
}
function pull(id, el)
{
		document.getElementById(el).innerHTML = '<img src=/UserFiles/Media/loading.gif id=loader />';
		var element = document.getElementById('right');
		//element.innerHTML = 'Loading ...';
		xmlhttp.open("GET", '?idr=' + id, true );
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				element.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
		
		// correct firefox bug, thx to http://www.selfindulgentwiener.com/post/20/
		// in this case just for the nice effect
		var showFunc = function(){ pull2(id, el) };
		setTimeout(showFunc,250);
}
function pull2(id, el)
{
		var element = document.getElementById(el);
		//element.innerHTML = 'Loading ...';
		xmlhttp.open("GET", '?ids=' + id, true );
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				element.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
		var showFunc = function(){ stretch('all'); };
		setTimeout(showFunc,1000);
}
// sends any form output: <form onsubmit="return sendForm(this)">
function sendForm(formName, el)
{
	s=formName.length-0
	fn='';
	for(i=0; i<s; i++)
	{
		if(formName.elements[i].checked==true)
		{
			fn +=formName.elements[i].name+'='+encodeURI(formName.elements[i].value)+'&';
			//if (formName.elements[i].value=='')
			//{
			//	alert("U dient alle vragen te beantwoorden\nPlease answer all questions");
			//	return false;
			//}
		}
		else if(formName.elements[i].type=='text' || formName.elements[i].type=='textarea' || formName.elements[i].type=='hidden')
		{
			fn +=formName.elements[i].name+'='+encodeURI(formName.elements[i].value)+'&';
			//if (formName.elements[i].value=='')
			//{
			//	alert("U dient alle vragen te beantwoorden\nPlease answer all questions");
			//	return false;
			//}
		}
	}
	//alert(fn);
	var element = document.getElementById(el);
	//element.innerHTML = '<img src=/UserFiles/Media/loading.gif />';
	xmlhttp.open('POST', 'index.php', true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", fn.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(fn);
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			element.innerHTML = xmlhttp.responseText;
		}
	}
	var showFunc = function(){ stretch('all'); };
	setTimeout(showFunc,1000);
	
	return false;
}

//-->