var DEFAULT_ERROR_TITLE='Error';var DEFAULT_MESSAGE_TITLE='';var DIALOG_DIV_ID='alertMessage';var waitMessageActive=false;jQuery(document).ready(function(){if(!jQuery('#'+DIALOG_DIV_ID).get(0)){jQuery('<div id="'+DIALOG_DIV_ID+'"></div>').appendTo('body');}
jQuery('#'+DIALOG_DIV_ID).dialog({modal:true,width:'',title:'',resizable:false,autoOpen:false,closeOnEscape:true,buttons:{"Ok":function(){jQuery(this).dialog("close");}},open:function(){jQuery(".ui-dialog-titlebar-close").hide();}});if(jQuery('#'+DIALOG_DIV_ID).html()){if(jQuery('#'+DIALOG_DIV_ID).hasClass('error')){setToBrandingError();jQuery('.ui-dialog .error').css('color','red');}else{setToBrandingDefault();}
jQuery('#'+DIALOG_DIV_ID).dialog('open');jQuery('#'+DIALOG_DIV_ID).parent().bgiframe();}});function showAlertMessageWait(message,isError,callback){if(callback)waitMessageActive=true;setAlertMessage(message);resetButtons();setMessageBranding(isError);var callbackCalled=false;jQuery('#'+DIALOG_DIV_ID).dialog('open');jQuery('#'+DIALOG_DIV_ID).parent().bgiframe();jQuery('#'+DIALOG_DIV_ID).bind("dialogclose",{callbackFunc:callback,callbackCalledBool:callbackCalled},function(event,ui){if(event.data.callbackFunc&&event.data.callbackCalledBool==false){event.data.callbackFunc();event.data.callbackCalledBool=true;waitMessageActive=false;}});}
function showAlertMessage(message,isError){showAlertMessageWait(message,isError,null);}
function showNoticeMessage(message){setAlertMessage(message);setNoticeBranding();jQuery('#'+DIALOG_DIV_ID).dialog('option','buttons',{});jQuery('#'+DIALOG_DIV_ID).dialog('open');}
function resetButtons(){jQuery('#'+DIALOG_DIV_ID).dialog("option","buttons",{"Ok":function(){jQuery(this).dialog("close");}});}
function setAlertMessage(message){clearMessages();if(typeof message=='string'){jQuery('#'+DIALOG_DIV_ID).html('<span>'+message+'</span>');}else{jQuery.each(message,function(i,text){jQuery('<span>'+text+'<span/>').appendTo('#'+DIALOG_DIV_ID);});}}
function clearMessages(){jQuery('#'+DIALOG_DIV_ID).html('');}
function setMessageBranding(isError){if(isError){setToBrandingError();}else{setToBrandingDefault();}}
function setToBrandingError(){jQuery('#'+DIALOG_DIV_ID+' span').addClass('error');setTitle(DEFAULT_ERROR_TITLE);jQuery('#ui-dialog-title-alertMessage').addClass('error');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('border','2px solid #000644');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('cursor','text');}
function setToBrandingDefault(){jQuery('#'+DIALOG_DIV_ID+' span').removeClass('error');setTitle(DEFAULT_MESSAGE_TITLE);jQuery('#ui-dialog-title-alertMessage').removeClass('error');jQuery('#'+DIALOG_DIV_ID).css('color','#000644');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('border','2px solid #000644');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('cursor','text');}
function setNoticeBranding(){jQuery('#'+DIALOG_DIV_ID+' span').removeClass('error');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).removeClass('error');jQuery('#'+DIALOG_DIV_ID).css('color','#000000');jQuery('#'+DIALOG_DIV_ID).css('textAlign','center');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('border','5px solid #AAAAAA');jQuery('#ui-dialog-title-'+DIALOG_DIV_ID).parent().parent().css('cursor','wait');}
function setTitle(title){jQuery('#'+DIALOG_DIV_ID).dialog('option','title',title);jQuery('.ui-dialog-titlebar').show();}
function closeAlertMessage(){if(waitMessageActive)return;clearMessages();jQuery('#'+DIALOG_DIV_ID).dialog('close');}
