
  function showReport( p_sHead, p_sContent, p_iTime ) {

    positionTop = f_scrollTop()+f_clientHeight()/2;
    document.getElementById('div_report').style.cssText='top: '+positionTop+'px';

    totHeight = document.getElementById('div_main').offsetHeight;
    document.getElementById('div_report_bg').style.height=totHeight+'px';

    document.getElementById('reportMeldingHead').innerHTML=p_sHead;
    if(p_sContent) {
      document.getElementById('reportMeldingContent').innerHTML=p_sContent;
    }
    document.getElementById('div_report_bg').style.visibility='visible';
    document.getElementById('div_report').style.visibility='visible';

    if(p_iTime != 'inf') {
      if( ! p_iTime ) {
        p_iTime = 1000;
      }
      setTimeout('hideReport()', p_iTime );
    }
  }

  function hideReport( ) {
   document.getElementById('div_report_bg').style.visibility='hidden';
   document.getElementById('div_report').style.visibility='hidden';
 }
 
  function createRequestObject() {
    /*var http = false;
    try {
      http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        http = false;
      }
    }
    if (!http && typeof XMLHttpRequest!='undefined') {
      http = new XMLHttpRequest();
    }
    return http;*/
    
    var req;
    if(window.XMLHttpRequest) {
      req = new XMLHttpRequest();
    } else if(window.ActiveXObject) {
      req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return req;
  }
  
  var http = createRequestObject();

  function loginCheck() {
    email = document.frm.lemail.value;
    pw = document.frm.lpassword.value;
    http.open('get', 'ajax/login.php?mail='+email+'&pw='+pw);
    http.onreadystatechange = handleResponseLogin;
    http.send(null);
  }
  
  var statusLogin = '';
  
  function handleResponseLogin() {
    if(http.readyState == 4 && http.status == 200) {
      if(http.responseText) {
        responseStr = http.responseText;
        statusLogin = responseStr.substr(0,2);
        rightsLogin = responseStr.substr(2,2);
        //inloggen gelukt?
        if(statusLogin == 'g*') {
          document.getElementById('radio1').disabled = true;
          document.getElementById('radio2').disabled = true;
          document.frm.bttnInloggen.disabled = true;
          document.frm.lemail.disabled = true;
          document.frm.lpassword.disabled = true;
          document.frm.type.disabled = true;
          document.getElementById('paymethod').style.display = 'block';
          document.getElementById('helpdiv').style.display = 'none';
          //klant mag per rekenening betalen?
          if(rightsLogin == '1*') {
            document.getElementById('payRekening').style.display = '';
          }
        }
        msg = responseStr.substr(4, 999);
        obj = document.getElementById('note');
        obj.innerHTML = msg;
      }
    }
  }
  
  /*-----------------------------------------*/  
  function show_content(id, item) {
    if(item == 2) {
      http.open('get', 'ajax/comment_more_labels.php?id='+id);
    } else {
      http.open('get', 'ajax/comment_more.php?id='+id);
    }
		http.onreadystatechange = handleResponse;
    http.send(null);
  }
  
  function handleResponse() {
    if(http.readyState == 4 && http.status == 200) {
      if(http.responseText) {
        obj = document.getElementById('reportMeldingContent');
        obj.innerHTML = http.responseText;
        obj.innerHTML += '<br style="clear: both"><div class="swButtons"><input type="button" value="Sluiten" id="updateButton" onclick="hideReport()" />';
        showReport('Uitgebreide info', '', 'inf' );
      }
    }
  }
 
  /*-----------------------------------------*/  

  function f_clientHeight() {
    return f_filterResults (
      window.innerHeight ? window.innerHeight : 0,
      document.documentElement ? document.documentElement.clientHeight : 0,
      document.body ? document.body.clientHeight : 0
    );
  }

  function f_scrollTop() {
    return f_filterResults (
      window.pageYOffset ? window.pageYOffset : 0,
      document.documentElement ? document.documentElement.scrollTop : 0,
      document.body ? document.body.scrollTop : 0
    );
  }

  function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
      n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
  }

