var ReloadOnError = false; var blnError = false; function showError(XMLHttpRequest, textStatus, errorThrown) { //Change dialog type on AJAX error blnError = true; $("#conf_ttl").html(textStatus.toUpperCase()); window.eThrown = errorThrown; if(window.eThrown){ var txt = window.eThrown; }else{ var txt = 'Please try again.'; } $("#conf_txt").html(txt); set_dialog_type('none', 'block', 'none', 'center'); // o_c, ok, im } function fix_msg(msgs){ var fixedStr = ""; fixedStr = msgs.replace('tagbbb', ''); fixedStr = fixedStr.replace('tagbbbe', ''); return fixedStr; } function deselectItems(mlt_lst){ // deselect all items in a multiselect list and dropdowns $(mlt_lst).attr('selectedIndex', '-1'); } function selectItems(mlt_lst){ //select all items in a multiselect list and dropdowns $(mlt_lst+' option').each(function(i) { $(this).attr("selected", "selected"); }); } function removeChildren(mlt_lst){ // Remove all child nodes from element $(mlt_lst).empty(); } function ini_dialog(){ $("#btn_okw").click(function(e) { /// btn common "OK" warning/error dlg e.preventDefault(); HideDialog(); set_dialog_type('none', 'none', 'none', 'center'); // o_c, ok, im if(ReloadOnError){ reload_page(CurrentTab); } }); $("#btn_cancel").click(function(e) { /// btn common "Cancel" confirm dlg e.preventDefault(); HideDialog(); set_dialog_type('none', 'none', 'none', 'center'); // o_c, ok, im, txt-align }); $("#dlg_int_button").click(function(e) { /// internal dialog close button HideDialogInternal('fast'); }); } function ShowDialog(d_width){ $.blockUI({ message: $('#dlg_confirm'), css: { width: d_width+'px'} }); // Show default dialog } function HideDialog(){ // Hide current dialog $.unblockUI(); } function ShowDialogInternal(){ $('#dlg_internal').show(); // Show internal dialog } function HideDialogInternal(){ // Hide internal dialog $('#dlg_internal').hide(); } function set_dialog_type(o_c, ok, im, ta){ // Sets the dialog type $("#dlg_ok_cancel").css("display",o_c); $("#conf_im").css("display",im); $("#dlg_ok").css("display",ok); $("#conf_ttl").css("text-align",ta); $("#conf_txt").css("text-align",ta); } function showErr(err_id){ $(err_id).show(); } function hideErr(err_id){ $(err_id).hide(); }