function ajax_init() {
	
	var ax = false;
	
	

        /**  code voor Internet Explorer */
        /*@cc_on
		
          @if (@_jscript_version >= 5)
              try
              {
                  ax = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      ax = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (e)
                  {
                      ax = false;
                  }
             }
          @else
             ax = false;
        @end @*/

        /** Andere browsers */
		
        if (!ax && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                ax = new XMLHttpRequest();
            }
            catch (e)
            {
                ax = false;
            }
        }

        return ax;
}

var ajax = ajax_init();


function ajax_get(url,responsehandler) {
	
	if (ajax) {
		
		url = url + '?nocache=' + new Date();
		
		ajax.open('GET',url,true);
		ajax.onreadystatechange = function() {
			
			if (ajax.readyState ==4) {
				switch(ajax.status) {
					case 200:
						eval(responsehandler);
						break;
					case 404:
						alert('URL niet gevonden');
						break;
					default:
						if (ajax.status !=0) {
						alert('Foutje: ' + ajax.status);
				}
				}
			
			}
		
			}
			
			ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			
			ajax.send(null);
			}
	
	else {
		
		alert('Ajax wordt in deze browser niet ondersteund');
		
	}

}


function ajax_post(url,responsehandler) {
	
if (ajax) {
	
	
	// url = url + '?nocache=' + new Date();
	
	var spliturl = url.split('?');
	
	ajax.open('POST',spliturl[0],true);
	ajax.onreadystatechange = function() {
		
		if (ajax.readyState ==4) {
			switch(ajax.status) {
				case 200:
					eval(responsehandler);
					break;
				case 404:
					alert('URL niet gevonden');
					break;
				default:
						if (ajax.status !=0) {
					alert('Foutje: ' + ajax.status);
			}
			}
		
		}
	
		}
		
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		
		ajax.send(spliturl[1]);
		
		
		
	}
	else {
		  alert('Ajax wordt niet in deze browser ondersteund');
		}
}
