// Rollover für Tabellen-Menü
function high(LinkObject)	{
	LinkObject.style.background='rgb(100,250,180)';
	LinkObject.style.cursor = 'hand';
}

function low(LinkObject)	{
	LinkObject.style.background='rgb(111,206,158)';
	LinkObject.style.cursor = 'hand';
}

function sub_high(LinkObject)	{
	LinkObject.style.background='rgb(100,150,200)';
	LinkObject.style.cursor = 'hand';
}

function sub_low(LinkObject)	{
	LinkObject.style.background='rgb(216,220,240)';
	LinkObject.style.cursor = 'hand';
}

function lade(Link)
{
	//alert(Link);
	location.href = Link;
}

function extern(datei,titel,groesse) 
{
	ExternFenster=window.open(datei,titel,groesse);
	ExternFenster.location.href = datei;
	if (ExternFenster.opener == null) ExternFenster.opener = window;
	ExternFenster.opener.name = "opener";
	return true;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

 var tagungsgebuehr = 0;
 var festabendgebuehr = 0;
 var gesamtgebuehr = 0;
 function betrag(wert)
 {
 if (wert.value == "gesamt")  tagungsgebuehr = 130;
 if ((wert.value == "tageskarte_freitag") || (wert.value == "tageskarte_samstag"))  tagungsgebuehr = 80;
 if (wert.value == "kostenlos")  tagungsgebuehr = 0;
 festabendgebuehr = document.forms.anmeldung.anzahl_festabend.value * 50
 gesamtgebuehr = tagungsgebuehr + festabendgebuehr;
 document.forms.anmeldung.alles.value = gesamtgebuehr+",00";
 }

 
function checkbox(box) 
{ 
  var b = box.form[box.name]; 
  var ok = false; 
  for(var i = b.length; i > -1; i--) 
  { 
    if(ok && !box.checked) b[i].checked = false; 
    if(b[i] == box) ok = true; 
  } 

  ok = false; 
  for(var i = 0; i < b.length; i++ ) 
  { 
    if(ok && box.checked) b[i].checked = true; 
    if(b[i] == box) ok = true; 
  } 
} 



// ----- Popup Control ---------------------------------------------------------

function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br />');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ----- Hide -----

function at_hide()
{
  var c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ----- Click -----

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

// ----- Attach -----

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);
  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}
