var Nx = Nx || {}; Nx.$ = jQuery.noConflict(false);
Nx.Config = { dependencyPath: { library: '/js/libraries/dynamic/', plugin: '/js/plugins/dynamic/', util: '/js/utils/dynamic/'} };
(function($) {
    Nx.Application = function($ctx, config) { this.config = $.extend(Nx.Config, config); this.$ctx = $ctx || $('body'); this.modCounter = 0; this.modules = []; this.connectors = {}; this.wildcardComponents = []; this.sandbox = new Nx.Sandbox(this, this.config); }; Nx.Application.prototype.constructor = Nx.Application; $.extend(Nx.Application.prototype, { registerModules: function() {
        var that = this; $('.mod', that.$ctx).each(function() {
            var $this = $(this); var classes = $this.attr('class').split(' '); if (classes.length > 1) {
                var modName; var skins = []; var connectors = []; for (var i = 0; i < classes.length; i++) {
                    if (classes[i].indexOf('mod') === 0 && classes[i].length > 3) { modName = classes[i].substr(3); }
                    else if (classes[i].indexOf('skin') === 0) { skins.push(classes[i].substr(4)); }
                    else if (classes[i].indexOf('conn') === 0) { connectors.push(classes[i].substr(4)); } 
                }
                if (modName && Nx.Module[modName]) { that.registerModule($this, modName, skins, connectors); } 
            } 
        });
    }, registerModule: function($node, modName, skins, connectors) {
        var that = this; modName = modName || null; skins = skins || []; connectors = connectors || []; if (modName && Nx.Module[modName]) {
            var modId = that.modCounter++; $node.data('id', modId); $.log.debug('instantiate Nx.Module.' + modName); that.modules[modId] = new Nx.Module[modName]($node, that.sandbox, modId); for (var i = 0; i < skins.length; i++) { var skinName = skins[i]; skinName = skinName.replace(modName, ''); if (Nx.Module[modName][skinName]) { $.log.debug('decorate it with the skin Nx.Module.' + modName + '.' + skinName); that.modules[modId] = that.modules[modId].getDecoratedModule(modName, skinName); } }
            that.applyErrorHandler(modName, that.modules[modId]); for (var i = 0; i < connectors.length; i++) { that.registerConnection(connectors[i], that.modules[modId]); }
            return that.modules[modId];
        }
        else { $.log.info('the module Nx.Module.' + modName + ' does not exist'); return null; } 
    }, registerLayout: function($node, layoutName, skins, connectors) { this.registerModule($node, layoutName, skins, connectors); }, registerConnection: function(connector, component) {
        var that = this; var connectorType = connector.replace(/[0-9]+[a-zA-Z]*$/, ''); var connectorId = connector.replace(/[a-zA-Z]*$/, '').replace(/^[a-zA-Z]*/, ''); var connectorRole = connector.replace(/^[a-zA-Z]*[0-9]*/, ''); if (connectorId === '*' && connectorRole === '*') { that.wildcardComponents.push(component); }
        else {
            if (!that.connectors[connectorId]) {
                if (connectorType === '') { that.connectors[connectorId] = new Nx.Connector(connectorId); }
                else if (Nx.Connector[connectorType]) { that.connectors[connectorId] = new Nx.Connector[connectorType](connectorId); } 
            }
            if (that.connectors[connectorId]) { $.log.debug('attach the connector: ' + connectorId); component.attachConnector(that.connectors[connectorId]); that.connectors[connectorId].registerComponent(component, connectorRole); } 
        } 
    }, applyErrorHandler: function(componentName, component) {
        var that = this; for (var methodName in component) {
            var method = component[methodName]; if ($.isFunction(method)) {
                component[methodName] = function(componentName, methodName, method) {
                    return function() {
                        try { return method.apply(this, arguments); }
                        catch (ex) { $.log.error(componentName + '.' + methodName + '(): ' + ex.message); if (that.config.debug) { throw ex; } } 
                    };
                } (componentName, methodName, method);
            } 
        } 
    }, startAll: function() {
        var that = this; for (var i = 0; i < this.modules.length; i++) { this.modules[i].start(); }
        for (var i = 0; i < this.wildcardComponents.length; i++) { for (var connectorId in this.connectors) { this.wildcardComponents[i].attachConnector(this.connectors[connectorId]); this.connectors[connectorId].registerComponent(this.wildcardComponents[i], '*'); } } 
    }, stopAll: function() { for (var i = 0; i < this.modules.length; i++) { this.modules[i].stop(); } } 
    });
})(Nx.$);
(function($) {
    Nx.Module = function($ctx, sandbox, modId) { if (arguments.length > 0) { this.$ctx = $ctx; this.modId = modId; this.connectors = []; this.dependencyCounter = { beforeBinding: 0, onBinding: 1, afterBinding: 0 }; this.sandbox = sandbox; } }; Nx.Module.prototype.constructor = Nx.Module; $.extend(Nx.Module.prototype, { start: function() {
        var that = this; if (this.dependencies) { this.dependencyCounter.beforeBinding++; this.dependencies(); this.dependencyCounter.beforeBinding--; }
        this.checkDependencies('beforeBinding', function() { that.initBeforeBinding(); });
    }, stop: function() { }, initBeforeBinding: function() {
        var that = this; var callback = function() { that.dependencyCounter.onBinding--; that.checkDependencies('onBinding', function() { that.initOnBinding(); }); }; if (this.beforeBinding) { this.beforeBinding(callback); }
        else { callback(); } 
    }, initOnBinding: function() {
        var that = this; if (this.onBinding) { this.onBinding(); }
        this.checkDependencies('afterBinding', function() { that.initAfterBinding(); });
    }, initAfterBinding: function() { if (this.afterBinding) { this.afterBinding(); } }, checkDependencies: function(phase, callback) { if (this.dependencyCounter[phase] === 0) { callback(); } }, require: function(dependency, type, phase) { var that = this; phase = phase || 'onBinding'; type = type || 'plugin'; this.dependencyCounter[phase]++; var callback = function() { that.dependencyCounter[phase]--; that.checkDependencies(phase, function() { that['init' + Nx.Utils.String.capitalize(phase)](); }); }; that.sandbox.loadDependency(dependency, type, callback, phase); }, fire: function(state, data, defaultAction) {
        var that = this; data = data || {}; state = Nx.Utils.String.capitalize(state); $.each(that.connectors, function() {
            var connector = this; var callback = function() {
                if (typeof defaultAction == 'function') { defaultAction(); }
                connector.notify(that, 'after' + state, data);
            }; if (connector.notify(that, 'on' + state, data, callback)) { callback(); } 
        }); if (this.connectors.length < 1) { if (typeof defaultAction == 'function') { defaultAction(); } } 
    }, attachConnector: function(connector) { this.connectors.push(connector); }, getDecoratedModule: function(module, skin) {
        if (Nx.Module[module][skin]) { var decorator = Nx.Module[module][skin]; decorator.prototype = this; decorator.prototype.constructor = Nx.Module[module][skin]; return new decorator(this); }
        else { $.log.info('the skin ' + skin + ' does not exists for this module'); return null; } 
    } 
    });
})(Nx.$);
(function($) {
    Nx.Connector = function(connectorId) { if (arguments.length > 0) { this.connectorId = connectorId; this.components = []; } }; Nx.Connector.prototype.constructor = Nx.Connector; $.extend(Nx.Connector.prototype, { registerComponent: function(component, role) { role = role || 'standard'; this.components.push({ 'component': component, 'role': role }); }, notify: function(component, state, data, callback) {
        var proceed = true; for (var i = 0; i < this.components.length; i++) { if (this.components[i].component.modId !== component.modId && this.components[i].component[state]) { if (this.components[i].component[state](data, callback) === false) { proceed = false; } } }
        return proceed;
    } 
    });
})(Nx.$);
(function($) {
    Nx.Sandbox = function(application, config) { this.application = application; this.config = config; this.dependencies = []; }; Nx.Sandbox.prototype.constructor = Nx.Sandbox; $.extend(Nx.Sandbox.prototype, { loadDependency: function(dependency, type, callback, phase) {
        var that = this; phase = phase || 'async'; type = type || 'plugin'; if (that.dependencies[dependency] && that.dependencies[dependency].state === 'requested') { $.log.info('dependency ' + dependency + ' already requested'); that.dependencies[dependency].callbacks.push(function() { callback(phase); }); }
        else if (that.dependencies[dependency] && that.dependencies[dependency].state === 'loaded') { $.log.info('dependency ' + dependency + ' already loaded'); callback(phase); }
        else {
            $.log.time('load dependency ' + dependency); that.dependencies[dependency] = { state: 'requested', callbacks: [] }; var path; switch (type) { case 'library': case 'plugin': case 'util': path = this.config.dependencyPath[type]; break; case 'url': path = ''; break; case 'default': $.log.error('the type ' + type + ' is not known'); break; }
            setTimeout(function() { $.ajax({ url: '' + path + dependency, dataType: 'script', cache: true, success: function() { $.log.time('load dependency ' + dependency); that.dependencies[dependency].state = 'loaded'; callback(phase); var callbacks = that.dependencies[dependency].callbacks; for (var i = 0; i < callbacks.length; i++) { callbacks[i](); } }, error: function() { $.log.error('an error occured during loading the dependency ' + path + dependency); } }); }, 0);
        } 
    }, getConfig: function() { return this.config; }, getConfigParam: function(name) {
        if (this.config.name !== undefined) { return this.config.name; }
        else { throw new Error('the config param ' + name + ' does not exist'); } 
    }, getModuleById: function(id) {
        if (this.application.modules[id] !== undefined) { return this.application.modules[id]; }
        else { throw new Error('the module with the id ' + id + ' does not exist'); } 
    } 
    });
})(Nx.$);
Nx.Utils = {};
(function($) {
    Nx.Connector.MasterSlave = function(connectorId) { Nx.Connector.call(this, connectorId); }; Nx.Connector.MasterSlave.prototype = new Nx.Connector(); Nx.Connector.MasterSlave.prototype.constructor = Nx.Connector.MasterSlave; Nx.$.extend(Nx.Connector.MasterSlave.prototype, { notify: function(component, state, data, callback) {
        var proceed = true; for (var j = 0; j < this.components.length; j++) { if (this.components[j].component.modId === component.modId && this.components[j].role === 'Master') { for (var i = 0; i < this.components.length; i++) { if (this.components[i].component.modId !== component.modId && this.components[i].component[state]) { if (this.components[i].component[state](data, callback) === false) { proceed = false; } } } } }
        return proceed;
    } 
    });
})(Nx.$);
Nx.$.json = { encode: function(value, replacer, space) {
    var i; gap = ''; var indent = ''; if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } } else if (typeof space === 'string') { indent = space; }
    rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.encode'); }
    return this.str('', { '': value });
}, decode: function(text, reviver) {
    var j; var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; function walk(holder, key) {
        var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } }
        return reviver.call(holder, key, value);
    }
    cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function(a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); }
    if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { j = eval('(' + text + ')'); return typeof reviver === 'function' ? walk({ '': j }, '') : j; }
    throw new SyntaxError('JSON.parse');
}, f: function(n) { return n < 10 ? '0' + n : n; }, DateToJSON: function(key) { return this.getUTCFullYear() + '-' + this.f(this.getUTCMonth() + 1) + '-' + this.f(this.getUTCDate()) + 'T' + this.f(this.getUTCHours()) + ':' + this.f(this.getUTCMinutes()) + ':' + this.f(this.getUTCSeconds()) + 'Z'; }, StringToJSON: function(key) { return this.valueOf(); }, quote: function(string) { var meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }; var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function(a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; }, str: function(key, holder) {
    var indent = '', gap = '', i, k, v, length, mind = gap, partial, value = holder[key]; if (value && typeof value === 'object') { switch ((typeof value)) { case 'date': this.DateToJSON(key); break; default: this.StringToJSON(key); break; } }
    if (typeof rep === 'function') { value = rep.call(holder, key, value); }
    switch (typeof value) {
        case 'string': return this.quote(value); case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) { return 'null'; }
            gap += indent; partial = []; if (Object.prototype.toString.apply(value) === '[object Array]') {
                length = value.length; for (i = 0; i < length; i += 1) { partial[i] = this.str(i, value) || 'null'; }
                v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v;
            }
            if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { k = rep[i]; if (typeof k === 'string') { v = this.str(k, value); if (v) { partial.push(this.quote(k) + (gap ? ': ' : ':') + v); } } } } else { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = this.str(k, value); if (v) { partial.push(this.quote(k) + (gap ? ': ' : ':') + v); } } } }
            v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v;
    } 
} 
}; ; (function($) { $.log = { toggle: function() { }, resize: function() { }, clear: function() { }, move: function() { }, debug: function() { }, warn: function() { }, info: function() { }, error: function() { }, time: function() { } }; })(jQuery);
(function($) { Nx.Utils.String = { capitalize: function(str) { return str.substr(0, 1).toUpperCase().concat(str.substr(1)); } }; })(Nx.$);
(function($) {
    Nx.Utils.Cookie = { internal: {}, expires: function() { return Nx.Utils.Cookie.internal.expires; }, path: function() { return Nx.Utils.Cookie.internal.path; }, require: function() { if (!$.isFunction($.json.decode)) { $.log.error('Nx.Utils.Cookie needs the jquery.json.js Plugin! Exit now.'); } }, read: function(name) {
        var theCookie = "" + document.cookie; var ind = theCookie.indexOf(name); if (ind == -1 || name == "") { $.log.info('No cookie found with the name "' + name + '"'); return null; }
        var ind1 = theCookie.indexOf(';', ind); if (ind1 == -1) { ind1 = theCookie.length; }
        var string = unescape(theCookie.substring(ind + name.length + 1, ind1)); var obj; if (string) { try { obj = $.json.decode(string); } catch (e) { $.log.error('Could not decode json with cookie "' + name + '"'); return false; } }
        if (typeof (obj) == "object") { Nx.Utils.Cookie.internal.expires = obj.expires; Nx.Utils.Cookie.internal.path = obj.path; return obj.value; }
        return false;
    }, write: function(name, value, expires, path) {
        var obj = { expires: expires, path: path, value: value }; try { var string = $.json.encode(obj); } catch (e) { $.log.error('Could not encode json with cookie "' + name + '"'); return false; }
        if (!name) { $.log.info('[Nx.Utils.cookies.write] No name: ' + name + ' or no value: ' + string); return false; }
        var cookie = name + '=' + string; if (expires) { cookie += '; expires=' + expires; }
        if (path) { cookie += '; path=' + path; } else if (path !== '') { cookie += '; path=/'; }
        document.cookie = cookie; return true;
    } 
    }; Nx.Utils.Cookie.require();
})(Nx.$);
(function($) {
    $.fn.bgIframe = $.fn.bgiframe = function(s) {
        if ($.browser.msie && /6.0/.test(navigator.userAgent)) {
            s = $.extend({ top: 'auto', left: 'auto', width: 'auto', height: 'auto', opacity: true, src: 'javascript:false;' }, s || {}); var prop = function(n) { return n && n.constructor == Number ? n + 'px' : n; }, html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' + 'style="display:block;position:absolute;z-index:-1;' +
(s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' + 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' + 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' + '"/>'; return this.each(function() {
    if ($('> iframe.bgiframe', this).length == 0)
        this.insertBefore(document.createElement(html), this.firstChild);
});
        }
        return this;
    };
})(jQuery); ; (function($) {
    if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery); return; }
    $.fn._fadeIn = $.fn.fadeIn; var noOp = function() { }; var mode = document.documentMode || 0; var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; $.blockUI = function(opts) { install(window, opts); }; $.unblockUI = function(opts) { remove(window, opts); }; $.growlUI = function(title, message, timeout, onClose) { var $m = $('<div class="growlUI"></div>'); if (title) $m.append('<h1>' + title + '</h1>'); if (message) $m.append('<h2>' + message + '</h2>'); if (timeout == undefined) timeout = 3000; $.blockUI({ message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, timeout: timeout, showOverlay: false, onUnblock: onClose, css: $.blockUI.defaults.growlCSS }); }; $.fn.block = function(opts) {
        return this.unblock({ fadeOut: 0 }).each(function() {
            if ($.css(this, 'position') == 'static')
                this.style.position = 'relative'; if ($.browser.msie)
                this.style.zoom = 1; install(this, opts);
        });
    }; $.fn.unblock = function(opts) { return this.each(function() { remove(this, opts); }); }; $.blockUI.version = 2.31; $.blockUI.defaults = { message: '<h1>Please wait...</h1>', title: null, draggable: true, theme: false, css: { padding: 0, margin: 0, width: '30%', top: '40%', left: '35%', textAlign: 'center', color: '#000', border: '3px solid #aaa', backgroundColor: '#fff', cursor: 'wait' }, themedCSS: { width: '30%', top: '40%', left: '35%' }, overlayCSS: { backgroundColor: '#000', opacity: 0.6, cursor: 'wait' }, growlCSS: { width: '350px', top: '10px', left: '', right: '10px', border: 'none', padding: '5px', opacity: 0.6, cursor: 'default', color: '#fff', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px' }, iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', forceIframe: false, baseZ: 1000, centerX: true, centerY: true, allowBodyStretch: true, bindEvents: true, constrainTabKey: true, fadeIn: 200, fadeOut: 400, timeout: 0, showOverlay: true, focusInput: true, applyPlatformOpacityRules: true, onBlock: null, onUnblock: null, quirksmodeOffsetHack: 4 }; var pageBlock = null; var pageBlockEls = []; function install(el, opts) {
        var full = (el == window); var msg = opts && opts.message !== undefined ? opts.message : undefined; opts = $.extend({}, $.blockUI.defaults, opts || {}); opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); msg = msg === undefined ? opts.message : msg; if (full && pageBlock)
            remove(window, { fadeOut: 0 }); if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
            var node = msg.jquery ? msg[0] : msg; var data = {}; $(el).data('blockUI.history', data); data.el = node; data.parent = node.parentNode; data.display = node.style.display; data.position = node.style.position; if (data.parent)
                data.parent.removeChild(node);
        }
        var z = opts.baseZ; var lyr1 = ($.browser.msie || opts.forceIframe) ? $('<iframe class="blockUI" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + opts.iframeSrc + '"></iframe>') : $('<div class="blockUI" style="display:none"></div>'); var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); var lyr3; if (opts.theme && full) { var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:' + z + ';display:none;position:fixed">' + '<div class="ui-widget-header ui-dialog-titlebar blockTitle">' + (opts.title || '&nbsp;') + '</div>' + '<div class="ui-widget-content ui-dialog-content"></div>' + '</div>'; lyr3 = $(s); }
        else { lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:' + z + ';display:none;position:fixed"></div>') : $('<div class="blockUI blockMsg blockElement" style="z-index:' + z + ';display:none;position:absolute"></div>'); }
        if (msg) {
            if (opts.theme) { lyr3.css(themedCSS); lyr3.addClass('ui-widget-content'); }
            else
                lyr3.css(css);
        }
        if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
            lyr2.css(opts.overlayCSS); lyr2.css('position', full ? 'fixed' : 'absolute'); if ($.browser.msie || opts.forceIframe)
            lyr1.css('opacity', 0.0); var layers = [lyr1, lyr2, lyr3], $par = full ? $('body') : $(el), $par2 = full ? $('form') : $(el); $.each(layers, function(i) {
                if (i < 2) { this.appendTo($par); }
                else { this.appendTo($par2); } 
            }); if (opts.theme && opts.draggable && $.fn.draggable) { lyr3.draggable({ handle: '.ui-dialog-titlebar', cancel: 'li' }); }
        var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); if (ie6 || expr) {
            if (full && opts.allowBodyStretch && $.boxModel)
                $('html,body').css('height', '100%'); if ((ie6 || !$.boxModel) && !full) { var t = sz(el, 'borderTopWidth'), l = sz(el, 'borderLeftWidth'); var fixT = t ? '(0 - ' + t + ')' : 0; var fixL = l ? '(0 - ' + l + ')' : 0; }
            $.each([lyr1, lyr2, lyr3], function(i, o) {
                var s = o[0].style; s.position = 'absolute'; if (i < 2) { full ? s.setExpression('height', 'Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:' + opts.quirksmodeOffsetHack + ') + "px"') : s.setExpression('height', 'this.parentNode.offsetHeight + "px"'); full ? s.setExpression('width', 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') : s.setExpression('width', 'this.parentNode.offsetWidth + "px"'); if (fixL) s.setExpression('left', fixL); if (fixT) s.setExpression('top', fixT); }
                else if (opts.centerY) { if (full) s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); s.marginTop = 0; }
                else if (!opts.centerY && full) { var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + ' + top + ') + "px"'; s.setExpression('top', expression); } 
            });
        }
        if (msg) {
            if (opts.theme)
                lyr3.find('.ui-widget-content').append(msg); else
                lyr3.append(msg); if (msg.jquery || msg.nodeType)
                $(msg).show();
        }
        if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
            lyr1.show(); if (opts.fadeIn) {
            var cb = opts.onBlock ? opts.onBlock : noOp; var cb1 = (opts.showOverlay && !msg) ? cb : noOp; var cb2 = msg ? cb : noOp; if (opts.showOverlay)
                lyr2._fadeIn(opts.fadeIn, cb1); if (msg)
                lyr3._fadeIn(opts.fadeIn, cb2);
        }
        else {
            if (opts.showOverlay)
                lyr2.show(); if (msg)
                lyr3.show(); if (opts.onBlock)
                opts.onBlock();
        }
        bind(1, el, opts); if (full) {
            pageBlock = lyr3[0]; pageBlockEls = $(':input:enabled:visible', pageBlock); if (opts.focusInput)
                setTimeout(focus, 20);
        }
        else
            center(lyr3[0], opts.centerX, opts.centerY); if (opts.timeout) { var to = setTimeout(function() { full ? $.unblockUI(opts) : $(el).unblock(opts); }, opts.timeout); $(el).data('blockUI.timeout', to); } 
    }; function remove(el, opts) {
        var full = (el == window); var $el = $(el); var data = $el.data('blockUI.history'); var to = $el.data('blockUI.timeout'); if (to) { clearTimeout(to); $el.removeData('blockUI.timeout'); }
        opts = $.extend({}, $.blockUI.defaults, opts || {}); bind(0, el, opts); var els; if (full)
            els = $('body').children().filter('.blockUI').add('body > .blockUI'); else
            els = $('.blockUI', el); if (full)
            pageBlock = pageBlockEls = null; if (opts.fadeOut) { els.fadeOut(opts.fadeOut); setTimeout(function() { reset(els, data, opts, el); }, opts.fadeOut); }
        else
            reset(els, data, opts, el);
    }; function reset(els, data, opts, el) {
        els.each(function(i, o) {
            if (this.parentNode)
                this.parentNode.removeChild(this);
        }); if (data && data.el) {
            data.el.style.display = data.display; data.el.style.position = data.position; if (data.parent)
                data.parent.appendChild(data.el); $(el).removeData('blockUI.history');
        }
        if (typeof opts.onUnblock == 'function')
            opts.onUnblock(el, opts);
    }; function bind(b, el, opts) {
        var full = el == window, $el = $(el); if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
            return; if (!full)
            $el.data('blockUI.isBlocked', b); if (!opts.bindEvents || (b && !opts.showOverlay))
            return; var events = 'mousedown mouseup keydown keypress'; b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
    }; function handler(e) {
        if (e.keyCode && e.keyCode == 9) { if (pageBlock && e.data.constrainTabKey) { var els = pageBlockEls; var fwd = !e.shiftKey && e.target == els[els.length - 1]; var back = e.shiftKey && e.target == els[0]; if (fwd || back) { setTimeout(function() { focus(back) }, 10); return false; } } }
        if ($(e.target).parents('div.blockMsg').length > 0)
            return true; return $(e.target).parents().children().filter('div.blockUI').length == 0;
    }; function focus(back) {
        if (!pageBlockEls)
            return; var e = pageBlockEls[back === true ? pageBlockEls.length - 1 : 0]; if (e)
            e.focus();
    }; function center(el, x, y) { var p = el.parentNode, s = el.style; var l = ((p.offsetWidth - el.offsetWidth) / 2) - sz(p, 'borderLeftWidth'); var t = ((p.offsetHeight - el.offsetHeight) / 2) - sz(p, 'borderTopWidth'); if (x) s.left = l > 0 ? (l + 'px') : '0'; if (y) s.top = t > 0 ? (t + 'px') : '0'; }; function sz(el, p) { return parseInt($.css(el, p)) || 0; };
})(jQuery); ; (function($) {
    var URI = location.href.replace(/#.*/, ''); var $localScroll = $.localScroll = function(settings) { $('body').localScroll(settings); }; $localScroll.defaults = { duration: 1000, axis: 'y', event: 'click', stop: true, target: window, reset: true }; $localScroll.hash = function(settings) {
        if (location.hash) {
            settings = $.extend({}, $localScroll.defaults, settings); settings.hash = false; if (settings.reset) { var d = settings.duration; delete settings.duration; $(settings.target).scrollTo(0, settings); settings.duration = d; }
            scroll(0, location, settings);
        } 
    }; $.fn.localScroll = function(settings) {
        settings = $.extend({}, $localScroll.defaults, settings); return settings.lazy ? this.bind(settings.event, function(e) {
            var a = $([e.target, e.target.parentNode]).filter(filter)[0]; if (a)
                scroll(e, a, settings);
        }) : this.find('a,area').filter(filter).bind(settings.event, function(e) { scroll(e, this, settings); }).end().end(); function filter() { return !!this.href && !!this.hash && this.href.replace(this.hash, '') == URI && (!settings.filter || $(this).is(settings.filter)); };
    }; function scroll(e, link, settings) {
        var id = link.hash.slice(1), elem = document.getElementById(id) || document.getElementsByName(id)[0]; if (!elem)
            return; if (e)
            e.preventDefault(); var $target = $(settings.target); if (settings.lock && $target.is(':animated') || settings.onBefore && settings.onBefore.call(settings, e, elem, $target) === false)
            return; if (settings.stop)
            $target.stop(true); if (settings.hash) { var attr = elem.id == id ? 'id' : 'name', $a = $('<a> </a>').attr(attr, id).css({ position: 'absolute', top: $(window).scrollTop(), left: $(window).scrollLeft() }); elem[attr] = ''; $('body').prepend($a); location = link.hash; $a.remove(); elem[attr] = id; }
        $target.scrollTo(elem, settings).trigger('notify.serialScroll', [elem]);
    };
})(jQuery); ; (function($) {
    var $scrollTo = $.scrollTo = function(target, duration, settings) { $(window).scrollTo(target, duration, settings); }; $scrollTo.defaults = { axis: 'xy', duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1 }; $scrollTo.window = function(scope) { return $(window).scrollable(); }; $.fn.scrollable = function() {
        return this.map(function() {
            var elem = this, isWin = !elem.nodeName || $.inArray(elem.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!isWin)
                return elem; var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem; return $.browser.safari || doc.compatMode == 'BackCompat' ? doc.body : doc.documentElement;
        });
    }; $.fn.scrollTo = function(target, duration, settings) {
        if (typeof duration == 'object') { settings = duration; duration = 0; }
        if (typeof settings == 'function')
            settings = { onAfter: settings }; if (target == 'max')
            target = 9e9; settings = $.extend({}, $scrollTo.defaults, settings); duration = duration || settings.speed || settings.duration; settings.queue = settings.queue && settings.axis.length > 1; if (settings.queue)
            duration /= 2; settings.offset = both(settings.offset); settings.over = both(settings.over); return this.scrollable().each(function() {
                var elem = this, $elem = $(elem), targ = target, toff, attr = {}, win = $elem.is('html,body'); switch (typeof targ) {
                    case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px)?$/.test(targ)) { targ = both(targ); break; }
                        targ = $(targ, this); case 'object': if (targ.is || targ.style)
                            toff = (targ = $(targ)).offset();
                }
                $.each(settings.axis.split(''), function(i, axis) {
                    var Pos = axis == 'x' ? 'Left' : 'Top', pos = Pos.toLowerCase(), key = 'scroll' + Pos, old = elem[key], Dim = axis == 'x' ? 'Width' : 'Height'; if (toff) {
                        attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]); if (settings.margin) { attr[key] -= parseInt(targ.css('margin' + Pos)) || 0; attr[key] -= parseInt(targ.css('border' + Pos + 'Width')) || 0; }
                        attr[key] += settings.offset[pos] || 0; if (settings.over[pos])
                            attr[key] += targ[Dim.toLowerCase()]() * settings.over[pos];
                    } else
                        attr[key] = targ[pos]; if (/^\d+$/.test(attr[key]))
                        attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max(Dim)); if (!i && settings.queue) {
                        if (old != attr[key])
                            animate(settings.onAfterFirst); delete attr[key];
                    } 
                }); animate(settings.onAfter); function animate(callback) { $elem.animate(attr, duration, settings.easing, callback && function() { callback.call(this, target, settings); }); }; function max(Dim) {
                    var scroll = 'scroll' + Dim; if (!win)
                        return elem[scroll]; var size = 'client' + Dim, html = elem.ownerDocument.documentElement, body = elem.ownerDocument.body; return Math.max(html[scroll], body[scroll])
- Math.min(html[size], body[size]);
                };
            }).end();
    }; function both(val) { return typeof val == 'object' ? val : { top: val, left: val }; };
})(jQuery);
(function($) {
    Nx.Utils.Block = { config: { type_dialog: { message: 'loading...', overlayCSS: { backgroundColor: '#000', opacity: 0.5 }, css: { top: '30%', left: '30%', padding: 0, margin: 0, width: '515px', color: '#434343', backgroundColor: '#fff', cursor: 'default' }, fadeIn: 0, fadeOut: 400, onUnblock: null }, type_error: { message: 'Es ist ein Fehler aufgetreten, bitte laden Sie die Seite neu und versuchen es nochmals.', overlayCSS: { backgroundColor: '#000', opacity: 0.5 }, css: { top: '30%', left: '30%', padding: '30px', margin: 0, width: '315px', color: '#fff', backgroundColor: '#ff1000', cursor: 'default' }, fadeIn: 0, fadeOut: 400, onUnblock: null} }, show: function(options) {
        if (!options) { return false; }
        var type = (options.type && typeof options.type === 'string' && Nx.Utils.Block.config.hasOwnProperty(options.type)) ? options.type : 'type_dialog'; if (options.$obj) {
            var $blockmsg = options.$obj; if (!$blockmsg.hasClass('blockbox')) { var blockid = options.$obj.attr('id'); var classname = options.$obj.attr('class'); $blockmsg = options.$obj.wrap('<div class="blockbox"><div class="blockcontent"></div></div>').closest('.blockbox').append('<div class="blockclose"></div>').attr('id', blockid).addClass(classname); options.$obj.removeAttr('id').removeAttr('class'); $('.blockclose', $blockmsg).bind('click.block', function() { Nx.Utils.Block.unblock(); }); }
            Nx.Utils.Block.config[type].message = $blockmsg; $.blockUI(Nx.Utils.Block.config[type]); $(document).bind('keyup.block', function(event) { if (event.keyCode === 27) { Nx.Utils.Block.unblock(); } }); $(document).bind('keypress.block', function(event) { if (event.keyCode === 13) { event.preventDefault(); } }); $('.blockOverlay').bind('click.block', function() { Nx.Utils.Block.unblock(); });
        }
        else { $.blockUI(Nx.Utils.Block.config[type]); }
        return false;
    }, unblock: function() { $.unblockUI(); $(document).unbind('.block'); return true; } 
    };
})(Nx.$);
(function($) { Nx.Utils.Service = { config: { base: 'services/FrontendService.svc/', timeout: { update: 15000, calculate: 30000} }, status: { ok: 'ok', operationfailed: 'operation_failed', servicefailed: 'service_failed', dbfailed: 'db_failed' }, ajaxerror: function(callback) { $.log.error('AJAX - Error - block'); var options = { type: 'type_error' }; Nx.Utils.Block.show(options); if ($.isFunction(callback)) { callback(); } }, test: function() { return true; } }; })(Nx.$);
(function($) {
    Nx.Module.Namics = function($ctx, sandbox, moduleId) { Nx.Module.call(this, $ctx, sandbox, moduleId); }; Nx.Module.Namics.prototype = new Nx.Module(); Nx.Module.Namics.prototype.constructor = Nx.Module.Namics; $.extend(Nx.Module.Namics.prototype, { beforeBinding: function(callback) { var that = this; $('#nojs').hide(); that.$helpbox = $('<div id="helpbox"><div class="helpclose"></div><div class="helpheader"></div><div class="helpcontent"></div></div>'); that.$helpbox.hide().insertBefore(that.$ctx); $.blockUI.defaults.css = {}; callback(); }, onBinding: function() {
        var that = this; var hideHelpSystem = function() { if (that.$helpbox.data('actid.helpsystem')) { that.$helpbox.hide().data('actid.helpsystem', ''); $(document).unbind('keyup.helpsystem'); } }; $(document).bind('click.helpsystem', function(event) {
            var $link = $(event.target).closest('a.help', that.$ctx); if ($link.length) {
                var containerid = $link.attr('rel'); var content = $('#' + containerid).html(); if (that.$helpbox.data('actid.helpsystem') !== containerid) { that.$helpbox.css({ top: event.pageY - 24, right: 21 }).data('actid.helpsystem', containerid).find('.helpcontent').html('<div>' + content + '</div>').end().show(); $(document).bind('keyup.helpsystem', function(event) { if (event.keyCode === 27) { hideHelpSystem(); } }); }
                return false;
            }
            else if (that.$helpbox.data('actid.helpsystem')) { hideHelpSystem(); return false; } 
        }); that.$helpbox.bind('click.helpsystem', function() { return false; }); that.$helpbox.find('.helpclose').bind('click.helpsystem', hideHelpSystem); var $scroll = $('#scroll > div'), $scrollBox = $('#scroll'), fixed = false, limit = 480; var getScrollLeft = function() { return $scrollBox.offset().left - $(window).scrollLeft(); }; if ($scroll.length > 0) {
            var handlerScroll = function() {
                var scrolltop = $(window).scrollTop(); if (!fixed && scrolltop >= limit) { var fixedposleft = getScrollLeft(); $scroll.css({ position: 'fixed', top: '-80px', left: fixedposleft }); fixed = true; }
                else if (fixed && scrolltop < limit) { $scroll.css({ position: 'static' }); fixed = false; }
                else if (fixed) { $scroll.css({ left: getScrollLeft() }); } 
            }; $(window).bind('scroll.scroller', handlerScroll).bind('resize.scroller', function() { var fixedposleft = getScrollLeft(); if (fixed) { $scroll.css({ left: fixedposleft }); } });
        }
        $('.line:eq(1) input', this.$ctx).live('keypress', function(event) { if (event.keyCode === 13) { event.preventDefault(); } });
    } 
    });
})(Nx.$);
(function($) { Nx.Module.Box = function($ctx, sandbox, modId) { Nx.Module.call(this, $ctx, sandbox, modId); }; Nx.Module.Box.prototype = new Nx.Module(); Nx.Module.Box.prototype.constructor = Nx.Module.Box; $.extend(Nx.Module.Box.prototype, { onBinding: function() { var that = this; $('table', that.$ctx).delegate('tr', 'hover', function() { $(this).toggleClass('hover'); }); $('input[type=text], textarea, select', that.$ctx).bind('focusin focusout', function() { $(this).toggleClass('active'); }); } }); })(Nx.$);
(function($) {
    Nx.Circle = function(control, map, id, point, radius) { var that = this; Nx.Circle.CIRCLE = 'circle'; Nx.Circle.queryCenterOptions = {}; Nx.Circle.queryCenterOptions.icon = new GIcon(); Nx.Circle.queryCenterOptions.icon.image = "/img/centerArrow.png"; Nx.Circle.queryCenterOptions.icon.iconSize = new GSize(20, 20); Nx.Circle.queryCenterOptions.icon.shadowSize = new GSize(0, 0); Nx.Circle.queryCenterOptions.icon.iconAnchor = new GPoint(10, 10); Nx.Circle.queryCenterOptions.draggable = true; Nx.Circle.queryCenterOptions.bouncy = false; Nx.Circle.queryLineOptions = {}; Nx.Circle.queryLineOptions.icon = new GIcon(); Nx.Circle.queryLineOptions.icon.image = "/img/resizeArrow.png"; Nx.Circle.queryLineOptions.icon.iconSize = new GSize(25, 20); Nx.Circle.queryLineOptions.icon.shadowSize = new GSize(0, 0); Nx.Circle.queryLineOptions.icon.iconAnchor = new GPoint(12, 10); Nx.Circle.queryLineOptions.draggable = true; Nx.Circle.queryLineOptions.bouncy = false; this.control = control; this.map = map; this.id = id; this.radius = radius; this.type = Nx.Circle.CIRCLE; this.color = '#0000ff'; this.dragHandlePosition = Nx.Circle.destination(point, 90, this.radius / 1000); this.dragHandle = new GMarker(this.dragHandlePosition, Nx.Circle.queryLineOptions); this.centerHandlePosition = point; this.centerHandle = new GMarker(this.centerHandlePosition, Nx.Circle.queryCenterOptions); this.map.addOverlay(this.dragHandle); this.map.addOverlay(this.centerHandle); GEvent.addListener(this.dragHandle, "drag", function() { that.update(1); }); GEvent.addListener(this.centerHandle, "drag", function() { that.update(2); }); GEvent.addListener(this.dragHandle, "dragend", function() { that.update(1); that.updateControl(); }); GEvent.addListener(this.centerHandle, "dragend", function() { that.update(2); that.updateControl(); }); }; Nx.Circle.prototype = {}; Nx.Circle.prototype.constructor = Nx.Circle; Nx.Circle.destination = function(orig, hdng, dist) { var R = 6371; var oX, oY; var x, y; var d = dist / R; hdng = hdng * Math.PI / 180; oX = orig.x * Math.PI / 180; oY = orig.y * Math.PI / 180; y = Math.asin(Math.sin(oY) * Math.cos(d) + Math.cos(oY) * Math.sin(d) * Math.cos(hdng)); x = oX + Math.atan2(Math.sin(hdng) * Math.sin(d) * Math.cos(oY), Math.cos(d) - Math.sin(oY) * Math.sin(y)); y = y * 180 / Math.PI; x = x * 180 / Math.PI; return new GLatLng(y, x); }; $.extend(Nx.Circle.prototype, { updateControl: function() { this.control.updateMapSelection(this.control.createMapSelection(this.id, this.centerHandlePosition, this.radius)); }, update: function(type) {
        this.map.removeOverlay(this.polyline); if (type == 1) { this.dragHandlePosition = this.dragHandle.getPoint(); this.radius = Nx.Map.distance(this.centerHandlePosition, this.dragHandlePosition) * 1000; this.render(); }
        else { this.centerHandlePosition = this.centerHandle.getPoint(); this.render(); this.dragHandle.setPoint(this.getEast()); } 
    }, render: function() {
        if (this.type == Nx.Circle.CIRCLE) {
            this.points = []; var distance = this.radius / 1000; for (i = 0; i < 72; i++) { this.points.push(Nx.Circle.destination(this.centerHandlePosition, i * 360 / 72, distance)); }
            this.points.push(Nx.Circle.destination(this.centerHandlePosition, 0, distance)); this.polyline = new GPolygon(this.points, this.color, 1, 1, this.color, 0.2); this.map.addOverlay(this.polyline);
        } 
    }, remove: function() { this.map.removeOverlay(this.polyline); this.map.removeOverlay(this.dragHandle); this.map.removeOverlay(this.centerHandle); }, getRadius: function() { return this.radius; }, getNorth: function() { return this.points[0]; }, getSouth: function() { return this.points[(72 / 2)]; }, getEast: function() { return this.points[(72 / 4)]; }, getWest: function() { return this.points[(72 / 4 * 3)]; }, getCoord: function() { return this.centerHandlePosition; } 
    });
})(Nx.$);
(function($) { Nx.Map = function(control, $map) { var that = this; this.control = control; this.$map = $map; this.components = []; this.componentId = 0; this.map = new GMap2($map.get(0)); this.map.setCenter(new GLatLng(46.8, 8.2), 6); this.map.setUIToDefault(); this.defaultRadius = 10000; GEvent.addListener(this.map, 'click', function(overlay, point) { if (point) { $map.trigger('addMapSelection', [point]); } }); this.$map.bind('addMapSelection', function(e, point, id, radius, addToControl) { var latLng = new GLatLng(point.y, point.x); id = id || that.components.length + 1; radius = radius || that.defaultRadius; addToControl = addToControl === false ? false : true; var component = new Nx.Circle(that.control, that.map, id, latLng, radius); that.addComponent(id, component); if (addToControl) { var mapSelection = that.control.createMapSelection(id, point, radius); that.displayComponent(id); that.control.addMapSelection(mapSelection); } }); }; Nx.Map.distance = function(point1, point2) { var R = 6371; var lon1 = point1.lng() * Math.PI / 180; var lat1 = point1.lat() * Math.PI / 180; var lon2 = point2.lng() * Math.PI / 180; var lat2 = point2.lat() * Math.PI / 180; var deltaLat = lat1 - lat2; var deltaLon = lon1 - lon2; var step1 = Math.pow(Math.sin(deltaLat / 2), 2) + Math.cos(lat2) * Math.cos(lat1) * Math.pow(Math.sin(deltaLon / 2), 2); var step2 = 2 * Math.atan2(Math.sqrt(step1), Math.sqrt(1 - step1)); return step2 * R; }; Nx.Map.prototype = {}; Nx.Map.prototype.constructor = Nx.Map; $.extend(Nx.Map.prototype, { addComponent: function(id, component) { this.components[id] = component; component.render(); return id; }, removeComponent: function(id) { var component = this.components[id]; if (component) { component.remove(); this.components[id] = null; } }, displayComponent: function(id) { var component = this.components[id]; if (component) { this.map.setZoom(11); this.map.panTo(component.getCoord()); } } }); })(Nx.$);
(function($) {
    Nx.Module.Criteria = function($ctx, sandbox, modId) {
        Nx.Module.call(this, $ctx, sandbox, modId); var that = this; that.config = {}; var info = $('a.criteriainfo', that.$ctx).attr('rel'); if (info) {
            info = info.split(':'); if (info.length >= 2) {
                that.config = { criteriaType: info[0], criteriaId: info[1] }; if (info.length === 2) { that.config.readonly = false; }
                else { that.config.readonly = info[2]; } 
            } 
        } 
    }; Nx.Module.Criteria.prototype = new Nx.Module(); Nx.Module.Criteria.prototype.constructor = Nx.Module.Criteria; $.extend(Nx.Module.Criteria.prototype, { onBinding: function() { var that = this; $('div.bd', that.$ctx).hover(function() { $(this).addClass('bdEdit'); }, function() { $(this).removeClass('bdEdit'); }); if (that.config.readonly) { that.block(Nx.lang.onlyAvailableAfterLogin); } }, block: function(message) { var that = this; message = message || ''; that.$ctx.block({ message: message, css: { padding: '10px', width: '350px', top: '26%', color: '#ff1c00', border: '0', cursor: 'default' }, overlayCSS: { backgroundColor: '#fff', opacity: 0.8, cursor: 'default' }, centerY: false }); }, unblock: function() { var that = this; that.$ctx.unblock(); }, setStatusConfigured: function(isConfigured) {
        var that = this; if (isConfigured) { $('div.bd', that.$ctx).addClass('bdConfigured'); }
        else { $('div.bd', that.$ctx).removeClass('bdConfigured'); } 
    }, updateCriteria: function(serviceMethod, jsonData, callback) {
        var that = this; jsonData = Nx.$.json.encode(jsonData); that.block(); clearTimeout(that.updateTotalTimeout); $.ajax({ url: Nx.Utils.Service.config.base + serviceMethod, data: jsonData, type: 'POST', processData: true, cache: false, contentType: "application/json", timeout: Nx.Utils.Service.config.timeout.update, dataType: 'json', success: function(data) {
            var result = data[serviceMethod + 'Result']; if (result && result.status === Nx.Utils.Service.status.ok) {
                if ($.isFunction(callback)) { callback(result); }
                that.setCriteriaStatusConfigured(); that.unblock(); that.updateTotalTimeout = setTimeout(function() { that.fire('updateTotal'); }, 1400);
            }
            else { $.log.error('[Criteria] AJAX: Status not "ok"'); Nx.Utils.Service.ajaxerror(); } 
        }, error: function() { $.log.error('[Criteria] AJAX: Error or timeout'); Nx.Utils.Service.ajaxerror(); } 
        });
    }, getValues: function(serviceMethod, params, callback) {
        var that = this; $.ajax({ url: Nx.Utils.Service.config.base + serviceMethod + params, type: 'GET', contentType: "application/json", timeout: Nx.Utils.Service.config.timeout.update, dataType: 'json', cache: false, success: function(data) {
            var result = data[serviceMethod + 'Result']; if (result && result.status === Nx.Utils.Service.status.ok) { if ($.isFunction(callback)) { callback(result); } }
            else { $.log.error('[Criteria] AJAX: Status not "ok"'); Nx.Utils.Service.ajaxerror(); } 
        }, error: function() { $.log.error('[Criteria] AJAX: Error or timeout'); Nx.Utils.Service.ajaxerror(); } 
        });
    } 
    });
})(Nx.$);
(function($) {
    Nx.Module.Ordercriteria = function($ctx, sandbox, modId) { Nx.Module.call(this, $ctx, sandbox, modId); }; Nx.Module.Ordercriteria.prototype = new Nx.Module(); Nx.Module.Ordercriteria.prototype.constructor = Nx.Module.Ordercriteria; $.extend(Nx.Module.Ordercriteria.prototype, { counter: 0, $updatableContainer: {}, beforeBinding: function(callback) { var that = this; that.$updatableContainer = $('.ordercriteriaUpdate', that.$ctx); callback(); }, onBinding: function() {
        var that = this; $('dt.closed', that.$ctx).next('dd').hide(); $('dt', that.$ctx).bind('click', function() { $(this).toggleClass('closed').next('dd').toggle(0); }); $('dl', that.$ctx).localScroll({ lazy: true, duration: 400, axis: 'xy', hash: true }); $('.block_saveselection', that.$ctx).bind('click', function() { var options = { $obj: $('#SaveSelection') }; Nx.Utils.Block.show(options); return false; }); $('dd', that.$ctx).delegate(':checkbox', 'change', function() {
            var updatedata = { criteriaId: this.name, criteriaSelected: this.checked }; var jsonstring = Nx.$.json.encode(updatedata); that.counter++; if (that.counter === 1) { that.block(); }
            $.ajax({ url: Nx.Utils.Service.config.base + 'setCriteria', data: jsonstring, type: 'POST', processData: true, cache: false, contentType: "application/json", timeout: Nx.Utils.Service.config.timeout.calculate, dataType: 'json', success: function(data) {
                var result = data.setCriteriaResult; if (result && result.status === Nx.Utils.Service.status.ok) {
                    if (result.total) { $('span.total', that.$updatableContainer).text(result.total); }
                    that.counter--; if (that.counter === 0) { that.unblock(); }
                    that.onUpdateTotal();
                }
                else { $.log.error('[Ordercriteria include/exclude] AJAX: Status Anfrage nicht "ok"'); Nx.Utils.Service.ajaxerror(function() { that.unblock(); }); } 
            }, error: function() { $.log.error('[Ordercriteria include/exclude] AJAX: Error or timeout'); Nx.Utils.Service.ajaxerror(function() { that.unblock(); }); } 
            });
        });
    }, block: function() { var that = this; that.$updatableContainer.block({ message: '<img src="/img/loader.gif" />', css: { border: 'none', background: 'transparent', width: 100, textAlign: 'center', cursor: 'wait' }, overlayCSS: { backgroundColor: '#fff', opacity: 0.5} }); }, unblock: function() { var that = this; that.$updatableContainer.unblock(); }, onUpdateTotal: function() {
        var that = this; that.counter++; if (that.counter === 1) { that.block(); }
        $.ajax({ url: Nx.Utils.Service.config.base + 'getSummary', type: 'GET', contentType: "application/json", timeout: Nx.Utils.Service.config.timeout.calculate, dataType: 'json', cache: false, success: function(data) {
            var result = data.getSummaryResult, i = 0, arrList = []; if (result && result.status === Nx.Utils.Service.status.ok) {
                if (result.total) { $('span.total', that.$updatableContainer).text(result.total); }
                if (result.notDefinedCriteria) { var $notDefinedCriteria = $('dd:eq(0) ul', that.$updatableContainer); if ($notDefinedCriteria.length && result.notDefinedCriteria) { $notDefinedCriteria.empty(); arrList = []; $.each(result.notDefinedCriteria, function(index, value) { if (value) { arrList.push('<li>'); arrList.push('<a href="#criteria'); arrList.push(value.criteriaId); arrList.push('">'); arrList.push(value.criteriaLabel); arrList.push('</a>'); arrList.push('</li>'); } }); $notDefinedCriteria.append(arrList.join('')); } }
                if (result.definedCriteria) {
                    var $definedCriteria = $('dd:eq(1) ul', that.$updatableContainer); if ($definedCriteria.length && result.definedCriteria) {
                        $definedCriteria.empty(); arrList = []; $.each(result.definedCriteria, function(index, value) {
                            if (value) {
                                arrList.push('<li>'); arrList.push('<input type="checkbox" name="check_criteria'); arrList.push(value.criteriaId); arrList.push('"'); if (value.criteriaSelected) { arrList.push(' checked="checked"'); }
                                arrList.push('/>'); arrList.push('<a href="#criteria'); arrList.push(value.criteriaId); arrList.push('">'); arrList.push(value.criteriaLabel); arrList.push('</a>'); arrList.push('<span>' + value.criteriaCount + '</span>'); arrList.push('</li>');
                            } 
                        }); $definedCriteria.append(arrList.join(''));
                    } 
                }
                that.counter--; if (that.counter === 0) { that.unblock(); } 
            }
            else { $.log.error('[Orderciteria onUpdateTotal] Status Anfrage nicht "ok"'); Nx.Utils.Service.ajaxerror(function() { that.unblock(); }); } 
        }, error: function() { $.log.error('[Orderciteria onUpdateTotal] Status Anfrage nicht "ok"'); Nx.Utils.Service.ajaxerror(function() { that.unblock(); }); } 
        });
    } 
    });
})(Nx.$);
(function($) { Nx.Module.Servicenav = function($ctx, sandbox, modId) { Nx.Module.call(this, $ctx, sandbox, modId); }; Nx.Module.Servicenav.prototype = new Nx.Module(); Nx.Module.Servicenav.prototype.constructor = Nx.Module.Servicenav; $.extend(Nx.Module.Servicenav.prototype, { onBinding: function() { var that = this; $('.block_login', that.$ctx).bind('click', function() { var options = { $obj: $('#VisualLoginLogin') }; Nx.Utils.Block.show(options); return false; }); $('.block_passwordrecovery', that.$ctx).bind('click', function() { var options = { $obj: $('#VisualLoginPassword') }; Nx.Utils.Block.show(options); return false; }); } }); })(Nx.$);
(function($) { Nx.Module.VisualLogin = function($ctx, sandbox, modId) { Nx.Module.call(this, $ctx, sandbox, modId); }; Nx.Module.VisualLogin.prototype = new Nx.Module(); Nx.Module.VisualLogin.prototype.constructor = Nx.Module.VisualLogin; $.extend(Nx.Module.VisualLogin.prototype, { onBinding: function() { var that = this; $('.block_login', that.$ctx).bind('click', function() { var options = { $obj: $('#VisualLoginLogin') }; Nx.Utils.Block.show(options); return false; }); $('.block_passwordrecovery', that.$ctx).bind('click', function() { var options = { $obj: $('#VisualLoginPassword') }; Nx.Utils.Block.show(options); return false; }); } }); })(Nx.$);
(function($) { Nx.Module.Criteria.Between = function(parent) { this.onBinding = function() { var that = this; parent.onBinding(); that.setCriteriaStatusConfigured(); $('.slider', that.$ctx).each(function() { var $this = $(this); var min = parseFloat($this.attr('data-min')); var max = parseFloat($this.attr('data-max')); var currentMin = parseFloat($this.attr('data-current-min')); var currentMax = parseFloat($this.attr('data-current-max')); $this.slider({ range: true, min: min, max: max, values: [currentMin, currentMax], slide: function(e, ui) { $('span', $(ui.handle)).text(ui.value); }, stop: function(e, ui) { var $handle = $(ui.handle); var jsonData = { criteriaId: that.config.criteriaId, minValue: ui.values[0], maxValue: ui.values[1] }; that.updateCriteria('setCriteriaBetween', jsonData); } }); $($('.ui-slider-handle', $this).get(0)).addClass('lowerValue'); $this.after($('<label class="left">' + min + '</label>')); $this.after($('<label class="right">' + max + '</label>')); $('.ui-slider-handle', $this).append($('<span></span>')); $($('.ui-slider-handle span', $this).get(0)).text(currentMin); $($('.ui-slider-handle span', $this).get(1)).text(currentMax); }); }; this.setCriteriaStatusConfigured = function() { var that = this; $('.slider', that.$ctx).each(function() { var $this = $(this); var min = parseFloat($this.attr('data-min')); if (parseFloat($(this).attr('data-current-min')) >= min || parseFloat($(this).attr('data-current-max')) >= min) { that.setStatusConfigured(true); } }); }; }; })(Nx.$);
(function($) {
    Nx.Module.Criteria.CategorySearch = function(parent) {
        this.onBinding = function() {
            var that = this; parent.onBinding(); that.setCriteriaStatusConfigured(); var $selectionBox = $('.categorySelection', that.$ctx); var $categoryBox = $('.categoryBox', that.$ctx); $('.tabs', that.$ctx).tabs(); var categoryStack = [{ id: 0, parentId: 0, label: ''}]; $('.boxNavigation', that.$ctx).delegate('.backToFirst', 'click', function() {
                if (categoryStack.length > 1) { var firstEntry = categoryStack[0]; categoryStack = []; categoryStack.push(firstEntry); $categoryBox.trigger('displayCategories', ['left']); }
                return false;
            }).delegate('.back', 'click', function() {
                if (categoryStack.length > 1) { categoryStack.pop(); $categoryBox.trigger('displayCategories', ['left']); }
                return false;
            }); $categoryBox.delegate('.next', 'click', function() {
                var $this = $(this); var selected = $this.closest('li').hasClass('selected'); if (!selected) { var $input = $('input', $this.closest('li')); categoryStack.push({ id: $input.attr('value'), parentId: $input.attr('data-parent-id'), label: $('label', $this.closest('li')).text() }); $this.trigger('displayCategories', ['right']); }
                return false;
            }).delegate('input:checkbox', 'click', function() {
                var $this = $(this); var checked = $this.attr('checked'); var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [{ valueKey: $this.attr('value'), valueSelected: checked}] }; that.updateCriteria('setCriteriaValues', jsonData, function() {
                    if (checked) { $this.trigger('checkCategory', [$this.attr('value')]); $selectionBox.trigger('addCategory', [{ id: $this.attr('value'), label: $('label', $this.closest('li')).text()}]); }
                    else { $this.trigger('uncheckCategory', [$this.attr('value')]); $selectionBox.trigger('removeCategory', [$this.attr('value')]); } 
                });
            }).bind('displayCategories', function(e, direction) {
                direction = direction || 'right'; var stackEntry = categoryStack[categoryStack.length - 1]; that.getValues('getCategories', '/' + that.config.criteriaId + '/' + stackEntry.id, function(result) {
                    var o = []; for (var i = 0; i < result.criteriaValues.length; i++) {
                        var criteriaValue = result.criteriaValues[i]; var checked = criteriaValue.valueSelected ? 'checked="checked"' : ''; var className = i % 2 === 0 ? 'odd' : 'even'; className += criteriaValue.valueSelected || criteriaValue.valueParentSelected ? ' selected' : ''; o[o.length] = '<li class="' + className + '">'; o[o.length] = '<input ' + checked + ' data-parent-id="' + criteriaValue.valueParentId + '" type="checkbox" id="cat' + criteriaValue.valueKey + '" name="category" value="' + criteriaValue.valueKey + '" />'; if (criteriaValue.valueHasChildren) { o[o.length] = '<a href="#" title="" class="icon next">&nbsp;</a>'; }
                        o[o.length] = '<label for="cat' + criteriaValue.valueKey + '">' + criteriaValue.valueLabel + '</label>'; o[o.length] = '</span>';
                    }
                    $currentCategory = $('.currentCategory', that.$ctx); $currentCategory.text(stackEntry.label); $('ul', $categoryBox).html(o.join('')).effect('slide', { direction: direction }, 500);
                });
            }).bind('checkCategory', function(e, id) { var $this = $('input[value=' + id + ']', $(this)); $this.closest('li').addClass('selected'); $this.attr('checked', true); }).bind('uncheckCategory', function(e, id) { var $this = $('input[value=' + id + ']', $(this)); $this.closest('li').removeClass('selected'); $this.attr('checked', false); }); var $search = $('.search', that.$ctx); $search.autocomplete({ source: function(request, response) {
                that.getValues($search.attr('data-url'), '/' + that.config.criteriaId + '/' + request.term, function(result) {
                    var suggestions = []; for (var i = 0; i < result.criteriaValues.length; i++) { var criteriaValue = result.criteriaValues[i]; var o = []; var className = criteriaValue.valueSelected ? 'alreadySelected' : ''; o[o.length] = '<span class="' + className + '">'; o[o.length] = criteriaValue.valueLabel; o[o.length] = '</span>'; suggestions.push({ 'value': criteriaValue.valueKey, 'description': criteriaValue.valueLabel, 'label': o.join(''), 'selected': criteriaValue.valueSelected }); }
                    response(suggestions);
                });
            }, minLength: 3, delay: 200, multiple: true, focus: function(e, ui) { return false; }, open: function(e, ui) { $('.ui-autocomplete').css('zIndex', 100); return false; }, close: function(e, ui) { return false; }, select: function(e, ui) {
                if (!ui.item.selected) {
                    var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [] }; var items = []; if (ui.item.value == -1) { $('li:gt(0)', $search.autocomplete('widget')).each(function() { var item = $(this).data("item.autocomplete"); if (!item.selected) { jsonData.criteriaValues.push({ valueKey: item.value, valueSelected: true }); items.push(item); } }); }
                    else { jsonData.criteriaValues.push({ valueKey: ui.item.value, valueSelected: true }); items.push(ui.item); }
                    that.updateCriteria('setCriteriaValues', jsonData, function() {
                        for (var i = 0; i < items.length; i++) { var item = items[i]; $selectionBox.trigger('addCategory', [{ id: item.value, label: item.description}]); }
                        $('.search', that.$ctx).autocomplete('search');
                    });
                }
                return false;
            } 
            }); $search.bind('keypress', function(e) { if (e.keyCode === 13) { e.preventDefault(); } }); $selectionBox.delegate('.remove', 'click', function() { var $this = $(this); var id = $this.attr('rel'); var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [{ valueKey: id, valueSelected: false}] }; that.updateCriteria('setCriteriaValues', jsonData, function() { $this.trigger('removeCategory', [id]); $categoryBox.trigger('uncheckCategory', [id]); }); return false; }).bind('addCategory', function(e, category) { var $this = $(this); var $item = $('<li><a rel="' + category.id + '" class="icon remove">&nbsp;</a><span>' + category.label + '</span></li>'); $('ul', $this).prepend($item); $item.effect('highlight', { 'color': '#ff6257' }, 500); }).bind('removeCategory', function(e, id) { var $this = $(this); $('a[rel=' + id + ']', $this).closest('li').effect('highlight', { 'color': '#ff6257', 'mode': 'hide' }, 500, function() { $(this).remove(); }); }); $('.removeCategories', that.$ctx).bind('click', function() { var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [] }; var categories = []; $('.remove', $selectionBox).each(function() { var $this = $(this); var id = $this.attr('rel'); jsonData.criteriaValues.push({ valueKey: id, valueSelected: false }); categories.push(id); }); that.updateCriteria('setCriteriaValues', jsonData, function() { $('ul', $selectionBox).html(''); for (var i = 0; i < categories.length; i++) { $categoryBox.trigger('uncheckCategory', [categories[i]]); } }); return false; }); $('.addCategories', that.$ctx).bind('click', function() { var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [] }; var categories = []; $('input', $categoryBox).each(function() { var $this = $(this); var id = $this.val(); if (!$this.is(':checked')) { jsonData.criteriaValues.push({ valueKey: id, valueSelected: true }); categories.push({ id: id, label: $('label', $this.closest('li')).text() }); } }); categories.reverse(); that.updateCriteria('setCriteriaValues', jsonData, function() { for (var i = 0; i < categories.length; i++) { $categoryBox.trigger('checkCategory', [categories[i].id]); $selectionBox.trigger('addCategory', [{ id: categories[i].id, label: categories[i].label}]); } }); return false; });
        }; this.setCriteriaStatusConfigured = function() { var that = this; var isConfigured = $('li', $('.categorySelection', that.$ctx)).length; that.setStatusConfigured(isConfigured); };
    };
})(Nx.$);
(function($) { Nx.Module.Criteria.Inlist = function(parent) { this.onBinding = function() { var that = this; parent.onBinding(); that.setCriteriaStatusConfigured(); $('ol.form', that.$ctx).delegate(':checkbox', 'change', function() { var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: [{ valueKey: this.name, valueSelected: this.checked}] }; that.updateCriteria('setCriteriaValues', jsonData, null); }); }; this.setCriteriaStatusConfigured = function() { var that = this; var isConfigured = $(':checkbox:checked', that.$ctx).length; that.setStatusConfigured(isConfigured); }; }; })(Nx.$);
(function($) {
    Nx.Module.Criteria.Map = function(parent) {
        this.onBinding = function() {
            var that = this; parent.onBinding(); var map = null; var $map = $('.map', that.$ctx); var $selectionBox = $('.mapSelection', this.$ctx); var $radiusBox = $('.radiusSelection', this.$ctx); $('.tabs', that.$ctx).bind('tabselect', function(e, ui) { return false; }).bind('tabsshow', function(e, ui) {
                var selectedIndex = ui.index; var $categorySelection = $('.categorySelection', that.$ctx); if (selectedIndex === 0 || selectedIndex === 1) { $categorySelection.addClass('boxSelected').prev().addClass('active'); $selectionBox.removeClass('boxSelected').prev().removeClass('active'); }
                else if (selectedIndex === 2) { $selectionBox.addClass('boxSelected').prev().addClass('active'); $categorySelection.removeClass('boxSelected').prev().removeClass('active'); if (!map) { map = new Nx.Map(that, $map); $('li', $selectionBox).each(function() { var $this = $(this); var point = { y: $this.attr('data-lat'), x: $this.attr('data-lng') }; $map.trigger('addMapSelection', [point, $this.attr('data-id'), $this.attr('data-radius'), false]); }); } }
                return false;
            }); $selectionBox.delegate('.remove', 'click', function() { var $this = $(this).closest('li'); var id = $this.attr('data-id'); var radius = $this.attr('data-radius'); var lat = $this.attr('data-lat'); var lng = $this.attr('data-lng'); var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: { "selectionId": id, "radius": radius, "lat": lat, "lng": lng, "valueSelected": false} }; that.updateCriteria('setMapLocations', jsonData, function() { $selectionBox.trigger('removeMapSelection', [id]); if (map) { map.removeComponent(id); } }); return false; }).delegate('.panSelection', 'click', function() { var $this = $(this).closest('li'); var id = $this.attr('data-id'); map.displayComponent(id); return false; }).bind('updateMapSelection', function(e, mapSelection) { var $this = $(this); var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: { "selectionId": mapSelection.id, "radius": mapSelection.radius, "lat": mapSelection.lat, "lng": mapSelection.lng, "valueSelected": true} }; that.updateCriteria('setMapLocations', jsonData, function(result) { var label = that.createLabel(result, mapSelection.radius); var $item = $('li[data-id=' + mapSelection.id + ']', $this); $item.attr('data-radius', mapSelection.radius).attr('data-lng', mapSelection.lng).attr('data-lat', mapSelection.lat).effect('highlight', { 'color': '#ff6257' }, 500).find('.panSelection').text(label); }); }).bind('addMapSelection', function(e, mapSelection) { var $this = $(this); var jsonData = { criteriaId: that.config.criteriaId, criteriaValues: { "selectionId": mapSelection.id, "radius": mapSelection.radius, "lat": mapSelection.lat, "lng": mapSelection.lng, "valueSelected": true} }; that.updateCriteria('setMapLocations', jsonData, function(result) { var label = that.createLabel(result, mapSelection.radius); var $item = $('<li data-id="' + mapSelection.id + '" data-lat="' + mapSelection.lat + '" data-lng="' + mapSelection.lng + '" data-radius="' + mapSelection.radius + '"><a class="icon remove">&nbsp;</a><a href="#" class="base"><span class="panSelection">' + label + '</span></a></li>'); $('ul', $this).prepend($item); $item.effect('highlight', { 'color': '#ff6257' }, 500); }); }).bind('removeMapSelection', function(e, id) { var $this = $(this); $('li[data-id=' + id + ']', $this).effect('highlight', { 'color': '#ff6257', 'mode': 'hide' }, 500, function() { $(this).remove(); }); }); $('.removeMaps', that.$ctx).bind('click', function() {
                var jsonData = { criteriaId: that.config.criteriaId }; that.updateCriteria('removeAllMapSelections', jsonData, function(result) {
                    if (map) { $('li', $selectionBox).each(function() { var $this = $(this); map.removeComponent($this.attr('data-id')); }); }
                    $('ul', $selectionBox).html('');
                }); return false;
            }); $('body').bind('unload', function() { GUnload(); });
        }; this.addMapSelection = function(mapSelection) { var $selectionBox = $('.mapSelection', this.$ctx); $selectionBox.trigger('addMapSelection', mapSelection); }; this.updateMapSelection = function(mapSelection) { var $selectionBox = $('.mapSelection', this.$ctx); $selectionBox.trigger('updateMapSelection', mapSelection); }; this.createMapSelection = function(id, latLng, radius) { var mapSelection = { id: id, lat: latLng.lat(), lng: latLng.lng(), radius: parseInt(radius, 10) }; return mapSelection; }; this.createLabel = function(result, radius) {
            var l = []; if (result.ZIP) { l[l.length] = result.ZIP; l[l.length] = ' '; }
            if (result.city) { l[l.length] = result.city; l[l.length] = ' '; }
            if (radius) { l[l.length] = ' + ' + radius + ' m'; }
            return l.join('');
        };
    };
})(Nx.$);
