/** COPYRIGHT 2011 ADMX V.O.F., BAARLE-NASSAU, SCHIJF, THE NETHERLANDS  */
/** * * prototype object constructor (compact) */var px = 'px';CLASS = function(core, extended) {var obj = {};if ('function' == typeof core) {var x = new core();for ( var i in x) {obj[i] = x[i];}} else {for ( var i in core) {obj[i] = core[i];}}for ( var i in extended) {obj[i] = extended[i];}var z = [];for ( var i = 1; i < arguments.length; i++) {z.push(arguments[i]);}if (arguments.length < 1) {z.push(arguments[0]);}return function() {for ( var i in obj) {this[i] = obj[i];}var b = [];if (arguments.length > 0) {for ( var i = 0; i < arguments.length; i++) {b.push(arguments[i]);}}var args = b.concat(z);if (this.initialize) {this.initialize.apply(this, args);}};};Function.prototype.bind = function(scope) {var fnc = this;var z = [];for ( var i = 1; i < arguments.length; i++) {z.push(arguments[i]);}if (arguments.length < 1) {z.push(arguments[0]);};return function() {var b = [];if (arguments.length > 0) {for ( var i = 0; i < arguments.length; i++) {b.push(arguments[i]);}}var args = z.concat(b);fnc.apply(scope, args);};};var XE = E = {add : function(obj, event, fnc) {if (obj.addEventListener) {obj.addEventListener(event, fnc, false);} else if (obj.attachEvent) {obj.attachEvent(event, fnc);}},remove : function(obj, event, fnc) {if (obj.addEventListener) {obj.removeEventListener(event, fnc, false);} else if (obj.detachEvent) {obj.detachEvent(event, fnc);}}};Mouse = new CLASS();Mouse.prototype = {handle : null,bounds : null,draggable : false,init : function(set) {for ( var i in set) {this[i] = set[i];}var obj = this.obj;this.handle = (this.handle) ? this.handle : alert('handle not set');this.bounds = (this.bounds) ? this.bounds : this.handle;if (this.draggable) {this.handle.style.cursor = 'move';} else {this.handle.style.cursor = 'pointer';}this._e8 = this._down.bind(this);E.add(this.handle, 'mousedown', this._e8);this._e1 = this._up.bind(this);E.add(this.handle, 'mouseup', this._e1);this._e11 = this._over.bind(this);E.add(this.handle, 'mouseover', this._e11);this._e12 = this._out.bind(this);E.add(this.handle, 'mouseout', this._e12);return this;},_over : function(e) {return (this.eOver) ? this.eOver(e) : false;},_out : function(e) {return (this.eOut) ? this.eOut(e) : false;},_down : function(e) {this._upState = false;this._clickCounter(e);this._start(e);return (this.eDown) ? this.eDown(e) : false;},_up : function(e) {this._upState = true;this._stop(e);return (this.eUp) ? this.eUp(e) : false;},eStart : function(e) {return (this.fncStart) ? this.fncStart(e) : false;},eMove : function(e) {return (this.fncMove) ? this.fncMove(e) : false;},eStop : function(e) {return (this.fncStop) ? this.fncStop(e) : false;},_upState : true,_clickTimer : null,_clickCount : 0,_clickCounter : function(e) {this._clickCount += 1;if (this._clickTimer == null) {this._clickTimer = setTimeout(this._clickTrigger.bind(this), 400, e);}},_clickTrigger : function(e) {alert(this._clickCount);if (this._upState == true) {switch (this._clickCount) {case 4:case 3:x = (this.eClick3) ? this.eClick3(e) : null;break;case 2:x = (this.eClick2) ? this.eClick2(e) : null;break;case 1:x = (this.eClick1) ? this.eClick1(e) : null;break;}}clearTimeout(this._clickTimer);this._clickTimer = null;this._clickCount = 0;},_start : function(e) {if (this.draggable == false) {return;}var o = Dom.getPosition(this.bounds);this._x = o.x;this._y = o.y;var scroll = Dom.getScrollPosition(this.bounds);this.mI = Dom.getMousePosition(e);this._mxI = this.mI.x + scroll.x;this._myI = this.mI.y + scroll.y;this._e4 = this._move.bind(this);E.add(document.body, 'mousemove', this._e4);this.eStart(e);},_masked : false,_maskRemove : function() {this._masked = false;Dom.setOpacity(this.bounds, 1);Dom.un(this._mask);Dom.un(this._clone);},_maskCreate : function(e) {if (this._masked == true) {return;}this._masked = true;this._mask = Dom.div(document.body, {'class' : 'dragMask'});this._e3 = this._up.bind(this);E.add(this._mask, 'mouseup', this._e3);with (this._mask.style) {position = 'fixed';top = '0px';right = '0px';bottom = '0px';left = '0px';zIndex = 9999;}this._mask.style.cursor = 'move';this._clone = this.bounds.cloneNode(true);document.body.appendChild(this._clone);var d = Dom.getDimensions(this.bounds);this._clone.style.width = d.width + px;this._clone.style.height = d.height + px;Dom.setOpacity(this.bounds, 0.5);this._move(e);},_move : function(e) {if (this.draggable == false) {return;};Dom.deselectAll();var m = Dom.getMousePosition(e);this._mx = m.x;this._my = m.y;if (!(Math.abs(this._mx - this.mI.x) > 3 || Math.abs(this._my- this.mI.y) > 3)) {return;} else {if (this._masked == false) {this._maskCreate(e);}}if (Math.abs(this._mx - this.mI.x) > 6|| Math.abs(this._my - this.mI.y) > 6) {this._clickCount = 0;}var mx = (this._mxI - this._mx);var my = (this._myI - this._my);this._e33 = this._up.bind(this);E.add(document.body, 'mouseup', this._e33);with (this._clone.style) {position = 'absolute';left = (this._x - mx) + 'px';top = (this._y - my) + 'px';zIndex = 9999;}this.handle.style.cursor = 'move';this._mask.style.cursor = 'move';this.eMove(e);},_stop : function(e) {if (this.draggable == false) {return;};E.remove(document.body, 'mouseup', this._e3);E.remove(document.body, 'mousemove', this._e4);this._maskRemove();this.eStop(e);},destroy : function() {E.remove(document.body, 'mouseup', this._e33);E.remove(document.body, 'mousemove', this._e4);E.remove(this.handle, 'mousedown', this._e8);E.remove(this.handle, 'mouseup', this._e1);E.remove(this._mask, 'mouseup', this._e3);E.remove(this.handle, 'mouseover', this._e11);E.remove(this.handle, 'mouseout', this._e12);}};Server = {getTransport : function() {return Try.these(function() {return new XMLHttpRequest();}, function() {return new ActiveXObject('Msxml2.XMLHTTP');}, function() {return new ActiveXObject('Microsoft.XMLHTTP');}) || false;},request : function(url, post, fnc) {var xhr = Server.getTransport();if (xhr == null) {alert("Server hyper request not supported");return false;}var obj = {};xhr.open("POST", url, true);xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.onreadystatechange = function() {switch (true) {case (xhr.readyState == 4 && xhr.status == 200): if (xhr.responseText.evalJSON) {obj = eval(xhr.responseText.evalJSON());} else {obj = JSON.parse(xhr.responseText);}Server.errorHandler(obj.error);fnc(obj);}};if (window.JSON && window.JSON.stringify) {post = window.JSON.stringify(post);post = encodeURIComponent(post);xhr.send("json=" + post);return true;} else {alert(' err. could not stringify ');return false;}},errorHandler : function(errors) {if (errors && 'array' == typeof (errors)) {for ( var i = 0; i < errors.length; i++) {alert('xhr err. ' + errors[i].msg + ' : ' + errors[i].number);}} else {return;}}};Try = {these : function() {var returnValue;for ( var i = 0, length = arguments.length; i < length; i++) {var lambda = arguments[i];try {returnValue = lambda();break;} catch (e) {}}return returnValue;}};String.prototype.camelize = function() {return String(this).replace(/\-(.)/, function(org, a) {return (a) ? a.toUpperCase() : '';});};var Dom = {doc : document,un : function(item) {if (item && item.childNodes) {for ( var i = 0; i < item.childNodes.length; i++) {Dom.un(item.childNodes[i]);}}if (item && item.parentNode) {item.parentNode.removeChild(item);}},unChild : function(item) {if ((item) && (item.childNodes)) {for ( var i = 0; i < item.childNodes.length; i++) {var ch = item.childNodes[i];Dom.un(ch);}}return true;},div : function(attach, props, content, contentEditable) {var obj = this.doc.createElement('div');this.setProps(obj, props);if (content != undefined) {obj.innerHTML = content;}if (contentEditable == true) {obj.contentEditable = true;}if (attach != undefined) {attach.appendChild(obj);}return obj;},form : function(attach, props, content) {var obj = this.doc.createElement('form');this.setProps(obj, props);if (content != undefined) {obj.innerHTML = content;}if (attach != undefined) {attach.appendChild(obj);}return obj;},table : function(attach, props) {var table = this.doc.createElement('table');if (attach != undefined) {attach.appendChild(table);}var tbody = this.doc.createElement('tbody');table.appendChild(tbody);this.setProps(table, props);return tbody;},tr : function(attach, props) {var obj = this.doc.createElement('tr');this.setProps(obj, props);if (attach != undefined) {attach.appendChild(obj);}return obj;},td : function(attach, props, content) {var obj = this.doc.createElement('td');this.setProps(obj, props);if (content != undefined) {obj.innerHTML = content;}if (attach != undefined) {attach.appendChild(obj);}return obj;},label : function(attach, props, content) {var obj = document.createElement('label');this.setProps(obj, props);if (content != undefined) {obj.innerHTML = content;}attach.appendChild(obj);return obj;},input : function(attach, props, value) {var obj = this.doc.createElement('input');this.setProps(obj, this.mergeObject(props, {'value' : value}));attach.appendChild(obj);return obj;},button : function(attach, props, value) {var obj = this.doc.createElement('input');this.setProps(obj, this.mergeObject(props, {'type' : 'button','value':value}));attach.appendChild(obj);return obj;},inputPassword : function(attach, props, value) {var obj = this.doc.createElement('input');this.setProps(obj, this.mergeObject(props, {'type' : 'password'}));if (value) {obj.value = value;}if (attach) {attach.appendChild(obj);}return obj;},submit : function(attach, props, value) {var obj = this.doc.createElement('input');this.setProps(obj, this.mergeObject(props, {'type' : 'submit'}));if (value) {obj.value = value;}if (attach) {attach.appendChild(obj);}return obj;},inputCheckbox : function(attach, props, value) {var obj = this.doc.createElement('input');this.setProps(obj, this.mergeObject(props, {'type' : 'checkbox','value' : value}));if (attach) {attach.appendChild(obj);}return obj;},textarea : function(attach, props, value) {var obj = this.doc.createElement('textarea');this.setProps(obj, props);if (value){obj.value = value;}attach.appendChild(obj);return obj;},iframe : function(attach, props) {var obj = document.createElement('iframe');this.setProps(obj, props);attach.appendChild(obj);return obj;},iframeContent : function(iframe) {return (iframe.contentDocument) ? iframe.contentDocument: iframe.contentWindow;},img : function(attach, props) {var obj = this.doc.createElement('img');this.setProps(obj, props);if (attach != undefined) {attach.appendChild(obj);}return obj;},inputText : function(attach, props, content) {var props = this.mergeObject({'type' : 'text'}, props);if (content) {props = this.mergeObject({'value' : content}, props);}var obj = this.doc.createElement('input');this.setProps(obj, props);if (attach) {attach.appendChild(obj);}return obj;},css : function(attach, props, href) {var obj = this.doc.createElement('link');var standard = {'type' : "text/css",'rel' : "stylesheet",'href' : href};this.setProps(obj, this.mergeObject(standard, props));attach.appendChild(obj);return obj;},setProps : function(obj, props) {for ( var i in props) {b = (i == 'class') ? 'className' : i;if (i == 'style') {var d = props[i].split(/;/);for ( var x in d) {if (d[x].split) {var z = d[x].split(/\:/);var p = z[0].replace(/\s+|\s/, '');var val = z[1];if (p && val != undefined) {p = (p == 'float') ? 'cssFloat' : p;obj[i][p.camelize()] = val.replace(/^\s+/, '');}}}} else {obj[b] = props[i];}}},mergeObject : function(a, b) {var o = {};for ( var i in a) {o[i] = a[i];}for ( var i in b) {o[i] = b[i];}return o;},getPosition : function(obj) {var top = 0, left = 0;if (obj && obj.offsetParent) {do {top += obj.offsetTop;left += obj.offsetLeft;} while (obj = obj.offsetParent);return {x : left,y : top};} else {return {x : 0,y : 0};}},getScrollPosition : function(node) {var x = 0;var y = 0;if (node) {if (node.pageXOffset) {do {if (node.nodeName == 'BODY') {break;}x += Number((node.pageXOffset) ? node.pageXOffset : 0);y += Number((node.pageYOffset) ? node.pageYOffset : 0);} while (node = node.parentNode);} else {do {if (node.nodeName == 'BODY') {break;}x += Number((node.scrollLeft) ? node.scrollLeft : 0);y += Number((node.scrollTop) ? node.scrollTop : 0);} while (node = node.parentNode);}}return {'x' : x,'y' : y};},mouseOffset : function(e) {var x = e.offsetX ? (e.offsetX) : 10;var y = e.offsetY ? (e.offsetY) : 10;return {'x' : x,'y' : y};},mousePosition : function(e) {var x = (e.pageX) ? (e.pageX) : (e.clientX) ? (e.clientX) : 0;var y = (e.pageY) ? (e.pageY) : (e.clientY) ? (e.clientY) : 0;return {x : x,y : y};},getMousePosition : function(e) {var x = (e.pageX) ? (e.pageX) : (e.clientX) ? (e.clientX) : 0;var y = (e.pageY) ? (e.pageY) : (e.clientY) ? (e.clientY) : 0;return {x : x,y : y};},deselectAll : function() {if (document.selection && document.selection.empty) {try {document.selection.empty();} catch (error) {}} else if (window.getSelection) {var selection = window.getSelection();if (selection && selection.removeAllRanges) {selection.removeAllRanges();};}},setOpacity : function(element, value) {element.style.opacity = (value == 1 || value === '') ? '': (value < 0.00001) ? 0 : value;return element;},findPos : function(obj) {var top = 0, left = 0;if (obj && obj.offsetParent) {do {left += obj.offsetLeft;top += obj.offsetTop;} while (obj = obj.offsetParent);return {top : top,left : left};} else {return {top : 0,left : 0};}},getDimensions : function(obj) {return {'width' : (obj.clientWidth) ? obj.clientWidth : obj.offsetWidth,'height' : (obj.clientWidth) ? obj.clientHeight : obj.offsetHeight};},windowSize : function() {return {width : window.innerWidth|| (window.document.documentElement.clientWidth || window.document.body.clientWidth),height : window.innerHeight|| (window.document.documentElement.clientHeight || window.document.body.clientHeight)};},timeout : function(timer, fnc, speed) {if ((fnc == null) && (speed == null)) {clearTimeout(timer);return null;}if (timer != null) {clearTimeout(timer);timer = null;}return setTimeout(fnc, speed);},timer : function(timer, fnc, speed) {if ((fnc == null) && (speed == null)) {clearInterval(timer);return null;}if (timer != null) {clearInterval(timer);timer = null;}return setInterval(fnc, speed);},cleanPath : function(input) {return input.replace(/#|@|\$|'|\||"|\&|\[|\]|\\|\*|\(|\)|\.|\?| |;|nbsp;|\.|\\|__/g,function(org, s1) {return '_';}).replace(/_$/g, function(org, s1) {return '';}).toLowerCase();}};var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;var Line = new CLASS();Line.prototype = {className : 'line',initialize : function(attachTo, x1, x2, y1, y2) {this.line = document.createElement("div");this.line.style.position = 'absolute';this.draw(attachTo, x1, x2, y1, y2);return this;},draw : function(attachTo, x1, x2, y1, y2) {if (attachTo) {attachTo.appendChild(this.line);this.attachTo = attachTo;}this.redraw(x1, x2, y1, y2);return this.line;},redraw : function(x1, x2, y1, y2) {if (x2 < x1) {var temp = x1;x1 = x2;x2 = temp;temp = y1;y1 = y2;y2 = temp;}this.line.className = this.className;var length = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));this.line.style.width = length + "px";if (isIE) {this.line.style.top = (y2 > y1) ? y1 + "px" : y2 + "px";this.line.style.left = x1 + "px";var nCos = (x2 - x1) / length;var nSin = (y2 - y1) / length;this.line.style.filter = "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11="+ nCos+ ", M12="+ -1* nSin+ ", M21="+ nSin+ ", M22="+ nCos + ")";} else {var angle = Math.atan((y2 - y1) / (x2 - x1));this.line.style.top = y1 + 0.5 * length * Math.sin(angle) + "px";this.line.style.left = x1 - 0.5 * length * (1 - Math.cos(angle))+ "px";this.line.style.MozTransform = this.line.style.WebkitTransform = this.line.style.OTransform = "rotate("+ angle + "rad)";}},erase : function() {Dom.un(this.line);}};if (!isIE){var alertBox;alert = function(msg) {var item = Dom.div(alertBox,{'class' : 'alert','style' : 'padding: 2px 10px; background: #ffa; border: 1px solid black; margin: 1px; '});item.innerHTML = String(msg);setTimeout(function() {Dom.un(item);}, 12000);};E.add(window, 'load', function() {alertBox = Dom.div(document.body, {'class' : 'alertBox','style' : 'position: fixed; top: 0px; right: 0px; z-index: 8000;'});alertBox.style.position = 'fixed';});};

