Ext.namespace("Das","Das.Cookie","Das.Plugins");Das.Cookie=function(){return{set:function(name,value,expires,path,domain,secure){today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24;}expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+((expires)?";expires="+expires_date.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");},get:function(check_name){var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++){a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name){b_cookie_found=true;if(a_temp_cookie.length>1){cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}return cookie_value;break;}a_temp_cookie=null;cookie_name='';}if(!b_cookie_found){return null;}},del:function(name,path,domain){if(Das.Cookie.get(name))document.cookie=name+"="+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}}}();isAdmin=Boolean(parseInt(Das.Cookie.get('DASADMIN')));isBetaUser=Boolean(parseInt(Das.Cookie.get('DASBETA')));if(isBetaUser){pathto="lib/beta"+version+"/";}else{pathto="lib/app"+version+"/";}syspath="lib/system/";Ext.apply(this,{userIsAdmin:isAdmin,userIsBeta:isBetaUser});ua=navigator.userAgent.toLowerCase();isCamino=ua.indexOf('camino')>-1;isIPhone=ua.indexOf('iphone')>-1;isIE8=!Ext.isOpera&&ua.indexOf("msie 8")>-1;Ext.apply(Ext,{isCamino:isCamino,isIPhone:isIPhone,isIE8:isIE8});function dateToWord(date){try{var today=new Date().format('z');var dt=new Date(ToDate(date)).format('z');var days=today-dt;if(days<7){switch(days){case 0:return'today';break;case 1:return'yesterday';break;default:return days+' days ago';break;}}else{return new Date(ToDate(date)).format('D m/d/Y')+' - '+days+' days ago';}}catch(e){};};function ToDate(v,record){try{d=v.split("-");rt=d.join('/');dt=new Date(rt);format=(this.dateFormat)?this.dateFormat:'m/d/Y';return dt.format(format);}catch(e){};};Ext.applyIf(Array.prototype,{filter:function(fun){var len=this.length;if(typeof fun!="function"){throw new TypeError();}var res=new Array();var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this){var val=this[i];if(fun.call(thisp,val,i,this)){res.push(val);}}}return res;},find:function(searchStr){var returnArray=false;for(i=0;i<this.length;i++){if(typeof(searchStr)=='function'){if(searchStr.test(this[i])){if(!returnArray){returnArray=[];}returnArray.push(i);}}else{if(this[i]===searchStr){if(!returnArray){returnArray=[];}returnArray.push(i);}}}return returnArray;}});Ext.lib.Ajax.isCrossDomain=function(u){var match=/(?:(\w*:)\/\/)?([\w\.]*(?::\d*)?)/.exec(u);if(!match[1])return false;return(match[1]!=location.protocol)||(match[2]!=location.host);};Ext.override(Ext.data.Connection,{request:function(o){if(this.fireEvent("beforerequest",this,o)!==false){var p=o.params;if(typeof p=="function"){p=p.call(o.scope||window,o);}if(typeof p=="object"){p=Ext.urlEncode(p);}if(this.extraParams){var extras=Ext.urlEncode(this.extraParams);p=p?(p+'&'+extras):extras;}var url=o.url||this.url;if(typeof url=='function'){url=url.call(o.scope||window,o);}if(o.form){var form=Ext.getDom(o.form);url=url||form.action;var enctype=form.getAttribute("enctype");if(o.isUpload||(enctype&&enctype.toLowerCase()=='multipart/form-data')){return this.doFormUpload(o,p,url);}var f=Ext.lib.Ajax.serializeForm(form);p=p?(p+'&'+f):f;}var hs=o.headers;if(this.defaultHeaders){hs=Ext.apply(hs||{},this.defaultHeaders);if(!o.headers){o.headers=hs;}}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:this.timeout};var method=o.method||this.method||(p?"POST":"GET");if(method=='GET'&&(this.disableCaching&&o.disableCaching!==false)||o.disableCaching===true){url+=(url.indexOf('?')!=-1?'&':'?')+'_dc='+(new Date().getTime());}if(typeof o.autoAbort=='boolean'){if(o.autoAbort){this.abort();}}else if(this.autoAbort!==false){this.abort();}if((method=='GET'&&p)||o.xmlData||o.jsonData){url+=(url.indexOf('?')!=-1?'&':'?')+p;p='';}if(o.scriptTag||this.scriptTag||Ext.lib.Ajax.isCrossDomain(url)){this.transId=this.scriptRequest(method,url,cb,p,o);}else{this.transId=Ext.lib.Ajax.request(method,url,cb,p,o);}return this.transId;}else{Ext.callback(o.callback,o.scope,[o,null,null]);return null;}},scriptRequest:function(method,url,cb,data,options){var transId=++Ext.data.ScriptTagProxy.TRANS_ID;var trans={id:transId,cb:options.callbackName||"stcCallback"+transId,scriptId:"stcScript"+transId,options:options};url+=(url.indexOf("?")!=-1?"&":"?")+data+String.format("&{0}={1}",options.callbackParam||this.callbackParam||'callback',trans.cb);var conn=this;window[trans.cb]=function(o){conn.handleScriptResponse(o,trans);};trans.timeoutId=this.handleScriptFailure.defer(cb.timeout,this,[trans]);var script=document.createElement("script");script.setAttribute("src",url);script.setAttribute("type","text/javascript");script.setAttribute("id",trans.scriptId);document.getElementsByTagName("head")[0].appendChild(script);return trans;},handleScriptResponse:function(o,trans){this.transId=false;this.destroyScriptTrans(trans,true);var options=trans.options;var doc;if(typeof o=='string'){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(o);}else{doc=new DOMParser().parseFromString(o,"text/xml");}}response={responseObject:o,responseText:(typeof o=="object")?Ext.util.JSON.encode(o):String(o),responseXML:doc,argument:options.argument};this.fireEvent("requestcomplete",this,response,options);Ext.callback(options.success,options.scope,[response,options]);Ext.callback(options.callback,options.scope,[options,true,response]);},handleScriptFailure:function(trans){this.transId=false;this.destroyScriptTrans(trans,false);var options=trans.options;response={argument:options.argument,status:500,statusText:'Server failed to respond',responseText:''};this.fireEvent("requestexception",this,response,options,{status:-1,statusText:'communication failure'});Ext.callback(options.failure,options.scope,[response,options]);Ext.callback(options.callback,options.scope,[options,false,response]);},destroyScriptTrans:function(trans,isLoaded){document.getElementsByTagName("head")[0].removeChild(document.getElementById(trans.scriptId));clearTimeout(trans.timeoutId);if(isLoaded){window[trans.cb]=undefined;try{delete window[trans.cb];}catch(e){}}else{window[trans.cb]=function(){window[trans.cb]=undefined;try{delete window[trans.cb];}catch(e){}};}}});Ext.override(Ext.grid.GridView,{layout:function(){if(!this.mainBody){return;}var g=this.grid;var c=g.getGridEl();var csize=c.getSize(true);var vw=csize.width;if(vw<20||csize.height<20){return;}if(g.autoHeight){this.scroller.dom.style.overflow='visible';this.scroller.dom.style.position='static';}else{this.el.setSize(csize.width,csize.height);var hdHeight=this.mainHd.getHeight();var vh=csize.height-(hdHeight);this.scroller.setSize(vw,vh);if(this.innerHd){this.innerHd.style.width=(vw)+'px';}}if(this.forceFit){if(this.lastViewWidth!=vw){this.fitColumns(false,false);this.lastViewWidth=vw;}}else{this.autoExpand();this.syncHeaderScroll();}this.onLayout(vw,vh);}});Ext.override(Ext.form.Checkbox,{onRender:function(ct,position){Ext.form.Checkbox.superclass.onRender.call(this,ct,position);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.innerWrap=this.el.wrap({cls:this.baseCls+'-wrap-inner'});this.wrap=this.innerWrap.wrap({cls:this.baseCls+'-wrap'});this.imageEl=this.innerWrap.createChild({tag:'img',src:Ext.BLANK_IMAGE_URL,cls:this.baseCls});if(this.boxLabel){this.labelEl=this.innerWrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}if(this.checked){this.setValue(true);}else{this.checked=this.el.dom.checked;}this.originalValue=this.checked;},afterRender:function(){Ext.form.Checkbox.superclass.afterRender.call(this);this.imageEl[this.checked?'addClass':'removeClass'](this.checkedCls);},initCheckEvents:function(){this.innerWrap.addClassOnOver(this.overCls);this.innerWrap.addClassOnClick(this.mouseDownCls);this.innerWrap.on('click',this.onClick,this);},onFocus:function(e){Ext.form.Checkbox.superclass.onFocus.call(this,e);this.innerWrap.addClass(this.focusCls);},onBlur:function(e){Ext.form.Checkbox.superclass.onBlur.call(this,e);this.innerWrap.removeClass(this.focusCls);},onClick:function(e){if(e.getTarget().htmlFor!=this.el.dom.id){if(e.getTarget()!==this.el.dom){this.el.focus();}if(!this.disabled&&!this.readOnly){this.toggleValue();}}},onEnable:Ext.form.Checkbox.superclass.onEnable,onDisable:Ext.form.Checkbox.superclass.onDisable,onKeyUp:undefined,setValue:function(v){var checked=this.checked;this.checked=(v===true||v==='true'||v=='1'||String(v).toLowerCase()=='on');if(this.rendered){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked;this.imageEl[this.checked?'addClass':'removeClass'](this.checkedCls);}if(checked!=this.checked){this.fireEvent("check",this,this.checked);if(this.handler){this.handler.call(this.scope||this,this,this.checked);}}},getResizeEl:function(){return this.wrap;}});Ext.override(Ext.form.Radio,{checkedCls:'x-form-radio-checked'});Ext.override(Ext.grid.GridView,{getColumnWidth:function(col){var w=this.cm.getColumnWidth(col);if(typeof w=='number'){return(Ext.isBorderBox||Ext.isSafari3||Ext.isChrome?w:(w-this.borderWidth>0?w-this.borderWidth:0))+'px';}return w;}});