UNPKG

ns-components-angular

Version:

Angular Wrapper Components for NSComponents

7 lines (6 loc) 3.86 MB
import { NG_VALUE_ACCESSOR } from '@angular/forms'; import * as i0 from '@angular/core'; import { Injectable, inject, ElementRef, Component, EventEmitter, forwardRef, ViewEncapsulation, Input, Output, ViewContainerRef, ViewChild, ContentChildren, Directive, NgModule } from '@angular/core'; import * as i1 from '@angular/router'; import { HttpClient } from '@angular/common/http'; const NSUtilCode = "var nsModuleExport = (function()\r\n{\r\n\tvar nsModuleExport = function(root,name,prototype)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\tmodule.exports[name] = prototype;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\tdefine(name,[], function () {return prototype;});\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\texports[name] = prototype;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\troot[name] = prototype;\r\n\t\t}\r\n\t};\r\n\treturn nsModuleExport;\r\n})();\r\n(function(root,name,prototype)\r\n{\r\n\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t{\r\n\t\tmodule.exports[name] = prototype;\r\n\t}\r\n\telse if (typeof define === \"function\" && define.amd)\r\n\t{\r\n\t\tdefine(name,[], function () {return prototype;});\r\n\t}\r\n\telse if(typeof exports === 'object')\r\n\t{\r\n\t\texports[name] = prototype;\r\n\t}\r\n\telse\r\n\t{\r\n\t\troot[name] = prototype;\r\n\t}\r\n})(this,\"nsModuleExport\",nsModuleExport);\r\nvar NSUtil = (function()\r\n{\r\n\tfunction NSUtil()\r\n\t{\r\n\t\tthis.__sheetId = \"nsStyle\";\r\n\t\tthis.KEYCODE = {BACKSPACE:8, TAB:9, ENTER:13, SHIFT:16, CTRL:17, ALT:18, ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46};\r\n\t\tthis.ANIMATIONDELAY = 10;\r\n\t\t//for nsMenu and nsPinTip\r\n\t\tthis.POS_TOP = \"top\";\r\n\t\tthis.POS_BOTTOM = \"bottom\";\r\n\t\tthis.POS_LEFT = \"left\";\r\n\t\tthis.POS_RIGHT = \"right\";\r\n\t\tthis.POS_TOPLEFT = \"top-left\";\r\n\t\tthis.POS_TOPRIGHT = \"top-right\";\r\n\t\tthis.POS_BOTTOMLEFT = \"bottom-left\";\r\n\t\tthis.POS_BOTTOMRIGHT = \"bottom-right\";\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getDomVariables = function()\r\n\t{\r\n\t\tvar retValue = {doc: null,win: null};\r\n\t\tif(typeof document === 'undefined')\r\n\t\t{\r\n\t\t\tretValue.doc = {\r\n\t\t\t\t\tbody: {},\r\n\t\t\t\t addEventListener: function addEventListener() {},\r\n\t\t\t\t removeEventListener: function removeEventListener() {},\r\n\t\t\t\t activeElement: {\r\n\t\t\t\t blur: function blur() {},\r\n\t\t\t\t nodeName: '',\r\n\t\t\t\t },\r\n\t\t\t\t querySelector: function querySelector() {\r\n\t\t\t\t return null;\r\n\t\t\t\t },\r\n\t\t\t\t querySelectorAll: function querySelectorAll() {\r\n\t\t\t\t return [];\r\n\t\t\t\t },\r\n\t\t\t\t getElementById: function getElementById() {\r\n\t\t\t\t return null;\r\n\t\t\t\t },\r\n\t\t\t\t createEvent: function createEvent() {\r\n\t\t\t\t return {\r\n\t\t\t\t initEvent: function initEvent() {},\r\n\t\t\t\t };\r\n\t\t\t\t },\r\n\t\t\t\t createElement: function createElement() {\r\n\t\t\t\t return {\r\n\t\t\t\t children: [],\r\n\t\t\t\t childNodes: [],\r\n\t\t\t\t style: {},\r\n\t\t\t\t setAttribute: function setAttribute() {},\r\n\t\t\t\t getElementsByTagName: function getElementsByTagName() {\r\n\t\t\t\t return [];\r\n\t\t\t\t },\r\n\t\t\t\t };\r\n\t\t\t\t },\r\n\t\t\t\t location: { hash: '' },\r\n\t\t\t};\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tretValue.doc = document;\r\n\t\t}\r\n\t\tif(typeof window === 'undefined')\r\n\t\t{\r\n\t\t\tretValue.win = \r\n\t\t\t{\r\n\t\t\t\t\tdocument: retValue.doc,\r\n\t\t\t\t navigator: {\r\n\t\t\t\t userAgent: '',\r\n\t\t\t\t },\r\n\t\t\t\t location: {},\r\n\t\t\t\t history: {},\r\n\t\t\t\t CustomEvent: function CustomEvent() {\r\n\t\t\t\t return this;\r\n\t\t\t\t },\r\n\t\t\t\t addEventListener: function addEventListener() {},\r\n\t\t\t\t removeEventListener: function removeEventListener() {},\r\n\t\t\t\t getComputedStyle: function getComputedStyle() {\r\n\t\t\t\t return {\r\n\t\t\t\t getPropertyValue: function getPropertyValue() {\r\n\t\t\t\t return '';\r\n\t\t\t\t },\r\n\t\t\t\t };\r\n\t\t\t\t },\r\n\t\t\t\t Image: function Image() {},\r\n\t\t\t\t Date: function Date() {},\r\n\t\t\t\t screen: {},\r\n\t\t\t\t setTimeout: function setTimeout() {},\r\n\t\t\t\t clearTimeout: function clearTimeout() {},\r\n\t\t\t};\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tretValue.win = window;\r\n\t\t}\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getSupportedEvents = function ()\r\n\t{\r\n\t\tvar obj = this.getDomVariables();\r\n\t\tvar win = obj.win;\r\n\t\tvar doc = obj.doc;\r\n\t\tvar retValue = {};\r\n\t\tretValue.touch = (win.Modernizr && win.Modernizr.touch === true) || (!!((win.navigator.maxTouchPoints > 0) || ('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch)));\r\n\t\tretValue.pointerEvents = !!win.PointerEvent && ('maxTouchPoints' in win.navigator) && win.navigator.maxTouchPoints > 0;\r\n\t\tretValue.passiveListener = (function checkPassiveListener() {\r\n\t\t var supportsPassive = false;\r\n\t\t try {\r\n\t\t var opts = Object.defineProperty({}, 'passive', {\r\n\t\t // eslint-disable-next-line\r\n\t\t get: function get() {\r\n\t\t supportsPassive = true;\r\n\t\t },\r\n\t\t });\r\n\t\t win.addEventListener('testPassiveListener', null, opts);\r\n\t\t } catch (e) {\r\n\t\t // No support\r\n\t\t }\r\n\t\t return supportsPassive;\r\n\t }());\r\n\t\tretValue.gestures = 'ongesturestart' in win;\r\n\t\t\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isMobile = function(win)\r\n\t{\r\n\t\tvar win = this.getWin(win);\r\n\t\tvar userAgent = (win.navigator && win.navigator.userAgent) ? win.navigator.userAgent : null;\r\n\t\tvar objOS = {android:{pattern:\"Android\",flags:\"i\"} ,blackberry:{pattern:\"BlackBerry\",flags:\"i\"} ,ios:{pattern:\"iPhone|iPad|iPod\",flags:\"i\"} ,opera:{pattern:\"Opera Mini\",flags:\"i\"} ,windows:{pattern:\"IEMobile\",flags:\"i\"}};\r\n\t\tvar objRet = {};\r\n\t\tif(userAgent)\r\n\t\t{\r\n\t\t\tvar any = false;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var os in objOS)\r\n\t\t\t{\r\n\t\t\t\titem = objOS[os];\r\n\t\t\t\tobjRet[os] = userAgent.match(new RegExp(item.pattern,item.flags));\r\n\t\t\t\tif(objRet[os])\r\n\t\t\t\t{\r\n\t\t\t\t\tany = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tobjRet[\"any\"] = any;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(var os in objOS)\r\n\t\t\t{\r\n\t\t\t\tobjRet[os] = false;\r\n\t\t\t}\r\n\t\t\tobjRet[\"any\"] = false;\r\n\t\t}\r\n\t\treturn objRet;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getElement = function (element,doc)\r\n\t{\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\tif(this.isObject(element))\r\n\t\t\t{\r\n\t\t\t\treturn element;\r\n\t\t\t}\r\n\t\t\telse if(element.length > 0)\r\n\t\t\t{\r\n\t\t\t\tdoc = this.getDoc(doc);\r\n\t\t\t\treturn doc.getElementById(element);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getElementFromHtml = function (html)\r\n\t{\r\n\t\tif(html)\r\n\t\t{\r\n\t\t\tvar div = this.createDiv();\r\n\t\t\tdiv.innerHTML = html.toString();\r\n\t\t\tvar child = (div.firstChild !== div.lastChild || !div.firstChild) ? div : div.firstChild;\r\n\t\t\treturn child;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getReferenceFromHtml = function(html)\r\n\t{\r\n\t\tvar comp = this.getElementFromHtml(html);\r\n\t\tif(comp)\r\n\t\t{\r\n\t\t\tvar arrElement = comp.querySelectorAll(\"[ns-ref],[data-ns-ref]\");\r\n\t\t\tvar objRefs = {};\r\n\t\t\tvar ref = comp.getAttribute(\"ns-ref\") || comp.getAttribute(\"data-ns-ref\");\r\n\t\t\tif(ref)\r\n\t\t\t{\r\n\t\t\t\tobjRefs[ref] = comp;\r\n\t\t\t}\r\n\t\t\tif(arrElement && arrElement.length)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrElement.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar element = arrElement[count];\r\n\t\t\t\t\tref = element.getAttribute(\"ns-ref\") || element.getAttribute(\"data-ns-ref\");\r\n\t\t\t\t\tobjRefs[ref] = element;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn {element : comp,refs: objRefs};\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getWebComponentElement = function (element)\r\n\t{\r\n\t\tif(element && element[\"__impl4cf1e782hg__\"])\r\n\t\t{\r\n\t\t\treturn element[\"__impl4cf1e782hg__\"];\r\n\t\t}\r\n\t\treturn element;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.hasAttribute = function (element,attributeName)\r\n\t{\r\n\t\tif(element && attributeName && element[\"hasAttribute\"])\r\n\t\t{\r\n\t\t\treturn (element.hasAttribute(attributeName) || element.hasAttribute(\"data-\" + attributeName)); \r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getAttribute = function (element,attributeName)\r\n\t{\r\n\t\tif(element && attributeName && element[\"hasAttribute\"])\r\n\t\t{\r\n\t\t\treturn (element.hasAttribute(attributeName) ? element.getAttribute(attributeName) : element.getAttribute(\"data-\" + attributeName)); \r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.removeAttribute = function (element,attributeName)\r\n\t{\r\n\t\tif(element && attributeName && element[\"hasAttribute\"])\r\n\t\t{\r\n\t\t\treturn (element.hasAttribute(attributeName) ? element.removeAttribute(attributeName) : element.removeAttribute(\"data-\" + attributeName)); \r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.createDiv = function (id,styleName,doc)\r\n\t{\r\n\t var div = this.createElement(\"div\",id,styleName,doc);\r\n\t return div;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.createElement = function(type,id,styleName,doc)\r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t var element = doc.createElement(type);\r\n\t if(id)\r\n\t {\r\n\t \telement.setAttribute(\"id\",id);\r\n\t }\r\n\t if(styleName)\r\n\t {\r\n\t \telement.className = styleName; \r\n\t }\r\n\t return element;\r\n\t};\r\n\t\r\n\t//from JQuery\r\n\tNSUtil.prototype.isElementVisible = function(element)\r\n\t{\r\n\t\treturn !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length); \r\n\t};\r\n\t\r\n\tNSUtil.prototype.setDivVisibility = function (id,isVisible,doc)\r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t var div = doc.getElementById(id);\r\n\t if(div)\r\n\t {\r\n\t if(isVisible)\r\n\t {\r\n\t div.style.display = \"block\";\r\n\t }\r\n\t else\r\n\t {\r\n\t div.style.display = \"none\";\r\n\t }\r\n\t }\r\n\t};\r\n\t\r\n\tNSUtil.prototype.removeDiv = function (id,doc)\r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t var div = doc.getElementById(id);\r\n\t if (div)\r\n\t {\r\n\t var parent = div.parentNode;\r\n\t if(parent)\r\n\t {\r\n\t parent.removeChild(div);\r\n\t }\r\n\t }\r\n\t};\r\n\t\r\n\t/*Utility Methods */\r\n\tNSUtil.prototype.getKeys = function (object) \r\n\t{\r\n\t var keys = [];\r\n\t for (var property in object)\r\n\t {\r\n\t \tkeys.push(property);\r\n\t }\r\n\t return keys;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getValues = function (object)\r\n\t{\r\n\t\tvar values = [];\r\n\t\tfor (var property in object)\r\n\t\t{\r\n\t\t\tvalues.push(object[property]);\r\n\t\t}\r\n\t\treturn values;\r\n\t};\r\n\t\r\n\t//from https://stackoverflow.com/questions/201183/how-to-determine-equality-for-two-javascript-objects/16788517#16788517\r\n\t//used in frameworks wrapper\r\n\tNSUtil.prototype.isObjectEqual = function(origValue, newValue) \r\n\t{\r\n\t\tif (origValue === null || origValue === undefined || newValue === null || newValue === undefined) \r\n\t\t{ \r\n\t\t\treturn origValue === newValue; \r\n\t\t}\r\n\t\t// after this just checking type of one would be enough\r\n\t\tif (origValue.constructor !== newValue.constructor) \r\n\t\t{ \r\n\t\t\treturn false; \r\n\t\t}\r\n\t\t// if they are functions, they should exactly refer to same one (because of closures)\r\n\t\tif (origValue instanceof Function) \r\n\t\t{ \r\n\t\t\treturn origValue === newValue; \r\n\t\t}\r\n\t\t// if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES)\r\n\t\tif (origValue instanceof RegExp) \r\n\t\t{ \r\n\t\t\treturn origValue === newValue; \r\n\t\t}\r\n\t\tif (origValue === newValue || origValue.valueOf() === newValue.valueOf()) \r\n\t\t{ \r\n\t\t\treturn true; \r\n\t\t}\r\n\t\tif (Array.isArray(origValue) && origValue.length !== newValue.length) \r\n\t\t{ \r\n\t\t\treturn false; \r\n\t\t}\r\n\t\t// if they are dates, they must had equal valueOf\r\n\t\tif (origValue instanceof Date) \r\n\t\t{ \r\n\t\t\treturn false; \r\n\t\t}\r\n\t\t// if they are strictly equal, they both need to be object at least\r\n\t\tif (!(origValue instanceof Object)) \r\n\t\t{ \r\n\t\t\treturn false; \r\n\t\t}\r\n\t\tif (!(newValue instanceof Object)) \r\n\t\t{ \r\n\t\t\treturn false; \r\n\t\t}\r\n\t\t// recursive object equality check\r\n\t\tvar arrKeys = Object.keys(origValue);\r\n\t\tvar arrNewKeys = Object.keys(newValue);\r\n\t\tfor(count = 0,len = arrNewKeys,length;count < len;count++)\r\n\t\t{\r\n\t\t\tif(arrKeys.indexOf(count) !== -1)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tfor(innerCount = 0,len = arrKeys,length;innerCount < len;innerCount++)\r\n\t\t\t{\r\n\t\t\t\treturn this.isObjectEqual(origValue[innerCount], newValue[innerCount]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getValueByKeys = function(item,keyParam)\r\n\t{\r\n\t\tvar objReturn = {};\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\t(function flatObject(item, index)\r\n\t\t\t {\r\n\t\t\t\tvar toString = Object.prototype.toString;\r\n\t\t\t\tvar suffix = toString.call(item) == \"[object Array]\" ? \"]\" : \"\";\r\n\t\t\t\tfor(var key in item)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!item.hasOwnProperty(key))continue;\r\n\t\t\t\t\tobjReturn[index+key+suffix] = item[key];\r\n\t\t\t\t\tif( toString.call(item[key]) == \"[object Array]\" )flatObject(item[key],index+key+suffix+\"[\");\r\n\t\t\t\t\tif( toString.call(item[key]) == \"[object Object]\" )flatObject(item[key],index+key+suffix+\".\"); \r\n\t\t\t\t}\r\n\t\t\t })(item,\"\");\r\n\t\t}\r\n\t\treturn objReturn[keyParam];\r\n\t};\r\n\t\r\n\t//arrIgnoreDeepCopy in case there is a circular reference in Hierarchical structure like in NSNavigation\r\n\tNSUtil.prototype.cloneObject = function(objSource,deepCopy,arrIgnoreKeys,arrIgnoreDeepCopy) \r\n\t{\r\n\t\tif(!arrIgnoreKeys)\r\n\t\t{\r\n\t\t\tarrIgnoreKeys = [];\r\n\t\t}\r\n\t\tif(!arrIgnoreDeepCopy)\r\n\t\t{\r\n\t\t\tarrIgnoreDeepCopy = [];\r\n\t\t}\r\n\t\tif(!objSource || typeof objSource != \"object\" || Object.prototype.toString.call(objSource) === \"[object Function]\")\r\n\t\t{\r\n\t\t\t// null, undefined, any non-object, or function\r\n\t\t\treturn objSource;\t// anything\r\n\t\t}\r\n\t\tif(objSource.nodeType && \"cloneNode\" in objSource)\r\n\t\t{\r\n\t\t\t// DOM Node\r\n\t\t\treturn objSource.cloneNode(true); // Node\r\n\t\t}\r\n\t\tif(objSource instanceof Date)\r\n\t\t{\r\n\t\t\t// Date\r\n\t\t\treturn new Date(objSource.getTime());\t// Date\r\n\t\t}\r\n\t\tif(objSource instanceof RegExp)\r\n\t\t{\r\n\t\t\t// RegExp\r\n\t\t\treturn new RegExp(objSource); // RegExp\r\n\t\t}\r\n\t\tif(objSource instanceof Array)\r\n\t\t{\r\n\t\t\tvar arrClone = [];\r\n\t\t\tvar length = objSource.length;\r\n\t\t for (var count = 0; count < length; count++) \r\n\t\t {\r\n\t\t var item = objSource[count];\r\n\t\t var obj = this.cloneObject(item,deepCopy,arrIgnoreKeys,arrIgnoreDeepCopy);\r\n\t\t arrClone.push(obj);\r\n\t\t }\r\n\t\t return arrClone;\r\n\t\t}\r\n\t\t// we don't clone functions for performance reasons\r\n\t\t//\t\t}else if(d.isFunction(objSource)){\r\n\t\t//\t\t\t// function\r\n\t\t//\t\t\tr = function(){ return objSource.apply(this, arguments); };\r\n\t\t// generic objects\r\n\t\tvar objClone = {};\r\n\t\tvar clonedItem = null;\r\n\t\tfor (var key in objSource) \r\n\t\t{\r\n\t\t\tvar isClone = true;\r\n\t\t\tfor (var count = 0; count < arrIgnoreKeys.length; count++) \r\n\t\t {\r\n\t\t\t\tif(arrIgnoreKeys[count] == key)\r\n\t\t\t\t{\r\n\t\t\t\t\tisClone = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t }\r\n\t\t\tif(isClone)\r\n\t\t\t{\r\n\t\t\t\tif(deepCopy)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar isIgnoreDeepCopy = false;\r\n\t\t\t\t\tfor (var ignoreDeepCount = 0; ignoreDeepCount < arrIgnoreDeepCopy.length; ignoreDeepCount++) \r\n\t\t\t\t {\r\n\t\t\t\t\t\tif(arrIgnoreDeepCopy[ignoreDeepCount] == key)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tisIgnoreDeepCopy = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t }\r\n\t\t\t\t\tclonedItem = isIgnoreDeepCopy ? objSource[key] : this.cloneObject(objSource[key],deepCopy,arrIgnoreKeys,arrIgnoreDeepCopy);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tclonedItem = objSource[key];\r\n\t\t\t\t}\r\n\t\t\t\tobjClone[key] = clonedItem;\r\n\t\t\t}\r\n\t }\r\n\t\treturn objClone;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.copyElement = function(sourceElement,destinationElement)\r\n\t{\r\n\t\tif(sourceElement)\r\n\t\t{\r\n\t\t\tif(destinationElement)\r\n\t\t\t{\r\n\t\t\t\tdestinationElement.innerHTML = sourceElement.innerHTML;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdestinationElement = sourceElement.cloneNode(true);\r\n\t\t\t}\r\n\t\t\tfor (var count = 0; count < sourceElement.attributes.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar attr = sourceElement.attributes.item(count);\r\n\t\t\t\tdestinationElement.setAttribute(attr.nodeName, attr.nodeValue);\r\n\t\t\t}\r\n\t\t\t//destinationElement.style.cssText = sourceElement.style.cssText;\r\n\t\t}\r\n\t\treturn destinationElement;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.swapArrayItems = function(arrInput,indFirst,indSecond) \r\n\t{\r\n\t\tif(arrInput && arrInput.length > indFirst && arrInput.length > indSecond)\r\n\t\t{\r\n\t\t\tvar objTemp = arrInput[indFirst];\r\n\t\t\tarrInput[indFirst] = arrInput[indSecond];\r\n\t\t\tarrInput[indSecond] = objTemp;\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.moveArrayItem = function(arrInput,sourceIndex,destinationIndex) \r\n\t{\r\n\t\tif(arrInput && arrInput.length > destinationIndex && arrInput.length > sourceIndex && destinationIndex > -1 && sourceIndex > -1)\r\n\t\t{\r\n\t\t\t// Remove the element from the array\r\n\t\t\tvar removedElement = arrInput.splice(sourceIndex, 1)[0];\r\n\t\t\t// At destinationIndex, remove 0 elements, insert the removedElement\r\n\t\t\tarrInput.splice(destinationIndex, 0,removedElement);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isObject = function (refObject)\r\n\t{\r\n\t\tif (typeof refObject === 'object' && refObject !== null) \r\n\t\t{\r\n\t\t return true;\r\n\t\t} \r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isTextNode = function (element)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\treturn (element && \"nodeType\" in element && element.nodeType === Node.TEXT_NODE);\r\n\t\t}\r\n\t catch(err)\r\n\t {\r\n\t \treturn false;\r\n\t }\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElement = function (element)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\treturn (element && \"nodeType\" in element && element.nodeType === Node.ELEMENT_NODE);\r\n\t\t}\r\n\t catch(err)\r\n\t {\r\n\t \treturn false;\r\n\t }\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementOfType = function (element,tagName)\r\n\t{\r\n\t\tif(element && tagName)\r\n\t {\r\n\t if(element.tagName && element.tagName.toLowerCase() === tagName.toLowerCase())\r\n\t {\r\n\t \treturn true;\r\n\t }\r\n\t }\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isArray = function (refArr) \r\n\t{\r\n\t return refArr != null && typeof refArr == \"object\" &&\r\n\t \"splice\" in refArr && \"join\" in refArr;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isVariable = function (variableName,context) \r\n\t{\r\n\t\tcontext = this.getWin(context);\r\n\t\treturn !this.isUndefined(context[variableName]); \r\n\t};\r\n\t\r\n\t//after\r\n\tNSUtil.prototype.insertAfterElement = function(referenceElement,insertElement) \r\n\t{\r\n\t\tif(referenceElement && insertElement)\r\n\t\t{\r\n\t\t\tvar parentElement = this.getWebComponentElement(referenceElement.parentNode);\r\n\t\t\tif(parentElement)\r\n\t\t\t{\r\n\t\t\t\treferenceElement = this.getWebComponentElement(referenceElement);\r\n\t\t\t\tinsertElement = this.getWebComponentElement(insertElement);\r\n\t\t\t\tif (parentElement.lastChild === referenceElement) \r\n\t\t\t\t{\r\n\t\t\t\t\tparentElement.appendChild(insertElement);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tparentElement.insertBefore(insertElement,referenceElement.nextSibling);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSUtil.prototype.insertElementAtIndex = function(parent,element,index)\r\n\t{\r\n\t\tif (!index)\r\n\t\t{\r\n\t\t\tindex = 0;\r\n\t\t}\r\n\t\tif (index >= parent.children.length) \r\n\t\t{\r\n\t\t\tparent.appendChild(element);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tparent.insertBefore(element,parent.children[index]);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSUtil.prototype.swapElements = function(element1,element2)\r\n\t{\r\n\t\tif(element1 && element2)\r\n\t\t{\r\n\t\t\tvar parent2 = element2.parentNode;\r\n\t\t var next2 = element2.nextSibling;\r\n\t\t // special case for element1 is the next sibling of element2\r\n\t\t if (next2 === element1) \r\n\t\t {\r\n\t\t // just put element1 before element2\r\n\t\t parent2.insertBefore(element1, element2);\r\n\t\t } \r\n\t\t else \r\n\t\t {\r\n\t\t // insert element2 right before element1\r\n\t\t element1.parentNode.insertBefore(element2, element1);\r\n\t\t // now insert element1 where element2 was\r\n\t\t if (next2) \r\n\t\t {\r\n\t\t // if there was an element after element2, then insert element1 right before that\r\n\t\t parent2.insertBefore(element1, next2);\r\n\t\t } \r\n\t\t else \r\n\t\t {\r\n\t\t // otherwise, just append as last child\r\n\t\t parent2.appendChild(element1);\r\n\t\t }\r\n\t\t }\r\n\t\t}\r\n\t};\r\n\t\r\n\t//replace\r\n\tNSUtil.prototype.replaceElement = function(element,newElement,copyAttributes,moveContent,doc)\r\n\t{\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\tmoveContent = this.isUndefinedOrNull(moveContent) ? true : Boolean.parse(moveContent);\r\n\t\t\tnewElement = this.isString(newElement) ? this.createElement(newElement,null,null,doc) : newElement;\r\n\t\t\tif(moveContent) \r\n\t\t\t{\r\n\t\t\t\twhile(element.firstChild) \r\n\t\t\t\t{\r\n\t\t\t\t\tnewElement.appendChild(element.firstChild);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(copyAttributes && element.hasAttributes()) \r\n\t\t\t{\r\n\t\t\t\tvar attrs = element.attributes;\r\n\t\t\t for(var count = attrs.length - 1;count >= 0;count--) \r\n\t\t\t {\r\n\t\t\t \tnewElement.setAttribute(attrs[count].name, attrs[count].value);\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t\tif(element.parentNode) \r\n\t\t\t{\r\n\t\t\t\telement.parentNode.replaceChild(newElement,element);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn newElement;\r\n\t};\r\n\t\r\n\t//unwrap\r\n\tNSUtil.prototype.insertElementParentsParent = function(element)\r\n\t{\r\n\t\tif(element && element.parentNode)\r\n\t\t{\r\n\t\t\tvar parent = element.parentNode;\r\n\t\t\twhile (element.firstChild) \r\n {\r\n parent.insertBefore(element.firstChild,element);\r\n }\r\n\t\t\tif(element.parentNode)\r\n\t\t\t{\r\n\t\t\t\telement.parentNode.removeChild(element);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getFunction = function (functionInstance,context)\r\n\t{\r\n\t\tif(functionInstance)\r\n\t\t{\r\n\t\t\tcontext = this.getWin(context);\r\n\t\t\tif (typeof functionInstance === \"string\" || functionInstance instanceof String)\r\n\t\t\t{\r\n\t\t\t\tif(this.isFunction(functionInstance))\r\n\t\t\t\t{\r\n\t\t\t\t\tfunctionInstance = context[functionInstance];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn functionInstance;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.callFunction = function (functionName,context) \r\n\t{\r\n\t\tvar returnValue = null;\r\n\t\tcontext = this.getWin(context);\r\n\t\tif (typeof context[functionName] === \"function\") \r\n\t\t{\r\n\t\t\treturnValue = context[functionName]();\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.callFunctionFromString = function (functionString,replaceParameterFunction,context)\r\n\t{\r\n\t\tvar returnValue = null;\r\n\t\tif(functionString)\r\n\t\t{\r\n\t\t\tcontext = this.getWin(context);\r\n\t\t\tvar functionName = null;\r\n\t\t\tvar arrParameter = null;\r\n\t\t\tif(functionString.indexOf(\"(\") > -1)\r\n\t\t\t{\r\n\t\t\t\tvar param = functionString.split(\"(\");\r\n\t\t\t\tif(param && param.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tfunctionName = param[0];\r\n\t\t\t\t\tvar parameter = param[1];\r\n\t\t\t\t\tif(parameter && parameter.charAt(parameter.length - 1) === \")\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tparameter = parameter.substring(0,parameter.length - 1);\r\n\t\t\t\t\t\tvar arrParam = parameter.split(\",\");\r\n\t\t\t\t\t\tif(arrParam && arrParam.length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrParameter = arrParam;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfunctionName = functionString;\r\n\t\t\t}\r\n\t\t\tif(this.isFunction(functionName))\r\n\t\t\t{\r\n\t\t\t\tif(!arrParameter || arrParameter.length === 0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturnValue = this.callFunction(functionName);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(replaceParameterFunction)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor(var count = 0;count < arrParameter.length;count++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t var newValue = replaceParameterFunction(arrParameter[count]);\r\n\t\t\t\t\t\t\t if(!this.isUndefined(newValue))\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t arrParameter[count] = newValue;\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tswitch (arrParameter.length) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t case 1:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 2:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 3:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 4:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 5:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 6:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4],arrParameter[5]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 7:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4],arrParameter[5],arrParameter[6]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 8:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4],arrParameter[5],arrParameter[6],arrParameter[7]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 9:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4],arrParameter[5],arrParameter[6],arrParameter[7],arrParameter[8]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t case 10:\r\n\t\t\t\t\t \treturnValue = context[functionName](arrParameter[0],arrParameter[1],arrParameter[2],arrParameter[3],arrParameter[4],arrParameter[5],arrParameter[6],arrParameter[7],arrParameter[8],arrParameter[9]);\r\n\t\t\t\t\t break;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.callFunctionOfObject = function (obj,functionName,...args) \r\n\t{\r\n\t\tvar returnValue = null;\r\n\t\tif(obj) \r\n\t\t{\r\n\t\t\tif (typeof obj[functionName] === \"function\") \r\n\t\t\t{\r\n\t\t\t\treturnValue = obj[functionName](args);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t \tconsole.log(functionName + \" does not exist or is not a function.\");\r\n\t \t}\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementInDOM = function(node,doc) \r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t\treturn (node === doc.body) ? false : doc.body.contains(node);\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementInParent = function(node,parent) \r\n\t{\r\n\t\tif(node && parent)\r\n\t\t{\r\n\t\t\twhile (node.parentNode) \r\n\t\t\t{\r\n\t if (node.parentNode === parent) \r\n\t {\r\n\t return true;\r\n\t }\r\n\t node = node.parentNode;\r\n\t }\r\n\t\t}\r\n return false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementInOrParent = function(node,parent,onlyContains) \r\n\t{\r\n\t\tif(node && parent)\r\n\t\t{\r\n\t\t\tonlyContains = Boolean.parse(onlyContains);\r\n\t\t\treturn ((node === parent && !onlyContains) || this.isElementInParent(node,parent));\r\n\t\t}\r\n return false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementInView = function(element,parent,doc) \r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t\tvar rect = element.getBoundingClientRect();\r\n\t\tvar elem = element;\r\n\t var top = rect.top;\r\n\t var height = rect.height;\r\n\t do \r\n\t {\r\n\t if (elem && elem.parentNode) \r\n\t {\r\n\t elem = elem.parentNode;\r\n\t rect = elem.getBoundingClientRect();\r\n\t if (!(top <= rect.bottom)) \r\n\t {\r\n\t return false;\r\n\t }\r\n\t if (top + height <= rect.top) \r\n\t {\r\n\t return false;\r\n\t }\r\n\t }\r\n\t } \r\n\t while (elem && elem !== parent && elem.parentNode);\r\n\t var retValue = (top <= ((doc.documentElement && doc.documentElement.clientHeight) || 0));\r\n\t return retValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.scrollIntoView = function(element,parent,doc) \r\n\t{\r\n\t\tif(!this.isElementInView(element,parent,doc))\r\n\t\t{\r\n\t\t\tif (parent.clientHeight !== parent.scrollHeight) \r\n\t\t\t{\r\n\t\t\t\tparent.scrollTop = element.offsetTop;\r\n\t }\r\n\t if (!this.isElementInView(element, parent, doc)) \r\n\t {\r\n\t \telement.scrollIntoView();\r\n\t }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isElementVisible = function(element,win) \r\n\t{\r\n\t\t if(element)\r\n\t\t {\r\n\t\t\t if(!element.offsetParent)\r\n\t\t\t {\r\n\t\t\t\t return false;\r\n\t\t\t }\r\n\t\t\t win = this.getWin(win);\r\n\t\t\t var style = win.getComputedStyle(element);\r\n\t\t\t if(style.display === \"none\" || style.visibility === \"hidden\")\r\n\t\t\t {\r\n\t\t\t\t return false;\r\n\t\t\t }\r\n\t\t }\r\n\t\t return true;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isFunction = function(refFunction,context) \r\n\t{\r\n\t\tcontext = this.getWin(context);\r\n\t if(refFunction && ((typeof refFunction == \"function\") || (typeof context[refFunction] === \"function\")))\r\n\t {\r\n\t \treturn true;\r\n\t }\r\n\t return false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isString = function(object) \r\n\t{\r\n\t return typeof object == \"string\";\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isNumber = function(object) \r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(typeof object == \"number\")\r\n\t\t {\r\n\t\t \treturn true;\r\n\t\t }\r\n\t\t var regex = /^([+\\-])?[0-9]+(\\.?)([0-9]+)?(e[0-9]+)?$/;\r\n\t\t if (!object.match(regex)) \r\n\t\t {\r\n\t return false;\r\n\t }\r\n\t value = parseFloat(object);\r\n\t return !isNaN(value) && isFinite(value);\r\n\t\t}\r\n\t catch(error)\r\n\t {\r\n\t \t\r\n\t }\r\n\t return false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isBoolean = function(object) \r\n\t{\r\n\t return typeof object == \"boolean\";\r\n\t};\r\n\t \r\n\tNSUtil.prototype.isUndefined = function(object) \r\n\t{\r\n\t return typeof object == \"undefined\";\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isUndefinedOrNull = function(object) \r\n\t{\r\n\t return (this.isUndefined(object) || object === null);\r\n\t};\r\n\t\r\n\tNSUtil.prototype.isStringValid = function(objString) \r\n\t{\r\n\t if(!objString || objString === \"\")\r\n\t {\r\n\t \treturn false;\r\n\t }\r\n\t return true;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.toCamelCase = function(objString,isFirstLetterCapital) \r\n\t{\r\n\t\tif(this.isString(objString))\r\n\t\t{\r\n\t\t\treturn ((isFirstLetterCapital ? \"-\" : \"\") + objString).replace(/-+([^-])/g, function(str, char) \r\n\t\t\t\t\t{\r\n\t\t\t \t\treturn char.toUpperCase();\r\n\t\t\t\t\t});\r\n\t\t}\r\n\t\treturn objString;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.fromCamelCase = function(objString) \r\n\t{\r\n\t\tif(this.isString(objString))\r\n\t\t{\r\n\t\t\treturn objString.replace(/([A-Z]+)/g, function(match,letter) \r\n\t\t\t{\r\n\t\t return '-' + letter.toLowerCase();\r\n\t\t });\r\n\t\t}\r\n\t\treturn objString;\r\n\t};\r\n\t\r\n\t//\"thisIsATest\" --> \"this-is-a-test\"\r\n\tNSUtil.prototype.toKebabCase = function(objString) \r\n\t{\r\n\t\tif(this.isString(objString))\r\n\t\t{\r\n\t\t\tobjString.replace(/([A-Z])([A-Z])([a-z])/g, '$1-$2$3')\r\n\t\t\t\t\t .replace(/([a-z])([A-Z])/g, '$1-$2')\r\n\t\t\t\t\t .replace(/[\\s_]+/g, '-')\r\n\t\t\t\t\t .toLowerCase();\r\n\t\t}\r\n\t\treturn objString;\r\n\t};\r\n\t\r\n\t\r\n\t\r\n\t/*\r\n\t * 1001 - function validation failure\r\n\t * 1002 - function return Parameter is not valid\r\n\t */\r\n\tNSUtil.prototype.throwException = function (exceptionCode,exceptionName,exceptionDetails)\r\n\t{\r\n\t\tfunction nsException() \r\n\t\t{\r\n\t\t\t this.code = exceptionCode;\r\n\t\t\t this.name = exceptionName;\r\n\t\t\t this.details = exceptionDetails;\r\n\t\t\t this.toString = function() \r\n\t\t\t {\r\n\t\t\t return \"Exception Occured with Code::\" + this.code + \" and Details \" + this.name + \"::\" + this.details;\r\n\t\t\t };\r\n\t\t}\r\n\t //alert(\"Error Occured with details code: \" + exceptionCode + \",name: \" + exceptionName + \",details: \" + exceptionDetails);\r\n\t throw new nsException();\r\n\t};\r\n\t\r\n\t//other values of navigator.appName is \"Netscape\",\"Opera\"\r\n\t//From IE 11 navigator.appName returns \"Netscape\" instead of \"Microsoft Internet Explorer\"\r\n\t//and From IE 11 it follows standard API.\r\n\tNSUtil.prototype.isBrowserIE = function ()\r\n\t{\r\n\t if(navigator && ((navigator.appName && navigator.appName == \"Microsoft Internet Explorer\") || (navigator.userAgent && navigator.userAgent.match(/Trident/))))\r\n\t {\r\n\t return true;\r\n\t }\r\n\t return false;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getBrowser = function(win)\r\n\t{\r\n\t\twin = this.getWin(win);\r\n\t\tvar objBrowser = {code:null,name:null,version:null,appName:null,appCodeName:null,platform:null,\r\n\t\t\t\t\t\t isChrome:false,isFirefox:false,isOpera:false,isIE:false,isMSIE:false,isSafari:false};\r\n\t\tvar userAgent = win.navigator.userAgent;\r\n\t\tif(userAgent.indexOf(\"Chrome\") != -1) \r\n\t\t{\r\n\t\t\tobjBrowser.code = \"chrome\";\r\n\t\t\tobjBrowser.name = \"Google Chrome\";\r\n\t\t\tobjBrowser.isChrome = true;\r\n\t\t} \r\n\t\telse if(userAgent.indexOf(\"Firefox\") != -1) \r\n\t\t{\r\n\t\t\tobjBrowser.code = \"firefox\";\r\n\t\t\tobjBrowser.name = \"Mozilla Firefox\";\r\n\t\t\tobjBrowser.isFirefox = true;\r\n\t\t} \r\n\t\telse if(userAgent.indexOf(\"Opera\")!=-1) \r\n\t\t{\r\n\t\t\tobjBrowser.code = \"opera\";\r\n\t\t\tobjBrowser.name = \"Opera\";\r\n\t\t\tobjBrowser.isOpera = true;\r\n\t\t}\r\n\t\t//for IE version 6 to 11\r\n\t\telse if(userAgent.indexOf('MSIE')!=-1 || navigator.userAgent.indexOf('Trident') > -1)\r\n\t\t{\r\n\t\t\tobjBrowser.code = \"ie\";\r\n\t\t\tobjBrowser.name = \"Internet Explorer\";\r\n\t\t\tobjBrowser.isIE = true;\r\n\t\t\tobjBrowser.isMSIE = true;\r\n\t\t}\r\n\t\t//for IE 12\r\n\t\telse if(/x64|x32/ig.test(userAgent))\r\n\t\t{\r\n\t\t\tobjBrowser.code = \"ie\";\r\n\t\t\tobjBrowser.name = \"Internet Explorer 12\";\r\n\t\t\tobjBrowser.isIE = true;\r\n\t\t\tobjBrowser.isMSIE = false;\r\n\t\t}\r\n\t\telse if (userAgent.indexOf(\"Safari\")!=-1) \r\n\t\t{\r\n\t\t\tobjBrowser.code = \"safari\";\r\n\t\t\tobjBrowser.name = \"Safari\";\r\n\t\t\tobjBrowser.isSafari = true;\r\n\t\t} \r\n\t\telse \r\n\t\t{\r\n\t\t\tobjBrowser.code = \"-1\";\r\n\t\t\tobjBrowser.name = \"Unknown Browser\";\r\n\t\t}\r\n\t\tobjBrowser.version = navigator.appVersion;\r\n\t\tobjBrowser.appName = navigator.appName;\r\n\t\tobjBrowser.appCodeName = navigator.appCodeName;\r\n\t\tobjBrowser.platform = navigator.platform;\r\n\t\t\r\n\t\treturn objBrowser;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.findParentBySelector = function (element,parentSelector,doc)\r\n\t{\r\n\t if(element && parentSelector)\r\n\t {\r\n\t \tvar matchesFn = null;\r\n\t \tvar parent = null;\r\n\t \tdoc = this.getDoc(doc);\r\n\t \t['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'].some(function(callback) \r\n\t \t{\r\n\t if (typeof doc.body[callback] == 'function') \r\n\t {\r\n\t matchesFn = callback;\r\n\t return true;\r\n\t }\r\n\t return false;\r\n\t });\r\n\t\r\n\t // traverse parents\r\n\t while (element) \r\n\t {\r\n\t parent = element.parentElement;\r\n\t if (parent && parent[matchesFn](parentSelector)) \r\n\t {\r\n\t return parent;\r\n\t }\r\n\t element = parent;\r\n\t }\r\n\t }\r\n\t return null;\r\n\t};\r\n\t\r\n\t//navigates to the DOM Heirarchy to find the nearest parent of the specified HTML tag \r\n\tNSUtil.prototype.findParent = function (element,param,querySelector,till)\r\n\t{\r\n\t\tvar retElement = null;\r\n\t if(element)\r\n\t {\r\n\t \tvar obj = this.getDomVariables();\r\n\t \ttill = till ? till : obj.doc.body;\r\n\t \tif(param)\r\n\t \t{\r\n\t \t\tif(this.isString(param))\r\n\t \t\t{\r\n\t \t\t\twhile(element) \r\n\t\t \t\t{\r\n\t\t \t\t\tif(element.tagName && element.tagName.toLowerCase() == param.toLowerCase()) \r\n\t\t \t\t\t{\r\n\t\t \t\t\t\tretElement = element;\r\n\t\t \t\t\t break;\r\n\t\t \t\t\t}\r\n\t\t \t\t\telement = element.parentElement;\r\n\t\t \t\t}\r\n\t \t\t}\r\n\t \t\telse if(this.isFunction(param))\r\n\t \t\t{\r\n\t \t\t\tvar start = element;\r\n\t \t\t\tdo\r\n\t\t \t\t{\r\n\t \t if (param(start)) \r\n\t \t {\r\n\t \t return start;\r\n\t \t }\r\n\t \t if (start == till || !start.parentNode) \r\n\t \t {\r\n\t \t break;\r\n\t \t }\r\n\t \t start = start.parentNode;\r\n\t \t } \r\n\t \t\t\twhile (start && start !== till);\r\n\t \t\t}\r\n\t \t}\r\n\t \telse if(querySelector)\r\n\t \t{\r\n\t \t\twhile(element) \r\n\t \t\t{\r\n\t \t\t\tif(element.matches(querySelector)) \r\n\t \t\t\t{\r\n\t \t\t\t\tretElement = element;\r\n\t \t\t\t break;\r\n\t \t\t\t}\r\n\t \t\t\telement = element.parentElement;\r\n\t \t\t}\r\n\t \t}\r\n\t }\r\n\t return retElement;\r\n\t};\r\n\t\r\n\t//up\r\n\tNSUtil.prototype.findParentByCallback = function(element,callback,root)\r\n\t{\r\n\t\tif (!element || !this.isElementInOrParent(element,root)) \r\n\t\t{\r\n return null;\r\n }\r\n\t\tvar start = element;\r\n do \r\n {\r\n if (callback && callback(start)) \r\n {\r\n return start;\r\n }\r\n if (start === root || !start.parentNode) \r\n {\r\n break;\r\n }\r\n start = start.parentNode;\r\n } \r\n while(start && start !== root);\r\n return null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.findChild = function (element,childTag)\r\n\t{\r\n\t if(element && childTag && element.getElementsByTagName(childTag).length > 0)\r\n\t {\r\n\t return element.getElementsByTagName(childTag)[0];\r\n\t } \r\n\t return null;\r\n\t};\r\n\t\t\r\n\t//prev\r\n\tNSUtil.prototype.findPrevNode = function(node,callback,root,withChild) \r\n\t{\r\n\t\twithChild = this.isUndefinedOrNull(withChild) ? true : Boolean.parse(withChild);\r\n return this.findNode(node,callback,root,false,\"previousSibling\",withChild ? \"lastChild\" : null);\r\n };\r\n \r\n //next\r\n NSUtil.prototype.findNextNode = function(node,callback,root,withChild) \r\n {\r\n \twithChild = this.isUndefinedOrNull(withChild) ? true : Boolean.parse(withChild);\r\n return this.findNode(node,callback,root,null,null,withChild ? \"firstChild\" : \"\");\r\n };\r\n\t\r\n\t//find\r\n\tNSUtil.prototype.findNode = function(node,callback,root,recursive,siblingProperty,childProperty) \r\n\t{\r\n\t\trecursive = Boolean.parse(recursive);\r\n\t\tsiblingProperty = this.isUndefinedOrNull(siblingProperty) ? \"nextSibling\" : siblingProperty;\r\n\t\tchildProperty = this.isUndefinedOrNull(childProperty) ? \"firstChild\" : childProperty;\r\n if (recursive && callback(node)) \r\n {\r\n return node;\r\n }\r\n var start = node;\r\n var next = null;\r\n do \r\n {\r\n next = start[siblingProperty];\r\n if (callback(next)) \r\n {\r\n return next ? next : null;\r\n }\r\n if (childProperty && next && next[childProperty]) \r\n {\r\n var nextOne = this.findNode(next[childProperty],callback,next,true,siblingProperty,childProperty);\r\n if (nextOne) \r\n {\r\n return nextOne;\r\n }\r\n }\r\n if(!next) \r\n {\r\n next = start.parentNode;\r\n }\r\n start = next;\r\n } \r\n while (start && start !== root);\r\n return null;\r\n };\r\n \r\n //findWithCurrent\r\n\tNSUtil.prototype.findNodeWithCurrent = function(node,callback,root,siblingProperty,childProperty) \r\n\t{\r\n\t\tsiblingProperty = this.isUndefinedOrNull(siblingProperty) ? \"nextSibling\" : siblingProperty;\r\n\t\tchildProperty = this.isUndefinedOrNull(childProperty) ? \"firstChild\" : childProperty;\r\n var next = node;\r\n do \r\n {\r\n \tif (callback(next)) \r\n {\r\n return next || null;\r\n }\r\n if (childProperty && next && next[childProperty]) \r\n {\r\n var nextOne = this.findNodeWithCurrent(next[childProperty],callback,next,siblingProperty,childProperty);\r\n if (nextOne) \r\n {\r\n return nextOne;\r\n }\r\n }\r\n while (next && !next[siblingProperty] && next != root) \r\n {\r\n\t\t\t\tnext = next.parentNode;\r\n\t\t\t}\r\n\t\t\tif (next && next[siblingProperty] && next != root) \r\n\t\t\t{\r\n\t\t\t\tnext = next[siblingProperty];\r\n\t\t\t}\r\n } \r\n while (next && next != root);\r\n return null;\r\n };\r\n \r\n //each\r\n //It goes through all the children of the node calling a callback function\r\n NSUtil.prototype.loopAllChildren = function (element,callback) \r\n {\r\n var node = element.firstChild;\r\n if (node) \r\n {\r\n while (node) \r\n {\r\n var next = this.findNextNode(node,Boolean,element);\r\n var value = callback(node);\r\n if(value == false) \r\n {\r\n return false;\r\n }\r\n // in case node is removed inside callback\r\n if(node.parentNode) \r\n {\r\n \tvalue = this.loopAllChildren(node,callback);\r\n if(!value)\r\n {\r\n \treturn false;\r\n }\r\n }\r\n node = next;\r\n }\r\n }\r\n return true;\r\n };\r\n \r\n\tNSUtil.prototype.getZIndex = function (element,doc) \r\n\t{\r\n\t\tdoc = this.getDoc(doc);\r\n\t var zIndex = doc.defaultView.getComputedStyle(element).getPropertyValue(\"z-index\");\r\n\t if(element.tagName !== \"BODY\" && element.tagName !== \"HTML\" && isNaN(zIndex)) \r\n\t {\r\n\t \treturn this.getZIndex(element.parentNode);\r\n\t }\r\n\t else \r\n\t {\r\n\t \treturn zIndex; \r\n\t }\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getStyleValue = function(element,styleProperty,getOrignalValue,getOnlyNumber,win)\r\n\t{\r\n\t\twin = this.getWin(win);\r\n\t\tvar propertyValue = null;\r\n\t\tif(element && styleProperty && this.isElement(element))\r\n\t\t{\r\n\t\t\telement = this.getElement(element);\r\n\t\t\tgetOrignalValue = this.isUndefined(getOrignalValue) ? true : getOrignalValue;\r\n\t\t\tvar getValue = function(styleProp)\r\n\t\t\t{\r\n\t\t\t\tvar retValue = null;\r\n\t\t\t\tif(element.style && element.style[styleProp])\r\n\t\t\t {\r\n\t\t\t\t\tretValue = element.style[styleProp];\r\n\t\t\t }\r\n\t\t\t\telse if(win.getComputedStyle)\r\n\t\t\t\t{\r\n\t\t\t\t\tretValue = win.getComputedStyle(element, null).getPropertyValue(styleProp);\r\n\t\t\t\t}\r\n\t\t\t\treturn retValue;\r\n\t\t\t};\r\n\t\t\tif(styleProperty === \"display\")\r\n\t\t\t{\r\n\t\t\t\tpropertyValue = getValue(styleProperty);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar displayValue = null;\r\n\t\t\t\tvar setStyleValue = false;\r\n\t\t\t\tif(getOrignalValue)\r\n\t\t\t\t{\r\n\t\t\t\t\tdisplayValue = getValue(\"display\");\r\n\t\t\t\t\tif(element.style.display)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetStyleValue = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telement.style.display = \"none\";\r\n\t\t\t\t}\r\n\t\t\t\tpropertyValue = getValue(styleProperty);\r\n\t\t\t\tif(getOrignalValue)\r\n\t\t\t\t{\r\n\t\t\t\t\telement.style.display = (displayValue && setStyleValue) ? displayValue: \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(getOnlyNumber && !this.isUndefinedOrNull(propertyValue))\r\n\t\t\t{\r\n\t\t\t\tvar numberFieldsReg = /^left|top|bottom|right|width|min|max|height|margin|padding|font-size/i;\r\n\t\t\t\tif (numberFieldsReg.test(styleProperty) && /^[\\-+]?[0-9.]+px$/.test(propertyValue.toString())) \r\n\t\t\t\t{\r\n\t\t\t\t\tpropertyValue = parseInt(propertyValue.toString(), 10);\r\n\t\t\t\t\tpropertyValue = this.isNumber(propertyValue) ? +propertyValue : propertyValue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t }\r\n\t\t return propertyValue;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.getControlValue = function(control)\r\n\t{\r\n\t\tif(control)\r\n\t\t{\r\n\t\t\t if(control.tagName == \"INPUT\") \r\n\t\t\t {\r\n\t if(control.type == \"text\") \r\n\t {\r\n\t \treturn control.value;\r\n\t }\r\n\t if(control.type == \"checkbox\") \r\n\t {\r\n\t \treturn control.checked;\r\n\t }\r\n\t if(control.type == \"radio\") \r\n\t {\r\n\t \treturn control.checked;\r\n\t }\r\n\t } \r\n\t if(control.tagName == \"SELECT\") \r\n\t {\r\n\t \t return control.value;\r\n\t }\r\n\t if(control.tagName == \"TEXTAREA\") \r\n\t {\r\n\t \t return control.value;\r\n\t }\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSUtil.prototype.setControlValue = function(control,value)\r\n\t{\r\n\t\tvar retValue = null;\r\n\t\tif(control)\r\n\t\t{\r\n\t\t\t if(control.tagName == \"INPUT\") \r\n\t\t\t {\r\n\t if(control.type == \"text\") \r\n\t {\r\n\t \tretValue = value;\r\n\t \tcontrol.value = value;\r\n\t }\r\n\t if(control.type == \"checkbox\") \r\n\t {\r\n\t \tretValue = Boolean.parse(value);\r\n\t \tcontrol.checked = retValue;\r\n\t }\r\n\t if(control.type == \"radio\") \r\n\t {\r\n\t \tretValue = Boolean.parse(value);\r\n\t \tcontrol.checked = retValue;\r\n\t }\r\n\t } \r\n\t if(control.tagName == \"SELECT\") \r\n\t {\r\n\t \t retValue = value;\r\n\t \t control.value = value;\r\n\t }\r\n\t\t}\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\t//returns the top y coordinate of the given div used while listening to scrolling events(vertical scrolling)\r\n\tNSUtil.prototype.scrollTop = function (div)\r\n\t{\r\n\t\t if(div)\r\n\t\t {\r\n\t\t return (div.scrollHeight - div.clientHeight);\r\n\t\t }\r\n\t\t return -1;\r\n\t};\r\n\t\r\n\t//returns the top x coordinate of the given div used while listening to scrolling events(horizontal scrolling)\r\n\tNSUtil.prototype.scrollLeft = function (div)\r\n\t{\r\n\t\t if(div)\r\n\t\t {\r\n\t\t\t return (div.scrollWidth - div.clientWidth);\r\n\t\t }\r\n\t\t return -1;\r\n\t};\r\n\t\r\n\t//adds Style class to an element's styles list \r\n\tNSUtil.prototype.addStyleClass = function (element