function getAllDatas(fromtyp,value,flag) {
  document.getElementById('einrichtung').getElementsByTagName('ul')[0].innerHTML = "";
  
//  alert(document.getElementById('hidden_fachgebiet').value);
//  alert(document.getElementById('hidden_einrichtung').value);

  // url = ('http://aswww02.amedick-sommer.de/Typo3-Projekte/sana2/setfields.php');
  url = baseUrl + 'setfields.php';
  
  new Ajax.Request(url, {
    method: 'post',
    parameters: 'id=284&fromtyp=' + fromtyp + '&value='+ value + '&bundesland='+ document.getElementById('hidden_bundesland').value + '&fachgebiet='+ document.getElementById('hidden_fachgebiet').value + '&einrichtung='+ document.getElementById('hidden_einrichtung').value,
    
    onSuccess: function(transport){
     // alert("Von Typ :" + fromtyp + " | Wert : " + fromvalue);
     var json = transport.responseText;
      
      var myJsonObject = eval('(' + json + ')');
      // alert(myJsonObject);
      setFields(myJsonObject,flag);
    },
    onFailure: function(transport) {
    alert ('Fehler:'+ transport.status);
  }
  });
}
  
  
  
  function setFields(json_obj,flag) {
      var showString = "";
      
      var jString = "";
      jString += '<table border="1" width="90%"><tr><th>Num.</th><th>Klinik</th> <th>Klinik UID</th> <th>Departments</th> <th>Countrystate</th></tr>';
      var counter = 1;
      
      
      var kliniken = '<li><a href="" value="">Alle Einrichtungen</a></li>';
      // var bundesland = '<li><a href="" value="">Alle Bundesländer</a></li>';
      
      for(var jObj in json_obj) {
      
        var docNameFirstName = eval('json_obj.'+ jObj + '.addFirstName');
        var docNameLasteName = eval('json_obj.'+ jObj + '.addrLastName');
        var depCompass = eval('json_obj.'+ jObj + '.departmentKompass');
        var countryCode = eval('json_obj.'+ jObj + '.clinicCountryStade');
        var depTitle    = eval('json_obj.'+ jObj + '.departmentTitle');

        var klinikTitle = eval('json_obj.'+ jObj + '.clinicTitle');
        var klinikUid = eval('json_obj.'+ jObj + '.clinicUid');

        jString += "<tr><td>" + counter + "</td><td>" + klinikTitle + "</td><td>" + klinikUid + "</td><td>" + depCompass + "</td><td>" + countryCode + "</td></tr>\n";
        counter++;
        
        
        kliniken    += '<li><a href="" value="' + klinikUid + '">' + klinikTitle + '</a></li>';
           
       //  bundesland  += '<li><a href="" value="' + countryCode + '">' + countryCode + '</a></li>';
      }
      jString += '</table>';
      
      
      document.getElementById('einrichtung').getElementsByTagName('ul')[0].innerHTML = kliniken;
      if(flag==null) {
        document.getElementById('zone-einrich-1').innerHTML = '<a href="aerzteliste.html#" onclick="return observeOpener(this)" class="dd-opener" value="#" id="link_einrich">Bitte wählen</a><a href="aerzteliste.html#" onclick="return observeOpener(this);" class="dd-opener" id="link_blank_2"><img height="20" width="22" src="fileadmin/templates/sana.de/main/images/blank.gif"/></a>';
        document.getElementById('hidden_einrichtung').value = '';
      }
      // document.getElementById('bundesland').getElementsByTagName('ul')[0].innerHTML = bundesland;
      // createNew(jString);
      
      var options = document.getElementById("zone_einrichtung").getElementsByTagName('A');
      for (var j = 0; j < options.length; j++) {
          option = options[j];
          Event.observe(option, 'click', (observeOption), false);
      }
      

      

  }
  
  
      /* DEBUG WINDOW */
      var _w = null;
      function createNew(content) {
        _w = window.open();
        _w.document.open();
        _w.document.write('<html>\n<head>\n<title>AJAX DEBUG WINDOW</title>\n</head>\n<body>\n');
        _w.document.write(content);
        _w.document.write('\n</body>\n</html>');
        _w.document.close();
      }
      
