//
function ajax_load() {
  attr_src = document.createAttribute("src");
  attr_src.nodeValue = "/javascripts/prototype.js";
  attr_type = document.createAttribute("type");
  attr_type.nodeValue = "text/javascript";
  elem = document.createElement("script");
  elem.setAttributeNode(attr_src);
  elem.setAttributeNode(attr_type);
  b = document.getElementById("body");
  b.appendChild(elem);
}


// pollenflug kalender
function show_pollen() {
  var newWindow=window.open('','pollen','width=576,height=636,scrollbars=no,resizable=no,status=no');
  newWindow.focus();
}

// lexikon
function lexikon_show(id) {
  new Ajax.Updater('lexikon', '/box/lexikon/'+id, {method:'get', asynchronous:true, evalScripts:true});
  document.getElementById('lexikon').style.visibility='visible';
}

function lexikon_hide() {
  document.getElementById('lexikon').style.visibility='hidden';
}

// ajax wrapper
// arguments: (divid, url1, url2, ...)
function content_updater() {
  divid = content_updater.arguments[0];
  document.body.style.cursor='wait';

  // get first one, delete content of divid
  new Ajax.Updater(divid, '/box/'+content_updater.arguments[1], {asynchronous:true, evalScripts:false, method:'get'});

  // get everything else, append
  for (i=0; i<(content_updater.arguments.length-2); i++){
    new Ajax.Updater(divid, '/box/'+content_updater.arguments[i+2], {asynchronous:true, evalScripts:false, method:'get', insertion:Insertion.Bottom});
  }
  document.body.style.cursor='default';
}


function content_main_updater() {
  divid = content_main_updater.arguments[0];
  document.body.style.cursor='wait';

  // get first one, delete content of divid
  new Ajax.Updater(divid, '/content/view/'+content_main_updater.arguments[1], {asynchronous:true, evalScripts:false, method:'get'});

  // get everything else, append
  for (i=0; i<(content_main_updater.arguments.length-2); i++){
    new Ajax.Updater(divid, '/content/view/'+content_main_updater.arguments[i+2], {asynchronous:true, evalScripts:false, method:'get', insertion:Insertion.Bottom});
  }
  document.body.style.cursor='default';
}
