function oeffneLink(url)
{
  window.open(url);
}

function oeffnePopup(url)
{
  fenster = window.open(url, 'Karte', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=500, height=520');
  fenster.focus();
}

function oeffneDruckansicht(url)
{
  fenster = window.open(url, 'Druckansicht', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=850, height=550');
  fenster.focus();
}

function inputFocus(el)
{
  el.style.backgroundColor = "#D7F3B8";
}

function inputBlur(el)
{
  el.style.backgroundColor = "#FFFFFF";
}

function inputOver(el)
{
  el.style.backgroundColor = '#D7F3B8';
  el.style.color = '#000000';
}

function inputOut(el)
{
  el.style.backgroundColor = '#99BD72';
  el.style.color = '#FFFFFF';
}

function aendereSortierung(el)
{
  el.parentNode.parentNode.submit();
}

function fehlermeldungKarte()
{
  document.getElementById('meldung').innerHTML = 'Das Laden der Karte dauert zu lange.<br/><br/>Überprüfen Sie Ihre Internetverbindung.';
}

function initKarte(titel, strasse, hausnummer, plz, ort)
{
  var to = window.setTimeout('fehlermeldungKarte()', 5000);

  var adresse = strasse + ' ' + hausnummer + ', ' + plz + ' ' + ort;

  var geocoder = new google.maps.Geocoder();

  var latlng = new google.maps.LatLng(-34, 150);
  var myOptions = {
    zoom: 16,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById('karte'), myOptions);

  window.clearTimeout(to);

  if(geocoder)
  {
    geocoder.geocode({'address':adresse}, function(results, status) {
      if(status == google.maps.GeocoderStatus.OK)
      {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
          map: map,
          position: results[0].geometry.location,
          title: titel
        });

        var contentString = '<div id="content">'+
                            '<h1>' + titel + '</h1>'+
                            '<p>' + strasse + ' ' + hausnummer + '</p>'+
                            '<p>' + plz + ' ' + ort + '</p>'+
                            '</div>';

        var infowindow = new google.maps.InfoWindow({
          'content': contentString,
          'maxWidth':200,
          'pixelOffset':new google.maps.Size(0, 35)
        });
        infowindow.open(map, marker);

        google.maps.event.addListener(marker, 'click', function()
        {
          infowindow.open(map,marker);
        });
      }
      else
      {
        alert('Fehler: ' + status)
      }
    });
  }
}









$(document).ready(function(){
  $('#login').css('top', -$('#login').outerHeight());

  $('#loginLink').click(function(){
    if($(this).attr('class') == 'loginOffen aktiv')
    {
      $(this).removeClass('loginOffen aktiv');
      $('#login').animate({
        top: -$('#login').outerHeight()
      });
    }
    else
    {
      $(this).addClass('loginOffen aktiv');
      $('#login').animate({
        top:14
      })
    }
  });

  $(".tooltip").tooltip({
    hintergrund: "#DCFFAD",
    schriftfarbe: "#000000",
    rand: "1px #999 solid",
    eckenradius: 0,
    zeit: 400
  });

});
