/* spendenobjekte */

function filterNum(e) {
 if (typeof e.which != 'undefined') {
  if (e.which==0 || e.which==8 || e.which==44) return true;
  key = String.fromCharCode(e.which);
 } else {
  if (e.keyCode==44) return true;
  if (e.keyCode==32) return false;
  key = String.fromCharCode(e.keyCode);
 }
 return ! isNaN(key);
}

function calcSum() {
 var i=0, inp, sum=0;
 while (inp = document.getElementById('sotable').getElementsByTagName('input')[i ++]) {
  if (inp.id=='sosum') break;
  sum += parseFloat(inp.value.replace(/,/,".") || 0);
 }
 document.getElementById('sosum').value=String(sum).replace(/\./,",");
}

function openpic(a, w, h) {
 window.open(a.href,'','width='+w+',height='+h+',left='+Math.floor(screen.availWidth/2-w/2)+',top='+Math.floor(screen.availHeight/2-h/2));
 return false;
}





/* init */

function drf() {
 initFlash();
 document.write('<style type="text/css">.flashobject{display:block !important;}</style>');
}

// Flash
// <div class="flashobject"><img src="" width="" height="" /></div>

document.write('<style type="text/css">.flashobject{display:none;}</style>');

flashVersion = 0;
function initFlash() {
 if (navigator.plugins != null && navigator.plugins.length > 0) {
  var flashPlugin = navigator.plugins['Shockwave Flash'];
  if (typeof flashPlugin == 'object') {for (var i = 10; i >= 4; i--) {if (flashPlugin.description.indexOf(i + '.') != -1) { flashVersion = i; break; }}}
 } else if (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4) {
  document.write('<scr' + 'ipt language="VBScript"\>\nOn Error Resume Next \nDim i\nDim obFlash \nFor i = ' + 10 + ' To 4 Step -1 \nSet obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \nIf IsObject(obFlash) Then \nflashVersion = i \nExit For \nEnd If \nNext \n</scr' + 'ipt\> \n');
 }

 if (flashVersion < 5) return;

 var i=0;
 while (objdiv = document.getElementsByTagName("div")[i++]) {
  if (objdiv.className.indexOf("flashobject")==-1) continue;
  objdiv.innerHTML = getFlashHTML(objdiv.innerHTML.match(/ src=["']?([^"' >]+)/i)[1].replace(/(\.jpg)|(\.gif)|(\.png)/,'.swf'),objdiv.innerHTML.match(/ width=["']?([^"' >]+)/i)[1],objdiv.innerHTML.match(/ height=["']?([^"' >]+)/i)[1]);
 }
}

function getFlashHTML(fname, width, height) {
 return "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\""+fname+"\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\""+fname+"\" menu=\"false\" quality=\"high\" scale=\"noscale\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\""+width+"\" height=\""+height+"\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\"></embed></object>";
}

window.onload = function() {
 if (navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
  initFlash();
 }

 initTips();
}







// Tips
document.write("<div id=\"tiplayer\"><div></div></div>");
tiptags = Array("dfn","acronym");
tiptimer = false;


function initTips() {
 for (t=0; t < tiptags.length; t++) {
  for (i=0; i < document.getElementsByTagName(tiptags[t]).length; i++) {
   if (document.getElementsByTagName(tiptags[t])[i].title=="") continue;

   if (document.getElementsByTagName(tiptags[t])[i].parentNode.nodeName.toLowerCase().substr(0,1)=='h' || document.getElementsByTagName(tiptags[t])[i].parentNode.parentNode.nodeName.toLowerCase().substr(0,1)=='h') {
    document.getElementsByTagName(tiptags[t])[i].title = "";
    continue;
   }

   document.getElementsByTagName(tiptags[t])[i].onmouseover = handleTip;
   document.getElementsByTagName(tiptags[t])[i].onmouseout = hideTip;

   document.getElementsByTagName(tiptags[t])[i].boxtitle = document.getElementsByTagName(tiptags[t])[i].title.replace(/ - /g,"<br />");
   document.getElementsByTagName(tiptags[t])[i].title = "";
  }
 }

 tip = document.getElementById("tiplayer");
}

tipobj=-1;
function handleTip(e) {
 if (tiptimer) {window.clearTimeout(tiptimer);tiptimer=false;}
 if (! this.boxtitle || this.boxtitle=="&nbsp;&nbsp;") return;
 
 var owner = this;
 tiptimer = window.setTimeout(function(){
  tip.firstChild.innerHTML = owner.boxtitle;

  getPos(owner);

  tip.style.visibility='hidden';
  tip.style.display='block';
  tip.style.top = absoluteTop - tip.offsetHeight + "px";
  tip.style.left = absoluteLeft + Math.floor(owner.offsetWidth/2)-28 + "px";
  tip.style.visibility='visible';
 },200);
}
function hideTip() {if (tiptimer) {window.clearTimeout(tiptimer);tiptimer=false;} tip.style.display="none";}


function getPos(obj) {
 absoluteTop = obj.offsetTop;
 absoluteLeft = obj.offsetLeft;
 objParent = obj;
 while(objParent = objParent.offsetParent) {
  absoluteTop += objParent.offsetTop;
  absoluteLeft += objParent.offsetLeft;
 }
}


function autoclear()
{
  document.getElementById("searchform").getElementById("1").value = "";
}