/*
 * JavaScript-Funktionen zur Formularverarbeitung
 * auf www.Gaussianer.de
 *
 * Author: René Kubach
 * Alle Rechte vorbehalten.
 *
 ************************************************/



/* Funktionen für edit-Formulare:
 ************************************************/

function setze_formularwert (formular, element, wert) {
    document.forms[formular].elements[element].value = wert;
}

function waehle_radiobutton (formular, element, option) {
    document.forms[formular].elements[element][option].checked = true;
}

function schreibe_datum_in_formular (tag, monat, jahr, formular, element) {
    setze_formularwert(formular,element+"_tag",tag);
    setze_formularwert(formular,element+"_monat",monat);
    setze_formularwert(formular,element+"_jahr",jahr);
    document.forms[formular].elements[element+"_jahr"].focus();
}

function oeffne_kalender (formular, datum) {
    calendar = window.open("kalender.php?formular="+formular+"&datum="+datum,"calendar","width=170,height=200");
    calendar.focus();
    if(screen) calendar.moveTo(500,screen.height/2-150);
}

function oeffne_upload_interface (formular, element) {
    ui = window.open("upload.php?modus=0&formular="+formular+"&element="+element,"upload","width=600,height=190");
    ui.focus();
    if(screen) ui.moveTo(screen.width/2-300,screen.height/2-150);
}

function melde_speicherstand(stand) {
    window.opener.changeImg("bildspeichern","/img/bild_speichern"+stand+".gif");
    if(stand==1) showObj("bildspeichern");
    if(stand==2) setTimeout("self.close()",5000);
}

function aktiviere_archivierung(tag,monat,jahr,option) {
    waehle_radiobutton('editieren','veroeffentlichung',option);
    schreibe_datum_in_formular(tag,monat,jahr,'editieren','veroeffentlichung_vonbis');
}
