function $(id)
{
	return document.getElementById(id);
}
function $$(id)
{
	return document.getElementsByName(id);
}

// PopUp öffnen
function wopen1(url,ziel)
{
  window.open(url,ziel,'resizable=yes,status=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes');
}
function wopen12(url,ziel,width,height)
{
  window.open(url,ziel,'width='+width+',height='+height+'resizable=no,status=yes,scrollbars=auto,menubar=no,toolbar=no,location=no');
}
function wopen2(url,ziel)
{
  window.open(url,ziel,'resizable=yes,status=no,scrollbars=yes,menubar=no,toolbar=no,location=no');
}

/* HTML-Tags und Sonderzeichen maskieren */
function htmlentities(str,typ)
{
  if(typeof str=="undefined")
    str="";
  if(typeof typ!="number")
    typ=2;
  typ = Math.max(0,Math.min(3,parseInt(typ)));
  var html = new Array();
  html[38] = "&amp;";
  html[60] = "&lt;";
  html[62] = "&gt;";
  if(typ==1 || typ==3)
    html[39] = "&#039;";
  if(typ==2 || typ==3)
    html[34] = "&quot;";
  for(var i in html)
    eval("str=str.replace(/"+String.fromCharCode(i)+"/g,\""+html[i]+"\");");
  var entity = new Array(
    "&nbsp;","&iexcl;","&cent;","&pound;","&curren;","&yen;","&brvbar;","&sect;",
    "&uml;","&copy;","&ordf;","&laquo;","&not;","&shy;","&reg;","&macr;",
    "&deg;","&plusmn;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;",
    "&cedil;","&sup1;","&ordm;","&raquo;","&frac14;","&frac12;","&frac34;","&iquest;",
    "&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;",
    "&Egrave;","&Eacute;","&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;",
    "&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;",
    "&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;",
    "&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;",
    "&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;",
    "&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&divide;",
    "&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;"
    );
  for(var i in entity)
    eval("str=str.replace(/"+String.fromCharCode(i*1+160)+"/g,\""+entity[i]+"\");");
  return str;
}
/**
* John Resig, erklärt bei quirksmode
*/
function addEvent( obj, type, fn )
{
   if (obj.addEventListener) {
      obj.addEventListener( type, fn, false );
   } else if (obj.attachEvent) {
      obj["e"+type+fn] = fn;
      obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
      obj.attachEvent( "on"+type, obj[type+fn] );
   }
}

function removeEvent( obj, type, fn )
{
   if (obj.removeEventListener) {
      obj.removeEventListener( type, fn, false );
   } else if (obj.detachEvent) {
      obj.detachEvent( "on"+type, obj[type+fn] );
      obj[type+fn] = null;
      obj["e"+type+fn] = null;
   }
}

// NL-Info anzeigen
function ShowInfo(id)
{
  info = $(id);
  info.style.display = 'block';
}

// NL-Info ausblenden
function HideInfo()
{
  info.style.display = 'none';
}

// NL-Info Position aktualisieren
function updateInfo(e)
{
  if(info!=null)
  {
    posx=0; posy=0;
    if (!e) e=window.event;
    if (e.pageX && e.pageY)
    {
      posx=e.pageX;
      posy=e.pageY;
    }
    else if (e.clientX && e.clientY)
    {
      if(document.compatMode && document.compatMode=="CSS1Compat")
      {
        posx=e.clientX + document.documentElement.scrollLeft;
        posy=e.clientY + document.documentElement.scrollTop;
      }
      else
      {
        posx=e.clientX + document.body.scrollLeft;
        posy=e.clientY + document.body.scrollTop;
      }
    }
    //window.status='posx: ' + posx + ' posy: ' + posy;
    info.style.top  = (posy - 104) + 'px';
    info.style.left = (posx + 1) + 'px';
  }
}

// Anfahrtskizze einblenden
function ShowCard()
{
  if(!zoom_in)
    zoom_in = true;
  pcard = $('p_skizze');
  card = $('skizze');
  pcard.style.display = 'block';
  card.style.display = 'block';
  if(card_height_current<card_height)
  {
    card_height_current += 5;
    if(card!=null)
    {
      pcard.style.height = card_height_current + 'px';
      card.style.height = card_height_current + 'px';
    }
    timer = window.setTimeout("ShowCard()",0.1);
  }
}

// Anfahrtskizze ausblenden
function HideCard()
{
  if(zoom_in)
    zoom_in = false;
  pcard = $('p_skizze');
  card = $('skizze');
  if(card_height_current>0)
  {
    card_height_current -= 10;
    if(card!=null)
    {
      pcard.style.height = card_height_current + 'px';
      card.style.height = card_height_current + 'px';
    }
    timer = window.setTimeout("HideCard()",0.1);
  }
  else
  {
    pcard.style.display = 'none';
    card.style.display = 'none';
  }
}

// Anfahrtskizze
function Card()
{
  window.clearTimeout(timer);
  if(!zoom_in)
    timer = window.setTimeout("ShowCard()",0.1);
  else
    timer = window.setTimeout("HideCard()",0.1);
}

// Globale Variablen initialisieren
var zoom_in = false;
var card_height = 0;
var card_height_current = 0;
var info = null;
var timer = null;

document.onmousemove = updateInfo;
