function Dialog(control, width, height, okCallback) { HideDropDowns(); $(control) .show() .dialog({ modal: true, width: width, height: height, resizable: false, show: { effect: "drop", options: { direction: "up" }, speed: 300 }, hide: { effect: "drop", options: { direction: "up" }, speed: 300 }, close: ShowDropDowns, buttons: { "Speichern": function() { ShowDropDowns(); okCallback(); $(this).dialog("close"); } } }); } function DialogWithoutButtons(control, width, height) { HideDropDowns(); $(control) .show() .dialog({ modal: true, width: width, height: height, resizable: false, show: { effect: "drop", options: { direction: "up" }, speed: 300 }, hide: { effect: "drop", options: { direction: "up" }, speed: 300 }, close: ShowDropDowns }); } function Message(message, redirectUrl) { HideDropDowns(); $("
" + message + "
") .appendTo("body") .dialog({ modal: true, overlay: { opacity: 0.9, background: "white" }, width: 770, height: 130, resizable: false, show: { effect: "drop", options: { direction: "up" }, speed: 300 }, hide: { effect: "drop", options: { direction: "up" }, speed: 300 }, close: ShowDropDowns, buttons: { "Weiter": function() { $(this).dialog("close"); if (redirectUrl) location = redirectUrl; } } }); } function ConfirmMessage(okCallback) { HideDropDowns(); $("
Sind Sie sicher?
") .appendTo("body") .dialog({ modal: true, height: 115, resizable: false, show: { effect: "drop", options: { direction: "up" }, speed: 300 }, hide: { effect: "drop", options: { direction: "up" }, speed: 300 }, close: ShowDropDowns, buttons: { "Ja, fortfahren": function() { $(this).dialog("close"); okCallback(); }, "Nein": function() { $(this).dialog("close"); } } }); } function DatePicker(control) { $(control).datepicker({ dateFormat: "dd.mm.yy", yearRange: "1900:2010", changeFirstDay: false }); //this is a fix for the jquery datepicker, because the proper class won't be added otherwise $("#ui-datepicker-div").addClass("ui-datepicker-div"); } function ReplaceBreaksWithCrlf(text) { if (!text) return ""; while (text.indexOf("
", 0) >= 0) text = text.replace("
", "\r\n"); return text; } function HideDropDowns() { if ($.browser.msie && $.browser.version < 7) $(".hide-dropdown").hide(); } function ShowDropDowns() { if ($.browser.msie && $.browser.version < 7) $(".hide-dropdown").show(); } function MaxLength(textarea, maxLength) { var divId = "___MaxLength"; $(textarea).blur(function() { $("#" + divId).remove(); }); $(textarea).focus(function() { var left = $(textarea).offset().left; var top = $(textarea).offset().top; $("
") .attr("id", divId) .addClass("grid-item") .css({ position: "absolute", left: left, top: top, width: 150, zIndex: 99999 }) .hide() .html($(textarea).val().length + "/" + maxLength + " Zeichen.") .appendTo("body") .fadeIn(300) .css({ top: top - $("#" + divId).height() }); }); $(textarea).keyup(function() { $("#" + divId) .html($(textarea).val().length + "/" + maxLength + " Zeichen."); }); $(textarea).keydown(function(evnt) { if (evnt.keyCode == 8 || evnt.keyCode == 46 || evnt.keyCode == 37 || evnt.keyCode == 39 || evnt.keyCode == 38 || evnt.keyCode == 40) //we still allow Backspace, Del and the Cursors. return true; if ($(textarea).val().length >= maxLength) return false; }); } function HoverInfo(id, text) { $(id).hover(function() { var left = $(id).offset().left; var top = $(id).offset().top + 25; if (left + 360 > $(document).width()) left = $(document).width() - 360; $("#___HoverInfo").remove(); $("
") .attr("id", "___HoverInfo") .addClass("hover-box") .css({ position: "absolute", left: left, top: top, width: 350, zIndex: 99999 }) .html(text) .hide() .appendTo("body") .fadeIn(500); }, function() { $("#___HoverInfo") .fadeOut(500); }); }