// Copyright Nintex  Type.registerNamespace('NWF');NWF.Utilities=function(){var progressDlg=null;var hideProgressDlg=false;return{ProgressDlg:progressDlg,OpenModalDialog:function(params,callbackFunction,allowMaximize){try{var sourceElement=NWF$(params[0])[0];if(callbackFunction==""){callbackFunction=this.CloseCallback;} if(sourceElement){var dialogElement=sourceElement.cloneNode(true);dialogElement=NWF$(dialogElement);dialogElement.show();var dialog={html:dialogElement[0],title:dialogElement.attr("title"),allowMaximize:allowMaximize!=undefined?allowMaximize:true,showClose:true,dialogReturnValueCallback:callbackFunction};SP.UI.ModalDialog.showModalDialog(dialog);}else{alert("This dialog cannot be used on this screen.");}}catch(e){alert("Exception: "+e.message);}},HelpButtonClickFromDialog:function(key){NWF.Designer.DialogIsOpen=false;NWF.Utilities.CloseModalDialog(SP.UI.DialogResult.CANCEL,'');NWF.Utilities.HelpButtonClick(key);},OpenOkModalDialog:function(dialogTitle,messageText,parentWindow){var okButton="

";var params=["
"+messageText.replace(/\\n/g,"
")+okButton+"
"];if(NWF.Designer){NWF.Designer.DialogIsOpen=true;} NWF.Utilities.HideProgressDiv();NWF.Utilities.OpenModalDialog(params,null,false);NWF$(".nf-info-dialog-ok-button",parentWindow.document).click(function(){if(NWF.Designer){NWF.Designer.DialogIsOpen=false;} NWF.Utilities.CloseModalDialog(SP.UI.DialogResult.CANCEL,'');});},IsStringNullOrEmpty:function(value){var isNullOrEmpty=true;if(value){if(typeof(value)=='string'){if(value.charCodeAt(0)!='8203'){isNullOrEmpty=false;}}} return isNullOrEmpty;},IsValueNullOrEmpty:function(value){if(typeof(value)=='undefined'||value==null){return true;} return(value.toString().replace(/^\s+|\s+$/gm,'')==="");},AjaxPost:function(service,requestData,cbSuccess,cbError){var NFApplicationWebUrl=NFApplicationWebUrl||"";var webserviceUrl=NFApplicationWebUrl+service;if(!SP.ScriptUtility.isUndefined(window._spPageContextInfo)&&!SP.ScriptUtility.isUndefined(window._spFormDigestRefreshInterval)&&!SP.ScriptUtility.isUndefined(window.UpdateFormDigest)){var context=window._spPageContextInfo;var webServerUrl=context.webServerRelativeUrl;var refreshInterval=window._spFormDigestRefreshInterval;window.UpdateFormDigest(webServerUrl,refreshInterval);} NWF$.ajax({type:"POST",url:webserviceUrl,data:requestData,headers:{"X-RequestDigest":NWF$("#__REQUESTDIGEST").val()},contentType:"application/json; charset=utf-8",dataType:"json",success:cbSuccess,error:cbError?cbError:function(XMLHttpRequest,textStatus,errorThrown){NWF.Utilities.HideProgressDiv();if(XMLHttpRequest.responseText!=undefined&&XMLHttpRequest.responseText!=""){alert(XMLHttpRequest.responseText);}else{if(textStatus=="error"&&errorThrown=="No Transport"){alert("A possible cross server scripting error has occurred during an Ajax call.");}else{alert("An error occurred during an Ajax call.");}}}});},HelpButtonClick:function(key){NWF.Environment.HelpButtonClick(key);},SelectRibbonTab:function(tabId){SelectRibbonTab(tabId,true);},CleanDateTimeVariableValues:function(fieldListCollection){for(var j=0;j=0){variableCollection[i].Value=new Date(parseInt(variableCollection[i].Value.replace("/Date(","").replace(")/",""),10));}}}},OpenUrlModalDialog:function(url,title,width,height,args,callbackFunction,showMaximize,showClose,startMaximized,setDialogIsOpenFlag,setAutoSize){try{if(showMaximize==undefined){showMaximize=true;} if(showClose==undefined){showClose=true;} if(startMaximized==undefined){startMaximized=false;} if(setDialogIsOpenFlag==undefined){setDialogIsOpenFlag=true;} if(callbackFunction==""||callbackFunction==null){callbackFunction=this.CloseCallback;} if(setAutoSize==undefined){setAutoSize=false;} if(args!=null){args.IsStartForm=isStartForm;} var dialog={url:url,title:title,height:height,width:width,autoSize:setAutoSize,args:args,allowMaximize:showMaximize,showClose:showClose,showMaximized:startMaximized,dialogReturnValueCallback:callbackFunction};SP.UI.ModalDialog.showModalDialog(dialog);try{var closeButtons=NWF$(".ms-dlgCloseBtn",window.parent.document);closeButtons.each(function(){var dialog=NWF$(this).closest("div.ms-dlgBorder");var iframe=NWF$("iframe[src*='NintexForms/DesignerPropertyPane.aspx']",dialog);if(iframe.length>0){}});}catch(err){} if(setDialogIsOpenFlag){NWF.Designer.DialogIsOpen=true;}}catch(e){alert("Modal Dialog: "+e.message);}},CloseModalDialog:function(result,returnVal){setTimeout(function(){SP.UI.ModalDialog.commonModalDialogClose(result,returnVal);});},CloseCallback:function(dialogResult,returnValue){try{if(dialogResult==SP.UI.DialogResult.OK){} if(dialogResult==SP.UI.DialogResult.cancel){} NWF.Designer.DialogIsOpen=false;RefreshCommandUI();}catch(e){alert("Modal Dialog: "+e.message);}},GetCssClass:function(selector){var rules;var haveRule=false;if(typeof document.styleSheets!="undefined"){var cssSheets=document.styleSheets;outerloop:for(var i=0;i0){try{document.forms[f][i].focus();}catch(e){} bFound=true;}}} if(bFound==true) break;} if(bFound==true) break;} if(!bFound){NWF$("a:visible").first().focus();}},ShowProgressDiv:function(sMessage){if(progressDlg!=null){NWF.Utilities.HideProgressDiv();} EnsureScript("SP.UI.Dialog.js",typeof(SP.UI.ModalDialog.showWaitScreenWithNoClose),function(){var heightOfDialog=110;if(sMessage.length>20){heightOfDialog=110+((Math.round(sMessage.length/20))*20);} progressDlg=SP.UI.ModalDialog.showWaitScreenWithNoClose(' ',sMessage,heightOfDialog,280);});},HideProgressDiv:function(){EnsureScript("SP.UI.Dialog.js",typeof(SP.UI.ModalDialog.showWaitScreenWithNoClose),function(){if(progressDlg){progressDlg.close();}else{SP.UI.ModalDialog.commonModalDialogClose();}});},UnescapeString:function(str){var div=document.createElement('div');div.innerHTML=str;return div.firstChild.data;},RemoveSPDialogEventHandler:function(element,eventType){try{if(element.removeEventListener){NWF$(element._events[eventType]).each(function(){element.removeEventListener(eventType,this.browserHandler,false);});}else if(element.detachEvent){NWF$(element._events[eventType]).each(function(){element.detachEvent('on'+eventType,this.browserHandler);});}}catch(err){}},SetContainerAndOuterDiv:function(formFillerDivCurrent){if(formfillerDivsCount>1){container=formFillerDivCurrent.find(".nf-filler-container");outerDiv=container.children(".nf-outer");}},ResizeFillerContainerHeight:function(heightDifference,formFillerDivCurrent){NWF.Utilities.SetContainerAndOuterDiv(formFillerDivCurrent);var newContainerHeight=heightDifference+container.height();outerDiv.height(newContainerHeight,true);container.height(newContainerHeight,true);},ResizeFillerContainerWidth:function(widthDifference,formFillerDivCurrent){NWF.Utilities.SetContainerAndOuterDiv(formFillerDivCurrent);var newContainerWidth=widthDifference+container.width();outerDiv.width(newContainerWidth,true);container.width(newContainerWidth,true);},RepositionAndResizeOtherControlsForRule:function(currentControl,currentControlTop,currentControlHeight,heightDifference,excludeClass){NWF.FormFiller.Events.ExecuteControlShowHidePropagating(currentControl);var repositionControls=true;var samelevelControl;var controlSelection=NWF.Utilities.GetSiblingFillerControls(currentControl,excludeClass);if(heightDifference<0){currentControl.data("RepositionControls",true);controlSelection.not(":hidden").each(function(){samelevelControl=NWF$(this);var samelevelControlCss=NWF.Utilities.GetAllStyles(samelevelControl[0]);var samelevelControlTop=parseInt(samelevelControlCss.top);var samelevelControlHeight=parseInt(samelevelControlCss.height);var samelevelControlBottom=samelevelControlTop+samelevelControlHeight;var currentControlBottom=currentControlTop+currentControlHeight;if((samelevelControlTop>=currentControlTop&&samelevelControlBottom<=currentControlBottom)||(samelevelControlBottom>currentControlTop&&samelevelControlBottom<=currentControlBottom)||(samelevelControlTopcurrentControlTop)){repositionControls=false;currentControl.data("RepositionControls",false);}});}else{if(currentControl.data("RepositionControls")!=undefined){repositionControls=currentControl.data("RepositionControls");} currentControl.data("RepositionControls",true);} if(repositionControls){controlSelection.each(function(){var samelevelControlTop=NWF.Utilities.GetTop.call(this);if(samelevelControlTop>currentControlTop){NWF.Utilities.SetTop.call(this,samelevelControlTop+heightDifference);}});var outermostContainerResized=NWF.Utilities.ResizeContainerControlsForRule(currentControl,heightDifference,heightDifference);if(outermostContainerResized){NWF.Utilities.ResizeFillerContainerHeight(heightDifference,NWF.FormFiller.Functions.GetFormFillerDiv(currentControl));}} NWF.FormFiller.Events.ExecuteControlShowHidePropagated(currentControl);},RepositionAndResizeOtherControls:function(currentControl,currentControlTop,heightDifference,heightDifferenceWithBorders,excludeClass){NWF.FormFiller.Events.ExecuteControlHeightChangePropagating(currentControl);var outermostContainerResized=true;var extraDisplacement;var controlSelection=NWF.Utilities.GetSiblingFillerControls(currentControl,excludeClass);controlSelection.each(function(){var samelevelControlTop=NWF.Utilities.GetTop.call(this);if(samelevelControlTop>currentControlTop){NWF.Utilities.SetTop.call(this,samelevelControlTop+heightDifferenceWithBorders);}});var parentControls=currentControl.parents('.nf-filler-control');if(parentControls.length>0){currentControl.parents('.nf-repeater-row').addClass("nf-repeater-resizeHeight");parentControls.each(function(){var fillerDiv=NWF$(this);var fillerInnerDiv=NWF$(NWF$(fillerDiv.children()[0]).children()[0]);var resizableFormControl=NWF$(fillerInnerDiv.children()[0]);if(!fillerDiv.hasClass('nf-resizable')){outermostContainerResized=false;return false;} var formControlHeight=parseInt(resizableFormControl.outerHeight());if(resizableFormControl.hasClass('nf-repeater')){var resizableRepeaterRows=resizableFormControl.children('.nf-repeater-resizeHeight');if(resizableRepeaterRows.length>0){resizableRepeaterRows.each(function(){var resizableRepeaterRow=NWF$(this);var resizableRepeaterRowHeight=parseInt(resizableRepeaterRow.outerHeight());resizableRepeaterRow.outerHeight(resizableRepeaterRowHeight+heightDifferenceWithBorders,true);resizableRepeaterRow.removeClass("nf-repeater-resizeHeight");});}} var fillerInnerCss=NWF.Utilities.GetAllStyles(fillerInnerDiv[0]);var fillerDivMarginTop=NWF.Utilities.GetStyle(fillerInnerCss,"borderTopWidth",fillerInnerDiv,"border-top-width");var fillerDivMarginBottom=NWF.Utilities.GetStyle(fillerInnerCss,"borderBottomWidth",fillerInnerDiv,"border-bottom-width");var controlDiv=NWF$(NWF$(NWF$(currentControl.children()[0]).children()[0]).children()[0]);var firstChild=NWF$(controlDiv.children()[0]);if(!((controlDiv.hasClass("nf-repeater")&&(firstChild.outerHeight()==Math.abs(heightDifference))))){formControlHeight=formControlHeight+fillerDivMarginTop+fillerDivMarginBottom;} var fillerDivHeightBefore=fillerDiv.outerHeight(true);fillerDiv.outerHeight(formControlHeight+heightDifferenceWithBorders,true);if(fillerDiv.data("HideCounter")>0){outermostContainerResized=false;return false;} var fillerDivHeightAfter=fillerDiv.outerHeight(true);var fillerDivHeightDifference=fillerDivHeightAfter-fillerDivHeightBefore;var fillerDivTop=parseInt(NWF.Utilities.GetAllStyles(fillerDiv[0]).top);if((fillerDiv.find(".nf-repeater").length+fillerDiv.parents(".nf-repeater").length>=1)){extraDisplacement=heightDifferenceWithBorders;}else{extraDisplacement=fillerDivHeightDifference;} NWF.Utilities.GetSiblingFillerControls(fillerDiv).each(function(){var resizableControlChildControlTop=NWF.Utilities.GetTop.call(this);if(resizableControlChildControlTop>fillerDivTop){NWF.Utilities.SetTop.call(this,resizableControlChildControlTop+extraDisplacement);}});});currentControl.parents('.nf-repeater-resizeHeight').removeClass("nf-repeater-resizeHeight");} NWF.FormFiller.Events.ExecuteControlHeightChangePropagated(currentControl);return outermostContainerResized;},ResizeContainerControlsForRule:function(currentControl,heightDifference,heightDifferenceWithBorders){var outermostContainerResized=true;var parentControls=currentControl.parents('.nf-filler-control');if(parentControls.length>0){parentControls.each(function(){var fillerDiv=NWF$(this);var fillerInnerDiv=NWF$(NWF$(fillerDiv.children()[0]).children()[0]);var resizableFormControl=NWF$(fillerInnerDiv.children()[0]);if(!fillerDiv.hasClass('nf-resizable')||resizableFormControl.hasClass('nf-repeater')){outermostContainerResized=false;return false;} var fillerDivHeightBefore=fillerDiv.outerHeight(true);fillerDiv.outerHeight(fillerDivHeightBefore+heightDifferenceWithBorders,true);var fillerDivTop=parseInt(NWF.Utilities.GetAllStyles(fillerDiv[0]).top);if(fillerDiv.data("HideCounter")>0){outermostContainerResized=false;return false;} NWF.Utilities.GetSiblingFillerControls(fillerDiv).each(function(){var resizableControlChildControlTop=NWF.Utilities.GetTop.call(this);if(resizableControlChildControlTop>fillerDivTop){NWF.Utilities.SetTop.call(this,resizableControlChildControlTop+heightDifferenceWithBorders);}});});} return outermostContainerResized;},GetSiblingFillerControls:function(currentControl,excludeClass){if(excludeClass){return currentControl.siblings('.nf-filler-control').not(excludeClass);}else{return currentControl.siblings('.nf-filler-control');}},GetAllStyles:function(domObject){try{var allStyles;var docView=document.defaultView;if(docView&&docView.getComputedStyle){allStyles=docView.getComputedStyle(domObject,null);}else{allStyles=domObject.currentStyle;} return allStyles;} catch(d){return null;}},GetStyle:function(cachedStyles,cachedStyleName,objectDiv,cssStyleName){var resultValue=parseInt(cachedStyles[cachedStyleName]);if(isNaN(resultValue)){resultValue=parseInt(objectDiv.css(cssStyleName));if(isNaN(resultValue)){resultValue=0;}} return resultValue;},GetTop:function(){var domObjectTop=this.style.posTop;if(domObjectTop===undefined){domObjectTop=parseInt(this.style.top);} return domObjectTop;},SetTop:function(posTop){if(this.style.posTop!=undefined){this.style.posTop=posTop;} else{this.style.top=posTop+"px";}},StripBRIfEmptyInnerHTML:function(strInnerHtml) {if(strInnerHtml==='
'){return'';} return strInnerHtml;},Browser:function(){return{IsEdge:function(){var ua=window.navigator.userAgent;var edge=ua.indexOf('Edge/');if(edge>0){return parseInt(ua.substring(edge+5,ua.indexOf('.',edge)),10)>=12;} return false;},IsFireFox:function(){var ua=window.navigator.userAgent;return ua.indexOf('Firefox')>-1;},IsIE:function(){var ua=window.navigator.userAgent;var msie=ua.indexOf('MSIE ');var trident=ua.indexOf('Trident/');return msie>0||trident>0;},IsIEVersion7:function(){var ua=window.navigator.userAgent;var msie=ua.indexOf('MSIE ');if(msie>0){return parseInt(ua.substring(msie+5,ua.indexOf('.',msie)),10)===7;} return false;},IsSafari:function(){var ua=window.navigator.userAgent;var safari=ua.indexOf('safari');if(safari>0){return ua.indexOf('chrome')===-1;} return false;},IsInIframe:function(){try{return window.self!==window.top;}catch(e){return true;}}}}};}();function IsNullOrEmpty(value){var isNullOrEmpty=true;if(value){if(typeof(value)=='string'){if(value.length>0)isNullOrEmpty=false;}} return isNullOrEmpty;}