
function popup(url,h,w) {
var args = "resizable=yes, screenX=50, screenY=50, left=100, top=100, height="+h+" ,width="+w;
 fenster=window.open(url, "Bild", args);
 fenster.focus();
 return false;
}

function g_popup() {

        if (BrowserDetect.browser == "Explorer")
        {
                y = document.documentElement.scrollTop + 20;
        }
        else
        {
                y = window.pageYOffset + 20;
        }
        gp = document.getElementById("generic-popup").style;
        gp.display = "block";
        gp.top = y + "px";
}

function hoverIE() {
    var obutton = document.getElementsByTagName("input");
            for (i=0;i<obutton.length;i++)
                {
                  if (obutton[i].className == 'button')
                          {
                   obutton[i].onmouseover=highlight_button(obutton[i]); obutton[i].onmouseout=downlight_button(obutton[i]);
                  }
        }
}
var bborderColor;
var bbackgroundColor;
var bcolor;

function highlight_button(t) {
        bborderColor = t.style.borderColor;
        bbackgroundColor = t.style.backgroundColor;
        bcolor = t.style.color;

        t.style.borderColor = "green";
        t.style.backgroundColor = "white";
        t.style.color = "#0f0f0f";
}

function downlight_button(t) {

        t.style.borderColor = bborderColor;
        t.style.backgroundColor = bbackgroundColor;
        t.style.color = bcolor;
}

function checkbutton(id) {
 var t = document.getElementById(id);
Farbe = t.style.backgroundColor;

 if ((Farbe == "") || (Farbe == 'white') || (Farbe == '#707070'))
 {
          t.style.backgroundColor = "silver";
          bbackgroundColor = "silver";
          t.style.color = "white";
          bcolor = "white";
 }
 else
          if (Farbe  == 'silver')
          {
                  t.style.backgroundColor = '';
                  bbackgroundColor ='';
                  t.style.color = "dimgray";
                  bcolor = "dimgray";
          }
}

function news_popup(tt,a,m,d,tx,i,l,lt) {

        if (BrowserDetect.browser == "Explorer")
        {
                y = document.documentElement.scrollTop + 20;
        }
        else
        {
                y = window.pageYOffset + 20;
        }

        ttp = document.getElementById("news-popup-title");
        if (!tt)
        {
         tt = 'Titel';
        }
        ttp.innerHTML = tt;

        ap = document.getElementById("news-popup-author");
        if (!a)
        {
         a = 'Autor';
        }
        if (!m)
        {
         m = 'Mannschaft';
        }
        ap.innerHTML = "von " + a + " fuer " + m;

        dp = document.getElementById("news-popup-date");
        if (!d)
        {
         d = 'Datum';
        }
        dp.innerHTML = d;
/*
        txp = document.getElementById("news-popup-text-image");
        if (!tx)
        {
         tx = 'Text';
        }
        txp.innerHTML = tx;
*/
        ip = document.getElementById("news-popup-image");
        if (!(!ip))
        {
                if (!i)
                {
                         i = 'images/dummybild.gif';
                }
                ip.innerHTML = '<img src="' + i + '">';
        }
        else
        {
                alert('RED ALERT: news-popup-image gibt es nicht');
        }

        lp = document.getElementById("news-popup-link");
                if (!l)
                {
                         l = 'Link';
                }
                else
                {
                         lp.innerHTML = '<a href="http://' + l + '">' + lt + '</a>';
                }

        np = document.getElementById("news-popup");
        np.style.display = "block";
        np.style.top = y + "px";

}

function align_news_height () {
        i = 0;
        var a_div_news = document.getElementsByTagName("div");
        /* alert('Start ' + a_div_news.length); */
        for (i=0;i<a_div_news.length;i++) {
        var a_div_news_side = a_div_news[i].childNodes;
                var found = false;
                for (s=0;s<a_div_news_side.length;s++) {
                        /* alert(a_div_news_side[s].className); */
                        if ((a_div_news_side[s].className == 'news-left') || (a_div_news_side[s].className == 'news-right')) {
                           var a_div_news_center = a_div_news_side[s].childNodes;
                           for (c=0;c<a_div_news_center.length;c++) {
                                      /* alert(a_div_news_center[c].className); */
                                      if (a_div_news_center[c].className == 'news-center') {
                                                var a_div_news_text = a_div_news_center[c].childNodes;
                                                for (t=0;t<a_div_news_text.length;t++) {
                                                          /* alert(a_div_news_text[t].className); */
                                                           if (a_div_news_text[t].className == 'news-text-image') {
                                                                   a_div_news[i].style.height = '176px';
                                                                     alert ('Triumpf');
                                                                   found = true;
                                                            break; /* news-text */
                                                          }
                                                          else {
                                                           a_div_news[i].style.height = '133px';
                                                     }
                                                }
                                      }
                           }
                        }
                if (found) {
                   break;
                   }
                }
        }
}


function pic_in_div ()
{
        pic_style = document.getElementById("news-image").style;
        txt_style = document.getElementById("news-text").style;
        news_style = document.getElementById("news").style;
        /*
        alert('Bild Weite: '+ pic_style.width + ' Bild Hoehe: ' + pic_style.height + 'Text Weite: ' + txt_style.width + ' Text Hoehe: ' + txt_style.height);
        */
        news_style.width = '300px';
   alert('News Weite: '+ news_style.width);
}

function digitalclock()
{

var dc = new Date();
var hours = dc.getHours();
var minutes = dc.getMinutes();
var seconds = dc.getSeconds();
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
var digic = document.getElementById("digiclock");
if (digic)
{
  digic.innerHTML = hours + ":" + minutes + ":" + seconds;
}
setTimeout("digitalclock()",1000)
}

function AuswahlAlle(f,p) {
var i = 0;
var n = '';

 for (i=0;i<document.forms[f].elements.length;i++)
 {
  n = document.forms[f].elements[i].name;
  if (n) {
           if (n.substring(0,p.length) == p) {
                document.forms[f].elements[i].style.backgroundColor = 'silver';
                document.forms[f].elements[i].style.color = 'white';
           }
  }
 }
}
function AuswahlKeine(f,p) {
var i = 0;
var n = '';

 for (i=0;i<document.forms[f].elements.length;i++)
 {
  n = document.forms[f].elements[i].name;
  if (n) {
           if (n.substring(0,p.length) == p)
           {
                document.forms[f].elements[i].style.backgroundColor = '';
                document.forms[f].elements[i].style.color = 'dimgray';
           }
  }
 }
}

function SpielerAuswahl(f,m,j) {
var i = 0;
var k = 0;
var auswahl = new Array();
var tauswahl = new Array();
var jauswahl = new Array();
var n = '';
        for (i=0;i<document.forms[f].elements.length;i++)
         {
                   n = document.forms[f].elements[i].name;
                  if (n)
        {
                      if (n.substring(0,m.length) == m)
                      {
                               if (document.forms[f].elements[i].style.backgroundColor == 'silver') {
                                       var el = document.forms[f].elements[i].name;
                                       el = el.slice(m.length);
                               var ne = mauswahl.push(el);
                               }
                   }
                      if (n.substring(0,j.length) == j)
                      {
                               if ((document.forms[f].elements[i].style.backgroundColor == 'silver') || (document.forms[f].elements[i].style.backgroundColor == 'whitesmoke')) {
                                       var el = document.forms[f].elements[i].name;
                                       el = el.slice(j.length);
                               var ne = jauswahl.push(el);
                               }
                   }
         }
         }
   auswahl[0] = tauswahl;
   auswahl[1] = jauswahl;
   return(auswahl);
}


function Auswahl(f,m) {
var i = 0;
var k = 0;
var mauswahl = new Array();
var n = '';
        for (i=0;i<document.forms[f].elements.length;i++)
         {
                   n = document.forms[f].elements[i].name;
                  if (n)
        {
                      if (n.substring(0,m.length) == m)
                      {
                               if (document.forms[f].elements[i].style.backgroundColor == 'silver')
                         {
                                       var el = document.forms[f].elements[i].name;
                                       el = el.slice(m.length);
                               var ne = mauswahl.push(el);
                               }
                   }
                 }
      }
 return(mauswahl);
}

function SpielAuswahl() {
var i = 0;
var k = 0;
var mauswahl = new Array();
if (document.spielauswahl.heim.style.backgroundColor == 'silver')
{
  mauswahl[0] = 'heim';
}
if (document.spielauswahl.auswaerts.style.backgroundColor == 'silver')
{
  mauswahl[1] = 'auswaerts';
}
if (document.spielauswahl.am.style.backgroundColor == 'silver')
{
  mauswahl[2] = 'am';
  mauswahl[3] = document.getElementById('am').value;
  //mauswahl[3] = document.spielauswahl.spiele_auswahl_am.options[document.spielauswahl.spiele_auswahl_am.selectedIndex].text;
}
if (document.spielauswahl.ab.style.backgroundColor == 'silver')
{
  mauswahl[4] = 'ab';
  mauswahl[5] = document.spielauswahl.spiele_auswahl_ab.options[document.spielauswahl.spiele_auswahl_ab.selectedIndex].text;
}
if (document.spielauswahl.saison.style.backgroundColor == 'silver')
{
  mauswahl[6] = 'saison';
  mauswahl[7] = document.spielauswahl.spiele_auswahl_saison.options[document.spielauswahl.spiele_auswahl_saison.selectedIndex].text;
}
if (document.spielauswahl.gegner.style.backgroundColor == 'silver')
{
  mauswahl[8] = 'gegner';
  mauswahl[9] = document.spielauswahl.spiele_auswahl_gegner.options[document.spielauswahl.spiele_auswahl_gegner.selectedIndex].text;
}

if (document.spielauswahl.fahrer.style.backgroundColor == 'silver')
{
  mauswahl[10] = 'fahrer';
}

 return(mauswahl);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


loading=function()
{
   xajax.$('xajaxloading').style.display='block';
   };


doneLoading=function()
{
   xajax.$('xajaxloading').style.display='none';

   };

function resetcursor()
{
 alert("Cursor: "+document.body.style.cursor);
 document.body.style.cursor = 'default';
}

function getWindowHeight() {
var windowHeight=0;
if (typeof(window.innerHeight)=='number') {
windowHeight=window.innerHeight;
}
else {
if (document.documentElement&&
document.documentElement.clientHeight) {
windowHeight=
document.documentElement.clientHeight;
}
else {
if (document.body&&document.body.clientHeight) {
windowHeight=document.body.clientHeight;
}
}
}
return windowHeight;
}

function setFooter() {
if (document.getElementById) {
var windowHeight=getWindowHeight();
//alert('WindowHeight '+windowHeight);
if (windowHeight>0) {
var contentHeight=
document.getElementById('center').offsetHeight;
//alert('contentHeight '+contentHeight);
var footerElement=
document.getElementById('footer');
var footerHeight=footerElement.offsetHeight;
//alert('footerHeight '+footerHeight);
if (windowHeight-(contentHeight+footerHeight)>=0) {
footerElement.style.position='absolute';
footerElement.style.top=(windowHeight-footerHeight)+'px';
//alert('footerTop '+footerElement.style.top);
}
else {
footerElement.style.position='absolute';
footerElement.style.top=(contentHeight)+'px';
}
}
}
}

function init_spspopup()
{
gp = document.getElementById("sps-name");
gp.onmousedown=movestart;
gp.onmouseup=movestop;
}


function s_spspopup(x,y,w,h,innerhtml)
{
popdown('spspopup');
lp = document.getElementById("lb");
lp.style.width = '100%';
 PageSize = getPageSize();
lp.style.height = PageSize[1] + 'px';

gp = document.getElementById("sps-name");
gp.onmousedown=movestart;
gp.onmouseup=movestop;

 if (window.pageYOffset)
 {
    b = window.pageYOffset;
 }
 else
 {
    b = document.documentElement.scrollTop;
 }

spspopup();

t = b + parseInt(y);
//alert('set_spspopup: x: '+x+' b: '+b+' y: '+y);
sp = document.getElementById("sps-popup");
//sp.style.display = "block";
sp.style.top = t + "px";
sp.style.left = x + "px";
sp.innerHTML = innerhtml;

gp = document.getElementById("sps-seite");

if (h != 0) gp.style.height = h + "px";

if (w != 0)
{
 i = w - 30;
 sp.style.width = w + "px";
 gp.style.width = i + "px";

 np = document.getElementById("sps-name");
 if (np) np.style.width = i + "px";
 nnp = document.getElementById("sps-nachname");
 if (nnp) nnp.style.width = i + "px";
 tp = document.getElementById("sps-title");
 if (tp) tp.style.width = w + "px";
 hp = document.getElementById("sps-headline");
 if (hp) hp.style.width = i + "px";
 cp = document.getElementById("sps-content");
 if (cp) cp.style.width = i + "px";
 aep = document.getElementById("sps-aebuttons");
 if (aep) aep.style.width = i + "px";
}

 opacity('lb',0,80,500);

}

function chg_spspopup(innerHTML)
{

sp = $("sps-popup");
sp.setStyle({display: "block"});
sp.innerHTML = innerHTML;

if (window.pageYOffset)
 {
    b = window.pageYOffset;
 }
else
 {
    b = document.documentElement.scrollTop;
 }

t = b + parseInt(sp.style.top);
sp.style.top = t + "px";

mw = $("sps-name");
if (mw)
{
 mw.onmousedown=movestart;
 mw.onmouseup=movestop;
}
else
{
 //alert("sps-name nicht gefunden");
}
w = parseInt(sp.style.width);
ssp = $("sps-seite");

 i = w - 30;
 iw = i + 'px';
 wk = w - 8;

if (w != 0)
{
// gp.style.display = 'none';
 i = w - 30;
 ssp.style.width = wk + "px";
// alert(" sps-seite width neu wk "+wk);
 np = $("sps-name");
 if (np) np.style.width = wk + "px";
 ap = $("sps-aendern");
 if (ap) ap.style.width = wk + "px";
// alert(" sps-name width neu wk "+wk);
 tp = $("sps-title");
 if (tp) tp.style.width = w + "px";
 hp = $("sps-headline");
 if (hp) hp.style.width = i + "px";
 cp = $("sps-content");
 if (cp) cp.style.width = i + "px";
 aep = $("sps-aebuttons");
 if (aep) aep.style.width = wk + "px";

 it = $$(".sps-intext");
 it.each(function(it_e)
          {
                  it_e_left = it_e.style.left;
                  it_e_width = i - 300;
                  it_e_w = it_e_width + 'px';
                  it_e.setStyle({width:it_e_w});
          });
}

new Effect.Appear(gp,{duration: 2});

}

sps_stack = new Array();

function spsdown()
{
  new Effect.Opacity($('sps-popup'),{from:1.0,to:0.0,duration:0.5});
}

function set_spspopup(x,y,w,h,sps)
{
 /*
 sps_innerHTML = $('sps-popup').innerHTML;
 dummy = sps_stack.push(sps_innerHTML);
*/

$('sps-popup').style.display = 'none';

$('sps-popup').innerHTML = sps;

lp = $("lb");
//lp.style.width = '100%';
 PageSize = getPageSize();
lp.style.height = PageSize[1] + 'px';

gp = $("sps-name");
gp.onmousedown=movestart;
gp.onmouseup=movestop;


 if (window.pageYOffset)
 {
    b = window.pageYOffset;
 }
 else
 {
    b = document.documentElement.scrollTop;
 }

t = b + parseInt(y);
sp = $("sps-popup");
sp.style.top = t + "px";
sp.style.left = x + "px";
/*
pd = $("pc");
alert("popclose top "+pd.style.top+" popclose left "+pd.style.left+" popclose right "+pd.style.right);
*/
spspopup();

/*
gp = $("sps-seite");

//if (h != 0) gp.style.height = h + "px"; */
hs = h + 'px';
if (h != 0) $("sps-seite").setStyle({height:hs});

if (w != 0)
{
 i = w - 30;
 wk = w - 2;
 sp.style.width = w + "px";
 np = document.getElementById("sps-name");
 if (np) np.style.width = wk + "px";
 nnp = document.getElementById("sps-nachname");
 if (nnp) nnp.style.width = i + "px";
 tp = document.getElementById("sps-title");
 if (tp) tp.style.width = wk + "px";
 hp = document.getElementById("sps-headline");
 if (hp) hp.style.width = i + "px";
 cp = document.getElementById("sps-content");
 if (cp) cp.style.width = i + "px";
 mp = document.getElementById("maparea");
 if (mp) mp.style.width = 500 + "px";
 if (mp) mp.style.height = 400 + "px";

/*
 aep = document.getElementById("sps-aebuttons");
 if (aep) aep.style.width = i + "px"; */
}
 opacity('lb',0,70,500);
}


function spspopup()
{
        gp = document.getElementById('footer');
        if (gp)
        {
          gp.style.display = 'none';
        }
        gp = document.getElementById('spiele-auswahl-am');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('spiele-auswahl-ab');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('spiele-auswahl-saison');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('spiele-auswahl-gegner');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('chart');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('ss1');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
        gp = document.getElementById('ss2');
        if (gp)
        {
          gp.style.visibility = 'hidden';
        }
}


function popdown(p) {

if (p == 'sps-popup')
{
   sps_stack.pop();
   if (sps_stack.length > 0)
   {
            sps_innerHTML = sps_stack.slice(sps_stack.length-1);
            $('sps-popup').innerHTML = sps_innerHTML;
   }
   else
   {
            gp = document.getElementById(p);
         if (gp)
         {
           new Effect.Fold(p,{afterFinish:lbOpacityDown});
         }
   }
}
/*
        gp = document.getElementById(p);
        if (gp)
        {
          new Effect.Fold(p,{afterFinish:lbOpacityDown});
        }
*/
        mp = $('maparea');
        if (mp)
        {
          mp.style.display = "none";
        }

        gp = document.getElementById('footer');
        if (gp)
        {
          gp.style.display = 'block';
        }
        gp = document.getElementById('spiele-auswahl-am');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('spiele-auswahl-ab');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('spiele-auswahl-saison');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('spiele-auswahl-gegner');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('chart');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('ss1');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }
        gp = document.getElementById('ss2');
        if (gp)
        {
          gp.style.visibility = 'visible';
        }

}

function lbOpacityDown()
{
  opacity('lb',70,0,1000);
}
function lbOpacityUp()
{
  opacity('mb',0,70,1000);
}


function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame

    var speed = Math.round(millisec / 100);

    var timer = 1;
    //alert('Opacity ... ' + id + ' Start ... ' + opacStart + ' End ... ' + opacEnd);
    //determine the direction for the blending, if start and end are the same nothing happens

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
        setTimeout("setDisplay(" + "'none'" + ",'" + id + "')",(timer * speed));
        timer++;
        setTimeout("killPopup(" + "'" + id + "')",(timer * speed));
    } else if(opacStart < opacEnd) {
                setTimeout("setDisplay(" + "'block'" + ",'" + id + "')",(timer * speed));
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
         // new Effect.Grow('sps-popup');

                setTimeout("Effect.Grow" + "('sps-popup')",(timer * speed));

    }
}

function movestart(e)
{
if (window.event)
{
   startX = parseInt(window.event.screenX);
   startY = parseInt(window.event.screenY);
}
else
{
  startX = parseInt(e.screenX);
  startY = parseInt(e.screenY);
}
if (document.getElementById("sps-popup"))
{
  XpositionAlt=parseInt(document.getElementById("sps-popup").style.left);
  if (!XpositionAlt)
  {
    XpositionAlt = 0;
  }
  YpositionAlt=parseInt(document.getElementById("sps-popup").style.top);
  if (!YpositionAlt)
  {
    YpositionAlt = 0;
  }
  window.status = 'movestart';
  document.onmousemove=move;
}
else
{
  alert('sps-popup existiert nicht');
}
window.status = 'movestart: Alt_X: '+XpositionAlt+', Alt_Y: '+YpositionAlt+', startX: '+startX+', startY: '+startY;
return false;
}

function move(e)
{
if (!e)
{
 e = window.event;
}
mX = parseInt(e.screenX);
mY = parseInt(e.screenY);

Xwert=mX-startX;
Ywert=mY-startY;

window.status="move mX: "+Xwert+" mY: "+Ywert;
if (document.getElementById("sps-popup"))
{
  document.getElementById("sps-popup").style.left=XpositionAlt+Xwert+'px';
  document.getElementById("sps-popup").style.top=YpositionAlt+Ywert+'px';
}
else
{
  alert('move: sps-popup existiert nicht');
}
return false;
}

function movestop(e)
{
document.onmousemove='';
window.status = 'movestop';
}

function start_simullink(e)
{
  if (e)
  {
    sl_bordercolor = e.style.borderColor;
    e.style.borderColor = "green";

    sl_bg               = e.style.backgroundImage;
    e.style.backgroundImage = "url(css/background_green_2.gif)";

    sl_color            = e.style.color;
    e.style.color       = 'white';

    document.getElementsByTagName('body')[0].style.cursor='pointer';
  }
}

function stop_simullink(e)
{
  if (e)
  {
    e.style.color = sl_color;
    e.style.backgroundImage = sl_bg;
    e.style.borderColor = sl_bordercolor;
    document.getElementsByTagName('body')[0].style.cursor='auto';
  }
}

om_class = new Array();

function om_over(e)
{
  if (e)
  {
    om_class[e] = $(e).className;
    if ($(e).className != 'buttonhover') $(e).className = $(e).className.replace("button","buttonhover");
    document.getElementsByTagName('body')[0].style.cursor='pointer';
  }
}

function om_out(e)
{
  if (e)
  {
     $(e).className = om_class[e];
     document.getElementsByTagName('body')[0].style.cursor='auto';
  }
}


function setColor () {
var X = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
var x1 = 0, x2 = 0;
  document.bgColor = "#" + X[x1] + X[x2] + X[x1] + X[x2] + X[x1] + X[x2];
  x2 = x2 + 1;
  if (x2 % 16 == 0) {
    x2 = 0;
    x1 = x1 + 1;
  }
}
function einblenden()
{
for (var i = 0; i < 255; ++i) {
  window.setTimeout("setColor()", 20);
}
}

function minithumbs(anfang,ende,laenge,direction)
{
  i_firstthumb = anfang; i_lastthumb = ende+1;
  p = new Array();
  ff = false; fl = false;
  for (i=anfang;i<=ende;i++)
  {
    id = "minithumb_"+i;
    p[i] = document.getElementById(id);
    if (!ff && (p[i].className == 'show-minithumb'))
    {
      ff = true;
      i_firstthumb = i;
    }
        if (!fl && ff && (p[i].className == 'hide-minithumb'))
        {
          i_lastthumb = i;
          fl = true;
        }
  }
  //alert('i_firstthumb: '+i_firstthumb+' i_lastthumb: '+i_lastthumb);
  if (direction == -1)
  {
    if (i_firstthumb <= (ende-laenge)) p[i_firstthumb].className = 'hide-minithumb';
    if (i_lastthumb <= ende) p[i_lastthumb].className = 'show-minithumb';
        //alert('direction: rechts, i_firstthumb: '+i_firstthumb+' i_lastthumb: '+i_lastthumb);
  }
  else
  {
    if (i_firstthumb > 0) p[i_firstthumb-1].className = 'show-minithumb';
        if (i_lastthumb > (anfang+laenge)) p[i_lastthumb-1].className = 'hide-minithumb';
        //alert('direction: links, i_firstthumb: '+i_firstthumb+' i_lastthumb: '+i_lastthumb);
  }
}
minithumbsaktiv = 0;
function start_minithumbs(anfang,ende,laenge,direction)
{
  if (!minithumbsaktiv)
  {
    minithumbsaktiv = window.setInterval("minithumbs("+anfang+","+ende+","+laenge+","+direction+")",500);
  }
}

function stop_minithumbs()
{
 window.clearInterval(minithumbsaktiv);
 minithumbsaktiv = false;
}

function bild_popdown()
{
  document.getElementById("bild-popup").style.display = "none";
}

function visible(objId) {
  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (obj)
    {
    obj.style.visibility = 'visible';
    }
 }
}

slideshowaktiv = false;
slideshowrunning = false;
id_index = 0;
id_index_last = 0;
aElementIDs = new Array();
direction = 'forward';
thema = '';
duration = 4;

function bildpopup(t)
{
 if (BrowserDetect.browser == "Explorer")
{
   y = document.documentElement.scrollTop;
}
else
{
   y = window.pageYOffset;
}
gp = document.getElementById("bild-popup");
gp.style.top = t + "px";
gp.style.left = 320 + "px";
document.getElementById("footer").style.display = "none";

}

function slideshow()
{
  if (slideshowaktiv)
  {
        diaID = 'minithumb_'+aElementIDs[id_index];
        dia = document.getElementById(diaID);
        dia.style.border = '2px solid green';
        //bildpopup(dia.style.top);
        fShowBild(aElementIDs[id_index]);

        if (direction == 'forward')
        {
          id_index_last = id_index - 1;
          id_index = (id_index + 1)*1;
        }
        else
        {
          id_index_last = id_index + 1;
          id_index = (id_index-1)*1;
        }

    if (id_index >= aElementIDs.length)
    {
          id_index = 0;
        }
        if (id_index < 0)
        {
          id_index = aElementIDs.length-1;
        }

    if (id_index_last >= aElementIDs.length)
    {
          id_index_last = 0;
        }
        if (id_index_last < 0)
        {
          id_index_last = aElementIDs.length-1;
        }
        diaID = 'minithumb_'+aElementIDs[id_index_last];
        dia = document.getElementById(diaID);
        dia.style.border = '1px solid white';
    slider = window.setTimeout(function() {slideshow(aElementIDs,id_index);},duration*1000);
  }
}
function activate_slideshow(aEleIDs,id_idx,drct,th,d)
{
 if (!slideshowaktiv)
 {
   thema = th;
   aElementIDs = aEleIDs;
   id_index = id_idx;
   direction = drct;
   slideshowaktiv = true;
   duration=d;
   slideshow();
 }
}

function forward_slideshow()
{
 direction = 'forward';
}

function backward_slideshow()
{
 direction = 'backward';
}

function stop_slideshow(id)
{
  if (id)
  {
        for (i=0;i<aElementIDs.length;i++)
        {
           if (aElementIDs[i] == id)
           {
                    if (slideshowaktiv)
                    {
                      if (direction == 'forward')
                      {
                        j = id_index - 1;
                      }
                   else
                   {
                     j = id_index + 1;
                   }
             }
                 else
                 {
                   j = id_index;
                 }
                    diaID = 'minithumb_'+aElementIDs[j];
             dia = document.getElementById(diaID);
                 dia.style.border = '1px solid white';
                    id_index = i;
                    break;
           }
        }
    diaID = 'minithumb_'+id;
    dia = document.getElementById(diaID);
    dia.style.border = '2px solid green';
  }
  slideshowaktiv = false;
  sss = document.getElementById('startstopslide');
  sss.innerHTML = '<img class=\"controls\" src=\"images/24-arrow-next.png\" ></div>';
  sss.onclick = function () {start_slideshow();};
  sss.onmouseover = function () {start_simullink(sss);};
  sss.onmouseout = function () {stop_simullink(sss);};
}

function start_slideshow()
{
  sss = document.getElementById('startstopslide');
  sss.innerHTML = '<img class=\"controls\" src=\"images/24-control-pause.png\" ></div>';
  sss.onclick = function() {stop_slideshow();};
  sss.onmouseover = function () {start_simullink(sss);};
  sss.onmouseout = function () {stop_simullink(sss);};
  slideshowaktiv = true;
  slideshow();
}

function deactivate_slideshow()
{
 window.clearTimeout(slider);
 slideshowaktiv = false;
 slideshowrunning = false;
}

function refresh_ShowBilder()
{
  xajax_processShowBilder(thema);
}

aMassPics = new Array();
function prepare_masspics(aMP)
{
   aMassPics = aMP;
}
function masspics()
{
  for (i=0;i<aMassPics.length;i++)
  {
   fill = (i+1)/aMassPics.length*100;
   xajax_processMassPicsDB(aMassPics[i],fill);
  }
}

function page_refresh()
{
  window.location.reload();
}

function index_refresh()
{
  top.location.href="index.php";
}

function drucke_spspopup()
{
  document.getElementById("spsprint").href = "css/spsprint.css";
  window.print();
  document.getElementById("spsprint").href = "css/basicprint.css";
}


function drucke()
{
           var i = 0;
        var e_inputs = document.getElementsByTagName("input");
        /* alert('Start ' + a_div_news.length); */
        if (e_inputs)
        {
        for (i=0;i<e_inputs.length;i++)
        {
          if (e_inputs[i].getAttribute('value') == 'Drucken')
          {
            e_inputs[i].style.visibility = 'hidden';
                window.print();
        e_inputs[i].style.visibility = 'visible';
          }
        }
    }

}

id = '';
keep_running = false;
function keepalive_init(keep_id)
{
   if (id != keep_id)  //alert('keepalive_init: '+keep_id);
   {
            if (keep_running)
            {
              window.clearTimeout(ka);
            }
            keep_running = true;
            keepalive(keep_id);
            id = keep_id;
   }
}

function keepalive(id)
{
  ck = getCookie('ebe-hb-cookie');
  xajax_processKeepAlive(id,ck);
  //alert('keepalive: '+id);
  ka = window.setTimeout(function() {keepalive(id);},120000);
}

function gotoURL(url)
{
  window.location.href=url;
}

function setCookie (name,value,expires,path,domain,secure) {

  if (expires)
  {
    exp = new Date();
    y = exp.getFullYear();
    exp.setYear(y+1);
  }
//alert('cookie '+name+' '+ escape (value));
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + exp.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
     c_start=c_start + c_name.length+1;
     c_end=document.cookie.indexOf(";",c_start);
     if (c_end==-1) c_end=document.cookie.length;
     return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return ""
}

function deleteCookie (name,path,domain) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
      alert('cookie loeschen '+name);
}

function title(t)
{
  document.title = t;
}

function commercials()
{
        fShowBild();
    comm = window.setTimeout(function() {commercials();},duration*1000);
}

function tiny()
{
  alert('tiny');
  tinyMCE.init ({mode : "textareas",theme : "simple"});
}

function replaceIt(string,suchen,ersetzen) {
ausgabe = "" + string;
while (ausgabe.indexOf(suchen)>-1) {
pos= ausgabe.indexOf(suchen);
ausgabe = "" + (ausgabe.substring(0, pos) + ersetzen +
ausgabe.substring((pos + suchen.length), ausgabe.length));
}
return ausgabe;
}

var slider_slidercolor;
var slider_backgroundcolor;
var slider_max;

function slider_hl(s,a,m,slidercolor,backgroundcolor)
{
 for (i=0;i<=a;i++)
 {
  tt = s + '_' + i;
  t = document.getElementById(tt);
  if (t)
  {
    t.style.backgroundColor = slidercolor;
    t.style.cursor = "pointer";
  }
 }
 for (i=a+1;i<=m;i++)
 {
  tt = s + '_' + i;
  t = document.getElementById(tt);
  if (t)
  {
    t.style.backgroundColor = backgroundcolor;
    t.style.cursor = "pointer";
  }
 }
 ttxt = s + "_text";
 txt = document.getElementById(ttxt);
 txt.innerHTML = a+1;
}

function slider_dl(s,a,m,slidercolor,backgroundcolor)
{

  if (a==0)
  {
    tt = s + '_' + a;
    t = document.getElementById(tt);
    t.style.backgroundColor = backgroundcolor;
    t.style.cursor = "auto";
    ttxt = s + "_text";
    txt = document.getElementById(ttxt);
    txt.innerHTML = 0;
  }
}



/* 'Wechsle Darstellung 051006' (c) by cybaer@binon.net
   ----------------------------
 Inhalt    : HTML-Elemente anzeigen oder verstecken (mit oder ohne Platzhalter, bzw. transparent)
 Aufruf    : toggle(type,element,toggleID[,xID[,xID[,...[,xSwitch]]]])
 Parameter : type (Aktionstyp: 1. fold (voreingestellt)/unfold: Ohne Platzhalter verstecken/zeigen
                                  (optional kann die Darstellungsart angehaengt werden, z.B. unfold:block)
                               2. hide/unhide: Mit Platzhalter verstecken/zeigen
                               3. trans: Transparenz wechseln (optional kann der gewuenschte Grad
                                  der Transparenz, sowie die Komplementaertransparenz angehaengt
                                  werden, z.B. trans:50/0 - diese Werte sind voreingestellt)
                               4. color: Vordergrund-Farbe wechseln (optional kann die gewuenschte
                                  Farbe, sowie die Farbe für die Komplementaerfunktion angehaengt
                                  werden, z.B. color:#000000/#FFFFFF - diese Werte sind voreingestellt)
                               5. back: Hintergrund-Farbe wechseln (optional kann die gewuenschte
                                  Farbe, sowie die Farbe für die Komplementaerfunktion angehaengt
                                  werden, z.B. back:#FFFFFF/#000000 - diese Werte sind voreingestellt)
                               6. border: Hintergrund-Farbe wechseln (optional kann die gewuenschte
                                  Farbe, sowie die Farbe für die Komplementaerfunktion angehaengt
                                  werden, z.B. border:transparent/black - diese Werte sind voreingestellt)
                               7. test: Ueberpruefung der Browserfaehigkeit
                   auch kombinierbar: z.B. "unfold hide" oder "unfold:block hide")
             element (1. ID des Elements, das bearbeitet werden soll, oder
                      2. Tagname der Elemente, die bearbeitet werden sollen (optional kann,
                         nach einem Doppelpunkt, ein Attributname uebergeben werden, sowie,
                         innerhalb geschweifter Klammern, ein Gueltigkeitsbereich), oder
                      3. leer (entspricht type="test"))
             toggleID (nur wenn element ein Tagname: einheitlicher Beginn (Basiskennung)
                       des Toggle-Attributs der gewuenschten Elemente)
             xID (optional: nur wenn element ein Tagname: (Rest-)Kennung(en) von Elementen,
                  die nicht erfasst werden sollen (Ausnahmen))
             xSwitch (optional: nur wenn element ein Tagname: Wenn true, dann wird bei den
                      mit xID definierten Ausnahmen die Komplementaerfunktion getogglet)
 Sprache   : JavaScript 1.1 (ungesichert), JavaScript 1.5 (gesichert)
 Quelle    : http://Coding.binon.net/Toggle (cybaer@binon.net)
             Die kostenlose Nutzung der Quelltexte in eigenen Projekten ist
             bei nicht-kommerziellen Projekten (und deren unentgeltlicher
             Herstellung) bei Nennung der Quelle ausdruecklich gestattet.
 InlineFunc: -
 Konstante : -
 Variable  : -
 SystemVar : -
 ExternVar : -
 Rueckgabe : Anzahl der bearbeiteten Elemente (auch 0), bzw. false, wenn der Einsatz technisch
             nicht moeglich ist und true, wenn er moeglich ist (Rueckgabewert des Testmodus).
 Anmerkung : 1. Auswahl per ID: Es wird exakt das Element mit der passenden ID behandelt. Wird
                kein passendes Element gefunden, wird der Parameter als Tagname interpretiert.
             2. Auswahl per Tagname: Jedes zu behandelnde Element muss das HTML-Attribut gid=""
                besitzen (wird in der Variablen toggleAttribute definiert - alternativ kann
                man ein eigenes Attribut in element uebergeben: "tr:id" fuer <tr id="">), mit
                einer einheitlichen Basiskennung am Anfang des Attributinhalts, gefolgt von
                einer beliebigen Restkennung. Wird bei z.B. toggle("fold",...) ein Element
                gefunden dessen Toggle-Attribut mit dieser Basiskennung beginnt, so wird dieses
                Element gefaltet. Wird ein passendes Element gefunden dessen (Rest-)Kennung
                aber als Ausnahme uebergeben wurde, so wird es nicht bearbeitet (xSwitch
                ist false oder leer), bzw. es wird explizit entfaltet (xSwitch ist true).
 Beispiele : HTML  : <tr id="TypA"><td>Zeile 1</td></tr>
                     <tr id="TypB"><td>Zeile 2</td></tr>
                     <tr id="TypC"><td>Zeile 3</td></tr>
             Script: toggle("fold","TypB")
             -> Zeile 2 wird ohne Platzhalter versteckt
             HTML  : <tr gid="TypA"><td>Zeile 1</td></tr>
                     <tr gid="TypB"><td>Zeile 2</td></tr>
                     <tr gid="TypB"><td>Zeile 3</td></tr>
                     <tr gid="TypC"><td>Zeile 4</td></tr>
                     <tr gid="TypD"><td>Zeile 5</td></tr>
             Script: toggle("fold","tr{0-4}","Typ")
             -> Alle Zeilen werden ohne Platzhalter versteckt (durchsucht werden nur die TRs Nr. 0-4)
             Script: toggle("fold","tr","Typ","A","D")
             -> Zeilen 2-4 werden ohne Platzhalter versteckt, Zeilen 1 & 5 werden nicht bearbeitet
             Script: toggle("fold","tr","Typ","A|D",true)
             -> Zeilen 2-4 werden ohne Platzhalter versteckt, Zeilen 1 & 5 werden angezeigt
             Script: toggle("hide","tr","Typ","B")
             -> Alle Zeilen werden mit Platzhalter versteckt, bis auf die Zeilen 2 & 3
             Script: toggle("unfold unhide","tr","Typ","C")
             -> Alle Zeilen werden angezeigt (egal ob vorher versteckt oder gefaltet), bis auf Zeile 4
*/

function ft_einaus()
{
  ft = document.getElementById("ft_einaus");
  if (ft)
  {
    if (ft.style.backgroundColor == "silver")
    {
      toggle('back:white','ft_einaus');
    }
    else
    {
      toggle('back:silver','ft_einaus');
    }
  }
}

function diashow(id)
{
  ds = window.setTimeout(function() {opacity(id,100,0,1000);},3000);
}


function set_opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);

    var timer = 0;
    //alert('Opacity ... ' + id + ' Start ... ' + opacStart + ' End ... ' + opacEnd);
    //determine the direction for the blending, if start and end are the same nothing happens

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
 if (id)
 {
    var o = document.getElementById(id);
    if (o)
    {
          object = o.style;
      object.filter = "Alpha(opacity=" + opacity + ")";

      object.opacity = (opacity / 100);
      object.MozOpacity = (opacity / 100);
      object.KhtmlOpacity = (opacity / 100);

        }
 }
}
function setDisplay(d,id)
{
  if (id)
  {
    var gp = document.getElementById(id);
    if (gp)
    {
      gp.style.display = d;
    }
  }
}

function killPopup(id)
{
  if (id)
  {
    var gp = document.getElementById(id);
    if (gp)
    {
      gp.innerHTML = '';
    }
  }
}


function adjust_height()
{
  ml = document.getElementById("menu-left");
  cs = document.getElementById("contents");

  if (ml)
  {
    if (cs)
    {
      ml_h = ml.scrollHeight;
          cs_h = cs.scrollHeight;
          alert("menu_left " + ml_h + "contents " +  cs_h + " ");
          if (ml_h > cs_h)
          {
            cs.scrollHeight = ml_h;
          }
          else
          {
            ml.scrollHeight = cs_h;
          }
    }
  }
}

function CheckDate(ChkDate)
{
   var Year=parseInt(ChkDate.substring(6,10), 10);
   var Month=parseInt(ChkDate.substring(3,5), 10);
   var Day=parseInt(ChkDate.substring(0,2), 10);

   if ((ChkDate.charAt(2)==".") && (ChkDate.charAt(5)=="."))
   {
       if ((Day<=31) && (Day>=1) && (Month>=1) && (Month<=12))
       {
         if((Month==1) || (Month==3) || (Month==5) || (Month==7) || (Month==8) || (Month==10) || (Month==12))
                 {
                   return true;
                 }
         else
         {
            if ((Day<=30) && (Day>=1))
            {
                if((Month==4) || (Month==6) || (Month==9) || (Month==11))
                                {
                                  return true;
                                }
               else
               {
                  if ((Day<=28) && (Day>=1))
                                  {
                                          return true;
                                  }
                  else
                  {
                      if(Day==29)
                      {
                           if ((Year%4)==0)
                           {
                               if ((Year%100)!=0)
                                                           {
                                                                     return true;
                                                           }
                               else
                               {
                                     if ((Year%400)==0)
                                                                         {
                                                                           return true;
                                                             }
                                     else
                                                                         {
                                                                           return false;
                                                                         }
                               }
                           }
                          else
                                                  {
                                                          return false;
                                                  }
                      }
                      else
                                          {
                                                  return false;
                                          }
                  }
            }
         }
        else
                {
                  return false;
                }
       }
    }
    else
        {
          return false;
        }
  }
  else
  {
          return false;
  }
}

function CheckTime(t)
{
   var Stunden=parseInt(t.substr(0,2),10);
   var Minuten=parseInt(t.substr(3,2),10);

   if (t.charAt(2)== ":")
   {
            if ((Stunden >= 0) && (Stunden <= 23))
            {
               if ((Minuten >= 0) && (Minuten <= 59))
               {
                 return true;
               }
            }
     else
         {
           return false;
         }
   }
   else
   {
            return false;
   }
}


function formattest()
{
  errortext = '';
  datumvon = document.effortsneu.datumvon.value;
  if (CheckDate(datumvon) == true)
  {
    error = false;
  }
  else
  {
    error = true;
    errortext = 'Datumformat ... von ... falsch\n';
  }

  datumbis = document.effortsneu.datumbis.value;
  if (CheckDate(datumbis) == true)
  {
    error = false;
  }
  else
  {
    error = true;
    errortext += 'Datumformat ... bis ... falsch\n';
  }
  von = document.effortsneu.von.value;
  if (CheckTime(von) == true)
  {
    error = false;
  }
  else
  {
    error = true;
    errortext += 'Uhrzeitformat ... von ... falsch\n';
  }
  bis = document.effortsneu.bis.value;
  if (CheckTime(bis) == true)
  {
    error = false;
  }
  else
  {
    error = true;
    errortext += 'Uhrzeitformat ... bis ... falsch\n';
  }

if (error == false)
{

  anlass = document.effortsneu.anlass.value;
  m_index = document.effortsneu.mannschaft.selectedIndex;
  mannschaft = document.effortsneu.mannschaft.options[m_index].value;
  st = document.effortsneu.st.value;
  km = document.effortsneu.km.value;
  popdown('sps-popup');
  xajax_processEffortsNeuDB(mannschaft,anlass,datumvon,datumbis,von,bis,st,km);
}
else
{
  alert(errortext);
}
}

  function print_sps_popup(){
    var printContent = document.getElementById("sps-popup");
    sp = $("sps-popup");
    w = parseInt(sp.style.width);
    var head = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">' +
                           '<html>' +
               '<link rel="stylesheet" type="text/css" href="css/sps-popup.css"></link>' +
               '<link rel="stylesheet" type="text/css" href="css/basicprint.css"></link>' +
                     '<link rel="stylesheet" type="text/css" href="css/news.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/forms.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/teams.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/tz.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/spieler.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/hilfe-popup.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/calendar.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/spiele.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/functions.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/tabellen.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/bilder.css"></link>' +
                           '<link rel="stylesheet" type="text/css" href="css/sps-popup.css"></link>' +
               '<!--' +
               '   HTML 3.2' +
               '     Document type as defined on http://www.w3.org/TR/REC-html32' +
               ' -->' +
               '<head>' +
               '</head>' +
               '<body>';
    var foot = '</body></html>';
    options = 'left=0,top=0,height=0,toolbar=0,scrollbars=0,status=0,width='+w;
    var windowPrint = window.open('spsprint.html','',options);
    windowPrint.document.write(head+printContent.innerHTML+foot);
    windowPrint.document.close();
    windowPrint.focus();
    windowPrint.print();
    windowPrint.close();
  }

function getPageSize() {

             var xScroll, yScroll;

                if (window.innerHeight && window.scrollMaxY) {
                        xScroll = window.innerWidth + window.scrollMaxX;
                        yScroll = window.innerHeight + window.scrollMaxY;
                } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                        xScroll = document.body.scrollWidth;
                        yScroll = document.body.scrollHeight;
                } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                        xScroll = document.body.offsetWidth;
                        yScroll = document.body.offsetHeight;
                }

                var windowWidth, windowHeight;

                if (self.innerHeight) {        // all except Explorer
                        if(document.documentElement.clientWidth){
                                windowWidth = document.documentElement.clientWidth;
                        } else {
                                windowWidth = self.innerWidth;
                        }
                        windowHeight = self.innerHeight;
                } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                        windowWidth = document.documentElement.clientWidth;
                        windowHeight = document.documentElement.clientHeight;
                } else if (document.body) { // other Explorers
                        windowWidth = document.body.clientWidth;
                        windowHeight = document.body.clientHeight;
                }

                // for small pages with total height less then height of the viewport
                if(yScroll < windowHeight){
                        pageHeight = windowHeight;
                } else {
                        pageHeight = yScroll;
                }

                // for small pages with total width less then width of the viewport
                if(xScroll < windowWidth){
                        pageWidth = xScroll;
                } else {
                        pageWidth = windowWidth;
                }

                if(windowHeight < document.documentElement.srollHeight)
                {
                   pageHeight = document.documentElement.scrollHeight
                }

                return [pageWidth,pageHeight];
        }


function teamDropped(element, dropon,event)
{
   //alert('Spieler-ID '+element.id+' Team alt: '+team+' Team neu: '+dropon.id);
   if (team) xajax_processRemoveSpielerTeam(team,element.id);
   if (dropon.id !== "X") xajax_processSetSpielerTeam(dropon.id,element.id);
   element.parentNode.removeChild(element);
}

function spieltagDropped(element, dropon,event)
{
   //alert('Spieler-ID '+element.id+' Team alt: '+team+' Team neu: '+dropon.id);
   if (dropon.id) xajax_processSetCatering(dropon.id,element.id);
   //element.parentNode.removeChild(element);
}


var scrollTopOld=0;
var scrollM=0;
var scrollFix;

function fix(ele)
{

 if (window.pageYOffset)
 {
   b = window.pageYOffset;
 }
 else
 {
   b = document.documentElement.scrollTop;
 }
b = b;
ele = 'mannschaften';
gp = document.getElementById(ele);

if (gp)
{
  gp.style.top = b + "px";
  scrollFix = window.setTimeout("fix()",500);
 }
}

function unfix()
{
   clearTimeout(scrollFix);
}

function SeiteWechseln(seite)
{
  window.location.href = seite;
}

function l(id)
{
  $('page-top').innerHTML = 'loading';
  $(id).innerHTML = "<img class='l-img' src='images/ajax-loader.gif' />";
}

function menu_current(c)
{
/*        $('home').removeClassName('current');
        $('kontakt').removeClassName('current');
        $('wir').removeClassName('current');
        $('tms').removeClassName('current');
        $('spiele').removeClassName('current');
        $('tab').removeClassName('current');
        $('training').removeClassName('current');
        $('halle').removeClassName('current');

        $('disclaimer').removeClassName('current');
*/
          $(c).addClassName('current');
}

/*
List of Buttons for buttonList option

'bold'
'italic'
'underline'
'left'
'center'
'right'
'justify'
'ol'
'ul'
'subscript'
'superscript'
'strikethrough'
'indent'
'outdent'
'hr'
'image'
'forecolor'
'bgcolor'
'link' * requires nicLink
'unlink' * requires nicLink
'fontSize' * requires nicSelect
'fontFamily' * requires nicSelect
'fontFormat' * requires nicSelect
'xhtml' * required nicCode


*/

var area1, area2;
function addNic(id)
{
        area2 = new nicEditor({buttonList : ['fontSize',
                                             'fontFamily','fontFormat',
                                             'bold',
                                             'italic',
                                             'underline', 
                                             'ol', 
                                             'ul', 
                                             'image', 
                                             'link',
                                             'unlink',
                                             'forecolor',
                                             'left','center','right',
                                             'strikethrough',
                                             'indent','outdent','hr'],
                                             maxHeight:  '180',
                                             iconsPath : 'js/nicEdit/nicEditorIcons.gif'}).panelInstance(id);
}
function removeArea2()
{
        area2.removeInstance('nin');
}

/*******************************************************************************
ROUTING MAPS AND SO ON
*******************************************************************************/
 //Declare global variables
  var geocoder = null;
  var router = null;
  var routePoints = [];
  var routeID = null;
  var maproute = '';
  var routemap = '';
  var rm = true;
  var startPointAlternatives = new Array();
  var destinationPointAlternatives = new Array();
  var startLoc = null;
  var destLoc = null;
  var start = '';
  var destination = '';
  var hallenname = '';

  function goMap24(strt,dest,halle) {
          start = strt;
          destination = dest;
          hallenname = halle;
    //Load core API and wrapper classes
    Map24.loadApi( ["core_api", "wrapper_api"] , map24ApiLoaded );
  }

  //If function name was defined in the loadApi() function,
  //this function is called when the API was loaded
  function map24ApiLoaded(){
    //alert('Initialize mapping client');
    Map24.MapApplication.init( { NodeName: "maparea" } );
    //alert('Initialize mapping client finished');
    $('maparea').style.width = "780px";
    $('maparea').style.height = "460px";
    startRouting();
  }

function startRouting(){
    //Retrieve start and destination of the route from the input fields
//    var start = Map24.trim( $v('start') );
//    var destination = Map24.trim( $v('destination') );

    //Check if the start and the destination form fields are empty
    if( start == "" ) { alert("Please enter start address!"); return; }
    if( destination == "" ) { alert("Please enter destination address!"); return; }

    //Disable the button for starting a route calculation.
//    document.getElementById("button_calculate_route").disabled = true;

    //Create a geocoder stub
    var geocoder = new Map24.GeocoderServiceStub();

    //Geocode the start point of the route
    geocoder.geocode({
      SearchText: start,
      //Define the name of the callback function that is called when the result is available on the client.
      CallbackFunction: setRouteEndPoint,
      //Set a parameter that is passed to the callback function. The parameter defines that this is the start point.
      CallbackParameters: {position: "start"}
    });

    //Geocode the destination point of the route
    geocoder.geocode({
      SearchText: destination,
      CallbackFunction: setRouteEndPoint,
      CallbackParameters: {position: "destination"}
    });
  }

  //Callback function that is called when the geocoding result is available.
  //The locations parameter contains an array with multiple alternative geocoding results.
  //The params parameter passes the value of CallbackParameters that specifies which route
  //end point is returned (start or destination point).
  function setRouteEndPoint(locations, params){

    //Access the geocoded address and add it to the routePoints array.
    //The geocoded address is stored at the first position in the locations array.
    routePoints[ params.position ] = locations[0];

    //After both the start and the destination addresses are geocoded, this function calls the calculateRoute() function.
    if( typeof routePoints["start"] != "undefined" && typeof routePoints["destination"] != "undefined")
      calculateRoute();
  }

  //Calculate the route.
  function calculateRoute() {
    router = new Map24.RoutingServiceStub();
    router.calculateRoute({
      Start: routePoints["start"],
      Destination: routePoints["destination"],
      CallbackFunction: displayRoute,
      ShowRoute: true
    });
//    document.getElementById("print").disabled = true;
    routePoints = [];
  }

  //Callback function used to access the calculated route of type Map24.WebServices.Route.
  //This function is called after the client has received the result from the routing service.
  function displayRoute( route ){
    //Remember the routeId. It is used e.g. to hide the route.
    routeID = route.RouteID;
    router.showRoute( {
      RouteId: routeID,
      Color: ['#00f', 150]
    });
     alert('displayroute');
    //Access the assumed time needed for traversing the route in hours
    var totalTime = ((route.TotalTime)/(60*60) ).toPrecision(3)
    //Access the total lenght of the route in kilometers
    var totalLength = (route.TotalLength/1000)
    //Create table with description of the route
    var div_content = "Total Time: " + totalTime + " h<br>" ;
    div_content += "Total Length: "+ totalLength +" km<br>";
    div_content += "<br>";

    //Iterate through the route segments and output the step-by-step textual description of the route
    for(var i = 0; i < route.Segments.length; i++){
      for(var j = 0; j < route.Segments[i].Descriptions.length; j++){
              //The route description contains tags for further evaluation. For example, the [M24_STREET] tag is used
              //to denote a street in the description. Add the following line of code to replace these tags by a blank:
        div_content += (i+1) + ". " + route.Segments[i].Descriptions[j].Text.replace(/(\[|\[\/)[0-9A-Z_]+\]/g, '' ) + "<br>";
      }
    }
  }

  //Show route
  function showRoute(routeID) {
    router.showRoute({RouteId: routeID});
  }

  //Hide route
  function hideRoute(routeID) {
    router.hideRoute({RouteId: routeID});
  }

  //Remove route
  function removeRoute(routeID) {
    router.removeRoute({RouteId: routeID});
  }

  //Print Description function.
  //The function opens a print preview window of the route description and one can choose the printer.
  function printRouteDescription(){
    var printContent = document.getElementById("routeDescription");
    var windowPrint = window.open('','','left=0,top=0,width=0,height=0,toolbar=0,scrollbars=0,status=0');
    windowPrint.document.write(printContent.innerHTML);
    windowPrint.document.close();
    windowPrint.focus();
    windowPrint.print();
    windowPrint.close();
  }

  function addStartLabel() {
    //Create an HTML object at the specified position with the specified content,
    //bubble layout, and medium size.
    StartLabelContent = hallenname + "\n"+start;    alert(StartLabelContent);
    StartLabelObj = new Map24.HtmlObject({
        Longitude: routePoints['start'].getLongitude(),
        Latitude: routePoints['start'].getLatitude(),
        Content: StartLabelContent,
        Layout: Map24.MapObject.LAYOUT_BALLON,
        Size: Map24.MapObject.SIZE_S
    });
    //Call commit() on the HTML object. The HTML object is shown on the map.
    StartLabelObj.commit();
    alert(StartLabelContent);
  }

function bildereffect(id,x,y,d)
{
 new Effect.Opacity(id,{from:y,to:x,duration:d});
 return false;
}

var pics = new Array();
var imax;
var icur;
var id;
var mode;
var opac_active = false;

function opac_init(e,a)
{
  if (!opac_active)
  {
    o_id = e;
    pics = a.split('&');
    imax = pics.length;
    icur = 1;
    mode = 'down';
    setTimeout("opac()",3000);
        opac_active = true;
  }
}

function changePic()
{
  $(o_id).src = pics[icur];
  //$j('#contents').css('background-image','url('+pics[icur]+')');
  icur = icur + 1;
  if (icur >= imax)
  {
    icur = 0;
  }
}

function opac()
{
   if (mode == 'up')
   {
     mode = 'down';
     Effect.Appear(o_id,{Duration:5, queue: { position: 'end', scope: 'bannerpic' } });
     setTimeout("opac()",7000);
   }
   else
   {
     mode = 'up';
     Effect.Fade(o_id,{Duration:5, queue: { position: 'end', scope: 'bannerpic' }, afterFinish:changePic});
     setTimeout("opac()",7000);
   }
}

function hoverBilder(e)
{
  $(e).src ='';

  $(e).innerHTML = "Bilder";
}

function getSelectedValue( obj )
{
        return obj.options[obj.selectedIndex].value;
}

function modalWin() {
	/*
	if (window.showModalDialog) {
	window.showModalDialog("http://www.bambisoft.de","virtuelles spielfeld","dialogWidth:1280px;dialogHeight:1024px");
	} else {
	window.open('www.bambisoft.de','virtuelles spielfeld','height=1024,width=1280,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
	}

	window.location.href="http://www.bambisoft.de";*/

	params  = 'width='+screen.width;
	 params += ', height='+screen.height;
	 params += ', top=0, left=0'
	 params += ', name="_BLANK"'	 ;

	var bw = window.open("http://www.bambisoft.de","_BLANK","width=1024, height=800");
	} 

