// zeigt ein "Bitte warten"-Fenster an
function fwait(txt)
{
	if(txt != "")
   {

      Dialog.info("<p align=center class=size2>"+txt+"</p>",
      {
         windowParameters:
         {
            className: "klabautermann",
            width:250,
            height:100
         },
         showProgress: true,
         showEffectOptions: {duration:0.4},
         hideEffectOptions: {duration:0.4}
      }
      );
	}
   else
   {
      Dialog.closeInfo();
	}
}

// zeigt eine Fehlermeldung an
function falert(txt)
{
   if(txt != "")
		Dialog.alert("<p align=center class=size2>&nbsp;<br>"+txt+"</p>", {windowParameters: {className: "klabautermann", title: "Hinweis", width:400, height:200, showEffectOptions: {duration:1}}, buttonClass: "button", okLabel: "schließen", ok:function(win) {debug("validate alert panel"); return true;}});
}

// zeigt einen Hinweis an
function finfo(tit,txt){
	if(txt != "")
		Dialog.alert("<p align=center class=size2>&nbsp;<br>"+txt+"</p>", {windowParameters: {className: "klabautermann", title: tit, width:400, height:200, showEffectOptions: {duration:10}}, buttonClass: "button_modal", okLabel: "schließen", ok:function(win) {debug("validate alert panel"); return true;}});
}

// Öffnet einen ja/nein-Dialog
function fconfirm(title, content, ok_function, cancel_function, cid, css, label_ok, label_cancel)
{
   // ID des Fensters
   if(cid == "" || typeof cid == "undefined")cid = "modal_confirm";

   // Beschriftung für ok-Button
   if(label_ok == "" || typeof label_ok == "undefined")label_ok = "ja";

   // Beschriftung für cancel-Button
   if(label_cancel == "" || typeof label_cancel == "undefined")label_cancel = "nein";

   // Funktion für ok
   if(ok_function == "" || typeof ok_function == "undefined")ok_function = "alert('Funktion fehlt noch!');";
   
   // Funktion für cancel
   if(cancel_function == "" || typeof cancel_function == "undefined")cancel_function = "";

   // CSS-Klasse für Buttons
   if(css == "" || typeof css == "undefined")css = "button_modal_confirm";

   var win  = Dialog.confirm(content,
   {
      windowParameters:
      {
         className:  "klabautermann",
         title:      title,
         width:      400,
         height:     200,
         showEffectOptions:   {duration:10}
      },
      okLabel:       label_ok,
      cancelLabel:   label_cancel,
      buttonClass:   css,
      id:            cid,
      ok:            function(win){eval(ok_function);return true;},
      onCancel:      cancel_function
   });
}

// Öffnet ein einfaches Fenster mit Inhalt
function fwindow(win_id, title,  content, cls, w, h)
{
   // ID des Fensters
   if(win_id == "" || typeof win_id == "undefined")win_id = "win";

   // Titel des Fensters
   if(title == "" || typeof title == "undefined")title = "";

   // Inhalt des Fensters
   if(content == "" || typeof content == "undefined")content = "Inhalt fehlt";

   // Theme des Fensters
   if(cls == "" || typeof cls == "undefined")cls = "klabautermann";

   // Größe des Fensters
   if(w == "" || typeof w == "undefined")w = 400;
   if(h == "" || typeof h == "undefined")h = 200;

   contentWin = new Window
   (
      win_id,
      {
         className:        cls,
         title:            title,
         width:            w,
         height:           h,
         zIndex:           100,
         maximizable:      true,
         resizable:        true,
         draggable:        true,
         destroyOnClose:   true
      }
   )
   contentWin.setDestroyOnClose();
   contentWin.getContent().innerHTML = content;
   contentWin.showCenter(true);
}
