function default_form_checkall(form,value) {

  for (var i = 0; i < form.length; i++) {
    if (form.elements[i].type == 'checkbox') {
      form.elements[i].checked = value;
    }
  }
}

function default_showgameinfo(spielnr,team) {
  wind = window.open('/spielinfo.php?spielnr='+spielnr+'&teamid='+team,'spielinfo','dependent=yes,height=350,width=370,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no');
  wind.focus();
}

function default_showteaminfo(team,teamid,teams) {
  wind = window.open('/teaminfo.php?name='+team+'&teamid='+teamid,'teaminfo','dependent=yes,left=400,height=420,width=390,location=no,menubar=no,resizable=no,status=no,scrollbars=no,toolbar=no');
  wind.document.body.clientheight = (110+(teams*50));
  wind.innerHeight = (110+(teams*50));
  wind.focus();
}

function profile_checkdays(func, defvalue) {
  boxname = func.id+'_days';
  if (box = document.getElementById(boxname)) {
    box.disabled=(!func.checked);
    
    if ((func.checked) && (box.value=="")) {
      box.value = defvalue;
    }
    box.focus();
    box.select();
  }
}

function enable_edit(box, editname, defvalue) {
  if (edit = document.getElementById(editname)) {
    edit.disabled=(!box.checked);
    
    if ((box.checked) && (edit.value=="")) {
      edit.value = defvalue;
    }
    edit.focus();
    edit.select();
  }
}

function overlib_url(url) {
//  document.location.href=url;
  overlib(_get_box('<img src="/gfx/loading.gif">'),FULLHTML,STICKY,VAUTO,HAUTO);
  window.setTimeout("_start_ajax('"+directory_pre+url+"')", 100);
}

function updateContainer(divid,text) {
  div = $(divid);
  
  if (div != null) {
    div.innerHTML = text;
  } else {
    alert('ID nicht gefunden: '+divid);
  }
}

// Private Funktionen
function _get_box(text) {
  return '<div id="overbox" class="overbox">'+text+'</div>';
}

function _start_ajax(url) {
//  document.location.href=url;
  var myAjax = new Ajax.Request(url,{onSuccess: _show_overlib,    onFailure: function(){ alert('Something went wrong...') }});
}

function _show_overlib(request) {
  request.responseText.evalScripts();
  nd();
  overlib(_get_box(request.responseText),FULLHTML,STICKY,VAUTO,HAUTO);
}
