

function ajaxfill(elemId,url,postFunction) {
  var xmlHttp = false;
  if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
  }
  if (!xmlHttp) {
    try {
      xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
      } catch(e) {
        xmlHttp  = false;
      }
    }
  }

  if (xmlHttp) {
    xmlHttp.onreadystatechange = function () {
      if (xmlHttp.readyState == 4) {
        var content = xmlHttp.responseText;
        var elem    = document.getElementById(elemId);

        elem.innerHTML = content;
        if (postFunction) {
          postFunction();
        }
      }
    };
    xmlHttp.open('GET', url, true);
    xmlHttp.send(null);
  }
}

function unhideOverlay() {
  var elem = document.getElementById('overlay');
  elem.style.display='block';
}

function showOverlay(typ,id) {
  var elem = document.getElementById('overlay');
  elem.style.display='none';

  var url = '';

  if (typ=='produktgruppe') {
    url = 'http://www.modelgroup.com/cs/getOverlayForGruppe/'+id;
  } else if (typ=='stufe') {
    url = 'http://www.modelgroup.com/cs/getOverlayForStufe/'+id;
  } else if (typ=='standort') {
    url = 'http://www.modelgroup.com/cs/getOverlayForStandort/'+id;
  }

  ajaxfill('overlay_content', url, unhideOverlay);
}

