(function(){var window=this,$=jQuery,acx={};window.acx=acx;acx.each=$.each;acx.extend=$.extend;acx.augment=function(){var args=Array.prototype.slice.call(arguments),src=(args.length===1)?this:args.shift(),augf=function(n,v){if(!(n in src)){src[n]=v;}};for(var i=0;i<args.length;i++){acx.each(args[i],augf);}return src;};acx.isArray=$.isArray;acx.isObject=function(value){return Object.prototype.toString.call(value)=="[object Object]";};acx.isDate=function(value){return Object.prototype.toString.call(value)=="[object Date]";};acx.isEmpty=function(value,allowBlank){return value===null||value===undefined||((acx.isArray(value)&&!value.length))||(!allowBlank?value==="":false);};acx.parseDate=function(str,fmt,forceStrMonth){var fmt=fmt||window.localeDateFormat;var mnlu=([].concat(JSCal.i18n.mn).concat(JSCal.i18n.smn)).map(function(n){return n.toLowerCase();});var flu=[["%y%Y",1900,2999,_pY],["%m%b%B",0,11,_pM],["%d%e",1,31,_pD],["%H%I%k%l",0,23,_pT],["%M",0,59,_pT]];function getFMap(fkey){return flu.reduce(function(rv,key,i){return key[0].contains(fkey)?i:rv;},null);}function _pY(y){y=parseInt(y,10);return y+(y<100?Math.floor(((new Date()).getFullYear()+50-y)/100)*100:0);}function _pM(m){return((!forceStrMonth&&parseInt(m,10))||1+(mnlu.indexOf(m.toLowerCase())%12))-1;}function _pD(d){return parseInt(d,10);}function _pT(t){tn=parseInt(t,10);return tn+((/pm/i.test(t)&&tn<12)?12:0)+((/am/i.test(t)&&tn>12)?-12:0);}var da=new Date();date=[0,-1,0,0,0],f=fmt.match(/%./g);return((str.match(/^\d+$/)?(str.match(new RegExp(f.map(function(t){return(t.match(/%y/i)&&str.length>(f.length*2))?"(....)":"(..)";}).join("")))||[0,"e"]).slice(1):str.split(/\W/)).reduce(function(good,de,i){var fkey=getFMap(f[i]);if(fkey===null){return good;}date[fkey]=flu[fkey][3](de);return good&&(date[fkey]>=flu[fkey][1]&&date[fkey]<=flu[fkey][2]);},true)&&(da.setTime(Date.UTC.apply(null,date))&&da))||(!forceStrMonth&&parseDate(str,"%m%d%y",true))||(!forceStrMonth&&parseDate(str,"%d%m%y",true));};acx.isFunction=$.isFunction;acx.vector=function(x,y){return new acx.vector.prototype.Init(x,y);};acx.vector.prototype={Init:function(x,y){x=x||0;this.y=isFinite(x.y)?x.y:(isFinite(x.top)?x.top:(isFinite(y)?y:0));this.x=isFinite(x.x)?x.x:(isFinite(x.left)?x.left:(isFinite(x)?x:0));},add:function(i,j){var d=acx.vector(i,j);return new this.Init(this.x+d.x,this.y+d.y);},sub:function(i,j){var d=acx.vector(i,j);return new this.Init(this.x-d.x,this.y-d.y);},addX:function(i){return new this.Init(this.x+i,this.y);},addY:function(j){return new this.Init(this.x,this.y+j);},mod:function(fn){return new this.Init({x:fn.call(this,this.x,"x"),y:fn.call(this,this.y,"y")});},within:function(p,q){return(this.x>=((p.x<q.x)?p.x:q.x)&&this.x<=((p.x>q.x)?p.x:q.x)&&this.y>=((p.y<q.y)?p.y:q.y)&&this.y<=((p.y>q.y)?p.y:q.y));},asOffset:function(){return{top:this.y,left:this.x};},asSize:function(){return{height:this.y,width:this.x};}};acx.vector.prototype.Init.prototype=acx.vector.prototype;$.fn.vSize=function(){return acx.vector(this.width(),this.height());};$.fn.vOuterSize=function(margin){return acx.vector(this.outerWidth(margin),this.outerHeight(margin));};$.fn.vScroll=function(){return acx.vector(this.scrollLeft(),this.scrollTop());};$.fn.vOffset=function(){return acx.vector(this.offset());};$.fn.vPosition=function(){return acx.vector(this.position());};$.Event.prototype.vMouse=function(){return acx.vector(this.pageX,this.pageY);};acx.augment(Array.prototype,{contains:function(needle){return this.indexOf(needle)!==-1;},filter:function(fn,thisp){var res=[];for(var i=0,len=this.length;i<len;i++){if(i in this){var val=this[i];if(fn.call(thisp,val,i,this)){res.push(val);}}}return res;},forEach:function(fn,thisp){for(var i=0;i<this.length;i++){if(i in this){fn.call(thisp,this[i],i,this);}}},indexOf:function(needle,from){from=parseInt(from,10)||0;if(from<0){from+=this.length;}for(;from<this.length;from++){if(from in this&&this[from]===needle){return from;}}return -1;},map:function(fn,thisp){var ret=[];for(var i=0;i<this.length;i++){if(i in this){ret[i]=fn.call(thisp,this[i],i,this);}}return ret;},reduce:function(fn,value){var i=0;rv=value;if(arguments.length===1){while(!(i++ in this)){}rv=this[i-1];}for(;i<this.length;i++){if(i in this){rv=fn.call(null,rv,this[i],i,this);}}return rv;}});acx.augment(Function.prototype,{bind:function(){var method=this,args=Array.prototype.slice.call(arguments),obj=args.shift();return function(){return method.apply(obj,args.concat(Array.prototype.slice.call(arguments)));};},delay:function(){var method=this,args=Array.prototype.slice.call(arguments),timeout=args.shift();return window.setTimeout(function(){return method.apply(method,args);},timeout);}});acx.augment(String.prototype,{contains:function(needle){return this.indexOf(needle)!==-1;},trim:function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"");},equalsIgnoreCase:function(match){return this.toLowerCase()===match.toLowerCase();},escapeHtml:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");},escapeJS:function(){var meta={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},xfrm=function(c){return meta[c]||"\\u"+c.charCodeAt(0).toString(16).zeroPad(4);};return this.replace(new RegExp('(["\\\\\x00-\x1f\x7f-\uffff])',"g"),xfrm);},escapeRegExp:function(){var ret="",esc="\\^$*+?.()=|{,}[]-";for(var i=0;i<this.length;i++){ret+=(esc.contains(this.charAt(i))?"\\":"")+this.charAt(i);}return ret;},zeroPad:function(len){return("0000000000"+this).substring(this.length-len+10);}});acx.browser=$.support;acx.extend(acx.browser,$.browser);acx.browser.major=parseInt(acx.browser.version,10);acx.browser.ie6=acx.browser.msie&&acx.browser.major===6;acx.browser.ie7=acx.browser.msie&&acx.browser.major===7;acx.browser.ie67=acx.browser.ie6||acx.browser.ie7;$(function(){acx.each($.browser,function(n,v,b){if(v===true&&(b=n.match(/ie$|^moz|^saf/))){document.body.className+=b[0]+" "+b[0]+acx.browser.major;}});});(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz;})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(prop){function Class(){if(!initializing){var args=Array.prototype.slice.call(arguments);if(this.makeConfig){this.config=$.extend(function(t){return $.extend(t._proto&&t._proto()&&arguments.callee(t._proto())||{},t.defaults);}(this),args.pop());}this.init&&this.init.apply(this,args);}}initializing=true;var prototype=new this();initializing=false;var _super=this.prototype;prototype._proto=function(){return _super;};for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){this._super=_super[name];return fn.apply(this,arguments);};})(name,prop[name]):prop[name];}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class;};})();acx.i18n=(function(){var me={};var keys={};var format=function(message,args){var substitute=function(){var format=arguments[1].split(",");var substr=escape(args[format.shift()]);if(format.length===0){return substr;}if(format.shift()!=="choice"){return"";}var styles=format.join("").split("|").map(function(style){return style.match(/(-?[\.\d]+)(#|<)([^{}]*)/);});var match=styles[0][3];for(var i=0;i<styles.length;i++){if((styles[i][2]==="#"&&(+styles[i][1])===(+substr))||(styles[i][2]==="<"&&((+styles[i][1])<(+substr)))){match=styles[i][3];}}return match;};if(message===undefined){return message;}return message.replace(/'(')|'([^']+)'|([^{']+)|([^']+)/g,function(x,sq,qs,ss,sub){do{}while(sub&&(sub!==(sub=(sub.replace(/\{([^{}]+)\}/,substitute)))));return sq||qs||ss||unescape(sub);});};me.setKey=function(key,value){keys[key]=value;};me.formatKey=function(){var args=Array.prototype.slice.call(arguments),key=keys[args.shift()];if(args.length===0){return key;}return format(key,args);};me.formatText=function(key,args){return format(key,acx.isArray(args)?args:[args]);};return me;})();acx.ajax=function(options){var req={};var xhrObj=null;var dispatch=function(name,args){return req[name]&&req[name].apply(req.context||req,args);};var defaults={url:document.location.href,type:"POST",timeout:window.default_ajax_timeout||0};var base={beforeSend:function(xhr,opts){xhrObj=xhr;return dispatch("onStart",[xhrObj,req]);},dataFilter:function(data,type){if((xhrObj.getResponseHeader("content-type")||"").indexOf("application/json")===0){data=window["eval"]("("+data+")");}dispatch("onReady",[type,xhrObj,req]);return data;},success:function(data,status){if(xhrObj.getResponseHeader("X-Aconex-Timeout")==="1"){req.error(xhrObj,"sessiontimeout",null);return ;}dispatch("onSuccess",[data,status,xhrObj,req]);},error:function(xhr,status,error){if(dispatch("onError",[status,error,xhrObj,req])===false){return ;}switch(status){case"timeout":alert(acx.text(req.timeout_alert||"General.AjaxRequestTimeout_alert"));break;case"error":case"sessiontimeout":if(acx.isEmpty(xhrObj.responseText)){return ;}var doc=top.document;doc.open();doc.write(xhrObj.responseText);doc.close();break;default:throw ("Unknown ajax request failure ("+status+") "+error.toString());break;}},complete:function(xhr){dispatch("onFinish",[xhrObj,req]);}};acx.extend(req,defaults,options,base);if("data" in req&&(req.data instanceof $)){req.data=req.data.serialize();}["action","_action","viewName"].forEach(function(v){if(v in req){req.url+=(req.url.contains("?")?"&":"?")+encodeURIComponent(v)+"="+encodeURIComponent(req[v]);}});return $.ajax(req);};jQuery.create=function(elementDef,parentNode){var context=(parentNode&&parentNode.ownerDocument)||document;var addAttr=function(el,obj){for(var attr in obj){switch(attr){case"tag":break;case"html":el.innerHTML=obj[attr];break;case"css":for(var style in obj.css){$.attr(el.style,style,obj.css[style]);}break;case"text":case"child":case"children":createNode(obj[attr],el);break;case"cls":$.className.add(el,obj[attr]);break;case"data":for(var data in obj.data){$.data(el,data,obj.data[data]);}break;default:if(attr.indexOf("on")===0&&acx.isFunction(obj[attr])){$.event.add(el,attr.substr(2),obj[attr]);}else{$.attr(el,attr,obj[attr]);}}}};var createNode=function(obj,parent){if(acx.isArray(obj)||(obj&&obj.jquery&&obj.length>1)){for(var ret=[],i=0;i<obj.length;i++){var newNode=createNode(obj[i],parent);if(newNode){ret.push(newNode);}}return ret;}var el;if(typeof (obj)==="string"){el=context.createTextNode(obj);}else{if(!obj){return undefined;}else{if(obj.nodeType===1){el=obj;}else{if(obj instanceof acx.ui.Widget){el=obj.el[0];}else{if(obj.jquery){el=obj[0];}else{if(acx.browser.msie&&obj.tag&&obj.tag.match(/input|button/i)){el=context.createElement("<"+obj.tag+" type='"+obj.type+"'"+(obj.checked?" checked":"")+">");delete obj.type;}else{el=context.createElement(obj.tag||"DIV");}addAttr(el,obj);}}}}}if(parent){parent.appendChild(el);}return el;};return $(createNode(elementDef,parentNode));};acx.ux={};acx.ui={};acx.ut={};acx.ux.Observable=Class.extend((function(){function getObs(type){return(this.observers[type]||(this.observers[type]=[]));}return{makeConfig:true,init:function(){this.observers={};this.suspendEvents=false;for(var opt in this.config){if(opt.indexOf("on")===0){this.on(opt.substring(2).replace(/^[A-Z]/,function(a){return a.toLowerCase();}),this.config[opt]);}}},on:function(type,fn,params,thisp){getObs.call(this,type).push({cb:fn,args:params||[],cx:thisp||this});return this;},fire:function(type){var params=Array.prototype.slice.call(arguments,1);if(this.suspendEvents){return this;}getObs.call(this,type).slice().forEach(function(ob){ob.cb.apply(ob.cx,ob.args.concat(params));});return this;},removeObserver:function(type,fn){var obs=getObs.call(this,type),index=obs.reduce(function(p,t,i){return(t.cb===fn)?i:p;},-1);if(index!==-1){obs.splice(index,1);}return this;},hasObserver:function(type){return !!getObs.call(this,type).length;}};})());acx.ui.Widget=acx.ux.Observable.extend({defaults:{id:""},_id:"Widget",el:null,init:function(){this._super();for(var prop in this){if(prop.contains("_handler")){this[prop]=this[prop].bind(this);}}},appendTo:function(node){this.el.appendTo(node);return this;},remove:function(){this.el.remove();return this;}});acx.ux.DragDrop=acx.ux.Observable.extend({defaults:{targetsSelector:null,pickupSelector:null,dragObj:null,draggingClass:"dragging"},init:function(options){this._super();this.drag_handler=this.drag.bind(this);this.drop_handler=this.drop.bind(this);this.pickup_handler=this.pickup.bind(this);this.targets=[];this.dragObj=null;this.dragObjOffset=null;this.currentTarget=null;if(this.config.pickupSelector){$(this.config.pickupSelector).bind("mousedown",this.pickup_handler);}},drag:function(jEv){jEv.preventDefault();var mloc=acx.vector(jEv.pageX,jEv.pageY);this.dragObj.css(mloc.add(this.dragObjOffset).asOffset());if(this.targets.length===0){return ;}if(this.currentTarget!==null&&mloc.within(this.currentTarget[1],this.currentTarget[2])){return ;}if(this.currentTarget!==null){this.fire("dragOut",this.currentTarget[0]);this.currentTarget=null;}for(var i=0;i<this.targets.length;i++){if(mloc.within(this.targets[i][1],this.targets[i][2])){this.currentTarget=this.targets[i];break;}}if(this.currentTarget!==null){this.fire("dragOver",this.currentTarget[0]);}},drop:function(jEv){$(document).unbind("mousemove",this.drag_handler);$(document).unbind("mouseup",this.drop_handler);this.dragObj.removeClass(this.config.draggingClass);if(this.currentTarget!==null){this.fire("dragOut",this.currentTarget[0]);this.fire("dragDrop",this.currentTarget[0]);}this.fire("dragStop",jEv);this.dragObj=null;},pickup:function(jEv,opts){acx.extend(this.config,opts);this.fire("dragStart",jEv);this.dragObj=this.dragObj||this.config.dragObj;this.dragObjOffset=this.config.dragObjOffset||acx.vector(this.dragObj.offset()).sub(jEv.pageX,jEv.pageY);this.dragObj.addClass(this.config.draggingClass);if(!this.dragObj.get(0).parentNode||this.dragObj.get(0).parentNode.nodeType===11){$(document.body).append(this.dragObj);}if(this.config.targetsSelector){this.currentTarget=null;var targets=(this.targets=[]);$(this.config.targetsSelector).each(function(i,el){var jEl=$(el);var tl=acx.vector(jEl.offset());var br=tl.add(jEl.width(),jEl.height());targets.push([jEl,tl,br]);});}$(document).bind("mousemove",this.drag_handler);$(document).bind("mouseup",this.drop_handler);this.drag_handler(jEv);}});acx.text=acx.i18n.formatKey;acx.helpers={};acx.data={};})();