//------------------------------------ //------------------------------------ //-- jQuery: jquery-1.4.2 //------------------------------------ //------------------------------------ (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); (function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= {},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); //------------------------------------ //------------------------------------ //-- jQuery: AX Adjustments //------------------------------------ //------------------------------------ /* Prevent conflicting with other libraries use of the $ variable */ jQuery.noConflict(); /* Create an shorter alias for JQuery */ var xj = jQuery; //------------------------------------ //------------------------------------ //------------------------------------ // DESCRIPTION // AX Standard Javascript libraries. // //------------------------------------ //------------------------------------ //------------------------------------ //------------------------------------ // JQuery Util Class //------------------------------------ function XJUClass() { var mobj = jQuery("
"); this.textToHtml = function(psText) { return mobj.text(psText).html(); }; this.htmlToText = function(psHtml) { return mobj.html(psHtml).text(); }; this.focusFirst = function(psContextSelector) { if (XString.isNotEmpty(psContextSelector)) { jQuery(":input[type!='button']:visible:enabled:first", jQuery(psContextSelector)).focus(); } else { jQuery(":input[type!='button'][type!=submit]:visible:enabled:first").focus().select(); } }; this.initValueI = function() { jQuery(":input").each(function(i) { var obj = jQuery(this); if (XJU.hasAttribute(obj,"valuei")) { obj.attr("value",obj.attr("valuei")); } }); }; this.hasAttribute = function(pjObj,psName) { if (!pjObj) { return false; } if (pjObj.length < 1) { return false; } var val = pjObj.attr(psName); return (val != null) && (val != undefined); }; this.getElement = function(pjObj) { if (!pjObj) { return null; } if (pjObj.length < 1) { return null; } return pjObj[0]; }; this.hasElement = function(pjObj) { if (!pjObj) { return false; } return pjObj.length > 0; }; this.ownerDocument = function(pjObj) { if (!pjObj) { return null; } if (pjObj.length < 1) { return null; } // TODO: is this cross browser? return pjObj[0].ownerDocument; }; this.setEnabled = function(pjObj, pbEnabled) { if (!pjObj) { return; } if (XBoolean.parse(pbEnabled)) { pjObj.attr("disabled",""); } else { pjObj.attr("disabled","disabled"); } }; return this; } var XJU = new XJUClass(); //------------------------------------ // HELPER FUNCTIONS //------------------------------------ function xfGet(psId) { return document.getElementById(psId); } function xfGetVal(psId) { var el = document.getElementById(psId); if (el) { return el.value; } return ""; } function xfGetValLen(psId) { var el = document.getElementById(psId); if (el) { return el.value.length; } return 0; } function xfSetVal(psId,pVal) { var el = document.getElementById(psId); if (el) { if (pVal) { el.value = pVal; } else { el.value = ""; } } } function xfSetFocus(psId,pbIgnoreError) { var el = document.getElementById(psId); if (el) { try { el.focus(); return true; } catch (e) { return false; } } } //------------------------------------ // STDLIBS CONFIG //------------------------------------ function XConfigClass() { this.EScopeClient = "client"; this.EScopeServer = "server"; var mScope = this.EScopeServer; this.setScopeClient = function() { mScope = this.EScopeClient; }; this.setScopeServer = function() { mScope = this.EScopeServer; }; this.isClientScope = function() { return mScope == this.EScopeClient; }; this.getBlankPageUrl = function() { if (this.isClientScope()) { return this.resolveWebUrl(this.winUrlBlankClient); } return this.resolveWebUrl(this.winUrlBlankServer); }; this.getBlankImageSrc = function() { if (this.isClientScope()) { return this.resolveWebUrl(this.winUrlBlankImageClient); } return this.resolveWebUrl(this.winUrlBlankImageServer); }; this.isUrlBlankPage = function(psUrl) { if ( (!psUrl) || (psUrl.length < 10) ) { return false; } var url = psUrl.toUpperCase().substr(psUrl.length - 10); if (url.indexOf("BLANK.") >= 0 ) { return true; } return false; }; this.resolveWebUrl = function(psUrl) { if (XString.isEmpty(psUrl)) { return psUrl; } var vdir = this.getVirtualDir(); if (XString.isEmpty(vdir)) { return psUrl; } var url = psUrl + ""; if (!XString.startsWith(url,"/")) { return psUrl; } url = XString.trim(url.toLowerCase()); // if not at the base, then it is relative if ( XString.startsWith(url,"/" + vdir.toLowerCase() + "/") ) { url = psUrl; } else { url = "/" + vdir + psUrl; } return url; }; // General settings var mVirtualDir = ""; this.getVirtualDir = function() { if (XString.startsWith(mVirtualDir,"XXXVIRTUALDIR") ) { mVirtualDir = ""; } return mVirtualDir; }; this.setVirtualDir = function(psDirName) { mVirtualDir = psDirName; }; // Window and url settings this.winUrlBlankServer = "/xsuite/client/web/blank.aspx"; this.winUrlBlankImageServer = "/xsuite/client/web/blank.gif"; this.winUrlLoadingServer = "/xsuite/xapps/std/axStdPageLoadingDialog.aspx"; this.winUrlErrorServer = "/xsuite/client/web/controls/axWindowError.aspx"; this.winUrlDebugServer = "/xsuite/client/web/controls/axWindowDebug.aspx"; this.winUrlPromptServer = "/xsuite/client/web/controls/axWindowPrompt.aspx"; this.winUrlConfirmServer = "/xsuite/client/web/controls/axWindowConfirm.aspx"; this.winUrlAlertServer = "/xsuite/client/web/controls/axWindowAlert.aspx"; this.winUrlYesNoServer = "/xsuite/client/web/controls/axWindowYesNo.aspx"; this.winUrlYesNoCancelServer = "/xsuite/client/web/controls/axWindowYesNoCancel.aspx"; this.winUrlFileChooserServer = "/xsuite/client/web/controls/axWindowFileChooser.aspx"; this.winUrlBlankClient = "web/blank.htm"; this.winUrlBlankImageClient = "web/blank.gif"; this.winUrlLoadingClient = "web/controls/axWindowLoading.htm"; this.winUrlErrorClient = "web/controls/axWindowError.htm"; this.winUrlDebugClient = "web/controls/axWindowDebug.htm"; this.winUrlPromptClient = "web/controls/axWindowPrompt.htm"; this.winUrlConfirmClient = "web/controls/axWindowConfirm.htm"; this.winUrlAlertClient = "web/controls/axWindowAlert.htm"; this.winUrlYesNoClient = "web/controls/axWindowYesNo.htm"; this.winUrlYesNoCancelClient = "web/controls/axWindowYesNoCancel.htm"; this.winUrlFileChooserClient = "web/controls/axWindowFileChooser.htm"; // Resource settings this.webserviceDefaultErrorMsg = "webserviceInternalError"; this.webserviceResultNodeId = "xWsResult"; this.webservicePostCallbackQueryParam = "xWsCallback"; return this; }; var XConfig = new XConfigClass(); //------------------------------------ // Browser Enums //------------------------------------ function XBrowserClass() { this.className = "XBrowserClass"; this.cursorDefault = "default"; this.cursorAuto = "auto"; this.cursorMove = "move"; this.cursorHand = "hand"; this.cursorHelp = "help"; this.cursorWait = "wait"; this.cursorPointer = "pointer"; this.cursorWorking = "progress"; this.cursorText = "text"; this.cursorCrosshair = "crosshair"; this.cursorResize = "resize"; this.cursorResizeNW = "nw-resize"; this.cursorResizeVertical = "n-resize"; this.cursorResizeHorizontal = "w-resize"; this.isIE = function() { try { return navigator.appVersion.indexOf("MSIE")>= 0; } catch (e) { XError.display(this.className,e,"isIE"); throw e; } }; this.hasPlugin = function(psName) { var plugin = null; try { if (navigator.plugins && navigator.plugins.length) { for (var i=0; i 0) ) { var plugin = null; for (i=0; i= XEKeyCode.key0 && evt.keyCode <= XEKeyCode.key9) { return true; } if (evt.keyCode >= XEKeyCode.keyPad0 && evt.keyCode <= XEKeyCode.keyPad9) { return true; } } return false; }; this.isKeyCodeEnter = function(poEvent) { var evt = poEvent? poEvent : window.event; if (evt) { return evt.keyCode == XEKeyCode.keyEnter; } return false; }; this.isKeyCodeTab = function(poEvent) { var evt = poEvent? poEvent : window.event; if (evt) { return evt.keyCode == XEKeyCode.keyTab; } return false; }; this.isAllowableNumericInputFieldKey = function(poEvent) { var evt = poEvent? poEvent : window.event; if (evt) { if (evt.keyCode >= XEKeyCode.key0 && evt.keyCode <= XEKeyCode.key9) { return true; } if (evt.keyCode >= XEKeyCode.keyPad0 && evt.keyCode <= XEKeyCode.keyPad9) { return true; } switch (evt.keyCode) { case XEKeyCode.keyDelete : case XEKeyCode.keyBackspace : case XEKeyCode.keyTab : case XEKeyCode.keyRightArrow : case XEKeyCode.keyLeftArrow : case XEKeyCode.keyHome : case XEKeyCode.keyEnd : return true; default : break; } return false; } return false; }; return this; }; var XEvent = new XEventClass(); //------------------------------------ // XUtil Class //------------------------------------ function XUtilClass() { this.className = "XUtilClass"; this.xnull = function() {}; this.setCookie = function(psName, psValue,pnExpireMillis) { var expMillis = XString.evl(pnExpireMillis,60*60*1000); /* NOTE: default 1 hour */ date = new Date(new Date().getTime() + expMillis); document.cookie = psName + "=" + escape(psValue) + "; path=/; expires=" + date.toGMTString(); }; this.getCookie = function(psName) { // cookies are separated by semicolons var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { // a name/value pair (a crumb) is separated by an equal sign var aCrumb = aCookie[i].split("="); if (psName == aCrumb[0]) return unescape(aCrumb[1]); } // a cookie with the requested name does not exist return null; }; this.locale = function() { var loc; var idx; if( navigator.language ) { loc = navigator.language; } else if( navigator.browserLanguage ) { loc = navigator.browserLanguage; } if (XString.isNotEmpty(loc)) { idx = loc.indexOf("-"); if (idx > 0) { loc = loc.substring(0,idx+1) + loc.substring(idx+1,loc.length).toUpperCase(); } } return loc; }; this.language = function() { if( navigator.language ) { return navigator.language; } else if( navigator.browserLanguage ) { return navigator.browserLanguage; } return ""; }; return this; }; var XUtil = new XUtilClass(); //------------------------------------ // XHTMLUtil Class //------------------------------------ function XHtmlUtilClass() { this.className = "XHtmlUtilClass"; this.getFrameDocument = function(psFrameName) { try { var frameName = psFrameName; if (XString.isEmpty(frameName)) { return null; } var frameEl = document.getElementById(frameName); if (frameEl) { if (frameEl.contentWindow) { return frameEl.contentWindow.document; } else { frameName = XString.evl(frameEl.getAttribute("name"),frameName); } } if (document.frames) { var frame = document.frames[frameName]; if (frame) { return frame.document; } } return null; } catch (e) { XError.display(this.className,e,"getFrameDocument"); throw e; } }; this.getFrameElDocument = function(poFrameEl) { try { var frameEl = poFrameEl; if (frameEl) { if (frameEl.contentWindow) { return frameEl.contentWindow.document; } else { var frameName = frameEl.getAttribute("name"); if (XString.isNotEmpty(frameName)) { if (document.frames) { var frame = document.frames[frameName]; if (frame) { return frame.document; } } } } } return null; } catch (e) { XError.display(this.className,e,"getFrameElDocument"); throw e; } }; this.clearFrameDocument = function(psFrameName) { try { var frameDoc = this.getFrameDocument(psFrameName); if (frameDoc) { frameDoc.open(); frameDoc.write(""); frameDoc.close(); } } catch (e) { XError.display(this.className,e,"clearFrameDocument"); throw e; } }; this.writeBlankDocument = function(psFrameName) { try { var frameDoc = this.getFrameDocument(psFrameName); if (frameDoc) { frameDoc.open(); frameDoc.write(""); frameDoc.close(); } } catch (e) { XError.display(this.className,e,"writeBlankDocument"); throw e; } }; this.disableFormViewState = function(poForm) { try { if (poForm) { var el = poForm.elements[XEConstants.aspViewState]; if (el) { var xaction = poForm.getAttribute("xaction"); if (XString.isNotEmpty(xaction)) { poForm.action = xaction; } el.removeNode(true); } } } catch (e) { XError.display(this.className,e,"disableFormViewState"); throw e; } }; this.initValueI = function(poContainerEl) { try { var oEl = poContainerEl; if (!oEl) { oEl = document.body; } if (oEl) { var el; var typ; var vali; var oColl; oColl = oEl.getElementsByTagName("INPUT"); if (oColl && oColl.length > 0) { for ( var i=0; i 0) { for ( var i=0; i 0) { for (var i=0; i 0) { for (var i=0; i 0) { poSelect.selectedIndex = currIndex - 1; return true; } return false; }; this.clearOptions = function(poSelect) { if (!XObject.isNull(poSelect)) { poSelect.innerHTML = ""; } }; this.getSelectionLength = function(poWindow) { var win = poWindow? poWindow : window; var oTextRange = win.document.selection.createRange(); return oTextRange.text.length; }; this.hideCaret = function(poWindow) { var win = poWindow? poWindow : window; win.document.selection.empty(); }; this.getCaretPosition = function (poWindow, poEl) { if (!poEl) { return -1; } var win = poWindow? poWindow : window; var oTextRange; var nPos; oTextRange = win.document.selection.createRange(); oTextRange.text = "*^*^*^*" + oTextRange.text; nPos = poEl.value.indexOf("*^*^*^*"); oTextRange.moveStart("character",-7); oTextRange.text = oTextRange.text.substr(7, oTextRange.text.length - 7); return nPos; }; this.placeCaret = function(poEl,pnPos,pnLength) { if (!poEl) { return; } var oTextRange; try { poEl.focus(); } catch(e) {} oTextRange = poEl.createTextRange(); oTextRange.moveStart("character", pnPos); oTextRange.setEndPoint("EndToStart", oTextRange); oTextRange.moveEnd("character", pnLength); oTextRange.select(); }; this.appendUrlQueryParam = function(psUrl,psName,psValue) { if (XString.isEmpty(psUrl)) { return; } var sUrl = psUrl; var sStr = ""; if (sUrl.indexOf("?") < 1) { sUrl += "?"; } sStr = sUrl.substr(sUrl.length-1,1); switch (sStr) { case "?" : return sUrl + psName + "=" + encodeURIComponent(psValue) + "&"; case "&" : return sUrl + psName + "=" + encodeURIComponent(psValue) + "&"; default : return sUrl + "&" + psName + "=" + encodeURIComponent(psValue) + "&"; } }; this.hasVerticalScrollbar = function(poEl) { var c = poEl.clientHeight *1; var s = poEl.scrollHeight *1; if (s > 0) { return c < s; } return false; }; this.hasHorizontalScrollbar = function(poEl) { var c = poEl.clientWidth *1; var s = poEl.scrollWidth *1; if (s > 0) { return c < s; } return false; }; this.getObjectHeight = function(poEl) { // does not include border return poEl.offsetHeight; }; this.getObjectWidth = function(poEl) { // does not include width return poEl.offsetWidth; }; this.getAbsoluteOffsetTop = function(poEl) { var val = 0; var oEl = poEl; while ( oEl.offsetParent ) { oEl = oEl.offsetParent; val += oEl.offsetTop; } return val; }; this.getAbsoluteOffsetLeft = function(poEl) { var val = 0; var oEl = poEl; while ( oEl.offsetParent ) { oEl = oEl.offsetParent; val += oEl.offsetLeft; } return val; }; this.calcAbsoluteLeft = function(poObject) { // Find the element's offsetLeft relative to the BODY tag. if (!poObject) { return 0; } var pos = poObject.offsetLeft; var objParent = poObject.offsetParent; while ((objParent) && (objParent.tagName.toUpperCase() != "BODY")) { pos += objParent.offsetLeft; objParent = objParent.offsetParent; } return pos; }; this.calcAbsoluteTop = function(poObject) { // Find the element's offsetTop relative to the BODY tag. if (!poObject) { return 0; } var pos = poObject.offsetTop; var objParent = poObject.offsetParent; while ((objParent) && (objParent.tagName.toUpperCase() != "BODY")) { pos += objParent.offsetTop; objParent = objParent.offsetParent; } return pos; }; this.getChildElementById = function(poParentEl, psElId) { if (!poParentEl) { return document.getElementById(psElId); } return poParentEl.all.item(psElId); }; this.getElementsByTag = function(poEl,psTagName) { if (poEl) { if (poEl.getElementsByTagName) { // IE DOM return poEl.getElementsByTagName(psTagName); } else { if (poEl.all) { // DHTML object model return poEl.all.tags(psTagName); } } } return null; }; // Gets just the direct children, doesn't traverse down this.getChildrenByTag = function(poEl,psTagName) { if (poEl) { if (poEl.getElementsByTagName) { var aChilds = null; var aEls = poEl.getElementsByTagName(psTagName); if (aEls && aEls.length > 0) { aChilds = new Array(aEls.length); var cnt = 0; for (var i=0; i 0) { aChilds = new Array(aEls.length); var cnt = 0; var el = null; for (var i=0; i 0) { row = kids[0]; if (row.tagName == "TR") { oEl = poTable; } else { if (row.tagName == "TBODY") { oEl = row; } else { for (var i=0; i= 0; } else { return psValue.indexOf(psPattern) >= 0; } }; this.nvl = function(psValue,psDefault) { if ( (psValue == null) || (psValue == undefined) || (psValue == "undefined") || (psValue == NaN) ) { return psDefault + ""; } return psValue; }; this.evl = function(psValue,psDefault) { if (this.isEmpty(psValue)) { return psDefault + ""; }else { return psValue; } }; this.replaceAll = function(psValue,psFind,psReplace) { var sStr; var oRegExp; sStr = psValue + ""; if (this.isEmpty(sStr)) { return sStr; } if (psFind == ".") { oRegExp = /\./g; } else { oRegExp = new RegExp(psFind,"g"); } sStr = sStr.replace(oRegExp,psReplace); return sStr; }; this.replace = function(psValue,psFind,psReplace) { var sStr; sStr = new String(psValue + ""); if (this.isEmpty(sStr)) { return sStr; } sStr = sStr.replace(psFind,psReplace); return sStr; }; this.rpad = function(psValue,pnLen,psPadString) { var sStr = psValue + ""; var nCnt; if (this.isEmpty(sStr)) { return sStr; } nCnt = pnLen - sStr.length; for(i=0; i < nCnt; i++) { sStr = sStr + psPadString; } return sStr; }; this.lpad = function(psValue,pnLen,psPadString) { var sStr = psValue + ""; var nCnt; if (this.isEmpty(sStr)) { return sStr; } nCnt = pnLen - sStr.length; for(i=0; i < nCnt; i++) { sStr = psPadString + sStr; } return sStr; }; this.trim = function(psValue) { return this.ltrim(this.rtrim(psValue + "")); }; this.ltrim = function(psValue) { var sStr = psValue + ""; if (sStr) { while (sStr.length > 0 && sStr.charAt(0) == ' ') { sStr = sStr.substring(1); } } return sStr; }; this.rtrim = function(psValue) { var sStr = psValue + ""; if (sStr) { while (sStr.length > 0 && sStr.charAt(sStr.length-1) == ' ') { sStr = sStr.substring(0,sStr.length-1); } } return sStr; }; this.splitNameValue = function(psNameValue,psSplitStr) { var ret = new XOption(); var len = XString.evl(psSplitStr,"").length; if (psNameValue) { var pos = psNameValue.indexOf(psSplitStr); if (pos > 0) { ret.name = psNameValue.substring(0,pos); if ( (psNameValue.length-len) > pos) { ret.value = psNameValue.substring(pos-(-len),psNameValue.length); } else { ret.value = ""; } } else { ret.name = psNameValue; ret.value = ""; } } else { ret.name = ""; ret.value = ""; } return ret; }; this.compare = function(psValue1,psValue2) { var s1 = this.toString(psValue1); var s2 = this.toString(psValue2); if (this.areEqual(s1, s2)) { return 0; } return s1 > s2? 1 : -1; }; return this; }; var XString = new XStringClass(); //------------------------------------ // XBoolean Utilitiy functions. //------------------------------------ function XBooleanClass() { this.className = "XBooleanClass"; this.trueIndicator = "1"; this.falseIndicator = "0"; this.parse = function(psValue,psDefault) { if (XString.isEmpty(psValue)) { return this.isTrue(psDefault); } return this.isTrue(psValue); }; this.parseEl = function(psElId,psDefault) { return this.parse(xfGetVal(psElId),psDefault); }; this.isTrue = function(psValue) { var c; if (XString.isEmpty(psValue)) { return false; } c = psValue.toString().substring(0,1); switch (c) { case '1': case 't': case 'T': case 'Y': case 'y': return true; default : return false; } return false; }; this.toIndicator = function(psValue) { return this.parse(psValue)? "1" : "0"; }; return this; }; var XBoolean = new XBooleanClass(); //------------------------------------ // Number Utility functions. //------------------------------------ function XNumberClass() { this.className = "XNumberClass"; this.parse = function(psValue,pnDefault) { var nval = psValue*1.0; if (nval == Number.NaN || nval == Number.MIN_VALUE) { return pnDefault*1.0; } return nval; }; this.isSet = function(psValue) { var nval = psValue*1.0; if (nval == 0) { return true; } return (!isNaN(nval)) && (nval > Number.MIN_VALUE); }; this.add = function(pnNum1,pnNum2) { return pnNum1 - (-pnNum2); }; this.isType = function(poValue) { var nNumber; if (XObject.isNull(poValue) || XString.isEmpty(poValue)) { return false; } nNumber = new Number(poValue); if (nNumber.toString() == Number.NaN.toString()) { return false; } return true; }; this.absValue = function(pnNumber) { if (!this.isType(pnNumber)) { return Number.NaN; } var nbr = pnNumber*1.0; if (nbr < 0) { return nbr * -1.0; } return nbr; }; this.toInt = function(pnNumber) { return Math.floor(pnNumber); }; this.isInRange = function(pnNumber,pnStart,pnEnd) { if ( (!this.isType(pnNumber)) || (!this.isType(pnStart)) || (!this.isType(pnEnd)) ) { return false; } if ( (pnNumber -0) < (pnStart-0) ) { return false; } if ( (pnNumber -0) > (pnEnd-0) ) { return false; } return true; }; this.hexCharToDecValue = function(psChar) { switch(psChar.toString().toUpperCase().toString()) { case "0": return 0; case "1": return 1; case "2": return 2; case "3": return 3; case "4": return 4; case "5": return 5; case "6": return 6; case "7": return 7; case "8": return 8; case "9": return 9; case "A": return 10; case "B": return 11; case "C": return 12; case "D": return 13; case "E": return 14; case "F": return 15; } }; this.hexToDec = function(psValue) { var nVal = 0; var nMult; for (var i=0; i < psValue.length-1; i++) { nMult = 16; for (j=2; j < psValue.length - i; j++) { nMult = nMult*16; } nVal += nMult*this.hexCharToDecValue(psValue.substr(i,1)); } nVal = nVal - (- this.hexCharToDecValue(psValue.substr(psValue.length-1,1))); return nVal; }; this.compare = function(pnVal1,pnVal2) { var v1 = pnVal1*1; var v2 = pnVal2*1; if ( isNaN(v1) && isNaN(v2) ) { return 0; } if (isNaN(v1)) { return -1; } if (isNaN(v2) ) { return 1; } if (v1 == v2) { return 0; } if (v1 > v2) { return 1; } return -1; }; return this; }; var XNumber = new XNumberClass(); function XIntegerClass() { this.className = "XIntegerClass"; this.parse = function(psValue,pnDefault) { var nval = psValue*1; if (nval == Number.NaN || nval == Number.MIN_VALUE) { return pnDefault*1; } return nval; }; this.isSet = function(psValue) { var nval = psValue*1; if (nval == 0) { return true; } return (!isNaN(nval)) && (nval > Number.MIN_VALUE); }; this.compare = function(pnVal1, pnVal2) { return XNumber.compare(pnVal1,pnVal2); }; return this; }; var XInteger = new XIntegerClass(); //------------------------------------ // Date Utility functions. //------------------------------------ function XDateClass() { this.className = "XDateClass"; this.isType = function(psValue) { var d; try { // try the javascript date d = new Date(psValue); if (!isNaN(d)) { return true; } // try the axacore format return this.isAxDateFormat(psValue); } catch (e) { return false; } }; this.parse = function(psValue) { var d; try { // try the javascript date d = new Date(psValue); if (!isNaN(d)) { return d; } // try the axacore format if (this.isAxDateFormat(psValue)) { return this.parseAxDate(psValue); } return null; } catch (e) { XError.display(this.className, e, "parse"); throw e; } }; this.parseAxDate = function(psValue) { var d = NaN; try { if (psValue.indexOf(".") > 0) { d = new Date( psValue.substr(0,4)*1 ,(psValue.substr(4,2)*1)-1 ,psValue.substr(6,2)*1 ,psValue.substr(9,2)*1 ,psValue.substr(11,2)*1 ,psValue.substr(13,2)*1 ,(psValue.length >=17? psValue.substr(15,3) : 0)*1 ); } else { d = new Date( psValue.substr(0,4)*1 ,(psValue.substr(4,2)*1)-1 ,psValue.substr(6,2)*1); } return d; } catch (e) { XError.display(this.className, e, "parseAxDate"); throw e; } }; this.nowAsMillis = function() { return (new Date()).getTime(); }; // returns value back as yyyyMMddHHmmssfff this.nowAsInteger = function(pbIncludeMillis) { var sval = this.nowAsDouble(pbIncludeMillis); return parseInt(XString.replace(sval,".","")); }; // returns value back as yyyyMMdd.HHmmssfff this.nowAsDouble = function(pbIncludeMillis) { var oDate; var nDateNbr; oDate = new Date(); return parseFloat( "" + oDate.getFullYear() + this.datePartTwoPlaces(oDate.getMonth() + 1) + this.datePartTwoPlaces(oDate.getDate()) + "." + this.datePartTwoPlaces(oDate.getHours()) + this.datePartTwoPlaces(oDate.getMinutes()) + this.datePartTwoPlaces(oDate.getSeconds()) + (XBoolean.parse(pbIncludeMillis)? this.datePartThreePlaces(oDate.getMilliseconds()) : "" ) ); }; this.isAxDateFormat = function(psValue) { return (new String(parseInt(psValue))).length == 8; }; this.convertToAxFormat = function(psDateValue,pbIncludeMillis) { try { if ( XString.isEmpty(XString.trim(psDateValue)) ) { return ""; } var oDate; var nDateNbr; // Try using the normal Javascript Date object nDateNbr = Date.parse(XString.trim(psDateValue)); if (!(isNaN(nDateNbr))) { oDate = new Date(nDateNbr); return parseFloat( "" + oDate.getFullYear() + this.datePartTwoPlaces(oDate.getMonth() + 1) + this.datePartTwoPlaces(oDate.getDate()) + "." + this.datePartTwoPlaces(oDate.getHours()) + this.datePartTwoPlaces(oDate.getMinutes()) + this.datePartTwoPlaces(oDate.getSeconds()) + (XBoolean.parse(pbIncludeMillis)? this.datePartThreePlaces(oDate.getMilliseconds()) : "" ) ); } else { // try the axacore date format try { if (this.isAxDateFormat(psDateValue)) { return XString.trim(psDateValue); } }catch(e) { } return ""; } } catch(e) { return ""; } }; this.datePartTwoPlaces = function(psValue) { return (psValue*1) < 10 ? "0" + psValue : psValue + ""; }; this.datePartThreePlaces = function(psValue) { var nval = psValue * 1; if (nval >= 100) { return psValue; } if (nval >= 10) { return "0" + psValue; } return "00" + psValue; }; this.dailySecToHr = function(pnSeconds) { var nval = XString.isEmpty(pnSeconds)? 0 : pnSeconds - 0; if (nval < 3600) { return 0; } return XNumber.toInt(pnSeconds/3600); }; this.dailySecToMin = function(pnSeconds) { var nval = XString.isEmpty(pnSeconds)? 0 : pnSeconds - 0; var ihr = 0; if (nval < 60) { return 0; } nval = pnSeconds/3600; ihr = XNumber.toInt(nval); return XNumber.toInt((nval - ihr)*60); }; this.toDailySec = function(pnHour,pnMin,pnSec) { var hr = XString.isEmpty(pnHour)? 0 : pnHour - 0; var min = XString.isEmpty(pnMin)? 0 : pnMin - 0; var sec = XString.isEmpty(pnSec)? 0 : pnSec - 0; hr = hr <= 0? 0 : hr; min = min <= 0? 0 : min; sec = sec <= 0? 0 : sec; return (hr*3600) - (-(min*60)) - (-sec); }; this.formatHourAndMin = function(pnHour,pnMin) { var hr = XString.isEmpty(pnHour)? 0 : pnHour-0; var min = XString.isEmpty(pnMin)? 0 : pnMin-0; hr = hr < 0? 0 : hr; min = min<0? 0 : min; return this.datePartTwoPlaces(hr) + ":" + this.datePartTwoPlaces(min); }; return this; }; var XDate = new XDateClass(); //------------------------------------ // HTML Form Validation //------------------------------------ function XFormClass() { this.className = "XFormClass"; this.lastErrorMessage = ""; this.getValidator = function(pnDataType) { var ndt = pnDataType*1; if (XEDataType.isNumberType(ndt)) { return XNumberValidator; } if (XEDataType.isDateType(ndt)) { return XDateValidator; } return XStringValidator; }; this.isValueRequired = function(poEl) { return XBoolean.parse(poEl.getAttribute(XEFormValidationRule.required)); }; this.isValueNotEmpty = function(poEl) { return !(this.isValueEmpty); }; this.isValueEmpty = function(poEl) { try { if (!poEl) { return true; } if (XString.isNotEmpty(poEl.value)) { return false; } /* if it is a select, and the selectedIndex > 0, assume selected*/ if (poEl.tagName == "SELECT") { if (poEl.selectedIndex > 0) { return false; } } return true; } catch (e) { XError.display(this.className,e,"isValueEmpty"); throw e; } }; this.validateSilent = function(poForm,pbSkipHidden) { return this.validate(poForm,pbSkipHidden,true); } this.validate = function(poForm,pbSkipHidden,pbSilentError) { this.lastErrorMessage = ""; var oEls; var oEl; var bHasError = false; var bSkipHidden = XBoolean.parse(pbSkipHidden); var bSilentError = XBoolean.parse(pbSilentError); var axvr; var axvt; var axvp; var axvfr; try { oEls = poForm.elements; if (!oEls) { return true; } for (i=0; i 0) ) { for (i=0; i 0 ) { return false; } } } return true; }; this.checkMinLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.minLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length < (rule*1) ) { return false; } } } return true; }; this.checkMaxLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.maxLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length > (rule*1) ) { return false; } } } return true; }; this.checkRegex = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.regex); if ( XString.isNotEmpty(rule) ) { return new RegExp(rule,"ig").test(psValue); } } return true; }; return this; }; var XStringValidator = new XStringValidatorClass(); function XNumberValidatorClass () { this.className = "XNumberValidatorClass"; this.lastErrors = ""; this.validate = function (psValue,poRuleEl,pbEvalAll) { var errors = this.getErrors(psValue,poRuleEl,pbEvalAll); this.lastErrors = errors; return XString.isEmpty(errors); }; this.getErrors = function (psValue,poRuleEl,pbEvalAll) { if (!poRuleEl) { return ""; } var value = psValue; var errors = ""; var evalAll = XBoolean.parse(pbEvalAll); if (XString.isEmpty(value)) { errors += XEFormValidationRule.empty + ","; if (!evalAll) { return errors; } } if ( XInteger.isSet(XInteger.parse(value, 0)) == false ) { errors += XEFormValidationRule.parse + ","; if (!evalAll) { return errors; } } if (!this.checkMinLength(value,poRuleEl)) { errors += XEFormValidationRule.minLength + ","; if (!evalAll) { return errors; } } if (!this.checkMaxLength(value,poRuleEl)) { errors += XEFormValidationRule.maxLength + ","; if (!evalAll) { return errors; } } if (!this.checkMinValue(value,poRuleEl)) { errors += XEFormValidationRule.minValue + ","; if (!evalAll) { return errors; } } if (!this.checkMaxValue(value,poRuleEl)) { errors += XEFormValidationRule.maxValue + ","; if (!evalAll) { return errors; } } if (!this.checkRegex(value,poRuleEl)) { errors += XEFormValidationRule.regex + ","; if (!evalAll) { return errors; } } return errors; }; this.checkMinValue = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.minValue); if ( XString.isNotEmpty(rule) ) { if( psValue < (rule*1) ) { return false; } } } return true; }; this.checkMaxValue = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.maxValue); if ( XString.isNotEmpty(rule) ) { if( psValue > (rule*1) ) { return false; } } } return true; }; this.checkMinLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.minLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length < (rule*1) ) { return false; } } } return true; }; this.checkMaxLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.maxLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length > (rule*1) ) { return false; } } } return true; }; this.checkRegex = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.regex); if ( XString.isNotEmpty(rule) ) { return new RegExp(rule,"ig").test(psValue); } } return true; }; return this; }; var XNumberValidator = new XNumberValidatorClass(); function XDateValidatorClass () { this.className = "XDateValidatorClass"; this.lastErrors = ""; this.validate = function (psValue,poRuleEl,pbEvalAll) { var errors = this.getErrors(psValue,poRuleEl,pbEvalAll); this.lastErrors = errors; return XString.isEmpty(errors); }; this.getErrors = function (psValue,poRuleEl,pbEvalAll) { if (!poRuleEl) { return ""; } var value = psValue; var errors = ""; var evalAll = XBoolean.parse(pbEvalAll); if (XString.isEmpty(value)) { errors += XEFormValidationRule.empty + ","; if (!evalAll) { return errors; } } if (!XDate.parse(value)) { errors += XEFormValidationRule.parse + ","; if (!evalAll) { return errors; } } if (!this.checkMinLength(value,poRuleEl)) { errors += XEFormValidationRule.minLength + ","; if (!evalAll) { return errors; } } if (!this.checkMaxLength(value,poRuleEl)) { errors += XEFormValidationRule.maxLength + ","; if (!evalAll) { return errors; } } if (!this.checkMinValue(value,poRuleEl)) { errors += XEFormValidationRule.minValue + ","; if (!evalAll) { return errors; } } if (!this.checkMaxValue(value,poRuleEl)) { errors += XEFormValidationRule.maxValue + ","; if (!evalAll) { return errors; } } if (!this.checkRegex(value,poRuleEl)) { errors += XEFormValidationRule.regex + ","; if (!evalAll) { return errors; } } return errors; }; this.checkMinValue = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.minValue); if ( XString.isNotEmpty(rule) ) { rule = XDate.parse(rule); var value = XDate.parse(psValue); if (rule && value) { if( value.getTime() < rule.getTime() ) { return false; } } } } return true; }; this.checkMaxValue = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.maxValue); if ( XString.isNotEmpty(rule) ) { rule = XDate.parse(rule); var value = XDate.parse(psValue); if (rule && value) { if( value.getTime() > rule.getTime() ) { return false; } } } } return true; }; this.checkMinLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.minLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length < (rule*1) ) { return false; } } } return true; }; this.checkMaxLength = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.maxLength); if ( XString.isNotEmpty(rule) ) { if( psValue.length > (rule*1) ) { return false; } } } return true; }; this.checkRegex = function (psValue, poRuleEl) { if (poRuleEl) { var rule = poRuleEl.getAttribute(XEFormValidationRule.regex); if ( XString.isNotEmpty(rule) ) { return new RegExp(rule,"ig").test(psValue); } } return true; }; return this; }; var XDateValidator = new XDateValidatorClass(); //------------------------------------ // ACTION MOUSE OVER FUNCTIONS //------------------------------------ function XActionUtilClass() { var mClassName = "XActionUtilClass"; this.onMouseOver = function(poEvent,poEl,psClassName) { try { poEl.setAttribute("xClassSave",poEl.className); poEl.className += " " + psClassName + " "; } catch (e) { XError.display(mClassName,e,"onMouseOver"); } }; this.onMouseOut = function(poEvent,poEl) { try { poEl.className = poEl.getAttribute("xClassSave"); } catch (e) { XError.display(mClassName,e,"onMouseOut"); } }; return this; }; var XActionUtil = new XActionUtilClass(); //------------------------------------ // WINDOW FUNCTIONS //------------------------------------ function XWindowClass() { this.className = "XWindowClass"; this.loadingWin = null; this.cleanseWindowName = function(psWindowName) { try { return (psWindowName + "").replace(/[^A-Z,0-9]/ig,"_"); } catch (e) { XError.display(this.className,e,"cleanseWindowName"); throw e; } } this.isInOtherMonitor = function(poWindow) { try { var win = poWindow? poWindow : window; if (win.screenLeft > win.screen.availWidth) { return true; } if (win.screenLeft < 0) { return true; } return false; } catch (e) { XError.display(this.className,e,"isInOtherMonitor"); throw e; } }; this.getOtherMonitorOffset = function(poWindow) { try { var win = poWindow? poWindow : window; if (win.screenLeft > win.screen.availWidth) { return win.screen.availWidth*1; } if (win.screenLeft < 0) { return -win.screen.availWidth; } return 0; } catch (e) { XError.display(this.className,e,"getOtherMonitorOffset"); throw e; } }; this.moveToCurrentMonitor = function(poWindow) { try { if (!poWindow) { return; } var offset = this.getWindowMonitorOffset(poWindow); if (offset != 0) { poWindow.moveTo(win.screenLeft -(-offset),poWindow.screenTop); } } catch (e) { XError.display(this.className,e,"moveToCurrentMonitor"); throw e; } }; this.isInRightMonitor = function(poWindow) { try { var win = poWindow? poWindow : window; win = win.top? win.top : win; return win.screenLeft > win.screen.availWidth; } catch (e) { XError.display(this.className,e,"isInRightMonitor"); throw e; } }; this.moveToRightMonitor = function(poWindow) { try { if (!poWindow) { return; } if (poWindow.screenLeft < poWindow.screen.availWidth) { poWindow.moveTo(poWindow.screenLeft - (- poWindow.screen.availWidth),poWindow.screenTop); } } catch (e) { XError.display(this.className,e,"moveToRightMonitor"); throw e; } }; this.getWindowBox = function(poWindow,pbIgnoreError) { try { var win = poWindow; var winBox = new XBox(); winBox.x = win.screenLeft*1; winBox.y = win.screenTop*1; if (win.document && win.document.body) { winBox.width = win.document.body.offsetWidth*1; winBox.height = win.document.body.offsetHeight*1; } else { winBox.width = win.screen.availWidth*1; winBox.height = win.screen.availHeight*1; } return winBox; } catch (e) { if (XBoolean.parse(pbIgnoreError)) { return null; } XError.display(this.className,e,"getWindowBox"); throw e; } }; this.getBrowserBox = function() { try { var dom = null; var win = window; if (win.top) { try { dom = win.top.document.domain; return this.getWindowBox(win.top,true); } catch (e) { } } if (!win.parent) { return this.getWindowBox(win); } var par = win.parent; while (par) { try { dom = par.document.domain; win = par; par = win.parent; } catch (e) { par = null; } } return this.getWindowBox(win); } catch (e) { XError.display(this.className,e,"getBrowserBox"); throw e; } }; this.getDialogPositionBox = function(pnWidth,pnHeight) { try { var winBox = this.getBrowserBox(); var posBox = new XBox(); posBox.x = (winBox.x + (winBox.width/2)) - (pnWidth/2); posBox.y = (winBox.y + (winBox.height/2)) - (pnHeight/2); posBox.width = pnWidth*1; posBox.height = pnHeight*1; return posBox; } catch (e) { XError.display(this.className,e,"getDialogPositionBox"); throw e; } }; this.getAppPositionBox = function(pnWidth,pnHeight,pnScale) { try { var winBox = this.getBrowserBox(); var offset = this.getOtherMonitorOffset(window); var nWidth = pnWidth*1; var nHeight = pnHeight*1; var nScale = XString.evl(pnScale,"1")*1; if (nWidth <= winBox.width && nHeight <= winBox.height) { return this.getDialogPositionBox(nWidth,nHeight); } var posBox = new XBox(); // if width is less than opening window, then position within opening window if (nWidth <= winBox.width) { posBox = this.getDialogPositionBox(nWidth,nHeight); posBox.y = (window.screen.availHeight - nHeight)/2; posBox.height = Math.min(window.screen.availHeight * nScale,nHeight); return posBox; } // get the default position posBox.x = (window.screen.availWidth - nWidth)/2; posBox.y = (window.screen.availHeight - nHeight)/2; posBox.height = Math.min(window.screen.availHeight * nScale,nHeight); posBox.width = Math.min(window.screen.availWidth * nScale,nWidth); // adjust the x coord for dual monitor posBox.x = posBox.x - (-offset); return posBox; } catch (e) { XError.display(this.className,e,"getAppPositionBox"); throw e; } }; this.showLoadingDialog = function() { try { var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlLoadingServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlLoadingClient); } this.loadingWin = this.launchAppModeless(baseUrl,300,125); return this.loadingWin; } catch (e) { XError.display(this.className,e,"showLoadingDialog"); throw e; } }; this.hideLoadingDialog = function() { try { if (this.loadingWin) { this.loadingWin.close(); } } catch (e) { } this.loadingWin = null; }; this.error = function(psResultCode,psResultInfo,psResultExtInfo,psTitle) { try { var sFeatures; var sUrl; var oArgs = null; var sRc = XString.evl(psResultCode,""); var sRi = XString.evl(psResultInfo,""); var sRx = XString.evl(psResultExtInfo,""); var sT = XString.evl(psTitle,""); var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlErrorServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlErrorClient); } // always pass the error info in the dialog args oArgs = new Array(4); oArgs[0] = sRc; oArgs[1] = sRi; oArgs[2] = sRx; oArgs[3] = sT; // center the dialog on the window var nWidth = 400; var nHeight = 300; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xResultCode=" + encodeURIComponent(sRc) + "&" + "xResultInfo=" + encodeURIComponent(sRi) + "&" + "xResultExtInfo=" + encodeURIComponent(sRx) + "&" + "xTitle=" + encodeURIComponent(sT) + "&" ; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return window.showModalDialog(sUrl,oArgs,sFeatures); } catch (e) { XError.display(this.className,e,"error"); throw e; } }; this.debug = function(psResultCode,psResultInfo,psResultExtInfo,psTitle) { try { var sFeatures; var sUrl; var oArgs = null; var sRc = XString.evl(psResultCode,""); var sRi = XString.evl(psResultInfo,""); var sRx = XString.evl(psResultExtInfo,""); var sT = XString.evl(psTitle,""); var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlDebugServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlDebugClient); } // always pass the debug info in the dialog args oArgs = new Array(4); oArgs[0] = sRc; oArgs[1] = sRi; oArgs[2] = sRx; oArgs[3] = sT; // center the dialog on the window var nWidth = 550; var nHeight = 350; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xResultCode=" + encodeURIComponent(sRc) + "&" + "xResultInfo=" + encodeURIComponent(sRi) + "&" + "xResultExtInfo=" + encodeURIComponent(sRx) + "&" + "xTitle=" + encodeURIComponent(sT); if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return window.showModalDialog(sUrl,oArgs,sFeatures); } catch (e) { XError.display(this.className,e,"debug"); throw e; } }; this.prompt = function(psMessage,psValue) { try { var sFeatures; var sUrl; var oArgs = null; var sMsg = XString.evl(psMessage,""); var sValue = XString.evl(psValue,""); var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlPromptServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlPromptClient); oArgs = new Array(2); oArgs[0] = sMsg; oArgs[1] = sValue; } // center the dialog on the window var nWidth = 300; var nHeight = 160; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&" + "xValue=" + encodeURIComponent(sValue) + "&"; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return window.showModalDialog(sUrl,oArgs,sFeatures); } catch (e) { XError.display(this.className,e,"prompt"); throw e; } }; this.fileChooser = function(psMessage,psValue) { try { var sFeatures; var sUrl; var oArgs = null; var sMsg = XString.evl(psMessage,""); var sValue = XString.evl(psValue,""); var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlFileChooserServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlFileChooserClient); oArgs = new Array(2); oArgs[0] = sMsg; oArgs[1] = sValue; } // center the dialog on the window var nWidth = 600; var nHeight = 150; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&" + "xValue=" + encodeURIComponent(sValue) + "&"; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return window.showModalDialog(sUrl,oArgs,sFeatures); } catch (e) { XError.display(this.className,e,"fileChooser"); throw e; } }; this.confirm = function(psMessage) { try { var sFeatures; var sUrl; var sMsg = XString.evl(psMessage,""); var oArgs = sMsg; var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlConfirmServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlConfirmClient); } // center the dialog on the window var nWidth = 300; var nHeight = 140; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&"; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return XBoolean.parse(window.showModalDialog(sUrl,oArgs,sFeatures)); } catch (e) { XError.display(this.className,e,"confirm"); throw e; } }; this.alert = function(psMessage,psAtt1,psAtt2,psAtt3) { try { var sFeatures; var sUrl; var oArgs = null; var sMsg = XString.evl(psMessage,""); var sAtt1 = XString.evl(psAtt1,""); var sAtt2 = XString.evl(psAtt2,""); var sAtt3 = XString.evl(psAtt3,""); var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlAlertServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlAlertClient); oArgs = new Array(4); oArgs[0] = sMsg; oArgs[1] = sAtt1; oArgs[2] = sAtt2; oArgs[3] = sAtt3; } // center the dialog on the window var nWidth = 300; var nHeight = 140; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&" + "xAtt1=" + encodeURIComponent(sAtt1) + "&" + "xAtt2=" + encodeURIComponent(sAtt2) + "&" + "xAtt3=" + encodeURIComponent(sAtt3) + "&" ; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return window.showModalDialog(sUrl,oArgs,sFeatures); } catch (e) { XError.display(this.className,e,"alert"); throw e; } }; this.yesNo= function(psMessage) { try { var sFeatures; var sUrl; var sMsg = XString.evl(psMessage,""); var oArgs = sMsg; var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlYesNoServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlYesNoClient); } // center the dialog on the window var nWidth = 300; var nHeight = 140; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&"; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } return XBoolean.parse(window.showModalDialog(sUrl,oArgs,sFeatures)); } catch (e) { XError.display(this.className,e,"yesNo"); throw e; } }; this.yesNoCancel = function(psMessage) { try { var sFeatures; var sUrl; var sMsg = XString.evl(psMessage,""); var oArgs = sMsg; var baseUrl = XConfig.resolveWebUrl(XConfig.winUrlYesNoCancelServer); if (XConfig.isClientScope()) { baseUrl = XConfig.resolveWebUrl(XConfig.winUrlYesNoCancelClient); } // center the dialog on the window var nWidth = 300; var nHeight = 140; var posBox = this.getDialogPositionBox(nWidth,nHeight); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = baseUrl + "?" + "xMessage=" + encodeURIComponent(sMsg) + "&"; if (sUrl.length > 2000) { sUrl = sUrl.substr(0,2000); } var rslt = window.showModalDialog(sUrl,oArgs,sFeatures); switch (rslt) { case "-1" : return null; default : return rslt; } } catch (e) { XError.display(this.className,e,"yesNoCancel"); throw e; } }; this.launchApp = function(psUrl,psWindowName,pnWidth,pnHeight,poArgs) { var sFeatures; var nHeight; var nWidth; var nTop; var nLeft; var sUrl; try { if (XString.isNotEmpty(pnWidth)) { nWidth = pnWidth*1; } else { nWidth = 1000; } if (XString.isNotEmpty(pnHeight)) { nHeight = pnHeight*1; } else { nHeight = 700; } // center the dialog on the window var posBox = this.getAppPositionBox(nWidth,nHeight,.9); sFeatures = //WIN "fullscreen=0," + //WIN "channelmode=0," + //WIN "titlebar=0," + //WIN "toolbar=0," + //WIN "location=0," + //WIN "directories=0," + //WIN "menubar=0," + "status=1," + "scrollbars=1," + "resizable=1," + "left=" + posBox.x + "," + "top=" + posBox.y + "," + "width=" + posBox.width + "," + "height=" + posBox.height; sUrl = XString.evl(psUrl,XConfig.getBlankPageUrl()); sWindowName = XString.evl(psWindowName,new Date().getTime()); win = window.open(sUrl,sWindowName,sFeatures,false); try {win.focus();} catch (e) {} try {win.opener = window.self; } catch (e) {} try {win.openerArgs = poArgs; } catch (e) {} return win; } catch (e) { XError.display(this.className,e,"launchApp"); throw e; } }; this.launchAppModal = function(psUrl,pnWidth,pnHeight,poArgs) { var sFeatures; var nHeight; var nWidth; try { if (XString.isNotEmpty(pnWidth)) { nWidth = pnWidth*1; } else { nWidth = 600; } if (XString.isNotEmpty(pnHeight)) { nHeight = pnHeight*1; } else { nHeight = 400; } // center the dialog on the window var posBox = this.getDialogPositionBox(nWidth,nHeight,.9); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; return window.showModalDialog(psUrl,poArgs,sFeatures); } catch (e) { XError.display(this.className,e,"launchAppModal"); throw e; } }; this.launchAppModeless = function(psUrl,pnWidth,pnHeight,poArgs) { var sFeatures; var nHeight; var nWidth; var sUrl; try { if (XString.isNotEmpty(pnWidth)) { nWidth = pnWidth*1; } else { nWidth = 600; } if (XString.isNotEmpty(pnHeight)) { nHeight = pnHeight*1; } else { nHeight = 400; } // center the dialog on the window var posBox = this.getDialogPositionBox(nWidth,nHeight,.9); sFeatures = "dialogLeft:" + posBox.x + "px;" + "dialogTop:" + posBox.y + "px;" + "dialogWidth:" + posBox.width + "px;" + "dialogHeight:" + posBox.height + "px;" + "edge:raised;" + "resizable:yes;" //WIN + "help:no;" //WIN + "scroll:no;" //WIN + "status:no;" ; sUrl = XString.evl(psUrl,XConfig.getBlankPageUrl()); var win = window.showModelessDialog(sUrl,poArgs,sFeatures); win.opener = window.self; return win; } catch (e) { XError.display(this.className,e,"launchAppModeless"); throw e; } }; this.launchAppXModal = function(psUrl,pnWidth,pnHeight,poArgs,psWindowName) { var sFeatures; var nHeight; var nWidth; var nTop; var nLeft; var sUrl; var name; try { if (XString.isNotEmpty(pnWidth)) { nWidth = pnWidth*1; } else { nWidth = 1000; } if (XString.isNotEmpty(pnHeight)) { nHeight = pnHeight*1; } else { nHeight = 700; } // center the dialog on the window var posBox = this.getDialogPositionBox(nWidth,nHeight,.9); sFeatures = //WIN "fullscreen=0," + //WIN "channelmode=0," + //WIN "titlebar=0," + //WIN "toolbar=0," + //WIN "location=0," + //WIN "directories=0," + //WIN "menubar=0," + //WIN "scrollbars=0," + //WIN "resizable=0," + "status=1," + "left=" + posBox.x + "," + "top=" + posBox.y + "," + "width=" + posBox.width + "," + "height=" + posBox.height ; sUrl = XString.evl(psUrl,XConfig.getBlankPageUrl()); name = XString.evl(psWindowName,"XWinModal"); win = window.open(sUrl,name,sFeatures,false); try {win.focus();} catch (e) {} try {win.opener = window.self; } catch (e) {} try {win.openerArgs = poArgs; } catch (e) {} return win; } catch (e) { XError.display(this.className,e,"launchAppXModal"); throw e; } }; return this; }; var XWindow = new XWindowClass(); //------------------------------------ // ALERT DIALOG FUNCTIONS //------------------------------------ function XAlertDialogClass() { this.className = "XAlertDialogClass"; this.onLoad = function() { try { XHtmlUtil.initValueI(); window.focus(); var oEl = document.getElementById("xActionDefault"); if (oEl) { oEl.focus(); } } catch (e) { XError.display(this.className,e,"onLoad"); } }; this.onUnload = function(psDefaultReturnValue) { try { if (XObject.isNull(window.returnValue) && (window.returnValue != "") ) { window.returnValue = XString.nvl(psDefaultReturnValue,null); } } catch (e) { XError.display(this.className,e,"onUnload"); } }; this.close = function(psValue) { try { window.returnValue = psValue; window.close(); } catch (e) { XError.display(this.className,e,"close"); } }; return this; }; var XAlertDialog = new XAlertDialogClass(); //------------------------------- // XModalHelper //------------------------------- function XModalHelperClass () { this.className = "XModalHelperClass"; this.dialog = null; this.setDialog = function(poWindow) { this.dialog = poWindow; }; this.clearDialog = function() { if (this.dialog) { try { this.dialog.close(); } catch (e) { } } this.dialog = null; }; this.showDialog = function() { if (this.dialog) { try { this.dialog.focus(); } catch (e) { } } }; this.onWindowFocus = function() { try { if (this.dialog) { try { this.dialog.focus(); } catch (e) { this.dialog = null; } } } catch(e) { XError.display(this.className,e,"onWindowFocus"); } }; return this; }; var XModalHelper = new XModalHelperClass(); //------------------------------------ // XTabFrame Class //------------------------------------ // * poTabEl.name is the name of the tab set // * The following objects exist: // _Container -- parent object holder for all tabs with the following attribs // - axTabClassOffFirst, axTabClassOff, axTabClassOn // _LoadingMsg // - inner HTML is what to display before navigating the frame function XTabFrameClass() { this.className = "XTabFrameClass"; this.navigate = function(poTabEl,poWindow,psRows,psUrl,pbAutoRefresh) { var oTabs; var oTab; var oContainer; var oLoadingMsg; var sClass; var sTabClassOff; var sTabClassOn; var bIsLoaded = false; try { if (!poTabEl) { return; } oLoadingMsg = document.getElementById(poTabEl.name + "_LoadingMsg"); oContainer = document.getElementById(poTabEl.name + "_Container"); oTabs = oContainer.children; sTabClassOff = oContainer.getAttribute("axTabClassOff"); sTabClassOn = oContainer.getAttribute("axTabClassOn"); for (var i=0; i < oTabs.length; i++) { oTab = oTabs[i]; sClass = oTab.className; sClass = sClass.replace(sTabClassOff,""); sClass = sClass.replace(sTabClassOn,""); sClass = XString.trim(sClass); sClass = sTabClassOff + " " + sClass; oTab.className = sClass; } sClass = poTabEl.className; sClass = sClass.replace(sTabClassOff,""); sClass = sClass.replace(sTabClassOn,""); sClass = XString.trim(sClass); sClass = sTabClassOn + " " + sClass; poTabEl.className = sClass; bIsLoaded = XBoolean.parse(poTabEl.getAttribute("axIsLoaded")); if ( (pbAutoRefresh) || (!bIsLoaded) || (XConfig.isUrlBlankPage(poWindow.location.href)) || (XEvent.isCtrlKey()) ) { if (oLoadingMsg) { poWindow.document.body.innerHTML = oLoadingMsg.innerHTML; } poWindow.navigate(psUrl); } parent.frameHolder.rows = psRows; poTabEl.setAttribute("axIsLoaded","1"); } catch (e) { XError.display(this.className,e,"navigate"); poTabEl.setAttribute("axIsLoaded","0"); } }; return this; }; var XTabFrame = new XTabFrameClass(); //------------------------------------ // XTabSet Class //------------------------------------ // * psTabSet is the name of the tab set // * The following objects exist: // _Container -- contains information about the tab set including the following attribs: // - axTabClassOffFirst, axTabClassOff, axTabClassOn // * For each tab in the set, the following must exist: // // // -- tab panel container that will be hidden/displayed function XTabSetClass() { this.className = "XTabSetClass"; this.loadFrameIndAttribute = "axLoadSrc"; this.loadFrameSrcAttribute = "axSrc"; this.initializeTabSet = function(psTabSet,pbPreservePanel) { try { var oSelEl = this.getTabSetSelectedEl(psTabSet); if (oSelEl) { var oElTab = this.getTab(oSelEl.value); if (!oElTab) { oElTab = this.getDefaultTab(psTabSet); } if (!oElTab) { oElTab = this.getFirstTab(psTabSet); } if (oElTab) { this.showTabEl(oElTab,true,pbPreservePanel); } } } catch (e) { XError.display(this.className,e,"initializeTabSet"); throw e; } }; this.getTabElements = function(psTabSet) { try { if (XString.isEmpty(psTabSet)) { return null; } return document.getElementsByName(psTabSet); } catch (e) { XError.display(this.className,e,"getTabElements"); throw e; } }; this.getDefaultTab = function(psTabSet) { try { if (XString.isEmpty(psTabSet)) { return null; } var oColl = this.getTabElements(psTabSet); var el = null; var firstEl = null; var tabId = ""; var tabDefaultInd = ""; if (oColl && oColl.length > 0) { tabId = oColl[0].getAttribute("axTab"); firstEl = document.getElementById(tabId); for (var i=0; i 0) { oElTab = document.getElementById(oColl[0].getAttribute("axTab")); } return oElTab; } catch (e) { XError.display(this.className,e,"getFirstTab"); throw e; } }; this.getSelectedTab = function(psTabSet) { try { var oEl = this.getTabSetSelectedEl(psTabSet); if (oEl) { oEl = document.getElementById(oEl.value); if (oEl) { return oEl.id; } } return ""; } catch (e) { XError.display(this.className,e,"getSelectedTab"); throw e; } }; this.isTabSelected = function(psTabId) { try { var oEl = document.getElementById(psTabId); if (oEl) { var sTabSet = oEl.getAttribute("axTabSet"); oEl = this.getTabSetSelectedEl(sTabSet); if (oEl) { return oEl.value == psTabId; } } return false; } catch (e) { XError.display(this.className,e,"isSelectedTab"); throw e; } }; this.getTabSetControllerEl = function(psTabSetId) { try { return document.getElementById(psTabSetId + "_Controller"); } catch (e) { XError.display(this.className,e,"getTabSetControllerEl"); throw e; } }; this.getTabSetSelectedEl = function(psTabSetId) { try { return document.getElementById(psTabSetId + "_Selected"); } catch (e) { XError.display(this.className,e,"getTabSetSelectedEl"); throw e; } }; this.getTabPanel = function(psTabId) { try { return document.getElementById(psTabId + "_Panel"); } catch (e) { XError.display(this.className,e,"getTabPanel"); throw e; } }; this.getTab = function(psTabId) { try { if (XString.isNotEmpty(psTabId)) { return document.getElementById(psTabId); } return null; } catch (e) { XError.display(this.className,e,"getTab"); throw e; } }; this.hideTabPanel = function(psTabId) { try { var oEl = this.getTabPanel(psTabId); if (oEl) { oEl.style.display = "none"; } } catch (e) { XError.display(this.className,e,"hideTabPanel"); throw e; } }; this.showTabPanel = function(psTabId) { try { var oEl = this.getTabPanel(psTabId); if (oEl) { oEl.style.display = ""; } } catch (e) { XError.display(this.className,e,"showTabPanel"); throw e; } }; this.hideTabs = function(psTabSet) { var oElTabController; var oColl; var oElTab; try { oElTabController = this.getTabSetControllerEl(psTabSet); oColl = this.getTabElements(psTabSet); if (oColl) { for ( var i=0; i // * Traps the move moving and invokes the following methods on the moveListener: // onResized, onResizeStart, onResizeEnd // * axResizeContainerId is the constraining container. if empty, will be the document. // * axResizePadding is the padding in pixels which the element must be within the border of the container. // * axResizeRefreshInterval is the number of pixels that need to be moved before a refresh occurs // * axResizeDir is one of: H=horizontal, V=vertical, both function XResizerClass() { this.className = "XResizerClass"; this.directionHorizontal = "H"; this.directionVertical = "V"; this.directionBoth = ""; this.defaultPadding = 10; this.defaultRefreshInterval = 0; this.defaultCancelThreshhold = 100; // if the x,y diff from the last event is more than this value, action is cancelled this.defaultHideStatus = false; this.defaultCursorStyle = XBrowser.cursorResizeNW; this.defaultMinWidth = 20; this.defaultMaxWidth = 0; this.defaultMinHeight = 4; this.defaultMaxHeight = 0; // control and elements this.controlEl = null; this.listener = null; this.documentState = null; this.containerEl = null; this.containerElState = null; this.containerElWidth = 0; this.containerElHeight = 0; this.containerElPosLeft = 0; this.containerElPosRight = 0; this.containerElPosTop = 0; this.containerElPosBottom = 0; this.targetEl = null; this.targetElId = ""; // the element that has the scrollbars this.scrollEl = null; this.scrollElId = ""; // control variables this.isWorking = false; this.isHideStatus = false; this.isWorkPending = false; this.isEndPending = false; this.isResizeHorizontal = true; this.isResizeVertical = true; this.minPadding = this.defaultPadding; this.cursorStyle = this.defaultCursorStyle; this.refreshInterval = this.defaultRefreshInterval; this.cancelThreshhold = this.defaultCancelThreshhold; this.lastX = 0; this.lastY = 0; this.currX = 0; this.currY = 0; this.minX = 0; this.minY = 0; this.maxX = 0; this.maxY = 0; this.minXX = 0; this.minYY = 0; this.maxXX = 0; this.maxYY = 0; this.startAction = function(poControlEl,poListener,poTargetElId) { var tmp; var oEvent = XEvent.getEvent(); try { this.isWorking = false; this.isWorkPending = false; this.isEndPending = false; this.controlEl = null; this.scrollEl = null; this.documentState = null; var oEl = poControlEl; if (!oEl) { oEl = XEvent.getSrcElement(oEvent); } if (!oEl) { return false; } // control settings this.controlEl = oEl; this.scrollElId = XString.evl(this.controlEl.getAttribute("axResizeScrollId"),""); this.isHideStatus = XBoolean.parse(XString.evl(this.controlEl.getAttribute("axResizeHideStatus"),this.defaultHideStatus)); this.minPadding = XString.evl(this.controlEl.getAttribute("axResizePadding"),this.defaultPadding)*1; this.cursorStyle = XString.evl(this.controlEl.getAttribute("axResizeCursor"),this.defaultCursorStyle); this.refreshInterval = XString.evl(this.controlEl.getAttribute("axResizeRefreshInterval"),this.defaultRefreshInterval); this.cancelThreshhold = XString.evl(this.controlEl.getAttribute("axResizeCancelThreshhold"),this.defaultCancelThreshhold); // resize direction this.isResizeHorizontal = true; this.isResizeVertical = true; this.direction = XString.evl(this.controlEl.getAttribute("axResizeDir"),this.directionBoth); if (this.direction == this.directionHorizontal) { this.isResizeVertical = false; } if (this.direction == this.directionVertical) { this.isResizeHorizontal = false; } // listener this.listener = poListener; // scroll object this.scrollEl = document.getElementById(this.scrollElId); this.setScrollElement(this.scrollEl); // container object tmp = this.controlEl.getAttribute("axResizeContainerId"); if (XString.isNotEmpty(tmp)) { this.containerEl = document.getElementById(tmp); } if (!this.containerEl) { this.containerEl = document.body; } this.setContainer(this.containerEl); // target object this.targetElId = XString.evl(poTargetElId,""); this.targetEl = document.getElementById(this.targetElId); this.setTarget(this.targetEl); // coords var evt = XEvent.getEvent(); // TODO: FIREFOX this.lastX = evt.x;// TODO: FIREFOX this.lastY = evt.y; // TODO: FIREFOX this.currX = evt.x;// TODO: FIREFOX this.currY = evt.y;// TODO: FIREFOX this.minXX = this.containerEl.style.pixelLeft - (-this.minPadding); this.minYY = this.containerEl.style.pixelTop - (-this.minPadding); this.maxXX = this.containerElWidth - this.minPadding; this.maxYY = this.containerElHeight - this.minPadding; this.minX = this.containerElPosLeft - (-this.minPadding); this.minY = this.containerElPosTop - (-this.minPadding); this.maxX = this.containerElPosLeft - (-this.maxXX); this.maxY = this.containerElPosTop - (-this.maxYY); // set the new container events on the container /* this.containerEl.onmousemove = XResizer.performAction; this.containerEl.onmouseup = XResizer.endAction; this.containerEl.onclick = XResizer.endAction; this.containerEl.ondblclick = XResizer.endAction; this.containerEl.style.cursor = this.cursorStyle; */ // set the new container events on the document this.documentState = new XHtmlState(document.body); this.documentState.captureState(true); document.body.onmousemove = XResizer.performAction; document.body.onmouseup = XResizer.endAction; document.body.onclick = XResizer.endAction; document.body.ondblclick = XResizer.endAction; document.body.style.cursor = this.cursorStyle; if (this.listener) { this.listener.onResizeStart(XResizer); } return XEvent.cancel(oEvent); } catch (e) { XError.display(this.className,e,"startAction"); return XEvent.cancel(oEvent); } }; this.setScrollElement = function(poEl) { try { this.scrollElId = ""; this.scrollEl = poEl; if (poEl) { this.scrollElId = poEl.id; } else { this.scrollEl = this.containerEl; } } catch (e) { XError.display(this.className,e,"setScrollElement"); return XEvent.cancel(); } }; this.setTarget = function(poEl) { try { this.targetElId = ""; this.targetEl = poEl; if (poEl) { this.targetElId = poEl.id; } } catch (e) { XError.display(this.className,e,"setTarget"); return XEvent.cancel(); } }; this.setContainer = function(poEl) { try { if (!poEl) { return; } this.containerEl = poEl; this.containerElState = new XHtmlState(this.containerEl); this.containerElState.captureState(true); // clientHeight and clientWidth ignore padding, margin, and scrollbars this.containerElWidth = this.containerEl.clientWidth*1; this.containerElHeight = this.containerEl.clientHeight*1; this.containerElPosLeft = XHtmlUtil.calcAbsoluteLeft(this.containerEl)*1; this.containerElPosRight = this.containerElPosLeft - (-this.containerElWidth); this.containerElPosTop = XHtmlUtil.calcAbsoluteTop(this.containerEl)*1; this.containerElPosBottom = this.containerElPosTop - (-this.containerElHeight); if (!this.scrollEl) { this.scrollEl = this.containerEl; } } catch (e) { XError.display(this.className,e,"setContainer"); return XEvent.cancel(); } }; this.resizeObject = function(poTarget,pnDiffX,pnDiffY,pbAdjustScroll) { var adjusted = false; var oCont = XResizer.containerEl; var oScroll = XResizer.scrollEl; var oEl = poTarget; var diffx = pnDiffX*1; var diffy = pnDiffY*1; var minw = XString.evl(oEl.getAttribute("axResizeMinWidth"),XResizer.defaultMinWidth); var maxw = XString.evl(oEl.getAttribute("axResizeMaxWidth"),XResizer.defaultMaxWidth); var minh = XString.evl(oEl.getAttribute("axResizeMinHeight"),XResizer.defaultMinHeight); var maxh = XString.evl(oEl.getAttribute("axResizeMaxHeight"),XResizer.defaultMaxHeight); var w = XString.evl(oEl.style.pixelWidth,"0")*1; if (w <= 0) { w = oEl.offsetWidth; } var h = XString.evl(oEl.style.pixelHeight,"0")*1; if (h <= 0) { h = oEl.offsetHeight; } var ww = w - (-diffx); var hh = h - (-diffy); if (ww < minw) { ww = minw; adjusted=true; } else { if ( (XResizer.maxXX > 0) && (ww > XResizer.maxXX) ) { ww = XResizer.maxXX - w; adjusted = true; } } if (hh < minh) { hh = minh; adjusted=true; } else { if ( (XResizer.maxYY > 0) && (hh > XResizer.maxYY) ){ hh = XResizer.maxYY - h; adjusted = true; } } oEl.style.pixelWidth = ww; oEl.style.pixelHeight = hh; if (pbAdjustScroll) { // scrollLeft/scrollHeight is the number of pixels the scrollbar is shifted right or down respectively // clientWidth and clientHeight is the "visible" area of the object - minus borders, padding, and scrollbars if (ww > oScroll.clientWidth) { oScroll.scrollLeft += ww - oScroll.clientWidth; } if (hh > oScroll.clientHeight) { oScroll.scrollTop += hh - oScroll.clientHeight; } } return new XPoint(ww,hh,adjusted); }; this.performAction = function() { // check exit conditions if (XResizer.isWorking) { return XEvent.cancel(); } if (!XResizer.controlEl) { XResizer.endAction(); return XEvent.cancel(); } var evt = event; // TODO: FIREFOX if ((!evt) || (XEvent.isLeftClick(evt))) { XResizer.endAction(); return XEvent.cancel(); } XResizer.isWorking = true; XResizer.isWorkPending = false; XResizer.isEndPending = false; var checkPosition = true; var x = evt.x*1;// TODO: FIREFOX var y = evt.y*1;// TODO: FIREFOX var diffx = (x - XResizer.lastX)*1; var diffy = (y - XResizer.lastY)*1; XResizer.currX = x; XResizer.currY = y; if (!XResizer.isHideStatus) { window.status = "(" + x + "," + y + ")"; } // check that we moved if ( (diffx == 0) && (diffy == 0) ) { XResizer.isWorking = false; return XEvent.cancel(); } var absDiffx = Math.abs(diffx); var absDiffy = Math.abs(diffy); // check for interval if (XResizer.refreshInterval > 0) { // see if we are under the throttle and j if ( (absDiffx < XResizer.refreshInterval) && (absDiffy < XResizer.refreshInterval) ) { XResizer.isWorking = false; XResizer.isWorkPending = true; return XEvent.cancel(); } } // check the cancel threshhold if (XResizer.cancelThreshhold > 0) { // see if we are over the threshhold if ( (absDiffx > XResizer.cancelThreshhold) || (absDiffy > XResizer.cancelThreshhold) ) { XResizer.endAction(); return XEvent.cancel(); } } // check the resize direction if (!XResizer.isResizeHorizontal) { diffx = 0; } if (!XResizer.isResizeVertical) { diffy = 0; } var point = null; if (XResizer.targetEl) { try { // point is new width,height point = XResizer.resizeObject(XResizer.targetEl,diffx,diffy,true); } catch (e) { } } if (true) { // check if we are outside the container if ( (XNumber.compare(x,XResizer.containerElPosLeft) < 0) || (XNumber.compare(x,XResizer.containerElPosRight) > 0) || (XNumber.compare(y,XResizer.containerElPosTop) < 0) || (XNumber.compare(y,XResizer.containerElPosBottom) > 0) ) { XResizer.isEndPending = true; } } if (XResizer.listener) { try { XResizer.listener.onResizeExec(XResizer); } catch (e) { } } XResizer.lastX = x; XResizer.lastY = y; XResizer.isWorking = false; if (XResizer.isEndPending ) { XResizer.endAction(); return XEvent.cancel(); } return XEvent.cancel(); }; this.endAction = function() { XResizer.isWorking = false; if (XResizer.controlEl) { try { if (XResizer.documentState) { XResizer.documentState.restoreState(); } } catch (e) {} try { // restore the state if (XResizer.containerElState) { XResizer.containerElState.restoreState(); } } catch (e) {} try { if (XResizer.listener) { XResizer.listener.onResizeEnd(XResizer); } } catch (e) {} } XResizer.targetEl = null; XResizer.controlEl = null; XResizer.isWorking = false; XResizer.isWorkPending = false; XResizer.isEndPending = false; return XEvent.cancel(); }; return this; }; var XResizer = new XResizerClass(); // * Eg: // // * Traps the move moving and invokes the following methods on the moveListener: // onMoved, onMoveStart, onMoveEnd // * axMoveContainerId is the constraining container. if empty, will be the document. // * axMovePadding is the padding in pixels which the element must be within the border of the container. // * axMoveRefreshInterval is the number of pixels that need to be moved before a refresh occurs function XMoverClass() { this.className = "XMoverClass"; this.defaultPadding = "10"; this.defaultRefreshInterval = 0; this.defaultCancelThreshhold = 100; // if the x,y diff from the last event is more than this value, action is cancelled this.defaultHideStatus = false; this.defaultCursorStyle = XBrowser.cursorMove; // control and elements this.controlEl = null; this.listener = null; this.documentState = null; this.containerEl = null; this.containerElState = null; this.containerElWidth = 0; this.containerElHeight = 0; this.containerElPosLeft = 0; this.containerElPosRight = 0; this.containerElPosTop = 0; this.containerElPosBottom = 0; this.targetEl = null; this.targetElId = ""; // the element that has the scrollbars this.scrollEl = null; this.scrollElId = ""; // control variables this.isWorking = false; this.isHideStatus = false; this.isWorkPending = false; this.isEndPending = false; this.minPadding = this.defaultPadding; this.cursorStyle = this.defaultCursorStyle; this.refreshInterval = this.defaultRefreshInterval; this.cancelThreshhold = this.defaultCancelThreshhold; this.lastX = 0; this.lastY = 0; this.currX = 0; this.currY = 0; this.minX = 0; this.minY = 0; this.maxX = 0; this.maxY = 0; this.minXX = 0; this.minYY = 0; this.maxXX = 0; this.maxYY = 0; this.startAction = function(poControlEl,poListener,poTargetElId) { try { this.isWorking = false; this.isWorkPending = false; this.isEndPending = false; this.controlEl = null; this.scrollEl = null; this.documentState = null; var oEl = poControlEl; if (!oEl) { oEl = XEvent.getSrcElement(); } if (!oEl) { return false; } // control settings this.controlEl = oEl; this.scrollElId = XString.evl(this.controlEl.getAttribute("axMoveScrollId"),""); this.isHideStatus = XBoolean.parse(XString.evl(this.controlEl.getAttribute("axMoveHideStatus"),this.defaultHideStatus)); this.minPadding = XString.evl(this.controlEl.getAttribute("axMovePadding"),this.defaultPadding)*1; this.cursorStyle = XString.evl(this.controlEl.getAttribute("axMoveCursor"),this.defaultCursorStyle); this.refreshInterval = XString.evl(this.controlEl.getAttribute("axMoveRefreshInterval"),this.defaultRefreshInterval); this.cancelThreshhold = XString.evl(this.controlEl.getAttribute("axMoveCancelThreshhold"),this.defaultCancelThreshhold); // listener this.listener = poListener; // scroll object this.scrollEl = document.getElementById(this.scrollElId); this.setScrollElement(this.scrollEl); // container object var contId = this.controlEl.getAttribute("axMoveContainerId"); if (XString.isNotEmpty(contId)) { this.containerEl = document.getElementById(contId); } if (!this.containerEl) { this.containerEl = document.body; } this.setContainer(this.containerEl); // target object this.targetElId = XString.evl(poTargetElId,""); this.targetEl = document.getElementById(this.targetElId); this.setTarget(this.targetEl); // coords var evt = event; // TODO: FIREFOX this.lastX = evt.x; // TODO: FIREFOX this.lastY = evt.y; // TODO: FIREFOX this.currX = evt.x; // TODO: FIREFOX this.currY = evt.y; // TODO: FIREFOX this.minXX = this.containerEl.style.pixelLeft - (-this.minPadding); this.minYY = this.containerEl.style.pixelTop - (-this.minPadding); this.maxXX = this.containerElWidth - this.minPadding; this.maxYY = this.containerElHeight - this.minPadding; this.minX = this.containerElPosLeft - (-this.minPadding); this.minY = this.containerElPosTop - (-this.minPadding); this.maxX = this.containerElPosLeft - (-this.maxXX); this.maxY = this.containerElPosTop - (-this.maxYY); // set the new container events on the container /* this.containerEl.onmousemove = XMover.performAction; this.containerEl.onmouseup = XMover.endAction; this.containerEl.onclick = XMover.endAction; this.containerEl.ondblclick = XMover.endAction; this.containerEl.style.cursor = this.cursorStyle; */ // set the new container events on the document this.documentState = new XHtmlState(document.body); this.documentState.captureState(true); document.body.onmousemove = XMover.performAction; document.body.onmouseup = XMover.endAction; document.body.onclick = XMover.endAction; document.body.ondblclick = XMover.endAction; document.body.onselectstart = XEvent.cancel; document.body.style.cursor = this.cursorStyle; if (this.listener) { this.listener.onMoveStart(XMover); } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"startAction"); return XEvent.cancel(); } }; this.setScrollElement = function(poEl) { try { this.scrollElId = ""; this.scrollEl = poEl; if (poEl) { this.scrollElId = poEl.id; } else { this.scrollEl = this.containerEl; } } catch (e) { XError.display(this.className,e,"setScrollElement"); return XEvent.cancel(); } }; this.setTarget = function(poEl) { try { this.targetElId = ""; this.targetEl = poEl; if (poEl) { this.targetElId = poEl.id; } } catch (e) { XError.display(this.className,e,"setTarget"); return XEvent.cancel(); } }; this.setContainer = function(poEl) { try { if (!poEl) { return; } this.containerEl = poEl; this.containerElState = new XHtmlState(this.containerEl); this.containerElState.captureState(true); // clientHeight and clientWidth ignore padding, margin, and scrollbars this.containerElWidth = this.containerEl.clientWidth*1; this.containerElHeight = this.containerEl.clientHeight*1; this.containerElPosLeft = XHtmlUtil.calcAbsoluteLeft(this.containerEl)*1; this.containerElPosRight = this.containerElPosLeft - (-this.containerElWidth); this.containerElPosTop = XHtmlUtil.calcAbsoluteTop(this.containerEl)*1; this.containerElPosBottom = this.containerElPosTop - (-this.containerElHeight); if (!this.scrollEl) { this.scrollEl = this.containerEl; } } catch (e) { XError.display(this.className,e,"setContainer"); return XEvent.cancel(); } }; // returns true if we are outside the container area this.moveObject = function(poTarget,pnDiffX,pnDiffY,pbAdjustScroll) { var adjusted = false; var oCont = XMover.containerEl; var oScroll = XMover.scrollEl; var oEl = poTarget; var diffx = pnDiffX*1; var diffy = pnDiffY*1; var w = XString.evl(oEl.style.pixelWidth,"0")*1; if (w <= 0) { w = oEl.offsetWidth; } var h = XString.evl(oEl.style.pixelHeight,"0")*1; if (h <= 0) { h = oEl.offsetHeight; } var xx = oEl.style.pixelLeft - (-diffx); var yy = oEl.style.pixelTop - (-diffy); var ww = xx - (-w); var hh = yy - (-h); if (xx < XMover.minXX) { xx = XMover.minXX; adjusted=true; } else { if (ww > XMover.maxXX) { xx = XMover.maxXX-w; adjusted=true; } } if (yy < XMover.minYY) { yy = XMover.minYY; adjusted=true; } else { if (hh > XMover.maxYY) { yy = XMover.maxYY-h; adjusted=true; } } oEl.style.pixelLeft = xx; oEl.style.pixelTop = yy; if (pbAdjustScroll) { // scrollLeft/scrollHeight is the number of pixels the scrollbar is shifted right or down respectively // clientWidth and clientHeight is the "visible" area of the object - minus borders, padding, and scrollbars if (xx < oScroll.scrollLeft) { oScroll.scrollLeft += xx - oScroll.scrollLeft; } else if (ww > oScroll.clientWidth) { oScroll.scrollLeft += ww - oScroll.clientWidth; } if (yy < oScroll.scrollTop) { oScroll.scrollTop += yy - oScroll.scrollTop; } else if (hh > oScroll.clientHeight) { oScroll.scrollTop += hh - oScroll.clientHeight; } } return new XPoint(xx,yy,outside); }; this.performAction = function() { // check exit conditions if (XMover.isWorking) { return XEvent.cancel(); } if (!XMover.controlEl) { XMover.endAction(); return XEvent.cancel(); } var evt = event; // TODO: FIREFOX if ((!evt) || (XEvent.isLeftClick(evt))) { XMover.endAction(); return XEvent.cancel(); } XMover.isWorking = true; XMover.isWorkPending = false; XMover.isEndPending = false; var checkPosition = true; var x = evt.x*1; var y = evt.y*1; var diffx = (x - XMover.lastX)*1; var diffy = (y - XMover.lastY)*1; XMover.currX = x; XMover.currY = y; if (!XMover.isHideStatus) { window.status = "(" + x + "," + y + ")"; //window.status += " dx=" + diffx + " dy=" + diffy + " ct=" + XMover.cancelThreshhold; } // check that we moved if ( (diffx == 0) && (diffy == 0) ) { XMover.isWorking = false; return XEvent.cancel(); } var absDiffx = Math.abs(diffx); var absDiffy = Math.abs(diffy); // check for interval if (XMover.refreshInterval > 0) { // see if we are under the throttle and j if ( (absDiffx < XMover.refreshInterval) && (absDiffy < XMover.refreshInterval) ) { XMover.isWorking = false; XMover.isWorkPending = true; return XEvent.cancel(); } } // check the cancel threshhold if (XMover.cancelThreshhold > 0) { // see if we are over the threshhold if ( (absDiffx > XMover.cancelThreshhold) || (absDiffy > XMover.cancelThreshhold) ) { XMover.endAction(); return XEvent.cancel(); } } var point = null; if (XMover.targetEl) { try { point = XMover.moveObject(XMover.targetEl,diffx,diffy,true); } catch (e) { } } if (true) { // check if we are outside the container if ( (XNumber.compare(x,XMover.containerElPosLeft) < 0) || (XNumber.compare(x,XMover.containerElPosRight) > 0) || (XNumber.compare(y,XMover.containerElPosTop) < 0) || (XNumber.compare(y,XMover.containerElPosBottom) > 0) ) { XMover.isEndPending = true; } } if (XMover.listener) { try { XMover.listener.onMoveExec(XMover); } catch (e) { } } XMover.lastX = x; XMover.lastY = y; XMover.isWorking = false; if (XMover.isEndPending ) { XMover.endAction(); return XEvent.cancel(); } return XEvent.cancel(); }; this.endAction = function() { XMover.isWorking = false; if (XMover.controlEl) { try { if (XMover.documentState) { XMover.documentState.restoreState(); } } catch (e) {} try { // restore the state if (XMover.containerElState) { XMover.containerElState.restoreState(); } } catch (e) {} try { if (XMover.listener) { XMover.listener.onMoveEnd(XMover); } } catch (e) {} } XMover.targetEl = null; XMover.controlEl = null; XMover.isWorking = false; XMover.isWorkPending = false; XMover.isEndPending = false; return XEvent.cancel(); }; return this; }; var XMover = new XMoverClass(); // * Eg: // // * The document elements with id = (axResizeEl and axResizeEl2) will get resized within axResizeContainerEl // * axResizeInvert="1" indicates the resize el is on the right or bottom // * axResizeContainerEl - if blank, will use the parent function XFrameResizerClass() { this.className = "XFrameResizerClass"; this.currSliderEl = null; this.currSlideVert = false; this.currResizeInvert = false; this.currParentEl = null; this.currResizeEl = null; this.currResizeEl2 = null; this.currResizeMin = 10; this.currResizeMax = 0; this.currResizeContainerEl = null; this.currContainerWidth = 0; this.currContainerHeight = 0; this.currWidth=0; this.currHeight=0; this.currPosX = 0; this.currPosY = 0; this.currStyleCursor = XBrowser.cursorResize; this.throttle = 20; this.inResizer = false; this.docStateMouseMove = null; this.docStateMouseUp = null; this.docStateSelectStart = null; this.docStateCursor = null; this.startResize = function(poEl) { try { var oEl = poEl; if (!oEl) { oEl = XEvent.getSrcElement(); } if (!oEl) { return false; } // get the slider properties this.inResizer = false; this.currSliderEl = oEl; this.currSlideVert = XBoolean.parse(oEl.getAttribute("axResizeVertical")); this.currResizeInvert = XBoolean.parse(oEl.getAttribute("axResizeInvert")); this.currResizeMin = XString.evl(oEl.getAttribute("axResizeMin"),"1")*1; this.currResizeMax = XString.evl(oEl.getAttribute("axResizeMax"),"0")*1; this.currResizeEl = document.getElementById(oEl.getAttribute("axResizeEl")); this.currResizeEl2 = document.getElementById(oEl.getAttribute("axResizeEl2")); this.currStyleCursor = XString.evl(oEl.getAttribute("axResizeCursor"),XBrowser.cursorResize); var contId = oEl.getAttribute("axResizeContainerEl"); if (XString.isNotEmpty(contId)) { this.currResizeContainerEl = document.getElementById(contId); } if (!this.currResizeContainerEl) { this.currResizeContainerEl = document.body; } this.currContainerWidth = this.currResizeContainerEl.clientWidth; this.currContainerHeight = this.currResizeContainerEl.clientHeight; if (XString.isEmpty(this.currStyleCursor)) { if (this.currSlideVert) { this.currStyleCursor = XBrowser.cursorResizeVertical; } else { this.currStyleCursor = XBrowser.cursorResizeHorizontal; } } var evt = event; // TODO: FIREFOX this.currPosX = evt.x; // TODO: FIREFOX this.currPosY = evt.y; // TODO: FIREFOX this.currWidth = this.currResizeEl.offsetWidth; this.currHeight = this.currResizeEl.offsetHeight; // save the document state this.docStateMouseMove = document.onmousemove; this.docStateMouseUp = document.onmouseup; this.docStateSelectStart = document.onselectstart; this.docStateCursor = document.body.style.cursor; // start the resize document.onmouseup = XFrameResizer.endResize; document.onmousemove = XFrameResizer.resize; document.onselectstart = null; document.onclick = XFrameResizer.endResize; document.body.style.cursor = this.currStyleCursor; } catch (e) { XError.display(this.className,e,"startResize"); } }; this.resize = function() { var evt = event; // TODO: FIREFOX evt.cancelBubble=true; var bend = false; XFrameResizer.inResize = true; if (!window.event) { XFrameResizer.endResize(); return; } var x = evt.x*1; var y = evt.y*1; try { if (XEvent.isLeftClick(evt)) { XFrameResizer.endResize(); return; } var diff = 0; var size = 0; var start = 0; var throttle = XFrameResizer.throttle; //var parentEl = document.body; if (!XFrameResizer.currSlideVert) { start = XFrameResizer.currWidth; if (XFrameResizer.currResizeInvert) { diff = (XFrameResizer.currPosX - x)*1; } else { diff = (x - XFrameResizer.currPosX)*1; } if (diff == 0 ) { return; } if ( (diff > 0) && (diff > throttle) ) { return;} if ( (diff < 0) && (diff < (-throttle)) ) { return;} size = XFrameResizer.currWidth - (-diff); if (size < XFrameResizer.currResizeMin) { size = XFrameResizer.currResizeMin; bend = true; } if ( (size > XFrameResizer.currResizeMax) && (XFrameResizer.currResizeMax > 0) ){ size = XFrameResizer.currResizeMax; bend = true; } // make sure the size < the body size if ( size >= XFrameResizer.currContainerWidth) { size = offset; bend = true; } XFrameResizer.currResizeEl.style.width = size; XFrameResizer.currWidth = size; if (XFrameResizer.currResizeEl2) { XFrameResizer.currResizeEl2.style.width = size; } } else { start = XFrameResizer.currHeight; if (XFrameResizer.currResizeInvert) { diff = (XFrameResizer.currPosY - y)*1; } else { diff = (y - XFrameResizer.currPosY)*1; } if (diff == 0 ) { return; } if ( (diff > 0) && (diff > throttle) ) { return;} if ( (diff < 0) && (diff < (-throttle)) ) { return;} size = XFrameResizer.currHeight - (-diff); if (size < XFrameResizer.currResizeMin) { size = XFrameResizer.currResizeMin; bend = true; } if ( (size > XFrameResizer.currResizeMax) && (XFrameResizer.currResizeMax > 0) ){ size = XFrameResizer.currResizeMax; bend = true; } // make sure the size < the body size if ( size >= XFrameResizer.currContainerHeight) { size = offset; bend = true; } XFrameResizer.currResizeEl.style.height = size; XFrameResizer.currHeight = size; if (XFrameResizer.currResizeEl2) { XFrameResizer.currResizeEl2.style.height = size; } } } catch (e) { } XFrameResizer.currPosX = x; XFrameResizer.currPosY = y; if (bend) { XFrameResizer.endResize(); return; } XFrameResizer.inResize = false; }; this.endResize = function() { document.body.style.cursor = XFrameResizer.docStateCursor; document.onmousemove = XFrameResizer.docStateMouseMove; document.onmouseup = XFrameResizer.docStateMouseUp; document.onselectstart = XFrameResizer.docStateSelectStart; XFrameResizer.inResize = false; }; return this; }; var XFrameResizer = new XFrameResizerClass(); //------------------------------------ // ESCAPE //------------------------------------ function XEscapeClass() { this.className = "XEscapeClass"; this.escapeXmlValue = function(psValue) { var val = psValue + ""; val = XString.replaceAll(val,"&","&"); val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); val = XString.replaceAll(val,'"',"""); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val, String.fromCharCode(13)," "); val = XString.replaceAll(val, String.fromCharCode(10)," "); return val; }; this.unescapeXmlValue = function(psValue) { var val = psValue + ""; val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); val = XString.replaceAll(val,""",'"'); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val," ", String.fromCharCode(13)); val = XString.replaceAll(val,"&xd;", String.fromCharCode(13)); val = XString.replaceAll(val," ", String.fromCharCode(10)); val = XString.replaceAll(val,"&xa;", String.fromCharCode(10)); val = XString.replaceAll(val,"&","&"); return val; }; this.escapeHtmlValue = function(psValue) { var val = psValue + ""; val = XString.replaceAll(val,"&","&"); val = XString.replaceAll(val,'"',"""); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); return val; }; this.unescapeHtmlValue = function(psValue) { var val = psValue + ""; val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); val = XString.replaceAll(val,""",'"'); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val,"&","&"); return val; }; this.htmlToText = function(psValue) { var val = psValue + ""; val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); val = XString.replaceAll(val,""",'"'); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val,"'","'"); val = XString.replaceAll(val," "," "); // replace the Euro Char //val = XString.replaceAll(val,String.fromCharCode(8364),String.fromCharCode(128)); val = XString.replaceAll(val,"&","&"); return val; }; this.textToHtml = function(psValue,pbPreserveLines) { var val = psValue + ""; val = XString.replaceAll(val,"&","&"); val = XString.replaceAll(val,"<","<"); val = XString.replaceAll(val,">",">"); val = XString.replaceAll(val,'"',"""); val = XString.replaceAll(val," "," "); if (XBoolean.parse(pbPreserveLines)) { val = XString.replaceAll(val,XString.CRLF,"
"); val = XString.replaceAll(val,XString.CR,"
"); val = XString.replaceAll(val,XString.LF,"
"); } // replace the Euro Char //val = XString.replaceAll(val,String.fromCharCode(8364),String.fromCharCode(128)); val = XString.replaceAll(val,"'","'"); return val; }; this.getElementValueAsXml = function(psElementId) { var oEl = document.getElementById(psElementId); if (oEl) { return this.escapeXmlValue(oEl.value); } else { return ""; } }; return this; }; var XEscape = new XEscapeClass(); //------------------------------------ // ESCAPE //------------------------------------ function XmlUtilClass() { this.className = "XmlUtilClass"; this.getXmlValueSafe = function(psElementId) { var oEl = document.getElementById(psElementId); if (oEl) { if (XHtmlUtil.isElementCheckbox(oEl)) { return oEl.checked? oEl.value : ""; } else { return XEscape.escapeXmlValue(oEl.value); } } else { return ""; } }; return this; }; var XmlUtil = new XmlUtilClass(); //------------------------------------ // CUSTOM CONTEXTMENU //------------------------------------ function XContextMenuClass() { this.className = "XContextMenuClass"; this.menus = new Array(); this.clear = function() { var oEl; for ( var i=0; i 0) { for (var i=0; i this.xarray.lastPos) { return false; } // iterate if the object is null if (!this.xarray.entries[this.xarrayPos]) { return this.next(); } this.currentIndex++; this.currentObject = this.xarray.entries[this.xarrayPos]; return true; }; return this; }; function XDictionaryEnumReverse (pxArray) { this.xarray = pxArray; this.xarrayPos = this.xarray.lastPos-(-1); this.currentIndex = this.xarray.length; this.currentObject = null; this.next = function() { this.xarrayPos--; if (this.xarrayPos < 0) { return false; } // iterate if the object is null if (!this.xarray.entries[this.xarrayPos]) { return this.next(); } this.currentIndex--; this.currentObject = this.xarray.entries[this.xarrayPos]; return true; }; return this; }; //------------------------------- // X ARRAY //------------------------------- function XArray (pnSize) { this.className = "XArray"; this.objects = null; this.length = 0; this.lastPos = -1; this.maxPos = -1; this.initSize = pnSize; if (XString.isNotEmpty(this.initSize)) { this.objects = new Array(this.initSize); } else { this.objects = new Array(25); }; this.push = function(poObject) { try { this.lastPos++; this.objects[this.lastPos] = poObject; this.length++; poObject.setAttribute("xArrayPos",this.lastPos); if (this.lastPos > this.maxPos) { this.maxPos = this.lastPos; } } catch (e) { XError.display(this.className,e,"push"); throw e; } }; this.pop = function() { try { if (this.length <= 0) { return null; } var obj = this.objects[this.lastPos]; this.length--; this.lastPos--; if (!obj) { return this.pop(); } if (obj) { obj.setAttribute("xArrayPos",-1); } return obj; } catch (e) { XError.display(this.className,e,"pop"); throw e; } }; this.indexOf = function(poObject) { try { var pos = -1; var ap = poObject.getAttribute("xArrayPos"); if (ap) { pos = ap*1; } if (pos >= 0) { return pos; } // brute force it var obj = null; for (var i=0; i<=this.lastPos; i++) { obj = this.objects[i]; if (obj == poObject) { return i; } } return -1; } catch (e) { XError.display(this.className,e,"indexOf"); throw e; } }; this.remove = function(poObject) { try { if (!poObject) { return; } var pos = this.indexOf(poObject); if (pos >= 0) { poObject.setAttribute("xArrayPos",-1); this.objects[pos] = null; this.length--; if (pos == this.lastPos) { this.lastPos--; } } } catch (e) { XError.display(this.className,e,"remove"); throw e; } } ; this.clear = function() { this.length = 0; this.lastPos = -1; }; this.getEnumerator = function(pbReverse) { if (XString.isTrue(pbReverse)) { return new XArrayEnumReverse(this); } else { return new XArrayEnum(this); } }; this.sort = function(pFunction) { // sort and fix the array if ( (this.lastPos == this.length-1) && (this.lastPos >= this.maxPos) ) { this.objects.sort(pFunction); } else { var xar = this.copy(); xar.objects.sort(pFunction); this.objects = xar.objects; this.length = xar.length; this.lastPos = xar.lastPos; } }; this.copy = function() { var objs = new XArray(this.length); var obj = null; for (i=0; i<=this.lastPos; i++) { obj = this.objects[i]; if (obj) { objs.push(obj); } } return objs; }; this.printObjects = function() { var rslt = ""; var obj = null; for (var i=0; i moArray.lastPos) { return false; } // iterate if the object is null var obj = moArray.objects[mnPos]; if (!obj) { return this.next(); } this.currentIndex++; this.currentObject = obj; return true; }; return this; }; function XArrayEnumReverse (poArray) { var moArray = poArray; var mnPos = moArray.lastPos-(-1); this.currentIndex = moArray.length; this.currentObject = null; this.next = function() { mnPos--; if (mnPos < 0) { return false; } // iterate if the object is null var obj = moArray.objects[mnPos]; if (!obj) { return this.next(); } this.currentIndex--; this.currentObject = obj; return true; }; return this; }; //------------------------------- // Standard Array Sort Methods //------------------------------- function fnCompareNumeric(pnVal1,pnVal2) { var val1 = pnVal1*1; var val2 = pnVal2*1; if (val1 axDeleteField stores the name of the field of the delete flag Eg: axDeleteTable stores the name of the table of the deleted items Eg: axItemIdField stores the name of the field of the id related to the record - if this is empty then the item is new and when deleted will not be moved to the axDeleteTable Eg: The two axDeleteField and axDeleteTable need to be created in the create row script Eg. var ins = document.createElement(""); cell.appendChild(ins); var ins = document.createElement(""); cell.appendChild(ins); * selectDeselectRows selects or deselects the first col checkboxes in all of the rows * resetRowClass resets the rows to the on/off class view - this is on the TR * saveCheckBoxes saves the checkbox checked states in the row before moving that row - needs a dictionary object initalized and passed to it * outputCheckBoxes resets the checkbox states to their original state before the move - needs the original dictionary object passed * moveRowUp moves the row clicked up one row * moveRowDown moves the row clicked down one row * deleteRow deletes a row and either saves that deleted row in axDeleteTable and changes the axDeleteField to true or deletes the clicked row * getSelectedRows returns the selected rows in the table as an array of obects - needs a table element passed to it * moveSelectedRowsUp moves all the selected rows in the table up one row * moveSelectedRowsDown moves all the selected rows in the table down one row * deleteSelectedRows either deletes all the selected rows in the table or moves them to the axDeleteTable and changes the axDeleteField to true */ this.className = "XTableClass"; this.rowCSSClassAbr = "CRow"; this.findTableEl = function(poEl) { try { var el = poEl; if (!el) { el = XEvent.getSrcElement(); } if (!el) { return null; } return XHtmlUtil.getParentElementByTag(el, "TABLE",true); } catch (e) { XError.display(this.className,e,"findTableEl"); throw e; } }; this.findTableElByEvent = function(poEvent) { try { var el = XEvent.getSrcElement(poEvent); if (!el) { return null; } return XHtmlUtil.getParentElementByTag(el, "TABLE",true); } catch (e) { XError.display(this.className,e,"findTableElByEvent"); throw e; } }; this.findTableRowEl = function(poEl) { try { var el = poEl; if (!el) { el = XEvent.getSrcElement(); } if (!el) { return null; } return XHtmlUtil.getParentElementByTag(el, "TR",true); } catch (e) { XError.display(this.className,e,"findTableRowEl"); throw e; } }; this.findTableCellEl = function(poEl) { try { var el = poEl; if (!el) { el = XEvent.getSrcElement(); } if (!el) { return null; } return XHtmlUtil.getParentElementByTag(el, "TD",true); } catch (e) { XError.display(this.className,e,"findTableCellEl"); throw e; } }; this.findTableRowElByEvent = function(poEvent) { try { var el = XEvent.getSrcElement(poEvent); if (!el) { return null; } return XHtmlUtil.getParentElementByTag(el, "TR",true); } catch (e) { XError.display(this.className,e,"findTableRowElByEvent"); throw e; } }; this.selectDeselectRows = function(poEl) { try { var src = poEl; if (!src) { src = XEvent.getSrcElement(); } var table = this.findTableEl(src); var rows = table.rows; var val = src.checked?true:false; for ( var i=0; i 1) { if (!cbs) { cbs = new XDictionary(row.cells.length); } this.saveCheckBoxes(cbs, row); table.moveRow(row.rowIndex, row.rowIndex-1); this.outputCheckBoxes(cbs); // NOTE: this assumes that the src element is not a ROW CELL! src.parentElement.outerHTML = src.parentElement.outerHTML; } } catch (e) { XError.display(this.className,e,"moveRowUp"); throw e; } this.resetRowClass(src); }; this.moveRowDown = function(poEl) { var src = poEl; try { var nRow = null; var cbs = null; if (!src) { src = XEvent.getSrcElement(); } var row = this.findTableRowEl(src); var table = this.findTableEl(row); if ( row.rowIndex < (table.rows.length-1) ) { if (!cbs) { cbs = new XDictionary(row.cells.length); } this.saveCheckBoxes(cbs, row); table.moveRow(row.rowIndex, row.rowIndex-(-1)); this.outputCheckBoxes(cbs); // NOTE: this assumes that the src element is not a ROW CELL! src.parentElement.outerHTML = src.parentElement.outerHTML; } } catch (e) { XError.display(this.className,e,"fnMoveRowDown"); throw e; } this.resetRowClass(src); }; this.deleteRow = function(poRow) { var table = null; try { var row = this.findTableRowEl(poRow); table = this.findTableEl(row); var idEl = null; var deleteEl = null; var deleteTable = null; var done = false; var itemIdField = ""; var deleteFieldId = ""; var deleteTableId = ""; itemIdField = table.getAttribute("axItemIdField"); deleteFieldId = table.getAttribute("axDeleteField"); deleteTableId = table.getAttribute("axDeleteTable"); if (XString.isNotEmpty(itemIdField)) { // - find the axItemIdField Row idEl = XHtmlUtil.getChildInputByName(row, itemIdField); if (idEl) { if (XString.isEmpty(idEl.value)) { row.removeNode(true); done = true; } } } if (!done) { // handle the delete logic if the delete field or table exists if ( (XString.isNotEmpty(deleteFieldId)) || (XString.isNotEmpty(deleteTableId)) ) { deleteEl = XHtmlUtil.getChildInputByName(row, deleteFieldId); deleteTable = table.axDeleteTableEl; if (!deleteTable) { deleteTable = document.getElementById(deleteTableId); table.axDeleteTableEl = deleteTable; } if (!deleteEl) { XWindow.alert("stdMsgHtmlXTableErrorMissingDeleteEls"); throw XError.createError("table: " + table.id + ".axDeleteField"); } if (!deleteTable) { XWindow.alert("stdMsgHtmlXTableErrorMissingDeleteEls"); throw XError.createError("table: " + table.id + ".axDeleteTable"); } deleteEl.value = XBoolean.trueIndicator; XHtmlUtil.addRowToTable(deleteTable,row); done = true; } } if (!done) { row.removeNode(true); } } catch(e) { XError.display(this.className,e,"deleteRow"); throw e; } this.resetRowClass(table); }; this.getSelectedRows = function(poEl) { try { // pass this function the table object and it will return the selected row objects var table = this.findTableEl(poEl); var rows = table.rows; var row = null; var selRows = new Array(table.rows.length-1); var cnt = 0; for (var i = 1 - (-0); i < rows.length; i++) { row = rows[i]; cb = row.cells[0].firstChild; if (XString.isTrue(cb.checked)) { selRows[cnt] = row; cnt++; } } selRows.length = cnt; return selRows; } catch (e) { XError.display(this.className,e,"getSelectedRows"); throw e; } }; this.moveSelectedRowsUp = function(poEl) { var src = poEl; try { if (!src) { src = XEvent.getSrcElement(); } var table = this.findTableEl(src); var rows = table.rows; var row = null; var cb = null; var cbs = null; for (var i = (1 - (-1)); i < rows.length; i++) { row = rows[i]; if (!cbs) { cbs = new XDictionary(row.cells.length); } cb = row.cells[0].firstChild; if (cb.checked == true) { this.saveCheckBoxes(cbs, row); table.moveRow(i, i-1); this.outputCheckBoxes(cbs); } } } catch (e) { XError.display(this.className,e,"moveSelectedRowsUp"); //throw e; } this.resetRowClass(src); }; this.moveSelectedRowsDown = function(poEl) { var src = poEl; try { if (!src) { src = XEvent.getSrcElement(); } var table = this.findTableEl(src); var rows = table.rows; var row = null; var cb = null; var cbs = null; var dictEntry = null; var inputs = null; var input = null; for (var i = rows.length - 2; i >= 1 ; i--) { row = rows[i]; cb = row.cells[0].firstChild; if (!cbs) { cbs = new XDictionary(row.cells.length); } if (cb.checked == true) { this.saveCheckBoxes(cbs, row); table.moveRow(i, i+1); this.outputCheckBoxes(cbs); } } } catch (e) { XError.display(this.className,e,"moveSelectedRowsDown"); //throw e; } this.resetRowClass(src); }; this.deleteSelectedRows = function(poEl) { var table = null; try { table = this.findTableEl(poEl); var rows = table.rows; var row = null; var oElChecked = null; for ( var i=rows.length-1; i>0; i-- ) { row = rows[i]; oElChecked = row.children[0].children[0].checked; if (XString.isTrue(oElChecked) ) { this.deleteRow(row); } } this.selectDeselectRows(); } catch (e) { XError.display(this.className, e, "deleteSelectedRows"); //throw e; } this.resetRowClass(table); }; return this; }; var XTable = new XTableClass(); //------------------------------- // XCheckbox Class //------------------------------- function XCheckboxClass() { this.className = "XCheckboxClass"; this.getCheckedByInputId = function(poInputId) { try { var el = xfGet(poInputId + "_CB"); if (el) { return el.checked; } return false; } catch (e) { XError.display(this.className, e, "getCheckedByInputId"); throw e; } }; this.getCheckedByInput = function(poInputEl) { try { if (poInputEl) { return this.getCheckedByInputId(poInputEl.id); } return false; } catch (e) { XError.display(this.className, e, "getCheckedByInput"); throw e; } }; this.getCheckboxFromInputId = function(poInputId) { try { return xfGet(poInputId + "_CB"); } catch (e) { XError.display(this.className, e, "getCheckboxFromInputId"); throw e; } }; this.getCheckboxFromInput = function(poInputEl) { try { if (poInputEl) { return document.getElementById(poInputEl.id + "_CB"); } return null; } catch (e) { XError.display(this.className, e, "getCheckboxFromInput"); throw e; } }; this.getInputFromCheckbox = function(poCheckboxEl) { try { if (poCheckboxEl) { return document.getElementById(poCheckboxEl.getAttribute("axid")); } return null; } catch (e) { XError.display(this.className, e, "getCheckboxFromInput"); throw e; } }; this.setCheckedByInput = function(poInputEl,pbChecked) { try { var input = poInputEl; if (!input) { return; } var checked = XBoolean.parse(pbChecked); var cb = this.getCheckboxFromInput(input); // set the checkbox cb.checked = checked; // set the input if (cb.checked) { input.value = cb.value; } else { input.value = XString.evl(cb.getAttribute("valueoff"),""); } } catch (e) { XError.display(this.className, e, "setCheckedByInput"); throw e; } }; this.setCheckedByCheckbox = function(poCheckboxEl,pbChecked) { try { var cb = poCheckboxEl; if (!cb) { return; } // get the input name of the id cb.checked = XBoolean.parse(pbChecked); var input = this.getInputFromCheckbox(cb); if (cb.checked) { input.value = cb.value; } else { input.value = XString.evl(cb.getAttribute("valueoff"),""); } } catch (e) { XError.display(this.className, e, "setCheckedByCheckbox"); throw e; } }; this.onClick = function(poEl) { var oEl = poEl; try { if (!oEl) { oEl = XEvent.getSrcElement(); } if (!oEl) { return; } this.setCheckedByCheckbox(oEl,oEl.checked); } catch (e) { XError.display(this.className, e, "onClick"); } }; this.toggleChildCheckbox = function(poEl) { try { if (poEl) { // find the first child checkbox var cb = XHtmlUtil.getChildInputByType(poEl,"checkbox"); if (cb) { // toggle the checkbox setting this.setCheckedByCheckbox(cb,!cb.checked); } } return XEvent.cancelBubble(); } catch (e) { XError.display(this.className, e, "toggleChildCheckbox"); } }; this.toggleTableCellXCheckboxes = function(poCell) { try { var src = XTable.findTableCellEl(poCell); if (src) { var idx = src.cellIndex; var table = XTable.findTableEl(src); if (table) { var rows = table.rows; var cell = null; var cb = null; var checked = false; var found = false; // assume a header row for (i=1; i this.listId = psListId; this.listEl = null; this.cssRowActive; this.cssRowSel; this.cssRowUnsel; this.cssRowMouseOver; this.stickySelectInd = pbStickySelect; this.isStickySelect = false; var mAttrSel = "axXListSel"; this.initialize = function() { try { this.listEl = document.getElementById(this.listId); if (XString.isNotEmpty(this.clientListenerName)) { this.clientListener = eval(this.clientListenerName); } this.isStickySelect = XBoolean.parse(pbStickySelect); this.cssRowActive = this.listEl.getAttribute("axCssRowActive"); this.cssRowSel = this.listEl.getAttribute("axCssRowSel"); this.cssRowUnsel = this.listEl.getAttribute("axCssRowUnsel"); this.cssRowMouseOver = this.listEl.getAttribute("axCssMouseOver"); this.setExclusions(); this.activateFirstSelected(); } catch (e) { XError.display(this.className,e,"initialize"); throw e; } }; // activates the first row with axSelected = 1 this.activateFirstSelected = function() { try { var oEl = this.listEl.children; if (oEl) { var row = null for (var i=0; i that represents the rowId this.getRowByInputValue = function(psInputName, psId) { try { if (XString.isEmpty(psInputName)) { return null; } var rows = this.listEl.children; var row = null; var el = null; for (var i=0; i pos1) { oEl = poStartEl.nextSibling; oElEnd = poEndEl; } else { oEl = poEndEl; oElEnd = poStartEl.previousSibling; } while (oEl) { if (this.isRowEnabled(oEl)) { this.selectRow(oEl,pbFireEvent); } if (oEl == oElEnd) { oEl = null; } else { oEl = oEl.nextSibling } } } catch (e) { XError.display(this.className,e,"selectRowRange"); throw e; } }; this.unselectRow = function(poRow,pbFireEvent) { try { if (!poRow) { return; } poRow.className = this.cssRowUnsel; poRow.setAttribute(mAttrSel,XBoolean.falseIndicator); if (this.activeRow == poRow) { this.activeRow = null; } if (pbFireEvent && this.clientListener && this.clientListener.onRowUnselect) { this.clientListener.onRowUnselect(poRow); } } catch (e) { XError.display(this.className,e,"unselectRow"); throw e; } }; this.selectAll = function(pbFireEvent) { try { var rows = this.listEl.children; for (var i=0; i parentChildren.length if (poIndex > childrenLength) { parentoEl.appendChild(childrenLength+1); return; } //pnIndex < parentChildren.length var current = poRow; var old = null; for (var i=0; i < parentChildren.length; i++){ if (i >= poIndex) { old = parentChildren[i]; parentChildren[i] = current; } current = old; } if (pbFireEvent && this.clientListener && this.clientListener.onRowAdd) { this.clientListener.onRowAdd(poRow); } } catch (e) { XError.display(this.className,e,"addRow"); throw e; } }; this.toggleRowSelect = function(poRow,pbFireEvent) { try { if (!poRow) { return; } if (this.isRowSelected(poRow)) { this.unselectRow(poRow,pbFireEvent); } else { this.selectRow(poRow,pbFireEvent); } } catch (e) { XError.display(this.className,e,"toggleRowSelect"); throw e; } }; // Event Listeners this.getParentRow = function(poEl) { try { var oEl = poEl? poEl : XEvent.getSrcElement(); if (!oEl) { return null; } // traverse up until the element is a direct child of the listEl while (oEl.parentElement) { if (oEl.parentElement == this.listEl) { return oEl; } oEl = oEl.parentElement; } return null; } catch (e) { XError.display(this.className,e,"getEventRow"); throw e; } }; this.onMouseOver = function(poRow) { try { var oEl = this.getParentRow(poRow); if ( (!oEl)|| (oEl.className.indexOf(this.cssRowSel) >= 0 ) ) { return XEvent.cancel(); } if (this.activeRow != oEl) { oEl.className = this.cssRowMouseOver; } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onMouseOver"); } }; this.onMouseOut = function(poRow) { try { var oEl = this.getParentRow(poRow); if (!oEl) { return XEvent.cancel(); } //oEl.className = oEl.className.replace(" " + this.cssRowMouseOver,""); if (!this.isRowSelected(oEl)) { if (this.activeRow == oEl) { oEl.className = this.cssRowActive; } else { oEl.className = this.cssRowUnsel; } } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onMouseOut"); } }; this.onClick = function(poRow,pbBubbleEvent) { try { var oEvent = event; // TODO: FIREFOX var bubble = XBoolean.parse(pbBubbleEvent); var oEl = this.getParentRow(poRow); if (!oEl) { return bubble? true : XEvent.cancel(); } if (XEvent.isCtrlKey(oEvent)) { this.toggleRowSelect(oEl,true); return bubble? true : XEvent.cancel(oEvent); } if (XEvent.isShiftKey(oEvent)) { this.selectRowRange(this.activeRow,oEl,true); return bubble? true : XEvent.cancel(oEvent); } if (this.isStickySelect) { this.toggleRowSelect(oEl,true); } else { this.activateRow(oEl,true); } return bubble? true : XEvent.cancel(oEvent); } catch (e) { XError.display(this.className,e,"onClick"); } }; this.onDblClick = function(poRow) { try { var oEl = this.getParentRow(poRow); if (oEl) { if (this.clientListener && this.clientListener.onDblClick) { this.clientListener.onDblClick(oEl); } } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onDblClick"); } }; return this; } //--------------- //-- Grouped List Controller //-- Required Attributes:.axCssRowActive; // axCssRowSel; // axCssRowUnsel; // axCssMouseOver; //-- Events Fired: // onRowEnable // onRowDisable // onRowActivate // onRowSelect // onRowUnselect // onRowRemove // onRowAdd // onDblClick //----------------------- function XListGroupedController(psObjectName,psListId,psClientListenerName,pbStickySelect) { this.className = "XListGroupedController"; this.objectName = psObjectName; this.clientListenerName = psClientListenerName; this.clientListener = null; // ID of the outer html element around the list rows. Usually a
this.listId = psListId; this.listEl = null; this.cssRowActive; this.cssRowSel; this.cssRowUnsel; this.cssRowMouseOver; this.stickySelectInd = pbStickySelect; this.isStickySelect = false; var mAttrSel = "axXListSel"; this.initialize = function() { try { this.listEl = document.getElementById(this.listId); if (XString.isNotEmpty(this.clientListenerName)) { this.clientListener = eval(this.clientListenerName); } this.isStickySelect = XBoolean.parse(pbStickySelect); this.cssRowActive = this.listEl.getAttribute("axCssRowActive"); this.cssRowSel = this.listEl.getAttribute("axCssRowSel"); this.cssRowUnsel = this.listEl.getAttribute("axCssRowUnsel"); this.cssRowMouseOver = this.listEl.getAttribute("axCssMouseOver"); this.setExclusions(); } catch (e) { XError.display(this.className,e,"initialize"); throw e; } }; this.setExclusions = function() { try { var oEl = this.listEl.children; if (oEl) { var row = null for (var i=0; i that represents the rowId this.getRowByInputValue = function(psInputName, psId) { try { if (XString.isEmpty(psInputName)) { return null; } var rows = this.listEl.children; var row = null; var el = null; for (var i=0; i pos1) { oEl = poStartEl.nextSibling; oElEnd = poEndEl; } else { oEl = poEndEl; oElEnd = poStartEl.previousSibling; } while (oEl) { if (this.isRowEnabled(oEl)) { this.selectRow(oEl,pbFireEvent); } if (oEl == oElEnd) { oEl = null; } else { oEl = oEl.nextSibling } } } catch (e) { XError.display(this.className,e,"selectRowRange"); throw e; } }; this.unselectRow = function(poRow,pbFireEvent) { try { if (!poRow) { return; } if ( poRow.getAttribute("axtype") == "group" ) { return; } poRow.className = this.cssRowUnsel; poRow.setAttribute(mAttrSel,XBoolean.falseIndicator); if (this.activeRow == poRow) { this.activeRow = null; } if (pbFireEvent && this.clientListener && this.clientListener.onRowUnselect) { this.clientListener.onRowUnselect(poRow); } } catch (e) { XError.display(this.className,e,"unselectRow"); throw e; } }; this.selectAll = function(pbFireEvent) { try { var rows = this.listEl.children; for (var i=0; i parentChildren.length if (poIndex > childrenLength) { parentoEl.appendChild(childrenLength+1); return; } //pnIndex < parentChildren.length var current = poRow; var old = null; for (var i=0; i < parentChildren.length; i++){ if (i >= poIndex) { old = parentChildren[i]; parentChildren[i] = current; } current = old; } if (pbFireEvent && this.clientListener && this.clientListener.onRowAdd) { this.clientListener.onRowAdd(poRow); } } catch (e) { XError.display(this.className,e,"addRow"); throw e; } }; this.toggleRowSelect = function(poRow,pbFireEvent) { try { if (!poRow) { return; } if (this.isRowSelected(poRow)) { this.unselectRow(poRow,pbFireEvent); } else { this.selectRow(poRow,pbFireEvent); } } catch (e) { XError.display(this.className,e,"toggleRowSelect"); throw e; } }; // Event Listeners this.getParentRow = function(poEl) { try { var oEl = poEl? poEl : XEvent.getSrcElement(); if (!oEl) { return null; } // alert(oEl.parentElement.outerHTML); // traverse up until the element is a direct child of the listEl while (oEl.parentElement) { if (oEl.parentElement == this.listEl) { return oEl; } oEl = oEl.parentElement; } return null; } catch (e) { XError.display(this.className,e,"getEventRow"); throw e; } }; this.onMouseOver = function(poRow) { try { var oEl = this.getParentRow(poRow); if ( (!oEl) || (oEl.className.indexOf(this.cssRowSel) >= 0 ) ) { return XEvent.cancel(); } if ( oEl.getAttribute("axtype") == "group" ) { return XEvent.cancel(); } if (this.activeRow != oEl) { oEl.className = this.cssRowMouseOver; } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onMouseOver"); } }; this.onMouseOut = function(poRow) { try { var oEl = this.getParentRow(poRow); if (!oEl) { return XEvent.cancel(); } if ( oEl.getAttribute("axtype") == "group" ) { return XEvent.cancel(); } //oEl.className = oEl.className.replace(" " + this.cssRowMouseOver,""); if (!this.isRowSelected(oEl)) { if (this.activeRow == oEl) { oEl.className = this.cssRowActive; } else { oEl.className = this.cssRowUnsel; } } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onMouseOut"); } }; this.onClick = function(poRow,pbBubbleEvent) { try { var oEvent = event; // TODO: FIREFOX var bubble = XBoolean.parse(pbBubbleEvent); var oEl = this.getParentRow(poRow); if (!oEl) { return bubble? true : XEvent.cancel(); } if ( oEl.getAttribute("axtype") == "group" ) { return bubble? true : XEvent.cancel(); } if (XEvent.isCtrlKey(oEvent)) { this.toggleRowSelect(oEl,true); return bubble? true : XEvent.cancel(oEvent); } if (XEvent.isShiftKey(oEvent)) { this.selectRowRange(this.activeRow,oEl,true); return bubble? true : XEvent.cancel(oEvent); } if (this.isStickySelect) { this.toggleRowSelect(oEl,true); } else { this.activateRow(oEl,true); } return bubble? true : XEvent.cancel(oEvent); } catch (e) { XError.display(this.className,e,"onClick"); } }; this.onDblClick = function(poRow) { try { var oEl = this.getParentRow(poRow); if (oEl) { if (this.clientListener && this.clientListener.onDblClick) { this.clientListener.onDblClick(oEl); } } return XEvent.cancel(); } catch (e) { XError.display(this.className,e,"onDblClick"); } }; return this; } //------------------------------------ // SELECTORBOX //------------------------------------ function SelectorBox( poContainer, poBox, poCallbackListener, pbEnabled) { this.className = "SelectorBox"; this.container = poContainer; this.oBox = poBox; this.enabled = XBoolean.parse(pbEnabled); this.isBoxShowing = false; this.pinX = 0; this.pinY = 0; this.x1 = 0; this.y1 = 0; this.x2 = 0; this.y2 = 0; this.isReverse = false; this.getLeft = function() { return this.x1; } this.getTop = function() { return this.y1; } this.getWidth = function() { return this.x2 - this.x1; } this.getHeight = function() { return this.y2 - this.y1; } this.getX1 = function() { return this.x1; } this.getY1 = function() { return this.y1; } this.getX2 = function() { return this.x2; } this.getY2 = function() { return this.y2; } this.callbackListener = poCallbackListener; this.initialize = function() { try { if (this.enabled) { this.enable(); } } catch (e) { XError.display(this.className,e,"initialize"); } }; this.setListener = function(poListener,pbEnabled) { this.callbackListener = poListener; if (this.callbackListener) { var enabled = this.enabled; if (XString.isNotEmpty(pbEnabled)) { enabled = XBoolean.parse(pbEnabled); this.enabled = enabled; } } else { this.disable(); } }; this.disable = function() { try { this.container.style.cursor = "auto"; } catch(e) {} this.enabled = false; }; this.enable = function() { try { this.container.style.cursor = "crosshair"; } catch(e) {} this.enabled = true; }; this.setEnabled = function(pbEnabled) { if (XBoolean.parse(pbEnabled)) { this.enable(); } else { this.disable(); } }; this.isEnabled = function() { return this.enabled; }; this.getRelativeEventX = function(poEvent) { // TODO: FIREFOX return poEvent.x - XHtmlUtil.calcAbsoluteLeft(this.container) -(-this.container.scrollLeft); }; this.getRelativeEventY = function(poEvent) { // TODO: FIREFOX return poEvent.y - XHtmlUtil.calcAbsoluteTop(this.container) -(-this.container.scrollTop); }; this.redrawBox = function() { if (!this.isBoxShowing) { this.oBox.style.display = "none"; return; } this.oBox.style.pixelLeft = this.x1; this.oBox.style.pixelTop = this.y1; this.oBox.style.pixelWidth = this.x2 - this.x1; this.oBox.style.pixelHeight = this.y2 - this.y1; this.oBox.style.display = ""; if (this.callbackListener) { this.callbackListener.onSelectorBoxRedraw(this); } }; this.onMouseDown = function(poEvent) { if (!this.enabled) { return; } this.isReverse = false; var oEvent = poEvent? poEvent : window.event; this.pinX = this.x1 = this.getRelativeEventX(oEvent); this.x2 = this.pinX - (-1); this.pinY = this.y1 = this.getRelativeEventY(oEvent); this.y2 = this.pinY - (-1); // make sure we are not on the scroll bar if ( ( ((this.container.style.pixelHeight -(-this.container.scrollTop) - this.pinY) < 20) ) || ( ((this.container.style.pixelWidth -(-this.container.scrollLeft) - this.pinX) < 20) ) ) { return; } this.isBoxShowing = true; }; this.onMouseUp = function(poEvent) { if (!this.enabled) { return; } try { if (!this.isBoxShowing) { return; } this.isBoxShowing = false; this.redrawBox(); if (this.callbackListener) { var box = new XBox(this.x1,this.y1,(this.x2-this.x1),(this.y2-this.y1),this.isReverse); this.callbackListener.onSelectorBoxComplete(this,box); } } catch (e) { //XError.display(this.className,e,"onMouseMove"); } }; this.onMouseMove = function(poEvent) { if (!this.enabled) { return; } if (!this.isBoxShowing) { return; } var oEvent = poEvent? poEvent : window.event; var nX; var nY; try { nX = this.getRelativeEventX(oEvent); nY = this.getRelativeEventY(oEvent); if ( (nX < this.pinX && nY > this.pinY) || (nY < this.pinY && nX > this.pinX) ) { this.isReverse = true; } else { this.isReverse = false; } // Always adjust so that the x/y coords are the top/left if (nX >= this.pinX) { this.x1 = this.pinX; this.x2 = nX; } else { this.x1 = nX; this.x2 = this.pinX; } if (nY >= this.pinY) { this.y1 = this.pinY; this.y2 = nY; } else { this.y1 = nY; this.y2 = this.pinY; } this.redrawBox(); } catch (e) { //XError.display(this.className,e,"onMouseMove"); } }; return this; }; //------------------------------------ // STDLIBS ENUMS //------------------------------------ function XEEventClass() { this.rightClickButton = 2; } var XEEvent = new XEEventClass(); function XEKeyCodeClass() { this.key0 = 48; this.key9 = 57; this.keyBackspace = 8; this.keyDelete = 46; this.keyEnd = 35; this.keyEnter = 13; this.keyHome = 36; this.keyTab = 9; this.keyRightArrow = 39; this.keyLeftArrow = 37; this.keyPeriod = 190; this.keyPad0 = 96; this.keyPad9 = 105; this.keyPadDecimal = 110; this.keyCut = 88; // x this.keyCopy = 67; // c this.keyPaste = 86; // v return this; }; var XEKeyCode = new XEKeyCodeClass(); function XEDataTypeClass() { this.unknown = 0; this.str = 20; this.text = 21; this.number = 30; this.integer = 31; this.integerUnsigned = 32; this.dateTime = 40; this.date = 41; this.time = 42; this.boolean = 60; this.isNumberType = function(pnDataTypeId) { var nt = pnDataTypeId*1; return (nt >= 30) && (nt <= 39); }; this.isDateType = function(pnDataTypeId) { var nt = pnDataTypeId*1; return (nt >= 40) && (nt <= 49); }; this.isStringType = function(pnDataTypeId) { var nt = pnDataTypeId*1; return (nt >= 20) && (nt <= 29); }; this.isNonStringType = function(pnDataTypeId) { var nt = pnDataTypeId*1; return (nt < 20) || (nt > 29); }; return this; }; var XEDataType = new XEDataTypeClass(); function XEValidationFailActionClass() { this.fail = 0; this.warn = 1; return this; }; var XEValidationFailAction = new XEValidationFailActionClass(); function XEInputTypeClass() { this.text = "0"; this.textarea = "1"; this.checkbox = "2"; this.list = "3"; this.barcode = "4"; return this; }; var XEInputType = new XEInputTypeClass(); function XEAddressTypeClass() { this.unknown = "0"; this.email = "1"; this.phone = "2"; this.fax = "3"; this.http = "4"; this.ftp = "5"; this.faxraw = "6"; this.file = "7"; this.print = "8"; this.scan = "9"; this.sms = "10"; this.wap = "11"; this.sftp = "12"; this.faxbridge = "13"; return this; }; var XEAddressType = new XEAddressTypeClass(); function XEAddressComponentIdClass() { this.addressRaw = 501; this.addressProtocol = 502; this.addressDomain = 503; this.addressPort = 504; this.addressAuthType = 505; this.addressAuthUsername = 506; this.addressAuthPassword = 507; this.addressAuthDomain = 508; this.addressCountryCode = 509; this.addressAreaCode = 510; this.addressLocalAddress = 511; this.addressPath = 512; this.addressNationalAddress = 513; this.addressDocumentFormat = 516; this.addressCanonical = 521; this.addressCleansed = 522; return this; }; var XEAddressComponentId = new XEAddressComponentIdClass(); function XEFileTypeClass() { this.pdf = "PDF"; this.tif = "TIF"; return this; }; var XEFileType = new XEFileTypeClass(); function XEObjectTypeClass() { this.file = "41"; this.document = "46"; return this; }; var XEObjectType = new XEObjectTypeClass(); function XEObjectScopeClass() { this.container = "container"; this.document = "document"; this.file = "file"; return this; }; var XEObjectScope = new XEObjectScopeClass(); function XEDisplayMaskClass() { this.never = 0; this.always = 1; this.editable = 2; return this; }; var XEDisplayMask = new XEDisplayMaskClass(); function XEMessageBoxClass() { this.errorType = 4000; this.warningType = 3999; this.infoType = -1; this.successType = 0; return this; }; var XEMessageBox = new XEMessageBoxClass(); function XEHtmlObjectAttribsClass() { this.valueOld = "axzo"; this.objectId = "axzi"; return this; }; var XEHtmlObjectAttribs = new XEHtmlObjectAttribsClass();