function $$(element) {
  return document.getElementById(element);
}

function blass() {
	if($$('feld_land').value=='SUCHE NACH LAND')	{
		$$('decker').style.display = "block";
	}	else {
		$$('decker').style.display = "none";
	}
}

function closeall() {
  $$('select_rahmen_land').style.height = "14px";
  $$('select_rahmen_land').style.overflow = "hidden";

  $$('select_rahmen_stadt').style.height = "14px";
  $$('select_rahmen_stadt').style.overflow = "hidden";
}

function toggleSelect(rahmen,feld,liste) {
  // an/aus
  if ($$(rahmen).style.height == "100px") {
    $$(rahmen).style.height = "14px";
    $$(rahmen).style.overflow = "hidden";
    $$(feld).style.value = feld;
    $$(liste).style.display = "none";
  } else {
    $$(rahmen).style.height = "100px";
    $$(rahmen).style.overflow = "auto";
    $$(feld).style.value = feld;
    $$(liste).style.display = "block";
  }
}

function weg(selector) {
  if (selector.id == 'feld_land') {
    $$('country').value = selector.value;
    $$('city').value = '';
    $$('feld_stadt').value = '';
  } else if (selector.id == 'feld_stadt') {
    $$('city').value = selector.value;
    $$('city').value = selector.value;
  }
  $$('feld_name').value = '';
  document.search.submit();
}

function fillin(b) {
  if ($$('thema').value =='') {
    var sep='';
  } else {
    var sep=',';
  }
  $$('thema').value = $$('thema').value + sep + b;
}

function check(x) {
  parts = $$('bild'+x).src.split('/');
  name = parts[parts.length-1];

	if (name == 'check_on.gif') {
	 $$('bild'+x).src = '/intern/pics/check_off.gif';
	}	else {
		$$('bild'+x).src = '/intern/pics/check_on.gif';
	}
}

function leer() {
	if ($$('feld_name').value == 'SUCHE NACH NAMEN') {
	 $$('feld_name').value = '';
	}
}

document.onmousemove = setCoords; 
var absolute_x, absolute_y, relative_x, relative_y; 

function setCoords(e){ 
  if (!e) e = window.event;
  var browser = navigator.userAgent; 
  if(document.all){
    var b = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ? window.document.documentElement : window.document.body || null;
    absolute_x = e.clientX + b.scrollLeft;
    absolute_y = e.clientY + b.scrollTop;
    relative_x = e.clientX;
    relative_y = e.clientY;
  } 
  else{ 
    absolute_x = e.pageX; 
    absolute_y = e.pageY; 
    relative_x = e.clientX; 
    relative_y = e.clientY; 
  } 
}

function popup(id) {
  if ($$(id).style.display != 'block') {
    var width = $$(id).style.width ? parseInt($$(id).style.width) : 400;
    var height = $$(id).style.height ? parseInt($$(id).style.height) : 200;
    var innerHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;
    var innerWidth = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth;
    if (relative_y + height + 25 > innerHeight && absolute_y > height) {
      $$(id).style.top = (absolute_y - height - 20) + 'px';
    } else {
      $$(id).style.top = (absolute_y + 20) + 'px';
    }
    if (relative_x + width/2 > innerWidth) {
      $$(id).style.left = (innerWidth - width - 50) + 'px';
    } else {
      $$(id).style.left = (relative_x - width/2) + 'px';
    }
    $$(id).style.display = 'block';
  } else {
    $$(id).style.display = 'none';
  }
}

