
(function(window,undefined){var document=window.document,navigator=window.navigator,location=window.location;var jQuery=(function(){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery);},_jQuery=window.jQuery,_$=window.$,rootjQuery,quickExpr=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,rnotwhite=/\S/,trimLeft=/^\s+/,trimRight=/\s+$/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,rvalidchars=/^[\],:{}\s]*$/,rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rwebkit=/(webkit)[ \/]([\w.]+)/,ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/,rmsie=/(msie) ([\w.]+)/,rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/,rdashAlpha=/-([a-z]|[0-9])/ig,rmsPrefix=/^-ms-/,fcamelCase=function(all,letter){return(letter+"").toUpperCase();},userAgent=navigator.userAgent,browserMatch,readyList,DOMContentLoaded,toString=Object.prototype.toString,hasOwn=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,trim=String.prototype.trim,indexOf=Array.prototype.indexOf,class2type={};jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem,ret,doc;if(!selector){return this;}
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}
if(selector==="body"&&!context&&document.body){this.context=document;this[0]=document.body;this.selector=selector;this.length=1;return this;}
if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null];}else{match=quickExpr.exec(selector);}
if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true);}else{selector=[doc.createElement(ret[1])];}}else{ret=jQuery.buildFragment([match[1]],[doc]);selector=(ret.cacheable?jQuery.clone(ret.fragment):ret.fragment).childNodes;}
return jQuery.merge(this,selector);}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return this.constructor(context).find(selector);}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length;},toArray:function(){return slice.call(this,0);},get:function(num){return num==null?this.toArray():(num<0?this[this.length+num]:this[num]);},pushStack:function(elems,name,selector){var ret=this.constructor();if(jQuery.isArray(elems)){push.apply(ret,elems);}else{jQuery.merge(ret,elems);}
ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector;}else if(name){ret.selector=this.selector+"."+name+"("+selector+")";}
return ret;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.bindReady();readyList.add(fn);return this;},eq:function(i){i=+i;return i===-1?this.slice(i):this.slice(i,i+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||this.constructor(null);},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[];}else{clone=src&&jQuery.isPlainObject(src)?src:{};}
target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({noConflict:function(deep){if(window.$===jQuery){window.$=_$;}
if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}
return jQuery;},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}},ready:function(wait){if((wait===true&&!--jQuery.readyWait)||(wait!==true&&!jQuery.isReady)){if(!document.body){return setTimeout(jQuery.ready,1);}
jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return;}
readyList.fireWith(document,[jQuery]);if(jQuery.fn.trigger){jQuery(document).trigger("ready").off("ready");}}},bindReady:function(){if(readyList){return;}
readyList=jQuery.Callbacks("once memory");if(document.readyState==="complete"){return setTimeout(jQuery.ready,1);}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null;}catch(e){}
if(document.documentElement.doScroll&&toplevel){doScrollCheck();}}},isFunction:function(obj){return jQuery.type(obj)==="function";},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array";},isWindow:function(obj){return obj&&typeof obj==="object"&&"setInterval"in obj;},isNumeric:function(obj){return!isNaN(parseFloat(obj))&&isFinite(obj);},type:function(obj){return obj==null?String(obj):class2type[toString.call(obj)]||"object";},isPlainObject:function(obj){if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false;}
try{if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false;}}catch(e){return false;}
var key;for(key in obj){}
return key===undefined||hasOwn.call(obj,key);},isEmptyObject:function(obj){for(var name in obj){return false;}
return true;},error:function(msg){throw new Error(msg);},parseJSON:function(data){if(typeof data!=="string"||!data){return null;}
data=jQuery.trim(data);if(window.JSON&&window.JSON.parse){return window.JSON.parse(data);}
if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return(new Function("return "+data))();}
jQuery.error("Invalid JSON: "+data);},parseXML:function(data){var xml,tmp;try{if(window.DOMParser){tmp=new DOMParser();xml=tmp.parseFromString(data,"text/xml");}else{xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data);}}catch(e){xml=undefined;}
if(!xml||!xml.documentElement||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data);}
return xml;},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){(window.execScript||function(data){window["eval"].call(window,data);})(data);}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase);},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break;}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break;}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break;}}}else{for(;i<length;){if(callback.call(object[i],i,object[i++])===false){break;}}}}
return object;},trim:trim?function(text){return text==null?"":trim.call(text);}:function(text){return text==null?"":text.toString().replace(trimLeft,"").replace(trimRight,"");},makeArray:function(array,results){var ret=results||[];if(array!=null){var type=jQuery.type(array);if(array.length==null||type==="string"||type==="function"||type==="regexp"||jQuery.isWindow(array)){push.call(ret,array);}else{jQuery.merge(ret,array);}}
return ret;},inArray:function(elem,array,i){var len;if(array){if(indexOf){return indexOf.call(array,elem,i);}
len=array.length;i=i?i<0?Math.max(0,len+i):i:0;for(;i<len;i++){if(i in array&&array[i]===elem){return i;}}}
return-1;},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var ret=[],retVal;inv=!!inv;for(var i=0,length=elems.length;i<length;i++){retVal=!!callback(elems[i],i);if(inv!==retVal){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var value,key,ret=[],i=0,length=elems.length,isArray=elems instanceof jQuery||length!==undefined&&typeof length==="number"&&((length>0&&elems[0]&&elems[length-1])||length===0||jQuery.isArray(elems));if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}}else{for(key in elems){value=callback(elems[key],key,arg);if(value!=null){ret[ret.length]=value;}}}
return ret.concat.apply([],ret);},guid:1,proxy:function(fn,context){if(typeof context==="string"){var tmp=fn[context];context=fn;fn=tmp;}
if(!jQuery.isFunction(fn)){return undefined;}
var args=slice.call(arguments,2),proxy=function(){return fn.apply(context,args.concat(slice.call(arguments)));};proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;return proxy;},access:function(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){jQuery.access(elems,k,key[k],exec,fn,value);}
return elems;}
if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass);}
return elems;}
return length?fn(elems[0],key):undefined;},now:function(){return(new Date()).getTime();},uaMatch:function(ua){ua=ua.toLowerCase();var match=rwebkit.exec(ua)||ropera.exec(ua)||rmsie.exec(ua)||ua.indexOf("compatible")<0&&rmozilla.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};},sub:function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context);}
jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context);}
return jQuery.fn.init.call(this,selector,context,rootjQuerySub);};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);return jQuerySub;},browser:{}});jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase();});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version;}
if(jQuery.browser.webkit){jQuery.browser.safari=true;}
if(rnotwhite.test("\xA0")){trimLeft=/^[\s\xA0]+/;trimRight=/[\s\xA0]+$/;}
rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready();};}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready();}};}
function doScrollCheck(){if(jQuery.isReady){return;}
try{document.documentElement.doScroll("left");}catch(e){setTimeout(doScrollCheck,1);return;}
jQuery.ready();}
return jQuery;})();var flagsCache={};function createFlags(flags){var object=flagsCache[flags]={},i,length;flags=flags.split(/\s+/);for(i=0,length=flags.length;i<length;i++){object[flags[i]]=true;}
return object;}
jQuery.Callbacks=function(flags){flags=flags?(flagsCache[flags]||createFlags(flags)):{};var
list=[],stack=[],memory,firing,firingStart,firingLength,firingIndex,add=function(args){var i,length,elem,type,actual;for(i=0,length=args.length;i<length;i++){elem=args[i];type=jQuery.type(elem);if(type==="array"){add(elem);}else if(type==="function"){if(!flags.unique||!self.has(elem)){list.push(elem);}}}},fire=function(context,args){args=args||[];memory=!flags.memory||[context,args];firing=true;firingIndex=firingStart||0;firingStart=0;firingLength=list.length;for(;list&&firingIndex<firingLength;firingIndex++){if(list[firingIndex].apply(context,args)===false&&flags.stopOnFalse){memory=true;break;}}
firing=false;if(list){if(!flags.once){if(stack&&stack.length){memory=stack.shift();self.fireWith(memory[0],memory[1]);}}else if(memory===true){self.disable();}else{list=[];}}},self={add:function(){if(list){var length=list.length;add(arguments);if(firing){firingLength=list.length;}else if(memory&&memory!==true){firingStart=length;fire(memory[0],memory[1]);}}
return this;},remove:function(){if(list){var args=arguments,argIndex=0,argLength=args.length;for(;argIndex<argLength;argIndex++){for(var i=0;i<list.length;i++){if(args[argIndex]===list[i]){if(firing){if(i<=firingLength){firingLength--;if(i<=firingIndex){firingIndex--;}}}
list.splice(i--,1);if(flags.unique){break;}}}}}
return this;},has:function(fn){if(list){var i=0,length=list.length;for(;i<length;i++){if(fn===list[i]){return true;}}}
return false;},empty:function(){list=[];return this;},disable:function(){list=stack=memory=undefined;return this;},disabled:function(){return!list;},lock:function(){stack=undefined;if(!memory||memory===true){self.disable();}
return this;},locked:function(){return!stack;},fireWith:function(context,args){if(stack){if(firing){if(!flags.once){stack.push([context,args]);}}else if(!(flags.once&&memory)){fire(context,args);}}
return this;},fire:function(){self.fireWith(this,arguments);return this;},fired:function(){return!!memory;}};return self;};var
sliceDeferred=[].slice;jQuery.extend({Deferred:function(func){var doneList=jQuery.Callbacks("once memory"),failList=jQuery.Callbacks("once memory"),progressList=jQuery.Callbacks("memory"),state="pending",lists={resolve:doneList,reject:failList,notify:progressList},promise={done:doneList.add,fail:failList.add,progress:progressList.add,state:function(){return state;},isResolved:doneList.fired,isRejected:failList.fired,then:function(doneCallbacks,failCallbacks,progressCallbacks){deferred.done(doneCallbacks).fail(failCallbacks).progress(progressCallbacks);return this;},always:function(){deferred.done.apply(deferred,arguments).fail.apply(deferred,arguments);return this;},pipe:function(fnDone,fnFail,fnProgress){return jQuery.Deferred(function(newDefer){jQuery.each({done:[fnDone,"resolve"],fail:[fnFail,"reject"],progress:[fnProgress,"notify"]},function(handler,data){var fn=data[0],action=data[1],returned;if(jQuery.isFunction(fn)){deferred[handler](function(){returned=fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().then(newDefer.resolve,newDefer.reject,newDefer.notify);}else{newDefer[action+"With"](this===deferred?newDefer:this,[returned]);}});}else{deferred[handler](newDefer[action]);}});}).promise();},promise:function(obj){if(obj==null){obj=promise;}else{for(var key in promise){obj[key]=promise[key];}}
return obj;}},deferred=promise.promise({}),key;for(key in lists){deferred[key]=lists[key].fire;deferred[key+"With"]=lists[key].fireWith;}
deferred.done(function(){state="resolved";},failList.disable,progressList.lock).fail(function(){state="rejected";},doneList.disable,progressList.lock);if(func){func.call(deferred,deferred);}
return deferred;},when:function(firstParam){var args=sliceDeferred.call(arguments,0),i=0,length=args.length,pValues=new Array(length),count=length,pCount=length,deferred=length<=1&&firstParam&&jQuery.isFunction(firstParam.promise)?firstParam:jQuery.Deferred(),promise=deferred.promise();function resolveFunc(i){return function(value){args[i]=arguments.length>1?sliceDeferred.call(arguments,0):value;if(!(--count)){deferred.resolveWith(deferred,args);}};}
function progressFunc(i){return function(value){pValues[i]=arguments.length>1?sliceDeferred.call(arguments,0):value;deferred.notifyWith(promise,pValues);};}
if(length>1){for(;i<length;i++){if(args[i]&&args[i].promise&&jQuery.isFunction(args[i].promise)){args[i].promise().then(resolveFunc(i),deferred.reject,progressFunc(i));}else{--count;}}
if(!count){deferred.resolveWith(deferred,args);}}else if(deferred!==firstParam){deferred.resolveWith(deferred,length?[firstParam]:[]);}
return promise;}});jQuery.support=(function(){var support,all,a,select,opt,input,marginDiv,fragment,tds,events,eventName,i,isSupported,div=document.createElement("div"),documentElement=document.documentElement;div.setAttribute("className","t");div.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return{};}
select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];support={leadingWhitespace:(div.firstChild.nodeType===3),tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:(a.getAttribute("href")==="/a"),opacity:/^0.55/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:(input.value==="on"),optSelected:opt.selected,getSetAttribute:div.className!=="t",enctype:!!document.createElement("form").enctype,html5Clone:document.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;select.disabled=true;support.optDisabled=!opt.disabled;try{delete div.test;}catch(e){support.deleteExpando=false;}
if(!div.addEventListener&&div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){support.noCloneEvent=false;});div.cloneNode(true).fireEvent("onclick");}
input=document.createElement("input");input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","checked");div.appendChild(input);fragment=document.createDocumentFragment();fragment.appendChild(div.lastChild);support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;support.appendChecked=input.checked;fragment.removeChild(input);fragment.appendChild(div);div.innerHTML="";if(window.getComputedStyle){marginDiv=document.createElement("div");marginDiv.style.width="0";marginDiv.style.marginRight="0";div.style.width="2px";div.appendChild(marginDiv);support.reliableMarginRight=(parseInt((window.getComputedStyle(marginDiv,null)||{marginRight:0}).marginRight,10)||0)===0;}
if(div.attachEvent){for(i in{submit:1,change:1,focusin:1}){eventName="on"+i;isSupported=(eventName in div);if(!isSupported){div.setAttribute(eventName,"return;");isSupported=(typeof div[eventName]==="function");}
support[i+"Bubbles"]=isSupported;}}
fragment.removeChild(div);fragment=select=opt=marginDiv=div=input=null;jQuery(function(){var container,outer,inner,table,td,offsetSupport,conMarginTop,ptlm,vb,style,html,body=document.getElementsByTagName("body")[0];if(!body){return;}
conMarginTop=1;ptlm="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";vb="visibility:hidden;border:0;";style="style='"+ptlm+"border:5px solid #000;padding:0;'";html="<div "+style+"><div></div></div>"+"<table "+style+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>";container=document.createElement("div");container.style.cssText=vb+"width:0;height:0;position:static;top:0;margin-top:"+conMarginTop+"px";body.insertBefore(container,body.firstChild);div=document.createElement("div");container.appendChild(div);div.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";tds=div.getElementsByTagName("td");isSupported=(tds[0].offsetHeight===0);tds[0].style.display="";tds[1].style.display="none";support.reliableHiddenOffsets=isSupported&&(tds[0].offsetHeight===0);div.innerHTML="";div.style.width=div.style.paddingLeft="1px";jQuery.boxModel=support.boxModel=div.offsetWidth===2;if(typeof div.style.zoom!=="undefined"){div.style.display="inline";div.style.zoom=1;support.inlineBlockNeedsLayout=(div.offsetWidth===2);div.style.display="";div.innerHTML="<div style='width:4px;'></div>";support.shrinkWrapBlocks=(div.offsetWidth!==2);}
div.style.cssText=ptlm+vb;div.innerHTML=html;outer=div.firstChild;inner=outer.firstChild;td=outer.nextSibling.firstChild.firstChild;offsetSupport={doesNotAddBorder:(inner.offsetTop!==5),doesAddBorderForTableAndCells:(td.offsetTop===5)};inner.style.position="fixed";inner.style.top="20px";offsetSupport.fixedPosition=(inner.offsetTop===20||inner.offsetTop===15);inner.style.position=inner.style.top="";outer.style.overflow="hidden";outer.style.position="relative";offsetSupport.subtractsBorderForOverflowNotVisible=(inner.offsetTop===-5);offsetSupport.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==conMarginTop);body.removeChild(container);div=container=null;jQuery.extend(support,offsetSupport);});return support;})();var rbrace=/^(?:\{.*\}|\[.*\])$/,rmultiDash=/([A-Z])/g;jQuery.extend({cache:{},uuid:0,expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),noData:{"embed":true,"object":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000","applet":true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem);},data:function(elem,name,data,pvt){if(!jQuery.acceptData(elem)){return;}
var privateCache,thisCache,ret,internalKey=jQuery.expando,getByName=typeof name==="string",isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[internalKey]:elem[internalKey]&&internalKey,isEvents=name==="events";if((!id||!cache[id]||(!isEvents&&!pvt&&!cache[id].data))&&getByName&&data===undefined){return;}
if(!id){if(isNode){elem[internalKey]=id=++jQuery.uuid;}else{id=internalKey;}}
if(!cache[id]){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop;}}
if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id]=jQuery.extend(cache[id],name);}else{cache[id].data=jQuery.extend(cache[id].data,name);}}
privateCache=thisCache=cache[id];if(!pvt){if(!thisCache.data){thisCache.data={};}
thisCache=thisCache.data;}
if(data!==undefined){thisCache[jQuery.camelCase(name)]=data;}
if(isEvents&&!thisCache[name]){return privateCache.events;}
if(getByName){ret=thisCache[name];if(ret==null){ret=thisCache[jQuery.camelCase(name)];}}else{ret=thisCache;}
return ret;},removeData:function(elem,name,pvt){if(!jQuery.acceptData(elem)){return;}
var thisCache,i,l,internalKey=jQuery.expando,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[internalKey]:internalKey;if(!cache[id]){return;}
if(name){thisCache=pvt?cache[id]:cache[id].data;if(thisCache){if(!jQuery.isArray(name)){if(name in thisCache){name=[name];}else{name=jQuery.camelCase(name);if(name in thisCache){name=[name];}else{name=name.split(" ");}}}
for(i=0,l=name.length;i<l;i++){delete thisCache[name[i]];}
if(!(pvt?isEmptyDataObject:jQuery.isEmptyObject)(thisCache)){return;}}}
if(!pvt){delete cache[id].data;if(!isEmptyDataObject(cache[id])){return;}}
if(jQuery.support.deleteExpando||!cache.setInterval){delete cache[id];}else{cache[id]=null;}
if(isNode){if(jQuery.support.deleteExpando){delete elem[internalKey];}else if(elem.removeAttribute){elem.removeAttribute(internalKey);}else{elem[internalKey]=null;}}},_data:function(elem,name,data){return jQuery.data(elem,name,data,true);},acceptData:function(elem){if(elem.nodeName){var match=jQuery.noData[elem.nodeName.toLowerCase()];if(match){return!(match===true||elem.getAttribute("classid")!==match);}}
return true;}});jQuery.fn.extend({data:function(key,value){var parts,attr,name,data=null;if(typeof key==="undefined"){if(this.length){data=jQuery.data(this[0]);if(this[0].nodeType===1&&!jQuery._data(this[0],"parsedAttrs")){attr=this[0].attributes;for(var i=0,l=attr.length;i<l;i++){name=attr[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.substring(5));dataAttr(this[0],name,data[name]);}}
jQuery._data(this[0],"parsedAttrs",true);}}
return data;}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);data=dataAttr(this[0],key,data);}
return data===undefined&&parts[1]?this.data(parts[0]):data;}else{return this.each(function(){var self=jQuery(this),args=[parts[0],value];self.triggerHandler("setData"+parts[1]+"!",args);jQuery.data(this,key,value);self.triggerHandler("changeData"+parts[1]+"!",args);});}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});function dataAttr(elem,key,data){if(data===undefined&&elem.nodeType===1){var name="data-"+key.replace(rmultiDash,"-$1").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:jQuery.isNumeric(data)?parseFloat(data):rbrace.test(data)?jQuery.parseJSON(data):data;}catch(e){}
jQuery.data(elem,key,data);}else{data=undefined;}}
return data;}
function isEmptyDataObject(obj){for(var name in obj){if(name==="data"&&jQuery.isEmptyObject(obj[name])){continue;}
if(name!=="toJSON"){return false;}}
return true;}
function handleQueueMarkDefer(elem,type,src){var deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",defer=jQuery._data(elem,deferDataKey);if(defer&&(src==="queue"||!jQuery._data(elem,queueDataKey))&&(src==="mark"||!jQuery._data(elem,markDataKey))){setTimeout(function(){if(!jQuery._data(elem,queueDataKey)&&!jQuery._data(elem,markDataKey)){jQuery.removeData(elem,deferDataKey,true);defer.fire();}},0);}}
jQuery.extend({_mark:function(elem,type){if(elem){type=(type||"fx")+"mark";jQuery._data(elem,type,(jQuery._data(elem,type)||0)+1);}},_unmark:function(force,elem,type){if(force!==true){type=elem;elem=force;force=false;}
if(elem){type=type||"fx";var key=type+"mark",count=force?0:((jQuery._data(elem,key)||1)-1);if(count){jQuery._data(elem,key,count);}else{jQuery.removeData(elem,key,true);handleQueueMarkDefer(elem,type,"mark");}}},queue:function(elem,type,data){var q;if(elem){type=(type||"fx")+"queue";q=jQuery._data(elem,type);if(data){if(!q||jQuery.isArray(data)){q=jQuery._data(elem,type,jQuery.makeArray(data));}else{q.push(data);}}
return q||[];}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift(),hooks={};if(fn==="inprogress"){fn=queue.shift();}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
jQuery._data(elem,type+".run",hooks);fn.call(elem,function(){jQuery.dequeue(elem,type);},hooks);}
if(!queue.length){jQuery.removeData(elem,type+"queue "+type+".run",true);handleQueueMarkDefer(elem,type,"queue");}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined){return jQuery.queue(this[0],type);}
return this.each(function(){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=setTimeout(next,time);hooks.stop=function(){clearTimeout(timeout);};});},clearQueue:function(type){return this.queue(type||"fx",[]);},promise:function(type,object){if(typeof type!=="string"){object=type;type=undefined;}
type=type||"fx";var defer=jQuery.Deferred(),elements=this,i=elements.length,count=1,deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",tmp;function resolve(){if(!(--count)){defer.resolveWith(elements,[elements]);}}
while(i--){if((tmp=jQuery.data(elements[i],deferDataKey,undefined,true)||(jQuery.data(elements[i],queueDataKey,undefined,true)||jQuery.data(elements[i],markDataKey,undefined,true))&&jQuery.data(elements[i],deferDataKey,jQuery.Callbacks("once memory"),true))){count++;tmp.add(resolve);}}
resolve();return defer.promise();}});var rclass=/[\n\t\r]/g,rspace=/\s+/,rreturn=/\r/g,rtype=/^(?:button|input)$/i,rfocusable=/^(?:button|input|object|select|textarea)$/i,rclickable=/^a(?:rea)?$/i,rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,getSetAttribute=jQuery.support.getSetAttribute,nodeHook,boolHook,fixSpecified;jQuery.fn.extend({attr:function(name,value){return jQuery.access(this,name,value,true,jQuery.attr);},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name);});},prop:function(name,value){return jQuery.access(this,name,value,true,jQuery.prop);},removeProp:function(name){name=jQuery.propFix[name]||name;return this.each(function(){try{this[name]=undefined;delete this[name];}catch(e){}});},addClass:function(value){var classNames,i,l,elem,setClass,c,cl;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,this.className));});}
if(value&&typeof value==="string"){classNames=value.split(rspace);for(i=0,l=this.length;i<l;i++){elem=this[i];if(elem.nodeType===1){if(!elem.className&&classNames.length===1){elem.className=value;}else{setClass=" "+elem.className+" ";for(c=0,cl=classNames.length;c<cl;c++){if(!~setClass.indexOf(" "+classNames[c]+" ")){setClass+=classNames[c]+" ";}}
elem.className=jQuery.trim(setClass);}}}}
return this;},removeClass:function(value){var classNames,i,l,elem,className,c,cl;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,this.className));});}
if((value&&typeof value==="string")||value===undefined){classNames=(value||"").split(rspace);for(i=0,l=this.length;i<l;i++){elem=this[i];if(elem.nodeType===1&&elem.className){if(value){className=(" "+elem.className+" ").replace(rclass," ");for(c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ");}
elem.className=jQuery.trim(className);}else{elem.className="";}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,this.className,stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery._data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery._data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ",i=0,l=this.length;for(;i<l;i++){if(this[i].nodeType===1&&(" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;},val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.nodeName.toLowerCase()]||jQuery.valHooks[elem.type];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret;}
ret=elem.value;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret;}
return;}
isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}else{val=value;}
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+"";});}
hooks=jQuery.valHooks[this.nodeName.toLowerCase()]||jQuery.valHooks[this.type];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val;}});}});jQuery.extend({valHooks:{option:{get:function(elem){var val=elem.attributes.value;return!val||val.specified?elem.value:elem.text;}},select:{get:function(elem){var value,i,max,option,index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null;}
i=one?index:0;max=one?index+1:options.length;for(;i<max;i++){option=options[i];if(option.selected&&(jQuery.support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
if(one&&!values.length&&options.length){return jQuery(options[index]).val();}
return values;},set:function(elem,value){var values=jQuery.makeArray(value);jQuery(elem).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){elem.selectedIndex=-1;}
return values;}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(elem,name,value,pass){var ret,hooks,notxml,nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return;}
if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value);}
if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value);}
notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(rboolean.test(name)?boolHook:nodeHook);}
if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return;}else if(hooks&&"set"in hooks&&notxml&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{elem.setAttribute(name,""+value);return value;}}else if(hooks&&"get"in hooks&&notxml&&(ret=hooks.get(elem,name))!==null){return ret;}else{ret=elem.getAttribute(name);return ret===null?undefined:ret;}},removeAttr:function(elem,value){var propName,attrNames,name,l,i=0;if(value&&elem.nodeType===1){attrNames=value.toLowerCase().split(rspace);l=attrNames.length;for(;i<l;i++){name=attrNames[i];if(name){propName=jQuery.propFix[name]||name;jQuery.attr(elem,name,"");elem.removeAttribute(getSetAttribute?name:propName);if(rboolean.test(name)&&propName in elem){elem[propName]=false;}}}}},attrHooks:{type:{set:function(elem,value){if(rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed");}else if(!jQuery.support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}
return value;}}},value:{get:function(elem,name){if(nodeHook&&jQuery.nodeName(elem,"button")){return nodeHook.get(elem,name);}
return name in elem?elem.value:null;},set:function(elem,value,name){if(nodeHook&&jQuery.nodeName(elem,"button")){return nodeHook.set(elem,value,name);}
elem.value=value;}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(elem,name,value){var ret,hooks,notxml,nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return;}
notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];}
if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{return(elem[name]=value);}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}else{return elem[name];}}},propHooks:{tabIndex:{get:function(elem){var attributeNode=elem.getAttributeNode("tabindex");return attributeNode&&attributeNode.specified?parseInt(attributeNode.value,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}}}});jQuery.attrHooks.tabindex=jQuery.propHooks.tabIndex;boolHook={get:function(elem,name){var attrNode,property=jQuery.prop(elem,name);return property===true||typeof property!=="boolean"&&(attrNode=elem.getAttributeNode(name))&&attrNode.nodeValue!==false?name.toLowerCase():undefined;},set:function(elem,value,name){var propName;if(value===false){jQuery.removeAttr(elem,name);}else{propName=jQuery.propFix[name]||name;if(propName in elem){elem[propName]=true;}
elem.setAttribute(name,name.toLowerCase());}
return name;}};if(!getSetAttribute){fixSpecified={name:true,id:true};nodeHook=jQuery.valHooks.button={get:function(elem,name){var ret;ret=elem.getAttributeNode(name);return ret&&(fixSpecified[name]?ret.nodeValue!=="":ret.specified)?ret.nodeValue:undefined;},set:function(elem,value,name){var ret=elem.getAttributeNode(name);if(!ret){ret=document.createAttribute(name);elem.setAttributeNode(ret);}
return(ret.nodeValue=value+"");}};jQuery.attrHooks.tabindex.set=nodeHook.set;jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{set:function(elem,value){if(value===""){elem.setAttribute(name,"auto");return value;}}});});jQuery.attrHooks.contenteditable={get:nodeHook.get,set:function(elem,value,name){if(value===""){value="false";}
nodeHook.set(elem,value,name);}};}
if(!jQuery.support.hrefNormalized){jQuery.each(["href","src","width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{get:function(elem){var ret=elem.getAttribute(name,2);return ret===null?undefined:ret;}});});}
if(!jQuery.support.style){jQuery.attrHooks.style={get:function(elem){return elem.style.cssText.toLowerCase()||undefined;},set:function(elem,value){return(elem.style.cssText=""+value);}};}
if(!jQuery.support.optSelected){jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}
return null;}});}
if(!jQuery.support.enctype){jQuery.propFix.enctype="encoding";}
if(!jQuery.support.checkOn){jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(elem){return elem.getAttribute("value")===null?"on":elem.value;}};});}
jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(elem,value){if(jQuery.isArray(value)){return(elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0);}}});});var rformElems=/^(?:textarea|input|select)$/i,rtypenamespace=/^([^\.]*)?(?:\.(.+))?$/,rhoverHack=/\bhover(\.\S+)?\b/,rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rquickIs=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,quickParse=function(selector){var quick=rquickIs.exec(selector);if(quick){quick[1]=(quick[1]||"").toLowerCase();quick[3]=quick[3]&&new RegExp("(?:^|\\s)"+quick[3]+"(?:\\s|$)");}
return quick;},quickIs=function(elem,m){var attrs=elem.attributes||{};return((!m[1]||elem.nodeName.toLowerCase()===m[1])&&(!m[2]||(attrs.id||{}).value===m[2])&&(!m[3]||m[3].test((attrs["class"]||{}).value)));},hoverHack=function(events){return jQuery.event.special.hover?events:events.replace(rhoverHack,"mouseenter$1 mouseleave$1");};jQuery.event={add:function(elem,types,handler,data,selector){var elemData,eventHandle,events,t,tns,type,namespaces,handleObj,handleObjIn,quick,handlers,special;if(elem.nodeType===3||elem.nodeType===8||!types||!handler||!(elemData=jQuery._data(elem))){return;}
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;}
if(!handler.guid){handler.guid=jQuery.guid++;}
events=elemData.events;if(!events){elemData.events=events={};}
eventHandle=elemData.handle;if(!eventHandle){elemData.handle=eventHandle=function(e){return typeof jQuery!=="undefined"&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.dispatch.apply(eventHandle.elem,arguments):undefined;};eventHandle.elem=elem;}
types=jQuery.trim(hoverHack(types)).split(" ");for(t=0;t<types.length;t++){tns=rtypenamespace.exec(types[t])||[];type=tns[1];namespaces=(tns[2]||"").split(".").sort();special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:tns[1],data:data,handler:handler,guid:handler.guid,selector:selector,quick:quickParse(selector),namespace:namespaces.join(".")},handleObjIn);handlers=events[type];if(!handlers){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
if(selector){handlers.splice(handlers.delegateCount++,0,handleObj);}else{handlers.push(handleObj);}
jQuery.event.global[type]=true;}
elem=null;},global:{},remove:function(elem,types,handler,selector,mappedTypes){var elemData=jQuery.hasData(elem)&&jQuery._data(elem),t,tns,type,origType,namespaces,origCount,j,events,special,handle,eventType,handleObj;if(!elemData||!(events=elemData.events)){return;}
types=jQuery.trim(hoverHack(types||"")).split(" ");for(t=0;t<types.length;t++){tns=rtypenamespace.exec(types[t])||[];type=origType=tns[1];namespaces=tns[2];if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true);}
continue;}
special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;eventType=events[type]||[];origCount=eventType.length;namespaces=namespaces?new RegExp("(^|\\.)"+namespaces.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(j=0;j<eventType.length;j++){handleObj=eventType[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!namespaces||namespaces.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){eventType.splice(j--,1);if(handleObj.selector){eventType.delegateCount--;}
if(special.remove){special.remove.call(elem,handleObj);}}}
if(eventType.length===0&&origCount!==eventType.length){if(!special.teardown||special.teardown.call(elem,namespaces)===false){jQuery.removeEvent(elem,type,elemData.handle);}
delete events[type];}}
if(jQuery.isEmptyObject(events)){handle=elemData.handle;if(handle){handle.elem=null;}
jQuery.removeData(elem,["events","handle"],true);}},customEvent:{"getData":true,"setData":true,"changeData":true},trigger:function(event,data,elem,onlyHandlers){if(elem&&(elem.nodeType===3||elem.nodeType===8)){return;}
var type=event.type||event,namespaces=[],cache,exclusive,i,cur,old,ontype,special,handle,eventPath,bubbleType;if(rfocusMorph.test(type+jQuery.event.triggered)){return;}
if(type.indexOf("!")>=0){type=type.slice(0,-1);exclusive=true;}
if(type.indexOf(".")>=0){namespaces=type.split(".");type=namespaces.shift();namespaces.sort();}
if((!elem||jQuery.event.customEvent[type])&&!jQuery.event.global[type]){return;}
event=typeof event==="object"?event[jQuery.expando]?event:new jQuery.Event(type,event):new jQuery.Event(type);event.type=type;event.isTrigger=true;event.exclusive=exclusive;event.namespace=namespaces.join(".");event.namespace_re=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;ontype=type.indexOf(":")<0?"on"+type:"";if(!elem){cache=jQuery.cache;for(i in cache){if(cache[i].events&&cache[i].events[type]){jQuery.event.trigger(event,data,cache[i].handle.elem,true);}}
return;}
event.result=undefined;if(!event.target){event.target=elem;}
data=data!=null?jQuery.makeArray(data):[];data.unshift(event);special=jQuery.event.special[type]||{};if(special.trigger&&special.trigger.apply(elem,data)===false){return;}
eventPath=[[elem,special.bindType||type]];if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;cur=rfocusMorph.test(bubbleType+type)?elem:elem.parentNode;old=null;for(;cur;cur=cur.parentNode){eventPath.push([cur,bubbleType]);old=cur;}
if(old&&old===elem.ownerDocument){eventPath.push([old.defaultView||old.parentWindow||window,bubbleType]);}}
for(i=0;i<eventPath.length&&!event.isPropagationStopped();i++){cur=eventPath[i][0];event.type=eventPath[i][1];handle=(jQuery._data(cur,"events")||{})[event.type]&&jQuery._data(cur,"handle");if(handle){handle.apply(cur,data);}
handle=ontype&&cur[ontype];if(handle&&jQuery.acceptData(cur)&&handle.apply(cur,data)===false){event.preventDefault();}}
event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(elem.ownerDocument,data)===false)&&!(type==="click"&&jQuery.nodeName(elem,"a"))&&jQuery.acceptData(elem)){if(ontype&&elem[type]&&((type!=="focus"&&type!=="blur")||event.target.offsetWidth!==0)&&!jQuery.isWindow(elem)){old=elem[ontype];if(old){elem[ontype]=null;}
jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(old){elem[ontype]=old;}}}}
return event.result;},dispatch:function(event){event=jQuery.event.fix(event||window.event);var handlers=((jQuery._data(this,"events")||{})[event.type]||[]),delegateCount=handlers.delegateCount,args=[].slice.call(arguments,0),run_all=!event.exclusive&&!event.namespace,handlerQueue=[],i,j,cur,jqcur,ret,selMatch,matched,matches,handleObj,sel,related;args[0]=event;event.delegateTarget=this;if(delegateCount&&!event.target.disabled&&!(event.button&&event.type==="click")){jqcur=jQuery(this);jqcur.context=this.ownerDocument||this;for(cur=event.target;cur!=this;cur=cur.parentNode||this){selMatch={};matches=[];jqcur[0]=cur;for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector;if(selMatch[sel]===undefined){selMatch[sel]=(handleObj.quick?quickIs(cur,handleObj.quick):jqcur.is(sel));}
if(selMatch[sel]){matches.push(handleObj);}}
if(matches.length){handlerQueue.push({elem:cur,matches:matches});}}}
if(handlers.length>delegateCount){handlerQueue.push({elem:this,matches:handlers.slice(delegateCount)});}
for(i=0;i<handlerQueue.length&&!event.isPropagationStopped();i++){matched=handlerQueue[i];event.currentTarget=matched.elem;for(j=0;j<matched.matches.length&&!event.isImmediatePropagationStopped();j++){handleObj=matched.matches[j];if(run_all||(!event.namespace&&!handleObj.namespace)||event.namespace_re&&event.namespace_re.test(handleObj.namespace)){event.data=handleObj.data;event.handleObj=handleObj;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}}}
return event.result;},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(event,original){if(event.which==null){event.which=original.charCode!=null?original.charCode:original.keyCode;}
return event;}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(event,original){var eventDoc,doc,body,button=original.button,fromElement=original.fromElement;if(event.pageX==null&&original.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=original.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=original.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.relatedTarget&&fromElement){event.relatedTarget=fromElement===event.target?original.toElement:fromElement;}
if(!event.which&&button!==undefined){event.which=(button&1?1:(button&2?3:(button&4?2:0)));}
return event;}},fix:function(event){if(event[jQuery.expando]){return event;}
var i,prop,originalEvent=event,fixHook=jQuery.event.fixHooks[event.type]||{},copy=fixHook.props?this.props.concat(fixHook.props):this.props;event=jQuery.Event(originalEvent);for(i=copy.length;i;){prop=copy[--i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=originalEvent.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
if(event.metaKey===undefined){event.metaKey=event.ctrlKey;}
return fixHook.filter?fixHook.filter(event,originalEvent):event;},special:{ready:{setup:jQuery.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(data,namespaces,eventHandle){if(jQuery.isWindow(this)){this.onbeforeunload=eventHandle;}},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null;}}}},simulate:function(type,elem,event,bubble){var e=jQuery.extend(new jQuery.Event(),event,{type:type,isSimulated:true,originalEvent:{}});if(bubble){jQuery.event.trigger(e,null,elem);}else{jQuery.event.dispatch.call(elem,e);}
if(e.isDefaultPrevented()){event.preventDefault();}}};jQuery.event.handle=jQuery.event.dispatch;jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false);}}:function(elem,type,handle){if(elem.detachEvent){elem.detachEvent("on"+type,handle);}};jQuery.Event=function(src,props){if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=(src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault())?returnTrue:returnFalse;}else{this.type=src;}
if(props){jQuery.extend(this,props);}
this.timeStamp=src&&src.timeStamp||jQuery.now();this[jQuery.expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var target=this,related=event.relatedTarget,handleObj=event.handleObj,selector=handleObj.selector,ret;if(!related||(related!==target&&!jQuery.contains(target,related))){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix;}
return ret;}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(){if(jQuery.nodeName(this,"form")){return false;}
jQuery.event.add(this,"click._submit keypress._submit",function(e){var elem=e.target,form=jQuery.nodeName(elem,"input")||jQuery.nodeName(elem,"button")?elem.form:undefined;if(form&&!form._submit_attached){jQuery.event.add(form,"submit._submit",function(event){if(this.parentNode&&!event.isTrigger){jQuery.event.simulate("submit",this.parentNode,event,true);}});form._submit_attached=true;}});},teardown:function(){if(jQuery.nodeName(this,"form")){return false;}
jQuery.event.remove(this,"._submit");}};}
if(!jQuery.support.changeBubbles){jQuery.event.special.change={setup:function(){if(rformElems.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){jQuery.event.add(this,"propertychange._change",function(event){if(event.originalEvent.propertyName==="checked"){this._just_changed=true;}});jQuery.event.add(this,"click._change",function(event){if(this._just_changed&&!event.isTrigger){this._just_changed=false;jQuery.event.simulate("change",this,event,true);}});}
return false;}
jQuery.event.add(this,"beforeactivate._change",function(e){var elem=e.target;if(rformElems.test(elem.nodeName)&&!elem._change_attached){jQuery.event.add(elem,"change._change",function(event){if(this.parentNode&&!event.isSimulated&&!event.isTrigger){jQuery.event.simulate("change",this.parentNode,event,true);}});elem._change_attached=true;}});},handle:function(event){var elem=event.target;if(this!==elem||event.isSimulated||event.isTrigger||(elem.type!=="radio"&&elem.type!=="checkbox")){return event.handleObj.handler.apply(this,arguments);}},teardown:function(){jQuery.event.remove(this,"._change");return rformElems.test(this.nodeName);}};}
if(!jQuery.support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var attaches=0,handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event),true);};jQuery.event.special[fix]={setup:function(){if(attaches++===0){document.addEventListener(orig,handler,true);}},teardown:function(){if(--attaches===0){document.removeEventListener(orig,handler,true);}}};});}
jQuery.fn.extend({on:function(types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=selector;selector=undefined;}
for(type in types){this.on(type,selector,data,types[type],one);}
return this;}
if(data==null&&fn==null){fn=selector;data=selector=undefined;}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined;}else{fn=data;data=selector;selector=undefined;}}
if(fn===false){fn=returnFalse;}else if(!fn){return this;}
if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments);};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++);}
return this.each(function(){jQuery.event.add(this,types,fn,data,selector);});},one:function(types,selector,data,fn){return this.on.call(this,types,selector,data,fn,1);},off:function(types,selector,fn){if(types&&types.preventDefault&&types.handleObj){var handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.type+"."+handleObj.namespace:handleObj.type,handleObj.selector,handleObj.handler);return this;}
if(typeof types==="object"){for(var type in types){this.off(type,selector,types[type]);}
return this;}
if(selector===false||typeof selector==="function"){fn=selector;selector=undefined;}
if(fn===false){fn=returnFalse;}
return this.each(function(){jQuery.event.remove(this,types,fn,selector);});},bind:function(types,data,fn){return this.on(types,null,data,fn);},unbind:function(types,fn){return this.off(types,null,fn);},live:function(types,data,fn){jQuery(this.context).on(types,this.selector,data,fn);return this;},die:function(types,fn){jQuery(this.context).off(types,this.selector||"**",fn);return this;},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn);},undelegate:function(selector,types,fn){return arguments.length==1?this.off(selector,"**"):this.off(types,selector,fn);},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){return jQuery.event.trigger(type,data,this[0],true);}},toggle:function(fn){var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){var lastToggle=(jQuery._data(this,"lastToggle"+fn.guid)||0)%i;jQuery._data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;};toggler.guid=guid;while(i<args.length){args[i++].guid=guid;}
return this.click(toggler);},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);}});jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error contextmenu").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){if(fn==null){fn=data;data=null;}
return arguments.length>0?this.on(name,null,data,fn):this.trigger(name);};if(jQuery.attrFn){jQuery.attrFn[name]=true;}
if(rkeyEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.keyHooks;}
if(rmouseEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.mouseHooks;}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,expando="sizcache"+(Math.random()+'').replace('.',''),done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true,rBackslash=/\\/g,rReturn=/\r\n/g,rNonWord=/\W/;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;var origContext=context;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var m,set,checkSet,extra,ret,cur,pop,i,prune=true,contextXML=Sizzle.isXML(context),parts=[],soFar=selector;do{chunker.exec("");m=chunker.exec(soFar);if(m){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}}while(m);if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context,seed);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift();}
set=posProcess(selector,set,seed);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){cur=parts.pop();pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){Sizzle.error(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&Sizzle.contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.matchesSelector=function(node,expr){return Sizzle(expr,null,null,[node]).length>0;};Sizzle.find=function(expr,context,isXML){var set,i,len,match,type,left;if(!expr){return[];}
for(i=0,len=Expr.order.length;i<len;i++){type=Expr.order[i];if((match=Expr.leftMatch[type].exec(expr))){left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(rBackslash,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName("*"):[];}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var match,anyFound,type,found,item,filter,left,i,pass,old=expr,result=[],curLoop=set,isXMLFilter=set&&set[0]&&Sizzle.isXML(set[0]);while(expr&&set.length){for(type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){filter=Expr.filter[type];left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue;}
if(curLoop===result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);pass=not^found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr===old){if(anyFound==null){Sizzle.error(expr);}else{break;}}
old=expr;}
return curLoop;};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg);};var getText=Sizzle.getText=function(elem){var i,node,nodeType=elem.nodeType,ret="";if(nodeType){if(nodeType===1||nodeType===9){if(typeof elem.textContent==='string'){return elem.textContent;}else if(typeof elem.innerText==='string'){return elem.innerText.replace(rReturn,'');}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem);}}}else if(nodeType===3||nodeType===4){return elem.nodeValue;}}else{for(i=0;(node=elem[i]);i++){if(node.nodeType!==8){ret+=getText(node);}}}
return ret;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");},type:function(elem){return elem.getAttribute("type");}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!rNonWord.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part){var elem,isPartStr=typeof part==="string",i=0,l=checkSet.length;if(isPartStr&&!rNonWord.test(part)){part=part.toLowerCase();for(;i<l;i++){elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false;}}}else{for(;i<l;i++){elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var nodeCheck,doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!rNonWord.test(part)){part=part.toLowerCase();nodeCheck=part;checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m&&m.parentNode?[m]:[];}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(match[1]);}}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(rBackslash,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n\r]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem);}}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(rBackslash,"");},TAG:function(match,curLoop){return match[1].replace(rBackslash,"").toLowerCase();},CHILD:function(match){if(match[1]==="nth"){if(!match[2]){Sizzle.error(match[0]);}
match[2]=match[2].replace(/^\+|\s*/g,'');var test=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
else if(match[2]){Sizzle.error(match[0]);}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1]=match[1].replace(rBackslash,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
match[4]=(match[4]||match[5]||"").replace(rBackslash,"");if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex;}
return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return(/h\d/i).test(elem.nodeName);},text:function(elem){var attr=elem.getAttribute("type"),type=elem.type;return elem.nodeName.toLowerCase()==="input"&&"text"===type&&(attr===type||attr===null);},radio:function(elem){return elem.nodeName.toLowerCase()==="input"&&"radio"===elem.type;},checkbox:function(elem){return elem.nodeName.toLowerCase()==="input"&&"checkbox"===elem.type;},file:function(elem){return elem.nodeName.toLowerCase()==="input"&&"file"===elem.type;},password:function(elem){return elem.nodeName.toLowerCase()==="input"&&"password"===elem.type;},submit:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"submit"===elem.type;},image:function(elem){return elem.nodeName.toLowerCase()==="input"&&"image"===elem.type;},reset:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"reset"===elem.type;},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&"button"===elem.type||name==="button";},input:function(elem){return(/input|select|textarea|button/i).test(elem.nodeName);},focus:function(elem){return elem===elem.ownerDocument.activeElement;}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0===i;},eq:function(elem,i,match){return match[3]-0===i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||getText([elem])||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var j=0,l=not.length;j<l;j++){if(not[j]===elem){return false;}}
return true;}else{Sizzle.error(name);}},CHILD:function(elem,match){var first,last,doneName,parent,cache,count,diff,type=match[1],node=elem;switch(type){case"only":case"first":while((node=node.previousSibling)){if(node.nodeType===1){return false;}}
if(type==="first"){return true;}
node=elem;case"last":while((node=node.nextSibling)){if(node.nodeType===1){return false;}}
return true;case"nth":first=match[2];last=match[3];if(first===1&&last===0){return true;}
doneName=match[0];parent=elem.parentNode;if(parent&&(parent[expando]!==doneName||!elem.nodeIndex)){count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent[expando]=doneName;}
diff=elem.nodeIndex-last;if(first===0){return diff===0;}else{return(diff%first===0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||!!elem.nodeName&&elem.nodeName.toLowerCase()===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Sizzle.attr?Sizzle.attr(elem,name):Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":!type&&Sizzle.attr?result!=null:type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS,fescape=function(all,num){return"\\"+(num-0+1);};for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+(/(?![^\[]*\])(?![^\(]*\))/.source));Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,fescape));}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType;}catch(e){makeArray=function(array,results){var i=0,ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var l=array.length;i<l;i++){ret.push(array[i]);}}else{for(;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder,siblingCheck;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0;}
if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1;}
return a.compareDocumentPosition(b)&4?-1:1;};}else{sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0;}else if(a.sourceIndex&&b.sourceIndex){return a.sourceIndex-b.sourceIndex;}
var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;if(aup===bup){return siblingCheck(a,b);}else if(!aup){return-1;}else if(!bup){return 1;}
while(cur){ap.unshift(cur);cur=cur.parentNode;}
cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode;}
al=ap.length;bl=bp.length;for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i]);}}
return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1);};siblingCheck=function(a,b,ret){if(a===b){return ret;var cur=a.nextSibling;}
while(cur){if(cur===b){return-1;}
cur=cur.nextSibling;}
return 1;};}
(function(){var form=document.createElement("div"),id="script"+(new Date()).getTime(),root=document.documentElement;form.innerHTML="<a name='"+id+"'/>";root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div"),id="__sizzle__";div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&!Sizzle.isXML(context)){var match=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query);if(match&&(context.nodeType===1||context.nodeType===9)){if(match[1]){return makeArray(context.getElementsByTagName(query),extra);}else if(match[2]&&Expr.find.CLASS&&context.getElementsByClassName){return makeArray(context.getElementsByClassName(match[2]),extra);}}
if(context.nodeType===9){if(query==="body"&&context.body){return makeArray([context.body],extra);}else if(match&&match[3]){var elem=context.getElementById(match[3]);if(elem&&elem.parentNode){if(elem.id===match[3]){return makeArray([elem],extra);}}else{return makeArray([],extra);}}
try{return makeArray(context.querySelectorAll(query),extra);}catch(qsaError){}}else if(context.nodeType===1&&context.nodeName.toLowerCase()!=="object"){var oldContext=context,old=context.getAttribute("id"),nid=old||id,hasParent=context.parentNode,relativeHierarchySelector=/^\s*[+~]/.test(query);if(!old){context.setAttribute("id",nid);}else{nid=nid.replace(/'/g,"\\$&");}
if(relativeHierarchySelector&&hasParent){context=context.parentNode;}
try{if(!relativeHierarchySelector||hasParent){return makeArray(context.querySelectorAll("[id='"+nid+"'] "+query),extra);}}catch(pseudoError){}finally{if(!old){oldContext.removeAttribute("id");}}}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();}
(function(){var html=document.documentElement,matches=html.matchesSelector||html.mozMatchesSelector||html.webkitMatchesSelector||html.msMatchesSelector;if(matches){var disconnectedMatch=!matches.call(document.createElement("div"),"div"),pseudoWorks=false;try{matches.call(document.documentElement,"[test!='']:sizzle");}catch(pseudoError){pseudoWorks=true;}
Sizzle.matchesSelector=function(node,expr){expr=expr.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!Sizzle.isXML(node)){try{if(pseudoWorks||!Expr.match.PSEUDO.test(expr)&&!/!=/.test(expr)){var ret=matches.call(node,expr);if(ret||!disconnectedMatch||node.document&&node.document.nodeType!==11){return ret;}}}catch(e){}}
return Sizzle(expr,null,null,[node]).length>0;};}})();(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return;}
div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return;}
Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem[expando]===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem[expando]=doneName;elem.sizset=i;}
if(elem.nodeName.toLowerCase()===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var match=false;elem=elem[dir];while(elem){if(elem[expando]===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem[expando]=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
if(document.documentElement.contains){Sizzle.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):true);};}else if(document.documentElement.compareDocumentPosition){Sizzle.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16);};}else{Sizzle.contains=function(){return false;};}
Sizzle.isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};var posProcess=function(selector,context,seed){var match,tmpSet=[],later="",root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet,seed);}
return Sizzle.filter(later,tmpSet);};Sizzle.attr=jQuery.attr;Sizzle.selectors.attrMap={};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,isSimple=/^.[^:#\[\.,]*$/,slice=Array.prototype.slice,POS=jQuery.expr.match.POS,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({find:function(selector){var self=this,i,l;if(typeof selector!=="string"){return jQuery(selector).filter(function(){for(i=0,l=self.length;i<l;i++){if(jQuery.contains(self[i],this)){return true;}}});}
var ret=this.pushStack("","find",selector),length,n,r;for(i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(n=length;n<ret.length;n++){for(r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break;}}}}}
return ret;},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector);},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector);},is:function(selector){return!!selector&&(typeof selector==="string"?POS.test(selector)?jQuery(selector,this.context).index(this[0])>=0:jQuery.filter(selector,this).length>0:this.filter(selector).length>0);},closest:function(selectors,context){var ret=[],i,l,cur=this[0];if(jQuery.isArray(selectors)){var level=1;while(cur&&cur.ownerDocument&&cur!==context){for(i=0;i<selectors.length;i++){if(jQuery(cur).is(selectors[i])){ret.push({selector:selectors[i],elem:cur,level:level});}}
cur=cur.parentNode;level++;}
return ret;}
var pos=POS.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(i=0,l=this.length;i<l;i++){cur=this[i];while(cur){if(pos?pos.index(cur)>-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break;}else{cur=cur.parentNode;if(!cur||!cur.ownerDocument||cur===context||cur.nodeType===11){break;}}}}
ret=ret.length>1?jQuery.unique(ret):ret;return this.pushStack(ret,"closest",selectors);},index:function(elem){if(!elem){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1;}
if(typeof elem==="string"){return jQuery.inArray(this[0],jQuery(elem));}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all));},andSelf:function(){return this.add(this.prevObject);}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret,name,slice.call(arguments).join(","));};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break;}}
return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});function winnow(elements,qualifier,keep){qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,filtered);}}
return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep;});}
function createSafeFragment(document){var list=nodeNames.split("|"),safeFrag=document.createDocumentFragment();if(safeFrag.createElement){while(list.length){safeFrag.createElement(list.pop());}}
return safeFrag;}
var nodeNames="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|"+"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style)/i,rnocache=/<(?:script|object|embed|option|style)/i,rnoshimcache=new RegExp("<(?:"+nodeNames+")","i"),rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/\/(java|ecma)script/i,rcleanScript=/^\s*<!(?:\[CDATA\[|\-\-)/,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},safeFragment=createSafeFragment(document);wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"];}
jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()));});}
if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));}
return jQuery.text(this);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild);}});},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});}else if(arguments.length){var set=jQuery.clean(arguments);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery.clean(arguments));return set;}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem]);}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}}
return this;},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));}
while(elem.firstChild){elem.removeChild(elem.firstChild);}}
return this;},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents);});},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null;}else if(typeof value==="string"&&!rnoInnerhtml.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){jQuery.cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value;}}}catch(e){this.empty().append(value);}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this);self.html(value.call(this,i,self.html()));});}else{this.empty().append(value);}
return this;},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old));});}
if(typeof value!=="string"){value=jQuery(value).detach();}
return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value);}else{jQuery(parent).append(value);}});}else{return this.length?this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value):this;}},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){var results,first,fragment,parent,value=args[0],scripts=[];if(!jQuery.support.checkClone&&arguments.length===3&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback,true);});}
if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback);});}
if(this[0]){parent=value&&value.parentNode;if(jQuery.support.parentNode&&parent&&parent.nodeType===11&&parent.childNodes.length===this.length){results={fragment:parent};}else{results=jQuery.buildFragment(args,this,scripts);}
fragment=results.fragment;if(fragment.childNodes.length===1){first=fragment=fragment.firstChild;}else{first=fragment.firstChild;}
if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length,lastIndex=l-1;i<l;i++){callback.call(table?root(this[i],first):this[i],results.cacheable||(l>1&&i<lastIndex)?jQuery.clone(fragment,true,true):fragment);}}
if(scripts.length){jQuery.each(scripts,evalScript);}}
return this;}});function root(elem,cur){return jQuery.nodeName(elem,"table")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}
function cloneCopyEvent(src,dest){if(!dest)return;if(dest.nodeType!==1||!jQuery.hasData(src)){return;}
var type,i,l,oldData=jQuery._data(src),curData=jQuery._data(dest,oldData),events=oldData.events;if(events){delete curData.handle;curData.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type+(events[type][i].namespace?".":"")+events[type][i].namespace,events[type][i],events[type][i].data);}}}
if(curData.data){curData.data=jQuery.extend({},curData.data);}}
function cloneFixAttributes(src,dest){var nodeName;if(dest.nodeType!==1){return;}
if(dest.clearAttributes){dest.clearAttributes();}
if(dest.mergeAttributes){dest.mergeAttributes(src);}
nodeName=dest.nodeName.toLowerCase();if(nodeName==="object"){dest.outerHTML=src.outerHTML;}else if(nodeName==="input"&&(src.type==="checkbox"||src.type==="radio")){if(src.checked){dest.defaultChecked=dest.checked=src.checked;}
if(dest.value!==src.value){dest.value=src.value;}}else if(nodeName==="option"){dest.selected=src.defaultSelected;}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}
dest.removeAttribute(jQuery.expando);}
jQuery.buildFragment=function(args,nodes,scripts){var fragment,cacheable,cacheresults,doc,first=args[0];if(nodes&&nodes[0]){doc=nodes[0].ownerDocument||nodes[0];}
if(!doc.createDocumentFragment){doc=document;}
if(args.length===1&&typeof first==="string"&&first.length<512&&doc===document&&first.charAt(0)==="<"&&!rnocache.test(first)&&(jQuery.support.checkClone||!rchecked.test(first))&&(jQuery.support.html5Clone||!rnoshimcache.test(first))){cacheable=true;cacheresults=jQuery.fragments[first];if(cacheresults&&cacheresults!==1){fragment=cacheresults;}}
if(!fragment){fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts);}
if(cacheable){jQuery.fragments[first]=cacheresults?fragment:1;}
return{fragment:fragment,cacheable:cacheable};};jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),parent=this.length===1&&this[0].parentNode;if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);return this;}else{for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,insert.selector);}};});function getAll(elem){if(typeof elem.getElementsByTagName!=="undefined"){return elem.getElementsByTagName("*");}else if(typeof elem.querySelectorAll!=="undefined"){return elem.querySelectorAll("*");}else{return[];}}
function fixDefaultChecked(elem){if(elem.type==="checkbox"||elem.type==="radio"){elem.defaultChecked=elem.checked;}}
function findInputs(elem){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="input"){fixDefaultChecked(elem);}else if(nodeName!=="script"&&typeof elem.getElementsByTagName!=="undefined"){jQuery.grep(elem.getElementsByTagName("input"),fixDefaultChecked);}}
function shimCloneNode(elem){var div=document.createElement("div");safeFragment.appendChild(div);div.innerHTML=elem.outerHTML;return div.firstChild;}
jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var srcElements,destElements,i,clone=jQuery.support.html5Clone||!rnoshimcache.test("<"+elem.nodeName)?elem.cloneNode(true):shimCloneNode(elem);if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){cloneFixAttributes(elem,clone);srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){if(destElements[i]){cloneFixAttributes(srcElements[i],destElements[i]);}}}
if(dataAndEvents){cloneCopyEvent(elem,clone);if(deepDataAndEvents){srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneCopyEvent(srcElements[i],destElements[i]);}}}
srcElements=destElements=null;return clone;},clean:function(elems,context,fragment,scripts){var checkScriptType;context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;}
var ret=[],j;for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+="";}
if(!elem){continue;}
if(typeof elem==="string"){if(!rhtml.test(elem)){elem=context.createTextNode(elem);}else{elem=elem.replace(rxhtmlTag,"<$1></$2>");var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");if(context===document){safeFragment.appendChild(div);}else{createSafeFragment(context).appendChild(div);}
div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild;}
if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j]);}}}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild);}
elem=div.childNodes;}}
var len;if(!jQuery.support.appendChecked){if(elem[0]&&typeof(len=elem.length)==="number"){for(j=0;j<len;j++){findInputs(elem[j]);}}else{findInputs(elem);}}
if(elem.nodeType){ret.push(elem);}else{ret=jQuery.merge(ret,elem);}}
if(fragment){checkScriptType=function(elem){return!elem.type||rscriptType.test(elem.type);};for(i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1){var jsTags=jQuery.grep(ret[i].getElementsByTagName("script"),checkScriptType);ret.splice.apply(ret,[i+1,0].concat(jsTags));}
fragment.appendChild(ret[i]);}}}
return ret;},cleanData:function(elems){var data,id,cache=jQuery.cache,special=jQuery.event.special,deleteExpando=jQuery.support.deleteExpando;for(var i=0,elem;(elem=elems[i])!=null;i++){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){continue;}
id=elem[jQuery.expando];if(id){data=cache[id];if(data&&data.events){for(var type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{jQuery.removeEvent(elem,type,data.handle);}}
if(data.handle){data.handle.elem=null;}}
if(deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}}});function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"});}else{jQuery.globalEval((elem.text||elem.textContent||elem.innerHTML||"").replace(rcleanScript,"/*$0*/"));}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}
var ralpha=/alpha\([^)]*\)/i,ropacity=/opacity=([^)]*)/,rupper=/([A-Z]|^ms)/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,rrelNum=/^([\-+])=([\-+.\de]+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],curCSS,getComputedStyle,currentStyle;jQuery.fn.css=function(name,value){if(arguments.length===2&&value===undefined){return this;}
return jQuery.access(this,name,value,true,function(elem,name,value){return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name);});};jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity","opacity");return ret===""?"1":ret;}else{return elem.style.opacity;}}}},cssNumber:{"fillOpacity":true,"fontWeight":true,"lineHeight":true,"opacity":true,"orphans":true,"widows":true,"zIndex":true,"zoom":true},cssProps:{"float":jQuery.support.cssFloat?"cssFloat":"styleFloat"},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return;}
var ret,type,origName=jQuery.camelCase(name),style=elem.style,hooks=jQuery.cssHooks[origName];name=jQuery.cssProps[origName]||origName;if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rrelNum.exec(value))){value=(+(ret[1]+1)*+ret[2])+parseFloat(jQuery.css(elem,name));type="number";}
if(value==null||type==="number"&&isNaN(value)){return;}
if(type==="number"&&!jQuery.cssNumber[origName]){value+="px";}
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value))!==undefined){try{style[name]=value;}catch(e){}}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret;}
return style[name];}},css:function(elem,name,extra){var ret,hooks;name=jQuery.camelCase(name);hooks=jQuery.cssHooks[name];name=jQuery.cssProps[name]||name;if(name==="cssFloat"){name="float";}
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,true,extra))!==undefined){return ret;}else if(curCSS){return curCSS(elem,name);}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(name in options){elem.style[name]=old[name];}}});jQuery.curCSS=jQuery.css;jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){var val;if(computed){if(elem.offsetWidth!==0){return getWH(elem,name,extra);}else{jQuery.swap(elem,cssShow,function(){val=getWH(elem,name,extra);});}
return val;}},set:function(elem,value){if(rnumpx.test(value)){value=parseFloat(value);if(value>=0){return value+"px";}}else{return value;}}};});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":computed?"1":"";},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle,opacity=jQuery.isNumeric(value)?"alpha(opacity="+value*100+")":"",filter=currentStyle&&currentStyle.filter||style.filter||"";style.zoom=1;if(value>=1&&jQuery.trim(filter.replace(ralpha,""))===""){style.removeAttribute("filter");if(currentStyle&&!currentStyle.filter){return;}}
style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity;}};}
jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){var ret;jQuery.swap(elem,{"display":"inline-block"},function(){if(computed){ret=curCSS(elem,"margin-right","marginRight");}else{ret=elem.style.marginRight;}});return ret;}};}});if(document.defaultView&&document.defaultView.getComputedStyle){getComputedStyle=function(elem,name){var ret,defaultView,computedStyle;name=name.replace(rupper,"-$1").toLowerCase();if((defaultView=elem.ownerDocument.defaultView)&&(computedStyle=defaultView.getComputedStyle(elem,null))){ret=computedStyle.getPropertyValue(name);if(ret===""&&!jQuery.contains(elem.ownerDocument.documentElement,elem)){ret=jQuery.style(elem,name);}}
return ret;};}
if(document.documentElement.currentStyle){currentStyle=function(elem,name){var left,rsLeft,uncomputed,ret=elem.currentStyle&&elem.currentStyle[name],style=elem.style;if(ret===null&&style&&(uncomputed=style[name])){ret=uncomputed;}
if(!rnumpx.test(ret)&&rnum.test(ret)){left=style.left;rsLeft=elem.runtimeStyle&&elem.runtimeStyle.left;if(rsLeft){elem.runtimeStyle.left=elem.currentStyle.left;}
style.left=name==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;if(rsLeft){elem.runtimeStyle.left=rsLeft;}}
return ret===""?"auto":ret;};}
curCSS=getComputedStyle||currentStyle;function getWH(elem,name,extra){var val=name==="width"?elem.offsetWidth:elem.offsetHeight,which=name==="width"?cssWidth:cssHeight,i=0,len=which.length;if(val>0){if(extra!=="border"){for(;i<len;i++){if(!extra){val-=parseFloat(jQuery.css(elem,"padding"+which[i]))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.css(elem,extra+which[i]))||0;}else{val-=parseFloat(jQuery.css(elem,"border"+which[i]+"Width"))||0;}}}
return val+"px";}
val=curCSS(elem,name,name);if(val<0||val==null){val=elem.style[name]||0;}
val=parseFloat(val)||0;if(extra){for(;i<len;i++){val+=parseFloat(jQuery.css(elem,"padding"+which[i]))||0;if(extra!=="padding"){val+=parseFloat(jQuery.css(elem,"border"+which[i]+"Width"))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.css(elem,extra+which[i]))||0;}}}
return val+"px";}
if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight;return(width===0&&height===0)||(!jQuery.support.reliableHiddenOffsets&&((elem.style&&elem.style.display)||jQuery.css(elem,"display"))==="none");};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rhash=/#.*$/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,rinput=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,rlocalProtocol=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rquery=/\?/,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,rselectTextarea=/^(?:select|textarea)/i,rspacesAjax=/\s+/,rts=/([?&])_=[^&]*/,rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,_load=jQuery.fn.load,prefilters={},transports={},ajaxLocation,ajaxLocParts,allTypes=["*/"]+["*"];try{ajaxLocation=location.href;}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href;}
ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}
if(jQuery.isFunction(func)){var dataTypes=dataTypeExpression.toLowerCase().split(rspacesAjax),i=0,length=dataTypes.length,dataType,list,placeBefore;for(;i<length;i++){dataType=dataTypes[i];placeBefore=/^\+/.test(dataType);if(placeBefore){dataType=dataType.substr(1)||"*";}
list=structure[dataType]=structure[dataType]||[];list[placeBefore?"unshift":"push"](func);}}};}
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,dataType,inspected){dataType=dataType||options.dataTypes[0];inspected=inspected||{};inspected[dataType]=true;var list=structure[dataType],i=0,length=list?list.length:0,executeOnly=(structure===prefilters),selection;for(;i<length&&(executeOnly||!selection);i++){selection=list[i](options,originalOptions,jqXHR);if(typeof selection==="string"){if(!executeOnly||inspected[selection]){selection=undefined;}else{options.dataTypes.unshift(selection);selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,selection,inspected);}}}
if((executeOnly||!selection)&&!inspected["*"]){selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,"*",inspected);}
return selection;}
function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:(deep||(deep={})))[key]=src[key];}}
if(deep){jQuery.extend(true,target,deep);}}
jQuery.fn.extend({load:function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments);}else if(!this.length){return this;}
var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=undefined;}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST";}}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(jqXHR,status,responseText){responseText=jqXHR.responseText;if(jqXHR.isResolved()){jqXHR.done(function(r){responseText=r;});self.html(selector?jQuery("<div>").append(responseText.replace(rscript,"")).find(selector):responseText);}
if(callback){self.each(callback,[responseText,status,jqXHR]);}}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}):{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.on(o,f);};});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined;}
return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type});};});jQuery.extend({getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},ajaxSetup:function(target,settings){if(settings){ajaxExtend(target,jQuery.ajaxSettings);}else{settings=target;target=jQuery.ajaxSettings;}
ajaxExtend(target,settings);return target;},ajaxSettings:{url:ajaxLocation,isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":allTypes},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined;}
options=options||{};var
s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=callbackContext!==s&&(callbackContext.nodeType||callbackContext instanceof jQuery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},ifModifiedKey,requestHeaders={},requestHeadersNames={},responseHeadersString,responseHeaders,transport,timeoutTimer,parts,state=0,fireGlobals,i,jqXHR={readyState:0,setRequestHeader:function(name,value){if(!state){var lname=name.toLowerCase();name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value;}
return this;},getAllResponseHeaders:function(){return state===2?responseHeadersString:null;},getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while((match=rheaders.exec(responseHeadersString))){responseHeaders[match[1].toLowerCase()]=match[2];}}
match=responseHeaders[key.toLowerCase()];}
return match===undefined?null:match;},overrideMimeType:function(type){if(!state){s.mimeType=type;}
return this;},abort:function(statusText){statusText=statusText||"abort";if(transport){transport.abort(statusText);}
done(0,statusText);return this;}};function done(status,nativeStatusText,responses,headers){if(state===2){return;}
state=2;if(timeoutTimer){clearTimeout(timeoutTimer);}
transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;var isSuccess,success,error,statusText=nativeStatusText,response=responses?ajaxHandleResponses(s,jqXHR,responses):undefined,lastModified,etag;if(status>=200&&status<300||status===304){if(s.ifModified){if((lastModified=jqXHR.getResponseHeader("Last-Modified"))){jQuery.lastModified[ifModifiedKey]=lastModified;}
if((etag=jqXHR.getResponseHeader("Etag"))){jQuery.etag[ifModifiedKey]=etag;}}
if(status===304){statusText="notmodified";isSuccess=true;}else{try{success=ajaxConvert(s,response);statusText="success";isSuccess=true;}catch(e){statusText="parsererror";error=e;}}}else{error=statusText;if(!statusText||status){statusText="error";if(status<0){status=0;}}}
jqXHR.status=status;jqXHR.statusText=""+(nativeStatusText||statusText);if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR]);}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error]);}
jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger("ajax"+(isSuccess?"Success":"Error"),[jqXHR,s,isSuccess?success:error]);}
completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop");}}}
deferred.promise(jqXHR);jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;jqXHR.complete=completeDeferred.add;jqXHR.statusCode=function(map){if(map){var tmp;if(state<2){for(tmp in map){statusCode[tmp]=[statusCode[tmp],map[tmp]];}}else{tmp=map[jqXHR.status];jqXHR.then(tmp,tmp);}}
return this;};s.url=((url||s.url)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().split(rspacesAjax);if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))));}
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return false;}
fireGlobals=s.global;s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart");}
if(!s.hasContent){if(s.data){s.url+=(rquery.test(s.url)?"&":"?")+s.data;delete s.data;}
ifModifiedKey=s.url;if(s.cache===false){var ts=jQuery.now(),ret=s.url.replace(rts,"$1_="+ts);s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"");}}
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType);}
if(s.ifModified){ifModifiedKey=ifModifiedKey||s.url;if(jQuery.lastModified[ifModifiedKey]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[ifModifiedKey]);}
if(jQuery.etag[ifModifiedKey]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[ifModifiedKey]);}}
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i]);}
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){jqXHR.abort();return false;}
for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i]);}
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}
if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}
try{state=1;transport.send(requestHeaders,done);}catch(e){if(state<2){done(-1,e);}else{throw e;}}}
return jqXHR;},param:function(a,traditional){var s=[],add=function(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);};if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional;}
if(jQuery.isArray(a)||(a.jquery&&!jQuery.isPlainObject(a))){jQuery.each(a,function(){add(this.name,this.value);});}else{for(var prefix in a){buildParams(prefix,a[prefix],traditional,add);}}
return s.join("&").replace(r20,"+");}});function buildParams(prefix,obj,traditional,add){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v,traditional,add);}});}else if(!traditional&&obj!=null&&typeof obj==="object"){for(var name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add);}}else{add(prefix,obj);}}
jQuery.extend({active:0,lastModified:{},etag:{}});function ajaxHandleResponses(s,jqXHR,responses){var contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields,ct,type,finalDataType,firstDataType;for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type];}}
while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("content-type");}}
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break;}}}
if(dataTypes[0]in responses){finalDataType=dataTypes[0];}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break;}
if(!firstDataType){firstDataType=type;}}
finalDataType=finalDataType||firstDataType;}
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType);}
return responses[finalDataType];}}
function ajaxConvert(s,response){if(s.dataFilter){response=s.dataFilter(response,s.dataType);}
var dataTypes=s.dataTypes,converters={},i,key,length=dataTypes.length,tmp,current=dataTypes[0],prev,conversion,conv,conv1,conv2;for(i=1;i<length;i++){if(i===1){for(key in s.converters){if(typeof key==="string"){converters[key.toLowerCase()]=s.converters[key];}}}
prev=current;current=dataTypes[i];if(current==="*"){current=prev;}else if(prev!=="*"&&prev!==current){conversion=prev+" "+current;conv=converters[conversion]||converters["* "+current];if(!conv){conv2=undefined;for(conv1 in converters){tmp=conv1.split(" ");if(tmp[0]===prev||tmp[0]==="*"){conv2=converters[tmp[1]+" "+current];if(conv2){conv1=converters[conv1];if(conv1===true){conv=conv2;}else if(conv2===true){conv=conv1;}
break;}}}}
if(!(conv||conv2)){jQuery.error("No conversion from "+conversion.replace(" "," to "));}
if(conv!==true){response=conv?conv(response):conv2(conv1(response));}}}
return response;}
var jsc=jQuery.now(),jsre=/(\=)\?(&|$)|\?\?/i;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return jQuery.expando+"_"+(jsc++);}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var inspectData=s.contentType==="application/x-www-form-urlencoded"&&(typeof s.data==="string");if(s.dataTypes[0]==="jsonp"||s.jsonp!==false&&(jsre.test(s.url)||inspectData&&jsre.test(s.data))){var responseContainer,jsonpCallback=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback,previous=window[jsonpCallback],url=s.url,data=s.data,replace="$1"+jsonpCallback+"$2";if(s.jsonp!==false){url=url.replace(jsre,replace);if(s.url===url){if(inspectData){data=data.replace(jsre,replace);}
if(s.data===data){url+=(/\?/.test(url)?"&":"?")+s.jsonp+"="+jsonpCallback;}}}
s.url=url;s.data=data;window[jsonpCallback]=function(response){responseContainer=[response];};jqXHR.always(function(){window[jsonpCallback]=previous;if(responseContainer&&jQuery.isFunction(previous)){window[jsonpCallback](responseContainer[0]);}});s.converters["script json"]=function(){if(!responseContainer){jQuery.error(jsonpCallback+" was not called");}
return responseContainer[0];};s.dataTypes[0]="json";return"script";}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(text){jQuery.globalEval(text);return text;}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false;}
if(s.crossDomain){s.type="GET";s.global=false;}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;return{send:function(_,callback){script=document.createElement("script");script.async="async";if(s.scriptCharset){script.charset=s.scriptCharset;}
script.src=s.url;script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}
script=undefined;if(!isAbort){callback(200,"success");}}};head.insertBefore(script,head.firstChild);},abort:function(){if(script){script.onload(0,1);}}};}});var
xhrOnUnloadAbort=window.ActiveXObject?function(){for(var key in xhrCallbacks){xhrCallbacks[key](0,1);}}:false,xhrId=0,xhrCallbacks;function createStandardXHR(){try{return new window.XMLHttpRequest();}catch(e){}}
function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}
jQuery.ajaxSettings.xhr=window.ActiveXObject?function(){return!this.isLocal&&createStandardXHR()||createActiveXHR();}:createStandardXHR;(function(xhr){jQuery.extend(jQuery.support,{ajax:!!xhr,cors:!!xhr&&("withCredentials"in xhr)});})(jQuery.ajaxSettings.xhr());if(jQuery.support.ajax){jQuery.ajaxTransport(function(s){if(!s.crossDomain||jQuery.support.cors){var callback;return{send:function(headers,complete){var xhr=s.xhr(),handle,i;if(s.username){xhr.open(s.type,s.url,s.async,s.username,s.password);}else{xhr.open(s.type,s.url,s.async);}
if(s.xhrFields){for(i in s.xhrFields){xhr[i]=s.xhrFields[i];}}
if(s.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(s.mimeType);}
if(!s.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}
try{for(i in headers){xhr.setRequestHeader(i,headers[i]);}}catch(_){}
xhr.send((s.hasContent&&s.data)||null);callback=function(_,isAbort){var status,statusText,responseHeaders,responses,xml;try{if(callback&&(isAbort||xhr.readyState===4)){callback=undefined;if(handle){xhr.onreadystatechange=jQuery.noop;if(xhrOnUnloadAbort){delete xhrCallbacks[handle];}}
if(isAbort){if(xhr.readyState!==4){xhr.abort();}}else{status=xhr.status;responseHeaders=xhr.getAllResponseHeaders();responses={};xml=xhr.responseXML;if(xml&&xml.documentElement){responses.xml=xml;}
responses.text=xhr.responseText;try{statusText=xhr.statusText;}catch(e){statusText="";}
if(!status&&s.isLocal&&!s.crossDomain){status=responses.text?200:404;}else if(status===1223){status=204;}}}}catch(firefoxAccessException){if(!isAbort){complete(-1,firefoxAccessException);}}
if(responses){complete(status,statusText,responses,responseHeaders);}};if(!s.async||xhr.readyState===4){callback();}else{handle=++xhrId;if(xhrOnUnloadAbort){if(!xhrCallbacks){xhrCallbacks={};jQuery(window).unload(xhrOnUnloadAbort);}
xhrCallbacks[handle]=callback;}
xhr.onreadystatechange=callback;}},abort:function(){if(callback){callback(0,1);}}};}});}
var elemdisplay={},iframe,iframeDoc,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],fxNow;jQuery.fn.extend({show:function(speed,easing,callback){var elem,display;if(speed||speed===0){return this.animate(genFx("show",3),speed,easing,callback);}else{for(var i=0,j=this.length;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(!jQuery._data(elem,"olddisplay")&&display==="none"){display=elem.style.display="";}
if(display===""&&jQuery.css(elem,"display")==="none"){jQuery._data(elem,"olddisplay",defaultDisplay(elem.nodeName));}}}
for(i=0;i<j;i++){elem=this[i];if(elem.style){display=elem.style.display;if(display===""||display==="none"){elem.style.display=jQuery._data(elem,"olddisplay")||"";}}}
return this;}},hide:function(speed,easing,callback){if(speed||speed===0){return this.animate(genFx("hide",3),speed,easing,callback);}else{var elem,display,i=0,j=this.length;for(;i<j;i++){elem=this[i];if(elem.style){display=jQuery.css(elem,"display");if(display!=="none"&&!jQuery._data(elem,"olddisplay")){jQuery._data(elem,"olddisplay",display);}}}
for(i=0;i<j;i++){if(this[i].style){this[i].style.display="none";}}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2,callback){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments);}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();});}else{this.animate(genFx("toggle",3),fn,fn2,callback);}
return this;},fadeTo:function(speed,to,easing,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,easing,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete,[false]);}
prop=jQuery.extend({},prop);function doAnimation(){if(optall.queue===false){jQuery._mark(this);}
var opt=jQuery.extend({},optall),isElement=this.nodeType===1,hidden=isElement&&jQuery(this).is(":hidden"),name,val,p,e,parts,start,end,unit,method;opt.animatedProperties={};for(p in prop){name=jQuery.camelCase(p);if(p!==name){prop[name]=prop[p];delete prop[p];}
val=prop[name];if(jQuery.isArray(val)){opt.animatedProperties[name]=val[1];val=prop[name]=val[0];}else{opt.animatedProperties[name]=opt.specialEasing&&opt.specialEasing[name]||opt.easing||'swing';}
if(val==="hide"&&hidden||val==="show"&&!hidden){return opt.complete.call(this);}
if(isElement&&(name==="height"||name==="width")){opt.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(jQuery.css(this,"display")==="inline"&&jQuery.css(this,"float")==="none"){if(!jQuery.support.inlineBlockNeedsLayout||defaultDisplay(this.nodeName)==="inline"){this.style.display="inline-block";}else{this.style.zoom=1;}}}}
if(opt.overflow!=null){this.style.overflow="hidden";}
for(p in prop){e=new jQuery.fx(this,opt,p);val=prop[p];if(rfxtypes.test(val)){method=jQuery._data(this,"toggle"+p)||(val==="toggle"?hidden?"show":"hide":0);if(method){jQuery._data(this,"toggle"+p,method==="show"?"hide":"show");e[method]();}else{e[val]();}}else{parts=rfxnum.exec(val);start=e.cur();if(parts){end=parseFloat(parts[2]);unit=parts[3]||(jQuery.cssNumber[p]?"":"px");if(unit!=="px"){jQuery.style(this,p,(end||1)+unit);start=((end||1)/e.cur())*start;jQuery.style(this,p,start+unit);}
if(parts[1]){end=((parts[1]==="-="?-1:1)*end)+start;}
e.custom(start,end,unit);}else{e.custom(start,val,"");}}}
return true;}
return optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation);},stop:function(type,clearQueue,gotoEnd){if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined;}
if(clearQueue&&type!==false){this.queue(type||"fx",[]);}
return this.each(function(){var index,hadTimers=false,timers=jQuery.timers,data=jQuery._data(this);if(!gotoEnd){jQuery._unmark(true,this);}
function stopQueue(elem,data,index){var hooks=data[index];jQuery.removeData(elem,index,true);hooks.stop(gotoEnd);}
if(type==null){for(index in data){if(data[index]&&data[index].stop&&index.indexOf(".run")===index.length-4){stopQueue(this,data,index);}}}else if(data[index=type+".run"]&&data[index].stop){stopQueue(this,data,index);}
for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){if(gotoEnd){timers[index](true);}else{timers[index].saveState();}
hadTimers=true;timers.splice(index,1);}}
if(!(gotoEnd&&hadTimers)){jQuery.dequeue(this,type);}});}});function createFxNow(){setTimeout(clearFxNow,0);return(fxNow=jQuery.now());}
function clearFxNow(){fxNow=undefined;}
function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;if(opt.queue==null||opt.queue===true){opt.queue="fx";}
opt.old=opt.complete;opt.complete=function(noUnmark){if(jQuery.isFunction(opt.old)){opt.old.call(this);}
if(opt.queue){jQuery.dequeue(this,opt.queue);}else if(noUnmark!==false){jQuery._unmark(this);}};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;options.orig=options.orig||{};}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}
(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}
var parsed,r=jQuery.css(this.elem,this.prop);return isNaN(parsed=parseFloat(r))?!r||r==="auto"?0:r:parsed;},custom:function(from,to,unit){var self=this,fx=jQuery.fx;this.startTime=fxNow||createFxNow();this.end=to;this.now=this.start=from;this.pos=this.state=0;this.unit=unit||this.unit||(jQuery.cssNumber[this.prop]?"":"px");function t(gotoEnd){return self.step(gotoEnd);}
t.queue=this.options.queue;t.elem=this.elem;t.saveState=function(){if(self.options.hide&&jQuery._data(self.elem,"fxshow"+self.prop)===undefined){jQuery._data(self.elem,"fxshow"+self.prop,self.start);}};if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(fx.tick,fx.interval);}},show:function(){var dataShow=jQuery._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=dataShow||jQuery.style(this.elem,this.prop);this.options.show=true;if(dataShow!==undefined){this.custom(this.cur(),dataShow);}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());}
jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery._data(this.elem,"fxshow"+this.prop)||jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var p,n,complete,t=fxNow||createFxNow(),done=true,elem=this.elem,options=this.options;if(gotoEnd||t>=options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();options.animatedProperties[this.prop]=true;for(p in options.animatedProperties){if(options.animatedProperties[p]!==true){done=false;}}
if(done){if(options.overflow!=null&&!jQuery.support.shrinkWrapBlocks){jQuery.each(["","X","Y"],function(index,value){elem.style["overflow"+value]=options.overflow[index];});}
if(options.hide){jQuery(elem).hide();}
if(options.hide||options.show){for(p in options.animatedProperties){jQuery.style(elem,p,options.orig[p]);jQuery.removeData(elem,"fxshow"+p,true);jQuery.removeData(elem,"toggle"+p,true);}}
complete=options.complete;if(complete){options.complete=false;complete.call(elem);}}
return false;}else{if(options.duration==Infinity){this.now=t;}else{n=t-this.startTime;this.state=n/options.duration;this.pos=jQuery.easing[options.animatedProperties[this.prop]](this.state,n,0,1,options.duration);this.now=this.start+((this.end-this.start)*this.pos);}
this.update();}
return true;}};jQuery.extend(jQuery.fx,{tick:function(){var timer,timers=jQuery.timers,i=0;for(;i<timers.length;i++){timer=timers[i];if(!timer()&&timers[i]===timer){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}},interval:13,stop:function(){clearInterval(timerId);timerId=null;},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit;}else{fx.elem[fx.prop]=fx.now;}}}});jQuery.each(["width","height"],function(i,prop){jQuery.fx.step[prop]=function(fx){jQuery.style(fx.elem,prop,Math.max(0,fx.now)+fx.unit);};});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
function defaultDisplay(nodeName){if(!elemdisplay[nodeName]){var body=document.body,elem=jQuery("<"+nodeName+">").appendTo(body),display=elem.css("display");elem.remove();if(display==="none"||display===""){if(!iframe){iframe=document.createElement("iframe");iframe.frameBorder=iframe.width=iframe.height=0;}
body.appendChild(iframe);if(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write((document.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");iframeDoc.close();}
elem=iframeDoc.createElement(nodeName);iframeDoc.body.appendChild(elem);display=jQuery.css(elem,"display");body.removeChild(iframe);}
elemdisplay[nodeName]=display;}
return elemdisplay[nodeName];}
var rtable=/^t(?:able|d|h)$/i,rroot=/^(?:body|html)$/i;if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0],box;if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
try{box=elem.getBoundingClientRect();}catch(e){}
var doc=elem.ownerDocument,docElem=doc.documentElement;if(!box||!jQuery.contains(docElem,elem)){return box?{top:box.top,left:box.left}:{top:0,left:0};}
var body=doc.body,win=getWindow(doc),clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,scrollTop=win.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop,scrollLeft=win.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft,top=box.top+scrollTop-clientTop,left=box.left+scrollLeft-clientLeft;return{top:top,left:left};};}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
var computedStyle,offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.support.fixedPosition&&prevComputedStyle.position==="fixed"){break;}
computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.support.doesNotAddBorder&&!(jQuery.support.doesAddBorderForTableAndCells&&rtable.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevOffsetParent=offsetParent;offsetParent=elem.offsetParent;}
if(jQuery.support.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft;}
if(jQuery.support.fixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft);}
return{top:top,left:left};};}
jQuery.offset={bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;if(jQuery.support.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.css(body,"marginTop"))||0;left+=parseFloat(jQuery.css(body,"marginLeft"))||0;}
return{top:top,left:left};},setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");if(position==="static"){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left;}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0;}
if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}
if(options.top!=null){props.top=(options.top-curOffset.top)+curTop;}
if(options.left!=null){props.left=(options.left-curOffset.left)+curLeft;}
if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({position:function(){if(!this[0]){return null;}
var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=rroot.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.css(elem,"marginTop"))||0;offset.left-=parseFloat(jQuery.css(elem,"marginLeft"))||0;parentOffset.top+=parseFloat(jQuery.css(offsetParent[0],"borderTopWidth"))||0;parentOffset.left+=parseFloat(jQuery.css(offsetParent[0],"borderLeftWidth"))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!rroot.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent;});}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem,win;if(val===undefined){elem=this[0];if(!elem){return null;}
win=getWindow(elem);return win?("pageXOffset"in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method];}
return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop());}else{this[method]=val;}});};});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){var elem=this[0];return elem?elem.style?parseFloat(jQuery.css(elem,type,"padding")):this[type]():null;};jQuery.fn["outer"+name]=function(margin){var elem=this[0];return elem?elem.style?parseFloat(jQuery.css(elem,type,margin?"margin":"border")):this[type]():null;};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this;}
if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()));});}
if(jQuery.isWindow(elem)){var docElemProp=elem.document.documentElement["client"+name],body=elem.document.body;return elem.document.compatMode==="CSS1Compat"&&docElemProp||body&&body["client"+name]||docElemProp;}else if(elem.nodeType===9){return Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name]);}else if(size===undefined){var orig=jQuery.css(elem,type),ret=parseFloat(orig);return jQuery.isNumeric(ret)?ret:orig;}else{return this.css(type,typeof size==="string"?size:size+"px");}};});window.jQuery=window.$=jQuery;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return jQuery;});}})(window);(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).bind("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).bind("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).unbind("click."+m).unbind("keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a("<a class=\"close\"></a>"),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return m.add(n)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.children(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(1,a)},prev:function(a){return f.move(-1,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children("."+e.clonedClass+":last").before(b),h.children("."+e.clonedClass+":first").replaceWith(b.clone().addClass(e.clonedClass))):h.append(b),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}}),f.seekTo(0,0,function(){})}var m=c(b,e.prev).click(function(){f.prev()}),n=c(b,e.next).click(function(){f.next()});!e.circular&&f.getSize()>1&&(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(m.toggleClass(e.disabledClass,b<=0),n.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||m.addClass(e.disabledClass)),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var o={};h[0].ontouchstart=function(a){var b=a.touches[0];o.x=b.clientX,o.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=o.x-b.clientX,d=o.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).bind("keydown.scrollable",function(b){if(e.keyboard&&!b.altKey&&!b.ctrlKey&&!a(b.target).is(":input")){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:!1,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){this.getPanes().slideUp(200),this.getPanes().eq(a).slideDown(400,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c;a.tools.tabs.addEffect("horizontal",function(b,d){c||(c=this.getPanes().eq(0).width()),this.getCurrentPane().animate({width:0},function(){a(this).hide()}),this.getPanes().eq(b).animate({width:c},function(){a(this).show(),d.call()})});function d(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(c,d){var i=h.eq(c);typeof c=="string"&&c.replace("#","")&&(i=h.filter("[href*="+c.replace("#","")+"]"),c=Math.max(h.index(i),0));if(e.rotate){var k=h.length-1;if(c<0)return f.click(k,d);if(c>k)return f.click(0,d)}if(!i.length){if(j>=0)return f;c=e.initialIndex,i=h.eq(c)}if(c===j)return f;d=d||a.Event(),d.type="onBeforeClick",g.trigger(d,[c]);if(!d.isDefaultPrevented()){b[e.effect].call(f,c,function(){d.type="onClick",g.trigger(d,[c])}),j=c,h.removeClass(e.current),i.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.unbind(e.event).removeClass(e.current),i.find("a[href^=#]").unbind("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).bind(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=#]").bind("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href="+location.hash+"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var e=this.data("tabs");e&&(e.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){e=new d(a(this),b,c),a(this).data("tabs",e)});return c.api?e:this}})(jQuery);(function(a){a.tools=a.tools||{version:"v1.2.5"};var b;b=a.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};function c(){if(a.browser.msie){var b=a(document).height(),c=a(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,b-c<20?c:b]}return[a(document).width(),a(document).height()]}function d(b){if(b)return b.call(a.mask)}var e,f,g,h,i;a.mask={load:function(j,k){if(g)return this;typeof j=="string"&&(j={color:j}),j=j||h,h=j=a.extend(a.extend({},b.conf),j),e=a("#"+j.maskId),e.length||(e=a("<div/>").attr("id",j.maskId),a("body").append(e));var l=c();e.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:j.startOpacity,zIndex:j.zIndex}),j.color&&e.css("backgroundColor",j.color);if(d(j.onBeforeLoad)===!1)return this;j.closeOnEsc&&a(document).bind("keydown.mask",function(b){b.keyCode==27&&a.mask.close(b)}),j.closeOnClick&&e.bind("click.mask",function(b){a.mask.close(b)}),a(window).bind("resize.mask",function(){a.mask.fit()}),k&&k.length&&(i=k.eq(0).css("zIndex"),a.each(k,function(){var b=a(this);/relative|absolute|fixed/i.test(b.css("position"))||b.css("position","relative")}),f=k.css({zIndex:Math.max(j.zIndex+1,i=="auto"?0:i)})),e.css({display:"block"}).fadeTo(j.loadSpeed,j.opacity,function(){a.mask.fit(),d(j.onLoad),g="full"}),g=!0;return this},close:function(){if(g){if(d(h.onBeforeClose)===!1)return this;e.fadeOut(h.closeSpeed,function(){d(h.onClose),f&&f.css({zIndex:i}),g=!1}),a(document).unbind("keydown.mask"),e.unbind("click.mask"),a(window).unbind("resize.mask")}return this},fit:function(){if(g){var a=c();e.css({width:a[0],height:a[1]})}},getMask:function(){return e},isLoaded:function(a){return a?g=="full":g},getConf:function(){return h},getExposed:function(){return f}},a.fn.mask=function(b){a.mask.load(b);return this},a.fn.expose=function(b){a.mask.load(b,this);return this}})(jQuery);(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=b||a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=c||a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&i(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function a(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=n(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(g.inline?t.parent()[0]:g.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function o(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(){var t=this.css("position"),i="absolute"===t,s=this.parents().filter(function(){var t=e(this);return i&&"static"===t.css("position")?!1:/(auto|scroll)/.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==t&&s.length?s:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),a=isNaN(s);return(a||s>=0)&&t(i,!a)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,n){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),n&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===i?["Left","Right"]:["Top","Bottom"],n=i.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?r["inner"+i].call(this):this.each(function(){e(this).css(n,s(this,t)+"px")})},e.fn["outer"+i]=function(t,a){return"number"!=typeof t?r["outer"+i].call(this,t):this.each(function(){e(this).css(n,s(this,t,!0,a)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,a=e(this[0]);a.length&&a[0]!==document;){if(i=a.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i,s){var a,n=e.plugins[t];if(n&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(a=0;n.length>a;a++)e.options[n[a][0]]&&n[a][1].apply(e.element,i)}};var h=0,l=Array.prototype.slice;e.cleanData=function(t){return function(i){for(var s,a=0;null!=(s=i[a]);a++)try{e(s).triggerHandler("remove")}catch(n){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var a,n,r,o,h={},l=t.split(".")[0];return t=t.split(".")[1],a=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[l]=e[l]||{},n=e[l][t],r=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new r(e,t)},e.extend(r,n,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),o=new i,o.options=e.widget.extend({},o.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},a=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,n=this._superApply;return this._super=e,this._superApply=a,t=s.apply(this,arguments),this._super=i,this._superApply=n,t}}(),void 0):(h[t]=s,void 0)}),r.prototype=e.widget.extend(o,{widgetEventPrefix:n?o.widgetEventPrefix||t:t},h,{constructor:r,namespace:l,widgetName:t,widgetFullName:a}),n?(e.each(n._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete n._childConstructors):i._childConstructors.push(r),e.widget.bridge(t,r),r},e.widget.extend=function(t){for(var i,s,a=l.call(arguments,1),n=0,r=a.length;r>n;n++)for(i in a[n])s=a[n][i],a[n].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(a){var n="string"==typeof a,r=l.call(arguments,1),o=this;return a=!n&&r.length?e.widget.extend.apply(null,[a].concat(r)):a,n?this.each(function(){var i,n=e.data(this,s);return"instance"===a?(o=n,!1):n?e.isFunction(n[a])&&"_"!==a.charAt(0)?(i=n[a].apply(n,r),i!==n&&void 0!==i?(o=i&&i.jquery?o.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+a+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(a||{}),t._init&&t._init()):e.data(this,s,new i(a,this))}),o}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,a,n,r=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(r={},s=t.split("."),t=s.shift(),s.length){for(a=r[t]=e.widget.extend({},this.options[t]),n=0;s.length-1>n;n++)a[s[n]]=a[s[n]]||{},a=a[s[n]];if(t=s.pop(),1===arguments.length)return void 0===a[t]?null:a[t];a[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];r[t]=i}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var a,n=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=a=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,a=this.widget()),e.each(s,function(s,r){function o(){return t||n.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof r?n[r]:r).apply(n,arguments):void 0}"string"!=typeof r&&(o.guid=r.guid=r.guid||o.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+n.eventNamespace,u=h[2];u?a.delegate(u,l,o):i.bind(l,o)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var a,n,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],n=i.originalEvent)for(a in n)a in i||(i[a]=n[a]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,a,n){"string"==typeof a&&(a={effect:a});var r,o=a?a===!0||"number"==typeof a?i:a.effect||i:t;a=a||{},"number"==typeof a&&(a={duration:a}),r=!e.isEmptyObject(a),a.complete=n,a.delay&&s.delay(a.delay),r&&e.effects&&e.effects.effect[o]?s[t](a):o!==t&&s[o]?s[o](a.duration,a.easing,n):s.queue(function(i){e(this)[t](),n&&n.call(s[0]),i()})}}),e.widget;var u=!1;e(document).mouseup(function(){u=!1}),e.widget("ui.mouse",{version:"1.11.0",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!u){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,a="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!a&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),u=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):t.which?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),u=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var a,n,r=Math.max,o=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==a)return a;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),n=s.children()[0];return e("body").append(s),t=n.offsetWidth,s.css("overflow","scroll"),i=n.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),a=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),a="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,n="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:n?e.position.scrollbarWidth():0,height:a?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),a=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:a,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},e.fn.position=function(a){if(!a||!a.of)return f.apply(this,arguments);a=e.extend({},a);var p,m,g,v,y,b,_=e(a.of),x=e.position.getWithinInfo(a.within),k=e.position.getScrollInfo(x),w=(a.collision||"flip").split(" "),D={};return b=s(_),_[0].preventDefault&&(a.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(a[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),D[this]=[e?e[0]:0,t?t[0]:0],a[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===a.at[0]?y.left+=m:"center"===a.at[0]&&(y.left+=m/2),"bottom"===a.at[1]?y.top+=g:"center"===a.at[1]&&(y.top+=g/2),p=t(D.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),T=d+f+i(this,"marginRight")+k.width,S=c+b+i(this,"marginBottom")+k.height,M=e.extend({},y),N=t(D.my,u.outerWidth(),u.outerHeight());"right"===a.my[0]?M.left-=d:"center"===a.my[0]&&(M.left-=d/2),"bottom"===a.my[1]?M.top-=c:"center"===a.my[1]&&(M.top-=c/2),M.left+=N[0],M.top+=N[1],n||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[w[t]]&&e.ui.position[w[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:T,collisionHeight:S,offset:[p[0]+N[0],p[1]+N[1]],my:a.my,at:a.at,within:x,elem:u})}),a.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,n=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>n?"top":s>0?"bottom":"middle"};d>m&&m>o(t+i)&&(h.horizontal="center"),c>g&&g>o(s+n)&&(h.vertical="middle"),h.important=r(o(t),o(i))>r(o(s),o(n))?"horizontal":"vertical",a.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollLeft:s.offset.left,n=s.width,o=e.left-t.collisionPosition.marginLeft,h=a-o,l=o+t.collisionWidth-n-a;t.collisionWidth>n?h>0&&0>=l?(i=e.left+h+t.collisionWidth-n-a,e.left+=h-i):e.left=l>0&&0>=h?a:h>l?a+n-t.collisionWidth:a:h>0?e.left+=h:l>0?e.left-=l:e.left=r(e.left-o,e.left)},top:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollTop:s.offset.top,n=t.within.height,o=e.top-t.collisionPosition.marginTop,h=a-o,l=o+t.collisionHeight-n-a;t.collisionHeight>n?h>0&&0>=l?(i=e.top+h+t.collisionHeight-n-a,e.top+=h-i):e.top=l>0&&0>=h?a:h>l?a+n-t.collisionHeight:a:h>0?e.top+=h:l>0?e.top-=l:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var i,s,a=t.within,n=a.offset.left+a.scrollLeft,r=a.width,h=a.isWindow?a.scrollLeft:a.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-r-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-r-n,(0>i||o(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>o(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,a=t.within,n=a.offset.top+a.scrollTop,r=a.height,h=a.isWindow?a.scrollTop:a.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-r-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-r-n,e.top+p+f+m>u&&(0>s||o(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>o(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,a,r,o=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(r in s)t.style[r]=s[r];t.appendChild(h),i=o||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",a=e(h).offset().left,n=a>10&&11>a,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.document[0],s=this.options;try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(a){}return this.helper||s.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(s.iframeFix===!0?"iframe":s.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this._removeHandleClassName(),e(this.options.handle||this.element).addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.element.find(".ui-draggable-handle").addBack().removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,a=this.options,n=this.document[0];return this.relative_container=null,a.containment?"window"===a.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===a.containment?(this.containment=[0,0,e(n).width()-this.helperProportions.width-this.margins.left,(e(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):a.containment.constructor===Array?(this.containment=a.containment,void 0):("parent"===a.containment&&(a.containment=this.helper[0].parentNode),i=e(a.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,a,n,r=this.options,o=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return o&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),r.grid&&(a=r.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/r.grid[1])*r.grid[1]:this.originalPageY,l=i?a-this.offset.click.top>=i[1]||a-this.offset.click.top>i[3]?a:a-this.offset.click.top>=i[1]?a-r.grid[1]:a+r.grid[1]:a,n=r.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/r.grid[0])*r.grid[0]:this.originalPageX,h=i?n-this.offset.click.left>=i[0]||n-this.offset.click.left>i[2]?n:n-this.offset.click.left>=i[0]?n-r.grid[0]:n+r.grid[0]:n),"y"===r.axis&&(h=this.originalPageX),"x"===r.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var a=s.options,n=e.extend({},i,{item:s.element});s.sortables=[],e(a.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var a=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,a))})},drag:function(t,i,s){var a=this;e.each(s.sortables,function(){var n=!1,r=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==r&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(r.instance.element[0],this.instance.element[0])&&(n=!1),n})),n?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(a).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var a=e("body"),n=s.options;a.css("cursor")&&(n._cursor=a.css("cursor")),a.css("cursor",n.cursor)},stop:function(t,i,s){var a=s.options;a._cursor&&e("body").css("cursor",a._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var a=e(i.helper),n=s.options;a.css("opacity")&&(n._opacity=a.css("opacity")),a.css("opacity",n.opacity)},stop:function(t,i,s){var a=s.options;a._opacity&&e(i.helper).css("opacity",a._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParent[0]!==i.document[0]&&"HTML"!==i.scrollParent[0].tagName&&(i.overflowOffset=i.scrollParent.offset())},drag:function(t,i,s){var a=s.options,n=!1,r=s.document[0];s.scrollParent[0]!==r&&"HTML"!==s.scrollParent[0].tagName?(a.axis&&"x"===a.axis||(s.overflowOffset.top+s.scrollParent[0].offsetHeight-t.pageY<a.scrollSensitivity?s.scrollParent[0].scrollTop=n=s.scrollParent[0].scrollTop+a.scrollSpeed:t.pageY-s.overflowOffset.top<a.scrollSensitivity&&(s.scrollParent[0].scrollTop=n=s.scrollParent[0].scrollTop-a.scrollSpeed)),a.axis&&"y"===a.axis||(s.overflowOffset.left+s.scrollParent[0].offsetWidth-t.pageX<a.scrollSensitivity?s.scrollParent[0].scrollLeft=n=s.scrollParent[0].scrollLeft+a.scrollSpeed:t.pageX-s.overflowOffset.left<a.scrollSensitivity&&(s.scrollParent[0].scrollLeft=n=s.scrollParent[0].scrollLeft-a.scrollSpeed))):(a.axis&&"x"===a.axis||(t.pageY-e(r).scrollTop()<a.scrollSensitivity?n=e(r).scrollTop(e(r).scrollTop()-a.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<a.scrollSensitivity&&(n=e(r).scrollTop(e(r).scrollTop()+a.scrollSpeed))),a.axis&&"y"===a.axis||(t.pageX-e(r).scrollLeft()<a.scrollSensitivity?n=e(r).scrollLeft(e(r).scrollLeft()-a.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<a.scrollSensitivity&&(n=e(r).scrollLeft(e(r).scrollLeft()+a.scrollSpeed)))),n!==!1&&e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var a=s.options;s.snapElements=[],e(a.snap.constructor!==String?a.snap.items||":data(ui-draggable)":a.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var a,n,r,o,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left,l=h+s.snapElements[c].width,u=s.snapElements[c].top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(a=m>=Math.abs(u-b),n=m>=Math.abs(d-y),r=m>=Math.abs(h-v),o=m>=Math.abs(l-g),a&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top-s.margins.top),n&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top-s.margins.top),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left-s.margins.left),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left-s.margins.left)),p=a||n||r||o,"outer"!==f.snapMode&&(a=m>=Math.abs(u-y),n=m>=Math.abs(d-b),r=m>=Math.abs(h-g),o=m>=Math.abs(l-v),a&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top-s.margins.top),n&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top-s.margins.top),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left-s.margins.left),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left-s.margins.left)),!s.snapElements[c].snapping&&(a||n||r||o||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=a||n||r||o||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var a,n=s.options,r=e.makeArray(e(n.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});r.length&&(a=parseInt(e(r[0]).css("zIndex"),10)||0,e(r).each(function(t){e(this).css("zIndex",a+t)}),this.css("zIndex",a+r.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var a=e(i.helper),n=s.options;a.css("zIndex")&&(n._zIndex=a.css("zIndex")),a.css("zIndex",n.zIndex)},stop:function(t,i,s){var a=s.options;a._zIndex&&e(i.helper).css("zIndex",a._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.0",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,a=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e(this).droppable("instance");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(a=!0,!1):void 0}),a?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s){if(!i.offset)return!1;var a,n,r=(t.positionAbs||t.position.absolute).left,o=(t.positionAbs||t.position.absolute).top,h=r+t.helperProportions.width,l=o+t.helperProportions.height,u=i.offset.left,d=i.offset.top,c=u+i.proportions().width,p=d+i.proportions().height;switch(s){case"fit":return r>=u&&c>=h&&o>=d&&p>=l;case"intersect":return r+t.helperProportions.width/2>u&&c>h-t.helperProportions.width/2&&o+t.helperProportions.height/2>d&&p>l-t.helperProportions.height/2;case"pointer":return a=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,n=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(n,d,i.proportions().height)&&e(a,u,i.proportions().width);case"touch":return(o>=d&&p>=o||l>=d&&p>=l||d>o&&l>p)&&(r>=u&&c>=r||h>=u&&c>=h||u>r&&h>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,a,n=e.ui.ddmanager.droppables[t.options.scope]||[],r=i?i.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;n.length>s;s++)if(!(n[s].options.disabled||t&&!n[s].accept.call(n[s].element[0],t.currentItem||t.element))){for(a=0;o.length>a;a++)if(o[a]===n[s].element[0]){n[s].proportions().height=0;continue e}n[s].visible="none"!==n[s].element.css("display"),n[s].visible&&("mousedown"===r&&n[s]._activate.call(n[s],i),n[s].offset=n[s].element.offset(),n[s].proportions({width:n[s].element[0].offsetWidth,height:n[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,a,n,r=e.ui.intersect(t,this,this.options.tolerance),o=!r&&this.isover?"isout":r&&!this.isover?"isover":null;o&&(this.options.greedy&&(a=this.options.scope,n=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===a}),n.length&&(s=e(n[0]).droppable("instance"),s.greedyChild="isover"===o)),s&&"isover"===o&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,i),s&&"isout"===o&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)},_create:function(){var t,i,s,a,n,r=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),n="ui-resizable-"+s,a=e("<div class='ui-resizable-handle "+n+"'></div>"),a.css({zIndex:o.zIndex}),"se"===s&&a.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(a);this._renderAxis=function(t){var i,s,a,n;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),n=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),a=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(a,n),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){r.resizing||(this.className&&(a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=a&&a[1]?a[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),r._handles.show())}).mouseleave(function(){o.disabled||r.resizing||(e(this).addClass("ui-resizable-autohide"),r._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,a=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(a=!0);return!this.options.disabled&&a},_mouseStart:function(t){var i,s,a,n=this.options,r=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),n.containment&&(i+=e(n.containment).scrollLeft()||0,s+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:r.width(),height:r.height()},this.originalSize=this._helper?{width:r.outerWidth(),height:r.outerHeight()}:{width:r.width(),height:r.height()},this.originalPosition={left:i,top:s},this.sizeDiff={width:r.outerWidth()-r.width(),height:r.outerHeight()-r.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),r.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s=this.helper,a={},n=this.originalMousePosition,r=this.axis,o=t.pageX-n.left||0,h=t.pageY-n.top||0,l=this._change[r];return this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height},l?(i=l.apply(this,[t,o,h]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==this.prevPosition.top&&(a.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(a.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(a.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(a.height=this.size.height+"px"),s.css(a),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(a)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,a,n,r,o,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),a=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,n=s?0:u.sizeDiff.width,r={width:u.helper.width()-n,height:u.helper.height()-a},o=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(r,{top:h,left:o})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,s,a,n,r=this.options;n={minWidth:this._isNumber(r.minWidth)?r.minWidth:0,maxWidth:this._isNumber(r.maxWidth)?r.maxWidth:1/0,minHeight:this._isNumber(r.minHeight)?r.minHeight:0,maxHeight:this._isNumber(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=n.minHeight*this.aspectRatio,s=n.minWidth/this.aspectRatio,i=n.maxHeight*this.aspectRatio,a=n.maxWidth/this.aspectRatio,t>n.minWidth&&(n.minWidth=t),s>n.minHeight&&(n.minHeight=s),n.maxWidth>i&&(n.maxWidth=i),n.maxHeight>a&&(n.maxHeight=a)),this._vBoundaries=n},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,a=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,n=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,r=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,o=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return n&&(e.width=t.minWidth),r&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),n&&l&&(e.left=o-t.minWidth),s&&l&&(e.left=o-t.maxWidth),r&&u&&(e.top=h-t.minHeight),a&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,s,a,n=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(a=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")],s=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);a.css({height:n.height()-this.borderDif[0]-this.borderDif[2]||0,width:n.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,a=this.originalPosition;return{top:a.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition,prevSize:this.prevSize,prevPosition:this.prevPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,a=i._proportionallyResizeElements,n=a.length&&/textarea/i.test(a[0].nodeName),r=n&&i._hasScroll(a[0],"left")?0:i.sizeDiff.height,o=n?0:i.sizeDiff.width,h={width:i.size.width-o,height:i.size.height-r},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};a&&a.length&&e(a[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,a,n,r,o,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,a=h.containerSize.height,n=h.containerSize.width,r=h._hasScroll(c,"left")?c.scrollWidth:n,o=h._hasScroll(c)?c.scrollHeight:a,h.parentData={element:c,left:s.left,top:s.top,width:r,height:o}))},resize:function(t,i){var s,a,n,r,o=e(this).resizable("instance"),h=o.options,l=o.containerOffset,u=o.position,d=o._aspectRatio||t.shiftKey,c={top:0,left:0},p=o.containerElement,f=!0;p[0]!==document&&/static/.test(p.css("position"))&&(c=l),u.left<(o._helper?l.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-l.left:o.position.left-c.left),d&&(o.size.height=o.size.width/o.aspectRatio,f=!1),o.position.left=h.helper?l.left:0),u.top<(o._helper?l.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-l.top:o.position.top),d&&(o.size.width=o.size.height*o.aspectRatio,f=!1),o.position.top=o._helper?l.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,s=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-l.left)+o.sizeDiff.width),a=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-l.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),r=/relative|absolute/.test(o.containerElement.css("position")),n&&r&&(s-=Math.abs(o.parentData.left)),s+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-s,d&&(o.size.height=o.size.width/o.aspectRatio,f=!1)),a+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-a,d&&(o.size.width=o.size.height*o.aspectRatio,f=!1)),f||(o.position.left=i.prevPosition.left,o.position.top=i.prevPosition.top,o.size.width=i.prevSize.width,o.size.height=i.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,a=t.containerPosition,n=t.containerElement,r=e(t.helper),o=r.offset(),h=r.outerWidth()-t.sizeDiff.width,l=r.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),a=s.options,n=s.originalSize,r=s.originalPosition,o={height:s.size.height-n.height||0,width:s.size.width-n.width||0,top:s.position.top-r.top||0,left:s.position.left-r.left||0},h=function(t,s){e(t).each(function(){var t=e(this),a=e(this).data("ui-resizable-alsoresize"),n={},r=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(e,t){var i=(a[t]||0)+(o[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})};"object"!=typeof a.alsoResize||a.alsoResize.nodeType?h(a.alsoResize):e.each(a.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size,a=t.originalSize,n=t.originalPosition,r=t.axis,o="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=o[0]||1,l=o[1]||1,u=Math.round((s.width-a.width)/h)*h,d=Math.round((s.height-a.height)/l)*l,c=a.width+u,p=a.height+d,f=i.maxWidth&&c>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>c,v=i.minHeight&&i.minHeight>p;i.grid=o,g&&(c+=h),v&&(p+=l),f&&(c-=h),m&&(p-=l),/^(se|s|e)$/.test(r)?(t.size.width=c,t.size.height=p):/^(ne)$/.test(r)?(t.size.width=c,t.size.height=p,t.position.top=n.top-d):/^(sw)$/.test(r)?(t.size.width=c,t.size.height=p,t.position.left=n.left-u):(p-l>0?(t.size.height=p,t.position.top=n.top-d):(t.size.height=l,t.position.top=n.top+a.height-l),c-h>0?(t.size.width=c,t.position.left=n.left-u):(t.size.width=h,t.position.left=n.left+a.width-h))}}),e.ui.resizable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,a=e.data(this,"selectable-item");return a?(s=!t.metaKey&&!t.ctrlKey||!a.$element.hasClass("ui-selected"),a.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),a.unselecting=!s,a.selecting=s,a.selected=s,s?i._trigger("selecting",t,{selecting:a.element}):i._trigger("unselecting",t,{unselecting:a.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,a=this.options,n=this.opos[0],r=this.opos[1],o=t.pageX,h=t.pageY;return n>o&&(i=o,o=n,n=i),r>h&&(i=h,h=r,r=i),this.helper.css({left:n,top:r,width:o-n,height:h-r}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===a.tolerance?l=!(i.left>o||n>i.right||i.top>h||r>i.bottom):"fit"===a.tolerance&&(l=i.left>n&&o>i.right&&i.top>r&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,a=!1,n=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,n.widgetName+"-item")===n?(s=e(this),!1):void 0}),e.data(t.target,n.widgetName+"-item")===n&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(a=!0)}),a)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var a,n,r=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,r.cursorAt&&this._adjustOffsetFromHelper(r.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),r.containment&&this._setContainment(),r.cursor&&"auto"!==r.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",r.cursor),this.storedStylesheet=e("<style>*{ cursor: "+r.cursor+" !important; }</style>").appendTo(n)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(a=this.containers.length-1;a>=0;a--)this.containers[a]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,a,n,r=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<r.scrollSensitivity?this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop+r.scrollSpeed:t.pageY-this.overflowOffset.top<r.scrollSensitivity&&(this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop-r.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<r.scrollSensitivity?this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft+r.scrollSpeed:t.pageX-this.overflowOffset.left<r.scrollSensitivity&&(this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft-r.scrollSpeed)):(t.pageY-e(document).scrollTop()<r.scrollSensitivity?o=e(document).scrollTop(e(document).scrollTop()-r.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<r.scrollSensitivity&&(o=e(document).scrollTop(e(document).scrollTop()+r.scrollSpeed)),t.pageX-e(document).scrollLeft()<r.scrollSensitivity?o=e(document).scrollLeft(e(document).scrollLeft()-r.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<r.scrollSensitivity&&(o=e(document).scrollLeft(e(document).scrollLeft()+r.scrollSpeed))),o!==!1&&e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],a=s.item[0],n=this._intersectsWithPointer(s),n&&s.instance===this.currentContainer&&a!==this.currentItem[0]&&this.placeholder[1===n?"next":"prev"]()[0]!==a&&!e.contains(this.placeholder[0],a)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],a):!0)){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,a=this.placeholder.offset(),n=this.options.axis,r={};n&&"x"!==n||(r.left=a.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(r.top=a.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(r,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,a=s+this.helperProportions.height,n=e.left,r=n+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>o&&h>s+l,c="y"===this.options.axis||t+u>n&&r>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>n&&r>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>o&&h>a-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,a=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return s?this.floating?n&&"right"===n||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&i||"left"===a&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){o.push(this)}var s,a,n,r,o=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(n=e(l[s]),a=n.length-1;a>=0;a--)r=e.data(n[a],this.widgetFullName),r&&r!==this&&!r.options.disabled&&h.push([e.isFunction(r.options.items)?r.options.items.call(r.element):e(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(o)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,a,n,r,o,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(a=e(c[i]),s=a.length-1;s>=0;s--)n=e.data(a[s],this.widgetFullName),n&&n!==this&&!n.options.disabled&&(d.push([e.isFunction(n.options.items)?n.options.items.call(n.element[0],t,{item:this.currentItem}):e(n.options.items,n.element),n]),this.containers.push(n));for(i=d.length-1;i>=0;i--)for(r=d[i][1],o=d[i][0],s=0,l=o.length;l>s;s++)h=e(o[s]),h.data(this.widgetName+"-item",r),u.push({item:h,instance:r,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,a,n;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(a=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=a.outerWidth(),s.height=a.outerHeight()),n=a.offset(),s.left=n.left,s.top=n.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)n=this.containers[i].element.offset(),this.containers[i].containerCache.left=n.left,this.containers[i].containerCache.top=n.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),a=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(a)}):"img"===s&&a.attr("src",t.currentItem.attr("src")),i||a.css("visibility","hidden"),a},update:function(e,a){(!i||s.forcePlaceholderSize)&&(a.height()||a.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),a.width()||a.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,a,n,r,o,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(a=1e4,n=null,u=c.floating||this._isFloating(this.currentItem),r=u?"left":"top",o=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[r],l=!1,t[d]-h>this.items[s][o]/2&&(l=!0),a>Math.abs(t[d]-h)&&(a=Math.abs(t[d]-h),n=this.items[s],this.direction=l?"up":"down"));if(!n&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return;n?this._rearrange(t,n,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,a=this.options;"parent"===a.containment&&(a.containment=this.helper[0].parentNode),("document"===a.containment||"window"===a.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===a.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===a.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(a.containment)||(t=e(a.containment)[0],i=e(a.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,n=/(html|body)/i.test(a[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():n?0:a.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():n?0:a.scrollLeft())*s}},_generatePosition:function(t){var i,s,a=this.options,n=t.pageX,r=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(n=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(r=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(n=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(r=this.containment[3]+this.offset.click.top)),a.grid&&(i=this.originalPageY+Math.round((r-this.originalPageY)/a.grid[1])*a.grid[1],r=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-a.grid[1]:i+a.grid[1]:i,s=this.originalPageX+Math.round((n-this.originalPageX)/a.grid[0])*a.grid[0],n=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-a.grid[0]:s+a.grid[0]:s)),{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var a=this.counter;this._delay(function(){a===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,a=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&a.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||a.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(a.push(function(e){this._trigger("remove",e,this._uiHash())}),a.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),a.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||a.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(a.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),s=0;a.length>s;s++)a[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(s=0;a.length>s;s++)a[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.accordion",{version:"1.11.0",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,a=this.headers.index(t.target),n=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:n=this.headers[(a+1)%s];break;case i.LEFT:case i.UP:n=this.headers[(a-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:n=this.headers[0];break;case i.END:n=this.headers[s-1]}n&&(e(t.target).attr("tabIndex",-1),e(n).attr("tabIndex",0),n.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var t,i=this.options,s=i.heightStyle,a=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),a=s.uniqueId().attr("id");t.attr("aria-controls",a),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=a.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,a=e(t.currentTarget),n=a[0]===s[0],r=n&&i.collapsible,o=r?e():a.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:r?e():a,newPanel:o};t.preventDefault(),n&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=r?!1:this.headers.index(a),this.active=n?e():a,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),n||(a.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),a.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,a,n,r=this,o=0,h=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},u=h&&l.down||l,d=function(){r._toggleComplete(i)};return"number"==typeof u&&(n=u),"string"==typeof u&&(a=u),a=a||u.easing||l.easing,n=n||u.duration||l.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:n,easing:a,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:n,easing:a,complete:d,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?o+=i.now:"content"!==r.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-o),o=0)}}),void 0):t.animate(this.hideProps,n,a,d):e.animate(this.showProps,n,a,d)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.0",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,a,n,r,o,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,a=this.previousFilter||"",n=String.fromCharCode(t.keyCode),r=!1,clearTimeout(this.filterTimer),n===a?r=!0:n=a+n,o=RegExp("^"+i(n),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return o.test(e(this).text())}),s=r&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(n=String.fromCharCode(t.keyCode),o=RegExp("^"+i(n),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return o.test(e(this).text())})),s.length?(this.focus(t,s),s.length>1?(this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,a=this.options.icons.submenu,n=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+a).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=n.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,a,n,r,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,a=t.offset().top-this.activeMenu.offset().top-i-s,n=this.activeMenu.scrollTop(),r=this.activeMenu.height(),o=t.outerHeight(),0>a?this.activeMenu.scrollTop(n+a):a+o>r&&this.activeMenu.scrollTop(n+a-r+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,a;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-a}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,a;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+a>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}}),e.widget("ui.autocomplete",{version:"1.11.0",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,a=this.element[0].nodeName.toLowerCase(),n="textarea"===a,r="input"===a;this.isMultiLine=n?!0:r?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[n||r?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(a){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var n=e.ui.keyCode;switch(a.keyCode){case n.PAGE_UP:t=!0,this._move("previousPage",a);break;case n.PAGE_DOWN:t=!0,this._move("nextPage",a);break;case n.UP:t=!0,this._keyEvent("previous",a);break;case n.DOWN:t=!0,this._keyEvent("next",a);break;case n.ENTER:this.menu.active&&(t=!0,a.preventDefault(),this.menu.select(a));break;case n.TAB:this.menu.active&&this.menu.select(a);break;case n.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(a),a.preventDefault());break;default:i=!0,this._searchTimeout(a)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var a=e.ui.keyCode;switch(s.keyCode){case a.PAGE_UP:this._move("previousPage",s);break;case a.PAGE_DOWN:this._move("nextPage",s);break;case a.UP:this._keyEvent("previous",s);break;case a.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,a;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(a=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:a})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(a.value),s=i.item.attr("aria-label")||a.value,s&&jQuery.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,a){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){a(e)},error:function(){a([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var d,c="ui-button ui-widget ui-state-default ui-corner-all",p="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},m=function(t){var i=t.name,s=t.form,a=e([]);return i&&(i=i.replace(/'/g,"\\'"),a=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),a};e.widget("ui.button",{version:"1.11.0",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,f),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,a=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(c).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===d&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(a)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];m(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),d=this,t.document.one("mouseup",function(){d=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(c+" ui-state-active "+p).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?m(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(p),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,a=s.primary&&s.secondary,n=[];s.primary||s.secondary?(this.options.text&&n.push("ui-button-text-icon"+(a?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(n.push(a?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):n.push("ui-button-text-only"),t.addClass(n.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.0",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.0"}});var g;e.extend(a.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,a,n;s=t.nodeName.toLowerCase(),a="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),n=this._newInst(e(t),a),n.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,n):a&&this._inlineDatepicker(t,n)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,a,n,r=this._get(i,"appendText"),o=this._get(i,"isRTL");i.append&&i.append.remove(),r&&(i.append=e("<span class='"+this._appendClass+"'>"+r+"</span>"),t[o?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(a=this._get(i,"buttonText"),n=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:n,alt:a,title:a}):e("<button type='button'></button>").addClass(this._triggerClass).html(n?e("<img/>").attr({src:n,alt:a,title:a}):a)),t[o?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,a,n=new Date(2009,11,20),r=this._get(e,"dateFormat");r.match(/[DM]/)&&(t=function(e){for(i=0,s=0,a=0;e.length>a;a++)e[a].length>i&&(i=e[a].length,s=a);return s},n.setMonth(t(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,a,n){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,a||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),a=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(a.append.remove(),a.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,s,a=e(t),n=e.data(t,"datepicker");a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=a.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,a=e(t),n=e.data(t,"datepicker");a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=a.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var a,n,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(a=i||{},"string"==typeof i&&(a={},a[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,a),null!==o&&void 0!==a.dateFormat&&void 0===a.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==a.dateFormat&&void 0===a.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in a&&(a.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,n),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,a,n=e.datepicker._getInst(t.target),r=!0,o=n.dpDiv.is(".ui-datepicker-rtl");if(n._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),r=!1;break;case 13:return a=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",n.dpDiv),a[0]&&e.datepicker._selectDay(t.target,n.selectedMonth,n.selectedYear,a[0]),i=e.datepicker._get(n,"onSelect"),i?(s=e.datepicker._formatDate(n),i.apply(n.input?n.input[0]:null,[s,n])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),r=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),r=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?1:-1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),r=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?-1:1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),r=t.ctrlKey||t.metaKey;break;default:r=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):r=!1;r&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,a=e.datepicker._getInst(t.target);return e.datepicker._get(a,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(a,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(a){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,a,n,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),a=e.datepicker._get(i,"beforeShow"),n=a?a.apply(t,[t,i]):{},n!==!1&&(r(i.settings,n),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,g=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a");var i,s=this._getNumberOfMonths(t),a=s[1],n=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),a>1&&t.dpDiv.addClass("ui-datepicker-multi-"+a).css("width",n*a+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var a=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),r=t.input?t.input.outerWidth():0,o=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?a-r:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+o?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+a>h&&h>a?Math.abs(i.left+a-h):0),i.top-=Math.min(i.top,i.top+n>l&&l>n?Math.abs(n+o):0),i},_findPos:function(t){for(var i,s=this._getInst(t),a=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[a?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,a,n,r=this._curInst;!r||t&&r!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(r,"showAnim"),s=this._get(r,"duration"),a=function(){e.datepicker._tidyDialog(r)},e.effects&&(e.effects.effect[i]||e.effects[i])?r.dpDiv.hide(i,e.datepicker._get(r,"showOptions"),s,a):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,a),i||a(),this._datepickerShowing=!1,n=this._get(r,"onClose"),n&&n.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var a=e(t),n=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(n,i+("M"===s?this._get(n,"showCurrentAtPos"):0),s),this._updateDatepicker(n))},_gotoToday:function(t){var i,s=e(t),a=this._getInst(s[0]);this._get(a,"gotoCurrent")&&a.currentDay?(a.selectedDay=a.currentDay,a.drawMonth=a.selectedMonth=a.currentMonth,a.drawYear=a.selectedYear=a.currentYear):(i=new Date,a.selectedDay=i.getDate(),a.drawMonth=a.selectedMonth=i.getMonth(),a.drawYear=a.selectedYear=i.getFullYear()),this._notifyChange(a),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var a=e(t),n=this._getInst(a[0]);n["selected"+("M"===s?"Month":"Year")]=n["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(n),this._adjustDate(a)},_selectDay:function(t,i,s,a){var n,r=e(t);e(a).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(n=this._getInst(r[0]),n.selectedDay=n.currentDay=e("a",a).html(),n.selectedMonth=n.currentMonth=i,n.selectedYear=n.currentYear=s,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,a=e(t),n=this._getInst(a[0]);i=null!=i?i:this._formatDate(n),n.input&&n.input.val(i),this._updateAlternate(n),s=this._get(n,"onSelect"),s?s.apply(n.input?n.input[0]:null,[i,n]):n.input&&n.input.trigger("change"),n.inline?this._updateDatepicker(n):(this._hideDatepicker(),this._lastInput=n.input[0],"object"!=typeof n.input[0]&&n.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,a,n=this._get(t,"altField");n&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),a=this.formatDate(i,s,this._getFormatConfig(t)),e(n).each(function(){e(this).val(a)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var a,n,r,o,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>a+1&&t.charAt(a+1)===e;return i&&a++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,a=RegExp("^\\d{1,"+s+"}"),n=i.substring(h).match(a);if(!n)throw"Missing number at position "+h;return h+=n[0].length,parseInt(n[0],10)},k=function(t,s,a){var n=-1,r=e.map(_(t)?a:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(r,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(n=t[0],h+=s.length,!1):void 0}),-1!==n)return n+1;throw"Unknown name at position "+h},w=function(){if(i.charAt(h)!==t.charAt(a))throw"Unexpected literal at position "+h;h++};for(a=0;t.length>a;a++)if(b)"'"!==t.charAt(a)||_("'")?w():b=!1;else switch(t.charAt(a)){case"d":v=x("d");break;case"D":k("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=k("M",p,f);break;case"y":m=x("y");break;case"@":o=new Date(x("@")),m=o.getFullYear(),g=o.getMonth()+1,v=o.getDate();break;case"!":o=new Date((x("!")-this._ticksTo1970)/1e4),m=o.getFullYear(),g=o.getMonth()+1,v=o.getDate();break;case"'":_("'")?w():b=!0;break;default:w()}if(i.length>h&&(r=i.substr(h),!/^\s+/.test(r)))throw"Extra/unparsed characters found in date: "+r;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(n=this._getDaysInMonth(m,g-1),n>=v)break;g++,v-=n}if(o=this._daylightSavingAdjust(new Date(m,g-1,v)),o.getFullYear()!==m||o.getMonth()+1!==g||o.getDate()!==v)throw"Invalid date";return o},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,n=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),a,n);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),r,o);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,a=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||a("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":a("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,a=this._getDefaultDate(e),n=a,r=this._getFormatConfig(e);try{n=this.parseDate(i,s,r)||a}catch(o){s=t?"":s}e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),e.currentDay=s?n.getDate():0,e.currentMonth=s?n.getMonth():0,e.currentYear=s?n.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var a=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},n=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var a=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,n=a.getFullYear(),r=a.getMonth(),o=a.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":o+=parseInt(l[1],10);break;case"w":case"W":o+=7*parseInt(l[1],10);break;case"m":case"M":r+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r));break;case"y":case"Y":n+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r))}l=h.exec(i)}return new Date(n,r,o)},r=null==i||""===i?s:"string"==typeof i?n(i):"number"==typeof i?isNaN(i)?s:a(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?s:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,a=e.selectedMonth,n=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),a===e.selectedMonth&&n===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,a,n,r,o,h,l,u,d,c,p,f,m,g,v,y,b,_,x,k,w,D,T,S,M,N,C,A,I,P,F,H,z,j,E,O,L,W=new Date,R=this._daylightSavingAdjust(new Date(W.getFullYear(),W.getMonth(),W.getDate())),Y=this._get(e,"isRTL"),J=this._get(e,"showButtonPanel"),B=this._get(e,"hideIfNoPrevNext"),K=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),q=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),G=1!==V[0]||1!==V[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-q,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-V[0]*V[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":B?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",a=this._get(e,"nextText"),a=K?this.formatDate(a,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):a,n=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+a+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+a+"</span></a>":B?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+a+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+a+"</span></a>",r=this._get(e,"currentText"),o=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,r=K?this.formatDate(r,o,this._getFormatConfig(e)):r,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=J?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,o)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+r+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",k=0;V[0]>k;k++){for(w="",this.maxRows=4,D=0;V[1]>D;D++){if(T=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",G){if(M+="<div class='ui-datepicker-group",V[1]>1)switch(D){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case V[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===k?Y?n:s:"")+(/all|right/.test(S)&&0===k?Y?s:n:"")+this._generateMonthYearHeader(e,Z,et,X,$,k>0||D>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",N=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)C=(x+u)%7,N+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[C]+"'>"+p[C]+"</span></th>";for(M+=N+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),I=(this._getFirstDayOfMonth(et,Z)-u+7)%7,P=Math.ceil((I+A)/7),F=G?this.maxRows>P?this.maxRows:P:P,this.maxRows=F,H=this._daylightSavingAdjust(new Date(et,Z,1-I)),z=0;F>z;z++){for(M+="<tr>",j=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(H)+"</td>":"",x=0;7>x;x++)E=g?g.apply(e.input?e.input[0]:null,[H]):[!0,""],O=H.getMonth()!==Z,L=O&&!y||!E[0]||X&&X>H||$&&H>$,j+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(H.getTime()===T.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===H.getTime()&&b.getTime()===T.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!v?"":" "+E[1]+(H.getTime()===Q.getTime()?" "+this._currentClass:"")+(H.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(O&&!v||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(O&&!v?"&#xa0;":L?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===R.getTime()?" ui-state-highlight":"")+(H.getTime()===Q.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=j+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(G?"</div>"+(V[0]>0&&D===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),w+=M}_+=w}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,a,n,r,o){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(n||!g)_+="<span class='ui-datepicker-month'>"+r[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=a&&a.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||a.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+o[u]+"</option>");_+="</select>"}if(y||(b+=_+(!n&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",n||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=a?Math.min(m,a.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!n&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),a=e.drawMonth+("M"===i?t:0),n=Math.min(e.selectedDay,this._getDaysInMonth(s,a))+("D"===i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,a,n)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),a=i&&i>t?i:t;return s&&a>s?s:a},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var a=this._getNumberOfMonths(e),n=this._daylightSavingAdjust(new Date(i,s+(0>t?t:a[0]*a[1]),1));return 0>t&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(e,n)},_isInRange:function(e,t){var i,s,a=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=null,o=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=s),i[1].match(/[+\-].*/)&&(o+=s)),(!a||t.getTime()>=a.getTime())&&(!n||t.getTime()<=n.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var a=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),a,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new a,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.0",e.datepicker,e.widget("ui.dialog",{version:"1.11.0",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(a){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,a=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),n=Math.max.apply(null,a);return n>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",n+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),a=i.filter(":last");t.target!==a[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){a.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var a,n;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),a=s.click,s.click=function(){a.apply(t.element[0],arguments)},n={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,a){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(a))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(a,n){var r=n.offset.left-i.document.scrollLeft(),o=n.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(o>=0?"+":"")+o,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",a,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,a=s.resizable,n=this.uiDialog.css("position"),r="string"==typeof a?a:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:r,start:function(s,a){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(a))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(a,n){var r=i.uiDialog.offset(),o=r.left-i.document.scrollLeft(),h=r.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",a,t(n))}}).css("position",n)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._untrackInstance(),this._trackingInstances().unshift(this),this._focusedElement=e(t.target)}})},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,a={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(a[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(e,t){var i,s,a=this.uiDialog;"dialogClass"===e&&a.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=a.is(":data(ui-draggable)"),i&&!t&&a.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=a.is(":data(ui-resizable)"),s&&!t&&a.resizable("destroy"),s&&"string"==typeof t&&a.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.progressbar",{version:"1.11.0",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectmenu",{version:"1.11.0",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this,i=this.element.attr("tabindex");this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:i||this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._setOption("width",this.options.width),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this._setOption("width",this.options.width)},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,a="";e.each(i,function(i,n){n.optgroup!==a&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(n.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:n.optgroup}).appendTo(t),a=n.optgroup),s._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,a=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),a+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](a).eq(-1):i[e+"All"](a).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{click:"_toggle",keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&(t||(t=this.element.outerWidth()),this.button.outerWidth(t))},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var a=e(s),n=a.parent("optgroup");i.push({element:a,index:t,value:a.attr("value"),label:a.text(),optgroup:n.attr("label")||"",disabled:n.prop("disabled")||a.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.0",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,a=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),n="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",r=[];for(i=s.values&&s.values.length||1,a.length>i&&(a.slice(i).remove(),a=a.slice(0,i)),t=a.length;i>t;t++)r.push(n);this.handles=a.add(e(r.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,a,n,r,o,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),a=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(a>i||a===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(a=i,n=e(this),r=t)}),o=this._start(t,r),o===!1?!1:(this._mouseSliding=!0,this._handleIndex=r,n.addClass("ui-state-active").focus(),h=n.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-n.width()/2,top:t.pageY-h.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,r,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,a,n;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),a=this._valueMax()-this._valueMin(),n=this._valueMin()+s*a,this._trimAlignValue(n)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,a,n;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(a=this.values(),a[t]=i,n=this._trigger("slide",e,{handle:this.handles[t],value:i,values:a}),s=this.values(t?0:1),n!==!1&&this.values(t,i))):i!==this.value()&&(n=this._trigger("slide",e,{handle:this.handles[t],value:i}),n!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,a,n;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,a=arguments[0],n=0;s.length>n;n+=1)s[n]=this._trimAlignValue(a[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,i){var s,a=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(a=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;a>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,s,a,n,r=this.options.range,o=this.options,h=this,l=this._animateOff?!1:o.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,o.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},o.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:o.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},o.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:o.animate}))),t=i}):(s=this.value(),a=this._valueMin(),n=this._valueMax(),i=n!==a?100*((s-a)/(n-a)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,o.animate),"min"===r&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},o.animate),"max"===r&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:o.animate}),"min"===r&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},o.animate),"max"===r&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:o.animate}))},_handleEvents:{keydown:function(t){var i,s,a,n,r=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,r),i===!1))return}switch(n=this.options.step,s=a=this.options.values&&this.options.values.length?this.values(r):this.value(),t.keyCode){case e.ui.keyCode.HOME:a=this._valueMin();break;case e.ui.keyCode.END:a=this._valueMax();break;case e.ui.keyCode.PAGE_UP:a=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;a=this._trimAlignValue(s+n);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;a=this._trimAlignValue(s-n)}this._slide(t,r,a)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.spinner",{version:"1.11.0",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var a=i.attr(s);void 0!==a&&a.length&&(t[s]=a)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:o(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:o(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:o(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:o(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:o(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(o(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.0",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(a){}try{s=decodeURIComponent(s)}catch(a){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,a){return e(a).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),a=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:a=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,a),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>a&&(t=0),0>t&&(t=a),t}for(var a=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var a,n,r,o=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(a=s.hash,r=a.substring(1),n=t.element.find(t._sanitizeSelector(a))):(r=h.attr("aria-controls")||e({}).uniqueId()[0].id,a="#"+r,n=t.element.find(a),n.length||(n=t._createPanel(r),n.insertAfter(t.panels[i-1]||t.tablist)),n.attr("aria-live","polite")),n.length&&(t.panels=t.panels.add(n)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":r,"aria-labelledby":o}),n.attr("aria-labelledby",o)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,a=e(t.currentTarget),n=a.closest("li"),r=n[0]===s[0],o=r&&i.collapsible,h=o?e():this._getPanelForTab(n),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:o?e():n,newPanel:h};t.preventDefault(),n.hasClass("ui-state-disabled")||n.hasClass("ui-tabs-loading")||this.running||r&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=o?!1:this.tabs.index(n),this.active=r?e():n,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(n),t),this._toggle(t,u))},_toggle:function(t,i){function s(){n.running=!1,n._trigger("activate",t,i)}function a(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&n.options.show?n._show(r,n.options.show,s):(r.show(),s())}var n=this,r=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),a()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),a()),o.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),r.length&&o.length?i.oldTab.attr("tabIndex",-1):r.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),r.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,a=this.tabs.eq(t),n=a.find(".ui-tabs-anchor"),r=this._getPanelForTab(a),o={tab:a,panel:r};this._isLocal(n[0])||(this.xhr=e.ajax(this._ajaxSettings(n,i,o)),this.xhr&&"canceled"!==this.xhr.statusText&&(a.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){r.html(e),s._trigger("load",i,o)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),a.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,s){var a=this;return{url:t.attr("href"),beforeSend:function(t,n){return a._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:n},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.0",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),a=e.inArray(i,s);-1!==a&&s.splice(a,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,a=this,n=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&a._delay(function(){t&&(t.type=n),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function a(e){l.of=e,n.is(":hidden")||n.position(l)}var n,r,o,h,l=e.extend({},this.options.position);if(s){if(n=this._find(i),n.length)return n.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),n=this._tooltip(i),this._addDescribedBy(i,n.attr("id")),n.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:a}),a(t)):n.position(e.extend({of:i},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(a(l.of),clearInterval(o))},e.fx.interval)),this._trigger("open",t,{tooltip:n}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}},i[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(n)}),t&&"mouseover"!==t.type||(r.mouseleave="close"),t&&"focusin"!==t.type||(r.focusout="close"),this._on(!0,i,r)}},close:function(t){var i=this,s=e(t?t.currentTarget:this.element),a=this._find(s);this.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),a.stop(!0),this._hide(a,this.options.hide,function(){i._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,s){e(s.element).attr("title",s.title),delete i.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:a}),this.closing=!1)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]=t,i},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0),e("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title")||s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}});var v="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),a=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,n){var r,o=n.re.exec(i),h=o&&n.parse(o),l=n.space||"rgba";return h?(r=s[l](h),s[u[l].cache]=r[u[l].cache],a=s._rgba=r._rgba,!1):t}),a.length?("0,0,0,0"===a.join()&&e.extend(a,n.transparent),s):n[i]}function a(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var n,r="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,a){return new e.Color.fn.parse(t,i,s,a)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(a,r,o,h){if(a===t)return this._rgba=[null,null,null,null],this;(a.jquery||a.nodeType)&&(a=e(a).css(r),r=t);var d=this,c=e.type(a),p=this._rgba=[];return r!==t&&(a=[a,r,o,h],c="array"),"string"===c?this.parse(s(a)||n._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(a[t.idx],t)}),this):"object"===c?(a instanceof l?f(u,function(e,t){a[t.cache]&&(d[t.cache]=a[t.cache].slice())}):f(u,function(t,s){var n=s.cache;f(s.props,function(e,t){if(!d[n]&&s.to){if("alpha"===e||null==a[e])return;d[n]=s.to(d._rgba)}d[n][t.idx]=i(a[e],t,!0)}),d[n]&&0>e.inArray(null,d[n].slice(0,3))&&(d[n][3]=1,s.from&&(d._rgba=s.from(d[n])))}),this):t},is:function(e){var i=l(e),s=!0,a=this;return f(u,function(e,n){var r,o=i[n.cache];return o&&(r=a[n.cache]||n.to&&n.to(a._rgba)||[],f(n.props,function(e,i){return null!=o[i.idx]?s=o[i.idx]===r[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),a=s._space(),n=u[a],r=0===this.alpha()?l("transparent"):this,o=r[n.cache]||n.to(r._rgba),h=o.slice();return s=s[n.cache],f(n.props,function(e,a){var n=a.idx,r=o[n],l=s[n],u=d[a.type]||{};null!==l&&(null===r?h[n]=l:(u.mod&&(l-r>u.mod/2?r+=u.mod:r-l>u.mod/2&&(r-=u.mod)),h[n]=i((l-r)*t+r,a)))}),this[a](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),a=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*a[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,a=e[1]/255,n=e[2]/255,r=e[3],o=Math.max(s,a,n),h=Math.min(s,a,n),l=o-h,u=o+h,d=.5*u;return t=h===o?0:s===o?60*(a-n)/l+360:a===o?60*(n-s)/l+120:60*(s-a)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==r?1:r]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],n=e[3],r=.5>=s?s*(1+i):s+i-s*i,o=2*s-r;return[Math.round(255*a(o,r,t+1/3)),Math.round(255*a(o,r,t)),Math.round(255*a(o,r,t-1/3)),n]},f(u,function(s,a){var n=a.props,r=a.cache,h=a.to,u=a.from;l.fn[s]=function(s){if(h&&!this[r]&&(this[r]=h(this._rgba)),s===t)return this[r].slice();var a,o=e.type(s),d="array"===o||"object"===o?s:arguments,c=this[r].slice();return f(n,function(e,t){var s=d["object"===o?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(a=l(u(c)),a[r]=c,a):l(c)},f(n,function(t,i){l.fn[t]||(l.fn[t]=function(a){var n,r=e.type(a),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===r?u:("function"===r&&(a=a.call(this,u),r=e.type(a)),null==a&&i.empty?this:("string"===r&&(n=o.exec(a),n&&(a=u+parseFloat(n[2])*("+"===n[1]?1:-1))),l[i.idx]=a,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,a){var n,r,o="";if("transparent"!==a&&("string"!==e.type(a)||(n=s(a)))){if(a=l(n||a),!c.rgba&&1!==a._rgba[3]){for(r="backgroundColor"===i?t.parentNode:t;(""===o||"transparent"===o)&&r&&r.style;)try{o=e.css(r,"backgroundColor"),r=r.parentNode}catch(h){}a=a.blend(o&&"transparent"!==o?o:"_default")}a=a.toRgbaString()}try{t.style[i]=a}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(r),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},n=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function t(t){var i,s,a=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(a&&a.length&&a[0]&&a[a[0]])for(s=a.length;s--;)i=a[s],"string"==typeof a[i]&&(n[e.camelCase(i)]=a[i]);else for(i in a)"string"==typeof a[i]&&(n[i]=a[i]);return n}function i(t,i){var s,n,r={};for(s in i)n=i[s],t[s]!==n&&(a[s]||(e.fx.step[s]||!isNaN(parseFloat(n)))&&(r[s]=n));return r}var s=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(a,n,r,o){var h=e.speed(n,r,o);return this.queue(function(){var n,r=e(this),o=r.attr("class")||"",l=h.children?r.find("*").addBack():r;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),n=function(){e.each(s,function(e,t){a[t]&&r[t+"Class"](a[t])})},n(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),r.attr("class",o),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){n(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(r[0])})})},e.fn.extend({addClass:function(t){return function(i,s,a,n){return s?e.effects.animateClass.call(this,{add:i},s,a,n):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,a,n){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,a,n):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,a,n,r){return"boolean"==typeof s||void 0===s?a?e.effects.animateClass.call(this,s?{add:i}:{remove:i},a,n,r):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,a,n)}}(e.fn.toggleClass),switchClass:function(t,i,s,a,n){return e.effects.animateClass.call(this,{add:i,remove:t},s,a,n)}})}(),function(){function t(t,i,s,a){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(a=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(a=s,s=i,i={}),e.isFunction(s)&&(a=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=a||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.0",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(v+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(v+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),a={width:t.width(),height:t.height()},n=document.activeElement;try{n.id}catch(r){n=document.body}return t.wrap(s),(t[0]===n||e.contains(t[0],n))&&e(n).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(a),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,a){return a=a||{},e.each(i,function(e,i){var n=t.cssUnit(i);n[0]>0&&(a[i]=n[0]*s+n[1])}),a}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(n)&&n.call(a[0]),e.isFunction(t)&&t()}var a=e(this),n=s.complete,o=s.mode;(a.is(":hidden")?"hide"===o:"show"===o)?(a[o](),i()):r.call(a[0],s,i)}var s=t.apply(this,arguments),a=s.mode,n=s.queue,r=e.effects.effect[s.effect];return e.fx.off||!r?a?this[a](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):n===!1?this.each(i):this.queue(n||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="show",this.effect.call(this,a)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="hide",this.effect.call(this,a)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var a=t.apply(this,arguments);return a.mode="toggle",this.effect.call(this,a)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,a,n,r=e(this),o=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(r,t.mode||"hide"),d=t.direction||"up",c=o.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;r.parent().is(".ui-effects-wrapper")?e.effects.save(r.parent(),l):e.effects.save(r,l),r.show(),s=e.effects.createWrapper(r).css({overflow:"hidden"}),a=s[p](),n=parseFloat(s.css(f))||0,g[p]=v?a:0,m||(r.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?n:a+n),v&&(s.css(p,0),m||s.css(f,n+a)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&r.hide(),e.effects.restore(r,l),e.effects.removeWrapper(r),i()}})},e.effects.effect.bounce=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(r,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=r.queue(),_=b.length;for((u||l)&&o.push("opacity"),e.effects.save(r,o),r.show(),e.effects.createWrapper(r),c||(c=r["top"===v?"outerHeight":"outerWidth"]()/3),u&&(n={opacity:1},n[v]=0,r.css("opacity",0).css(v,y?2*-c:2*c).animate(n,m,g)),l&&(c/=Math.pow(2,p-1)),n={},n[v]=0,s=0;p>s;s++)a={},a[v]=(y?"-=":"+=")+c,r.animate(a,m,g).animate(n,m,g),c=l?2*c:c/2;l&&(a={opacity:0},a[v]=(y?"-=":"+=")+c,r.animate(a,m,g)),r.queue(function(){l&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),r.dequeue()},e.effects.effect.clip=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(r,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(r,o),r.show(),s=e.effects.createWrapper(r).css({overflow:"hidden"}),a="IMG"===r[0].tagName?s:r,n=a[c](),l&&(a.css(c,0),a.css(p,n/2)),f[c]=l?n:0,f[p]=l?0:n/2,a.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})},e.effects.effect.drop=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","opacity","height","width"],r=e.effects.setMode(a,t.mode||"hide"),o="show"===r,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:o?1:0};e.effects.save(a,n),a.show(),e.effects.createWrapper(a),s=t.distance||a["top"===l?"outerHeight":"outerWidth"](!0)/2,o&&a.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(o?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,a.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&a()}function a(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var n,r,o,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(n=0;d>n;n++)for(h=g.top+n*y,u=n-(d-1)/2,r=0;c>r;r++)o=g.left+r*v,l=r-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-r*v,top:-n*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:o+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:o+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:a},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,a,n=e(this),r=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"hide"),h="show"===o,l="hide"===o,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(n,r),n.show(),s=e.effects.createWrapper(n).css({overflow:"hidden"}),a=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*a[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?a[0]:u,v[f[1]]=h?a[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),a=["backgroundImage","backgroundColor","opacity"],n=e.effects.setMode(s,t.mode||"show"),r={backgroundColor:s.css("backgroundColor")};"hide"===n&&(r.opacity=0),e.effects.save(s,a),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(r,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&s.hide(),e.effects.restore(s,a),i()}})},e.effects.effect.size=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(r,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=r.css("position"),y=f?o:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&r.show(),s={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},"toggle"===t.mode&&"show"===p?(r.from=t.to||b,r.to=t.from||s):(r.from=t.from||("show"===p?b:s),r.to=t.to||("hide"===p?b:s)),n={from:{y:r.from.height/s.height,x:r.from.width/s.width},to:{y:r.to.height/s.height,x:r.to.width/s.width}},("box"===m||"both"===m)&&(n.from.y!==n.to.y&&(y=y.concat(d),r.from=e.effects.setTransition(r,d,n.from.y,r.from),r.to=e.effects.setTransition(r,d,n.to.y,r.to)),n.from.x!==n.to.x&&(y=y.concat(c),r.from=e.effects.setTransition(r,c,n.from.x,r.from),r.to=e.effects.setTransition(r,c,n.to.x,r.to))),("content"===m||"both"===m)&&n.from.y!==n.to.y&&(y=y.concat(u).concat(l),r.from=e.effects.setTransition(r,u,n.from.y,r.from),r.to=e.effects.setTransition(r,u,n.to.y,r.to)),e.effects.save(r,y),r.show(),e.effects.createWrapper(r),r.css("overflow","hidden").css(r.from),g&&(a=e.effects.getBaseline(g,s),r.from.top=(s.outerHeight-r.outerHeight())*a.y,r.from.left=(s.outerWidth-r.outerWidth())*a.x,r.to.top=(s.outerHeight-r.to.outerHeight)*a.y,r.to.left=(s.outerWidth-r.to.outerWidth)*a.x),r.css(r.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=o.concat(d).concat(c),r.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,l),i.from={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},i.to={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x},n.from.y!==n.to.y&&(i.from=e.effects.setTransition(i,d,n.from.y,i.from),i.to=e.effects.setTransition(i,d,n.to.y,i.to)),n.from.x!==n.to.x&&(i.from=e.effects.setTransition(i,c,n.from.x,i.from),i.to=e.effects.setTransition(i,c,n.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),r.animate(r.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===r.to.opacity&&r.css("opacity",r.from.opacity),"hide"===p&&r.hide(),e.effects.restore(r,y),f||("static"===v?r.css({position:"relative",top:r.to.top,left:r.to.left}):e.each(["top","left"],function(e,t){r.css(t,function(t,i){var s=parseInt(i,10),a=e?r.to.left:r.to.top;return"auto"===i?a+"px":s+a+"px"})})),e.effects.removeWrapper(r),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),a=e.extend(!0,{},t),n=e.effects.setMode(s,t.mode||"effect"),r=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===n?0:100),o=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==o?r/100:1,x:"vertical"!==o?r/100:1};a.effect="size",a.queue=!1,a.complete=i,"effect"!==n&&(a.origin=h||["middle","center"],a.restore=!0),a.from=t.from||("show"===n?{height:0,width:0,outerHeight:0,outerWidth:0}:l),a.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},a.fade&&("show"===n&&(a.from.opacity=0,a.to.opacity=1),"hide"===n&&(a.from.opacity=1,a.to.opacity=0)),s.effect(a)},e.effects.effect.puff=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"hide"),n="hide"===a,r=parseInt(t.percent,10)||150,o=r/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:a,complete:i,percent:n?r:100,from:n?h:{height:h.height*o,width:h.width*o,outerHeight:h.outerHeight*o,outerWidth:h.outerWidth*o}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,a=e(this),n=e.effects.setMode(a,t.mode||"show"),r="show"===n,o="hide"===n,h=r||"hide"===n,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=a.queue(),p=c.length;for((r||!a.is(":visible"))&&(a.css("opacity",0).show(),d=1),s=1;l>s;s++)a.animate({opacity:d},u,t.easing),d=1-d;a.animate({opacity:d},u,t.easing),a.queue(function(){o&&a.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),a.dequeue()},e.effects.effect.shake=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"effect"),o=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,f={},m={},g={},v=a.queue(),y=v.length;for(e.effects.save(a,n),a.show(),e.effects.createWrapper(a),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,a.animate(f,d,t.easing),s=1;l>s;s++)a.animate(m,d,t.easing).animate(g,d,t.easing);a.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),a.dequeue()},e.effects.effect.slide=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","width","height"],r=e.effects.setMode(a,t.mode||"show"),o="show"===r,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(a,n),a.show(),s=t.distance||a["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(a).css({overflow:"hidden"}),o&&a.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(o?u?"+=":"-=":u?"-=":"+=")+s,a.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),a=e(t.to),n="fixed"===a.css("position"),r=e("body"),o=n?r.scrollTop():0,h=n?r.scrollLeft():0,l=a.offset(),u={top:l.top-o,left:l.left-h,height:a.innerHeight(),width:a.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-o,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:n?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}});jQuery.fn.collapse=function(options){var defaults={closed:false}
settings=jQuery.extend({},defaults,options);return this.each(function(){var obj=jQuery(this);if(obj.hasClass('collapsed')){obj.children().not('legend').hide();}
obj.find("legend:first").addClass('collapsible').css("cursor","pointer").click(function(){if(obj.hasClass('collapsed')){obj.removeClass('collapsed').addClass('collapsible');}
jQuery(this).removeClass('collapsed');obj.children().not('legend').toggle("slow",function(){if(jQuery(this).is(":visible"))
obj.find("legend:first").addClass('collapsible');else
obj.addClass('collapsed').find("legend").addClass('collapsed');});});if(settings.closed){obj.addClass('collapsed').find("legend:first").addClass('collapsed');obj.children().not("legend:first").css('display','none');}});};(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):b(jQuery)})(function(b){var j=[],n=b(document),k=navigator.userAgent.toLowerCase(),l=b(window),g=[],o=null,p=/msie/.test(k)&&!/opera/.test(k),q=/opera/.test(k),m,r;m=p&&/msie 6./.test(k)&&"object"!==typeof window.XMLHttpRequest;r=p&&/msie 7.0/.test(k);b.modal=function(a,h){return b.modal.impl.init(a,h)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions=function(){b.modal.impl.setContainerDimensions()};b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,h){b.modal.impl.update(a,h)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1E3,close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,h){if(this.d.data)return!1;o=p&&!b.support.boxModel;this.o=b.extend({},b.modal.defaults,h);this.zIndex=this.o.zIndex;this.occb=!1;if("object"===typeof a){if(a=a instanceof b?a:b(a),this.d.placeholder=!1,0<a.parent().parent().size()&&(a.before(b("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),this.d.placeholder=!0,this.display=a.css("display"),!this.o.persist))this.d.orig=a.clone(!0)}else if("string"===typeof a||"number"===typeof a)a=b("<div></div>").html(a);else return alert("SimpleModal Error: Unsupported data type: "+typeof a),this;this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){this.getDimensions();if(this.o.modal&&m)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:g[0],width:g[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?j[0]:0,width:this.o.modal?j[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend({position:this.o.fixed?"fixed":"absolute"},this.o.containerCss,{display:"none",zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();this.d.data.appendTo(this.d.wrap);(m||o)&&this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});n.bind("keydown.simplemodal",function(b){a.o.modal&&9===b.keyCode?a.watchTab(b):a.o.close&&a.o.escClose&&27===b.keyCode&&(b.preventDefault(),a.close())});l.bind("resize.simplemodal orientationchange.simplemodal",function(){a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();m||o?a.fixIE():a.o.modal&&(a.d.iframe&&a.d.iframe.css({height:g[0],width:g[1]}),a.d.overlay.css({height:j[0],width:j[1]}))})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");n.unbind("keydown.simplemodal");l.unbind(".simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay,"fixed"===this.d.container.css("position")?this.d.container:null],function(b,e){if(e){var f=e[0].style;f.position="absolute";if(2>b)f.removeExpression("height"),f.removeExpression("width"),f.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'),f.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"');else{var c,d;a&&a.constructor===Array?(c=a[0]?"number"===typeof a[0]?a[0].toString():a[0].replace(/px/,""):e.css("top").replace(/px/,""),c=-1===c.indexOf("%")?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',a[1]&&(d="number"===typeof a[1]?a[1].toString():a[1].replace(/px/,""),d=-1===d.indexOf("%")?d+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(d.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')):(c='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',d='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"');f.removeExpression("top");f.removeExpression("left");f.setExpression("top",c);f.setExpression("left",d)}}})},focus:function(a){var h=this,a=a&&-1!==b.inArray(a,["first","last"])?a:"first",e=b(":input:enabled:visible:"+a,h.d.wrap);setTimeout(function(){0<e.length?e.focus():h.d.wrap.focus()},10)},getDimensions:function(){var a="undefined"===typeof window.innerHeight?l.height():window.innerHeight;j=[n.height(),n.width()];g=[a,l.width()]},getVal:function(a,b){return a?"number"===typeof a?a:"auto"===a?0:0<a.indexOf("%")?parseInt(a.replace(/%/,""))/100*("h"===b?g[0]:g[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){if(!this.d.data)return!1;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(b,"w");this.d.data.hide();a&&this.d.container.css("height",a);b&&this.d.container.css("width",b);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=m||r,b=this.d.origHeight?this.d.origHeight:q?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h"),a=this.d.origWidth?this.d.origWidth:q?this.d.container.width():this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w"),e=this.d.data.outerHeight(!0),f=this.d.data.outerWidth(!0);this.d.origHeight=this.d.origHeight||b;this.d.origWidth=this.d.origWidth||a;var c=this.o.maxHeight?this.getVal(this.o.maxHeight,"h"):null,d=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null,c=c&&c<g[0]?c:g[0],d=d&&d<g[1]?d:g[1],i=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto",b=b?this.o.autoResize&&b>c?c:b<i?i:b:e?e>c?c:this.o.minHeight&&"auto"!==i&&e<i?i:e:i,c=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto",a=a?this.o.autoResize&&a>d?d:a<c?c:a:f?f>d?d:this.o.minWidth&&"auto"!==c&&f<c?c:f:c;this.d.container.css({height:b,width:a});this.d.wrap.css({overflow:e>b||f>a?"auto":"visible"});this.o.autoPosition&&this.setPosition()},setPosition:function(){var a,b;a=g[0]/2-this.d.container.outerHeight(!0)/2;b=g[1]/2-this.d.container.outerWidth(!0)/2;var e="fixed"!==this.d.container.css("position")?l.scrollTop():0;this.o.position&&"[object Array]"===Object.prototype.toString.call(this.o.position)?(a=e+(this.o.position[0]||a),b=this.o.position[1]||b):a=e+a;this.d.container.css({left:b,top:a})},watchTab:function(a){if(0<b(a.target).parents(".simplemodal-container").length){if(this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]),!a.shiftKey&&a.target===this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||0===this.inputs.length)a.preventDefault(),this.focus(a.shiftKey?"last":"first")}else a.preventDefault(),this.focus()},open:function(){this.d.iframe&&this.d.iframe.show();b.isFunction(this.o.onOpen)?this.o.onOpen.apply(this,[this.d]):(this.d.overlay.show(),this.d.container.show(),this.d.data.show());this.o.focus&&this.focus();this.bindEvents()},close:function(){if(!this.d.data)return!1;this.unbindEvents();if(b.isFunction(this.o.onClose)&&!this.occb)this.occb=!0,this.o.onClose.apply(this,[this.d]);else{if(this.d.placeholder){var a=b("#simplemodal-placeholder");this.o.persist?a.replaceWith(this.d.data.removeClass("simplemodal-data").css("display",this.display)):(this.d.data.hide().remove(),a.replaceWith(this.d.orig))}else this.d.data.hide().remove();this.d.container.hide().remove();this.d.overlay.hide();this.d.iframe&&this.d.iframe.hide().remove();this.d.overlay.remove();this.d={}}}}});(function($){var abs=Math.abs,max=Math.max,min=Math.min,round=Math.round;function div(){return $('<div/>')}$.imgAreaSelect=function(img,options){var $img=$(img),imgLoaded,$box=div(),$area=div(),$border=div().add(div()).add(div()).add(div()),$outer=div().add(div()).add(div()).add(div()),$handles=$([]),$areaOpera,left,top,imgOfs={left:0,top:0},imgWidth,imgHeight,$parent,parOfs={left:0,top:0},zIndex=0,position='absolute',startX,startY,scaleX,scaleY,resize,minWidth,minHeight,maxWidth,maxHeight,aspectRatio,shown,x1,y1,x2,y2,selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0},docElem=document.documentElement,ua=navigator.userAgent,$p,d,i,o,w,h,adjusted;function viewX(x){return x+imgOfs.left-parOfs.left}function viewY(y){return y+imgOfs.top-parOfs.top}function selX(x){return x-imgOfs.left+parOfs.left}function selY(y){return y-imgOfs.top+parOfs.top}function evX(event){return event.pageX-parOfs.left}function evY(event){return event.pageY-parOfs.top}function getSelection(noScale){var sx=noScale||scaleX,sy=noScale||scaleY;return{x1:round(selection.x1*sx),y1:round(selection.y1*sy),x2:round(selection.x2*sx),y2:round(selection.y2*sy),width:round(selection.x2*sx)-round(selection.x1*sx),height:round(selection.y2*sy)-round(selection.y1*sy)}}function setSelection(x1,y1,x2,y2,noScale){var sx=noScale||scaleX,sy=noScale||scaleY;selection={x1:round(x1/sx||0),y1:round(y1/sy||0),x2:round(x2/sx||0),y2:round(y2/sy||0)};selection.width=selection.x2-selection.x1;selection.height=selection.y2-selection.y1}function adjust(){if(!imgLoaded||!$img.width())return;imgOfs={left:round($img.offset().left),top:round($img.offset().top)};imgWidth=$img.innerWidth();imgHeight=$img.innerHeight();imgOfs.top+=($img.outerHeight()-imgHeight)>>1;imgOfs.left+=($img.outerWidth()-imgWidth)>>1;minWidth=round(options.minWidth/scaleX)||0;minHeight=round(options.minHeight/scaleY)||0;maxWidth=round(min(options.maxWidth/scaleX||1<<24,imgWidth));maxHeight=round(min(options.maxHeight/scaleY||1<<24,imgHeight));if($().jquery=='1.3.2'&&position=='fixed'&&!docElem['getBoundingClientRect']){imgOfs.top+=max(document.body.scrollTop,docElem.scrollTop);imgOfs.left+=max(document.body.scrollLeft,docElem.scrollLeft)}parOfs=/absolute|relative/.test($parent.css('position'))?{left:round($parent.offset().left)-$parent.scrollLeft(),top:round($parent.offset().top)-$parent.scrollTop()}:position=='fixed'?{left:$(document).scrollLeft(),top:$(document).scrollTop()}:{left:0,top:0};left=viewX(0);top=viewY(0);if(selection.x2>imgWidth||selection.y2>imgHeight)doResize()}function update(resetKeyPress){if(!shown)return;$box.css({left:viewX(selection.x1),top:viewY(selection.y1)}).add($area).width(w=selection.width).height(h=selection.height);$area.add($border).add($handles).css({left:0,top:0});$border.width(max(w-$border.outerWidth()+$border.innerWidth(),0)).height(max(h-$border.outerHeight()+$border.innerHeight(),0));$($outer[0]).css({left:left,top:top,width:selection.x1,height:imgHeight});$($outer[1]).css({left:left+selection.x1,top:top,width:w,height:selection.y1});$($outer[2]).css({left:left+selection.x2,top:top,width:imgWidth-selection.x2,height:imgHeight});$($outer[3]).css({left:left+selection.x1,top:top+selection.y2,width:w,height:imgHeight-selection.y2});w-=$handles.outerWidth();h-=$handles.outerHeight();switch($handles.length){case 8:$($handles[4]).css({left:w>>1});$($handles[5]).css({left:w,top:h>>1});$($handles[6]).css({left:w>>1,top:h});$($handles[7]).css({top:h>>1});case 4:$handles.slice(1,3).css({left:w});$handles.slice(2,4).css({top:h})}if(resetKeyPress!==false){if($.imgAreaSelect.onKeyPress!=docKeyPress)$(document).unbind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress);if(options.keys)$(document)[$.imgAreaSelect.keyPress]($.imgAreaSelect.onKeyPress=docKeyPress)}if(msie&&$border.outerWidth()-$border.innerWidth()==2){$border.css('margin',0);setTimeout(function(){$border.css('margin','auto')},0)}}function doUpdate(resetKeyPress){adjust();update(resetKeyPress);x1=viewX(selection.x1);y1=viewY(selection.y1);x2=viewX(selection.x2);y2=viewY(selection.y2)}function hide($elem,fn){options.fadeSpeed?$elem.fadeOut(options.fadeSpeed,fn):$elem.hide()}function areaMouseMove(event){var x=selX(evX(event))-selection.x1,y=selY(evY(event))-selection.y1;if(!adjusted){adjust();adjusted=true;$box.one('mouseout',function(){adjusted=false})}resize='';if(options.resizable){if(y<=options.resizeMargin)resize='n';else if(y>=selection.height-options.resizeMargin)resize='s';if(x<=options.resizeMargin)resize+='w';else if(x>=selection.width-options.resizeMargin)resize+='e'}$box.css('cursor',resize?resize+'-resize':options.movable?'move':'');if($areaOpera)$areaOpera.toggle()}function docMouseUp(event){$('body').css('cursor','');if(options.autoHide||selection.width*selection.height==0)hide($box.add($outer),function(){$(this).hide()});$(document).unbind('mousemove',selectingMouseMove);$box.mousemove(areaMouseMove);options.onSelectEnd(img,getSelection())}function areaMouseDown(event){if(event.which!=1)return false;adjust();if(resize){$('body').css('cursor',resize+'-resize');x1=viewX(selection[/w/.test(resize)?'x2':'x1']);y1=viewY(selection[/n/.test(resize)?'y2':'y1']);$(document).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove)}else if(options.movable){startX=left+selection.x1-evX(event);startY=top+selection.y1-evY(event);$box.unbind('mousemove',areaMouseMove);$(document).mousemove(movingMouseMove).one('mouseup',function(){options.onSelectEnd(img,getSelection());$(document).unbind('mousemove',movingMouseMove);$box.mousemove(areaMouseMove)})}else $img.mousedown(event);return false}function fixAspectRatio(xFirst){if(aspectRatio)if(xFirst){x2=max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1)));y2=round(max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1))));x2=round(x2)}else{y2=max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1)));x2=round(max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1))));y2=round(y2)}}function doResize(){x1=min(x1,left+imgWidth);y1=min(y1,top+imgHeight);if(abs(x2-x1)<minWidth){x2=x1-minWidth*(x2<x1||-1);if(x2<left)x1=left+minWidth;else if(x2>left+imgWidth)x1=left+imgWidth-minWidth}if(abs(y2-y1)<minHeight){y2=y1-minHeight*(y2<y1||-1);if(y2<top)y1=top+minHeight;else if(y2>top+imgHeight)y1=top+imgHeight-minHeight}x2=max(left,min(x2,left+imgWidth));y2=max(top,min(y2,top+imgHeight));fixAspectRatio(abs(x2-x1)<abs(y2-y1)*aspectRatio);if(abs(x2-x1)>maxWidth){x2=x1-maxWidth*(x2<x1||-1);fixAspectRatio()}if(abs(y2-y1)>maxHeight){y2=y1-maxHeight*(y2<y1||-1);fixAspectRatio(true)}selection={x1:selX(min(x1,x2)),x2:selX(max(x1,x2)),y1:selY(min(y1,y2)),y2:selY(max(y1,y2)),width:abs(x2-x1),height:abs(y2-y1)};update();options.onSelectChange(img,getSelection())}function selectingMouseMove(event){x2=/w|e|^$/.test(resize)||aspectRatio?evX(event):viewX(selection.x2);y2=/n|s|^$/.test(resize)||aspectRatio?evY(event):viewY(selection.y2);doResize();return false}function doMove(newX1,newY1){x2=(x1=newX1)+selection.width;y2=(y1=newY1)+selection.height;$.extend(selection,{x1:selX(x1),y1:selY(y1),x2:selX(x2),y2:selY(y2)});update();options.onSelectChange(img,getSelection())}function movingMouseMove(event){x1=max(left,min(startX+evX(event),left+imgWidth-selection.width));y1=max(top,min(startY+evY(event),top+imgHeight-selection.height));doMove(x1,y1);event.preventDefault();return false}function startSelection(){$(document).unbind('mousemove',startSelection);adjust();x2=x1;y2=y1;doResize();resize='';if(!$outer.is(':visible'))$box.add($outer).hide().fadeIn(options.fadeSpeed||0);shown=true;$(document).unbind('mouseup',cancelSelection).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove);options.onSelectStart(img,getSelection())}function cancelSelection(){$(document).unbind('mousemove',startSelection).unbind('mouseup',cancelSelection);hide($box.add($outer));setSelection(selX(x1),selY(y1),selX(x1),selY(y1));if(!(this instanceof $.imgAreaSelect)){options.onSelectChange(img,getSelection());options.onSelectEnd(img,getSelection())}}function imgMouseDown(event){if(event.which!=1||$outer.is(':animated'))return false;adjust();startX=x1=evX(event);startY=y1=evY(event);$(document).mousemove(startSelection).mouseup(cancelSelection);return false}function windowResize(){doUpdate(false)}function imgLoad(){imgLoaded=true;setOptions(options=$.extend({classPrefix:'imgareaselect',movable:true,parent:'body',resizable:true,resizeMargin:10,onInit:function(){},onSelectStart:function(){},onSelectChange:function(){},onSelectEnd:function(){}},options));$box.add($outer).css({visibility:''});if(options.show){shown=true;adjust();update();$box.add($outer).hide().fadeIn(options.fadeSpeed||0)}setTimeout(function(){options.onInit(img,getSelection())},0)}var docKeyPress=function(event){var k=options.keys,d,t,key=event.keyCode;d=!isNaN(k.alt)&&(event.altKey||event.originalEvent.altKey)?k.alt:!isNaN(k.ctrl)&&event.ctrlKey?k.ctrl:!isNaN(k.shift)&&event.shiftKey?k.shift:!isNaN(k.arrows)?k.arrows:10;if(k.arrows=='resize'||(k.shift=='resize'&&event.shiftKey)||(k.ctrl=='resize'&&event.ctrlKey)||(k.alt=='resize'&&(event.altKey||event.originalEvent.altKey))){switch(key){case 37:d=-d;case 39:t=max(x1,x2);x1=min(x1,x2);x2=max(t+d,x1);fixAspectRatio();break;case 38:d=-d;case 40:t=max(y1,y2);y1=min(y1,y2);y2=max(t+d,y1);fixAspectRatio(true);break;default:return}doResize()}else{x1=min(x1,x2);y1=min(y1,y2);switch(key){case 37:doMove(max(x1-d,left),y1);break;case 38:doMove(x1,max(y1-d,top));break;case 39:doMove(x1+min(d,imgWidth-selX(x2)),y1);break;case 40:doMove(x1,y1+min(d,imgHeight-selY(y2)));break;default:return}}return false};function styleOptions($elem,props){for(var option in props)if(options[option]!==undefined)$elem.css(props[option],options[option])}function setOptions(newOptions){if(newOptions.parent)($parent=$(newOptions.parent)).append($box.add($outer));$.extend(options,newOptions);adjust();if(newOptions.handles!=null){$handles.remove();$handles=$([]);i=newOptions.handles?newOptions.handles=='corners'?4:8:0;while(i--)$handles=$handles.add(div());$handles.addClass(options.classPrefix+'-handle').css({position:'absolute',fontSize:0,zIndex:zIndex+1||1});if(!parseInt($handles.css('width'))>=0)$handles.width(5).height(5);if(o=options.borderWidth)$handles.css({borderWidth:o,borderStyle:'solid'});styleOptions($handles,{borderColor1:'border-color',borderColor2:'background-color',borderOpacity:'opacity'})}scaleX=options.imageWidth/imgWidth||1;scaleY=options.imageHeight/imgHeight||1;if(newOptions.x1!=null){setSelection(newOptions.x1,newOptions.y1,newOptions.x2,newOptions.y2);newOptions.show=!newOptions.hide}if(newOptions.keys)options.keys=$.extend({shift:1,ctrl:'resize'},newOptions.keys);$outer.addClass(options.classPrefix+'-outer');$area.addClass(options.classPrefix+'-selection');for(i=0;i++<4;)$($border[i-1]).addClass(options.classPrefix+'-border'+i);styleOptions($area,{selectionColor:'background-color',selectionOpacity:'opacity'});styleOptions($border,{borderOpacity:'opacity',borderWidth:'border-width'});styleOptions($outer,{outerColor:'background-color',outerOpacity:'opacity'});if(o=options.borderColor1)$($border[0]).css({borderStyle:'solid',borderColor:o});if(o=options.borderColor2)$($border[1]).css({borderStyle:'dashed',borderColor:o});$box.append($area.add($border).add($areaOpera)).append($handles);if(msie){if(o=($outer.css('filter')||'').match(/opacity=(\d+)/))$outer.css('opacity',o[1]/100);if(o=($border.css('filter')||'').match(/opacity=(\d+)/))$border.css('opacity',o[1]/100)}if(newOptions.hide)hide($box.add($outer));else if(newOptions.show&&imgLoaded){shown=true;$box.add($outer).fadeIn(options.fadeSpeed||0);doUpdate()}aspectRatio=(d=(options.aspectRatio||'').split(/:/))[0]/d[1];$img.add($outer).unbind('mousedown',imgMouseDown);if(options.disable||options.enable===false){$box.unbind('mousemove',areaMouseMove).unbind('mousedown',areaMouseDown);$(window).unbind('resize',windowResize)}else{if(options.enable||options.disable===false){if(options.resizable||options.movable)$box.mousemove(areaMouseMove).mousedown(areaMouseDown);$(window).resize(windowResize)}if(!options.persistent)$img.add($outer).mousedown(imgMouseDown)}options.enable=options.disable=undefined}this.remove=function(){setOptions({disable:true});$box.add($outer).remove()};this.getOptions=function(){return options};this.setOptions=setOptions;this.getSelection=getSelection;this.setSelection=setSelection;this.cancelSelection=cancelSelection;this.update=doUpdate;var msie=(/msie ([\w.]+)/i.exec(ua)||[])[1],opera=/opera/i.test(ua),safari=/webkit/i.test(ua)&&!/chrome/i.test(ua);$p=$img;while($p.length){zIndex=max(zIndex,!isNaN($p.css('z-index'))?$p.css('z-index'):zIndex);if($p.css('position')=='fixed')position='fixed';$p=$p.parent(':not(body)')}zIndex=options.zIndex||zIndex;if(msie)$img.attr('unselectable','on');$.imgAreaSelect.keyPress=msie||safari?'keydown':'keypress';if(opera)$areaOpera=div().css({width:'100%',height:'100%',position:'absolute',zIndex:zIndex+2||2});$box.add($outer).css({visibility:'hidden',position:position,overflow:'hidden',zIndex:zIndex||'0'});$box.css({zIndex:zIndex+2||2});$area.add($border).css({position:'absolute',fontSize:0});img.complete||img.readyState=='complete'||!$img.is('img')?imgLoad():$img.one('load',imgLoad);if(!imgLoaded&&msie&&msie>=7)img.src=img.src};$.fn.imgAreaSelect=function(options){options=options||{};this.each(function(){if($(this).data('imgAreaSelect')){if(options.remove){$(this).data('imgAreaSelect').remove();$(this).removeData('imgAreaSelect')}else $(this).data('imgAreaSelect').setOptions(options)}else if(!options.remove){if(options.enable===undefined&&options.disable===undefined)options.enable=true;$(this).data('imgAreaSelect',new $.imgAreaSelect(this,options))}});if(options.instance)return $(this).data('imgAreaSelect');return this}})(jQuery);Ext={version:'2.3.0'};window["undefined"]=window["undefined"];Ext.apply=function(o,c,defaults){if(defaults){Ext.apply(o,defaults);}
if(o&&c&&typeof c=='object'){for(var p in c){o[p]=c[p];}}
return o;};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase(),check=function(r){return r.test(ua);},isStrict=document.compatMode=="CSS1Compat",isOpera=check(/opera/),isChrome=check(/chrome/),isWebKit=check(/webkit/),isSafari=!isChrome&&check(/safari/),isSafari2=isSafari&&check(/applewebkit\/4/),isSafari3=isSafari&&check(/version\/3/),isSafari4=isSafari&&check(/version\/4/),isIE=!isOpera&&check(/msie/),isIE7=isIE&&check(/msie 7/),isIE8=isIE&&check(/msie 8/),isIE6=isIE&&!isIE7&&!isIE8,isGecko=!isWebKit&&check(/gecko/),isGecko2=isGecko&&check(/rv:1\.8/),isGecko3=isGecko&&check(/rv:1\.9/),isBorderBox=isIE&&!isStrict,isWindows=check(/windows|win32/),isMac=check(/macintosh|mac os x/),isAir=check(/adobeair/),isLinux=check(/linux/),isSecure=/^https/i.test(window.location.protocol);if(isIE6){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
Ext.apply(Ext,{isStrict:isStrict,isSecure:isSecure,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}
return o;},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o);});return;}
var cache={};for(var b in o){var parts=b.split('@');if(parts[1]){var s=parts[0];if(!cache[s]){cache[s]=Ext.select(s);}
cache[s].on(parts[1],o[b]);}}
cache=null;},id:function(el,prefix){prefix=prefix||"ext-gen";el=Ext.getDom(el);var id=prefix+(++idSeed);return el?(el.id?el.id:(el.id=id)):id;},extend:function(){var io=function(o){for(var m in o){this[m]=o[m];}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=='object'){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments);};}
var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp;}
sb.override=function(o){Ext.override(sb,o);};sbp.override=io;Ext.override(sb,overrides);sb.extend=function(o){Ext.extend(sb,o);};return sb;};}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method];}
if(Ext.isIE&&overrides.toString!=origclass.toString){p.toString=overrides.toString;}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval('if (typeof '+rt+' == "undefined"){'+rt+' = {};} o = '+rt+';');for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},urlEncode:function(o){if(!o){return"";}
var buf=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=='undefined'){buf.push(k,"=&");}else if(type!="function"&&type!="object"){buf.push(k,"=",encodeURIComponent(ov),"&");}else if(Ext.isDate(ov)){var s=Ext.encode(ov).replace(/"/g,'');buf.push(k,"=",s,"&");}else if(Ext.isArray(ov)){if(ov.length){for(var i=0,len=ov.length;i<len;i++){buf.push(k,"=",encodeURIComponent(ov[i]===undefined?'':ov[i]),"&");}}else{buf.push(k,"=&");}}}
buf.pop();return buf.join("");},urlDecode:function(string,overwrite){if(!string||!string.length){return{};}
var obj={};var pairs=string.split('&');var pair,name,value;for(var i=0,len=pairs.length;i<len;i++){pair=pairs[i].split('=');name=decodeURIComponent(pair[0]);value=decodeURIComponent(pair[1]);if(overwrite!==true){if(typeof obj[name]=="undefined"){obj[name]=value;}else if(typeof obj[name]=="string"){obj[name]=[obj[name]];obj[name].push(value);}else{obj[name].push(value);}}else{obj[name]=value;}}
return obj;},each:function(array,fn,scope){if(typeof array.length=="undefined"||typeof array=="string"){array=[array];}
for(var i=0,len=array.length;i<len;i++){if(fn.call(scope||array[i],array[i],i,array)===false){return i;};}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(Ext.isArray(a)){r=r.concat(a);}else if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0));}else{r.push(a);}}
return r;},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");},callback:function(cb,scope,args,delay){if(typeof cb=="function"){if(delay){cb.defer(delay,scope,args||[]);}else{cb.apply(scope,args||[]);}}},getDom:function(el){if(!el||!document){return null;}
return el.dom?el.dom:(typeof el=='string'?document.getElementById(el):el);},getDoc:function(){return Ext.get(document);},getBody:function(){return Ext.get(document.body||document.documentElement);},getCmp:function(id){return Ext.ComponentMgr.get(id);},num:function(v,defaultValue){v=Number(v==null||typeof v=='boolean'?NaN:v);return isNaN(v)?defaultValue:v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(typeof as.destroy=='function'){as.destroy();}
else if(as.dom){as.removeAllListeners();as.remove();}}}},removeNode:isIE?function(){var d;return function(n){if(n&&n.tagName!='BODY'){d=d||document.createElement('div');d.appendChild(n);d.innerHTML='';}}}():function(n){if(n&&n.parentNode&&n.tagName!='BODY'){n.parentNode.removeChild(n);}},type:function(o){if(o===undefined||o===null){return false;}
if(o.htmlElement){return'element';}
var t=typeof o;if(t=='object'&&o.nodeName){switch(o.nodeType){case 1:return'element';case 3:return(/\S/).test(o.nodeValue)?'textnode':'whitespace';}}
if(t=='object'||t=='function'){switch(o.constructor){case Array:return'array';case RegExp:return'regexp';case Date:return'date';}
if(typeof o.length=='number'&&typeof o.item=='function'){return'nodelist';}}
return t;},isEmpty:function(v,allowBlank){return v===null||v===undefined||(!allowBlank?v==='':false);},value:function(v,defaultValue,allowBlank){return Ext.isEmpty(v,allowBlank)?defaultValue:v;},isArray:function(v){return v&&typeof v.length=='number'&&typeof v.splice=='function';},isDate:function(v){return v&&typeof v.getFullYear=='function';},isOpera:isOpera,isWebKit:isWebKit,isChrome:isChrome,isSafari:isSafari,isSafari4:isSafari4,isSafari3:isSafari3,isSafari2:isSafari2,isIE:isIE,isIE6:isIE6,isIE7:isIE7,isIE8:isIE8,isGecko:isGecko,isGecko2:isGecko2,isGecko3:isGecko3,isBorderBox:isBorderBox,isLinux:isLinux,isWindows:isWindows,isMac:isMac,isAir:isAir,useShims:((isIE&&!(isIE7||isIE8))||(isMac&&isGecko&&!isGecko3))});Ext.ns=Ext.namespace;})();Ext.ns("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout","Ext.app","Ext.ux");Ext.apply(Function.prototype,{createCallback:function(){var args=arguments;var method=this;return function(){return method.apply(window,args);};},createDelegate:function(obj,args,appendArgs){var method=this;return function(){var callArgs=args||arguments;if(appendArgs===true){callArgs=Array.prototype.slice.call(arguments,0);callArgs=callArgs.concat(args);}else if(typeof appendArgs=="number"){callArgs=Array.prototype.slice.call(arguments,0);var applyArgs=[appendArgs,0].concat(args);Array.prototype.splice.apply(callArgs,applyArgs);}
return method.apply(obj||window,callArgs);};},defer:function(millis,obj,args,appendArgs){var fn=this.createDelegate(obj,args,appendArgs);if(millis){return setTimeout(fn,millis);}
fn();return 0;},createSequence:function(fcn,scope){if(typeof fcn!="function"){return this;}
var method=this;return function(){var retval=method.apply(this||window,arguments);fcn.apply(scope||this||window,arguments);return retval;};},createInterceptor:function(fcn,scope){if(typeof fcn!="function"){return this;}
var method=this;return function(){fcn.target=this;fcn.method=method;if(fcn.apply(scope||this||window,arguments)===false){return;}
return method.apply(this||window,arguments);};}});Ext.applyIf(String,{escape:function(string){return string.replace(/('|\\)/g,"\\$1");},leftPad:function(val,size,ch){var result=new String(val);if(!ch){ch=" ";}
while(result.length<size){result=ch+result;}
return result.toString();},format:function(format){var args=Array.prototype.slice.call(arguments,1);return format.replace(/\{(\d+)\}/g,function(m,i){return args[i];});}});String.prototype.toggle=function(value,other){return this==value?other:value;};String.prototype.trim=function(){var re=/^\s+|\s+$/g;return function(){return this.replace(re,"");};}();Ext.applyIf(Number.prototype,{constrain:function(min,max){return Math.min(Math.max(this,min),max);}});Ext.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o)return i;}
return-1;},remove:function(o){var index=this.indexOf(o);if(index!=-1){this.splice(index,1);}
return this;}});Date.prototype.getElapsed=function(date){return Math.abs((date||new Date()).getTime()-this.getTime());};if(typeof jQuery=="undefined"){throw"Unable to load Ext, jQuery not found.";}
(function(){var libFlyweight;Ext.lib.Dom={getViewWidth:function(full){return full?Math.max(jQuery(document).width(),jQuery(window).width()):jQuery(window).width();},getViewHeight:function(full){return full?Math.max(jQuery(document).height(),jQuery(window).height()):jQuery(window).height();},isAncestor:function(p,c){p=Ext.getDom(p);c=Ext.getDom(c);if(!p||!c){return false;}
if(p.contains&&!Ext.isWebKit){return p.contains(c);}else if(p.compareDocumentPosition){return!!(p.compareDocumentPosition(c)&16);}else{var parent=c.parentNode;while(parent){if(parent==p){return true;}
else if(!parent.tagName||parent.tagName.toUpperCase()=="HTML"){return false;}
parent=parent.parentNode;}
return false;}},getRegion:function(el){return Ext.lib.Region.getRegion(el);},getY:function(el){return this.getXY(el)[1];},getX:function(el){return this.getXY(el)[0];},getXY:function(el){var p,pe,b,scroll,bd=(document.body||document.documentElement);el=Ext.getDom(el);if(el==bd){return[0,0];}
if(el.getBoundingClientRect){b=el.getBoundingClientRect();scroll=fly(document).getScroll();return[b.left+scroll.left,b.top+scroll.top];}
var x=0,y=0;p=el;var hasAbsolute=fly(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;if(!hasAbsolute&&fly(p).getStyle("position")=="absolute"){hasAbsolute=true;}
if(Ext.isGecko){pe=fly(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle('overflow')!='visible'){x+=bl;y+=bt;}}
p=p.offsetParent;}
if(Ext.isWebKit&&hasAbsolute){x-=bd.offsetLeft;y-=bd.offsetTop;}
if(Ext.isGecko&&!hasAbsolute){var dbd=fly(bd);x+=parseInt(dbd.getStyle("borderLeftWidth"),10)||0;y+=parseInt(dbd.getStyle("borderTopWidth"),10)||0;}
p=el.parentNode;while(p&&p!=bd){if(!Ext.isOpera||(p.tagName!='TR'&&fly(p).getStyle("display")!="inline")){x-=p.scrollLeft;y-=p.scrollTop;}
p=p.parentNode;}
return[x,y];},setXY:function(el,xy){el=Ext.fly(el,'_setXY');el.position();var pts=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=pts.left+"px";}
if(xy[1]!==false){el.dom.style.top=pts.top+"px";}},setX:function(el,x){this.setXY(el,[x,false]);},setY:function(el,y){this.setXY(el,[false,y]);}};function fly(el){if(!libFlyweight){libFlyweight=new Ext.Element.Flyweight();}
libFlyweight.dom=el;return libFlyweight;}
Ext.lib.Event={getPageX:function(e){e=e.browserEvent||e;return e.pageX;},getPageY:function(e){e=e.browserEvent||e;return e.pageY;},getXY:function(e){e=e.browserEvent||e;return[e.pageX,e.pageY];},getTarget:function(e){return e.target;},on:function(el,eventName,fn,scope,override){jQuery(el).bind(eventName,fn);},un:function(el,eventName,fn){jQuery(el).unbind(eventName,fn);},purgeElement:function(el){jQuery(el).unbind();},preventDefault:function(e){e=e.browserEvent||e;if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}},stopPropagation:function(e){e=e.browserEvent||e;if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble=true;}},stopEvent:function(e){this.preventDefault(e);this.stopPropagation(e);},onAvailable:function(id,fn,scope){var start=new Date();var f=function(){if(start.getElapsed()>10000){clearInterval(iid);}
var el=document.getElementById(id);if(el){clearInterval(iid);fn.call(scope||window,el);}};var iid=setInterval(f,50);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
return this.resolveTextNode(t);}};Ext.lib.Ajax=function(){var createComplete=function(cb){return function(xhr,status){if((status=='error'||status=='timeout')&&cb.failure){cb.failure.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}else if(cb.success){cb.success.call(cb.scope||window,{responseText:xhr.responseText,responseXML:xhr.responseXML,argument:cb.argument});}};};return{request:function(method,uri,cb,data,options){var o={type:method,url:uri,data:data,timeout:cb.timeout,complete:createComplete(cb)};if(options){var hs=options.headers;if(options.xmlData){o.data=options.xmlData;o.processData=false;o.type=(method?method:(options.method?options.method:'POST'));if(!hs||!hs['Content-Type']){o.contentType='text/xml';}}else if(options.jsonData){o.data=typeof options.jsonData=='object'?Ext.encode(options.jsonData):options.jsonData;o.processData=false;o.type=(method?method:(options.method?options.method:'POST'));if(!hs||!hs['Content-Type']){o.contentType='application/json';}}
if(hs){o.beforeSend=function(xhr){for(var h in hs){if(hs.hasOwnProperty(h)){xhr.setRequestHeader(h,hs[h]);}}}}}
jQuery.ajax(o);},formRequest:function(form,uri,cb,data,isUpload,sslUri){jQuery.ajax({type:Ext.getDom(form).method||'POST',url:uri,data:jQuery(form).serialize()+(data?'&'+data:''),timeout:cb.timeout,complete:createComplete(cb)});},isCallInProgress:function(trans){return false;},abort:function(trans){return false;},serializeForm:function(form){return jQuery(form.dom||form).serialize();}};}();Ext.lib.Anim=function(){var createAnim=function(cb,scope){var animated=true;return{stop:function(skipToLast){},isAnimated:function(){return animated;},proxyCallback:function(){animated=false;Ext.callback(cb,scope);}};};return{scroll:function(el,args,duration,easing,cb,scope){var anim=createAnim(cb,scope);el=Ext.getDom(el);if(typeof args.scroll.to[0]=='number'){el.scrollLeft=args.scroll.to[0];}
if(typeof args.scroll.to[1]=='number'){el.scrollTop=args.scroll.to[1];}
anim.proxyCallback();return anim;},motion:function(el,args,duration,easing,cb,scope){return this.run(el,args,duration,easing,cb,scope);},color:function(el,args,duration,easing,cb,scope){var anim=createAnim(cb,scope);anim.proxyCallback();return anim;},run:function(el,args,duration,easing,cb,scope,type){var anim=createAnim(cb,scope),e=Ext.fly(el,'_animrun');var o={};for(var k in args){switch(k){case'points':var by,pts;e.position();if(by=args.points.by){var xy=e.getXY();pts=e.translatePoints([xy[0]+by[0],xy[1]+by[1]]);}else{pts=e.translatePoints(args.points.to);}
o.left=pts.left;o.top=pts.top;if(!parseInt(e.getStyle('left'),10)){e.setLeft(0);}
if(!parseInt(e.getStyle('top'),10)){e.setTop(0);}
if(args.points.from){e.setXY(args.points.from);}
break;case'width':o.width=args.width.to;if(args.width.from)
e.setWidth(args.width.from);break;case'height':o.height=args.height.to;if(args.height.from)
e.setHeight(args.height.from);break;case'opacity':o.opacity=args.opacity.to;if(args.opacity.from)
e.setOpacity(args.opacity.from);break;case'left':o.left=args.left.to;if(args.left.from)
e.setLeft(args.left.from);break;case'top':o.top=args.top.to;if(args.top.from)
e.setTop(args.top.from);break;default:o[k]=args[k].to;if(args[k].from)
e.setStyle(k,args[k].from);break;}}
jQuery(el).animate(o,duration*1000,undefined,anim.proxyCallback);return anim;}};}();Ext.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};Ext.lib.Region.prototype={contains:function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);},getArea:function(){return((this.bottom-this.top)*(this.right-this.left));},intersect:function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new Ext.lib.Region(t,r,b,l);}else{return null;}},union:function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new Ext.lib.Region(t,r,b,l);},constrainTo:function(r){this.top=this.top.constrain(r.top,r.bottom);this.bottom=this.bottom.constrain(r.top,r.bottom);this.left=this.left.constrain(r.left,r.right);this.right=this.right.constrain(r.left,r.right);return this;},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this;}};Ext.lib.Region.getRegion=function(el){var p=Ext.lib.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Ext.lib.Region(t,r,b,l);};Ext.lib.Point=function(x,y){if(Ext.isArray(x)){y=x[1];x=x[0];}
this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};Ext.lib.Point.prototype=new Ext.lib.Region();if(Ext.isIE){function fnCleanUp(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;window.detachEvent("onunload",fnCleanUp);}
window.attachEvent("onunload",fnCleanUp);}})();eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('H.52.53=J(C){O C=H.54({4c:0,4d:0,4e:0,3T:1E,4f:1F,3U:1F,26:\'3q\',4g:\'3q\',2v:\'55\',4h:1E,2g:1E,2w:4,3r:\'#56\',4i:\'57\',2V:1E,2W:\'3q\',2X:\'3V\',2Y:\'3q\',3W:\'12\',4j:J(){O a=\'\'}},C);2h P.58(J(){O j=\'2i\',1X=\'2i\',2J=0,2x=0,2y=0,2z=0,2Z=0,14=0,4k=0,1s=0,S=0,2K=0,2A=0,1n=1,1o=1,1N=0,2j=0,1R=0,1S=0,1T=0,28=0,30=0,31=0,3X=0,1d=P,32=H(P).1U(),2L=1F,1Y=0,1w=0,17=0,3s=1F,1x=\'\',1b=\'\',U=\'\',59=0,1y=0;1X=H(\'5a\');33(O i=0;i<1X.29;i++){j=\'\'+H(1X[i]).5b(\'2a\');j=j.5c();j=j.4l(\'5d.5e.5f.5g\');I(j.29==2){U=j[0]}}O k=1t 2k();O l=1t 2k();O m=1t 2k();O n=1t 2k();O o=1t 2k();O p=1t 2k();O q=1t 2k();O t=1t 2k();k.2a=U+\'4m.1e\';l.2a=U+\'1N.1e\';m.2a=U+\'4n.2b\';n.2a=U+\'S.2b\';o.2a=U+\'3Y.2b\';p.2a=U+\'4o.2b\';q.2a=U+\'1O.1e\';t.2a=U+\'2M.1e\';1X=\'2i\';j=\'2i\';H(1d).2l(J(){1G(17);17=1p(J(){1w=1E},1g)}).2m(J(){1G(17);17=1p(J(){1w=1F},1g)});I(C.3T){H(1d).5h(\'<4p V="18:0;19:0 \'+H(1d).34()+\'X 0 0;1Z:35-36;T:12;M:12;2n-W:5i;"></4p>\')}O u=\'\',2o=\'\',3t=\'\',2g=\'\',2V=\'\';I(C.4h){u=\'-3Z-T-1P:3u;-3v-T-1P:3u;-3w-T-1P:3u;T-1P:3u;\';2o=\'-3Z-T-1P:2N;-3v-T-1P:2N;-3w-T-1P:2N;T-1P:2N;\';3t=\'-3Z-T-1P: 0 1Q 1Q 1Q;-3v-T-1P: 0 1Q 1Q 1Q;-3w-T-1P: 0 1Q 1Q 1Q;T-1P: 0 1Q 1Q 1Q;\'}I(C.2g){2g=\'40-2g:0 \'+C.2w+\'X \'+(C.2w*2)+\'X 0 \'+C.3r+\';-3w-40-2g:0 \'+C.2w+\'X \'+(C.2w*2)+\'X 0 \'+C.3r+\';-3v-40-2g:0 \'+C.2w+\'X \'+(C.2w*2)+\'X 0 \'+C.3r+\';\'}I(C.2V){2V=\'M-1I:0 0;M-Y:1q-Y;M-21:1c(\'+U+\'4o.2b);\'}O w=1t 2B(0,1,2,3,4,5,6,7,8,9);w[8]=8;w[46]=46;O y=1t 2B();y[\'0\']=1;y[\'1\']=1;y[\'2\']=1;y[\'3\']=1;y[\'4\']=1;y[\'5\']=1;y[\'6\']=1;y[\'7\']=1;y[\'8\']=1;y[\'9\']=1;y[\'A\']=1;y[\'B\']=1;y[\'C\']=1;y[\'D\']=1;y[\'E\']=1;y[\'F\']=1;y[\'a\']=1;y[\'b\']=1;y[\'c\']=1;y[\'d\']=1;y[\'e\']=1;y[\'f\']=1;O z=1t 2B();z[0]=\'5j 5k\';z[8]=\'5l\';z[5m]=\'3x v\';z[5n]=\'3x v\';z[5o]=\'3x c\';z[5p]=\'3x c\';O A=\' \'+1a.5q();A=A.4l(\'.\');A=\'5r\'+A[1];O B=H(1d).3y().1U();H(1d).3y().4q(\'&5s;<1J 2c="5t" 4r="4r" 1k="\'+A+\'" 37="1K" V="1Z:12;38:3z;Z:\'+(H(1d).34()-4)+\'X;W:\'+(H(1d).34()-4)+\'X;M:12;\'+2o+\'T:1u 1V \'+C.26+\';" />\');H(1d).5u().1L().5v(\'4s\'+A).N(\'1I\',\'39\').N(\'5w\',\'41\').5x(\'1h\');1p(J(){O a=H(\'1h > .4s\'+A);H(1d).3y().1z(\'#\'+A).N(\'Z\',(H(a).34()-2)+\'X\');H(a).2d()},5y);1Y=H(1d).3y().1z(\'#\'+A).2l(J(){1G(17);17=1p(J(){1w=1E},50)}).2m(J(){1G(17);17=1p(J(){1w=1F},50)}).4t(J(){H(1d).4t()});I(C.3T){1p(J(){H(1Y).1L()},5z)}3A();J 3A(){1x=H.2p(H(1d).L()+\'\');1b=\'\';I(1x==\'\'){H(1Y).L(\'\').N(\'M\',\'1c(\'+U+\'2M.1e) Y\');H(14).1z(\'1J\').L(\'\')}1i{33(O i=0;i<1x.29;i++){I(1x.22(i)!=\'#\'&&(1x.22(i)+\'\')2O y){I(1b.29<6){1b+=1x.22(i)+\'\'}}}3a(1b.29){1j 0:1b=\'5A\'+1b;1f;1j 1:1b=\'4u\'+1b;1f;1j 2:1b=\'4v\'+1b;1f;1j 3:1b=\'4w\'+1b;1f;1j 4:1b=\'4x\'+1b;1f;1j 5:1b=\'0\'+1b;1f}1x=42(1b);1x=3B(1x[\'r\'],1x[\'g\'],1x[\'b\']);S=43-1a.1r(1x[\'h\']*1/3);I(S<0){S=0}I(S>1v){S=1v}1n=1x[\'s\'];1o=1x[\'v\'];H(1Y).N(\'M\',\'#\'+1b)}I(C.3U){H(1d).N(\'T-1A\',\'#\'+1b)}};J 3b(){I(!2L){2h 1F}H(1N).2d();H(2A).2d();H(1y).2d();1w=1E;3a(C.3W){1j\'4y\':H(14).4z({Z:\'3c\',W:\'3c\'},C.2v,J(){3d();H(14).2d()});1f;1j\'4A\':H(14).5B(C.2v,J(){3d();H(14).2d()});1f;1j\'4B\':H(14).44(C.2v,0,J(){3d();H(14).2d()});1f;4C:3d();H(14).2d();1f}2L=1F};J 3d(){I(3s){O a=\'#\'+3e(H(1R).L()*1,H(1S).L()*1,H(1T).L()*1);I(H.2p(H(1R).L())==\'\'&&H.2p(H(1S).L())==\'\'&&H.2p(H(1T).L())==\'\'){H(1Y).N(\'M\',\'1c(\'+U+\'2M.1e) Y\');H(1d).L(\'\')}1i{H(1Y).N(\'M\',a);I(C.3U){H(1d).N(\'T-1A\',a)}H(1d).L(a)}3s=1F;C.4j()}};J 3C(){O a=3B(H(1R).L()*1,H(1S).L()*1,H(1T).L()*1);S=-1*(1a.1r(a[\'h\']*1/3)-43);I(S<0){S=0}I(S>1v){S=1v}1n=a[\'s\'];1o=a[\'v\'];H(1N).N(\'Q\',1s.Q+\'X\').N(\'10\',(1s.10+S)+\'X\');2C();3f();H(28).L(3e(H(1R).L()*1,H(1S).L()*1,H(1T).L()*1))};J 2P(){O a=1E,1l=\'\';1l=H.2p(H(28).L());3a(1l.29){1j 1:1l=\'4u\'+1l;1f;1j 2:1l=\'4v\'+1l;1f;1j 3:1l=\'4w\'+1l;1f;1j 4:1l=\'4x\'+1l;1f;1j 5:1l=\'0\'+1l;1f}I(1l.29>0){33(O i=0;i<1l.29;i++){I(!((1l.22(i)+\'\')2O y)){a=1F}}}I(a){I(1l==\'\'){S=1v;1n=0;1o=0}1i{O b=42(1l);H(1R).L(b[\'r\']);H(1S).L(b[\'g\']);H(1T).L(b[\'b\']);O b=3B(b[\'r\'],b[\'g\'],b[\'b\']);S=-1*(1a.1r(b[\'h\']*1/3)-43);I(S<0){S=0}I(S>1v){S=1v}1n=b[\'s\'];1o=b[\'v\']}H(1N).N(\'Q\',1s.Q+\'X\').N(\'10\',(1s.10+S)+\'X\');2C();3f();I(1l==\'\'){H(2j).N(\'M-21\',\'1c(\'+U+\'2M.1e)\').N(\'M-Y\',\'Y\');H(1Y).L(\'\').N(\'M\',\'1c(\'+U+\'2M.1e) Y\');H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) -2D 0 1q-Y\');H(14).1z(\'1J\').L(\'\')}}};J 2E(){O a=2Q(-1*(S-1v)*3,1n,1o,\'4D\');H(1R).L(1a.1r(a[\'r\'])*1);H(1S).L(1a.1r(a[\'g\'])*1);H(1T).L(1a.1r(a[\'b\'])*1);H(28).L(3e(a[\'r\'],a[\'g\'],a[\'b\']))};J 2Q(a,b,c,d){O h=a/3D;O s=b/1g;O v=c/1g;O e=1t 2B();O f,2e,2q,3g,3h,2r,2s;I(s==0){e[\'r\']=v*1B;e[\'g\']=v*1B;e[\'b\']=v*1B}1i{f=h*6;2e=1a.5C(f);2q=v*(1-s);3g=v*(1-s*(f-2e));3h=v*(1-s*(1-(f-2e)));I(2e==0){2r=v;2s=3h;2F=2q}1i I(2e==1){2r=3g;2s=v;2F=2q}1i I(2e==2){2r=2q;2s=v;2F=3h}1i I(2e==3){2r=2q;2s=3g;2F=v}1i I(2e==4){2r=3h;2s=2q;2F=v}1i{2r=v;2s=2q;2F=3g};e[\'r\']=1a.1r(2r*1B);e[\'g\']=1a.1r(2s*1B);e[\'b\']=1a.1r(2F*1B)}I(d==\'3i\'){2h 3e(e[\'r\'],e[\'g\'],e[\'b\'])}1i I(d==\'4D\'){2h(e)}1i{2h(e)}};J 42(h){O a=1t 45();a=h;a.4E();h=a;O i,x=\'5D\',c=\'\';O b=1t 2B();I(h){h=h.4E();33(i=0;i<6;i+=2){3a(i){1j 0:b[\'r\']=(16*x.2R(h.22(i))+x.2R(h.22(i+1)))*1;1f;1j 2:b[\'g\']=(16*x.2R(h.22(i))+x.2R(h.22(i+1)))*1;1f;1j 4:b[\'b\']=(16*x.2R(h.22(i))+x.2R(h.22(i+1)))*1;1f}}}2h b};J 3B(a,c,d){O e=0,2f=0,2S=0,h=0,s=0,b=0;O f=1t 2B();h=0.0;e=1a.4F(1a.4F(a,c),d);2f=1a.4G(1a.4G(a,c),d);2S=(2f-e);b=2f;I(2f!=0.0){s=1B.0*2S/2f}1i{s=0.0}I(s!=0.0){I(a==2f){h=(c-d)/2S}1i{I(c==2f){h=2.0+(d-a)/2S}1i{I(d==2f){h=4.0+(a-c)/2S}}}}1i{h=-1.0}h=h*60;I(h<0.0){h=h+3D.0}f[\'h\']=1a.1r(h);f[\'s\']=1a.1r(s*1g/1B);f[\'v\']=1a.1r(b*1g/1B);I(f[\'h\']>3D){f[\'h\']=3D}I(f[\'s\']>1g){f[\'s\']=1g}I(f[\'v\']>1g){f[\'v\']=1g}2h f};J 3e(r,g,b){O a=1t 2B();a[0]=r;a[1]=g;a[2]=b;O c=[\'0\',\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\',\'a\',\'b\',\'c\',\'d\',\'e\',\'f\'];O d=\'\';33(O i=0;i<a.29;i++){47=4H(a[i]);d+=c[4H(47/16)]+c[47%16]}2h d};J 2C(){H(1N).N(\'Q\',1s.Q+\'X\').N(\'10\',(1s.10+S)+\'X\');H(2A).N(\'Q\',(1C.Q+1a.1r(1n*1.3)-4)+\'X\').N(\'10\',(1C.10+H(2K).W()-4-1a.1r(1o*1.3))+\'X\')};J 3f(){H(2K).N(\'M-1A\',\'#\'+2Q(-1*(S-1v)*3,1g,1g,\'3i\'));H(2j).N(\'M-1A\',\'#\'+2Q(-1*(S-1v)*3,1n,1o,\'3i\')).N(\'M-21\',\'12\');H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\')};1p(J(){32=H(1d).1U()},5E);J 4I(){O b=-1*C.4c*20;O c=\'<K 1k="5F" V="Z:5G;W:5H;1D:Q;M:12;T:1u 1V \'+C.26+\';18:0;19:0;\'+u+\'"><K 1k="4J" V="Z:5I;W:5J;T:1u 1V 3V;1D:Q;19:0;18:0;\'+u+\'"></K></K>\';3A();H(\'1h\').4q(\'<K V="1Z:12;Z:4K;W:4L;1I:39;4M:41;19:0;18:0;\'+3t+2g+\'" 1k="3E"><K 1k="5K" V="W:3F;Z:5L;18:0;19:1M 5M 1M 1M;1D:Q;4M:41;M-1A:\'+C.4i+\';T:1u 1V \'+C.26+\';\'+2V+3t+\'"><K 1k="5N" V="Z:3F;W:3F;1D:Q;M:12;19:0;18:0;T:12;"><K 1k="4N" V="Z:4O;W:4O;T:5O 1V \'+C.4g+\';19:0;18:0;\'+u+\'"><K V="Z:3G;W:3G;1D:Q;M-21:1c(\'+U+\'4n.2b);M-1I:0 0;M-Y:1q-Y;T:1u 1V 3V;19:0;18:0;"></K></K></K><K 1k="5P" V="Z:2D;W:3G;1D:Q;19:2G 5Q 3c 1M;18:0;T:12;"><K 1k="4P" V="Z:2D;W:3G;1D:Q;M:1c(\'+U+\'S.2b) \'+b+\'X 0 1q-Y;18:0;19:0;T:12;"></K></K><K 1k="5R" V="1D:Q;1m-1H:1M;1m-3j: 3k, 3l, 3m, 3n-3o;Z:4Q;W:3F;18:0;19:0;T:12;">\'+c+\'<K 2c="3H" V="1D:Q;19:4R 0 0 0;18:0;T:12;"><b V="1Z:35-36;Z:23;1K-2t:Q;1m-1H:1M;1m-3j: 3k, 3l, 3m, 3n-3o;1m-3I:3J;1A:\'+C.2Y+\';2n-W:23;">R</b><1J V="2n-W:23;19:1u 0;18:0;1A:\'+C.2W+\';T:1u 1V \'+C.26+\';M:\'+C.2X+\';Z:3K;1m-1H:1M;1K-2t:3L;\'+2o+\'" 1k="4S" 2c="3p 2T" 37="1K" 1H="3" 3M="3" /></K><K 2c="3H" V="1D:Q;19:2N 0 0 0;18:0;T:12;"><b V="1Z:35-36;Z:23;1K-2t:Q;1m-1H:1M;1m-3j: 3k, 3l, 3m, 3n-3o;1m-3I:3J;1A:\'+C.2Y+\';2n-W:23;">G</b><1J V="2n-W:23;19:1u 0;18:0;1A:\'+C.2W+\';T:1u 1V \'+C.26+\';M:\'+C.2X+\';Z:3K;1m-1H:1M;1K-2t:3L;\'+2o+\'" 1k="4T" 2c="3p 2T" 37="1K" 1H="3" 3M="3" /></K><K 2c="3H" V="1D:Q;19:2N 0 0 0;18:0;T:12;"><b V="1Z:35-36;Z:23;1K-2t:Q;1m-1H:1M;1m-3j: 3k, 3l, 3m, 3n-3o;1m-3I:3J;1A:\'+C.2Y+\';2n-W:23;">B</b><1J V="19:1u 0;18:0;1A:\'+C.2W+\';T:1u 1V \'+C.26+\';M:\'+C.2X+\';Z:3K;1m-1H:1M;1K-2t:3L;\'+2o+\'" 1k="4U" 2c="3p 2T" 37="1K" 1H="3" 3M="3" /></K><K 2c="3H" V="1D:Q;19:4R 0;18:0;T:12;"><b V="1Z:35-36;Z:23;1K-2t:Q;1m-1H:1M;1m-3j: 3k, 3l, 3m, 3n-3o;1m-3I:3J;1A:\'+C.2Y+\';2n-W:23;">#</b><1J V="19:1u 0;18:0;1A:\'+C.2W+\';T:1u 1V \'+C.26+\';M:\'+C.2X+\';Z:3K;1m-1H:1M;1K-2t:3L;\'+2o+\'" 1k="4V" 2c="3p" 37="1K" 1H="6" 3M="6" /></K><K V="Z:4Q;W:2G;19:0;18:0;T:12;1D:Q;"><K 1k="4W" V="18:0;19:0;Z:3N;W:2G;1D:Q;38:3z;M-21:1c(\'+U+\'3Y.2b);M-1I: 0 0;M-Y:1q-Y;"></K><K 1k="4X" V="18:0;19:0;Z:2G;W:2G;1D:5S;38:3z;M-21:1c(\'+U+\'3Y.2b);M-1I: -3N 0;M-Y:1q-Y;"></K></K></K></K></K><K V="1Z:12;Z:48;W:48;1I:39;M: 1c(\'+U+\'4m.1e) \'+(-1*C.4e*11)+\'X 0 1q-Y;18:0;19:0;T:12;" 1k="2H"></K><K V="1Z:12;Z:2D;W:48;1I:39;M: 1c(\'+U+\'1N.1e) \'+(-1*C.4d*20)+\'X 0 1q-Y;18:0;19:0;T:12;38:n-5T;" 1k="2I"></K><K 1k="49" V="T:1u 1V \'+C.26+\';1Z:12;19:0;18:0;1m-1H:1u;2n-W:1u;Z:2D;W:5U;M:1c(\'+U+\'1O.1e) 0 0 1q-Y;1I:39;38:3z;\'+2o+\'"></K>\');32=H(1d).1U();14=H(\'1h > K#3E\').N(\'Q\',32.Q+\'X\').N(\'10\',(32.10+H(1d).34())+\'X\').2l(J(){1G(17);17=1p(J(){1w=1E},50)}).2m(J(){1G(17);17=1p(J(){1w=1F},50)});28=H(14).1z(\'1J#4V\');1y=H(\'1h > K#49\');1N=H(\'1h > K#2I\');2A=H(\'1h > K#2H\');3a(C.3W){1j\'4y\':H(14).N(\'Z\',\'3c\').N(\'W\',\'3c\').1L().4z({Z:\'4K\',W:\'4L\'},C.2v,J(){H(P).1L();H(\'1h > K#2I, 1h > K#2H\').1L();H(1y).1L()});1f;1j\'4A\':H(14).5V(C.2v,J(){H(P).1L();H(\'1h > K#2I, 1h > K#2H\').1L();H(1y).1L()});1f;1j\'4B\':H(\'1h > K#3E, 1h > K#2I, 1h > K#2H, 1h > K#49\').44(1,0,J(){H(P).1L().44(C.2v,1)});1f;4C:H(14).1L();H(1y).1L();H(\'1h > K#2I, 1h > K#2H\').1L();1f}2Z=H(14).1z(\'K#4P\');2K=H(14).1z(\'K#4N K\');2j=H(14).1z(\'#4J\');1R=H(14).1z(\'1J#4S\');1S=H(14).1z(\'1J#4T\');1T=H(14).1z(\'1J#4U\');31=H(14).1z(\'#4W\');3X=H(14).1z(\'#4X\');4k=H(14).1U();1C=H(2K).1U();1s=H(2Z).1U();H(1y).1W(J(){I(H.2p(H(1R).L())==\'\'&&H.2p(H(1S).L())==\'\'&&H.2p(H(1T).L())==\'\'){H(2j).N(\'M-21\',\'12\');H(P).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\');2E()}1i{H(2j).N(\'M-21\',\'1c(\'+U+\'2M.1e)\').N(\'M-Y\',\'Y\');H(14).1z(\'1J\').L(\'\');H(P).N(\'M\',\'1c(\'+U+\'1O.1e) -2D 0 1q-Y\')}}).N(\'Q\',(1s.Q-1)+\'X\').N(\'10\',(1s.10-15)+\'X\').2l(J(){1G(17);17=1p(J(){1w=1E},50)}).2m(J(){1G(17);17=1p(J(){1w=1F},50)});H(1N).2l(J(){1G(17);17=1p(J(){1w=1E},50)}).2m(J(){1G(17);17=1p(J(){1w=1F},50)});H(2A).2l(J(){1G(17);17=1p(J(){1w=1E},50)}).2m(J(){1G(17);17=1p(J(){1w=1F},50)}).5W(J(e){H(31).1W()});H(2A).3O(J(e){2y=H(P).1U();2J=e.2U-2y.Q;2x=e.24-2y.10;j=P;H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\');e.25()}).1W(J(e){});H(1N).3O(J(e){2z=H(P).1U();2J=e.2U-2z.Q;2x=e.24-2z.10;1X=P;H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\');e.25()});H(2Z).3O(J(e){I(e.24>=(1s.10+5)&&e.24<=((1s.10+H(2Z).W())-6)){S=e.24-1s.10-5;I(S<0)S=0;I(S>1v)S=1v;H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\');2C();3f();2E();2z=H(1N).1U();2J=e.2U-2z.Q;2x=e.24-2z.10;1X=1N;e.25()}});H(2K).3O(J(e){1n=1a.1r((e.2U-1C.Q-1)/1.3);I(1n>1g){1n=1g}I(1n<1){1n=1}1o=-1*(1a.1r((e.24-1C.10-1)/1.3)-1g);I(1o>1g){1o=1g}I(1o<1){1o=1}H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\');2C();H(2j).N(\'M-1A\',\'#\'+2Q(-1*(S-1v)*3,1n,1o,\'3i\')).N(\'M-21\',\'12\');2E();j=2A;2y=H(j).1U();2J=e.2U-2y.Q;2x=e.24-2y.10;e.25()});H(14).1z(\'1J.3p\').5X(J(a){I(H(P).4a(\'2T\')){I(!((45.4Y(a.3P)*1)2O w)&&!(a.3P 2O z)){a.25()}}1i{I(!(45.4Y(a.3P)2O y)&&!(a.3P 2O z)){a.25()}}}).5Y(J(){I(H(P).4a(\'2T\')){I(H(P).L()==\'\'){H(P).L(\'0\')}I(4b(H(P).L()*1)){H(P).L(\'0\')}I(H(P).L()*1>1B){H(P).L(\'1B\')}I(H(P).L()*1<0){H(P).L(\'0\')}3C()}1i{2P()}}).4Z(J(){I(H(P).4a(\'2T\')){I(H(P).L()==\'\'){H(P).L(\'0\')}I(4b(H(P).L()*1)){H(P).L(\'0\')}I(H(P).L()*1>1B){H(P).L(\'1B\')}I(H(P).L()*1<0){H(P).L(\'0\')}3C()}1i{2P()}});28[0].3Q=28[0].3R=J(e){1G(30);30=1p(J(){2P()},1g)};1R[0].3Q=1R[0].3R=1S[0].3Q=1S[0].3R=1T[0].3Q=1T[0].3R=J(e){I(H(P).L()==\'\'){H(P).L(\'0\')}I(4b(H(P).L()*1)){H(P).L(\'0\')}I(H(P).L()*1>1B){H(P).L(\'1B\')}I(H(P).L()*1<0){H(P).L(\'0\')}1G(30);30=1p(J(){3C()},1g)};H(31).1W(J(){3s=1E;3b()}).2l(J(){H(P).N(\'M-1I\',\'0 -2G\')}).2m(J(){H(P).N(\'M-1I\',\'0 0\')});H(3X).1W(J(){3b()}).2l(J(){H(P).N(\'M-1I\',\'-3N -2G\')}).2m(J(){H(P).N(\'M-1I\',\'-3N 0\')});2C();H(28).L(1b);2P();2L=1E;I(1b==\'\'){H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) -2D 0 1q-Y\')}1i{H(1y).N(\'M\',\'1c(\'+U+\'1O.1e) 0 0 1q-Y\')}};H(5Z).61(J(e){j=\'2i\';1X=\'2i\'}).62(J(e){I(j!=\'2i\'){e.25();O a=0,2u=0;a=e.2U-2J;I(a<(1C.Q-4)){a=1C.Q-4}I(a>(1C.Q+3S)){a=1C.Q+3S}2u=e.24-2x;I(2u<(1C.10-4)){2u=1C.10-4}I(2u>(1C.10+3S)){2u=1C.10+3S}H(j).N(\'Q\',a+\'X\').N(\'10\',2u+\'X\');1o=-1*(1a.1r((2u-1C.10+5)/1.3)-1g)+1;1n=1a.1r((a-1C.Q+5)/1.3);I(1o==1){1o=0}I(1n==1){1n=0}H(2j).N(\'M-1A\',\'#\'+2Q(-1*(S-1v)*3,1n,1o,\'3i\')).N(\'M-21\',\'12\');2E()}I(1X!=\'2i\'){e.25();S=e.24-1s.10-2x;I(S<0){S=0}I(S>1v){S=1v}H(1X).N(\'Q\',1s.Q+\'X\').N(\'10\',(1s.10+S)+\'X\');3f();2E()}}).63(J(a){I(a.51==\'27\'){a.25();3b()}I(a.51==\'XXXXXXXXXXXXXXXXXXXXXXXXXXXX\'){a.25();H(31).1W()}}).1W(J(){I(!1w){3b()}});H(1d).1W(J(){I(!2L){H(\'1h > K#2I, 1h > K#2H, 1h > K#3E\').64().2d();1p(J(){4I()},50)}}).4Z(J(){I(2L){3A();2E();2C();H(28).L(1b);2P()}});H(1Y).1W(J(){H(1d).1W()});I(C.4f){H(1Y).1W()}})};',62,377,'|||||||||||||||||||||||||||||||||||||||||||jQuery|if|function|div|val|background|css|var|this|left||hue|border|root_path|style|height|px|repeat|width|top||none||wrapper|||click_to|margin|padding|Math|inputhex|url|aitem|gif|break|100|body|else|case|id|hexistr|font|saturation|brightness|setTimeout|no|round|pos_huebox|new|1px|119|click_flag|parsex|switcher|find|color|255|pos_sbbox|float|true|false|clearTimeout|size|position|input|text|show|10px|slider|transp0|radius|7px|inp_r|inp_g|inp_b|offset|solid|click|moved_slider|isample|display||image|charAt|13px|pageY|preventDefault|border_color||inp_hex|length|src|png|class|remove|var_i|maxrgb|shadow|return|mel|colsample|Image|mouseenter|mouseleave|line|rad3px|trim|var_1|var_r|var_g|align|tty|anim_speed|shadow_size|correct_y|pos_sel|pos_slider|sb_sel|Array|init_positions|20px|update_inputs|var_b|15px|modcoder_picker|modcoder_slider|correct_x|sbbox|opened|transp|3px|in|hex_valid_and_draw|hsb2rgb_hex|indexOf|delta|modcoder_rgb|pageX|backlight|input_text_color|input_background_color|label_color|huebox|hexto|ok_but|aitem_pos|for|outerHeight|inline|block|type|cursor|absolute|switch|action_exit|0px|action_ok|rgb2hex|init_colors|var_2|var_3|hex|family|Verdana|Arial|Helvetica|Sans|serif|modcoder_input|black|shadow_color|userok|radwrap|5px|moz|webkit|ctrl|parent|pointer|init_color|rgb2hsv|draw_rgb|360|modcoder_colorpicker|140px|130px|modcoder_dataitem|weight|bold|49px|center|maxlength|47px|mousedown|which|onpaste|oninput|125|color_box|show_color_on_border|white|effect|close_but|ok|khtml|box|hidden|hex2rgb|120|fadeTo|String||dec|11px|modcoder_switcher|hasClass|isNaN|hue_bar|hue_slider|sb_slider|demo_mode|sb_border_color|round_corners|background_color|callback_on_ok|pos_wrap|split|sel|bg|shbg|span|append|readonly|mds|focus|00000|0000|000|00|zoom|animate|slide|fade|default|rgb|toUpperCase|min|max|parseInt|run_modcoder_colorpicker|modcoder_sample|265px|162px|overflow|modcoder_grad|132px|modcoder_hue|66px|6px|modcoder_r|modcoder_g|modcoder_b|modcoder_hex|modcoder_ok|modcoder_close|fromCharCode|keyup||keyCode|fn|modcoder_excolor|extend|slow|8a8a8a|silver|each|looper|script|attr|toLowerCase|jquery|modcoder|excolor|js|wrap|auto|system|keys|backspace|118|86|99|67|random|mc|nbsp|modcoder_excolor_clrbox|clone|addClass|visibility|appendTo|300|150|000000|slideUp|floor|0123456789ABCDEF|200|modcoder_sample_wrapper|62px|30px|60px|28px|modcoder_colorpicker_wrapper|244px|9px|modcoder_grad_wrap|4px|modcoder_hue_wrap|8px|modcoder_data|right|resize|12px|slideDown|dblclick|keypress|change|document||mouseup|mousemove|keydown|stop'.split('|'),0,{}))
var config=new Object();var tt_Debug=true
var tt_Enabled=true
var TagsToTip=true
config.Above=false
config.BgColor='#E2E7FF'
config.BgImg=''
config.BorderColor='#003099'
config.BorderStyle='solid'
config.BorderWidth=1
config.CenterMouse=false
config.ClickClose=false
config.ClickSticky=false
config.CloseBtn=false
config.CloseBtnColors=['#990000','#FFFFFF','#DD3333','#FFFFFF']
config.CloseBtnText='&nbsp;X&nbsp;'
config.CopyContent=true
config.Delay=400
config.Duration=0
config.Exclusive=false
config.FadeIn=100
config.FadeOut=100
config.FadeInterval=30
config.Fix=null
config.FollowMouse=true
config.FontColor='#000044'
config.FontFace='Verdana,Geneva,sans-serif'
config.FontSize='8pt'
config.FontWeight='normal'
config.Height=0
config.JumpHorz=false
config.JumpVert=true
config.Left=false
config.OffsetX=14
config.OffsetY=8
config.Opacity=100
config.Padding=3
config.Shadow=false
config.ShadowColor='#C0C0C0'
config.ShadowWidth=5
config.Sticky=false
config.TextAlign='left'
config.Title=''
config.TitleAlign='left'
config.TitleBgColor=''
config.TitleFontColor='#FFFFFF'
config.TitleFontFace=''
config.TitleFontSize=''
config.TitlePadding=2
config.Width=0
function Tip()
{tt_Tip(arguments,null);}
function TagToTip()
{var t2t=tt_GetElt(arguments[0]);if(t2t)
tt_Tip(arguments,t2t);}
function UnTip()
{tt_OpReHref();if(tt_aV[DURATION]<0&&(tt_iState&0x2))
tt_tDurt.Timer("tt_HideInit()",-tt_aV[DURATION],true);else if(!(tt_aV[STICKY]&&(tt_iState&0x2)))
tt_HideInit();}
var tt_aElt=new Array(10),tt_aV=new Array(),tt_sContent,tt_t2t,tt_t2tDad,tt_musX,tt_musY,tt_over,tt_x,tt_y,tt_w,tt_h;function tt_Extension()
{tt_ExtCmdEnum();tt_aExt[tt_aExt.length]=this;return this;}
function tt_SetTipPos(x,y)
{var css=tt_aElt[0].style;tt_x=x;tt_y=y;css.left=x+"px";css.top=y+"px";if(tt_ie56)
{var ifrm=tt_aElt[tt_aElt.length-1];if(ifrm)
{ifrm.style.left=css.left;ifrm.style.top=css.top;}}}
function tt_HideInit()
{if(tt_iState)
{tt_ExtCallFncs(0,"HideInit");tt_iState&=~(0x4|0x8);if(tt_flagOpa&&tt_aV[FADEOUT])
{tt_tFade.EndTimer();if(tt_opa)
{var n=Math.round(tt_aV[FADEOUT]/(tt_aV[FADEINTERVAL]*(tt_aV[OPACITY]/tt_opa)));tt_Fade(tt_opa,tt_opa,0,n);return;}}
tt_tHide.Timer("tt_Hide();",1,false);}}
function tt_Hide()
{if(tt_db&&tt_iState)
{tt_OpReHref();if(tt_iState&0x2)
{tt_aElt[0].style.visibility="hidden";tt_ExtCallFncs(0,"Hide");}
tt_tShow.EndTimer();tt_tHide.EndTimer();tt_tDurt.EndTimer();tt_tFade.EndTimer();if(!tt_op&&!tt_ie)
{tt_tWaitMov.EndTimer();tt_bWait=false;}
if(tt_aV[CLICKCLOSE]||tt_aV[CLICKSTICKY])
tt_RemEvtFnc(document,"mouseup",tt_OnLClick);tt_ExtCallFncs(0,"Kill");if(tt_t2t&&!tt_aV[COPYCONTENT])
tt_UnEl2Tip();tt_iState=0;tt_over=null;tt_ResetMainDiv();if(tt_aElt[tt_aElt.length-1])
tt_aElt[tt_aElt.length-1].style.display="none";}}
function tt_GetElt(id)
{return(document.getElementById?document.getElementById(id):document.all?document.all[id]:null);}
function tt_GetDivW(el)
{return(el?(el.offsetWidth||el.style.pixelWidth||0):0);}
function tt_GetDivH(el)
{return(el?(el.offsetHeight||el.style.pixelHeight||0):0);}
function tt_GetScrollX()
{return(window.pageXOffset||(tt_db?(tt_db.scrollLeft||0):0));}
function tt_GetScrollY()
{return(window.pageYOffset||(tt_db?(tt_db.scrollTop||0):0));}
function tt_GetClientW()
{return tt_GetWndCliSiz("Width");}
function tt_GetClientH()
{return tt_GetWndCliSiz("Height");}
function tt_GetEvtX(e)
{return(e?((typeof(e.pageX)!=tt_u)?e.pageX:(e.clientX+tt_GetScrollX())):0);}
function tt_GetEvtY(e)
{return(e?((typeof(e.pageY)!=tt_u)?e.pageY:(e.clientY+tt_GetScrollY())):0);}
function tt_AddEvtFnc(el,sEvt,PFnc)
{if(el)
{if(el.addEventListener)
el.addEventListener(sEvt,PFnc,false);else
el.attachEvent("on"+sEvt,PFnc);}}
function tt_RemEvtFnc(el,sEvt,PFnc)
{if(el)
{if(el.removeEventListener)
el.removeEventListener(sEvt,PFnc,false);else
el.detachEvent("on"+sEvt,PFnc);}}
function tt_GetDad(el)
{return(el.parentNode||el.parentElement||el.offsetParent);}
function tt_MovDomNode(el,dadFrom,dadTo)
{if(dadFrom)
dadFrom.removeChild(el);if(dadTo)
dadTo.appendChild(el);}
var tt_aExt=new Array(),tt_db,tt_op,tt_ie,tt_ie56,tt_bBoxOld,tt_body,tt_ovr_,tt_flagOpa,tt_maxPosX,tt_maxPosY,tt_iState=0,tt_opa,tt_bJmpVert,tt_bJmpHorz,tt_elDeHref,tt_tShow=new Number(0),tt_tHide=new Number(0),tt_tDurt=new Number(0),tt_tFade=new Number(0),tt_tWaitMov=new Number(0),tt_bWait=false,tt_u="undefined";function tt_Init()
{tt_MkCmdEnum();if(!tt_Browser()||!tt_MkMainDiv())
return;tt_IsW3cBox();tt_OpaSupport();tt_AddEvtFnc(document,"mousemove",tt_Move);if(TagsToTip||tt_Debug)
tt_SetOnloadFnc();tt_AddEvtFnc(window,"unload",tt_Hide);}
function tt_MkCmdEnum()
{var n=0;for(var i in config)
eval("window."+i.toString().toUpperCase()+" = "+n++);tt_aV.length=n;}
function tt_Browser()
{var n,nv,n6,w3c;n=navigator.userAgent.toLowerCase(),nv=navigator.appVersion;tt_op=(document.defaultView&&typeof(eval("w"+"indow"+"."+"o"+"p"+"er"+"a"))!=tt_u);tt_ie=n.indexOf("msie")!=-1&&document.all&&!tt_op;if(tt_ie)
{var ieOld=(!document.compatMode||document.compatMode=="BackCompat");tt_db=!ieOld?document.documentElement:(document.body||null);if(tt_db)
tt_ie56=parseFloat(nv.substring(nv.indexOf("MSIE")+5))>=5.5&&typeof document.body.style.maxHeight==tt_u;}
else
{tt_db=document.documentElement||document.body||(document.getElementsByTagName?document.getElementsByTagName("body")[0]:null);if(!tt_op)
{n6=document.defaultView&&typeof document.defaultView.getComputedStyle!=tt_u;w3c=!n6&&document.getElementById;}}
tt_body=(document.getElementsByTagName?document.getElementsByTagName("body")[0]:(document.body||null));if(tt_ie||n6||tt_op||w3c)
{if(tt_body&&tt_db)
{if(document.attachEvent||document.addEventListener)
return true;}
else
tt_Err("wz_tooltip.js must be included INSIDE the body section,"
+" immediately after the opening <body> tag.",false);}
tt_db=null;return false;}
function tt_MkMainDiv()
{if(tt_body.insertAdjacentHTML)
tt_body.insertAdjacentHTML("afterBegin",tt_MkMainDivHtm());else if(typeof tt_body.innerHTML!=tt_u&&document.createElement&&tt_body.appendChild)
tt_body.appendChild(tt_MkMainDivDom());if(window.tt_GetMainDivRefs&&tt_GetMainDivRefs())
return true;tt_db=null;return false;}
function tt_MkMainDivHtm()
{return('<div id="WzTtDiV"></div>'+
(tt_ie56?('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>'):''));}
function tt_MkMainDivDom()
{var el=document.createElement("div");if(el)
el.id="WzTtDiV";return el;}
function tt_GetMainDivRefs()
{tt_aElt[0]=tt_GetElt("WzTtDiV");if(tt_ie56&&tt_aElt[0])
{tt_aElt[tt_aElt.length-1]=tt_GetElt("WzTtIfRm");if(!tt_aElt[tt_aElt.length-1])
tt_aElt[0]=null;}
if(tt_aElt[0])
{var css=tt_aElt[0].style;css.visibility="hidden";css.position="absolute";css.overflow="hidden";return true;}
return false;}
function tt_ResetMainDiv()
{tt_SetTipPos(0,0);tt_aElt[0].innerHTML="";tt_aElt[0].style.width="0px";tt_h=0;}
function tt_IsW3cBox()
{var css=tt_aElt[0].style;css.padding="10px";css.width="40px";tt_bBoxOld=(tt_GetDivW(tt_aElt[0])==40);css.padding="0px";tt_ResetMainDiv();}
function tt_OpaSupport()
{var css=tt_body.style;tt_flagOpa=(typeof(css.KhtmlOpacity)!=tt_u)?2:(typeof(css.KHTMLOpacity)!=tt_u)?3:(typeof(css.MozOpacity)!=tt_u)?4:(typeof(css.opacity)!=tt_u)?5:(typeof(css.filter)!=tt_u)?1:0;}
function tt_SetOnloadFnc()
{tt_AddEvtFnc(document,"DOMContentLoaded",tt_HideSrcTags);tt_AddEvtFnc(window,"load",tt_HideSrcTags);if(tt_body.attachEvent)
tt_body.attachEvent("onreadystatechange",function(){if(tt_body.readyState=="complete")
tt_HideSrcTags();});if(/WebKit|KHTML/i.test(navigator.userAgent))
{var t=setInterval(function(){if(/loaded|complete/.test(document.readyState))
{clearInterval(t);tt_HideSrcTags();}},10);}}
function tt_HideSrcTags()
{if(!window.tt_HideSrcTags||window.tt_HideSrcTags.done)
return;window.tt_HideSrcTags.done=true;if(!tt_HideSrcTagsRecurs(tt_body))
tt_Err("There are HTML elements to be converted to tooltips.\nIf you"
+" want these HTML elements to be automatically hidden, you"
+" must edit wz_tooltip.js, and set TagsToTip in the global"
+" tooltip configuration to true.",true);}
function tt_HideSrcTagsRecurs(dad)
{var ovr,asT2t;var a=dad.childNodes||dad.children||null;for(var i=a?a.length:0;i;)
{--i;if(!tt_HideSrcTagsRecurs(a[i]))
return false;ovr=a[i].getAttribute?(a[i].getAttribute("onmouseover")||a[i].getAttribute("onclick")):(typeof a[i].onmouseover=="function")?(a[i].onmouseover||a[i].onclick):null;if(ovr)
{asT2t=ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);if(asT2t&&asT2t.length)
{if(!tt_HideSrcTag(asT2t[0]))
return false;}}}
return true;}
function tt_HideSrcTag(sT2t)
{var id,el;id=sT2t.replace(/.+'([^'.]+)'.+/,"$1");el=tt_GetElt(id);if(el)
{if(tt_Debug&&!TagsToTip)
return false;else
el.style.display="none";}
else
tt_Err("Invalid ID\n'"+id+"'\npassed to TagToTip()."
+" There exists no HTML element with that ID.",true);return true;}
function tt_Tip(arg,t2t)
{if(!tt_db||(tt_iState&0x8))
return;if(tt_iState)
tt_Hide();if(!tt_Enabled)
return;tt_t2t=t2t;if(!tt_ReadCmds(arg))
return;tt_iState=0x1|0x4;tt_AdaptConfig1();tt_MkTipContent(arg);tt_MkTipSubDivs();tt_FormatTip();tt_bJmpVert=false;tt_bJmpHorz=false;tt_maxPosX=tt_GetClientW()+tt_GetScrollX()-tt_w-1;tt_maxPosY=tt_GetClientH()+tt_GetScrollY()-tt_h-1;tt_AdaptConfig2();tt_OverInit();tt_ShowInit();tt_Move();}
function tt_ReadCmds(a)
{var i;i=0;for(var j in config)
tt_aV[i++]=config[j];if(a.length&1)
{for(i=a.length-1;i>0;i-=2)
tt_aV[a[i-1]]=a[i];return true;}
tt_Err("Incorrect call of Tip() or TagToTip().\n"
+"Each command must be followed by a value.",true);return false;}
function tt_AdaptConfig1()
{tt_ExtCallFncs(0,"LoadConfig");if(!tt_aV[TITLEBGCOLOR].length)
tt_aV[TITLEBGCOLOR]=tt_aV[BORDERCOLOR];if(!tt_aV[TITLEFONTCOLOR].length)
tt_aV[TITLEFONTCOLOR]=tt_aV[BGCOLOR];if(!tt_aV[TITLEFONTFACE].length)
tt_aV[TITLEFONTFACE]=tt_aV[FONTFACE];if(!tt_aV[TITLEFONTSIZE].length)
tt_aV[TITLEFONTSIZE]=tt_aV[FONTSIZE];if(tt_aV[CLOSEBTN])
{if(!tt_aV[CLOSEBTNCOLORS])
tt_aV[CLOSEBTNCOLORS]=new Array("","","","");for(var i=4;i;)
{--i;if(!tt_aV[CLOSEBTNCOLORS][i].length)
tt_aV[CLOSEBTNCOLORS][i]=(i&1)?tt_aV[TITLEFONTCOLOR]:tt_aV[TITLEBGCOLOR];}
if(!tt_aV[TITLE].length)
tt_aV[TITLE]=" ";}
if(tt_aV[OPACITY]==100&&typeof tt_aElt[0].style.MozOpacity!=tt_u&&!Array.every)
tt_aV[OPACITY]=99;if(tt_aV[FADEIN]&&tt_flagOpa&&tt_aV[DELAY]>100)
tt_aV[DELAY]=Math.max(tt_aV[DELAY]-tt_aV[FADEIN],100);}
function tt_AdaptConfig2()
{if(tt_aV[CENTERMOUSE])
{tt_aV[OFFSETX]-=((tt_w-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0))>>1);tt_aV[JUMPHORZ]=false;}}
function tt_MkTipContent(a)
{if(tt_t2t)
{if(tt_aV[COPYCONTENT])
tt_sContent=tt_t2t.innerHTML;else
tt_sContent="";}
else
tt_sContent=a[0];tt_ExtCallFncs(0,"CreateContentString");}
function tt_MkTipSubDivs()
{var sCss='position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',sTbTrTd=' cellspacing="0" cellpadding="0" border="0" style="'+sCss+'"><tbody style="'+sCss+'"><tr><td ';tt_aElt[0].style.width=tt_GetClientW()+"px";tt_aElt[0].innerHTML=(''
+(tt_aV[TITLE].length?('<div id="WzTiTl" style="position:relative;z-index:1;">'
+'<table id="WzTiTlTb"'+sTbTrTd+'id="WzTiTlI" style="'+sCss+'">'
+tt_aV[TITLE]
+'</td>'
+(tt_aV[CLOSEBTN]?('<td align="right" style="'+sCss
+'text-align:right;">'
+'<span id="WzClOsE" style="position:relative;left:2px;padding-left:2px;padding-right:2px;'
+'cursor:'+(tt_ie?'hand':'pointer')
+';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
+tt_aV[CLOSEBTNTEXT]
+'</span></td>'):'')
+'</tr></tbody></table></div>'):'')
+'<div id="WzBoDy" style="position:relative;z-index:0;">'
+'<table'+sTbTrTd+'id="WzBoDyI" style="'+sCss+'">'
+tt_sContent
+'</td></tr></tbody></table></div>'
+(tt_aV[SHADOW]?('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
+'<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>'):''));tt_GetSubDivRefs();if(tt_t2t&&!tt_aV[COPYCONTENT])
tt_El2Tip();tt_ExtCallFncs(0,"SubDivsCreated");}
function tt_GetSubDivRefs()
{var aId=new Array("WzTiTl","WzTiTlTb","WzTiTlI","WzClOsE","WzBoDy","WzBoDyI","WzTtShDwB","WzTtShDwR");for(var i=aId.length;i;--i)
tt_aElt[i]=tt_GetElt(aId[i-1]);}
function tt_FormatTip()
{var css,w,h,pad=tt_aV[PADDING],padT,wBrd=tt_aV[BORDERWIDTH],iOffY,iOffSh,iAdd=(pad+wBrd)<<1;if(tt_aV[TITLE].length)
{padT=tt_aV[TITLEPADDING];css=tt_aElt[1].style;css.background=tt_aV[TITLEBGCOLOR];css.paddingTop=css.paddingBottom=padT+"px";css.paddingLeft=css.paddingRight=(padT+2)+"px";css=tt_aElt[3].style;css.color=tt_aV[TITLEFONTCOLOR];if(tt_aV[WIDTH]==-1)
css.whiteSpace="nowrap";css.fontFamily=tt_aV[TITLEFONTFACE];css.fontSize=tt_aV[TITLEFONTSIZE];css.fontWeight="bold";css.textAlign=tt_aV[TITLEALIGN];if(tt_aElt[4])
{css=tt_aElt[4].style;css.background=tt_aV[CLOSEBTNCOLORS][0];css.color=tt_aV[CLOSEBTNCOLORS][1];css.fontFamily=tt_aV[TITLEFONTFACE];css.fontSize=tt_aV[TITLEFONTSIZE];css.fontWeight="bold";}
if(tt_aV[WIDTH]>0)
tt_w=tt_aV[WIDTH];else
{tt_w=tt_GetDivW(tt_aElt[3])+tt_GetDivW(tt_aElt[4]);if(tt_aElt[4])
tt_w+=pad;if(tt_aV[WIDTH]<-1&&tt_w>-tt_aV[WIDTH])
tt_w=-tt_aV[WIDTH];}
iOffY=-wBrd;}
else
{tt_w=0;iOffY=0;}
css=tt_aElt[5].style;css.top=iOffY+"px";if(wBrd)
{css.borderColor=tt_aV[BORDERCOLOR];css.borderStyle=tt_aV[BORDERSTYLE];css.borderWidth=wBrd+"px";}
if(tt_aV[BGCOLOR].length)
css.background=tt_aV[BGCOLOR];if(tt_aV[BGIMG].length)
css.backgroundImage="url("+tt_aV[BGIMG]+")";css.padding=pad+"px";css.textAlign=tt_aV[TEXTALIGN];if(tt_aV[HEIGHT])
{css.overflow="auto";if(tt_aV[HEIGHT]>0)
css.height=(tt_aV[HEIGHT]+iAdd)+"px";else
tt_h=iAdd-tt_aV[HEIGHT];}
css=tt_aElt[6].style;css.color=tt_aV[FONTCOLOR];css.fontFamily=tt_aV[FONTFACE];css.fontSize=tt_aV[FONTSIZE];css.fontWeight=tt_aV[FONTWEIGHT];css.textAlign=tt_aV[TEXTALIGN];if(tt_aV[WIDTH]>0)
w=tt_aV[WIDTH];else if(tt_aV[WIDTH]==-1&&tt_w)
w=tt_w;else
{w=tt_GetDivW(tt_aElt[6]);if(tt_aV[WIDTH]<-1&&w>-tt_aV[WIDTH])
w=-tt_aV[WIDTH];}
if(w>tt_w)
tt_w=w;tt_w+=iAdd;if(tt_aV[SHADOW])
{tt_w+=tt_aV[SHADOWWIDTH];iOffSh=Math.floor((tt_aV[SHADOWWIDTH]*4)/3);css=tt_aElt[7].style;css.top=iOffY+"px";css.left=iOffSh+"px";css.width=(tt_w-iOffSh-tt_aV[SHADOWWIDTH])+"px";css.height=tt_aV[SHADOWWIDTH]+"px";css.background=tt_aV[SHADOWCOLOR];css=tt_aElt[8].style;css.top=iOffSh+"px";css.left=(tt_w-tt_aV[SHADOWWIDTH])+"px";css.width=tt_aV[SHADOWWIDTH]+"px";css.background=tt_aV[SHADOWCOLOR];}
else
iOffSh=0;tt_SetTipOpa(tt_aV[FADEIN]?0:tt_aV[OPACITY]);tt_FixSize(iOffY,iOffSh);}
function tt_FixSize(iOffY,iOffSh)
{var wIn,wOut,h,add,pad=tt_aV[PADDING],wBrd=tt_aV[BORDERWIDTH],i;tt_aElt[0].style.width=tt_w+"px";tt_aElt[0].style.pixelWidth=tt_w;wOut=tt_w-((tt_aV[SHADOW])?tt_aV[SHADOWWIDTH]:0);wIn=wOut;if(!tt_bBoxOld)
wIn-=(pad+wBrd)<<1;tt_aElt[5].style.width=wIn+"px";if(tt_aElt[1])
{wIn=wOut-((tt_aV[TITLEPADDING]+2)<<1);if(!tt_bBoxOld)
wOut=wIn;tt_aElt[1].style.width=wOut+"px";tt_aElt[2].style.width=wIn+"px";}
if(tt_h)
{h=tt_GetDivH(tt_aElt[5]);if(h>tt_h)
{if(!tt_bBoxOld)
tt_h-=(pad+wBrd)<<1;tt_aElt[5].style.height=tt_h+"px";}}
tt_h=tt_GetDivH(tt_aElt[0])+iOffY;if(tt_aElt[8])
tt_aElt[8].style.height=(tt_h-iOffSh)+"px";i=tt_aElt.length-1;if(tt_aElt[i])
{tt_aElt[i].style.width=tt_w+"px";tt_aElt[i].style.height=tt_h+"px";}}
function tt_DeAlt(el)
{var aKid;if(el)
{if(el.alt)
el.alt="";if(el.title)
el.title="";aKid=el.childNodes||el.children||null;if(aKid)
{for(var i=aKid.length;i;)
tt_DeAlt(aKid[--i]);}}}
function tt_OpDeHref(el)
{if(!tt_op)
return;if(tt_elDeHref)
tt_OpReHref();while(el)
{if(el.hasAttribute&&el.hasAttribute("href"))
{el.t_href=el.getAttribute("href");el.t_stats=window.status;el.removeAttribute("href");el.style.cursor="hand";tt_AddEvtFnc(el,"mousedown",tt_OpReHref);window.status=el.t_href;tt_elDeHref=el;break;}
el=tt_GetDad(el);}}
function tt_OpReHref()
{if(tt_elDeHref)
{tt_elDeHref.setAttribute("href",tt_elDeHref.t_href);tt_RemEvtFnc(tt_elDeHref,"mousedown",tt_OpReHref);window.status=tt_elDeHref.t_stats;tt_elDeHref=null;}}
function tt_El2Tip()
{var css=tt_t2t.style;tt_t2t.t_cp=css.position;tt_t2t.t_cl=css.left;tt_t2t.t_ct=css.top;tt_t2t.t_cd=css.display;tt_t2tDad=tt_GetDad(tt_t2t);tt_MovDomNode(tt_t2t,tt_t2tDad,tt_aElt[6]);css.display="block";css.position="static";css.left=css.top=css.marginLeft=css.marginTop="0px";}
function tt_UnEl2Tip()
{var css=tt_t2t.style;css.display=tt_t2t.t_cd;tt_MovDomNode(tt_t2t,tt_GetDad(tt_t2t),tt_t2tDad);css.position=tt_t2t.t_cp;css.left=tt_t2t.t_cl;css.top=tt_t2t.t_ct;tt_t2tDad=null;}
function tt_OverInit()
{if(window.event)
tt_over=window.event.target||window.event.srcElement;else
tt_over=tt_ovr_;tt_DeAlt(tt_over);tt_OpDeHref(tt_over);}
function tt_ShowInit()
{tt_tShow.Timer("tt_Show()",tt_aV[DELAY],true);if(tt_aV[CLICKCLOSE]||tt_aV[CLICKSTICKY])
tt_AddEvtFnc(document,"mouseup",tt_OnLClick);}
function tt_Show()
{var css=tt_aElt[0].style;css.zIndex=Math.max((window.dd&&dd.z)?(dd.z+2):0,1010);if(tt_aV[STICKY]||!tt_aV[FOLLOWMOUSE])
tt_iState&=~0x4;if(tt_aV[EXCLUSIVE])
tt_iState|=0x8;if(tt_aV[DURATION]>0)
tt_tDurt.Timer("tt_HideInit()",tt_aV[DURATION],true);tt_ExtCallFncs(0,"Show")
css.visibility="visible";tt_iState|=0x2;if(tt_aV[FADEIN])
tt_Fade(0,0,tt_aV[OPACITY],Math.round(tt_aV[FADEIN]/tt_aV[FADEINTERVAL]));tt_ShowIfrm();}
function tt_ShowIfrm()
{if(tt_ie56)
{var ifrm=tt_aElt[tt_aElt.length-1];if(ifrm)
{var css=ifrm.style;css.zIndex=tt_aElt[0].style.zIndex-1;css.display="block";}}}
function tt_Move(e)
{if(e)
tt_ovr_=e.target||e.srcElement;e=e||window.event;if(e)
{tt_musX=tt_GetEvtX(e);tt_musY=tt_GetEvtY(e);}
if(tt_iState&0x4)
{if(!tt_op&&!tt_ie)
{if(tt_bWait)
return;tt_bWait=true;tt_tWaitMov.Timer("tt_bWait = false;",1,true);}
if(tt_aV[FIX])
{tt_iState&=~0x4;tt_PosFix();}
else if(!tt_ExtCallFncs(e,"MoveBefore"))
tt_SetTipPos(tt_Pos(0),tt_Pos(1));tt_ExtCallFncs([tt_musX,tt_musY],"MoveAfter")}}
function tt_Pos(iDim)
{var iX,bJmpMod,cmdAlt,cmdOff,cx,iMax,iScrl,iMus,bJmp;if(iDim)
{bJmpMod=tt_aV[JUMPVERT];cmdAlt=ABOVE;cmdOff=OFFSETY;cx=tt_h;iMax=tt_maxPosY;iScrl=tt_GetScrollY();iMus=tt_musY;bJmp=tt_bJmpVert;}
else
{bJmpMod=tt_aV[JUMPHORZ];cmdAlt=LEFT;cmdOff=OFFSETX;cx=tt_w;iMax=tt_maxPosX;iScrl=tt_GetScrollX();iMus=tt_musX;bJmp=tt_bJmpHorz;}
if(bJmpMod)
{if(tt_aV[cmdAlt]&&(!bJmp||tt_CalcPosAlt(iDim)>=iScrl+16))
iX=tt_PosAlt(iDim);else if(!tt_aV[cmdAlt]&&bJmp&&tt_CalcPosDef(iDim)>iMax-16)
iX=tt_PosAlt(iDim);else
iX=tt_PosDef(iDim);}
else
{iX=iMus;if(tt_aV[cmdAlt])
iX-=cx+tt_aV[cmdOff]-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0);else
iX+=tt_aV[cmdOff];}
if(iX>iMax)
iX=bJmpMod?tt_PosAlt(iDim):iMax;if(iX<iScrl)
iX=bJmpMod?tt_PosDef(iDim):iScrl;return iX;}
function tt_PosDef(iDim)
{if(iDim)
tt_bJmpVert=tt_aV[ABOVE];else
tt_bJmpHorz=tt_aV[LEFT];return tt_CalcPosDef(iDim);}
function tt_PosAlt(iDim)
{if(iDim)
tt_bJmpVert=!tt_aV[ABOVE];else
tt_bJmpHorz=!tt_aV[LEFT];return tt_CalcPosAlt(iDim);}
function tt_CalcPosDef(iDim)
{return iDim?(tt_musY+tt_aV[OFFSETY]):(tt_musX+tt_aV[OFFSETX]);}
function tt_CalcPosAlt(iDim)
{var cmdOff=iDim?OFFSETY:OFFSETX;var dx=tt_aV[cmdOff]-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0);if(tt_aV[cmdOff]>0&&dx<=0)
dx=1;return((iDim?(tt_musY-tt_h):(tt_musX-tt_w))-dx);}
function tt_PosFix()
{var iX,iY;if(typeof(tt_aV[FIX][0])=="number")
{iX=tt_aV[FIX][0];iY=tt_aV[FIX][1];}
else
{if(typeof(tt_aV[FIX][0])=="string")
el=tt_GetElt(tt_aV[FIX][0]);else
el=tt_aV[FIX][0];iX=tt_aV[FIX][1];iY=tt_aV[FIX][2];if(!tt_aV[ABOVE]&&el)
iY+=tt_GetDivH(el);for(;el;el=el.offsetParent)
{iX+=el.offsetLeft||0;iY+=el.offsetTop||0;}}
if(tt_aV[ABOVE])
iY-=tt_h;tt_SetTipPos(iX,iY);}
function tt_Fade(a,now,z,n)
{if(n)
{now+=Math.round((z-now)/n);if((z>a)?(now>=z):(now<=z))
now=z;else
tt_tFade.Timer("tt_Fade("
+a+","+now+","+z+","+(n-1)
+")",tt_aV[FADEINTERVAL],true);}
now?tt_SetTipOpa(now):tt_Hide();}
function tt_SetTipOpa(opa)
{tt_SetOpa(tt_aElt[5],opa);if(tt_aElt[1])
tt_SetOpa(tt_aElt[1],opa);if(tt_aV[SHADOW])
{opa=Math.round(opa*0.8);tt_SetOpa(tt_aElt[7],opa);tt_SetOpa(tt_aElt[8],opa);}}
function tt_OnCloseBtnOver(iOver)
{var css=tt_aElt[4].style;iOver<<=1;css.background=tt_aV[CLOSEBTNCOLORS][iOver];css.color=tt_aV[CLOSEBTNCOLORS][iOver+1];}
function tt_OnLClick(e)
{e=e||window.event;if(!((e.button&&e.button&2)||(e.which&&e.which==3)))
{if(tt_aV[CLICKSTICKY]&&(tt_iState&0x4))
{tt_aV[STICKY]=true;tt_iState&=~0x4;}
else if(tt_aV[CLICKCLOSE])
tt_HideInit();}}
function tt_Int(x)
{var y;return(isNaN(y=parseInt(x))?0:y);}
Number.prototype.Timer=function(s,iT,bUrge)
{if(!this.value||bUrge)
this.value=window.setTimeout(s,iT);}
Number.prototype.EndTimer=function()
{if(this.value)
{window.clearTimeout(this.value);this.value=0;}}
function tt_GetWndCliSiz(s)
{var db,y=window["inner"+s],sC="client"+s,sN="number";if(typeof y==sN)
{var y2;return(((db=document.body)&&typeof(y2=db[sC])==sN&&y2&&y2<=y)?y2:((db=document.documentElement)&&typeof(y2=db[sC])==sN&&y2&&y2<=y)?y2:y);}
return(((db=document.documentElement)&&(y=db[sC]))?y:document.body[sC]);}
function tt_SetOpa(el,opa)
{var css=el.style;tt_opa=opa;if(tt_flagOpa==1)
{if(opa<100)
{if(typeof(el.filtNo)==tt_u)
el.filtNo=css.filter;var bVis=css.visibility!="hidden";css.zoom="100%";if(!bVis)
css.visibility="visible";css.filter="alpha(opacity="+opa+")";if(!bVis)
css.visibility="hidden";}
else if(typeof(el.filtNo)!=tt_u)
css.filter=el.filtNo;}
else
{opa/=100.0;switch(tt_flagOpa)
{case 2:css.KhtmlOpacity=opa;break;case 3:css.KHTMLOpacity=opa;break;case 4:css.MozOpacity=opa;break;case 5:css.opacity=opa;break;}}}
function tt_Err(sErr,bIfDebug)
{if(tt_Debug||!bIfDebug)
alert("Tooltip Script Error Message:\n\n"+sErr);}
function tt_ExtCmdEnum()
{var s;for(var i in config)
{s="window."+i.toString().toUpperCase();if(eval("typeof("+s+") == tt_u"))
{eval(s+" = "+tt_aV.length);tt_aV[tt_aV.length]=null;}}}
function tt_ExtCallFncs(arg,sFnc)
{var b=false;for(var i=tt_aExt.length;i;)
{--i;var fnc=tt_aExt[i]["On"+sFnc];if(fnc&&fnc(arg))
b=true;}
return b;}
tt_Init();Ext={version:"2.2"};window["undefined"]=window["undefined"];Ext.apply=function(C,D,B){if(B){Ext.apply(C,B)}if(C&&D&&typeof D=="object"){for(var A in D){C[A]=D[A]}}return C};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=!isOpera&&ua.indexOf("msie")>-1,isIE7=!isOpera&&ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isGecko3=!isSafari&&ua.indexOf("rv:1.9")>-1,isBorderBox=isIE&&!isStrict,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isAir=(ua.indexOf("adobeair")!=-1),isLinux=(ua.indexOf("linux")!=-1),isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}Ext.apply(Ext,{isStrict:isStrict,isSecure:isSecure,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p]}}}return o},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o)});return}var cache={};for(var b in o){var parts=b.split("@");if(parts[1]){var s=parts[0];if(!cache[s]){cache[s]=Ext.select(s)}cache[s].on(parts[1],o[b])}}cache=null},id:function(el,prefix){prefix=prefix||"ext-gen";el=Ext.getDom(el);var id=prefix+(++idSeed);return el?(el.id?el.id:(el.id=id)):id},extend:function(){var io=function(o){for(var m in o){this[m]=o[m]}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=="object"){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments)}}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp}sb.override=function(o){Ext.override(sb,o)};sbp.override=io;Ext.override(sb,overrides);sb.extend=function(o){Ext.extend(sb,o)};return sb}}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method]}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]]}}},urlEncode:function(o){if(!o){return""}var buf=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=="undefined"){buf.push(k,"=&")}else{if(type!="function"&&type!="object"){buf.push(k,"=",encodeURIComponent(ov),"&")}else{if(Ext.isArray(ov)){if(ov.length){for(var i=0,len=ov.length;i<len;i++){buf.push(k,"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&")}}else{buf.push(k,"=&")}}}}}buf.pop();return buf.join("")},urlDecode:function(string,overwrite){if(!string||!string.length){return{}}var obj={};var pairs=string.split("&");var pair,name,value;for(var i=0,len=pairs.length;i<len;i++){pair=pairs[i].split("=");name=decodeURIComponent(pair[0]);value=decodeURIComponent(pair[1]);if(overwrite!==true){if(typeof obj[name]=="undefined"){obj[name]=value}else{if(typeof obj[name]=="string"){obj[name]=[obj[name]];obj[name].push(value)}else{obj[name].push(value)}}}else{obj[name]=value}}return obj},each:function(array,fn,scope){if(typeof array.length=="undefined"||typeof array=="string"){array=[array]}for(var i=0,len=array.length;i<len;i++){if(fn.call(scope||array[i],array[i],i,array)===false){return i}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(Ext.isArray(a)){r=r.concat(a)}else{if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0))}else{r.push(a)}}}return r},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},callback:function(cb,scope,args,delay){if(typeof cb=="function"){if(delay){cb.defer(delay,scope,args||[])}else{cb.apply(scope,args||[])}}},getDom:function(el){if(!el||!document){return null}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el)},getDoc:function(){return Ext.get(document)},getBody:function(){return Ext.get(document.body||document.documentElement)},getCmp:function(id){return Ext.ComponentMgr.get(id)},num:function(v,defaultValue){if(typeof v!="number"){return defaultValue}return v},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;i++){var as=a[i];if(as){if(typeof as.destroy=="function"){as.destroy()}else{if(as.dom){as.removeAllListeners();as.remove()}}}}},removeNode:isIE&&false?function(){var d;return function(n){if(n&&n.tagName!="BODY"){d=d||document.createElement("div");d.appendChild(n);d.innerHTML=""}}}():function(n){if(n&&n.parentNode&&n.tagName!="BODY"){n.parentNode.removeChild(n)}},type:function(o){if(o===undefined||o===null){return false}if(o.htmlElement){return"element"}var t=typeof o;if(t=="object"&&o.nodeName){switch(o.nodeType){case 1:return"element";case 3:return(/\S/).test(o.nodeValue)?"textnode":"whitespace"}}if(t=="object"||t=="function"){switch(o.constructor){case Array:return"array";case RegExp:return"regexp"}if(typeof o.length=="number"&&typeof o.item=="function"){return"nodelist"}}return t},isEmpty:function(v,allowBlank){return v===null||v===undefined||(!allowBlank?v==="":false)},value:function(v,defaultValue,allowBlank){return Ext.isEmpty(v,allowBlank)?defaultValue:v},isArray:function(v){return v&&typeof v.length=="number"&&typeof v.splice=="function"},isDate:function(v){return v&&typeof v.getFullYear=="function"},isOpera:isOpera,isSafari:isSafari,isSafari3:isSafari3,isSafari2:isSafari&&!isSafari3,isIE:isIE,isIE6:isIE&&!isIE7,isIE7:isIE7,isGecko:isGecko,isGecko2:isGecko&&!isGecko3,isGecko3:isGecko3,isBorderBox:isBorderBox,isLinux:isLinux,isWindows:isWindows,isMac:isMac,isAir:isAir,useShims:((isIE&&!isIE7)||(isMac&&isGecko&&!isGecko3))});Ext.ns=Ext.namespace})();Ext.ns("Ext","Ext.util","Ext.grid","Ext.dd","Ext.tree","Ext.data","Ext.form","Ext.menu","Ext.state","Ext.lib","Ext.layout","Ext.app","Ext.ux");Ext.apply(Function.prototype,{createCallback:function(){var A=arguments;var B=this;return function(){return B.apply(window,A)}},createDelegate:function(C,B,A){var D=this;return function(){var F=B||arguments;if(A===true){F=Array.prototype.slice.call(arguments,0);F=F.concat(B)}else{if(typeof A=="number"){F=Array.prototype.slice.call(arguments,0);var E=[A,0].concat(B);Array.prototype.splice.apply(F,E)}}return D.apply(C||window,F)}},defer:function(C,E,B,A){var D=this.createDelegate(E,B,A);if(C){return setTimeout(D,C)}D();return 0},createSequence:function(B,A){if(typeof B!="function"){return this}var C=this;return function(){var D=C.apply(this||window,arguments);B.apply(A||this||window,arguments);return D}},createInterceptor:function(B,A){if(typeof B!="function"){return this}var C=this;return function(){B.target=this;B.method=C;if(B.apply(A||this||window,arguments)===false){return}return C.apply(this||window,arguments)}}});Ext.applyIf(String,{escape:function(A){return A.replace(/('|\\)/g,"\\$1")},leftPad:function(D,B,C){var A=new String(D);if(!C){C=" "}while(A.length<B){A=C+A}return A.toString()},format:function(B){var A=Array.prototype.slice.call(arguments,1);return B.replace(/\{(\d+)\}/g,function(C,D){return A[D]})}});String.prototype.toggle=function(B,A){return this==B?A:B};String.prototype.trim=function(){var A=/^\s+|\s+$/g;return function(){return this.replace(A,"")}}();Ext.applyIf(Number.prototype,{constrain:function(B,A){return Math.min(Math.max(this,B),A)}});Ext.applyIf(Array.prototype,{indexOf:function(C){for(var B=0,A=this.length;B<A;B++){if(this[B]==C){return B}}return-1},remove:function(B){var A=this.indexOf(B);if(A!=-1){this.splice(A,1)}return this}});Date.prototype.getElapsed=function(A){return Math.abs((A||new Date()).getTime()-this.getTime())};(function(){var B;Ext.lib.Dom={getViewWidth:function(E){return E?this.getDocumentWidth():this.getViewportWidth()},getViewHeight:function(E){return E?this.getDocumentHeight():this.getViewportHeight()},getDocumentHeight:function(){var E=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(E,this.getViewportHeight())},getDocumentWidth:function(){var E=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(E,this.getViewportWidth())},getViewportHeight:function(){if(Ext.isIE){return Ext.isStrict?document.documentElement.clientHeight:document.body.clientHeight}else{return self.innerHeight}},getViewportWidth:function(){if(Ext.isIE){return Ext.isStrict?document.documentElement.clientWidth:document.body.clientWidth}else{return self.innerWidth}},isAncestor:function(F,G){F=Ext.getDom(F);G=Ext.getDom(G);if(!F||!G){return false}if(F.contains&&!Ext.isSafari){return F.contains(G)}else{if(F.compareDocumentPosition){return!!(F.compareDocumentPosition(G)&16)}else{var E=G.parentNode;while(E){if(E==F){return true}else{if(!E.tagName||E.tagName.toUpperCase()=="HTML"){return false}}E=E.parentNode}return false}}},getRegion:function(E){return Ext.lib.Region.getRegion(E)},getY:function(E){return this.getXY(E)[1]},getX:function(E){return this.getXY(E)[0]},getXY:function(G){var F,K,M,N,J=(document.body||document.documentElement);G=Ext.getDom(G);if(G==J){return[0,0]}if(G.getBoundingClientRect){M=G.getBoundingClientRect();N=C(document).getScroll();return[M.left+N.left,M.top+N.top]}var O=0,L=0;F=G;var E=C(G).getStyle("position")=="absolute";while(F){O+=F.offsetLeft;L+=F.offsetTop;if(!E&&C(F).getStyle("position")=="absolute"){E=true}if(Ext.isGecko){K=C(F);var P=parseInt(K.getStyle("borderTopWidth"),10)||0;var H=parseInt(K.getStyle("borderLeftWidth"),10)||0;O+=H;L+=P;if(F!=G&&K.getStyle("overflow")!="visible"){O+=H;L+=P}}F=F.offsetParent}if(Ext.isSafari&&E){O-=J.offsetLeft;L-=J.offsetTop}if(Ext.isGecko&&!E){var I=C(J);O+=parseInt(I.getStyle("borderLeftWidth"),10)||0;L+=parseInt(I.getStyle("borderTopWidth"),10)||0}F=G.parentNode;while(F&&F!=J){if(!Ext.isOpera||(F.tagName!="TR"&&C(F).getStyle("display")!="inline")){O-=F.scrollLeft;L-=F.scrollTop}F=F.parentNode}return[O,L]},setXY:function(E,F){E=Ext.fly(E,"_setXY");E.position();var G=E.translatePoints(F);if(F[0]!==false){E.dom.style.left=G.left+"px"}if(F[1]!==false){E.dom.style.top=G.top+"px"}},setX:function(F,E){this.setXY(F,[E,false])},setY:function(E,F){this.setXY(E,[false,F])}};Ext.lib.Event=function(){var F=false;var G=[];var K=[];var I=0;var H=[];var E=0;var J=null;return{POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach()};this._interval=setInterval(M,this.POLL_INTERVAL)}},onAvailable:function(N,L,O,M){H.push({id:N,fn:L,obj:O,override:M,checkReady:false});I=this.POLL_RETRYS;this.startInterval()},addListener:function(Q,M,P){Q=Ext.getDom(Q);if(!Q||!P){return false}if("unload"==M){K[K.length]=[Q,M,P];return true}var O=function(R){return typeof Ext!="undefined"?P(Ext.lib.Event.getEvent(R)):false};var L=[Q,M,P,O];var N=G.length;G[N]=L;this.doAdd(Q,M,O,false);return true},removeListener:function(S,O,R){var Q,N;S=Ext.getDom(S);if(!R){return this.purgeElement(S,false,O)}if("unload"==O){for(Q=0,N=K.length;Q<N;Q++){var M=K[Q];if(M&&M[0]==S&&M[1]==O&&M[2]==R){K.splice(Q,1);return true}}return false}var L=null;var P=arguments[3];if("undefined"==typeof P){P=this._getCacheIndex(S,O,R)}if(P>=0){L=G[P]}if(!S||!L){return false}this.doRemove(S,O,L[this.WFN],false);delete G[P][this.WFN];delete G[P][this.FN];G.splice(P,1);return true},getTarget:function(N,M){N=N.browserEvent||N;var L=N.target||N.srcElement;return this.resolveTextNode(L)},resolveTextNode:function(L){if(Ext.isSafari&&L&&3==L.nodeType){return L.parentNode}else{return L}},getPageX:function(M){M=M.browserEvent||M;var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(Ext.isIE){L+=this.getScroll()[1]}}return L},getPageY:function(L){L=L.browserEvent||L;var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(Ext.isIE){M+=this.getScroll()[0]}}return M},getXY:function(L){L=L.browserEvent||L;return[this.getPageX(L),this.getPageY(L)]},getRelatedTarget:function(M){M=M.browserEvent||M;var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement}else{if(M.type=="mouseover"){L=M.fromElement}}}return this.resolveTextNode(L)},getTime:function(N){N=N.browserEvent||N;if(!N.time){var M=new Date().getTime();try{N.time=M}catch(L){this.lastError=L;return M}}return N.time},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L)},stopPropagation:function(L){L=L.browserEvent||L;if(L.stopPropagation){L.stopPropagation()}else{L.cancelBubble=true}},preventDefault:function(L){L=L.browserEvent||L;if(L.preventDefault){L.preventDefault()}else{L.returnValue=false}},getEvent:function(M){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break}N=N.caller}}return L},getCharCode:function(L){L=L.browserEvent||L;return L.charCode||L.keyCode||0},_getCacheIndex:function(Q,N,P){for(var O=0,M=G.length;O<M;++O){var L=G[O];if(L&&L[this.FN]==P&&L[this.EL]==Q&&L[this.TYPE]==N){return O}}return-1},elCache:{},getEl:function(L){return document.getElementById(L)},clearCache:function(){},_load:function(M){F=true;var L=Ext.lib.Event;if(Ext.isIE){L.doRemove(window,"load",L._load)}},_tryPreloadAttach:function(){if(this.locked){return false}this.locked=true;var R=!F;if(!R){R=(I>0)}var Q=[];for(var M=0,L=H.length;M<L;++M){var P=H[M];if(P){var O=this.getEl(P.id);if(O){if(!P.checkReady||F||O.nextSibling||(document&&document.body)){var N=O;if(P.override){if(P.override===true){N=P.obj}else{N=P.override}}P.fn.call(N,P.obj);H[M]=null}}else{Q.push(P)}}}I=(Q.length===0)?0:I-1;if(R){this.startInterval()}else{clearInterval(this._interval);this._interval=null}this.locked=false;return true},purgeElement:function(P,Q,N){var R=this.getListeners(P,N);if(R){for(var O=0,L=R.length;O<L;++O){var M=R[O];this.removeListener(P,M.type,M.fn)}}if(Q&&P&&P.childNodes){for(O=0,L=P.childNodes.length;O<L;++O){this.purgeElement(P.childNodes[O],Q,N)}}},getListeners:function(M,R){var P=[],L;if(!R){L=[G,K]}else{if(R=="unload"){L=[K]}else{L=[G]}}for(var O=0;O<L.length;++O){var T=L[O];if(T&&T.length>0){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===M&&(!R||R===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.ADJ_SCOPE],index:Q})}}}}return(P.length)?P:null},_unload:function(S){var R=Ext.lib.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.OBJ]}else{Q=M[R.ADJ_SCOPE]}}M[R.FN].call(Q,R.getEvent(S),M[R.OBJ]);K[P]=null;M=null;Q=null}}K=null;if(G&&G.length>0){O=G.length;while(O){N=O-1;M=G[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N)}O=O-1}M=null;R.clearCache()}R.doRemove(window,"unload",R._unload)},getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft]}else{if(M){return[M.scrollTop,M.scrollLeft]}else{return[0,0]}}},doAdd:function(){if(window.addEventListener){return function(O,M,N,L){O.addEventListener(M,N,(L))}}else{if(window.attachEvent){return function(O,M,N,L){O.attachEvent("on"+M,N)}}else{return function(){}}}}(),doRemove:function(){if(window.removeEventListener){return function(O,M,N,L){O.removeEventListener(M,N,(L))}}else{if(window.detachEvent){return function(N,L,M){N.detachEvent("on"+L,M)}}else{return function(){}}}}()}}();var D=Ext.lib.Event;D.on=D.addListener;D.un=D.removeListener;if(document&&document.body){D._load()}else{D.doAdd(window,"load",D._load)}D.doAdd(window,"unload",D._unload);D._tryPreloadAttach();Ext.lib.Ajax={request:function(K,I,E,J,F){if(F){var G=F.headers;if(G){for(var H in G){if(G.hasOwnProperty(H)){this.initHeader(H,G[H],false)}}}if(F.xmlData){if(!G||!G["Content-Type"]){this.initHeader("Content-Type","text/xml",false)}K=(K?K:(F.method?F.method:"POST"));J=F.xmlData}else{if(F.jsonData){if(!G||!G["Content-Type"]){this.initHeader("Content-Type","application/json",false)}K=(K?K:(F.method?F.method:"POST"));J=typeof F.jsonData=="object"?Ext.encode(F.jsonData):F.jsonData}}}return this.asyncRequest(K,I,E,J)},serializeForm:function(F){if(typeof F=="string"){F=(document.getElementById(F)||document.forms[F])}var G,E,H,J,K="",M=false;for(var L=0;L<F.elements.length;L++){G=F.elements[L];J=F.elements[L].disabled;E=F.elements[L].name;H=F.elements[L].value;if(!J&&E){switch(G.type){case"select-one":case"select-multiple":for(var I=0;I<G.options.length;I++){if(G.options[I].selected){if(Ext.isIE){K+=encodeURIComponent(E)+"="+encodeURIComponent(G.options[I].attributes["value"].specified?G.options[I].value:G.options[I].text)+"&"}else{K+=encodeURIComponent(E)+"="+encodeURIComponent(G.options[I].hasAttribute("value")?G.options[I].value:G.options[I].text)+"&"}}}break;case"radio":case"checkbox":if(G.checked){K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&"}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(M==false){K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&";M=true}break;default:K+=encodeURIComponent(E)+"="+encodeURIComponent(H)+"&";break}}}K=K.substr(0,K.length-1);return K},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:"application/x-www-form-urlencoded; charset=UTF-8",useDefaultXhrHeader:true,defaultXhrHeader:"XMLHttpRequest",hasDefaultHeaders:true,defaultHeaders:{},poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(E){this.activeX.unshift(E)},setDefaultPostHeader:function(E){this.useDefaultHeader=E},setDefaultXhrHeader:function(E){this.useDefaultXhrHeader=E},setPollingInterval:function(E){if(typeof E=="number"&&isFinite(E)){this.pollInterval=E}},createXhrObject:function(I){var H,E;try{E=new XMLHttpRequest();H={conn:E,tId:I}}catch(G){for(var F=0;F<this.activeX.length;++F){try{E=new ActiveXObject(this.activeX[F]);H={conn:E,tId:I};break}catch(G){}}}finally{return H}},getConnectionObject:function(){var F;var G=this.transactionId;try{F=this.createXhrObject(G);if(F){this.transactionId++}}catch(E){}finally{return F}},asyncRequest:function(I,F,H,E){var G=this.getConnectionObject();if(!G){return null}else{G.conn.open(I,F,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders["X-Requested-With"]){this.initHeader("X-Requested-With",this.defaultXhrHeader,true)}}if(E&&this.useDefaultHeader&&(!this.hasHeaders||!this.headers["Content-Type"])){this.initHeader("Content-Type",this.defaultPostHeader)}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(G)}this.handleReadyState(G,H);G.conn.send(E||null);return G}},handleReadyState:function(F,G){var E=this;if(G&&G.timeout){this.timeout[F.tId]=window.setTimeout(function(){E.abort(F,G,true)},G.timeout)}this.poll[F.tId]=window.setInterval(function(){if(F.conn&&F.conn.readyState==4){window.clearInterval(E.poll[F.tId]);delete E.poll[F.tId];if(G&&G.timeout){window.clearTimeout(E.timeout[F.tId]);delete E.timeout[F.tId]}E.handleTransactionResponse(F,G)}},this.pollInterval)},handleTransactionResponse:function(I,J,E){if(!J){this.releaseObject(I);return}var G,F;try{if(I.conn.status!==undefined&&I.conn.status!=0){G=I.conn.status}else{G=13030}}catch(H){G=13030}if(G>=200&&G<300){F=this.createResponseObject(I,J.argument);if(J.success){if(!J.scope){J.success(F)}else{J.success.apply(J.scope,[F])}}}else{switch(G){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:F=this.createExceptionObject(I.tId,J.argument,(E?E:false));if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}break;default:F=this.createResponseObject(I,J.argument);if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}}}this.releaseObject(I);F=null},createResponseObject:function(E,K){var H={};var M={};try{var G=E.conn.getAllResponseHeaders();var J=G.split("\n");for(var I=0;I<J.length;I++){var F=J[I].indexOf(":");if(F!=-1){M[J[I].substring(0,F)]=J[I].substring(F+2)}}}catch(L){}H.tId=E.tId;H.status=E.conn.status;H.statusText=E.conn.statusText;H.getResponseHeader=M;H.getAllResponseHeaders=G;H.responseText=E.conn.responseText;H.responseXML=E.conn.responseXML;if(typeof K!==undefined){H.argument=K}return H},createExceptionObject:function(L,H,E){var J=0;var K="communication failure";var G=-1;var F="transaction aborted";var I={};I.tId=L;if(E){I.status=G;I.statusText=F}else{I.status=J;I.statusText=K}if(H){I.argument=H}return I},initHeader:function(E,H,G){var F=(G)?this.defaultHeaders:this.headers;if(F[E]===undefined){F[E]=H}else{F[E]=H+","+F[E]}if(G){this.hasDefaultHeaders=true}else{this.hasHeaders=true}},setHeader:function(E){if(this.hasDefaultHeaders){for(var F in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(F)){E.conn.setRequestHeader(F,this.defaultHeaders[F])}}}if(this.hasHeaders){for(var F in this.headers){if(this.headers.hasOwnProperty(F)){E.conn.setRequestHeader(F,this.headers[F])}}this.headers={};this.hasHeaders=false}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false},abort:function(F,G,E){if(this.isCallInProgress(F)){F.conn.abort();window.clearInterval(this.poll[F.tId]);delete this.poll[F.tId];if(E){delete this.timeout[F.tId]}this.handleTransactionResponse(F,G,true);return true}else{return false}},isCallInProgress:function(E){if(E.conn){return E.conn.readyState!=4&&E.conn.readyState!=0}else{return false}},releaseObject:function(E){E.conn=null;E=null},activeX:["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]};Ext.lib.Region=function(G,H,E,F){this.top=G;this[1]=G;this.right=H;this.bottom=E;this.left=F;this[0]=F};Ext.lib.Region.prototype={contains:function(E){return(E.left>=this.left&&E.right<=this.right&&E.top>=this.top&&E.bottom<=this.bottom)},getArea:function(){return((this.bottom-this.top)*(this.right-this.left))},intersect:function(I){var G=Math.max(this.top,I.top);var H=Math.min(this.right,I.right);var E=Math.min(this.bottom,I.bottom);var F=Math.max(this.left,I.left);if(E>=G&&H>=F){return new Ext.lib.Region(G,H,E,F)}else{return null}},union:function(I){var G=Math.min(this.top,I.top);var H=Math.max(this.right,I.right);var E=Math.max(this.bottom,I.bottom);var F=Math.min(this.left,I.left);return new Ext.lib.Region(G,H,E,F)},constrainTo:function(E){this.top=this.top.constrain(E.top,E.bottom);this.bottom=this.bottom.constrain(E.top,E.bottom);this.left=this.left.constrain(E.left,E.right);this.right=this.right.constrain(E.left,E.right);return this},adjust:function(G,F,E,H){this.top+=G;this.left+=F;this.right+=H;this.bottom+=E;return this}};Ext.lib.Region.getRegion=function(H){var J=Ext.lib.Dom.getXY(H);var G=J[1];var I=J[0]+H.offsetWidth;var E=J[1]+H.offsetHeight;var F=J[0];return new Ext.lib.Region(G,I,E,F)};Ext.lib.Point=function(E,F){if(Ext.isArray(E)){F=E[1];E=E[0]}this.x=this.right=this.left=this[0]=E;this.y=this.top=this.bottom=this[1]=F};Ext.lib.Point.prototype=new Ext.lib.Region();Ext.lib.Anim={scroll:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Scroll)},motion:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Motion)},color:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.ColorAnim)},run:function(I,F,K,L,E,H,G){G=G||Ext.lib.AnimBase;if(typeof L=="string"){L=Ext.lib.Easing[L]}var J=new G(I,F,K,L);J.animateX(function(){Ext.callback(E,H)});return J}};function C(E){if(!B){B=new Ext.Element.Flyweight()}B.dom=E;return B}if(Ext.isIE){function A(){var E=Function.prototype;delete E.createSequence;delete E.defer;delete E.createDelegate;delete E.createCallback;delete E.createInterceptor;window.detachEvent("onunload",A)}window.attachEvent("onunload",A)}Ext.lib.AnimBase=function(F,E,G,H){if(F){this.init(F,E,G,H)}};Ext.lib.AnimBase.prototype={toString:function(){var E=this.getEl();var F=E.id||E.tagName;return("Anim "+F)},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(E,G,F){return this.method(this.currentFrame,G,F-G,this.totalFrames)},setAttribute:function(E,G,F){if(this.patterns.noNegatives.test(E)){G=(G>0)?G:0}Ext.fly(this.getEl(),"_anim").setStyle(E,G+F)},getAttribute:function(E){var G=this.getEl();var I=C(G).getStyle(E);if(I!=="auto"&&!this.patterns.offsetUnit.test(I)){return parseFloat(I)}var F=this.patterns.offsetAttribute.exec(E)||[];var J=!!(F[3]);var H=!!(F[2]);if(H||(C(G).getStyle("position")=="absolute"&&J)){I=G["offset"+F[0].charAt(0).toUpperCase()+F[0].substr(1)]}else{I=0}return I},getDefaultUnit:function(E){if(this.patterns.defaultUnit.test(E)){return"px"}return""},animateX:function(G,E){var F=function(){this.onComplete.removeListener(F);if(typeof G=="function"){G.call(E||this,this)}};this.onComplete.addListener(F,this);this.animate()},setRuntimeAttribute:function(F){var K;var G;var H=this.attributes;this.runtimeAttributes[F]={};var J=function(L){return(typeof L!=="undefined")};if(!J(H[F]["to"])&&!J(H[F]["by"])){return false}K=(J(H[F]["from"]))?H[F]["from"]:this.getAttribute(F);if(J(H[F]["to"])){G=H[F]["to"]}else{if(J(H[F]["by"])){if(K.constructor==Array){G=[];for(var I=0,E=K.length;I<E;++I){G[I]=K[I]+H[F]["by"][I]}}else{G=K+H[F]["by"]}}}this.runtimeAttributes[F].start=K;this.runtimeAttributes[F].end=G;this.runtimeAttributes[F].unit=(J(H[F].unit))?H[F]["unit"]:this.getDefaultUnit(F)},init:function(G,L,K,E){var F=false;var H=null;var J=0;G=Ext.getDom(G);this.attributes=L||{};this.duration=K||1;this.method=E||Ext.lib.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=Ext.lib.AnimMgr.fps;this.getEl=function(){return G};this.isAnimated=function(){return F};this.getStartTime=function(){return H};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(Ext.lib.AnimMgr.fps*this.duration):this.duration;Ext.lib.AnimMgr.registerElement(this)};this.stop=function(O){if(O){this.currentFrame=this.totalFrames;this._onTween.fire()}Ext.lib.AnimMgr.stop(this)};var N=function(){this.onStart.fire();this.runtimeAttributes={};for(var O in this.attributes){this.setRuntimeAttribute(O)}F=true;J=0;H=new Date()};var M=function(){var Q={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};Q.toString=function(){return("duration: "+Q.duration+", currentFrame: "+Q.currentFrame)};this.onTween.fire(Q);var P=this.runtimeAttributes;for(var O in P){this.setAttribute(O,this.doMethod(O,P[O].start,P[O].end),P[O].unit)}J+=1};var I=function(){var O=(new Date()-H)/1000;var P={duration:O,frames:J,fps:J/O};P.toString=function(){return("duration: "+P.duration+", frames: "+P.frames+", fps: "+P.fps)};F=false;J=0;this.onComplete.fire(P)};this._onStart=new Ext.util.Event(this);this.onStart=new Ext.util.Event(this);this.onTween=new Ext.util.Event(this);this._onTween=new Ext.util.Event(this);this.onComplete=new Ext.util.Event(this);this._onComplete=new Ext.util.Event(this);this._onStart.addListener(N);this._onTween.addListener(M);this._onComplete.addListener(I)}};Ext.lib.AnimMgr=new function(){var G=null;var F=[];var E=0;this.fps=1000;this.delay=1;this.registerElement=function(J){F[F.length]=J;E+=1;J._onStart.fire();this.start()};this.unRegister=function(K,J){K._onComplete.fire();J=J||I(K);if(J!=-1){F.splice(J,1)}E-=1;if(E<=0){this.stop()}};this.start=function(){if(G===null){G=setInterval(this.run,this.delay)}};this.stop=function(L){if(!L){clearInterval(G);for(var K=0,J=F.length;K<J;++K){if(F[0].isAnimated()){this.unRegister(F[0],0)}}F=[];G=null;E=0}else{this.unRegister(L)}};this.run=function(){for(var L=0,J=F.length;L<J;++L){var K=F[L];if(!K||!K.isAnimated()){continue}if(K.currentFrame<K.totalFrames||K.totalFrames===null){K.currentFrame+=1;if(K.useSeconds){H(K)}K._onTween.fire()}else{Ext.lib.AnimMgr.stop(K,L)}}};var I=function(L){for(var K=0,J=F.length;K<J;++K){if(F[K]==L){return K}}return-1};var H=function(K){var N=K.totalFrames;var M=K.currentFrame;var L=(K.currentFrame*K.duration*1000/K.totalFrames);var J=(new Date()-K.getStartTime());var O=0;if(J<K.duration*1000){O=Math.round((J/L-1)*K.currentFrame)}else{O=N-(M+1)}if(O>0&&isFinite(O)){if(K.currentFrame+O>=N){O=N-(M+1)}K.currentFrame+=O}}};Ext.lib.Bezier=new function(){this.getPosition=function(I,H){var J=I.length;var G=[];for(var F=0;F<J;++F){G[F]=[I[F][0],I[F][1]]}for(var E=1;E<J;++E){for(F=0;F<J-E;++F){G[F][0]=(1-H)*G[F][0]+H*G[parseInt(F+1,10)][0];G[F][1]=(1-H)*G[F][1]+H*G[parseInt(F+1,10)][1]}}return[G[0][0],G[0][1]]}};(function(){Ext.lib.ColorAnim=function(I,H,J,K){Ext.lib.ColorAnim.superclass.constructor.call(this,I,H,J,K)};Ext.extend(Ext.lib.ColorAnim,Ext.lib.AnimBase);var F=Ext.lib;var G=F.ColorAnim.superclass;var E=F.ColorAnim.prototype;E.toString=function(){var H=this.getEl();var I=H.id||H.tagName;return("ColorAnim "+I)};E.patterns.color=/color$/i;E.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;E.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;E.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;E.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;E.parseColor=function(H){if(H.length==3){return H}var I=this.patterns.hex.exec(H);if(I&&I.length==4){return[parseInt(I[1],16),parseInt(I[2],16),parseInt(I[3],16)]}I=this.patterns.rgb.exec(H);if(I&&I.length==4){return[parseInt(I[1],10),parseInt(I[2],10),parseInt(I[3],10)]}I=this.patterns.hex3.exec(H);if(I&&I.length==4){return[parseInt(I[1]+I[1],16),parseInt(I[2]+I[2],16),parseInt(I[3]+I[3],16)]}return null};E.getAttribute=function(H){var J=this.getEl();if(this.patterns.color.test(H)){var K=C(J).getStyle(H);if(this.patterns.transparent.test(K)){var I=J.parentNode;K=C(I).getStyle(H);while(I&&this.patterns.transparent.test(K)){I=I.parentNode;K=C(I).getStyle(H);if(I.tagName.toUpperCase()=="HTML"){K="#fff"}}}}else{K=G.getAttribute.call(this,H)}return K};E.doMethod=function(I,M,J){var L;if(this.patterns.color.test(I)){L=[];for(var K=0,H=M.length;K<H;++K){L[K]=G.doMethod.call(this,I,M[K],J[K])}L="rgb("+Math.floor(L[0])+","+Math.floor(L[1])+","+Math.floor(L[2])+")"}else{L=G.doMethod.call(this,I,M,J)}return L};E.setRuntimeAttribute=function(I){G.setRuntimeAttribute.call(this,I);if(this.patterns.color.test(I)){var K=this.attributes;var M=this.parseColor(this.runtimeAttributes[I].start);var J=this.parseColor(this.runtimeAttributes[I].end);if(typeof K[I]["to"]==="undefined"&&typeof K[I]["by"]!=="undefined"){J=this.parseColor(K[I].by);for(var L=0,H=M.length;L<H;++L){J[L]=M[L]+J[L]}}this.runtimeAttributes[I].start=M;this.runtimeAttributes[I].end=J}}})();Ext.lib.Easing={easeNone:function(F,E,H,G){return H*F/G+E},easeIn:function(F,E,H,G){return H*(F/=G)*F+E},easeOut:function(F,E,H,G){return-H*(F/=G)*(F-2)+E},easeBoth:function(F,E,H,G){if((F/=G/2)<1){return H/2*F*F+E}return-H/2*((--F)*(F-2)-1)+E},easeInStrong:function(F,E,H,G){return H*(F/=G)*F*F*F+E},easeOutStrong:function(F,E,H,G){return-H*((F=F/G-1)*F*F*F-1)+E},easeBothStrong:function(F,E,H,G){if((F/=G/2)<1){return H/2*F*F*F*F+E}return-H/2*((F-=2)*F*F*F-2)+E},elasticIn:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J)==1){return E+K}if(!I){I=J*0.3}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}return-(F*Math.pow(2,10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I))+E},elasticOut:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J)==1){return E+K}if(!I){I=J*0.3}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}return F*Math.pow(2,-10*G)*Math.sin((G*J-H)*(2*Math.PI)/I)+K+E},elasticBoth:function(G,E,K,J,F,I){if(G==0){return E}if((G/=J/2)==2){return E+K}if(!I){I=J*(0.3*1.5)}if(!F||F<Math.abs(K)){F=K;var H=I/4}else{var H=I/(2*Math.PI)*Math.asin(K/F)}if(G<1){return-0.5*(F*Math.pow(2,10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I))+E}return F*Math.pow(2,-10*(G-=1))*Math.sin((G*J-H)*(2*Math.PI)/I)*0.5+K+E},backIn:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}return I*(F/=H)*F*((G+1)*F-G)+E},backOut:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}return I*((F=F/H-1)*F*((G+1)*F+G)+1)+E},backBoth:function(F,E,I,H,G){if(typeof G=="undefined"){G=1.70158}if((F/=H/2)<1){return I/2*(F*F*(((G*=(1.525))+1)*F-G))+E}return I/2*((F-=2)*F*(((G*=(1.525))+1)*F+G)+2)+E},bounceIn:function(F,E,H,G){return H-Ext.lib.Easing.bounceOut(G-F,0,H,G)+E},bounceOut:function(F,E,H,G){if((F/=G)<(1/2.75)){return H*(7.5625*F*F)+E}else{if(F<(2/2.75)){return H*(7.5625*(F-=(1.5/2.75))*F+0.75)+E}else{if(F<(2.5/2.75)){return H*(7.5625*(F-=(2.25/2.75))*F+0.9375)+E}}}return H*(7.5625*(F-=(2.625/2.75))*F+0.984375)+E},bounceBoth:function(F,E,H,G){if(F<G/2){return Ext.lib.Easing.bounceIn(F*2,0,H,G)*0.5+E}return Ext.lib.Easing.bounceOut(F*2-G,0,H,G)*0.5+H*0.5+E}};(function(){Ext.lib.Motion=function(K,J,L,M){if(K){Ext.lib.Motion.superclass.constructor.call(this,K,J,L,M)}};Ext.extend(Ext.lib.Motion,Ext.lib.ColorAnim);var H=Ext.lib;var I=H.Motion.superclass;var F=H.Motion.prototype;F.toString=function(){var J=this.getEl();var K=J.id||J.tagName;return("Motion "+K)};F.patterns.points=/^points$/i;F.setAttribute=function(J,L,K){if(this.patterns.points.test(J)){K=K||"px";I.setAttribute.call(this,"left",L[0],K);I.setAttribute.call(this,"top",L[1],K)}else{I.setAttribute.call(this,J,L,K)}};F.getAttribute=function(J){if(this.patterns.points.test(J)){var K=[I.getAttribute.call(this,"left"),I.getAttribute.call(this,"top")]}else{K=I.getAttribute.call(this,J)}return K};F.doMethod=function(J,N,K){var M=null;if(this.patterns.points.test(J)){var L=this.method(this.currentFrame,0,100,this.totalFrames)/100;M=H.Bezier.getPosition(this.runtimeAttributes[J],L)}else{M=I.doMethod.call(this,J,N,K)}return M};F.setRuntimeAttribute=function(S){if(this.patterns.points.test(S)){var K=this.getEl();var M=this.attributes;var J;var O=M["points"]["control"]||[];var L;var P,R;if(O.length>0&&!Ext.isArray(O[0])){O=[O]}else{var N=[];for(P=0,R=O.length;P<R;++P){N[P]=O[P]}O=N}Ext.fly(K,"_anim").position();if(G(M["points"]["from"])){Ext.lib.Dom.setXY(K,M["points"]["from"])}else{Ext.lib.Dom.setXY(K,Ext.lib.Dom.getXY(K))}J=this.getAttribute("points");if(G(M["points"]["to"])){L=E.call(this,M["points"]["to"],J);var Q=Ext.lib.Dom.getXY(this.getEl());for(P=0,R=O.length;P<R;++P){O[P]=E.call(this,O[P],J)}}else{if(G(M["points"]["by"])){L=[J[0]+M["points"]["by"][0],J[1]+M["points"]["by"][1]];for(P=0,R=O.length;P<R;++P){O[P]=[J[0]+O[P][0],J[1]+O[P][1]]}}}this.runtimeAttributes[S]=[J];if(O.length>0){this.runtimeAttributes[S]=this.runtimeAttributes[S].concat(O)}this.runtimeAttributes[S][this.runtimeAttributes[S].length]=L}else{I.setRuntimeAttribute.call(this,S)}};var E=function(J,L){var K=Ext.lib.Dom.getXY(this.getEl());J=[J[0]-K[0]+L[0],J[1]-K[1]+L[1]];return J};var G=function(J){return(typeof J!=="undefined")}})();(function(){Ext.lib.Scroll=function(I,H,J,K){if(I){Ext.lib.Scroll.superclass.constructor.call(this,I,H,J,K)}};Ext.extend(Ext.lib.Scroll,Ext.lib.ColorAnim);var F=Ext.lib;var G=F.Scroll.superclass;var E=F.Scroll.prototype;E.toString=function(){var H=this.getEl();var I=H.id||H.tagName;return("Scroll "+I)};E.doMethod=function(H,K,I){var J=null;if(H=="scroll"){J=[this.method(this.currentFrame,K[0],I[0]-K[0],this.totalFrames),this.method(this.currentFrame,K[1],I[1]-K[1],this.totalFrames)]}else{J=G.doMethod.call(this,H,K,I)}return J};E.getAttribute=function(H){var J=null;var I=this.getEl();if(H=="scroll"){J=[I.scrollLeft,I.scrollTop]}else{J=G.getAttribute.call(this,H)}return J};E.setAttribute=function(H,K,J){var I=this.getEl();if(H=="scroll"){I.scrollLeft=K[0];I.scrollTop=K[1]}else{G.setAttribute.call(this,H,K,J)}}})()})();Ext.DomHelper=function(){var tempTableEl=null;var emptyTags=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var tableRe=/^table|tbody|tr|td$/i;var createHtml=function(o){if(typeof o=='string'){return o;}
var b="";if(Ext.isArray(o)){for(var i=0,l=o.length;i<l;i++){b+=createHtml(o[i]);}
return b;}
if(!o.tag){o.tag="div";}
b+="<"+o.tag;for(var attr in o){if(attr=="tag"||attr=="children"||attr=="cn"||attr=="html"||typeof o[attr]=="function")continue;if(attr=="style"){var s=o["style"];if(typeof s=="function"){s=s.call();}
if(typeof s=="string"){b+=' style="'+s+'"';}else if(typeof s=="object"){b+=' style="';for(var key in s){if(typeof s[key]!="function"){b+=key+":"+s[key]+";";}}
b+='"';}}else{if(attr=="cls"){b+=' class="'+o["cls"]+'"';}else if(attr=="htmlFor"){b+=' for="'+o["htmlFor"]+'"';}else{b+=" "+attr+'="'+o[attr]+'"';}}}
if(emptyTags.test(o.tag)){b+="/>";}else{b+=">";var cn=o.children||o.cn;if(cn){b+=createHtml(cn);}else if(o.html){b+=o.html;}
b+="</"+o.tag+">";}
return b;};var createDom=function(o,parentNode){var el;if(Ext.isArray(o)){el=document.createDocumentFragment();for(var i=0,l=o.length;i<l;i++){createDom(o[i],el);}}else if(typeof o=="string"){el=document.createTextNode(o);}else{el=document.createElement(o.tag||'div');var useSet=!!el.setAttribute;for(var attr in o){if(attr=="tag"||attr=="children"||attr=="cn"||attr=="html"||attr=="style"||typeof o[attr]=="function")continue;if(attr=="cls"){el.className=o["cls"];}else{if(useSet)el.setAttribute(attr,o[attr]);else el[attr]=o[attr];}}
Ext.DomHelper.applyStyles(el,o.style);var cn=o.children||o.cn;if(cn){createDom(cn,el);}else if(o.html){el.innerHTML=o.html;}}
if(parentNode){parentNode.appendChild(el);}
return el;};var ieTable=function(depth,s,h,e){tempTableEl.innerHTML=[s,h,e].join('');var i=-1,el=tempTableEl;while(++i<depth){el=el.firstChild;}
return el;};var ts='<table>',te='</table>',tbs=ts+'<tbody>',tbe='</tbody>'+te,trs=tbs+'<tr>',tre='</tr>'+tbe;var insertIntoTable=function(tag,where,el,html){if(!tempTableEl){tempTableEl=document.createElement('div');}
var node;var before=null;if(tag=='td'){if(where=='afterbegin'||where=='beforeend'){return;}
if(where=='beforebegin'){before=el;el=el.parentNode;}else{before=el.nextSibling;el=el.parentNode;}
node=ieTable(4,trs,html,tre);}
else if(tag=='tr'){if(where=='beforebegin'){before=el;el=el.parentNode;node=ieTable(3,tbs,html,tbe);}else if(where=='afterend'){before=el.nextSibling;el=el.parentNode;node=ieTable(3,tbs,html,tbe);}else{if(where=='afterbegin'){before=el.firstChild;}
node=ieTable(4,trs,html,tre);}}else if(tag=='tbody'){if(where=='beforebegin'){before=el;el=el.parentNode;node=ieTable(2,ts,html,te);}else if(where=='afterend'){before=el.nextSibling;el=el.parentNode;node=ieTable(2,ts,html,te);}else{if(where=='afterbegin'){before=el.firstChild;}
node=ieTable(3,tbs,html,tbe);}}else{if(where=='beforebegin'||where=='afterend'){return;}
if(where=='afterbegin'){before=el.firstChild;}
node=ieTable(2,ts,html,te);}
el.insertBefore(node,before);return node;};return{useDom:false,markup:function(o){return createHtml(o);},applyStyles:function(el,styles){if(styles){el=Ext.fly(el);if(typeof styles=="string"){var re=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var matches;while((matches=re.exec(styles))!=null){el.setStyle(matches[1],matches[2]);}}else if(typeof styles=="object"){for(var style in styles){el.setStyle(style,styles[style]);}}else if(typeof styles=="function"){Ext.DomHelper.applyStyles(el,styles.call());}}},insertHtml:function(where,el,html){where=where.toLowerCase();if(el.insertAdjacentHTML){if(tableRe.test(el.tagName)){var rs;if(rs=insertIntoTable(el.tagName.toLowerCase(),where,el,html)){return rs;}}
switch(where){case"beforebegin":el.insertAdjacentHTML('BeforeBegin',html);return el.previousSibling;case"afterbegin":el.insertAdjacentHTML('AfterBegin',html);return el.firstChild;case"beforeend":el.insertAdjacentHTML('BeforeEnd',html);return el.lastChild;case"afterend":el.insertAdjacentHTML('AfterEnd',html);return el.nextSibling;}
throw'Illegal insertion point -> "'+where+'"';}
var range=el.ownerDocument.createRange();var frag;switch(where){case"beforebegin":range.setStartBefore(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el);return el.previousSibling;case"afterbegin":if(el.firstChild){range.setStartBefore(el.firstChild);frag=range.createContextualFragment(html);el.insertBefore(frag,el.firstChild);return el.firstChild;}else{el.innerHTML=html;return el.firstChild;}
case"beforeend":if(el.lastChild){range.setStartAfter(el.lastChild);frag=range.createContextualFragment(html);el.appendChild(frag);return el.lastChild;}else{el.innerHTML=html;return el.lastChild;}
case"afterend":range.setStartAfter(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el.nextSibling);return el.nextSibling;}
throw'Illegal insertion point -> "'+where+'"';},insertBefore:function(el,o,returnElement){return this.doInsert(el,o,returnElement,"beforeBegin");},insertAfter:function(el,o,returnElement){return this.doInsert(el,o,returnElement,"afterEnd","nextSibling");},insertFirst:function(el,o,returnElement){return this.doInsert(el,o,returnElement,"afterBegin","firstChild");},doInsert:function(el,o,returnElement,pos,sibling){el=Ext.getDom(el);var newNode;if(this.useDom){newNode=createDom(o,null);(sibling==="firstChild"?el:el.parentNode).insertBefore(newNode,sibling?el[sibling]:el);}else{var html=createHtml(o);newNode=this.insertHtml(pos,el,html);}
return returnElement?Ext.get(newNode,true):newNode;},append:function(el,o,returnElement){el=Ext.getDom(el);var newNode;if(this.useDom){newNode=createDom(o,null);el.appendChild(newNode);}else{var html=createHtml(o);newNode=this.insertHtml("beforeEnd",el,html);}
return returnElement?Ext.get(newNode,true):newNode;},overwrite:function(el,o,returnElement){el=Ext.getDom(el);el.innerHTML=createHtml(o);return returnElement?Ext.get(el.firstChild,true):el.firstChild;},createTemplate:function(o){var html=createHtml(o);return new Ext.Template(html);}};}();Ext.Template=function(html){var a=arguments;if(Ext.isArray(html)){html=html.join("");}else if(a.length>1){var buf=[];for(var i=0,len=a.length;i<len;i++){if(typeof a[i]=='object'){Ext.apply(this,a[i]);}else{buf[buf.length]=a[i];}}
html=buf.join('');}
this.html=html;if(this.compiled){this.compile();}};Ext.Template.prototype={applyTemplate:function(values){if(this.compiled){return this.compiled(values);}
var useF=this.disableFormats!==true;var fm=Ext.util.Format,tpl=this;var fn=function(m,name,format,args){if(format&&useF){if(format.substr(0,5)=="this."){return tpl.call(format.substr(5),values[name],values);}else{if(args){var re=/^\s*['"](.*)["']\s*$/;args=args.split(',');for(var i=0,len=args.length;i<len;i++){args[i]=args[i].replace(re,"$1");}
args=[values[name]].concat(args);}else{args=[values[name]];}
return fm[format].apply(fm,args);}}else{return values[name]!==undefined?values[name]:"";}};return this.html.replace(this.re,fn);},set:function(html,compile){this.html=html;this.compiled=null;if(compile){this.compile();}
return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Ext.util.Format;var useF=this.disableFormats!==true;var sep=Ext.isGecko?"+":",";var fn=function(m,name,format,args){if(format&&useF){args=args?','+args:"";if(format.substr(0,5)!="this."){format="fm."+format+'(';}else{format='this.call("'+format.substr(5)+'", ';args=", values";}}else{args='';format="(values['"+name+"'] == undefined ? '' : ";}
return"'"+sep+format+"values['"+name+"']"+args+")"+sep+"'";};var body;if(Ext.isGecko){body="this.compiled = function(values){ return '"+
this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else{body=["this.compiled = function(values){ return ['"];body.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));body.push("'].join('');};");body=body.join('');}
eval(body);return this;},call:function(fnName,value,allValues){return this[fnName](value,allValues);},insertFirst:function(el,values,returnElement){return this.doInsert('afterBegin',el,values,returnElement);},insertBefore:function(el,values,returnElement){return this.doInsert('beforeBegin',el,values,returnElement);},insertAfter:function(el,values,returnElement){return this.doInsert('afterEnd',el,values,returnElement);},append:function(el,values,returnElement){return this.doInsert('beforeEnd',el,values,returnElement);},doInsert:function(where,el,values,returnEl){el=Ext.getDom(el);var newNode=Ext.DomHelper.insertHtml(where,el,this.applyTemplate(values));return returnEl?Ext.get(newNode,true):newNode;},overwrite:function(el,values,returnElement){el=Ext.getDom(el);el.innerHTML=this.applyTemplate(values);return returnElement?Ext.get(el.firstChild,true):el.firstChild;}};Ext.Template.prototype.apply=Ext.Template.prototype.applyTemplate;Ext.DomHelper.Template=Ext.Template;Ext.Template.from=function(el,config){el=Ext.getDom(el);return new Ext.Template(el.value||el.innerHTML,config||'');};Ext.DomQuery=function(){var cache={},simpleCache={},valueCache={};var nonSpace=/\S/;var trimRe=/^\s+|\s+$/g;var tplRe=/\{(\d+)\}/g;var modeRe=/^(\s?[\/>+~]\s?|\s|$)/;var tagTokenRe=/^(#)?([\w-\*]+)/;var nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/;function child(p,index){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n;}}
n=n.nextSibling;}
return null;};function next(n){while((n=n.nextSibling)&&n.nodeType!=1);return n;};function prev(n){while((n=n.previousSibling)&&n.nodeType!=1);return n;};function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}
n=nx;}
return this;};function byClassName(c,a,v){if(!v){return c;}
var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((' '+ci.className+' ').indexOf(v)!=-1){r[++ri]=ci;}}
return r;};function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}
if(!n){return null;}
if(attr=="for"){return n.htmlFor;}
if(attr=="class"||attr=="className"){return n.className;}
return n.getAttribute(attr)||n[attr];};function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result;}
tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}
if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci;}}}else if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=='*'){result[++ri]=cj;}}}}else if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=='*')){result[++ri]=n;}}}else if(mode=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(tagName=='*'||n.tagName.toLowerCase()!=tagName)));if(n){result[++ri]=n;}}}
return result;};function concat(a,b){if(b.slice){return a.concat(b);}
for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i];}
return a;}
function byTag(cs,tagName){if(cs.tagName||cs==document){cs=[cs];}
if(!tagName){return cs;}
var r=[],ri=-1;tagName=tagName.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==tagName){r[++ri]=ci;}}
return r;};function byId(cs,attr,id){if(cs.tagName||cs==document){cs=[cs];}
if(!id){return cs;}
var r=[],ri=-1;for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[++ri]=ci;return r;}}
return r;};function byAttribute(cs,attr,value,op,custom){var r=[],ri=-1,st=custom=="{";var f=Ext.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Ext.DomQuery.getStyle(ci,attr);}
else if(attr=="class"||attr=="className"){a=ci.className;}else if(attr=="for"){a=ci.htmlFor;}else if(attr=="href"){a=ci.getAttribute("href",2);}else{a=ci.getAttribute(attr);}
if((f&&f(a,value))||(!f&&a)){r[++ri]=ci;}}
return r;};function byPseudo(cs,name,value){return Ext.DomQuery.pseudos[name](cs,value);};var isIE=window.ActiveXObject?true:false;eval("var batch = 30803;");var key=30803;function nodupIEXml(cs){var d=++key;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}
for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}
return r;}
function nodup(cs){if(!cs){return[];}
var len=cs.length,c,i,r=cs,cj,ri=-1;if(!len||typeof cs.nodeType!="undefined"||len==1){return cs;}
if(isIE&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs);}
var d=++key;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d;}else{r=[];for(var j=0;j<i;j++){r[++ri]=cs[j];}
for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[++ri]=cj;}}
return r;}}
return r;}
function quickDiffIEXml(c1,c2){var d=++key;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}
var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}
for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}
return r;}
function quickDiff(c1,c2){var len1=c1.length;if(!len1){return c2;}
if(isIE&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2);}
var d=++key;for(var i=0;i<len1;i++){c1[i]._qdiff=d;}
var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}
return r;}
function quickId(ns,mode,root,id){if(ns==root){var d=root.ownerDocument||root;return d.getElementById(id);}
ns=getNodes(ns,mode,"*");return byId(ns,null,id);}
return{getStyle:function(el,name){return Ext.fly(el).getStyle(name);},compile:function(path,type){type=type||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=path,mode,lq;var tk=Ext.DomQuery.matchers;var tklen=tk.length;var mm;var lmode=q.match(modeRe);if(lmode&&lmode[1]){fn[fn.length]='mode="'+lmode[1].replace(trimRe,"")+'";';q=q.replace(lmode[1],"");}
while(path.substr(0,1)=="/"){path=path.substr(1);}
while(q&&lq!=q){lq=q;var tm=q.match(tagTokenRe);if(type=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]='n = quickId(n, mode, root, "'+tm[2]+'");';}else{fn[fn.length]='n = getNodes(n, mode, "'+tm[2]+'");';}
q=q.replace(tm[0],"");}else if(q.substr(0,1)!='@'){fn[fn.length]='n = getNodes(n, mode, "*");';}}else{if(tm){if(tm[1]=="#"){fn[fn.length]='n = byId(n, null, "'+tm[2]+'");';}else{fn[fn.length]='n = byTag(n, "'+tm[2]+'");';}
q=q.replace(tm[0],"");}}
while(!(mm=q.match(modeRe))){var matched=false;for(var j=0;j<tklen;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(tplRe,function(x,i){return m[i];});q=q.replace(m[0],"");matched=true;break;}}
if(!matched){throw'Error parsing selector, parsing failed at "'+q+'"';}}
if(mm[1]){fn[fn.length]='mode="'+mm[1].replace(trimRe,"")+'";';q=q.replace(mm[1],"");}}
fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(path,root,type){if(!root||root==document){root=document;}
if(typeof root=="string"){root=document.getElementById(root);}
var paths=path.split(",");var results=[];for(var i=0,len=paths.length;i<len;i++){var p=paths[i].replace(trimRe,"");if(!cache[p]){cache[p]=Ext.DomQuery.compile(p);if(!cache[p]){throw p+" is not a valid selector";}}
var result=cache[p](root);if(result&&result!=document){results=results.concat(result);}}
if(paths.length>1){return nodup(results);}
return results;},selectNode:function(path,root){return Ext.DomQuery.select(path,root)[0];},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Ext.DomQuery.compile(path,"select");}
var n=valueCache[path](root);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==='')?defaultValue:v);},selectNumber:function(path,root,defaultValue){var v=Ext.DomQuery.selectValue(path,root,defaultValue||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}
var isArray=Ext.isArray(el);var result=Ext.DomQuery.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0);},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Ext.DomQuery.compile(ss,"simple");}
var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result;},matchers:[{re:/^\.([\w-]+)/,select:'n = byClassName(n, null, " {1} ");'},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:'n = byPseudo(n, "{1}", "{2}");'},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'},{re:/^#([\w-]+)/,select:'n = byId(n, null, "{1}");'},{re:/^@([\w-]+)/,select:'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'}],operators:{"=":function(a,v){return a==v;},"!=":function(a,v){return a!=v;},"^=":function(a,v){return a&&a.substr(0,v.length)==v;},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v;},"*=":function(a,v){return a&&a.indexOf(v)!==-1;},"%=":function(a,v){return(a%v)==0;},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+'-');},"~=":function(a,v){return a&&(' '+a+' ').indexOf(' '+v+' ')!=-1;}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci;}}
return r;},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci;}}
return r;},"nth-child":function(c,a){var r=[],ri=-1;var m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j;}}
pn._batch=batch;}
if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n;}}else if((n.nodeIndex+l)%f==0){r[++ri]=n;}}
return r;},"only-child":function(c){var r=[],ri=-1;;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci;}}
return r;},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break;}}
if(empty){r[++ri]=ci;}}
return r;},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||'').indexOf(v)!=-1){r[++ri]=ci;}}
return r;},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci;}}
return r;},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci;}}
return r;},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true);},"any":function(c,selectors){var ss=selectors.split('|');var r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Ext.DomQuery.is(ci,s)){r[++ri]=ci;break;}}}
return r;},"odd":function(c){return this["nth-child"](c,"odd");},"even":function(c){return this["nth-child"](c,"even");},"nth":function(c,a){return c[a-1]||[];},"first":function(c){return c[0]||[];},"last":function(c){return c[c.length-1]||[];},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci;}}
return r;},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci;}}
return r;},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci;}}
return r;}}};}();Ext.query=Ext.DomQuery.select;Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners;}};Ext.util.Observable.prototype={fireEvent:function(){if(this.eventsSuspended!==true){var ce=this.events[arguments[0].toLowerCase()];if(typeof ce=="object"){return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}}
return true;},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(eventName,fn,scope,o){if(typeof eventName=="object"){o=eventName;for(var e in o){if(this.filterOptRe.test(e)){continue;}
if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o);}else{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}
return;}
o=(!o||typeof o=="boolean")?{}:o;eventName=eventName.toLowerCase();var ce=this.events[eventName]||true;if(typeof ce=="boolean"){ce=new Ext.util.Event(this,eventName);this.events[eventName]=ce;}
ce.addListener(fn,scope,o);},removeListener:function(eventName,fn,scope){var ce=this.events[eventName.toLowerCase()];if(typeof ce=="object"){ce.removeListener(fn,scope);}},purgeListeners:function(){for(var evt in this.events){if(typeof this.events[evt]=="object"&&typeof(this.events[evt].clearListeners)=='function'){this.events[evt].clearListeners();}}},relayEvents:function(o,events){var createHandler=function(ename){return function(){return this.fireEvent.apply(this,Ext.combine(ename,Array.prototype.slice.call(arguments,0)));};};for(var i=0,len=events.length;i<len;i++){var ename=events[i];if(!this.events[ename]){this.events[ename]=true;};o.on(ename,createHandler(ename),this);}},addEvents:function(o){if(!this.events){this.events={};}
if(typeof o=='string'){for(var i=0,a=arguments,v;v=a[i];i++){if(!this.events[a[i]]){this.events[a[i]]=true;}}}else{Ext.applyIf(this.events,o);}},hasListener:function(eventName){var e=this.events[eventName];return typeof e=="object"&&e.listeners.length>0;},suspendEvents:function(){this.eventsSuspended=true;},resumeEvents:function(){this.eventsSuspended=false;},getMethodEvent:function(method){if(!this.methodEvents){this.methodEvents={};}
var e=this.methodEvents[method];if(!e){e={};this.methodEvents[method]=e;e.originalFn=this[method];e.methodName=method;e.before=[];e.after=[];var returnValue,v,cancel;var obj=this;var makeCall=function(fn,scope,args){if((v=fn.apply(scope||obj,args))!==undefined){if(typeof v==='object'){if(v.returnValue!==undefined){returnValue=v.returnValue;}else{returnValue=v;}
if(v.cancel===true){cancel=true;}}else if(v===false){cancel=true;}else{returnValue=v;}}}
this[method]=function(){returnValue=v=undefined;cancel=false;var args=Array.prototype.slice.call(arguments,0);for(var i=0,len=e.before.length;i<len;i++){makeCall(e.before[i].fn,e.before[i].scope,args);if(cancel){return returnValue;}}
if((v=e.originalFn.apply(obj,args))!==undefined){returnValue=v;}
for(var i=0,len=e.after.length;i<len;i++){makeCall(e.after[i].fn,e.after[i].scope,args);if(cancel){return returnValue;}}
return returnValue;};}
return e;},beforeMethod:function(method,fn,scope){var e=this.getMethodEvent(method);e.before.push({fn:fn,scope:scope});},afterMethod:function(method,fn,scope){var e=this.getMethodEvent(method);e.after.push({fn:fn,scope:scope});},removeMethodListener:function(method,fn,scope){var e=this.getMethodEvent(method);for(var i=0,len=e.before.length;i<len;i++){if(e.before[i].fn==fn&&e.before[i].scope==scope){e.before.splice(i,1);return;}}
for(var i=0,len=e.after.length;i<len;i++){if(e.after[i].fn==fn&&e.after[i].scope==scope){e.after.splice(i,1);return;}}}};Ext.util.Observable.prototype.on=Ext.util.Observable.prototype.addListener;Ext.util.Observable.prototype.un=Ext.util.Observable.prototype.removeListener;Ext.util.Observable.capture=function(o,fn,scope){o.fireEvent=o.fireEvent.createInterceptor(fn,scope);};Ext.util.Observable.releaseCapture=function(o){o.fireEvent=Ext.util.Observable.prototype.fireEvent;};(function(){var createBuffered=function(h,o,scope){var task=new Ext.util.DelayedTask();return function(){task.delay(o.buffer,h,scope,Array.prototype.slice.call(arguments,0));};};var createSingle=function(h,e,fn,scope){return function(){e.removeListener(fn,scope);return h.apply(scope,arguments);};};var createDelayed=function(h,o,scope){return function(){var args=Array.prototype.slice.call(arguments,0);setTimeout(function(){h.apply(scope,args);},o.delay||10);};};Ext.util.Event=function(obj,name){this.name=name;this.obj=obj;this.listeners=[];};Ext.util.Event.prototype={addListener:function(fn,scope,options){scope=scope||this.obj;if(!this.isListening(fn,scope)){var l=this.createListener(fn,scope,options);if(!this.firing){this.listeners.push(l);}else{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},createListener:function(fn,scope,o){o=o||{};scope=scope||this.obj;var l={fn:fn,scope:scope,options:o};var h=fn;if(o.delay){h=createDelayed(h,o,scope);}
if(o.single){h=createSingle(h,this,fn,scope);}
if(o.buffer){h=createBuffered(h,o,scope);}
l.fireFn=h;return l;},findListener:function(fn,scope){scope=scope||this.obj;var ls=this.listeners;for(var i=0,len=ls.length;i<len;i++){var l=ls[i];if(l.fn==fn&&l.scope==scope){return i;}}
return-1;},isListening:function(fn,scope){return this.findListener(fn,scope)!=-1;},removeListener:function(fn,scope){var index;if((index=this.findListener(fn,scope))!=-1){if(!this.firing){this.listeners.splice(index,1);}else{this.listeners=this.listeners.slice(0);this.listeners.splice(index,1);}
return true;}
return false;},clearListeners:function(){this.listeners=[];},fire:function(){var ls=this.listeners,scope,len=ls.length;if(len>0){this.firing=true;var args=Array.prototype.slice.call(arguments,0);for(var i=0;i<len;i++){var l=ls[i];if(l.fireFn.apply(l.scope||this.obj||window,arguments)===false){this.firing=false;return false;}}
this.firing=false;}
return true;}};})();Ext.EventManager=function(){var docReadyEvent,docReadyProcId,docReadyState=false;var resizeEvent,resizeTask,textEvent,textSize;var E=Ext.lib.Event;var D=Ext.lib.Dom;var xname='Ex'+'t';var elHash={};var addListener=function(el,ename,fn,wrap,scope){var id=Ext.id(el);if(!elHash[id]){elHash[id]={};}
var es=elHash[id];if(!es[ename]){es[ename]=[];}
var ls=es[ename];ls.push({id:id,ename:ename,fn:fn,wrap:wrap,scope:scope});E.on(el,ename,wrap);if(ename=="mousewheel"&&el.addEventListener){el.addEventListener("DOMMouseScroll",wrap,false);E.on(window,'unload',function(){el.removeEventListener("DOMMouseScroll",wrap,false);});}
if(ename=="mousedown"&&el==document){Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);}}
var removeListener=function(el,ename,fn,scope){el=Ext.getDom(el);var id=Ext.id(el),es=elHash[id],wrap;if(es){var ls=es[ename],l;if(ls){for(var i=0,len=ls.length;i<len;i++){l=ls[i];if(l.fn==fn&&(!scope||l.scope==scope)){wrap=l.wrap;E.un(el,ename,wrap);ls.splice(i,1);break;}}}}
if(ename=="mousewheel"&&el.addEventListener&&wrap){el.removeEventListener("DOMMouseScroll",wrap,false);}
if(ename=="mousedown"&&el==document&&wrap){Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);}}
var removeAll=function(el){el=Ext.getDom(el);var id=Ext.id(el),es=elHash[id],ls;if(es){for(var ename in es){if(es.hasOwnProperty(ename)){ls=es[ename];for(var i=0,len=ls.length;i<len;i++){E.un(el,ename,ls[i].wrap);ls[i]=null;}}
es[ename]=null;}
delete elHash[id];}}
var fireDocReady=function(){if(!docReadyState){docReadyState=Ext.isReady=true;if(Ext.isGecko||Ext.isOpera){document.removeEventListener("DOMContentLoaded",fireDocReady,false);}}
if(docReadyProcId){clearInterval(docReadyProcId);docReadyProcId=null;}
if(docReadyEvent){docReadyEvent.fire();docReadyEvent.clearListeners();}};var initDocReady=function(){docReadyEvent=new Ext.util.Event();if(Ext.isReady){return;}
E.on(window,'load',fireDocReady);if(Ext.isGecko||Ext.isOpera){document.addEventListener('DOMContentLoaded',fireDocReady,false);}
else if(Ext.isIE){docReadyProcId=setInterval(function(){try{Ext.isReady||(document.documentElement.doScroll('left'));}catch(e){return;}
fireDocReady();},5);document.onreadystatechange=function(){if(document.readyState=='complete'){document.onreadystatechange=null;fireDocReady();}};}
else if(Ext.isSafari){docReadyProcId=setInterval(function(){var rs=document.readyState;if(rs=='complete'){fireDocReady();}},10);}};var createBuffered=function(h,o){var task=new Ext.util.DelayedTask(h);return function(e){e=new Ext.EventObjectImpl(e);task.delay(o.buffer,h,null,[e]);};};var createSingle=function(h,el,ename,fn,scope){return function(e){Ext.EventManager.removeListener(el,ename,fn,scope);h(e);};};var createDelayed=function(h,o){return function(e){e=new Ext.EventObjectImpl(e);setTimeout(function(){h(e);},o.delay||10);};};var listen=function(element,ename,opt,fn,scope){var o=(!opt||typeof opt=="boolean")?{}:opt;fn=fn||o.fn;scope=scope||o.scope;var el=Ext.getDom(element);if(!el){throw"Error listening for \""+ename+'\". Element "'+element+'" doesn\'t exist.';}
var h=function(e){if(!window[xname]){return;}
e=Ext.EventObject.setEvent(e);var t;if(o.delegate){t=e.getTarget(o.delegate,el);if(!t){return;}}else{t=e.target;}
if(o.stopEvent===true){e.stopEvent();}
if(o.preventDefault===true){e.preventDefault();}
if(o.stopPropagation===true){e.stopPropagation();}
if(o.normalized===false){e=e.browserEvent;}
fn.call(scope||el,e,t,o);};if(o.delay){h=createDelayed(h,o);}
if(o.single){h=createSingle(h,el,ename,fn,scope);}
if(o.buffer){h=createBuffered(h,o);}
addListener(el,ename,fn,h,scope);return h;};var propRe=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var pub={addListener:function(element,eventName,fn,scope,options){if(typeof eventName=="object"){var o=eventName;for(var e in o){if(propRe.test(e)){continue;}
if(typeof o[e]=="function"){listen(element,e,o,o[e],o.scope);}else{listen(element,e,o[e]);}}
return;}
return listen(element,eventName,options,fn,scope);},removeListener:function(element,eventName,fn,scope){return removeListener(element,eventName,fn,scope);},removeAll:function(element){return removeAll(element);},onDocumentReady:function(fn,scope,options){if(!docReadyEvent){initDocReady();}
if(docReadyState||Ext.isReady){options||(options={});fn.defer(options.delay||0,scope);}else{docReadyEvent.addListener(fn,scope,options);}},onWindowResize:function(fn,scope,options){if(!resizeEvent){resizeEvent=new Ext.util.Event();resizeTask=new Ext.util.DelayedTask(function(){resizeEvent.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",this.fireWindowResize,this);}
resizeEvent.addListener(fn,scope,options);},fireWindowResize:function(){if(resizeEvent){if((Ext.isIE||Ext.isAir)&&resizeTask){resizeTask.delay(50);}else{resizeEvent.fire(D.getViewWidth(),D.getViewHeight());}}},onTextResize:function(fn,scope,options){if(!textEvent){textEvent=new Ext.util.Event();var textEl=new Ext.Element(document.createElement('div'));textEl.dom.className='x-text-resize';textEl.dom.innerHTML='X';textEl.appendTo(document.body);textSize=textEl.dom.offsetHeight;setInterval(function(){if(textEl.dom.offsetHeight!=textSize){textEvent.fire(textSize,textSize=textEl.dom.offsetHeight);}},this.textResizeInterval);}
textEvent.addListener(fn,scope,options);},removeResizeListener:function(fn,scope){if(resizeEvent){resizeEvent.removeListener(fn,scope);}},fireResize:function(){if(resizeEvent){resizeEvent.fire(D.getViewWidth(),D.getViewHeight());}},ieDeferSrc:false,textResizeInterval:50};pub.on=pub.addListener;pub.un=pub.removeListener;pub.stoppedMouseDownEvent=new Ext.util.Event();return pub;}();Ext.onReady=Ext.EventManager.onDocumentReady;(function(){var initExtCss=function(){var bd=document.body||document.getElementsByTagName('body')[0];if(!bd){return false;}
var cls=[' ',Ext.isIE?"ext-ie "+(Ext.isIE6?'ext-ie6':'ext-ie7'):Ext.isGecko?"ext-gecko "+(Ext.isGecko2?'ext-gecko2':'ext-gecko3'):Ext.isOpera?"ext-opera":Ext.isSafari?"ext-safari":""];if(Ext.isMac){cls.push("ext-mac");}
if(Ext.isLinux){cls.push("ext-linux");}
if(Ext.isBorderBox){cls.push('ext-border-box');}
if(Ext.isStrict){var p=bd.parentNode;if(p){p.className+=' ext-strict';}}
bd.className+=cls.join(' ');return true;}
if(!initExtCss()){Ext.onReady(initExtCss);}})();Ext.EventObject=function(){var E=Ext.lib.Event;var safariKeys={3:13,63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var btnMap=Ext.isIE?{1:0,4:1,2:2}:(Ext.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Ext.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Ext.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,CONTROL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGEUP:33,PAGE_DOWN:34,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;}
this.browserEvent=e;if(e){this.button=e.button?btnMap[e.button]:(e.which?e.which-1:-1);if(e.type=='click'&&this.button==-1){this.button=0;}
this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;this.charCode=e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}
return this;},stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=='mousedown'){Ext.EventManager.stoppedMouseDownEvent.fire(this);}
E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}},isNavKeyPress:function(){var k=this.keyCode;k=Ext.isSafari?(safariKeys[k]||k):k;return(k>=33&&k<=40)||k==this.RETURN||k==this.TAB||k==this.ESC;},isSpecialKey:function(){var k=this.keyCode;return(this.type=='keypress'&&this.ctrlKey)||k==9||k==13||k==40||k==27||(k==16)||(k==17)||(k>=18&&k<=20)||(k>=33&&k<=35)||(k>=36&&k<=39)||(k>=44&&k<=45);},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=='mousedown'){Ext.EventManager.stoppedMouseDownEvent.fire(this);}
E.stopPropagation(this.browserEvent);}},getCharCode:function(){return this.charCode||this.keyCode;},getKey:function(){var k=this.keyCode||this.charCode;return Ext.isSafari?(safariKeys[k]||k):k;},getPageX:function(){return this.xy[0];},getPageY:function(){return this.xy[1];},getTime:function(){if(this.browserEvent){return E.getTime(this.browserEvent);}
return null;},getXY:function(){return this.xy;},getTarget:function(selector,maxDepth,returnEl){return selector?Ext.fly(this.target).findParent(selector,maxDepth,returnEl):(returnEl?Ext.get(this.target):this.target);},getRelatedTarget:function(){if(this.browserEvent){return E.getRelatedTarget(this.browserEvent);}
return null;},getWheelDelta:function(){var e=this.browserEvent;var delta=0;if(e.wheelDelta){delta=e.wheelDelta/120;}else if(e.detail){delta=-e.detail/3;}
return delta;},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false;},within:function(el,related){var t=this[related?"getRelatedTarget":"getTarget"]();return t&&Ext.fly(el).contains(t);},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1]);}};return new Ext.EventObjectImpl();}();(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var propCache={};var camelRe=/(-[a-z])/gi;var camelFn=function(m,a){return a.charAt(1).toUpperCase();};var view=document.defaultView;Ext.Element=function(element,forceNew){var dom=typeof element=="string"?document.getElementById(element):element;if(!dom){return null;}
var id=dom.id;if(forceNew!==true&&id&&Ext.Element.cache[id]){return Ext.Element.cache[id];}
this.dom=dom;this.id=id||Ext.id(dom);};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(visMode){this.visibilityMode=visMode;return this;},enableDisplayMode:function(display){this.setVisibilityMode(El.DISPLAY);if(typeof display!="undefined")this.originalDisplay=display;return this;},findParent:function(simpleSelector,maxDepth,returnEl){var p=this.dom,b=document.body,depth=0,dq=Ext.DomQuery,stopEl;maxDepth=maxDepth||50;if(typeof maxDepth!="number"){stopEl=Ext.getDom(maxDepth);maxDepth=10;}
while(p&&p.nodeType==1&&depth<maxDepth&&p!=b&&p!=stopEl){if(dq.is(p,simpleSelector)){return returnEl?Ext.get(p):p;}
depth++;p=p.parentNode;}
return null;},findParentNode:function(simpleSelector,maxDepth,returnEl){var p=Ext.fly(this.dom.parentNode,'_internal');return p?p.findParent(simpleSelector,maxDepth,returnEl):null;},up:function(simpleSelector,maxDepth){return this.findParentNode(simpleSelector,maxDepth,true);},is:function(simpleSelector){return Ext.DomQuery.is(this.dom,simpleSelector);},animate:function(args,duration,onComplete,easing,animType){this.anim(args,{duration:duration,callback:onComplete,easing:easing},animType);return this;},anim:function(args,opt,animType,defaultDur,defaultEase,cb){animType=animType||'run';opt=opt||{};var anim=Ext.lib.Anim[animType](this.dom,args,(opt.duration||defaultDur)||.35,(opt.easing||defaultEase)||'easeOut',function(){Ext.callback(cb,this);Ext.callback(opt.callback,opt.scope||this,[this,opt]);},this);opt.anim=anim;return anim;},preanim:function(a,i){return!a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]});},clean:function(forceReclean){if(this.isCleaned&&forceReclean!==true){return this;}
var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}
n=nx;}
this.isCleaned=true;return this;},scrollIntoView:function(container,hscroll){var c=Ext.getDom(container)||Ext.getBody().dom;var el=this.dom;var o=this.getOffsetsTo(c),l=o[0]+c.scrollLeft,t=o[1]+c.scrollTop,b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(el.offsetHeight>ch||t<ct){c.scrollTop=t;}else if(b>cb){c.scrollTop=b-ch;}
c.scrollTop=c.scrollTop;if(hscroll!==false){if(el.offsetWidth>c.clientWidth||l<cl){c.scrollLeft=l;}else if(r>cr){c.scrollLeft=r-c.clientWidth;}
c.scrollLeft=c.scrollLeft;}
return this;},scrollChildIntoView:function(child,hscroll){Ext.fly(child,'_scrollChildIntoView').scrollIntoView(this,hscroll);},autoHeight:function(animate,duration,onComplete,easing){var oldHeight=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var height=parseInt(this.dom.scrollHeight,10);if(!animate){this.setHeight(height);this.unclip();if(typeof onComplete=="function"){onComplete();}}else{this.setHeight(oldHeight);this.setHeight(height,animate,duration,function(){this.unclip();if(typeof onComplete=="function")onComplete();}.createDelegate(this),easing);}}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}
return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(deep){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(deep!==true||!vis){return vis;}
var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,'_isVisible').isVisible()){return false;}
p=p.parentNode;}
return true;},select:function(selector,unique){return El.select(selector,unique,this.dom);},query:function(selector){return Ext.DomQuery.select(selector,this.dom);},child:function(selector,returnDom){var n=Ext.DomQuery.selectNode(selector,this.dom);return returnDom?n:Ext.get(n);},down:function(selector,returnDom){var n=Ext.DomQuery.selectNode(" > "+selector,this.dom);return returnDom?n:Ext.get(n);},initDD:function(group,config,overrides){var dd=new Ext.dd.DD(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides);},initDDProxy:function(group,config,overrides){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides);},initDDTarget:function(group,config,overrides){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides);},setVisible:function(visible,animate){if(!animate||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(visible);}else{this.fixDisplay();this.dom.style.visibility=visible?"visible":"hidden";}}else{var dom=this.dom;var visMode=this.visibilityMode;if(visible){this.setOpacity(.01);this.setVisible(true);}
this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,.35,'easeIn',function(){if(!visible){if(visMode==El.DISPLAY){dom.style.display="none";}else{dom.style.visibility="hidden";}
Ext.get(dom).setOpacity(1);}});}
return this;},isDisplayed:function(){return this.getStyle("display")!="none";},toggle:function(animate){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this;},setDisplayed:function(value){if(typeof value=="boolean"){value=value?this.originalDisplay:"none";}
this.setStyle("display",value);return this;},focus:function(){try{this.dom.focus();}catch(e){}
return this;},blur:function(){try{this.dom.blur();}catch(e){}
return this;},addClass:function(className){if(Ext.isArray(className)){for(var i=0,len=className.length;i<len;i++){this.addClass(className[i]);}}else{if(className&&!this.hasClass(className)){this.dom.className=this.dom.className+" "+className;}}
return this;},radioClass:function(className){var siblings=this.dom.parentNode.childNodes;for(var i=0;i<siblings.length;i++){var s=siblings[i];if(s.nodeType==1){Ext.get(s).removeClass(className);}}
this.addClass(className);return this;},removeClass:function(className){if(!className||!this.dom.className){return this;}
if(Ext.isArray(className)){for(var i=0,len=className.length;i<len;i++){this.removeClass(className[i]);}}else{if(this.hasClass(className)){var re=this.classReCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)',"g");this.classReCache[className]=re;}
this.dom.className=this.dom.className.replace(re," ");}}
return this;},classReCache:{},toggleClass:function(className){if(this.hasClass(className)){this.removeClass(className);}else{this.addClass(className);}
return this;},hasClass:function(className){return className&&(' '+this.dom.className+' ').indexOf(' '+className+' ')!=-1;},replaceClass:function(oldClassName,newClassName){this.removeClass(oldClassName);this.addClass(newClassName);return this;},getStyles:function(){var a=arguments,len=a.length,r={};for(var i=0;i<len;i++){r[a[i]]=this.getStyle(a[i]);}
return r;},getStyle:function(){return view&&view.getComputedStyle?function(prop){var el=this.dom,v,cs,camel;if(prop=='float'){prop="cssFloat";}
if(v=el.style[prop]){return v;}
if(cs=view.getComputedStyle(el,"")){if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn);}
return cs[camel];}
return null;}:function(prop){var el=this.dom,v,cs,camel;if(prop=='opacity'){if(typeof el.style.filter=='string'){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0;}}}
return 1;}else if(prop=='float'){prop="styleFloat";}
if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn);}
if(v=el.style[camel]){return v;}
if(cs=el.currentStyle){return cs[camel];}
return null;};}(),setStyle:function(prop,value){if(typeof prop=="string"){var camel;if(!(camel=propCache[prop])){camel=propCache[prop]=prop.replace(camelRe,camelFn);}
if(camel=='opacity'){this.setOpacity(value);}else{this.dom.style[camel]=value;}}else{for(var style in prop){if(typeof prop[style]!="function"){this.setStyle(style,prop[style]);}}}
return this;},applyStyles:function(style){Ext.DomHelper.applyStyles(this.dom,style);return this;},getX:function(){return D.getX(this.dom);},getY:function(){return D.getY(this.dom);},getXY:function(){return D.getXY(this.dom);},getOffsetsTo:function(el){var o=this.getXY();var e=Ext.fly(el,'_internal').getXY();return[o[0]-e[0],o[1]-e[1]];},setX:function(x,animate){if(!animate||!A){D.setX(this.dom,x);}else{this.setXY([x,this.getY()],this.preanim(arguments,1));}
return this;},setY:function(y,animate){if(!animate||!A){D.setY(this.dom,y);}else{this.setXY([this.getX(),y],this.preanim(arguments,1));}
return this;},setLeft:function(left){this.setStyle("left",this.addUnits(left));return this;},setTop:function(top){this.setStyle("top",this.addUnits(top));return this;},setRight:function(right){this.setStyle("right",this.addUnits(right));return this;},setBottom:function(bottom){this.setStyle("bottom",this.addUnits(bottom));return this;},setXY:function(pos,animate){if(!animate||!A){D.setXY(this.dom,pos);}else{this.anim({points:{to:pos}},this.preanim(arguments,1),'motion');}
return this;},setLocation:function(x,y,animate){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,animate){this.setXY([x,y],this.preanim(arguments,2));return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(contentHeight){var h=this.dom.offsetHeight||0;h=contentHeight!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");return h<0?0:h;},getWidth:function(contentWidth){var w=this.dom.offsetWidth||0;w=contentWidth!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");return w<0?0:w;},getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle('height'),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth('tb');}}
return h;},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!w){w=parseInt(this.getStyle('width'),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth('lr');}}
return w;},getSize:function(contentSize){return{width:this.getWidth(contentSize),height:this.getHeight(contentSize)};},getStyleSize:function(){var w,h,d=this.dom,s=d.style;if(s.width&&s.width!='auto'){w=parseInt(s.width,10);if(Ext.isBorderBox){w-=this.getFrameWidth('lr');}}
if(s.height&&s.height!='auto'){h=parseInt(s.height,10);if(Ext.isBorderBox){h-=this.getFrameWidth('tb');}}
return{width:w||this.getWidth(true),height:h||this.getHeight(true)};},getViewSize:function(){var d=this.dom,doc=document,aw=0,ah=0;if(d==doc||d==doc.body){return{width:D.getViewWidth(),height:D.getViewHeight()};}else{return{width:d.clientWidth,height:d.clientHeight};}},getValue:function(asNumber){return asNumber?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(width){if(typeof width=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){width-=(this.getBorderWidth("lr")+this.getPadding("lr"));}
if(width<0){width=0;}}
return width;},adjustHeight:function(height){if(typeof height=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){height-=(this.getBorderWidth("tb")+this.getPadding("tb"));}
if(height<0){height=0;}}
return height;},setWidth:function(width,animate){try{width=this.adjustWidth(width);if(!animate||!A){this.dom.style.width=this.addUnits(width);}else{this.anim({width:{to:width}},this.preanim(arguments,1));}}catch(ex){}
return this;},setHeight:function(height,animate){height=this.adjustHeight(height);if(!animate||!A){this.dom.style.height=this.addUnits(height);}else{this.anim({height:{to:height}},this.preanim(arguments,1));}
return this;},setSize:function(width,height,animate){if(typeof width=="object"){height=width.height;width=width.width;}
width=this.adjustWidth(width);height=this.adjustHeight(height);if(!animate||!A){this.dom.style.width=this.addUnits(width);this.dom.style.height=this.addUnits(height);}else{this.anim({width:{to:width},height:{to:height}},this.preanim(arguments,2));}
return this;},setBounds:function(x,y,width,height,animate){if(!animate||!A){this.setSize(width,height);this.setLocation(x,y);}else{width=this.adjustWidth(width);height=this.adjustHeight(height);this.anim({points:{to:[x,y]},width:{to:width},height:{to:height}},this.preanim(arguments,4),'motion');}
return this;},setRegion:function(region,animate){this.setBounds(region.left,region.top,region.right-region.left,region.bottom-region.top,this.preanim(arguments,1));return this;},addListener:function(eventName,fn,scope,options){Ext.EventManager.on(this.dom,eventName,fn,scope||this,options);},removeListener:function(eventName,fn,scope){Ext.EventManager.removeListener(this.dom,eventName,fn,scope||this);return this;},removeAllListeners:function(){Ext.EventManager.removeAll(this.dom);return this;},relayEvent:function(eventName,observable){this.on(eventName,function(e){observable.fireEvent(eventName,e);});},setOpacity:function(opacity,animate){if(!animate||!A){var s=this.dom.style;if(Ext.isIE){s.zoom=1;s.filter=(s.filter||'').replace(/alpha\([^\)]*\)/gi,"")+
(opacity==1?"":" alpha(opacity="+opacity*100+")");}else{s.opacity=opacity;}}else{this.anim({opacity:{to:opacity}},this.preanim(arguments,1),null,.35,'easeIn');}
return this;},getLeft:function(local){if(!local){return this.getX();}else{return parseInt(this.getStyle("left"),10)||0;}},getRight:function(local){if(!local){return this.getX()+this.getWidth();}else{return(this.getLeft(true)+this.getWidth())||0;}},getTop:function(local){if(!local){return this.getY();}else{return parseInt(this.getStyle("top"),10)||0;}},getBottom:function(local){if(!local){return this.getY()+this.getHeight();}else{return(this.getTop(true)+this.getHeight())||0;}},position:function(pos,zIndex,x,y){if(!pos){if(this.getStyle('position')=='static'){this.setStyle('position','relative');}}else{this.setStyle("position",pos);}
if(zIndex){this.setStyle("z-index",zIndex);}
if(x!==undefined&&y!==undefined){this.setXY([x,y]);}else if(x!==undefined){this.setX(x);}else if(y!==undefined){this.setY(y);}},clearPositioning:function(value){value=value||'';this.setStyle({"left":value,"right":value,"top":value,"bottom":value,"z-index":"","position":"static"});return this;},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return{"position":this.getStyle("position"),"left":l,"right":l?"":this.getStyle("right"),"top":t,"bottom":t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")};},getBorderWidth:function(side){return this.addStyles(side,El.borders);},getPadding:function(side){return this.addStyles(side,El.paddings);},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right="";}
if(pc.bottom=="auto"){this.dom.style.bottom="";}
return this;},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block");}}},setOverflow:function(v){if(v=='auto'&&Ext.isMac&&Ext.isGecko2){this.dom.style.overflow='hidden';(function(){this.dom.style.overflow='auto';}).defer(1,this);}else{this.dom.style.overflow=v;}},setLeftTop:function(left,top){this.dom.style.left=this.addUnits(left);this.dom.style.top=this.addUnits(top);return this;},move:function(direction,distance,animate){var xy=this.getXY();direction=direction.toLowerCase();switch(direction){case"l":case"left":this.moveTo(xy[0]-distance,xy[1],this.preanim(arguments,2));break;case"r":case"right":this.moveTo(xy[0]+distance,xy[1],this.preanim(arguments,2));break;case"t":case"top":case"up":this.moveTo(xy[0],xy[1]-distance,this.preanim(arguments,2));break;case"b":case"bottom":case"down":this.moveTo(xy[0],xy[1]+distance,this.preanim(arguments,2));break;}
return this;},clip:function(){if(!this.isClipped){this.isClipped=true;this.originalClip={"o":this.getStyle("overflow"),"x":this.getStyle("overflow-x"),"y":this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden");}
return this;},unclip:function(){if(this.isClipped){this.isClipped=false;var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o);}
if(o.x){this.setStyle("overflow-x",o.x);}
if(o.y){this.setStyle("overflow-y",o.y);}}
return this;},getAnchorXY:function(anchor,local,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;w=D.getViewWidth();h=D.getViewHeight();}else{w=this.getWidth();h=this.getHeight();}}else{w=s.width;h=s.height;}
var x=0,y=0,r=Math.round;switch((anchor||"tl").toLowerCase()){case"c":x=r(w*.5);y=r(h*.5);break;case"t":x=r(w*.5);y=0;break;case"l":x=0;y=r(h*.5);break;case"r":x=w;y=r(h*.5);break;case"b":x=r(w*.5);y=h;break;case"tl":x=0;y=0;break;case"bl":x=0;y=h;break;case"br":x=w;y=h;break;case"tr":x=w;y=0;break;}
if(local===true){return[x,y];}
if(vp){var sc=this.getScroll();return[x+sc.left,y+sc.top];}
var o=this.getXY();return[x+o[0],y+o[1]];},getAlignToXY:function(el,p,o){el=Ext.get(el);if(!el||!el.dom){throw"Element.alignToXY with an element that doesn't exist";}
var d=this.dom;var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl";}else if(p=="?"){p="tl-bl?";}else if(p.indexOf("-")==-1){p="tl-"+p;}
p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw"Element.alignTo with an invalid alignment "+p;}
p1=m[1];p2=m[2];c=!!m[3];var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var p1y=p1.charAt(0),p1x=p1.charAt(p1.length-1);var p2y=p2.charAt(0),p2x=p2.charAt(p2.length-1);var swapY=((p1y=="t"&&p2y=="b")||(p1y=="b"&&p2y=="t"));var swapX=((p1x=="r"&&p2x=="l")||(p1x=="l"&&p2x=="r"));var doc=document;var scrollX=(doc.documentElement.scrollLeft||doc.body.scrollLeft||0)+5;var scrollY=(doc.documentElement.scrollTop||doc.body.scrollTop||0)+5;if((x+w)>dw+scrollX){x=swapX?r.left-w:dw+scrollX-w;}
if(x<scrollX){x=swapX?r.right:scrollX;}
if((y+h)>dh+scrollY){y=swapY?r.top-h:dh+scrollY-h;}
if(y<scrollY){y=swapY?r.bottom:scrollY;}}
return[x,y];},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,local,offsets,proposedXY){el=Ext.get(el);offsets=offsets?Ext.applyIf(offsets,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Ext.lib.Dom.getViewWidth();vh=Ext.lib.Dom.getViewHeight();}else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!local){var vxy=el.getXY();vx=vxy[0];vy=vxy[1];}}
var s=el.getScroll();vx+=offsets.left+s.left;vy+=offsets.top+s.top;vw-=offsets.right;vh-=offsets.bottom;var vr=vx+vw;var vb=vy+vh;var xy=proposedXY||(!local?this.getXY():[this.getLeft(true),this.getTop(true)]);var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var moved=false;if((x+w)>vr){x=vr-w;moved=true;}
if((y+h)>vb){y=vb-h;moved=true;}
if(x<vx){x=vx;moved=true;}
if(y<vy){y=vy;moved=true;}
return moved?[x,y]:false;};}(),adjustForConstraints:function(xy,parent,offsets){return this.getConstrainToXY(parent||document,false,offsets,xy)||xy;},alignTo:function(element,position,offsets,animate){var xy=this.getAlignToXY(element,position,offsets);this.setXY(xy,this.preanim(arguments,3));return this;},anchorTo:function(el,alignment,offsets,animate,monitorScroll,callback){var action=function(){this.alignTo(el,alignment,offsets,animate);Ext.callback(callback,this);};Ext.EventManager.onWindowResize(action,this);var tm=typeof monitorScroll;if(tm!='undefined'){Ext.EventManager.on(window,'scroll',action,this,{buffer:tm=='number'?monitorScroll:50});}
action.call(this);return this;},clearOpacity:function(){if(window.ActiveXObject){if(typeof this.dom.style.filter=='string'&&(/alpha/i).test(this.dom.style.filter)){this.dom.style.filter="";}}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]="";}
return this;},hide:function(animate){this.setVisible(false,this.preanim(arguments,0));return this;},show:function(animate){this.setVisible(true,this.preanim(arguments,0));return this;},addUnits:function(size){return Ext.Element.addUnits(size,this.defaultUnit);},update:function(html,loadScripts,callback){if(typeof html=="undefined"){html="";}
if(loadScripts!==true){this.dom.innerHTML=html;if(typeof callback=="function"){callback();}
return this;}
var id=Ext.id();var dom=this.dom;html+='<span id="'+id+'"></span>';E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var srcRe=/\ssrc=([\'\"])(.*?)\1/i;var typeRe=/\stype=([\'\"])(.*?)\1/i;var match;while(match=re.exec(html)){var attrs=match[1];var srcMatch=attrs?attrs.match(srcRe):false;if(srcMatch&&srcMatch[2]){var s=document.createElement("script");s.src=srcMatch[2];var typeMatch=attrs.match(typeRe);if(typeMatch&&typeMatch[2]){s.type=typeMatch[2];}
hd.appendChild(s);}else if(match[2]&&match[2].length>0){if(window.execScript){window.execScript(match[2]);}else{window.eval(match[2]);}}}
var el=document.getElementById(id);if(el){Ext.removeNode(el);}
if(typeof callback=="function"){callback();}});dom.innerHTML=html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this;},load:function(){var um=this.getUpdater();um.update.apply(um,arguments);return this;},getUpdater:function(){if(!this.updateManager){this.updateManager=new Ext.Updater(this);}
return this.updateManager;},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this;},getCenterXY:function(){return this.getAlignToXY(document,'c-c');},center:function(centerIn){this.alignTo(centerIn||document,'c-c');return this;},isBorderBox:function(){return noBoxAdjust[this.dom.tagName.toLowerCase()]||Ext.isBorderBox;},getBox:function(contentBox,local){var xy;if(!local){xy=this.getXY();}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top];}
var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!contentBox){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h};}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)};}
bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx;},getFrameWidth:function(sides,onlyContentBox){return onlyContentBox&&Ext.isBorderBox?0:(this.getPadding(sides)+this.getBorderWidth(sides));},setBox:function(box,adjust,animate){var w=box.width,h=box.height;if((adjust&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"));}
this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this;},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint");},1);return this;},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0};}else{return this.addStyles(side,El.margins);}},addStyles:function(sides,styles){var val=0,v,w;for(var i=0,len=sides.length;i<len;i++){v=this.getStyle(styles[sides.charAt(i)]);if(v){w=parseInt(v,10);if(w){val+=(w>=0?w:-1*w);}}}
return val;},createProxy:function(config,renderTo,matchBox){config=typeof config=="object"?config:{tag:"div",cls:config};var proxy;if(renderTo){proxy=Ext.DomHelper.append(renderTo,config,true);}else{proxy=Ext.DomHelper.insertBefore(this.dom,config,true);}
if(matchBox){proxy.setBox(this.getBox());}
return proxy;},mask:function(msg,msgCls){if(this.getStyle("position")=="static"){this.setStyle("position","relative");}
if(this._maskMsg){this._maskMsg.remove();}
if(this._mask){this._mask.remove();}
this._mask=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask"},true);this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=='string'){this._maskMsg=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask-msg",cn:{tag:'div'}},true);var mm=this._maskMsg;mm.dom.className=msgCls?"ext-el-mask-msg "+msgCls:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this);}
if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle('height')=='auto'){this._mask.setSize(this.dom.clientWidth,this.getHeight());}
return this._mask;},unmask:function(){if(this._mask){if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg;}
this._mask.remove();delete this._mask;}
this.removeClass("x-masked");},isMasked:function(){return this._mask&&this._mask.isVisible();},createShim:function(){var el=document.createElement('iframe');el.frameBorder='0';el.className='ext-shim';if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL;}
var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim;},remove:function(){Ext.removeNode(this.dom);delete El.cache[this.dom.id];},hover:function(overFn,outFn,scope){var preOverFn=function(e){if(!e.within(this,true)){overFn.apply(scope||this,arguments);}};var preOutFn=function(e){if(!e.within(this,true)){outFn.apply(scope||this,arguments);}};this.on("mouseover",preOverFn,this.dom);this.on("mouseout",preOutFn,this.dom);return this;},addClassOnOver:function(className){this.hover(function(){Ext.fly(this,'_internal').addClass(className);},function(){Ext.fly(this,'_internal').removeClass(className);});return this;},addClassOnFocus:function(className){this.on("focus",function(){Ext.fly(this,'_internal').addClass(className);},this.dom);this.on("blur",function(){Ext.fly(this,'_internal').removeClass(className);},this.dom);return this;},addClassOnClick:function(className){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,'_internal').addClass(className);var d=Ext.getDoc();var fn=function(){Ext.fly(dom,'_internal').removeClass(className);d.removeListener("mouseup",fn);};d.on("mouseup",fn);});return this;},swallowEvent:function(eventName,preventDefault){var fn=function(e){e.stopPropagation();if(preventDefault){e.preventDefault();}};if(Ext.isArray(eventName)){for(var i=0,len=eventName.length;i<len;i++){this.on(eventName[i],fn);}
return this;}
this.on(eventName,fn);return this;},parent:function(selector,returnDom){return this.matchNode('parentNode','parentNode',selector,returnDom);},next:function(selector,returnDom){return this.matchNode('nextSibling','nextSibling',selector,returnDom);},prev:function(selector,returnDom){return this.matchNode('previousSibling','previousSibling',selector,returnDom);},first:function(selector,returnDom){return this.matchNode('nextSibling','firstChild',selector,returnDom);},last:function(selector,returnDom){return this.matchNode('previousSibling','lastChild',selector,returnDom);},matchNode:function(dir,start,selector,returnDom){var n=this.dom[start];while(n){if(n.nodeType==1&&(!selector||Ext.DomQuery.is(n,selector))){return!returnDom?Ext.get(n):n;}
n=n[dir];}
return null;},appendChild:function(el){el=Ext.get(el);el.appendTo(this);return this;},createChild:function(config,insertBefore,returnDom){config=config||{tag:'div'};if(insertBefore){return Ext.DomHelper.insertBefore(insertBefore,config,returnDom!==true);}
return Ext.DomHelper[!this.dom.firstChild?'overwrite':'append'](this.dom,config,returnDom!==true);},appendTo:function(el){el=Ext.getDom(el);el.appendChild(this.dom);return this;},insertBefore:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el);return this;},insertAfter:function(el){el=Ext.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this;},insertFirst:function(el,returnDom){el=el||{};if(typeof el=='object'&&!el.nodeType&&!el.dom){return this.createChild(el,this.dom.firstChild,returnDom);}else{el=Ext.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return!returnDom?Ext.get(el):el;}},insertSibling:function(el,where,returnDom){var rt;if(Ext.isArray(el)){for(var i=0,len=el.length;i<len;i++){rt=this.insertSibling(el[i],where,returnDom);}
return rt;}
where=where?where.toLowerCase():'before';el=el||{};var refNode=where=='before'?this.dom:this.dom.nextSibling;if(typeof el=='object'&&!el.nodeType&&!el.dom){if(where=='after'&&!this.dom.nextSibling){rt=Ext.DomHelper.append(this.dom.parentNode,el,!returnDom);}else{rt=Ext.DomHelper[where=='after'?'insertAfter':'insertBefore'](this.dom,el,!returnDom);}}else{rt=this.dom.parentNode.insertBefore(Ext.getDom(el),refNode);if(!returnDom){rt=Ext.get(rt);}}
return rt;},wrap:function(config,returnDom){if(!config){config={tag:"div"};}
var newEl=Ext.DomHelper.insertBefore(this.dom,config,!returnDom);newEl.dom?newEl.dom.appendChild(this.dom):newEl.appendChild(this.dom);return newEl;},replace:function(el){el=Ext.get(el);this.insertBefore(el);el.remove();return this;},replaceWith:function(el){if(typeof el=='object'&&!el.nodeType&&!el.dom){el=this.insertSibling(el,'before');}else{el=Ext.getDom(el);this.dom.parentNode.insertBefore(el,this.dom);}
El.uncache(this.id);this.dom.parentNode.removeChild(this.dom);this.dom=el;this.id=Ext.id(el);El.cache[this.id]=this;return this;},insertHtml:function(where,html,returnEl){var el=Ext.DomHelper.insertHtml(where,this.dom,html);return returnEl?Ext.get(el):el;},set:function(o,useSet){var el=this.dom;useSet=typeof useSet=='undefined'?(el.setAttribute?true:false):useSet;for(var attr in o){if(attr=="style"||typeof o[attr]=="function")continue;if(attr=="cls"){el.className=o["cls"];}else if(o.hasOwnProperty(attr)){if(useSet)el.setAttribute(attr,o[attr]);else el[attr]=o[attr];}}
if(o.style){Ext.DomHelper.applyStyles(el,o.style);}
return this;},addKeyListener:function(key,fn,scope){var config;if(typeof key!="object"||Ext.isArray(key)){config={key:key,fn:fn,scope:scope};}else{config={key:key.key,shift:key.shift,ctrl:key.ctrl,alt:key.alt,fn:fn,scope:scope};}
return new Ext.KeyMap(this,config);},addKeyMap:function(config){return new Ext.KeyMap(this,config);},isScrollable:function(){var dom=this.dom;return dom.scrollHeight>dom.clientHeight||dom.scrollWidth>dom.clientWidth;},scrollTo:function(side,value,animate){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!animate||!A){this.dom[prop]=value;}else{var to=prop=="scrollLeft"?[value,this.dom.scrollTop]:[this.dom.scrollLeft,value];this.anim({scroll:{"to":to}},this.preanim(arguments,2),'scroll');}
return this;},scroll:function(direction,distance,animate){if(!this.isScrollable()){return;}
var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;direction=direction.toLowerCase();var scrolled=false;var a=this.preanim(arguments,2);switch(direction){case"l":case"left":if(w-l>cw){var v=Math.min(l+distance,w-cw);this.scrollTo("left",v,a);scrolled=true;}
break;case"r":case"right":if(l>0){var v=Math.max(l-distance,0);this.scrollTo("left",v,a);scrolled=true;}
break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-distance,0);this.scrollTo("top",v,a);scrolled=true;}
break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+distance,h-ch);this.scrollTo("top",v,a);scrolled=true;}
break;}
return scrolled;},translatePoints:function(x,y){if(typeof x=='object'||Ext.isArray(x)){y=x[1];x=x[0];}
var p=this.getStyle('position');var o=this.getXY();var l=parseInt(this.getStyle('left'),10);var t=parseInt(this.getStyle('top'),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft;}
if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop;}
return{left:(x-o[0]+l),top:(y-o[1]+t)};},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l,t;if(Ext.isIE&&Ext.isStrict){l=doc.documentElement.scrollLeft||(doc.body.scrollLeft||0);t=doc.documentElement.scrollTop||(doc.body.scrollTop||0);}else{l=window.pageXOffset||(doc.body.scrollLeft||0);t=window.pageYOffset||(doc.body.scrollTop||0);}
return{left:l,top:t};}else{return{left:d.scrollLeft,top:d.scrollTop};}},getColor:function(attr,defaultValue,prefix){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return defaultValue;}
var color=typeof prefix=="undefined"?"#":prefix;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]);var s=h.toString(16);if(h<16){s="0"+s;}
color+=s;}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);color+=c+c;}}else if(v.length==7){color+=v.substr(1);}}}
return(color.length>5?color.toLowerCase():defaultValue);},boxWrap:function(cls){cls=cls||'x-box';var el=Ext.get(this.insertHtml('beforeBegin',String.format('<div class="{0}">'+El.boxMarkup+'</div>',cls)));el.child('.'+cls+'-mc').dom.appendChild(this.dom);return el;},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!='undefined'&&type!='unknown'){return d[ns+":"+name];}
return d[name];}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name];},getTextWidth:function(text,min,max){return(Ext.util.TextMetrics.measure(this.dom,Ext.value(text,this.dom.innerHTML,true)).width).constrain(min||0,max||1000000);}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.getUpdateManager=ep.getUpdater;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,defaultUnit){if(v===""||v=="auto"){return v;}
if(v===undefined){return'';}
if(typeof v=="number"||!El.unitPattern.test(v)){return v+(defaultUnit||'px');}
return v;};El.boxMarkup='<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var docEl;El.get=function(el){var ex,elm,id;if(!el){return null;}
if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null;}
if(ex=El.cache[el]){ex.dom=elm;}else{ex=El.cache[el]=new El(elm);}
return ex;}else if(el.tagName){if(!(id=el.id)){id=Ext.id(el);}
if(ex=El.cache[id]){ex.dom=el;}else{ex=El.cache[id]=new El(el);}
return ex;}else if(el instanceof El){if(el!=docEl){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el;}
return el;}else if(el.isComposite){return el;}else if(Ext.isArray(el)){return El.select(el);}else if(el==document){if(!docEl){var f=function(){};f.prototype=El.prototype;docEl=new f();docEl.dom=document;}
return docEl;}
return null;};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i<len;i++){if(a[i]){delete El.cache[a[i].id||a[i]];}}};El.garbageCollect=function(){if(!Ext.enableGarbageCollector){clearInterval(El.collectorThread);return;}
for(var eid in El.cache){var el=El.cache[eid],d=el.dom;if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(eid))){delete El.cache[eid];if(d&&Ext.enableListenerCollection){Ext.EventManager.removeAll(d);}}}}
El.collectorThreadId=setInterval(El.garbageCollect,30000);var flyFn=function(){};flyFn.prototype=El.prototype;var _cls=new flyFn();El.Flyweight=function(dom){this.dom=dom;};El.Flyweight.prototype=_cls;El.Flyweight.prototype.isFlyweight=true;El._flyweights={};El.fly=function(el,named){named=named||'_global';el=Ext.getDom(el);if(!el){return null;}
if(!El._flyweights[named]){El._flyweights[named]=new El.Flyweight();}
El._flyweights[named].dom=el;return El._flyweights[named];};Ext.get=El.get;Ext.fly=El.fly;var noBoxAdjust=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){noBoxAdjust['button']=1;}
Ext.EventManager.on(window,'unload',function(){delete El.cache;delete El._flyweights;});})();Ext.enableFx=true;Ext.Fx={slideIn:function(anchor,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){anchor=anchor||"t";this.fixDisplay();var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var wrap=this.fxWrap(r.pos,o,"hidden");var st=this.dom.style;st.visibility="visible";st.position="absolute";var after=function(){el.fxUnwrap(wrap,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,pt={to:[b.x,b.y]},bw={to:b.width},bh={to:b.height};switch(anchor.toLowerCase()){case"t":wrap.setSize(b.width,0);st.left=st.bottom="0";a={height:bh};break;case"l":wrap.setSize(0,b.height);st.right=st.top="0";a={width:bw};break;case"r":wrap.setSize(0,b.height);wrap.setX(b.right);st.left=st.top="0";a={width:bw,points:pt};break;case"b":wrap.setSize(b.width,0);wrap.setY(b.bottom);st.left=st.top="0";a={height:bh,points:pt};break;case"tl":wrap.setSize(0,0);st.right=st.bottom="0";a={width:bw,height:bh};break;case"bl":wrap.setSize(0,0);wrap.setY(b.y+b.height);st.right=st.top="0";a={width:bw,height:bh,points:pt};break;case"br":wrap.setSize(0,0);wrap.setXY([b.right,b.bottom]);st.left=st.top="0";a={width:bw,height:bh,points:pt};break;case"tr":wrap.setSize(0,0);wrap.setX(b.x+b.width);st.left=st.bottom="0";a={width:bw,height:bh,points:pt};break;}
this.dom.style.visibility="visible";wrap.show();arguments.callee.anim=wrap.fxanim(a,o,'motion',.5,'easeOut',after);});return this;},slideOut:function(anchor,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){anchor=anchor||"t";var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var wrap=this.fxWrap(r.pos,o,"visible");var st=this.dom.style;st.visibility="visible";st.position="absolute";wrap.setSize(b);var after=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}
el.fxUnwrap(wrap,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,zero={to:0};switch(anchor.toLowerCase()){case"t":st.left=st.bottom="0";a={height:zero};break;case"l":st.right=st.top="0";a={width:zero};break;case"r":st.left=st.top="0";a={width:zero,points:{to:[b.right,b.y]}};break;case"b":st.left=st.top="0";a={height:zero,points:{to:[b.x,b.bottom]}};break;case"tl":st.right=st.bottom="0";a={width:zero,height:zero};break;case"bl":st.right=st.top="0";a={width:zero,height:zero,points:{to:[b.x,b.bottom]}};break;case"br":st.left=st.top="0";a={width:zero,height:zero,points:{to:[b.x+b.width,b.bottom]}};break;case"tr":st.left=st.bottom="0";a={width:zero,height:zero,points:{to:[b.right,b.y]}};break;}
arguments.callee.anim=wrap.fxanim(a,o,'motion',.5,"easeOut",after);});return this;},puff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.show();var r=this.getFxRestore();var st=this.dom.style;var after=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}
el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;st.fontSize='';el.afterFx(o);};var width=this.getWidth();var height=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(width*2)},height:{to:this.adjustHeight(height*2)},points:{by:[-(width*.5),-(height*.5)]},opacity:{to:0},fontSize:{to:200,unit:"%"}},o,'motion',.5,"easeOut",after);});return this;},switchOff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.clip();var r=this.getFxRestore();var st=this.dom.style;var after=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}
el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);};this.fxanim({opacity:{to:0.3}},null,null,.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*.5]}},o,'motion',0.3,'easeIn',after);}).defer(100,this);});});return this;},highlight:function(color,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){color=color||"ffff9c";var attr=o.attr||"backgroundColor";this.clearOpacity();this.show();var origColor=this.getColor(attr);var restoreColor=this.dom.style[attr];var endColor=(o.endColor||origColor)||"ffffff";var after=function(){el.dom.style[attr]=restoreColor;el.afterFx(o);};var a={};a[attr]={from:color,to:endColor};arguments.callee.anim=this.fxanim(a,o,'color',1,'easeIn',after);});return this;},frame:function(color,count,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){color=color||"#C3DAF9";if(color.length==6){color="#"+color;}
count=count||1;var duration=o.duration||1;this.show();var b=this.getBox();var animFn=function(){var proxy=Ext.getBody().createChild({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+color}});var scale=Ext.isBorderBox?2:1;proxy.animate({top:{from:b.y,to:b.y-20},left:{from:b.x,to:b.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:b.height,to:(b.height+(20*scale))},width:{from:b.width,to:(b.width+(20*scale))}},duration,function(){proxy.remove();if(--count>0){animFn();}else{el.afterFx(o);}});};animFn.call(this);});return this;},pause:function(seconds){var el=this.getFxEl();var o={};el.queueFx(o,function(){setTimeout(function(){el.afterFx(o);},seconds*1000);});return this;},fadeIn:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility='visible';var to=o.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:to}},o,null,.5,"easeOut",function(){if(to==1){this.clearOpacity();}
el.afterFx(o);});});return this;},fadeOut:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){arguments.callee.anim=this.fxanim({opacity:{to:o.endOpacity||0}},o,null,.5,"easeOut",function(){if(this.visibilityMode==Ext.Element.DISPLAY||o.useDisplay){this.dom.style.display="none";}else{this.dom.style.visibility="hidden";}
this.clearOpacity();el.afterFx(o);});});return this;},scale:function(w,h,o){this.shift(Ext.apply({},o,{width:w,height:h}));return this;},shift:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){var a={},w=o.width,h=o.height,x=o.x,y=o.y,op=o.opacity;if(w!==undefined){a.width={to:this.adjustWidth(w)};}
if(h!==undefined){a.height={to:this.adjustHeight(h)};}
if(o.left!==undefined){a.left={to:o.left};}
if(o.top!==undefined){a.top={to:o.top};}
if(o.right!==undefined){a.right={to:o.right};}
if(o.bottom!==undefined){a.bottom={to:o.bottom};}
if(x!==undefined||y!==undefined){a.points={to:[x!==undefined?x:this.getX(),y!==undefined?y:this.getY()]};}
if(op!==undefined){a.opacity={to:op};}
if(o.xy!==undefined){a.points={to:o.xy};}
arguments.callee.anim=this.fxanim(a,o,'motion',.35,"easeOut",function(){el.afterFx(o);});});return this;},ghost:function(anchor,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){anchor=anchor||"b";var r=this.getFxRestore();var w=this.getWidth(),h=this.getHeight();var st=this.dom.style;var after=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}
el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);};var a={opacity:{to:0},points:{}},pt=a.points;switch(anchor.toLowerCase()){case"t":pt.by=[0,-h];break;case"l":pt.by=[-w,0];break;case"r":pt.by=[w,0];break;case"b":pt.by=[0,h];break;case"tl":pt.by=[-w,-h];break;case"bl":pt.by=[-w,h];break;case"br":pt.by=[w,h];break;case"tr":pt.by=[w,-h];break;}
arguments.callee.anim=this.fxanim(a,o,'motion',.5,"easeOut",after);});return this;},syncFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this;},sequenceFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this;},nextFx:function(){var ef=this.fxQueue[0];if(ef){ef.call(this);}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0];},stopFx:function(){if(this.hasActiveFx()){var cur=this.fxQueue[0];if(cur&&cur.anim&&cur.anim.isAnimated()){this.fxQueue=[cur];cur.anim.stop(true);}}
return this;},beforeFx:function(o){if(this.hasActiveFx()&&!o.concurrent){if(o.stopFx){this.stopFx();return true;}
return false;}
return true;},hasFxBlock:function(){var q=this.fxQueue;return q&&q[0]&&q[0].block;},queueFx:function(o,fn){if(!this.fxQueue){this.fxQueue=[];}
if(!this.hasFxBlock()){Ext.applyIf(o,this.fxDefaults);if(!o.concurrent){var run=this.beforeFx(o);fn.block=o.block;this.fxQueue.push(fn);if(run){this.nextFx();}}else{fn.call(this);}}
return this;},fxWrap:function(pos,o,vis){var wrap;if(!o.wrap||!(wrap=Ext.get(o.wrap))){var wrapXY;if(o.fixPosition){wrapXY=this.getXY();}
var div=document.createElement("div");div.style.visibility=vis;wrap=Ext.get(this.dom.parentNode.insertBefore(div,this.dom));wrap.setPositioning(pos);if(wrap.getStyle("position")=="static"){wrap.position("relative");}
this.clearPositioning('auto');wrap.clip();wrap.dom.appendChild(this.dom);if(wrapXY){wrap.setXY(wrapXY);}}
return wrap;},fxUnwrap:function(wrap,pos,o){this.clearPositioning();this.setPositioning(pos);if(!o.wrap){wrap.dom.parentNode.insertBefore(this.dom,wrap.dom);wrap.remove();}},getFxRestore:function(){var st=this.dom.style;return{pos:this.getPositioning(),width:st.width,height:st.height};},afterFx:function(o){if(o.afterStyle){this.applyStyles(o.afterStyle);}
if(o.afterCls){this.addClass(o.afterCls);}
if(o.remove===true){this.remove();}
Ext.callback(o.callback,o.scope,[this]);if(!o.concurrent){this.fxQueue.shift();this.nextFx();}},getFxEl:function(){return Ext.get(this.dom);},fxanim:function(args,opt,animType,defaultDur,defaultEase,cb){animType=animType||'run';opt=opt||{};var anim=Ext.lib.Anim[animType](this.dom,args,(opt.duration||defaultDur)||.35,(opt.easing||defaultEase)||'easeOut',function(){Ext.callback(cb,this);},this);opt.anim=anim;return anim;}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx);Ext.CompositeElement=function(els){this.elements=[];this.addElements(els);};Ext.CompositeElement.prototype={isComposite:true,addElements:function(els){if(!els)return this;if(typeof els=="string"){els=Ext.Element.selectorFunction(els);}
var yels=this.elements;var index=yels.length-1;for(var i=0,len=els.length;i<len;i++){yels[++index]=Ext.get(els[i]);}
return this;},fill:function(els){this.elements=[];this.add(els);return this;},filter:function(selector){var els=[];this.each(function(el){if(el.is(selector)){els[els.length]=el.dom;}});this.fill(els);return this;},invoke:function(fn,args){var els=this.elements;for(var i=0,len=els.length;i<len;i++){Ext.Element.prototype[fn].apply(els[i],args);}
return this;},add:function(els){if(typeof els=="string"){this.addElements(Ext.Element.selectorFunction(els));}else if(els.length!==undefined){this.addElements(els);}else{this.addElements([els]);}
return this;},each:function(fn,scope){var els=this.elements;for(var i=0,len=els.length;i<len;i++){if(fn.call(scope||els[i],els[i],this,i)===false){break;}}
return this;},item:function(index){return this.elements[index]||null;},first:function(){return this.item(0);},last:function(){return this.item(this.elements.length-1);},getCount:function(){return this.elements.length;},contains:function(el){return this.indexOf(el)!==-1;},indexOf:function(el){return this.elements.indexOf(Ext.get(el));},removeElement:function(el,removeDom){if(Ext.isArray(el)){for(var i=0,len=el.length;i<len;i++){this.removeElement(el[i]);}
return this;}
var index=typeof el=='number'?el:this.indexOf(el);if(index!==-1&&this.elements[index]){if(removeDom){var d=this.elements[index];if(d.dom){d.remove();}else{Ext.removeNode(d);}}
this.elements.splice(index,1);}
return this;},replaceElement:function(el,replacement,domReplace){var index=typeof el=='number'?el:this.indexOf(el);if(index!==-1){if(domReplace){this.elements[index].replaceWith(replacement);}else{this.elements.splice(index,1,Ext.get(replacement))}}
return this;},clear:function(){this.elements=[];}};(function(){Ext.CompositeElement.createCall=function(proto,fnName){if(!proto[fnName]){proto[fnName]=function(){return this.invoke(fnName,arguments);};}};for(var fnName in Ext.Element.prototype){if(typeof Ext.Element.prototype[fnName]=="function"){Ext.CompositeElement.createCall(Ext.CompositeElement.prototype,fnName);}};})();Ext.CompositeElementLite=function(els){Ext.CompositeElementLite.superclass.constructor.call(this,els);this.el=new Ext.Element.Flyweight();};Ext.extend(Ext.CompositeElementLite,Ext.CompositeElement,{addElements:function(els){if(els){if(Ext.isArray(els)){this.elements=this.elements.concat(els);}else{var yels=this.elements;var index=yels.length-1;for(var i=0,len=els.length;i<len;i++){yels[++index]=els[i];}}}
return this;},invoke:function(fn,args){var els=this.elements;var el=this.el;for(var i=0,len=els.length;i<len;i++){el.dom=els[i];Ext.Element.prototype[fn].apply(el,args);}
return this;},item:function(index){if(!this.elements[index]){return null;}
this.el.dom=this.elements[index];return this.el;},addListener:function(eventName,handler,scope,opt){var els=this.elements;for(var i=0,len=els.length;i<len;i++){Ext.EventManager.on(els[i],eventName,handler,scope||els[i],opt);}
return this;},each:function(fn,scope){var els=this.elements;var el=this.el;for(var i=0,len=els.length;i<len;i++){el.dom=els[i];if(fn.call(scope||el,el,this,i)===false){break;}}
return this;},indexOf:function(el){return this.elements.indexOf(Ext.getDom(el));},replaceElement:function(el,replacement,domReplace){var index=typeof el=='number'?el:this.indexOf(el);if(index!==-1){replacement=Ext.getDom(replacement);if(domReplace){var d=this.elements[index];d.parentNode.insertBefore(replacement,d);Ext.removeNode(d);}
this.elements.splice(index,1,replacement);}
return this;}});Ext.CompositeElementLite.prototype.on=Ext.CompositeElementLite.prototype.addListener;if(Ext.DomQuery){Ext.Element.selectorFunction=Ext.DomQuery.select;}
Ext.Element.select=function(selector,unique,root){var els;if(typeof selector=="string"){els=Ext.Element.selectorFunction(selector,root);}else if(selector.length!==undefined){els=selector;}else{throw"Invalid selector";}
if(unique===true){return new Ext.CompositeElement(els);}else{return new Ext.CompositeElementLite(els);}};Ext.select=Ext.Element.select;Ext.data.Connection=function(config){Ext.apply(this,config);this.addEvents("beforerequest","requestcomplete","requestexception");Ext.data.Connection.superclass.constructor.call(this);};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,disableCachingParam:'_dc',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:o.timeout||this.timeout};var method=o.method||this.method||((p||o.xmlData||o.jsonData)?"POST":"GET");if(method=='GET'&&(this.disableCaching&&o.disableCaching!==false)||o.disableCaching===true){var dcp=o.disableCachingParam||this.disableCachingParam;url+=(url.indexOf('?')!=-1?'&':'?')+dcp+'='+(new Date().getTime());}
if(typeof o.autoAbort=='boolean'){if(o.autoAbort){this.abort();}}else if(this.autoAbort!==false){this.abort();}
if((method=='GET'||o.xmlData||o.jsonData)&&p){url+=(url.indexOf('?')!=-1?'&':'?')+p;p='';}
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;}},isLoading:function(transId){if(transId){return Ext.lib.Ajax.isCallInProgress(transId);}else{return this.transId?true:false;}},abort:function(transId){if(transId||this.isLoading()){Ext.lib.Ajax.abort(transId||this.transId);}},handleResponse:function(response){this.transId=false;var options=response.argument.options;response.argument=options?options.argument:null;this.fireEvent("requestcomplete",this,response,options);Ext.callback(options.success,options.scope,[response,options]);Ext.callback(options.callback,options.scope,[options,true,response]);},handleFailure:function(response,e){this.transId=false;var options=response.argument.options;response.argument=options?options.argument:null;this.fireEvent("requestexception",this,response,options,e);Ext.callback(options.failure,options.scope,[response,options]);Ext.callback(options.callback,options.scope,[options,false,response]);},doFormUpload:function(o,ps,url){var id=Ext.id();var frame=document.createElement('iframe');frame.id=id;frame.name=id;frame.className='x-hidden';if(Ext.isIE){frame.src=Ext.SSL_SECURE_URL;}
document.body.appendChild(frame);if(Ext.isIE){document.frames[id].name=id;}
var form=Ext.getDom(o.form);form.target=id;form.method='POST';form.enctype=form.encoding='multipart/form-data';if(url){form.action=url;}
var hiddens,hd;if(ps){hiddens=[];ps=Ext.urlDecode(ps,false);for(var k in ps){if(ps.hasOwnProperty(k)){hd=document.createElement('input');hd.type='hidden';hd.name=k;hd.value=ps[k];form.appendChild(hd);hiddens.push(hd);}}}
function cb(){var r={responseText:'',responseXML:null};r.argument=o?o.argument:null;try{var doc;if(Ext.isIE){doc=frame.contentWindow.document;}else{doc=(frame.contentDocument||window.frames[id].document);}
if(doc&&doc.body){r.responseText=doc.body.innerHTML;}
if(doc&&doc.XMLDocument){r.responseXML=doc.XMLDocument;}else{r.responseXML=doc;}}
catch(e){}
Ext.EventManager.removeListener(frame,'load',cb,this);this.fireEvent("requestcomplete",this,r,o);Ext.callback(o.success,o.scope,[r,o]);Ext.callback(o.callback,o.scope,[o,true,r]);setTimeout(function(){Ext.removeNode(frame);},100);}
Ext.EventManager.on(frame,'load',cb,this);form.submit();if(hiddens){for(var i=0,len=hiddens.length;i<len;i++){Ext.removeNode(hiddens[i]);}}}});Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(form){return Ext.lib.Ajax.serializeForm(form);}});Ext.Updater=Ext.extend(Ext.util.Observable,{constructor:function(el,forceNew){el=Ext.get(el);if(!forceNew&&el.updateManager){return el.updateManager;}
this.el=el;this.defaultUrl=null;this.addEvents("beforeupdate","update","failure");var d=Ext.Updater.defaults;this.sslBlankUrl=d.sslBlankUrl;this.disableCaching=d.disableCaching;this.indicatorText=d.indicatorText;this.showLoadIndicator=d.showLoadIndicator;this.timeout=d.timeout;this.loadScripts=d.loadScripts;this.transaction=null;this.refreshDelegate=this.refresh.createDelegate(this);this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);if(!this.renderer){this.renderer=this.getDefaultRenderer();}
Ext.Updater.superclass.constructor.call(this);},getDefaultRenderer:function(){return new Ext.Updater.BasicRenderer();},getEl:function(){return this.el;},update:function(url,params,callback,discardUrl){if(this.fireEvent("beforeupdate",this.el,url,params)!==false){var cfg,callerScope;if(typeof url=="object"){cfg=url;url=cfg.url;params=params||cfg.params;callback=callback||cfg.callback;discardUrl=discardUrl||cfg.discardUrl;callerScope=cfg.scope;if(typeof cfg.nocache!="undefined"){this.disableCaching=cfg.nocache;};if(typeof cfg.text!="undefined"){this.indicatorText='<div class="loading-indicator">'+cfg.text+"</div>";};if(typeof cfg.scripts!="undefined"){this.loadScripts=cfg.scripts;};if(typeof cfg.timeout!="undefined"){this.timeout=cfg.timeout;};}
this.showLoading();if(!discardUrl){this.defaultUrl=url;}
if(typeof url=="function"){url=url.call(this);}
var o=Ext.apply({},{url:url,params:(typeof params=="function"&&callerScope)?params.createDelegate(callerScope):params,success:this.processSuccess,failure:this.processFailure,scope:this,callback:undefined,timeout:(this.timeout*1000),disableCaching:this.disableCaching,argument:{"options":cfg,"url":url,"form":null,"callback":callback,"scope":callerScope||window,"params":params}},cfg);this.transaction=Ext.Ajax.request(o);}},formUpdate:function(form,url,reset,callback){if(this.fireEvent("beforeupdate",this.el,form,url)!==false){if(typeof url=="function"){url=url.call(this);}
form=Ext.getDom(form)
this.transaction=Ext.Ajax.request({form:form,url:url,success:this.processSuccess,failure:this.processFailure,scope:this,timeout:(this.timeout*1000),argument:{"url":url,"form":form,"callback":callback,"reset":reset}});this.showLoading.defer(1,this);}},refresh:function(callback){if(this.defaultUrl==null){return;}
this.update(this.defaultUrl,null,callback,true);},startAutoRefresh:function(interval,url,params,callback,refreshNow){if(refreshNow){this.update(url||this.defaultUrl,params,callback,true);}
if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);}
this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[url||this.defaultUrl,params,callback,true]),interval*1000);},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId;}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false;},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText);}},processSuccess:function(response){this.transaction=null;if(response.argument.form&&response.argument.reset){try{response.argument.form.reset();}catch(e){}}
if(this.loadScripts){this.renderer.render(this.el,response,this,this.updateComplete.createDelegate(this,[response]));}else{this.renderer.render(this.el,response,this);this.updateComplete(response);}},updateComplete:function(response){this.fireEvent("update",this.el,response);if(typeof response.argument.callback=="function"){response.argument.callback.call(response.argument.scope,this.el,true,response,response.argument.options);}},processFailure:function(response){this.transaction=null;this.fireEvent("failure",this.el,response);if(typeof response.argument.callback=="function"){response.argument.callback.call(response.argument.scope,this.el,false,response,response.argument.options);}},setRenderer:function(renderer){this.renderer=renderer;},getRenderer:function(){return this.renderer;},setDefaultUrl:function(defaultUrl){this.defaultUrl=defaultUrl;},abort:function(){if(this.transaction){Ext.Ajax.abort(this.transaction);}},isUpdating:function(){if(this.transaction){return Ext.Ajax.isLoading(this.transaction);}
return false;}});Ext.Updater.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Ext.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:'<div class="loading-indicator">Loading...</div>'};Ext.Updater.updateElement=function(el,url,params,options){var um=Ext.get(el).getUpdater();Ext.apply(um,options);um.update(url,params,options?options.callback:null);};Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(el,response,updateManager,callback){el.update(response.responseText,updateManager.loadScripts,callback);}};Ext.UpdateManager=Ext.Updater;(function(){Date.formatCodeToRegex=function(character,currentGroup){var p=Date.parseCodes[character];if(p){p=Ext.type(p)=='function'?p():p;Date.parseCodes[character]=p;}
return p?Ext.applyIf({c:p.c?String.format(p.c,currentGroup||"{0}"):p.c},p):{g:0,c:null,s:Ext.escapeRe(character)}}
var $f=Date.formatCodeToRegex;Ext.apply(Date,{parseFunctions:{count:0},parseRegexes:[],formatFunctions:{count:0},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],y2kYear:50,MILLI:"ms",SECOND:"s",MINUTE:"mi",HOUR:"h",DAY:"d",MONTH:"mo",YEAR:"y",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNumbers:{Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11},getShortMonthName:function(month){return Date.monthNames[month].substring(0,3);},getShortDayName:function(day){return Date.dayNames[day].substring(0,3);},getMonthNumber:function(name){return Date.monthNumbers[name.substring(0,1).toUpperCase()+name.substring(1,3).toLowerCase()];},formatCodes:{d:"String.leftPad(this.getDate(), 2, '0')",D:"Date.getShortDayName(this.getDay())",j:"this.getDate()",l:"Date.dayNames[this.getDay()]",N:"(this.getDay() ? this.getDay() : 7)",S:"this.getSuffix()",w:"this.getDay()",z:"this.getDayOfYear()",W:"String.leftPad(this.getWeekOfYear(), 2, '0')",F:"Date.monthNames[this.getMonth()]",m:"String.leftPad(this.getMonth() + 1, 2, '0')",M:"Date.getShortMonthName(this.getMonth())",n:"(this.getMonth() + 1)",t:"this.getDaysInMonth()",L:"(this.isLeapYear() ? 1 : 0)",o:"(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))",Y:"this.getFullYear()",y:"('' + this.getFullYear()).substring(2, 4)",a:"(this.getHours() < 12 ? 'am' : 'pm')",A:"(this.getHours() < 12 ? 'AM' : 'PM')",g:"((this.getHours() % 12) ? this.getHours() % 12 : 12)",G:"this.getHours()",h:"String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",H:"String.leftPad(this.getHours(), 2, '0')",i:"String.leftPad(this.getMinutes(), 2, '0')",s:"String.leftPad(this.getSeconds(), 2, '0')",u:"String.leftPad(this.getMilliseconds(), 3, '0')",O:"this.getGMTOffset()",P:"this.getGMTOffset(true)",T:"this.getTimezone()",Z:"(this.getTimezoneOffset() * -60)",c:function(){for(var c="Y-m-dTH:i:sP",code=[],i=0,l=c.length;i<l;++i){var e=c.charAt(i);code.push(e=="T"?"'T'":Date.getFormatCode(e));}
return code.join(" + ");},U:"Math.round(this.getTime() / 1000)"},parseDate:function(input,format){var p=Date.parseFunctions;if(p[format]==null){Date.createParser(format);}
var func=p[format];return Date[func](input);},getFormatCode:function(character){var f=Date.formatCodes[character];if(f){f=Ext.type(f)=='function'?f():f;Date.formatCodes[character]=f;}
return f||("'"+String.escape(character)+"'");},createNewFormat:function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function(){return ";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}
else if(special){special=false;code+="'"+String.escape(ch)+"' + ";}
else{code+=Date.getFormatCode(ch)+" + ";}}
eval(code.substring(0,code.length-3)+";}");},createParser:function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input){\n"
+"var y, m, d, h = 0, i = 0, s = 0, ms = 0, o, z, u, v;\n"
+"input = String(input);\n"
+"d = new Date();\n"
+"y = d.getFullYear();\n"
+"m = d.getMonth();\n"
+"d = d.getDate();\n"
+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"
+"if (results && results.length > 0) {";var regex="";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}
else if(special){special=false;regex+=String.escape(ch);}
else{var obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}
code+="if (u){\n"
+"v = new Date(u * 1000);\n"+"}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0){\n"
+"v = new Date(y, m, d, h, i, s, ms);\n"
+"}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0){\n"
+"v = new Date(y, m, d, h, i, s);\n"
+"}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0){\n"
+"v = new Date(y, m, d, h, i);\n"
+"}else if (y >= 0 && m >= 0 && d > 0 && h >= 0){\n"
+"v = new Date(y, m, d, h);\n"
+"}else if (y >= 0 && m >= 0 && d > 0){\n"
+"v = new Date(y, m, d);\n"
+"}else if (y >= 0 && m >= 0){\n"
+"v = new Date(y, m);\n"
+"}else if (y >= 0){\n"
+"v = new Date(y);\n"
+"}\n}\nreturn (v && (z || o))?"+" (Ext.type(z) == 'number' ? v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - z) :"+" v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn))) : v;\n"+"}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$","i");eval(code);},parseCodes:{d:{g:1,c:"d = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},j:{g:1,c:"d = parseInt(results[{0}], 10);\n",s:"(\\d{1,2})"},D:function(){for(var a=[],i=0;i<7;a.push(Date.getShortDayName(i)),++i);return{g:0,c:null,s:"(?:"+a.join("|")+")"}},l:function(){return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"}},N:{g:0,c:null,s:"[1-7]"},S:{g:0,c:null,s:"(?:st|nd|rd|th)"},w:{g:0,c:null,s:"[0-6]"},z:{g:0,c:null,s:"(?:\\d{1,3}"},W:{g:0,c:null,s:"(?:\\d{2})"},F:function(){return{g:1,c:"m = parseInt(Date.getMonthNumber(results[{0}]), 10);\n",s:"("+Date.monthNames.join("|")+")"}},M:function(){for(var a=[],i=0;i<12;a.push(Date.getShortMonthName(i)),++i);return Ext.applyIf({s:"("+a.join("|")+")"},$f("F"));},m:{g:1,c:"m = parseInt(results[{0}], 10) - 1;\n",s:"(\\d{2})"},n:{g:1,c:"m = parseInt(results[{0}], 10) - 1;\n",s:"(\\d{1,2})"},t:{g:0,c:null,s:"(?:\\d{2})"},L:{g:0,c:null,s:"(?:1|0)"},o:function(){return $f("Y");},Y:{g:1,c:"y = parseInt(results[{0}], 10);\n",s:"(\\d{4})"},y:{g:1,c:"var ty = parseInt(results[{0}], 10);\n"
+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"},a:{g:1,c:"if (results[{0}] == 'am') {\n"
+"if (h == 12) { h = 0; }\n"
+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"},A:{g:1,c:"if (results[{0}] == 'AM') {\n"
+"if (h == 12) { h = 0; }\n"
+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"},g:function(){return $f("G");},G:{g:1,c:"h = parseInt(results[{0}], 10);\n",s:"(\\d{1,2})"},h:function(){return $f("H");},H:{g:1,c:"h = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},i:{g:1,c:"i = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},s:{g:1,c:"s = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},u:{g:1,c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",s:"(\\d+)"},O:{g:1,c:["o = results[{0}];","var sn = o.substring(0,1);","var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);","var mn = o.substring(3,5) % 60;","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join("\n"),s:"([+\-]\\d{4})"},P:{g:1,c:["o = results[{0}];","var sn = o.substring(0,1);","var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);","var mn = o.substring(4,6) % 60;","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join("\n"),s:"([+\-]\\d{2}:\\d{2})"},T:{g:0,c:null,s:"[A-Z]{1,4}"},Z:{g:1,c:"z = results[{0}] * 1;\n"+"z = (-43200 <= z && z <= 50400)? z : null;\n",s:"([+\-]?\\d{1,5})"},c:function(){var calc=[];var arr=[$f("Y",1),$f("m",2),$f("d",3),$f("h",4),$f("i",5),$f("s",6),{c:"ms = (results[7] || '.0').substring(1); ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},{c:"if(results[9] == 'Z'){\no = 0;\n}else{\n"+$f("P",9).c+"\n}"}];for(var i=0,l=arr.length;i<l;++i){calc.push(arr[i].c);}
return{g:1,c:calc.join(""),s:arr[0].s+"-"+arr[1].s+"-"+arr[2].s+"T"+arr[3].s+":"+arr[4].s+":"+arr[5].s
+"((\.|,)\\d+)?"+"("+$f("P",null).s+"|Z)"}},U:{g:1,c:"u = parseInt(results[{0}], 10);\n",s:"(-?\\d+)"}}});}());Ext.override(Date,{dateFormat:function(format){if(Date.formatFunctions[format]==null){Date.createNewFormat(format);}
var func=Date.formatFunctions[format];return this[func]();},getTimezone:function(){return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/,"$1$2").replace(/[^A-Z]/g,"");},getGMTOffset:function(colon){return(this.getTimezoneOffset()>0?"-":"+")
+String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset()/60)),2,"0")
+(colon?":":"")
+String.leftPad(Math.abs(this.getTimezoneOffset()%60),2,"0");},getDayOfYear:function(){var num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){num+=Date.daysInMonth[i];}
return num+this.getDate()-1;},getWeekOfYear:function(){var ms1d=864e5;var ms7d=7*ms1d;var DC3=Date.UTC(this.getFullYear(),this.getMonth(),this.getDate()+3)/ms1d;var AWN=Math.floor(DC3/7);var Wyr=new Date(AWN*ms7d).getUTCFullYear();return AWN-Math.floor(Date.UTC(Wyr,0,7)/ms7d)+1;},isLeapYear:function(){var year=this.getFullYear();return!!((year&3)==0&&(year%100||(year%400==0&&year)));},getFirstDayOfMonth:function(){var day=(this.getDay()-(this.getDate()-1))%7;return(day<0)?(day+7):day;},getLastDayOfMonth:function(){var day=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(day<0)?(day+7):day;},getFirstDateOfMonth:function(){return new Date(this.getFullYear(),this.getMonth(),1);},getLastDateOfMonth:function(){return new Date(this.getFullYear(),this.getMonth(),this.getDaysInMonth());},getDaysInMonth:function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];},getSuffix:function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}},clone:function(){return new Date(this.getTime());},clearTime:function(clone){if(clone){return this.clone().clearTime();}
this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;},add:function(interval,value){var d=this.clone();if(!interval||value===0)return d;switch(interval.toLowerCase()){case Date.MILLI:d.setMilliseconds(this.getMilliseconds()+value);break;case Date.SECOND:d.setSeconds(this.getSeconds()+value);break;case Date.MINUTE:d.setMinutes(this.getMinutes()+value);break;case Date.HOUR:d.setHours(this.getHours()+value);break;case Date.DAY:d.setDate(this.getDate()+value);break;case Date.MONTH:var day=this.getDate();if(day>28){day=Math.min(day,this.getFirstDateOfMonth().add('mo',value).getLastDateOfMonth().getDate());}
d.setDate(day);d.setMonth(this.getMonth()+value);break;case Date.YEAR:d.setFullYear(this.getFullYear()+value);break;}
return d;},between:function(start,end){var t=this.getTime();return start.getTime()<=t&&t<=end.getTime();}});Date.prototype.format=Date.prototype.dateFormat;if(Ext.isSafari){Date.brokenSetMonth=Date.prototype.setMonth;Date.prototype.setMonth=function(num){if(num<=-1){var n=Math.ceil(-num);var back_year=Math.ceil(n/12);var month=(n%12)?12-n%12:0;this.setFullYear(this.getFullYear()-back_year);return Date.brokenSetMonth.call(this,month);}else{return Date.brokenSetMonth.apply(this,arguments);}};}
Ext.util.DelayedTask=function(fn,scope,args){var id=null,d,t;var call=function(){var now=new Date().getTime();if(now-t>=d){clearInterval(id);id=null;fn.apply(scope,args||[]);}};this.delay=function(delay,newFn,newScope,newArgs){if(id&&delay!=d){this.cancel();}
d=delay;t=new Date().getTime();fn=newFn||fn;scope=newScope||scope;args=newArgs||args;if(!id){id=setInterval(call,d);}};this.cancel=function(){if(id){clearInterval(id);id=null;}};};Ext.util.TaskRunner=function(interval){interval=interval||10;var tasks=[],removeQueue=[];var id=0;var running=false;var stopThread=function(){running=false;clearInterval(id);id=0;};var startThread=function(){if(!running){running=true;id=setInterval(runTasks,interval);}};var removeTask=function(t){removeQueue.push(t);if(t.onStop){t.onStop.apply(t.scope||t);}};var runTasks=function(){if(removeQueue.length>0){for(var i=0,len=removeQueue.length;i<len;i++){tasks.remove(removeQueue[i]);}
removeQueue=[];if(tasks.length<1){stopThread();return;}}
var now=new Date().getTime();for(var i=0,len=tasks.length;i<len;++i){var t=tasks[i];var itime=now-t.taskRunTime;if(t.interval<=itime){var rt=t.run.apply(t.scope||t,t.args||[++t.taskRunCount]);t.taskRunTime=now;if(rt===false||t.taskRunCount===t.repeat){removeTask(t);return;}}
if(t.duration&&t.duration<=(now-t.taskStartTime)){removeTask(t);}}};this.start=function(task){tasks.push(task);task.taskStartTime=new Date().getTime();task.taskRunTime=0;task.taskRunCount=0;startThread();return task;};this.stop=function(task){removeTask(task);return task;};this.stopAll=function(){stopThread();for(var i=0,len=tasks.length;i<len;i++){if(tasks[i].onStop){tasks[i].onStop();}}
tasks=[];removeQueue=[];};};Ext.TaskMgr=new Ext.util.TaskRunner();Ext.util.MixedCollection=function(allowFunctions,keyFn){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents("clear","add","replace","remove","sort");this.allowFunctions=allowFunctions===true;if(keyFn){this.getKey=keyFn;}
Ext.util.MixedCollection.superclass.constructor.call(this);};Ext.extend(Ext.util.MixedCollection,Ext.util.Observable,{allowFunctions:false,add:function(key,o){if(arguments.length==1){o=arguments[0];key=this.getKey(o);}
if(typeof key=="undefined"||key===null){this.length++;this.items.push(o);this.keys.push(null);}else{var old=this.map[key];if(old){return this.replace(key,o);}
this.length++;this.items.push(o);this.map[key]=o;this.keys.push(key);}
this.fireEvent("add",this.length-1,o,key);return o;},getKey:function(o){return o.id;},replace:function(key,o){if(arguments.length==1){o=arguments[0];key=this.getKey(o);}
var old=this.item(key);if(typeof key=="undefined"||key===null||typeof old=="undefined"){return this.add(key,o);}
var index=this.indexOfKey(key);this.items[index]=o;this.map[key]=o;this.fireEvent("replace",key,old,o);return o;},addAll:function(objs){if(arguments.length>1||Ext.isArray(objs)){var args=arguments.length>1?arguments:objs;for(var i=0,len=args.length;i<len;i++){this.add(args[i]);}}else{for(var key in objs){if(this.allowFunctions||typeof objs[key]!="function"){this.add(key,objs[key]);}}}},each:function(fn,scope){var items=[].concat(this.items);for(var i=0,len=items.length;i<len;i++){if(fn.call(scope||items[i],items[i],i,len)===false){break;}}},eachKey:function(fn,scope){for(var i=0,len=this.keys.length;i<len;i++){fn.call(scope||window,this.keys[i],this.items[i],i,len);}},find:function(fn,scope){for(var i=0,len=this.items.length;i<len;i++){if(fn.call(scope||window,this.items[i],this.keys[i])){return this.items[i];}}
return null;},insert:function(index,key,o){if(arguments.length==2){o=arguments[1];key=this.getKey(o);}
if(index>=this.length){return this.add(key,o);}
this.length++;this.items.splice(index,0,o);if(typeof key!="undefined"&&key!=null){this.map[key]=o;}
this.keys.splice(index,0,key);this.fireEvent("add",index,o,key);return o;},remove:function(o){return this.removeAt(this.indexOf(o));},removeAt:function(index){if(index<this.length&&index>=0){this.length--;var o=this.items[index];this.items.splice(index,1);var key=this.keys[index];if(typeof key!="undefined"){delete this.map[key];}
this.keys.splice(index,1);this.fireEvent("remove",o,key);return o;}
return false;},removeKey:function(key){return this.removeAt(this.indexOfKey(key));},getCount:function(){return this.length;},indexOf:function(o){return this.items.indexOf(o);},indexOfKey:function(key){return this.keys.indexOf(key);},item:function(key){var item=typeof this.map[key]!="undefined"?this.map[key]:this.items[key];return typeof item!='function'||this.allowFunctions?item:null;},itemAt:function(index){return this.items[index];},key:function(key){return this.map[key];},contains:function(o){return this.indexOf(o)!=-1;},containsKey:function(key){return typeof this.map[key]!="undefined";},clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear");},first:function(){return this.items[0];},last:function(){return this.items[this.length-1];},_sort:function(property,dir,fn){var dsc=String(dir).toUpperCase()=="DESC"?-1:1;fn=fn||function(a,b){return a-b;};var c=[],k=this.keys,items=this.items;for(var i=0,len=items.length;i<len;i++){c[c.length]={key:k[i],value:items[i],index:i};}
c.sort(function(a,b){var v=fn(a[property],b[property])*dsc;if(v==0){v=(a.index<b.index?-1:1);}
return v;});for(var i=0,len=c.length;i<len;i++){items[i]=c[i].value;k[i]=c[i].key;}
this.fireEvent("sort",this);},sort:function(dir,fn){this._sort("value",dir,fn);},keySort:function(dir,fn){this._sort("key",dir,fn||function(a,b){return String(a).toUpperCase()-String(b).toUpperCase();});},getRange:function(start,end){var items=this.items;if(items.length<1){return[];}
start=start||0;end=Math.min(typeof end=="undefined"?this.length-1:end,this.length-1);var r=[];if(start<=end){for(var i=start;i<=end;i++){r[r.length]=items[i];}}else{for(var i=start;i>=end;i--){r[r.length]=items[i];}}
return r;},filter:function(property,value,anyMatch,caseSensitive){if(Ext.isEmpty(value,false)){return this.clone();}
value=this.createValueMatcher(value,anyMatch,caseSensitive);return this.filterBy(function(o){return o&&value.test(o[property]);});},filterBy:function(fn,scope){var r=new Ext.util.MixedCollection();r.getKey=this.getKey;var k=this.keys,it=this.items;for(var i=0,len=it.length;i<len;i++){if(fn.call(scope||this,it[i],k[i])){r.add(k[i],it[i]);}}
return r;},findIndex:function(property,value,start,anyMatch,caseSensitive){if(Ext.isEmpty(value,false)){return-1;}
value=this.createValueMatcher(value,anyMatch,caseSensitive);return this.findIndexBy(function(o){return o&&value.test(o[property]);},null,start);},findIndexBy:function(fn,scope,start){var k=this.keys,it=this.items;for(var i=(start||0),len=it.length;i<len;i++){if(fn.call(scope||this,it[i],k[i])){return i;}}
if(typeof start=='number'&&start>0){for(var i=0;i<start;i++){if(fn.call(scope||this,it[i],k[i])){return i;}}}
return-1;},createValueMatcher:function(value,anyMatch,caseSensitive){if(!value.exec){value=String(value);value=new RegExp((anyMatch===true?'':'^')+Ext.escapeRe(value),caseSensitive?'':'i');}
return value;},clone:function(){var r=new Ext.util.MixedCollection();var k=this.keys,it=this.items;for(var i=0,len=it.length;i<len;i++){r.add(k[i],it[i]);}
r.getKey=this.getKey;return r;}});Ext.util.MixedCollection.prototype.get=Ext.util.MixedCollection.prototype.item;Ext.util.JSON=new(function(){var useHasOwn=!!{}.hasOwnProperty;var pad=function(n){return n<10?"0"+n:n;};var m={"\b":'\\b',"\t":'\\t',"\n":'\\n',"\f":'\\f',"\r":'\\r','"':'\\"',"\\":'\\\\'};var encodeString=function(s){if(/["\\\x00-\x1f]/.test(s)){return'"'+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return"\\u00"+
Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"';}
return'"'+s+'"';};var encodeArray=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(',');}
a.push(v===null?"null":Ext.util.JSON.encode(v));b=true;}}
a.push("]");return a.join("");};this.encodeDate=function(o){return'"'+o.getFullYear()+"-"+
pad(o.getMonth()+1)+"-"+
pad(o.getDate())+"T"+
pad(o.getHours())+":"+
pad(o.getMinutes())+":"+
pad(o.getSeconds())+'"';};this.encode=function(o){if(typeof o=="undefined"||o===null){return"null";}else if(Ext.isArray(o)){return encodeArray(o);}else if(Ext.isDate(o)){return Ext.util.JSON.encodeDate(o);}else if(typeof o=="string"){return encodeString(o);}else if(typeof o=="number"){return isFinite(o)?String(o):"null";}else if(typeof o=="boolean"){return String(o);}else{var a=["{"],b,i,v;for(i in o){if(!useHasOwn||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(',');}
a.push(this.encode(i),":",v===null?"null":this.encode(v));b=true;}}}
a.push("}");return a.join("");}};this.decode=function(json){return eval("("+json+')');};})();Ext.encode=Ext.util.JSON.encode;Ext.decode=Ext.util.JSON.decode;Ext.util.Format=function(){var trimRe=/^\s+|\s+$/g;return{ellipsis:function(value,len){if(value&&value.length>len){return value.substr(0,len-3)+"...";}
return value;},undef:function(value){return value!==undefined?value:"";},defaultValue:function(value,defaultValue){return value!==undefined&&value!==''?value:defaultValue;},htmlEncode:function(value){return!value?value:String(value).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");},htmlDecode:function(value){return!value?value:String(value).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&");},trim:function(value){return String(value).replace(trimRe,"");},substr:function(value,start,length){return String(value).substr(start,length);},lowercase:function(value){return String(value).toLowerCase();},uppercase:function(value){return String(value).toUpperCase();},capitalize:function(value){return!value?value:value.charAt(0).toUpperCase()+value.substr(1).toLowerCase();},call:function(value,fn){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);args.unshift(value);return eval(fn).apply(window,args);}else{return eval(fn).call(window,value);}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);v=String(v);var ps=v.split('.');var whole=ps[0];var sub=ps[1]?'.'+ps[1]:'.00';var r=/(\d+)(\d{3})/;while(r.test(whole)){whole=whole.replace(r,'$1'+','+'$2');}
v=whole+sub;if(v.charAt(0)=='-'){return'-$'+v.substr(1);}
return"$"+v;},date:function(v,format){if(!v){return"";}
if(!Ext.isDate(v)){v=new Date(Date.parse(v));}
return v.dateFormat(format||"m/d/Y");},dateRenderer:function(format){return function(v){return Ext.util.Format.date(v,format);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return!v?v:String(v).replace(this.stripTagsRE,"");},stripScriptsRe:/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,stripScripts:function(v){return!v?v:String(v).replace(this.stripScriptsRe,"");},fileSize:function(size){if(size<1024){return size+" bytes";}else if(size<1048576){return(Math.round(((size*10)/1024))/10)+" KB";}else{return(Math.round(((size*10)/1048576))/10)+" MB";}},math:function(){var fns={};return function(v,a){if(!fns[a]){fns[a]=new Function('v','return v '+a+';');}
return fns[a](v);}}(),nl2br:function(v){return v===undefined||v===null?'':v.replace(/\n/g,'<br/>');}};}();Ext.XTemplate=function(){Ext.XTemplate.superclass.constructor.apply(this,arguments);var s=this.html;s=['<tpl>',s,'</tpl>'].join('');var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var nameRe=/^<tpl\b[^>]*?for="(.*?)"/;var ifRe=/^<tpl\b[^>]*?if="(.*?)"/;var execRe=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var tpls=[];while(m=s.match(re)){var m2=m[0].match(nameRe);var m3=m[0].match(ifRe);var m4=m[0].match(execRe);var exp=null,fn=null,exec=null;var name=m2&&m2[1]?m2[1]:'';if(m3){exp=m3&&m3[1]?m3[1]:null;if(exp){fn=new Function('values','parent','xindex','xcount','with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }');}}
if(m4){exp=m4&&m4[1]?m4[1]:null;if(exp){exec=new Function('values','parent','xindex','xcount','with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }');}}
if(name){switch(name){case'.':name=new Function('values','parent','with(values){ return values; }');break;case'..':name=new Function('values','parent','with(values){ return parent; }');break;default:name=new Function('values','parent','with(values){ return '+name+'; }');}}
tpls.push({id:id,target:name,exec:exec,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}
for(var i=tpls.length-1;i>=0;--i){this.compileTpl(tpls[i]);}
this.master=tpls[tpls.length-1];this.tpls=tpls;};Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(id,values,parent,xindex,xcount){var t=this.tpls[id];if(t.test&&!t.test.call(this,values,parent,xindex,xcount)){return'';}
if(t.exec&&t.exec.call(this,values,parent,xindex,xcount)){return'';}
var vs=t.target?t.target.call(this,values,parent):values;parent=t.target?values:parent;if(t.target&&Ext.isArray(vs)){var buf=[];for(var i=0,len=vs.length;i<len;i++){buf[buf.length]=t.compiled.call(this,vs[i],parent,i+1,len);}
return buf.join('');}
return t.compiled.call(this,vs,parent,xindex,xcount);},compileTpl:function(tpl){var fm=Ext.util.Format;var useF=this.disableFormats!==true;var sep=Ext.isGecko?"+":",";var fn=function(m,name,format,args,math){if(name.substr(0,4)=='xtpl'){return"'"+sep+'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";}
var v;if(name==='.'){v='values';}else if(name==='#'){v='xindex';}else if(name.indexOf('.')!=-1){v=name;}else{v="values['"+name+"']";}
if(math){v='('+v+math+')';}
if(format&&useF){args=args?','+args:"";if(format.substr(0,5)!="this."){format="fm."+format+'(';}else{format='this.call("'+format.substr(5)+'", ';args=", values";}}else{args='';format="("+v+" === undefined ? '' : ";}
return"'"+sep+format+v+args+")"+sep+"'";};var codeFn=function(m,code){return"'"+sep+'('+code+')'+sep+"'";};var body;if(Ext.isGecko){body="tpl.compiled = function(values, parent, xindex, xcount){ return '"+
tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn).replace(this.codeRe,codeFn)+"';};";}else{body=["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];body.push(tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn).replace(this.codeRe,codeFn));body.push("'].join('');};");body=body.join('');}
eval(body);return this;},applyTemplate:function(values){return this.master.compiled.call(this,values,{},1,1);},compile:function(){return this;}});Ext.XTemplate.prototype.apply=Ext.XTemplate.prototype.applyTemplate;Ext.XTemplate.from=function(el){el=Ext.getDom(el);return new Ext.XTemplate(el.value||el.innerHTML);};Ext.util.CSS=function(){var rules=null;var doc=document;var camelRe=/(-[a-z])/gi;var camelFn=function(m,a){return a.charAt(1).toUpperCase();};return{createStyleSheet:function(cssText,id){var ss;var head=doc.getElementsByTagName("head")[0];var rules=doc.createElement("style");rules.setAttribute("type","text/css");if(id){rules.setAttribute("id",id);}
if(Ext.isIE){head.appendChild(rules);ss=rules.styleSheet;ss.cssText=cssText;}else{try{rules.appendChild(doc.createTextNode(cssText));}catch(e){rules.cssText=cssText;}
head.appendChild(rules);ss=rules.styleSheet?rules.styleSheet:(rules.sheet||doc.styleSheets[doc.styleSheets.length-1]);}
this.cacheStyleSheet(ss);return ss;},removeStyleSheet:function(id){var existing=doc.getElementById(id);if(existing){existing.parentNode.removeChild(existing);}},swapStyleSheet:function(id,url){this.removeStyleSheet(id);var ss=doc.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");ss.setAttribute("id",id);ss.setAttribute("href",url);doc.getElementsByTagName("head")[0].appendChild(ss);},refreshCache:function(){return this.getRules(true);},cacheStyleSheet:function(ss){if(!rules){rules={};}
try{var ssRules=ss.cssRules||ss.rules;for(var j=ssRules.length-1;j>=0;--j){rules[ssRules[j].selectorText]=ssRules[j];}}catch(e){}},getRules:function(refreshCache){if(rules==null||refreshCache){rules={};var ds=doc.styleSheets;for(var i=0,len=ds.length;i<len;i++){try{this.cacheStyleSheet(ds[i]);}catch(e){}}}
return rules;},getRule:function(selector,refreshCache){var rs=this.getRules(refreshCache);if(!Ext.isArray(selector)){return rs[selector];}
for(var i=0;i<selector.length;i++){if(rs[selector[i]]){return rs[selector[i]];}}
return null;},updateRule:function(selector,property,value){if(!Ext.isArray(selector)){var rule=this.getRule(selector);if(rule){rule.style[property.replace(camelRe,camelFn)]=value;return true;}}else{for(var i=0;i<selector.length;i++){if(this.updateRule(selector[i],property,value)){return true;}}}
return false;}};}();Ext.util.ClickRepeater=function(el,config)
{this.el=Ext.get(el);this.el.unselectable();Ext.apply(this,config);this.addEvents("mousedown","click","mouseup");this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(e){if(this.preventDefault){e.preventDefault();}
if(this.stopDefault){e.stopEvent();}},this);}
if(this.handler){this.on("click",this.handler,this.scope||this);}
Ext.util.ClickRepeater.superclass.constructor.call(this);};Ext.extend(Ext.util.ClickRepeater,Ext.util.Observable,{interval:20,delay:250,preventDefault:true,stopDefault:false,timer:0,handleMouseDown:function(){clearTimeout(this.timer);this.el.blur();if(this.pressClass){this.el.addClass(this.pressClass);}
this.mousedownTime=new Date();Ext.getDoc().on("mouseup",this.handleMouseUp,this);this.el.on("mouseout",this.handleMouseOut,this);this.fireEvent("mousedown",this);this.fireEvent("click",this);if(this.accelerate){this.delay=400;}
this.timer=this.click.defer(this.delay||this.interval,this);},click:function(){this.fireEvent("click",this);this.timer=this.click.defer(this.accelerate?this.easeOutExpo(this.mousedownTime.getElapsed(),400,-390,12000):this.interval,this);},easeOutExpo:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},handleMouseOut:function(){clearTimeout(this.timer);if(this.pressClass){this.el.removeClass(this.pressClass);}
this.el.on("mouseover",this.handleMouseReturn,this);},handleMouseReturn:function(){this.el.un("mouseover",this.handleMouseReturn,this);if(this.pressClass){this.el.addClass(this.pressClass);}
this.click();},handleMouseUp:function(){clearTimeout(this.timer);this.el.un("mouseover",this.handleMouseReturn,this);this.el.un("mouseout",this.handleMouseOut,this);Ext.getDoc().un("mouseup",this.handleMouseUp,this);this.el.removeClass(this.pressClass);this.fireEvent("mouseup",this);}});Ext.KeyNav=function(el,config){this.el=Ext.get(el);Ext.apply(this,config);if(!this.disabled){this.disabled=true;this.enable();}};Ext.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",forceKeyDown:false,prepareEvent:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(Ext.isSafari2&&h&&k>=37&&k<=40){e.stopEvent();}},relay:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(h&&this[h]){if(this.doRelay(e,this[h],h)!==true){e[this.defaultEventAction]();}}},doRelay:function(e,h,hname){return h.call(this.scope||this,e);},enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"},enable:function(){if(this.disabled){if(this.forceKeyDown||Ext.isIE||Ext.isSafari3||Ext.isAir){this.el.on("keydown",this.relay,this);}else{this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this);}
this.disabled=false;}},disable:function(){if(!this.disabled){if(this.forceKeyDown||Ext.isIE||Ext.isSafari3||Ext.isAir){this.el.un("keydown",this.relay);}else{this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay);}
this.disabled=true;}}};Ext.KeyMap=function(el,config,eventName){this.el=Ext.get(el);this.eventName=eventName||"keydown";this.bindings=[];if(config){this.addBinding(config);}
this.enable();};Ext.KeyMap.prototype={stopEvent:false,addBinding:function(config){if(Ext.isArray(config)){for(var i=0,len=config.length;i<len;i++){this.addBinding(config[i]);}
return;}
var keyCode=config.key,shift=config.shift,ctrl=config.ctrl,alt=config.alt,fn=config.fn||config.handler,scope=config.scope;if(config.stopEvent){this.stopEvent=config.stopEvent;}
if(typeof keyCode=="string"){var ks=[];var keyString=keyCode.toUpperCase();for(var j=0,len=keyString.length;j<len;j++){ks.push(keyString.charCodeAt(j));}
keyCode=ks;}
var keyArray=Ext.isArray(keyCode);var handler=function(e){if((!shift||e.shiftKey)&&(!ctrl||e.ctrlKey)&&(!alt||e.altKey)){var k=e.getKey();if(keyArray){for(var i=0,len=keyCode.length;i<len;i++){if(keyCode[i]==k){if(this.stopEvent){e.stopEvent();}
fn.call(scope||window,k,e);return;}}}else{if(k==keyCode){if(this.stopEvent){e.stopEvent();}
fn.call(scope||window,k,e);}}}};this.bindings.push(handler);},on:function(key,fn,scope){var keyCode,shift,ctrl,alt;if(typeof key=="object"&&!Ext.isArray(key)){keyCode=key.key;shift=key.shift;ctrl=key.ctrl;alt=key.alt;}else{keyCode=key;}
this.addBinding({key:keyCode,shift:shift,ctrl:ctrl,alt:alt,fn:fn,scope:scope})},handleKeyDown:function(e){if(this.enabled){var b=this.bindings;for(var i=0,len=b.length;i<len;i++){b[i].call(this,e);}}},isEnabled:function(){return this.enabled;},enable:function(){if(!this.enabled){this.el.on(this.eventName,this.handleKeyDown,this);this.enabled=true;}},disable:function(){if(this.enabled){this.el.removeListener(this.eventName,this.handleKeyDown,this);this.enabled=false;}}};Ext.util.TextMetrics=function(){var shared;return{measure:function(el,text,fixedWidth){if(!shared){shared=Ext.util.TextMetrics.Instance(el,fixedWidth);}
shared.bind(el);shared.setFixedWidth(fixedWidth||'auto');return shared.getSize(text);},createInstance:function(el,fixedWidth){return Ext.util.TextMetrics.Instance(el,fixedWidth);}};}();Ext.util.TextMetrics.Instance=function(bindTo,fixedWidth){var ml=new Ext.Element(document.createElement('div'));document.body.appendChild(ml.dom);ml.position('absolute');ml.setLeftTop(-1000,-1000);ml.hide();if(fixedWidth){ml.setWidth(fixedWidth);}
var instance={getSize:function(text){ml.update(text);var s=ml.getSize();ml.update('');return s;},bind:function(el){ml.setStyle(Ext.fly(el).getStyles('font-size','font-style','font-weight','font-family','line-height','text-transform','letter-spacing'));},setFixedWidth:function(width){ml.setWidth(width);},getWidth:function(text){ml.dom.style.width='auto';return this.getSize(text).width;},getHeight:function(text){return this.getSize(text).height;}};instance.bind(bindTo);return instance;};Ext.Element.measureText=Ext.util.TextMetrics.measure;(function(){var Event=Ext.EventManager;var Dom=Ext.lib.Dom;Ext.dd.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};Ext.dd.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(constrainTo,pad,inContent){if(typeof pad=="number"){pad={left:pad,right:pad,top:pad,bottom:pad};}
pad=pad||this.defaultPadding;var b=Ext.get(this.getEl()).getBox();var ce=Ext.get(constrainTo);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Ext.lib.Dom.getViewWidth(),height:Ext.lib.Dom.getViewHeight()};}else{var xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight};}
var topSpace=b.y-c.y;var leftSpace=b.x-c.x;this.resetConstraints();this.setXConstraint(leftSpace-(pad.left||0),c.width-leftSpace-b.width-(pad.right||0),this.xTickSize);this.setYConstraint(topSpace-(pad.top||0),c.height-topSpace-b.height-(pad.bottom||0),this.yTickSize);},getEl:function(){if(!this._domRef){this._domRef=Ext.getDom(this.id);}
return this._domRef;},getDragEl:function(){return Ext.getDom(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this.id,"mousedown",this.handleMouseDown,this);},initTarget:function(id,sGroup,config){this.config=config||{};this.DDM=Ext.dd.DDM;this.groups={};if(typeof id!=="string"){id=Ext.id(id);}
this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}
var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];}
this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Ext.id(id);}
this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Ext.id(id);}
Event.on(id,"mousedown",this.handleMouseDown,this);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.un(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},destroy:function(){this.unreg();},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){if(this.primaryButtonOnly&&e.button!=0){return;}
if(this.isLocked()){return;}
this.DDM.refreshCache(this.groups);var pt=new Ext.lib.Point(Ext.lib.Event.getPageX(e),Ext.lib.Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=e.getTarget();return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Ext.id(id);}
this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Ext.id(id);}
delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==cssClass){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(node){var valid=true;var nodeName;try{nodeName=node.nodeName.toUpperCase();}catch(e){nodeName=node.nodeName;}
valid=valid&&!this.invalidHandleTypes[nodeName];valid=valid&&!this.invalidHandleIds[node.id];for(var i=0,len=this.invalidHandleClasses.length;valid&&i<len;++i){valid=!Ext.fly(node).hasClass(this.invalidHandleClasses[i]);}
return valid;},setXTicks:function(iStartX,iTickSize){this.xTicks=[];this.xTickSize=iTickSize;var tickMap={};for(var i=this.initPageX;i>=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=iLeft;this.rightConstraint=iRight;this.minX=this.initPageX-iLeft;this.maxX=this.initPageX+iRight;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);}
this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=iUp;this.bottomConstraint=iDown;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+iDown;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);}
this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}
if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}
if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i<len;++i){var next=i+1;if(tickArray[next]&&tickArray[next]>=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}}
return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};})();if(!Ext.dd.DragDropMgr){Ext.dd.DragDropMgr=function(){var Event=Ext.EventManager;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
if(!this.ids[sGroup]){this.ids[sGroup]={};}
this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}
delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;i<len;++i){if(targets[i].id==oTargetDD.id){return true;}}
return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(sDDId,sHandleId){return(this.handleIds[sDDId]&&this.handleIds[sDDId][sHandleId]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}
return null;},handleMouseDown:function(e,oDD){if(Ext.QuickTips){Ext.QuickTips.disable();}
this.currentTarget=e.getTarget();this.dragCurrent=oDD;var el=oDD.getEl();this.startX=e.getPageX();this.startY=e.getPageY();this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=Ext.dd.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}
this.dragThreshMet=true;},handleMouseUp:function(e){if(Ext.QuickTips){Ext.QuickTips.enable();}
if(!this.dragCurrent){return;}
clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}
this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){e.stopPropagation();}
if(this.preventDefault){e.preventDefault();}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}
this.dragCurrent.onMouseUp(e);}
this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}
if(Ext.isIE&&(e.button!==0&&e.button!==1&&e.button!==2)){this.stopEvent(e);return this.handleMouseUp(e);}
if(!this.dragThreshMet){var diffX=Math.abs(this.startX-e.getPageX());var diffY=Math.abs(this.startY-e.getPageY());if(diffX>this.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);if(!this.dragCurrent.moveOnly){this.fireEvents(e,false);}}
this.stopEvent(e);return true;},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}
var pt=e.getPoint();var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
if(!this.isOverTarget(pt,ddo,this.mode)){outEvts.push(ddo);}
oldOvers[i]=true;delete this.dragOvers[i];}
for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);}
this.dragOvers[oDD.id]=oDD;}}}}}
if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);dc.onDragOut(e,outEvts);}
if(enterEvts.length){dc.onDragEnter(e,enterEvts);}
if(overEvts.length){dc.b4DragOver(e,overEvts);dc.onDragOver(e,overEvts);}
if(dropEvts.length){dc.b4DragDrop(e,dropEvts);dc.onDragDrop(e,dropEvts);}}else{var len=0;for(i=0,len=outEvts.length;i<len;++i){dc.b4DragOut(e,outEvts[i].id);dc.onDragOut(e,outEvts[i].id);}
for(i=0,len=enterEvts.length;i<len;++i){dc.onDragEnter(e,enterEvts[i].id);}
for(i=0,len=overEvts.length;i<len;++i){dc.b4DragOver(e,overEvts[i].id);dc.onDragOver(e,overEvts[i].id);}
for(i=0,len=dropEvts.length;i<len;++i){dc.b4DragDrop(e,dropEvts[i].id);dc.onDragDrop(e,dropEvts[i].id);}}
if(isDrop&&!dropEvts.length){dc.onInvalidDrop(e);}},getBestMatch:function(dds){var winner=null;var len=dds.length;if(len==1){winner=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(dd.cursorIsOver){winner=dd;break;}else{if(!winner||winner.overlap.getArea()<dd.overlap.getArea()){winner=dd;}}}}
return winner;},refreshCache:function(groups){for(var sGroup in groups){if("string"!=typeof sGroup){continue;}
for(var i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){if(el){var parent;if(Ext.isIE){try{parent=el.offsetParent;}catch(e){}}else{parent=el.offsetParent;}
if(parent){return true;}}
return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}
var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=Ext.lib.Dom.getXY(el);}catch(e){}
if(!pos){return null;}
x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new Ext.lib.Region(t,r,b,l);},isOverTarget:function(pt,oTarget,intersect){var loc=this.locationCache[oTarget.id];if(!loc||!this.useCache){loc=this.getLocation(oTarget);this.locationCache[oTarget.id]=loc;}
if(!loc){return false;}
oTarget.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!intersect&&!dc.constrainX&&!dc.constrainY)){return oTarget.cursorIsOver;}
oTarget.overlap=null;var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var curRegion=new Ext.lib.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var overlap=curRegion.intersect(loc);if(overlap){oTarget.overlap=overlap;return(intersect)?true:oTarget.cursorIsOver;}else{return false;}},_onUnload:function(e,me){Ext.dd.DragDropMgr.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
this._execOnAll("unreg",[]);for(var i in this.elementCache){delete this.elementCache[i];}
this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var oWrapper=this.elementCache[id];if(!oWrapper||!oWrapper.el){oWrapper=this.elementCache[id]=new this.ElementWrapper(Ext.getDom(id));}
return oWrapper;},getElement:function(id){return Ext.getDom(id);},getCss:function(id){var el=Ext.getDom(id);return(el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return Ext.lib.Dom.getX(el);},getPosY:function(el){return Ext.lib.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else{}
return{top:t,left:l};},getStyle:function(el,styleProp){return Ext.fly(el).getStyle(styleProp);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(moveEl,targetEl){var aCoord=Ext.lib.Dom.getXY(targetEl);Ext.lib.Dom.setXY(moveEl,aCoord);},numericSort:function(a,b){return(a-b);},_timeoutCount:0,_addListeners:function(){var DDM=Ext.dd.DDM;if(Ext.lib.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}
return false;}};}();Ext.dd.DDM=Ext.dd.DragDropMgr;Ext.dd.DDM._addListeners();}
Ext.dd.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);var fly=el.dom?el:Ext.fly(el,'_dd');if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];fly.setXY(aCoord);var newLeft=fly.getLeft(true);var newTop=fly.getTop(true);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{fly.setLeftTop(oCoord.x+this.deltaSetXY[0],oCoord.y+this.deltaSetXY[1]);}
this.cachePosition(oCoord.x,oCoord.y);this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);return oCoord;},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=Ext.lib.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=Ext.lib.Dom.getViewHeight();var clientW=Ext.lib.Dom.getViewWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot<thresh){window.scrollTo(sl,st+scrAmt);}
if(y<st&&st>0&&y-st<thresh){window.scrollTo(sl,st-scrAmt);}
if(right>clientW&&toRight<thresh){window.scrollTo(sl+scrAmt,st);}
if(x<sl&&sl>0&&x-sl<thresh){window.scrollTo(sl-scrAmt,st);}}},getTargetCoord:function(iPageX,iPageY){var x=iPageX-this.deltaX;var y=iPageY-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}
if(x>this.maxX){x=this.maxX;}}
if(this.constrainY){if(y<this.minY){y=this.minY;}
if(y>this.maxY){y=this.maxY;}}
x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},applyConfig:function(){Ext.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(e.getPageX(),e.getPageY());},b4Drag:function(e){this.setDragElPos(e.getPageX(),e.getPageY());},toString:function(){return("DD "+this.id);}});Ext.dd.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};Ext.dd.DDProxy.dragElId="ygddfdiv";Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}
var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){Ext.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Ext.dd.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
this.setDragElPos(iPageX,iPageY);Ext.fly(dragEl).show();},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();Ext.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);}},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){Ext.fly(this.getDragEl()).hide();},endDrag:function(e){var lel=this.getEl();var del=this.getDragEl();del.style.visibility="";this.beforeMove();lel.style.visibility="hidden";Ext.dd.DDM.moveToEl(lel,del);del.style.visibility="hidden";lel.style.visibility="";this.afterDrag();},beforeMove:function(){},afterDrag:function(){},toString:function(){return("DDProxy "+this.id);}});Ext.dd.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{toString:function(){return("DDTarget "+this.id);}});Ext.dd.DragTracker=function(config){Ext.apply(this,config);this.addEvents('mousedown','mouseup','mousemove','dragstart','dragend','drag');this.dragRegion=new Ext.lib.Region(0,0,0,0);if(this.el){this.initEl(this.el);}}
Ext.extend(Ext.dd.DragTracker,Ext.util.Observable,{active:false,tolerance:5,autoStart:false,initEl:function(el){this.el=Ext.get(el);el.on('mousedown',this.onMouseDown,this,this.delegate?{delegate:this.delegate}:undefined);},destroy:function(){this.el.un('mousedown',this.onMouseDown,this);},onMouseDown:function(e,target){if(this.fireEvent('mousedown',this,e)!==false&&this.onBeforeStart(e)!==false){this.startXY=this.lastXY=e.getXY();this.dragTarget=this.delegate?target:this.el.dom;e.preventDefault();var doc=Ext.getDoc();doc.on('mouseup',this.onMouseUp,this);doc.on('mousemove',this.onMouseMove,this);doc.on('selectstart',this.stopSelect,this);if(this.autoStart){this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this);}}},onMouseMove:function(e,target){e.preventDefault();var xy=e.getXY(),s=this.startXY;this.lastXY=xy;if(!this.active){if(Math.abs(s[0]-xy[0])>this.tolerance||Math.abs(s[1]-xy[1])>this.tolerance){this.triggerStart();}else{return;}}
this.fireEvent('mousemove',this,e);this.onDrag(e);this.fireEvent('drag',this,e);},onMouseUp:function(e){var doc=Ext.getDoc();doc.un('mousemove',this.onMouseMove,this);doc.un('mouseup',this.onMouseUp,this);doc.un('selectstart',this.stopSelect,this);e.preventDefault();this.clearStart();this.active=false;delete this.elRegion;this.fireEvent('mouseup',this,e);this.onEnd(e);this.fireEvent('dragend',this,e);},triggerStart:function(isTimer){this.clearStart();this.active=true;this.onStart(this.startXY);this.fireEvent('dragstart',this,this.startXY);},clearStart:function(){if(this.timer){clearTimeout(this.timer);delete this.timer;}},stopSelect:function(e){e.stopEvent();return false;},onBeforeStart:function(e){},onStart:function(xy){},onDrag:function(e){},onEnd:function(e){},getDragTarget:function(){return this.dragTarget;},getDragCt:function(){return this.el;},getXY:function(constrain){return constrain?this.constrainModes[constrain].call(this,this.lastXY):this.lastXY;},getOffset:function(constrain){var xy=this.getXY(constrain);var s=this.startXY;return[s[0]-xy[0],s[1]-xy[1]];},constrainModes:{'point':function(xy){if(!this.elRegion){this.elRegion=this.getDragCt().getRegion();}
var dr=this.dragRegion;dr.left=xy[0];dr.top=xy[1];dr.right=xy[0];dr.bottom=xy[1];dr.constrainTo(this.elRegion);return[dr.left,dr.top];}}});Ext.dd.ScrollManager=function(){var ddm=Ext.dd.DragDropMgr;var els={};var dragEl=null;var proc={};var onStop=function(e){dragEl=null;clearProc();};var triggerRefresh=function(){if(ddm.dragCurrent){ddm.refreshCache(ddm.dragCurrent.groups);}};var doScroll=function(){if(ddm.dragCurrent){var dds=Ext.dd.ScrollManager;var inc=proc.el.ddScrollConfig?proc.el.ddScrollConfig.increment:dds.increment;if(!dds.animate){if(proc.el.scroll(proc.dir,inc)){triggerRefresh();}}else{proc.el.scroll(proc.dir,inc,true,dds.animDuration,triggerRefresh);}}};var clearProc=function(){if(proc.id){clearInterval(proc.id);}
proc.id=0;proc.el=null;proc.dir="";};var startProc=function(el,dir){clearProc();proc.el=el;proc.dir=dir;var freq=(el.ddScrollConfig&&el.ddScrollConfig.frequency)?el.ddScrollConfig.frequency:Ext.dd.ScrollManager.frequency;proc.id=setInterval(doScroll,freq);};var onFire=function(e,isDrop){if(isDrop||!ddm.dragCurrent){return;}
var dds=Ext.dd.ScrollManager;if(!dragEl||dragEl!=ddm.dragCurrent){dragEl=ddm.dragCurrent;dds.refreshCache();}
var xy=Ext.lib.Event.getXY(e);var pt=new Ext.lib.Point(xy[0],xy[1]);for(var id in els){var el=els[id],r=el._region;var c=el.ddScrollConfig?el.ddScrollConfig:dds;if(r&&r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=c.vthresh){if(proc.el!=el){startProc(el,"down");}
return;}else if(r.right-pt.x<=c.hthresh){if(proc.el!=el){startProc(el,"left");}
return;}else if(pt.y-r.top<=c.vthresh){if(proc.el!=el){startProc(el,"up");}
return;}else if(pt.x-r.left<=c.hthresh){if(proc.el!=el){startProc(el,"right");}
return;}}}
clearProc();};ddm.fireEvents=ddm.fireEvents.createSequence(onFire,ddm);ddm.stopDrag=ddm.stopDrag.createSequence(onStop,ddm);return{register:function(el){if(Ext.isArray(el)){for(var i=0,len=el.length;i<len;i++){this.register(el[i]);}}else{el=Ext.get(el);els[el.id]=el;}},unregister:function(el){if(Ext.isArray(el)){for(var i=0,len=el.length;i<len;i++){this.unregister(el[i]);}}else{el=Ext.get(el);delete els[el.id];}},vthresh:25,hthresh:25,increment:100,frequency:500,animate:true,animDuration:.4,refreshCache:function(){for(var id in els){if(typeof els[id]=='object'){els[id]._region=els[id].getRegion();}}}};}();Ext.dd.Registry=function(){var elements={};var handles={};var autoIdSeed=0;var getId=function(el,autogen){if(typeof el=="string"){return el;}
var id=el.id;if(!id&&autogen!==false){id="extdd-"+(++autoIdSeed);el.id=id;}
return id;};return{register:function(el,data){data=data||{};if(typeof el=="string"){el=document.getElementById(el);}
data.ddel=el;elements[getId(el)]=data;if(data.isHandle!==false){handles[data.ddel.id]=data;}
if(data.handles){var hs=data.handles;for(var i=0,len=hs.length;i<len;i++){handles[getId(hs[i])]=data;}}},unregister:function(el){var id=getId(el,false);var data=elements[id];if(data){delete elements[id];if(data.handles){var hs=data.handles;for(var i=0,len=hs.length;i<len;i++){delete handles[getId(hs[i],false)];}}}},getHandle:function(id){if(typeof id!="string"){id=id.id;}
return handles[id];},getHandleFromEvent:function(e){var t=Ext.lib.Event.getTarget(e);return t?handles[t.id]:null;},getTarget:function(id){if(typeof id!="string"){id=id.id;}
return elements[id];},getTargetFromEvent:function(e){var t=Ext.lib.Event.getTarget(e);return t?elements[t.id]||handles[t.id]:null;}};}();Ext.dd.StatusProxy=function(config){Ext.apply(this,config);this.id=this.id||Ext.id();this.el=new Ext.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!config||config.shadow!==false});this.ghost=Ext.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed;};Ext.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(cssClass){cssClass=cssClass||this.dropNotAllowed;if(this.dropStatus!=cssClass){this.el.replaceClass(this.dropStatus,cssClass);this.dropStatus=cssClass;}},reset:function(clearGhost){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(clearGhost){this.ghost.update("");}},update:function(html){if(typeof html=="string"){this.ghost.update(html);}else{this.ghost.update("");html.style.margin="0";this.ghost.dom.appendChild(html);}
var el=this.ghost.dom.firstChild;if(el){Ext.fly(el).setStyle(Ext.isIE?'styleFloat':'cssFloat','none');}},getEl:function(){return this.el;},getGhost:function(){return this.ghost;},hide:function(clear){this.el.hide();if(clear){this.reset(true);}},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop();}},show:function(){this.el.show();},sync:function(){this.el.sync();},repair:function(xy,callback,scope){this.callback=callback;this.scope=scope;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||.5,easing:'easeOut',xy:xy,stopFx:true,callback:this.afterRepair,scope:this});}else{this.afterRepair();}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this);}
this.callback=null;this.scope=null;}};Ext.dd.DragSource=function(el,config){this.el=Ext.get(el);if(!this.dragData){this.dragData={};}
Ext.apply(this,config);if(!this.proxy){this.proxy=new Ext.dd.StatusProxy();}
Ext.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});this.dragging=false;};Ext.extend(Ext.dd.DragSource,Ext.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData;},onDragEnter:function(e,id){var target=Ext.dd.DragDropMgr.getDDById(id);this.cachedTarget=target;if(this.beforeDragEnter(target,e,id)!==false){if(target.isNotifyTarget){var status=target.notifyEnter(this,e,this.dragData);this.proxy.setStatus(status);}else{this.proxy.setStatus(this.dropAllowed);}
if(this.afterDragEnter){this.afterDragEnter(target,e,id);}}},beforeDragEnter:function(target,e,id){return true;},alignElWithMouse:function(){Ext.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync();},onDragOver:function(e,id){var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(target,e,id)!==false){if(target.isNotifyTarget){var status=target.notifyOver(this,e,this.dragData);this.proxy.setStatus(status);}
if(this.afterDragOver){this.afterDragOver(target,e,id);}}},beforeDragOver:function(target,e,id){return true;},onDragOut:function(e,id){var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(target,e,id)!==false){if(target.isNotifyTarget){target.notifyOut(this,e,this.dragData);}
this.proxy.reset();if(this.afterDragOut){this.afterDragOut(target,e,id);}}
this.cachedTarget=null;},beforeDragOut:function(target,e,id){return true;},onDragDrop:function(e,id){var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);if(this.beforeDragDrop(target,e,id)!==false){if(target.isNotifyTarget){if(target.notifyDrop(this,e,this.dragData)){this.onValidDrop(target,e,id);}else{this.onInvalidDrop(target,e,id);}}else{this.onValidDrop(target,e,id);}
if(this.afterDragDrop){this.afterDragDrop(target,e,id);}}
delete this.cachedTarget;},beforeDragDrop:function(target,e,id){return true;},onValidDrop:function(target,e,id){this.hideProxy();if(this.afterValidDrop){this.afterValidDrop(target,e,id);}},getRepairXY:function(e,data){return this.el.getXY();},onInvalidDrop:function(target,e,id){this.beforeInvalidDrop(target,e,id);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,e,this.dragData);}
this.cacheTarget=null;}
this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(e,id);}},afterRepair:function(){if(Ext.enableFx){this.el.highlight(this.hlColor||"c3daf9");}
this.dragging=false;},beforeInvalidDrop:function(target,e,id){return true;},handleMouseDown:function(e){if(this.dragging){return;}
var data=this.getDragData(e);if(data&&this.onBeforeDrag(data,e)!==false){this.dragData=data;this.proxy.stop();Ext.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);}},onBeforeDrag:function(data,e){return true;},onStartDrag:Ext.emptyFn,startDrag:function(x,y){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show();},onInitDrag:function(x,y){var clone=this.el.dom.cloneNode(true);clone.id=Ext.id();this.proxy.update(clone);this.onStartDrag(x,y);return true;},getProxy:function(){return this.proxy;},hideProxy:function(){this.proxy.hide();this.proxy.reset(true);this.dragging=false;},triggerCacheRefresh:function(){Ext.dd.DDM.refreshCache(this.groups);},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e);},onEndDrag:function(data,e){},autoOffset:function(x,y){this.setDelta(-12,-20);}});Ext.dd.DropTarget=function(el,config){this.el=Ext.get(el);Ext.apply(this,config);if(this.containerScroll){Ext.dd.ScrollManager.register(this.el);}
Ext.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true});};Ext.extend(Ext.dd.DropTarget,Ext.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,data){if(this.overClass){this.el.addClass(this.overClass);}
return this.dropAllowed;},notifyOver:function(dd,e,data){return this.dropAllowed;},notifyOut:function(dd,e,data){if(this.overClass){this.el.removeClass(this.overClass);}},notifyDrop:function(dd,e,data){return false;}});Ext.dd.DragZone=function(el,config){Ext.dd.DragZone.superclass.constructor.call(this,el,config);if(this.containerScroll){Ext.dd.ScrollManager.register(this.el);}};Ext.extend(Ext.dd.DragZone,Ext.dd.DragSource,{getDragData:function(e){return Ext.dd.Registry.getHandleFromEvent(e);},onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true;},afterRepair:function(){if(Ext.enableFx){Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}
this.dragging=false;},getRepairXY:function(e){return Ext.Element.fly(this.dragData.ddel).getXY();}});Ext.dd.DropZone=function(el,config){Ext.dd.DropZone.superclass.constructor.call(this,el,config);};Ext.extend(Ext.dd.DropZone,Ext.dd.DropTarget,{getTargetFromEvent:function(e){return Ext.dd.Registry.getTargetFromEvent(e);},onNodeEnter:function(n,dd,e,data){},onNodeOver:function(n,dd,e,data){return this.dropAllowed;},onNodeOut:function(n,dd,e,data){},onNodeDrop:function(n,dd,e,data){return false;},onContainerOver:function(dd,e,data){return this.dropNotAllowed;},onContainerDrop:function(dd,e,data){return false;},notifyEnter:function(dd,e,data){return this.dropNotAllowed;},notifyOver:function(dd,e,data){var n=this.getTargetFromEvent(e);if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,data);this.lastOverNode=null;}
return this.onContainerOver(dd,e,data);}
if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,data);}
this.onNodeEnter(n,dd,e,data);this.lastOverNode=n;}
return this.onNodeOver(n,dd,e,data);},notifyOut:function(dd,e,data){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,data);this.lastOverNode=null;}},notifyDrop:function(dd,e,data){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,data);this.lastOverNode=null;}
var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,data):this.onContainerDrop(dd,e,data);},triggerCacheRefresh:function(){Ext.dd.DDM.refreshCache(this.groups);}});Ext.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();},asDate:function(s){if(!s){return 0;}
if(Ext.isDate(s)){return s.getTime();}
return Date.parse(String(s));},asFloat:function(s){var val=parseFloat(String(s).replace(/,/g,""));if(isNaN(val))val=0;return val;},asInt:function(s){var val=parseInt(String(s).replace(/,/g,""));if(isNaN(val))val=0;return val;}};Ext.data.Record=function(data,id){this.id=(id||id===0)?id:++Ext.data.Record.AUTO_ID;this.data=data;};Ext.data.Record.create=function(o){var f=Ext.extend(Ext.data.Record,{});var p=f.prototype;p.fields=new Ext.util.MixedCollection(false,function(field){return field.name;});for(var i=0,len=o.length;i<len;i++){p.fields.add(new Ext.data.Field(o[i]));}
f.getField=function(name){return p.fields.get(name);};return f;};Ext.data.Record.AUTO_ID=1000;Ext.data.Record.EDIT='edit';Ext.data.Record.REJECT='reject';Ext.data.Record.COMMIT='commit';Ext.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(store){this.store=store;},set:function(name,value){if(String(this.data[name])==String(value)){return;}
this.dirty=true;if(!this.modified){this.modified={};}
if(typeof this.modified[name]=='undefined'){this.modified[name]=this.data[name];}
this.data[name]=value;if(!this.editing&&this.store){this.store.afterEdit(this);}},get:function(name){return this.data[name];},beginEdit:function(){this.editing=true;this.modified={};},cancelEdit:function(){this.editing=false;delete this.modified;},endEdit:function(){this.editing=false;if(this.dirty&&this.store){this.store.afterEdit(this);}},reject:function(silent){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n];}}
this.dirty=false;delete this.modified;this.editing=false;if(this.store&&silent!==true){this.store.afterReject(this);}},commit:function(silent){this.dirty=false;delete this.modified;this.editing=false;if(this.store&&silent!==true){this.store.afterCommit(this);}},getChanges:function(){var m=this.modified,cs={};for(var n in m){if(m.hasOwnProperty(n)){cs[n]=this.data[n];}}
return cs;},hasError:function(){return this.error!=null;},clearError:function(){this.error=null;},copy:function(newId){return new this.constructor(Ext.apply({},this.data),newId||this.id);},isModified:function(fieldName){return!!(this.modified&&this.modified.hasOwnProperty(fieldName));}};Ext.StoreMgr=Ext.apply(new Ext.util.MixedCollection(),{register:function(){for(var i=0,s;s=arguments[i];i++){this.add(s);}},unregister:function(){for(var i=0,s;s=arguments[i];i++){this.remove(this.lookup(s));}},lookup:function(id){return typeof id=="object"?id:this.get(id);},getKey:function(o){return o.storeId||o.id;}});Ext.data.Store=function(config){this.data=new Ext.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start","limit":"limit","sort":"sort","dir":"dir"};if(config&&config.data){this.inlineData=config.data;delete config.data;}
Ext.apply(this,config);if(this.url&&!this.proxy){this.proxy=new Ext.data.HttpProxy({url:this.url});}
if(this.reader){if(!this.recordType){this.recordType=this.reader.recordType;}
if(this.reader.onMetaChange){this.reader.onMetaChange=this.onMetaChange.createDelegate(this);}}
if(this.recordType){this.fields=this.recordType.prototype.fields;}
this.modified=[];this.addEvents('datachanged','metachange','add','remove','update','clear','beforeload','load','loadexception');if(this.proxy){this.relayEvents(this.proxy,["loadexception"]);}
this.sortToggle={};if(this.sortInfo){this.setDefaultSort(this.sortInfo.field,this.sortInfo.direction);}
Ext.data.Store.superclass.constructor.call(this);if(this.storeId||this.id){Ext.StoreMgr.register(this);}
if(this.inlineData){this.loadData(this.inlineData);delete this.inlineData;}else if(this.autoLoad){this.load.defer(10,this,[typeof this.autoLoad=='object'?this.autoLoad:undefined]);}};Ext.extend(Ext.data.Store,Ext.util.Observable,{remoteSort:false,pruneModifiedRecords:false,lastOptions:null,destroy:function(){if(this.id){Ext.StoreMgr.unregister(this);}
this.data=null;this.purgeListeners();},add:function(records){records=[].concat(records);if(records.length<1){return;}
for(var i=0,len=records.length;i<len;i++){records[i].join(this);}
var index=this.data.length;this.data.addAll(records);if(this.snapshot){this.snapshot.addAll(records);}
this.fireEvent("add",this,records,index);},addSorted:function(record){var index=this.findInsertIndex(record);this.insert(index,record);},remove:function(record){var index=this.data.indexOf(record);this.data.removeAt(index);if(this.pruneModifiedRecords){this.modified.remove(record);}
if(this.snapshot){this.snapshot.remove(record);}
this.fireEvent("remove",this,record,index);},removeAll:function(){this.data.clear();if(this.snapshot){this.snapshot.clear();}
if(this.pruneModifiedRecords){this.modified=[];}
this.fireEvent("clear",this);},insert:function(index,records){records=[].concat(records);for(var i=0,len=records.length;i<len;i++){this.data.insert(index,records[i]);records[i].join(this);}
this.fireEvent("add",this,records,index);},indexOf:function(record){return this.data.indexOf(record);},indexOfId:function(id){return this.data.indexOfKey(id);},getById:function(id){return this.data.key(id);},getAt:function(index){return this.data.itemAt(index);},getRange:function(start,end){return this.data.getRange(start,end);},storeOptions:function(o){o=Ext.apply({},o);delete o.callback;delete o.scope;this.lastOptions=o;},load:function(options){options=options||{};if(this.fireEvent("beforeload",this,options)!==false){this.storeOptions(options);var p=Ext.apply(options.params||{},this.baseParams);if(this.sortInfo&&this.remoteSort){var pn=this.paramNames;p[pn["sort"]]=this.sortInfo.field;p[pn["dir"]]=this.sortInfo.direction;}
this.proxy.load(p,this.reader,this.loadRecords,this,options);return true;}else{return false;}},reload:function(options){this.load(Ext.applyIf(options||{},this.lastOptions));},loadRecords:function(o,options,success){if(!o||success===false){if(success!==false){this.fireEvent("load",this,[],options);}
if(options.callback){options.callback.call(options.scope||this,[],options,false);}
return;}
var r=o.records,t=o.totalRecords||r.length;if(!options||options.add!==true){if(this.pruneModifiedRecords){this.modified=[];}
for(var i=0,len=r.length;i<len;i++){r[i].join(this);}
if(this.snapshot){this.data=this.snapshot;delete this.snapshot;}
this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else{this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}
this.fireEvent("load",this,r,options);if(options.callback){options.callback.call(options.scope||this,r,options,true);}},loadData:function(o,append){var r=this.reader.readRecords(o);this.loadRecords(r,{add:append},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;this.sortData(f,s.direction);}},sortData:function(f,direction){direction=direction||'ASC';var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(direction,fn);}},setDefaultSort:function(field,dir){dir=dir?dir.toUpperCase():"ASC";this.sortInfo={field:field,direction:dir};this.sortToggle[field]=dir;},sort:function(fieldName,dir){var f=this.fields.get(fieldName);if(!f){return false;}
if(!dir){if(this.sortInfo&&this.sortInfo.field==f.name){dir=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else{dir=f.sortDir;}}
var st=(this.sortToggle)?this.sortToggle[f.name]:null;var si=(this.sortInfo)?this.sortInfo:null;this.sortToggle[f.name]=dir;this.sortInfo={field:f.name,direction:dir};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else{if(!this.load(this.lastOptions)){if(st){this.sortToggle[f.name]=st;}
if(si){this.sortInfo=si;}}}},each:function(fn,scope){this.data.each(fn,scope);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(property,value,anyMatch,caseSensitive){if(Ext.isEmpty(value,false)){return false;}
value=this.data.createValueMatcher(value,anyMatch,caseSensitive);return function(r){return value.test(r.data[property]);};},sum:function(property,start,end){var rs=this.data.items,v=0;start=start||0;end=(end||end===0)?end:rs.length-1;for(var i=start;i<=end;i++){v+=(rs[i].data[property]||0);}
return v;},filter:function(property,value,anyMatch,caseSensitive){var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,scope){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,scope||this);this.fireEvent("datachanged",this);},query:function(property,value,anyMatch,caseSensitive){var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,scope){var data=this.snapshot||this.data;return data.filterBy(fn,scope||this);},find:function(property,value,start,anyMatch,caseSensitive){var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);return fn?this.data.findIndexBy(fn,null,start):-1;},findBy:function(fn,scope,start){return this.data.findIndexBy(fn,scope,start);},collect:function(dataIndex,allowNull,bypassFilter){var d=(bypassFilter===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,len=d.length;i<len;i++){v=d[i].data[dataIndex];sv=String(v);if((allowNull||!Ext.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}
return r;},clearFilter:function(suppressEvent){if(this.isFiltered()){this.data=this.snapshot;delete this.snapshot;if(suppressEvent!==true){this.fireEvent("datachanged",this);}}},isFiltered:function(){return this.snapshot&&this.snapshot!=this.data;},afterEdit:function(record){if(this.modified.indexOf(record)==-1){this.modified.push(record);}
this.fireEvent("update",this,record,Ext.data.Record.EDIT);},afterReject:function(record){this.modified.remove(record);this.fireEvent("update",this,record,Ext.data.Record.REJECT);},afterCommit:function(record){this.modified.remove(record);this.fireEvent("update",this,record,Ext.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,len=m.length;i<len;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,len=m.length;i<len;i++){m[i].reject();}},onMetaChange:function(meta,rtype,o){this.recordType=rtype;this.fields=rtype.prototype.fields;delete this.snapshot;this.sortInfo=meta.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);},findInsertIndex:function(record){this.suspendEvents();var data=this.data.clone();this.data.add(record);this.applySort();var index=this.data.indexOf(record);this.data=data;this.resumeEvents();return index;}});Ext.data.SimpleStore=function(config){Ext.data.SimpleStore.superclass.constructor.call(this,Ext.apply(config,{reader:new Ext.data.ArrayReader({id:config.id},Ext.data.Record.create(config.fields))}));};Ext.extend(Ext.data.SimpleStore,Ext.data.Store,{loadData:function(data,append){if(this.expandData===true){var r=[];for(var i=0,len=data.length;i<len;i++){r[r.length]=[data[i]];}
data=r;}
Ext.data.SimpleStore.superclass.loadData.call(this,data,append);}});Ext.data.JsonStore=function(c){Ext.data.JsonStore.superclass.constructor.call(this,Ext.apply(c,{proxy:c.proxy||(!c.data?new Ext.data.HttpProxy({url:c.url}):undefined),reader:new Ext.data.JsonReader(c,c.fields)}));};Ext.extend(Ext.data.JsonStore,Ext.data.Store);Ext.data.Field=function(config){if(typeof config=="string"){config={name:config};}
Ext.apply(this,config);if(!this.type){this.type="auto";}
var st=Ext.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}
if(!this.sortType){switch(this.type){case"string":this.sortType=st.asUCString;break;case"date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}
var stripRe=/[\$,%]/g;if(!this.convert){var cv,dateFormat=this.dateFormat;switch(this.type){case"":case"auto":case undefined:cv=function(v){return v;};break;case"string":cv=function(v){return(v===undefined||v===null)?'':String(v);};break;case"int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(stripRe,""),10):'';};break;case"float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(stripRe,""),10):'';};break;case"bool":case"boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case"date":cv=function(v){if(!v){return'';}
if(Ext.isDate(v)){return v;}
if(dateFormat){if(dateFormat=="timestamp"){return new Date(v*1000);}
if(dateFormat=="time"){return new Date(parseInt(v,10));}
return Date.parseDate(v,dateFormat);}
var parsed=Date.parse(v);return parsed?new Date(parsed):null;};break;}
this.convert=cv;}};Ext.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};Ext.data.DataReader=function(meta,recordType){this.meta=meta;this.recordType=Ext.isArray(recordType)?Ext.data.Record.create(recordType):recordType;};Ext.data.DataReader.prototype={};Ext.data.DataProxy=function(){this.addEvents('beforeload','load');Ext.data.DataProxy.superclass.constructor.call(this);};Ext.extend(Ext.data.DataProxy,Ext.util.Observable);Ext.data.MemoryProxy=function(data){Ext.data.MemoryProxy.superclass.constructor.call(this);this.data=data;};Ext.extend(Ext.data.MemoryProxy,Ext.data.DataProxy,{load:function(params,reader,callback,scope,arg){params=params||{};var result;try{result=reader.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,arg,null,e);callback.call(scope,null,arg,false);return;}
callback.call(scope,result,arg,true);},update:function(params,records){}});Ext.data.HttpProxy=function(conn){Ext.data.HttpProxy.superclass.constructor.call(this);this.conn=conn;this.useAjax=!conn||!conn.events;};Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{getConnection:function(){return this.useAjax?Ext.Ajax:this.conn;},load:function(params,reader,callback,scope,arg){if(this.fireEvent("beforeload",this,params)!==false){var o={params:params||{},request:{callback:callback,scope:scope,arg:arg},reader:reader,callback:this.loadResponse,scope:this};if(this.useAjax){Ext.applyIf(o,this.conn);if(this.activeRequest){Ext.Ajax.abort(this.activeRequest);}
this.activeRequest=Ext.Ajax.request(o);}else{this.conn.request(o);}}else{callback.call(scope||this,null,arg,false);}},loadResponse:function(o,success,response){delete this.activeRequest;if(!success){this.fireEvent("loadexception",this,o,response);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
var result;try{result=o.reader.read(response);}catch(e){this.fireEvent("loadexception",this,o,response,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,result,o.request.arg,true);},update:function(dataSet){},updateResponse:function(dataSet){}});Ext.data.ScriptTagProxy=function(config){Ext.data.ScriptTagProxy.superclass.constructor.call(this);Ext.apply(this,config);this.head=document.getElementsByTagName("head")[0];};Ext.data.ScriptTagProxy.TRANS_ID=1000;Ext.extend(Ext.data.ScriptTagProxy,Ext.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(params,reader,callback,scope,arg){if(this.fireEvent("beforeload",this,params)!==false){var p=Ext.urlEncode(Ext.apply(params,this.extraParams));var url=this.url;url+=(url.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){url+="&_dc="+(new Date().getTime());}
var transId=++Ext.data.ScriptTagProxy.TRANS_ID;var trans={id:transId,cb:"stcCallback"+transId,scriptId:"stcScript"+transId,params:params,arg:arg,url:url,callback:callback,scope:scope,reader:reader};var conn=this;window[trans.cb]=function(o){conn.handleResponse(o,trans);};url+=String.format("&{0}={1}",this.callbackParam,trans.cb);if(this.autoAbort!==false){this.abort();}
trans.timeoutId=this.handleFailure.defer(this.timeout,this,[trans]);var script=document.createElement("script");script.setAttribute("src",url);script.setAttribute("type","text/javascript");script.setAttribute("id",trans.scriptId);this.head.appendChild(script);this.trans=trans;}else{callback.call(scope||this,null,arg,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(trans,isLoaded){this.head.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){}};}},handleResponse:function(o,trans){this.trans=false;this.destroyTrans(trans,true);var result;try{result=trans.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,trans.arg,e);trans.callback.call(trans.scope||window,null,trans.arg,false);return;}
this.fireEvent("load",this,o,trans.arg);trans.callback.call(trans.scope||window,result,trans.arg,true);},handleFailure:function(trans){this.trans=false;this.destroyTrans(trans,false);this.fireEvent("loadexception",this,null,trans.arg);trans.callback.call(trans.scope||window,null,trans.arg,false);}});Ext.data.JsonReader=function(meta,recordType){meta=meta||{};Ext.data.JsonReader.superclass.constructor.call(this,meta,recordType||meta.fields);};Ext.extend(Ext.data.JsonReader,Ext.data.DataReader,{read:function(response){var json=response.responseText;var o=eval("("+json+")");if(!o){throw{message:"JsonReader.read: Json object not found"};}
return this.readRecords(o);},onMetaChange:function(meta,recordType,o){},simpleAccess:function(obj,subsc){return obj[subsc];},getJsonAccessor:function(){var re=/[\[\.]/;return function(expr){try{return(re.test(expr))?new Function("obj","return obj."+expr):function(obj){return obj[expr];};}catch(e){}
return Ext.emptyFn;};}(),readRecords:function(o){this.jsonData=o;if(o.metaData){delete this.ef;this.meta=o.metaData;this.recordType=Ext.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);}
var s=this.meta,Record=this.recordType,f=Record.prototype.fields,fi=f.items,fl=f.length;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}
if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}
this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(rec){var r=g(rec);return(r===undefined||r==="")?null:r;};}else{this.getId=function(){return null;};}
this.ef=[];for(var i=0;i<fl;i++){f=fi[i];var map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[i]=this.getJsonAccessor(map);}}
var root=this.getRoot(o),c=root.length,totalRecords=c,success=true;if(s.totalProperty){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){totalRecords=v;}}
if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==='false'){success=false;}}
var records=[];for(var i=0;i<c;i++){var n=root[i];var values={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);values[f.name]=f.convert((v!==undefined)?v:f.defaultValue,n);}
var record=new Record(values,id);record.json=n;records[i]=record;}
return{success:success,records:records,totalRecords:totalRecords};}});Ext.data.XmlReader=function(meta,recordType){meta=meta||{};Ext.data.XmlReader.superclass.constructor.call(this,meta,recordType||meta.fields);};Ext.extend(Ext.data.XmlReader,Ext.data.DataReader,{read:function(response){var doc=response.responseXML;if(!doc){throw{message:"XmlReader.read: XML Document not available"};}
return this.readRecords(doc);},readRecords:function(doc){this.xmlData=doc;var root=doc.documentElement||doc;var q=Ext.DomQuery;var recordType=this.recordType,fields=recordType.prototype.fields;var sid=this.meta.id;var totalRecords=0,success=true;if(this.meta.totalRecords){totalRecords=q.selectNumber(this.meta.totalRecords,root,0);}
if(this.meta.success){var sv=q.selectValue(this.meta.success,root,true);success=sv!==false&&sv!=='false';}
var records=[];var ns=q.select(this.meta.record,root);for(var i=0,len=ns.length;i<len;i++){var n=ns[i];var values={};var id=sid?q.selectValue(sid,n):undefined;for(var j=0,jlen=fields.length;j<jlen;j++){var f=fields.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v,n);values[f.name]=v;}
var record=new recordType(values,id);record.node=n;records[records.length]=record;}
return{success:success,records:records,totalRecords:totalRecords||records.length};}});Ext.data.ArrayReader=Ext.extend(Ext.data.JsonReader,{readRecords:function(o){var sid=this.meta?this.meta.id:null;var recordType=this.recordType,fields=recordType.prototype.fields;var records=[];var root=o;for(var i=0;i<root.length;i++){var n=root[i];var values={};var id=((sid||sid===0)&&n[sid]!==undefined&&n[sid]!==""?n[sid]:null);for(var j=0,jlen=fields.length;j<jlen;j++){var f=fields.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v,n);values[f.name]=v;}
var record=new recordType(values,id);record.json=n;records[records.length]=record;}
return{records:records,totalRecords:records.length};}});Ext.data.Tree=function(root){this.nodeHash={};this.root=null;if(root){this.setRootNode(root);}
this.addEvents("append","remove","move","insert","beforeappend","beforeremove","beforemove","beforeinsert");Ext.data.Tree.superclass.constructor.call(this);};Ext.extend(Ext.data.Tree,Ext.util.Observable,{pathSeparator:"/",proxyNodeEvent:function(){return this.fireEvent.apply(this,arguments);},getRootNode:function(){return this.root;},setRootNode:function(node){this.root=node;node.ownerTree=this;node.isRoot=true;this.registerNode(node);return node;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(node){this.nodeHash[node.id]=node;},unregisterNode:function(node){delete this.nodeHash[node.id];},toString:function(){return"[Tree"+(this.id?" "+this.id:"")+"]";}});Ext.data.Node=function(attributes){this.attributes=attributes||{};this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Ext.id(null,"ynode-");this.attributes.id=this.id;}
this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o)return i;}
return-1;};}
this.parentNode=null;this.firstChild=null;this.lastChild=null;this.previousSibling=null;this.nextSibling=null;this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});this.listeners=this.attributes.listeners;Ext.data.Node.superclass.constructor.call(this);};Ext.extend(Ext.data.Node,Ext.util.Observable,{fireEvent:function(evtName){if(Ext.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false;}
var ot=this.getOwnerTree();if(ot){if(ot.proxyNodeEvent.apply(ot,arguments)===false){return false;}}
return true;},isLeaf:function(){return this.leaf===true;},setFirstChild:function(node){this.firstChild=node;},setLastChild:function(node){this.lastChild=node;},isLast:function(){return(!this.parentNode?true:this.parentNode.lastChild==this);},isFirst:function(){return(!this.parentNode?true:this.parentNode.firstChild==this);},hasChildNodes:function(){return!this.isLeaf()&&this.childNodes.length>0;},isExpandable:function(){return this.attributes.expandable||this.hasChildNodes();},appendChild:function(node){var multi=false;if(Ext.isArray(node)){multi=node;}else if(arguments.length>1){multi=arguments;}
if(multi){for(var i=0,len=multi.length;i<len;i++){this.appendChild(multi[i]);}}else{if(this.fireEvent("beforeappend",this.ownerTree,this,node)===false){return false;}
var index=this.childNodes.length;var oldParent=node.parentNode;if(oldParent){if(node.fireEvent("beforemove",node.getOwnerTree(),node,oldParent,this,index)===false){return false;}
oldParent.removeChild(node);}
index=this.childNodes.length;if(index==0){this.setFirstChild(node);}
this.childNodes.push(node);node.parentNode=this;var ps=this.childNodes[index-1];if(ps){node.previousSibling=ps;ps.nextSibling=node;}else{node.previousSibling=null;}
node.nextSibling=null;this.setLastChild(node);node.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,node,index);if(oldParent){node.fireEvent("move",this.ownerTree,node,oldParent,this,index);}
return node;}},removeChild:function(node){var index=this.childNodes.indexOf(node);if(index==-1){return false;}
if(this.fireEvent("beforeremove",this.ownerTree,this,node)===false){return false;}
this.childNodes.splice(index,1);if(node.previousSibling){node.previousSibling.nextSibling=node.nextSibling;}
if(node.nextSibling){node.nextSibling.previousSibling=node.previousSibling;}
if(this.firstChild==node){this.setFirstChild(node.nextSibling);}
if(this.lastChild==node){this.setLastChild(node.previousSibling);}
node.setOwnerTree(null);node.parentNode=null;node.previousSibling=null;node.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,node);return node;},insertBefore:function(node,refNode){if(!refNode){return this.appendChild(node);}
if(node==refNode){return false;}
if(this.fireEvent("beforeinsert",this.ownerTree,this,node,refNode)===false){return false;}
var index=this.childNodes.indexOf(refNode);var oldParent=node.parentNode;var refIndex=index;if(oldParent==this&&this.childNodes.indexOf(node)<index){refIndex--;}
if(oldParent){if(node.fireEvent("beforemove",node.getOwnerTree(),node,oldParent,this,index,refNode)===false){return false;}
oldParent.removeChild(node);}
if(refIndex==0){this.setFirstChild(node);}
this.childNodes.splice(refIndex,0,node);node.parentNode=this;var ps=this.childNodes[refIndex-1];if(ps){node.previousSibling=ps;ps.nextSibling=node;}else{node.previousSibling=null;}
node.nextSibling=refNode;refNode.previousSibling=node;node.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,node,refNode);if(oldParent){node.fireEvent("move",this.ownerTree,node,oldParent,this,refIndex,refNode);}
return node;},remove:function(){this.parentNode.removeChild(this);return this;},item:function(index){return this.childNodes[index];},replaceChild:function(newChild,oldChild){this.insertBefore(newChild,oldChild);this.removeChild(oldChild);return oldChild;},indexOf:function(child){return this.childNodes.indexOf(child);},getOwnerTree:function(){if(!this.ownerTree){var p=this;while(p){if(p.ownerTree){this.ownerTree=p.ownerTree;break;}
p=p.parentNode;}}
return this.ownerTree;},getDepth:function(){var depth=0;var p=this;while(p.parentNode){++depth;p=p.parentNode;}
return depth;},setOwnerTree:function(tree){if(tree!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this);}
this.ownerTree=tree;var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].setOwnerTree(tree);}
if(tree){tree.registerNode(this);}}},getPath:function(attr){attr=attr||"id";var p=this.parentNode;var b=[this.attributes[attr]];while(p){b.unshift(p.attributes[attr]);p=p.parentNode;}
var sep=this.getOwnerTree().pathSeparator;return sep+b.join(sep);},bubble:function(fn,scope,args){var p=this;while(p){if(fn.apply(scope||p,args||[p])===false){break;}
p=p.parentNode;}},cascade:function(fn,scope,args){if(fn.apply(scope||this,args||[this])!==false){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].cascade(fn,scope,args);}}},eachChild:function(fn,scope,args){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(fn.apply(scope||this,args||[cs[i]])===false){break;}}},findChild:function(attribute,value){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(cs[i].attributes[attribute]==value){return cs[i];}}
return null;},findChildBy:function(fn,scope){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(fn.call(scope||cs[i],cs[i])===true){return cs[i];}}
return null;},sort:function(fn,scope){var cs=this.childNodes;var len=cs.length;if(len>0){var sortFn=scope?function(){fn.apply(scope,arguments);}:fn;cs.sort(sortFn);for(var i=0;i<len;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n);}
if(i==len-1){this.setLastChild(n);}}}},contains:function(node){return node.isAncestor(this);},isAncestor:function(node){var p=this.parentNode;while(p){if(p==node){return true;}
p=p.parentNode;}
return false;},toString:function(){return"[Node"+(this.id?" "+this.id:"")+"]";}});Ext.data.GroupingStore=Ext.extend(Ext.data.Store,{remoteGroup:false,groupOnSort:false,clearGrouping:function(){this.groupField=false;if(this.remoteGroup){if(this.baseParams){delete this.baseParams.groupBy;}
this.reload();}else{this.applySort();this.fireEvent('datachanged',this);}},groupBy:function(field,forceRegroup){if(this.groupField==field&&!forceRegroup){return;}
this.groupField=field;if(this.remoteGroup){if(!this.baseParams){this.baseParams={};}
this.baseParams['groupBy']=field;}
if(this.groupOnSort){this.sort(field);return;}
if(this.remoteGroup){this.reload();}else{var si=this.sortInfo||{};if(si.field!=field){this.applySort();}else{this.sortData(field);}
this.fireEvent('datachanged',this);}},applySort:function(){Ext.data.GroupingStore.superclass.applySort.call(this);if(!this.groupOnSort&&!this.remoteGroup){var gs=this.getGroupState();if(gs&&gs!=this.sortInfo.field){this.sortData(this.groupField);}}},applyGrouping:function(alwaysFireChange){if(this.groupField!==false){this.groupBy(this.groupField,true);return true;}else{if(alwaysFireChange===true){this.fireEvent('datachanged',this);}
return false;}},getGroupState:function(){return this.groupOnSort&&this.groupField!==false?(this.sortInfo?this.sortInfo.field:undefined):this.groupField;}});Ext.ComponentMgr=function(){var all=new Ext.util.MixedCollection();var types={};return{register:function(c){all.add(c);},unregister:function(c){all.remove(c);},get:function(id){return all.get(id);},onAvailable:function(id,fn,scope){all.on("add",function(index,o){if(o.id==id){fn.call(scope||o,o);all.un("add",fn,scope);}});},all:all,registerType:function(xtype,cls){types[xtype]=cls;cls.xtype=xtype;},isRegistered:function(xtype){return types[xtype];},create:function(config,defaultType){return new types[config.xtype||defaultType](config);}};}();Ext.reg=Ext.ComponentMgr.registerType;Ext.Component=function(config){config=config||{};if(config.initialConfig){if(config.isAction){this.baseAction=config;}
config=config.initialConfig;}else if(config.tagName||config.dom||typeof config=="string"){config={applyTo:config,id:config.id||config};}
this.initialConfig=config;Ext.apply(this,config);this.addEvents('disable','enable','beforeshow','show','beforehide','hide','beforerender','render','beforedestroy','destroy','beforestaterestore','staterestore','beforestatesave','statesave');this.getId();Ext.ComponentMgr.register(this);Ext.Component.superclass.constructor.call(this);if(this.baseAction){this.baseAction.addComponent(this);}
this.initComponent();if(this.plugins){if(Ext.isArray(this.plugins)){for(var i=0,len=this.plugins.length;i<len;i++){this.plugins[i]=this.initPlugin(this.plugins[i]);}}else{this.plugins=this.initPlugin(this.plugins);}}
if(this.stateful!==false){this.initState(config);}
if(this.applyTo){this.applyToMarkup(this.applyTo);delete this.applyTo;}else if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Ext.Component.AUTO_ID=1000;Ext.extend(Ext.Component,Ext.util.Observable,{disabledClass:"x-item-disabled",allowDomMove:true,autoShow:false,hideMode:'display',hideParent:false,hidden:false,disabled:false,rendered:false,ctype:"Ext.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initPlugin:function(p){p.init(this);return p;},initComponent:Ext.emptyFn,render:function(container,position){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!container&&this.el){this.el=Ext.get(this.el);container=this.el.dom.parentNode;this.allowDomMove=false;}
this.container=Ext.get(container);if(this.ctCls){this.container.addClass(this.ctCls);}
this.rendered=true;if(position!==undefined){if(typeof position=='number'){position=this.container.dom.childNodes[position];}else{position=Ext.getDom(position);}}
this.onRender(this.container,position||null);if(this.autoShow){this.el.removeClass(['x-hidden','x-hide-'+this.hideMode]);}
if(this.cls){this.el.addClass(this.cls);delete this.cls;}
if(this.style){this.el.applyStyles(this.style);delete this.style;}
this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();}
if(this.disabled){this.disable();}
if(this.stateful!==false){this.initStateEvents();}}
return this;},initState:function(config){if(Ext.state.Manager){var state=Ext.state.Manager.get(this.stateId||this.id);if(state){if(this.fireEvent('beforestaterestore',this,state)!==false){this.applyState(state);this.fireEvent('staterestore',this,state);}}}},initStateEvents:function(){if(this.stateEvents){for(var i=0,e;e=this.stateEvents[i];i++){this.on(e,this.saveState,this,{delay:100});}}},applyState:function(state,config){if(state){Ext.apply(this,state);}},getState:function(){return null;},saveState:function(){if(Ext.state.Manager){var state=this.getState();if(this.fireEvent('beforestatesave',this,state)!==false){Ext.state.Manager.set(this.stateId||this.id,state);this.fireEvent('statesave',this,state);}}},applyToMarkup:function(el){this.allowDomMove=false;this.el=Ext.get(el);this.render(this.el.dom.parentNode);},addClass:function(cls){if(this.el){this.el.addClass(cls);}else{this.cls=this.cls?this.cls+' '+cls:cls;}},removeClass:function(cls){if(this.el){this.el.removeClass(cls);}else if(this.cls){this.cls=this.cls.split(' ').remove(cls).join(' ');}},onRender:function(ct,position){if(this.autoEl){if(typeof this.autoEl=='string'){this.el=document.createElement(this.autoEl);}else{var div=document.createElement('div');Ext.DomHelper.overwrite(div,this.autoEl);this.el=div.firstChild;}
if(!this.el.id){this.el.id=this.getId();}}
if(this.el){this.el=Ext.get(this.el);if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,position);}
if(this.overCls){this.el.addClassOnOver(this.overCls);}}},getAutoCreate:function(){var cfg=typeof this.autoCreate=="object"?this.autoCreate:Ext.apply({},this.defaultAutoCreate);if(this.id&&!cfg.id){cfg.id=this.id;}
return cfg;},afterRender:Ext.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();if(this.actionMode=="container"){this.container.remove();}}
this.onDestroy();Ext.ComponentMgr.unregister(this);this.fireEvent("destroy",this);this.purgeListeners();}},beforeDestroy:Ext.emptyFn,onDestroy:Ext.emptyFn,getEl:function(){return this.el;},getId:function(){return this.id||(this.id="ext-comp-"+(++Ext.Component.AUTO_ID));},getItemId:function(){return this.itemId||this.getId();},focus:function(selectText,delay){if(delay){this.focus.defer(typeof delay=='number'?delay:10,this,[selectText,false]);return;}
if(this.rendered){this.el.focus();if(selectText===true){this.el.dom.select();}}
return this;},blur:function(){if(this.rendered){this.el.blur();}
return this;},disable:function(){if(this.rendered){this.onDisable();}
this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}
this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(disabled){this[disabled?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.autoRender){this.render(typeof this.autoRender=='boolean'?Ext.getBody():this.autoRender);}
if(this.rendered){this.onShow();}
this.fireEvent("show",this);}
return this;},onShow:function(){if(this.hideParent){this.container.removeClass('x-hide-'+this.hideMode);}else{this.getActionEl().removeClass('x-hide-'+this.hideMode);}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();}
this.fireEvent("hide",this);}
return this;},onHide:function(){if(this.hideParent){this.container.addClass('x-hide-'+this.hideMode);}else{this.getActionEl().addClass('x-hide-'+this.hideMode);}},setVisible:function(visible){if(visible){this.show();}else{this.hide();}
return this;},isVisible:function(){return this.rendered&&this.getActionEl().isVisible();},cloneConfig:function(overrides){overrides=overrides||{};var id=overrides.id||Ext.id();var cfg=Ext.applyIf(overrides,this.initialConfig);cfg.id=id;return new this.constructor(cfg);},getXType:function(){return this.constructor.xtype;},isXType:function(xtype,shallow){return!shallow?('/'+this.getXTypes()+'/').indexOf('/'+xtype+'/')!=-1:this.constructor.xtype==xtype;},getXTypes:function(){var tc=this.constructor;if(!tc.xtypes){var c=[],sc=this;while(sc&&sc.constructor.xtype){c.unshift(sc.constructor.xtype);sc=sc.constructor.superclass;}
tc.xtypeChain=c;tc.xtypes=c.join('/');}
return tc.xtypes;},findParentBy:function(fn){for(var p=this.ownerCt;(p!=null)&&!fn(p,this);p=p.ownerCt);return p||null;},findParentByType:function(xtype){return typeof xtype=='function'?this.findParentBy(function(p){return p.constructor===xtype;}):this.findParentBy(function(p){return p.constructor.xtype===xtype;});},mon:function(item,ename,fn,scope,opt){if(!this.mons){this.mons=[];this.on('beforedestroy',function(){for(var i=0,len=this.mons.length;i<len;i++){var m=this.mons[i];m.item.un(m.ename,m.fn,m.scope);}},this);}
this.mons.push({item:item,ename:ename,fn:fn,scope:scope});item.on(ename,fn,scope,opt);}});Ext.reg('component',Ext.Component);Ext.Action=function(config){this.initialConfig=config;this.items=[];}
Ext.Action.prototype={isAction:true,setText:function(text){this.initialConfig.text=text;this.callEach('setText',[text]);},getText:function(){return this.initialConfig.text;},setIconClass:function(cls){this.initialConfig.iconCls=cls;this.callEach('setIconClass',[cls]);},getIconClass:function(){return this.initialConfig.iconCls;},setDisabled:function(v){this.initialConfig.disabled=v;this.callEach('setDisabled',[v]);},enable:function(){this.setDisabled(false);},disable:function(){this.setDisabled(true);},isDisabled:function(){return this.initialConfig.disabled;},setHidden:function(v){this.initialConfig.hidden=v;this.callEach('setVisible',[!v]);},show:function(){this.setHidden(false);},hide:function(){this.setHidden(true);},isHidden:function(){return this.initialConfig.hidden;},setHandler:function(fn,scope){this.initialConfig.handler=fn;this.initialConfig.scope=scope;this.callEach('setHandler',[fn,scope]);},each:function(fn,scope){Ext.each(this.items,fn,scope);},callEach:function(fnName,args){var cs=this.items;for(var i=0,len=cs.length;i<len;i++){cs[i][fnName].apply(cs[i],args);}},addComponent:function(comp){this.items.push(comp);comp.on('destroy',this.removeComponent,this);},removeComponent:function(comp){this.items.remove(comp);},execute:function(){this.initialConfig.handler.apply(this.initialConfig.scope||window,arguments);}};(function(){Ext.Layer=function(config,existingEl){config=config||{};var dh=Ext.DomHelper;var cp=config.parentEl,pel=cp?Ext.getDom(cp):document.body;if(existingEl){this.dom=Ext.getDom(existingEl);}
if(!this.dom){var o=config.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(pel,o);}
if(config.cls){this.addClass(config.cls);}
this.constrain=config.constrain!==false;this.visibilityMode=Ext.Element.VISIBILITY;if(config.id){this.id=this.dom.id=config.id;}else{this.id=Ext.id(this.dom);}
this.zindex=config.zindex||this.getZIndex();this.position("absolute",this.zindex);if(config.shadow){this.shadowOffset=config.shadowOffset||4;this.shadow=new Ext.Shadow({offset:this.shadowOffset,mode:config.shadow});}else{this.shadowOffset=0;}
this.useShim=config.shim!==false&&Ext.useShims;this.useDisplay=config.useDisplay;this.hide();};var supr=Ext.Element.prototype;var shims=[];Ext.extend(Ext.Layer,Ext.Element,{getZIndex:function(){return this.zindex||parseInt(this.getStyle("z-index"),10)||11000;},getShim:function(){if(!this.useShim){return null;}
if(this.shim){return this.shim;}
var shim=shims.shift();if(!shim){shim=this.createShim();shim.enableDisplayMode('block');shim.dom.style.display='none';shim.dom.style.visibility='visible';}
var pn=this.dom.parentNode;if(shim.dom.parentNode!=pn){pn.insertBefore(shim.dom,this.dom);}
shim.setStyle('z-index',this.getZIndex()-2);this.shim=shim;return shim;},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);shims.push(this.shim);delete this.shim;}},disableShadow:function(){if(this.shadow){this.shadowDisabled=true;this.shadow.hide();this.lastShadowOffset=this.shadowOffset;this.shadowOffset=0;}},enableShadow:function(show){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(show){this.sync(true);}}},sync:function(doShow){var sw=this.shadow;if(!this.updating&&this.isVisible()&&(sw||this.useShim)){var sh=this.getShim();var w=this.getWidth(),h=this.getHeight();var l=this.getLeft(true),t=this.getTop(true);if(sw&&!this.shadowDisabled){if(doShow&&!sw.isVisible()){sw.show(this);}else{sw.realign(l,t,w,h);}
if(sh){if(doShow){sh.show();}
var a=sw.adjusts,s=sh.dom.style;s.left=(Math.min(l,l+a.l))+"px";s.top=(Math.min(t,t+a.t))+"px";s.width=(w+a.w)+"px";s.height=(h+a.h)+"px";}}else if(sh){if(doShow){sh.show();}
sh.setSize(w,h);sh.setLeftTop(l,t);}}},destroy:function(){this.hideShim();if(this.shadow){this.shadow.hide();}
this.removeAllListeners();Ext.removeNode(this.dom);Ext.Element.uncache(this.id);},remove:function(){this.destroy();},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.sync(true);},hideUnders:function(negOffset){if(this.shadow){this.shadow.hide();}
this.hideShim();},constrainXY:function(){if(this.constrain){var vw=Ext.lib.Dom.getViewWidth(),vh=Ext.lib.Dom.getViewHeight();var s=Ext.getDoc().getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;var moved=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;moved=true;}
if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;moved=true;}
if(x<s.left){x=s.left;moved=true;}
if(y<s.top){y=s.top;moved=true;}
if(moved){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5;}}
xy=[x,y];this.storeXY(xy);supr.setXY.call(this,xy);this.sync();}}},isVisible:function(){return this.visible;},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("");}else if(this.lastXY){supr.setXY.call(this,this.lastXY);}else if(this.lastLT){supr.setLeftTop.call(this,this.lastLT[0],this.lastLT[1]);}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false);}else{this.setLeftTop(-10000,-10000);}},setVisible:function(v,a,d,c,e){if(v){this.showAction();}
if(a&&v){var cb=function(){this.sync(true);if(c){c();}}.createDelegate(this);supr.setVisible.call(this,true,true,d,cb,e);}else{if(!v){this.hideUnders(true);}
var cb=c;if(a){cb=function(){this.hideAction();if(c){c();}}.createDelegate(this);}
supr.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true);}else if(!a){this.hideAction();}}},storeXY:function(xy){delete this.lastLT;this.lastXY=xy;},storeLeftTop:function(left,top){delete this.lastXY;this.lastLT=[left,top];},beforeFx:function(){this.beforeAction();return Ext.Layer.superclass.beforeFx.apply(this,arguments);},afterFx:function(){Ext.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible());},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide();}},setLeft:function(left){this.storeLeftTop(left,this.getTop(true));supr.setLeft.apply(this,arguments);this.sync();},setTop:function(top){this.storeLeftTop(this.getLeft(true),top);supr.setTop.apply(this,arguments);this.sync();},setLeftTop:function(left,top){this.storeLeftTop(left,top);supr.setLeftTop.apply(this,arguments);this.sync();},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);supr.setXY.call(this,xy,a,d,cb,e);if(!a){cb();}},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c();}};},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e);},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e);},setSize:function(w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);supr.setSize.call(this,w,h,a,d,cb,e);if(!a){cb();}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);supr.setWidth.call(this,w,a,d,cb,e);if(!a){cb();}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);supr.setHeight.call(this,h,a,d,cb,e);if(!a){cb();}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);supr.setXY.call(this,[x,y]);supr.setSize.call(this,w,h,a,d,cb,e);cb();}else{supr.setBounds.call(this,x,y,w,h,a,d,cb,e);}
return this;},setZIndex:function(zindex){this.zindex=zindex;this.setStyle("z-index",zindex+2);if(this.shadow){this.shadow.setZIndex(zindex+1);}
if(this.shim){this.shim.setStyle("z-index",zindex);}}});})();Ext.Shadow=function(config){Ext.apply(this,config);if(typeof this.mode!="string"){this.mode=this.defaultMode;}
var o=this.offset,a={h:0};var rad=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case"drop":a.w=0;a.l=a.t=o;a.t-=1;if(Ext.isIE){a.l-=this.offset+rad;a.t-=this.offset+rad;a.w-=rad;a.h-=rad;a.t+=1;}
break;case"sides":a.w=(o*2);a.l=-o;a.t=o-1;if(Ext.isIE){a.l-=(this.offset-rad);a.t-=this.offset+rad;a.l+=1;a.w-=(this.offset-rad)*2;a.w-=rad+1;a.h-=1;}
break;case"frame":a.w=a.h=(o*2);a.l=a.t=-o;a.t+=1;a.h-=2;if(Ext.isIE){a.l-=(this.offset-rad);a.t-=(this.offset-rad);a.l+=1;a.w-=(this.offset+rad+1);a.h-=(this.offset+rad);a.h+=1;}
break;};this.adjusts=a;};Ext.Shadow.prototype={offset:4,defaultMode:"drop",show:function(target){target=Ext.get(target);if(!this.el){this.el=Ext.Shadow.Pool.pull();if(this.el.dom.nextSibling!=target.dom){this.el.insertBefore(target);}}
this.el.setStyle("z-index",this.zIndex||parseInt(target.getStyle("z-index"),10)-1);if(Ext.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";}
this.realign(target.getLeft(true),target.getTop(true),target.getWidth(),target.getHeight());this.el.dom.style.display="block";},isVisible:function(){return this.el?true:false;},realign:function(l,t,w,h){if(!this.el){return;}
var a=this.adjusts,d=this.el.dom,s=d.style;var iea=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),sws=sw+"px",shs=sh+"px";if(s.width!=sws||s.height!=shs){s.width=sws;s.height=shs;if(!Ext.isIE){var cn=d.childNodes;var sww=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=sww;cn[1].childNodes[1].style.width=sww;cn[2].childNodes[1].style.width=sww;cn[1].style.height=Math.max(0,(sh-12))+"px";}}},hide:function(){if(this.el){this.el.dom.style.display="none";Ext.Shadow.Pool.push(this.el);delete this.el;}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z);}}};Ext.Shadow.Pool=function(){var p=[];var markup=Ext.isIE?'<div class="x-ie-shadow"></div>':'<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';return{pull:function(){var sh=p.shift();if(!sh){sh=Ext.get(Ext.DomHelper.insertHtml("beforeBegin",document.body.firstChild,markup));sh.autoBoxAdjust=false;}
return sh;},push:function(sh){p.push(sh);}};}();Ext.BoxComponent=Ext.extend(Ext.Component,{initComponent:function(){Ext.BoxComponent.superclass.initComponent.call(this);this.addEvents('resize','move');},boxReady:false,deferHeight:false,setSize:function(w,h){if(typeof w=='object'){h=w.height;w=w.width;}
if(!this.boxReady){this.width=w;this.height=h;return this;}
if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return this;}
this.lastSize={width:w,height:h};var adj=this.adjustSize(w,h);var aw=adj.width,ah=adj.height;if(aw!==undefined||ah!==undefined){var rz=this.getResizeEl();if(!this.deferHeight&&aw!==undefined&&ah!==undefined){rz.setSize(aw,ah);}else if(!this.deferHeight&&ah!==undefined){rz.setHeight(ah);}else if(aw!==undefined){rz.setWidth(aw);}
this.onResize(aw,ah,w,h);this.fireEvent('resize',this,aw,ah,w,h);}
return this;},setWidth:function(width){return this.setSize(width);},setHeight:function(height){return this.setSize(undefined,height);},getSize:function(){return this.el.getSize();},getPosition:function(local){if(local===true){return[this.el.getLeft(true),this.el.getTop(true)];}
return this.xy||this.el.getXY();},getBox:function(local){var s=this.el.getSize();if(local===true){s.x=this.el.getLeft(true);s.y=this.el.getTop(true);}else{var xy=this.xy||this.el.getXY();s.x=xy[0];s.y=xy[1];}
return s;},updateBox:function(box){this.setSize(box.width,box.height);this.setPagePosition(box.x,box.y);return this;},getResizeEl:function(){return this.resizeEl||this.el;},getPositionEl:function(){return this.positionEl||this.el;},setPosition:function(x,y){if(x&&typeof x[1]=='number'){y=x[1];x=x[0];}
this.x=x;this.y=y;if(!this.boxReady){return this;}
var adj=this.adjustPosition(x,y);var ax=adj.x,ay=adj.y;var el=this.getPositionEl();if(ax!==undefined||ay!==undefined){if(ax!==undefined&&ay!==undefined){el.setLeftTop(ax,ay);}else if(ax!==undefined){el.setLeft(ax);}else if(ay!==undefined){el.setTop(ay);}
this.onPosition(ax,ay);this.fireEvent('move',this,ax,ay);}
return this;},setPagePosition:function(x,y){if(x&&typeof x[1]=='number'){y=x[1];x=x[0];}
this.pageX=x;this.pageY=y;if(!this.boxReady){return;}
if(x===undefined||y===undefined){return;}
var p=this.el.translatePoints(x,y);this.setPosition(p.left,p.top);return this;},onRender:function(ct,position){Ext.BoxComponent.superclass.onRender.call(this,ct,position);if(this.resizeEl){this.resizeEl=Ext.get(this.resizeEl);}
if(this.positionEl){this.positionEl=Ext.get(this.positionEl);}},afterRender:function(){Ext.BoxComponent.superclass.afterRender.call(this);this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y);}else if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.autoWidth?undefined:this.el.getWidth(),this.autoHeight?undefined:this.el.getHeight());return this;},onResize:function(adjWidth,adjHeight,rawWidth,rawHeight){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w='auto';}
if(this.autoHeight){h='auto';}
return{width:w,height:h};},adjustPosition:function(x,y){return{x:x,y:y};}});Ext.reg('box',Ext.BoxComponent);Ext.SplitBar=function(dragElement,resizingElement,orientation,placement,existingProxy){this.el=Ext.get(dragElement,true);this.el.dom.unselectable="on";this.resizingEl=Ext.get(resizingElement,true);this.orientation=orientation||Ext.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!existingProxy){this.proxy=Ext.SplitBar.createProxy(this.orientation);}else{this.proxy=Ext.get(existingProxy).dom;}
this.dd=new Ext.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Ext.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.placement=placement||(this.el.getX()>this.resizingEl.getX()?Ext.SplitBar.LEFT:Ext.SplitBar.RIGHT);this.el.addClass("x-splitbar-h");}else{this.placement=placement||(this.el.getY()>this.resizingEl.getY()?Ext.SplitBar.TOP:Ext.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v");}
this.addEvents("resize","moved","beforeresize","beforeapply");Ext.SplitBar.superclass.constructor.call(this);};Ext.extend(Ext.SplitBar,Ext.util.Observable,{onStartProxyDrag:function(x,y){this.fireEvent("beforeresize",this);this.overlay=Ext.DomHelper.append(document.body,{cls:"x-drag-overlay",html:"&#160;"},true);this.overlay.unselectable();this.overlay.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.overlay.show();Ext.get(this.proxy).setDisplayed("block");var size=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();;this.activeMaxSize=this.getMaximumSize();;var c1=size-this.activeMinSize;var c2=Math.max(this.activeMaxSize-size,0);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Ext.SplitBar.LEFT?c1:c2,this.placement==Ext.SplitBar.LEFT?c2:c1);this.dd.setYConstraint(0,0);}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Ext.SplitBar.TOP?c1:c2,this.placement==Ext.SplitBar.TOP?c2:c1);}
this.dragSpecs.startSize=size;this.dragSpecs.startPoint=[x,y];Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd,x,y);},onEndProxyDrag:function(e){Ext.get(this.proxy).setDisplayed(false);var endPoint=Ext.lib.Event.getXY(e);if(this.overlay){this.overlay.remove();delete this.overlay;}
var newSize;if(this.orientation==Ext.SplitBar.HORIZONTAL){newSize=this.dragSpecs.startSize+
(this.placement==Ext.SplitBar.LEFT?endPoint[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-endPoint[0]);}else{newSize=this.dragSpecs.startSize+
(this.placement==Ext.SplitBar.TOP?endPoint[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-endPoint[1]);}
newSize=Math.min(Math.max(newSize,this.activeMinSize),this.activeMaxSize);if(newSize!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,newSize)!==false){this.adapter.setElementSize(this,newSize);this.fireEvent("moved",this,newSize);this.fireEvent("resize",this,newSize);}}},getAdapter:function(){return this.adapter;},setAdapter:function(adapter){this.adapter=adapter;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(minSize){this.minSize=minSize;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(maxSize){this.maxSize=maxSize;},setCurrentSize:function(size){var oldAnimate=this.animate;this.animate=false;this.adapter.setElementSize(this,size);this.animate=oldAnimate;},destroy:function(removeEl){if(this.shim){this.shim.remove();}
this.dd.unreg();Ext.removeNode(this.proxy);if(removeEl){this.el.remove();}}});Ext.SplitBar.createProxy=function(dir){var proxy=new Ext.Element(document.createElement("div"));proxy.unselectable();var cls='x-splitbar-proxy';proxy.addClass(cls+' '+(dir==Ext.SplitBar.HORIZONTAL?cls+'-h':cls+'-v'));document.body.appendChild(proxy.dom);return proxy.dom;};Ext.SplitBar.BasicLayoutAdapter=function(){};Ext.SplitBar.BasicLayoutAdapter.prototype={init:function(s){},getElementSize:function(s){if(s.orientation==Ext.SplitBar.HORIZONTAL){return s.resizingEl.getWidth();}else{return s.resizingEl.getHeight();}},setElementSize:function(s,newSize,onComplete){if(s.orientation==Ext.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(newSize);if(onComplete){onComplete(s,newSize);}}else{s.resizingEl.setWidth(newSize,true,.1,onComplete,'easeOut');}}else{if(!s.animate){s.resizingEl.setHeight(newSize);if(onComplete){onComplete(s,newSize);}}else{s.resizingEl.setHeight(newSize,true,.1,onComplete,'easeOut');}}}};Ext.SplitBar.AbsoluteLayoutAdapter=function(container){this.basic=new Ext.SplitBar.BasicLayoutAdapter();this.container=Ext.get(container);};Ext.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,newSize,onComplete){this.basic.setElementSize(s,newSize,this.moveSplitter.createDelegate(this,[s]));},moveSplitter:function(s){var yes=Ext.SplitBar;switch(s.placement){case yes.LEFT:s.el.setX(s.resizingEl.getRight());break;case yes.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case yes.TOP:s.el.setY(s.resizingEl.getBottom());break;case yes.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break;}}};Ext.SplitBar.VERTICAL=1;Ext.SplitBar.HORIZONTAL=2;Ext.SplitBar.LEFT=1;Ext.SplitBar.RIGHT=2;Ext.SplitBar.TOP=3;Ext.SplitBar.BOTTOM=4;Ext.Container=Ext.extend(Ext.BoxComponent,{autoDestroy:true,defaultType:'panel',initComponent:function(){Ext.Container.superclass.initComponent.call(this);this.addEvents('afterlayout','beforeadd','beforeremove','add','remove');var items=this.items;if(items){delete this.items;if(Ext.isArray(items)){this.add.apply(this,items);}else{this.add(items);}}},initItems:function(){if(!this.items){this.items=new Ext.util.MixedCollection(false,this.getComponentId);this.getLayout();}},setLayout:function(layout){if(this.layout&&this.layout!=layout){this.layout.setContainer(null);}
this.initItems();this.layout=layout;layout.setContainer(this);},render:function(){Ext.Container.superclass.render.apply(this,arguments);if(this.layout){if(typeof this.layout=='string'){this.layout=new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);}
this.setLayout(this.layout);if(this.activeItem!==undefined){var item=this.activeItem;delete this.activeItem;this.layout.setActiveItem(item);return;}}
if(!this.ownerCt){this.doLayout();}
if(this.monitorResize===true){Ext.EventManager.onWindowResize(this.doLayout,this,[false]);}},getLayoutTarget:function(){return this.el;},getComponentId:function(comp){return comp.itemId||comp.id;},add:function(comp){if(!this.items){this.initItems();}
var a=arguments,len=a.length;if(len>1){for(var i=0;i<len;i++){this.add(a[i]);}
return;}
var c=this.lookupComponent(this.applyDefaults(comp));var pos=this.items.length;if(this.fireEvent('beforeadd',this,c,pos)!==false&&this.onBeforeAdd(c)!==false){this.items.add(c);c.ownerCt=this;this.fireEvent('add',this,c,pos);}
return c;},insert:function(index,comp){if(!this.items){this.initItems();}
var a=arguments,len=a.length;if(len>2){for(var i=len-1;i>=1;--i){this.insert(index,a[i]);}
return;}
var c=this.lookupComponent(this.applyDefaults(comp));if(c.ownerCt==this&&this.items.indexOf(c)<index){--index;}
if(this.fireEvent('beforeadd',this,c,index)!==false&&this.onBeforeAdd(c)!==false){this.items.insert(index,c);c.ownerCt=this;this.fireEvent('add',this,c,index);}
return c;},applyDefaults:function(c){if(this.defaults){if(typeof c=='string'){c=Ext.ComponentMgr.get(c);Ext.apply(c,this.defaults);}else if(!c.events){Ext.applyIf(c,this.defaults);}else{Ext.apply(c,this.defaults);}}
return c;},onBeforeAdd:function(item){if(item.ownerCt){item.ownerCt.remove(item,false);}
if(this.hideBorders===true){item.border=(item.border===true);}},remove:function(comp,autoDestroy){var c=this.getComponent(comp);if(c&&this.fireEvent('beforeremove',this,c)!==false){this.items.remove(c);delete c.ownerCt;if(autoDestroy===true||(autoDestroy!==false&&this.autoDestroy)){c.destroy();}
if(this.layout&&this.layout.activeItem==c){delete this.layout.activeItem;}
this.fireEvent('remove',this,c);}
return c;},getComponent:function(comp){if(typeof comp=='object'){return comp;}
return this.items.get(comp);},lookupComponent:function(comp){if(typeof comp=='string'){return Ext.ComponentMgr.get(comp);}else if(!comp.events){return this.createComponent(comp);}
return comp;},createComponent:function(config){return Ext.ComponentMgr.create(config,this.defaultType);},doLayout:function(shallow){if(this.rendered&&this.layout){this.layout.layout();}
if(shallow!==false&&this.items){var cs=this.items.items;for(var i=0,len=cs.length;i<len;i++){var c=cs[i];if(c.doLayout){c.doLayout();}}}},getLayout:function(){if(!this.layout){var layout=new Ext.layout.ContainerLayout(this.layoutConfig);this.setLayout(layout);}
return this.layout;},beforeDestroy:function(){if(this.items){Ext.destroy.apply(Ext,this.items.items);}
if(this.monitorResize){Ext.EventManager.removeResizeListener(this.doLayout,this);}
if(this.layout&&this.layout.destroy){this.layout.destroy();}
Ext.Container.superclass.beforeDestroy.call(this);},bubble:function(fn,scope,args){var p=this;while(p){if(fn.apply(scope||p,args||[p])===false){break;}
p=p.ownerCt;}},cascade:function(fn,scope,args){if(fn.apply(scope||this,args||[this])!==false){if(this.items){var cs=this.items.items;for(var i=0,len=cs.length;i<len;i++){if(cs[i].cascade){cs[i].cascade(fn,scope,args);}else{fn.apply(scope||cs[i],args||[cs[i]]);}}}}},findById:function(id){var m,ct=this;this.cascade(function(c){if(ct!=c&&c.id===id){m=c;return false;}});return m||null;},findByType:function(xtype){return typeof xtype=='function'?this.findBy(function(c){return c.constructor===xtype;}):this.findBy(function(c){return c.constructor.xtype===xtype;});},find:function(prop,value){return this.findBy(function(c){return c[prop]===value;});},findBy:function(fn,scope){var m=[],ct=this;this.cascade(function(c){if(ct!=c&&fn.call(scope||c,c,ct)===true){m.push(c);}});return m;}});Ext.Container.LAYOUTS={};Ext.reg('container',Ext.Container);Ext.layout.ContainerLayout=function(config){Ext.apply(this,config);};Ext.layout.ContainerLayout.prototype={monitorResize:false,activeItem:null,layout:function(){var target=this.container.getLayoutTarget();this.onLayout(this.container,target);this.container.fireEvent('afterlayout',this.container,this);},onLayout:function(ct,target){this.renderAll(ct,target);},isValidParent:function(c,target){var el=c.getPositionEl?c.getPositionEl():c.getEl();return el.dom.parentNode==target.dom;},renderAll:function(ct,target){var items=ct.items.items;for(var i=0,len=items.length;i<len;i++){var c=items[i];if(c&&(!c.rendered||!this.isValidParent(c,target))){this.renderItem(c,i,target);}}},renderItem:function(c,position,target){if(c&&!c.rendered){c.render(target,position);if(this.extraCls){var t=c.getPositionEl?c.getPositionEl():c;t.addClass(this.extraCls);}
if(this.renderHidden&&c!=this.activeItem){c.hide();}}else if(c&&!this.isValidParent(c,target)){if(this.extraCls){c.addClass(this.extraCls);}
if(typeof position=='number'){position=target.dom.childNodes[position];}
target.dom.insertBefore(c.getEl().dom,position||null);if(this.renderHidden&&c!=this.activeItem){c.hide();}}},onResize:function(){if(this.container.collapsed){return;}
var b=this.container.bufferResize;if(b){if(!this.resizeTask){this.resizeTask=new Ext.util.DelayedTask(this.layout,this);this.resizeBuffer=typeof b=='number'?b:100;}
this.resizeTask.delay(this.resizeBuffer);}else{this.layout();}},setContainer:function(ct){if(this.monitorResize&&ct!=this.container){if(this.container){this.container.un('resize',this.onResize,this);}
if(ct){ct.on('resize',this.onResize,this);}}
this.container=ct;},parseMargins:function(v){var ms=v.split(' ');var len=ms.length;if(len==1){ms[1]=ms[0];ms[2]=ms[0];ms[3]=ms[0];}
if(len==2){ms[2]=ms[0];ms[3]=ms[1];}
return{top:parseInt(ms[0],10)||0,right:parseInt(ms[1],10)||0,bottom:parseInt(ms[2],10)||0,left:parseInt(ms[3],10)||0};},destroy:Ext.emptyFn};Ext.Container.LAYOUTS['auto']=Ext.layout.ContainerLayout;Ext.layout.FitLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,onLayout:function(ct,target){Ext.layout.FitLayout.superclass.onLayout.call(this,ct,target);if(!this.container.collapsed){this.setItemSize(this.activeItem||ct.items.itemAt(0),target.getStyleSize());}},setItemSize:function(item,size){if(item&&size.height>0){item.setSize(size);}}});Ext.Container.LAYOUTS['fit']=Ext.layout.FitLayout;Ext.layout.CardLayout=Ext.extend(Ext.layout.FitLayout,{deferredRender:false,renderHidden:true,setActiveItem:function(item){item=this.container.getComponent(item);if(this.activeItem!=item){if(this.activeItem){this.activeItem.hide();}
this.activeItem=item;item.show();this.layout();}},renderAll:function(ct,target){if(this.deferredRender){this.renderItem(this.activeItem,undefined,target);}else{Ext.layout.CardLayout.superclass.renderAll.call(this,ct,target);}}});Ext.Container.LAYOUTS['card']=Ext.layout.CardLayout;Ext.layout.AnchorLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,getAnchorViewSize:function(ct,target){return target.dom==document.body?target.getViewSize():target.getStyleSize();},onLayout:function(ct,target){Ext.layout.AnchorLayout.superclass.onLayout.call(this,ct,target);var size=this.getAnchorViewSize(ct,target);var w=size.width,h=size.height;if(w<20||h<20){return;}
var aw,ah;if(ct.anchorSize){if(typeof ct.anchorSize=='number'){aw=ct.anchorSize;}else{aw=ct.anchorSize.width;ah=ct.anchorSize.height;}}else{aw=ct.initialConfig.width;ah=ct.initialConfig.height;}
var cs=ct.items.items,len=cs.length,i,c,a,cw,ch;for(i=0;i<len;i++){c=cs[i];if(c.anchor){a=c.anchorSpec;if(!a){var vs=c.anchor.split(' ');c.anchorSpec=a={right:this.parseAnchor(vs[0],c.initialConfig.width,aw),bottom:this.parseAnchor(vs[1],c.initialConfig.height,ah)};}
cw=a.right?this.adjustWidthAnchor(a.right(w),c):undefined;ch=a.bottom?this.adjustHeightAnchor(a.bottom(h),c):undefined;if(cw||ch){c.setSize(cw||undefined,ch||undefined);}}}},parseAnchor:function(a,start,cstart){if(a&&a!='none'){var last;if(/^(r|right|b|bottom)$/i.test(a)){var diff=cstart-start;return function(v){if(v!==last){last=v;return v-diff;}}}else if(a.indexOf('%')!=-1){var ratio=parseFloat(a.replace('%',''))*.01;return function(v){if(v!==last){last=v;return Math.floor(v*ratio);}}}else{a=parseInt(a,10);if(!isNaN(a)){return function(v){if(v!==last){last=v;return v+a;}}}}}
return false;},adjustWidthAnchor:function(value,comp){return value;},adjustHeightAnchor:function(value,comp){return value;}});Ext.Container.LAYOUTS['anchor']=Ext.layout.AnchorLayout;Ext.layout.ColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:'x-column',scrollOffset:0,isValidParent:function(c,target){return c.getEl().dom.parentNode==this.innerCt.dom;},onLayout:function(ct,target){var cs=ct.items.items,len=cs.length,c,i;if(!this.innerCt){target.addClass('x-column-layout-ct');this.innerCt=target.createChild({cls:'x-column-inner'});this.innerCt.createChild({cls:'x-clear'});}
this.renderAll(ct,this.innerCt);var size=Ext.isIE&&target.dom!=Ext.getBody().dom?target.getStyleSize():target.getViewSize();if(size.width<1&&size.height<1){return;}
var w=size.width-target.getPadding('lr')-this.scrollOffset,h=size.height-target.getPadding('tb'),pw=w;this.innerCt.setWidth(w);for(i=0;i<len;i++){c=cs[i];if(!c.columnWidth){pw-=(c.getSize().width+c.getEl().getMargins('lr'));}}
pw=pw<0?0:pw;for(i=0;i<len;i++){c=cs[i];if(c.columnWidth){c.setSize(Math.floor(c.columnWidth*pw)-c.getEl().getMargins('lr'));}}}});Ext.Container.LAYOUTS['column']=Ext.layout.ColumnLayout;Ext.layout.BorderLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,rendered:false,onLayout:function(ct,target){var collapsed;if(!this.rendered){target.position();target.addClass('x-border-layout-ct');var items=ct.items.items;collapsed=[];for(var i=0,len=items.length;i<len;i++){var c=items[i];var pos=c.region;if(c.collapsed){collapsed.push(c);}
c.collapsed=false;if(!c.rendered){c.cls=c.cls?c.cls+' x-border-panel':'x-border-panel';c.render(target,i);}
this[pos]=pos!='center'&&c.split?new Ext.layout.BorderLayout.SplitRegion(this,c.initialConfig,pos):new Ext.layout.BorderLayout.Region(this,c.initialConfig,pos);this[pos].render(target,c);}
this.rendered=true;}
var size=target.getViewSize();if(size.width<20||size.height<20){if(collapsed){this.restoreCollapsed=collapsed;}
return;}else if(this.restoreCollapsed){collapsed=this.restoreCollapsed;delete this.restoreCollapsed;}
var w=size.width,h=size.height;var centerW=w,centerH=h,centerY=0,centerX=0;var n=this.north,s=this.south,west=this.west,e=this.east,c=this.center;if(!c){throw'No center region defined in BorderLayout '+ct.id;}
if(n&&n.isVisible()){var b=n.getSize();var m=n.getMargins();b.width=w-(m.left+m.right);b.x=m.left;b.y=m.top;centerY=b.height+b.y+m.bottom;centerH-=centerY;n.applyLayout(b);}
if(s&&s.isVisible()){var b=s.getSize();var m=s.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var totalHeight=(b.height+m.top+m.bottom);b.y=h-totalHeight+m.top;centerH-=totalHeight;s.applyLayout(b);}
if(west&&west.isVisible()){var b=west.getSize();var m=west.getMargins();b.height=centerH-(m.top+m.bottom);b.x=m.left;b.y=centerY+m.top;var totalWidth=(b.width+m.left+m.right);centerX+=totalWidth;centerW-=totalWidth;west.applyLayout(b);}
if(e&&e.isVisible()){var b=e.getSize();var m=e.getMargins();b.height=centerH-(m.top+m.bottom);var totalWidth=(b.width+m.left+m.right);b.x=w-totalWidth+m.left;b.y=centerY+m.top;centerW-=totalWidth;e.applyLayout(b);}
var m=c.getMargins();var centerBox={x:centerX+m.left,y:centerY+m.top,width:centerW-(m.left+m.right),height:centerH-(m.top+m.bottom)};c.applyLayout(centerBox);if(collapsed){for(var i=0,len=collapsed.length;i<len;i++){collapsed[i].collapse(false);}}
if(Ext.isIE&&Ext.isStrict){target.repaint();}},destroy:function(){var r=['north','south','east','west'];for(var i=0;i<r.length;i++){var region=this[r[i]];if(region&&region.split){region.split.destroy(true);}}
Ext.layout.BorderLayout.superclass.destroy.call(this);}});Ext.layout.BorderLayout.Region=function(layout,config,pos){Ext.apply(this,config);this.layout=layout;this.position=pos;this.state={};if(typeof this.margins=='string'){this.margins=this.layout.parseMargins(this.margins);}
this.margins=Ext.applyIf(this.margins||{},this.defaultMargins);if(this.collapsible){if(typeof this.cmargins=='string'){this.cmargins=this.layout.parseMargins(this.cmargins);}
if(this.collapseMode=='mini'&&!this.cmargins){this.cmargins={left:0,top:0,right:0,bottom:0};}else{this.cmargins=Ext.applyIf(this.cmargins||{},pos=='north'||pos=='south'?this.defaultNSCMargins:this.defaultEWCMargins);}}};Ext.layout.BorderLayout.Region.prototype={collapsible:false,split:false,floatable:true,minWidth:50,minHeight:50,defaultMargins:{left:0,top:0,right:0,bottom:0},defaultNSCMargins:{left:5,top:5,right:5,bottom:5},defaultEWCMargins:{left:5,top:0,right:5,bottom:0},isCollapsed:false,render:function(ct,p){this.panel=p;p.el.enableDisplayMode();this.targetEl=ct;this.el=p.el;var gs=p.getState,ps=this.position;p.getState=function(){return Ext.apply(gs.call(p)||{},this.state);}.createDelegate(this);if(ps!='center'){p.allowQueuedExpand=false;p.on({beforecollapse:this.beforeCollapse,collapse:this.onCollapse,beforeexpand:this.beforeExpand,expand:this.onExpand,hide:this.onHide,show:this.onShow,scope:this});if(this.collapsible){p.collapseEl='el';p.slideAnchor=this.getSlideAnchor();}
if(p.tools&&p.tools.toggle){p.tools.toggle.addClass('x-tool-collapse-'+ps);p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');}}},getCollapsedEl:function(){if(!this.collapsedEl){if(!this.toolTemplate){var tt=new Ext.Template('<div class="x-tool x-tool-{id}">&#160;</div>');tt.disableFormats=true;tt.compile();Ext.layout.BorderLayout.Region.prototype.toolTemplate=tt;}
this.collapsedEl=this.targetEl.createChild({cls:"x-layout-collapsed x-layout-collapsed-"+this.position,id:this.panel.id+'-xcollapsed'});this.collapsedEl.enableDisplayMode('block');if(this.collapseMode=='mini'){this.collapsedEl.addClass('x-layout-cmini-'+this.position);this.miniCollapsedEl=this.collapsedEl.createChild({cls:"x-layout-mini x-layout-mini-"+this.position,html:"&#160;"});this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on('click',this.onExpandClick,this,{stopEvent:true});}else{var t=this.toolTemplate.append(this.collapsedEl.dom,{id:'expand-'+this.position},true);t.addClassOnOver('x-tool-expand-'+this.position+'-over');t.on('click',this.onExpandClick,this,{stopEvent:true});if(this.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this);}}}
return this.collapsedEl;},onExpandClick:function(e){if(this.isSlid){this.afterSlideIn();this.panel.expand(false);}else{this.panel.expand();}},onCollapseClick:function(e){this.panel.collapse();},beforeCollapse:function(p,animate){this.lastAnim=animate;if(this.splitEl){this.splitEl.hide();}
this.getCollapsedEl().show();this.panel.el.setStyle('z-index',100);this.isCollapsed=true;this.layout.layout();},onCollapse:function(animate){this.panel.el.setStyle('z-index',1);if(this.lastAnim===false||this.panel.animCollapse===false){this.getCollapsedEl().dom.style.visibility='visible';}else{this.getCollapsedEl().slideIn(this.panel.slideAnchor,{duration:.2});}
this.state.collapsed=true;this.panel.saveState();},beforeExpand:function(animate){var c=this.getCollapsedEl();this.el.show();if(this.position=='east'||this.position=='west'){this.panel.setSize(undefined,c.getHeight());}else{this.panel.setSize(c.getWidth(),undefined);}
c.hide();c.dom.style.visibility='hidden';this.panel.el.setStyle('z-index',100);},onExpand:function(){this.isCollapsed=false;if(this.splitEl){this.splitEl.show();}
this.layout.layout();this.panel.el.setStyle('z-index',1);this.state.collapsed=false;this.panel.saveState();},collapseClick:function(e){if(this.isSlid){e.stopPropagation();this.slideIn();}else{e.stopPropagation();this.slideOut();}},onHide:function(){if(this.isCollapsed){this.getCollapsedEl().hide();}else if(this.splitEl){this.splitEl.hide();}},onShow:function(){if(this.isCollapsed){this.getCollapsedEl().show();}else if(this.splitEl){this.splitEl.show();}},isVisible:function(){return!this.panel.hidden;},getMargins:function(){return this.isCollapsed&&this.cmargins?this.cmargins:this.margins;},getSize:function(){return this.isCollapsed?this.getCollapsedEl().getSize():this.panel.getSize();},setPanel:function(panel){this.panel=panel;},getMinWidth:function(){return this.minWidth;},getMinHeight:function(){return this.minHeight;},applyLayoutCollapsed:function(box){var ce=this.getCollapsedEl();ce.setLeftTop(box.x,box.y);ce.setSize(box.width,box.height);},applyLayout:function(box){if(this.isCollapsed){this.applyLayoutCollapsed(box);}else{this.panel.setPosition(box.x,box.y);this.panel.setSize(box.width,box.height);}},beforeSlide:function(){this.panel.beforeEffect();},afterSlide:function(){this.panel.afterEffect();},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var st=new Ext.util.DelayedTask(this.slideIn,this);this.autoHideHd={"mouseout":function(e){if(!e.within(this.el,true)){st.delay(500);}},"mouseover":function(e){st.cancel();},scope:this};}
this.el.on(this.autoHideHd);}},clearAutoHide:function(){if(this.autoHide!==false){this.el.un("mouseout",this.autoHideHd.mouseout);this.el.un("mouseover",this.autoHideHd.mouseover);}},clearMonitor:function(){Ext.getDoc().un("click",this.slideInIf,this);},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return;}
this.isSlid=true;var ts=this.panel.tools;if(ts&&ts.toggle){ts.toggle.hide();}
this.el.show();if(this.position=='east'||this.position=='west'){this.panel.setSize(undefined,this.collapsedEl.getHeight());}else{this.panel.setSize(this.collapsedEl.getWidth(),undefined);}
this.restoreLT=[this.el.dom.style.left,this.el.dom.style.top];this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.el.setStyle("z-index",102);if(this.animFloat!==false){this.beforeSlide();this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this);},scope:this,block:true});}else{this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this);}},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");this.el.dom.style.left=this.restoreLT[0];this.el.dom.style.top=this.restoreLT[1];var ts=this.panel.tools;if(ts&&ts.toggle){ts.toggle.show();}},slideIn:function(cb){if(!this.isSlid||this.el.hasActiveFx()){Ext.callback(cb);return;}
this.isSlid=false;if(this.animFloat!==false){this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.hide();this.afterSlide();this.afterSlideIn();Ext.callback(cb);},scope:this,block:true});}else{this.el.hide();this.afterSlideIn();}},slideInIf:function(e){if(!e.within(this.el)){this.slideIn();}},anchors:{"west":"left","east":"right","north":"top","south":"bottom"},sanchors:{"west":"l","east":"r","north":"t","south":"b"},canchors:{"west":"tl-tr","east":"tr-tl","north":"tl-bl","south":"bl-tl"},getAnchor:function(){return this.anchors[this.position];},getCollapseAnchor:function(){return this.canchors[this.position];},getSlideAnchor:function(){return this.sanchors[this.position];},getAlignAdj:function(){var cm=this.cmargins;switch(this.position){case"west":return[0,0];break;case"east":return[0,0];break;case"north":return[0,0];break;case"south":return[0,0];break;}},getExpandAdj:function(){var c=this.collapsedEl,cm=this.cmargins;switch(this.position){case"west":return[-(cm.right+c.getWidth()+cm.left),0];break;case"east":return[cm.right+c.getWidth()+cm.left,0];break;case"north":return[0,-(cm.top+cm.bottom+c.getHeight())];break;case"south":return[0,cm.top+cm.bottom+c.getHeight()];break;}}};Ext.layout.BorderLayout.SplitRegion=function(layout,config,pos){Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this,layout,config,pos);this.applyLayout=this.applyFns[pos];};Ext.extend(Ext.layout.BorderLayout.SplitRegion,Ext.layout.BorderLayout.Region,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,splitSettings:{north:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.TOP,maxFn:'getVMaxSize',minProp:'minHeight',maxProp:'maxHeight'},south:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.BOTTOM,maxFn:'getVMaxSize',minProp:'minHeight',maxProp:'maxHeight'},east:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.RIGHT,maxFn:'getHMaxSize',minProp:'minWidth',maxProp:'maxWidth'},west:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.LEFT,maxFn:'getHMaxSize',minProp:'minWidth',maxProp:'maxWidth'}},applyFns:{west:function(box){if(this.isCollapsed){return this.applyLayoutCollapsed(box);}
var sd=this.splitEl.dom,s=sd.style;this.panel.setPosition(box.x,box.y);var sw=sd.offsetWidth;s.left=(box.x+box.width-sw)+'px';s.top=(box.y)+'px';s.height=Math.max(0,box.height)+'px';this.panel.setSize(box.width-sw,box.height);},east:function(box){if(this.isCollapsed){return this.applyLayoutCollapsed(box);}
var sd=this.splitEl.dom,s=sd.style;var sw=sd.offsetWidth;this.panel.setPosition(box.x+sw,box.y);s.left=(box.x)+'px';s.top=(box.y)+'px';s.height=Math.max(0,box.height)+'px';this.panel.setSize(box.width-sw,box.height);},north:function(box){if(this.isCollapsed){return this.applyLayoutCollapsed(box);}
var sd=this.splitEl.dom,s=sd.style;var sh=sd.offsetHeight;this.panel.setPosition(box.x,box.y);s.left=(box.x)+'px';s.top=(box.y+box.height-sh)+'px';s.width=Math.max(0,box.width)+'px';this.panel.setSize(box.width,box.height-sh);},south:function(box){if(this.isCollapsed){return this.applyLayoutCollapsed(box);}
var sd=this.splitEl.dom,s=sd.style;var sh=sd.offsetHeight;this.panel.setPosition(box.x,box.y+sh);s.left=(box.x)+'px';s.top=(box.y)+'px';s.width=Math.max(0,box.width)+'px';this.panel.setSize(box.width,box.height-sh);}},render:function(ct,p){Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this,ct,p);var ps=this.position;this.splitEl=ct.createChild({cls:"x-layout-split x-layout-split-"+ps,html:"&#160;",id:this.panel.id+'-xsplit'});if(this.collapseMode=='mini'){this.miniSplitEl=this.splitEl.createChild({cls:"x-layout-mini x-layout-mini-"+ps,html:"&#160;"});this.miniSplitEl.addClassOnOver('x-layout-mini-over');this.miniSplitEl.on('click',this.onCollapseClick,this,{stopEvent:true});}
var s=this.splitSettings[ps];this.split=new Ext.SplitBar(this.splitEl.dom,p.el,s.orientation);this.split.placement=s.placement;this.split.getMaximumSize=this[s.maxFn].createDelegate(this);this.split.minSize=this.minSize||this[s.minProp];this.split.on("beforeapply",this.onSplitMove,this);this.split.useShim=this.useShim===true;this.maxSize=this.maxSize||this[s.maxProp];if(p.hidden){this.splitEl.hide();}
if(this.useSplitTips){this.splitEl.dom.title=this.collapsible?this.collapsibleSplitTip:this.splitTip;}
if(this.collapsible){this.splitEl.on("dblclick",this.onCollapseClick,this);}},getSize:function(){if(this.isCollapsed){return this.collapsedEl.getSize();}
var s=this.panel.getSize();if(this.position=='north'||this.position=='south'){s.height+=this.splitEl.dom.offsetHeight;}else{s.width+=this.splitEl.dom.offsetWidth;}
return s;},getHMaxSize:function(){var cmax=this.maxSize||10000;var center=this.layout.center;return Math.min(cmax,(this.el.getWidth()+center.el.getWidth())-center.getMinWidth());},getVMaxSize:function(){var cmax=this.maxSize||10000;var center=this.layout.center;return Math.min(cmax,(this.el.getHeight()+center.el.getHeight())-center.getMinHeight());},onSplitMove:function(split,newSize){var s=this.panel.getSize();this.lastSplitSize=newSize;if(this.position=='north'||this.position=='south'){this.panel.setSize(s.width,newSize);this.state.height=newSize;}else{this.panel.setSize(newSize,s.height);this.state.width=newSize;}
this.layout.layout();this.panel.saveState();return false;},getSplitBar:function(){return this.split;}});Ext.Container.LAYOUTS['border']=Ext.layout.BorderLayout;Ext.layout.FormLayout=Ext.extend(Ext.layout.AnchorLayout,{labelSeparator:':',getAnchorViewSize:function(ct,target){return ct.body.getStyleSize();},setContainer:function(ct){Ext.layout.FormLayout.superclass.setContainer.call(this,ct);if(ct.labelAlign){ct.addClass('x-form-label-'+ct.labelAlign);}
if(ct.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";this.labelAdjust=0;}else{this.labelSeparator=ct.labelSeparator||this.labelSeparator;ct.labelWidth=ct.labelWidth||100;if(typeof ct.labelWidth=='number'){var pad=(typeof ct.labelPad=='number'?ct.labelPad:5);this.labelAdjust=ct.labelWidth+pad;this.labelStyle="width:"+ct.labelWidth+"px;";this.elementStyle="padding-left:"+(ct.labelWidth+pad)+'px';}
if(ct.labelAlign=='top'){this.labelStyle="width:auto;";this.labelAdjust=0;this.elementStyle="padding-left:0;";}}
if(!this.fieldTpl){var t=new Ext.Template('<div class="x-form-item {5}" tabIndex="-1">','<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div><div class="{6}"></div>','</div>');t.disableFormats=true;t.compile();Ext.layout.FormLayout.prototype.fieldTpl=t;}},renderItem:function(c,position,target){if(c&&!c.rendered&&c.isFormField&&c.inputType!='hidden'){var args=[c.id,c.fieldLabel,c.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof c.labelSeparator=='undefined'?this.labelSeparator:c.labelSeparator,(c.itemCls||this.container.itemCls||'')+(c.hideLabel?' x-hide-label':''),c.clearCls||'x-form-clear-left'];if(typeof position=='number'){position=target.dom.childNodes[position]||null;}
if(position){this.fieldTpl.insertBefore(position,args);}else{this.fieldTpl.append(target,args);}
c.render('x-form-el-'+c.id);}else{Ext.layout.FormLayout.superclass.renderItem.apply(this,arguments);}},adjustWidthAnchor:function(value,comp){return value-(comp.isFormField?(comp.hideLabel?0:this.labelAdjust):0);},isValidParent:function(c,target){return true;}});Ext.Container.LAYOUTS['form']=Ext.layout.FormLayout;Ext.layout.Accordion=Ext.extend(Ext.layout.FitLayout,{fill:true,autoWidth:true,titleCollapse:true,hideCollapseTool:false,collapseFirst:false,animate:false,sequence:false,activeOnTop:false,renderItem:function(c){if(this.animate===false){c.animCollapse=false;}
c.collapsible=true;if(this.autoWidth){c.autoWidth=true;}
if(this.titleCollapse){c.titleCollapse=true;}
if(this.hideCollapseTool){c.hideCollapseTool=true;}
if(this.collapseFirst!==undefined){c.collapseFirst=this.collapseFirst;}
if(!this.activeItem&&!c.collapsed){this.activeItem=c;}else if(this.activeItem){c.collapsed=true;}
Ext.layout.Accordion.superclass.renderItem.apply(this,arguments);c.header.addClass('x-accordion-hd');c.on('beforeexpand',this.beforeExpand,this);},beforeExpand:function(p,anim){var ai=this.activeItem;if(ai){if(this.sequence){delete this.activeItem;if(!ai.collapsed){ai.collapse({callback:function(){p.expand(anim||true);},scope:this});return false;}}else{ai.collapse(this.animate);}}
this.activeItem=p;if(this.activeOnTop){p.el.dom.parentNode.insertBefore(p.el.dom,p.el.dom.parentNode.firstChild);}
this.layout();},setItemSize:function(item,size){if(this.fill&&item){var items=this.container.items.items;var hh=0;for(var i=0,len=items.length;i<len;i++){var p=items[i];if(p!=item){hh+=(p.getSize().height-p.bwrap.getHeight());}}
size.height-=hh;item.setSize(size);}}});Ext.Container.LAYOUTS['accordion']=Ext.layout.Accordion;Ext.layout.TableLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:false,setContainer:function(ct){Ext.layout.TableLayout.superclass.setContainer.call(this,ct);this.currentRow=0;this.currentColumn=0;this.cells=[];},onLayout:function(ct,target){var cs=ct.items.items,len=cs.length,c,i;if(!this.table){target.addClass('x-table-layout-ct');this.table=target.createChild({tag:'table',cls:'x-table-layout',cellspacing:0,cn:{tag:'tbody'}},null,true);this.renderAll(ct,target);}},getRow:function(index){var row=this.table.tBodies[0].childNodes[index];if(!row){row=document.createElement('tr');this.table.tBodies[0].appendChild(row);}
return row;},getNextCell:function(c){var cell=this.getNextNonSpan(this.currentColumn,this.currentRow);var curCol=this.currentColumn=cell[0],curRow=this.currentRow=cell[1];for(var rowIndex=curRow;rowIndex<curRow+(c.rowspan||1);rowIndex++){if(!this.cells[rowIndex]){this.cells[rowIndex]=[];}
for(var colIndex=curCol;colIndex<curCol+(c.colspan||1);colIndex++){this.cells[rowIndex][colIndex]=true;}}
var td=document.createElement('td');if(c.cellId){td.id=c.cellId;}
var cls='x-table-layout-cell';if(c.cellCls){cls+=' '+c.cellCls;}
td.className=cls;if(c.colspan){td.colSpan=c.colspan;}
if(c.rowspan){td.rowSpan=c.rowspan;}
this.getRow(curRow).appendChild(td);return td;},getNextNonSpan:function(colIndex,rowIndex){var cols=this.columns;while((cols&&colIndex>=cols)||(this.cells[rowIndex]&&this.cells[rowIndex][colIndex])){if(cols&&colIndex>=cols){rowIndex++;colIndex=0;}else{colIndex++;}}
return[colIndex,rowIndex];},renderItem:function(c,position,target){if(c&&!c.rendered){c.render(this.getNextCell(c));}},isValidParent:function(c,target){return true;}});Ext.Container.LAYOUTS['table']=Ext.layout.TableLayout;Ext.layout.AbsoluteLayout=Ext.extend(Ext.layout.AnchorLayout,{extraCls:'x-abs-layout-item',isForm:false,setContainer:function(ct){Ext.layout.AbsoluteLayout.superclass.setContainer.call(this,ct);if(ct.isXType('form')){this.isForm=true;}},onLayout:function(ct,target){if(this.isForm){ct.body.position();}else{target.position();}
Ext.layout.AbsoluteLayout.superclass.onLayout.call(this,ct,target);},getAnchorViewSize:function(ct,target){return this.isForm?ct.body.getStyleSize():Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this,ct,target);},isValidParent:function(c,target){return this.isForm?true:Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this,c,target);},adjustWidthAnchor:function(value,comp){return value?value-comp.getPosition(true)[0]:value;},adjustHeightAnchor:function(value,comp){return value?value-comp.getPosition(true)[1]:value;}});Ext.Container.LAYOUTS['absolute']=Ext.layout.AbsoluteLayout;Ext.Viewport=Ext.extend(Ext.Container,{initComponent:function(){Ext.Viewport.superclass.initComponent.call(this);document.getElementsByTagName('html')[0].className+=' x-viewport';this.el=Ext.getBody();this.el.setHeight=Ext.emptyFn;this.el.setWidth=Ext.emptyFn;this.el.setSize=Ext.emptyFn;this.el.dom.scroll='no';this.allowDomMove=false;this.autoWidth=true;this.autoHeight=true;Ext.EventManager.onWindowResize(this.fireResize,this);this.renderTo=this.el;},fireResize:function(w,h){this.fireEvent('resize',this,w,h,w,h);}});Ext.reg('viewport',Ext.Viewport);Ext.Panel=Ext.extend(Ext.Container,{baseCls:'x-panel',collapsedCls:'x-panel-collapsed',maskDisabled:true,animCollapse:Ext.enableFx,headerAsText:true,buttonAlign:'right',collapsed:false,collapseFirst:true,minButtonWidth:75,elements:'body',toolTarget:'header',collapseEl:'bwrap',slideAnchor:'t',disabledClass:'',deferHeight:true,expandDefaults:{duration:.25},collapseDefaults:{duration:.25},initComponent:function(){Ext.Panel.superclass.initComponent.call(this);this.addEvents('bodyresize','titlechange','collapse','expand','beforecollapse','beforeexpand','beforeclose','close','activate','deactivate');if(this.tbar){this.elements+=',tbar';if(typeof this.tbar=='object'){this.topToolbar=this.tbar;}
delete this.tbar;}
if(this.bbar){this.elements+=',bbar';if(typeof this.bbar=='object'){this.bottomToolbar=this.bbar;}
delete this.bbar;}
if(this.header===true){this.elements+=',header';delete this.header;}else if(this.title&&this.header!==false){this.elements+=',header';}
if(this.footer===true){this.elements+=',footer';delete this.footer;}
if(this.buttons){var btns=this.buttons;this.buttons=[];for(var i=0,len=btns.length;i<len;i++){if(btns[i].render){btns[i].ownerCt=this;this.buttons.push(btns[i]);}else{this.addButton(btns[i]);}}}
if(this.autoLoad){this.on('render',this.doAutoLoad,this,{delay:10});}},createElement:function(name,pnode){if(this[name]){pnode.appendChild(this[name].dom);return;}
if(name==='bwrap'||this.elements.indexOf(name)!=-1){if(this[name+'Cfg']){this[name]=Ext.fly(pnode).createChild(this[name+'Cfg']);}else{var el=document.createElement('div');el.className=this[name+'Cls'];this[name]=Ext.get(pnode.appendChild(el));}}},onRender:function(ct,position){Ext.Panel.superclass.onRender.call(this,ct,position);this.createClasses();if(this.el){this.el.addClass(this.baseCls);this.header=this.el.down('.'+this.headerCls);this.bwrap=this.el.down('.'+this.bwrapCls);var cp=this.bwrap?this.bwrap:this.el;this.tbar=cp.down('.'+this.tbarCls);this.body=cp.down('.'+this.bodyCls);this.bbar=cp.down('.'+this.bbarCls);this.footer=cp.down('.'+this.footerCls);this.fromMarkup=true;}else{this.el=ct.createChild({id:this.id,cls:this.baseCls},position);}
var el=this.el,d=el.dom;if(this.cls){this.el.addClass(this.cls);}
if(this.buttons){this.elements+=',footer';}
if(this.frame){el.insertHtml('afterBegin',String.format(Ext.Element.boxMarkup,this.baseCls));this.createElement('header',d.firstChild.firstChild.firstChild);this.createElement('bwrap',d);var bw=this.bwrap.dom;var ml=d.childNodes[1],bl=d.childNodes[2];bw.appendChild(ml);bw.appendChild(bl);var mc=bw.firstChild.firstChild.firstChild;this.createElement('tbar',mc);this.createElement('body',mc);this.createElement('bbar',mc);this.createElement('footer',bw.lastChild.firstChild.firstChild);if(!this.footer){this.bwrap.dom.lastChild.className+=' x-panel-nofooter';}}else{this.createElement('header',d);this.createElement('bwrap',d);var bw=this.bwrap.dom;this.createElement('tbar',bw);this.createElement('body',bw);this.createElement('bbar',bw);this.createElement('footer',bw);if(!this.header){this.body.addClass(this.bodyCls+'-noheader');if(this.tbar){this.tbar.addClass(this.tbarCls+'-noheader');}}}
if(this.border===false){this.el.addClass(this.baseCls+'-noborder');this.body.addClass(this.bodyCls+'-noborder');if(this.header){this.header.addClass(this.headerCls+'-noborder');}
if(this.footer){this.footer.addClass(this.footerCls+'-noborder');}
if(this.tbar){this.tbar.addClass(this.tbarCls+'-noborder');}
if(this.bbar){this.bbar.addClass(this.bbarCls+'-noborder');}}
if(this.bodyBorder===false){this.body.addClass(this.bodyCls+'-noborder');}
if(this.bodyStyle){this.body.applyStyles(this.bodyStyle);}
this.bwrap.enableDisplayMode('block');if(this.header){this.header.unselectable();if(this.headerAsText){this.header.dom.innerHTML='<span class="'+this.headerTextCls+'">'+this.header.dom.innerHTML+'</span>';if(this.iconCls){this.setIconClass(this.iconCls);}}}
if(this.floating){this.makeFloating(this.floating);}
if(this.collapsible){this.tools=this.tools?this.tools.slice(0):[];if(!this.hideCollapseTool){this.tools[this.collapseFirst?'unshift':'push']({id:'toggle',handler:this.toggleCollapse,scope:this});}
if(this.titleCollapse&&this.header){this.header.on('click',this.toggleCollapse,this);this.header.setStyle('cursor','pointer');}}
if(this.tools){var ts=this.tools;this.tools={};this.addTool.apply(this,ts);}else{this.tools={};}
if(this.buttons&&this.buttons.length>0){var tb=this.footer.createChild({cls:'x-panel-btns-ct',cn:{cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'}},null,true);var tr=tb.getElementsByTagName('tr')[0];for(var i=0,len=this.buttons.length;i<len;i++){var b=this.buttons[i];var td=document.createElement('td');td.className='x-panel-btn-td';b.render(tr.appendChild(td));}}
if(this.tbar&&this.topToolbar){if(Ext.isArray(this.topToolbar)){this.topToolbar=new Ext.Toolbar(this.topToolbar);}
this.topToolbar.render(this.tbar);this.topToolbar.ownerCt=this;}
if(this.bbar&&this.bottomToolbar){if(Ext.isArray(this.bottomToolbar)){this.bottomToolbar=new Ext.Toolbar(this.bottomToolbar);}
this.bottomToolbar.render(this.bbar);this.bottomToolbar.ownerCt=this;}},setIconClass:function(cls){var old=this.iconCls;this.iconCls=cls;if(this.rendered&&this.header){if(this.frame){this.header.addClass('x-panel-icon');this.header.replaceClass(old,this.iconCls);}else{var hd=this.header.dom;var img=hd.firstChild&&String(hd.firstChild.tagName).toLowerCase()=='img'?hd.firstChild:null;if(img){Ext.fly(img).replaceClass(old,this.iconCls);}else{Ext.DomHelper.insertBefore(hd.firstChild,{tag:'img',src:Ext.BLANK_IMAGE_URL,cls:'x-panel-inline-icon '+this.iconCls});}}}},makeFloating:function(cfg){this.floating=true;this.el=new Ext.Layer(typeof cfg=='object'?cfg:{shadow:this.shadow!==undefined?this.shadow:'sides',shadowOffset:this.shadowOffset,constrain:false,shim:this.shim===false?false:undefined},this.el);},getTopToolbar:function(){return this.topToolbar;},getBottomToolbar:function(){return this.bottomToolbar;},addButton:function(config,handler,scope){var bc={handler:handler,scope:scope,minWidth:this.minButtonWidth,hideParent:true};if(typeof config=="string"){bc.text=config;}else{Ext.apply(bc,config);}
var btn=new Ext.Button(bc);btn.ownerCt=this;if(!this.buttons){this.buttons=[];}
this.buttons.push(btn);return btn;},addTool:function(){if(!this[this.toolTarget]){return;}
if(!this.toolTemplate){var tt=new Ext.Template('<div class="x-tool x-tool-{id}">&#160;</div>');tt.disableFormats=true;tt.compile();Ext.Panel.prototype.toolTemplate=tt;}
for(var i=0,a=arguments,len=a.length;i<len;i++){var tc=a[i],overCls='x-tool-'+tc.id+'-over';var t=this.toolTemplate.insertFirst((tc.align!=='left')?this[this.toolTarget]:this[this.toolTarget].child('span'),tc,true);this.tools[tc.id]=t;t.enableDisplayMode('block');t.on('click',this.createToolHandler(t,tc,overCls,this));if(tc.on){t.on(tc.on);}
if(tc.hidden){t.hide();}
if(tc.qtip){if(typeof tc.qtip=='object'){Ext.QuickTips.register(Ext.apply({target:t.id},tc.qtip));}else{t.dom.qtip=tc.qtip;}}
t.addClassOnOver(overCls);}},onShow:function(){if(this.floating){return this.el.show();}
Ext.Panel.superclass.onShow.call(this);},onHide:function(){if(this.floating){return this.el.hide();}
Ext.Panel.superclass.onHide.call(this);},createToolHandler:function(t,tc,overCls,panel){return function(e){t.removeClass(overCls);e.stopEvent();if(tc.handler){tc.handler.call(tc.scope||t,e,t,panel);}};},afterRender:function(){if(this.fromMarkup&&this.height===undefined&&!this.autoHeight){this.height=this.el.getHeight();}
if(this.floating&&!this.hidden&&!this.initHidden){this.el.show();}
if(this.title){this.setTitle(this.title);}
this.setAutoScroll();if(this.html){this.body.update(typeof this.html=='object'?Ext.DomHelper.markup(this.html):this.html);delete this.html;}
if(this.contentEl){var ce=Ext.getDom(this.contentEl);Ext.fly(ce).removeClass(['x-hidden','x-hide-display']);this.body.dom.appendChild(ce);}
if(this.collapsed){this.collapsed=false;this.collapse(false);}
Ext.Panel.superclass.afterRender.call(this);this.initEvents();},setAutoScroll:function(){if(this.rendered&&this.autoScroll){var el=this.body||this.el;if(el){el.setOverflow('auto');}}},getKeyMap:function(){if(!this.keyMap){this.keyMap=new Ext.KeyMap(this.el,this.keys);}
return this.keyMap;},initEvents:function(){if(this.keys){this.getKeyMap();}
if(this.draggable){this.initDraggable();}},initDraggable:function(){this.dd=new Ext.Panel.DD(this,typeof this.draggable=='boolean'?null:this.draggable);},beforeEffect:function(){if(this.floating){this.el.beforeAction();}
this.el.addClass('x-panel-animated');},afterEffect:function(){this.syncShadow();this.el.removeClass('x-panel-animated');},createEffect:function(a,cb,scope){var o={scope:scope,block:true};if(a===true){o.callback=cb;return o;}else if(!a.callback){o.callback=cb;}else{o.callback=function(){cb.call(scope);Ext.callback(a.callback,a.scope);};}
return Ext.applyIf(o,a);},collapse:function(animate){if(this.collapsed||this.el.hasFxBlock()||this.fireEvent('beforecollapse',this,animate)===false){return;}
var doAnim=animate===true||(animate!==false&&this.animCollapse);this.beforeEffect();this.onCollapse(doAnim,animate);return this;},onCollapse:function(doAnim,animArg){if(doAnim){this[this.collapseEl].slideOut(this.slideAnchor,Ext.apply(this.createEffect(animArg||true,this.afterCollapse,this),this.collapseDefaults));}else{this[this.collapseEl].hide();this.afterCollapse();}},afterCollapse:function(){this.collapsed=true;this.el.addClass(this.collapsedCls);this.afterEffect();this.fireEvent('collapse',this);},expand:function(animate){if(!this.collapsed||this.el.hasFxBlock()||this.fireEvent('beforeexpand',this,animate)===false){return;}
var doAnim=animate===true||(animate!==false&&this.animCollapse);this.el.removeClass(this.collapsedCls);this.beforeEffect();this.onExpand(doAnim,animate);return this;},onExpand:function(doAnim,animArg){if(doAnim){this[this.collapseEl].slideIn(this.slideAnchor,Ext.apply(this.createEffect(animArg||true,this.afterExpand,this),this.expandDefaults));}else{this[this.collapseEl].show();this.afterExpand();}},afterExpand:function(){this.collapsed=false;this.afterEffect();this.fireEvent('expand',this);},toggleCollapse:function(animate){this[this.collapsed?'expand':'collapse'](animate);return this;},onDisable:function(){if(this.rendered&&this.maskDisabled){this.el.mask();}
Ext.Panel.superclass.onDisable.call(this);},onEnable:function(){if(this.rendered&&this.maskDisabled){this.el.unmask();}
Ext.Panel.superclass.onEnable.call(this);},onResize:function(w,h){if(w!==undefined||h!==undefined){if(!this.collapsed){if(typeof w=='number'){this.body.setWidth(this.adjustBodyWidth(w-this.getFrameWidth()));}else if(w=='auto'){this.body.setWidth(w);}
if(typeof h=='number'){this.body.setHeight(this.adjustBodyHeight(h-this.getFrameHeight()));}else if(h=='auto'){this.body.setHeight(h);}
if(this.disabled&&this.el._mask){this.el._mask.setSize(this.el.dom.clientWidth,this.el.getHeight());}}else{this.queuedBodySize={width:w,height:h};if(!this.queuedExpand&&this.allowQueuedExpand!==false){this.queuedExpand=true;this.on('expand',function(){delete this.queuedExpand;this.onResize(this.queuedBodySize.width,this.queuedBodySize.height);this.doLayout();},this,{single:true});}}
this.fireEvent('bodyresize',this,w,h);}
this.syncShadow();},adjustBodyHeight:function(h){return h;},adjustBodyWidth:function(w){return w;},onPosition:function(){this.syncShadow();},getFrameWidth:function(){var w=this.el.getFrameWidth('lr');if(this.frame){var l=this.bwrap.dom.firstChild;w+=(Ext.fly(l).getFrameWidth('l')+Ext.fly(l.firstChild).getFrameWidth('r'));var mc=this.bwrap.dom.firstChild.firstChild.firstChild;w+=Ext.fly(mc).getFrameWidth('lr');}
return w;},getFrameHeight:function(){var h=this.el.getFrameWidth('tb');h+=(this.tbar?this.tbar.getHeight():0)+
(this.bbar?this.bbar.getHeight():0);if(this.frame){var hd=this.el.dom.firstChild;var ft=this.bwrap.dom.lastChild;h+=(hd.offsetHeight+ft.offsetHeight);var mc=this.bwrap.dom.firstChild.firstChild.firstChild;h+=Ext.fly(mc).getFrameWidth('tb');}else{h+=(this.header?this.header.getHeight():0)+
(this.footer?this.footer.getHeight():0);}
return h;},getInnerWidth:function(){return this.getSize().width-this.getFrameWidth();},getInnerHeight:function(){return this.getSize().height-this.getFrameHeight();},syncShadow:function(){if(this.floating){this.el.sync(true);}},getLayoutTarget:function(){return this.body;},setTitle:function(title,iconCls){this.title=title;if(this.header&&this.headerAsText){this.header.child('span').update(title);}
if(iconCls){this.setIconClass(iconCls);}
this.fireEvent('titlechange',this,title);return this;},getUpdater:function(){return this.body.getUpdater();},load:function(){var um=this.body.getUpdater();um.update.apply(um,arguments);return this;},beforeDestroy:function(){Ext.Element.uncache(this.header,this.tbar,this.bbar,this.footer,this.body);if(this.tools){for(var k in this.tools){Ext.destroy(this.tools[k]);}}
if(this.buttons){for(var b in this.buttons){Ext.destroy(this.buttons[b]);}}
Ext.destroy(this.topToolbar,this.bottomToolbar);Ext.Panel.superclass.beforeDestroy.call(this);},createClasses:function(){this.headerCls=this.baseCls+'-header';this.headerTextCls=this.baseCls+'-header-text';this.bwrapCls=this.baseCls+'-bwrap';this.tbarCls=this.baseCls+'-tbar';this.bodyCls=this.baseCls+'-body';this.bbarCls=this.baseCls+'-bbar';this.footerCls=this.baseCls+'-footer';},createGhost:function(cls,useShim,appendTo){var el=document.createElement('div');el.className='x-panel-ghost '+(cls?cls:'');if(this.header){el.appendChild(this.el.dom.firstChild.cloneNode(true));}
Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());el.style.width=this.el.dom.offsetWidth+'px';;if(!appendTo){this.container.dom.appendChild(el);}else{Ext.getDom(appendTo).appendChild(el);}
if(useShim!==false&&this.el.useShim!==false){var layer=new Ext.Layer({shadow:false,useDisplay:true,constrain:false},el);layer.show();return layer;}else{return new Ext.Element(el);}},doAutoLoad:function(){this.body.load(typeof this.autoLoad=='object'?this.autoLoad:{url:this.autoLoad});}});Ext.reg('panel',Ext.Panel);Ext.Window=Ext.extend(Ext.Panel,{baseCls:'x-window',resizable:true,draggable:true,closable:true,constrain:false,constrainHeader:false,plain:false,minimizable:false,maximizable:false,minHeight:100,minWidth:200,expandOnShow:true,closeAction:'close',elements:'header,body',collapsible:false,initHidden:true,monitorResize:true,frame:true,floating:true,initComponent:function(){Ext.Window.superclass.initComponent.call(this);this.addEvents('resize','maximize','minimize','restore');},getState:function(){return Ext.apply(Ext.Window.superclass.getState.call(this)||{},this.getBox());},onRender:function(ct,position){Ext.Window.superclass.onRender.call(this,ct,position);if(this.plain){this.el.addClass('x-window-plain');}
this.focusEl=this.el.createChild({tag:"a",href:"#",cls:"x-dlg-focus",tabIndex:"-1",html:"&#160;"});this.focusEl.swallowEvent('click',true);this.proxy=this.el.createProxy("x-window-proxy");this.proxy.enableDisplayMode('block');if(this.modal){this.mask=this.container.createChild({cls:"ext-el-mask"},this.el.dom);this.mask.enableDisplayMode("block");this.mask.hide();}},initEvents:function(){Ext.Window.superclass.initEvents.call(this);if(this.animateTarget){this.setAnimateTarget(this.animateTarget);}
if(this.resizable){this.resizer=new Ext.Resizable(this.el,{minWidth:this.minWidth,minHeight:this.minHeight,handles:this.resizeHandles||"all",pinned:true,resizeElement:this.resizerAction});this.resizer.window=this;this.resizer.on("beforeresize",this.beforeResize,this);}
if(this.draggable){this.header.addClass("x-window-draggable");}
this.initTools();this.el.on("mousedown",this.toFront,this);this.manager=this.manager||Ext.WindowMgr;this.manager.register(this);this.hidden=true;if(this.maximized){this.maximized=false;this.maximize();}
if(this.closable){var km=this.getKeyMap();km.on(27,this.onEsc,this);km.disable();}},initDraggable:function(){this.dd=new Ext.Window.DD(this);},onEsc:function(){this[this.closeAction]();},beforeDestroy:function(){Ext.destroy(this.resizer,this.dd,this.proxy,this.mask);Ext.Window.superclass.beforeDestroy.call(this);},onDestroy:function(){if(this.manager){this.manager.unregister(this);}
Ext.Window.superclass.onDestroy.call(this);},initTools:function(){if(this.minimizable){this.addTool({id:'minimize',handler:this.minimize.createDelegate(this,[])});}
if(this.maximizable){this.addTool({id:'maximize',handler:this.maximize.createDelegate(this,[])});this.addTool({id:'restore',handler:this.restore.createDelegate(this,[]),hidden:true});this.header.on('dblclick',this.toggleMaximize,this);}
if(this.closable){this.addTool({id:'close',handler:this[this.closeAction].createDelegate(this,[])});}},resizerAction:function(){var box=this.proxy.getBox();this.proxy.hide();this.window.handleResize(box);return box;},beforeResize:function(){this.resizer.minHeight=Math.max(this.minHeight,this.getFrameHeight()+40);this.resizer.minWidth=Math.max(this.minWidth,this.getFrameWidth()+40);this.resizeBox=this.el.getBox();},updateHandles:function(){if(Ext.isIE&&this.resizer){this.resizer.syncHandleHeight();this.el.repaint();}},handleResize:function(box){var rz=this.resizeBox;if(rz.x!=box.x||rz.y!=box.y){this.updateBox(box);}else{this.setSize(box);}
this.focus();this.updateHandles();this.saveState();if(this.layout){this.doLayout();}
this.fireEvent("resize",this,box.width,box.height);},focus:function(){var f=this.focusEl,db=this.defaultButton,t=typeof db;if(t!='undefined'){if(t=='number'){f=this.buttons[db];}else if(t=='string'){f=Ext.getCmp(db);}else{f=db;}}
f.focus.defer(10,f);},setAnimateTarget:function(el){el=Ext.get(el);this.animateTarget=el;},beforeShow:function(){delete this.el.lastXY;delete this.el.lastLT;if(this.x===undefined||this.y===undefined){var xy=this.el.getAlignToXY(this.container,'c-c');var pos=this.el.translatePoints(xy[0],xy[1]);this.x=this.x===undefined?pos.left:this.x;this.y=this.y===undefined?pos.top:this.y;}
this.el.setLeftTop(this.x,this.y);if(this.expandOnShow){this.expand(false);}
if(this.modal){Ext.getBody().addClass("x-body-masked");this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.mask.show();}},show:function(animateTarget,cb,scope){if(!this.rendered){this.render(Ext.getBody());}
if(this.hidden===false){this.toFront();return;}
if(this.fireEvent("beforeshow",this)===false){return;}
if(cb){this.on('show',cb,scope,{single:true});}
this.hidden=false;if(animateTarget!==undefined){this.setAnimateTarget(animateTarget);}
this.beforeShow();if(this.animateTarget){this.animShow();}else{this.afterShow();}},afterShow:function(){this.proxy.hide();this.el.setStyle('display','block');this.el.show();if(this.maximized){this.fitContainer();}
if(Ext.isMac&&Ext.isGecko){this.cascade(this.setAutoScroll);}
if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){Ext.EventManager.onWindowResize(this.onWindowResize,this);}
this.doConstrain();if(this.layout){this.doLayout();}
if(this.keyMap){this.keyMap.enable();}
this.toFront();this.updateHandles();this.fireEvent("show",this);},animShow:function(){this.proxy.show();this.proxy.setBox(this.animateTarget.getBox());this.proxy.setOpacity(0);var b=this.getBox(false);b.callback=this.afterShow;b.scope=this;b.duration=.25;b.easing='easeNone';b.opacity=.5;b.block=true;this.el.setStyle('display','none');this.proxy.shift(b);},hide:function(animateTarget,cb,scope){if(this.activeGhost){this.hide.defer(100,this,[animateTarget,cb,scope]);return;}
if(this.hidden||this.fireEvent("beforehide",this)===false){return;}
if(cb){this.on('hide',cb,scope,{single:true});}
this.hidden=true;if(animateTarget!==undefined){this.setAnimateTarget(animateTarget);}
if(this.animateTarget){this.animHide();}else{this.el.hide();this.afterHide();}},afterHide:function(){this.proxy.hide();if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){Ext.EventManager.removeResizeListener(this.onWindowResize,this);}
if(this.modal){this.mask.hide();Ext.getBody().removeClass("x-body-masked");}
if(this.keyMap){this.keyMap.disable();}
this.fireEvent("hide",this);},animHide:function(){this.proxy.setOpacity(.5);this.proxy.show();var tb=this.getBox(false);this.proxy.setBox(tb);this.el.hide();var b=this.animateTarget.getBox();b.callback=this.afterHide;b.scope=this;b.duration=.25;b.easing='easeNone';b.block=true;b.opacity=0;this.proxy.shift(b);},onWindowResize:function(){if(this.maximized){this.fitContainer();}
if(this.modal){this.mask.setSize('100%','100%');var force=this.mask.dom.offsetHeight;this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));}
this.doConstrain();},doConstrain:function(){if(this.constrain||this.constrainHeader){var offsets;if(this.constrain){offsets={right:this.el.shadowOffset,left:this.el.shadowOffset,bottom:this.el.shadowOffset};}else{var s=this.getSize();offsets={right:-(s.width-100),bottom:-(s.height-25)};}
var xy=this.el.getConstrainToXY(this.container,true,offsets);if(xy){this.setPosition(xy[0],xy[1]);}}},ghost:function(cls){var ghost=this.createGhost(cls);var box=this.getBox(true);ghost.setLeftTop(box.x,box.y);ghost.setWidth(box.width);this.el.hide();this.activeGhost=ghost;return ghost;},unghost:function(show,matchPosition){if(show!==false){this.el.show();this.focus();if(Ext.isMac&&Ext.isGecko){this.cascade(this.setAutoScroll);}}
if(matchPosition!==false){this.setPosition(this.activeGhost.getLeft(true),this.activeGhost.getTop(true));}
this.activeGhost.hide();this.activeGhost.remove();delete this.activeGhost;},minimize:function(){this.fireEvent('minimize',this);},close:function(){if(this.fireEvent("beforeclose",this)!==false){this.hide(null,function(){this.fireEvent('close',this);this.destroy();},this);}},maximize:function(){if(!this.maximized){this.expand(false);this.restoreSize=this.getSize();this.restorePos=this.getPosition(true);if(this.maximizable){this.tools.maximize.hide();this.tools.restore.show();}
this.maximized=true;this.el.disableShadow();if(this.dd){this.dd.lock();}
if(this.collapsible){this.tools.toggle.hide();}
this.el.addClass('x-window-maximized');this.container.addClass('x-window-maximized-ct');this.setPosition(0,0);this.fitContainer();this.fireEvent('maximize',this);}},restore:function(){if(this.maximized){this.el.removeClass('x-window-maximized');this.tools.restore.hide();this.tools.maximize.show();this.setPosition(this.restorePos[0],this.restorePos[1]);this.setSize(this.restoreSize.width,this.restoreSize.height);delete this.restorePos;delete this.restoreSize;this.maximized=false;this.el.enableShadow(true);if(this.dd){this.dd.unlock();}
if(this.collapsible){this.tools.toggle.show();}
this.container.removeClass('x-window-maximized-ct');this.doConstrain();this.fireEvent('restore',this);}},toggleMaximize:function(){this[this.maximized?'restore':'maximize']();},fitContainer:function(){var vs=this.container.getViewSize();this.setSize(vs.width,vs.height);},setZIndex:function(index){if(this.modal){this.mask.setStyle("z-index",index);}
this.el.setZIndex(++index);index+=5;if(this.resizer){this.resizer.proxy.setStyle("z-index",++index);}
this.lastZIndex=index;},alignTo:function(element,position,offsets){var xy=this.el.getAlignToXY(element,position,offsets);this.setPagePosition(xy[0],xy[1]);return this;},anchorTo:function(el,alignment,offsets,monitorScroll,_pname){var action=function(){this.alignTo(el,alignment,offsets);};Ext.EventManager.onWindowResize(action,this);var tm=typeof monitorScroll;if(tm!='undefined'){Ext.EventManager.on(window,'scroll',action,this,{buffer:tm=='number'?monitorScroll:50});}
action.call(this);this[_pname]=action;return this;},toFront:function(){if(this.manager.bringToFront(this)){this.focus();}
return this;},setActive:function(active){if(active){if(!this.maximized){this.el.enableShadow(true);}
this.fireEvent('activate',this);}else{this.el.disableShadow();this.fireEvent('deactivate',this);}},toBack:function(){this.manager.sendToBack(this);return this;},center:function(){var xy=this.el.getAlignToXY(this.container,'c-c');this.setPagePosition(xy[0],xy[1]);return this;}});Ext.reg('window',Ext.Window);Ext.Window.DD=function(win){this.win=win;Ext.Window.DD.superclass.constructor.call(this,win.el.id,'WindowDD-'+win.id);this.setHandleElId(win.header.id);this.scroll=false;};Ext.extend(Ext.Window.DD,Ext.dd.DD,{moveOnly:true,headerOffsets:[100,25],startDrag:function(){var w=this.win;this.proxy=w.ghost();if(w.constrain!==false){var so=w.el.shadowOffset;this.constrainTo(w.container,{right:so,left:so,bottom:so});}else if(w.constrainHeader!==false){var s=this.proxy.getSize();this.constrainTo(w.container,{right:-(s.width-this.headerOffsets[0]),bottom:-(s.height-this.headerOffsets[1])});}},b4Drag:Ext.emptyFn,onDrag:function(e){this.alignElWithMouse(this.proxy,e.getPageX(),e.getPageY());},endDrag:function(e){this.win.unghost();this.win.saveState();}});Ext.WindowGroup=function(){var list={};var accessList=[];var front=null;var sortWindows=function(d1,d2){return(!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;};var orderWindows=function(){var a=accessList,len=a.length;if(len>0){a.sort(sortWindows);var seed=a[0].manager.zseed;for(var i=0;i<len;i++){var win=a[i];if(win&&!win.hidden){win.setZIndex(seed+(i*10));}}}
activateLast();};var setActiveWin=function(win){if(win!=front){if(front){front.setActive(false);}
front=win;if(win){win.setActive(true);}}};var activateLast=function(){for(var i=accessList.length-1;i>=0;--i){if(!accessList[i].hidden){setActiveWin(accessList[i]);return;}}
setActiveWin(null);};return{zseed:9000,register:function(win){list[win.id]=win;accessList.push(win);win.on('hide',activateLast);},unregister:function(win){delete list[win.id];win.un('hide',activateLast);accessList.remove(win);},get:function(id){return typeof id=="object"?id:list[id];},bringToFront:function(win){win=this.get(win);if(win!=front){win._lastAccess=new Date().getTime();orderWindows();return true;}
return false;},sendToBack:function(win){win=this.get(win);win._lastAccess=-(new Date().getTime());orderWindows();return win;},hideAll:function(){for(var id in list){if(list[id]&&typeof list[id]!="function"&&list[id].isVisible()){list[id].hide();}}},getActive:function(){return front;},getBy:function(fn,scope){var r=[];for(var i=accessList.length-1;i>=0;--i){var win=accessList[i];if(fn.call(scope||win,win)!==false){r.push(win);}}
return r;},each:function(fn,scope){for(var id in list){if(list[id]&&typeof list[id]!="function"){if(fn.call(scope||list[id],list[id])===false){return;}}}}};};Ext.WindowMgr=new Ext.WindowGroup();Ext.dd.PanelProxy=function(panel,config){this.panel=panel;this.id=this.panel.id+'-ddproxy';Ext.apply(this,config);};Ext.dd.PanelProxy.prototype={insertProxy:true,setStatus:Ext.emptyFn,reset:Ext.emptyFn,update:Ext.emptyFn,stop:Ext.emptyFn,sync:Ext.emptyFn,getEl:function(){return this.ghost;},getGhost:function(){return this.ghost;},getProxy:function(){return this.proxy;},hide:function(){if(this.ghost){if(this.proxy){this.proxy.remove();delete this.proxy;}
this.panel.el.dom.style.display='';this.ghost.remove();delete this.ghost;}},show:function(){if(!this.ghost){this.ghost=this.panel.createGhost(undefined,undefined,Ext.getBody());this.ghost.setXY(this.panel.el.getXY())
if(this.insertProxy){this.proxy=this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});this.proxy.setSize(this.panel.getSize());}
this.panel.el.dom.style.display='none';}},repair:function(xy,callback,scope){this.hide();if(typeof callback=="function"){callback.call(scope||this);}},moveProxy:function(parentNode,before){if(this.proxy){parentNode.insertBefore(this.proxy.dom,before);}}};Ext.Panel.DD=function(panel,cfg){this.panel=panel;this.dragData={panel:panel};this.proxy=new Ext.dd.PanelProxy(panel,cfg);Ext.Panel.DD.superclass.constructor.call(this,panel.el,cfg);var h=panel.header;if(h){this.setHandleElId(h.id);}
(h?h:this.panel.body).setStyle('cursor','move');this.scroll=false;};Ext.extend(Ext.Panel.DD,Ext.dd.DragSource,{showFrame:Ext.emptyFn,startDrag:Ext.emptyFn,b4StartDrag:function(x,y){this.proxy.show();},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);},onInitDrag:function(x,y){this.onStartDrag(x,y);return true;},createFrame:Ext.emptyFn,getDragEl:function(e){return this.proxy.ghost.dom;},endDrag:function(e){this.proxy.hide();this.panel.saveState();},autoOffset:function(x,y){x-=this.startPageX;y-=this.startPageY;this.setDelta(x,y);}});Ext.state.Provider=function(){this.addEvents("statechange");this.state={};Ext.state.Provider.superclass.constructor.call(this);};Ext.extend(Ext.state.Provider,Ext.util.Observable,{get:function(name,defaultValue){return typeof this.state[name]=="undefined"?defaultValue:this.state[name];},clear:function(name){delete this.state[name];this.fireEvent("statechange",this,name,null);},set:function(name,value){this.state[name]=value;this.fireEvent("statechange",this,name,value);},decodeValue:function(cookie){var re=/^(a|n|d|b|s|o)\:(.*)$/;var matches=re.exec(unescape(cookie));if(!matches||!matches[1])return;var type=matches[1];var v=matches[2];switch(type){case"n":return parseFloat(v);case"d":return new Date(Date.parse(v));case"b":return(v=="1");case"a":var all=[];var values=v.split("^");for(var i=0,len=values.length;i<len;i++){all.push(this.decodeValue(values[i]));}
return all;case"o":var all={};var values=v.split("^");for(var i=0,len=values.length;i<len;i++){var kv=values[i].split("=");all[kv[0]]=this.decodeValue(kv[1]);}
return all;default:return v;}},encodeValue:function(v){var enc;if(typeof v=="number"){enc="n:"+v;}else if(typeof v=="boolean"){enc="b:"+(v?"1":"0");}else if(Ext.isDate(v)){enc="d:"+v.toGMTString();}else if(Ext.isArray(v)){var flat="";for(var i=0,len=v.length;i<len;i++){flat+=this.encodeValue(v[i]);if(i!=len-1)flat+="^";}
enc="a:"+flat;}else if(typeof v=="object"){var flat="";for(var key in v){if(typeof v[key]!="function"&&v[key]!==undefined){flat+=key+"="+this.encodeValue(v[key])+"^";}}
enc="o:"+flat.substring(0,flat.length-1);}else{enc="s:"+v;}
return escape(enc);}});Ext.state.Manager=function(){var provider=new Ext.state.Provider();return{setProvider:function(stateProvider){provider=stateProvider;},get:function(key,defaultValue){return provider.get(key,defaultValue);},set:function(key,value){provider.set(key,value);},clear:function(key){provider.clear(key);},getProvider:function(){return provider;}};}();Ext.state.CookieProvider=function(config){Ext.state.CookieProvider.superclass.constructor.call(this);this.path="/";this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;Ext.apply(this,config);this.state=this.readCookies();};Ext.extend(Ext.state.CookieProvider,Ext.state.Provider,{set:function(name,value){if(typeof value=="undefined"||value===null){this.clear(name);return;}
this.setCookie(name,value);Ext.state.CookieProvider.superclass.set.call(this,name,value);},clear:function(name){this.clearCookie(name);Ext.state.CookieProvider.superclass.clear.call(this,name);},readCookies:function(){var cookies={};var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var matches;while((matches=re.exec(c))!=null){var name=matches[1];var value=matches[2];if(name&&name.substring(0,3)=="ys-"){cookies[name.substr(3)]=this.decodeValue(value);}}
return cookies;},setCookie:function(name,value){document.cookie="ys-"+name+"="+this.encodeValue(value)+
((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+
((this.path==null)?"":("; path="+this.path))+
((this.domain==null)?"":("; domain="+this.domain))+
((this.secure==true)?"; secure":"");},clearCookie:function(name){document.cookie="ys-"+name+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+
((this.path==null)?"":("; path="+this.path))+
((this.domain==null)?"":("; domain="+this.domain))+
((this.secure==true)?"; secure":"");}});Ext.DataView=Ext.extend(Ext.BoxComponent,{selectedClass:"x-view-selected",emptyText:"",deferEmptyText:true,trackOver:false,last:false,initComponent:function(){Ext.DataView.superclass.initComponent.call(this);if(typeof this.tpl=="string"){this.tpl=new Ext.XTemplate(this.tpl);}
this.addEvents("beforeclick","click","mouseenter","mouseleave","containerclick","dblclick","contextmenu","selectionchange","beforeselect");this.all=new Ext.CompositeElementLite();this.selected=new Ext.CompositeElementLite();},onRender:function(){if(!this.el){this.el=document.createElement('div');this.el.id=this.id;}
Ext.DataView.superclass.onRender.apply(this,arguments);},afterRender:function(){Ext.DataView.superclass.afterRender.call(this);this.el.on({"click":this.onClick,"dblclick":this.onDblClick,"contextmenu":this.onContextMenu,scope:this});if(this.overClass||this.trackOver){this.el.on({"mouseover":this.onMouseOver,"mouseout":this.onMouseOut,scope:this});}
if(this.store){this.setStore(this.store,true);}},refresh:function(){this.clearSelections(false,true);this.el.update("");var records=this.store.getRange();if(records.length<1){if(!this.deferEmptyText||this.hasSkippedEmptyText){this.el.update(this.emptyText);}
this.hasSkippedEmptyText=true;this.all.clear();return;}
this.tpl.overwrite(this.el,this.collectData(records,0));this.all.fill(Ext.query(this.itemSelector,this.el.dom));this.updateIndexes(0);},prepareData:function(data){return data;},collectData:function(records,startIndex){var r=[];for(var i=0,len=records.length;i<len;i++){r[r.length]=this.prepareData(records[i].data,startIndex+i,records[i]);}
return r;},bufferRender:function(records){var div=document.createElement('div');this.tpl.overwrite(div,this.collectData(records));return Ext.query(this.itemSelector,div);},onUpdate:function(ds,record){var index=this.store.indexOf(record);var sel=this.isSelected(index);var original=this.all.elements[index];var node=this.bufferRender([record],index)[0];this.all.replaceElement(index,node,true);if(sel){this.selected.replaceElement(original,node);this.all.item(index).addClass(this.selectedClass);}
this.updateIndexes(index,index);},onAdd:function(ds,records,index){if(this.all.getCount()==0){this.refresh();return;}
var nodes=this.bufferRender(records,index),n,a=this.all.elements;if(index<this.all.getCount()){n=this.all.item(index).insertSibling(nodes,'before',true);a.splice.apply(a,[index,0].concat(nodes));}else{n=this.all.last().insertSibling(nodes,'after',true);a.push.apply(a,nodes);}
this.updateIndexes(index);},onRemove:function(ds,record,index){this.deselect(index);this.all.removeElement(index,true);this.updateIndexes(index);},refreshNode:function(index){this.onUpdate(this.store,this.store.getAt(index));},updateIndexes:function(startIndex,endIndex){var ns=this.all.elements;startIndex=startIndex||0;endIndex=endIndex||((endIndex===0)?0:(ns.length-1));for(var i=startIndex;i<=endIndex;i++){ns[i].viewIndex=i;}},setStore:function(store,initial){if(!initial&&this.store){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("datachanged",this.refresh,this);this.store.un("add",this.onAdd,this);this.store.un("remove",this.onRemove,this);this.store.un("update",this.onUpdate,this);this.store.un("clear",this.refresh,this);}
if(store){store=Ext.StoreMgr.lookup(store);store.on("beforeload",this.onBeforeLoad,this);store.on("datachanged",this.refresh,this);store.on("add",this.onAdd,this);store.on("remove",this.onRemove,this);store.on("update",this.onUpdate,this);store.on("clear",this.refresh,this);}
this.store=store;if(store){this.refresh();}},findItemFromChild:function(node){return Ext.fly(node).findParent(this.itemSelector,this.el);},onClick:function(e){var item=e.getTarget(this.itemSelector,this.el);if(item){var index=this.indexOf(item);if(this.onItemClick(item,index,e)!==false){this.fireEvent("click",this,index,item,e);}}else{if(this.fireEvent("containerclick",this,e)!==false){this.clearSelections();}}},onContextMenu:function(e){var item=e.getTarget(this.itemSelector,this.el);if(item){this.fireEvent("contextmenu",this,this.indexOf(item),item,e);}},onDblClick:function(e){var item=e.getTarget(this.itemSelector,this.el);if(item){this.fireEvent("dblclick",this,this.indexOf(item),item,e);}},onMouseOver:function(e){var item=e.getTarget(this.itemSelector,this.el);if(item&&item!==this.lastItem){this.lastItem=item;Ext.fly(item).addClass(this.overClass);this.fireEvent("mouseenter",this,this.indexOf(item),item,e);}},onMouseOut:function(e){if(this.lastItem){if(!e.within(this.lastItem,true)){Ext.fly(this.lastItem).removeClass(this.overClass);this.fireEvent("mouseleave",this,this.indexOf(this.lastItem),this.lastItem,e);delete this.lastItem;}}},onItemClick:function(item,index,e){if(this.fireEvent("beforeclick",this,index,item,e)===false){return false;}
if(this.multiSelect){this.doMultiSelection(item,index,e);e.preventDefault();}else if(this.singleSelect){this.doSingleSelection(item,index,e);e.preventDefault();}
return true;},doSingleSelection:function(item,index,e){if(e.ctrlKey&&this.isSelected(index)){this.deselect(index);}else{this.select(index,false);}},doMultiSelection:function(item,index,e){if(e.shiftKey&&this.last!==false){var last=this.last;this.selectRange(last,index,e.ctrlKey);this.last=last;}else{if((e.ctrlKey||this.simpleSelect)&&this.isSelected(index)){this.deselect(index);}else{this.select(index,e.ctrlKey||e.shiftKey||this.simpleSelect);}}},getSelectionCount:function(){return this.selected.getCount()},getSelectedNodes:function(){return this.selected.elements;},getSelectedIndexes:function(){var indexes=[],s=this.selected.elements;for(var i=0,len=s.length;i<len;i++){indexes.push(s[i].viewIndex);}
return indexes;},getSelectedRecords:function(){var r=[],s=this.selected.elements;for(var i=0,len=s.length;i<len;i++){r[r.length]=this.store.getAt(s[i].viewIndex);}
return r;},getRecords:function(nodes){var r=[],s=nodes;for(var i=0,len=s.length;i<len;i++){r[r.length]=this.store.getAt(s[i].viewIndex);}
return r;},getRecord:function(node){return this.store.getAt(node.viewIndex);},clearSelections:function(suppressEvent,skipUpdate){if((this.multiSelect||this.singleSelect)&&this.selected.getCount()>0){if(!skipUpdate){this.selected.removeClass(this.selectedClass);}
this.selected.clear();this.last=false;if(!suppressEvent){this.fireEvent("selectionchange",this,this.selected.elements);}}},isSelected:function(node){return this.selected.contains(this.getNode(node));},deselect:function(node){if(this.isSelected(node)){node=this.getNode(node);this.selected.removeElement(node);if(this.last==node.viewIndex){this.last=false;}
Ext.fly(node).removeClass(this.selectedClass);this.fireEvent("selectionchange",this,this.selected.elements);}},select:function(nodeInfo,keepExisting,suppressEvent){if(Ext.isArray(nodeInfo)){if(!keepExisting){this.clearSelections(true);}
for(var i=0,len=nodeInfo.length;i<len;i++){this.select(nodeInfo[i],true,true);}
if(!suppressEvent){this.fireEvent("selectionchange",this,this.selected.elements);}}else{var node=this.getNode(nodeInfo);if(!keepExisting){this.clearSelections(true);}
if(node&&!this.isSelected(node)){if(this.fireEvent("beforeselect",this,node,this.selected.elements)!==false){Ext.fly(node).addClass(this.selectedClass);this.selected.add(node);this.last=node.viewIndex;if(!suppressEvent){this.fireEvent("selectionchange",this,this.selected.elements);}}}}},selectRange:function(start,end,keepExisting){if(!keepExisting){this.clearSelections(true);}
this.select(this.getNodes(start,end),true);},getNode:function(nodeInfo){if(typeof nodeInfo=="string"){return document.getElementById(nodeInfo);}else if(typeof nodeInfo=="number"){return this.all.elements[nodeInfo];}
return nodeInfo;},getNodes:function(start,end){var ns=this.all.elements;start=start||0;end=typeof end=="undefined"?Math.max(ns.length-1,0):end;var nodes=[],i;if(start<=end){for(i=start;i<=end&&ns[i];i++){nodes.push(ns[i]);}}else{for(i=start;i>=end&&ns[i];i--){nodes.push(ns[i]);}}
return nodes;},indexOf:function(node){node=this.getNode(node);if(typeof node.viewIndex=="number"){return node.viewIndex;}
return this.all.indexOf(node);},onBeforeLoad:function(){if(this.loadingText){this.clearSelections(false,true);this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');this.all.clear();}},onDestroy:function(){Ext.DataView.superclass.onDestroy.call(this);this.setStore(null);}});Ext.reg('dataview',Ext.DataView);Ext.ColorPalette=function(config){Ext.ColorPalette.superclass.constructor.call(this,config);this.addEvents('select');if(this.handler){this.on("select",this.handler,this.scope,true);}};Ext.extend(Ext.ColorPalette,Ext.Component,{itemCls:"x-color-palette",value:null,clickEvent:'click',ctype:"Ext.ColorPalette",allowReselect:false,colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","969696","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","99CCFF","CC99FF","FFFFFF"],onRender:function(container,position){var t=this.tpl||new Ext.XTemplate('<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>');var el=document.createElement("div");el.className=this.itemCls;t.overwrite(el,this.colors);container.dom.insertBefore(el,position);this.el=Ext.get(el);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!='click'){this.el.on('click',Ext.emptyFn,this,{delegate:"a",preventDefault:true});}},afterRender:function(){Ext.ColorPalette.superclass.afterRender.call(this);if(this.value){var s=this.value;this.value=null;this.select(s);}},handleClick:function(e,t){e.preventDefault();if(!this.disabled){var c=t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];this.select(c.toUpperCase());}},select:function(color){color=color.replace("#","");if(color!=this.value||this.allowReselect){var el=this.el;if(this.value){el.child("a.color-"+this.value).removeClass("x-color-palette-sel");}
el.child("a.color-"+color).addClass("x-color-palette-sel");this.value=color;this.fireEvent("select",this,color);}}});Ext.reg('colorpalette',Ext.ColorPalette);Ext.DatePicker=Ext.extend(Ext.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDaysText:"Disabled",disabledDatesText:"Disabled",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:'Next Month (Control+Right)',prevText:'Previous Month (Control+Left)',monthYearText:'Choose a month (Control+Up/Down to move years)',startDay:0,showToday:true,initComponent:function(){Ext.DatePicker.superclass.initComponent.call(this);this.value=this.value?this.value.clearTime():new Date().clearTime();this.addEvents('select');if(this.handler){this.on("select",this.handler,this.scope||this);}
this.initDisabledDays();},initDisabledDays:function(){if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
this.disabledDatesRE=new RegExp(re+")");}},setDisabledDates:function(dd){if(Ext.isArray(dd)){this.disabledDates=dd;this.disabledDatesRE=null;}else{this.disabledDatesRE=dd;}
this.initDisabledDays();this.update(this.value,true);},setDisabledDays:function(dd){this.disabledDays=dd;this.update(this.value,true);},setMinDate:function(dt){this.minDate=dt;this.update(this.value,true);},setMaxDate:function(dt){this.maxDate=dt;this.update(this.value,true);},setValue:function(value){var old=this.value;this.value=value.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(container,position){var m=['<table cellspacing="0">','<tr><td class="x-date-left"><a href="#" title="',this.prevText,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="',this.nextText,'">&#160;</a></td></tr>','<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];var dn=this.dayNames;for(var i=0;i<7;i++){var d=parseInt(this.startDay+i);while(d>6){d=d-7;}
m.push("<th><span>",(dn[d]&&dn[d].length>0?dn[d].substr(0,1):' '),"</span></th>");}
m[m.length]="</tr></thead><tbody><tr>";for(var i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>";}
m[m.length]='<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';}
m.push('</tr></tbody></table></td></tr>',this.showToday?'<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>':'','</table><div class="x-date-mp"></div>');var el=document.createElement("div");el.className="x-date-picker";el.innerHTML=m.join("");container.dom.insertBefore(el,position);this.el=Ext.get(el);this.eventEl=Ext.get(el.firstChild);new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});this.eventEl.on("mousewheel",this.handleMouseWheel,this);this.monthPicker=this.el.down('div.x-date-mp');this.monthPicker.enableDisplayMode('block');var kn=new Ext.KeyNav(this.eventEl,{"left":function(e){e.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1));},"right":function(e){e.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1));},"up":function(e){e.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7));},"down":function(e){e.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7));},"pageUp":function(e){this.showNextMonth();},"pageDown":function(e){this.showPrevMonth();},"enter":function(e){e.stopPropagation();return true;},scope:this});this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Ext.Button({text:"&#160;",tooltip:this.monthYearText,renderTo:this.el.child("td.x-date-middle",true)});this.mbtn.on('click',this.showMonthPicker,this);this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");if(this.showToday){this.todayKeyListener=this.eventEl.addKeyListener(Ext.EventObject.SPACE,this.selectToday,this);var today=(new Date()).dateFormat(this.format);this.todayBtn=new Ext.Button({renderTo:this.el.child("td.x-date-bottom",true),text:String.format(this.todayText,today),tooltip:String.format(this.todayTip,today),handler:this.selectToday,scope:this});}
if(Ext.isIE){this.el.repaint();}
this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var buf=['<table border="0" cellspacing="0">'];for(var i=0;i<6;i++){buf.push('<tr><td class="x-date-mp-month"><a href="#">',this.monthNames[i].substr(0,3),'</a></td>','<td class="x-date-mp-month x-date-mp-sep"><a href="#">',this.monthNames[i+6].substr(0,3),'</a></td>',i==0?'<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>':'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>');}
buf.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',this.okText,'</button><button type="button" class="x-date-mp-cancel">',this.cancelText,'</button></td></tr>','</table>');this.monthPicker.update(buf.join(''));this.monthPicker.on('click',this.onMonthClick,this);this.monthPicker.on('dblclick',this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select('td.x-date-mp-month');this.mpYears=this.monthPicker.select('td.x-date-mp-year');this.mpMonths.each(function(m,a,i){i+=1;if((i%2)==0){m.dom.xmonth=5+Math.round(i*.5);}else{m.dom.xmonth=Math.round((i-1)*.5);}});}},showMonthPicker:function(){this.createMonthPicker();var size=this.el.getSize();this.monthPicker.setSize(size);this.monthPicker.child('table').setSize(size);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn('t',{duration:.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*.5);td.firstChild.innerHTML=y2;td.xyear=y2;}else{y2=y-(5-Math.round(i*.5));td.firstChild.innerHTML=y2;td.xyear=y2;}
this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-sel');}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?'addClass':'removeClass']('x-date-mp-sel');});},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Ext.Element(t),pn;if(el.is('button.x-date-mp-cancel')){this.hideMonthPicker();}
else if(el.is('button.x-date-mp-ok')){var d=new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate());if(d.getMonth()!=this.mpSelMonth){d=new Date(this.mpSelYear,this.mpSelMonth,1).getLastDateOfMonth();}
this.update(d);this.hideMonthPicker();}
else if(pn=el.up('td.x-date-mp-month',2)){this.mpMonths.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelMonth=pn.dom.xmonth;}
else if(pn=el.up('td.x-date-mp-year',2)){this.mpYears.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelYear=pn.dom.xyear;}
else if(el.is('a.x-date-mp-prev')){this.updateMPYear(this.mpyear-10);}
else if(el.is('a.x-date-mp-next')){this.updateMPYear(this.mpyear+10);}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Ext.Element(t),pn;if(pn=el.up('td.x-date-mp-month',2)){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}
else if(pn=el.up('td.x-date-mp-year',2)){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}},hideMonthPicker:function(disableAnim){if(this.monthPicker){if(disableAnim===true){this.monthPicker.hide();}else{this.monthPicker.slideOut('t',{duration:.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));},showPrevYear:function(){this.update(this.activeDate.add("y",-1));},showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var delta=e.getWheelDelta();if(delta>0){this.showPrevMonth();e.stopEvent();}else if(delta<0){this.showNextMonth();e.stopEvent();}},handleDateClick:function(e,t){e.stopEvent();if(t.dateValue&&!Ext.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}},selectToday:function(){if(this.todayBtn&&!this.todayBtn.disabled){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value);}},update:function(date,forceRefresh){var vd=this.activeDate;this.activeDate=date;if(!forceRefresh&&vd&&this.el){var t=date.getTime();if(vd.getMonth()==date.getMonth()&&vd.getFullYear()==date.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){c.addClass("x-date-selected");setTimeout(function(){try{c.dom.firstChild.focus();}catch(e){}},50);return false;}});return;}}
var days=date.getDaysInMonth();var firstOfMonth=date.getFirstDateOfMonth();var startingPos=firstOfMonth.getDay()-this.startDay;if(startingPos<=this.startDay){startingPos+=7;}
var pm=date.add("mo",-1);var prevStart=pm.getDaysInMonth()-startingPos;var cells=this.cells.elements;var textEls=this.textNodes;days+=startingPos;var day=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),prevStart)).clearTime();var today=new Date().clearTime().getTime();var sel=date.clearTime().getTime();var min=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var max=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var ddMatch=this.disabledDatesRE;var ddText=this.disabledDatesText;var ddays=this.disabledDays?this.disabledDays.join(""):false;var ddaysText=this.disabledDaysText;var format=this.format;if(this.showToday){var td=new Date().clearTime();var disable=(td<min||td>max||(ddMatch&&format&&ddMatch.test(td.dateFormat(format)))||(ddays&&ddays.indexOf(td.getDay())!=-1));this.todayBtn.setDisabled(disable);this.todayKeyListener[disable?'disable':'enable']();}
var setCellClass=function(cal,cell){cell.title="";var t=d.getTime();cell.firstChild.dateValue=t;if(t==today){cell.className+=" x-date-today";cell.title=cal.todayText;}
if(t==sel){cell.className+=" x-date-selected";setTimeout(function(){try{cell.firstChild.focus();}catch(e){}},50);}
if(t<min){cell.className=" x-date-disabled";cell.title=cal.minText;return;}
if(t>max){cell.className=" x-date-disabled";cell.title=cal.maxText;return;}
if(ddays){if(ddays.indexOf(d.getDay())!=-1){cell.title=ddaysText;cell.className=" x-date-disabled";}}
if(ddMatch&&format){var fvalue=d.dateFormat(format);if(ddMatch.test(fvalue)){cell.title=ddText.replace("%0",fvalue);cell.className=" x-date-disabled";}}};var i=0;for(;i<startingPos;i++){textEls[i].innerHTML=(++prevStart);d.setDate(d.getDate()+1);cells[i].className="x-date-prevday";setCellClass(this,cells[i]);}
for(;i<days;i++){intDay=i-startingPos+1;textEls[i].innerHTML=(intDay);d.setDate(d.getDate()+1);cells[i].className="x-date-active";setCellClass(this,cells[i]);}
var extraDays=0;for(;i<42;i++){textEls[i].innerHTML=(++extraDays);d.setDate(d.getDate()+1);cells[i].className="x-date-nextday";setCellClass(this,cells[i]);}
this.mbtn.setText(this.monthNames[date.getMonth()]+" "+date.getFullYear());if(!this.internalRender){var main=this.el.dom.firstChild;var w=main.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Ext.fly(main).setWidth(w);this.internalRender=true;if(Ext.isOpera&&!this.secondPass){main.rows[0].cells[1].style.width=(w-(main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[date]);}}},beforeDestroy:function(){if(this.rendered){Ext.destroy(this.mbtn,this.todayBtn);}}});Ext.reg('datepicker',Ext.DatePicker);Ext.TabPanel=Ext.extend(Ext.Panel,{monitorResize:true,deferredRender:true,tabWidth:120,minTabWidth:30,resizeTabs:false,enableTabScroll:false,scrollIncrement:0,scrollRepeatInterval:400,scrollDuration:.35,animScroll:true,tabPosition:'top',baseCls:'x-tab-panel',autoTabs:false,autoTabSelector:'div.x-tab',activeTab:null,tabMargin:2,plain:false,wheelIncrement:20,idDelimiter:'__',itemCls:'x-tab-item',elements:'body',headerAsText:false,frame:false,hideBorders:true,initComponent:function(){this.frame=false;Ext.TabPanel.superclass.initComponent.call(this);this.addEvents('beforetabchange','tabchange','contextmenu');this.setLayout(new Ext.layout.CardLayout({deferredRender:this.deferredRender}));if(this.tabPosition=='top'){this.elements+=',header';this.stripTarget='header';}else{this.elements+=',footer';this.stripTarget='footer';}
if(!this.stack){this.stack=Ext.TabPanel.AccessStack();}
this.initItems();},render:function(){Ext.TabPanel.superclass.render.apply(this,arguments);if(this.activeTab!==undefined){var item=this.activeTab;delete this.activeTab;this.setActiveTab(item);}},onRender:function(ct,position){Ext.TabPanel.superclass.onRender.call(this,ct,position);if(this.plain){var pos=this.tabPosition=='top'?'header':'footer';this[pos].addClass('x-tab-panel-'+pos+'-plain');}
var st=this[this.stripTarget];this.stripWrap=st.createChild({cls:'x-tab-strip-wrap',cn:{tag:'ul',cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});var beforeEl=(this.tabPosition=='bottom'?this.stripWrap:null);this.stripSpacer=st.createChild({cls:'x-tab-strip-spacer'},beforeEl);this.strip=new Ext.Element(this.stripWrap.dom.firstChild);this.edge=this.strip.createChild({tag:'li',cls:'x-tab-edge'});this.strip.createChild({cls:'x-clear'});this.body.addClass('x-tab-panel-body-'+this.tabPosition);if(!this.itemTpl){var tt=new Ext.Template('<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>','<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">','<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>','</em></a></li>');tt.disableFormats=true;tt.compile();Ext.TabPanel.prototype.itemTpl=tt;}
this.items.each(this.initTab,this);},afterRender:function(){Ext.TabPanel.superclass.afterRender.call(this);if(this.autoTabs){this.readTabs(false);}},initEvents:function(){Ext.TabPanel.superclass.initEvents.call(this);this.on('add',this.onAdd,this);this.on('remove',this.onRemove,this);this.strip.on('mousedown',this.onStripMouseDown,this);this.strip.on('contextmenu',this.onStripContextMenu,this);if(this.enableTabScroll){this.strip.on('mousewheel',this.onWheel,this);}},findTargets:function(e){var item=null;var itemEl=e.getTarget('li',this.strip);if(itemEl){item=this.getComponent(itemEl.id.split(this.idDelimiter)[1]);if(item.disabled){return{close:null,item:null,el:null};}}
return{close:e.getTarget('.x-tab-strip-close',this.strip),item:item,el:itemEl};},onStripMouseDown:function(e){if(e.button!=0){return;}
e.preventDefault();var t=this.findTargets(e);if(t.close){this.remove(t.item);return;}
if(t.item&&t.item!=this.activeTab){this.setActiveTab(t.item);}},onStripContextMenu:function(e){e.preventDefault();var t=this.findTargets(e);if(t.item){this.fireEvent('contextmenu',this,t.item,e);}},readTabs:function(removeExisting){if(removeExisting===true){this.items.each(function(item){this.remove(item);},this);}
var tabs=this.el.query(this.autoTabSelector);for(var i=0,len=tabs.length;i<len;i++){var tab=tabs[i];var title=tab.getAttribute('title');tab.removeAttribute('title');this.add({title:title,el:tab});}},initTab:function(item,index){var before=this.strip.dom.childNodes[index];var cls=item.closable?'x-tab-strip-closable':'';if(item.disabled){cls+=' x-item-disabled';}
if(item.iconCls){cls+=' x-tab-with-icon';}
if(item.tabCls){cls+=' '+item.tabCls;}
var p={id:this.id+this.idDelimiter+item.getItemId(),text:item.title,cls:cls,iconCls:item.iconCls||''};var el=before?this.itemTpl.insertBefore(before,p):this.itemTpl.append(this.strip,p);Ext.fly(el).addClassOnOver('x-tab-strip-over');if(item.tabTip){Ext.fly(el).child('span.x-tab-strip-text',true).qtip=item.tabTip;}
item.on('disable',this.onItemDisabled,this);item.on('enable',this.onItemEnabled,this);item.on('titlechange',this.onItemTitleChanged,this);item.on('beforeshow',this.onBeforeShowItem,this);},onAdd:function(tp,item,index){this.initTab(item,index);if(this.items.getCount()==1){this.syncSize();}
this.delegateUpdates();},onBeforeAdd:function(item){var existing=item.events?(this.items.containsKey(item.getItemId())?item:null):this.items.get(item);if(existing){this.setActiveTab(item);return false;}
Ext.TabPanel.superclass.onBeforeAdd.apply(this,arguments);var es=item.elements;item.elements=es?es.replace(',header',''):es;item.border=(item.border===true);},onRemove:function(tp,item){Ext.removeNode(this.getTabEl(item));this.stack.remove(item);item.un('disable',this.onItemDisabled,this);item.un('enable',this.onItemEnabled,this);item.un('titlechange',this.onItemTitleChanged,this);item.un('beforeshow',this.onBeforeShowItem,this);if(item==this.activeTab){var next=this.stack.next();if(next){this.setActiveTab(next);}else{this.setActiveTab(0);}}
this.delegateUpdates();},onBeforeShowItem:function(item){if(item!=this.activeTab){this.setActiveTab(item);return false;}},onItemDisabled:function(item){var el=this.getTabEl(item);if(el){Ext.fly(el).addClass('x-item-disabled');}
this.stack.remove(item);},onItemEnabled:function(item){var el=this.getTabEl(item);if(el){Ext.fly(el).removeClass('x-item-disabled');}},onItemTitleChanged:function(item){var el=this.getTabEl(item);if(el){Ext.fly(el).child('span.x-tab-strip-text',true).innerHTML=item.title;}},getTabEl:function(item){var itemId=(typeof item==='number')?this.items.items[item].getItemId():item.getItemId();return document.getElementById(this.id+this.idDelimiter+itemId);},onResize:function(){Ext.TabPanel.superclass.onResize.apply(this,arguments);this.delegateUpdates();},beginUpdate:function(){this.suspendUpdates=true;},endUpdate:function(){this.suspendUpdates=false;this.delegateUpdates();},hideTabStripItem:function(item){item=this.getComponent(item);var el=this.getTabEl(item);if(el){el.style.display='none';this.delegateUpdates();}
this.stack.remove(item);},unhideTabStripItem:function(item){item=this.getComponent(item);var el=this.getTabEl(item);if(el){el.style.display='';this.delegateUpdates();}},delegateUpdates:function(){if(this.suspendUpdates){return;}
if(this.resizeTabs&&this.rendered){this.autoSizeTabs();}
if(this.enableTabScroll&&this.rendered){this.autoScrollTabs();}},autoSizeTabs:function(){var count=this.items.length;var ce=this.tabPosition!='bottom'?'header':'footer';var ow=this[ce].dom.offsetWidth;var aw=this[ce].dom.clientWidth;if(!this.resizeTabs||count<1||!aw){return;}
var each=Math.max(Math.min(Math.floor((aw-4)/count)-this.tabMargin,this.tabWidth),this.minTabWidth);this.lastTabWidth=each;var lis=this.stripWrap.dom.getElementsByTagName('li');for(var i=0,len=lis.length-1;i<len;i++){var li=lis[i];var inner=li.childNodes[1].firstChild.firstChild;var tw=li.offsetWidth;var iw=inner.offsetWidth;inner.style.width=(each-(tw-iw))+'px';}},adjustBodyWidth:function(w){if(this.header){this.header.setWidth(w);}
if(this.footer){this.footer.setWidth(w);}
return w;},setActiveTab:function(item){item=this.getComponent(item);if(!item||this.fireEvent('beforetabchange',this,item,this.activeTab)===false){return;}
if(!this.rendered){this.activeTab=item;return;}
if(this.activeTab!=item){if(this.activeTab){var oldEl=this.getTabEl(this.activeTab);if(oldEl){Ext.fly(oldEl).removeClass('x-tab-strip-active');}
this.activeTab.fireEvent('deactivate',this.activeTab);}
var el=this.getTabEl(item);Ext.fly(el).addClass('x-tab-strip-active');this.activeTab=item;this.stack.add(item);this.layout.setActiveItem(item);if(this.layoutOnTabChange&&item.doLayout){item.doLayout();}
if(this.scrolling){this.scrollToTab(item,this.animScroll);}
item.fireEvent('activate',item);this.fireEvent('tabchange',this,item);}},getActiveTab:function(){return this.activeTab||null;},getItem:function(item){return this.getComponent(item);},autoScrollTabs:function(){var count=this.items.length;var ow=this.header.dom.offsetWidth;var tw=this.header.dom.clientWidth;var wrap=this.stripWrap;var wd=wrap.dom;var cw=wd.offsetWidth;var pos=this.getScrollPos();var l=this.edge.getOffsetsTo(this.stripWrap)[0]+pos;if(!this.enableTabScroll||count<1||cw<20){return;}
if(l<=tw){wd.scrollLeft=0;wrap.setWidth(tw);if(this.scrolling){this.scrolling=false;this.header.removeClass('x-tab-scrolling');this.scrollLeft.hide();this.scrollRight.hide();if(Ext.isAir){wd.style.marginLeft='';wd.style.marginRight='';}}}else{if(!this.scrolling){this.header.addClass('x-tab-scrolling');if(Ext.isAir){wd.style.marginLeft='18px';wd.style.marginRight='18px';}}
tw-=wrap.getMargins('lr');wrap.setWidth(tw>20?tw:20);if(!this.scrolling){if(!this.scrollLeft){this.createScrollers();}else{this.scrollLeft.show();this.scrollRight.show();}}
this.scrolling=true;if(pos>(l-tw)){wd.scrollLeft=l-tw;}else{this.scrollToTab(this.activeTab,false);}
this.updateScrollButtons();}},createScrollers:function(){var h=this.stripWrap.dom.offsetHeight;var sl=this.header.insertFirst({cls:'x-tab-scroller-left'});sl.setHeight(h);sl.addClassOnOver('x-tab-scroller-left-over');this.leftRepeater=new Ext.util.ClickRepeater(sl,{interval:this.scrollRepeatInterval,handler:this.onScrollLeft,scope:this});this.scrollLeft=sl;var sr=this.header.insertFirst({cls:'x-tab-scroller-right'});sr.setHeight(h);sr.addClassOnOver('x-tab-scroller-right-over');this.rightRepeater=new Ext.util.ClickRepeater(sr,{interval:this.scrollRepeatInterval,handler:this.onScrollRight,scope:this});this.scrollRight=sr;},getScrollWidth:function(){return this.edge.getOffsetsTo(this.stripWrap)[0]+this.getScrollPos();},getScrollPos:function(){return parseInt(this.stripWrap.dom.scrollLeft,10)||0;},getScrollArea:function(){return parseInt(this.stripWrap.dom.clientWidth,10)||0;},getScrollAnim:function(){return{duration:this.scrollDuration,callback:this.updateScrollButtons,scope:this};},getScrollIncrement:function(){return this.scrollIncrement||(this.resizeTabs?this.lastTabWidth+2:100);},scrollToTab:function(item,animate){if(!item){return;}
var el=this.getTabEl(item);var pos=this.getScrollPos(),area=this.getScrollArea();var left=Ext.fly(el).getOffsetsTo(this.stripWrap)[0]+pos;var right=left+el.offsetWidth;if(left<pos){this.scrollTo(left,animate);}else if(right>(pos+area)){this.scrollTo(right-area,animate);}},scrollTo:function(pos,animate){this.stripWrap.scrollTo('left',pos,animate?this.getScrollAnim():false);if(!animate){this.updateScrollButtons();}},onWheel:function(e){var d=e.getWheelDelta()*this.wheelIncrement*-1;e.stopEvent();var pos=this.getScrollPos();var newpos=pos+d;var sw=this.getScrollWidth()-this.getScrollArea();var s=Math.max(0,Math.min(sw,newpos));if(s!=pos){this.scrollTo(s,false);}},onScrollRight:function(){var sw=this.getScrollWidth()-this.getScrollArea();var pos=this.getScrollPos();var s=Math.min(sw,pos+this.getScrollIncrement());if(s!=pos){this.scrollTo(s,this.animScroll);}},onScrollLeft:function(){var pos=this.getScrollPos();var s=Math.max(0,pos-this.getScrollIncrement());if(s!=pos){this.scrollTo(s,this.animScroll);}},updateScrollButtons:function(){var pos=this.getScrollPos();this.scrollLeft[pos==0?'addClass':'removeClass']('x-tab-scroller-left-disabled');this.scrollRight[pos>=(this.getScrollWidth()-this.getScrollArea())?'addClass':'removeClass']('x-tab-scroller-right-disabled');}});Ext.reg('tabpanel',Ext.TabPanel);Ext.TabPanel.prototype.activate=Ext.TabPanel.prototype.setActiveTab;Ext.TabPanel.AccessStack=function(){var items=[];return{add:function(item){items.push(item);if(items.length>10){items.shift();}},remove:function(item){var s=[];for(var i=0,len=items.length;i<len;i++){if(items[i]!=item){s.push(items[i]);}}
items=s;},next:function(){return items.pop();}};};Ext.Button=Ext.extend(Ext.Component,{hidden:false,disabled:false,pressed:false,enableToggle:false,menuAlign:"tl-bl?",type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',buttonSelector:"button:first",initComponent:function(){Ext.Button.superclass.initComponent.call(this);this.addEvents("click","toggle",'mouseover','mouseout','menushow','menuhide','menutriggerover','menutriggerout');if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);}
if(typeof this.toggleGroup==='string'){this.enableToggle=true;}},onRender:function(ct,position){if(!this.template){if(!Ext.Button.buttonTemplate){Ext.Button.buttonTemplate=new Ext.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>','<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',"</tr></tbody></table>");}
this.template=Ext.Button.buttonTemplate;}
var btn,targs=[this.text||'&#160;',this.type];if(position){btn=this.template.insertBefore(position,targs,true);}else{btn=this.template.append(ct,targs,true);}
var btnEl=btn.child(this.buttonSelector);btnEl.on('focus',this.onFocus,this);btnEl.on('blur',this.onBlur,this);this.initButtonEl(btn,btnEl);if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");}
Ext.ButtonToggleMgr.register(this);},initButtonEl:function(btn,btnEl){this.el=btn;btn.addClass("x-btn");if(this.icon){btnEl.setStyle('background-image','url('+this.icon+')');}
if(this.iconCls){btnEl.addClass(this.iconCls);if(!this.cls){btn.addClass(this.text?'x-btn-text-icon':'x-btn-icon');}}
if(this.tabIndex!==undefined){btnEl.dom.tabIndex=this.tabIndex;}
if(this.tooltip){if(typeof this.tooltip=='object'){Ext.QuickTips.register(Ext.apply({target:btnEl.id},this.tooltip));}else{btnEl.dom[this.tooltipType]=this.tooltip;}}
if(this.pressed){this.el.addClass("x-btn-pressed");}
if(this.handleMouseEvents){btn.on("mouseover",this.onMouseOver,this);btn.on("mousedown",this.onMouseDown,this);}
if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}
if(this.id){this.el.dom.id=this.el.id=this.id;}
if(this.repeat){var repeater=new Ext.util.ClickRepeater(btn,typeof this.repeat=="object"?this.repeat:{});repeater.on("click",this.onClick,this);}
btn.on(this.clickEvent,this.onClick,this);},afterRender:function(){Ext.Button.superclass.afterRender.call(this);if(Ext.isIE6){this.autoWidth.defer(1,this);}else{this.autoWidth();}},setIconClass:function(cls){if(this.el){this.el.child(this.buttonSelector).replaceClass(this.iconCls,cls);}
this.iconCls=cls;},beforeDestroy:function(){if(this.rendered){var btn=this.el.child(this.buttonSelector);if(btn){btn.removeAllListeners();}}
if(this.menu){Ext.destroy(this.menu);}},onDestroy:function(){if(this.rendered){Ext.ButtonToggleMgr.unregister(this);}},autoWidth:function(){if(this.el){this.el.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var ib=this.el.child(this.buttonSelector);if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Ext.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}
if(this.minWidth){if(this.el.getWidth()<this.minWidth){this.el.setWidth(this.minWidth);}}}},setHandler:function(handler,scope){this.handler=handler;this.scope=scope;},setText:function(text){this.text=text;if(this.el){this.el.child("td.x-btn-center "+this.buttonSelector).update(text);}
this.autoWidth();},getText:function(){return this.text;},toggle:function(state){state=state===undefined?!this.pressed:state;if(state!=this.pressed){if(state){this.el.addClass("x-btn-pressed");this.pressed=true;this.fireEvent("toggle",this,true);}else{this.el.removeClass("x-btn-pressed");this.pressed=false;this.fireEvent("toggle",this,false);}
if(this.toggleHandler){this.toggleHandler.call(this.scope||this,this,state);}}},focus:function(){this.el.child(this.buttonSelector).focus();},onDisable:function(){if(this.el){if(!Ext.isIE6||!this.text){this.el.addClass(this.disabledClass);}
this.el.dom.disabled=true;}
this.disabled=true;},onEnable:function(){if(this.el){if(!Ext.isIE6||!this.text){this.el.removeClass(this.disabledClass);}
this.el.dom.disabled=false;}
this.disabled=false;},showMenu:function(){if(this.menu){this.menu.show(this.el,this.menuAlign);}
return this;},hideMenu:function(){if(this.menu){this.menu.hide();}
return this;},hasVisibleMenu:function(){return this.menu&&this.menu.isVisible();},onClick:function(e){if(e){e.preventDefault();}
if(e.button!=0){return;}
if(!this.disabled){if(this.enableToggle&&(this.allowDepress!==false||!this.pressed)){this.toggle();}
if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){this.showMenu();}
this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}},isMenuTriggerOver:function(e,internal){return this.menu&&!internal;},isMenuTriggerOut:function(e,internal){return this.menu&&!internal;},onMouseOver:function(e){if(!this.disabled){var internal=e.within(this.el,true);if(!internal){this.el.addClass("x-btn-over");if(!this.monitoringMouseOver){Ext.getDoc().on('mouseover',this.monitorMouseOver,this);this.monitoringMouseOver=true;}
this.fireEvent('mouseover',this,e);}
if(this.isMenuTriggerOver(e,internal)){this.fireEvent('menutriggerover',this,this.menu,e);}}},monitorMouseOver:function(e){if(e.target!=this.el.dom&&!e.within(this.el)){if(this.monitoringMouseOver){Ext.getDoc().un('mouseover',this.monitorMouseOver,this);this.monitoringMouseOver=false;}
this.onMouseOut(e);}},onMouseOut:function(e){var internal=e.within(this.el)&&e.target!=this.el.dom;this.el.removeClass("x-btn-over");this.fireEvent('mouseout',this,e);if(this.isMenuTriggerOut(e,internal)){this.fireEvent('menutriggerout',this,this.menu,e);}},onFocus:function(e){if(!this.disabled){this.el.addClass("x-btn-focus");}},onBlur:function(e){this.el.removeClass("x-btn-focus");},getClickEl:function(e,isUp){return this.el;},onMouseDown:function(e){if(!this.disabled&&e.button==0){this.getClickEl(e).addClass("x-btn-click");Ext.getDoc().on('mouseup',this.onMouseUp,this);}},onMouseUp:function(e){if(e.button==0){this.getClickEl(e,true).removeClass("x-btn-click");Ext.getDoc().un('mouseup',this.onMouseUp,this);}},onMenuShow:function(e){this.ignoreNextClick=0;this.el.addClass("x-btn-menu-active");this.fireEvent('menushow',this,this.menu);},onMenuHide:function(e){this.el.removeClass("x-btn-menu-active");this.ignoreNextClick=this.restoreClick.defer(250,this);this.fireEvent('menuhide',this,this.menu);},restoreClick:function(){this.ignoreNextClick=0;}});Ext.reg('button',Ext.Button);Ext.ButtonToggleMgr=function(){var groups={};function toggleGroup(btn,state){if(state){var g=groups[btn.toggleGroup];for(var i=0,l=g.length;i<l;i++){if(g[i]!=btn){g[i].toggle(false);}}}}
return{register:function(btn){if(!btn.toggleGroup){return;}
var g=groups[btn.toggleGroup];if(!g){g=groups[btn.toggleGroup]=[];}
g.push(btn);btn.on("toggle",toggleGroup);},unregister:function(btn){if(!btn.toggleGroup){return;}
var g=groups[btn.toggleGroup];if(g){g.remove(btn);btn.un("toggle",toggleGroup);}}};}();Ext.SplitButton=Ext.extend(Ext.Button,{arrowSelector:'button:last',initComponent:function(){Ext.SplitButton.superclass.initComponent.call(this);this.addEvents("arrowclick");},onRender:function(ct,position){var tpl=new Ext.Template('<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>','<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>','<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',"</tbody></table></td><td>",'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>','<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',"</tbody></table></td></tr></table>");var btn,targs=[this.text||'&#160;',this.type];if(position){btn=tpl.insertBefore(position,targs,true);}else{btn=tpl.append(ct,targs,true);}
var btnEl=btn.child(this.buttonSelector);this.initButtonEl(btn,btnEl);this.arrowBtnTable=btn.child("table:last");if(this.arrowTooltip){btn.child(this.arrowSelector).dom[this.tooltipType]=this.arrowTooltip;}},autoWidth:function(){if(this.el){var tbl=this.el.child("table:first");var tbl2=this.el.child("table:last");this.el.setWidth("auto");tbl.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var ib=this.el.child(this.buttonSelector);if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Ext.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}
if(this.minWidth){if((tbl.getWidth()+tbl2.getWidth())<this.minWidth){tbl.setWidth(this.minWidth-tbl2.getWidth());}}
this.el.setWidth(tbl.getWidth()+tbl2.getWidth());}},setArrowHandler:function(handler,scope){this.arrowHandler=handler;this.scope=scope;},onClick:function(e){e.preventDefault();if(!this.disabled){if(e.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){this.showMenu();}
this.fireEvent("arrowclick",this,e);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,e);}}else{if(this.enableToggle){this.toggle();}
this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}}},getClickEl:function(e,isUp){if(!isUp){return(this.lastClickEl=e.getTarget("table",10,true));}
return this.lastClickEl;},onDisable:function(){if(this.el){if(!Ext.isIE6){this.el.addClass("x-item-disabled");}
this.el.child(this.buttonSelector).dom.disabled=true;this.el.child(this.arrowSelector).dom.disabled=true;}
this.disabled=true;},onEnable:function(){if(this.el){if(!Ext.isIE6){this.el.removeClass("x-item-disabled");}
this.el.child(this.buttonSelector).dom.disabled=false;this.el.child(this.arrowSelector).dom.disabled=false;}
this.disabled=false;},isMenuTriggerOver:function(e){return this.menu&&e.within(this.arrowBtnTable)&&!e.within(this.arrowBtnTable,true);},isMenuTriggerOut:function(e,internal){return this.menu&&!e.within(this.arrowBtnTable);},onDestroy:function(){Ext.destroy(this.arrowBtnTable);Ext.SplitButton.superclass.onDestroy.call(this);}});Ext.MenuButton=Ext.SplitButton;Ext.reg('splitbutton',Ext.SplitButton);Ext.CycleButton=Ext.extend(Ext.SplitButton,{getItemText:function(item){if(item&&this.showText===true){var text='';if(this.prependText){text+=this.prependText;}
text+=item.text;return text;}
return undefined;},setActiveItem:function(item,suppressEvent){if(typeof item!='object'){item=this.menu.items.get(item);}
if(item){if(!this.rendered){this.text=this.getItemText(item);this.iconCls=item.iconCls;}else{var t=this.getItemText(item);if(t){this.setText(t);}
this.setIconClass(item.iconCls);}
this.activeItem=item;if(!item.checked){item.setChecked(true,true);}
if(this.forceIcon){this.setIconClass(this.forceIcon);}
if(!suppressEvent){this.fireEvent('change',this,item);}}},getActiveItem:function(){return this.activeItem;},initComponent:function(){this.addEvents("change");if(this.changeHandler){this.on('change',this.changeHandler,this.scope||this);delete this.changeHandler;}
this.itemCount=this.items.length;this.menu={cls:'x-cycle-menu',items:[]};var checked;for(var i=0,len=this.itemCount;i<len;i++){var item=this.items[i];item.group=item.group||this.id;item.itemIndex=i;item.checkHandler=this.checkHandler;item.scope=this;item.checked=item.checked||false;this.menu.items.push(item);if(item.checked){checked=item;}}
this.setActiveItem(checked,true);Ext.CycleButton.superclass.initComponent.call(this);this.on('click',this.toggleSelected,this);},checkHandler:function(item,pressed){if(pressed){this.setActiveItem(item);}},toggleSelected:function(){this.menu.render();var nextIdx,checkItem;for(var i=1;i<this.itemCount;i++){nextIdx=(this.activeItem.itemIndex+i)%this.itemCount;checkItem=this.menu.items.itemAt(nextIdx);if(!checkItem.disabled){checkItem.setChecked(true);break;}}}});Ext.reg('cycle',Ext.CycleButton);Ext.Toolbar=function(config){if(Ext.isArray(config)){config={buttons:config};}
Ext.Toolbar.superclass.constructor.call(this,config);};(function(){var T=Ext.Toolbar;Ext.extend(T,Ext.BoxComponent,{trackMenus:true,initComponent:function(){T.superclass.initComponent.call(this);if(this.items){this.buttons=this.items;}
this.items=new Ext.util.MixedCollection(false,function(o){return o.itemId||o.id||Ext.id();});},autoCreate:{cls:'x-toolbar x-small-editor',html:'<table cellspacing="0"><tr></tr></table>'},onRender:function(ct,position){this.el=ct.createChild(Ext.apply({id:this.id},this.autoCreate),position);this.tr=this.el.child("tr",true);},afterRender:function(){T.superclass.afterRender.call(this);if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i<l;i++){var el=a[i];if(el.isFormField){this.addField(el);}else if(el.render){this.addItem(el);}else if(typeof el=="string"){if(el=="separator"||el=="-"){this.addSeparator();}else if(el==" "){this.addSpacer();}else if(el=="->"){this.addFill();}else{this.addText(el);}}else if(el.tagName){this.addElement(el);}else if(typeof el=="object"){if(el.xtype){this.addField(Ext.ComponentMgr.create(el,'button'));}else{this.addButton(el);}}}},addSeparator:function(){return this.addItem(new T.Separator());},addSpacer:function(){return this.addItem(new T.Spacer());},addFill:function(){return this.addItem(new T.Fill());},addElement:function(el){return this.addItem(new T.Item(el));},addItem:function(item){var td=this.nextBlock();this.initMenuTracking(item);item.render(td);this.items.add(item);return item;},addButton:function(config){if(Ext.isArray(config)){var buttons=[];for(var i=0,len=config.length;i<len;i++){buttons.push(this.addButton(config[i]));}
return buttons;}
var b=config;if(!(config instanceof T.Button)){b=config.split?new T.SplitButton(config):new T.Button(config);}
var td=this.nextBlock();this.initMenuTracking(b);b.render(td);this.items.add(b);return b;},initMenuTracking:function(item){if(this.trackMenus&&item.menu){item.on({'menutriggerover':this.onButtonTriggerOver,'menushow':this.onButtonMenuShow,'menuhide':this.onButtonMenuHide,scope:this})}},addText:function(text){return this.addItem(new T.TextItem(text));},insertButton:function(index,item){if(Ext.isArray(item)){var buttons=[];for(var i=0,len=item.length;i<len;i++){buttons.push(this.insertButton(index+i,item[i]));}
return buttons;}
if(!(item instanceof T.Button)){item=new T.Button(item);}
var td=document.createElement("td");this.tr.insertBefore(td,this.tr.childNodes[index]);this.initMenuTracking(item);item.render(td);this.items.insert(index,item);return item;},addDom:function(config,returnEl){var td=this.nextBlock();Ext.DomHelper.overwrite(td,config);var ti=new T.Item(td.firstChild);ti.render(td);this.items.add(ti);return ti;},addField:function(field){var td=this.nextBlock();field.render(td);var ti=new T.Item(td.firstChild);ti.render(td);this.items.add(field);return ti;},nextBlock:function(){var td=document.createElement("td");this.tr.appendChild(td);return td;},onDestroy:function(){Ext.Toolbar.superclass.onDestroy.call(this);if(this.rendered){if(this.items){Ext.destroy.apply(Ext,this.items.items);}
Ext.Element.uncache(this.tr);}},onDisable:function(){this.items.each(function(item){if(item.disable){item.disable();}});},onEnable:function(){this.items.each(function(item){if(item.enable){item.enable();}});},onButtonTriggerOver:function(btn){if(this.activeMenuBtn&&this.activeMenuBtn!=btn){this.activeMenuBtn.hideMenu();btn.showMenu();this.activeMenuBtn=btn;}},onButtonMenuShow:function(btn){this.activeMenuBtn=btn;},onButtonMenuHide:function(btn){delete this.activeMenuBtn;}});Ext.reg('toolbar',Ext.Toolbar);T.Item=function(el){this.el=Ext.getDom(el);this.id=Ext.id(this.el);this.hidden=false;};T.Item.prototype={getEl:function(){return this.el;},render:function(td){this.td=td;td.appendChild(this.el);},destroy:function(){if(this.td&&this.td.parentNode){this.td.parentNode.removeChild(this.td);}},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},setVisible:function(visible){if(visible){this.show();}else{this.hide();}},focus:function(){Ext.fly(this.el).focus();},disable:function(){Ext.fly(this.td).addClass("x-item-disabled");this.disabled=true;this.el.disabled=true;},enable:function(){Ext.fly(this.td).removeClass("x-item-disabled");this.disabled=false;this.el.disabled=false;}};Ext.reg('tbitem',T.Item);T.Separator=function(){var s=document.createElement("span");s.className="ytb-sep";T.Separator.superclass.constructor.call(this,s);};Ext.extend(T.Separator,T.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg('tbseparator',T.Separator);T.Spacer=function(){var s=document.createElement("div");s.className="ytb-spacer";T.Spacer.superclass.constructor.call(this,s);};Ext.extend(T.Spacer,T.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg('tbspacer',T.Spacer);T.Fill=Ext.extend(T.Spacer,{render:function(td){td.style.width='100%';T.Fill.superclass.render.call(this,td);}});Ext.reg('tbfill',T.Fill);T.TextItem=function(t){var s=document.createElement("span");s.className="ytb-text";s.innerHTML=t.text?t.text:t;T.TextItem.superclass.constructor.call(this,s);};Ext.extend(T.TextItem,T.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg('tbtext',T.TextItem);T.Button=Ext.extend(Ext.Button,{hideParent:true,onDestroy:function(){T.Button.superclass.onDestroy.call(this);if(this.container){this.container.remove();}}});Ext.reg('tbbutton',T.Button);T.SplitButton=Ext.extend(Ext.SplitButton,{hideParent:true,onDestroy:function(){T.SplitButton.superclass.onDestroy.call(this);if(this.container){this.container.remove();}}});Ext.reg('tbsplit',T.SplitButton);T.MenuButton=T.SplitButton;})();Ext.PagingToolbar=Ext.extend(Ext.Toolbar,{pageSize:20,displayMsg:'Displaying {0} - {1} of {2}',emptyMsg:'No data to display',beforePageText:"Page",afterPageText:"of {0}",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",lastText:"Last Page",refreshText:"Refresh",paramNames:{start:'start',limit:'limit'},initComponent:function(){this.addEvents('change','beforechange');Ext.PagingToolbar.superclass.initComponent.call(this);this.cursor=0;this.bind(this.store);},onRender:function(ct,position){Ext.PagingToolbar.superclass.onRender.call(this,ct,position);this.first=this.addButton({tooltip:this.firstText,iconCls:"x-tbar-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,iconCls:"x-tbar-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])});this.addSeparator();this.add(this.beforePageText);this.field=Ext.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-tbar-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.afterTextEl=this.addText(String.format(this.afterPageText,1));this.field.setHeight(18);this.addSeparator();this.next=this.addButton({tooltip:this.nextText,iconCls:"x-tbar-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});this.last=this.addButton({tooltip:this.lastText,iconCls:"x-tbar-page-last",disabled:true,handler:this.onClick.createDelegate(this,["last"])});this.addSeparator();this.loading=this.addButton({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});}
if(this.dsLoaded){this.onLoad.apply(this,this.dsLoaded);}},updateInfo:function(){if(this.displayEl){var count=this.store.getCount();var msg=count==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+count-1,this.store.getTotalCount());this.displayEl.update(msg);}},onLoad:function(store,r,o){if(!this.rendered){this.dsLoaded=[store,r,o];return;}
this.cursor=o.params?o.params[this.paramNames.start]:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,d.pages);this.field.dom.value=ap;this.first.setDisabled(ap==1);this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();this.fireEvent('change',this,d);},getPageData:function(){var total=this.store.getTotalCount();return{total:total,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:total<this.pageSize?1:Math.ceil(total/this.pageSize)};},onLoadError:function(){if(!this.rendered){return;}
this.loading.enable();},readPage:function(d){var v=this.field.dom.value,pageNum;if(!v||isNaN(pageNum=parseInt(v,10))){this.field.dom.value=d.activePage;return false;}
return pageNum;},onPagingKeydown:function(e){var k=e.getKey(),d=this.getPageData(),pageNum;if(k==e.RETURN){e.stopEvent();pageNum=this.readPage(d);if(pageNum!==false){pageNum=Math.min(Math.max(1,pageNum),d.pages)-1;this.doLoad(pageNum*this.pageSize);}}else if(k==e.HOME||k==e.END){e.stopEvent();pageNum=k==e.HOME?1:d.pages;this.field.dom.value=pageNum;}else if(k==e.UP||k==e.PAGEUP||k==e.DOWN||k==e.PAGEDOWN){e.stopEvent();if(pageNum=this.readPage(d)){var increment=e.shiftKey?10:1;if(k==e.DOWN||k==e.PAGEDOWN){increment*=-1;}
pageNum+=increment;if(pageNum>=1&pageNum<=d.pages){this.field.dom.value=pageNum;}}}},beforeLoad:function(){if(this.rendered&&this.loading){this.loading.disable();}},doLoad:function(start){var o={},pn=this.paramNames;o[pn.start]=start;o[pn.limit]=this.pageSize;if(this.fireEvent('beforechange',this,o)!==false){this.store.load({params:o});}},changePage:function(page){this.doLoad(((page-1)*this.pageSize).constrain(0,this.store.getTotalCount()));},onClick:function(which){var store=this.store;switch(which){case"first":this.doLoad(0);break;case"prev":this.doLoad(Math.max(0,this.cursor-this.pageSize));break;case"next":this.doLoad(this.cursor+this.pageSize);break;case"last":var total=store.getTotalCount();var extra=total%this.pageSize;var lastStart=extra?(total-extra):total-this.pageSize;this.doLoad(lastStart);break;case"refresh":this.doLoad(this.cursor);break;}},unbind:function(store){store=Ext.StoreMgr.lookup(store);store.un("beforeload",this.beforeLoad,this);store.un("load",this.onLoad,this);store.un("loadexception",this.onLoadError,this);this.store=undefined;},bind:function(store){store=Ext.StoreMgr.lookup(store);store.on("beforeload",this.beforeLoad,this);store.on("load",this.onLoad,this);store.on("loadexception",this.onLoadError,this);this.store=store;}});Ext.reg('paging',Ext.PagingToolbar);Ext.Resizable=function(el,config){this.el=Ext.get(el);if(config&&config.wrap){config.resizeChild=this.el;this.el=this.el.wrap(typeof config.wrap=="object"?config.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=config.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(config.resizeChild.getPositioning());config.resizeChild.clearPositioning();if(!config.width||!config.height){var csize=config.resizeChild.getSize();this.el.setSize(csize.width,csize.height);}
if(config.pinned&&!config.adjustments){config.adjustments="auto";}}
this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"},Ext.getBody());this.proxy.unselectable();this.proxy.enableDisplayMode('block');Ext.apply(this,config);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned");}
var position=this.el.getStyle("position");if(position!="absolute"&&position!="fixed"){this.el.setStyle("position","relative");}
if(!this.handles){this.handles='s,e,se';if(this.multiDirectional){this.handles+=',n,w';}}
if(this.handles=="all"){this.handles="n s e w ne nw se sw";}
var hs=this.handles.split(/\s*?[,;]\s*?| /);var ps=Ext.Resizable.positions;for(var i=0,len=hs.length;i<len;i++){if(hs[i]&&ps[hs[i]]){var pos=ps[hs[i]];this[pos]=new Ext.Resizable.Handle(this,pos,this.disableTrackOver,this.transparent);}}
this.corner=this.southeast;if(this.handles.indexOf("n")!=-1||this.handles.indexOf("w")!=-1){this.updateBox=true;}
this.activeHandle=null;if(this.resizeChild){if(typeof this.resizeChild=="boolean"){this.resizeChild=Ext.get(this.el.dom.firstChild,true);}else{this.resizeChild=Ext.get(this.resizeChild,true);}}
if(this.adjustments=="auto"){var rc=this.resizeChild;var hw=this.west,he=this.east,hn=this.north,hs=this.south;if(rc&&(hw||hn)){rc.position("relative");rc.setLeft(hw?hw.el.getWidth():0);rc.setTop(hn?hn.el.getHeight():0);}
this.adjustments=[(he?-he.el.getWidth():0)+(hw?-hw.el.getWidth():0),(hn?-hn.el.getHeight():0)+(hs?-hs.el.getHeight():0)-1];}
if(this.draggable){this.dd=this.dynamic?this.el.initDD(null):this.el.initDDProxy(null,{dragElId:this.proxy.id});this.dd.setHandleElId(this.resizeChild?this.resizeChild.id:this.el.id);}
this.addEvents("beforeresize","resize");if(this.width!==null&&this.height!==null){this.resizeTo(this.width,this.height);}else{this.updateChildSize();}
if(Ext.isIE){this.el.dom.style.zoom=1;}
Ext.Resizable.superclass.constructor.call(this);};Ext.extend(Ext.Resizable,Ext.util.Observable,{resizeChild:false,adjustments:[0,0],minWidth:5,minHeight:5,maxWidth:10000,maxHeight:10000,enabled:true,animate:false,duration:.35,dynamic:false,handles:false,multiDirectional:false,disableTrackOver:false,easing:'easeOutStrong',widthIncrement:0,heightIncrement:0,pinned:false,width:null,height:null,preserveRatio:false,transparent:false,minX:0,minY:0,draggable:false,resizeTo:function(width,height){this.el.setSize(width,height);this.updateChildSize();this.fireEvent("resize",this,width,height,null);},startSizing:function(e,handle){this.fireEvent("beforeresize",this,e);if(this.enabled){if(!this.overlay){this.overlay=this.el.createProxy({tag:"div",cls:"x-resizable-overlay",html:"&#160;"},Ext.getBody());this.overlay.unselectable();this.overlay.enableDisplayMode("block");this.overlay.on("mousemove",this.onMouseMove,this);this.overlay.on("mouseup",this.onMouseUp,this);}
this.overlay.setStyle("cursor",handle.el.getStyle("cursor"));this.resizing=true;this.startBox=this.el.getBox();this.startPoint=e.getXY();this.offsets=[(this.startBox.x+this.startBox.width)-this.startPoint[0],(this.startBox.y+this.startBox.height)-this.startPoint[1]];this.overlay.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.overlay.show();if(this.constrainTo){var ct=Ext.get(this.constrainTo);this.resizeRegion=ct.getRegion().adjust(ct.getFrameWidth('t'),ct.getFrameWidth('l'),-ct.getFrameWidth('b'),-ct.getFrameWidth('r'));}
this.proxy.setStyle('visibility','hidden');this.proxy.show();this.proxy.setBox(this.startBox);if(!this.dynamic){this.proxy.setStyle('visibility','visible');}}},onMouseDown:function(handle,e){if(this.enabled){e.stopEvent();this.activeHandle=handle;this.startSizing(e,handle);}},onMouseUp:function(e){var size=this.resizeElement();this.resizing=false;this.handleOut();this.overlay.hide();this.proxy.hide();this.fireEvent("resize",this,size.width,size.height,e);},updateChildSize:function(){if(this.resizeChild){var el=this.el;var child=this.resizeChild;var adj=this.adjustments;if(el.dom.offsetWidth){var b=el.getSize(true);child.setSize(b.width+adj[0],b.height+adj[1]);}
if(Ext.isIE){setTimeout(function(){if(el.dom.offsetWidth){var b=el.getSize(true);child.setSize(b.width+adj[0],b.height+adj[1]);}},10);}}},snap:function(value,inc,min){if(!inc||!value)return value;var newValue=value;var m=value%inc;if(m>0){if(m>(inc/2)){newValue=value+(inc-m);}else{newValue=value-m;}}
return Math.max(min,newValue);},resizeElement:function(){var box=this.proxy.getBox();if(this.updateBox){this.el.setBox(box,false,this.animate,this.duration,null,this.easing);}else{this.el.setSize(box.width,box.height,this.animate,this.duration,null,this.easing);}
this.updateChildSize();if(!this.dynamic){this.proxy.hide();}
return box;},constrain:function(v,diff,m,mx){if(v-diff<m){diff=v-m;}else if(v-diff>mx){diff=mx-v;}
return diff;},onMouseMove:function(e){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(e.getPoint())){return;}
var curSize=this.curSize||this.startBox;var x=this.startBox.x,y=this.startBox.y;var ox=x,oy=y;var w=curSize.width,h=curSize.height;var ow=w,oh=h;var mw=this.minWidth,mh=this.minHeight;var mxw=this.maxWidth,mxh=this.maxHeight;var wi=this.widthIncrement;var hi=this.heightIncrement;var eventXY=e.getXY();var diffX=-(this.startPoint[0]-Math.max(this.minX,eventXY[0]));var diffY=-(this.startPoint[1]-Math.max(this.minY,eventXY[1]));var pos=this.activeHandle.position;switch(pos){case"east":w+=diffX;w=Math.min(Math.max(mw,w),mxw);break;case"south":h+=diffY;h=Math.min(Math.max(mh,h),mxh);break;case"southeast":w+=diffX;h+=diffY;w=Math.min(Math.max(mw,w),mxw);h=Math.min(Math.max(mh,h),mxh);break;case"north":diffY=this.constrain(h,diffY,mh,mxh);y+=diffY;h-=diffY;break;case"west":diffX=this.constrain(w,diffX,mw,mxw);x+=diffX;w-=diffX;break;case"northeast":w+=diffX;w=Math.min(Math.max(mw,w),mxw);diffY=this.constrain(h,diffY,mh,mxh);y+=diffY;h-=diffY;break;case"northwest":diffX=this.constrain(w,diffX,mw,mxw);diffY=this.constrain(h,diffY,mh,mxh);y+=diffY;h-=diffY;x+=diffX;w-=diffX;break;case"southwest":diffX=this.constrain(w,diffX,mw,mxw);h+=diffY;h=Math.min(Math.max(mh,h),mxh);x+=diffX;w-=diffX;break;}
var sw=this.snap(w,wi,mw);var sh=this.snap(h,hi,mh);if(sw!=w||sh!=h){switch(pos){case"northeast":y-=sh-h;break;case"north":y-=sh-h;break;case"southwest":x-=sw-w;break;case"west":x-=sw-w;break;case"northwest":x-=sw-w;y-=sh-h;break;}
w=sw;h=sh;}
if(this.preserveRatio){switch(pos){case"southeast":case"east":h=oh*(w/ow);h=Math.min(Math.max(mh,h),mxh);w=ow*(h/oh);break;case"south":w=ow*(h/oh);w=Math.min(Math.max(mw,w),mxw);h=oh*(w/ow);break;case"northeast":w=ow*(h/oh);w=Math.min(Math.max(mw,w),mxw);h=oh*(w/ow);break;case"north":var tw=w;w=ow*(h/oh);w=Math.min(Math.max(mw,w),mxw);h=oh*(w/ow);x+=(tw-w)/2;break;case"southwest":h=oh*(w/ow);h=Math.min(Math.max(mh,h),mxh);var tw=w;w=ow*(h/oh);x+=tw-w;break;case"west":var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),mxh);y+=(th-h)/2;var tw=w;w=ow*(h/oh);x+=tw-w;break;case"northwest":var tw=w;var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),mxh);w=ow*(h/oh);y+=th-h;x+=tw-w;break;}}
this.proxy.setBounds(x,y,w,h);if(this.dynamic){this.resizeElement();}}catch(e){}}},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over");}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over");}},getEl:function(){return this.el;},getResizeChild:function(){return this.resizeChild;},destroy:function(removeEl){this.proxy.remove();if(this.overlay){this.overlay.removeAllListeners();this.overlay.remove();}
var ps=Ext.Resizable.positions;for(var k in ps){if(typeof ps[k]!="function"&&this[ps[k]]){var h=this[ps[k]];h.el.removeAllListeners();h.el.remove();}}
if(removeEl){this.el.update("");this.el.remove();}},syncHandleHeight:function(){var h=this.el.getHeight(true);if(this.west){this.west.el.setHeight(h);}
if(this.east){this.east.el.setHeight(h);}}});Ext.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast"};Ext.Resizable.Handle=function(rz,pos,disableTrackOver,transparent){if(!this.tpl){var tpl=Ext.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});tpl.compile();Ext.Resizable.Handle.prototype.tpl=tpl;}
this.position=pos;this.rz=rz;this.el=this.tpl.append(rz.el.dom,[this.position],true);this.el.unselectable();if(transparent){this.el.setOpacity(0);}
this.el.on("mousedown",this.onMouseDown,this);if(!disableTrackOver){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this);}};Ext.Resizable.Handle.prototype={afterResize:function(rz){},onMouseDown:function(e){this.rz.onMouseDown(this,e);},onMouseOver:function(e){this.rz.handleOver(this,e);},onMouseOut:function(e){this.rz.handleOut(this,e);}};Ext.Editor=function(field,config){this.field=field;Ext.Editor.superclass.constructor.call(this,config);};Ext.extend(Ext.Editor,Ext.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,swallowKeys:true,completeOnEnter:false,cancelOnEsc:false,updateEl:false,initComponent:function(){Ext.Editor.superclass.initComponent.call(this);this.addEvents("beforestartedit","startedit","beforecomplete","complete","canceledit","specialkey");},onRender:function(ct,position){this.el=new Ext.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain});this.el.setStyle("overflow",Ext.isGecko?"auto":"hidden");if(this.field.msgTarget!='title'){this.field.msgTarget='qtip';}
this.field.inEditor=true;this.field.render(this.el);if(Ext.isGecko){this.field.el.dom.setAttribute('autocomplete','off');}
this.field.on("specialkey",this.onSpecialKey,this);if(this.swallowKeys){this.field.el.swallowEvent(['keydown','keypress']);}
this.field.show();this.field.on("blur",this.onBlur,this);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1});}},onSpecialKey:function(field,e){var key=e.getKey();if(this.completeOnEnter&&key==e.ENTER){e.stopEvent();this.completeEdit();}else if(this.cancelOnEsc&&key==e.ESC){this.cancelEdit();}else{this.fireEvent('specialkey',field,e);}
if(this.field.triggerBlur&&(key==e.ENTER||key==e.ESC||key==e.TAB)){this.field.triggerBlur();}},startEdit:function(el,value){if(this.editing){this.completeEdit();}
this.boundEl=Ext.get(el);var v=value!==undefined?value:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body);}
if(this.fireEvent("beforestartedit",this,this.boundEl,v)===false){return;}
this.startValue=v;this.field.setValue(v);this.doAutoSize();this.el.alignTo(this.boundEl,this.alignment);this.editing=true;this.show();},doAutoSize:function(){if(this.autoSize){var sz=this.boundEl.getSize();switch(this.autoSize){case"width":this.setSize(sz.width,"");break;case"height":this.setSize("",sz.height);break;default:this.setSize(sz.width,sz.height);}}},setSize:function(w,h){delete this.field.lastSize;this.field.setSize(w,h);if(this.el){if(Ext.isGecko2||Ext.isOpera){this.el.setSize(w,h);}
this.el.sync();}},realign:function(){this.el.alignTo(this.boundEl,this.alignment);},completeEdit:function(remainVisible){if(!this.editing){return;}
var v=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){v=this.startValue;this.cancelEdit(true);}
if(String(v)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return;}
if(this.fireEvent("beforecomplete",this,v,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(v);}
if(remainVisible!==true){this.hide();}
this.fireEvent("complete",this,v,this.startValue);}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide();}
this.field.show();if(Ext.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.deferredFocus.defer(50,this);}else{this.field.focus();}
this.fireEvent("startedit",this.boundEl,this.startValue);},deferredFocus:function(){if(this.editing){this.field.focus();}},cancelEdit:function(remainVisible){if(this.editing){var v=this.getValue();this.setValue(this.startValue);if(remainVisible!==true){this.hide();}
this.fireEvent("canceledit",this,v,this.startValue);}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit();}},onHide:function(){if(this.editing){this.completeEdit();return;}
this.field.blur();if(this.field.collapse){this.field.collapse();}
this.el.hide();if(this.hideEl!==false){this.boundEl.show();}},setValue:function(v){this.field.setValue(v);},getValue:function(){return this.field.getValue();},beforeDestroy:function(){this.field.destroy();this.field=null;}});Ext.reg('editor',Ext.Editor);Ext.MessageBox=function(){var dlg,opt,mask,waitTimer;var bodyEl,msgEl,textboxEl,textareaEl,progressBar,pp,iconEl,spacerEl;var buttons,activeTextEl,bwidth,iconCls='';var handleButton=function(button){if(dlg.isVisible()){dlg.hide();Ext.callback(opt.fn,opt.scope||window,[button,activeTextEl.dom.value],1);}};var handleHide=function(){if(opt&&opt.cls){dlg.el.removeClass(opt.cls);}
progressBar.reset();};var handleEsc=function(d,k,e){if(opt&&opt.closable!==false){dlg.hide();}
if(e){e.stopEvent();}};var updateButtons=function(b){var width=0;if(!b){buttons["ok"].hide();buttons["cancel"].hide();buttons["yes"].hide();buttons["no"].hide();return width;}
dlg.footer.dom.style.display='';for(var k in buttons){if(typeof buttons[k]!="function"){if(b[k]){buttons[k].show();buttons[k].setText(typeof b[k]=="string"?b[k]:Ext.MessageBox.buttonText[k]);width+=buttons[k].el.getWidth()+15;}else{buttons[k].hide();}}}
return width;};return{getDialog:function(titleText){if(!dlg){dlg=new Ext.Window({autoCreate:true,title:titleText,resizable:false,constrain:true,constrainHeader:true,minimizable:false,maximizable:false,stateful:false,modal:true,shim:true,buttonAlign:"center",width:400,height:100,minHeight:80,plain:true,footer:true,closable:true,close:function(){if(opt&&opt.buttons&&opt.buttons.no&&!opt.buttons.cancel){handleButton("no");}else{handleButton("cancel");}}});buttons={};var bt=this.buttonText;buttons["ok"]=dlg.addButton(bt["ok"],handleButton.createCallback("ok"));buttons["yes"]=dlg.addButton(bt["yes"],handleButton.createCallback("yes"));buttons["no"]=dlg.addButton(bt["no"],handleButton.createCallback("no"));buttons["cancel"]=dlg.addButton(bt["cancel"],handleButton.createCallback("cancel"));buttons["ok"].hideMode=buttons["yes"].hideMode=buttons["no"].hideMode=buttons["cancel"].hideMode='offsets';dlg.render(document.body);dlg.getEl().addClass('x-window-dlg');mask=dlg.mask;bodyEl=dlg.body.createChild({html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'});iconEl=Ext.get(bodyEl.dom.firstChild);var contentEl=bodyEl.dom.childNodes[1];msgEl=Ext.get(contentEl.firstChild);textboxEl=Ext.get(contentEl.childNodes[2].firstChild);textboxEl.enableDisplayMode();textboxEl.addKeyListener([10,13],function(){if(dlg.isVisible()&&opt&&opt.buttons){if(opt.buttons.ok){handleButton("ok");}else if(opt.buttons.yes){handleButton("yes");}}});textareaEl=Ext.get(contentEl.childNodes[2].childNodes[1]);textareaEl.enableDisplayMode();progressBar=new Ext.ProgressBar({renderTo:bodyEl});bodyEl.createChild({cls:'x-clear'});}
return dlg;},updateText:function(text){if(!dlg.isVisible()&&!opt.width){dlg.setSize(this.maxWidth,100);}
msgEl.update(text||'&#160;');var iw=iconCls!=''?(iconEl.getWidth()+iconEl.getMargins('lr')):0;var mw=msgEl.getWidth()+msgEl.getMargins('lr');var fw=dlg.getFrameWidth('lr');var bw=dlg.body.getFrameWidth('lr');if(Ext.isIE&&iw>0){iw+=3;}
var w=Math.max(Math.min(opt.width||iw+mw+fw+bw,this.maxWidth),Math.max(opt.minWidth||this.minWidth,bwidth||0));if(opt.prompt===true){activeTextEl.setWidth(w-iw-fw-bw);}
if(opt.progress===true||opt.wait===true){progressBar.setSize(w-iw-fw-bw);}
dlg.setSize(w,'auto').center();return this;},updateProgress:function(value,progressText,msg){progressBar.updateProgress(value,progressText);if(msg){this.updateText(msg);}
return this;},isVisible:function(){return dlg&&dlg.isVisible();},hide:function(){if(this.isVisible()){dlg.hide();handleHide();}
return this;},show:function(options){if(this.isVisible()){this.hide();}
opt=options;var d=this.getDialog(opt.title||"&#160;");d.setTitle(opt.title||"&#160;");var allowClose=(opt.closable!==false&&opt.progress!==true&&opt.wait!==true);d.tools.close.setDisplayed(allowClose);activeTextEl=textboxEl;opt.prompt=opt.prompt||(opt.multiline?true:false);if(opt.prompt){if(opt.multiline){textboxEl.hide();textareaEl.show();textareaEl.setHeight(typeof opt.multiline=="number"?opt.multiline:this.defaultTextHeight);activeTextEl=textareaEl;}else{textboxEl.show();textareaEl.hide();}}else{textboxEl.hide();textareaEl.hide();}
activeTextEl.dom.value=opt.value||"";if(opt.prompt){d.focusEl=activeTextEl;}else{var bs=opt.buttons;var db=null;if(bs&&bs.ok){db=buttons["ok"];}else if(bs&&bs.yes){db=buttons["yes"];}
if(db){d.focusEl=db;}}
if(opt.iconCls){d.setIconClass(opt.iconCls);}
this.setIcon(opt.icon);bwidth=updateButtons(opt.buttons);progressBar.setVisible(opt.progress===true||opt.wait===true);this.updateProgress(0,opt.progressText);this.updateText(opt.msg);if(opt.cls){d.el.addClass(opt.cls);}
d.proxyDrag=opt.proxyDrag===true;d.modal=opt.modal!==false;d.mask=opt.modal!==false?mask:false;if(!d.isVisible()){document.body.appendChild(dlg.el.dom);d.setAnimateTarget(opt.animEl);d.show(opt.animEl);}
d.on('show',function(){if(allowClose===true){d.keyMap.enable();}else{d.keyMap.disable();}},this,{single:true});if(opt.wait===true){progressBar.wait(opt.waitConfig);}
return this;},setIcon:function(icon){if(icon&&icon!=''){iconEl.removeClass('x-hidden');iconEl.replaceClass(iconCls,icon);iconCls=icon;}else{iconEl.replaceClass(iconCls,'x-hidden');iconCls='';}
return this;},progress:function(title,msg,progressText){this.show({title:title,msg:msg,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,progressText:progressText});return this;},wait:function(msg,title,config){this.show({title:title,msg:msg,buttons:false,closable:false,wait:true,modal:true,minWidth:this.minProgressWidth,waitConfig:config});return this;},alert:function(title,msg,fn,scope){this.show({title:title,msg:msg,buttons:this.OK,fn:fn,scope:scope});return this;},confirm:function(title,msg,fn,scope){this.show({title:title,msg:msg,buttons:this.YESNO,fn:fn,scope:scope,icon:this.QUESTION});return this;},prompt:function(title,msg,fn,scope,multiline,value){this.show({title:title,msg:msg,buttons:this.OKCANCEL,fn:fn,minWidth:250,scope:scope,prompt:true,multiline:multiline,value:value});return this;},OK:{ok:true},CANCEL:{cancel:true},OKCANCEL:{ok:true,cancel:true},YESNO:{yes:true,no:true},YESNOCANCEL:{yes:true,no:true,cancel:true},INFO:'ext-mb-info',WARNING:'ext-mb-warning',QUESTION:'ext-mb-question',ERROR:'ext-mb-error',defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}};}();Ext.Msg=Ext.MessageBox;Ext.Tip=Ext.extend(Ext.Panel,{minWidth:40,maxWidth:300,shadow:"sides",defaultAlign:"tl-bl?",autoRender:true,quickShowInterval:250,frame:true,hidden:true,baseCls:'x-tip',floating:{shadow:true,shim:true,useDisplay:true,constrain:false},autoHeight:true,initComponent:function(){Ext.Tip.superclass.initComponent.call(this);if(this.closable&&!this.title){this.elements+=',header';}},afterRender:function(){Ext.Tip.superclass.afterRender.call(this);if(this.closable){this.addTool({id:'close',handler:this.hide,scope:this});}},showAt:function(xy){Ext.Tip.superclass.show.call(this);if(this.measureWidth!==false&&(!this.initialConfig||typeof this.initialConfig.width!='number')){this.doAutoWidth();}
if(this.constrainPosition){xy=this.el.adjustForConstraints(xy);}
this.setPagePosition(xy[0],xy[1]);},doAutoWidth:function(){var bw=this.body.getTextWidth();if(this.title){bw=Math.max(bw,this.header.child('span').getTextWidth(this.title));}
bw+=this.getFrameWidth()+(this.closable?20:0)+this.body.getPadding("lr");this.setWidth(bw.constrain(this.minWidth,this.maxWidth));if(Ext.isIE7&&!this.repainted){this.el.repaint();this.repainted=true;}},showBy:function(el,pos){if(!this.rendered){this.render(Ext.getBody());}
this.showAt(this.el.getAlignToXY(el,pos||this.defaultAlign));},initDraggable:function(){this.dd=new Ext.Tip.DD(this,typeof this.draggable=='boolean'?null:this.draggable);this.header.addClass('x-tip-draggable');}});Ext.Tip.DD=function(tip,config){Ext.apply(this,config);this.tip=tip;Ext.Tip.DD.superclass.constructor.call(this,tip.el.id,'WindowDD-'+tip.id);this.setHandleElId(tip.header.id);this.scroll=false;};Ext.extend(Ext.Tip.DD,Ext.dd.DD,{moveOnly:true,scroll:false,headerOffsets:[100,25],startDrag:function(){this.tip.el.disableShadow();},endDrag:function(e){this.tip.el.enableShadow(true);}});Ext.ToolTip=Ext.extend(Ext.Tip,{showDelay:500,hideDelay:200,dismissDelay:5000,mouseOffset:[15,18],trackMouse:false,constrainPosition:true,initComponent:function(){Ext.ToolTip.superclass.initComponent.call(this);this.lastActive=new Date();this.initTarget();},initTarget:function(){if(this.target){this.target=Ext.get(this.target);this.target.on('mouseover',this.onTargetOver,this);this.target.on('mouseout',this.onTargetOut,this);this.target.on('mousemove',this.onMouseMove,this);}},onMouseMove:function(e){this.targetXY=e.getXY();if(!this.hidden&&this.trackMouse){this.setPagePosition(this.getTargetXY());}},getTargetXY:function(){return[this.targetXY[0]+this.mouseOffset[0],this.targetXY[1]+this.mouseOffset[1]];},onTargetOver:function(e){if(this.disabled||e.within(this.target.dom,true)){return;}
this.clearTimer('hide');this.targetXY=e.getXY();this.delayShow();},delayShow:function(){if(this.hidden&&!this.showTimer){if(this.lastActive.getElapsed()<this.quickShowInterval){this.show();}else{this.showTimer=this.show.defer(this.showDelay,this);}}else if(!this.hidden&&this.autoHide!==false){this.show();}},onTargetOut:function(e){if(this.disabled||e.within(this.target.dom,true)){return;}
this.clearTimer('show');if(this.autoHide!==false){this.delayHide();}},delayHide:function(){if(!this.hidden&&!this.hideTimer){this.hideTimer=this.hide.defer(this.hideDelay,this);}},hide:function(){this.clearTimer('dismiss');this.lastActive=new Date();Ext.ToolTip.superclass.hide.call(this);},show:function(){this.showAt(this.getTargetXY());},showAt:function(xy){this.lastActive=new Date();this.clearTimers();Ext.ToolTip.superclass.showAt.call(this,xy);if(this.dismissDelay&&this.autoHide!==false){this.dismissTimer=this.hide.defer(this.dismissDelay,this);}},clearTimer:function(name){name=name+'Timer';clearTimeout(this[name]);delete this[name];},clearTimers:function(){this.clearTimer('show');this.clearTimer('dismiss');this.clearTimer('hide');},onShow:function(){Ext.ToolTip.superclass.onShow.call(this);Ext.getDoc().on('mousedown',this.onDocMouseDown,this);},onHide:function(){Ext.ToolTip.superclass.onHide.call(this);Ext.getDoc().un('mousedown',this.onDocMouseDown,this);},onDocMouseDown:function(e){if(this.autoHide!==false&&!e.within(this.el.dom)){this.disable();this.enable.defer(100,this);}},onDisable:function(){this.clearTimers();this.hide();},adjustPosition:function(x,y){var ay=this.targetXY[1],h=this.getSize().height;if(this.constrainPosition&&y<=ay&&(y+h)>=ay){y=ay-h-5;}
return{x:x,y:y};},onDestroy:function(){Ext.ToolTip.superclass.onDestroy.call(this);if(this.target){this.target.un('mouseover',this.onTargetOver,this);this.target.un('mouseout',this.onTargetOut,this);this.target.un('mousemove',this.onMouseMove,this);}}});Ext.QuickTip=Ext.extend(Ext.ToolTip,{interceptTitles:false,tagConfig:{namespace:"ext",attribute:"qtip",width:"qwidth",target:"target",title:"qtitle",hide:"hide",cls:"qclass",align:"qalign"},initComponent:function(){this.target=this.target||Ext.getDoc();this.targets=this.targets||{};Ext.QuickTip.superclass.initComponent.call(this);},register:function(config){var cs=Ext.isArray(config)?config:arguments;for(var i=0,len=cs.length;i<len;i++){var c=cs[i];var target=c.target;if(target){if(Ext.isArray(target)){for(var j=0,jlen=target.length;j<jlen;j++){this.targets[Ext.id(target[j])]=c;}}else{this.targets[Ext.id(target)]=c;}}}},unregister:function(el){delete this.targets[Ext.id(el)];},onTargetOver:function(e){if(this.disabled){return;}
this.targetXY=e.getXY();var t=e.getTarget();if(!t||t.nodeType!==1||t==document||t==document.body){return;}
if(this.activeTarget&&t==this.activeTarget.el){this.clearTimer('hide');this.show();return;}
if(t&&this.targets[t.id]){this.activeTarget=this.targets[t.id];this.activeTarget.el=t;this.delayShow();return;}
var ttp,et=Ext.fly(t),cfg=this.tagConfig;var ns=cfg.namespace;if(this.interceptTitles&&t.title){ttp=t.title;t.qtip=ttp;t.removeAttribute("title");e.preventDefault();}else{ttp=t.qtip||et.getAttributeNS(ns,cfg.attribute);}
if(ttp){var autoHide=et.getAttributeNS(ns,cfg.hide);this.activeTarget={el:t,text:ttp,width:et.getAttributeNS(ns,cfg.width),autoHide:autoHide!="user"&&autoHide!=='false',title:et.getAttributeNS(ns,cfg.title),cls:et.getAttributeNS(ns,cfg.cls),align:et.getAttributeNS(ns,cfg.align)};this.delayShow();}},onTargetOut:function(e){this.clearTimer('show');if(this.autoHide!==false){this.delayHide();}},showAt:function(xy){var t=this.activeTarget;if(t){if(!this.rendered){this.render(Ext.getBody());this.activeTarget=t;}
if(t.width){this.setWidth(t.width);this.body.setWidth(this.adjustBodyWidth(t.width-this.getFrameWidth()));this.measureWidth=false;}else{this.measureWidth=true;}
this.setTitle(t.title||'');this.body.update(t.text);this.autoHide=t.autoHide;this.dismissDelay=t.dismissDelay||this.dismissDelay;if(this.lastCls){this.el.removeClass(this.lastCls);delete this.lastCls;}
if(t.cls){this.el.addClass(t.cls);this.lastCls=t.cls;}
if(t.align){xy=this.el.getAlignToXY(t.el,t.align);this.constrainPosition=false;}else{this.constrainPosition=true;}}
Ext.QuickTip.superclass.showAt.call(this,xy);},hide:function(){delete this.activeTarget;Ext.QuickTip.superclass.hide.call(this);}});Ext.QuickTips=function(){var tip,locks=[];return{init:function(autoRender){if(!tip){if(!Ext.isReady){Ext.onReady(function(){Ext.QuickTips.init(autoRender);});return;}
tip=new Ext.QuickTip({elements:'header,body'});if(autoRender!==false){tip.render(Ext.getBody());}}},enable:function(){if(tip){locks.pop();if(locks.length<1){tip.enable();}}},disable:function(){if(tip){tip.disable();}
locks.push(1);},isEnabled:function(){return tip!==undefined&&!tip.disabled;},getQuickTip:function(){return tip;},register:function(){tip.register.apply(tip,arguments);},unregister:function(){tip.unregister.apply(tip,arguments);},tips:function(){tip.register.apply(tip,arguments);}}}();Ext.tree.TreePanel=Ext.extend(Ext.Panel,{rootVisible:true,animate:Ext.enableFx,lines:true,enableDD:false,hlDrop:Ext.enableFx,pathSeparator:"/",initComponent:function(){Ext.tree.TreePanel.superclass.initComponent.call(this);if(!this.eventModel){this.eventModel=new Ext.tree.TreeEventModel(this);}
var l=this.loader;if(!l){l=new Ext.tree.TreeLoader({dataUrl:this.dataUrl});}else if(typeof l=='object'&&!l.load){l=new Ext.tree.TreeLoader(l);}
this.loader=l;this.nodeHash={};if(this.root){this.setRootNode(this.root);}
this.addEvents("append","remove","movenode","insert","beforeappend","beforeremove","beforemovenode","beforeinsert","beforeload","load","textchange","beforeexpandnode","beforecollapsenode","expandnode","disabledchange","collapsenode","beforeclick","click","checkchange","dblclick","contextmenu","beforechildrenrendered","startdrag","enddrag","dragdrop","beforenodedrop","nodedrop","nodedragover");if(this.singleExpand){this.on("beforeexpandnode",this.restrictExpand,this);}},proxyNodeEvent:function(ename,a1,a2,a3,a4,a5,a6){if(ename=='collapse'||ename=='expand'||ename=='beforecollapse'||ename=='beforeexpand'||ename=='move'||ename=='beforemove'){ename=ename+'node';}
return this.fireEvent(ename,a1,a2,a3,a4,a5,a6);},getRootNode:function(){return this.root;},setRootNode:function(node){if(!node.render){node=this.loader.createNode(node);}
this.root=node;node.ownerTree=this;node.isRoot=true;this.registerNode(node);if(!this.rootVisible){var uiP=node.attributes.uiProvider;node.ui=uiP?new uiP(node):new Ext.tree.RootTreeNodeUI(node);}
return node;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(node){this.nodeHash[node.id]=node;},unregisterNode:function(node){delete this.nodeHash[node.id];},toString:function(){return"[Tree"+(this.id?" "+this.id:"")+"]";},restrictExpand:function(node){var p=node.parentNode;if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}
p.expandedChild=node;}},getChecked:function(a,startNode){startNode=startNode||this.root;var r=[];var f=function(){if(this.attributes.checked){r.push(!a?this:(a=='id'?this.id:this.attributes[a]));}}
startNode.cascade(f);return r;},getEl:function(){return this.el;},getLoader:function(){return this.loader;},expandAll:function(){this.root.expand(true);},collapseAll:function(){this.root.collapse(true);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Ext.tree.DefaultSelectionModel();}
return this.selModel;},expandPath:function(path,attr,callback){attr=attr||"id";var keys=path.split(this.pathSeparator);var curNode=this.root;if(curNode.attributes[attr]!=keys[1]){if(callback){callback(false,null);}
return;}
var index=1;var f=function(){if(++index==keys.length){if(callback){callback(true,curNode);}
return;}
var c=curNode.findChild(attr,keys[index]);if(!c){if(callback){callback(false,curNode);}
return;}
curNode=c;c.expand(false,false,f);};curNode.expand(false,false,f);},selectPath:function(path,attr,callback){attr=attr||"id";var keys=path.split(this.pathSeparator);var v=keys.pop();if(keys.length>0){var f=function(success,node){if(success&&node){var n=node.findChild(attr,v);if(n){n.select();if(callback){callback(true,n);}}else if(callback){callback(false,n);}}else{if(callback){callback(false,n);}}};this.expandPath(keys.join(this.pathSeparator),attr,f);}else{this.root.select();if(callback){callback(true,this.root);}}},getTreeEl:function(){return this.body;},onRender:function(ct,position){Ext.tree.TreePanel.superclass.onRender.call(this,ct,position);this.el.addClass('x-tree');this.innerCt=this.body.createChild({tag:"ul",cls:"x-tree-root-ct "+
(this.useArrows?'x-tree-arrows':this.lines?"x-tree-lines":"x-tree-no-lines")});},initEvents:function(){Ext.tree.TreePanel.superclass.initEvents.call(this);if(this.containerScroll){Ext.dd.ScrollManager.register(this.body);}
if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Ext.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}
if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Ext.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll});}
this.getSelectionModel().init(this);},afterRender:function(){Ext.tree.TreePanel.superclass.afterRender.call(this);this.root.render();if(!this.rootVisible){this.root.renderChildren();}},onDestroy:function(){if(this.rendered){this.body.removeAllListeners();Ext.dd.ScrollManager.unregister(this.body);if(this.dropZone){this.dropZone.unreg();}
if(this.dragZone){this.dragZone.unreg();}}
this.root.destroy();this.nodeHash=null;Ext.tree.TreePanel.superclass.onDestroy.call(this);}});Ext.tree.TreePanel.nodeTypes={};Ext.reg('treepanel',Ext.tree.TreePanel);Ext.tree.TreeEventModel=function(tree){this.tree=tree;this.tree.on('render',this.initEvents,this);}
Ext.tree.TreeEventModel.prototype={initEvents:function(){var el=this.tree.getTreeEl();el.on('click',this.delegateClick,this);if(this.tree.trackMouseOver!==false){el.on('mouseover',this.delegateOver,this);el.on('mouseout',this.delegateOut,this);}
el.on('dblclick',this.delegateDblClick,this);el.on('contextmenu',this.delegateContextMenu,this);},getNode:function(e){var t;if(t=e.getTarget('.x-tree-node-el',10)){var id=Ext.fly(t,'_treeEvents').getAttributeNS('ext','tree-node-id');if(id){return this.tree.getNodeById(id);}}
return null;},getNodeTarget:function(e){var t=e.getTarget('.x-tree-node-icon',1);if(!t){t=e.getTarget('.x-tree-node-el',6);}
return t;},delegateOut:function(e,t){if(!this.beforeEvent(e)){return;}
if(e.getTarget('.x-tree-ec-icon',1)){var n=this.getNode(e);this.onIconOut(e,n);if(n==this.lastEcOver){delete this.lastEcOver;}}
if((t=this.getNodeTarget(e))&&!e.within(t,true)){this.onNodeOut(e,this.getNode(e));}},delegateOver:function(e,t){if(!this.beforeEvent(e)){return;}
if(this.lastEcOver){this.onIconOut(e,this.lastEcOver);delete this.lastEcOver;}
if(e.getTarget('.x-tree-ec-icon',1)){this.lastEcOver=this.getNode(e);this.onIconOver(e,this.lastEcOver);}
if(t=this.getNodeTarget(e)){this.onNodeOver(e,this.getNode(e));}},delegateClick:function(e,t){if(!this.beforeEvent(e)){return;}
if(e.getTarget('input[type=checkbox]',1)){this.onCheckboxClick(e,this.getNode(e));}
else if(e.getTarget('.x-tree-ec-icon',1)){this.onIconClick(e,this.getNode(e));}
else if(this.getNodeTarget(e)){this.onNodeClick(e,this.getNode(e));}},delegateDblClick:function(e,t){if(this.beforeEvent(e)&&this.getNodeTarget(e)){this.onNodeDblClick(e,this.getNode(e));}},delegateContextMenu:function(e,t){if(this.beforeEvent(e)&&this.getNodeTarget(e)){this.onNodeContextMenu(e,this.getNode(e));}},onNodeClick:function(e,node){node.ui.onClick(e);},onNodeOver:function(e,node){node.ui.onOver(e);},onNodeOut:function(e,node){node.ui.onOut(e);},onIconOver:function(e,node){node.ui.addClass('x-tree-ec-over');},onIconOut:function(e,node){node.ui.removeClass('x-tree-ec-over');},onIconClick:function(e,node){node.ui.ecClick(e);},onCheckboxClick:function(e,node){node.ui.onCheckChange(e);},onNodeDblClick:function(e,node){node.ui.onDblClick(e);},onNodeContextMenu:function(e,node){node.ui.onContextMenu(e);},beforeEvent:function(e){if(this.disabled){e.stopEvent();return false;}
return true;},disable:function(){this.disabled=true;},enable:function(){this.disabled=false;}};Ext.tree.DefaultSelectionModel=function(config){this.selNode=null;this.addEvents("selectionchange","beforeselect");Ext.apply(this,config);Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{init:function(tree){this.tree=tree;tree.getTreeEl().on("keydown",this.onKeyDown,this);tree.on("click",this.onNodeClick,this);},onNodeClick:function(node,e){this.select(node);},select:function(node){var last=this.selNode;if(last!=node&&this.fireEvent('beforeselect',this,node,last)!==false){if(last){last.ui.onSelectedChange(false);}
this.selNode=node;node.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,node,last);}
return node;},unselect:function(node){if(this.selNode==node){this.clearSelections();}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null);}
return n;},getSelectedNode:function(){return this.selNode;},isSelected:function(node){return this.selNode==node;},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}
var ps=s.previousSibling;if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps);}else{var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild;}
return this.select(lc);}}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode);}
return null;},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}
if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild);}else if(s.nextSibling){return this.select(s.nextSibling);}else if(s.parentNode){var newS=null;s.parentNode.bubble(function(){if(this.nextSibling){newS=this.getOwnerTree().selModel.select(this.nextSibling);return false;}});return newS;}
return null;},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}
var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand();}else if(s.firstChild){this.select(s.firstChild,e);}}
break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse();}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e);}
break;};}});Ext.tree.MultiSelectionModel=function(config){this.selNodes=[];this.selMap={};this.addEvents("selectionchange");Ext.apply(this,config);Ext.tree.MultiSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{init:function(tree){this.tree=tree;tree.getTreeEl().on("keydown",this.onKeyDown,this);tree.on("click",this.onNodeClick,this);},onNodeClick:function(node,e){this.select(node,e,e.ctrlKey);},select:function(node,e,keepExisting){if(keepExisting!==true){this.clearSelections(true);}
if(this.isSelected(node)){this.lastSelNode=node;return node;}
this.selNodes.push(node);this.selMap[node.id]=node;this.lastSelNode=node;node.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return node;},unselect:function(node){if(this.selMap[node.id]){node.ui.onSelectedChange(false);var sn=this.selNodes;var index=sn.indexOf(node);if(index!=-1){this.selNodes.splice(index,1);}
delete this.selMap[node.id];this.fireEvent("selectionchange",this,this.selNodes);}},clearSelections:function(suppressEvent){var sn=this.selNodes;if(sn.length>0){for(var i=0,len=sn.length;i<len;i++){sn[i].ui.onSelectedChange(false);}
this.selNodes=[];this.selMap={};if(suppressEvent!==true){this.fireEvent("selectionchange",this,this.selNodes);}}},isSelected:function(node){return this.selMap[node.id]?true:false;},getSelectedNodes:function(){return this.selNodes;},onKeyDown:Ext.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Ext.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Ext.tree.DefaultSelectionModel.prototype.selectPrevious});Ext.tree.TreeNode=function(attributes){attributes=attributes||{};if(typeof attributes=="string"){attributes={text:attributes};}
this.childrenRendered=false;this.rendered=false;Ext.tree.TreeNode.superclass.constructor.call(this,attributes);this.expanded=attributes.expanded===true;this.isTarget=attributes.isTarget!==false;this.draggable=attributes.draggable!==false&&attributes.allowDrag!==false;this.allowChildren=attributes.allowChildren!==false&&attributes.allowDrop!==false;this.text=attributes.text;this.disabled=attributes.disabled===true;this.addEvents("textchange","beforeexpand","beforecollapse","expand","disabledchange","collapse","beforeclick","click","checkchange","dblclick","contextmenu","beforechildrenrendered");var uiClass=this.attributes.uiProvider||this.defaultUI||Ext.tree.TreeNodeUI;this.ui=new uiClass(this);};Ext.extend(Ext.tree.TreeNode,Ext.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},getLoader:function(){var owner;return this.loader||((owner=this.getOwnerTree())&&owner.loader?owner.loader:new Ext.tree.TreeLoader());},setFirstChild:function(node){var of=this.firstChild;Ext.tree.TreeNode.superclass.setFirstChild.call(this,node);if(this.childrenRendered&&of&&node!=of){of.renderIndent(true,true);}
if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(node){var ol=this.lastChild;Ext.tree.TreeNode.superclass.setLastChild.call(this,node);if(this.childrenRendered&&ol&&node!=ol){ol.renderIndent(true,true);}
if(this.rendered){this.renderIndent(true,true);}},appendChild:function(n){if(!n.render&&!Ext.isArray(n)){n=this.getLoader().createNode(n);}
var node=Ext.tree.TreeNode.superclass.appendChild.call(this,n);if(node&&this.childrenRendered){node.render();}
this.ui.updateExpandIcon();return node;},removeChild:function(node){this.ownerTree.getSelectionModel().unselect(node);Ext.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){node.ui.remove();}
if(this.childNodes.length<1){this.collapse(false,false);}else{this.ui.updateExpandIcon();}
if(!this.firstChild&&!this.isHiddenRoot()){this.childrenRendered=false;}
return node;},insertBefore:function(node,refNode){if(!node.render){node=this.getLoader().createNode(node);}
var newNode=Ext.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(newNode&&refNode&&this.childrenRendered){node.render();}
this.ui.updateExpandIcon();return newNode;},setText:function(text){var oldText=this.text;this.text=text;this.attributes.text=text;if(this.rendered){this.ui.onTextChange(this,text,oldText);}
this.fireEvent("textchange",this,text,oldText);},select:function(){this.getOwnerTree().getSelectionModel().select(this);},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this);},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this);},expand:function(deep,anim,callback){if(!this.expanded){if(this.fireEvent("beforeexpand",this,deep,anim)===false){return;}
if(!this.childrenRendered){this.renderChildren();}
this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&anim!==false)||anim){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof callback=="function"){callback(this);}
if(deep===true){this.expandChildNodes(true);}}.createDelegate(this));return;}else{this.ui.expand();this.fireEvent("expand",this);if(typeof callback=="function"){callback(this);}}}else{if(typeof callback=="function"){callback(this);}}
if(deep===true){this.expandChildNodes(true);}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible;},collapse:function(deep,anim){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,deep,anim)===false){return;}
this.expanded=false;if((this.getOwnerTree().animate&&anim!==false)||anim){this.ui.animCollapse(function(){this.fireEvent("collapse",this);if(deep===true){this.collapseChildNodes(true);}}.createDelegate(this));return;}else{this.ui.collapse();this.fireEvent("collapse",this);}}
if(deep===true){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].collapse(true,false);}}},delayedExpand:function(delay){if(!this.expandProcId){this.expandProcId=this.expand.defer(delay,this);}},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);}
this.expandProcId=false;},toggle:function(){if(this.expanded){this.collapse();}else{this.expand();}},ensureVisible:function(callback){var tree=this.getOwnerTree();tree.expandPath(this.parentNode.getPath(),false,function(){var node=tree.getNodeById(this.id);tree.getTreeEl().scrollChildIntoView(node.ui.anchor);Ext.callback(callback);}.createDelegate(this));},expandChildNodes:function(deep){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].expand(deep);}},collapseChildNodes:function(deep){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].collapse(deep);}},disable:function(){this.disabled=true;this.unselect();if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,true);}
this.fireEvent("disabledchange",this,true);},enable:function(){this.disabled=false;if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,false);}
this.fireEvent("disabledchange",this,false);},renderChildren:function(suppressEvent){if(suppressEvent!==false){this.fireEvent("beforechildrenrendered",this);}
var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].render(true);}
this.childrenRendered=true;},sort:function(fn,scope){Ext.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].render(true);}}},render:function(bulkRender){this.ui.render(bulkRender);if(!this.rendered){this.getOwnerTree().registerNode(this);this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false);}}},renderIndent:function(deep,refresh){if(refresh){this.ui.childIndent=null;}
this.ui.renderIndent();if(deep===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].renderIndent(true,refresh);}}},beginUpdate:function(){this.childrenRendered=false;},endUpdate:function(){if(this.expanded&&this.rendered){this.renderChildren();}},destroy:function(){if(this.childNodes){for(var i=0,l=this.childNodes.length;i<l;i++){this.childNodes[i].destroy();}
this.childNodes=null;}
if(this.ui.destroy){this.ui.destroy();}}});Ext.tree.TreePanel.nodeTypes.node=Ext.tree.TreeNode;Ext.tree.AsyncTreeNode=function(config){this.loaded=config&&config.loaded===true;this.loading=false;Ext.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents('beforeload','load');};Ext.extend(Ext.tree.AsyncTreeNode,Ext.tree.TreeNode,{expand:function(deep,anim,callback){if(this.loading){var timer;var f=function(){if(!this.loading){clearInterval(timer);this.expand(deep,anim,callback);}}.createDelegate(this);timer=setInterval(f,200);return;}
if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return;}
this.loading=true;this.ui.beforeLoad(this);var loader=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(loader){loader.load(this,this.loadComplete.createDelegate(this,[deep,anim,callback]));return;}}
Ext.tree.AsyncTreeNode.superclass.expand.call(this,deep,anim,callback);},isLoading:function(){return this.loading;},loadComplete:function(deep,anim,callback){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(deep,anim,callback);},isLoaded:function(){return this.loaded;},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true;}else{return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);}},reload:function(callback){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild);}
this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false;}
this.expand(false,false,callback);}});Ext.tree.TreePanel.nodeTypes.async=Ext.tree.AsyncTreeNode;Ext.tree.TreeNodeUI=function(node){this.node=node;this.rendered=false;this.animating=false;this.wasLeaf=true;this.ecc='x-tree-ec-icon x-tree-elbow';this.emptyIcon=Ext.BLANK_IMAGE_URL;};Ext.tree.TreeNodeUI.prototype={removeChild:function(node){if(this.rendered){this.ctNode.removeChild(node.ui.getEl());}},beforeLoad:function(){this.addClass("x-tree-node-loading");},afterLoad:function(){this.removeClass("x-tree-node-loading");},onTextChange:function(node,text,oldText){if(this.rendered){this.textNode.innerHTML=text;}},onDisableChange:function(node,state){this.disabled=state;if(this.checkbox){this.checkbox.disabled=state;}
if(state){this.addClass("x-tree-node-disabled");}else{this.removeClass("x-tree-node-disabled");}},onSelectedChange:function(state){if(state){this.focus();this.addClass("x-tree-selected");}else{this.removeClass("x-tree-selected");}},onMove:function(tree,node,oldParent,newParent,index,refNode){this.childIndent=null;if(this.rendered){var targetNode=newParent.ui.getContainer();if(!targetNode){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return;}
var insertBefore=refNode?refNode.ui.getEl():null;if(insertBefore){targetNode.insertBefore(this.wrap,insertBefore);}else{targetNode.appendChild(this.wrap);}
this.node.renderIndent(true);}},addClass:function(cls){if(this.elNode){Ext.fly(this.elNode).addClass(cls);}},removeClass:function(cls){if(this.elNode){Ext.fly(this.elNode).removeClass(cls);}},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments);},initEvents:function(){this.node.on("move",this.onMove,this);if(this.node.disabled){this.addClass("x-tree-node-disabled");if(this.checkbox){this.checkbox.disabled=true;}}
if(this.node.hidden){this.hide();}
var ot=this.node.getOwnerTree();var dd=ot.enableDD||ot.enableDrag||ot.enableDrop;if(dd&&(!this.node.isRoot||ot.rootVisible)){Ext.dd.Registry.register(this.elNode,{node:this.node,handles:this.getDDHandles(),isHandle:false});}},getDDHandles:function(){return[this.iconNode,this.textNode,this.elNode];},hide:function(){this.node.hidden=true;if(this.wrap){this.wrap.style.display="none";}},show:function(){this.node.hidden=false;if(this.wrap){this.wrap.style.display="";}},onContextMenu:function(e){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){e.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,e);}},onClick:function(e){if(this.dropping){e.stopEvent();return;}
if(this.fireEvent("beforeclick",this.node,e)!==false){var a=e.getTarget('a');if(!this.disabled&&this.node.attributes.href&&a){this.fireEvent("click",this.node,e);return;}else if(a&&e.ctrlKey){e.stopEvent();}
e.preventDefault();if(this.disabled){return;}
if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.isExpandable()){this.node.toggle();}
this.fireEvent("click",this.node,e);}else{e.stopEvent();}},onDblClick:function(e){e.preventDefault();if(this.disabled){return;}
if(this.checkbox){this.toggleCheck();}
if(!this.animating&&this.node.isExpandable()){this.node.toggle();}
this.fireEvent("dblclick",this.node,e);},onOver:function(e){this.addClass('x-tree-node-over');},onOut:function(e){this.removeClass('x-tree-node-over');},onCheckChange:function(){var checked=this.checkbox.checked;this.checkbox.defaultChecked=checked;this.node.attributes.checked=checked;this.fireEvent('checkchange',this.node,checked);},ecClick:function(e){if(!this.animating&&this.node.isExpandable()){this.node.toggle();}},startDrop:function(){this.dropping=true;},endDrop:function(){setTimeout(function(){this.dropping=false;}.createDelegate(this),50);},expand:function(){this.updateExpandIcon();this.ctNode.style.display="";},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus();}catch(e){}}else if(!Ext.isIE){try{var noscroll=this.node.getOwnerTree().getTreeEl().dom;var l=noscroll.scrollLeft;this.anchor.focus();noscroll.scrollLeft=l;}catch(e){}}},toggleCheck:function(value){var cb=this.checkbox;if(cb){cb.checked=(value===undefined?!cb.checked:value);this.onCheckChange();}},blur:function(){try{this.anchor.blur();}catch(e){}},animExpand:function(callback){var ct=Ext.get(this.ctNode);ct.stopFx();if(!this.node.isExpandable()){this.updateExpandIcon();this.ctNode.style.display="";Ext.callback(callback);return;}
this.animating=true;this.updateExpandIcon();ct.slideIn('t',{callback:function(){this.animating=false;Ext.callback(callback);},scope:this,duration:this.node.ownerTree.duration||.25});},highlight:function(){var tree=this.node.getOwnerTree();Ext.fly(this.wrap).highlight(tree.hlColor||"C3DAF9",{endColor:tree.hlBaseColor});},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none";},animCollapse:function(callback){var ct=Ext.get(this.ctNode);ct.enableDisplayMode('block');ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut('t',{callback:function(){this.animating=false;Ext.callback(callback);},scope:this,duration:this.node.ownerTree.duration||.25});},getContainer:function(){return this.ctNode;},getEl:function(){return this.wrap;},appendDDGhost:function(ghostNode){ghostNode.appendChild(this.elNode.cloneNode(true));},getDDRepairXY:function(){return Ext.lib.Dom.getXY(this.iconNode);},onRender:function(){this.render();},render:function(bulkRender){var n=this.node,a=n.attributes;var targetNode=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(n,a,targetNode,bulkRender);if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else{this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}else if(a.qtipCfg){a.qtipCfg.target=Ext.id(this.textNode);Ext.QuickTips.register(a.qtipCfg);}
this.initEvents();if(!this.node.expanded){this.updateExpandIcon(true);}}else{if(bulkRender===true){targetNode.appendChild(this.wrap);}}},renderElements:function(n,a,targetNode,bulkRender){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var cb=typeof a.checked=='boolean';var href=a.href?a.href:Ext.isGecko?"":"#";var buf=['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ',a.cls,'" unselectable="on">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon x-tree-elbow" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':'/>')):'','<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on">',n.text,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"].join('');var nel;if(bulkRender!==true&&n.nextSibling&&(nel=n.nextSibling.ui.getEl())){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",nel,buf);}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf);}
this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var index=3;if(cb){this.checkbox=cs[3];this.checkbox.defaultChecked=this.checkbox.checked;index++;}
this.anchor=cs[index];this.textNode=cs[index].firstChild;},getAnchor:function(){return this.anchor;},getTextEl:function(){return this.textNode;},getIconEl:function(){return this.iconNode;},isChecked:function(){return this.checkbox?this.checkbox.checked:false;},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var cls=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";if(n.isExpandable()){if(n.expanded){cls+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded";}else{cls+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed";}
if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false;}
if(this.c1!=c1||this.c2!=c2){Ext.fly(this.elNode).replaceClass(c1,c2);this.c1=c1;this.c2=c2;}}else{if(!this.wasLeaf){Ext.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true;}}
var ecc="x-tree-ec-icon "+cls;if(this.ecc!=ecc){this.ecNode.className=ecc;this.ecc=ecc;}}},getChildIndent:function(){if(!this.childIndent){var buf=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');}else{buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');}}
p=p.parentNode;}
this.childIndent=buf.join("");}
return this.childIndent;},renderIndent:function(){if(this.rendered){var indent="";var p=this.node.parentNode;if(p){indent=p.ui.getChildIndent();}
if(this.indentMarkup!=indent){this.indentNode.innerHTML=indent;this.indentMarkup=indent;}
this.updateExpandIcon();}},destroy:function(){if(this.elNode){Ext.dd.Registry.unregister(this.elNode.id);}
delete this.elNode;delete this.ctNode;delete this.indentNode;delete this.ecNode;delete this.iconNode;delete this.checkbox;delete this.anchor;delete this.textNode;Ext.removeNode(this.ctNode);}};Ext.tree.RootTreeNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{render:function(){if(!this.rendered){var targetNode=this.node.ownerTree.innerCt.dom;this.node.expanded=true;targetNode.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=targetNode.firstChild;}},collapse:Ext.emptyFn,expand:Ext.emptyFn});Ext.tree.TreeLoader=function(config){this.baseParams={};Ext.apply(this,config);this.addEvents("beforeload","load","loadexception");Ext.tree.TreeLoader.superclass.constructor.call(this);};Ext.extend(Ext.tree.TreeLoader,Ext.util.Observable,{uiProviders:{},clearOnLoad:true,load:function(node,callback){if(this.clearOnLoad){while(node.firstChild){node.removeChild(node.firstChild);}}
if(this.doPreload(node)){if(typeof callback=="function"){callback();}}else if(this.dataUrl||this.url){this.requestData(node,callback);}},doPreload:function(node){if(node.attributes.children){if(node.childNodes.length<1){var cs=node.attributes.children;node.beginUpdate();for(var i=0,len=cs.length;i<len;i++){var cn=node.appendChild(this.createNode(cs[i]));if(this.preloadChildren){this.doPreload(cn);}}
node.endUpdate();}
return true;}else{return false;}},getParams:function(node){var buf=[],bp=this.baseParams;for(var key in bp){if(typeof bp[key]!="function"){buf.push(encodeURIComponent(key),"=",encodeURIComponent(bp[key]),"&");}}
buf.push("node=",encodeURIComponent(node.id));return buf.join("");},requestData:function(node,callback){if(this.fireEvent("beforeload",this,node,callback)!==false){this.transId=Ext.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:callback,node:node},params:this.getParams(node)});}else{if(typeof callback=="function"){callback();}}},isLoading:function(){return!!this.transId;},abort:function(){if(this.isLoading()){Ext.Ajax.abort(this.transId);}},createNode:function(attr){if(this.baseAttrs){Ext.applyIf(attr,this.baseAttrs);}
if(this.applyLoader!==false){attr.loader=this;}
if(typeof attr.uiProvider=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}
if(attr.nodeType){return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);}else{return attr.leaf?new Ext.tree.TreeNode(attr):new Ext.tree.AsyncTreeNode(attr);}},processResponse:function(response,node,callback){var json=response.responseText;try{var o=eval("("+json+")");node.beginUpdate();for(var i=0,len=o.length;i<len;i++){var n=this.createNode(o[i]);if(n){node.appendChild(n);}}
node.endUpdate();if(typeof callback=="function"){callback(this,node);}}catch(e){this.handleFailure(response);}},handleResponse:function(response){this.transId=false;var a=response.argument;this.processResponse(response,a.node,a.callback);this.fireEvent("load",this,a.node,response);},handleFailure:function(response){this.transId=false;var a=response.argument;this.fireEvent("loadexception",this,a.node,response);if(typeof a.callback=="function"){a.callback(this,a.node);}}});Ext.tree.TreeFilter=function(tree,config){this.tree=tree;this.filtered={};Ext.apply(this,config);};Ext.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(value,attr,startNode){attr=attr||"text";var f;if(typeof value=="string"){var vlen=value.length;if(vlen==0&&this.clearBlank){this.clear();return;}
value=value.toLowerCase();f=function(n){return n.attributes[attr].substr(0,vlen).toLowerCase()==value;};}else if(value.exec){f=function(n){return value.test(n.attributes[attr]);};}else{throw'Illegal filter type, must be string or regex';}
this.filterBy(f,null,startNode);},filterBy:function(fn,scope,startNode){startNode=startNode||this.tree.root;if(this.autoClear){this.clear();}
var af=this.filtered,rv=this.reverse;var f=function(n){if(n==startNode){return true;}
if(af[n.id]){return false;}
var m=fn.call(scope||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}
return true;};startNode.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];if(n&&n.parentNode){n.parentNode.removeChild(n);}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show();}}}
this.filtered={};}};Ext.tree.TreeSorter=function(tree,config){Ext.apply(this,config);tree.on("beforechildrenrendered",this.doSort,this);tree.on("append",this.updateSort,this);tree.on("insert",this.updateSort,this);tree.on("textchange",this.updateSortParent,this);var dsc=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var sortType=this.sortType;var fs=this.folderSort;var cs=this.caseSensitive===true;var leafAttr=this.leafAttr||'leaf';this.sortFn=function(n1,n2){if(fs){if(n1.attributes[leafAttr]&&!n2.attributes[leafAttr]){return 1;}
if(!n1.attributes[leafAttr]&&n2.attributes[leafAttr]){return-1;}}
var v1=sortType?sortType(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());var v2=sortType?sortType(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());if(v1<v2){return dsc?+1:-1;}else if(v1>v2){return dsc?-1:+1;}else{return 0;}};};Ext.tree.TreeSorter.prototype={doSort:function(node){node.sort(this.sortFn);},compareNodes:function(n1,n2){return(n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);},updateSort:function(tree,node){if(node.childrenRendered){this.doSort.defer(1,this,[node]);}},updateSortParent:function(node){var p=node.parentNode;if(p&&p.childrenRendered){this.doSort.defer(1,this,[p]);}}};if(Ext.dd.DropZone){Ext.tree.TreeDropZone=function(tree,config){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Ext.tree.TreeDropZone.superclass.constructor.call(this,tree.innerCt,config);this.tree=tree;this.dragOverData={};this.lastInsertClass="x-tree-no-status";};Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(node){if(node.hasChildNodes()&&!node.isExpanded()){node.expand(false,null,this.triggerCacheRefresh.createDelegate(this));}},queueExpand:function(node){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[node]);},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false;}},isValidDropPoint:function(n,pt,dd,e,data){if(!n||!data){return false;}
var targetNode=n.node;var dropNode=data.node;if(!(targetNode&&targetNode.isTarget&&pt)){return false;}
if(pt=="append"&&targetNode.allowChildren===false){return false;}
if((pt=="above"||pt=="below")&&(targetNode.parentNode&&targetNode.parentNode.allowChildren===false)){return false;}
if(dropNode&&(targetNode==dropNode||dropNode.contains(targetNode))){return false;}
var overEvent=this.dragOverData;overEvent.tree=this.tree;overEvent.target=targetNode;overEvent.data=data;overEvent.point=pt;overEvent.source=dd;overEvent.rawEvent=e;overEvent.dropNode=dropNode;overEvent.cancel=false;var result=this.tree.fireEvent("nodedragover",overEvent);return overEvent.cancel===false&&result!==false;},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false;}
var dragEl=n.ddel;var t=Ext.lib.Dom.getY(dragEl),b=t+dragEl.offsetHeight;var y=Ext.lib.Event.getPageY(e);var noAppend=tn.allowChildren===false||tn.isLeaf();if(this.appendOnly||tn.parentNode.allowChildren===false){return noAppend?false:"append";}
var noBelow=false;if(!this.allowParentInsert){noBelow=tn.hasChildNodes()&&tn.isExpanded();}
var q=(b-t)/(noAppend?2:3);if(y>=t&&y<(t+q)){return"above";}else if(!noBelow&&(noAppend||y>=b-q&&y<=b)){return"below";}else{return"append";}},onNodeEnter:function(n,dd,e,data){this.cancelExpand();},onNodeOver:function(n,dd,e,data){var pt=this.getDropPoint(e,n,dd);var node=n.node;if(!this.expandProcId&&pt=="append"&&node.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(node);}else if(pt!="append"){this.cancelExpand();}
var returnCls=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,data)){if(pt){var el=n.ddel;var cls;if(pt=="above"){returnCls=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";cls="x-tree-drag-insert-above";}else if(pt=="below"){returnCls=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";cls="x-tree-drag-insert-below";}else{returnCls="x-tree-drop-ok-append";cls="x-tree-drag-append";}
if(this.lastInsertClass!=cls){Ext.fly(el).replaceClass(this.lastInsertClass,cls);this.lastInsertClass=cls;}}}
return returnCls;},onNodeOut:function(n,dd,e,data){this.cancelExpand();this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,data){var point=this.getDropPoint(e,n,dd);var targetNode=n.node;targetNode.ui.startDrop();if(!this.isValidDropPoint(n,point,dd,e,data)){targetNode.ui.endDrop();return false;}
var dropNode=data.node||(dd.getTreeNode?dd.getTreeNode(data,targetNode,point,e):null);var dropEvent={tree:this.tree,target:targetNode,data:data,point:point,source:dd,rawEvent:e,dropNode:dropNode,cancel:!dropNode,dropStatus:false};var retval=this.tree.fireEvent("beforenodedrop",dropEvent);if(retval===false||dropEvent.cancel===true||!dropEvent.dropNode){targetNode.ui.endDrop();return dropEvent.dropStatus;}
targetNode=dropEvent.target;if(point=="append"&&!targetNode.isExpanded()){targetNode.expand(false,null,function(){this.completeDrop(dropEvent);}.createDelegate(this));}else{this.completeDrop(dropEvent);}
return true;},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!Ext.isArray(ns)){ns=[ns];}
var n;for(var i=0,len=ns.length;i<len;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t);}else if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling);}else{t.appendChild(n);}}
n.ui.focus();if(Ext.enableFx&&this.tree.hlDrop){n.ui.highlight();}
t.ui.endDrop();this.tree.fireEvent("nodedrop",de);},afterNodeMoved:function(dd,data,e,targetNode,dropNode){if(Ext.enableFx&&this.tree.hlDrop){dropNode.ui.focus();dropNode.ui.highlight();}
this.tree.fireEvent("nodedrop",this.tree,targetNode,data,dd,e);},getTree:function(){return this.tree;},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Ext.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass";}},beforeDragDrop:function(target,e,id){this.cancelExpand();return true;},afterRepair:function(data){if(data&&Ext.enableFx){data.node.ui.highlight();}
this.hideProxy();}});}
if(Ext.dd.DragZone){Ext.tree.TreeDragZone=function(tree,config){Ext.tree.TreeDragZone.superclass.constructor.call(this,tree.getTreeEl(),config);this.tree=tree;};Ext.extend(Ext.tree.TreeDragZone,Ext.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(data,e){var n=data.node;return n&&n.draggable&&!n.disabled;},onInitDrag:function(e){var data=this.dragData;this.tree.getSelectionModel().select(data.node);this.tree.eventModel.disable();this.proxy.update("");data.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,data.node,e);},getRepairXY:function(e,data){return data.node.ui.getDDRepairXY();},onEndDrag:function(data,e){this.tree.eventModel.enable.defer(100,this.tree.eventModel);this.tree.fireEvent("enddrag",this.tree,data.node,e);},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy();},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();sm.clearSelections();sm.select(this.dragData.node);},afterRepair:function(){if(Ext.enableFx&&this.tree.hlDrop){Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}
this.dragging=false;}});}
Ext.tree.TreeEditor=function(tree,fc,config){fc=fc||{};var field=fc.events?fc:new Ext.form.TextField(fc);Ext.tree.TreeEditor.superclass.constructor.call(this,field,config);this.tree=tree;if(!tree.rendered){tree.on('render',this.initEditor,this);}else{this.initEditor(tree);}};Ext.extend(Ext.tree.TreeEditor,Ext.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,editDelay:350,initEditor:function(tree){tree.on('beforeclick',this.beforeNodeClick,this);tree.on('dblclick',this.onNodeDblClick,this);this.on('complete',this.updateNode,this);this.on('beforestartedit',this.fitToTree,this);this.on('startedit',this.bindScroll,this,{delay:10});this.on('specialkey',this.onSpecialKey,this);},fitToTree:function(ed,el){var td=this.tree.getTreeEl().dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft;}
var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,'');},triggerEdit:function(node,defer){this.completeEdit();if(node.attributes.editable!==false){this.editNode=node;if(this.tree.autoScroll){node.ui.getEl().scrollIntoView(this.tree.body);}
this.autoEditTimer=this.startEdit.defer(this.editDelay,this,[node.ui.textNode,node.text]);return false;}},bindScroll:function(){this.tree.getTreeEl().on('scroll',this.cancelEdit,this);},beforeNodeClick:function(node,e){clearTimeout(this.autoEditTimer);if(this.tree.getSelectionModel().isSelected(node)){e.stopEvent();return this.triggerEdit(node);}},onNodeDblClick:function(node,e){clearTimeout(this.autoEditTimer);},updateNode:function(ed,value){this.tree.getTreeEl().un('scroll',this.cancelEdit,this);this.editNode.setText(value);},onHide:function(){Ext.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus.defer(50,this.editNode.ui);}},onSpecialKey:function(field,e){var k=e.getKey();if(k==e.ESC){e.stopEvent();this.cancelEdit();}else if(k==e.ENTER&&!e.hasModifier()){e.stopEvent();this.completeEdit();}}});Ext.menu.Menu=function(config){if(Ext.isArray(config)){config={items:config};}
Ext.apply(this,config);this.id=this.id||Ext.id();this.addEvents('beforeshow','beforehide','show','hide','click','mouseover','mouseout','itemclick');Ext.menu.MenuMgr.register(this);Ext.menu.Menu.superclass.constructor.call(this);var mis=this.items;this.items=new Ext.util.MixedCollection();if(mis){this.add.apply(this,mis);}};Ext.extend(Ext.menu.Menu,Ext.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,ignoreParentClicks:false,hidden:true,createEl:function(){return new Ext.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000});},render:function(){if(this.el){return;}
var el=this.el=this.createEl();if(!this.keyNav){this.keyNav=new Ext.menu.MenuNav(this);}
if(this.plain){el.addClass("x-menu-plain");}
if(this.cls){el.addClass(this.cls);}
this.focusEl=el.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var ul=el.createChild({tag:"ul",cls:"x-menu-list"});ul.on("click",this.onClick,this);ul.on("mouseover",this.onMouseOver,this);ul.on("mouseout",this.onMouseOut,this);this.items.each(function(item){var li=document.createElement("li");li.className="x-menu-list-item";ul.dom.appendChild(li);item.render(li,this);},this);this.ul=ul;this.autoWidth();},autoWidth:function(){var el=this.el,ul=this.ul;if(!el){return;}
var w=this.width;if(w){el.setWidth(w);}else if(Ext.isIE){el.setWidth(this.minWidth);var t=el.dom.offsetWidth;el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));}},delayAutoWidth:function(){if(this.el){if(!this.awTask){this.awTask=new Ext.util.DelayedTask(this.autoWidth,this);}
this.awTask.delay(20);}},findTargetItem:function(e){var t=e.getTarget(".x-menu-list-item",this.ul,true);if(t&&t.menuItemId){return this.items.get(t.menuItemId);}},onClick:function(e){var t;if(t=this.findTargetItem(e)){if(t.menu&&this.ignoreParentClicks){t.expandMenu();}else{t.onClick(e);this.fireEvent("click",this,t,e);}}},setActiveItem:function(item,autoExpand){if(item!=this.activeItem){if(this.activeItem){this.activeItem.deactivate();}
this.activeItem=item;item.activate(autoExpand);}else if(autoExpand){item.expandMenu();}},tryActivate:function(start,step){var items=this.items;for(var i=start,len=items.length;i>=0&&i<len;i+=step){var item=items.get(i);if(!item.disabled&&item.canActivate){this.setActiveItem(item,false);return item;}}
return false;},onMouseOver:function(e){var t;if(t=this.findTargetItem(e)){if(t.canActivate&&!t.disabled){this.setActiveItem(t,true);}}
this.over=true;this.fireEvent("mouseover",this,e,t);},onMouseOut:function(e){var t;if(t=this.findTargetItem(e)){if(t==this.activeItem&&t.shouldDeactivate(e)){this.activeItem.deactivate();delete this.activeItem;}}
this.over=false;this.fireEvent("mouseout",this,e,t);},isVisible:function(){return this.el&&!this.hidden;},show:function(el,pos,parentMenu){this.parentMenu=parentMenu;if(!this.el){this.render();}
this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,pos||this.defaultAlign),parentMenu,false);},showAt:function(xy,parentMenu,_e){this.parentMenu=parentMenu;if(!this.el){this.render();}
if(_e!==false){this.fireEvent("beforeshow",this);xy=this.el.adjustForConstraints(xy);}
this.el.setXY(xy);this.el.show();this.hidden=false;this.focus();this.fireEvent("show",this);},focus:function(){if(!this.hidden){this.doFocus.defer(50,this);}},doFocus:function(){if(!this.hidden){this.focusEl.focus();}},hide:function(deep){if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null;}
this.el.hide();this.hidden=true;this.fireEvent("hide",this);}
if(deep===true&&this.parentMenu){this.parentMenu.hide(true);}},add:function(){var a=arguments,l=a.length,item;for(var i=0;i<l;i++){var el=a[i];if(el.render){item=this.addItem(el);}else if(typeof el=="string"){if(el=="separator"||el=="-"){item=this.addSeparator();}else{item=this.addText(el);}}else if(el.tagName||el.el){item=this.addElement(el);}else if(typeof el=="object"){Ext.applyIf(el,this.defaults);item=this.addMenuItem(el);}}
return item;},getEl:function(){if(!this.el){this.render();}
return this.el;},addSeparator:function(){return this.addItem(new Ext.menu.Separator());},addElement:function(el){return this.addItem(new Ext.menu.BaseItem(el));},addItem:function(item){this.items.add(item);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.appendChild(li);item.render(li,this);this.delayAutoWidth();}
return item;},addMenuItem:function(config){if(!(config instanceof Ext.menu.Item)){if(typeof config.checked=="boolean"){config=new Ext.menu.CheckItem(config);}else{config=new Ext.menu.Item(config);}}
return this.addItem(config);},addText:function(text){return this.addItem(new Ext.menu.TextItem(text));},insert:function(index,item){this.items.insert(index,item);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.insertBefore(li,this.ul.dom.childNodes[index]);item.render(li,this);this.delayAutoWidth();}
return item;},remove:function(item){this.items.removeKey(item.id);item.destroy();},removeAll:function(){if(this.items){var f;while(f=this.items.first()){this.remove(f);}}},destroy:function(){this.beforeDestroy();Ext.menu.MenuMgr.unregister(this);if(this.keyNav){this.keyNav.disable();}
this.removeAll();if(this.ul){this.ul.removeAllListeners();}
if(this.el){this.el.destroy();}},beforeDestroy:Ext.emptyFn});Ext.menu.MenuNav=function(menu){Ext.menu.MenuNav.superclass.constructor.call(this,menu.el);this.scope=this.menu=menu;};Ext.extend(Ext.menu.MenuNav,Ext.KeyNav,{doRelay:function(e,h){var k=e.getKey();if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN){this.menu.tryActivate(0,1);return false;}
return h.call(this.scope||this,e,this.menu);},up:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){m.tryActivate(m.items.length-1,-1);}},down:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){m.tryActivate(0,1);}},right:function(e,m){if(m.activeItem){m.activeItem.expandMenu(true);}},left:function(e,m){m.hide();if(m.parentMenu&&m.parentMenu.activeItem){m.parentMenu.activeItem.activate();}},enter:function(e,m){if(m.activeItem){e.stopPropagation();m.activeItem.onClick(e);m.fireEvent("click",this,m.activeItem);return true;}}});Ext.menu.MenuMgr=function(){var menus,active,groups={},attached=false,lastShow=new Date();function init(){menus={};active=new Ext.util.MixedCollection();Ext.getDoc().addKeyListener(27,function(){if(active.length>0){hideAll();}});}
function hideAll(){if(active&&active.length>0){var c=active.clone();c.each(function(m){m.hide();});}}
function onHide(m){active.remove(m);if(active.length<1){Ext.getDoc().un("mousedown",onMouseDown);attached=false;}}
function onShow(m){var last=active.last();lastShow=new Date();active.add(m);if(!attached){Ext.getDoc().on("mousedown",onMouseDown);attached=true;}
if(m.parentMenu){m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);m.parentMenu.activeChild=m;}else if(last&&last.isVisible()){m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"),10)+3);}}
function onBeforeHide(m){if(m.activeChild){m.activeChild.hide();}
if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer;}}
function onBeforeShow(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){hideAll();}else if(pm&&pm.activeChild){pm.activeChild.hide();}}
function onMouseDown(e){if(lastShow.getElapsed()>50&&active.length>0&&!e.getTarget(".x-menu")){hideAll();}}
function onBeforeCheck(mi,state){if(state){var g=groups[mi.group];for(var i=0,l=g.length;i<l;i++){if(g[i]!=mi){g[i].setChecked(false);}}}}
return{hideAll:function(){hideAll();},register:function(menu){if(!menus){init();}
menus[menu.id]=menu;menu.on("beforehide",onBeforeHide);menu.on("hide",onHide);menu.on("beforeshow",onBeforeShow);menu.on("show",onShow);var g=menu.group;if(g&&menu.events["checkchange"]){if(!groups[g]){groups[g]=[];}
groups[g].push(menu);menu.on("checkchange",onCheck);}},get:function(menu){if(typeof menu=="string"){if(!menus){return null;}
return menus[menu];}else if(menu.events){return menu;}else if(typeof menu.length=='number'){return new Ext.menu.Menu({items:menu});}else{return new Ext.menu.Menu(menu);}},unregister:function(menu){delete menus[menu.id];menu.un("beforehide",onBeforeHide);menu.un("hide",onHide);menu.un("beforeshow",onBeforeShow);menu.un("show",onShow);var g=menu.group;if(g&&menu.events["checkchange"]){groups[g].remove(menu);menu.un("checkchange",onCheck);}},registerCheckable:function(menuItem){var g=menuItem.group;if(g){if(!groups[g]){groups[g]=[];}
groups[g].push(menuItem);menuItem.on("beforecheckchange",onBeforeCheck);}},unregisterCheckable:function(menuItem){var g=menuItem.group;if(g){groups[g].remove(menuItem);menuItem.un("beforecheckchange",onBeforeCheck);}},getCheckedItem:function(groupId){var g=groups[groupId];if(g){for(var i=0,l=g.length;i<l;i++){if(g[i].checked){return g[i];}}}
return null;},setCheckedItem:function(groupId,itemId){var g=groups[groupId];if(g){for(var i=0,l=g.length;i<l;i++){if(g[i].id==itemId){g[i].setChecked(true);}}}
return null;}};}();Ext.menu.BaseItem=function(config){Ext.menu.BaseItem.superclass.constructor.call(this,config);this.addEvents('click','activate','deactivate');if(this.handler){this.on("click",this.handler,this.scope);}};Ext.extend(Ext.menu.BaseItem,Ext.Component,{canActivate:false,activeClass:"x-menu-item-active",hideOnClick:true,hideDelay:100,ctype:"Ext.menu.BaseItem",actionMode:"container",render:function(container,parentMenu){this.parentMenu=parentMenu;Ext.menu.BaseItem.superclass.render.call(this,container);this.container.menuItemId=this.id;},onRender:function(container,position){this.el=Ext.get(this.el);container.dom.appendChild(this.el.dom);},setHandler:function(handler,scope){if(this.handler){this.un("click",this.handler,this.scope);}
this.on("click",this.handler=handler,this.scope=scope);},onClick:function(e){if(!this.disabled&&this.fireEvent("click",this,e)!==false&&this.parentMenu.fireEvent("itemclick",this,e)!==false){this.handleClick(e);}else{e.stopEvent();}},activate:function(){if(this.disabled){return false;}
var li=this.container;li.addClass(this.activeClass);this.region=li.getRegion().adjust(2,2,-2,-2);this.fireEvent("activate",this);return true;},deactivate:function(){this.container.removeClass(this.activeClass);this.fireEvent("deactivate",this);},shouldDeactivate:function(e){return!this.region||!this.region.contains(e.getPoint());},handleClick:function(e){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true]);}},expandMenu:function(autoActivate){},hideMenu:function(){}});Ext.menu.TextItem=function(cfg){if(typeof cfg=='string'){cfg={text:cfg}}
Ext.menu.TextItem.superclass.constructor.call(this,cfg);};Ext.extend(Ext.menu.TextItem,Ext.menu.BaseItem,{hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML=this.text;this.el=s;Ext.menu.TextItem.superclass.onRender.apply(this,arguments);}});Ext.menu.Separator=function(config){Ext.menu.Separator.superclass.constructor.call(this,config);};Ext.extend(Ext.menu.Separator,Ext.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(li){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML="&#160;";this.el=s;li.addClass("x-menu-sep-li");Ext.menu.Separator.superclass.onRender.apply(this,arguments);}});Ext.menu.Item=function(config){Ext.menu.Item.superclass.constructor.call(this,config);if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);}};Ext.extend(Ext.menu.Item,Ext.menu.BaseItem,{itemCls:"x-menu-item",canActivate:true,showDelay:200,hideDelay:200,ctype:"Ext.menu.Item",onRender:function(container,position){var el=document.createElement("a");el.hideFocus=true;el.unselectable="on";el.href=this.href||"#";if(this.hrefTarget){el.target=this.hrefTarget;}
el.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");el.innerHTML=String.format('<img src="{0}" class="x-menu-item-icon {2}" />{1}',this.icon||Ext.BLANK_IMAGE_URL,this.itemText||this.text,this.iconCls||'');this.el=el;Ext.menu.Item.superclass.onRender.call(this,container,position);},setText:function(text){this.text=text;if(this.rendered){this.el.update(String.format('<img src="{0}" class="x-menu-item-icon {2}">{1}',this.icon||Ext.BLANK_IMAGE_URL,this.text,this.iconCls||''));this.parentMenu.autoWidth();}},setIconClass:function(cls){var oldCls=this.iconCls;this.iconCls=cls;if(this.rendered){this.el.child('img.x-menu-item-icon').replaceClass(oldCls,this.iconCls);}},handleClick:function(e){if(!this.href){e.stopEvent();}
Ext.menu.Item.superclass.handleClick.apply(this,arguments);},activate:function(autoExpand){if(Ext.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(autoExpand){this.expandMenu();}}
return true;},shouldDeactivate:function(e){if(Ext.menu.Item.superclass.shouldDeactivate.call(this,e)){if(this.menu&&this.menu.isVisible()){return!this.menu.getEl().getRegion().contains(e.getPoint());}
return true;}
return false;},deactivate:function(){Ext.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu();},expandMenu:function(autoActivate){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[autoActivate]);}else if(this.menu.isVisible()&&autoActivate){this.menu.tryActivate(0,1);}}},deferExpand:function(autoActivate){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(autoActivate){this.menu.tryActivate(0,1);}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this);}},deferHide:function(){delete this.hideTimer;if(this.menu.over){this.parentMenu.setActiveItem(this,false);}else{this.menu.hide();}}});Ext.menu.CheckItem=function(config){Ext.menu.CheckItem.superclass.constructor.call(this,config);this.addEvents("beforecheckchange","checkchange");if(this.checkHandler){this.on('checkchange',this.checkHandler,this.scope);}
Ext.menu.MenuMgr.registerCheckable(this);};Ext.extend(Ext.menu.CheckItem,Ext.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Ext.menu.CheckItem",onRender:function(c){Ext.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass);}
if(this.checked){this.checked=false;this.setChecked(true,true);}},destroy:function(){Ext.menu.MenuMgr.unregisterCheckable(this);Ext.menu.CheckItem.superclass.destroy.apply(this,arguments);},setChecked:function(state,suppressEvent){if(this.checked!=state&&this.fireEvent("beforecheckchange",this,state)!==false){if(this.container){this.container[state?"addClass":"removeClass"]("x-menu-item-checked");}
this.checked=state;if(suppressEvent!==true){this.fireEvent("checkchange",this,state);}}},handleClick:function(e){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked);}
Ext.menu.CheckItem.superclass.handleClick.apply(this,arguments);}});Ext.menu.Adapter=function(component,config){Ext.menu.Adapter.superclass.constructor.call(this,config);this.component=component;};Ext.extend(Ext.menu.Adapter,Ext.menu.BaseItem,{canActivate:true,onRender:function(container,position){this.component.render(container);this.el=this.component.getEl();},activate:function(){if(this.disabled){return false;}
this.component.focus();this.fireEvent("activate",this);return true;},deactivate:function(){this.fireEvent("deactivate",this);},disable:function(){this.component.disable();Ext.menu.Adapter.superclass.disable.call(this);},enable:function(){this.component.enable();Ext.menu.Adapter.superclass.enable.call(this);}});Ext.menu.DateItem=function(config){Ext.menu.DateItem.superclass.constructor.call(this,new Ext.DatePicker(config),config);this.picker=this.component;this.addEvents('select');this.picker.on("render",function(picker){picker.getEl().swallowEvent("click");picker.container.addClass("x-menu-date-item");});this.picker.on("select",this.onSelect,this);};Ext.extend(Ext.menu.DateItem,Ext.menu.Adapter,{onSelect:function(picker,date){this.fireEvent("select",this,date,picker);Ext.menu.DateItem.superclass.handleClick.call(this);}});Ext.menu.ColorItem=function(config){Ext.menu.ColorItem.superclass.constructor.call(this,new Ext.ColorPalette(config),config);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on('select',this.selectHandler,this.scope);}};Ext.extend(Ext.menu.ColorItem,Ext.menu.Adapter);Ext.menu.DateMenu=function(config){Ext.menu.DateMenu.superclass.constructor.call(this,config);this.plain=true;var di=new Ext.menu.DateItem(config);this.add(di);this.picker=di.picker;this.relayEvents(di,["select"]);this.on('beforeshow',function(){if(this.picker){this.picker.hideMonthPicker(true);}},this);};Ext.extend(Ext.menu.DateMenu,Ext.menu.Menu,{cls:'x-date-menu',beforeDestroy:function(){this.picker.destroy();}});Ext.menu.ColorMenu=function(config){Ext.menu.ColorMenu.superclass.constructor.call(this,config);this.plain=true;var ci=new Ext.menu.ColorItem(config);this.add(ci);this.palette=ci.palette;this.relayEvents(ci,["select"]);};Ext.extend(Ext.menu.ColorMenu,Ext.menu.Menu);Ext.form.Field=Ext.extend(Ext.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:'qtip',msgFx:'normal',readOnly:false,disabled:false,isFormField:true,hasFocus:false,initComponent:function(){Ext.form.Field.superclass.initComponent.call(this);this.addEvents('focus','blur','specialkey','change','invalid','valid');},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onRender:function(ct,position){Ext.form.Field.superclass.onRender.call(this,ct,position);if(!this.el){var cfg=this.getAutoCreate();if(!cfg.name){cfg.name=this.name||this.id;}
if(this.inputType){cfg.type=this.inputType;}
this.el=ct.createChild(cfg,position);}
var type=this.el.dom.type;if(type){if(type=='password'){type='text';}
this.el.addClass('x-form-'+type);}
if(this.readOnly){this.el.dom.readOnly=true;}
if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}
this.el.addClass([this.fieldClass,this.cls]);},initValue:function(){if(this.value!==undefined){this.setValue(this.value);}else if(this.el.dom.value.length>0&&this.el.dom.value!=this.emptyText){this.setValue(this.el.dom.value);}
this.originalValue=this.getValue();},isDirty:function(){if(this.disabled){return false;}
return String(this.getValue())!==String(this.originalValue);},afterRender:function(){Ext.form.Field.superclass.afterRender.call(this);this.initEvents();this.initValue();},fireKey:function(e){if(e.isSpecialKey()){this.fireEvent("specialkey",this,e);}},reset:function(){this.setValue(this.originalValue);this.clearInvalid();},initEvents:function(){this.el.on(Ext.isIE||Ext.isSafari3?"keydown":"keypress",this.fireKey,this);this.el.on("focus",this.onFocus,this);var o=this.inEditor&&Ext.isWindows&&Ext.isGecko?{buffer:10}:null;this.el.on("blur",this.onBlur,this,o);this.originalValue=this.getValue();},onFocus:function(){if(!Ext.isOpera&&this.focusClass){this.el.addClass(this.focusClass);}
if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this);}},beforeBlur:Ext.emptyFn,onBlur:function(){this.beforeBlur();if(!Ext.isOpera&&this.focusClass){this.el.removeClass(this.focusClass);}
this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}
var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);}
this.fireEvent("blur",this);},isValid:function(preventMark){if(this.disabled){return true;}
var restore=this.preventMark;this.preventMark=preventMark===true;var v=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=restore;return v;},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true;}
return false;},processValue:function(value){return value;},validateValue:function(value){return true;},markInvalid:function(msg){if(!this.rendered||this.preventMark){return;}
this.el.addClass(this.invalidClass);msg=msg||this.invalidText;switch(this.msgTarget){case'qtip':this.el.dom.qtip=msg;this.el.dom.qclass='x-form-invalid-tip';if(Ext.QuickTips){Ext.QuickTips.enable();}
break;case'title':this.el.dom.title=msg;break;case'under':if(!this.errorEl){var elp=this.getErrorCt();if(!elp){this.el.dom.title=msg;break;}
this.errorEl=elp.createChild({cls:'x-form-invalid-msg'});this.errorEl.setWidth(elp.getWidth(true)-20);}
this.errorEl.update(msg);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case'side':if(!this.errorIcon){var elp=this.getErrorCt();if(!elp){this.el.dom.title=msg;break;}
this.errorIcon=elp.createChild({cls:'x-form-invalid-icon'});}
this.alignErrorIcon();this.errorIcon.dom.qtip=msg;this.errorIcon.dom.qclass='x-form-invalid-tip';this.errorIcon.show();this.on('resize',this.alignErrorIcon,this);break;default:var t=Ext.getDom(this.msgTarget);t.innerHTML=msg;t.style.display=this.msgDisplay;break;}
this.fireEvent('invalid',this,msg);},getErrorCt:function(){return this.el.findParent('.x-form-element',5,true)||this.el.findParent('.x-form-field-wrap',5,true);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,'tl-tr',[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}
this.el.removeClass(this.invalidClass);switch(this.msgTarget){case'qtip':this.el.dom.qtip='';break;case'title':this.el.dom.title='';break;case'under':if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}
break;case'side':if(this.errorIcon){this.errorIcon.dom.qtip='';this.errorIcon.hide();this.un('resize',this.alignErrorIcon,this);}
break;default:var t=Ext.getDom(this.msgTarget);t.innerHTML='';t.style.display='none';break;}
this.fireEvent('valid',this);},getRawValue:function(){var v=this.rendered?this.el.getValue():Ext.value(this.value,'');if(v===this.emptyText){v='';}
return v;},getValue:function(){if(!this.rendered){return this.value;}
var v=this.el.getValue();if(v===this.emptyText||v===undefined){v='';}
return v;},setRawValue:function(v){return this.el.dom.value=(v===null||v===undefined?'':v);},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=(v===null||v===undefined?'':v);this.validate();}},adjustSize:function(w,h){var s=Ext.form.Field.superclass.adjustSize.call(this,w,h);s.width=this.adjustWidth(this.el.dom.tagName,s.width);return s;},adjustWidth:function(tag,w){tag=tag.toLowerCase();if(typeof w=='number'&&!Ext.isSafari){if(Ext.isIE&&(tag=='input'||tag=='textarea')){if(tag=='input'&&!Ext.isStrict){return this.inEditor?w:w-3;}
if(tag=='input'&&Ext.isStrict){return w-(Ext.isIE6?4:1);}
if(tag=='textarea'&&Ext.isStrict){return w-2;}}else if(Ext.isOpera&&Ext.isStrict){if(tag=='input'){return w+2;}
if(tag=='textarea'){return w-2;}}}
return w;}});Ext.form.MessageTargets={'qtip':{mark:function(f){this.el.dom.qtip=msg;this.el.dom.qclass='x-form-invalid-tip';if(Ext.QuickTips){Ext.QuickTips.enable();}},clear:function(f){this.el.dom.qtip='';}},'title':{mark:function(f){this.el.dom.title=msg;},clear:function(f){this.el.dom.title='';}},'under':{mark:function(f){if(!this.errorEl){var elp=this.getErrorCt();if(!elp){this.el.dom.title=msg;return;}
this.errorEl=elp.createChild({cls:'x-form-invalid-msg'});this.errorEl.setWidth(elp.getWidth(true)-20);}
this.errorEl.update(msg);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);},clear:function(f){if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}else{this.el.dom.title='';}}},'side':{mark:function(f){if(!this.errorIcon){var elp=this.getErrorCt();if(!elp){this.el.dom.title=msg;return;}
this.errorIcon=elp.createChild({cls:'x-form-invalid-icon'});}
this.alignErrorIcon();this.errorIcon.dom.qtip=msg;this.errorIcon.dom.qclass='x-form-invalid-tip';this.errorIcon.show();this.on('resize',this.alignErrorIcon,this);},clear:function(f){if(this.errorIcon){this.errorIcon.dom.qtip='';this.errorIcon.hide();this.un('resize',this.alignErrorIcon,this);}else{this.el.dom.title='';}}},'around':{mark:function(f){},clear:function(f){}}};Ext.form.Field.msgFx={normal:{show:function(msgEl,f){msgEl.setDisplayed('block');},hide:function(msgEl,f){msgEl.setDisplayed(false).update('');}},slide:{show:function(msgEl,f){msgEl.slideIn('t',{stopFx:true});},hide:function(msgEl,f){msgEl.slideOut('t',{stopFx:true,useDisplay:true});}},slideRight:{show:function(msgEl,f){msgEl.fixDisplay();msgEl.alignTo(f.el,'tl-tr');msgEl.slideIn('l',{stopFx:true});},hide:function(msgEl,f){msgEl.slideOut('l',{stopFx:true,useDisplay:true});}}};Ext.reg('field',Ext.form.Field);Ext.form.TextField=Ext.extend(Ext.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:'x-form-empty-field',initComponent:function(){Ext.form.TextField.superclass.initComponent.call(this);this.addEvents('autosize','keydown','keyup','keypress');},initEvents:function(){Ext.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Ext.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}
else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}
if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);this.el.on('mousedown',function(){if(!this.hasFocus){this.el.on('mouseup',function(e){e.preventDefault();},this,{single:true});}},this);if(this.emptyText){this.on('blur',this.postBlur,this);this.applyEmptyText();}}
if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Ext.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this);}
if(this.grow){this.el.on("keyup",this.onKeyUpBuffered,this,{buffer:50});this.el.on("click",this.autoSize,this);}
if(this.enableKeyEvents){this.el.on("keyup",this.onKeyUp,this);this.el.on("keydown",this.onKeyDown,this);this.el.on("keypress",this.onKeyPress,this);}},processValue:function(value){if(this.stripCharsRe){var newValue=value.replace(this.stripCharsRe,'');if(newValue!==value){this.setRawValue(newValue);return newValue;}}
return value;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUpBuffered:function(e){if(!e.isNavKeyPress()){this.autoSize();}},onKeyUp:function(e){this.fireEvent('keyup',this,e);},onKeyDown:function(e){this.fireEvent('keydown',this,e);},onKeyPress:function(e){this.fireEvent('keypress',this,e);},reset:function(){Ext.form.TextField.superclass.reset.call(this);this.applyEmptyText();},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass);}},preFocus:function(){if(this.emptyText){if(this.el.dom.value==this.emptyText){this.setRawValue('');}
this.el.removeClass(this.emptyClass);}
if(this.selectOnFocus){this.el.dom.select();}},postBlur:function(){this.applyEmptyText();},filterKeys:function(e){if(e.ctrlKey){return;}
var k=e.getKey();if(Ext.isGecko&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return;}
var c=e.getCharCode(),cc=String.fromCharCode(c);if(!Ext.isGecko&&e.isSpecialKey()&&!cc){return;}
if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){if(this.emptyText&&this.el&&v!==undefined&&v!==null&&v!==''){this.el.removeClass(this.emptyClass);}
Ext.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize();},validateValue:function(value){if(value.length<1||value===this.emptyText){if(this.allowBlank){this.clearInvalid();return true;}else{this.markInvalid(this.blankText);return false;}}
if(value.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}
if(value.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false;}
if(this.vtype){var vt=Ext.form.VTypes;if(!vt[this.vtype](value,this)){this.markInvalid(this.vtypeText||vt[this.vtype+'Text']);return false;}}
if(typeof this.validator=="function"){var msg=this.validator(value);if(msg!==true){this.markInvalid(msg);return false;}}
if(this.regex&&!this.regex.test(value)){this.markInvalid(this.regexText);return false;}
return true;},selectText:function(start,end){var v=this.getRawValue();if(v.length>0){start=start===undefined?0:start;end=end===undefined?v.length:end;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(start,end);}else if(d.createTextRange){var range=d.createTextRange();range.moveStart("character",start);range.moveEnd("character",end-v.length);range.select();}}},autoSize:function(){if(!this.grow||!this.rendered){return;}
if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el);}
var el=this.el;var v=el.dom.value;var d=document.createElement('div');d.appendChild(document.createTextNode(v));v=d.innerHTML;d=null;v+="&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w);}});Ext.reg('textfield',Ext.form.TextField);Ext.form.TriggerField=Ext.extend(Ext.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,autoSize:Ext.emptyFn,monitorTab:true,deferHeight:true,mimicing:false,onResize:function(w,h){Ext.form.TriggerField.superclass.onResize.call(this,w,h);if(typeof w=='number'){this.el.setWidth(this.adjustWidth('input',w-this.trigger.getWidth()));}
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());},adjustSize:Ext.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);}},onRender:function(ct,position){Ext.form.TriggerField.superclass.onRender.call(this,ct,position);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});if(this.hideTrigger){this.trigger.setDisplayed(false);}
this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());}},afterRender:function(){Ext.form.TriggerField.superclass.afterRender.call(this);var y;if(Ext.isIE&&this.el.getY()!=(y=this.trigger.getY())){this.el.position();this.el.setY(y);}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver('x-form-trigger-over');this.trigger.addClassOnClick('x-form-trigger-click');},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove();}
if(this.wrap){this.wrap.remove();}
Ext.form.TriggerField.superclass.onDestroy.call(this);},onFocus:function(){Ext.form.TriggerField.superclass.onFocus.call(this);if(!this.mimicing){this.wrap.addClass('x-trigger-wrap-focus');this.mimicing=true;Ext.get(Ext.isIE?document.body:document).on("mousedown",this.mimicBlur,this,{delay:10});if(this.monitorTab){this.el.on("keydown",this.checkTab,this);}}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();}},onBlur:function(){},mimicBlur:function(e){if(!this.wrap.contains(e.target)&&this.validateBlur(e)){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this);if(this.monitorTab){this.el.un("keydown",this.checkTab,this);}
this.beforeBlur();this.wrap.removeClass('x-trigger-wrap-focus');Ext.form.TriggerField.superclass.onBlur.call(this);},beforeBlur:Ext.emptyFn,validateBlur:function(e){return true;},onDisable:function(){Ext.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass(this.disabledClass);this.el.removeClass(this.disabledClass);}},onEnable:function(){Ext.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass(this.disabledClass);}},onShow:function(){if(this.wrap){this.wrap.dom.style.display='';this.wrap.dom.style.visibility='visible';}},onHide:function(){this.wrap.dom.style.display='none';},onTriggerClick:Ext.emptyFn});Ext.form.TwinTriggerField=Ext.extend(Ext.form.TriggerField,{initComponent:function(){Ext.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:'span',cls:'x-form-twin-triggers',cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};},getTrigger:function(index){return this.triggers[index];},initTrigger:function(){var ts=this.trigger.select('.x-form-trigger',true);this.wrap.setStyle('overflow','hidden');var triggerField=this;ts.each(function(t,all,index){t.hide=function(){var w=triggerField.wrap.getWidth();this.dom.style.display='none';triggerField.el.setWidth(w-triggerField.trigger.getWidth());};t.show=function(){var w=triggerField.wrap.getWidth();this.dom.style.display='';triggerField.el.setWidth(w-triggerField.trigger.getWidth());};var triggerIndex='Trigger'+(index+1);if(this['hide'+triggerIndex]){t.dom.style.display='none';}
t.on("click",this['on'+triggerIndex+'Click'],this,{preventDefault:true});t.addClassOnOver('x-form-trigger-over');t.addClassOnClick('x-form-trigger-click');},this);this.triggers=ts.elements;},onTrigger1Click:Ext.emptyFn,onTrigger2Click:Ext.emptyFn});Ext.reg('trigger',Ext.form.TriggerField);Ext.form.TextArea=Ext.extend(Ext.form.TextField,{growMin:60,growMax:1000,growAppend:'&#160;\n&#160;',growPad:0,enterIsSpecial:false,preventScrollbars:false,onRender:function(ct,position){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:100px;height:60px;",autocomplete:"off"};}
Ext.form.TextArea.superclass.onRender.call(this,ct,position);if(this.grow){this.textSizeEl=Ext.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden");}
this.el.setHeight(this.growMin);}},onDestroy:function(){if(this.textSizeEl){Ext.removeNode(this.textSizeEl);}
Ext.form.TextArea.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isSpecialKey()&&(this.enterIsSpecial||(e.getKey()!=e.ENTER||e.hasModifier()))){this.fireEvent("specialkey",this,e);}},onKeyUp:function(e){if(!e.isNavKeyPress()||e.getKey()==e.ENTER){this.autoSize();}
Ext.form.TextArea.superclass.onKeyUp.call(this,e);},autoSize:function(){if(!this.grow||!this.textSizeEl){return;}
var el=this.el;var v=el.dom.value;var ts=this.textSizeEl;ts.innerHTML='';ts.appendChild(document.createTextNode(v));v=ts.innerHTML;Ext.fly(ts).setWidth(this.el.getWidth());if(v.length<1){v="&#160;&#160;";}else{if(Ext.isIE){v=v.replace(/\n/g,'<p>&#160;</p>');}
v+=this.growAppend;}
ts.innerHTML=v;var h=Math.min(this.growMax,Math.max(ts.offsetHeight,this.growMin)+this.growPad);if(h!=this.lastHeight){this.lastHeight=h;this.el.setHeight(h);this.fireEvent("autosize",this,h);}}});Ext.reg('textarea',Ext.form.TextArea);Ext.form.NumberField=Ext.extend(Ext.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",baseChars:"0123456789",initEvents:function(){Ext.form.NumberField.superclass.initEvents.call(this);var allowed=this.baseChars+'';if(this.allowDecimals){allowed+=this.decimalSeparator;}
if(this.allowNegative){allowed+="-";}
this.stripCharsRe=new RegExp('[^'+allowed+']','gi');var keyPress=function(e){var k=e.getKey();if(!Ext.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE)){return;}
var c=e.getCharCode();if(allowed.indexOf(String.fromCharCode(c))===-1){e.stopEvent();}};this.el.on("keypress",keyPress,this);},validateValue:function(value){if(!Ext.form.NumberField.superclass.validateValue.call(this,value)){return false;}
if(value.length<1){return true;}
value=String(value).replace(this.decimalSeparator,".");if(isNaN(value)){this.markInvalid(String.format(this.nanText,value));return false;}
var num=this.parseValue(value);if(num<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false;}
if(num>this.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false;}
return true;},getValue:function(){return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));},setValue:function(v){v=typeof v=='number'?v:parseFloat(String(v).replace(this.decimalSeparator,"."));v=isNaN(v)?'':String(v).replace(".",this.decimalSeparator);Ext.form.NumberField.superclass.setValue.call(this,v);},parseValue:function(value){value=parseFloat(String(value).replace(this.decimalSeparator,"."));return isNaN(value)?'':value;},fixPrecision:function(value){var nan=isNaN(value);if(!this.allowDecimals||this.decimalPrecision==-1||nan||!value){return nan?'':value;}
return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));},beforeBlur:function(){var v=this.parseValue(this.getRawValue());if(v){this.setValue(this.fixPrecision(v));}}});Ext.reg('numberfield',Ext.form.NumberField);Ext.form.DateField=Ext.extend(Ext.form.TriggerField,{format:"m/d/Y",altFormats:"m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",disabledDaysText:"Disabled",disabledDatesText:"Disabled",minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',showToday:true,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},initComponent:function(){Ext.form.DateField.superclass.initComponent.call(this);if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}
if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);}
this.ddMatch=null;this.initDisabledDays();},initDisabledDays:function(){if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
this.disabledDatesRE=new RegExp(re+")");}},setDisabledDates:function(dd){this.disabledDates=dd;this.initDisabledDays();if(this.menu){this.menu.picker.setDisabledDates(this.disabledDatesRE);}},setDisabledDays:function(dd){this.disabledDays=dd;if(this.menu){this.menu.picker.setDisabledDays(dd);}},setMinValue:function(dt){this.minValue=(typeof dt=="string"?this.parseDate(dt):dt);if(this.menu){this.menu.picker.setMinDate(this.minValue);}},setMaxValue:function(dt){this.maxValue=(typeof dt=="string"?this.parseDate(dt):dt);if(this.menu){this.menu.picker.setMaxDate(this.maxValue);}},validateValue:function(value){value=this.formatDate(value);if(!Ext.form.DateField.superclass.validateValue.call(this,value)){return false;}
if(value.length<1){return true;}
var svalue=value;value=this.parseDate(value);if(!value){this.markInvalid(String.format(this.invalidText,svalue,this.format));return false;}
var time=value.getTime();if(this.minValue&&time<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false;}
if(this.maxValue&&time>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false;}
if(this.disabledDays){var day=value.getDay();for(var i=0;i<this.disabledDays.length;i++){if(day===this.disabledDays[i]){this.markInvalid(this.disabledDaysText);return false;}}}
var fvalue=this.formatDate(value);if(this.ddMatch&&this.ddMatch.test(fvalue)){this.markInvalid(String.format(this.disabledDatesText,fvalue));return false;}
return true;},validateBlur:function(){return!this.menu||!this.menu.isVisible();},getValue:function(){return this.parseDate(Ext.form.DateField.superclass.getValue.call(this))||"";},setValue:function(date){Ext.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(date)));},parseDate:function(value){if(!value||Ext.isDate(value)){return value;}
var v=Date.parseDate(value,this.format);if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}
for(var i=0,len=this.altFormatsArray.length;i<len&&!v;i++){v=Date.parseDate(value,this.altFormatsArray[i]);}}
return v;},onDestroy:function(){if(this.menu){this.menu.destroy();}
if(this.wrap){this.wrap.remove();}
Ext.form.DateField.superclass.onDestroy.call(this);},formatDate:function(date){return Ext.isDate(date)?date.dateFormat(this.format):date;},menuListeners:{select:function(m,d){this.setValue(d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}
if(this.menu==null){this.menu=new Ext.menu.DateMenu();}
Ext.apply(this.menu.picker,{minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.format,showToday:this.showToday,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))});this.menu.on(Ext.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}}});Ext.reg('datefield',Ext.form.DateField);Ext.form.ComboBox=Ext.extend(Ext.form.TriggerField,{defaultAutoCreate:{tag:"input",type:"text",size:"24",autocomplete:"off"},listClass:'',selectedClass:'x-combo-selected',triggerClass:'x-form-arrow-trigger',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,minHeight:90,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,lazyInit:true,initComponent:function(){Ext.form.ComboBox.superclass.initComponent.call(this);this.addEvents('expand','collapse','beforeselect','select','beforequery');if(this.transform){this.allowDomMove=false;var s=Ext.getDom(this.transform);if(!this.hiddenName){this.hiddenName=s.name;}
if(!this.store){this.mode='local';var d=[],opts=s.options;for(var i=0,len=opts.length;i<len;i++){var o=opts[i];var value=(Ext.isIE?o.getAttributeNode('value').specified:o.hasAttribute('value'))?o.value:o.text;if(o.selected){this.value=value;}
d.push([value,o.text]);}
this.store=new Ext.data.SimpleStore({'id':0,fields:['value','text'],data:d});this.valueField='value';this.displayField='text';}
s.name=Ext.id();if(!this.lazyRender){this.target=true;this.el=Ext.DomHelper.insertBefore(s,this.autoCreate||this.defaultAutoCreate);Ext.removeNode(s);this.render(this.el.parentNode);}else{Ext.removeNode(s);}}
else if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.SimpleStore({fields:['value','text'],data:this.store});this.valueField='value';}else{this.store=new Ext.data.SimpleStore({fields:['text'],data:this.store,expandData:true});this.valueField='text';}
this.displayField='text';this.mode='local';}
this.selectedIndex=-1;if(this.mode=='local'){if(this.initialConfig.queryDelay===undefined){this.queryDelay=10;}
if(this.initialConfig.minChars===undefined){this.minChars=0;}}},onRender:function(ct,position){Ext.form.ComboBox.superclass.onRender.call(this,ct,position);if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)},'before',true);this.el.dom.removeAttribute('name');}
if(Ext.isGecko){this.el.dom.setAttribute('autocomplete','off');}
if(!this.lazyInit){this.initList();}else{this.on('focus',this.initList,this,{single:true});}
if(!this.editable){this.editable=true;this.setEditable(false);}},initValue:function(){Ext.form.ComboBox.superclass.initValue.call(this);if(this.hiddenField){this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';}},initList:function(){if(!this.list){var cls='x-combo-list';this.list=new Ext.Layer({shadow:this.shadow,cls:[cls,this.listClass].join(' '),constrain:false});var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:cls+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();}
this.innerList=this.list.createChild({cls:cls+'-inner'});this.innerList.on('mouseover',this.onViewOver,this);this.innerList.on('mousemove',this.onViewMove,this);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));if(this.pageSize){this.footer=this.list.createChild({cls:cls+'-ft'});this.pageTb=new Ext.PagingToolbar({store:this.store,pageSize:this.pageSize,renderTo:this.footer});this.assetHeight+=this.footer.getHeight();}
if(!this.tpl){this.tpl='<tpl for="."><div class="'+cls+'-item">{'+this.displayField+'}</div></tpl>';}
this.view=new Ext.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,selectedClass:this.selectedClass,itemSelector:this.itemSelector||'.'+cls+'-item'});this.view.on('click',this.onViewClick,this);this.bindStore(this.store,true);if(this.resizable){this.resizer=new Ext.Resizable(this.list,{pinned:true,handles:'se'});this.resizer.on('resize',function(r,w,h){this.maxHeight=h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;this.listWidth=w;this.innerList.setWidth(w-this.list.getFrameWidth('lr'));this.restrictHeight();},this);this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom',this.handleHeight+'px');}}},bindStore:function(store,initial){if(this.store&&!initial){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.collapse,this);if(!store){this.store=null;if(this.view){this.view.setStore(null);}}}
if(store){this.store=Ext.StoreMgr.lookup(store);this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.collapse,this);if(this.view){this.view.setStore(store);}}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Ext.KeyNav(this.el,{"up":function(e){this.inKeyMode=true;this.selectPrev();},"down":function(e){if(!this.isExpanded()){this.onTriggerClick();}else{this.inKeyMode=true;this.selectNext();}},"enter":function(e){this.onViewClick();this.delayedCheck=true;this.unsetDelayCheck.defer(10,this);},"esc":function(e){this.collapse();},"tab":function(e){this.onViewClick(false);return true;},scope:this,doRelay:function(foo,bar,hname){if(hname=='down'||this.scope.isExpanded()){return Ext.KeyNav.prototype.doRelay.apply(this,arguments);}
return true;},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=='local'?10:250);this.dqTask=new Ext.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Ext.util.DelayedTask(this.onTypeAhead,this);}
if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);}
if(this.forceSelection){this.on('blur',this.doForce,this);}},onDestroy:function(){if(this.view){this.view.el.removeAllListeners();this.view.el.remove();this.view.purgeListeners();}
if(this.list){this.list.destroy();}
this.bindStore(null);Ext.form.ComboBox.superclass.onDestroy.call(this);},unsetDelayCheck:function(){delete this.delayedCheck;},fireKey:function(e){if(e.isNavKeyPress()&&!this.isExpanded()&&!this.delayedCheck){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){Ext.form.ComboBox.superclass.onResize.apply(this,arguments);if(this.list&&this.listWidth===undefined){var lw=Math.max(w,this.minListWidth);this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));}},onEnable:function(){Ext.form.ComboBox.superclass.onEnable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=false;}},onDisable:function(){Ext.form.ComboBox.superclass.onDisable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=true;}},setEditable:function(value){if(value==this.editable){return;}
this.editable=value;if(!value){this.el.dom.setAttribute('readOnly',true);this.el.on('mousedown',this.onTriggerClick,this);this.el.addClass('x-combo-noedit');}else{this.el.dom.setAttribute('readOnly',false);this.el.un('mousedown',this.onTriggerClick,this);this.el.removeClass('x-combo-noedit');}},onBeforeLoad:function(){if(!this.hasFocus){return;}
this.innerList.update(this.loadingText?'<div class="loading-indicator">'+this.loadingText+'</div>':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){if(!this.hasFocus){return;}
if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select();}
if(!this.selectByValue(this.value,true)){this.select(0,true);}}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);}}}else{this.onEmptyResults();}},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var newValue=r.data[this.displayField];var len=newValue.length;var selStart=this.getRawValue().length;if(selStart!=len){this.setRawValue(newValue);this.selectText(selStart,newValue.length);}}},onSelect:function(record,index){if(this.fireEvent('beforeselect',this,record,index)!==false){this.setValue(record.data[this.valueField||this.displayField]);this.collapse();this.fireEvent('select',this,record,index);}},getValue:function(){if(this.valueField){return typeof this.value!='undefined'?this.value:'';}else{return Ext.form.ComboBox.superclass.getValue.call(this);}},clearValue:function(){if(this.hiddenField){this.hiddenField.value='';}
this.setRawValue('');this.lastSelectionText='';this.applyEmptyText();this.value='';},setValue:function(v){var text=v;if(this.valueField){var r=this.findRecord(this.valueField,v);if(r){text=r.data[this.displayField];}else if(this.valueNotFoundText!==undefined){text=this.valueNotFoundText;}}
this.lastSelectionText=text;if(this.hiddenField){this.hiddenField.value=v;}
Ext.form.ComboBox.superclass.setValue.call(this,text);this.value=v;},findRecord:function(prop,value){var record;if(this.store.getCount()>0){this.store.each(function(r){if(r.data[prop]==value){record=r;return false;}});}
return record;},onViewMove:function(e,t){this.inKeyMode=false;},onViewOver:function(e,t){if(this.inKeyMode){return;}
var item=this.view.findItemFromChild(t);if(item){var index=this.view.indexOf(item);this.select(index,false);}},onViewClick:function(doFocus){var index=this.view.getSelectedIndexes()[0];var r=this.store.getAt(index);if(r){this.onSelect(r,index);}
if(doFocus!==false){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height='';var inner=this.innerList.dom;var pad=this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;var h=Math.max(inner.clientHeight,inner.offsetHeight,inner.scrollHeight);var ha=this.getPosition()[1]-Ext.getBody().getScroll().top;var hb=Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;var space=Math.max(ha,hb,this.minHeight||0)-this.list.shadowOffset-pad-5;h=Math.min(h,space,this.maxHeight);this.innerList.setHeight(h);this.list.beginUpdate();this.list.setHeight(h+pad);this.list.alignTo(this.wrap,this.listAlign);this.list.endUpdate();},onEmptyResults:function(){this.collapse();},isExpanded:function(){return this.list&&this.list.isVisible();},selectByValue:function(v,scrollIntoView){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),scrollIntoView);return true;}}
return false;},select:function(index,scrollIntoView){this.selectedIndex=index;this.view.select(index);if(scrollIntoView!==false){var el=this.view.getNode(index);if(el){this.innerList.scrollChildIntoView(el,false);}}},selectNext:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex<ct-1){this.select(this.selectedIndex+1);}}},selectPrev:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1);}}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return!this.list||!this.list.isVisible();},initQuery:function(){this.doQuery(this.getRawValue());},doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;this.applyEmptyText();}},doQuery:function(q,forceAll){if(q===undefined||q===null){q='';}
var qe={query:q,forceAll:forceAll,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
q=qe.query;forceAll=qe.forceAll;if(forceAll===true||(q.length>=this.minChars)){if(this.lastQuery!==q){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(forceAll){this.store.clearFilter();}else{this.store.filter(this.displayField,q);}
this.onLoad();}else{this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else{this.selectedIndex=-1;this.onLoad();}}},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize;}
return p;},collapse:function(){if(!this.isExpanded()){return;}
this.list.hide();Ext.getDoc().un('mousewheel',this.collapseIf,this);Ext.getDoc().un('mousedown',this.collapseIf,this);this.fireEvent('collapse',this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}
this.list.alignTo(this.wrap,this.listAlign);this.list.show();this.innerList.setOverflow('auto');Ext.getDoc().on('mousewheel',this.collapseIf,this);Ext.getDoc().on('mousedown',this.collapseIf,this);this.fireEvent('expand',this);},onTriggerClick:function(){if(this.disabled){return;}
if(this.isExpanded()){this.collapse();this.el.focus();}else{this.onFocus({});if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else{this.doQuery(this.getRawValue());}
this.el.focus();}}});Ext.reg('combo',Ext.form.ComboBox);Ext.form.Checkbox=Ext.extend(Ext.form.Field,{checkedCls:'x-form-check-checked',focusCls:'x-form-check-focus',overCls:'x-form-check-over',mouseDownCls:'x-form-check-down',tabIndex:0,checked:false,defaultAutoCreate:{tag:'input',type:'checkbox',autocomplete:'off'},baseCls:'x-form-check',initComponent:function(){Ext.form.Checkbox.superclass.initComponent.call(this);this.addEvents('check');},initEvents:function(){Ext.form.Checkbox.superclass.initEvents.call(this);this.initCheckEvents();},initCheckEvents:function(){this.innerWrap.removeAllListeners();this.innerWrap.addClassOnOver(this.overCls);this.innerWrap.addClassOnClick(this.mouseDownCls);this.innerWrap.on('click',this.onClick,this);this.innerWrap.on('keyup',this.onKeyUp,this);},onRender:function(ct,position){Ext.form.Checkbox.superclass.onRender.call(this,ct,position);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}
this.el.addClass('x-hidden');this.innerWrap=this.el.wrap({tabIndex:this.tabIndex,cls:this.baseCls+'-wrap-inner'});this.wrap=this.innerWrap.wrap({cls:this.baseCls+'-wrap'});if(this.boxLabel){this.labelEl=this.innerWrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}
this.imageEl=this.innerWrap.createChild({tag:'img',src:Ext.BLANK_IMAGE_URL,cls:this.baseCls},this.el);if(this.checked){this.setValue(true);}else{this.checked=this.el.dom.checked;}
this.originalValue=this.checked;},onDestroy:function(){if(this.rendered){Ext.destroy(this.imageEl,this.labelEl,this.innerWrap,this.wrap);}
Ext.form.Checkbox.superclass.onDestroy.call(this);},onFocus:function(e){Ext.form.Checkbox.superclass.onFocus.call(this,e);this.el.addClass(this.focusCls);},onBlur:function(e){Ext.form.Checkbox.superclass.onBlur.call(this,e);this.el.removeClass(this.focusCls);},onResize:function(){Ext.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel&&!this.fieldLabel){this.el.alignTo(this.wrap,'c-c');}},onKeyUp:function(e){if(e.getKey()==Ext.EventObject.SPACE){this.onClick(e);}},onClick:function(e){if(!this.disabled&&!this.readOnly){this.toggleValue();}
e.stopEvent();},onEnable:function(){Ext.form.Checkbox.superclass.onEnable.call(this);this.initCheckEvents();},onDisable:function(){Ext.form.Checkbox.superclass.onDisable.call(this);this.innerWrap.removeAllListeners();},toggleValue:function(){this.setValue(!this.checked);},getResizeEl:function(){if(!this.resizeEl){this.resizeEl=Ext.isSafari?this.wrap:(this.wrap.up('.x-form-element',5)||this.wrap);}
return this.resizeEl;},getPositionEl:function(){return this.wrap;},getActionEl:function(){return this.wrap;},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,initValue:Ext.emptyFn,getValue:function(){if(this.rendered){return this.el.dom.checked;}
return false;},setValue:function(v){var checked=this.checked;this.checked=(v===true||v==='true'||v=='1'||String(v).toLowerCase()=='on');if(this.el&&this.el.dom){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked;}
this.wrap[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);}}}});Ext.reg('checkbox',Ext.form.Checkbox);Ext.form.CheckboxGroup=Ext.extend(Ext.form.Field,{columns:'auto',vertical:false,allowBlank:true,blankText:"You must select at least one item in this group",defaultType:'checkbox',groupCls:'x-form-check-group',onRender:function(ct,position){if(!this.el){var panelCfg={cls:this.groupCls,layout:'column',border:false,renderTo:ct};var colCfg={defaultType:this.defaultType,layout:'form',border:false,defaults:{hideLabel:true,anchor:'100%'}}
if(this.items[0].items){Ext.apply(panelCfg,{layoutConfig:{columns:this.items.length},defaults:this.defaults,items:this.items})
for(var i=0,len=this.items.length;i<len;i++){Ext.applyIf(this.items[i],colCfg);};}else{var numCols,cols=[];if(typeof this.columns=='string'){this.columns=this.items.length;}
if(!Ext.isArray(this.columns)){var cs=[];for(var i=0;i<this.columns;i++){cs.push((100/this.columns)*.01);}
this.columns=cs;}
numCols=this.columns.length;for(var i=0;i<numCols;i++){var cc=Ext.apply({items:[]},colCfg);cc[this.columns[i]<=1?'columnWidth':'width']=this.columns[i];if(this.defaults){cc.defaults=Ext.apply(cc.defaults||{},this.defaults)}
cols.push(cc);};if(this.vertical){var rows=Math.ceil(this.items.length/numCols),ri=0;for(var i=0,len=this.items.length;i<len;i++){if(i>0&&i%rows==0){ri++;}
if(this.items[i].fieldLabel){this.items[i].hideLabel=false;}
cols[ri].items.push(this.items[i]);};}else{for(var i=0,len=this.items.length;i<len;i++){var ci=i%numCols;if(this.items[i].fieldLabel){this.items[i].hideLabel=false;}
cols[ci].items.push(this.items[i]);};}
Ext.apply(panelCfg,{layoutConfig:{columns:numCols},items:cols});}
this.panel=new Ext.Panel(panelCfg);this.el=this.panel.getEl();if(this.forId&&this.itemCls){var l=this.el.up(this.itemCls).child('label',true);if(l){l.setAttribute('htmlFor',this.forId);}}
var fields=this.panel.findBy(function(c){return c.isFormField;},this);this.items=new Ext.util.MixedCollection();this.items.addAll(fields);}
Ext.form.CheckboxGroup.superclass.onRender.call(this,ct,position);},validateValue:function(value){if(!this.allowBlank){var blank=true;this.items.each(function(f){if(f.checked){return blank=false;}},this);if(blank){this.markInvalid(this.blankText);return false;}}
return true;},onDisable:function(){this.items.each(function(item){item.disable();})},onEnable:function(){this.items.each(function(item){item.enable();})},onResize:function(w,h){this.panel.setSize(w,h);this.panel.doLayout();},reset:function(){Ext.form.CheckboxGroup.superclass.reset.call(this);this.items.each(function(c){if(c.reset){c.reset();}},this);},initValue:Ext.emptyFn,getValue:Ext.emptyFn,getRawValue:Ext.emptyFn,setValue:Ext.emptyFn,setRawValue:Ext.emptyFn});Ext.reg('checkboxgroup',Ext.form.CheckboxGroup);Ext.form.Radio=Ext.extend(Ext.form.Checkbox,{inputType:'radio',baseCls:'x-form-radio',getGroupValue:function(){var c=this.getParent().child('input[name='+this.el.dom.name+']:checked',true);return c?c.value:null;},getParent:function(){return this.el.up('form')||Ext.getBody();},toggleValue:function(){if(!this.checked){var els=this.getParent().select('input[name='+this.el.dom.name+']');els.each(function(el){if(el.dom.id==this.id){this.setValue(true);}else{Ext.getCmp(el.dom.id).setValue(false);}},this);}},setValue:function(v){if(typeof v=='boolean'){Ext.form.Radio.superclass.setValue.call(this,v);}else{var r=this.getParent().child('input[name='+this.el.dom.name+'][value='+v+']',true);if(r&&!r.checked){Ext.getCmp(r.id).toggleValue();};}},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn});Ext.reg('radio',Ext.form.Radio);Ext.form.RadioGroup=Ext.extend(Ext.form.CheckboxGroup,{allowBlank:true,blankText:"You must select one item in this group",defaultType:'radio',groupCls:'x-form-radio-group'});Ext.reg('radiogroup',Ext.form.RadioGroup);Ext.form.Hidden=Ext.extend(Ext.form.Field,{inputType:'hidden',onRender:function(){Ext.form.Hidden.superclass.onRender.apply(this,arguments);},initEvents:function(){this.originalValue=this.getValue();},setSize:Ext.emptyFn,setWidth:Ext.emptyFn,setHeight:Ext.emptyFn,setPosition:Ext.emptyFn,setPagePosition:Ext.emptyFn,markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn});Ext.reg('hidden',Ext.form.Hidden);Ext.form.BasicForm=function(el,config){Ext.apply(this,config);this.items=new Ext.util.MixedCollection(false,function(o){return o.id||(o.id=Ext.id());});this.addEvents('beforeaction','actionfailed','actioncomplete');if(el){this.initEl(el);}
Ext.form.BasicForm.superclass.constructor.call(this);};Ext.extend(Ext.form.BasicForm,Ext.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,initEl:function(el){this.el=Ext.get(el);this.id=this.el.id||Ext.id();if(!this.standardSubmit){this.el.on('submit',this.onSubmit,this);}
this.el.addClass('x-form');},getEl:function(){return this.el;},onSubmit:function(e){e.stopEvent();},destroy:function(){this.items.each(function(f){Ext.destroy(f);});if(this.el){this.el.removeAllListeners();this.el.remove();}
this.purgeListeners();},isValid:function(){var valid=true;this.items.each(function(f){if(!f.validate()){valid=false;}});return valid;},isDirty:function(){var dirty=false;this.items.each(function(f){if(f.isDirty()){dirty=true;return false;}});return dirty;},doAction:function(action,options){if(typeof action=='string'){action=new Ext.form.Action.ACTION_TYPES[action](this,options);}
if(this.fireEvent('beforeaction',this,action)!==false){this.beforeAction(action);action.run.defer(100,action);}
return this;},submit:function(options){if(this.standardSubmit){var v=this.isValid();if(v){this.el.dom.submit();}
return v;}
this.doAction('submit',options);return this;},load:function(options){this.doAction('load',options);return this;},updateRecord:function(record){record.beginEdit();var fs=record.fields;fs.each(function(f){var field=this.findField(f.name);if(field){record.set(f.name,field.getValue());}},this);record.endEdit();return this;},loadRecord:function(record){this.setValues(record.data);return this;},beforeAction:function(action){var o=action.options;if(o.waitMsg){if(this.waitMsgTarget===true){this.el.mask(o.waitMsg,'x-mask-loading');}else if(this.waitMsgTarget){this.waitMsgTarget=Ext.get(this.waitMsgTarget);this.waitMsgTarget.mask(o.waitMsg,'x-mask-loading');}else{Ext.MessageBox.wait(o.waitMsg,o.waitTitle||this.waitTitle||'Please Wait...');}}},afterAction:function(action,success){this.activeAction=null;var o=action.options;if(o.waitMsg){if(this.waitMsgTarget===true){this.el.unmask();}else if(this.waitMsgTarget){this.waitMsgTarget.unmask();}else{Ext.MessageBox.updateProgress(1);Ext.MessageBox.hide();}}
if(success){if(o.reset){this.reset();}
Ext.callback(o.success,o.scope,[this,action]);this.fireEvent('actioncomplete',this,action);}else{Ext.callback(o.failure,o.scope,[this,action]);this.fireEvent('actionfailed',this,action);}},findField:function(id){var field=this.items.get(id);if(!field){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){field=f;return false;}});}
return field||null;},markInvalid:function(errors){if(Ext.isArray(errors)){for(var i=0,len=errors.length;i<len;i++){var fieldError=errors[i];var f=this.findField(fieldError.id);if(f){f.markInvalid(fieldError.msg);}}}else{var field,id;for(id in errors){if(typeof errors[id]!='function'&&(field=this.findField(id))){field.markInvalid(errors[id]);}}}
return this;},setValues:function(values){if(Ext.isArray(values)){for(var i=0,len=values.length;i<len;i++){var v=values[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var field,id;for(id in values){if(typeof values[id]!='function'&&(field=this.findField(id))){field.setValue(values[id]);if(this.trackResetOnLoad){field.originalValue=field.getValue();}}}}
return this;},getValues:function(asString){var fs=Ext.lib.Ajax.serializeForm(this.el.dom);if(asString===true){return fs;}
return Ext.urlDecode(fs);},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();});return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(field){this.items.remove(field);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyToMarkup(f.id);}});return this;},applyToFields:function(o){this.items.each(function(f){Ext.apply(f,o);});return this;},applyIfToFields:function(o){this.items.each(function(f){Ext.applyIf(f,o);});return this;}});Ext.BasicForm=Ext.form.BasicForm;Ext.FormPanel=Ext.extend(Ext.Panel,{buttonAlign:'center',minButtonWidth:75,labelAlign:'left',monitorValid:false,monitorPoll:200,layout:'form',initComponent:function(){this.form=this.createForm();this.bodyCfg={tag:'form',cls:this.baseCls+'-body',method:this.method||'POST',id:this.formId||Ext.id()};if(this.fileUpload){this.bodyCfg.enctype='multipart/form-data';}
Ext.FormPanel.superclass.initComponent.call(this);this.addEvents('clientvalidation');this.relayEvents(this.form,['beforeaction','actionfailed','actioncomplete']);},createForm:function(){delete this.initialConfig.listeners;return new Ext.form.BasicForm(null,this.initialConfig);},initFields:function(){var f=this.form;var formPanel=this;var fn=function(c){if(c.isFormField){f.add(c);}else if(c.doLayout&&c!=formPanel){Ext.applyIf(c,{labelAlign:c.ownerCt.labelAlign,labelWidth:c.ownerCt.labelWidth,itemCls:c.ownerCt.itemCls});if(c.items){c.items.each(fn);}}}
this.items.each(fn);},getLayoutTarget:function(){return this.form.el;},getForm:function(){return this.form;},onRender:function(ct,position){this.initFields();Ext.FormPanel.superclass.onRender.call(this,ct,position);this.form.initEl(this.body);},beforeDestroy:function(){Ext.FormPanel.superclass.beforeDestroy.call(this);this.stopMonitoring();Ext.destroy(this.form);},initEvents:function(){Ext.FormPanel.superclass.initEvents.call(this);this.items.on('remove',this.onRemove,this);this.items.on('add',this.onAdd,this);if(this.monitorValid){this.startMonitoring();}},onAdd:function(ct,c){if(c.isFormField){this.form.add(c);}},onRemove:function(c){if(c.isFormField){Ext.destroy(c.container.up('.x-form-item'));this.form.remove(c);}},startMonitoring:function(){if(!this.bound){this.bound=true;Ext.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this});}},stopMonitoring:function(){this.bound=false;},load:function(){this.form.load.apply(this.form,arguments);},onDisable:function(){Ext.FormPanel.superclass.onDisable.call(this);if(this.form){this.form.items.each(function(){this.disable();});}},onEnable:function(){Ext.FormPanel.superclass.onEnable.call(this);if(this.form){this.form.items.each(function(){this.enable();});}},bindHandler:function(){if(!this.bound){return false;}
var valid=true;this.form.items.each(function(f){if(!f.isValid(true)){valid=false;return false;}});if(this.buttons){for(var i=0,len=this.buttons.length;i<len;i++){var btn=this.buttons[i];if(btn.formBind===true&&btn.disabled===valid){btn.setDisabled(!valid);}}}
this.fireEvent('clientvalidation',this,valid);}});Ext.reg('form',Ext.FormPanel);Ext.form.FormPanel=Ext.FormPanel;Ext.form.FieldSet=Ext.extend(Ext.Panel,{baseCls:'x-fieldset',layout:'form',onRender:function(ct,position){if(!this.el){this.el=document.createElement('fieldset');this.el.id=this.id;if(this.title||this.header||this.checkboxToggle){this.el.appendChild(document.createElement('legend')).className='x-fieldset-header';}}
Ext.form.FieldSet.superclass.onRender.call(this,ct,position);if(this.checkboxToggle){var o=typeof this.checkboxToggle=='object'?this.checkboxToggle:{tag:'input',type:'checkbox',name:this.checkboxName||this.id+'-checkbox'};this.checkbox=this.header.insertFirst(o);this.checkbox.dom.checked=!this.collapsed;this.checkbox.on('click',this.onCheckClick,this);}},onCollapse:function(doAnim,animArg){if(this.checkbox){this.checkbox.dom.checked=false;}
this.afterCollapse();},onExpand:function(doAnim,animArg){if(this.checkbox){this.checkbox.dom.checked=true;}
this.afterExpand();},onCheckClick:function(){this[this.checkbox.dom.checked?'expand':'collapse']();}});Ext.reg('fieldset',Ext.form.FieldSet);Ext.form.HtmlEditor=Ext.extend(Ext.form.Field,{enableFormat:true,enableFontSize:true,enableColors:true,enableAlignments:true,enableLists:true,enableSourceEdit:true,enableLinks:true,enableFont:true,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],defaultFont:'tahoma',validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Ext.emptyFn,iframePad:3,hideMode:'offsets',defaultAutoCreate:{tag:"textarea",style:"width:500px;height:300px;",autocomplete:"off"},initComponent:function(){this.addEvents('initialize','activate','beforesync','beforepush','sync','push','editmodechange')},createFontOptions:function(){var buf=[],fs=this.fontFamilies,ff,lc;for(var i=0,len=fs.length;i<len;i++){ff=fs[i];lc=ff.toLowerCase();buf.push('<option value="',lc,'" style="font-family:',ff,';"',(this.defaultFont==lc?' selected="true">':'>'),ff,'</option>');}
return buf.join('');},createToolbar:function(editor){var tipsEnabled=Ext.QuickTips&&Ext.QuickTips.isEnabled();function btn(id,toggle,handler){return{itemId:id,cls:'x-btn-icon x-edit-'+id,enableToggle:toggle!==false,scope:editor,handler:handler||editor.relayBtnCmd,clickEvent:'mousedown',tooltip:tipsEnabled?editor.buttonTips[id]||undefined:undefined,tabIndex:-1};}
var tb=new Ext.Toolbar({renderTo:this.wrap.dom.firstChild});tb.el.on('click',function(e){e.preventDefault();});if(this.enableFont&&!Ext.isSafari2){this.fontSelect=tb.el.createChild({tag:'select',cls:'x-font-select',html:this.createFontOptions()});this.fontSelect.on('change',function(){var font=this.fontSelect.dom.value;this.relayCmd('fontname',font);this.deferFocus();},this);tb.add(this.fontSelect.dom,'-');};if(this.enableFormat){tb.add(btn('bold'),btn('italic'),btn('underline'));};if(this.enableFontSize){tb.add('-',btn('increasefontsize',false,this.adjustFont),btn('decreasefontsize',false,this.adjustFont));};if(this.enableColors){tb.add('-',{itemId:'forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:tipsEnabled?editor.buttonTips['forecolor']||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({allowReselect:true,focus:Ext.emptyFn,value:'000000',plain:true,selectHandler:function(cp,color){this.execCmd('forecolor',Ext.isSafari||Ext.isIE?'#'+color:color);this.deferFocus();},scope:this,clickEvent:'mousedown'})},{itemId:'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:tipsEnabled?editor.buttonTips['backcolor']||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({focus:Ext.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,color){if(Ext.isGecko){this.execCmd('useCSS',false);this.execCmd('hilitecolor',color);this.execCmd('useCSS',true);this.deferFocus();}else{this.execCmd(Ext.isOpera?'hilitecolor':'backcolor',Ext.isSafari||Ext.isIE?'#'+color:color);this.deferFocus();}},scope:this,clickEvent:'mousedown'})});};if(this.enableAlignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));};if(!Ext.isSafari2){if(this.enableLinks){tb.add('-',btn('createlink',false,this.createLink));};if(this.enableLists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}
if(this.enableSourceEdit){tb.add('-',btn('sourceedit',true,function(btn){this.toggleSourceEdit(btn.pressed);}));}}
this.tb=tb;},getDocMarkup:function(){return'<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';},getEditorBody:function(){return this.doc.body||this.doc.documentElement;},getDoc:function(){return Ext.isIE?this.getWin().document:(this.iframe.contentDocument||this.getWin().document);},getWin:function(){return Ext.isIE?this.iframe.contentWindow:window.frames[this.iframe.name];},onRender:function(ct,position){Ext.form.HtmlEditor.superclass.onRender.call(this,ct,position);this.el.dom.style.border='0 none';this.el.dom.setAttribute('tabIndex',-1);this.el.addClass('x-hidden');if(Ext.isIE){this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')}
this.wrap=this.el.wrap({cls:'x-html-editor-wrap',cn:{cls:'x-html-editor-tb'}});this.createToolbar(this);this.tb.items.each(function(item){if(item.itemId!='sourceedit'){item.disable();}});var iframe=document.createElement('iframe');iframe.name=Ext.id();iframe.frameBorder='0';iframe.src=Ext.isIE?Ext.SSL_SECURE_URL:"javascript:;";this.wrap.dom.appendChild(iframe);this.iframe=iframe;this.initFrame();if(this.autoMonitorDesignMode!==false){this.monitorTask=Ext.TaskMgr.start({run:this.checkDesignMode,scope:this,interval:100});}
if(!this.width){var sz=this.el.getSize();this.setSize(sz.width,this.height||sz.height);}},initFrame:function(){this.doc=this.getDoc();this.win=this.getWin();this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var task={run:function(){if(this.doc.body||this.doc.readyState=='complete'){Ext.TaskMgr.stop(task);this.doc.designMode="on";this.initEditor.defer(10,this);}},interval:10,duration:10000,scope:this};Ext.TaskMgr.start(task);},checkDesignMode:function(){if(this.wrap&&this.wrap.dom.offsetWidth){var doc=this.getDoc();if(!doc){return;}
if(!doc.editorInitialized||String(doc.designMode).toLowerCase()!='on'){this.initFrame();}}},onResize:function(w,h){Ext.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(typeof w=='number'){var aw=w-this.wrap.getFrameWidth('lr');this.el.setWidth(this.adjustWidth('textarea',aw));this.iframe.style.width=aw+'px';}
if(typeof h=='number'){var ah=h-this.wrap.getFrameWidth('tb')-this.tb.el.getHeight();this.el.setHeight(this.adjustWidth('textarea',ah));this.iframe.style.height=ah+'px';if(this.doc){this.getEditorBody().style.height=(ah-(this.iframePad*2))+'px';}}}},toggleSourceEdit:function(sourceEditMode){if(sourceEditMode===undefined){sourceEditMode=!this.sourceEditMode;}
this.sourceEditMode=sourceEditMode===true;var btn=this.tb.items.get('sourceedit');if(btn.pressed!==this.sourceEditMode){btn.toggle(this.sourceEditMode);return;}
if(this.sourceEditMode){this.tb.items.each(function(item){if(item.itemId!='sourceedit'){item.disable();}});this.syncValue();this.iframe.className='x-hidden';this.el.removeClass('x-hidden');this.el.dom.removeAttribute('tabIndex');this.el.focus();}else{if(this.initialized){this.tb.items.each(function(item){item.enable();});}
this.pushValue();this.iframe.className='';this.el.addClass('x-hidden');this.el.dom.setAttribute('tabIndex',-1);this.deferFocus();}
var lastSize=this.lastSize;if(lastSize){delete this.lastSize;this.setSize(lastSize);}
this.fireEvent('editmodechange',this,this.sourceEditMode);},createLink:function(){var url=prompt(this.createLinkText,this.defaultLinkValue);if(url&&url!='http:/'+'/'){this.relayCmd('createlink',url);}},adjustSize:Ext.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},initEvents:function(){this.originalValue=this.getValue();},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,setValue:function(v){Ext.form.HtmlEditor.superclass.setValue.call(this,v);this.pushValue();},cleanHtml:function(html){html=String(html);if(html.length>5){if(Ext.isSafari){html=html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,'');}}
if(html=='&nbsp;'){html='';}
return html;},syncValue:function(){if(this.initialized){var bd=this.getEditorBody();var html=bd.innerHTML;if(Ext.isSafari){var bs=bd.getAttribute('style');var m=bs.match(/text-align:(.*?);/i);if(m&&m[1]){html='<div style="'+m[0]+'">'+html+'</div>';}}
html=this.cleanHtml(html);if(this.fireEvent('beforesync',this,html)!==false){this.el.dom.value=html;this.fireEvent('sync',this,html);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value;if(!this.activated&&v.length<1){v='&nbsp;';}
if(this.fireEvent('beforepush',this,v)!==false){this.getEditorBody().innerHTML=v;this.fireEvent('push',this,v);}}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();}else{this.el.focus();}},initEditor:function(){var dbody=this.getEditorBody();var ss=this.el.getStyles('font-size','font-family','background-image','background-repeat');ss['background-attachment']='fixed';dbody.bgProperties='fixed';Ext.DomHelper.applyStyles(dbody,ss);if(this.doc){try{Ext.EventManager.removeAll(this.doc);}catch(e){}}
this.doc=this.getDoc();Ext.EventManager.on(this.doc,{'mousedown':this.onEditorEvent,'dblclick':this.onEditorEvent,'click':this.onEditorEvent,'keyup':this.onEditorEvent,buffer:100,scope:this});if(Ext.isGecko){Ext.EventManager.on(this.doc,'keypress',this.applyCommand,this);}
if(Ext.isIE||Ext.isSafari||Ext.isOpera){Ext.EventManager.on(this.doc,'keydown',this.fixKeys,this);}
this.initialized=true;this.fireEvent('initialize',this);this.doc.editorInitialized=true;this.pushValue();},onDestroy:function(){if(this.monitorTask){Ext.TaskMgr.stop(this.monitorTask);}
if(this.rendered){this.tb.items.each(function(item){if(item.menu){item.menu.removeAll();if(item.menu.el){item.menu.el.destroy();}}
item.destroy();});this.wrap.dom.innerHTML='';this.wrap.remove();}},onFirstFocus:function(){this.activated=true;this.tb.items.each(function(item){item.enable();});if(Ext.isGecko){this.win.focus();var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0);r.selectNodeContents(this.getEditorBody());r.collapse(true);this.deferFocus();}
try{this.execCmd('useCSS',true);this.execCmd('styleWithCSS',false);}catch(e){}}
this.fireEvent('activate',this);},adjustFont:function(btn){var adjust=btn.itemId=='increasefontsize'?1:-1;var v=parseInt(this.doc.queryCommandValue('FontSize')||2,10);if(Ext.isSafari3||Ext.isAir){if(v<=10){v=1+adjust;}else if(v<=13){v=2+adjust;}else if(v<=16){v=3+adjust;}else if(v<=18){v=4+adjust;}else if(v<=24){v=5+adjust;}else{v=6+adjust;}
v=v.constrain(1,6);}else{if(Ext.isSafari){adjust*=2;}
v=Math.max(1,v+adjust)+(Ext.isSafari?'px':0);}
this.execCmd('FontSize',v);},onEditorEvent:function(e){this.updateToolbar();},updateToolbar:function(){if(!this.activated){this.onFirstFocus();return;}
var btns=this.tb.items.map,doc=this.doc;if(this.enableFont&&!Ext.isSafari2){var name=(this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();if(name!=this.fontSelect.dom.value){this.fontSelect.dom.value=name;}}
if(this.enableFormat){btns.bold.toggle(doc.queryCommandState('bold'));btns.italic.toggle(doc.queryCommandState('italic'));btns.underline.toggle(doc.queryCommandState('underline'));}
if(this.enableAlignments){btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));btns.justifyright.toggle(doc.queryCommandState('justifyright'));}
if(!Ext.isSafari2&&this.enableLists){btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));}
Ext.menu.MenuMgr.hideAll();this.syncValue();},relayBtnCmd:function(btn){this.relayCmd(btn.itemId);},relayCmd:function(cmd,value){(function(){this.focus();this.execCmd(cmd,value);this.updateToolbar();}).defer(10,this);},execCmd:function(cmd,value){this.doc.execCommand(cmd,false,value===undefined?null:value);this.syncValue();},applyCommand:function(e){if(e.ctrlKey){var c=e.getCharCode(),cmd;if(c>0){c=String.fromCharCode(c);switch(c){case'b':cmd='bold';break;case'i':cmd='italic';break;case'u':cmd='underline';break;}
if(cmd){this.win.focus();this.execCmd(cmd);this.deferFocus();e.preventDefault();}}}},insertAtCursor:function(text){if(!this.activated){return;}
if(Ext.isIE){this.win.focus();var r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML(text);this.syncValue();this.deferFocus();}}else if(Ext.isGecko||Ext.isOpera){this.win.focus();this.execCmd('InsertHTML',text);this.deferFocus();}else if(Ext.isSafari){this.execCmd('InsertText',text);this.deferFocus();}},fixKeys:function(){if(Ext.isIE){return function(e){var k=e.getKey(),r;if(k==e.TAB){e.stopEvent();r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;');this.deferFocus();}}else if(k==e.ENTER){r=this.doc.selection.createRange();if(r){var target=r.parentElement();if(!target||target.tagName.toLowerCase()!='li'){e.stopEvent();r.pasteHTML('<br />');r.collapse(false);r.select();}}}};}else if(Ext.isOpera){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.win.focus();this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;');this.deferFocus();}};}else if(Ext.isSafari){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.execCmd('InsertText','\t');this.deferFocus();}};}}(),getToolbar:function(){return this.tb;},buttonTips:{bold:{title:'Bold (Ctrl+B)',text:'Make the selected text bold.',cls:'x-html-editor-tip'},italic:{title:'Italic (Ctrl+I)',text:'Make the selected text italic.',cls:'x-html-editor-tip'},underline:{title:'Underline (Ctrl+U)',text:'Underline the selected text.',cls:'x-html-editor-tip'},increasefontsize:{title:'Grow Text',text:'Increase the font size.',cls:'x-html-editor-tip'},decreasefontsize:{title:'Shrink Text',text:'Decrease the font size.',cls:'x-html-editor-tip'},backcolor:{title:'Text Highlight Color',text:'Change the background color of the selected text.',cls:'x-html-editor-tip'},forecolor:{title:'Font Color',text:'Change the color of the selected text.',cls:'x-html-editor-tip'},justifyleft:{title:'Align Text Left',text:'Align text to the left.',cls:'x-html-editor-tip'},justifycenter:{title:'Center Text',text:'Center text in the editor.',cls:'x-html-editor-tip'},justifyright:{title:'Align Text Right',text:'Align text to the right.',cls:'x-html-editor-tip'},insertunorderedlist:{title:'Bullet List',text:'Start a bulleted list.',cls:'x-html-editor-tip'},insertorderedlist:{title:'Numbered List',text:'Start a numbered list.',cls:'x-html-editor-tip'},createlink:{title:'Hyperlink',text:'Make the selected text a hyperlink.',cls:'x-html-editor-tip'},sourceedit:{title:'Source Edit',text:'Switch to source editing mode.',cls:'x-html-editor-tip'}}});Ext.reg('htmleditor',Ext.form.HtmlEditor);Ext.form.TimeField=Ext.extend(Ext.form.ComboBox,{minValue:null,maxValue:null,minText:"The time in this field must be equal to or after {0}",maxText:"The time in this field must be equal to or before {0}",invalidText:"{0} is not a valid time",format:"g:i A",altFormats:"g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",increment:15,mode:'local',triggerAction:'all',typeAhead:false,initDate:'1/1/2008',initComponent:function(){Ext.form.TimeField.superclass.initComponent.call(this);if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}
if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);}
if(!this.store){var min=this.parseDate(this.minValue);if(!min){min=new Date(this.initDate).clearTime();}
var max=this.parseDate(this.maxValue);if(!max){max=new Date(this.initDate).clearTime().add('mi',(24*60)-1);}
var times=[];while(min<=max){times.push([min.dateFormat(this.format)]);min=min.add('mi',this.increment);}
this.store=new Ext.data.SimpleStore({fields:['text'],data:times});this.displayField='text';}},getValue:function(){var v=Ext.form.TimeField.superclass.getValue.call(this);return this.formatDate(this.parseDate(v))||'';},setValue:function(value){Ext.form.TimeField.superclass.setValue.call(this,this.formatDate(this.parseDate(value)));},validateValue:Ext.form.DateField.prototype.validateValue,parseDate:Ext.form.DateField.prototype.parseDate,formatDate:Ext.form.DateField.prototype.formatDate,beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v.dateFormat(this.format));}}});Ext.reg('timefield',Ext.form.TimeField);Ext.form.Label=Ext.extend(Ext.BoxComponent,{onRender:function(ct,position){if(!this.el){this.el=document.createElement('label');this.el.id=this.getId();this.el.innerHTML=this.text?Ext.util.Format.htmlEncode(this.text):(this.html||'');if(this.forId){this.el.setAttribute('htmlFor',this.forId);}}
Ext.form.Label.superclass.onRender.call(this,ct,position);},setText:function(t,encode){this.text=t;if(this.rendered){this.el.dom.innerHTML=encode!==false?Ext.util.Format.htmlEncode(t):t;}
return this;}});Ext.reg('label',Ext.form.Label);Ext.form.Action=function(form,options){this.form=form;this.options=options||{};};Ext.form.Action.CLIENT_INVALID='client';Ext.form.Action.SERVER_INVALID='server';Ext.form.Action.CONNECT_FAILURE='connect';Ext.form.Action.LOAD_FAILURE='load';Ext.form.Action.prototype={type:'default',run:function(options){},success:function(response){},handleResponse:function(response){},failure:function(response){this.response=response;this.failureType=Ext.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},processResponse:function(response){this.response=response;if(!response.responseText){return true;}
this.result=this.handleResponse(response);return this.result;},getUrl:function(appendParams){var url=this.options.url||this.form.url||this.form.el.dom.action;if(appendParams){var p=this.getParams();if(p){url+=(url.indexOf('?')!=-1?'&':'?')+p;}}
return url;},getMethod:function(){return(this.options.method||this.form.method||this.form.el.dom.method||'POST').toUpperCase();},getParams:function(){var bp=this.form.baseParams;var p=this.options.params;if(p){if(typeof p=="object"){p=Ext.urlEncode(Ext.applyIf(p,bp));}else if(typeof p=='string'&&bp){p+='&'+Ext.urlEncode(bp);}}else if(bp){p=Ext.urlEncode(bp);}
return p;},createCallback:function(opts){var opts=opts||{};return{success:this.success,failure:this.failure,scope:this,timeout:(opts.timeout*1000)||(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined};}};Ext.form.Action.Submit=function(form,options){Ext.form.Action.Submit.superclass.constructor.call(this,form,options);};Ext.extend(Ext.form.Action.Submit,Ext.form.Action,{type:'submit',run:function(){var o=this.options;var method=this.getMethod();var isGet=method=='GET';if(o.clientValidation===false||this.form.isValid()){Ext.Ajax.request(Ext.apply(this.createCallback(o),{form:this.form.el.dom,url:this.getUrl(isGet),method:method,headers:o.headers,params:!isGet?this.getParams():null,isUpload:this.form.fileUpload}));}else if(o.clientValidation!==false){this.failureType=Ext.form.Action.CLIENT_INVALID;this.form.afterAction(this,false);}},success:function(response){var result=this.processResponse(response);if(result===true||result.success){this.form.afterAction(this,true);return;}
if(result.errors){this.form.markInvalid(result.errors);this.failureType=Ext.form.Action.SERVER_INVALID;}
this.form.afterAction(this,false);},handleResponse:function(response){if(this.form.errorReader){var rs=this.form.errorReader.read(response);var errors=[];if(rs.records){for(var i=0,len=rs.records.length;i<len;i++){var r=rs.records[i];errors[i]=r.data;}}
if(errors.length<1){errors=null;}
return{success:rs.success,errors:errors};}
return Ext.decode(response.responseText);}});Ext.form.Action.Load=function(form,options){Ext.form.Action.Load.superclass.constructor.call(this,form,options);this.reader=this.form.reader;};Ext.extend(Ext.form.Action.Load,Ext.form.Action,{type:'load',run:function(){Ext.Ajax.request(Ext.apply(this.createCallback(this.options),{method:this.getMethod(),url:this.getUrl(false),headers:this.options.headers,params:this.getParams()}));},success:function(response){var result=this.processResponse(response);if(result===true||!result.success||!result.data){this.failureType=Ext.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return;}
this.form.clearInvalid();this.form.setValues(result.data);this.form.afterAction(this,true);},handleResponse:function(response){if(this.form.reader){var rs=this.form.reader.read(response);var data=rs.records&&rs.records[0]?rs.records[0].data:null;return{success:rs.success,data:data};}
return Ext.decode(response.responseText);}});Ext.form.Action.ACTION_TYPES={'load':Ext.form.Action.Load,'submit':Ext.form.Action.Submit};Ext.form.VTypes=function(){var alpha=/^[a-zA-Z_]+$/;var alphanum=/^[a-zA-Z0-9_]+$/;var email=/^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;var url=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return{'email':function(v){return email.test(v);},'emailText':'This field should be an e-mail address in the format "user@domain.com"','emailMask':/[a-z0-9_\.\-@]/i,'url':function(v){return url.test(v);},'urlText':'This field should be a URL in the format "http:/'+'/www.domain.com"','alpha':function(v){return alpha.test(v);},'alphaText':'This field should only contain letters and _','alphaMask':/[a-z_]/i,'alphanum':function(v){return alphanum.test(v);},'alphanumText':'This field should only contain letters, numbers and _','alphanumMask':/[a-z0-9_]/i};}();Ext.grid.GridPanel=Ext.extend(Ext.Panel,{ddText:"{0} selected row{1}",minColumnWidth:25,trackMouseOver:true,enableDragDrop:false,enableColumnMove:true,enableColumnHide:true,enableHdMenu:true,stripeRows:false,autoExpandColumn:false,autoExpandMin:50,autoExpandMax:1000,view:null,loadMask:false,deferRowRender:true,rendered:false,viewReady:false,stateEvents:["columnmove","columnresize","sortchange"],initComponent:function(){Ext.grid.GridPanel.superclass.initComponent.call(this);this.autoScroll=false;this.autoWidth=false;if(Ext.isArray(this.columns)){this.colModel=new Ext.grid.ColumnModel(this.columns);delete this.columns;}
if(this.ds){this.store=this.ds;delete this.ds;}
if(this.cm){this.colModel=this.cm;delete this.cm;}
if(this.sm){this.selModel=this.sm;delete this.sm;}
this.store=Ext.StoreMgr.lookup(this.store);this.addEvents("click","dblclick","contextmenu","mousedown","mouseup","mouseover","mouseout","keypress","keydown","cellmousedown","rowmousedown","headermousedown","cellclick","celldblclick","rowclick","rowdblclick","headerclick","headerdblclick","rowcontextmenu","cellcontextmenu","headercontextmenu","bodyscroll","columnresize","columnmove","sortchange");},onRender:function(ct,position){Ext.grid.GridPanel.superclass.onRender.apply(this,arguments);var c=this.body;this.el.addClass('x-grid-panel');var view=this.getView();view.init(this);c.on("mousedown",this.onMouseDown,this);c.on("click",this.onClick,this);c.on("dblclick",this.onDblClick,this);c.on("contextmenu",this.onContextMenu,this);c.on("keydown",this.onKeyDown,this);this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);this.view.render();},initEvents:function(){Ext.grid.GridPanel.superclass.initEvents.call(this);if(this.loadMask){this.loadMask=new Ext.LoadMask(this.bwrap,Ext.apply({store:this.store},this.loadMask));}},initStateEvents:function(){Ext.grid.GridPanel.superclass.initStateEvents.call(this);this.colModel.on('hiddenchange',this.saveState,this,{delay:100});},applyState:function(state){var cm=this.colModel;var cs=state.columns;if(cs){for(var i=0,len=cs.length;i<len;i++){var s=cs[i];var c=cm.getColumnById(s.id);if(c){c.hidden=s.hidden;c.width=s.width;var oldIndex=cm.getIndexById(s.id);if(oldIndex!=i){cm.moveColumn(oldIndex,i);}}}}
if(state.sort){this.store[this.store.remoteSort?'setDefaultSort':'sort'](state.sort.field,state.sort.direction);}},getState:function(){var o={columns:[]};for(var i=0,c;c=this.colModel.config[i];i++){o.columns[i]={id:c.id,width:c.width};if(c.hidden){o.columns[i].hidden=true;}}
var ss=this.store.getSortState();if(ss){o.sort=ss;}
return o;},afterRender:function(){Ext.grid.GridPanel.superclass.afterRender.call(this);this.view.layout();if(this.deferRowRender){this.view.afterRender.defer(10,this.view);}else{this.view.afterRender();}
this.viewReady=true;},reconfigure:function(store,colModel){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Ext.LoadMask(this.bwrap,Ext.apply({store:store},this.initialConfig.loadMask));}
this.view.bind(store,colModel);this.store=store;this.colModel=colModel;if(this.rendered){this.view.refresh(true);}},onKeyDown:function(e){this.fireEvent("keydown",e);},onDestroy:function(){if(this.rendered){if(this.loadMask){this.loadMask.destroy();}
var c=this.body;c.removeAllListeners();this.view.destroy();c.update("");}
this.colModel.purgeListeners();Ext.grid.GridPanel.superclass.onDestroy.call(this);},processEvent:function(name,e){this.fireEvent(name,e);var t=e.getTarget();var v=this.view;var header=v.findHeaderIndex(t);if(header!==false){this.fireEvent("header"+name,this,header,e);}else{var row=v.findRowIndex(t);var cell=v.findCellIndex(t);if(row!==false){this.fireEvent("row"+name,this,row,e);if(cell!==false){this.fireEvent("cell"+name,this,row,cell,e);}}}},onClick:function(e){this.processEvent("click",e);},onMouseDown:function(e){this.processEvent("mousedown",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(row,col,step,fn,scope){var cm=this.colModel,clen=cm.getColumnCount();var ds=this.store,rlen=ds.getCount(),first=true;if(step<0){if(col<0){row--;first=false;}
while(row>=0){if(!first){col=clen-1;}
first=false;while(col>=0){if(fn.call(scope||this,row,col,cm)===true){return[row,col];}
col--;}
row--;}}else{if(col>=clen){row++;first=false;}
while(row<rlen){if(!first){col=0;}
first=false;while(col<clen){if(fn.call(scope||this,row,col,cm)===true){return[row,col];}
col++;}
row++;}}
return null;},getSelections:function(){return this.selModel.getSelections();},onResize:function(){Ext.grid.GridPanel.superclass.onResize.apply(this,arguments);if(this.viewReady){this.view.layout();}},getGridEl:function(){return this.body;},stopEditing:function(){},getSelectionModel:function(){if(!this.selModel){this.selModel=new Ext.grid.RowSelectionModel(this.disableSelection?{selectRow:Ext.emptyFn}:null);}
return this.selModel;},getStore:function(){return this.store;},getColumnModel:function(){return this.colModel;},getView:function(){if(!this.view){this.view=new Ext.grid.GridView(this.viewConfig);}
return this.view;},getDragDropText:function(){var count=this.selModel.getCount();return String.format(this.ddText,count,count==1?'':'s');}});Ext.reg('grid',Ext.grid.GridPanel);Ext.grid.GridView=function(config){Ext.apply(this,config);this.addEvents("beforerowremoved","beforerowsinserted","beforerefresh","rowremoved","rowsinserted","rowupdated","refresh");Ext.grid.GridView.superclass.constructor.call(this);};Ext.extend(Ext.grid.GridView,Ext.util.Observable,{deferEmptyText:true,scrollOffset:19,autoFill:false,forceFit:false,sortClasses:["sort-asc","sort-desc"],sortAscText:"Sort Ascending",sortDescText:"Sort Descending",columnsText:"Columns",borderWidth:2,tdClass:'x-grid3-cell',hdCls:'x-grid3-hd',cellSelectorDepth:4,rowSelectorDepth:10,cellSelector:'td.x-grid3-cell',rowSelector:'div.x-grid3-row',initTemplates:function(){var ts=this.templates||{};if(!ts.master){ts.master=new Ext.Template('<div class="x-grid3" hidefocus="true">','<div class="x-grid3-viewport">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</div>',"</div>");}
if(!ts.header){ts.header=new Ext.Template('<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">','<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',"</table>");}
if(!ts.hcell){ts.hcell=new Ext.Template('<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">',this.grid.enableHdMenu?'<a class="x-grid3-hd-btn" href="#"></a>':'','{value}<img class="x-grid3-sort-icon" src="',Ext.BLANK_IMAGE_URL,'" />',"</div></td>");}
if(!ts.body){ts.body=new Ext.Template('{rows}');}
if(!ts.row){ts.row=new Ext.Template('<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">','<tbody><tr>{cells}</tr>',(this.enableRowBody?'<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>':''),'</tbody></table></div>');}
if(!ts.cell){ts.cell=new Ext.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>','<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',"</td>");}
for(var k in ts){var t=ts[k];if(t&&typeof t.compile=='function'&&!t.compiled){t.disableFormats=true;t.compile();}}
this.templates=ts;this.colRe=new RegExp("x-grid3-td-([^\\s]+)","");},fly:function(el){if(!this._flyweight){this._flyweight=new Ext.Element.Flyweight(document.body);}
this._flyweight.dom=el;return this._flyweight;},getEditorParent:function(ed){return this.scroller.dom;},initElements:function(){var E=Ext.Element;var el=this.grid.getGridEl().dom.firstChild;var cs=el.childNodes;this.el=new E(el);this.mainWrap=new E(cs[0]);this.mainHd=new E(this.mainWrap.dom.firstChild);if(this.grid.hideHeaders){this.mainHd.setDisplayed(false);}
this.innerHd=this.mainHd.dom.firstChild;this.scroller=new E(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle('overflow-x','hidden');}
this.mainBody=new E(this.scroller.dom.firstChild);this.focusEl=new E(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new E(cs[1]);this.resizeProxy=new E(cs[2]);},getRows:function(){return this.hasRows()?this.mainBody.dom.childNodes:[];},findCell:function(el){if(!el){return false;}
return this.fly(el).findParent(this.cellSelector,this.cellSelectorDepth);},findCellIndex:function(el,requiredCls){var cell=this.findCell(el);if(cell&&(!requiredCls||this.fly(cell).hasClass(requiredCls))){return this.getCellIndex(cell);}
return false;},getCellIndex:function(el){if(el){var m=el.className.match(this.colRe);if(m&&m[1]){return this.cm.getIndexById(m[1]);}}
return false;},findHeaderCell:function(el){var cell=this.findCell(el);return cell&&this.fly(cell).hasClass(this.hdCls)?cell:null;},findHeaderIndex:function(el){return this.findCellIndex(el,this.hdCls);},findRow:function(el){if(!el){return false;}
return this.fly(el).findParent(this.rowSelector,this.rowSelectorDepth);},findRowIndex:function(el){var r=this.findRow(el);return r?r.rowIndex:false;},getRow:function(row){return this.getRows()[row];},getCell:function(row,col){return this.getRow(row).getElementsByTagName('td')[col];},getHeaderCell:function(index){return this.mainHd.dom.getElementsByTagName('td')[index];},addRowClass:function(row,cls){var r=this.getRow(row);if(r){this.fly(r).addClass(cls);}},removeRowClass:function(row,cls){var r=this.getRow(row);if(r){this.fly(r).removeClass(cls);}},removeRow:function(row){Ext.removeNode(this.getRow(row));this.focusRow(row);},removeRows:function(firstRow,lastRow){var bd=this.mainBody.dom;for(var rowIndex=firstRow;rowIndex<=lastRow;rowIndex++){Ext.removeNode(bd.childNodes[firstRow]);}
this.focusRow(firstRow);},getScrollState:function(){var sb=this.scroller.dom;return{left:sb.scrollLeft,top:sb.scrollTop};},restoreScroll:function(state){var sb=this.scroller.dom;sb.scrollLeft=state.left;sb.scrollTop=state.top;},scrollToTop:function(){this.scroller.dom.scrollTop=0;this.scroller.dom.scrollLeft=0;},syncScroll:function(){this.syncHeaderScroll();var mb=this.scroller.dom;this.grid.fireEvent("bodyscroll",mb.scrollLeft,mb.scrollTop);},syncHeaderScroll:function(){var mb=this.scroller.dom;this.innerHd.scrollLeft=mb.scrollLeft;this.innerHd.scrollLeft=mb.scrollLeft;},updateSortIcon:function(col,dir){var sc=this.sortClasses;var hds=this.mainHd.select('td').removeClass(sc);hds.item(col).addClass(sc[dir=="DESC"?1:0]);},updateAllColumnWidths:function(){var tw=this.getTotalWidth();var clen=this.cm.getColumnCount();var ws=[];for(var i=0;i<clen;i++){ws[i]=this.getColumnWidth(i);}
this.innerHd.firstChild.firstChild.style.width=tw;for(var i=0;i<clen;i++){var hd=this.getHeaderCell(i);hd.style.width=ws[i];}
var ns=this.getRows();for(var i=0,len=ns.length;i<len;i++){ns[i].style.width=tw;ns[i].firstChild.style.width=tw;var row=ns[i].firstChild.rows[0];for(var j=0;j<clen;j++){row.childNodes[j].style.width=ws[j];}}
this.onAllColumnWidthsUpdated(ws,tw);},updateColumnWidth:function(col,width){var w=this.getColumnWidth(col);var tw=this.getTotalWidth();this.innerHd.firstChild.firstChild.style.width=tw;var hd=this.getHeaderCell(col);hd.style.width=w;var ns=this.getRows();for(var i=0,len=ns.length;i<len;i++){ns[i].style.width=tw;ns[i].firstChild.style.width=tw;ns[i].firstChild.rows[0].childNodes[col].style.width=w;}
this.onColumnWidthUpdated(col,w,tw);},updateColumnHidden:function(col,hidden){var tw=this.getTotalWidth();this.innerHd.firstChild.firstChild.style.width=tw;var display=hidden?'none':'';var hd=this.getHeaderCell(col);hd.style.display=display;var ns=this.getRows();for(var i=0,len=ns.length;i<len;i++){ns[i].style.width=tw;ns[i].firstChild.style.width=tw;ns[i].firstChild.rows[0].childNodes[col].style.display=display;}
this.onColumnHiddenUpdated(col,hidden,tw);delete this.lastViewWidth;this.layout();},doRender:function(cs,rs,ds,startRow,colCount,stripe){var ts=this.templates,ct=ts.cell,rt=ts.row,last=colCount-1;var tstyle='width:'+this.getTotalWidth()+';';var buf=[],cb,c,p={},rp={tstyle:tstyle},r;for(var j=0,len=rs.length;j<len;j++){r=rs[j];cb=[];var rowIndex=(j+startRow);for(var i=0;i<colCount;i++){c=cs[i];p.id=c.id;p.css=i==0?'x-grid3-cell-first ':(i==last?'x-grid3-cell-last ':'');p.attr=p.cellAttr="";p.value=c.renderer(r.data[c.name],p,r,rowIndex,i,ds);p.style=c.style;if(p.value==undefined||p.value==="")p.value="&#160;";if(r.dirty&&typeof r.modified[c.name]!=='undefined'){p.css+=' x-grid3-dirty-cell';}
cb[cb.length]=ct.apply(p);}
var alt=[];if(stripe&&((rowIndex+1)%2==0)){alt[0]="x-grid3-row-alt";}
if(r.dirty){alt[1]=" x-grid3-dirty-row";}
rp.cols=colCount;if(this.getRowClass){alt[2]=this.getRowClass(r,rowIndex,rp,ds);}
rp.alt=alt.join(" ");rp.cells=cb.join("");buf[buf.length]=rt.apply(rp);}
return buf.join("");},processRows:function(startRow,skipStripe){if(this.ds.getCount()<1){return;}
skipStripe=skipStripe||!this.grid.stripeRows;startRow=startRow||0;var rows=this.getRows();var cls=' x-grid3-row-alt ';for(var i=startRow,len=rows.length;i<len;i++){var row=rows[i];row.rowIndex=i;if(!skipStripe){var isAlt=((i+1)%2==0);var hasAlt=(' '+row.className+' ').indexOf(cls)!=-1;if(isAlt==hasAlt){continue;}
if(isAlt){row.className+=" x-grid3-row-alt";}else{row.className=row.className.replace("x-grid3-row-alt","");}}}},afterRender:function(){this.mainBody.dom.innerHTML=this.renderRows();this.processRows(0,true);if(this.deferEmptyText!==true){this.applyEmptyText();}},renderUI:function(){var header=this.renderHeaders();var body=this.templates.body.apply({rows:''});var html=this.templates.master.apply({body:body,header:header});var g=this.grid;g.getGridEl().dom.innerHTML=html;this.initElements();Ext.fly(this.innerHd).on("click",this.handleHdDown,this);this.mainHd.on("mouseover",this.handleHdOver,this);this.mainHd.on("mouseout",this.handleHdOut,this);this.mainHd.on("mousemove",this.handleHdMove,this);this.scroller.on('scroll',this.syncScroll,this);if(g.enableColumnResize!==false){this.splitone=new Ext.grid.GridView.SplitDragZone(g,this.mainHd.dom);}
if(g.enableColumnMove){this.columnDrag=new Ext.grid.GridView.ColumnDragZone(g,this.innerHd);this.columnDrop=new Ext.grid.HeaderDropZone(g,this.mainHd.dom);}
if(g.enableHdMenu!==false){if(g.enableColumnHide!==false){this.colMenu=new Ext.menu.Menu({id:g.id+"-hcols-menu"});this.colMenu.on("beforeshow",this.beforeColMenuShow,this);this.colMenu.on("itemclick",this.handleHdMenuClick,this);}
this.hmenu=new Ext.menu.Menu({id:g.id+"-hctx"});this.hmenu.add({id:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{id:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});if(g.enableColumnHide!==false){this.hmenu.add('-',{id:"columns",text:this.columnsText,menu:this.colMenu,iconCls:'x-cols-icon'});}
this.hmenu.on("itemclick",this.handleHdMenuClick,this);}
if(g.enableDragDrop||g.enableDrag){this.dragZone=new Ext.grid.GridDragZone(g,{ddGroup:g.ddGroup||'GridDD'});}
this.updateHeaderSortState();},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';}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);},onLayout:function(vw,vh){},onColumnWidthUpdated:function(col,w,tw){},onAllColumnWidthsUpdated:function(ws,tw){},onColumnHiddenUpdated:function(col,hidden,tw){},updateColumnText:function(col,text){},afterMove:function(colIndex){},init:function(grid){this.grid=grid;this.initTemplates();this.initData(grid.store,grid.colModel);this.initUI(grid);},getColumnId:function(index){return this.cm.getColumnId(index);},renderHeaders:function(){var cm=this.cm,ts=this.templates;var ct=ts.hcell;var cb=[],sb=[],p={};for(var i=0,len=cm.getColumnCount();i<len;i++){p.id=cm.getColumnId(i);p.value=cm.getColumnHeader(i)||"";p.style=this.getColumnStyle(i,true);p.tooltip=this.getColumnTooltip(i);if(cm.config[i].align=='right'){p.istyle='padding-right:16px';}else{delete p.istyle;}
cb[cb.length]=ct.apply(p);}
return ts.header.apply({cells:cb.join(""),tstyle:'width:'+this.getTotalWidth()+';'});},getColumnTooltip:function(i){var tt=this.cm.getColumnTooltip(i);if(tt){if(Ext.QuickTips.isEnabled()){return'ext:qtip="'+tt+'"';}else{return'title="'+tt+'"';}}
return"";},beforeUpdate:function(){this.grid.stopEditing(true);},updateHeaders:function(){this.innerHd.firstChild.innerHTML=this.renderHeaders();},focusRow:function(row){this.focusCell(row,0,false);},focusCell:function(row,col,hscroll){row=Math.min(row,Math.max(0,this.getRows().length-1));var xy=this.ensureVisible(row,col,hscroll);this.focusEl.setXY(xy||this.scroller.getXY());if(Ext.isGecko){this.focusEl.focus();}else{this.focusEl.focus.defer(1,this.focusEl);}},ensureVisible:function(row,col,hscroll){if(typeof row!="number"){row=row.rowIndex;}
if(!this.ds){return;}
if(row<0||row>=this.ds.getCount()){return;}
col=(col!==undefined?col:0);var rowEl=this.getRow(row),cellEl;if(!(hscroll===false&&col===0)){while(this.cm.isHidden(col)){col++;}
cellEl=this.getCell(row,col);}
if(!rowEl){return;}
var c=this.scroller.dom;var ctop=0;var p=rowEl,stop=this.el.dom;while(p&&p!=stop){ctop+=p.offsetTop;p=p.offsetParent;}
ctop-=this.mainHd.dom.offsetHeight;var cbot=ctop+rowEl.offsetHeight;var ch=c.clientHeight;var stop=parseInt(c.scrollTop,10);var sbot=stop+ch;if(ctop<stop){c.scrollTop=ctop;}else if(cbot>sbot){c.scrollTop=cbot-ch;}
if(hscroll!==false){var cleft=parseInt(cellEl.offsetLeft,10);var cright=cleft+cellEl.offsetWidth;var sleft=parseInt(c.scrollLeft,10);var sright=sleft+c.clientWidth;if(cleft<sleft){c.scrollLeft=cleft;}else if(cright>sright){c.scrollLeft=cright-c.clientWidth;}}
return cellEl?Ext.fly(cellEl).getXY():[c.scrollLeft+this.el.getX(),Ext.fly(rowEl).getY()];},insertRows:function(dm,firstRow,lastRow,isUpdate){if(!isUpdate&&firstRow===0&&lastRow>=dm.getCount()-1){this.refresh();}else{if(!isUpdate){this.fireEvent("beforerowsinserted",this,firstRow,lastRow);}
var html=this.renderRows(firstRow,lastRow);var before=this.getRow(firstRow);if(before){Ext.DomHelper.insertHtml('beforeBegin',before,html);}else{Ext.DomHelper.insertHtml('beforeEnd',this.mainBody.dom,html);}
if(!isUpdate){this.fireEvent("rowsinserted",this,firstRow,lastRow);this.processRows(firstRow);}}
this.focusRow(firstRow);},deleteRows:function(dm,firstRow,lastRow){if(dm.getRowCount()<1){this.refresh();}else{this.fireEvent("beforerowsdeleted",this,firstRow,lastRow);this.removeRows(firstRow,lastRow);this.processRows(firstRow);this.fireEvent("rowsdeleted",this,firstRow,lastRow);}},getColumnStyle:function(col,isHeader){var style=!isHeader?(this.cm.config[col].css||''):'';style+='width:'+this.getColumnWidth(col)+';';if(this.cm.isHidden(col)){style+='display:none;';}
var align=this.cm.config[col].align;if(align){style+='text-align:'+align+';';}
return style;},getColumnWidth:function(col){var w=this.cm.getColumnWidth(col);if(typeof w=='number'){return(Ext.isBorderBox?w:(w-this.borderWidth>0?w-this.borderWidth:0))+'px';}
return w;},getTotalWidth:function(){return this.cm.getTotalWidth()+'px';},fitColumns:function(preventRefresh,onlyExpand,omitColumn){var cm=this.cm,leftOver,dist,i;var tw=cm.getTotalWidth(false);var aw=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(aw<20){return;}
var extra=aw-tw;if(extra===0){return false;}
var vc=cm.getColumnCount(true);var ac=vc-(typeof omitColumn=='number'?1:0);if(ac===0){ac=1;omitColumn=undefined;}
var colCount=cm.getColumnCount();var cols=[];var extraCol=0;var width=0;var w;for(i=0;i<colCount;i++){if(!cm.isHidden(i)&&!cm.isFixed(i)&&i!==omitColumn){w=cm.getColumnWidth(i);cols.push(i);extraCol=i;cols.push(w);width+=w;}}
var frac=(aw-cm.getTotalWidth())/width;while(cols.length){w=cols.pop();i=cols.pop();cm.setColumnWidth(i,Math.max(this.grid.minColumnWidth,Math.floor(w+w*frac)),true);}
if((tw=cm.getTotalWidth(false))>aw){var adjustCol=ac!=vc?omitColumn:extraCol;cm.setColumnWidth(adjustCol,Math.max(1,cm.getColumnWidth(adjustCol)-(tw-aw)),true);}
if(preventRefresh!==true){this.updateAllColumnWidths();}
return true;},autoExpand:function(preventUpdate){var g=this.grid,cm=this.cm;if(!this.userResized&&g.autoExpandColumn){var tw=cm.getTotalWidth(false);var aw=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(tw!=aw){var ci=cm.getIndexById(g.autoExpandColumn);var currentWidth=cm.getColumnWidth(ci);var cw=Math.min(Math.max(((aw-tw)+currentWidth),g.autoExpandMin),g.autoExpandMax);if(cw!=currentWidth){cm.setColumnWidth(ci,cw,true);if(preventUpdate!==true){this.updateColumnWidth(ci,cw);}}}}},getColumnData:function(){var cs=[],cm=this.cm,colCount=cm.getColumnCount();for(var i=0;i<colCount;i++){var name=cm.getDataIndex(i);cs[i]={name:(typeof name=='undefined'?this.ds.fields.get(i).name:name),renderer:cm.getRenderer(i),id:cm.getColumnId(i),style:this.getColumnStyle(i)};}
return cs;},renderRows:function(startRow,endRow){var g=this.grid,cm=g.colModel,ds=g.store,stripe=g.stripeRows;var colCount=cm.getColumnCount();if(ds.getCount()<1){return"";}
var cs=this.getColumnData();startRow=startRow||0;endRow=typeof endRow=="undefined"?ds.getCount()-1:endRow;var rs=ds.getRange(startRow,endRow);return this.doRender(cs,rs,ds,startRow,colCount,stripe);},renderBody:function(){var markup=this.renderRows();return this.templates.body.apply({rows:markup});},refreshRow:function(record){var ds=this.ds,index;if(typeof record=='number'){index=record;record=ds.getAt(index);}else{index=ds.indexOf(record);}
var cls=[];this.insertRows(ds,index,index,true);this.getRow(index).rowIndex=index;this.onRemove(ds,record,index+1,true);this.fireEvent("rowupdated",this,index,record);},refresh:function(headersToo){this.fireEvent("beforerefresh",this);this.grid.stopEditing(true);var result=this.renderBody();this.mainBody.update(result);if(headersToo===true){this.updateHeaders();this.updateHeaderSortState();}
this.processRows(0,true);this.layout();this.applyEmptyText();this.fireEvent("refresh",this);},applyEmptyText:function(){if(this.emptyText&&!this.hasRows()){this.mainBody.update('<div class="x-grid-empty">'+this.emptyText+'</div>');}},updateHeaderSortState:function(){var state=this.ds.getSortState();if(!state){return;}
if(!this.sortState||(this.sortState.field!=state.field||this.sortState.direction!=state.direction)){this.grid.fireEvent('sortchange',this.grid,state);}
this.sortState=state;var sortColumn=this.cm.findColumnIndex(state.field);if(sortColumn!=-1){var sortDir=state.direction;this.updateSortIcon(sortColumn,sortDir);}},destroy:function(){if(this.colMenu){this.colMenu.removeAll();Ext.menu.MenuMgr.unregister(this.colMenu);this.colMenu.getEl().remove();delete this.colMenu;}
if(this.hmenu){this.hmenu.removeAll();Ext.menu.MenuMgr.unregister(this.hmenu);this.hmenu.getEl().remove();delete this.hmenu;}
if(this.grid.enableColumnMove){var dds=Ext.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];if(dds){for(var dd in dds){if(!dds[dd].config.isTarget&&dds[dd].dragElId){var elid=dds[dd].dragElId;dds[dd].unreg();Ext.get(elid).remove();}else if(dds[dd].config.isTarget){dds[dd].proxyTop.remove();dds[dd].proxyBottom.remove();dds[dd].unreg();}
if(Ext.dd.DDM.locationCache[dd]){delete Ext.dd.DDM.locationCache[dd];}}
delete Ext.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];}}
Ext.destroy(this.resizeMarker,this.resizeProxy);if(this.dragZone){this.dragZone.unreg();}
this.initData(null,null);Ext.EventManager.removeResizeListener(this.onWindowResize,this);},onDenyColumnHide:function(){},render:function(){if(this.autoFill){this.fitColumns(true,true);}else if(this.forceFit){this.fitColumns(true,false);}else if(this.grid.autoExpandColumn){this.autoExpand(true);}
this.renderUI();},initData:function(ds,cm){if(this.ds){this.ds.un("load",this.onLoad,this);this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);}
if(ds){ds.on("load",this.onLoad,this);ds.on("datachanged",this.onDataChange,this);ds.on("add",this.onAdd,this);ds.on("remove",this.onRemove,this);ds.on("update",this.onUpdate,this);ds.on("clear",this.onClear,this);}
this.ds=ds;if(this.cm){this.cm.un("configchange",this.onColConfigChange,this);this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this);}
if(cm){delete this.lastViewWidth;cm.on("configchange",this.onColConfigChange,this);cm.on("widthchange",this.onColWidthChange,this);cm.on("headerchange",this.onHeaderChange,this);cm.on("hiddenchange",this.onHiddenChange,this);cm.on("columnmoved",this.onColumnMove,this);cm.on("columnlockchange",this.onColumnLock,this);}
this.cm=cm;},onDataChange:function(){this.refresh();this.updateHeaderSortState();},onClear:function(){this.refresh();},onUpdate:function(ds,record){this.refreshRow(record);},onAdd:function(ds,records,index){this.insertRows(ds,index,index+(records.length-1));},onRemove:function(ds,record,index,isUpdate){if(isUpdate!==true){this.fireEvent("beforerowremoved",this,index,record);}
this.removeRow(index);if(isUpdate!==true){this.processRows(index);this.applyEmptyText();this.fireEvent("rowremoved",this,index,record);}},onLoad:function(){this.scrollToTop();},onColWidthChange:function(cm,col,width){this.updateColumnWidth(col,width);},onHeaderChange:function(cm,col,text){this.updateHeaders();},onHiddenChange:function(cm,col,hidden){this.updateColumnHidden(col,hidden);},onColumnMove:function(cm,oldIndex,newIndex){this.indexMap=null;var s=this.getScrollState();this.refresh(true);this.restoreScroll(s);this.afterMove(newIndex);},onColConfigChange:function(){delete this.lastViewWidth;this.indexMap=null;this.refresh(true);},initUI:function(grid){grid.on("headerclick",this.onHeaderClick,this);if(grid.trackMouseOver){grid.on("mouseover",this.onRowOver,this);grid.on("mouseout",this.onRowOut,this);}},initEvents:function(){},onHeaderClick:function(g,index){if(this.headersDisabled||!this.cm.isSortable(index)){return;}
g.stopEditing(true);g.store.sort(this.cm.getDataIndex(index));},onRowOver:function(e,t){var row;if((row=this.findRowIndex(t))!==false){this.addRowClass(row,"x-grid3-row-over");}},onRowOut:function(e,t){var row;if((row=this.findRowIndex(t))!==false&&row!==this.findRowIndex(e.getRelatedTarget())){this.removeRowClass(row,"x-grid3-row-over");}},handleWheel:function(e){e.stopPropagation();},onRowSelect:function(row){this.addRowClass(row,"x-grid3-row-selected");},onRowDeselect:function(row){this.removeRowClass(row,"x-grid3-row-selected");},onCellSelect:function(row,col){var cell=this.getCell(row,col);if(cell){this.fly(cell).addClass("x-grid3-cell-selected");}},onCellDeselect:function(row,col){var cell=this.getCell(row,col);if(cell){this.fly(cell).removeClass("x-grid3-cell-selected");}},onColumnSplitterMoved:function(i,w){this.userResized=true;var cm=this.grid.colModel;cm.setColumnWidth(i,w,true);if(this.forceFit){this.fitColumns(true,false,i);this.updateAllColumnWidths();}else{this.updateColumnWidth(i,w);}
this.grid.fireEvent("columnresize",i,w);},handleHdMenuClick:function(item){var index=this.hdCtxIndex;var cm=this.cm,ds=this.ds;switch(item.id){case"asc":ds.sort(cm.getDataIndex(index),"ASC");break;case"desc":ds.sort(cm.getDataIndex(index),"DESC");break;default:index=cm.getIndexById(item.id.substr(4));if(index!=-1){if(item.checked&&cm.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false;}
cm.setHidden(index,item.checked);}}
return true;},isHideableColumn:function(c){return!c.hidden&&!c.fixed;},beforeColMenuShow:function(){var cm=this.cm,colCount=cm.getColumnCount();this.colMenu.removeAll();for(var i=0;i<colCount;i++){if(cm.config[i].fixed!==true&&cm.config[i].hideable!==false){this.colMenu.add(new Ext.menu.CheckItem({id:"col-"+cm.getColumnId(i),text:cm.getColumnHeader(i),checked:!cm.isHidden(i),hideOnClick:false,disabled:cm.config[i].hideable===false}));}}},handleHdDown:function(e,t){if(Ext.fly(t).hasClass('x-grid3-hd-btn')){e.stopEvent();var hd=this.findHeaderCell(t);Ext.fly(hd).addClass('x-grid3-hd-menu-open');var index=this.getCellIndex(hd);this.hdCtxIndex=index;var ms=this.hmenu.items,cm=this.cm;ms.get("asc").setDisabled(!cm.isSortable(index));ms.get("desc").setDisabled(!cm.isSortable(index));this.hmenu.on("hide",function(){Ext.fly(hd).removeClass('x-grid3-hd-menu-open');},this,{single:true});this.hmenu.show(t,"tl-bl?");}},handleHdOver:function(e,t){var hd=this.findHeaderCell(t);if(hd&&!this.headersDisabled){this.activeHd=hd;this.activeHdIndex=this.getCellIndex(hd);var fly=this.fly(hd);this.activeHdRegion=fly.getRegion();if(!this.cm.isMenuDisabled(this.activeHdIndex)){fly.addClass("x-grid3-hd-over");this.activeHdBtn=fly.child('.x-grid3-hd-btn');if(this.activeHdBtn){this.activeHdBtn.dom.style.height=(hd.firstChild.offsetHeight-1)+'px';}}}},handleHdMove:function(e,t){if(this.activeHd&&!this.headersDisabled){var hw=this.splitHandleWidth||5;var r=this.activeHdRegion;var x=e.getPageX();var ss=this.activeHd.style;if(x-r.left<=hw&&this.cm.isResizable(this.activeHdIndex-1)){ss.cursor=Ext.isAir?'move':Ext.isSafari?'e-resize':'col-resize';}else if(r.right-x<=(!this.activeHdBtn?hw:2)&&this.cm.isResizable(this.activeHdIndex)){ss.cursor=Ext.isAir?'move':Ext.isSafari?'w-resize':'col-resize';}else{ss.cursor='';}}},handleHdOut:function(e,t){var hd=this.findHeaderCell(t);if(hd&&(!Ext.isIE||!e.within(hd,true))){this.activeHd=null;this.fly(hd).removeClass("x-grid3-hd-over");hd.style.cursor='';}},hasRows:function(){var fc=this.mainBody.dom.firstChild;return fc&&fc.className!='x-grid-empty';},bind:function(d,c){this.initData(d,c);}});Ext.grid.GridView.SplitDragZone=function(grid,hd){this.grid=grid;this.view=grid.getView();this.marker=this.view.resizeMarker;this.proxy=this.view.resizeProxy;Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Ext.id(this.proxy.dom),resizeFrame:false});this.scroll=false;this.hw=this.view.splitHandleWidth||5;};Ext.extend(Ext.grid.GridView.SplitDragZone,Ext.dd.DDProxy,{b4StartDrag:function(x,y){this.view.headersDisabled=true;var h=this.view.mainWrap.getHeight();this.marker.setHeight(h);this.marker.show();this.marker.alignTo(this.view.getHeaderCell(this.cellIndex),'tl-tl',[-2,0]);this.proxy.setHeight(h);var w=this.cm.getColumnWidth(this.cellIndex);var minw=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(minw,1000);this.setYConstraint(0,0);this.minX=x-minw;this.maxX=x+1000;this.startPos=x;Ext.dd.DDProxy.prototype.b4StartDrag.call(this,x,y);},handleMouseDown:function(e){var t=this.view.findHeaderCell(e.getTarget());if(t){var xy=this.view.fly(t).getXY(),x=xy[0],y=xy[1];var exy=e.getXY(),ex=exy[0],ey=exy[1];var w=t.offsetWidth,adjust=false;if((ex-x)<=this.hw){adjust=-1;}else if((x+w)-ex<=this.hw){adjust=0;}
if(adjust!==false){this.cm=this.grid.colModel;var ci=this.view.getCellIndex(t);if(adjust==-1){if(ci+adjust<0){return;}
while(this.cm.isHidden(ci+adjust)){--adjust;if(ci+adjust<0){return;}}}
this.cellIndex=ci+adjust;this.split=t.dom;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this,arguments);}}else if(this.view.columnDrag){this.view.columnDrag.callHandleMouseDown(e);}}},endDrag:function(e){this.marker.hide();var v=this.view;var endX=Math.max(this.minX,e.getPageX());var diff=endX-this.startPos;v.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+diff);setTimeout(function(){v.headersDisabled=false;},50);},autoOffset:function(){this.setDelta(0,0);}});Ext.grid.GroupingView=Ext.extend(Ext.grid.GridView,{hideGroupedColumn:false,showGroupName:true,startCollapsed:false,enableGrouping:true,enableGroupingMenu:true,enableNoGroups:true,emptyGroupText:'(None)',ignoreAdd:false,groupTextTpl:'{text}',gidSeed:1000,initTemplates:function(){Ext.grid.GroupingView.superclass.initTemplates.call(this);this.state={};var sm=this.grid.getSelectionModel();sm.on(sm.selectRow?'beforerowselect':'beforecellselect',this.onBeforeRowSelect,this);if(!this.startGroup){this.startGroup=new Ext.XTemplate('<div id="{groupId}" class="x-grid-group {cls}">','<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>',this.groupTextTpl,'</div></div>','<div id="{groupId}-bd" class="x-grid-group-body">');}
this.startGroup.compile();this.endGroup='</div></div>';},findGroup:function(el){return Ext.fly(el).up('.x-grid-group',this.mainBody.dom);},getGroups:function(){return this.hasRows()?this.mainBody.dom.childNodes:[];},onAdd:function(){if(this.enableGrouping&&!this.ignoreAdd){var ss=this.getScrollState();this.refresh();this.restoreScroll(ss);}else if(!this.enableGrouping){Ext.grid.GroupingView.superclass.onAdd.apply(this,arguments);}},onRemove:function(ds,record,index,isUpdate){Ext.grid.GroupingView.superclass.onRemove.apply(this,arguments);var g=document.getElementById(record._groupId);if(g&&g.childNodes[1].childNodes.length<1){Ext.removeNode(g);}
this.applyEmptyText();},refreshRow:function(record){if(this.ds.getCount()==1){this.refresh();}else{this.isUpdating=true;Ext.grid.GroupingView.superclass.refreshRow.apply(this,arguments);this.isUpdating=false;}},beforeMenuShow:function(){var field=this.getGroupField();var g=this.hmenu.items.get('groupBy');if(g){g.setDisabled(this.cm.config[this.hdCtxIndex].groupable===false);}
var s=this.hmenu.items.get('showGroups');if(s){s.setDisabled(!field&&this.cm.config[this.hdCtxIndex].groupable===false);s.setChecked(!!field,true);}},renderUI:function(){Ext.grid.GroupingView.superclass.renderUI.call(this);this.mainBody.on('mousedown',this.interceptMouse,this);if(this.enableGroupingMenu&&this.hmenu){this.hmenu.add('-',{id:'groupBy',text:this.groupByText,handler:this.onGroupByClick,scope:this,iconCls:'x-group-by-icon'});if(this.enableNoGroups){this.hmenu.add({id:'showGroups',text:this.showGroupsText,checked:true,checkHandler:this.onShowGroupsClick,scope:this});}
this.hmenu.on('beforeshow',this.beforeMenuShow,this);}},onGroupByClick:function(){this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));this.beforeMenuShow();},onShowGroupsClick:function(mi,checked){if(checked){this.onGroupByClick();}else{this.grid.store.clearGrouping();}},toggleGroup:function(group,expanded){this.grid.stopEditing(true);group=Ext.getDom(group);var gel=Ext.fly(group);expanded=expanded!==undefined?expanded:gel.hasClass('x-grid-group-collapsed');this.state[gel.dom.id]=expanded;gel[expanded?'removeClass':'addClass']('x-grid-group-collapsed');},toggleAllGroups:function(expanded){var groups=this.getGroups();for(var i=0,len=groups.length;i<len;i++){this.toggleGroup(groups[i],expanded);}},expandAllGroups:function(){this.toggleAllGroups(true);},collapseAllGroups:function(){this.toggleAllGroups(false);},interceptMouse:function(e){var hd=e.getTarget('.x-grid-group-hd',this.mainBody);if(hd){e.stopEvent();this.toggleGroup(hd.parentNode);}},getGroup:function(v,r,groupRenderer,rowIndex,colIndex,ds){var g=groupRenderer?groupRenderer(v,{},r,rowIndex,colIndex,ds):String(v);if(g===''){g=this.cm.config[colIndex].emptyGroupText||this.emptyGroupText;}
return g;},getGroupField:function(){return this.grid.store.getGroupState();},renderRows:function(){var groupField=this.getGroupField();var eg=!!groupField;if(this.hideGroupedColumn){var colIndex=this.cm.findColumnIndex(groupField);if(!eg&&this.lastGroupField!==undefined){this.mainBody.update('');this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField),false);delete this.lastGroupField;}else if(eg&&this.lastGroupField===undefined){this.lastGroupField=groupField;this.cm.setHidden(colIndex,true);}else if(eg&&this.lastGroupField!==undefined&&groupField!==this.lastGroupField){this.mainBody.update('');var oldIndex=this.cm.findColumnIndex(this.lastGroupField);this.cm.setHidden(oldIndex,false);this.lastGroupField=groupField;this.cm.setHidden(colIndex,true);}}
return Ext.grid.GroupingView.superclass.renderRows.apply(this,arguments);},doRender:function(cs,rs,ds,startRow,colCount,stripe){if(rs.length<1){return'';}
var groupField=this.getGroupField();var colIndex=this.cm.findColumnIndex(groupField);this.enableGrouping=!!groupField;if(!this.enableGrouping||this.isUpdating){return Ext.grid.GroupingView.superclass.doRender.apply(this,arguments);}
var gstyle='width:'+this.getTotalWidth()+';';var gidPrefix=this.grid.getGridEl().id;var cfg=this.cm.config[colIndex];var groupRenderer=cfg.groupRenderer||cfg.renderer;var prefix=this.showGroupName?(cfg.groupName||cfg.header)+': ':'';var groups=[],curGroup,i,len,gid;for(i=0,len=rs.length;i<len;i++){var rowIndex=startRow+i;var r=rs[i],gvalue=r.data[groupField],g=this.getGroup(gvalue,r,groupRenderer,rowIndex,colIndex,ds);if(!curGroup||curGroup.group!=g){gid=gidPrefix+'-gp-'+groupField+'-'+Ext.util.Format.htmlEncode(g);var isCollapsed=typeof this.state[gid]!=='undefined'?!this.state[gid]:this.startCollapsed;var gcls=isCollapsed?'x-grid-group-collapsed':'';curGroup={group:g,gvalue:gvalue,text:prefix+g,groupId:gid,startRow:rowIndex,rs:[r],cls:gcls,style:gstyle};groups.push(curGroup);}else{curGroup.rs.push(r);}
r._groupId=gid;}
var buf=[];for(i=0,len=groups.length;i<len;i++){var g=groups[i];this.doGroupStart(buf,g,cs,ds,colCount);buf[buf.length]=Ext.grid.GroupingView.superclass.doRender.call(this,cs,g.rs,ds,g.startRow,colCount,stripe);this.doGroupEnd(buf,g,cs,ds,colCount);}
return buf.join('');},getGroupId:function(value){var gidPrefix=this.grid.getGridEl().id;var groupField=this.getGroupField();var colIndex=this.cm.findColumnIndex(groupField);var cfg=this.cm.config[colIndex];var groupRenderer=cfg.groupRenderer||cfg.renderer;var gtext=this.getGroup(value,{data:{}},groupRenderer,0,colIndex,this.ds);return gidPrefix+'-gp-'+groupField+'-'+Ext.util.Format.htmlEncode(value);},doGroupStart:function(buf,g,cs,ds,colCount){buf[buf.length]=this.startGroup.apply(g);},doGroupEnd:function(buf,g,cs,ds,colCount){buf[buf.length]=this.endGroup;},getRows:function(){if(!this.enableGrouping){return Ext.grid.GroupingView.superclass.getRows.call(this);}
var r=[];var g,gs=this.getGroups();for(var i=0,len=gs.length;i<len;i++){g=gs[i].childNodes[1].childNodes;for(var j=0,jlen=g.length;j<jlen;j++){r[r.length]=g[j];}}
return r;},updateGroupWidths:function(){if(!this.enableGrouping||!this.hasRows()){return;}
var tw=Math.max(this.cm.getTotalWidth(),this.el.dom.offsetWidth-this.scrollOffset)+'px';var gs=this.getGroups();for(var i=0,len=gs.length;i<len;i++){gs[i].firstChild.style.width=tw;}},onColumnWidthUpdated:function(col,w,tw){this.updateGroupWidths();},onAllColumnWidthsUpdated:function(ws,tw){this.updateGroupWidths();},onColumnHiddenUpdated:function(col,hidden,tw){this.updateGroupWidths();},onLayout:function(){this.updateGroupWidths();},onBeforeRowSelect:function(sm,rowIndex){if(!this.enableGrouping){return;}
var row=this.getRow(rowIndex);if(row&&!row.offsetParent){var g=this.findGroup(row);this.toggleGroup(g,true);}},groupByText:'Group By This Field',showGroupsText:'Show in Groups'});Ext.grid.GroupingView.GROUP_ID=1000;Ext.grid.HeaderDragZone=function(grid,hd,hd2){this.grid=grid;this.view=grid.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Ext.grid.HeaderDragZone.superclass.constructor.call(this,hd);if(hd2){this.setHandleElId(Ext.id(hd));this.setOuterHandleElId(Ext.id(hd2));}
this.scroll=false;};Ext.extend(Ext.grid.HeaderDragZone,Ext.dd.DragZone,{maxDragWidth:120,getDragData:function(e){var t=Ext.lib.Event.getTarget(e);var h=this.view.findHeaderCell(t);if(h){return{ddel:h.firstChild,header:h};}
return false;},onInitDrag:function(e){this.view.headersDisabled=true;var clone=this.dragData.ddel.cloneNode(true);clone.id=Ext.id();clone.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(clone);return true;},afterValidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);},afterInvalidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);}});Ext.grid.HeaderDropZone=function(grid,hd,hd2){this.grid=grid;this.view=grid.getView();this.proxyTop=Ext.DomHelper.append(document.body,{cls:"col-move-top",html:"&#160;"},true);this.proxyBottom=Ext.DomHelper.append(document.body,{cls:"col-move-bottom",html:"&#160;"},true);this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden");};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Ext.grid.HeaderDropZone.superclass.constructor.call(this,grid.getGridEl().dom);};Ext.extend(Ext.grid.HeaderDropZone,Ext.dd.DropZone,{proxyOffsets:[-4,-9],fly:Ext.Element.fly,getTargetFromEvent:function(e){var t=Ext.lib.Event.getTarget(e);var cindex=this.view.findCellIndex(t);if(cindex!==false){return this.view.getHeaderCell(cindex);}},nextVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.nextSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
h=h.nextSibling;}
return null;},prevVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.prevSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
h=h.prevSibling;}
return null;},positionIndicator:function(h,n,e){var x=Ext.lib.Event.getPageX(e);var r=Ext.lib.Dom.getRegion(n.firstChild);var px,pt,py=r.top+this.proxyOffsets[1];if((r.right-x)<=(r.right-r.left)/2){px=r.right+this.view.borderWidth;pt="after";}else{px=r.left;pt="before";}
var oldIndex=this.view.getCellIndex(h);var newIndex=this.view.getCellIndex(n);if(this.grid.colModel.isFixed(newIndex)){return false;}
var locked=this.grid.colModel.isLocked(newIndex);if(pt=="after"){newIndex++;}
if(oldIndex<newIndex){newIndex--;}
if(oldIndex==newIndex&&(locked==this.grid.colModel.isLocked(oldIndex))){return false;}
px+=this.proxyOffsets[0];this.proxyTop.setLeftTop(px,py);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight();}
this.proxyBottom.setLeftTop(px,py+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return pt;},onNodeEnter:function(n,dd,e,data){if(data.header!=n){this.positionIndicator(data.header,n,e);}},onNodeOver:function(n,dd,e,data){var result=false;if(data.header!=n){result=this.positionIndicator(data.header,n,e);}
if(!result){this.proxyTop.hide();this.proxyBottom.hide();}
return result?this.dropAllowed:this.dropNotAllowed;},onNodeOut:function(n,dd,e,data){this.proxyTop.hide();this.proxyBottom.hide();},onNodeDrop:function(n,dd,e,data){var h=data.header;if(h!=n){var cm=this.grid.colModel;var x=Ext.lib.Event.getPageX(e);var r=Ext.lib.Dom.getRegion(n.firstChild);var pt=(r.right-x)<=((r.right-r.left)/2)?"after":"before";var oldIndex=this.view.getCellIndex(h);var newIndex=this.view.getCellIndex(n);var locked=cm.isLocked(newIndex);if(pt=="after"){newIndex++;}
if(oldIndex<newIndex){newIndex--;}
if(oldIndex==newIndex&&(locked==cm.isLocked(oldIndex))){return false;}
cm.setLocked(oldIndex,locked,true);cm.moveColumn(oldIndex,newIndex);this.grid.fireEvent("columnmove",oldIndex,newIndex);return true;}
return false;}});Ext.grid.GridView.ColumnDragZone=function(grid,hd){Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this,grid,hd,null);this.proxy.el.addClass('x-grid3-col-dd');};Ext.extend(Ext.grid.GridView.ColumnDragZone,Ext.grid.HeaderDragZone,{handleMouseDown:function(e){},callHandleMouseDown:function(e){Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,e);}});Ext.grid.SplitDragZone=function(grid,hd,hd2){this.grid=grid;this.view=grid.getView();this.proxy=this.view.resizeProxy;Ext.grid.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Ext.id(this.proxy.dom),resizeFrame:false});this.setHandleElId(Ext.id(hd));this.setOuterHandleElId(Ext.id(hd2));this.scroll=false;};Ext.extend(Ext.grid.SplitDragZone,Ext.dd.DDProxy,{fly:Ext.Element.fly,b4StartDrag:function(x,y){this.view.headersDisabled=true;this.proxy.setHeight(this.view.mainWrap.getHeight());var w=this.cm.getColumnWidth(this.cellIndex);var minw=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(minw,1000);this.setYConstraint(0,0);this.minX=x-minw;this.maxX=x+1000;this.startPos=x;Ext.dd.DDProxy.prototype.b4StartDrag.call(this,x,y);},handleMouseDown:function(e){ev=Ext.EventObject.setEvent(e);var t=this.fly(ev.getTarget());if(t.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(t.dom);this.split=t.dom;this.cm=this.grid.colModel;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this,arguments);}}},endDrag:function(e){this.view.headersDisabled=false;var endX=Math.max(this.minX,Ext.lib.Event.getPageX(e));var diff=endX-this.startPos;this.view.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+diff);},autoOffset:function(){this.setDelta(0,0);}});Ext.grid.GridDragZone=function(grid,config){this.view=grid.getView();Ext.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,config);if(this.view.lockedBody){this.setHandleElId(Ext.id(this.view.mainBody.dom));this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom));}
this.scroll=false;this.grid=grid;this.ddel=document.createElement('div');this.ddel.className='x-grid-dd-wrap';};Ext.extend(Ext.grid.GridDragZone,Ext.dd.DragZone,{ddGroup:"GridDD",getDragData:function(e){var t=Ext.lib.Event.getTarget(e);var rowIndex=this.view.findRowIndex(t);if(rowIndex!==false){var sm=this.grid.selModel;if(!sm.isSelected(rowIndex)||e.hasModifier()){sm.handleMouseDown(this.grid,rowIndex,e);}
return{grid:this.grid,ddel:this.ddel,rowIndex:rowIndex,selections:sm.getSelections()};}
return false;},onInitDrag:function(e){var data=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel);},afterRepair:function(){this.dragging=false;},getRepairXY:function(e,data){return false;},onEndDrag:function(data,e){},onValidDrop:function(dd,e,id){this.hideProxy();},beforeInvalidDrop:function(e,id){}});Ext.grid.ColumnModel=function(config){this.defaultWidth=100;this.defaultSortable=false;if(config.columns){Ext.apply(this,config);this.setConfig(config.columns,true);}else{this.setConfig(config,true);}
this.addEvents("widthchange","headerchange","hiddenchange","columnmoved","columnlockchange","configchange");Ext.grid.ColumnModel.superclass.constructor.call(this);};Ext.extend(Ext.grid.ColumnModel,Ext.util.Observable,{getColumnId:function(index){return this.config[index].id;},setConfig:function(config,initial){if(!initial){delete this.totalWidth;for(var i=0,len=this.config.length;i<len;i++){var c=this.config[i];if(c.editor){c.editor.destroy();}}}
this.config=config;this.lookup={};for(var i=0,len=config.length;i<len;i++){var c=config[i];if(typeof c.renderer=="string"){c.renderer=Ext.util.Format[c.renderer];}
if(typeof c.id=="undefined"){c.id=i;}
if(c.editor&&c.editor.isFormField){c.editor=new Ext.grid.GridEditor(c.editor);}
this.lookup[c.id]=c;}
if(!initial){this.fireEvent('configchange',this);}},getColumnById:function(id){return this.lookup[id];},getIndexById:function(id){for(var i=0,len=this.config.length;i<len;i++){if(this.config[i].id==id){return i;}}
return-1;},moveColumn:function(oldIndex,newIndex){var c=this.config[oldIndex];this.config.splice(oldIndex,1);this.config.splice(newIndex,0,c);this.dataMap=null;this.fireEvent("columnmoved",this,oldIndex,newIndex);},isLocked:function(colIndex){return this.config[colIndex].locked===true;},setLocked:function(colIndex,value,suppressEvent){if(this.isLocked(colIndex)==value){return;}
this.config[colIndex].locked=value;if(!suppressEvent){this.fireEvent("columnlockchange",this,colIndex,value);}},getTotalLockedWidth:function(){var totalWidth=0;for(var i=0;i<this.config.length;i++){if(this.isLocked(i)&&!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}
return totalWidth;},getLockedCount:function(){for(var i=0,len=this.config.length;i<len;i++){if(!this.isLocked(i)){return i;}}},getColumnCount:function(visibleOnly){if(visibleOnly===true){var c=0;for(var i=0,len=this.config.length;i<len;i++){if(!this.isHidden(i)){c++;}}
return c;}
return this.config.length;},getColumnsBy:function(fn,scope){var r=[];for(var i=0,len=this.config.length;i<len;i++){var c=this.config[i];if(fn.call(scope||this,c,i)===true){r[r.length]=c;}}
return r;},isSortable:function(col){if(typeof this.config[col].sortable=="undefined"){return this.defaultSortable;}
return this.config[col].sortable;},isMenuDisabled:function(col){return!!this.config[col].menuDisabled;},getRenderer:function(col){if(!this.config[col].renderer){return Ext.grid.ColumnModel.defaultRenderer;}
return this.config[col].renderer;},setRenderer:function(col,fn){this.config[col].renderer=fn;},getColumnWidth:function(col){return this.config[col].width||this.defaultWidth;},setColumnWidth:function(col,width,suppressEvent){this.config[col].width=width;this.totalWidth=null;if(!suppressEvent){this.fireEvent("widthchange",this,col,width);}},getTotalWidth:function(includeHidden){if(!this.totalWidth){this.totalWidth=0;for(var i=0,len=this.config.length;i<len;i++){if(includeHidden||!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}}
return this.totalWidth;},getColumnHeader:function(col){return this.config[col].header;},setColumnHeader:function(col,header){this.config[col].header=header;this.fireEvent("headerchange",this,col,header);},getColumnTooltip:function(col){return this.config[col].tooltip;},setColumnTooltip:function(col,tooltip){this.config[col].tooltip=tooltip;},getDataIndex:function(col){return this.config[col].dataIndex;},setDataIndex:function(col,dataIndex){this.config[col].dataIndex=dataIndex;},findColumnIndex:function(dataIndex){var c=this.config;for(var i=0,len=c.length;i<len;i++){if(c[i].dataIndex==dataIndex){return i;}}
return-1;},isCellEditable:function(colIndex,rowIndex){return(this.config[colIndex].editable||(typeof this.config[colIndex].editable=="undefined"&&this.config[colIndex].editor))?true:false;},getCellEditor:function(colIndex,rowIndex){return this.config[colIndex].editor;},setEditable:function(col,editable){this.config[col].editable=editable;},isHidden:function(colIndex){return this.config[colIndex].hidden;},isFixed:function(colIndex){return this.config[colIndex].fixed;},isResizable:function(colIndex){return colIndex>=0&&this.config[colIndex].resizable!==false&&this.config[colIndex].fixed!==true;},setHidden:function(colIndex,hidden){var c=this.config[colIndex];if(c.hidden!==hidden){c.hidden=hidden;this.totalWidth=null;this.fireEvent("hiddenchange",this,colIndex,hidden);}},setEditor:function(col,editor){this.config[col].editor=editor;}});Ext.grid.ColumnModel.defaultRenderer=function(value){if(typeof value=="string"&&value.length<1){return"&#160;";}
return value;};Ext.grid.DefaultColumnModel=Ext.grid.ColumnModel;Ext.grid.AbstractSelectionModel=function(){this.locked=false;Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.grid.AbstractSelectionModel,Ext.util.Observable,{init:function(grid){this.grid=grid;this.initEvents();},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;}});Ext.grid.RowSelectionModel=function(config){Ext.apply(this,config);this.selections=new Ext.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents("selectionchange","beforerowselect","rowselect","rowdeselect");Ext.grid.RowSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.grid.RowSelectionModel,Ext.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("rowmousedown",this.handleMouseDown,this);}else{this.grid.on("rowclick",function(grid,rowIndex,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(rowIndex,false);grid.view.focusRow(rowIndex);}},this);}
this.rowNav=new Ext.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var last=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(last!==false){this.last=last;}}else{this.selectFirstRow();}},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var last=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(last!==false){this.last=last;}}else{this.selectFirstRow();}},scope:this});var view=this.grid.view;view.on("refresh",this.onRefresh,this);view.on("rowupdated",this.onRowUpdated,this);view.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.store,index;var s=this.getSelections();this.clearSelections(true);for(var i=0,len=s.length;i<len;i++){var r=s[i];if((index=ds.indexOfId(r.id))!=-1){this.selectRow(index,true);}}
if(s.length!=this.selections.getCount()){this.fireEvent("selectionchange",this);}},onRemove:function(v,index,r){if(this.selections.remove(r)!==false){this.fireEvent('selectionchange',this);}},onRowUpdated:function(v,index,r){if(this.isSelected(r)){v.onRowSelect(index);}},selectRecords:function(records,keepExisting){if(!keepExisting){this.clearSelections();}
var ds=this.grid.store;for(var i=0,len=records.length;i<len;i++){this.selectRow(ds.indexOf(records[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(keepExisting){this.selectRow(this.grid.store.getCount()-1,keepExisting);},selectNext:function(keepExisting){if(this.hasNext()){this.selectRow(this.last+1,keepExisting);this.grid.getView().focusRow(this.last);return true;}
return false;},selectPrevious:function(keepExisting){if(this.hasPrevious()){this.selectRow(this.last-1,keepExisting);this.grid.getView().focusRow(this.last);return true;}
return false;},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getCount();},hasPrevious:function(){return!!this.last;},getSelections:function(){return[].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},each:function(fn,scope){var s=this.getSelections();for(var i=0,len=s.length;i<len;i++){if(fn.call(scope||this,s[i],i)===false){return false;}}
return true;},clearSelections:function(fast){if(this.locked)return;if(fast!==true){var ds=this.grid.store;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else{this.selections.clear();}
this.last=false;},selectAll:function(){if(this.locked)return;this.selections.clear();for(var i=0,len=this.grid.store.getCount();i<len;i++){this.selectRow(i,true);}},hasSelection:function(){return this.selections.length>0;},isSelected:function(index){var r=typeof index=="number"?this.grid.store.getAt(index):index;return(r&&this.selections.key(r.id)?true:false);},isIdSelected:function(id){return(this.selections.key(id)?true:false);},handleMouseDown:function(g,rowIndex,e){if(e.button!==0||this.isLocked()){return;};var view=this.grid.getView();if(e.shiftKey&&this.last!==false){var last=this.last;this.selectRange(last,rowIndex,e.ctrlKey);this.last=last;view.focusRow(rowIndex);}else{var isSelected=this.isSelected(rowIndex);if(e.ctrlKey&&isSelected){this.deselectRow(rowIndex);}else if(!isSelected||this.getCount()>1){this.selectRow(rowIndex,e.ctrlKey||e.shiftKey);view.focusRow(rowIndex);}}},selectRows:function(rows,keepExisting){if(!keepExisting){this.clearSelections();}
for(var i=0,len=rows.length;i<len;i++){this.selectRow(rows[i],true);}},selectRange:function(startRow,endRow,keepExisting){if(this.locked)return;if(!keepExisting){this.clearSelections();}
if(startRow<=endRow){for(var i=startRow;i<=endRow;i++){this.selectRow(i,true);}}else{for(var i=startRow;i>=endRow;i--){this.selectRow(i,true);}}},deselectRange:function(startRow,endRow,preventViewNotify){if(this.locked)return;for(var i=startRow;i<=endRow;i++){this.deselectRow(i,preventViewNotify);}},selectRow:function(index,keepExisting,preventViewNotify){if(this.locked||(index<0||index>=this.grid.store.getCount())||this.isSelected(index))return;var r=this.grid.store.getAt(index);if(r&&this.fireEvent("beforerowselect",this,index,keepExisting,r)!==false){if(!keepExisting||this.singleSelect){this.clearSelections();}
this.selections.add(r);this.last=this.lastActive=index;if(!preventViewNotify){this.grid.getView().onRowSelect(index);}
this.fireEvent("rowselect",this,index,r);this.fireEvent("selectionchange",this);}},deselectRow:function(index,preventViewNotify){if(this.locked)return;if(this.last==index){this.last=false;}
if(this.lastActive==index){this.lastActive=false;}
var r=this.grid.store.getAt(index);if(r){this.selections.remove(r);if(!preventViewNotify){this.grid.getView().onRowDeselect(index);}
this.fireEvent("rowdeselect",this,index,r);this.fireEvent("selectionchange",this);}},restoreLast:function(){if(this._last){this.last=this._last;}},acceptsNav:function(row,col,cm){return!cm.isHidden(col)&&cm.isCellEditable(col,row);},onEditorKey:function(field,e){var k=e.getKey(),newCell,g=this.grid,ed=g.activeEditor;var shift=e.shiftKey;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(shift){newCell=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else{newCell=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}}else if(k==e.ENTER){e.stopEvent();ed.completeEdit();if(this.moveEditorOnEnter!==false){if(shift){newCell=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this);}else{newCell=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this);}}}else if(k==e.ESC){ed.cancelEdit();}
if(newCell){g.startEditing(newCell[0],newCell[1]);}}});Ext.grid.CellSelectionModel=function(config){Ext.apply(this,config);this.selection=null;this.addEvents("beforecellselect","cellselect","selectionchange");Ext.grid.CellSelectionModel.superclass.constructor.call(this);};Ext.extend(Ext.grid.CellSelectionModel,Ext.grid.AbstractSelectionModel,{initEvents:function(){this.grid.on("cellmousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Ext.isIE||Ext.isSafari3?"keydown":"keypress",this.handleKeyDown,this);var view=this.grid.view;view.on("refresh",this.onViewChange,this);view.on("rowupdated",this.onRowUpdated,this);view.on("beforerowremoved",this.clearSelections,this);view.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,index,r){if(this.selection&&this.selection.record==r){v.onCellSelect(index,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(preventNotify){var s=this.selection;if(s){if(preventNotify!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}
this.selection=null;this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(g,row,cell,e){if(e.button!==0||this.isLocked()){return;};this.select(row,cell);},select:function(rowIndex,colIndex,preventViewNotify,preventFocus,r){if(this.fireEvent("beforecellselect",this,rowIndex,colIndex)!==false){this.clearSelections();r=r||this.grid.store.getAt(rowIndex);this.selection={record:r,cell:[rowIndex,colIndex]};if(!preventViewNotify){var v=this.grid.getView();v.onCellSelect(rowIndex,colIndex);if(preventFocus!==true){v.focusCell(rowIndex,colIndex);}}
this.fireEvent("cellselect",this,rowIndex,colIndex);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(rowIndex,colIndex,cm){return!cm.isHidden(colIndex);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}
var g=this.grid,s=this.selection;if(!s){e.stopEvent();var cell=g.walkCells(0,0,1,this.isSelectable,this);if(cell){this.select(cell[0],cell[1]);}
return;}
var sm=this;var walk=function(row,col,step){return g.walkCells(row,col,step,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var newCell;switch(k){case e.TAB:if(e.shiftKey){newCell=walk(r,c-1,-1);}else{newCell=walk(r,c+1,1);}
break;case e.DOWN:newCell=walk(r+1,c,1);break;case e.UP:newCell=walk(r-1,c,-1);break;case e.RIGHT:newCell=walk(r,c+1,1);break;case e.LEFT:newCell=walk(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}
break;};if(newCell){this.select(newCell[0],newCell[1]);e.stopEvent();}},acceptsNav:function(row,col,cm){return!cm.isHidden(col)&&cm.isCellEditable(col,row);},onEditorKey:function(field,e){var k=e.getKey(),newCell,g=this.grid,ed=g.activeEditor;if(k==e.TAB){if(e.shiftKey){newCell=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else{newCell=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}
e.stopEvent();}else if(k==e.ENTER){ed.completeEdit();e.stopEvent();}else if(k==e.ESC){e.stopEvent();ed.cancelEdit();}
if(newCell){g.startEditing(newCell[0],newCell[1]);}}});Ext.grid.EditorGridPanel=Ext.extend(Ext.grid.GridPanel,{clicksToEdit:2,isEditor:true,detectEdit:false,autoEncode:false,trackMouseOver:false,initComponent:function(){Ext.grid.EditorGridPanel.superclass.initComponent.call(this);if(!this.selModel){this.selModel=new Ext.grid.CellSelectionModel();}
this.activeEditor=null;this.addEvents("beforeedit","afteredit","validateedit");},initEvents:function(){Ext.grid.EditorGridPanel.superclass.initEvents.call(this);this.on("bodyscroll",this.stopEditing,this,[true]);if(this.clicksToEdit==1){this.on("cellclick",this.onCellDblClick,this);}else{if(this.clicksToEdit=='auto'&&this.view.mainBody){this.view.mainBody.on("mousedown",this.onAutoEditClick,this);}
this.on("celldblclick",this.onCellDblClick,this);}
this.getGridEl().addClass("xedit-grid");},onCellDblClick:function(g,row,col){this.startEditing(row,col);},onAutoEditClick:function(e,t){if(e.button!==0){return;}
var row=this.view.findRowIndex(t);var col=this.view.findCellIndex(t);if(row!==false&&col!==false){this.stopEditing();if(this.selModel.getSelectedCell){var sc=this.selModel.getSelectedCell();if(sc&&sc.cell[0]===row&&sc.cell[1]===col){this.startEditing(row,col);}}else{if(this.selModel.isSelected(row)){this.startEditing(row,col);}}}},onEditComplete:function(ed,value,startValue){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var field=this.colModel.getDataIndex(ed.col);value=this.postEditValue(value,startValue,r,field);if(String(value)!==String(startValue)){var e={grid:this,record:r,field:field,originalValue:startValue,value:value,row:ed.row,column:ed.col,cancel:false};if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(field,e.value);delete e.cancel;this.fireEvent("afteredit",e);}}
this.view.focusCell(ed.row,ed.col);},startEditing:function(row,col){this.stopEditing();if(this.colModel.isCellEditable(col,row)){this.view.ensureVisible(row,col,true);var r=this.store.getAt(row);var field=this.colModel.getDataIndex(col);var e={grid:this,record:r,field:field,value:r.data[field],row:row,column:col,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(col,row);if(!ed.rendered){ed.render(this.view.getEditorParent(ed));}
(function(){ed.row=row;ed.col=col;ed.record=r;ed.on("complete",this.onEditComplete,this,{single:true});ed.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=ed;var v=this.preEditValue(r,field);ed.startEdit(this.view.getCell(row,col).firstChild,v);}).defer(50,this);}}},preEditValue:function(r,field){var value=r.data[field];return this.autoEncode&&typeof value=='string'?Ext.util.Format.htmlDecode(value):value;},postEditValue:function(value,originalValue,r,field){return this.autoEncode&&typeof value=='string'?Ext.util.Format.htmlEncode(value):value;},stopEditing:function(cancel){if(this.activeEditor){this.activeEditor[cancel===true?'cancelEdit':'completeEdit']();}
this.activeEditor=null;},onDestroy:function(){if(this.rendered){var cols=this.colModel.config;for(var i=0,len=cols.length;i<len;i++){var c=cols[i];Ext.destroy(c.editor);}}
Ext.grid.EditorGridPanel.superclass.onDestroy.call(this);}});Ext.reg('editorgrid',Ext.grid.EditorGridPanel);Ext.grid.GridEditor=function(field,config){Ext.grid.GridEditor.superclass.constructor.call(this,field,config);field.monitorTab=false;};Ext.extend(Ext.grid.GridEditor,Ext.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:false});Ext.grid.PropertyRecord=Ext.data.Record.create([{name:'name',type:'string'},'value']);Ext.grid.PropertyStore=function(grid,source){this.grid=grid;this.store=new Ext.data.Store({recordType:Ext.grid.PropertyRecord});this.store.on('update',this.onUpdate,this);if(source){this.setSource(source);}
Ext.grid.PropertyStore.superclass.constructor.call(this);};Ext.extend(Ext.grid.PropertyStore,Ext.util.Observable,{setSource:function(o){this.source=o;this.store.removeAll();var data=[];for(var k in o){if(this.isEditableValue(o[k])){data.push(new Ext.grid.PropertyRecord({name:k,value:o[k]},k));}}
this.store.loadRecords({records:data},{},true);},onUpdate:function(ds,record,type){if(type==Ext.data.Record.EDIT){var v=record.data['value'];var oldValue=record.modified['value'];if(this.grid.fireEvent('beforepropertychange',this.source,record.id,v,oldValue)!==false){this.source[record.id]=v;record.commit();this.grid.fireEvent('propertychange',this.source,record.id,v,oldValue);}else{record.reject();}}},getProperty:function(row){return this.store.getAt(row);},isEditableValue:function(val){if(Ext.isDate(val)){return true;}else if(typeof val=='object'||typeof val=='function'){return false;}
return true;},setValue:function(prop,value){this.source[prop]=value;this.store.getById(prop).set('value',value);},getSource:function(){return this.source;}});Ext.grid.PropertyColumnModel=function(grid,store){this.grid=grid;var g=Ext.grid;g.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,width:50,sortable:true,dataIndex:'name',id:'name',menuDisabled:true},{header:this.valueText,width:50,resizable:false,dataIndex:'value',id:'value',menuDisabled:true}]);this.store=store;this.bselect=Ext.DomHelper.append(document.body,{tag:'select',cls:'x-grid-editor x-hide-display',children:[{tag:'option',value:'true',html:'true'},{tag:'option',value:'false',html:'false'}]});var f=Ext.form;var bfield=new f.Field({el:this.bselect,bselect:this.bselect,autoShow:true,getValue:function(){return this.bselect.value=='true';}});this.editors={'date':new g.GridEditor(new f.DateField({selectOnFocus:true})),'string':new g.GridEditor(new f.TextField({selectOnFocus:true})),'number':new g.GridEditor(new f.NumberField({selectOnFocus:true,style:'text-align:left;'})),'boolean':new g.GridEditor(bfield)};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this);};Ext.extend(Ext.grid.PropertyColumnModel,Ext.grid.ColumnModel,{nameText:'Name',valueText:'Value',dateFormat:'m/j/Y',renderDate:function(dateVal){return dateVal.dateFormat(this.dateFormat);},renderBool:function(bVal){return bVal?'true':'false';},isCellEditable:function(colIndex,rowIndex){return colIndex==1;},getRenderer:function(col){return col==1?this.renderCellDelegate:this.renderPropDelegate;},renderProp:function(v){return this.getPropertyName(v);},renderCell:function(val){var rv=val;if(Ext.isDate(val)){rv=this.renderDate(val);}else if(typeof val=='boolean'){rv=this.renderBool(val);}
return Ext.util.Format.htmlEncode(rv);},getPropertyName:function(name){var pn=this.grid.propertyNames;return pn&&pn[name]?pn[name]:name;},getCellEditor:function(colIndex,rowIndex){var p=this.store.getProperty(rowIndex);var n=p.data['name'],val=p.data['value'];if(this.grid.customEditors[n]){return this.grid.customEditors[n];}
if(Ext.isDate(val)){return this.editors['date'];}else if(typeof val=='number'){return this.editors['number'];}else if(typeof val=='boolean'){return this.editors['boolean'];}else{return this.editors['string'];}}});Ext.grid.PropertyGrid=Ext.extend(Ext.grid.EditorGridPanel,{enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1,enableHdMenu:false,viewConfig:{forceFit:true},initComponent:function(){this.customEditors=this.customEditors||{};this.lastEditRow=null;var store=new Ext.grid.PropertyStore(this);this.propStore=store;var cm=new Ext.grid.PropertyColumnModel(this,store);store.store.sort('name','ASC');this.addEvents('beforepropertychange','propertychange');this.cm=cm;this.ds=store.store;Ext.grid.PropertyGrid.superclass.initComponent.call(this);this.selModel.on('beforecellselect',function(sm,rowIndex,colIndex){if(colIndex===0){this.startEditing.defer(200,this,[rowIndex,1]);return false;}},this);},onRender:function(){Ext.grid.PropertyGrid.superclass.onRender.apply(this,arguments);this.getGridEl().addClass('x-props-grid');},afterRender:function(){Ext.grid.PropertyGrid.superclass.afterRender.apply(this,arguments);if(this.source){this.setSource(this.source);}},setSource:function(source){this.propStore.setSource(source);},getSource:function(){return this.propStore.getSource();}});Ext.reg("propertygrid",Ext.grid.PropertyGrid);Ext.grid.RowNumberer=function(config){Ext.apply(this,config);if(this.rowspan){this.renderer=this.renderer.createDelegate(this);}};Ext.grid.RowNumberer.prototype={header:"",width:23,sortable:false,fixed:true,menuDisabled:true,dataIndex:'',id:'numberer',rowspan:undefined,renderer:function(v,p,record,rowIndex){if(this.rowspan){p.cellAttr='rowspan="'+this.rowspan+'"';}
return rowIndex+1;}};Ext.grid.CheckboxSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{header:'<div class="x-grid3-hd-checker">&#160;</div>',width:20,sortable:false,menuDisabled:true,fixed:true,dataIndex:'',id:'checker',initEvents:function(){Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.on('render',function(){var view=this.grid.getView();view.mainBody.on('mousedown',this.onMouseDown,this);Ext.fly(view.innerHd).on('mousedown',this.onHdMouseDown,this);},this);},onMouseDown:function(e,t){if(e.button===0&&t.className=='x-grid3-row-checker'){e.stopEvent();var row=e.getTarget('.x-grid3-row');if(row){var index=row.rowIndex;if(this.isSelected(index)){this.deselectRow(index);}else{this.selectRow(index,true);}}}},onHdMouseDown:function(e,t){if(t.className=='x-grid3-hd-checker'){e.stopEvent();var hd=Ext.fly(t.parentNode);var isChecked=hd.hasClass('x-grid3-hd-checker-on');if(isChecked){hd.removeClass('x-grid3-hd-checker-on');this.clearSelections();}else{hd.addClass('x-grid3-hd-checker-on');this.selectAll();}}},renderer:function(v,p,record){return'<div class="x-grid3-row-checker">&#160;</div>';}});Ext.LoadMask=function(el,config){this.el=Ext.get(el);Ext.apply(this,config);if(this.store){this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoad,this);this.removeMask=Ext.value(this.removeMask,false);}else{var um=this.el.getUpdater();um.showLoadIndicator=false;um.on('beforeupdate',this.onBeforeLoad,this);um.on('update',this.onLoad,this);um.on('failure',this.onLoad,this);this.removeMask=Ext.value(this.removeMask,true);}};Ext.LoadMask.prototype={msg:'Loading...',msgCls:'x-mask-loading',disabled:false,disable:function(){this.disabled=true;},enable:function(){this.disabled=false;},onLoad:function(){this.el.unmask(this.removeMask);},onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls);}},show:function(){this.onBeforeLoad();},hide:function(){this.onLoad();},destroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoad,this);}else{var um=this.el.getUpdater();um.un('beforeupdate',this.onBeforeLoad,this);um.un('update',this.onLoad,this);um.un('failure',this.onLoad,this);}}};Ext.ProgressBar=Ext.extend(Ext.BoxComponent,{baseCls:'x-progress',waitTimer:null,initComponent:function(){Ext.ProgressBar.superclass.initComponent.call(this);this.addEvents("update");},onRender:function(ct,position){Ext.ProgressBar.superclass.onRender.call(this,ct,position);var tpl=new Ext.Template('<div class="{cls}-wrap">','<div class="{cls}-inner">','<div class="{cls}-bar">','<div class="{cls}-text">','<div>&#160;</div>','</div>','</div>','<div class="{cls}-text {cls}-text-back">','<div>&#160;</div>','</div>','</div>','</div>');if(position){this.el=tpl.insertBefore(position,{cls:this.baseCls},true);}else{this.el=tpl.append(ct,{cls:this.baseCls},true);}
if(this.id){this.el.dom.id=this.id;}
var inner=this.el.dom.firstChild;this.progressBar=Ext.get(inner.firstChild);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl;}else{this.textTopEl=Ext.get(this.progressBar.dom.firstChild);var textBackEl=Ext.get(inner.childNodes[1]);this.textTopEl.setStyle("z-index",99).addClass('x-hidden');this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,textBackEl.dom.firstChild]);this.textEl.setWidth(inner.offsetWidth);}
this.progressBar.setHeight(inner.offsetHeight);},afterRender:function(){Ext.ProgressBar.superclass.afterRender.call(this);if(this.value){this.updateProgress(this.value,this.text);}else{this.updateText(this.text);}},updateProgress:function(value,text){this.value=value||0;if(text){this.updateText(text);}
if(this.rendered){var w=Math.floor(value*this.el.dom.firstChild.offsetWidth);this.progressBar.setWidth(w);if(this.textTopEl){this.textTopEl.removeClass('x-hidden').setWidth(w);}}
this.fireEvent('update',this,value,text);return this;},wait:function(o){if(!this.waitTimer){var scope=this;o=o||{};this.updateText(o.text);this.waitTimer=Ext.TaskMgr.start({run:function(i){var inc=o.increment||10;this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01);},interval:o.interval||1000,duration:o.duration,onStop:function(){if(o.fn){o.fn.apply(o.scope||this);}
this.reset();},scope:scope});}
return this;},isWaiting:function(){return this.waitTimer!=null;},updateText:function(text){this.text=text||'&#160;';if(this.rendered){this.textEl.update(this.text);}
return this;},syncProgressBar:function(){if(this.value){this.updateProgress(this.value,this.text);}
return this;},setSize:function(w,h){Ext.ProgressBar.superclass.setSize.call(this,w,h);if(this.textTopEl){var inner=this.el.dom.firstChild;this.textEl.setSize(inner.offsetWidth,inner.offsetHeight);}
this.syncProgressBar();return this;},reset:function(hide){this.updateProgress(0);if(this.textTopEl){this.textTopEl.addClass('x-hidden');}
if(this.waitTimer){this.waitTimer.onStop=null;Ext.TaskMgr.stop(this.waitTimer);this.waitTimer=null;}
if(hide===true){this.hide();}
return this;}});Ext.reg('progress',Ext.ProgressBar);Ext.Slider=Ext.extend(Ext.BoxComponent,{vertical:false,minValue:0,maxValue:100,keyIncrement:1,increment:0,clickRange:[5,15],clickToChange:true,animate:true,dragging:false,initComponent:function(){if(this.value===undefined){this.value=this.minValue;}
Ext.Slider.superclass.initComponent.call(this);this.keyIncrement=Math.max(this.increment,this.keyIncrement);this.addEvents('beforechange','change','changecomplete','dragstart','drag','dragend');if(this.vertical){Ext.apply(this,Ext.Slider.Vertical);}},onRender:function(){this.autoEl={cls:'x-slider '+(this.vertical?'x-slider-vert':'x-slider-horz'),cn:{cls:'x-slider-end',cn:{cls:'x-slider-inner',cn:[{cls:'x-slider-thumb'},{tag:'a',cls:'x-slider-focus',href:"#",tabIndex:'-1',hidefocus:'on'}]}}};Ext.Slider.superclass.onRender.apply(this,arguments);this.endEl=this.el.first();this.innerEl=this.endEl.first();this.thumb=this.innerEl.first();this.halfThumb=(this.vertical?this.thumb.getHeight():this.thumb.getWidth())/2;this.focusEl=this.thumb.next();this.initEvents();},initEvents:function(){this.thumb.addClassOnOver('x-slider-thumb-over');this.mon(this.el,'mousedown',this.onMouseDown,this);this.mon(this.el,'keydown',this.onKeyDown,this);this.focusEl.swallowEvent("click",true);this.tracker=new Ext.dd.DragTracker({onBeforeStart:this.onBeforeDragStart.createDelegate(this),onStart:this.onDragStart.createDelegate(this),onDrag:this.onDrag.createDelegate(this),onEnd:this.onDragEnd.createDelegate(this),tolerance:3,autoStart:300});this.tracker.initEl(this.thumb);this.on('beforedestroy',this.tracker.destroy,this.tracker);},onMouseDown:function(e){if(this.disabled){return;}
if(this.clickToChange&&e.target!=this.thumb.dom){var local=this.innerEl.translatePoints(e.getXY());this.onClickChange(local);}
this.focus();},onClickChange:function(local){if(local.top>this.clickRange[0]&&local.top<this.clickRange[1]){this.setValue(Math.round(this.reverseValue(local.left)),undefined,true);}},onKeyDown:function(e){if(this.disabled){e.preventDefault();return;}
var k=e.getKey();switch(k){case e.UP:case e.RIGHT:e.stopEvent();if(e.ctrlKey){this.setValue(this.maxValue,undefined,true);}else{this.setValue(this.value+this.keyIncrement,undefined,true);}
break;case e.DOWN:case e.LEFT:e.stopEvent();if(e.ctrlKey){this.setValue(this.minValue,undefined,true);}else{this.setValue(this.value-this.keyIncrement,undefined,true);}
break;default:e.preventDefault();}},doSnap:function(value){if(!this.increment||this.increment==1||!value){return value;}
var newValue=value,inc=this.increment;var m=value%inc;if(m>0){if(m>(inc/2)){newValue=value+(inc-m);}else{newValue=value-m;}}
return newValue.constrain(this.minValue,this.maxValue);},afterRender:function(){Ext.Slider.superclass.afterRender.apply(this,arguments);if(this.value!==undefined){var v=this.normalizeValue(this.value);if(v!==this.value){delete this.value;this.setValue(v,false);}else{this.moveThumb(this.translateValue(v),false);}}},getRatio:function(){var w=this.innerEl.getWidth();var v=this.maxValue-this.minValue;return v==0?w:(w/v);},normalizeValue:function(v){if(typeof v!='number'){v=parseInt(v);}
v=Math.round(v);v=this.doSnap(v);v=v.constrain(this.minValue,this.maxValue);return v;},setValue:function(v,animate,changeComplete){v=this.normalizeValue(v);if(v!==this.value&&this.fireEvent('beforechange',this,v,this.value)!==false){this.value=v;this.moveThumb(this.translateValue(v),animate!==false);this.fireEvent('change',this,v);if(changeComplete){this.fireEvent('changecomplete',this,v);}}},translateValue:function(v){var ratio=this.getRatio();return(v*ratio)-(this.minValue*ratio)-this.halfThumb;},reverseValue:function(pos){var ratio=this.getRatio();return(pos+this.halfThumb+(this.minValue*ratio))/ratio;},moveThumb:function(v,animate){if(!animate||this.animate===false){this.thumb.setLeft(v);}else{this.thumb.shift({left:v,stopFx:true,duration:.35});}},focus:function(){this.focusEl.focus(10);},onBeforeDragStart:function(e){return!this.disabled;},onDragStart:function(e){this.thumb.addClass('x-slider-thumb-drag');this.dragging=true;this.dragStartValue=this.value;this.fireEvent('dragstart',this,e);},onDrag:function(e){var pos=this.innerEl.translatePoints(this.tracker.getXY());this.setValue(Math.round(this.reverseValue(pos.left)),false);this.fireEvent('drag',this,e);},onDragEnd:function(e){this.thumb.removeClass('x-slider-thumb-drag');this.dragging=false;this.fireEvent('dragend',this,e);if(this.dragStartValue!=this.value){this.fireEvent('changecomplete',this,this.value);}},onResize:function(w,h){this.innerEl.setWidth(w-(this.el.getPadding('l')+this.endEl.getPadding('r')));this.syncThumb();},syncThumb:function(){if(this.rendered){this.moveThumb(this.translateValue(this.value));}},getValue:function(){return this.value;}});Ext.reg('slider',Ext.Slider);Ext.Slider.Vertical={onResize:function(w,h){this.innerEl.setHeight(h-(this.el.getPadding('t')+this.endEl.getPadding('b')));this.syncThumb();},getRatio:function(){var h=this.innerEl.getHeight();var v=this.maxValue-this.minValue;return h/v;},moveThumb:function(v,animate){if(!animate||this.animate===false){this.thumb.setBottom(v);}else{this.thumb.shift({bottom:v,stopFx:true,duration:.35});}},onDrag:function(e){var pos=this.innerEl.translatePoints(this.tracker.getXY());var bottom=this.innerEl.getHeight()-pos.top;this.setValue(Math.round(bottom/this.getRatio()),false);this.fireEvent('drag',this,e);},onClickChange:function(local){if(local.left>this.clickRange[0]&&local.left<this.clickRange[1]){var bottom=this.innerEl.getHeight()-local.top;this.setValue(Math.round(bottom/this.getRatio()),undefined,true);}}};Ext.StatusBar=Ext.extend(Ext.Toolbar,{cls:'x-statusbar',busyIconCls:'x-status-busy',busyText:'Loading...',autoClear:5000,activeThreadId:0,initComponent:function(){if(this.statusAlign=='right'){this.cls+=' x-status-right';}
Ext.StatusBar.superclass.initComponent.call(this);},afterRender:function(){Ext.StatusBar.superclass.afterRender.call(this);var right=this.statusAlign=='right',td=Ext.get(this.nextBlock());if(right){this.tr.appendChild(td.dom);}else{td.insertBefore(this.tr.firstChild);}
this.statusEl=td.createChild({cls:'x-status-text '+(this.iconCls||this.defaultIconCls||''),html:this.text||this.defaultText||''});this.statusEl.unselectable();this.spacerEl=td.insertSibling({tag:'td',style:'width:100%',cn:[{cls:'ytb-spacer'}]},right?'before':'after');},setStatus:function(o){o=o||{};if(typeof o=='string'){o={text:o};}
if(o.text!==undefined){this.setText(o.text);}
if(o.iconCls!==undefined){this.setIcon(o.iconCls);}
if(o.clear){var c=o.clear,wait=this.autoClear,defaults={useDefaults:true,anim:true};if(typeof c=='object'){c=Ext.applyIf(c,defaults);if(c.wait){wait=c.wait;}}else if(typeof c=='number'){wait=c;c=defaults;}else if(typeof c=='boolean'){c=defaults;}
c.threadId=this.activeThreadId;this.clearStatus.defer(wait,this,[c]);}
return this;},clearStatus:function(o){o=o||{};if(o.threadId&&o.threadId!==this.activeThreadId){return this;}
var text=o.useDefaults?this.defaultText:'',iconCls=o.useDefaults?(this.defaultIconCls?this.defaultIconCls:''):'';if(o.anim){this.statusEl.fadeOut({remove:false,useDisplay:true,scope:this,callback:function(){this.setStatus({text:text,iconCls:iconCls});this.statusEl.show();}});}else{this.statusEl.hide();this.setStatus({text:text,iconCls:iconCls});this.statusEl.show();}
return this;},setText:function(text){this.activeThreadId++;this.text=text||'';if(this.rendered){this.statusEl.update(this.text);}
return this;},getText:function(){return this.text;},setIcon:function(cls){this.activeThreadId++;cls=cls||'';if(this.rendered){if(this.currIconCls){this.statusEl.removeClass(this.currIconCls);this.currIconCls=null;}
if(cls.length>0){this.statusEl.addClass(cls);this.currIconCls=cls;}}else{this.currIconCls=cls;}
return this;},showBusy:function(o){if(typeof o=='string'){o={text:o};}
o=Ext.applyIf(o||{},{text:this.busyText,iconCls:this.busyIconCls});return this.setStatus(o);}});Ext.reg('statusbar',Ext.StatusBar);Ext.History=(function(){var iframe,hiddenField;var ready=false;var currentToken;function getHash(){var href=top.location.href,i=href.indexOf("#");return i>=0?href.substr(i+1):null;}
function doSave(){hiddenField.value=currentToken;}
function handleStateChange(token){currentToken=token;Ext.History.fireEvent('change',token);}
function updateIFrame(token){var html=['<html><body><div id="state">',token,'</div></body></html>'].join('');try{var doc=iframe.contentWindow.document;doc.open();doc.write(html);doc.close();return true;}catch(e){return false;}}
function checkIFrame(){if(!iframe.contentWindow||!iframe.contentWindow.document){setTimeout(checkIFrame,10);return;}
var doc=iframe.contentWindow.document;var elem=doc.getElementById("state");var token=elem?elem.innerText:null;var hash=getHash();setInterval(function(){doc=iframe.contentWindow.document;elem=doc.getElementById("state");var newtoken=elem?elem.innerText:null;var newHash=getHash();if(newtoken!==token){token=newtoken;handleStateChange(token);top.location.hash=token;hash=token;doSave();}else if(newHash!==hash){hash=newHash;updateIFrame(newHash);}},50);ready=true;Ext.History.fireEvent('ready',Ext.History);}
function startUp(){currentToken=hiddenField.value;if(Ext.isIE){checkIFrame();}else{var hash=getHash();setInterval(function(){var newHash=getHash();if(newHash!==hash){hash=newHash;handleStateChange(hash);doSave();}},50);ready=true;Ext.History.fireEvent('ready',Ext.History);}}
return{fieldId:'x-history-field',iframeId:'x-history-frame',events:{},init:function(onReady,scope){if(ready){Ext.callback(onReady,scope,[this]);return;}
if(!Ext.isReady){Ext.onReady(function(){Ext.History.init(onReady,scope);});return;}
hiddenField=Ext.getDom(Ext.History.fieldId);if(Ext.isIE){iframe=Ext.getDom(Ext.History.iframeId);}
this.addEvents('ready','change');if(onReady){this.on('ready',onReady,scope,{single:true});}
startUp();},add:function(token,preventDup){if(preventDup!==false){if(this.getToken()==token){return true;}}
if(Ext.isIE){return updateIFrame(token);}else{top.location.hash=token;return true;}},back:function(){history.go(-1);},forward:function(){history.go(1);},getToken:function(){return ready?currentToken:getHash();}};})();Ext.apply(Ext.History,new Ext.util.Observable());Ext.debug={};(function(){var cp;function createConsole(){var scriptPanel=new Ext.debug.ScriptsPanel();var logView=new Ext.debug.LogPanel();var tree=new Ext.debug.DomTree();var tabs=new Ext.TabPanel({activeTab:0,border:false,tabPosition:'bottom',items:[{title:'Debug Console',layout:'border',items:[logView,scriptPanel]},{title:'DOM Inspector',layout:'border',items:[tree]}]});cp=new Ext.Panel({id:'x-debug-browser',title:'Console',collapsible:true,animCollapse:false,style:'position:absolute;left:0;bottom:0;',height:200,logView:logView,layout:'fit',tools:[{id:'close',handler:function(){cp.destroy();cp=null;Ext.EventManager.removeResizeListener(handleResize);}}],items:tabs});cp.render(document.body);cp.resizer=new Ext.Resizable(cp.el,{minHeight:50,handles:"n",pinned:true,transparent:true,resizeElement:function(){var box=this.proxy.getBox();this.proxy.hide();cp.setHeight(box.height);return box;}});function handleResize(){cp.setWidth(Ext.getBody().getViewSize().width);}
Ext.EventManager.onWindowResize(handleResize);handleResize();}
Ext.apply(Ext,{log:function(){if(!cp){createConsole();}
cp.logView.log.apply(cp.logView,arguments);},logf:function(format,arg1,arg2,etc){Ext.log(String.format.apply(String,arguments));},dump:function(o){if(typeof o=='string'||typeof o=='number'||typeof o=='undefined'||Ext.isDate(o)){Ext.log(o);}else if(!o){Ext.log("null");}else if(typeof o!="object"){Ext.log('Unknown return type');}else if(Ext.isArray(o)){Ext.log('['+o.join(',')+']');}else{var b=["{\n"];for(var key in o){var to=typeof o[key];if(to!="function"&&to!="object"){b.push(String.format("  {0}: {1},\n",key,o[key]));}}
var s=b.join("");if(s.length>3){s=s.substr(0,s.length-2);}
Ext.log(s+"\n}");}},_timers:{},time:function(name){name=name||"def";Ext._timers[name]=new Date().getTime();},timeEnd:function(name,printResults){var t=new Date().getTime();name=name||"def";var v=String.format("{0} ms",t-Ext._timers[name]);Ext._timers[name]=new Date().getTime();if(printResults!==false){Ext.log('Timer '+(name=="def"?v:name+": "+v));}
return v;}});})();Ext.debug.ScriptsPanel=Ext.extend(Ext.Panel,{id:'x-debug-scripts',region:'east',minWidth:200,split:true,width:350,border:false,layout:'anchor',style:'border-width:0 0 0 1px;',initComponent:function(){this.scriptField=new Ext.form.TextArea({anchor:'100% -26',style:'border-width:0;'});this.trapBox=new Ext.form.Checkbox({id:'console-trap',boxLabel:'Trap Errors',checked:true});this.toolbar=new Ext.Toolbar([{text:'Run',scope:this,handler:this.evalScript},{text:'Clear',scope:this,handler:this.clear},'->',this.trapBox,' ',' ']);this.items=[this.toolbar,this.scriptField];Ext.debug.ScriptsPanel.superclass.initComponent.call(this);},evalScript:function(){var s=this.scriptField.getValue();if(this.trapBox.getValue()){try{var rt=eval(s);Ext.dump(rt===undefined?'(no return)':rt);}catch(e){Ext.log(e.message||e.descript);}}else{var rt=eval(s);Ext.dump(rt===undefined?'(no return)':rt);}},clear:function(){this.scriptField.setValue('');this.scriptField.focus();}});Ext.debug.LogPanel=Ext.extend(Ext.Panel,{autoScroll:true,region:'center',border:false,style:'border-width:0 1px 0 0',log:function(){var markup=['<div style="padding:5px !important;border-bottom:1px solid #ccc;">',Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments,', ')).replace(/\n/g,'<br />').replace(/\s/g,'&#160;'),'</div>'].join('');this.body.insertHtml('beforeend',markup);this.body.scrollTo('top',100000);},clear:function(){this.body.update('');this.body.dom.scrollTop=0;}});Ext.debug.DomTree=Ext.extend(Ext.tree.TreePanel,{enableDD:false,lines:false,rootVisible:false,animate:false,hlColor:'ffff9c',autoScroll:true,region:'center',border:false,initComponent:function(){Ext.debug.DomTree.superclass.initComponent.call(this);var styles=false,hnode;var nonSpace=/^\s*$/;var html=Ext.util.Format.htmlEncode;var ellipsis=Ext.util.Format.ellipsis;var styleRe=/\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;function findNode(n){if(!n||n.nodeType!=1||n==document.body||n==document){return false;}
var pn=[n],p=n;while((p=p.parentNode)&&p.nodeType==1&&p.tagName.toUpperCase()!='HTML'){pn.unshift(p);}
var cn=hnode;for(var i=0,len=pn.length;i<len;i++){cn.expand();cn=cn.findChild('htmlNode',pn[i]);if(!cn){return false;}}
cn.select();var a=cn.ui.anchor;treeEl.dom.scrollTop=Math.max(0,a.offsetTop-10);cn.highlight();return true;}
function nodeTitle(n){var s=n.tagName;if(n.id){s+='#'+n.id;}else if(n.className){s+='.'+n.className;}
return s;}
function onNodeSelect(t,n,last){return;if(last&&last.unframe){last.unframe();}
var props={};if(n&&n.htmlNode){if(frameEl.pressed){n.frame();}
if(inspecting){return;}
addStyle.enable();reload.setDisabled(n.leaf);var dom=n.htmlNode;stylePanel.setTitle(nodeTitle(dom));if(styles&&!showAll.pressed){var s=dom.style?dom.style.cssText:'';if(s){var m;while((m=styleRe.exec(s))!=null){props[m[1].toLowerCase()]=m[2];}}}else if(styles){var cl=Ext.debug.cssList;var s=dom.style,fly=Ext.fly(dom);if(s){for(var i=0,len=cl.length;i<len;i++){var st=cl[i];var v=s[st]||fly.getStyle(st);if(v!=undefined&&v!==null&&v!==''){props[st]=v;}}}}else{for(var a in dom){var v=dom[a];if((isNaN(a+10))&&v!=undefined&&v!==null&&v!==''&&!(Ext.isGecko&&a[0]==a[0].toUpperCase())){props[a]=v;}}}}else{if(inspecting){return;}
addStyle.disable();reload.disabled();}
stylesGrid.setSource(props);stylesGrid.treeNode=n;stylesGrid.view.fitColumns();}
this.loader=new Ext.tree.TreeLoader();this.loader.load=function(n,cb){var isBody=n.htmlNode==document.body;var cn=n.htmlNode.childNodes;for(var i=0,c;c=cn[i];i++){if(isBody&&c.id=='x-debug-browser'){continue;}
if(c.nodeType==1){n.appendChild(new Ext.debug.HtmlNode(c));}else if(c.nodeType==3&&!nonSpace.test(c.nodeValue)){n.appendChild(new Ext.tree.TreeNode({text:'<em>'+ellipsis(html(String(c.nodeValue)),35)+'</em>',cls:'x-tree-noicon'}));}}
cb();};this.root=this.setRootNode(new Ext.tree.TreeNode('Ext'));hnode=this.root.appendChild(new Ext.debug.HtmlNode(document.getElementsByTagName('html')[0]));}});Ext.debug.HtmlNode=function(){var html=Ext.util.Format.htmlEncode;var ellipsis=Ext.util.Format.ellipsis;var nonSpace=/^\s*$/;var attrs=[{n:'id',v:'id'},{n:'className',v:'class'},{n:'name',v:'name'},{n:'type',v:'type'},{n:'src',v:'src'},{n:'href',v:'href'}];function hasChild(n){for(var i=0,c;c=n.childNodes[i];i++){if(c.nodeType==1){return true;}}
return false;}
function renderNode(n,leaf){var tag=n.tagName.toLowerCase();var s='&lt;'+tag;for(var i=0,len=attrs.length;i<len;i++){var a=attrs[i];var v=n[a.n];if(v&&!nonSpace.test(v)){s+=' '+a.v+'=&quot;<i>'+html(v)+'</i>&quot;';}}
var style=n.style?n.style.cssText:'';if(style){s+=' style=&quot;<i>'+html(style.toLowerCase())+'</i>&quot;';}
if(leaf&&n.childNodes.length>0){s+='&gt;<em>'+ellipsis(html(String(n.innerHTML)),35)+'</em>&lt;/'+tag+'&gt;';}else if(leaf){s+=' /&gt;';}else{s+='&gt;';}
return s;}
var HtmlNode=function(n){var leaf=!hasChild(n);this.htmlNode=n;this.tagName=n.tagName.toLowerCase();var attr={text:renderNode(n,leaf),leaf:leaf,cls:'x-tree-noicon'};HtmlNode.superclass.constructor.call(this,attr);this.attributes.htmlNode=n;if(!leaf){this.on('expand',this.onExpand,this);this.on('collapse',this.onCollapse,this);}};Ext.extend(HtmlNode,Ext.tree.AsyncTreeNode,{cls:'x-tree-noicon',preventHScroll:true,refresh:function(highlight){var leaf=!hasChild(this.htmlNode);this.setText(renderNode(this.htmlNode,leaf));if(highlight){Ext.fly(this.ui.textNode).highlight();}},onExpand:function(){if(!this.closeNode&&this.parentNode){this.closeNode=this.parentNode.insertBefore(new Ext.tree.TreeNode({text:'&lt;/'+this.tagName+'&gt;',cls:'x-tree-noicon'}),this.nextSibling);}else if(this.closeNode){this.closeNode.ui.show();}},onCollapse:function(){if(this.closeNode){this.closeNode.ui.hide();}},render:function(bulkRender){HtmlNode.superclass.render.call(this,bulkRender);},highlightNode:function(){},highlight:function(){},frame:function(){this.htmlNode.style.border='1px solid #0000ff';},unframe:function(){this.htmlNode.style.border='';}});return HtmlNode;}();Ext.BLANK_IMAGE_URL="s.gif";Ext.override(Ext.tree.TreeEventModel,{initEvents:function(){var el=this.tree.getTreeEl();el.on('click',this.delegateClick,this);if(this.tree.trackMouseOver!==false){var innerCt=Ext.fly(el.dom.firstChild);innerCt.on('mouseover',this.delegateOver,this);innerCt.on('mouseout',this.delegateOut,this);}
el.on('dblclick',this.delegateDblClick,this);el.on('contextmenu',this.delegateContextMenu,this);}});Ext.tree.DefaultSelectionModel.override({onKeyDown:Ext.emptyFn});Ext.form.DateField.override({parseDate:function(value){if(!value||Ext.isDate(value)){return value;}
var v=Date.parseDate(value,this.format);if(!v){var no_zeros_format=this.format.replace('d','j').replace('m','n');v=Date.parseDate(value,no_zeros_format);if(!v){var no_zeros_format_y=no_zeros_format.replace('Y','y')
v=Date.parseDate(value,no_zeros_format_y);}}
if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}
for(var i=0,len=this.altFormatsArray.length;i<len&&!v;i++){v=Date.parseDate(value,this.altFormatsArray[i]);}}
return v;}});Ext.grid.CheckboxSelectionModel.override({handleMouseDown:function(grid,rowIndex,e){var t=e.getTarget();var checkbox_clicked=(t.className=='x-grid3-row-checker');if(e.button===0){e.stopEvent();var row=e.getTarget('.x-grid3-row');if(row){var index=row.rowIndex;if(this.isSelected(index)){if(!checkbox_clicked)this.deselectRow(index);}else{if(e.shiftKey){var sels=this.getSelections();if(sels.length>0){var first_idx=0;var all_items=sels[0].store.data.items;for(var k=0;k<all_items.length;k++){if(sels[0].data.object_id==all_items[k].data.object_id)break;first_idx++;}
if(checkbox_clicked){if(first_idx<index){index=index-1;}else{index=index+1;}}
this.selectRange(first_idx,index);}}else{if(checkbox_clicked){return;}
this.selectRow(index,e.ctrlKey===true);}}}}}});Ext.grid.GridView.override({focusCell:function(row,col,hscroll){this.syncFocusEl(this.ensureVisible(row,col,hscroll));this.focusEl.focus.defer(1,this.focusEl);},syncFocusEl:function(row,col,hscroll){var xy=row;if(!Ext.isArray(xy)){row=Math.min(row,Math.max(0,this.getRows().length-1));}
this.focusEl.setXY(xy||this.scroller.getXY());}});Ext.grid.RowSelectionModel.override({initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("rowmousedown",this.handleMouseDown,this);}else{this.grid.on("rowclick",function(grid,rowIndex,e){},this);}
this.rowNav=new Ext.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var last=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(last!==false){this.last=last;}}else{this.selectFirstRow();}},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var last=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(last!==false){this.last=last;}}else{this.selectFirstRow();}},scope:this});var view=this.grid.view;view.on("refresh",this.onRefresh,this);view.on("rowupdated",this.onRowUpdated,this);view.on("rowremoved",this.onRemove,this);}});Ext.override(Ext.Element,{getAttributeNS:function(ns,name){if(Ext.isIE){var ieVer=navigator.userAgent.match(/msie (\d+)/i);ieVer=ieVer?parseInt(ieVer[1],10):0;}
if(!Ext.isIE||ieVer>=9){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name];}else{var d=this.dom;var type=typeof d[ns+":"+name];if(type!='undefined'&&type!='unknown'){return d[ns+":"+name];}
return d[name];}}});if(typeof Range!="undefined"){if(typeof Range.prototype.createContextualFragment=="undefined"){Range.prototype.createContextualFragment=function(html){var doc=window.document;var container=doc.createElement("div");container.innerHTML=html;var frag=doc.createDocumentFragment(),n;while((n=container.firstChild)){frag.appendChild(n);}
return frag;};}}
Ext.form.ComboBox.override({doQuery:function(q,forceAll){if(q===undefined||q===null){q='';}
var qe={query:q,forceAll:forceAll,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
q=qe.query;forceAll=qe.forceAll;if(forceAll===true||(q.length>=this.minChars)){if(this.lastQuery!==q){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(forceAll){this.store.clearFilter();}else{this.store.filter(this.displayField,q,true);}
this.onLoad();}else{this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else{this.selectedIndex=-1;this.onLoad();}}}});Ext.grid.GridView.override({insertRows:function(dm,firstRow,lastRow,isUpdate){if(!isUpdate&&firstRow===0&&lastRow>=dm.getCount()-1){this.refresh();}else{if(!isUpdate){this.fireEvent("beforerowsinserted",this,firstRow,lastRow);}
var html=this.renderRows(firstRow,lastRow);var before=this.getRow(firstRow);if(before){Ext.DomHelper.insertHtml('beforeBegin',before,html);}else{Ext.DomHelper.insertHtml('beforeEnd',this.mainBody.dom,html);}
if(!isUpdate){this.fireEvent("rowsinserted",this,firstRow,lastRow);this.processRows(firstRow);}}}});Ext.grid.GridPanel.override({reloadGridPagingToolbar:function(controller,func,manager){var bba_before=Ext.getCmp(manager).getBottomToolbar();if(bba_before.loading){bba_before.loading.disable();}
var params=Ext.getCmp(manager).store.lastOptions.params;if(typeof params!='undefined'){delete params.action;params.only_result=1;Ext.getCmp(manager).getBottomToolbar().disable();og.openLink(og.getUrl(controller,func,params),{hideLoading:true,callback:function(success,data){var man=Ext.getCmp(manager);if(!man)return;man.updateGridPagingToolbar(data);}});params.only_result=0;params.count_results=0;}},updateGridPagingToolbar:function(data){var man=this;man.store.proxy.totalLength=data.totalCount;man.store.totalLength=data.totalCount;var bba=man.getBottomToolbar();bba.updateInfo();var total_pag=data.totalCount<bba.pageSize?1:Math.ceil(data.totalCount/bba.pageSize);if(bba.afterTextEl){bba.afterTextEl.el.textContent=String.format(bba.afterPageText,total_pag);}
bba.enable();var current_page=$("#"+man.id+" .x-tbar-page-number").val();if(parseInt(current_page)==1){bba.first.disable();bba.prev.disable();}
if(parseInt(current_page)==1&&total_pag>1){bba.last.enable();bba.next.enable();}
if(Math.ceil(parseInt(data.totalCount)/parseInt(bba.pageSize))==current_page){bba.last.disable();bba.next.disable();}
if(bba.loading)bba.loading.enable();},columnModelHasDimensionAssociations:function(){var man=this;var has_associations=false;var cm=man.getColumnModel();for(var i=0;i<cm.config.length;i++){if(cm.config[i].id.indexOf('dimassoc_')==0){has_associations=true;break;}}
return has_associations;},updateColumnModelHiddenColumns:function(){var hidden_columns=this.hiddenColumnIds;if(hidden_columns&&hidden_columns.length>0){var cm=this.getColumnModel();for(var i=0;i<cm.config.length;i++){if(hidden_columns.indexOf(cm.config[i].id)!==-1){cm.config[i].hidden=true;}}
cm.fireEvent('configchange');}},afterColumnShowHide:function(col_model,col_index,is_hidden){var col=col_model.config[col_index];if(col.id&&col.id.indexOf('cp_')==0&&this.hiddenColumnIds){var h_index=this.hiddenColumnIds.indexOf(col.id);if(is_hidden&&h_index==-1){this.hiddenColumnIds.push(col.id);}else if(!is_hidden&&h_index>=0){this.hiddenColumnIds.splice(h_index,1);}}},addCustomPropertyColumns:function(cps,cm_info,grid_id){this.hiddenColumnIds=[];var last_state=Ext.state.Manager.getProvider().state;var last_grid_state=last_state?last_state[grid_id]:null;for(i=0;i<cps.length;i++){var state_col=null;if(last_grid_state&&last_grid_state.columns){for(var j=0;j<last_grid_state.columns.length;j++){if(last_grid_state.columns[j].id=='cp_'+cps[i].id){state_col=last_grid_state.columns[j];break;}}}
var is_hidden=(state_col==null)?parseInt(cps[i].show_in_lists)==0:state_col.hidden;if(is_hidden){this.hiddenColumnIds.push('cp_'+cps[i].id);}
cm_info.push({id:'cp_'+cps[i].id,hidden:is_hidden,header:cps[i].name,align:cps[i].cp_type=='numeric'?'right':'left',dataIndex:'cp_'+cps[i].id,sortable:true,renderer:'string'});}}});Date.getShortMonthName=function(month){var short_lang=lang("month "+(month+1)+" short");if(short_lang&&short_lang.indexOf("Missing lang")==-1)return short_lang;return Date.monthNames[month].substring(0,3);}
function StringBuffer(){this.buffer=[];}
StringBuffer.prototype.append=function append(string){this.buffer.push(string);return this;};StringBuffer.prototype.toString=function toString(){return this.buffer.join("");};var og={};var ogTasks={};var ogTaskEvents={};ogTasksTask={};ogTasksMilestone={};ogTasksCompany={};ogTasksUser={};var vtindex=0;var vtlist=[];var searchingMemberOnTheServer=[];og.eventTimeouts=[];og.otherData=[];og.hostName='';og.maxFileSize=1024*1024;og.showMailsTab=0;og.hiddenTabs=[];og.msg=function(title,text,timeout,classname,sound){if(typeof timeout=='undefined')timeout=4;if(!classname)classname="msg";var click_to_remove_msg='';if(timeout==0)
click_to_remove_msg='<div class="x-clear"></div><div class="click-to-remove">'+lang('close')+' X</div><div class="x-clear"></div>';var box=['<div class="'+classname+'" title="'+lang('click to remove')+'">','<div class="og-box-tl"><div class="og-box-tr"><div class="og-box-tc"></div></div></div>','<div class="og-box-ml"><div class="og-box-mr"><div class="og-box-mc"><h3>{0}:</h3><p>{1}</p>',click_to_remove_msg,'</div></div></div>','<input type="hidden" value="'+new Date().getTime()+'" />','<div class="og-box-bl"><div class="og-box-br"><div class="og-box-bc"></div></div></div>','</div>'].join('');if(!this.msgCt){this.msgCt=Ext.DomHelper.insertFirst(document.body,{id:'msg-div'},true);}
var m=Ext.DomHelper.append(this.msgCt,{html:String.format(box,title,text.replace(/([^>])\n/g,'$1<br/>\n'))},true);Ext.get(m).on('click',function(){if(timeout>0){this.setStyle('display','none');}else{this.remove();}});m.timeout='aaaaa';if(timeout>0){m.slideIn('t').pause(timeout).ghost("t",{remove:true});}else{m.slideIn('t');}
if(sound){}};og.updateClock=function(clockId){var clock=og.eventTimeouts[clockId+"clock"];if(clock){clearTimeout(clock);}
var startTime=og.otherData[clockId+"starttime"];var startSeconds=og.otherData[clockId+"startseconds"];var ts=document.getElementById(clockId+"timespan");if(ts){ts.innerHTML=og.calculateTimeForClock(startTime,startSeconds);og.eventTimeouts[clockId+"clock"]=setTimeout("og.updateClock('"+clockId+"')",1002);}else{og.eventTimeouts[clockId+"clock"]=0;}};og.calculateTimeForClock=function(startTime,startSeconds){var nowTime=new Date();var elapsed=((nowTime.getElapsed(startTime)/1000)+startSeconds).toFixed(0);var seconds=(elapsed%60)/1;var totalMinutes=(elapsed-seconds)/60;var minutes=totalMinutes%60;var totalHours=(totalMinutes-minutes)/60;minutes=(minutes<10?"0":"")+minutes;seconds=(seconds<10?"0":"")+seconds.toFixed(0);return totalHours+":"+minutes+":"+seconds;}
og.startClock=function(clockId,startSeconds){og.otherData[clockId+"starttime"]=new Date();og.otherData[clockId+"startseconds"]=startSeconds;og.updateClock(clockId);};og.err=function(text){var errors=Ext.query("div.err");var maxErrors=2;for(var i=0;i<errors.length-maxErrors+1;i++){Ext.fly(errors[i]).remove();}
og.msg(lang("information"),text,0,"err");};og.clearErrors=function(timeout){var errors=Ext.query("div.err");for(var i=0;i<errors.length;i++){if(timeout){var inputs=Ext.fly(errors[i]).query('input');var ts=inputs[0].value;if(new Date().getTime()-ts>timeout*1000){Ext.fly(errors[i]).remove();}}else{Ext.fly(errors[i]).remove();}}};og.hideAndShow=function(itemToHide,itemToDisplay){Ext.get(itemToHide).setDisplayed('none');Ext.get(itemToDisplay).setDisplayed('block');};og.hideAndShowByClass=function(itemToHide,classToDisplay,containerItemName,count){Ext.get(itemToHide).setDisplayed('none');var list;var container;if(containerItemName!=''){container=document.getElementById(containerItemName);}else container=document;list=container.getElementsByTagName("*");for(var i=0;i<list.length;i++){var obj=list[i];if(obj.className!=''&&obj.className.indexOf(classToDisplay)>=0){obj.style.display='';if(count){count--;if(count==0)break;}}}};og.selectReportingMenuItem=function(link,divName,tab){var table=document.getElementById('reportingMenu');var list=table.getElementsByTagName('td');for(var i=0;i<list.length;i++)
if(list[i].className=='report_selected_menu')
list[i].className='report_unselected_menu';link.parentNode.className='report_selected_menu';link.blur();list=table.getElementsByTagName('div');for(var i=0;i<list.length;i++)
if(list[i].className=='inner_report_menu_div')
list[i].style.display='none';document.getElementById(divName).style.display='block';var url=og.getUrl('account','update_user_preference',{name:'custom_report_tab',value:tab});og.openLink(url,{hideLoading:true});}
og.dateselectchange=function(select,cls_selector){if(!cls_selector)cls_selector='dateTr';var list=select.offsetParent.offsetParent.getElementsByTagName('tr');for(var i=0;i<list.length;i++){if(list[i].className==cls_selector){list[i].style.display=select.value=='6'?'table-row':'none';}}}
og.timeslotTypeSelectChange=function(select,genid){document.getElementById(genid+'gbspan').style.display=select.value>0?'none':'inline';document.getElementById(genid+'altgbspan').style.display=select.value>0?'inline':'none';document.getElementById(genid+'task_ts_desc').style.display=select.value==0?'':'none';document.getElementById(genid+'general_ts_desc').style.display=select.value==1?'':'none';var st_row=document.getElementById(genid+'task_status_row');if(st_row)st_row.style.display=select.value==1?'none':'';}
og.switchDashboardView=function(view_as_list){og.openLink(og.getUrl('account','update_user_preference',{name:'overviewAsList',value:view_as_list}),{hideLoading:true,callback:function(success,data){var opanel=Ext.getCmp('overview-panel');opanel.defaultContent={type:'url',data:og.getUrl('dashboard','main_dashboard')};opanel.load(opanel.defaultContent);}});}
og.switchToOverview=function(){og.switchDashboardView(1);};og.switchToDashboard=function(){og.switchDashboardView(0);};og.customDashboard=function(controller,action,params,reload){if(!params)params={};if(!controller)return false;if(!action)action='init';var opanel=Ext.getCmp('overview-panel');if(opanel){var new_data=og.getUrl(controller,action,params);var content={type:"url",data:new_data};opanel.defaultContent=content;if(reload){opanel.load(content);}}}
og.resetDashboard=function(){var opanel=Ext.getCmp('overview-panel');if(opanel&&opanel.defaultContent.data!="overview"){opanel.defaultContent={type:"url",data:og.getUrl('dashboard','main_dashboard')};opanel.load(opanel.defaultContent);}}
og.loading=function(){if(!this.loadingCt){this.loadingCt=document.createElement('div');this.loadingCt.innerHTML=lang('loading');this.loadingCt.className='loading-indicator og-loading';this.loadingCt.onclick=function(){this.style.visibility='hidden';this.instances=0;};this.loadingCt.instances=0;document.body.appendChild(this.loadingCt);}
this.loadingCt.instances++;this.loadingCt.style.visibility='visible';};og.hideLoading=function(){this.loadingCt.instances--;if(this.loadingCt.instances<=0){this.loadingCt.style.visibility='hidden';}};og.getIndependentLoading=function(){loadingCt=document.createElement('div');loadingCt.innerHTML=lang('loading');loadingCt.className='loading-indicator';return loadingCt;};og.otherMsgCt=null;og.showOtherMessage=function(msg,left_percent){if(!og.otherMsgCt){og.otherMsgCt=document.createElement('div');og.otherMsgCt.innerHTML=msg;og.otherMsgCt.className='loading-indicator';og.otherMsgCt.style.position='absolute';og.otherMsgCt.style.left=(left_percent!=null?left_percent:'15%');og.otherMsgCt.style.zIndex=1000000;og.otherMsgCt.style.cursor='pointer';og.otherMsgCt.onclick=function(){this.style.visibility='hidden';this.instances=0;};og.otherMsgCt.instances=0;document.body.appendChild(og.otherMsgCt);}
og.otherMsgCt.instances++;og.otherMsgCt.style.visibility='visible';};og.hideOtherMessage=function(){og.otherMsgCt.instances--;if(og.otherMsgCt.instances<=0){og.otherMsgCt.style.visibility='hidden';}};og.toggle=function(id,btn){var obj=Ext.fly(id);if(obj.isDisplayed()){obj.slideOut("t",{duration:0.5,useDisplay:true});if(btn)Ext.fly(btn).replaceClass('toggle_expanded','toggle_collapsed');}else{obj.slideIn("t",{duration:0.5,useDisplay:true});if(btn)Ext.fly(btn).replaceClass('toggle_collapsed','toggle_expanded');}};og.toggleAndBolden=function(id,btn){var obj=Ext.get(id);if(obj.isDisplayed()){obj.dom.style.display='none';if(btn){btn.style.fontWeight='normal';}}else{obj.dom.style.display='block';$("#"+id).closest('form').parent().animate({scrollTop:$("#"+id).offset().top-250});if(btn){btn.style.fontWeight='bold';}}};og.toggleSimpleTab=function(id,contentContainer,tabContainer,tab){var tc=Ext.getDom(tabContainer);var child=tc.firstChild;while(child){if(child.style){child.style.fontWeight='normal';}
child=child.nextSibling;}
if(tab){tab.style.fontWeight='bold';tab.blur();}
var cc=Ext.getDom(contentContainer);var child=cc.firstChild;while(child){if(child.style){child.style.display='none';}
child=child.nextSibling;}
var obj=Ext.get(id);obj.dom.style.display='block';};og.showAndHide=function(idToShow,idsToHide,displayType){if(!displayType)
displayType='block';var show=document.getElementById(idToShow);if(show){show.style.display=displayType;for(var i=0;i<idsToHide.length;i++){var hide=document.getElementById(idsToHide[i]);if(hide)hide.style.display='none';}}};og.toggleAndHide=function(id,btn){var obj=Ext.getDom(id);if(obj.style.display=='block'){obj.style.display='none';if(btn)
btn.style.display='none';}else{obj.style.display='block';if(btn)
btn.style.display='none';}};og.getUrl=function(controller,action,args){var url=og.getHostName()+"/index.php";url+="?c="+controller;url+="&a="+action;for(var key in args){url+="&"+encodeURIComponent(key)+"="+encodeURIComponent(args[key]);}
return url;};og.getSandboxUrl=function(controller,action,args){var url=og.getSandboxName()+"/index.php";url+="?c="+controller;url+="&a="+action;for(var key in args){url+="&"+encodeURIComponent(key)+"="+encodeURIComponent(args[key]);}
return url;};og.filesizeFormat=function(fs){if(fs>1024*1024){var total=Math.round(fs/1024/1024*10);return total/10+"."+total%10+" MB";}else{var total=Math.round(fs/1024*10);return total/10+"."+total%10+" KB";}};og.makeAjaxUrl=function(url,params){var q=url.indexOf('?');var n=url.indexOf('#');var ap="";if(url.indexOf("context")<0&&(params&&!params.context)){var ap="context="+og.contextManager.plainContext();if(url.indexOf("currentdimension")<0&&!params.currentdimension){ap+="&currentdimension="+og.contextManager.currentDimension;}}
if(url.indexOf("ajax=true")<0){var aj="&ajax=true";}else{var aj="";}
var p="";if(params){if(typeof params=='string'){if(params!=''){p="&"+params;}}else{for(var k in params){p+="&"+encodeURIComponent(k)+"="+encodeURIComponent(params[k]);}}}
if(q<0){if(n<0){return url+"?"+ap+aj+p;}else{return url.substring(0,n)+"?"+ap+aj+(url.substring(n)!=''?"&":"")+url.substring(n)+p;}}else{return url.substring(0,q+1)+ap+aj+(url.substring(q+1)!=''?"&":"")+url.substring(q+1)+p;}};og.createHTMLElement=function(config){var tag=config.tag||'p';var attrs=config.attrs||{};var content=config.content||{};var elem=document.createElement(tag);for(var k in attrs){elem[k]=attrs[k];}
if(typeof content=='string'){elem.innerHTML=content;}else{for(var i=0;i<content.length;i++){elem.appendChild(og.createHTMLElement(content[i]));}}
return elem;};og.debug=function(obj,level){if(!level)level=0;if(level>5)return"";var pad="";var str="";for(var i=0;i<level;i++){pad+="  ";}
if(!obj){str="NULL";}else if(typeof obj=='object'){str="";for(var k in obj){str+=",\n"+pad+"  ";str+=k+": ";str+=og.debug(obj[k],level+1);}
str="{"+str.substring(1)+"\n"+pad+"}";}else if(typeof obj=='string'){str='"'+obj+'"';}else{str=obj;}
return str;};og.captureLinks=function(id,caller){var element=document.getElementById(id);if(!element)element=document;var links=element.getElementsByTagName("a");for(var i=0;i<links.length;i++){var link=links[i];if(!link.href||Ext.isGecko&&link.href==link.baseURI||link.href.indexOf('mailto:')==0||link.href.indexOf('javascript:')==0||link.href.indexOf('#')>=0)continue;if(link.target&&link.target[0]=='_')continue;if(caller&&!link.target){link.target=caller.id;}
link.onvalidate=link.onclick;link.onclick=function(e){if(typeof this.onvalidate!='function'){var p=true;}else{var p=this.onvalidate(e);}
if(this.getAttribute('disabled')!=null&&this.getAttribute('disabled')=='disabled')return false;if(p||typeof p=='undefined'){if(!this.href||this.href.indexOf("c=access&a=index")!=-1){return false;}
og.openLink(this.href,{caller:this.target});}
return false;}};forms=element.getElementsByTagName("form");for(var i=0;i<forms.length;i++){var form=forms[i];if(form.target&&form.target[0]=='_')continue;if(caller&&!form.target){form.target=caller.id;}
var onsubmit=form.onsubmit;form.onsubmit=function(){if(onsubmit&&!onsubmit()){return false;}else{og.ajaxSubmit(this,{caller:this.target});}
return false;}};};og.log=function(msg){if(!og._log)og._log="";og._log+=msg+"\n";};og.openLink=function(url,options){if(!options)options={};if(typeof options.caller=="object"){options.caller=options.caller.id;}
if(!options.caller){var tabs=Ext.getCmp('tabs-panel');if(tabs){var active=tabs.getActiveTab();if(active)options.caller=active.id;}}
if(!options.hideLoading&&!options.silent){og.loading();}
if(!options.hideLoading&&!options.hideErrors&&!options.silent){og.clearErrors(5);}
var params=options.get||{};if(typeof params=='string'&&params.indexOf('current=')<0){params+="&current="+options.caller;}else{if(options.caller&&!params.current)
params.current=options.caller;}
if(url.substring(url.length-5)!='.html'){url=og.makeAjaxUrl(url,params);}
if(typeof options.timeout!="undefined"){var oldTimeout=Ext.Ajax.timeout;Ext.Ajax.timeout=options.timeout;}
var startTime=new Date().getTime();var requestId=Ext.Ajax.request({url:url,params:options.post,callback:function(options,success,response){og.eventManager.fireEvent('ajax response',options);if(!options.options.hideLoading&&!options.silent){og.hideLoading();}
og.eventManager.fireEvent('openLink callback',response);if(success){UnTip();if(og)
clearTimeout(og.triggerFPTTO);try{try{var data=Ext.util.JSON.decode(response.responseText);}catch(e){if(!options.preventPanelLoad&&!options.options.silent){var p=Ext.getCmp(options.caller);if(p){var tp=p.ownerCt;p.load(response.responseText);if(tp&&tp.setActiveTab&&options.options.show){tp.setActiveTab(p);}}else{og.newTab(response.responseText);}}}
var dont_process_response=typeof(data)!='undefined'&&data.dont_process_response;if(!dont_process_response){og.processResponse(data,options);}}catch(e){og.err(e.message);}
var ok=typeof data=='object'&&data.errorCode==0;if(typeof options.postProcess=='function')options.postProcess.call(options.scope||this,ok,data||response.responseText,options.options);if(ok){if(typeof options.onSuccess=='function')options.onSuccess.call(options.scope||this,data||response.responseText,options.options);}else{if(typeof options.onError=='function')options.onError.call(options.scope||this,data||response.responseText,options.options);}}else{if(!options.options.hideErrors&&!options.options.silent&&response.status>0){og.err(lang("http error",response.status,response.statusText));og.httpErrLog=og.clean(response.responseText);}
if(typeof options.postProcess=='function')options.postProcess.call(options.scope||this,false,data||response.responseText,options.options);if(typeof options.onError=='function')options.onError.call(options.scope||this,data||response.responseText,options.options);}
var endTime=new Date().getTime();},caller:options.caller,postProcess:options.callback||options.postProcess,onSuccess:options.onSuccess,onError:options.onError,scope:options.scope,preventPanelLoad:options.preventPanelLoad,options:options});if(typeof oldTimeout!="undefined"){Ext.Ajax.timeout=oldTimeout;}};og.submit=function(form,options){if(!options)options={};var id=Ext.id();var frame=document.createElement('iframe');frame.id=id;frame.name=id;frame.className='x-hidden';document.body.appendChild(frame);if(Ext.isIE)frame.src=Ext.SSL_SECURE_URL;if(Ext.isIE){document.frames[id].name=id;}
options.panel=options.panel||Ext.getCmp('tabs-panel').getActiveTab().id;var origUrl=form.getAttribute('action');var origTarget=form.getAttribute('target');Ext.EventManager.on(frame,'load',function(){if(frame.submitted){form.setAttribute('action',origUrl);form.setAttribute('target',origTarget);if(typeof options.forcedCallback=='function'){options.forcedCallback();}
og.hideLoading();setTimeout(function(){Ext.removeNode(frame);},100);}},frame);og.submit[id]=options;form.setAttribute('target',frame.name);var url=og.makeAjaxUrl(origUrl)+"&upload=true&current="+options.panel+"&request_id="+id;form.setAttribute('action',url);og.loading();frame.submitted=1;form.submit();return false;};og.ajaxSubmit=function(form,options){if(!options)options={};var params=Ext.Ajax.serializeForm(form);options[form.getAttribute('method').toLowerCase()]=params;og.openLink(form.getAttribute('action'),options);return false;};og.processResponse=function(data,options,url){if(!data)return;og.loadScripts(data.scripts||[],{callback:function(){if(options)var caller=options.caller;if(data.errorCode==2009||data.u!=og.loggedUser.id){if(options){og.LoginDialog.show(options.url,options.options);}else{og.LoginDialog.show();}
return;}
if(data.events){for(var i=0;i<data.events.length;i++){og.eventManager.fireEvent(data.events[i].name,data.events[i].data);}}
if(!options||!options.preventPanelLoad&&(!options.options||!options.options.silent)){if(data.contents){for(var k in data.contents){var p=Ext.getCmp(k);if(p){p.load(data.contents[k]);}}}
if(data.current){data.current.inlineScripts=data.inlineScripts;if(data.current.panel||caller){var panelName=data.current.panel?data.current.panel:caller;var p=Ext.getCmp(panelName);if(p){var tp=p.ownerCt;p.load(data.current);if(tp&&tp.setActiveTab&&Ext.getCmp(panelName)&&(options.options.show||data.current.panel)){tp.setActiveTab(p);}}else{og.newTab(data.current,panelName,data);}}else{og.newTab(data.current);}}
if(data.help_content){Ext.getCmp('help-panel').load(data.help_content);}}
if(data.errorCode!=0&&(!options.options||!options.options.hideErrors&&!options.options.silent)){og.err(data.errorMessage);}else if(data.errorMessage){og.msg(lang("success"),data.errorMessage);}}});};og.newTab=function(content,id,data){if(!data)data={};if(!data.title){data.title=id?lang(id):lang('new tab');}
data.tabTip=data.tabTip||data.title;if(data.title.length>=15)data.title=data.title.substring(0,12)+'...';data.iconCls=data.iconCls||data.icon||(id?'ico-'+id:'ico-tab');var tp=Ext.getCmp('tabs-panel');var t=new og.ContentPanel(Ext.apply(data,{closable:true,id:id||Ext.id(),defaultContent:content}));if(tp){tp.add(t);tp.setActiveTab(t);}};og.addDomEventHandler=function(elem,ev,fun,scope){if(scope)fun=fun.createCallback(scope);if(!elem[ev+"Handlers"]){elem[ev+"Handlers"]={};if(typeof elem["on"+ev]=='function'){elem[ev+"Handlers"]['original']=elem["on"+ev];}
elem["on"+ev]=function(event){for(var id in this[ev+"Handlers"]){this[ev+"Handlers"][id](event,id);}};}
var id=Ext.id();elem[ev+"Handlers"][id]=fun;};og.removeDomEventHandler=function(elem,ev,id){if(!elem||!id||!ev||!elem[ev+"Handlers"])return;delete elem[ev+"Handlers"][id];};og.eventManager={events:new Array(),eventsById:new Array(),addListener:function(event,callback,scope,options){if(!options)options={};if(!this.events[event]||options.replace){this.events[event]=new Array();}
var id=Ext.id();var evobj={id:id,callback:callback,scope:scope,options:options};this.events[event].push(evobj);this.eventsById[id]=evobj;return id;},removeListener:function(id){var ev=this.eventsById[id];if(!ev){return;}
this.eventsById[id]=null;for(var i in this.events){if((i)&&this.events[i]){if(this.events[i].length){for(var j in this.events[i]){if(j=="remove")continue;try{event=this.events[i][j];if(event){if(event.id&&event.id==id){this.events[i][j]=null;this.events[i].splice(j,1);if(this.events[i].length==0){this.events[i]=null;this.events.splice(i,1);}}}}catch(e){if(!Ext.isIE)og.err(e.message);}}}}}},fireEvent:function(event,arguments){var list=this.events[event];if(!list){return;}
for(var i=list.length-1;i>=0;i--){if(!this.eventsById[list[i].id]){list.splice(i,1);}
var ret="";try{if(list[i]&&list[i].callback&&typeof(list[i].callback)=='function'){ret=list[i].callback.call(list[i].scope,arguments,list[i].id);}}catch(e){og.err(e.message);}
if(list[i]&&list[i].options.single||ret=='remove'){list.splice(i,1);;}}}};og.showHelp=function(){Ext.getCmp('help-panel').toggleCollapse();};og.extractScripts=function(html){var id=Ext.id();html+='<span id="'+id+'"></span>';Ext.lib.Event.onAvailable(id,function(){try{var startTime=new Date().getTime();var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var match;while(match=re.exec(html)){if(match[2]&&match[2].length>0){try{if(window.execScript){window.execScript(match[2]);}else{window.eval(match[2]);}}catch(e){og.err(e.message);}}}
var endTime=new Date().getTime();var el=document.getElementById(id);if(el){Ext.removeNode(el);}}catch(e){alert(e);}});return html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");};og.clone=function(o){if('object'!==typeof o){return o;}
var c='function'===typeof o.pop?[]:{};var p,v;for(p in o){v=o[p];if('object'===typeof v){c[p]=og.clone(v);}
else{c[p]=v;}}
return c;};og.closeView=function(obj){var currentPanel=Ext.getCmp('tabs-panel').getActiveTab();if(currentPanel)currentPanel.back();var mails_cmp=Ext.getCmp('mails-manager');if(mails_cmp!==undefined){var sm=mails_cmp.getSelectionModel();sm.clearSelections();}};og.activeTabHasBack=function(){return Ext.getCmp('tabs-panel').getActiveTab().hasBack();}
og.slideshow=function(id){var url=og.getUrl('files','slideshow',{fileId:id});var top=screen.height*0.1;var left=screen.width*0.1;var width=screen.width*0.8;var height=screen.height*0.8;window.open(url,'slideshow','top='+top+',left='+left+',width='+width+',height='+height+',status=no,menubar=no,location=no,toolbar=no,scrollbars=no,directories=no,resizable=yes')};og.getParentContentPanel=function(dom){return Ext.fly(dom).findParentNode('.og-content-panel',100);};og.getParentContentPanelBody=function(dom){return Ext.fly(dom).findParentNode('.x-panel-body',100);};og.removeLinkedObjectRow=function(r,tblId,confirm_msg){if(confirm(confirm_msg)){var i=r.parentNode.parentNode.rowIndex;var tbl=document.getElementById(tblId);tbl.deleteRow(i);tbl.deleteRow(i-1);}};og.addLinkedObjectRow=function(tblId,obj_type,obj_id,obj_name,obj_manager,confirm_msg,unlink_msg){var tbl=document.getElementById(tblId);var cantRows=tbl.rows.length/2;var row1=tbl.insertRow(tbl.rows.length);row1.className='linkedObject';row1.className+=(cantRows%2==0)?'even':'odd';var td1=row1.insertCell(0);td1.rowSpan=2;td1.style.paddingLeft=1;td1.style.verticalAlign='middle';td1.style.width='25px'
td1.innerHTML="<input type='hidden' value='"+obj_id+"' name='rel_objects[id_"+cantRows+"]' />";td1.innerHTML+="<input type='hidden' value='"+obj_manager+"' name='rel_objects[type_"+cantRows+"]' />";td1.innerHTML+="<div class='db-ico unknown ico-"+obj_type+"' title='"+obj_type+"'></div>";var td2=row1.insertCell(1);td2.innerHTML="<b><span>"+obj_name+"</span></b>";var row2=tbl.insertRow(tbl.rows.length);row2.className=row1.className;var td2=row2.insertCell(0);td2.innerHTML='<a class="internalLink" href="#" onclick="og.removeLinkedObjectRow(this,\''+tblId+'\',\''+confirm_msg+'\')" title="'+unlink_msg+' object">'+unlink_msg+'</a>';};og.PagingToolbar=function(config){og.PagingToolbar.superclass.constructor.call(this,config);};Ext.extend(og.PagingToolbar,Ext.PagingToolbar,{getPageData:function(){var total=this.store.getTotalCount();var ap=Math.ceil((this.cursor+this.pageSize)/this.pageSize);if(this.store.reader.jsonData){var start=parseInt(this.store.reader.jsonData.start);ap=Math.ceil((start+this.pageSize)/this.pageSize);this.cursor=start;}
return{total:total,activePage:ap,pages:total<this.pageSize?1:Math.ceil(total/this.pageSize)};}});og.getGooPlayerPanel=function(callback){var gppanel=Ext.getCmp('gooplayer-panel');if(gppanel){callback();}else{og.loadScripts([og.getScriptUrl('og/ObjectPicker.js'),og.getScriptUrl('og/GooPlayer.js')],{callback:function(){og.newTab({type:"panel",data:"gooplayer",config:{id:'gooplayer',sound:og.musicSound}},'gooplayer-panel',{title:'GooPlayer',icon:'ico-gooplayer'});gppanel=Ext.getCmp('gooplayer-panel');callback();}});}
return gppanel;};og.playMP3=function(track){if(og.isFlashSupported()){var gppanel=og.getGooPlayerPanel(function(){Ext.getCmp('tabs-panel').setActiveTab(gppanel);var gooplayer=Ext.getCmp('gooplayer');gooplayer.loadPlaylist([track]);gooplayer.start();});}else if(track[6]){window.open(track[6]);}};og.queueMP3=function(track){if(og.isFlashSupported()){var gppanel=og.getGooPlayerPanel(function(){var gooplayer=Ext.getCmp('gooplayer');gooplayer.queueTrack(track);});}else if(track[6]){window.open(track[6]);}};og.playXSPF=function(id){if(og.isFlashSupported()){var gppanel=og.getGooPlayerPanel(function(){Ext.getCmp('tabs-panel').setActiveTab(gppanel);var gooplayer=Ext.getCmp('gooplayer');gooplayer.loadPlaylistFromFile(id,true);});}else{window.open(og.getUrl('files','download_file',{id:id}));}};og.xmlFetchTag=function(xml,tag){var i1=xml.indexOf("<"+tag+">");var i2=xml.indexOf("</"+tag+">");if(i1>=0&&i2>i1){return{found:true,value:xml.substring(i1+tag.length+2,i2),rest:xml.substring(i2+tag.length+3)};}else{return{found:false,value:"",rest:xml};}};og.clean=function(text){return Ext.util.Format.htmlEncode(text);};og.removeTags=function(text){return Ext.util.Format.stripTags(text);};og.displayFileContents=function(genid,isFull){var text=document.getElementById(genid+'file_contents').innerHTML;if(text.length>1000&&!isFull){text=text.substring(0,900);text+='&hellip;&nbsp;&nbsp;<a href="#" onclick="og.displayFileContents(\''+genid+'\',true)">['+lang('show more')+'&hellip;]</a>';}
document.getElementById(genid+'file_display').innerHTML=text;};og.dashExpand=function(genid,expand_id){if(!expand_id)expand_id='_widget_body';var widget=Ext.get(genid+expand_id);if(widget){var setExpanded=widget.dom.style.display=='none';if(setExpanded)widget.slideIn('t',{useDisplay:true,duration:.3});else widget.slideOut('t',{useDisplay:true,duration:.3});var expander=document.getElementById(genid+'expander');if(expander)expander.className=(setExpanded)?"dash-expander ico-dash-expanded":"dash-expander ico-dash-collapsed";}};og.closeContextHelp=function(genid,option_name){var help=document.getElementById(genid+'help');if(help){help.style.display='none';if(option_name!=''){var url=og.getUrl('account','update_user_preference',{name:'show_'+option_name+'_context_help',value:0});og.openLink(url,{hideLoading:true});}}};og.billingEditValue=function(id){document.getElementById(id+'bv').style.display='none';document.getElementById(id+'bvedit').style.display='inline';document.getElementById(id+'edclick').value=1;document.getElementById(id+'text').focus();};og.checkDownload=function(url,checkedOutById,checkedOutBy,file_id){var checkOut=function(){og.ExtendedDialog.dialog.destroy();if(file_id){og.openLink(og.getUrl('files','reload_file_view',{id:file_id,checkout:1}),{hideLoading:true,hideErrors:true,callback:function(){setTimeout(function(){location.href=url+"&checkout=0";},1000);}});}else{location.href=url+"&checkout=1";}};var readOnly=function(){og.ExtendedDialog.dialog.destroy();location.href=url+"&checkout=0";}
var checkedOutByName=checkedOutBy;if(checkedOutByName=='self'){checkedOutByName=lang('you');}
if(checkedOutById>0){var config={title:lang('checkout notification'),y:50,id:'checkDownloadDialog',modal:true,height:150,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('download'),handler:readOnly,id:'download_button',scope:this}],dialogItems:[{xtype:'label',name:'checked_label',id:'checkedout',hideLabel:true,style:'font-size:100%;',text:lang('document checked out by',checkedOutByName)}]};}else{var config={title:lang('checkout confirmation'),y:50,id:'checkDownloadDialog',modal:true,height:150,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('checkout and download'),handler:checkOut,id:'checkOut_button',scope:this},{text:lang('download only'),handler:readOnly,id:'readOnly_button',scope:this}],dialogItems:[{xtype:'label',name:'checked_label',id:'checkedout',hideLabel:true,style:'font-size:100%;',text:lang('checkout recommendation')}]};}
og.ExtendedDialog.show(config);};og.getScriptUrl=function(script){return og.getHostName()+"/public/assets/javascript/"+script;};og.loadScripts=function(urls,config){if(!config)config={};if(typeof urls=="string")urls=[urls];var scriptsLeft=urls.length;var scripts=[];for(var i=0;i<urls.length;i++){if(og.loadedScripts[urls[i]]){scriptsLeft--;}else{og.loadedScripts[urls[i]]=true;if(!config.hideLoading)og.loading();Ext.Ajax.request({disableCaching:false,url:urls[i],callback:function(options,success,response){scriptsLeft--;if(!config.hideLoading)og.hideLoading();if(success){scripts[options.index]=response.responseText;}},index:i});}}
var success={};var count=0;var postScript=function(){if(scriptsLeft>0){setTimeout(postScript,100);return;}
for(var i=0;i<scripts.length;i++){if(scripts[i]){try{if(window.execScript){window.execScript(scripts[i]);}else{window.eval(scripts[i]);}
success[urls[i]]=true;count++;}catch(e){og.err(e.message);}}}
if(typeof config.callback=='function'){config.callback.call(config.scope,count,success);}};postScript();};og.loadedScripts={};og.ToggleTrap=function(trapid,fsid){if(Ext.isIE){if(!Ext.get(fsid).isDisplayed()){Ext.get(fsid).setDisplayed('block');}else{Ext.get(fsid).setDisplayed('none');}}};og.FileIsZip=function(mimetype,name){if(!name)return false;var ix=name.lastIndexOf('.');var extension=ix>=0?name.substring(ix+1):"";return(mimetype=='application/zip'||mimetype=='application/x-zip-compressed'||(mimetype=='application/x-compressed'&&extension=='zip')||extension=='zip');};og.disableEventPropagation=function(event){if(Ext.isIE){window.event.cancelBubble=true;}else{event.stopPropagation();}};og.showMoreActions=function(genid){$("#otherActions"+genid).slideToggle('slow');$("#moreOption"+genid).hide();};og.loadEmailAccounts=function(type){og.openLink(og.getUrl('mail','list_accounts',{type:type}),{callback:function(success,data){if(success){if(type=='view')og.email_accounts_toview=data.accounts;else if(type=='edit')og.email_accounts_toedit=data.accounts;}}});};og.rollOver=function(div){$(div).addClass("rolling-over");};og.rollOut=function(div,isCompany){if(isCompany){isChecked=Ext.fly(div).hasClass("checked");div.className="container-div company-name";if(isChecked){$(div).addClass("checked");}else{$(div).removeClass("checked");}}else{isChecked=Ext.fly(div).hasClass("checked-user");if(isChecked){$(div).addClass("checked-user");$(div).removeClass("user-name");}else{$(div).removeClass("checked-user");$(div).addClass("user-name");}}
$(div).removeClass("rolling-over");};og.checkUser=function(div){var hiddy=document.getElementById(div.id.substring(3));if(hiddy){if(hiddy.value=='1'){hiddy.value='0';$(div).removeClass("checked-user");$(div).addClass("user-name");}else{hiddy.value='1';$(div).addClass("checked-user");$(div).removeClass("user-name");}}};og.subscribeCompany=function(div){var isChecked=Ext.fly(div).hasClass("checked");var hids=div.parentNode.getElementsByTagName("input");for(var i=0;i<hids.length;i++){var hiddenTag=hids[i];if(!isChecked&&!hiddenTag.checked||isChecked&&hiddenTag.checked){og.checkUser(hiddenTag.parentNode);}}
if(!isChecked){Ext.fly(div).addClass('checked');}else{Ext.fly(div).removeClass('checked');}};og.confirmRemoveTags=function(manager){var man=Ext.getCmp(manager);var removeAction=function(){og.ExtendedDialog.dialog.destroy();if(man)man.removeTags();};var cancelAction=function(){og.ExtendedDialog.dialog.destroy();};var config={title:lang('remove tags'),y:50,id:'removeTags',modal:true,height:125,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('yes'),handler:removeAction,id:'yes_button',scope:this},{text:lang('no'),handler:cancelAction,id:'no_button',scope:this}],dialogItems:[{xtype:'label',name:'moveadd_label',id:'moveadd',hideLabel:true,style:'font-size:100%;',text:lang('confirm remove tags')}]};og.ExtendedDialog.show(config);}
og.confirmMoveToAllWs=function(manager,text){var man=Ext.getCmp(manager);var moveAction=function(){og.ExtendedDialog.dialog.destroy();man.moveObjectsToAllWs();};var cancelAction=function(){og.ExtendedDialog.dialog.destroy();};var config={title:'',y:50,id:'moveToAllWs',modal:true,height:125,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('yes'),handler:moveAction,id:'yes_button',scope:this},{text:lang('no'),handler:cancelAction,id:'no_button',scope:this}],dialogItems:[{xtype:'label',name:'moveadd_label',id:'moveadd',hideLabel:true,style:'font-size:100%;',text:text}]};og.ExtendedDialog.show(config);}
og.moveToWsOrMantainMembers=function(manager,ws){var man=Ext.getCmp(manager);var moveAction=function(){if(og.ExtendedDialog.dialog)og.ExtendedDialog.dialog.destroy();man.moveObjectsToWsOrMantainMembers(0,ws);};var mantainAction=function(){if(og.ExtendedDialog.dialog)og.ExtendedDialog.dialog.destroy();man.moveObjectsToWsOrMantainMembers(1,ws);};if(og.preferences['drag_drop_prompt']=='move'){moveAction();return;}else if(og.preferences['drag_drop_prompt']=='keep'){mantainAction();return;}
var config={title:lang('move to workspace or keep old ones'),y:50,id:'moveToWsOrAddWs',modal:true,height:150,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('move to workspace'),handler:moveAction,id:'move_button',scope:this},{text:lang('keep old workspaces'),handler:mantainAction,id:'add_button',scope:this}],dialogItems:[{xtype:'label',name:'moveadd_label',id:'moveadd',hideLabel:true,style:'font-size:100%;',text:lang('do you want to move objects to this ws or keep old ones and add this ws')}]};og.ExtendedDialog.show(config);};og.askToClassifyUnclassifiedAttachs=function(manager,mantain,ws){var man=Ext.getCmp(manager);var classifyAction=function(){if(og.ExtendedDialog.dialog)og.ExtendedDialog.dialog.destroy();man.moveObjectsClassifyingEmails(mantain,ws,1);};var leaveAction=function(){if(og.ExtendedDialog.dialog)og.ExtendedDialog.dialog.destroy();man.moveObjectsClassifyingEmails(mantain,ws,0);};if(og.preferences['mail_drag_drop_prompt']=='classify'){classifyAction();return;}else if(og.preferences['mail_drag_drop_prompt']=='dont'){leaveAction();return;}
var config={title:lang('classify mail attachments'),y:50,id:'classifyAttachs',modal:true,height:150,width:300,resizable:false,closeAction:'hide',iconCls:'op-ico',border:false,buttons:[{text:lang('yes'),handler:classifyAction,id:'yes_button',scope:this},{text:lang('no'),handler:leaveAction,id:'no_button',scope:this}],dialogItems:[{xtype:'label',name:'classify_label',id:'classify_leave',hideLabel:true,style:'font-size:100%;',text:lang('do you want to classify the unclassified emails attachments')}]};og.ExtendedDialog.show(config);};og.replaceAllOccurrences=function(str,search,replace){while(str.indexOf(search)!=-1){str=str.replace(search,replace);}
return str;};og.isFlashSupported=function(){return navigator.mimeTypes["application/x-shockwave-flash"]?true:false;};og.showHide=function(itemId,mode){if(!mode||(mode!='block'&&mode!='inline'))mode='block';var el=document.getElementById(itemId);if(el){if(el.style.display=='none')el.style.display=mode;else el.style.display='none';}};og.calculate_time_zone=function(server){var client=new Date();var diff=client.getTime()-server.getTime();diff=Math.round(diff*2/3600000);return diff/2;};og.redrawLinkedObjects=function(id){var div=Ext.get("linked_objects_in_prop_panel");if(div){div.load({url:og.getUrl('object','redraw_linked_object_list',{id:id}),scripts:true});}}
og.redrawSubscribers=function(id,genid){var div=Ext.get(genid+"subscribers_in_prop_panel");if(div){div.load({url:og.getUrl('object','redraw_subscribers_list',{id:id}),scripts:true});}}
og.show_hide_subscribers_list=function(id,genid){og.openLink(og.getUrl('object','add_subscribers_list',{obj_id:id,genid:genid}),{preventPanelLoad:true,onSuccess:function(data){og.ExtendedDialog.show({html:data.current.data,height:450,width:685,ok_fn:function(){formy=document.getElementById(genid+"add-User-Form");var params=Ext.Ajax.serializeForm(formy);var options={callback:function(data,success){og.redrawSubscribers(id,genid);}}
options[formy.method.toLowerCase()]=params;og.openLink(formy.getAttribute('action'),options);og.ExtendedDialog.hide();}});return;}});};og.eventManager.addListener('handle edit concurrence',function(data){var genid=data['genid'];var elem=document.getElementById(genid+'merge-changes-hidden');elem.value='';var hidden=document.getElementById(genid+"updated-on-hidden");if(hidden){hidden.value=data['updatedon'];}
var dialog='<div style="padding:10px;">';dialog+='<h1>'+lang('allready updated object')+'</h1><br />';dialog+='<div>'+lang('allready updated object desc')+'</div></div>';og.ExtendedDialog.show({html:dialog,height:250,width:350,YESNO:true,ok_fn:function(){og.ExtendedDialog.hide();elem.value='true';var form=document.getElementById(genid+"submit-edit-form");form.onsubmit();elem.value='';}});});og.getCkEditorInstance=function(name){var editor=null;for(instName in CKEDITOR.instances){if(instName==name){editor=CKEDITOR.instances[instName];break;}}
return editor;};og.adjustCkEditorArea=function(genid,id,keep_bottom){if(id==undefined)id='';var el=document.getElementById('cke_'+genid+'ckeditor'+id);if(el)el.style.padding='0px';var cont=document.getElementById('cke_contents_'+genid+'ckeditor'+id);if(cont){cont.style.padding='0px';cont.style.border='0px none';}
if(!keep_bottom){var bot=document.getElementById('cke_bottom_'+genid+'ckeditor'+id);if(bot)bot.style.display='none';}};og.hideFlashObjects=function(){var flash=document.getElementsByTagName('embed');for(var i=0;i<flash.length;i++){flash[i].style.visibility='hidden';flash[i].hiddenFlashObject=true;}};og.restoreFlashObjects=function(){var flash=document.getElementsByTagName('embed');for(var i=0;i<flash.length;i++){if(flash[i].hiddenFlashObject)flash[i].style.visibility='visible';flash[i].hiddenFlashObject=false;}};og.promptDeleteAccount=function(account_id,reload){var check_id=Ext.id();var config={genid:Ext.id(),title:lang('confirm delete mail account'),height:150,width:250,labelWidth:150,ok_fn:function(){var checked=Ext.getCmp(check_id).getValue();og.openLink(og.getUrl('mail','delete_account',{id:account_id,deleteMails:checked?1:0,reload:reload?1:0}));og.ExtendedDialog.hide();},dialogItems:{xtype:'checkbox',fieldLabel:lang('delete account emails'),id:check_id,value:false}};og.ExtendedDialog.show(config);};og.promptDeleteCalendar=function(calendar_id){var check_id=Ext.id();var config={genid:Ext.id(),title:lang('delete calendar'),height:200,width:250,labelWidth:150,ok_fn:function(){var checked=Ext.getCmp(check_id).getValue();og.openLink(og.getUrl('event','delete_calendar',{cal_id:calendar_id,deleteCalendar:checked?1:0}));og.ExtendedDialog.hide();},dialogItems:{xtype:'checkbox',fieldLabel:lang('delete calendar events'),id:check_id,value:false}};og.ExtendedDialog.show(config);};og.htmlToText=function(html){html=html.replace(/[\n\r]\s*/g,"");html=html.replace(/[ \t][ \t]+|&nbsp;/g," ");html=html.replace(/(<\/table>|<\/tr>|<\/div>|<br *\/?>|<\/p>)/g,"$1\n");html=html.replace(/(<\/td>)/g,"$1\t");html=html.replace(/<[^>]*>/g,"");return html;};og.updateUnreadEmail=function(unread){if(og.preferences['show_unread_on_title']){var title=document.title;if(title.charAt(0)=='('&&title.indexOf(')')>0){title=title.substring(title.indexOf(')')+2);}
if(unread>0){document.title="("+unread+") "+title;}else{document.title=title;}}
var panel=Ext.getCmp('mails-panel');if(panel){if(unread>0){panel.setTitle(lang('email tab')+" ("+unread+")");}else{panel.setTitle(lang('email tab'));}}else{var tab=Ext.select("#tabs-panel__mails-panel span.x-tab-strip-text");tab.each(function(){if(unread>0){this.innerHTML=lang('email tab')+" ("+unread+")";}else{this.innerHTML=lang('email tab');}});}};og.onChangeObjectCoType=function(genid,manager,id,new_cotype){og.openLink(og.getUrl('object','re_render_custom_properties',{id:id,manager:manager,req:1,co_type:new_cotype}),{callback:function(success,data){if(success){var div=Ext.get(genid+'required_custom_properties');if(div)div.remove();var container=Ext.get(genid+'required_custom_properties_container');if(container){container.insertHtml('beforeEnd','<div id="'+genid+'required_custom_properties">'+data.html+'</div>');eval(data.scripts);}}}});};og.expandDocumentView=function(link){var document_view=$(link).parent();var container=$(link).closest(".x-panel-body");if(link.expanded){$(document_view).css({'height':link.old_height+'px','position':'relative'});link.title=lang('expand');link.className='ico-expand';$(container).animate({scrollTop:0},0);$(container).css('overflow-y','auto');link.expanded=false;}else{link.old_height=$(document_view).height();$(document_view).css({'z-index':'500','top':'0px','height':'100%','position':'absolute'});link.title=lang('collapse');link.className='ico-collapse';$(container).animate({scrollTop:0},0);$(container).css('overflow-y','hidden');link.expanded=true;}};og.getHostName=function(){og.hostName=og.hostName.replace(/\/+$/,"");return og.hostName;};og.handleMemberChooserSubmit=function(genid,objectType,preHfId){if(!preHfId)preHfId="";var panels=Ext.getCmp(genid+"-member-chooser-panel-"+objectType);if(panels){var memberChoosers=panels.items;var members=[];if(memberChoosers){memberChoosers.each(function(item,index,length){var checked=item.getChecked("id");for(var j=0;j<checked.length;j++){members.push(checked[j]);}});if(og.can_submit_members){document.getElementById(genid+preHfId+member_selector[genid].hiddenFieldName).value=Ext.util.JSON.encode(members);}
var el=document.getElementById(genid+preHfId+"trees_not_loaded");if(el)el.value=og.can_submit_members?0:1;}}
return true;}
og.getSandboxName=function(){og.sandboxName=og.sandboxName?og.sandboxName.replace(/\/+$/,""):og.getHostName();return og.sandboxName;};og.formatPopupMemberChooserSelectedValues=function(genid,selected){var html='';var title='';var memberChoosers=Ext.getCmp("menu-panel").items;for(i=0;i<selected.length;i++){if(memberChoosers){memberChoosers.each(function(item,index,length){var node=item.getNodeById(selected[i]);if(node){title+=node.text;if(i<selected.length-1)title+=',';title+=' ';}});}}
html=title.length>40?title.substring(0,37)+"...":title;var ico=Ext.get(genid+'popup_ms_icon');if(ico){ico.dom.className='ico-edit';ico.dom.innerHTML=lang('edit');}
return{html:html,title:title};}
og.popupMemberChooserHtml=function(genid,obj_type,hf_members_id,selected,no_label){var ico_cls='db-ico ico-add';var action=lang('add');var to_show={html:'<span class="desc">'+lang('none selected')+'</span>',title:''};if(selected){to_show=og.formatPopupMemberChooserSelectedValues(genid,selected);ico_cls='db-ico ico-edit';action=lang('edit');}
var onclick_ev='og.showPopupMemberChooser(\''+genid+'\', \''+obj_type+'\', \''+hf_members_id+'\', \''+selected+'\');';var html='';if(!no_label)
html+='<div style="padding-top:5px;"><label style="font-size:100%;display:inline;margin-right:30px;">'+lang('context')+':&nbsp;</label>';html+='<span id="'+genid+'popup_member_selector" onclick="'+onclick_ev+'" style="cursor:pointer;" title="'+to_show.title+'">'+to_show.html+'</span>';html+='<span id="'+genid+'popup_ms_icon" class="'+ico_cls+'" onclick="'+onclick_ev+'" style="cursor:pointer; padding:5px 0 0 20px; margin-left:5px;">'+action+'</span>'
html+='</div>';return html;};og.showPopupMemberChooser=function(genid,obj_type,hf_members_id,selected){og.openLink(og.getUrl('object','popup_member_chooser',{obj_type:obj_type,genid:genid,selected:selected}),{preventPanelLoad:true,onSuccess:function(data){var dialog=og.ExtendedDialog.show({html:data.current.data,title:lang('select context members'),iconCls:'ico-workspace',resizable:true,minHeight:273,minWidth:480,height:273,width:480,ok_fn:function(){og.handleMemberChooserSubmit(genid,obj_type);var sel_members=Ext.get(genid+member_selector[genid].hiddenFieldName).getValue();var hf=Ext.get(genid+hf_members_id);hf.dom.value=sel_members;og.ExtendedDialog.hide();if(sel_members!=''){var to_show=og.formatPopupMemberChooserSelectedValues(genid,Ext.util.JSON.decode(sel_members));var sel=Ext.get(genid+'popup_member_selector');sel.dom.innerHTML=to_show.html;sel.dom.title=to_show.title;}}});return;}});}
og.drawComboBox=function(config){if(!config)config={};if(!config.render_to)config.render_to='';if(!config.id)config.id=Ext.id();if(!config.name)config.name=Ext.id();if(!config.selected)config.selected=0;if(!config.store)config.store=[];if(!config.empty_text)config.empty_text='';if(!config.tab_index)config.tab_index='500';if(!config.width)config.width=200;if(!config.typeAhead)config.typeAhead=false;var combo=new Ext.form.ComboBox({renderTo:config.render_to,name:config.name,id:config.id,value:config.selected,store:new Ext.data.SimpleStore({fields:['value','text'],data:config.store}),emptyText:config.empty_text,width:config.width,listWidth:config.width,tabIndex:config.tab_index,displayField:'text',editable:config.editable==true,typeAhead:config.typeAhead,mode:'local',triggerAction:'all',selectOnFocus:true,valueField:'value',valueNotFoundText:'',disabled:config.disabled==true,hidden:config.hidden==true});Ext.get(config.id).setWidth(config.width-18);combo.setWidth(config.width);return combo;}
og.drawDateMenuPicker=function(config){var datemenu=new Ext.menu.DateMenu({id:config.id?config.id:Ext.id(),format:og.preferences['date_format'],startDay:og.preferences['start_monday'],altFormats:lang('date format alternatives'),listeners:config.listeners,items:config.items});Ext.apply(datemenu.picker,{okText:lang('ok'),cancelText:lang('cancel'),monthNames:[lang('month 1'),lang('month 2'),lang('month 3'),lang('month 4'),lang('month 5'),lang('month 6'),lang('month 7'),lang('month 8'),lang('month 9'),lang('month 10'),lang('month 11'),lang('month 12')],dayNames:[lang('sunday'),lang('monday'),lang('tuesday'),lang('wednesday'),lang('thursday'),lang('friday'),lang('saturday')],monthYearText:'',nextText:lang('next month'),prevText:lang('prev month'),todayText:lang('today'),todayTip:lang('today')});return datemenu;}
og.quickForm=function(config){if(!config)return false;switch(config.type){case"member":var d=config.dimensionId;var tree=Ext.getCmp("dimension-panel-"+d);if(tree){var selected=tree.getSelectionModel().getSelectedNode();if(!selected||selected.getDepth()==0){var parent=0;}else{var parent=selected.id;}
var e=$("#"+config.elId);if(d){if(og.quick_form_visible==d&&$("#quick-form").css('display')!='none'){og.quick_form_visible=0;$("#quick-form").slideUp();}else{og.openLink(og.getUrl('member','quick_add_form',{dimension_id:config.dimensionId,parent_member_id:parent}),{preventPanelLoad:true,callback:function(success,data){og.quick_form_visible=d;if(data.draw_menu){var html='<ul class="quick-menu-list">';$("#quick-form").addClass("menu");for(var k=0;k<data.urls.length;k++){var url_obj=data.urls[k];html+='<li class="quick-menu-item">';html+='<a class="link-ico '+url_obj.iconcls+'" href="#" onclick="og.render_modal_form(\'\', {url:\''+url_obj.url+'\'}); $(\'#quick-form\').hide(); return false;">'+url_obj.link_text+'</a></li>';}
html+="</ul>";var offset=e.offset();$("#quick-form .form-container").html('').html(html);$("#quick-form .form-container").parent().css({top:offset.top+15,left:offset.left+15}).slideDown('normal',function(){var bottom=$("#quick-form .form-container").css('bottom').replace('px','');if(bottom<0)$("#quick-form .form-container").animate({"top":"+="+bottom+"px"});});}else{if(data.urls&&data.urls.length>0){var url_obj=data.urls[0];og.render_modal_form('',{url:url_obj.url});if($("#quick-form").css('display')!='none'){og.quick_form_visible=0;$("#quick-form").slideUp();}}}}});}}}
break;case"configFilter":var e=$("#"+config.genid+"configFilters");$("#quick-form .form-container").html('').load(og.getUrl('contact','quick_config_filter_activity',{members:config.members}),function(){var new_offset={top:e.offset().top,left:e.offset().left-240,right:e.offset().right,bottom:e.offset().bottom};$(this).parent().css(new_offset).slideDown();return true;});return false;break;case"expenses_graph":var e=$("#"+config.genid+"configFiltersExpense");$("#quick-form .form-container").html('').load(og.getUrl('widget','render_template_with_options',{type:config.type}),function(){var new_offset={top:e.offset().top,left:e.offset().left-240,right:e.offset().right,bottom:e.offset().bottom};$(this).parent().css(new_offset).slideDown();return true;});$("#quick-form").css('z-index',100);return false;break;default:break}
return false;}
og.flash2img=function(){$.each($('embed'),function(k,elem){var convert=(typeof elem.get_img_binary=="function");if(convert){var base64=elem.get_img_binary();if(base64){var image=document.createElement('img');image.src="data:image/jpg;base64,"+base64;$(elem).replaceWith(image);}}});}
og.getMemberTreeNodeColor=function(node){var color="";if(node.ui&&node.ui.getIconEl()){classes=node.ui.getIconEl().className.split(" ");for(j=0;j<classes.length;j++){if(classes[j].indexOf('ico-color')>=0)color=classes[j].replace('ico-color',"");}}
return color;}
og.getMemberFromTrees=function(dim_id,mem_id,include_parents){var texts=[];var tree=Ext.getCmp("dimension-panel-"+dim_id);if(tree){var selnode=tree.getSelectionModel().getSelectedNode();selnode_id=selnode?selnode.id:-1;node=tree.getNodeById(mem_id);if(node){texts.push({id:node.id,text:node.text,ot:node.object_type_id,c:og.getMemberTreeNodeColor(node)});if(include_parents){while(node.parentNode&&node.parentNode.id>0&&node.parentNode.id!=selnode_id){node=node.parentNode;if(node)texts.push({id:node.id,text:node.text,ot:node.object_type_id,c:og.getMemberTreeNodeColor(node)});}}}}
return texts;}
og.expandCollapseDimensionTree=function(tree,previous_exp,selection_id){if(tree&&!tree.expanded_once){if(previous_exp){expanded=previous_exp;}else{expanded=[];tree.root.cascade(function(){if(this.isExpanded())expanded.push(this.id);});}
if(selection_id){tree.root.expand(true,false,function(){tree.selectNodes([selection_id])});}else{tree.root.expand(true,false);}
tree.root.collapse(true,false);for(i=0;i<expanded.length;i++){node=tree.getNodeById(expanded[i]);if(node)node.expand(false);}
tree.expanded_once=true;}}
og.memberTreeExternalClick=function(tree_id,member_id){var dimensions_panel=Ext.getCmp('menu-panel');dimensions_panel.items.each(function(item,index,length){if(item.dimensionCode==tree_id){item.onMemberExternalClick(member_id);}});}
og.checkValidEmailAddress=function(email){var atpos=email.indexOf("@");var dotpos=email.lastIndexOf(".");if(atpos<1||dotpos<atpos+2||dotpos+2>=email.length){return false;}else{return true;}}
og.checkEmailAddress=function(element,id_contact,contact_type){$(element).blur(function(){var field=$(this);var url=og.makeAjaxUrl(og.getUrl("contact","check_existing_email",{email:field.val(),id_contact:id_contact,contact_type:contact_type}));og.loading();$.getJSON(url,function(data){$(".field-error-msg").remove();var contact=data.contact;if(contact.status){$(field).addClass("field-error");$(field).after("<div class='field-error-msg'>"+lang("email already taken by",contact.name)+" </div>");$(field).focus();$('.submit').attr('disabled',true);$('.submit').addClass('disabled');}else{$(field).removeClass("field-error");if(contact.id){og.openLink(og.getUrl('contact','edit',{id:contact.id,isEdit:1}));$("#quick-form").hide();}
$('.submit').attr('disabled',false);$('.submit').removeClass('disabled');}
og.hideLoading();});setTimeout(function(){og.hideLoading()},5000);});}
og.selectDimensionTreeMember=function(data){var tree=Ext.getCmp("dimension-panel-"+data.dim_id);if(tree){if(data.node=='root'){og.contextManager.cleanActiveMembers(data.dim_id);if(!tree.hidden)og.contextManager.addActiveMember(0,data.dim_id,tree.root);tree.selectRoot();}else{var treenode=tree.getNodeById(data.node);if(treenode){treenode.select();treenode.ensureVisible();if(!tree.hidden)og.contextManager.addActiveMember(node,data.dim_id,treenode);}}}}
og.loadWidget=function(name,callback){var url=og.getUrl('dashboard','load_widget',{name:name});var params={callback:callback};og.openLink(url,params);}
og.quickAddTask=function(data,callback){var name=data.name;var due_date=data.due_date;var due_time=data.due_time;var assigned_to=data.assigned_to|0;var ajaxOptions={post:{'task[assigned_to_contact_id]':assigned_to,'task[name]':name,'task[task_due_date]':due_date,'task[task_due_time]':due_time},callback:callback};var url=og.makeAjaxUrl(og.getUrl('task','quick_add_task',ajaxOptions));og.openLink(url,ajaxOptions);}
og.quickAddWs=function(data,callback){var name=data.name;var parent=data.parent|0;var ajaxOptions={post:{'member[name]':name,'member[dimension_id]':data.dim_id,'member[parent_member_id]':parent,'member[object_type_id]':data.ot_id},callback:callback};var url=og.makeAjaxUrl(og.getUrl('member','add',ajaxOptions));og.openLink(url,ajaxOptions);}
og.onPersonClose=function(){var currentPanel=Ext.getCmp('tabs-panel').getActiveTab();if(currentPanel.id!='overview-panel'){og.closeView();return;}
var actual_sel=og.core_dimensions.prev_selection.pop();var prev_sel=null;if(og.core_dimensions.prev_selection.length>0){prev_sel=og.core_dimensions.prev_selection[og.core_dimensions.prev_selection.length-1];}else{if(currentPanel.closable)og.closeView();}
var dimensions_panel=Ext.getCmp('menu-panel');dimensions_panel.items.each(function(item,index,length){if(item.dimensionCode=='feng_persons'){if(prev_sel){og.expandCollapseDimensionTree(item);var n=item.getNodeById(prev_sel);if(n){if(n.parentNode)item.expandPath(n.parentNode.getPath(),false);item.fireEvent('click',n);og.contextManager.addActiveMember(n.id,item.dimensionId);}else{item.selectRoot();n=item.getRootNode();item.fireEvent('click',n);og.contextManager.cleanActiveMembers(item.dimensionId);}}else{item.selectRoot();n=item.getRootNode();item.fireEvent('click',n);og.contextManager.cleanActiveMembers(item.dimensionId);}
setTimeout(function(){if(n.id==item.getRootNode().id){item.getSelectionModel().fireEvent('selectionchange',item.getSelectionModel(),n);}},500);}});}
og.checkRelated=function(type,related_id){var return_data=false;var url;switch(type){case"task":url=og.makeAjaxUrl(og.getUrl("task","check_related_task"));$.ajax({url:url,dataType:'json',async:false,data:{related_id:related_id},success:function(data){return_data=data.status;}});return return_data;break;case"event":url=og.makeAjaxUrl(og.getUrl("event","check_related_event"));$.ajax({url:url,dataType:'json',async:false,data:{related_id:related_id},success:function(data){return_data=data.status;}});return return_data;default:return return_data;break}}
og.openTab=function(id){Ext.getCmp('tabs-panel').activate(id);}
og.reload_subscribers=function(genid,object_type_id,user_ids){if(og.reload_subscribers_timeout){clearTimeout(og.reload_subscribers_timeout);}
og.reload_subscribers_params={genid:genid,object_type_id:object_type_id,user_uds:user_ids};og.reload_subscribers_timeout=setTimeout(function(){og.do_reload_subscribers(og.reload_subscribers_params.genid,og.reload_subscribers_params.object_type_id,og.reload_subscribers_params.user_ids);},500);}
og.do_reload_subscribers=function(genid,object_type_id,user_ids){if(!user_ids){var uids=App.modules.addMessageForm.getCheckedUsers(genid);}else{var uids=user_ids;}
var assigned_to=0;var ot=og.objectTypes[object_type_id];if(ot&&ot.name=='task'){var combo=Ext.getCmp(genid+'taskFormAssignedToCombo');if(combo)assigned_to=combo.getValue();}
var subs=Ext.get(genid+'add_subscribers_content');if(subs)subs.mask();og.openLink(og.getUrl('object','render_add_subscribers',{context:Ext.util.JSON.encode(member_selector[genid].sel_context),users:uids,genid:genid,assigned_to:assigned_to,otype:object_type_id}),{preventPanelLoad:true,callback:function(success,data){$('#'+genid+'add_subscribers_content').html(data.current.data);var subs_content=Ext.get(genid+'add_subscribers_content');if(subs_content)subs_content.unmask();}});}
function dump(arr,level){var dumped_text="";if(!level)level=0;var level_padding="";for(var j=0;j<level+1;j++)level_padding+="    ";if(typeof(arr)=='object'){for(var item in arr){var value=arr[item];if(typeof(value)=='object'){dumped_text+=level_padding+"'"+item+"' ...\n";dumped_text+=dump(value,level+1);}else{dumped_text+=level_padding+"'"+item+"' => \""+value+"\"\n";}}}else{dumped_text="===>"+arr+"<===("+typeof(arr)+")";}
return dumped_text;}
og.load_company_combo=function(combo_id,selected_id){if(!og.json_companies){$("#"+combo_id).css('display','none');$("#"+combo_id+"-loading").css('display','');$.ajax({type:"GET",url:og.getUrl('contact','get_companies_json'),dataType:"json",async:true,success:function(data,textStatus){var html="";for(var i=0;i<data.length;i++){sel=selected_id&&selected_id==data[i].id?" selected=selected ":"";html+="<option value=\""+data[i].id+"\""+sel+">"+data[i].name+"</option>";}
$("#"+combo_id).empty().append(html);if(data.length>1000){og.json_companies=data;}
$("#"+combo_id+"-loading").css('display','none');$("#"+combo_id).css('display','');}});}else{$("#"+combo_id).css('display','none');$("#"+combo_id+"-loading").css('display','');data=og.json_companies;var html="";for(var i=0;i<data.length;i++){sel=selected_id&&selected_id==data[i].id?" selected=selected ":"";html+="<option value=\""+data[i].id+"\""+sel+">"+data[i].name+"</option>";}
$("#"+combo_id).empty().append(html);$("#"+combo_id+"-loading").css('display','none');$("#"+combo_id).css('display','');}}
og.clearDimensionSelection=function(){var dimensions_panel=Ext.getCmp('menu-panel');var n=null;var tree=null;dimensions_panel.items.each(function(item,index,length){item.selectRoot();if(n==null||tree==null){n=item.getRootNode();tree=item;}
og.contextManager.cleanActiveMembers(item.dimensionId);});if(tree!=null&&n!=null){tree.fireEvent('click',n);}
Ext.getCmp('tabs-panel').items.each(function(tab,index,length){tab.loaded=false;});var currentPanel=Ext.getCmp('tabs-panel').getActiveTab();if(currentPanel&&currentPanel.id!='overview'){currentPanel.reload();}}
og.renderDimCol=function(value,p,r){if(r.id=='quick_add_row')return value;var dim_id=p.id.replace(/dim_/,'');var exclude_parents_path=false;if(og.dimensions_that_exclude_parents_in_breadcrumbs&&og.dimensions_that_exclude_parents_in_breadcrumbs[dim_id]){exclude_parents_path=og.dimensions_that_exclude_parents_in_breadcrumbs[dim_id];}
var text=og.dimColEmptyBreadcrumb(dim_id,r.data.memPath,exclude_parents_path);return text;}
og.dimColEmptyBreadcrumb=function(dim_id,memPath,exclude_parents_path){var text='';var mpath=null;if(memPath){mpath=Ext.util.JSON.decode(memPath);}
if(mpath){var mpath_aux={};mpath_aux[dim_id]={};for(t in mpath[dim_id]){mpath_aux[dim_id][t]=mpath[dim_id][t];}
text="<div class='breadcrumb-container' style='width: 100%;'>";text+=og.getEmptyCrumbHtml(mpath_aux,'.breadcrumb-container',null,null,exclude_parents_path,true);text+="</div>";}
return text;}
og.renderAmountColumn=function(value,p,r){if(typeof(value)=='undefined'){return'';}
var str_val=value;if(typeof(value)=='object'){str_val="<div class='amounts-container'>";for(curr_id in value){var amount=value[curr_id];if(typeof(amount)=='function')continue;str_val+="<div class='amount-container'>"+amount+"</div>";}
str_val+="</div>";}
return str_val;}
og.expandMenuPanel=function(options){var animate=options.animate?options.animate:true;if(options.expand)Ext.getCmp('menu-panel').expand(animate);else if(options.collapse)Ext.getCmp('menu-panel').collapse(animate);}
og.addNodesToTree=function(tree_id,more_nodes_left){var tree=Ext.getCmp(tree_id);var o=og.tmp_members_to_add[tree_id].pop();if(o){for(i=0;i<o.length;i++){if(!o[i])continue;if(tree.getNodeById(o[i].id)){continue;}
var n=tree.loader.createNode(o[i]);n.object_id=o[i].object_id;n.options=o[i].options;n.object_controller=o[i].object_controller;n.allow_childs=o[i].allow_childs;if(n)og.tmp_node[tree_id].appendChild(n);}}
if(more_nodes_left){og.addViewMoreNode(tree.getRootNode(),tree_id,og.treeLoaderViewMoreCallback);}else{var old_view_more_node=tree.getNodeById('view_more_'+tree.getRootNode().id);if(old_view_more_node)old_view_more_node.remove();}}
og.showHideWidgetMoreLink=function(cls,linkid,show){og.showHide('hidelnk'+linkid);og.showHide('showlnk'+linkid);if(show)$(cls).show("slow");else $(cls).hide("slow");}
og.showHideAppLogDetails=function(id){og.showHide('hidelink'+id);og.showHide('showlink'+id);og.showHide('logdetails'+id);}
og.getColorInputHtml=function(genid,field_name,value,col,label,disabled){if(!col)col='color';if(!field_name)field_name='member';if(!value)value=0;var html='';if(label){html+='<label for="'+genid+field_name+'_'+col+'">'+label+':</label>';}
html+='<input name="'+field_name+'['+col+']" id="'+genid+field_name+'_'+col+'" class="color-code" type="hidden" value="'+value+'" />';if(!disabled){html+="<div class='ws-color-chooser'>";for(var i=0;i<=24;i++){var cls=(value==i)?'selected':'';html+="<div  class='ico-color"+i+" "+cls+" color-cell'  onClick='$(\"input.color-code\").val(\""+i+"\");$(\".color-cell\").removeClass(\"selected\");$(this).addClass(\"selected\");'></div>";if(i==12){html+='<div class="x-clear"></div><div style="width:20px;float:left;height:10px;"></div>';}}
html+='<div class="x-clear"></div>';html+='</div>';}else{html+="<div class='ico-color"+value+"' style='float:left;width:16px;'>&nbsp;</div>";}
return html;}
og.showSelectTimezone=function(genid){var check=document.getElementById(genid+"userFormAutoDetectTimezoneYes");var div=document.getElementById(genid+"selecttzdiv");if(check&&div)div.style.display=check.checked?"none":"";if(check)$("#"+genid+"autodetected_tz_div").css('display',check.checked?"":"none");};og.getTimezoneFromBrowser=function(server,genid){var check=document.getElementById(genid+'userFormAutoDetectTimezoneYes');var combo=document.getElementById(genid+'userFormTimezone');if(check.checked){var client=new Date();var diff=client.getTime()-server.getTime();diff=Math.round(diff*2/3600000);for(var i=0;i<combo.options.length;i++){if(combo.options[i].value==diff/2){combo.options[i].selected='selected';}}}};og.goToOverview=function(close_active_tab){var opanel=Ext.getCmp('overview-panel');if(opanel){var active_tab=Ext.getCmp('tabs-panel').getActiveTab();Ext.getCmp('tabs-panel').setActiveTab(opanel);if(close_active_tab&&active_tab){Ext.getCmp('tabs-panel').remove(active_tab);}}}
og.goback=function(btn){var p=og.getParentContentPanel(Ext.fly(btn));if(p)Ext.getCmp(p.id).back();};og.fade_background_color=function(id,color){if(!color)color="white";$("#"+id).animate({backgroundColor:color},'slow');}
og.dimensionTreeDoLayout=function(genid,dim_id){var memberChooserPanel=Ext.getCmp(genid+'_with_permissions_'+dim_id);if(memberChooserPanel&&!memberChooserPanel.initialized){memberChooserPanel.doLayout();memberChooserPanel.initialized=true;}
var memberChooserPanel2=Ext.getCmp(genid+'_without_permissions_'+dim_id);if(memberChooserPanel2&&!memberChooserPanel2.initialized){memberChooserPanel2.doLayout();memberChooserPanel2.initialized=true;}}
og.onParentMemberRemove=function(genid){$("#"+genid+"memberParent").val(0);}
og.onParentMemberSelect=function(genid,dimension_id,member_id){member_selector.remove_all_selections(genid);if(!member_id){$("#"+genid+"memberParent").val(0);return;}
$("#"+genid+"memberParent").val(member_id);member_selector.add_relation(dimension_id,genid,member_id,false,false,true);og.prev_parent=member_id;og.userPermissions.reload_member_permissions(genid,dimension_id,member_id);}
og.createBrandColorsSheet=function(brand_colors){var header_back=brand_colors['brand_colors_head_back'];var tabs_back=brand_colors['brand_colors_tabs_back'];var tabs_font=brand_colors['brand_colors_tabs_font'];var header_font=brand_colors['brand_colors_head_font'];var brand_texture=brand_colors['brand_colors_texture'];var texture='';if(brand_texture){texture='background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, rgba(255, 255, 255, 0.05) 75%, rgba(255, 255, 255, 0.05)), linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, rgba(255, 255, 255, 0.05) 75%, rgba(255, 255, 255, 0.05));'
+'background-position: 0 0pt, 2px 2px;'
+'background-size: 4px 4px; ';}
var cssRules='.x-accordion-hd, ul.x-tab-strip li {background-color: #'+tabs_back+'; '+texture+'}';cssRules+='.x-accordion-hd, ul.x-tab-strip {background-color: #'+tabs_back+'; '+texture+'}';cssRules+='ul.x-tab-strip li {border-color: #'+tabs_back+'}';cssRules+='#header {background-color: #'+header_back+'; '+texture+'}';cssRules+='.x-accordion-hd, .x-tab-strip span.x-tab-strip-text {color: #'+tabs_font+'}';cssRules+='#logodiv h1, div.og-loading, div.header-breadcrumb-container {color: #'+header_font+'}';cssRules+='.x-accordion-hd {background-color: #'+tabs_back+'}';var node_selected_back=color_utils.make_transparent_color('#'+tabs_back);if(node_selected_back){cssRules+='.x-tree-node .x-tree-selected {background-color: '+node_selected_back+'; border-color: '+color_utils.darker_html_color(node_selected_back)+'}';}
var styleElement=document.createElement("style");styleElement.type="text/css";if(styleElement.styleSheet){styleElement.styleSheet.cssText=cssRules;}else{styleElement.appendChild(document.createTextNode(cssRules));}
document.getElementsByTagName("head")[0].appendChild(styleElement);}
og.render_modal_form=function(genid,options){var parameters=options.params||{};parameters.modal=1;var form_url='';if(typeof(options.url)!='undefined'){form_url=options.url;for(pname in parameters){form_url+='&'+pname+'='+parameters[pname];}}else{form_url=og.getUrl(options.c,options.a,parameters);}
og.openLink(form_url,{preventPanelLoad:true,callback:function(success,data){if(!success)return;var id=genid+(options.id?options.id:'');var div=document.createElement('div');var close_cls=options.close_cls||'';div.className=options.cls||'';div.id=id;div.innerHTML=data.current.data;var modal_params={'appendTo':'#modal-forms-container','focus':typeof(options.focusFirst)!='undefined'?options.focusFirst:true,'escClose':typeof(options.escClose)!='undefined'?options.escClose:true,'overlayClose':typeof(options.overlayClose)!='undefined'?options.overlayClose:false,'closeHTML':'<a id="'+genid+'_close_link" class="'+close_cls+' modal-close modal-close-img" title="'+lang('close')+'"></a>','onClose':function(dialog){$("#modal-forms-container").hide();$.modal.close();if(options.callbackOnClose&&typeof options.callbackOnClose=='function'){options.callbackOnClose();}},'onShow':function(dialog){$(".simplemodal-container").css('position','absolute');$("#modal-forms-container").show();if(options.hideCloseIcon){$("#"+genid+"_close_link").hide();}
$(".simplemodal-container .simplemodal-wrap").css('min-height',($("#simplemodal-data").outerHeight()+20)+'px');$(".simplemodal-container .simplemodal-wrap").css('height','auto');$(".simplemodal-container .simplemodal-wrap").css('overflow','');$(".simplemodal-container").css('margin-top','20px');og.update_modal_main_input_width();}};if(options.position){modal_params.position=options.position;}
setTimeout(function(){$.modal(div,modal_params);},100);}});}
og.resize_modal_form=function(){setTimeout(function(){var offset=$(".simplemodal-data").offset();var modalh=$(".simplemodal-data").height();var winh=$(".simplemodal-overlay").height();var headerh=$(".simplemodal-data .coInputHeader").height();var cont_offset=$(".simplemodal-container").offset();$(".simplemodal-data .form-tab").css({'max-height':(winh-(cont_offset&&cont_offset.top?cont_offset.top:0)-175)+'px','overflow-y':'auto','overflow-x':'hidden'});if(modalh>winh){$(".simplemodal-container").css({height:(winh-10)+'px'});$(".simplemodal-data .form-tab").css({'max-height':(winh-headerh-125)+'px','overflow-y':'auto','overflow-x':'hidden'});}else if(offset&&modalh+offset.top>winh){}},500);}
og.center_modal_form=function(){var modalh=$(".simplemodal-data").height();var winh=$(".simplemodal-overlay").height();var otop=(winh-modalh)/2;if(otop<0)otop=0;$(".simplemodal-container").css({top:(otop)+'px'});}
og.update_modal_main_input_width=function(){var title_w=$(".simplemodal-data .coInputHeader .coInputHeaderUpperRow .coInputTitle").width();var buttons_w=$(".simplemodal-data .coInputHeader .coInputButtons").width();var prefix_w=$(".simplemodal-data .coInputHeader .coInputName .object-prefix").width();var total_w=$(".simplemodal-data .coInputHeader").width();var input_count=$(".simplemodal-data .coInputHeader .coInputName input.title").length;if(input_count<1)input_count=1;$(".simplemodal-data .coInputHeader .coInputName input.title").css('width',(((total_w-title_w-buttons_w-prefix_w)/input_count)-35)+'px');}
og.submit_modal_form=function(form_id,callback_fn,options){if($('#'+form_id).data().isSubmitted){return false;}
options=options||{};var form=document.getElementById(form_id);var params={modal:1};var all_inputs=$('#'+form_id+' input');for(var i=0;i<all_inputs.length;i++){if(all_inputs[i].type=='checkbox'){params[all_inputs[i].name]=all_inputs[i].checked?'1':'0';}else if(all_inputs[i].type=='radio'){if(all_inputs[i].checked){params[all_inputs[i].name]=params[all_inputs[i].name]=all_inputs[i].value;}}else{if(all_inputs[i].name.indexOf("[]")>-1&&all_inputs[i].name.slice(-2)=="[]"){var in_name=all_inputs[i].name;in_name=in_name.substring(0,in_name.length-2);var arr_index=0;while(arr_index<all_inputs.length){var new_in_name=in_name+"["+arr_index+"]";if(!(new_in_name in params)){params[new_in_name]=all_inputs[i].value;break;}
arr_index++;}}else{params[all_inputs[i].name]=all_inputs[i].value;}}}
var all_selects=$('#'+form_id+' select');for(var i=0;i<all_selects.length;i++){var selopt=all_selects[i].options[all_selects[i].selectedIndex];if(selopt){params[all_selects[i].name]=selopt.value;}}
var all_textareas=$('#'+form_id+' textarea');for(var i=0;i<all_textareas.length;i++){params[all_textareas[i].name]=all_textareas[i].value;}
$('#'+form_id+' .submit').prop('disabled',true);og.openLink(form.action,{post:params,preventPanelLoad:true,hideLoading:options.hideLoading||false,hideErrors:options.hideErrors||false,callback:function(success,data){$('#'+form_id+' .submit').prop('disabled',false);if(typeof(data)=="string"){try{data=eval(data);}catch(e){}}
if(data.errorCode>0){if(data.showMessage)og.err(data.errorMessage);$('#'+form_id).data().isSubmitted=false;return;}else{if(callback_fn&&typeof(callback_fn)=='function'){callback_fn.call(null,data);}
if(data.msg){og.msg(lang('success'),data.msg);}
$('.modal-close').click();}}});$('#'+form_id).data().isSubmitted=true;setTimeout(function(){if($('#'+form_id).length){$('#'+form_id).data().isSubmitted=false;}},5000);}
og.onWidgetDimensionChanged=function(checkbox,dim_id,is_default){var enable=$(checkbox).attr('checked')=='checked'?'1':'0';og.openLink(og.getUrl('config','enable_disable_widget_dimension',{dim_id:dim_id,enable:enable,is_default:is_default}),{silent:true,callback:function(success,data){}});}
og.reload_active_tab=function(){var currentPanel=Ext.getCmp('tabs-panel').getActiveTab();if(currentPanel){currentPanel.reload();}}
og.removeFileExtension=function(filename){if(filename.lastIndexOf('.')>0){return filename.substring(0,filename.lastIndexOf('.'));}else{return filename;}}
og.single_shake=function(selector,direction,distance,times){direction=direction||'up';distance=distance||3;times=times||5;$(selector).effect("shake",{direction:direction,distance:distance,times:times});}
og.draw_highlight_hint=function(selector,hint_id,hint_text,hint_pos){$('.highlight-hint').remove();if(!hint_pos)hint_pos='right';if(!hint_text)hint_text=lang('click here');$("<div>"+hint_text+"</div>").attr('id',hint_id).addClass('highlight-hint').appendTo('body');var offset=$(selector).offset();$("#"+hint_id).click(function(){$(selector).click();$(selector).removeClass('highlighted');$(this).remove();});switch(hint_pos){case'right':$("#"+hint_id).css('top',offset.top+'px');$("#"+hint_id).css('left',(offset.left+$(selector).width()+25)+'px');break;case'left':$("#"+hint_id).css('top',offset.top+'px');$("#"+hint_id).css('left',(offset.left-$("#"+hint_id).width()-25)+'px');break;case'top':$("#"+hint_id).css('top',(offset.top-$("#"+hint_id).width()-25)+'px');$("#"+hint_id).css('left',offset.left+'px');break;case'bottom':$("#"+hint_id).css('top',(offset.top+$(selector).height()+25)+'px');$("#"+hint_id).css('left',offset.left+'px');break;default:break;}
$("#"+hint_id).show();}
og.highlight_link=function(config){var selector=config.selector;var step=config.step;var time_active=config.time_active;var timeout=config.timeout;var hint_text=config.hint_text;if(!selector)return;if(config.prev_click_selector){$(config.prev_click_selector).click();}
if($(selector).length==0){setTimeout(function(){og.highlight_link(config);},500);return;}
var hint_id=Ext.id();timeout=timeout||10;time_active=time_active||3000;setTimeout(function(){$(selector).addClass('highlighted');og.draw_highlight_hint(selector,hint_id,hint_text,config.hint_pos);if(config.shake){og.single_shake(selector,'up',3,5);setTimeout(function(){og.single_shake(selector,'up',3,5);},1500);}
if(config.animate_opacity>0){var animate_times=0;while(animate_times<config.animate_opacity){$(selector).animate({opacity:'.5'},'slow').animate({opacity:'1.0'},'slow');animate_times++;}}
setTimeout(function(){$(selector).removeClass('highlighted');$("#"+hint_id).remove();},time_active);$(selector).click(function(){$(selector).removeClass('highlighted');$("#"+hint_id).remove();if(step&&step>0){var reload=config.reload_panel?config.reload_panel:'0';og.openLink(og.getUrl('more','set_getting_started_step',{step:step,reload_panel:reload}),{hideLoading:true});if(step==99){$("#tabs-panel__more-panel").addClass("x-tab-strip-closable");$("#tabs-panel__more-panel .x-tab-strip-text").removeClass("ico-more-tab");$("#tabs-panel__more-panel .x-tab-strip-text").addClass("ico-administration");$("#tabs-panel__more-panel .x-tab-strip-text").html(lang('more-panel'));}}});},timeout);}
og.initPopoverBtns=function(btns){for(var i=0;i<btns.length;i++){var btn=$("#"+btns[i].id);var popover_options={content:"example",delay:{show:"100",hide:"200"},template:$("#"+btn.data("templateid")).html()}
if($.browser.mozilla){popover_options.trigger='focus';btn.on('click',function(){$(this).focus();});}
btn.popover(popover_options);}}
og.setSettingsClosed=function(){og.openLink(og.getUrl('more','set_settings_closed'),{hideLoading:true});}
og.renderUserTypeSelector=function(config){container_id=config.container_id;if(!config.id)config.id=Ext.id()+'_user_type_sel';var selected_type=0;for(role_id in og.userRoles){if(role_id==config.selected_value){selected_type=og.userRoles[role_id].parent;break;}}
var sel_type=document.createElement("select");sel_type.setAttribute("onchange","og.reloadUserRoleSelector({id:'"+config.id+"', input_name:'"+config.input_name+"'}, this.value);");sel_type.setAttribute("class","user-typegroup-selector");sel_type.id=config.id+'_type';document.getElementById(container_id).appendChild(sel_type);for(type_id in og.userTypes){var option=document.createElement("option");option.value=type_id;option.innerHTML=og.userTypes[type_id].name;if(selected_type==type_id){option.setAttribute('selected','selected');}
sel_type.appendChild(option);}
og.renderUserRoleSelector(config,selected_type);$("#"+container_id).append('<div style="display:none;" id="'+genid+'user_role_explanation" class="user-role-explanation">'+og.userRoles[config.selected_value].hint+'</div><div class="clear"></div>');setTimeout(function(){$("#"+genid+"user_role_explanation").css('width',($("#"+container_id).width()-275-$("#"+config.id+"_type").outerWidth()-$("#"+config.id+"_role").outerWidth())+'px').show();},100);}
og.renderUserRoleSelector=function(config,parent_type){container_id=config.container_id;var sel_role=document.createElement("select");if(config.input_name)sel_role.name=config.input_name;sel_role.onchange="";sel_role.id=config.id+'_role';sel_role.className="user-type-selector";var container=document.getElementById(container_id);if(container){container.appendChild(sel_role);}
for(role_id in og.userRoles){if(og.userRoles[role_id].parent==parent_type){var option=document.createElement("option");option.value=role_id;option.innerHTML=og.userRoles[role_id].name;if(config.selected_value){if(config.selected_value==role_id){option.setAttribute('selected','selected');}}else{if(role_id==og.defaultRoleByType[parent_type]){option.setAttribute('selected','selected');}}
sel_role.appendChild(option);}}}
og.reloadUserRoleSelector=function(config,parent_type){var sel_role=document.getElementById(config.id+'_role');for(var i=sel_role.options.length-1;i>=0;i--){sel_role.remove(i);}
for(role_id in og.userRoles){if(og.userRoles[role_id].parent==parent_type){var option=document.createElement("option");option.value=role_id;option.text=og.userRoles[role_id].name;if(role_id==og.defaultRoleByType[parent_type]){option.setAttribute('selected','selected');}
sel_role.appendChild(option);}}
$(sel_role).change();}
og.addUserGroupToUser=function(genid,container_id,group){if(typeof(group)=='string')group=Ext.util.JSON.decode(group);var values=$("#"+genid+"_user_groups").val();values=values.split(',');var idx=values.indexOf(group.id.toString());if(idx<0){var remove_link='&nbsp;<a class="remove-link link-ico ico-delete" href="#" title="'+lang('remove')+'" onclick="og.removeUserFromUserGroup(\''+genid+'\', '+group.id+');">&nbsp;</a>';var group_link=group.name;var html='<div class="user-group" id="'+genid+'user_group_'+group.id+'">'+group_link+remove_link+'</div>';$("#"+container_id).append(html);values.push(group.id);$("#"+genid+"_user_groups").val(values.join());}}
og.removeUserFromUserGroup=function(genid,group_id){var values=$("#"+genid+"_user_groups").val();values=values.split(',');var idx=values.indexOf(group_id.toString());if(idx>=0){values.splice(idx,1);$("#"+genid+"_user_groups").val(values.join());}
$("#"+genid+"user_group_"+group_id).remove();}
og.download_exported_file=function(filename,filetype){setTimeout(function(){var params={};if(filename)params.fname=filename;if(filetype)params.file_type=filetype;window.location=og.getUrl('contact','download_exported_file',params);},1000);}
og.expandAllChildNodes=function(node){if(node){setTimeout(function(){node.eachChild(function(n){if(n)n.expand(true,false,og.expandAllChildNodes);});},1000);}}
og.doDeleteMember=function(gen,delete_url){var delMessage=$("#"+gen+"_keyword").val();var trashObjects=$("#"+gen+"_trash_objects_in_member").val();if(trashObjects&&parseInt(trashObjects)>0){delete_url+="&trash_objects_in_member=1";og.preferences.trash_objects_in_member_after_delete=1;}else{og.preferences.trash_objects_in_member_after_delete=0;}
if(delMessage&&(delMessage.toUpperCase()=="DELETE")){og.openLink(delete_url);$('#_close_link').click();}
og.ExtModal.hide();}
og.deleteMember=function(delete_url,ot_name){var gen=Ext.id();var html='<div class="modal-container">'+'<div style="display: inline-block;">'+'<div class="desc" style="margin-top:5px;">'+lang('confirm delete permanently this member',ot_name)+'</div>'+'</div>'+'<div style="margin: 10px 10px 0 0;">'+'<label>'+lang('confirm delete with keyword')+'</label>'+'<input type="text" name="keyword" id="'+gen+'_keyword" style="width:100%;">'+'</div><div class="clear"></div>'+'<div style="margin: 10px 10px 0 0;">'+'<label>'+lang('trash objects in member',ot_name)+'</label>'+'<select name="trash_objects_in_member" id="'+gen+'_trash_objects_in_member">'+'<option value="1">'+lang('yes')+'</option>'+'<option value="0">'+lang('no')+'</option>'+'</select>'+'<div class="desc">'+lang('trash objects in member desc',ot_name)+'</div>'+'</div><div class="clear"></div>'+'<div style="float:right;">'+'<button class="submit blue" onclick="og.doDeleteMember(\''+gen+'\',\''+delete_url+'\')">'+lang('delete')+'</button>&nbsp;'+'<button class="submit" onclick="og.ExtModal.hide();">'+lang('cancel')+'</button>'+'</div><div class="clear"></div></div>';og.ExtModal.show({html:html,title:lang('delete')+' '+ot_name,width:400});setTimeout(function(){$("#"+gen+"_keyword").focus();$("#"+gen+"_trash_objects_in_member").val(og.preferences.trash_objects_in_member_after_delete);},10);}
og.renderContactDataFields=function(genid,value){$(".contact-data-container").hide();$("#"+genid+"-contact-data-"+value).show(300);$("#"+genid+"existing_contact_combo_container").hide();var company_ot=null;var contact_ot=null;for(x in og.objectTypes){if(og.objectTypes[x].name=='contact')contact_ot=x;else if(og.objectTypes[x].name=='company')company_ot=x;}
if(value==contact_ot){$("#"+genid+"contact_data_tab").parent(".contact-data-container").show();$("#"+genid+"contact_additional_data_tab").parent(".contact-data-container").show();$("#"+genid+"add_contact_custom_properties_div").show();}
if(value==company_ot){$("#"+genid+"company_data_tab").parent(".contact-data-container").show();$("#"+genid+"add_contact_custom_properties_div").show();}
if(value==0){$("#"+genid+"existing_contact_combo_container").show();}}
og.renderAddressTypeSelector=function(id,name,container_id,selected_value){var select=$('<select name="'+name+'" id="'+id+'" class="address_type_input"></select>');for(var i=0;i<og.address_types.length;i++){var type=og.address_types[i];var option=$('<option></option>');option.attr('value',type.id);if(selected_value==type.id)option.attr('selected','selected');option.text(type.name);select.append(option);}
$('#'+container_id).empty().append(select);}
og.renderAddressInput=function(id,name,container_id,sel_type,sel_data){if(!sel_data)sel_data={};if(!sel_data.id)sel_data.id=0;if(!sel_data.street)sel_data.street='';if(!sel_data.city)sel_data.city='';if(!sel_data.state)sel_data.state='';if(!sel_data.zip_code)sel_data.zip_code='';if(!sel_data.country)sel_data.country=og.config['default_country_address']?og.config['default_country_address']:'';$('#'+container_id).append('<input type="hidden" name="'+name+'[id]" id="'+id+'_id" value="'+sel_data.id+'" />');$('#'+container_id).append('<input type="hidden" name="'+name+'[deleted]" id="'+id+'_deleted" value="0" />');$('#'+container_id).append('<span id="'+id+'_type" style="vertical-align:top;"></span>');og.renderAddressTypeSelector(id+'_type',name+'[type]',id+'_type',sel_type);var address_placeholder_str=navigator.appVersion.indexOf("MSIE")!=-1?'':('placeholder="'+lang('street address')+'"');var address_placeholder_str=navigator.appVersion.indexOf("MSIE")!=-1?'':('placeholder="'+lang('street address')+'"');var address_input=$('<textarea name="'+name+'[street]" id="'+id+'_street" class="address_street_input" '+address_placeholder_str+'>'+sel_data.street+'</textarea>');$('#'+container_id).append(address_input);var city_input=$('<input name="'+name+'[city]" id="'+id+'_city" value="'+sel_data.city+'" class="address_city_input" placeholder="'+lang('city')+'"/>');$('#'+container_id).append(city_input);var state_input=$('<input name="'+name+'[state]" id="'+id+'_state" value="'+sel_data.state+'" class="address_state_input" placeholder="'+lang('state')+'"/>');$('#'+container_id).append(state_input);var zip_code_input=$('<input name="'+name+'[zip_code]" id="'+id+'_zip_code" value="'+sel_data.zip_code+'" class="address_zipcode_input" placeholder="'+lang('zip_code')+'"/>');$('#'+container_id).append(zip_code_input);var select_country=$('<select name="'+name+'[country]" id="'+id+'_country" class="address_country_input country-selector"></select>');$('#'+container_id).append(select_country);$('#template_select_country option').clone().appendTo('#'+id+'_country');if(sel_data.country!=''){var selc=document.getElementById(id+'_country');for(var i=0;i<selc.options.length;i++){if(selc.options[i].value==sel_data.country){selc.options[i].setAttribute('selected','selected');}}}
var delete_or_undo=$(`<div class="removeUndo addressRemoveUndo"><a href="#"onclick="og.markAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-delete delete-link"title="${lang('delete')}"></a><a href="#"onclick="og.undoMarkAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-undo undo-delete"style="display:none;"title="${lang('undo')}"></a></div>`);$('#'+container_id).append(delete_or_undo);if(og.loggedUser.localization){$('#'+container_id).addClass(og.loggedUser.localization);}
$('#'+container_id).append('<div class="clear"></div>');}
og.onAssociatedMemberTypeRemove=function(genid,dimension_id,hf_id){var el=document.getElementById(genid+hf_id);if(el)el.value=[];}
og.onAssociatedMemberTypeSelect=function(genid,dimension_id,member_id,hf_id){member_selector.remove_all_selections(genid);if(!member_id){var el=document.getElementById(genid+hf_id);if(el)el.value=[];return;}
member_selector.add_relation(dimension_id,genid,member_id,false);document.getElementById(genid+hf_id).value="["+member_id+"]";if(member_selector[genid].hiddenFieldName.indexOf("associated_members[")==-1){og.selectDefaultAssociatedMembers(genid,dimension_id,member_id);}}
og.onAssociatedMemberTypeSelectMultiple=function(genid,dimension_id,member_id,hf_id){member_selector.add_relation(dimension_id,genid,member_id,true);document.getElementById(genid+hf_id).value=Ext.util.JSON.encode(member_selector[genid].sel_context[dimension_id]);if(member_selector[genid].hiddenFieldName.indexOf("associated_members[")==-1){og.selectDefaultAssociatedMembers(genid,dimension_id,member_id);}}
og.onAssociatedMemberTypeRemoveMultiple=function(genid,dimension_id,hf_id){document.getElementById(genid+hf_id).value=Ext.util.JSON.encode(member_selector[genid].sel_context[dimension_id]);}
og.clickRootNodeAndCallNext=function(dimId,currentCall){og.resettingAllTrees=true;og.contextManager.cleanActiveMembers(dimId);var members=og.contextManager.dimensionMembers[dimId];if(members.length>0){var tree=Ext.getCmp("dimension-panel-"+dimId);og.memberTreeExternalClick(tree.dimensionCode,tree.getRootNode().id);}
currentCall++;var total=0;for(x in og.contextManager.dimensionMembers){total++;}
if(currentCall<total){var i=0;for(dimId in og.contextManager.dimensionMembers){if(i<currentCall){i++;}else{og.clickRootNodeAndCallNext(dimId,currentCall);break;}}}else{var all_tabs=Ext.getCmp('tabs-panel');for(i in all_tabs.items.items){var tab=all_tabs.items.items[i];if(tab&&tab.content&&tab.content.type=='html'&&tab.content.url){tab.content.url=tab.content.url.replace("context=","ignored=")+"&context="+og.contextManager.plainContext();}
if(tab&&typeof(tab.reset)=='function'){tab.reset();}}
og.resettingAllTrees=false;}};og.uploadNewRevision=function(file_id,quickId){og.openLink(og.getUrl('files','quick_add_files',{genid:quickId,object_id:file_id,new_rev_file_id:file_id}),{preventPanelLoad:true,onSuccess:function(data){og.ExtendedDialog.show({html:data.current.data,height:300,width:600,title:lang('upload new revision'),ok_fn:function(){og.doFileUpload(quickId,{callback:function(){form=document.getElementById(quickId+'quickaddfile');og.ajaxSubmit(form);}});og.ExtendedDialog.hide();}});return;}});};og.addViewMoreNode=function(pnode,tree_id,callback){var tree=Ext.getCmp(tree_id);var view_more_node=tree.loader.createNode({id:'view_more_'+pnode.id,text:og.clean(lang('view more')+" ..."),iconCls:'ico-view-more',cls:'view-more-node',parent:pnode.id,object_id:-1,options:{},object_controller:'',object_type_id:0,allow_childs:false,leaf:true});if(view_more_node){view_more_node.on('click',function(){this.remove();if(typeof callback=='function'){callback.call(null,tree,pnode);}});var old_view_more=tree.getNodeById('view_more_'+pnode.id);if(!old_view_more){if(pnode)pnode.appendChild(view_more_node);}
if(view_more_node.ui&&view_more_node.ui.anchor&&view_more_node.ui.anchor.parentNode){view_more_node.ui.anchor.parentNode.innerHTML=" "+og.clean(lang('view more')+" ...");}}}
og.ajaxMemberTreeViewMoreCallbackRoot=function(tree){if(!tree.last_offset)tree.last_offset=0;if(og.config.member_selector_page_size){tree.limit=og.config.member_selector_page_size;tree.last_offset=tree.last_offset+og.config.member_selector_page_size;}else{tree.limit=100;}
og.initialMemberTreeAjaxLoad(tree,tree.limit,tree.last_offset);var tree_id=tree.id;setTimeout(function(){if($("#"+tree.body.id).css('display')=='none'){var t=Ext.getCmp(tree_id);$("#"+t.body.id).show();}},100);}
og.ajaxMemberTreeViewMoreCallback=function(tree,pnode){if(!tree.last_offset)tree.last_offset=0;if(og.config.member_selector_page_size){tree.limit=og.config.member_selector_page_size;tree.last_offset=tree.last_offset+og.config.member_selector_page_size;}else{tree.limit=100;}
og.memberTreeAjaxLoad(tree,pnode,tree.limit,tree.last_offset,{ignore_context_filters:'',context:og.contextManager.plainContext()});var tree_id=tree.id;setTimeout(function(){if($("#"+tree.body.id).css('display')=='none'){var t=Ext.getCmp(tree_id);$("#"+t.body.id).show();}},100);}
og.treeLoaderViewMoreCallback=function(tree,pnode){var offset=!isNaN(tree.loader.baseParams.offset)?tree.loader.baseParams.offset:0;offset+=og.config.member_selector_page_size;tree.loader.clearOnLoad=false;tree.loader.baseParams['offset']=offset;tree.loader.baseParams['limit']=og.config.member_selector_page_size;tree.loader.load(pnode);}
og.initialMemberTreeAjaxLoad=function(tree,limit,offset,add_params){var tree_id=tree.id;var parameters={dimension_id:tree.dimensionId};if(add_params){for(key in add_params){parameters[key]=add_params[key];}}
if(limit&&!isNaN(limit)){parameters.limit=limit;}else{parameters.limit=og.config.member_selector_page_size;}
if(offset&&!isNaN(offset)){parameters.offset=offset;}
og.openLink(og.getUrl('dimension','initial_list_dimension_members_tree_root',parameters),{hideLoading:true,hideErrors:true,callback:function(success,data){if(!data)return;var dimension_tree=Ext.getCmp(tree_id);dimension_tree.addMembersToTree(data.dimension_members,data.dimension_id);dimension_tree.innerCt.unmask();dimension_tree.suspendEvents();dimension_tree.expandAll();dimension_tree.resumeEvents();dimension_tree.render();var is_filtered=data.list_was_filtered_by&&data.list_was_filtered_by.length>0;if(typeof(data.dimensions_root_members)!="undefined"&&!data.more_nodes_left&&!is_filtered){ogMemberCache.addDimToDimRootMembers(data.dimension_id);}
if(data.more_nodes_left){og.addViewMoreNode(dimension_tree.getRootNode(),tree_id,og.ajaxMemberTreeViewMoreCallbackRoot);}else{var old_view_more_node=dimension_tree.getNodeById('view_more_'+dimension_tree.getRootNode().id);if(old_view_more_node)old_view_more_node.remove();}
dimension_tree.initialized=true;if(og.after_member_tree_initial_load_functions){fn_params={add_params:add_params,data:data};for(var x=0;x<og.after_member_tree_initial_load_functions.length;x++){var fn=og.after_member_tree_initial_load_functions[x];if(typeof(fn)=='function'){fn.call(null,fn_params);}}}
og.eventManager.fireEvent('end_callback member_tree loaded',{});}});}
og.memberTreeAjaxLoad=function(tree,pnode,limit,offset,add_params){var tree_id=tree.id;var parameters={dimension_id:tree.dimensionId,ignore_context_filters:true,member:pnode.id,tree_id:tree_id};if(limit&&!isNaN(limit)){parameters.limit=limit;}else{parameters.limit=og.config.member_selector_page_size;}
if(offset&&!isNaN(offset)){parameters.offset=offset;}
if(add_params){for(key in add_params){parameters[key]=add_params[key];}}
if(pnode.ownerTree.initialConfig.get_childs_params){for(p_name in pnode.ownerTree.initialConfig.get_childs_params){if(typeof(pnode.ownerTree.initialConfig.get_childs_params[p_name])=='function')continue;parameters[p_name]=pnode.ownerTree.initialConfig.get_childs_params[p_name];}}
og.openLink(og.getUrl('dimension','get_member_childs',parameters),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp(data.tree_id);dimension_tree.addMembersToTree(data.members,data.dimension_id);dimension_tree.innerCt.unmask();dimension_tree.suspendEvents();dimension_tree.expandAll();dimension_tree.resumeEvents();dimension_tree.render();if(typeof(data.dimensions_root_members)!="undefined"&&!data.more_nodes_left){ogMemberCache.addDimToDimRootMembers(data.dimension_id);}
if(data.more_nodes_left){og.addViewMoreNode(pnode,tree_id,og.ajaxMemberTreeViewMoreCallback);}else{var old_view_more_node=dimension_tree.getNodeById('view_more_'+pnode.id);if(old_view_more_node)old_view_more_node.remove();}
dimension_tree.initialized=true;}});}
og.reloadCurrentPanel=function(){var currentPanel=Ext.getCmp('tabs-panel').getActiveTab();if(currentPanel){currentPanel.reload();}}
og.addTableCustomPropertyRow=function(parent,focus,values,col_count,ti,cpid,is_member_cp){var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';if(og.table_cps_last_row_id[cpid]){var count=og.table_cps_last_row_id[cpid];}else{var count=$(parent).find("table tbody tr").length;}
og.table_cps_last_row_id[cpid]=count+1;var tbody=parent.getElementsByTagName("tbody")[0];var tr=document.createElement("tr");ti=ti+col_count*count;var cell_w=(600/col_count)+'px';for(row=0;row<col_count;row++){var td=document.createElement("td");var row_val=values&&values[row]?values[row]:"";td.innerHTML='<input class="value" style="width:'+cell_w+';min-width:105px;" type="text" name="'+field_name+'['+cpid+']['+count+']['+row+']" value="'+row_val+'" tabindex='+ti+'>';if(td.children&&row==0)var input=td.children[0];tr.appendChild(td);ti+=1;}
tbody.appendChild(tr);var td=document.createElement("td");td.innerHTML='<div class="ico ico-delete" style="width: 20px;height: 20px;cursor: pointer;margin-left: 2px;margin-top: 1px;" onclick="og.removeTableCustomPropertyRow(this.parentNode.parentNode);return false;">&nbsp;</div>';tr.appendChild(td);tbody.appendChild(tr);if(input&&focus)
input.focus();}
og.selectDefaultAssociatedMembers=function(genid,dimension_id,member_id,current_associated_members){var action_name='get_all_default_associated_members';if(current_associated_members){action_name='get_all_associated_members';}
og.openLink(og.getUrl('dimension',action_name,{member_id:member_id,dimension_id:dimension_id,genid:genid}),{hideLoading:true,callback:function(success,response_data){if(!response_data)return;var d_associations=[];for(var ot in og.dimension_member_associations[response_data.dimension_id]){for(var j=0;j<og.dimension_member_associations[response_data.dimension_id][ot].length;j++){d_associations.push(og.dimension_member_associations[response_data.dimension_id][ot][j]);}}
let processed_dimension_ids=[];for(var i=0;i<d_associations.length;i++){var assoc=d_associations[i];if(assoc&&assoc.allows_default_selection){if(processed_dimension_ids.indexOf(assoc.assoc_dimension_id)>=0)continue;processed_dimension_ids.push(assoc.assoc_dimension_id);var data=response_data.associations_data[assoc.id];if(!data)continue;var hf=Ext.get(data.genid+member_selector[data.genid].hiddenFieldName);if(!hf.dom.form){var dep_genid=data.genid;}else{var form_id=hf.dom.form.id;var dep_genid="";var selector_inputs=$("#"+form_id+' .dimension-panel-textfilter');for(var x=0;x<selector_inputs.length;x++){var sel_id=selector_inputs[x].id;var key="-member-chooser-panel-"+data.dimension_id+"-tree-textfilter";if(sel_id.indexOf(key)>=0){dep_genid=selector_inputs[x].id.substring(0,selector_inputs[x].id.indexOf("-"));break;}}
if(dep_genid=='')dep_genid=data.genid;}
if(member_selector[dep_genid]&&member_selector[dep_genid].properties[data.dimension_id]){for(var z=0;z<data.member_ids.length;z++){var hf_input=document.getElementById(dep_genid+member_selector[dep_genid].hiddenFieldName);var json_sel_ids=Ext.util.JSON.decode(hf_input.value);if(json_sel_ids.indexOf(parseInt(data.member_ids[z]))!=-1){continue;}
member_selector.remove_all_dimension_selections(dep_genid,data.dimension_id);if(og.dimensions&&og.dimensions[data.dimension_id]&&og.dimensions[data.dimension_id][data.member_ids[z]]){member_selector.add_relation(data.dimension_id,dep_genid,data.member_ids[z],false,true);}else{var tmp_data={member_id:data.member_ids[z],dimension_id:data.dimension_id,genid:dep_genid};og.getMemberFromServer(data.member_ids[z],og.member_selector_add_relation,tmp_data);}}
if(data.member_ids.length>0){if(!member_selector[dep_genid].properties[data.dimension_id].isMultiple){$("#"+dep_genid+"-member-chooser-panel-"+data.dimension_id+"-tree-current-selected .empty-text").hide();}}}}}}});}
og.member_selector_add_relation=function(ignored1,ignored2,data){member_selector.add_relation(data.dimension_id,data.genid,data.member_id);}
og.get_dimension_member_association_by_id=function(dim_assoc_id){for(dim in og.dimension_member_associations){var assocs_by_ot=og.dimension_member_associations[dim];for(ot in assocs_by_ot){if(isNaN(ot))continue;for(i=0;i<assocs_by_ot[ot].length;i++){var a=assocs_by_ot[ot][i];if(!a.is_reverse&&a.id==dim_assoc_id){return a;}}}}
return null;}
og.is_associated_dimension=function(dimension_id){var dim_ot_assoc_data=og.dimension_member_associations[dimension_id];for(ot_id in dim_ot_assoc_data){var associations=dim_ot_assoc_data[ot_id];for(var i=0;i<associations.length;i++){var assoc=associations[i];if(assoc&&assoc.is_reverse){return true;}}}
return false;}
og.gridBooleanColumnRenderer=function(value,p,r){if(r.data.id=='quick_add_row')return value;if(r.data.id=='__total_row__'||r.data.object_id<=0)return'';return value?lang('yes'):lang('no');}
og.gridObjectNameRenderer=function(value,p,r){if(r.data.id=='quick_add_row'){return value;}
if(r.data.id=='__total_row__'||r.data.object_id<=0)return'<span id="__total_row__">'+value+'</span>';var controller=r.data.type_controller?r.data.type_controller:r.store.baseParams.url_controller;var onclick="og.openLink(og.getUrl('"+controller+"', 'view', {id: "+r.data.object_id+"})); return false;";return String.format('<a href="#" onclick="{1}" title="{2}" style="font-size:120%;"><span class="bold">{0}</span></a>',og.clean(value),onclick,og.clean(value));}
og.gridPictureRenderer=function(value,p,r){if(r.data.picture){var picture_url=r.data.picture;return String.format('<div class="picture-file-small"><img src="{0}" alt="{1}" /></div>',picture_url,og.clean(r.data.name));}else{var classes="db-ico ico-unknown ico-"+(r.data.type?r.data.type:'contact');return String.format('<div class="{0}" title="{1}" style="margin-left: 5px;"/>',classes,lang(r.data.type));}}
og.getDateToolbarFilterComponent=function(config){var genid=config.genid?config.genid:'';var action_btn=new Ext.Action({id:genid+config.name,hidden:config.hidden,text:config.value?config.value:lang('select a date'),value:config.value?config.value:'',tooltip:config.tooltip?config.tooltip:config.text,menu:new og.drawDateMenuPicker({id:config.name,items:[new Ext.menu.Item({id:genid+config.name+'_remove',text:lang('remove filter'),iconCls:'ico-delete',hidden:true,handler:function(){var man=Ext.getCmp(config.grid_id);if(man.filters){man.filters[config.name].value='';}
man[config.name]=''
man.load();this.hide();Ext.getCmp(genid+config.name).setText(lang('select a date'));}})],listeners:{'select':function(dp,date){var man=Ext.getCmp(config.grid_id);Ext.getCmp(genid+config.name).setText(date.format(og.preferences['date_format']));if(man.filters){man.filters[dp.id].value=date.format(og.preferences['date_format']);}
man[dp.id]=date.format(og.preferences['date_format']);man.load();Ext.getCmp(genid+config.name+'_remove').show();}}})});if(config.value)
Ext.getCmp(config.name+'_remove').show();return action_btn;}
og.getListToolbarFilterComponent=function(config){var genid=config.genid?config.genid:'';var combo=new Ext.form.ComboBox({id:genid+config.name,store:new Ext.data.SimpleStore({fields:['value','text'],data:config.options}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:config.width?config.width:160,valueField:'value',valueNotFoundText:'',grid_id:config.grid_id,listeners:{'select':function(combo,record){var man=Ext.getCmp(combo.grid_id);man.filters[config.name].value=combo.getValue();if(man.store_params)man.store_params[config.name]=combo.getValue();man.load();},}});if(typeof(config.initial_val)!='undefined'){combo.setValue(config.initial_val);}
return combo;}
og.getListToolbarFilterComponentWithEvents=function(config){var genid=config.genid?config.genid:'';var combo=new Ext.form.ComboBox({id:genid+config.name,store:new Ext.data.SimpleStore({fields:['value','text'],data:config.options}),displayField:'text',hideLabel:false,mode:'local',triggerAction:'all',selectOnFocus:true,width:config.width?config.width:160,valueField:'value',valueNotFoundText:'',listeners:{'select':function(combo,record){var man=Ext.getCmp(config.grid_id);if(man.filters){man.filters[config.name].value=combo.getValue();}
man[config.name]=combo.getValue();if(combo.id==genid+'period_filter'){if(record.data.value==6){Ext.getCmp(genid+'label_from_filter').show();Ext.getCmp(genid+'from_filter').show();Ext.getCmp(genid+'label_to_filter').show();Ext.getCmp(genid+'to_filter').show();man.from_filter=Ext.getCmp(genid+'from_filter').text;man.to_filter=Ext.getCmp(genid+'to_filter').text;if(Ext.getCmp(genid+'label_period_filter')){Ext.getCmp(genid+'label_period_filter').hide();}}else{Ext.getCmp(genid+'label_from_filter').hide();Ext.getCmp(genid+'from_filter').hide();Ext.getCmp(genid+'label_to_filter').hide();Ext.getCmp(genid+'to_filter').hide();man.from_filter='';man.to_filter='';if(Ext.getCmp(genid+'label_period_filter')){Ext.getCmp(genid+'label_period_filter').show();}}}
man.load();}},'initComponent':function(){},});if(typeof(config.initial_val)!='undefined'){combo.setValue(config.initial_val);}
var test=new Ext.FormPanel({items:[combo]});return combo;}
og.buildToolbarFilterAction=function(filter_name,filter_data,grid_id){var items=[];if(filter_name=='text_filter'){items.push(filter_data);}else if(filter_data.type=='date'){var btn_config={name:filter_name,grid_id:grid_id};btn_config=Ext.apply(btn_config,filter_data);var btn=og.getDateToolbarFilterComponent(btn_config);if(btn){if(filter_data.label)items.push(filter_data.label);items.push(btn);}}else if(filter_data.type=='list'){var combo_config={name:filter_name,grid_id:grid_id};combo_config=Ext.apply(combo_config,filter_data);var combo=og.getListToolbarFilterComponent(combo_config);if(combo){if(filter_data.label)items.push(filter_data.label);items.push(combo);}}else if(filter_data.type=='period'){var combo_config={name:filter_name,grid_id:grid_id};combo_config=Ext.apply(combo_config,filter_data);var combo=og.getListToolbarFilterComponentWithEvents(combo_config);if(combo){if(filter_data.label)items.push(filter_data.label);items.push(combo);}}
return items;}
og.onTzSelectorCountryChange=function(country_combo,timezones_id){og.openLink(og.getUrl('account','get_country_timezones',{code:$(country_combo).val()}),{preventPanelLoad:true,callback:function(success,data){if(data.timezones){var combo=document.getElementById(timezones_id);while(combo.options.length>0)combo.remove(0);for(var id in data.timezones){var name=data.timezones[id];var option=document.createElement("option");option.text=name;option.value=id;combo.add(option);}}}});}
og.showHiddenTimezoneSelector=function(genid){$('#'+genid+'tz_text').hide();$('#'+genid+'tz_selector').show();$('#'+genid+'tz_edited').val(1);$('#'+genid+'tz_edit_link').hide();}
og.ConfirmBoxDefaultCancelFn=function(close_btn_id){$('#'+close_btn_id).click();return false;}
og.ConfirmBoxDefaultAcceptFn=function(close_btn_id){$('#'+close_btn_id).click();return true;}
og.ConfirmBox=function(data){var default_cancel_fn='og.ConfirmBoxDefaultCancelFn("'+data.genid+'_confirmbox_close_link");';var cancel_fn=default_cancel_fn;if(typeof(data.cancel_fn)!=='undefined'){cancel_fn=data.cancel_fn+default_cancel_fn;}
var default_accept_fn='og.ConfirmBoxDefaultAcceptFn("'+data.genid+'_confirmbox_close_link");';var accept_fn=accept_fn;if(typeof(data.accept_fn)!=='undefined'){accept_fn=data.accept_fn+default_accept_fn;}
var data={genid:data.genid,text:data.text,cancel_fn:cancel_fn,accept_fn:accept_fn}
var source=$("#confirm-dialog-box").html();var template=Handlebars.compile(source);var html=template(data);var modal_params={'escClose':true,'minWidth':500,'minHeight':400,'overlayClose':true,'closeHTML':'<a id="'+data.genid+'_confirmbox_close_link" style="display: none;" class="modal-close modal-close-img"></a>'};$.modal(html,modal_params);}
og.replaceStringAccents=function(str){var rExps=[{re:/[\xC0-\xC6]/g,ch:'A'},{re:/[\xE0-\xE6]/g,ch:'a'},{re:/[\xC8-\xCB]/g,ch:'E'},{re:/[\xE8-\xEB]/g,ch:'e'},{re:/[\xCC-\xCF]/g,ch:'I'},{re:/[\xEC-\xEF]/g,ch:'i'},{re:/[\xD2-\xD6]/g,ch:'O'},{re:/[\xF2-\xF6]/g,ch:'o'},{re:/[\xD9-\xDC]/g,ch:'U'},{re:/[\xF9-\xFC]/g,ch:'u'},{re:/[\xD1]/g,ch:'N'},{re:/[\xF1]/g,ch:'n'}];for(var i=0,len=rExps.length;i<len;i++){str=str.replace(rExps[i].re,rExps[i].ch);}
return str;}
og.openPDFOptions=function(genid){var html=$("#pdfOptions").html();html=html.replace(/{gen_id}/g,genid);var modal_params={'escClose':true,'overlayClose':true,'minWidth':400,'minHeight':200,'closeHTML':'<a id="pdf_options_close_link" class="modal-close modal-close-img"></a>'};$.modal(html,modal_params);}
og.submit_pdf_form=function(genid){var params=og.get_report_parameters_of_form(genid);params['exportPDF']=true;params['pdfPageLayout']=$("#"+genid+"pdfPageLayout").val();params['pdfPageSize']=$("#"+genid+"pdfPageSize").val();var report_id=$("#report_id_"+genid).val();og.openLink(og.getUrl('reporting','export_custom_report_pdf',{id:report_id}),{post:params,callback:function(success,data){if(data.filename){var $form=$("<form></form>");$form.attr("action",og.getUrl('reporting','download_file'));$form.attr("method","post");$form.append('<input type="text" name="file_name" value="'+data.filename+'" />');$form.append('<input type="text" name="file_type" value="application/pdf" />');if(data.size){$form.append('<input type="text" name="file_size" value="'+data.size+'" />');}
$form.appendTo('body').submit().remove();}}});$.modal.close();return false;}
og.get_report_parameters_of_form=function(genid){var form_id='form'+genid;var form=document.getElementById(form_id);var post_id='post'+genid;var post_el=document.getElementById(post_id);var post=Ext.util.JSON.decode(post_el.value);var params={};for(x in post){if(x=='params'){params["report_params"]=Ext.util.JSON.encode(post[x]);}else if(x!='c'&&x!='a'&&x!='ajax'){params[x]=post[x];var i=document.createElement("input");i.type="hidden";i.value=post[x];i.name=x;form.appendChild(i);}}
og.reports.fillDisabledParams(genid,params);return params;}
og.submit_csv_form=function(genid,elem){var params=og.get_report_parameters_of_form(genid);params['exportCSV']=true;var report_id=$("#report_id_"+genid).val();og.openLink(og.getUrl('reporting','export_custom_report_csv',{id:report_id}),{post:params,callback:function(success,data){var $form=$("<form></form>");$form.attr("action",og.getUrl('reporting','download_file'));$form.attr("method","post");$form.append('<input type="text" name="file_name" value="'+data.filename+'" />');$form.append('<input type="text" name="file_type" value="application/csv" />');$form.appendTo('body').submit().remove();}});og.disable_export_report_link(elem);return false;}
og.submit_fixed_report_csv_form=function(genid,elem){var form_id='form'+genid;var form=document.getElementById(form_id);var params=og.get_report_parameters_of_form(genid);params['exportCSV']=true;og.openLink(form.action,{post:params,callback:function(success,data){var $form=$("<form></form>");$form.attr("action",og.getUrl('reporting','download_file'));$form.attr("method","post");$form.append('<input type="text" name="file_name" value="'+data.filename+'" />');$form.append('<input type="text" name="file_type" value="application/csv" />');$form.appendTo('body').submit().remove();}});og.disable_export_report_link(elem);return false;}
og.add_object_grid_quick_add_row=function(grid,config){if(typeof(config.quick_add_row_fn)=='function'){config.quick_add_row_fn.call(null,grid,config)}}
og.on_quick_add_row_input_click=function(input,event){$(input).focus();}
og.quick_add_row_combo_input=function(config){try{var uid=Ext.id();var combo_config={renderTo:config.renderTo,id:config.id,genid:config.genid,name:config.name,store:new Ext.data.SimpleStore({fields:['value','text'],data:config.options}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:config.width?config.width:160,valueField:'value',valueNotFoundText:'',tabIndex:config.tabIndex};if(config.listeners){combo_config.listeners=config.listeners;}
var combo=new Ext.form.ComboBox(combo_config);if(typeof(config.initial_val)!='undefined'){combo.setValue(config.initial_val);}
return combo;}catch(e){console.log(e);}}
og.quick_add_row_date_input=function(config){try{var picker=new og.DateField(Ext.apply(config,{width:100,emptyText:og.preferences.date_format_tip}));return picker;}catch(e){console.log(e);}}
og.quick_add_row_time_input=function(config){try{var picker=new Ext.form.TimeField(Ext.apply(config,{width:80,format:og.config.time_format_use_24?'G:i':'g:i A',emptyText:'hh:mm'}));return picker;}catch(e){console.log(e);}}
og.quick_add_row_worked_time_input=function(config){var html='<table><tr><td>';var onkeydown=config.onkeydown?'onkeydown="'+config.onkeydown+'"':'';html+='<input type="number" name="timeslot[hours]" tabindex="'+config.tabindex+'" id="'+config.id+'" '+onkeydown+' style="width:40px;" value="0"/> hs.';html+='</td><td>';html+='<select name="timeslot[minutes]" tabindex="'+(config.tabindex+1)+'"/>';for(var i=0;i<60;i++){html+='<option value="'+i+'">'+i+'</option>';}
html+='</select> mins.';html+='</td></tr></table>';return html;}
og.quick_add_row_column_tabindex=function(grid,column){var tabindex=0;for(var i=0;i<grid.colModel.config.length;i++){var col_conf=grid.colModel.config[i];if(col_conf.id==column){tabindex=100+(i*2);break;}}
return tabindex;}
og.quick_add_row_member_selector=function(dim_id,genid,hf_name,sel_mem_ids,is_multiple,select_current_context){if(dim_id>0){if(!hf_name)hf_name='members_input_'+dim_id;if(!sel_mem_ids)sel_mem_ids='';if(!is_multiple)is_multiple=0;if(typeof(select_current_context)=='undefined')select_current_context=true;var selector_config={genid:genid,context:og.contextManager.plainContext(),dim_id:dim_id,is_multiple:is_multiple,hide_label:true,hf_name:hf_name,selected_member_ids:sel_mem_ids,select_current_context:select_current_context};og.openLink(og.getUrl('dimension','render_member_selector',selector_config),{preventPanelLoad:true,hideLoading:true,callback:function(success,data){if(success){var container_id=data.genid+'members_'+data.dim_id;$("#"+container_id).html(data.current.data);$("#"+data.genid+"-member-chooser-panel-"+data.dim_id+"-tree").click(function(){og.fix_quick_add_row_member_selector_list_position(data);});}}});}}
og.fix_quick_add_row_member_selector_list_position=function(data){var tree_el=Ext.get(data.genid+"-member-chooser-panel-"+data.dim_id+"-tree");var left=($("#menu-panel-xsplit").position().left-Ext.get("menu-panel-xsplit").getOffsetsTo(tree_el)[0]);$("#"+data.genid+"-member-chooser-panel-"+data.dim_id+" .x-panel-body.collapsible-body").css('left',left+'px');}
og.add_timeslot_module_quick_add_params=function(grid){var params={'dont_reload':true,'members':'[]'};var add_row=grid.getView().getRow(0);var member_ids=[];$(add_row).find('input, select').each(function(){if($(this).attr('name').indexOf('members_input_')==0){}else{params[$(this).attr('name')]=$(this).val();}});for(did in og.simple_member_selectors[grid.genid]){var mem_selector=og.simple_member_selectors[grid.genid][did];if(mem_selector){var mem_id=mem_selector.getValue();if(mem_id>0){member_ids.push(mem_id);}}}
if(member_ids.length>0){params['members']=Ext.util.JSON.encode(member_ids);}
var user_id=Ext.getCmp(grid.genid+'add_ts_contact_id').getValue();params['timeslot[contact_id]']=user_id;params['req_channel']='time list - quick add';return params;}
og.clean_timeslot_module_quick_add_params=function(grid){var params={'dont_reload':true,'members':'[]'};var add_row=grid.getView().getRow(0);$(add_row).find('input, select').each(function(){if($(this).attr('name')=='timeslot[description]'){$(this).val('')}
if($(this).attr('name')=='timeslot[start_time]'||$(this).attr('name')=='timeslot[hours]'||$(this).attr('name')=='timeslot[minutes]'){$(this).val('')}});}
og.add_timeslot_module_quick_add_submit=function(grid_id,first_input_column){var grid=Ext.getCmp(grid_id);var form_params=og.add_timeslot_module_quick_add_params(grid);og.openLink(og.getUrl('time','add'),{post:form_params,preventPanelLoad:true,callback:function(success,data){if(success&&data.timeslot){data.timeslot.type='timeslot';if(data.timeslot.invoicing_status){data.timeslot.is_billable=data.timeslot.invoicing_status=='pending'?lang('yes'):lang('no');if(!data.timeslot.invoicing_status_html){let status_text=lang('invoicing_status '+data.timeslot.invoicing_status);let status_class='invoicing-status-'+data.timeslot.invoicing_status;data.timeslot.invoicing_status_html='<span class="additional-list-col"><span class="'+status_class+'">'+status_text+'</span></span>';}}
data.timeslot.object_id=data.timeslot.id;var record=new Ext.data.Record(data.timeslot,data.timeslot.id);og.clean_timeslot_module_quick_add_params(grid);grid.store.insert(1,record);og.eventManager.fireEvent('replace all empty breadcrumb',null);if(first_input_column){setTimeout(function(){$("#"+grid.genid+"add_ts_"+first_input_column).focus();},200);}
grid.reloadTotalsRow();}}});}
og.add_timeslot_module_quick_add_enter=function(event,genid){if(event.keyCode==13){$("#"+genid+"ts_quick_add_btn").click();}}
og.add_timeslot_module_quick_add_row=function(grid,config){var onclick='og.on_quick_add_row_input_click(this, event);';let labor_cat_dim_id=0;for(did in og.dimensions_info){if(!isNaN(did)&&og.dimensions_info[did].code=="hour_types"){labor_cat_dim_id=did;}}
var first_input_column=null;for(var i=0;i<grid.colModel.config.length;i++){var col_conf=grid.colModel.config[i];if(col_conf.id=='name'||col_conf.id=='description'||col_conf.id=='start_time'||col_conf.id=='worked_time'){if(col_conf.id=='name'){first_input_column='contact_id';}else{first_input_column=col_conf.id;}
break;}}
var record_config={};record_config.type='add';record_config.description='<input type="text" id="'+config.genid+'add_ts_description" name="timeslot[description]" value="" style="width:95%;" onmousedown="event.stopPropagation();"';record_config.description+='onclick="'+onclick+'" tabindex="'+og.quick_add_row_column_tabindex(grid,'description')+'" onkeydown="og.add_timeslot_module_quick_add_enter(event, \''+config.genid+'\')"/>';record_config.name='<span id="'+config.genid+'usercombo"></span>';record_config.start_time='<table><tr><td><span id="'+config.genid+'start_date"></td><td><span id="'+config.genid+'start_time"></td></tr></table>';record_config.worked_time=og.quick_add_row_worked_time_input({id:config.genid+'add_ts_worked_time',tabindex:og.quick_add_row_column_tabindex(grid,'worked_time'),onkeydown:'og.add_timeslot_module_quick_add_enter(event, \''+config.genid+'\')'});if(og.income&&og.advanced_billing){record_config.is_billable='<span id="'+config.genid+'is_billable"></span>';record_config.is_billable+='<input type="hidden" id="'+config.genid+'add_ts_invoicing_status" name="timeslot[invoicing_status]" />';}
var quick_add_submit_fn='og.add_timeslot_module_quick_add_submit(\''+grid.id+'\', \''+first_input_column+'\'); return false;';var quick_add_btn_class='x-btn-text ico-new add-first-btn blue';var ac_tindex=og.quick_add_row_column_tabindex(grid,'actions');var quick_add_btn_blur='document.getElementById(\''+config.genid+'add_ts_'+first_input_column+'\').focus();';record_config.actions='<button id="'+config.genid+'ts_quick_add_btn" class="'+quick_add_btn_class+'" onblur="'+quick_add_btn_blur+'" onclick="'+quick_add_submit_fn+'" tabindex="'+ac_tindex+'">'+lang('add')+'</button>';for(var i=0;i<grid.colModel.config.length;i++){var col_conf=grid.colModel.config[i];if(col_conf.id.indexOf('dim_')==0){var dim_id=col_conf.id.substring(4);record_config[col_conf.id]='<span id="'+config.genid+'members_'+dim_id+'"></span>';}}
var record=new Ext.data.Record(record_config,'quick_add_row');grid.store.insert(0,record);var add_row=grid.getView().getRow(0);$(add_row).find('.x-grid3-row-checker').removeClass('x-grid3-row-checker');$(add_row).addClass('quick-add-row');for(var i=0;i<grid.colModel.config.length;i++){var col_conf=grid.colModel.config[i];if(col_conf.id.indexOf('dim_')==0){var dim_id=col_conf.id.substring(4);var onselect=null;if(og.hour_types&&dim_id==labor_cat_dim_id){onselect=og.hour_types.after_quick_add_labor_cat_select;}
dim_sel=new og.SimpleMemberSelector({dimensionId:dim_id,genid:config.genid,renderTo:config.genid+'members_'+dim_id,width:grid.colModel.getColumnWidth(i)-14,select_current_context:true,tabIndex:og.quick_add_row_column_tabindex(grid,col_conf.id),onselect_fn:onselect});}}
var user_combo_listeners={};if(og.time_quick_add_user_combo_listeners){for(x in og.time_quick_add_user_combo_listeners){user_combo_listeners[x]=og.time_quick_add_user_combo_listeners[x];}}
var user_combo=og.quick_add_row_combo_input({id:config.genid+'add_ts_contact_id',genid:config.genid,name:"timeslot[contact_id]",options:config.quick_add_row_user_options,initial_val:og.loggedUser.id,renderTo:config.genid+"usercombo",tabIndex:og.quick_add_row_column_tabindex(grid,'name'),listeners:user_combo_listeners});if(user_combo.initialConfig.listeners&&typeof(user_combo.initialConfig.listeners.select)=='function'){user_combo.initialConfig.listeners.select.call(null,user_combo);}
var start_time_tindex=og.quick_add_row_column_tabindex(grid,'start_time');var st_date_picker=og.quick_add_row_date_input({id:config.genid+'add_ts_start_time',name:"timeslot[date]",renderTo:config.genid+"start_date",tabIndex:start_time_tindex,value:new Date()});st_date_picker.on('keydown',function(picker,event){og.add_timeslot_module_quick_add_enter(event,config.genid);});var st_time_picker=og.quick_add_row_time_input({id:config.genid+'add_ts_start_time_min',genid:config.genid,name:"timeslot[start_time]",renderTo:config.genid+"start_time",tabIndex:start_time_tindex+1});if(og.income&&og.advanced_billing){let billable_combo_listeners={'select':og.quick_add_row_time_on_is_billable_select}
var billable_combo=og.quick_add_row_combo_input({id:config.genid+'add_ts_is_billable',genid:config.genid,name:"timeslot[is_billable]",options:[['yes',lang('yes')],['no',lang('no')]],initial_val:'pending',renderTo:config.genid+"is_billable",width:60,tabIndex:og.quick_add_row_column_tabindex(grid,'is_billable'),listeners:billable_combo_listeners});}
$("#"+config.genid+"add_ts_start_time_min").keydown(function(event){var gid=$(this).attr('id').replace("add_ts_start_time_min","");og.add_timeslot_module_quick_add_enter(event,gid);});$("#"+config.genid+"add_ts_start_time").keydown(function(event){var gid=$(this).attr('id').replace("add_ts_start_time","");og.add_timeslot_module_quick_add_enter(event,gid);});$("#"+config.genid+"add_ts_contact_id").keydown(function(event){var gid=$(this).attr('id').replace("add_ts_contact_id","");og.add_timeslot_module_quick_add_enter(event,gid);});if(first_input_column&&!config.dont_focus_in_first_input){setTimeout(function(){$("#"+config.genid+"add_ts_"+first_input_column).focus();},200);}
$("#"+grid.id+" .quick-add-row td").focus(function(){});}
og.quick_add_row_time_on_is_billable_select=function(combo,record,index){let inv_status=combo.getValue()=='yes'?'pending':'non_billable';$("#"+combo.genid+'add_ts_invoicing_status').val(inv_status);}
og.quick_add_row_event_to_fix_mem_selector_position=function(grid){if(!grid.scroll_event_added){grid.last_horizontal_scroll=$("#"+grid.id+" .x-grid3-scroller").scrollLeft();grid.scroll_event_added=true;$("#"+grid.id+" .x-grid3-scroller").scroll(function(){if(grid.fix_member_selector_position_timeout){clearTimeout(grid.fix_member_selector_position_timeout);}
grid.fix_member_selector_position_timeout=setTimeout(function(){var left_scroll_pos=$("#"+grid.id+" .x-grid3-scroller").scrollLeft();if(left_scroll_pos!=grid.last_horizontal_scroll){grid.last_horizontal_scroll=left_scroll_pos;$("#"+grid.id+" .x-panel-body.collapsible-body:visible").each(function(){var container_id=$(this).closest(".member-chooser-container").attr('id');var arr=container_id.split('-');var dim=arr[arr.length-2];og.fix_quick_add_row_member_selector_list_position({genid:grid.genid,dim_id:dim});});}else{$("#"+grid.id+" .dimension-panel-textfilter").blur();}},5);});}}
og.prompt_delete_object=function(id,reload){if(confirm(lang('confirm delete object'))){og.openLink(og.getUrl('object','trash',{object_id:id,reload:reload}));}}
og.render_default_grid_actions=function(value,p,r){var actions='';if(r.id=='quick_add_row'||r.data.id=='__total_row__')return value;var actionStyle=' style="font-size:105%;padding-top:2px;padding-bottom:3px;padding-left:16px;background-repeat:no-repeat;" ';if(r.store&&r.store.baseParams&&r.store.baseParams.url_controller){var controller=r.store.baseParams.url_controller;var action_edit='edit';var action_delete='delete';var obj_id=r.data.object_id?r.data.object_id:r.data.id;actions+=String.format('<a class="list-action ico-edit" href="#" onclick="og.render_modal_form(\'\', {c:\''+controller+'\', a:\''+action_edit+'\', params:{id:'+obj_id+'}});" title="{0}" '+
actionStyle+'>&nbsp;</a>',lang('edit'));actions+=String.format('<a class="list-action ico-delete" href="#" onclick="og.prompt_delete_object('+obj_id+', 1);" title="{0}" '+
actionStyle+'>&nbsp;</a>',lang('delete'));}
return'<div>'+actions+'</div>';}
og.on_date_range_config_option_change=function(select,option_name){if($(select).val()=='range'){$("."+option_name+".date-range-container").show();}else{$("."+option_name+".date-range-container").hide();}}
og.confirmNorification=function(lang,status){if(status)
return confirm(lang);else
return true;}
og.setPictureInfo=function(i,e){$('#'+genid+'x').val(e.x1);$('#'+genid+'y').val(e.y1);$('#'+genid+'w').val(e.width);$('#'+genid+'h').val(e.height);}
og.beforePictureSubmit=function(){$(".imgareaselect-selection").parent().remove();$(".imgareaselect-outer").remove();}
og.tmpPictureFileUpload=function(genid,config){var fileInput=document.getElementById(genid+'uploadImage');var fileParent=fileInput.parentNode;fileParent.removeChild(fileInput);var form=document.createElement('form');form.method='post';form.enctype='multipart/form-data';form.encoding='multipart/form-data';form.action=og.getUrl('contact','tmp_picture_file_upload',{'id':genid});form.style.display='none';form.appendChild(fileInput);document.body.appendChild(form);og.submit(form,{callback:function(d){form.removeChild(fileInput);fileParent.appendChild(fileInput);document.body.removeChild(form);if(typeof config.callback=='function'){config.callback.call(config.scope,d);}}});}
og.set_image_area_selection=function(genid,is_company){setTimeout(function(){var w=$('img#'+genid+'uploadPreview').width();var h=$('img#'+genid+'uploadPreview').height();if(!is_company){var min=w>h?h:w;var size=min<200?min:200;w=size;h=size;}
og.area_sel.setSelection(0,0,w,h,true);og.area_sel.setOptions({show:true});og.area_sel.update();},500);}
og.formatAmount=function(id){amount=$("#"+id).val();$("#"+id).val(og.format_money_amount(amount));}
og.updatePictureFile=function(url){og.openLink(url,{preventPanelLoad:true,callback:function(success,data){og.ExtModal.show({html:data.current.data,title:lang('edit_picture')});var is_company=data.is_company;var genid=data.genid;var p=$("#"+genid+"uploadPreview");if(!is_company){og.area_sel=$('img#'+genid+'uploadPreview').imgAreaSelect({aspectRatio:'1:1',handles:true,instance:true,onSelectEnd:og.setPictureInfo});}
$("#"+genid+"uploadImage").change(function(){p.fadeOut();$("#"+genid+"current_picture").hide();$("#"+genid+"submit_btn").show();if(window.FileReader){var fr=new FileReader();fr.readAsDataURL(document.getElementById(genid+"uploadImage").files[0]);fr.onload=function(fevent){p.attr('src',fevent.target.result).fadeIn();};if(!is_company){og.set_image_area_selection(genid);}}else{og.tmpPictureFileUpload(genid,{callback:function(data){$("#"+genid+"uploadPreview").attr('src',data.url).fadeIn();if(!is_company){og.area_sel=$('img#'+genid+'uploadPreview').imgAreaSelect({aspectRatio:'1:1',handles:true,instance:true,type:Blob,onSelectEnd:og.setPictureInfo});og.set_image_area_selection(genid);}}});}});}});}
og.delete_contact_picture=function(genid,delete_picture_url,confirm_message,reload_picture){if(confirm(confirm_message)){og.openLink(delete_picture_url,{preventPanelLoad:true,callback:function(success,data){$("#"+genid+"current_picture").fadeOut();og.ExtModal.hide();$("#"+reload_picture).attr('src',data.default_image_url);}});}};og.upload_tmp_file_content=function(genid,file_input_id,file_input_name,hf_id,callback){var fileInput=document.getElementById(file_input_id);var fileParent=fileInput.parentNode;fileParent.removeChild(fileInput);var form=document.createElement('form');form.method='post';form.enctype='multipart/form-data';form.encoding='multipart/form-data';form.action=og.getUrl('object','tmp_file_upload',{'id':hf_id,'input_name':file_input_name});form.style.display='none';form.appendChild(fileInput);document.body.appendChild(form);og.submit(form,{callback:function(d){$("button.submit").removeAttr("disabled").removeClass("disabled");form.removeChild(fileInput);fileParent.appendChild(fileInput);document.body.removeChild(form);if(d&&d.id){$("#"+hf_id).val(d.id);}else{$("#"+hf_id).val("");}
if(typeof callback=='function'){callback(genid,file_input_id,hf_id);}}});}
og.call_add_objects_to_member=function(e,ids,member_id,attachment,reclassify_in_associations,remove_prev,callback,dimension_id){if(og.still_adding_objects_to_member)return;og.still_adding_objects_to_member=true;setTimeout(function(){og.still_adding_objects_to_member=false;},1000);var params={};params.objects=Ext.util.JSON.encode(ids);if(isNaN(member_id)||member_id==null){params.dimension=dimension_id;}else{params.member=member_id;}
if(attachment)params.attachment=attachment;if(reclassify_in_associations)params.reclassify_in_associations=reclassify_in_associations;if(remove_prev)params.remove_prev=remove_prev;params.req_channel='drag and drop';og.openLink(og.getUrl('member','add_objects_to_member'),{method:'POST',post:params,callback:function(){if(e&&e.data&&e.data.grid)e.data.grid.load();if(typeof(callback)=='function'){callback.call(null,ids,member_id);}}});}
og.drag_drop_classification_keep_or_move_prompt=function(genid,e,ids,member_id,attachment,reclassify_in_associations,callback){var div=document.createElement('div');var question=lang('do you want to mantain the current associations of this obj with members of',config.title);div.style="border-radius: 5px; background-color: #fff; padding: 10px; width: 500px;";var genid=Ext.id();div.innerHTML='<div><label class="coInputTitle">'+lang('classification')+'</label></div>'+'<div id="'+genid+'_question">'+question+'</div>'+'<div id="'+genid+'_buttons">'+'<button class="replace submit blue">'+lang('replace with the new one')+'</button><button class="keep submit blue">'+lang('keep both current and new')+'</button>'+'</div><div class="clear"></div>';var modal_params={'escClose':false,'overlayClose':false,'closeHTML':'<a id="'+genid+'_close_link" class="modal-close" title="'+lang('close')+'"></a>','onShow':function(dialog){$("#"+genid+"_close_link").addClass("modal-close-img");$("#"+genid+"_buttons").css('text-align','right').css('margin','10px 0');$("#"+genid+"_question").css('margin','10px 0');$("#"+genid+"_buttons button.replace").css('margin-right','10px').click(function(){og.call_add_objects_to_member(e,ids,member_id,attachment,reclassify_in_associations,true,callback);$('.modal-close').click();});$("#"+genid+"_buttons button.keep").css('margin-right','10px').click(function(){og.call_add_objects_to_member(e,ids,member_id,attachment,reclassify_in_associations,false,callback);$('.modal-close').click();});}};setTimeout(function(){$.modal(div,modal_params);},100);}
og.get_currency_by_id=function(id){for(var i=0;i<og.all_currencies.length;i++){if(og.all_currencies[i].id==id)return og.all_currencies[i];}}
og.format_money_amount=function(amount,decimals){if(amount==''||typeof amount=='undefined')amount='0';amount=og.clean_thousand_separator(amount);if(amount.toString().indexOf(',')>0){amount=amount.toString().replace(',','.');}
amount=parseFloat(amount);if(!decimals)decimals=2;if(og.preferences.thousand_separator==''){return amount.toFixed(decimals).toString().replace('.',og.preferences.decimals_separator);}
var locale=og.preferences.thousand_separator==','?'en':'it';return amount.toLocaleString(locale,{minimumFractionDigits:decimals,maximumFractionDigits:decimals});}
og.updateElementMoneyAmount=function(id,value){var formatted_value=og.format_money_amount(value);$('#'+id).val(formatted_value);}
og.clean_thousand_separator=function(amount){if(!isNaN(amount))return amount;if(typeof amount=='undefined')return 0;var th_sep=og.get_locale_thousand_separator();if(th_sep==''){th_sep=og.preferences.decimals_separator==','?'.':',';}
while(amount.toString().indexOf(th_sep)>0){amount=amount.toString().replace(th_sep,'');}
if(th_sep=='.'){amount=amount.toString().replace(',','.');}
return amount;}
og.get_locale_thousand_separator=function(){return og.preferences.thousand_separator;}
og.getDateArray=function(date,time){var format=og.preferences.date_format;var result=[];switch(format){case'd-m-Y':var aux=date.split('-');result.push(aux[2]);result.push((aux[1]-1));result.push(aux[0]);break;case'd/m/Y':var aux=date.split('/');result.push(aux[2]);result.push((aux[1]-1));result.push(aux[0]);break;case'd.m.Y':var aux=date.split('.');result.push(aux[2]);result.push((aux[1]-1));result.push(aux[0]);break;case'm-d-Y':var aux=date.split('-');result.push(aux[2]);result.push((aux[0]-1));result.push(aux[1]);break;case'm/d/Y':var aux=date.split('/');result.push(aux[2]);result.push((aux[0]-1));result.push(aux[1]);break;case'm.d.Y':var aux=date.split('.');result.push(aux[2]);result.push((aux[0]-1));result.push(aux[1]);break;case'Y-m-d':var aux=date.split('-');result.push(aux[0]);result.push((aux[1]-1));result.push(aux[2]);break;case'Y/m/d':var aux=date.split('/');result.push(aux[0]);result.push((aux[1]-1));result.push(aux[2]);break;case'Y.m.d':var aux=date.split('.');result.push(aux[0]);result.push((aux[1]-1));result.push(aux[2]);break;default:break;}
if(time=='hh:mm'){var now_time=new Date();time=now_time.format('H:i');}
var auxTime=time.split(' ');var times=auxTime[0].split(':');if(auxTime[1]=='PM'&&times[0]!=12){result.push((parseInt(times[0])+12));}else{if(auxTime[1]=='AM'&&times[0]==12){result.push((parseInt(times[0])+12));}else{result.push(times[0]);}}
result.push(times[1]);return result;}
og.reload_tasks_list_with_status=function(status_id){var url=og.getUrl('task','set_task_list_filters_to_reload',{status_id:status_id});og.openLink(url,{hideLoading:true,callback:function(success,data){var t=Ext.getCmp("tasks-panel");if(t){var tp=Ext.getCmp('tabs-panel');tp.setActiveTab(t);t.reset();}}});}
og.get_object_type_by_name=function(ot_name){for(x in og.objectTypes){if(!isNaN(x)){var ot=og.objectTypes[x];if(ot&&ot.name==ot_name){return ot;}}}}
og.render_plain_member_selector=function(config){var dim_id=config.dim_id;if(!og.render_plain_member_selector_waiting_response)og.render_plain_member_selector_waiting_response={};if(og.render_plain_member_selector_waiting_response[dim_id]){og.render_plain_member_selector_waiting_response[dim_id].push(config);return;}
if(typeof og.dimensions[dim_id]=='undefined'){og.render_plain_member_selector_waiting_response[dim_id]=[];og.render_plain_member_selector_waiting_response[dim_id].push(config);og.openLink(og.getUrl('dimension','reload_dimensions_js',{dim_ids:[dim_id],vars:Ext.util.JSON.encode(config)}),{callback:function(success,data){for(dim_id in data.dims){let dim_members=data.dims[dim_id];if(dim_members.length>0){if(!og.dimensions){og.dimensions={};}
if(!og.dimensions[dim_id]){og.dimensions[dim_id]={};}
for(var i=0;i<dim_members.length;i++){let member=dim_members[i];og.dimensions[dim_id][member.id]=member;}}
for(var i=0;i<og.render_plain_member_selector_waiting_response[dim_id].length;i++){let conf=og.render_plain_member_selector_waiting_response[dim_id][i];og.do_render_plain_member_selector(conf);}
delete og.render_plain_member_selector_waiting_response[dim_id];}}});}else{og.do_render_plain_member_selector(config);}}
og.do_render_plain_member_selector=function(config){var dim_id=config.dim_id;var hf_name=config.hf_name;var container=config.container;var genid=config.genid;var sel_id=config.sel_id?config.sel_id:0;var class_add=config.class_add?config.class_add:'';var selector_id=genid+'member_selector_'+dim_id;var members=[];for(mem_id in og.dimensions[dim_id]){members.push(og.dimensions[dim_id][mem_id]);}
members.sort(function(a,b){return((a.sort_key<b.sort_key)?-1:((a.sort_key>b.sort_key)?1:0));});var sel=$('<select id="'+selector_id+'" name="'+hf_name+'" class="'+class_add+'">');sel.append($('<option value="0">'));$("#"+container).html(sel);for(var j=0;j<members.length;j++){var member=members[j];var mem_name="";for(var i=1;i<member.depth;i++)mem_name+='&nbsp;&nbsp;';mem_name+=og.clean(member.name);var option_id="mem_"+member.id;var pid=member.parent==0?member.id:member.parent;var sel_attr=sel_id==member.id?'selected="selected"':"";var option_html='<option id="'+option_id+'" class="parent_'+pid+'" value="'+member.id+'" '+sel_attr+'>'+mem_name+'</option>';if(member.parent==0){sel.append(option_html);}else{parent_option_id="mem_"+member.parent;$("#"+selector_id+" .parent_"+member.parent+":last").after(option_html);}}}
og.preload_small_dimension_members=function(){if(!og.simple_member_selectors)og.simple_member_selectors={store_cache:{}};og.openLink(og.getUrl('dimension','preload_small_dimension_members'),{silent:true,callback:function(success,data){if(data&&data.dimension_members){for(dim_id in data.dimension_members){let store_data=[[0,lang('none')]];og.buildPlainStoreFromTree(data.dimension_members[dim_id],store_data);og.simple_member_selectors.store_cache[dim_id]={store:store_data,date:new Date(),}}}}});}
og.padding_rigth=9;og.padding=15;og.font_size=11;og.lastWidthTab=0;og.lastLengthTab=0;og.checkAndAdjustTabsSize=function(widthtab,length){if(widthtab!=undefined){if((widthtab==og.lastWidthTab)&&(og.lastLengthTab==length)){if($(".x-tab-with-icon:not(.x-tab-strip-active):first .x-tab-strip-text:first").width()==0){$(".x-tab-with-icon .x-tab-strip-text").css('width','0px');$(".x-tab-with-icon.x-tab-strip-active .x-tab-strip-text").css('width','auto');return true;}}
og.lastWidthTab=widthtab;og.lastLengthTab=length;}
var deltaWidth=100;var total_tabs_w=40;var all_tabs=$("li.x-tab-with-icon");for(var j=0;j<all_tabs.length;j++){total_tabs_w+=$(all_tabs[j]).outerWidth();}
var container_w=$(".x-tab-strip-wrap").width();if(container_w>total_tabs_w){if(container_w-deltaWidth>total_tabs_w){og.calculateTotalTabsWidthUp(container_w-deltaWidth,function(flag){if(flag){og.checkAndAdjustTabsSize();}})}}else{og.calculateTotalTabsWidthDown(container_w,function(flagResize){if(flagResize){og.checkAndAdjustTabsSize();}})}}
og.calculateTotalTabsWidthUp=function(container_w,callback){var total_tabs_w=40;var all_tabs=$("li.x-tab-with-icon");for(var j=0;j<all_tabs.length;j++){total_tabs_w+=$(all_tabs[j]).outerWidth();}
if(og.padding_rigth<10){og.padding_rigth++}
if(og.font_size<11){og.font_size++}
og.padding++
if(og.padding>15){callback(false);return false;}
$(".x-tab-with-icon .x-tab-strip-text").css('width','auto');;og.changeTabsSize(og.font_size,og.padding,og.padding_rigth);callback(true);}
og.calculateTotalTabsWidthDown=function(container_w,callback){var flagChanges=false;var total_tabs_w=40;var all_tabs=$("li.x-tab-with-icon");for(var j=0;j<all_tabs.length;j++){total_tabs_w+=$(all_tabs[j]).outerWidth();}
if(og.padding_rigth>2){og.padding_rigth--
flagChanges=true;}
if(og.font_size>9){og.font_size--
flagChanges=true;}
if(og.padding<6){if(!flagChanges&&(container_w<total_tabs_w)){$(".x-tab-with-icon .x-tab-strip-text").css('width','0px');$(".x-tab-with-icon.x-tab-strip-active .x-tab-strip-text").css('width','auto');$(".x-tab-with-icon .x-tab-left").css('padding-right','0px');$(".x-tab-with-icon.x-tab-strip-active .x-tab-left").css('padding-right','10px');}
callback(false,flagChanges);}else{og.padding--
flagChanges=true;$(".x-tab-with-icon. .x-tab-strip-text").css('width','auto');og.changeTabsSize(og.font_size,og.padding,og.padding_rigth);callback(true,flagChanges);}}
og.changeTabsSize=function(font_size,padding,padding_rigth){$(".x-tab-with-icon .x-tab-left").css('padding-right',padding_rigth+'px');$(".x-tab-with-icon.x-tab-strip-active .x-tab-left").css('padding-right',padding_rigth+'px');$(".x-tab-with-icon").css('padding-left',padding+'px');$(".x-tab-with-icon").css('padding-right',padding+'px');$(".x-tab-strip-text").css('font-size',font_size+'px');}
og.InfinitePagingToolbar=Ext.extend(Ext.Toolbar,{pageSize:20,emptyMsg:'No data to display',beforePageText:"Page",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",refreshText:"Refresh",maxPages:1000000,paramNames:{start:'start',limit:'limit'},initComponent:function(){this.addEvents('change','beforechange');og.InfinitePagingToolbar.superclass.initComponent.call(this);this.cursor=0;this.bind(this.store);},onRender:function(ct,position){og.InfinitePagingToolbar.superclass.onRender.call(this,ct,position);this.first=this.addButton({tooltip:this.firstText,iconCls:"x-tbar-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,iconCls:"x-tbar-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])});this.addSeparator();this.add(this.beforePageText);this.field=Ext.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-tbar-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.field.setHeight(18);this.addSeparator();this.next=this.addButton({tooltip:this.nextText,iconCls:"x-tbar-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});this.addSeparator();this.loading=this.addButton({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});}
if(this.dsLoaded){this.onLoad.apply(this,this.dsLoaded);}},updateInfo:function(){if(this.displayEl){var count=this.store.getCount();var msg=count==0?this.emptyMsg:"";this.displayEl.update(msg);}},onLoad:function(store,r,o){if(!this.rendered){this.dsLoaded=[store,r,o];return;}
this.cursor=o.params?o.params[this.paramNames.start]:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.field.dom.value=ap;this.first.setDisabled(ap==1);this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.loading.enable();this.updateInfo();this.fireEvent('change',this,d);},getPageData:function(){var total=this.maxPages;var ap=Math.ceil((this.cursor+this.pageSize)/this.pageSize);if(this.store.reader.jsonData){var start=parseInt(this.store.reader.jsonData.start);ap=Math.ceil((start+this.pageSize)/this.pageSize);this.cursor=start;}
return{total:total,activePage:ap,pages:total<this.pageSize?1:Math.ceil(total/this.pageSize)};},onLoadError:function(){if(!this.rendered){return;}
this.loading.enable();},readPage:function(d){var v=this.field.dom.value,pageNum;if(!v||isNaN(pageNum=parseInt(v,10))){this.field.dom.value=d.activePage;return false;}
return pageNum;},onPagingKeydown:function(e){var k=e.getKey(),d=this.getPageData(),pageNum;if(k==e.RETURN){e.stopEvent();pageNum=this.readPage(d);if(pageNum!==false){pageNum=Math.min(Math.max(1,pageNum),d.pages)-1;this.doLoad(pageNum*this.pageSize);}}else if(k==e.HOME||k==e.END){e.stopEvent();pageNum=k==e.HOME?1:d.pages;this.field.dom.value=pageNum;}else if(k==e.UP||k==e.PAGEUP||k==e.DOWN||k==e.PAGEDOWN){e.stopEvent();if(pageNum=this.readPage(d)){var increment=e.shiftKey?10:1;if(k==e.DOWN||k==e.PAGEDOWN){increment*=-1;}
pageNum+=increment;if(pageNum>=1&pageNum<=d.pages){this.field.dom.value=pageNum;}}}},beforeLoad:function(){if(this.rendered&&this.loading){this.loading.disable();}},doLoad:function(start){var o={},pn=this.paramNames;o[pn.start]=start;o[pn.limit]=this.pageSize;if(this.fireEvent('beforechange',this,o)!==false){this.store.load({params:o});}},changePage:function(page){this.doLoad(((page-1)*this.pageSize).constrain(0,this.maxPages));},onClick:function(which){var store=this.store;switch(which){case"first":this.doLoad(0);break;case"prev":this.doLoad(Math.max(0,this.cursor-this.pageSize));break;case"next":this.doLoad(this.cursor+this.pageSize);break;case"refresh":this.doLoad(this.cursor);break;}},unbind:function(store){store=Ext.StoreMgr.lookup(store);store.un("beforeload",this.beforeLoad,this);store.un("load",this.onLoad,this);store.un("loadexception",this.onLoadError,this);this.store=undefined;},bind:function(store){store=Ext.StoreMgr.lookup(store);store.on("beforeload",this.beforeLoad,this);store.on("load",this.onLoad,this);store.on("loadexception",this.onLoadError,this);this.store=store;}});og.HttpProvider=function(config){this.addEvents('readsuccess','readfailure','savesuccess','savefailure');og.HttpProvider.superclass.constructor.call(this);Ext.apply(this,config,{delay:750,dirty:false,started:false,autoStart:true,autoRead:true,user:'user',id:1,session:'session',logFailure:false,logSuccess:false,queue:[],url:'.',readUrl:undefined,saveUrl:undefined,method:'post',saveBaseParams:{},readBaseParams:{},paramNames:{id:'id',name:'name',value:'value',user:'user',session:'session',data:'data'}});if(this.autoRead){this.readState();}
this.dt=new Ext.util.DelayedTask(this.submitState,this);if(this.autoStart){this.start();}};Ext.extend(og.HttpProvider,Ext.state.Provider,{saveSuccessText:'Save Success',saveFailureText:'Save Failure',readSuccessText:'Read Success',readFailureText:'Read Failure',dataErrorText:'Data Error',initState:function(state){if(state instanceof Array){Ext.each(state,function(item){this.state[item.name]=this.decodeValue(item.value);},this);}
else{this.state=state?state:{};}},set:function(name,value){if(!name){return;}
this.queueChange(name,value);},start:function(){this.dt.delay(this.delay);this.started=true;},stop:function(){this.dt.cancel();this.started=false;},queueChange:function(name,value){var changed=undefined===this.state[name]||this.state[name]!==value;var o={};var i;var found=false;if(changed){o[this.paramNames.name]=name;o[this.paramNames.value]=this.encodeValue(value);for(i=0;i<this.queue.length;i++){if(this.queue[i].name===o.name){this.queue[i]=o;found=true;}}
if(false===found){this.queue.push(o);}
this.dirty=true;}
return changed;},submitState:function(){if(!this.dirty){this.dt.delay(this.delay);return;}
this.dt.cancel();var o={url:this.saveUrl||this.url,method:this.method,scope:this,success:this.onSaveSuccess,failure:this.onSaveFailure,queue:og.clone(this.queue),params:{}};var params=Ext.apply({},this.saveBaseParams);params[this.paramNames.id]=this.id;params[this.paramNames.user]=this.user;params[this.paramNames.session]=this.session;params[this.paramNames.data]=Ext.encode(o.queue);Ext.apply(o.params,params);this.dirty=false;Ext.Ajax.request(o);},clear:function(name){this.set(name,undefined);},onSaveSuccess:function(response,options){if(this.started){this.start();}
var o={};try{o=Ext.decode(response.responseText);}
catch(e){if(true===this.logFailure){this.log(this.saveFailureText,e,response);}
this.dirty=true;return;}
if(true!==o.success){if(true===this.logFailure){this.log(this.saveFailureText,o,response);}
this.dirty=true;}
else{Ext.each(options.queue,function(item){var name=item[this.paramNames.name];var value=this.decodeValue(item[this.paramNames.value]);if(undefined===value||null===value){og.HttpProvider.superclass.clear.call(this,name);}
else{og.HttpProvider.superclass.set.call(this,name,value);}},this);if(false===this.dirty){this.queue=[];}
else{var i,j,found;for(i=0;i<options.queue.length;i++){found=false;for(j=0;j<this.queue.length;j++){if(options.queue[i].name===this.queue[j].name){found=true;break;}}
if(true===found&&this.encodeValue(options.queue[i].value)===this.encodeValue(this.queue[j].value)){delete(this.queue[j]);}}}
if(true===this.logSuccess){this.log(this.saveSuccessText,o,response);}
this.fireEvent('savesuccess',this);}},onSaveFailure:function(response,options){if(true===this.logFailure){this.log(this.saveFailureText,response);}
if(this.started){this.start();}
this.dirty=true;this.fireEvent('savefailure',this);},onReadFailure:function(response,options){if(true===this.logFailure){this.log(this.readFailureText,response);}
this.fireEvent('readfailure',this);},onReadSuccess:function(response,options){var o={},data;try{o=Ext.decode(response.responseText);}
catch(e){if(true===this.logFailure){this.log(this.readFailureText,e,response);}
return;}
if(true!==o.success){if(true===this.logFailure){this.log(this.readFailureText,o,response);}}
else{try{data=Ext.decode(o[this.paramNames.data]);}
catch(ex){if(true===this.logFailure){this.log(this.dataErrorText,o,response);}
return;}
if(!(data instanceof Array)&&true===this.logFailure){this.log(this.dataErrorText,data,response);return;}
Ext.each(data,function(item){this.state[item[this.paramNames.name]]=this.decodeValue(item[this.paramNames.value]);},this);this.queue=[];this.dirty=false;if(true===this.logSuccess){this.log(this.readSuccessText,data,response);}
this.fireEvent('readsuccess',this);}},readState:function(){var o={url:this.readUrl||this.url,method:this.method,scope:this,success:this.onReadSuccess,failure:this.onReadFailure,params:{}};var params=Ext.apply({},this.readBaseParams);params[this.paramNames.id]=this.id;params[this.paramNames.user]=this.user;params[this.paramNames.session]=this.session;Ext.apply(o.params,params);Ext.Ajax.request(o);},log:function(){if(console){console.log.apply(console,arguments);}}});og.GooProxy=function(config){og.GooProxy.superclass.constructor.call(this);Ext.apply(this,config);};Ext.extend(og.GooProxy,Ext.data.DataProxy,{load:function(params,reader,callback,scope,arg){if(this.fireEvent("beforeload",this,params)!==false){og.openLink(this.url,{get:params,callback:this.loadResponse,scope:this,request:{callback:callback,scope:scope,arg:arg},reader:reader,timeout:this.timeout});}else{callback.call(scope||this,null,arg,false);}},loadResponse:function(success,data,options){if(!success){this.fireEvent("loadexception",this,options,data);options.request.callback.call(options.request.scope,null,options.request.arg,false);return;}
var result;try{result=options.reader.readRecords(data);}catch(e){this.fireEvent("loadexception",this,options,data,e);options.request.callback.call(options.request.scope,null,options.request.arg,false);return;}
this.fireEvent("load",this,result,options.request.arg);options.request.callback.call(options.request.scope,result,options.request.arg,true);},update:function(dataSet){},updateResponse:function(dataSet){}});og.QuickAdd=function(config){if(!og.AdditionalQuickAddButtons)og.AdditionalQuickAddButtons=[];og.QuickAdd.superclass.constructor.call(this,Ext.applyIf(config||{},{text:lang('new'),tooltip:lang('create an object'),iconCls:'ico-quick-add',listeners:{'render':function(button){for(i=0;i<og.AdditionalQuickAddButtons.length;i++){button.menu.add(og.AdditionalQuickAddButtons[i]);}}},menu:{items:[{id:'quick-contact',text:lang('person'),iconCls:'ico-contact',handler:function(){var url=og.getUrl('contact','add');og.openLink(url);},hidden:!og.config['enable_contacts_module']},{id:'quick-company',text:lang('company'),iconCls:'ico-company',handler:function(){var url=og.getUrl('contact','add_company');og.openLink(url);},hidden:!og.config['enable_contacts_module']},{id:'quick-event',text:lang('event'),iconCls:'ico-event',handler:function(){og.render_modal_form('',{c:'event',a:'add'});},hidden:!og.config['enable_calendar_module']},{id:'quick-task',text:lang('task'),iconCls:'ico-task',handler:function(){og.render_modal_form('',{c:'task',a:'add_task',params:{reload:1}});},hidden:!og.config['enable_tasks_module']},{id:'quick-milestone',text:lang('milestone'),iconCls:'ico-milestone',handler:function(){og.render_modal_form('',{c:'milestone',a:'add'});},hidden:!og.config['enable_tasks_module']},{id:'quick-weblink',text:lang('webpage'),iconCls:'ico-webpage',handler:function(){og.render_modal_form('',{c:'webpage',a:'add'});},hidden:!og.config['enable_weblinks_module']},{id:'quick-note',text:lang('message'),iconCls:'ico-message',handler:function(){og.render_modal_form('',{c:'message',a:'add'});},hidden:!og.config['enable_notes_module']},{id:'quick-file',text:lang('upload file'),iconCls:'ico-upload',handler:function(){og.render_modal_form('',{c:'files',a:'add_file'});},hidden:!og.config['enable_documents_module']}]}}));};Ext.extend(og.QuickAdd,Ext.Button,{});Ext.override(Ext.tree.TreePanel,{totalNodes:0,expandedNodes:0,expandAll:function(callback){if(typeof callback=="function"){this.expandedNodes=0;this.root.expand(true,this.animate,function(node){var tree=node.getOwnerTree();tree.expandedNodes++;if(tree.expandedNodes>=tree.totalNodes){callback(this,node);}});}else{this.root.expand(true);}}});Ext.override(Ext.tree.TreeNodeUI,{renderElements:function(n,a,targetNode,bulkRender){nodeIconHide="";extraHTML='';if(n.actions&&n.actions.length){extraHTML+="<ul class= 'feng-node-actions'>";for(var i in n.actions){if(i=="remove")continue;action=n.actions[i];if(action.url){url=og.makeAjaxUrl(action.url);var onClick="og.disableEventPropagation(event);";if(action.class=="action-edit"){onClick+=" og.render_modal_form('', {url:'"+action.url+"'});";}else{onClick+=" og.openLink('"+url+"');";}
extraHTML+="<li>";extraHTML+='<a class="'+action.iconCls+'" href="#" onClick = "'+onClick+'" title="'+lang('edit')+'" >';extraHTML+=action.text;extraHTML+="</a>";extraHTML+="</li>";}}
extraHTML+="</ul>";nodeIconHide="tree-node-icon-hide-over";}
this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var cb=typeof a.checked=='boolean';var href=a.href?a.href:Ext.isGecko?"":"#";var buf=['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ',a.cls,'" unselectable="on">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon x-tree-elbow" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon '+nodeIconHide+' ',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':'/>')):'','<div style="display: inline-block;" class="tree-name-container">'+extraHTML+'<a style="display: table-cell;" hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on">',n.text,"</span></a></div></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"].join('');var nel;if(bulkRender!==true&&n.nextSibling&&(nel=n.nextSibling.ui.getEl())){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",nel,buf);}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf);}
this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var index=3;if(cb){this.checkbox=cs[3];this.checkbox.defaultChecked=this.checkbox.checked;index++;}
this.anchor=cs[index].lastChild;this.textNode=this.anchor.firstChild;}});Ext.override(Ext.tree.TreeNode,{expand:function(deep,anim,callback){if(!this.expanded){if(this.fireEvent("beforeexpand",this,deep,anim)===false){return;}
if(!this.childrenRendered){this.renderChildren();}
this.expanded=true;if(!this.isHiddenRoot()&&(anim!==false&&this.getOwnerTree()&&this.getOwnerTree().animate)||anim){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof callback=="function"){callback(this);}
if(deep===true){this.expandChildNodes(true,callback);}}.createDelegate(this));return;}else{this.ui.expand();this.fireEvent("expand",this);if(typeof callback=="function"){callback(this);}}}else{if(typeof callback=="function"){callback(this);}}
if((!this.attributes.gettingChildsFromServer)&&this.expanded&&this.childNodes.length<this.attributes.realTotalChilds&&this.attributes.expandable){this.expanded=false;this.getUI().expand();}
if(deep===true){this.expandChildNodes(true,callback);}},expandedNodes:function(){var expanded=[];if(this.isExpanded()){if(this.getDepth()){expanded.push(this.id);}else{expanded.push(0);}}
if(!this.leaf){this.eachChild(function(n){expanded=expanded.concat(n.expandedNodes());});}
return expanded;},expandChildNodes:function(deep,callback){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){if(cs[i]&&typeof(cs[i])!='function'){cs[i].expand(deep,false,callback);}}},ensureVisible:function(callback){var tree=this.getOwnerTree();if(!tree||!this.parentNode)return;tree.expandPath(this.parentNode.getPath(),false,function(){var node=tree.getNodeById(this.id);if(node&&node.ui){tree.getTreeEl().scrollChildIntoView(node.ui.anchor);}
Ext.callback(callback);}.createDelegate(this));},remove:function(){if(this.parentNode&&this.parentNode.ownerTree){this.parentNode.removeChild(this);}
return this;}});og.MemberChooserTreeLoader=function(config){og.MemberChooserTreeLoader.superclass.constructor.call(this,config);if(this.ownerTree){this.ownerTree.totalNodes=0;}};Ext.extend(og.MemberChooserTreeLoader,Ext.tree.TreeLoader,{ownerTree:null,createNode:function(attr){if(Ext.type(this.ownerTree)){if(this.ownerTree.totalNodes){this.ownerTree.totalNodes++;}else{this.ownerTree.totalNodes=1;}}else{alert("MemberChooserTreeLoader.js - TREE NOT DEFINED  ! ! ! "+attr.text);}
if(this.baseAttrs){Ext.applyIf(attr,this.baseAttrs);}
if(this.applyLoader!==false){if(!attr)attr={};attr.loader=this;}
if(typeof attr.uiProvider=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}
if(attr.nodeType){var node=Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);}else{var node=attr.leaf?new Ext.tree.TreeNode(attr):new Ext.tree.AsyncTreeNode(attr);}
node.object_id=attr.object_id;node.options=attr.options;node.object_controller=attr.object_controller;node.object_type_id=attr.object_type_id;node.allow_childs=attr.allow_childs;if(attr.actions){node.actions=attr.actions;}
return node;},processResponse:function(response,node,callback){if(Ext.type(this.ownerTree)){this.ownerTree.totalNodes=1;}
var json=response.responseText;try{var json_obj=eval("("+json+")");var dimension_id=this.ownerTree.dimensionId;if(!og.tmp_members_to_add)og.tmp_members_to_add=[];this.ownerTree.loaded_member_ids=[];for(i=0;i<json_obj.dimension_members.length;i++){og.addMemberToOgDimensions(dimension_id,json_obj.dimension_members[i]);this.ownerTree.loaded_member_ids.push(json_obj.dimension_members[i].id);}
if(typeof(json_obj.dimensions_root_members)!="undefined"&&!json_obj.more_nodes_left){ogMemberCache.addDimToDimRootMembers(json_obj.dimension_id);}
var tmp_member_array=[];var count=0;while(json_obj.dimension_members.length>0){tmp_member_array[count]=json_obj.dimension_members.splice(0,100);count++;}
tmp_member_array.reverse();var tree_id=this.ownerTree.id;og.tmp_members_to_add[tree_id]=tmp_member_array;if(!og.tmp_node)og.tmp_node=[];og.tmp_node[tree_id]=node;var old_text=this.ownerTree.getRootNode().text;this.ownerTree.innerCt.mask();for(x=0;x<count;x++){setTimeout('og.addNodesToTree("'+tree_id+'", '+(json_obj.more_nodes_left?'1':'0')+');',1000*x);}
var t=this.ownerTree;setTimeout(function(){t.innerCt.unmask();t.getRootNode().setText(old_text);og.eventManager.fireEvent('after add nodes to tree panel',t);},1000*count);node.endUpdate();if(typeof callback=="function"){callback(this,node,json_obj);}
this.ownerTree.expanded_once=false;}catch(e){this.handleFailure(response);}}});Ext.ns('Ext.ux.layout');Ext.ux.layout.MultiAccordion=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,maxActiveItems:1,activeItemsCount:0,activeItems:[],fill:true,autoWidth:true,titleCollapse:true,hideCollapseTool:false,collapseFirst:false,animate:false,sequence:false,activeOnTop:false,addActiveItem:function(item){this.activeItems.push(item);this.activeItemsCount++;},renderItem:function(c){if(this.animate===false){c.animCollapse=false;}
c.collapsible=true;if(this.autoWidth){c.autoWidth=true;}
if(this.titleCollapse){c.titleCollapse=true;}
if(this.hideCollapseTool){c.hideCollapseTool=true;}
if(this.collapseFirst!==undefined){c.collapseFirst=this.collapseFirst;}
if(this.activeItems.length<this.maxActiveItems&&!c.collapsed&&!c.hidden){this.addActiveItem(c);}else{c.collapsed=true;}
Ext.ux.layout.MultiAccordion.superclass.renderItem.apply(this,arguments);c.header.addClass('x-accordion-hd');c.on('beforeexpand',this.beforeExpand,this);c.on('beforecollapse',this.beforeCollapse,this);c.on('beforehide',this.beforeHide,this);},beforeHide:function(p){p.hidden=true;this.layout();},beforeCollapse:function(p,anim){var ais=this.activeItems;this.activeItemsCount--;var deleted=false;for(var i=0;i<ais.length;i++){if(ais[i]&&ais[i].id==p.id){var deleted=true;delete this.activeItems[i];break;}}
p.willExpand=false;p.willCollapse=true;this.layout();},beforeExpand:function(p,anim){var ais=this.activeItems;var max=this.maxActiveItems;if(this.activeItemsCount>=max){for(var i=0;i<this.activeItems.length;i++){if(this.activeItems[i]){this.activeItems[i];this.activeItems[i].collapse(false);break;}}}
this.addActiveItem(p);if(this.activeOnTop){p.el.dom.parentNode.insertBefore(p.el.dom,p.el.dom.parentNode.firstChild);}
p.willExpand=true;p.willCollapse=false;this.layout();},onLayout:function(ct,target){Ext.ux.layout.MultiAccordion.superclass.onLayout.call(this,ct,target);if(!this.container.collapsed){this.setActiveItemsSize(target.getStyleSize());}},setActiveItemsSize:function(size){var margins=7;var delta=30;if(this.fill){var items=this.container.items.items;var hh=0;for(var i=0,len=items.length;i<len;i++){var p=items[i];if(p.willCollapse&&!p.hidden||(p.collapsed&&!p.hidden&&!p.willExpand)){var delta=(p.getSize().height-p.bwrap.getHeight());delta+=margins;hh+=delta;}}
size.height=(size.height-hh)/this.activeItemsCount-margins;var dbg='';for(var i=0;i<this.activeItems.length;i++){if(this.activeItems[i]){this.activeItems[i].setSize(size);this.activeItems[i].doLayout();}}}},debug:function(title){var out='';out+=title+'\n';out+='-------------------\n';out+='* ACTIVE ITEMS COUNT: '+this.activeItemsCount+'\n';out+='* ACTIVE ITEMS : \n';for(var i=0;i<this.activeItems.length;i++){if(item=this.activeItems[i]){out+='      *'+item.title+'\n';}}
og.msg("",out,15);}});Ext.Container.LAYOUTS['multi-accordion']=Ext.ux.layout.MultiAccordion;Ext.ns('Ext.ux.layout');Ext.ux.layout.HorizontalLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:'x-column',scrollOffset:0,isValidParent:function(c,target){return c.getEl().dom.parentNode==this.innerCt.dom;},renderItem:function(c,position,target){if(c&&!c.rendered){c.render(target,position);if(this.extraCls){var t=c.getPositionEl?c.getPositionEl():c;t.addClass(this.extraCls);}
if(this.renderHidden&&c!=this.activeItem){c.hide();}}else if(c&&!this.isValidParent(c,target)){if(this.extraCls){c.addClass(this.extraCls);}
if(typeof position=='number'){position=target.dom.childNodes[position];}
target.dom.insertBefore(c.getEl().dom,position||null);if(this.renderHidden&&c!=this.activeItem){c.hide();}}
c.header.addClass('horizontal-hd');c.on('beforeexpand',this.beforeExpand,this);c.on('beforecollapse',this.beforeCollapse,this);},renderRange:function(ct,target,start,limit){var items=ct.items.items;for(var i=start,len=Math.min(items.length,limit+start);i<len;i++){var c=items[i];if(c&&(!c.rendered||!this.isValidParent(c,target))){this.renderItem(c,i,target);}}},beforeCollapse:function(p,anim){p.addClass("horizontal-collapsed");p.afterCollapse();},beforeExpand:function(p,anim){p.removeClass("horizontal-collapsed");},onLayout:function(ct,target){var cs=ct.items.items,len=cs.length,c,i;if(!this.innerCt){target.addClass('x-column-layout-ct');this.innerCt=target.createChild({cls:'x-column-inner'});this.innerCt.createChild({cls:'x-clear'});}
this.renderAll(ct,this.innerCt);var size=Ext.isIE&&target.dom!=Ext.getBody().dom?target.getStyleSize():target.getViewSize();if(size.width<1&&size.height<1){return;}
var w=size.width-target.getPadding('lr')-this.scrollOffset,h=size.height-target.getPadding('tb'),pw=w;this.innerCt.setWidth(w);for(i=0;i<len;i++){c=cs[i];if(!c.columnWidth){pw-=(c.getSize().width+c.getEl().getMargins('lr'));}}
pw=pw<0?0:pw;for(i=0;i<len;i++){c=cs[i];if(c.columnWidth){c.setSize(Math.floor(c.columnWidth*pw)-c.getEl().getMargins('lr'));}}}});Ext.Container.LAYOUTS['horizontal']=Ext.ux.layout.HorizontalLayout;og.ExtendedDialog=function(config){if(config.html){var panel=new og.HtmlPanel({html:config.html});}else{var panel=new Ext.FormPanel({frame:false,url:'',labelWidth:config.labelWidth,bodyStyle:'padding:20px 20px 0',border:false,bodyBorder:false,items:config.dialogItems});}
config.stateful=false;if(!config.genid)config.genid=Ext.id();og.ExtendedDialog.superclass.constructor.call(this,Ext.applyIf(config,{y:50,id:config.genid+'dialog',layout:'fit',modal:true,height:300,width:450,resizable:false,closeAction:'hide',iconCls:config.iconCls?config.iconCls:'op-ico',border:false,buttons:[{text:(config.YESNO?lang('yes'):lang('ok')),handler:this.accept,hidden:config.noOkBtn,id:config.genid+'ok_button',cls:config.okBtnCls?config.okBtnCls:'',scope:this},{text:(config.YESNO?lang('no'):lang('cancel')),handler:this.cancel,hidden:config.noCancel,id:config.genid+'cancel_button',cls:config.cancelBtnCls?config.cancelBtnCls:'',scope:this}],items:[panel]}));}
Ext.extend(og.ExtendedDialog,Ext.Window,{accept:function(){this.hide();},cancel:function(){this.hide();}});og.ExtendedDialog.show=function(config){if(!config)
config={};if(!config.genid)
config.genid='Extended';if(this.dialog)
this.dialog.destroy();this.dialog=new og.ExtendedDialog(config);if(config.ok_fn){Ext.getCmp(config.genid+'ok_button').setHandler(config.ok_fn);}
if(config.cancel_fn){Ext.getCmp(config.genid+'cancel_button').setHandler(config.cancel_fn);}
this.dialog.purgeListeners();this.dialog.on('hide',og.restoreFlashObjects);this.dialog.on('close',og.restoreFlashObjects);og.hideFlashObjects();this.dialog.show();var pos=this.dialog.getPosition();if(pos[0]<0)pos[0]=0;if(pos[1]<0)pos[1]=0;this.dialog.setPosition(pos[0],pos[1]);return this.dialog;}
og.ExtendedDialog.hide=function(){if(this.dialog)this.dialog.hide();}
og.ExtModal=function(config){config.stateful=false;if(!config.genid)config.genid=Ext.id();og.ExtModal.superclass.constructor.call(this,Ext.applyIf(config,{y:75,id:config.genid+'ext_modal',layout:'fit',cls:'ext-modal-object-list '+config.basecls,modal:true,resizable:false,border:false,title:config.title,html:config.html}));}
Ext.extend(og.ExtModal,Ext.Window,{});og.ExtModal.show=function(config){if(!config)config={};if(this.dialog){this.dialog.destroy();}
this.dialog=new og.ExtModal(config);this.dialog.purgeListeners();this.dialog.show();return this.dialog;}
og.ExtModal.hide=function(){if(this.dialog)this.dialog.hide();}
og.LoginDialog=function(config){if(!config)config={};og.LoginDialog.superclass.constructor.call(this,Ext.apply(config,{id:'og-login-dialog',modal:true,layout:'form',closeAction:'hide',iconCls:'op-ico',title:lang('login'),labelWidth:75,bodyStyle:'padding:5px 5px 0',width:250,defaults:{width:130},defaultType:'textfield',items:[{xtype:'label',style:'color: red',width:240,hideLabel:true,text:lang('login dialog desc')},{id:'username',fieldLabel:lang('username'),name:'username',listeners:{specialkey:{fn:function(field,e){if(e.getKey()==13){this.submit();}},scope:this}}},{id:'password',inputType:'password',fieldLabel:lang('password'),name:'password',listeners:{specialkey:{fn:function(field,e){if(e.getKey()==13){this.submit();}},scope:this}}},{id:'remember',xtype:'checkbox',fieldLabel:'',labelSeparator:'',boxLabel:lang('remember me'),name:'remember'}],buttons:[{text:lang('login'),handler:this.submit,scope:this},{text:lang('cancel'),handler:function(){this.hide()},scope:this}]}));}
Ext.extend(og.LoginDialog,Ext.Window,{submit:function(){if(this.findById('username').getValue()==og.loggedUser.username){og.openLink(og.getUrl('access','relogin'),{post:{"login[username]":this.findById('username').getValue(),"login[password]":this.findById('password').getValue(),"login[remember]":this.findById('remember').getValue()},callback:function(success,data){if(success&&data.errorCode==0){this.hide();if(this.params.url){og.openLink(this.params.url,this.params.options);}}},scope:this});}else{var form=document.createElement('form');form.action=og.getUrl('access','login');form.method='POST';var un=document.createElement('input');un.name='login[username]';un.type='hidden';un.value=this.findById('username').getValue();var pw=document.createElement('input');pw.name='login[password]';pw.type='hidden';pw.value=this.findById('password').getValue();var rm=document.createElement('input');rm.name='login[remember]';rm.type='hidden';rm.value=this.findById('username').getValue()?'checked':'';form.appendChild(un);form.appendChild(pw);form.appendChild(rm);document.body.appendChild(form);form.submit();}}});og.LoginDialog.show=function(url,options){if(!this.dialog){this.dialog=new og.LoginDialog();this.dialog.on('show',function(){this.findById('username').focus();},this.dialog);}
this.dialog.findById('username').setValue(og.loggedUser.username);this.dialog.findById('password').setValue('');this.dialog.params={url:url,options:options};this.dialog.on('hide',og.restoreFlashObjects);this.dialog.on('close',og.restoreFlashObjects);og.hideFlashObjects();this.dialog.show();}
og.HtmlPanel=function(config){var html=config.html;config.html=null;var url=config.url;config.url=null;og.HtmlPanel.superclass.constructor.call(this,Ext.apply(config,{cls:'html-panel'}));if(html){this.load(html);}else if(url){this.get(url);}};Ext.extend(og.HtmlPanel,Ext.Panel,{get:function(url){this.urli=url;if(this.rendered){Ext.Ajax.request({url:og.makeAjaxUrl(url),callback:function(options,success,response){this.load(response.responseText);},scope:this});}},load:function(html){this.htmli=html;if(this.rendered){this.update();}},onRender:function(ct,position){og.HtmlPanel.superclass.onRender.call(this,ct,position);this.rendered=true;if(this.urli){this.get(this.urli);}else{this.update();}},update:function(){this.body.update(this.htmli,true);og.captureLinks(this.id,this.ownerCt);}});Ext.reg("htmlpanel",og.HtmlPanel);og.SimpleMemberSelector=function(config){var mode='remote';if(og.simple_member_selectors&&og.simple_member_selectors.store_cache&&og.simple_member_selectors.store_cache[config.dimensionId]){mode='local';}
if(mode=='local'){var store=new Ext.data.SimpleStore({fields:['value','text'],data:config.options?config.options:[]});var value_field='value';}else{var parameters={genid:config.genid,dimension_id:config.dimensionId,limit:100,offset:0,};var store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({method:"GET",url:og.makeAjaxUrl(og.getUrl('dimension','initial_list_dimension_members_tree',parameters))}),reader:new Ext.data.JsonReader({root:"dimension_members",fields:['id','text'],})});var value_field='id';}
var uid=Ext.id();var combo_config={renderTo:config.renderTo,id:config.id,genid:config.genid,name:config.name,store:store,displayField:'text',mode:mode,triggerAction:'all',selectOnFocus:true,valueField:value_field,valueNotFoundText:''};if(config.tabIndex){combo_config.tabIndex=config.tabIndex;}
if(!config.listeners)config.listeners={};Ext.applyIf(config,combo_config);og.SimpleMemberSelector.superclass.constructor.call(this,config);this.on({select:function(combo,record,index){$(combo.el.dom).val(Ext.util.Format.htmlDecode(og.removeTags($(combo.el.dom).val())));if(!combo.dont_select_associated_member){this.selectAssociatedMembers();}
if(combo.onselect_fn&&typeof combo.onselect_fn=='function'){combo.onselect_fn.call(null,combo);}}});if(!og.simple_member_selectors){og.simple_member_selectors={store_cache:{}};}
if(!og.simple_member_selectors[config.genid]){og.simple_member_selectors[config.genid]={};}
og.simple_member_selectors[config.genid][config.dimensionId]=this;this.init();}
og.buildPlainStoreFromTree=function(tree_members,store_data){for(var i=0;i<tree_members.length;i++){var member=tree_members[i];var mem_name='<span style="margin-left:'+(20*(member.depth-1))+'px">'+member.display_name+'</span>';store_data.push([member.id,mem_name]);og.addMemberToOgDimensions(member.dimension_id,member);if(!member.leaf){og.buildPlainStoreFromTree(member.children,store_data);}}}
Ext.extend(og.SimpleMemberSelector,Ext.form.ComboBox,{init:function(){if(this.mode=='local'){var use_store_cache=false;var cache_date_to_check=new Date();cache_date_to_check.setHours(cache_date_to_check.getHours()-1);if(og.simple_member_selectors.store_cache[this.dimensionId]&&og.simple_member_selectors.store_cache[this.dimensionId].date.getTime()>cache_date_to_check.getTime()){use_store_cache=true;}
if(use_store_cache&&og.simple_member_selectors.store_cache[this.dimensionId].store){var store_data=og.simple_member_selectors.store_cache[this.dimensionId].store;this.store.loadData(store_data);if(this.select_current_context){this.selectCurrentContext();}}else{var parameters={genid:this.genid,dimension_id:this.dimensionId,limit:20000,offset:0,};og.openLink(og.getUrl('dimension','initial_list_dimension_members_tree',parameters),{hideLoading:true,hideErrors:true,callback:function(success,data){if(!success||!data)return;var selector=og.simple_member_selectors[data.genid][data.dimension_id];store_data=[[0,lang('none')]];og.buildPlainStoreFromTree(data.dimension_members,store_data);selector.store.loadData(store_data);og.simple_member_selectors.store_cache[data.dimension_id]={store:store_data,date:new Date(),}
if(selector.select_current_context){selector.selectCurrentContext();}}});}}else{if(this.select_current_context){this.selectCurrentContext();}}},selectMember:function(mem_id){if(this.getValue()==mem_id)return;if(this.mode=='local'){this.setValue(mem_id);if(mem_id>0){var idx=this.store.find(this.valueField,mem_id);var r=this.store.getAt(idx);this.fireEvent('select',this,r,idx);}}else{var options={params:{id:mem_id},callback:function(record,options,success){if(record.length>0){let member_id=record[0].data.id;this.setValue(member_id);if(member_id>0){var idx=this.store.find(this.valueField,member_id);var r=this.store.getAt(idx);this.fireEvent('select',this,r,idx);}}},scope:this};this.store.load(options);}},selectCurrentContext:function(){var sel_members=og.contextManager.getDimensionMembers(this.dimensionId);if(sel_members.length>1){var mem_id=sel_members[1];this.selectMember(mem_id);}},selectAssociatedMembers:function(){var genid=this.genid;var dimension_id=this.dimensionId;var member_id=this.getValue();if(isNaN(member_id)||member_id==0)return;og.openLink(og.getUrl('dimension','get_all_associated_members',{member_id:member_id,dimension_id:dimension_id,genid:genid}),{hideLoading:true,callback:function(success,response_data){if(!response_data)return;var d_associations=[];for(var ot in og.dimension_member_associations[response_data.dimension_id]){for(var j=0;j<og.dimension_member_associations[response_data.dimension_id][ot].length;j++){var association=og.dimension_member_associations[response_data.dimension_id][ot][j];if(association&&!association.is_reverse){d_associations.push(association);}}}
let processed_dimension_ids=[];for(var i=0;i<d_associations.length;i++){var assoc=d_associations[i];if(assoc&&assoc.allows_default_selection){if(processed_dimension_ids.indexOf(assoc.assoc_dimension_id)>=0)continue;processed_dimension_ids.push(assoc.assoc_dimension_id);var data=response_data.associations_data[assoc.id];if(!data)continue;if(og.simple_member_selectors[data.genid]&&og.simple_member_selectors[data.genid][data.dimension_id]){var assoc_selector=og.simple_member_selectors[data.genid][data.dimension_id];if(assoc_selector){if(data.member_ids.length>0){assoc_selector.dont_select_associated_member=true;assoc_selector.selectMember(data.member_ids[0],true);assoc_selector.dont_select_associated_member=false;}else{assoc_selector.selectMember(0);}}}}}}});}});Ext.reg('simple-member-selector',og.SimpleMemberSelector);og.MemberTree=function(config){var tbar=[{xtype:'textfield',id:config.id+'-textfilter',cls:"dimension-panel-textfilter",emptyText:lang('filter members'),listeners:{render:{fn:function(f){f.el.on('keyup',function(e){if(e.target.value.length!=0&&e.target.value.length<og.config.minimum_characters_dimension_search){return false;}
var from_server=true;if(this.tbar.history!=undefined){var now=new Date();var timeDiff=now.getTime()-this.tbar.history.date.getTime();timeDiff=timeDiff/(1000*60);if(timeDiff>10){this.tbar.history=undefined;}}
if(this.tbar.history==undefined){this.tbar.history={prevTextFilters:[],date:new Date()};}
if(this.tbar.history.prevTextFilters.length>0){for(var i=0;i<this.tbar.history.prevTextFilters.length;i++){var prevTextFilter=this.tbar.history.prevTextFilters[i];if(e.target.value.indexOf(prevTextFilter)==0){from_server=false;}}}
this.filterTree(e.target.value,from_server);},this,{buffer:700});},scope:this}}}];var name_to_over="";for(key in og.dimension_object_type_descendants[config.dimensionId]){if(parseInt(key)>0&&og.objectTypes[key]){if(['project_folder','customer_folder'].indexOf(og.objectTypes[key].name)==-1){name_to_over+=og.objectTypes[key].c_name+', ';}}}
name_to_over=name_to_over.slice(0,-2);var show_over_button=name_to_over!=''?lang('add a new custom member in',name_to_over):'';var load_url='index.php?c=dimension&a=initial_list_dimension_members_tree_root&ajax=true&dimension_id='+config.dimensionId+'&avoid_session=1';if(config.loadUrl){load_url=config.loadUrl;}
load_url+=(og.config.member_selector_page_size?'&limit='+og.config.member_selector_page_size:'');var expandM='root';if(config.hidden)expandM='none';Ext.applyIf(config,{region:'center',id:config.id,loader:new og.MemberChooserTreeLoader({dataUrl:load_url,ownerTree:this}),autoScroll:true,root:{text:config.root_node_text?config.root_node_text:lang('view all'),id:0,href:"#",iconCls:'root',cls:'root'},enableDrop:true,ddGroup:'MemberDD',collapseFirst:false,collapsible:true,selModel:(config.multipleSelection)?new Ext.tree.MultiSelectionModel():new Ext.tree.DefaultSelectionModel(),dimensionId:config.dimensionId,dimensionCode:config.dimensionCode,cls:config.dimensionCode,reloadHidden:false,height:210,animate:false,tools:[{id:'toggle',handler:function(e,t,p){p.toggleCollapse();},hidden:!og.preferences['can_modify_navigation_panel']},{id:'options',qtip:show_over_button,handler:function(e,t,p){og.quickForm({dimensionId:p.dimensionId,type:'member',treeId:p.dimensionId,elId:t.id});}}],toolTemplate:new Ext.XTemplate('<tpl if="id==\'options\'">','<buton type="" class="btn btn-xs btn-primary x-tool x-tool-{id}"><div class="x-tool x-tool-{id}-ico">&#160;</div>'+lang("new")+'</buton>','</tpl>','<tpl if="id!=\'options\'">','<div class="x-tool x-tool-{id}">&#160;</div>','</tpl>'),hideCollapseTool:true,expandMode:expandM,tbar:tbar});config.initialLoader=config.loader;if(!config.listeners)config.listeners={};Ext.apply(config.listeners,{beforenodedrop:function(e){if(this.disable_default_events)return;if(!isNaN(e.target.id)&&e.data.grid){var has_relations=false;var ids=[];for(var i=0;i<e.data.selections.length;i++){if(isNaN(e.data.selections[i].data.object_id))continue;ids.push(e.data.selections[i].data.object_id);if(!has_relations){var mpath=Ext.util.JSON.decode(e.data.selections[i].data.memPath);if(mpath&&mpath[config.dimensionId])has_relations=true;}}
function selectionHasAttachments(){if(Ext.getCmp('mails-manager')!=undefined){var sm=Ext.getCmp('mails-manager').getSelectionModel();var selections=sm.getSelections();if(selections.length<=0){return false;}else{for(var i=0;i<selections.length;i++){if(selections[i].data.hasAttachment||selections[i].data.conv_hasatt){return true;}}
sm.clearSelections();return false;}}else{return false;}}
this.selectionHasAttachments=selectionHasAttachments;var first_selected_row=null;for(var j=0;j<e.data.selections.length;j++){var sel_row=e.data.selections[j];if(!sel_row)continue;if(sel_row.id!='quick_add_row'&&sel_row.id!='#__total_row__'&&sel_row.data.ot_id){first_selected_row=sel_row;break;}}
if(first_selected_row&&first_selected_row.data&&e.target&&og.dimension_object_type_contents[config.dimensionId]&&og.dimension_object_type_contents[config.dimensionId][e.target.object_type_id]&&og.dimension_object_type_contents[config.dimensionId][e.target.object_type_id][first_selected_row.data.ot_id]&&og.dimension_object_type_contents[config.dimensionId][e.target.object_type_id][first_selected_row.data.ot_id].multiple){if(this.selectionHasAttachments()&&e.target.id){if(og.preferences['mail_drag_drop_prompt']=='prompt'){var attachment=confirm(lang('do you want to classify the unclassified emails attachments',config.title))?"1":"0";}else if(og.preferences['mail_drag_drop_prompt']=='classify'){var attachment=1;}else if(og.preferences['mail_drag_drop_prompt']=='dont'){var attachment=0;}}
if(has_relations&&og.preferences['drag_drop_prompt']=='prompt'){og.drag_drop_classification_keep_or_move_prompt(genid,e,ids,e.target.id,attachment,true);}else{if(og.preferences['drag_drop_prompt']=='move'){var rm_prev=1;}else if(og.preferences['drag_drop_prompt']=='keep'){var rm_prev=0;}else{var rm_prev=0;}
og.call_add_objects_to_member(e,ids,e.target.id,attachment,true,rm_prev);}}else{if(this.selectionHasAttachments()&&e.target.id){if(og.preferences['mail_drag_drop_prompt']=='prompt'){var attachment=confirm(lang('do you want to classify the unclassified emails attachments',config.title))?"1":"0";}else if(og.preferences['mail_drag_drop_prompt']=='classify'){var attachment=1;}else if(og.preferences['mail_drag_drop_prompt']=='dont'){var attachment=0;}}
var dim_id=e.target.attributes.dimension_id;if(og.dimension_member_associations[dim_id]&&og.dimension_member_associations[dim_id][e.target.object_type_id]&&og.dimension_member_associations[dim_id][e.target.object_type_id].length>0){var obj_type_name='object';if(e.data&&e.data.grid&&e.data.grid.type_name){obj_type_name=lang(e.data.grid.type_name);}
var mem_type_name=og.objectTypes[e.target.object_type_id].c_name;var assoc_dim_names='';for(var i=0;i<og.dimension_member_associations[dim_id][e.target.object_type_id].length;i++){var assoc=og.dimension_member_associations[dim_id][e.target.object_type_id][i];assoc_dim_names+=(assoc_dim_names==''?'':', ')+assoc.name;}
var div=document.createElement('div');var question=lang('do you want to reclassify in memtype associated dimensions',obj_type_name,mem_type_name,assoc_dim_names);div.style="border-radius: 5px; background-color: #fff; padding: 10px; width: 400px;";var genid=Ext.id();div.innerHTML='<div><label class="coInputTitle">'+lang('classification in associated members')+'</label></div>'+'<div id="'+genid+'_question">'+question+'</div>'+'<div id="'+genid+'_buttons">'+'<button class="yes submit blue">'+lang('yes')+'</button><button class="no submit blue">'+lang('no')+'</button>'+'</div><div class="clear"></div>';var modal_params={'escClose':false,'overlayClose':false,'closeHTML':'<a id="'+genid+'_close_link" class="modal-close" title="'+lang('close')+'"></a>','onShow':function(dialog){$("#"+genid+"_close_link").addClass("modal-close-img");$("#"+genid+"_buttons").css('text-align','right').css('margin','10px 0');$("#"+genid+"_question").css('margin','10px 0');$("#"+genid+"_buttons button.yes").css('margin-right','10px').click(function(){og.call_add_objects_to_member(e,ids,e.target.id,attachment,true);$('.modal-close').click();});$("#"+genid+"_buttons button.no").css('margin-right','10px').click(function(){og.call_add_objects_to_member(e,ids,e.target.id,attachment);$('.modal-close').click();});}};setTimeout(function(){$.modal(div,modal_params);},100);}else{og.call_add_objects_to_member(e,ids,e.target.id,attachment);}}}else{if(e.target.getDepth()==0){var has_relations=false;var ids=[];for(var i=0;i<e.data.selections.length;i++){ids.push(e.data.selections[i].data.object_id);if(!has_relations){var mpath=Ext.util.JSON.decode(e.data.selections[i].data.memPath);if(mpath&&mpath[config.dimensionId])has_relations=true;}}
og.openLink(og.getUrl('member','add_objects_to_member'),{method:'POST',post:{objects:Ext.util.JSON.encode(ids),dimension:e.target.getOwnerTree().dimensionId},callback:function(){e.data.grid.load();}});}}
return false;}});og.MemberTree.superclass.constructor.call(this,config);var self=this;this.on({expandnode:function(node){if(node&&isNaN(node.id)&&node.id.indexOf('view_more_')>=0){return;}
if(node.childNodes.length<node.attributes.realTotalChilds&&node.attributes.expandable&&!node.attributes.gettingChildsFromServer){node.ownerTree.innerCt.mask();node.attributes.gettingChildsFromServer=true;if(!node.last_childs_offset){node.last_childs_offset=0;}else{node.last_childs_offset=node.last_childs_offset+og.config.member_selector_page_size;}
var limit=og.config.member_selector_page_size;var parameters={member:node.id,limit:limit,tree_id:this.id,offset:node.last_childs_offset,ignore_context_filters:!this.filterOnChange,context:og.contextManager.plainContext()};if(node.ownerTree.initialConfig.get_childs_params){for(p_name in node.ownerTree.initialConfig.get_childs_params){if(typeof(node.ownerTree.initialConfig.get_childs_params[p_name])=='function')continue;parameters[p_name]=node.ownerTree.initialConfig.get_childs_params[p_name];}}
og.openLink(og.getUrl('dimension','get_member_childs',parameters),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp(data.tree_id);if(dimension_tree){dimension_tree.addMembersToTree(data.members,data.dimension);if(data.more_nodes_left){og.addViewMoreNode(node,data.tree_id,og.ajaxMemberTreeViewMoreCallback);}else{var old_view_more_node=dimension_tree.getNodeById('view_more_'+node.id);if(old_view_more_node)old_view_more_node.remove();}
dimension_tree.innerCt.unmask();var current_node=dimension_tree.getNodeById(data.member_id);if(current_node)current_node.attributes.gettingChildsFromServer=false;}}});}else{for(var i=0;i<node.childNodes.length;i++){var child=node.childNodes[i];child.getUI().show();}}},click:function(node,e){if(this.disable_default_events)return;if(node&&isNaN(node.id)&&node.id.indexOf('view_more_')>=0){return;}
og.contextManager.currentDimension=self.dimensionId;og.eventManager.fireEvent("member tree node click",node);var treeConf=node.attributes.loader.ownerTree.initialConfig;if(node.getDepth()==0){og.contextManager.cleanActiveMembers(this.dimensionId);if(treeConf.dimensionOptions.defaultAjax){var controller=treeConf.dimensionOptions.defaultAjax.controller;var action=treeConf.dimensionOptions.defaultAjax.action;if(controller&&action){og.customDashboard(controller,action,{},true);}}
var trees=this.ownerCt.items;if(trees){trees.each(function(item,index,length){var must_reload=false;if(self.reloadDimensions){for(ot_id in self.reloadDimensions){if(self.reloadDimensions[ot_id]&&typeof(self.reloadDimensions[ot_id].indexOf)=='function'&&self.reloadDimensions[ot_id].indexOf(item.dimensionId)!=-1){must_reload=true;}}}
if(self.id!=item.id&&(!item.hidden||item.reloadHidden)&&must_reload){item.getRootNode().suspendEvents();item.getRootNode().select();item.getRootNode().resumeEvents();}});}}
if(node.getDepth()>0){node.ownerTree.suspendEvents();node.ensureVisible();node.select();node.expand();node.ownerTree.resumeEvents();if(node.childNodes.length<node.attributes.realTotalChilds&&node.attributes.expandable&&!node.attributes.gettingChildsFromServer){node.ownerTree.innerCt.mask();node.attributes.gettingChildsFromServer=true;og.openLink(og.getUrl('dimension','get_member_childs',{member:node.id,ignore_context_filters:!this.filterOnChange,tree_id:this.id}),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp(data.tree_id);dimension_tree.addMembersToTree(data.members,data.dimension);var current_node=dimension_tree.getNodeById(data.member_id);current_node.attributes.gettingChildsFromServer=false;dimension_tree.innerCt.unmask();}});}else{for(var i=0;i<node.childNodes.length;i++){var child=node.childNodes[i];child.getUI().show();}}}},dblclick:function(node,e){if(this.disable_default_events)return;og.contextManager.currentDimension=self.dimensionId;og.eventManager.fireEvent("member tree node dblclick",node);var treeConf=node.attributes.loader.ownerTree.initialConfig;if(node.getDepth()>0&&node.actions&&node.actions.length>0){for(var i=0;i<node.actions.length;i++){var action=node.actions[i];if(action['class']=='action-edit'&&action.url){og.render_modal_form('',{url:action.url});return;}}}}});this.getSelectionModel().on({selectionchange:function(sm,selection){if(this.disable_default_events)return;if(selection&&isNaN(selection.id)&&selection.id.indexOf('view_more_')>=0){return;}
if(selection&&!this.pauseEvents){var selection_changed=og.contextManager.getDimensionMembers(this.dimensionId).indexOf(selection.id)==-1;og.contextManager.cleanActiveMembers(this.dimensionId);if(!this.isMultiple()){var node=selection;if(node.getDepth()){var member=node.attributes.id;if(node.attributes.allow_childs){$('#'+this.id+" .member-quick-form-link").show();}else{$('#'+this.id+" .member-quick-form-link").hide();}}else{$('#'+this.id+" .member-quick-form-link").show();var member=0;}
if(!this.hidden){og.contextManager.addActiveMember(member,this.dimensionId,node);}
if(this.filterOnChange){var trees=this.ownerCt.items;if(trees){this.suspendEvents();this.totalFilterTrees=0;this.filteredTrees=0;var selected_members=[];if(!og.resettingAllTrees){trees.each(function(item,index,length){var sel=item.getSelectionModel().getSelectedNode();if(sel&&!isNaN(sel.attributes.id))selected_members.push(sel.attributes.id);});}
trees.each(function(item,index,length){var must_reload=false;if(self.reloadDimensions&&self.reloadDimensions[node.object_type_id]){for(var k=0;k<self.reloadDimensions[node.object_type_id].length;k++){var reload_dim_id=parseInt(self.reloadDimensions[node.object_type_id][k]);if(reload_dim_id==parseInt(item.dimensionId)){must_reload=true;break;}}}
if(self.id!=item.id&&(!item.hidden||item.reloadHidden)&&(must_reload||item.is_filtered_by)){self.totalFilterTrees++;if(item.disableReloadOtherDimensions){item.disableReloadOtherDimensions=false;}else{var n=og.resettingAllTrees?item.getRootNode():node;item.prevSelection=og.contextManager.getDimensionMembers(item.dimensionId);og.contextManager.cleanActiveMembers(item.dimensionId);item.filterByMember(selected_members,n,function(){self.filteredTrees++;if(self.filteredTrees==self.totalFilterTrees){self.resumeEvents();og.eventManager.fireEvent('member trees updated',n);if(selection_changed&&!item.resettingAllTrees){if(item.sel_mem_count==0){og.eventManager.fireEvent('member changed',n);}}}});}
item.is_filtered_by=must_reload;}});if(this.totalFilterTrees==0){this.resumeEvents();og.eventManager.fireEvent('member trees updated',node);if(selection_changed&&!og.resettingAllTrees){og.eventManager.fireEvent('member changed',node);}}}}
var type=node.attributes.object_type_id;og.contextManager.lastSelectedNode=node;og.contextManager.lastSelectedDimension=this.dimensionId;og.contextManager.lastSelectedMemberType=type;}else{for(var i=0;i<selection.length;i++){var node=selection[i];if(node.getDepth()){var member=node.attributes.id;}else{var member=0;}
og.contextManager.addActiveMember(member,this.dimensionId,node);}}}},scope:this});this.init(function(){self.selectRoot([0]);setTimeout(function(){if(self.totalNodes>1000){self.collapseAll();self.root.expand();}},100);});};Ext.extend(og.MemberTree,Ext.tree.TreePanel,{filterOnChange:false,filterTree:function(text,from_server){if(from_server==undefined){var from_server=true;}
if(text==this.getTopToolbar().items.get(this.id+'-textfilter').emptyText){text="";}
if(text.trim()==''){this.clearFilter();}else{var re=new RegExp(Ext.escapeRe(text.toLowerCase()),'i');if(from_server){this.innerCt.mask();var d=new Date();this.tbar.last_search_time=d.getTime();var dimension_id=this.dimensionId?this.dimensionId:this.id.replace("dimension-panel-","");og.last_search_request_id=og.openLink(og.getUrl('dimension','search_dimension_members_tree',{dimension_id:dimension_id,tree_id:this.id,query:Ext.escapeRe(text.toLowerCase()),time:d.getTime()}),{hideLoading:true,hideErrors:true,callback:function(success,data){if(success){var dimension_tree=Ext.getCmp(data.tree_id);if(dimension_tree.tbar.last_search_time!=data.time){dimension_tree.innerCt.unmask();return;}
dimension_tree.addMembersToTree(data.members,data.dimension_id);dimension_tree.innerCt.unmask();var search_text=dimension_tree.getTopToolbar().items.get(dimension_tree.id+'-textfilter').el.getValue();re_search_text=new RegExp(Ext.escapeRe(search_text.toLowerCase()),'i');if(data.query&&data.query.trim()!=''){if(dimension_tree.tbar.history==undefined){dimension_tree.tbar.history={prevTextFilters:[],date:new Date()};}
dimension_tree.tbar.history.prevTextFilters.push(data.query);}
dimension_tree.filterNode(dimension_tree.getRootNode(),re_search_text);dimension_tree.suspendEvents();dimension_tree.expandAll();dimension_tree.resumeEvents();}}});}else{this.filterNode(this.getRootNode(),re);this.suspendEvents();this.expandAll();this.resumeEvents();}}},filterNode:function(n,re){var f=false;var c=n.firstChild;while(c){f=this.filterNode(c,re)||f;c=c.nextSibling;}
f=re.test(Ext.util.Format.htmlDecode(n.text.toLowerCase()))||f;if(!n.previousState){n.previousState=n.expanded?"e":"c";}
if(f){n.getUI().show();}else{n.getUI().hide();}
return f;},clearFilter:function(n){if(!n)n=this.getRootNode();if(!n.previousState)return;var c=n.firstChild;while(c){this.clearFilter(c);c=c.nextSibling;}
n.getUI().show();this.collapseAll();if(n.previousState=="e"){n.expand(false,false);}else if(n.previousState=="c"){n.collapse(false,false);}
n.previousState=null;},expandedNodes:function(){nodes=[];nodes=nodes.concat(this.root.expandedNodes());return nodes;},init:function(callback){new Ext.tree.TreeSorter(this,{dir:"asc",property:"text",sortType:function(node){if(isNaN(node.id)&&node.id.indexOf('view_more_')==0){var last_char=String.fromCharCode(126);return last_char+last_char+last_char+node.text;}
if(node.attributes&&node.attributes.sort_key){return og.replaceStringAccents(node.attributes.sort_key).toLowerCase();}else if(node.sort_key){return og.replaceStringAccents(node.sort_key).toLowerCase();}else{return og.replaceStringAccents(node.text).toLowerCase();}}});switch(this.expandMode){case"all":this.expandAll(callback);break;case"root":this.root.expand(0,0,callback);break;case"none":default:break;}},isMultiple:function(){return(this.getSelectionModel().constructor.toString().indexOf("Array")!=-1);},selectRoot:function(){selModel=this.getSelectionModel();selModel.suspendEvents();var node=this.getRootNode();selModel.select(node);if(!this.hidden)og.contextManager.addActiveMember(0,this.dimensionId,node);selModel.resumeEvents();},hide:function(){og.MemberTree.superclass.hide.call(this);og.contextManager.cleanActiveMembers(this.dimensionId);},show:function(){og.MemberTree.superclass.show.call(this);og.contextManager.cleanActiveMembers(this.dimensionId);this.selectRoot();},selectNodes:function(nids){if(og.resettingAllTrees){nids=[];}
var mem_count=0;for(var i=0;i<nids.length;i++){if(nids[i]!="undefined"){var node_loaded=false;if(nids[i]!=0){var node=this.getNodeById(nids[i]);node_loaded=this.loaded_member_ids.indexOf(nids[i])>=0;if(node_loaded){var member_obj=og.dimensions[this.dimensionId][nids[i]];if(member_obj){var pnode=member_obj?og.dimensions[this.dimensionId][member_obj.parent]:null;while(pnode!=null&&pnode.id!=this.getRootNode().id){if(pnode.id>0){og.eventManager.fireEvent('try to expand member',{id:pnode.id,dimension_id:this.dimensionId});}
pnode=pnode.parent>0?og.dimensions[this.dimensionId][pnode.parent]:null;}}
og.eventManager.fireEvent('try to select member',{id:nids[i],dimension_id:this.dimensionId});}}else{continue;}
if(node_loaded&&nids[i]>0){var dimensions_to_reload=this.reloadDimensions;var trees=this.ownerCt.items;if(trees){trees.each(function(item,index,length){for(ot in dimensions_to_reload){var dims_array=dimensions_to_reload[ot];for(var k=0;k<dims_array.length;k++){var reload_dim_id=parseInt(dims_array[k]);if(reload_dim_id==parseInt(item.dimensionId)){item.disableReloadOtherDimensions=true;break;}}}});}
mem_count++;}}}
if(mem_count==0){og.contextManager.cleanActiveMembers(this.dimensionId);}
return mem_count;},expandNodes:function(nids,callback){for(var i=0;i<nids.length;i++){if(nids[i]!="undefined"){if(nids[i]!=0){var node=this.getNodeById(nids[i]);}else{var node=this.getRootNode();}
if(node){node.expand();}}}},hideRoot:function(){this.addClass("root-hidden");},showRoot:function(){this.removeClass("root-hidden");},filterByMember:function(memberIds,nodeClicked,callback){var tree=this;var expandedNodes=tree.expandedNodes();var selectedMembers=og.resettingAllTrees?[]:og.contextManager.getDimensionMembers(this.dimensionId);if(selectedMembers.length<=1&&this.prevSelection&&this.prevSelection.length>1){selectedMembers=this.prevSelection;this.prevSelection=[0];}
tree.expandMode="root";tree.getTopToolbar().container.history=undefined;this.resettingAllTrees=og.resettingAllTrees;this.loader=new og.MemberChooserTreeLoader({dataUrl:'index.php?c=dimension&a=initial_list_dimension_members_tree_root&ajax=true&dimension_id='+this.dimensionId+'&selected_ids='+Ext.util.JSON.encode(memberIds)+'&avoid_session=1',ownerTree:this});this.loader.load(this.getRootNode(),function(loader,node,response_object){tree.init(function(){var was_filtered=true;if(response_object&&response_object.list_was_filtered_by){if(response_object.list_was_filtered_by.length==0){was_filtered=false;}}
var expand=response_object&&!(response_object.list_was_filtered_by&&response_object.list_was_filtered_by.length>0);if(nodeClicked.getDepth()>0&&expand){og.expandAllChildNodes(tree.getRootNode());}
if(tree.expandMode!="all"){tree.expandNodes(expandedNodes);}
tree.sel_mem_count=tree.selectNodes(selectedMembers);if(typeof callback=="function"){callback();}
tree.resettingAllTrees=false;});});},removeFromContext:function(){this.hide();this.collapse();this.getSelectionModel().select(this.getRootNode());var did=this.dimensionId;Ext.getCmp("dimension-selector-"+did).suspendEvents();Ext.getCmp("dimension-selector-"+did).setChecked(false);Ext.getCmp("dimension-selector-"+did).resumeEvents();},addMembersToTree:function(members,dimension_id){var all_parent_nodes_involved=[];var dimension_tree=this;for(var prop in members){var mem=members[prop];if(typeof dimension_tree.allowedMemberTypes!="undefined"){if(dimension_tree.allowedMemberTypes.indexOf(mem.object_type_id)==-1){continue;}}
var new_node=dimension_tree.loader.createNode(mem);var node_parent=dimension_tree.getNodeById(mem.parent);if(mem.parent==0){node_parent=dimension_tree.getRootNode();}
var node_exist=dimension_tree.getNodeById(mem.id);if(!node_exist){dimension_tree.suspendEvents();if(node_parent)node_parent.appendChild(new_node);dimension_tree.resumeEvents();}else{if(node_parent){node_exist.attributes=mem;node_exist.setText(mem.text);}}
if(node_parent){all_parent_nodes_involved[node_parent.id]=node_parent;}
og.addMemberToOgDimensions(dimension_id,mem);}
for(var i in all_parent_nodes_involved){var pn=all_parent_nodes_involved[i];if(pn&&typeof(pn)=='object'){pn.sort(og.sortNodesFn);}}},onMemberExternalClick:function(member_id){var n=this.getNodeById(member_id);if(n){if(n.parentNode)this.expandPath(n.parentNode.getPath(),false);if(n.getOwnerTree())n.select();og.eventManager.fireEvent('member tree node click',n);}else{this.innerCt.mask();og.openLink(og.getUrl('dimension','get_member_parents',{member:member_id}),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp('dimension-panel-'+data.dimension_id);if(dimension_tree){if(dimension_tree.hidden){dimension_tree.show();dimension_tree.expand();dimension_tree.getRootNode().expand();dimension_tree.innerCt.unmask();Ext.getCmp("dimension-selector-"+data.dimension_id).setChecked(true,true);if(data.members&&data.members.length>0){for(var i=0;i<data.members.length;i++){var mem=data.members[i];if(mem.id==data.member_id){break;}else{og.eventManager.fireEvent('try to expand member',{id:mem.id,dimension_id:data.dimension_id});}}}
og.eventManager.fireEvent('try to select member',{id:data.member_id,dimension_id:data.dimension_id});dimension_tree.root.sort(og.sortNodesFn);}else{dimension_tree.addMembersToTree(data.members,data.dimension_id);dimension_tree.innerCt.unmask();var n=dimension_tree.getNodeById(data.member_id);if(n){dimension_tree.suspendEvents();if(n.parentNode){dimension_tree.expandPath(n.parentNode.getPath(),false);n.parentNode.sort(og.sortNodesFn);}else{dimension_tree.root.sort(og.sortNodesFn);}
dimension_tree.resumeEvents();if(n.getOwnerTree())n.select();og.eventManager.fireEvent('member tree node click',n);}}}}});}}});Ext.reg('member-tree',og.MemberTree);og.updateDimensionTreeNode=function(dimension_id,member,extra_params){var dimension_tree=Ext.getCmp('dimension-panel-'+dimension_id);var node_parent=dimension_tree.getNodeById(member.parent);if(member.parent==0){node_parent=dimension_tree.root;}
member.leaf=!member.expandable;member.text=member.name;var new_node=dimension_tree.loader.createNode(member);var node_exist=dimension_tree.getNodeById(member.id);if(!node_exist){if(node_parent)node_parent.appendChild(new_node);}else{if(node_exist.parentNode.attributes.id==member.parent||(node_exist.parentNode.isRoot&&member.parent==0)){node_parent.removeChild(node_exist);}else{node_exist.parentNode.removeChild(node_exist);}
node_parent.appendChild(new_node);if(!node_parent.isExpanded()){dimension_tree.suspendEvents();node_parent.expand();dimension_tree.resumeEvents();}}
new_node.ensureVisible();if(extra_params.select_node){dimension_tree.suspendEvents();new_node.select();dimension_tree.resumeEvents();og.eventManager.fireEvent('member tree node click',new_node);}
if(new_node.attributes.expandable)new_node.expand();dimension_tree.root.sort(og.sortNodesFn);}
og.sortNodesFn=function(node1,node2){if(node1&&node2){if(node1.attributes&&node1.attributes.sort_key&&node2.attributes&&node2.attributes.sort_key){return node1.attributes.sort_key.toLowerCase().localeCompare(node2.attributes.sort_key.toLowerCase());}else if(node1.sort_key&&node2.sort_key){return node1.sort_key.toLowerCase().localeCompare(node2.sort_key.toLowerCase());}else{return node1.text.toLowerCase().localeCompare(node2.text.toLowerCase());}}}
og.MemberTreeAjax=function(config){var tbar=[{xtype:'textfield',id:config.id+'-textfilter',cls:"dimension-panel-textfilter ico-search-m search-filter",emptyText:'',listeners:{render:{fn:function(f){f.el.on('keyup',function(e){var from_server=true;if(this.tbar.history!=undefined){var now=new Date();var timeDiff=now.getTime()-this.tbar.history.date.getTime();timeDiff=timeDiff/(1000*60*60);if(timeDiff>24){this.tbar.history=undefined;}}
if(this.tbar.history==undefined){this.tbar.history={prevTextFilters:[],date:new Date()};}
if(this.tbar.history.prevTextFilters.length>0){for(var i=0;i<this.tbar.history.prevTextFilters.length;i++){var prevTextFilter=this.tbar.history.prevTextFilters[i];if(e.target.value.indexOf(prevTextFilter)==0){from_server=false;}}}
if(from_server&&e.target.value.trim()!=''){this.tbar.history.prevTextFilters.push(e.target.value);}
this.filterTree(e.target.value,from_server);},this,{buffer:350});},scope:this}}}];var expandM='root';if(config.hidden)expandM='none';var isrootVisible=false;if(!config.isMultiple)isrootVisible=true;Ext.applyIf(config,{region:'center',id:config.id,autoScroll:true,root:{text:lang('view all'),id:0,href:"#",iconCls:'root',cls:'root'},enableDrop:true,lines:false,rootVisible:isrootVisible,ddGroup:'MemberDD',collapseFirst:false,collapsible:true,selModel:(config.multipleSelection)?new Ext.tree.MultiSelectionModel():new Ext.tree.DefaultSelectionModel(),dimensionId:config.dimensionId,selectFunction:config.selectFunction,genid:config.genid,dimensionCode:config.dimensionCode,cls:config.dimensionCode+" single-tree single-tree-right",reloadHidden:false,height:210,width:265,animate:false,hideCollapseTool:true,expandMode:expandM,tbar:tbar});if(!config.listeners)config.listeners={};og.MemberTreeAjax.superclass.constructor.call(this,config);var self=this;this.on({expandnode:function(node){if(node.childNodes.length<node.attributes.realTotalChilds&&node.attributes.expandable){node.ownerTree.innerCt.mask();node.attributes.gettingChildsFromServer=true;if(!node.last_childs_offset){node.last_childs_offset=0;}else{node.last_childs_offset=node.last_childs_offset+og.config.member_selector_page_size;}
var limit=og.config.member_selector_page_size;var parameters={member:node.id,limit:limit,ignore_context_filters:true,offset:node.last_childs_offset,tree_id:node.ownerTree.id};if(member_selector[this.genid]&&member_selector[this.genid].sel_context){var current_selected_member_ids=[];for(c_dim_id in member_selector[this.genid].sel_context){var c_mems=member_selector[this.genid].sel_context[c_dim_id];for(var i=0;i<c_mems.length;i++){current_selected_member_ids.push(c_mems[i]);}}}
if(node.ownerTree.initialConfig.get_childs_params){for(p_name in node.ownerTree.initialConfig.get_childs_params){if(typeof(node.ownerTree.initialConfig.get_childs_params[p_name])=='function')continue;parameters[p_name]=node.ownerTree.initialConfig.get_childs_params[p_name];}}
og.openLink(og.getUrl('dimension','get_member_childs',parameters),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp(data.tree_id);dimension_tree.suspendEvents();dimension_tree.addMembersToTree(data.members,data.dimension_id);dimension_tree.resumeEvents();for(var i=0;i<node.childNodes.length;i++){node.childNodes[i].getUI().show();}
if(data.more_nodes_left){og.addViewMoreNode(node,data.tree_id,og.ajaxMemberTreeViewMoreCallback);}else{var old_view_more_node=dimension_tree.getNodeById('view_more_'+node.id);if(old_view_more_node)old_view_more_node.remove();}
dimension_tree.innerCt.unmask();var current_node=dimension_tree.getNodeById(data.member_id);if(current_node)current_node.attributes.gettingChildsFromServer=false;}});}else{for(var i=0;i<node.childNodes.length;i++){node.childNodes[i].getUI().show();}}},click:function(node,e){this.clearFilter();$("#"+this.id+'-textfilter').val("");if(node.getDepth()>0){node.ensureVisible();node.select();var params='"'+this.genid+'",'+node.attributes.dimension_id+','+node.attributes.id+',"'+member_selector[this.genid].hiddenFieldName+'"';eval(this.selectFunction+'('+params+')');if(this.selectFunction==""){member_selector.add_relation(node.attributes.dimension_id,this.genid,node.attributes.id);}
if(node.getOwnerTree()){$("#"+node.getOwnerTree().id+"-current-selected .empty-text").hide();}}else{var params='"'+this.genid+'",'+this.dimensionId+','+0+',"'+member_selector[this.genid].hiddenFieldName+'"';eval(this.selectFunction+'('+params+')');if(!this.isMultiple&&node.getOwnerTree()){$("#"+node.getOwnerTree().id+"-current-selected .empty-text").show();}
if(!this.isMultiple){member_selector.remove_all_dimension_selections(this.genid,this.dimensionId);}}
node.ownerTree.body.removeClass("have-focus");node.ownerTree.body.hide();},render:function(tree){this.body.setVisibilityMode(Ext.Element.DISPLAY);this.body.toggle();this.body.addClass("collapsible-body");var tree=this;$("#"+tree.id+'-textfilter').attr("placeholder",tree.initialConfig.search_placeholder);if(!this.isMultiple){if(!og.tree_focus)og.tree_focus={};$("#"+tree.id+'-textfilter').hide();$("#"+tree.id+'-textfilter').closest('.x-panel-tbar').attr("tabindex",-1);$("#"+tree.id+'-textfilter').parent().append("<div id='"+tree.id+"-current-selected' class='single_current_selected ico-search-m'><div class='empty-text'>"+tree.getRootNode().text+"</div></div>");$("#"+tree.id+'-textfilter').closest('.x-panel-tbar').focusin(function(e){$("#"+tree.id+'-textfilter').addClass("filter-has-focus");$("#"+tree.id+'-textfilter').show();$("#"+tree.id+'-textfilter').select();$("#"+tree.id+'-current-selected').hide();setTimeout(function(){tree.body.show();var top=$("#"+tree.tbar.id).offset().top+$("#"+tree.tbar.id).height();$("#"+tree.body.id).css({top:top+'px'});tree.adjustDropDownListHeight();if(!tree.initialized){tree.initialized=true;tree.init();}},300);});$("#"+tree.id+'-textfilter').closest('.x-panel-tbar').focusout(function(e){if(!$("#"+tree.id+'-textfilter').hasClass("filter-has-focus")){$("#"+tree.id+'-textfilter').hide();$("#"+tree.id+'-current-selected').show();}
setTimeout(function(){if(!tree.body.hasClass("have-focus")){tree.body.hide();tree.clearFilter();}
$("#"+tree.id+'-textfilter').val("");$("#"+tree.id+'-textfilter').removeClass("filter-has-focus");},300);});}else{$("#"+this.tbar.id).focusin(function(){if(!og.dont_show_tree||og.dont_show_tree!=tree.dimensionId){setTimeout(function(){tree.body.show();var top=$("#"+tree.tbar.id).offset().top+$("#"+tree.tbar.id).height();$("#"+tree.body.id).css({top:top+'px'});tree.adjustDropDownListHeight();if(!tree.initialized){tree.initialized=true;tree.init();}},300);}});$("#"+this.tbar.id).keyup(function(){if($("#"+tree.body.id).css('display')=='none'){$(this).focus();}});$("#"+this.tbar.id).focusout(function(){setTimeout(function(){if(!tree.body.hasClass("have-focus")){tree.body.hide();tree.clearFilter();$("#"+tree.id+'-textfilter').val("");}},300);});}
var cont=$("#"+this.body.id);cont.attr("tabindex",-1);cont.focusin(function(){cont.addClass("have-focus");});cont.focusout(function(){cont.removeClass("have-focus");setTimeout(function(){tree.body.hide();tree.clearFilter();$("#"+tree.id+'-textfilter').val("");},200);});}});this.getSelectionModel().on({selectionchange:function(sm,selection){},scope:this});this.initialized=false;var root_lang=lang('none');if(config.root_lang){root_lang=config.root_lang;}
var root=new Ext.tree.TreeNode({text:root_lang,expandable:true,hidden:true,id:0,href:"#",iconCls:'ico-folder',cls:'root'});this.setRootNode(root);};Ext.extend(og.MemberTreeAjax,Ext.tree.TreePanel,{filterOnChange:true,filterTree:function(text,from_server){if(from_server==undefined){var from_server=true;}
if(text==this.getTopToolbar().items.get(this.id+'-textfilter').emptyText){text="";}
if(text.trim()==''){this.clearFilter();}else{var re=new RegExp(Ext.escapeRe(text.toLowerCase()),'i');if(from_server){this.innerCt.mask();var tree_id=this.id;var options={dimension_id:this.dimensionId,query:Ext.escapeRe(text.toLowerCase()),ignore_context_filters:true};if(this.initialConfig.filter_by_ids){options.filter_by_ids=this.initialConfig.filter_by_ids;}
og.openLink(og.getUrl('dimension','search_dimension_members_tree',options),{hideLoading:true,hideErrors:true,callback:function(success,data){var dimension_tree=Ext.getCmp(tree_id);dimension_tree.addMembersToTree(data.members,data.dimension_id);dimension_tree.innerCt.unmask();var search_text=dimension_tree.getTopToolbar().items.get(dimension_tree.id+'-textfilter').el.getValue();re_search_text=new RegExp(Ext.escapeRe(search_text.toLowerCase()),'i');dimension_tree.filterNode(dimension_tree.getRootNode(),re_search_text);dimension_tree.suspendEvents();dimension_tree.expandAll();dimension_tree.resumeEvents();}});}else{this.filterNode(this.getRootNode(),re);this.suspendEvents();this.expandAll();this.resumeEvents();}}},filterByMember:function(memberIds,nodeClicked,callback,options){while(n=this.getRootNode().childNodes[0]){this.getRootNode().removeChild(n);}
if(!options)options={};options.dimension_id=this.dimensionId;options.selected_ids=Ext.util.JSON.encode(memberIds);options.avoid_session=1;options.node_clicked=nodeClicked?(isNaN(nodeClicked)?nodeClicked.id:nodeClicked):null;if(this.initialConfig.filter_by_ids){options.filter_by_ids=this.initialConfig.filter_by_ids;}
og.initialMemberTreeAjaxLoad(this,500,0,options);},filterNode:function(n,re){var f=false;var c=n.firstChild;while(c){f=this.filterNode(c,re)||f;c=c.nextSibling;}
f=re.test(Ext.util.Format.htmlDecode(n.text.toLowerCase()))||f;if(!n.previousState){n.previousState=n.expanded?"e":"c";}
if(f){n.getUI().show();}else{n.getUI().hide();}
return f;},clearFilter:function(n){if(!n)n=this.getRootNode();if(!n.previousState)return;var c=n.firstChild;while(c){this.clearFilter(c);c=c.nextSibling;}
n.getUI().show();this.collapseAll();if(n.previousState=="e"){n.expand(false,false);}else if(n.previousState=="c"){n.collapse(false,false);}
n.previousState=null;},expandedNodes:function(){nodes=[];nodes=nodes.concat(this.root.expandedNodes());return nodes;},init:function(callback){new Ext.tree.TreeSorter(this,{dir:"asc",property:"text",sortType:function(node){if(isNaN(node.id)&&node.id.indexOf('view_more_')==0){var last_char=String.fromCharCode(126);return last_char+last_char+last_char+node.text;}
if(node.attributes&&node.attributes.sort_key){return og.replaceStringAccents(node.attributes.sort_key).toLowerCase();}else if(node.sort_key){return og.replaceStringAccents(node.sort_key).toLowerCase();}else{return og.replaceStringAccents(node.text).toLowerCase();}}});switch(this.expandMode){case"all":this.expandAll(callback);break;case"root":this.root.expand(0,0,callback);break;case"none":default:break;}
this.root.enable();this.totalNodes=1;var filtering_by_ids=this.initialConfig.filter_by_ids;if(ogMemberCache.areDimRootMembersLoaded(this.dimensionId.toString())&&!filtering_by_ids){var dim=og.dimensions[this.dimensionId];if(typeof dim!="undefined"){for(m in dim){mem=dim[m];if(typeof this.allowedMemberTypes!="undefined"){if(this.allowedMemberTypes.indexOf(mem.object_type_id)==-1){continue;}}
var new_node=this.createNode(mem);var node_parent=this.getNodeById(mem.parent);if(mem.parent==0){node_parent=this.getRootNode();}
var node_exist=this.getNodeById(mem.id);if(!node_exist){if(node_parent)node_parent.appendChild(new_node);}}}
this.initialized=true;og.eventManager.fireEvent('end_callback member_tree loaded',{});}else{var options={};if(filtering_by_ids){options.filter_by_ids=filtering_by_ids;}
var limit=500;if(og.config.member_selector_page_size){limit=og.config.member_selector_page_size;}
og.initialMemberTreeAjaxLoad(this,limit,0,options);}},isMultiple:function(){return(this.getSelectionModel().constructor.toString().indexOf("Array")!=-1);},selectRoot:function(){selModel=this.getSelectionModel();selModel.suspendEvents();var node=this.getRootNode();selModel.select(node);selModel.resumeEvents();},hide:function(){og.MemberTreeAjax.superclass.hide.call(this);},show:function(){og.MemberTreeAjax.superclass.show.call(this);this.selectRoot();},selectNodes:function(nids){for(var i=0;i<nids.length;i++){if(nids[i]!="undefined"){if(nids[i]!=0){var node=this.getNodeById(nids[i]);}else{var node=this.getRootNode();}
if(node){selModel=this.getSelectionModel();selModel.suspendEvents();selModel.select(node);selModel.resumeEvents();}}}},expandNodes:function(nids,callback){for(var i=0;i<nids.length;i++){if(nids[i]!="undefined"){if(nids[i]!=0){var node=this.getNodeById(nids[i]);}else{var node=this.getRootNode();}
if(node){node.expand();}}}},hideRoot:function(){this.addClass("root-hidden");},showRoot:function(){this.removeClass("root-hidden");},addMembersToTree:function(members,dimension_id){var all_parent_nodes_involved=[];var dimension_tree=this;for(var prop in members){var mem=members[prop];if(typeof mem=='function')continue;if(typeof dimension_tree.allowedMemberTypes!="undefined"){if(dimension_tree.allowedMemberTypes.indexOf(mem.object_type_id)==-1){continue;}}
var new_node=dimension_tree.loader.createNode(mem);var node_parent=dimension_tree.getNodeById(mem.parent);if(mem.parent==0){node_parent=dimension_tree.getRootNode();}
var node_exist=dimension_tree.getNodeById(mem.id);if(node_parent){dimension_tree.suspendEvents();if(node_exist){node_parent.removeChild(node_exist);}
node_parent.appendChild(new_node);dimension_tree.resumeEvents();all_parent_nodes_involved[node_parent.id]=node_parent;}
og.addMemberToOgDimensions(dimension_id,mem);}
for(var i in all_parent_nodes_involved){var pn=all_parent_nodes_involved[i];if(pn&&typeof(pn)=='object'){pn.sort(og.sortNodesFn);}}},createNode:function(attr){if(Ext.type(this)){if(this.totalNodes){this.totalNodes++;}else{this.totalNodes=1;}}
var node=attr.leaf?new Ext.tree.TreeNode(attr):new Ext.tree.AsyncTreeNode(attr);node.object_id=attr.object_id;node.options=attr.options;node.object_controller=attr.object_controller;node.object_type_id=attr.object_type_id;node.allow_childs=attr.allow_childs;if(attr.actions){node.actions=attr.actions;}
return node;},adjustDropDownListHeight:function(){if($(".simplemodal-overlay").length>0){let winh=$(".simplemodal-overlay").height();let list=this.body;if(list.getTop()+list.getHeight()>winh){let max_height=winh-list.getTop()-5;let minimum_heigth=80;let new_top=0;if(max_height<minimum_heigth){new_top=list.getTop()+max_height-minimum_heigth
max_height=minimum_heigth;}
$("#"+list.id).css({'max-height':max_height+'px'});if(new_top){$("#"+list.id).css({'top':new_top+'px','border-top':'1px solid #cccccc'});}}}}});Ext.reg('member-tree-ajax',og.MemberTreeAjax);og.MemberChooserPanel=function(config){Ext.applyIf(config,{iconCls:'ico-workspaces',autoScroll:true,renderTo:'member-chooser-panel'});og.MemberChooserPanel.superclass.constructor.call(this,config);};Ext.extend(og.MemberChooserPanel,Ext.Panel,{checkNodes:function(nodes){this.items.each(function(item,index,length){item.checkNodes(nodes);});}});og.MemberChooserTree=function(config){if(!config.allowedMemberTypes)
config.allowedMemberTypes='';if(config.filterContentType){var objectTypeQuery='&object_type_id='+config.objectTypeId;}else{var objectTypeQuery='';}
base_params=null;if(config.loadAdditionalParameters){var load_additional_params=Ext.util.JSON.decode(config.loadAdditionalParameters);if(load_additional_params&&load_additional_params.length>0){base_params={};for(x in load_additional_params){var input_id=load_additional_params[x];var input_name=$("#"+input_id).attr('name');var input_val=$("#"+input_id).val();if(input_name&&input_val){base_params[input_name]=input_val;}}}}
Ext.applyIf(config,{isMultiple:false,collapsible:true,collapsed:false,titleCollapse:true,allowedMemberTypes:'',reloadDimensions:[],loader:new og.MemberChooserTreeLoader({dataUrl:config.loadUrl?config.loadUrl:'index.php?c=dimension&a=initial_list_dimension_members_tree&ajax=true'+'&dimension_id='+config.dimensionId+objectTypeQuery+
(config.checkBoxes?'&checkboxes=true':'')+
(config.all_members?'&all_members=true':'')+
(og.config.member_selector_page_size?'&limit='+og.config.member_selector_page_size:'')+'&allowedMemberTypes='+Ext.encode(config.allowedMemberTypes)+'&avoid_session=1',baseParams:base_params,ownerTree:this}),checkBoxes:true,autoScroll:true,animCollapse:false,animExpand:false,animate:false,rootVisible:true,lines:false,root:{text:lang('all'),expanded:false},cls:'member-chooser',tbar:[{xtype:'textfield',id:'textfilter-'+config.dimensionId,cls:"dimension-panel-textfilter",emptyText:lang('filter members'),listeners:{render:{fn:function(f){f.el.on('keyup',function(e){this.filterTree(e.target.value);},this,{buffer:350});},scope:this}}}]});og.MemberChooserTree.superclass.constructor.call(this,config);if(Ext.isIE7){this.width=230;this.height=280;}
this.filterOnChange=true;this.totalFilterTrees=0;this.filteredTrees=0;var self=this;this.on({'checkchange':function(node,checked){if(!this.isMultiple){if(checked){var oldChecked=this.getChecked();for(var i=0;i<oldChecked.length;i++){if(oldChecked[i]&&oldChecked[i].id!=node.id){this.suspendEvents();oldChecked[i].checked=false;oldChecked[i].getUI().toggleCheck(false);this.resumeEvents();}}}}
if(this.filterOnChange){var trees=this.ownerCt.items;if(trees){this.suspendEvents();this.totalFilterTrees=0;this.filteredTrees=0;var selected_members=[];trees.each(function(item,index,length){if(typeof(item.getSelectionModel().getSelectedNode)=='function'){var sel=item.getSelectionModel().getSelectedNode();if(sel&&!isNaN(sel.attributes.id))selected_members.push(sel.attributes.id);}else if(typeof(item.getChecked)=='function'){var sels=item.getChecked();for(x=0;x<sels.length;x++){var sel=sels[x];if(sel&&!isNaN(sel.id))selected_members.push(sel.id);}}});trees.each(function(item,index,length){if(self.id!=item.id&&self.reloadDimensions.indexOf(item.dimensionId)!=-1){self.totalFilterTrees++;var nid=(checked)?node.id:0;if(checked){var nid=node.id;}else{if(!this.isMultiple){var nid=0;}else{var nid=self.getLastChecked();}}
item.filterByMember(selected_members,function(){self.filteredTrees++;if(self.filteredTrees==self.totalFilterTrees){self.resumeEvents();self.fireEvent('all trees updated');}});}});if(this.totalFilterTrees==0){this.resumeEvents();self.fireEvent('all trees updated');}}}},'scope':this});};Ext.extend(og.MemberChooserTree,Ext.tree.TreePanel,{suspendEvents:function(){og.MemberChooserTree.superclass.suspendEvents.call(this);var htmlInputs=Ext.query("#"+this.getId()+" input");for(var i in htmlInputs){if(i!="remove"){htmlInputs[i].disabled="disabled";}}},resumeEvents:function(){og.MemberChooserTree.superclass.resumeEvents.call(this);var htmlInputs=Ext.query("#"+this.getId()+" input");for(var i=0;i<htmlInputs.length;i++){if(htmlInputs[i]){htmlInputs[i].disabled="";}}},filterByMember:function(selected_members,callback){var checked=this.getChecked("id");this.loader=new og.MemberChooserTreeLoader({dataUrl:'index.php?c=dimension&a=initial_list_dimension_members_tree&ajax=true&checkboxes=true'
+'&dimension_id='+this.dimensionId
+'&selected_ids='+Ext.util.JSON.encode(selected_members)
+'&object_type_id='+this.objectTypeId
+'&avoid_session=1',ownerTree:this});var self=this;this.loader.load(this.getRootNode(),function(){self.expandAll(function(){self.checkNodes(checked);if(typeof callback=="function"){callback();}});});},checkNodes:function(nids){if(!nids)return;for(var i=0;i<nids.length;i++){if(nids[i]!="undefined"){if(nids[i]!=0){var node=this.getNodeById(nids[i]);}else{var node=this.getRootNode();}
if(node){this.suspendEvents();node.checked=true;node.getUI().toggleCheck(true);this.resumeEvents();}}}},selectNodes:function(nids){if(nids.length){for(var i=0;i<nids.length;i++){this.getSelectionModel().select(this.getNodeById(nids[i]));if(!this.multipleSelect){return true;}}}else{if(!this.checkBoxes)this.getRootNode().select();}
return true;},afterRender:function(){var tree=this;var collapsed=this.collapsed;this.collapsed=false;og.MemberChooserTree.superclass.afterRender.call(this);if(collapsed){if(this.checkBoxes){tree.expandAll(function(){tree.collapse(false);tree.checkNodes(tree.ownerCt.selectedMembers);tree.fireEvent('tree rendered',tree);});}else{tree.expandAll(function(){tree.collapse(false);tree.selectNodes(tree.ownerCt.selectedMembers);tree.fireEvent('tree rendered',tree);});}}else{if(this.checkBoxes){tree.expandAll(function(){tree.checkNodes(tree.ownerCt.selectedMembers);tree.fireEvent('tree rendered',tree);});}else{tree.expandAll(function(){tree.selectNodes(tree.ownerCt.selectedMembers);tree.fireEvent('tree rendered',tree);});}}},getLastChecked:function(){var checkedNodes=this.getChecked("id");if(checkedNodes.length&&checkedNodes[0]){return checkedNodes[0];}else{return 0;}},filterTree:function(text){if(this.getTopToolbar().items.length){var searchBox=this.getTopToolbar().items.get('textfilter-'+this.dimensionId);if(searchBox){if(text==searchBox.emptyText){text="";}
if(text.trim()==''){this.clearFilter();}else{var re=new RegExp(Ext.escapeRe(text.toLowerCase()),'i');this.filterNode(this.getRootNode(),re);this.expandAll();}}}},filterNode:function(n,re){var f=false;var c=n.firstChild;while(c){f=this.filterNode(c,re)||f;c=c.nextSibling;}
f=re.test(n.text.toLowerCase())||f;if(!n.previousState){n.previousState=n.expanded?"e":"c";}
if(f){n.getUI().show();}else{n.getUI().hide();}
return f;},clearFilter:function(n){if(!n)n=this.getRootNode();if(!n.previousState)return;var c=n.firstChild;while(c){this.clearFilter(c);c=c.nextSibling;}
n.getUI().show();if(n.previousState=="e"){n.expand(false,false);}else if(n.previousState=="c"){n.collapse(false,false);}
n.previousState=null;}});Ext.reg('member-chooser-tree',og.MemberChooserTree);og.MemberChooserNode=function(config){self.construct=function(config){}
self.construct(config);return self;}
og.MemberChooser=function(config){var self=this;self.construct=function(config){this.isMultiple=false;this.baseUrl=config.baseUrl;this.dimensionId=config.dimensionId||"";this.objectTypeId=config.objectTypeId||"";this.ajaxUrl=this.baseUrl
+'&dimension_id='+this.dimensionId
+'&object_type_id='+this.objectTypeId+
+'&checkboxes=true'+
+'&avoid_session=1';};self.renderMembers=function(){var ul=document.createElement('ul');var hdr=document.createElement('div');hdr.className="mc-header";var txtBox=document.createElement('input');txtBox.type="text";hdr.appendChild(txtBox);for(i in this.members){if(this.members[i]&&typeof(this.members[i])!='function'){var member=this.members[i];var li=document.createElement('li');var ch=document.createElement('input');ch.type='checkbox';ch.name='dimension_members';ch.value=member.id;li.appendChild(ch);li.innerHTML+="<span>"+member.name+"</span>";ul.appendChild(li);}}
this.ct.innerHTML='';this.ct.appendChild(hdr);this.ct.appendChild(ul);$(this.ct).slideDown();this.filter("ad");};self.filter=function(text){$(this.ct).find("li:not(:contains("+text+"))").addClass("hidden");};self.render=function(position){if(!this.status){var ct=document.createElement("div");ct.className="mc-container";ct.style.diplay="none";$(ct).offset(position);this.ct=ct;setTimeout(function(){$('html').click(function(){$(".mc-container").slideUp();});$(ct).click(function(event){event.stopPropagation();});},1000);}else{$(this.ct).slideDown();}
this.status=1;document.body.appendChild(ct);Ext.Ajax.request({url:self.ajaxUrl,success:function(data){var response=eval("("+data.responseText+")");self.members=response.dimension_members;self.renderMembers();},failure:function(data){alert("error in response");}});return ct;};self.toggle=function(e){position=e.offset();position.top=position.top+e.height()+2;this.render(position);};self.construct(config);return self;}
og.ContentPanelLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,onLayout:function(ct,target){og.ContentPanelLayout.superclass.onLayout.call(this,ct,target);if(!this.container.collapsed){for(var i=0;ct.items.itemAt(i);i++){if(!ct.items.itemAt(i).hidden){this.setItemSize(this.activeItem||ct.items.itemAt(i),target.getStyleSize());}}
this.setItemSize(this.activeItem||ct.items.itemAt(0),target.getStyleSize());}},setItemSize:function(item,size){if(item&&size.height>0){item.setSize(size);}}});Ext.Container.LAYOUTS['contentpanel']=og.ContentPanelLayout;og.ContentPanel=function(config){if(!config)config={};if(!config.listeners)config.listeners={};this.onClose=config.onClose;this.contentAutoScroll=typeof config.autoscroll=="undefined"||config.autoscroll;Ext.apply(config,{autoscroll:false,layout:'contentpanel',loaded:false,cls:'og-content-panel',items:[{xtype:'panel',html:""}],listeners:Ext.apply(config.listeners,{activate:{fn:this.activate,scope:this},deactivate:{fn:this.deactivate,scope:this}})});og.ContentPanel.superclass.constructor.call(this,config);this.history=[];this.help='';this.contentLoaded=false;this.onClose=config.onClose;if(config.refreshOnWorkspaceChange){og.eventManager.addListener('member changed',this.reset,this);}
this.on('render',function(){var tab=Ext.get("tabs-panel__"+this.id);if(tab){og._activeTab=this.id;tab.on('click',function(){og._activeTab=this.id;},this);tab.on('dblclick',function(){if(this.id==og._activeTab){this.reset();}},this);}
if(this.ownerCt){this.ownerCt.on('remove',function(ct,item){if(item==this){if(typeof this.onClose=='function'){this.onClose();}}},this);}},this);};Ext.extend(og.ContentPanel,Ext.Panel,{activate:function(){og.eventManager.fireEvent('tab activated',this);this.active=true;if(this.getComponent(0).activate){this.getComponent(0).activate();}
if(!this.loaded){if(this.initialContent){this.history.push(this.defaultContent);this.load(this.initialContent);this.initialContent=false;}else{this.load(this.defaultContent);}}
if(this.help.data){Ext.getCmp('help-panel').load(this.help);}},deactivate:function(){this.active=false;},setHelp:function(help){this.help=help;},hasHelp:function(){if(this.help!=''){return true;}
return false;},setPreventClose:function(prevent){if(!this.preventClose&&prevent){og.ContentPanel.preventCloseCount++;if(og.ContentPanel.preventCloseCount){window.onbeforeunload=function(){return lang("confirm unload page");};}}else if(this.preventClose&&!prevent){og.ContentPanel.preventCloseCount--;if(!og.ContentPanel.preventCloseCount){window.onbeforeunload=null;}}
this.preventClose=prevent;},confirmClose:function(){if(this.preventClose){if(!confirm(lang("confirm leave panel"))){return false;}
this.setPreventClose(false);}
return!this.preventClose;},load:function(content,isBack,isReload,isReset){if(!this.confirmClose()){if(isBack){this.history.push(content);}
return false;}
if(this.content&&this.content.onleave){eval(this.content.onleave);}
if(content.type=='start'){if(this.closable){this.ownerCt.remove(this);}else{this.reset();}
return false;}else if(content.type=='back'){if(typeof content.data=='number'){for(var i=0;i<content.data;i++){this.back();}}else{this.back();}
return false;}else if(content.type=='reload'){this.reload();return false;}
if(this.content&&!isBack&&this.content.type!='url'&&!content.replace){var skip=false;if(this.content.type=='html'&&(content.type=='url'||content.type=='html')){var url1=this.content.url;var url2=content.url||content.data;if(url1&&url2){url1=url1.replace(/_dc=[^&]*/g,"");url2=url2.replace(/_dc=[^&]*/g,"");if(url1==url2){skip=true;}}}
if(!skip){this.history.push(this.content);}}
if(typeof content=='string'){content={type:'html',data:content}}
this.content=content;if(content.makeDefault){this.defaultContent=content;}
if(this.content.type!='url'){var i=0;while(this.getComponent(i)){if(this.getComponent(i).doNotRemove){this.getComponent(i).hide();i++;}else{this.remove(this.getComponent(i));}}
this.doLayout();}
this.setPreventClose(content.preventClose);if(content.type=='html'){if(this.history.length>0&&!content.noback){var tbar=[{text:lang('back'),handler:function(){this.back();},scope:this,iconCls:'ico-back'},'-'];}else if(this.closable){var tbar=[{text:lang('cancel'),handler:function(){if(this.ownerCt)this.ownerCt.remove(this);},scope:this,iconCls:'ico-back'},'-'];}else if(content.actions){var tbar=[];}
if(content.actions){for(var i=0;i<content.actions.length;i++){if(content.actions[i].title=='-'){tbar.push('-');}else{var tbar_item={text:content.actions[i].title,handler:function(){if(this.url.indexOf('javascript:')==0){var js=this.url.substring(11);eval(js);}else{if(this.target=='_blank'){window.open(this.url);}else if(this.target){og.openLink(this.url,{caller:this.target});}else{og.openLink(this.url);}}},scope:content.actions[i],iconCls:content.actions[i].name}
if(content.actions[i].attributes){if(content.actions[i].attributes.id)tbar_item.id=content.actions[i].attributes.id;if(content.actions[i].attributes.hidden)tbar_item.hidden=content.actions[i].attributes.hidden;if(content.actions[i].attributes.disabled)tbar_item.disabled=content.actions[i].attributes.disabled;if(content.actions[i].attributes.type)tbar_item.xtype=content.actions[i].attributes.type;}
tbar.push(tbar_item);}}}
if(content.notbar){tbar=null;}
var html=content.data
if(content.inlineScripts&&content.inlineScripts.length){var id=Ext.id();html+='<span id="'+id+'"></span>';Ext.lib.Event.onAvailable(id,function(){var start=new Date().getTime();for(var inlineScriptContentIterator=0;inlineScriptContentIterator<content.inlineScripts.length;inlineScriptContentIterator++){try{if(window.execScript){window.execScript(content.inlineScripts[inlineScriptContentIterator]);}else{window.eval(content.inlineScripts[inlineScriptContentIterator]);}}catch(e){og.err(e.message);}}
var end=new Date().getTime();var el=document.getElementById(id);if(el)Ext.removeNode(el);});}
var p=new og.HtmlPanel({html:og.extractScripts(html),autoScroll:this.contentAutoScroll,tbar:tbar});this.add(p);this.doLayout();}else if(content.type=='url'){if(this.active){context_str="";if(og.contextManager&&og.contextManager.dimensionMembers.length>0)
context_str="&context="+escape(og.contextManager.plainContext());og.openLink(content.data+context_str,{caller:this,preventSwitch:true});}else{this.loaded=false;}}else if(content.type=='panel'){if(!content.panel){for(var i=0;this.getComponent(i)&&!content.panel;i++){if(this.getComponent(i).getXType()==content.data){content.panel=this.getComponent(i);}}
if(!content.panel){var config=content.config||{};config.xtype=content.data||config.xtype;if(Ext.ComponentMgr.isRegistered(config.xtype))
content.panel=Ext.ComponentMgr.create(config);else return false;}else if(content.config&&typeof content.panel.newConfig=='function'){content.panel.newConfig(content.config);}}
if(isReset){if(content.panel)content.panel.reset();}else{if(content.panel.data!="overview"){content.panel.load();}}
this.add(content.panel);if(content.panel)content.panel.show();this.doLayout();og.captureLinks(this.id,this);}else{var html="<h1>Error: invalid content</h1>";html+="<pre>";html+=og.debug(content);html+="</pre>";var p=new Ext.Panel({html:html,autoScroll:true});this.add(p);this.doLayout();}
if(content.type!='url'){this.loaded=true;}
og.eventManager.fireEvent("tab loaded",this.id);return true;},hasBack:function(){if(this.history.pop())return true;return false;},back:function(){var prev=this.history.pop();if(!prev){this.load({type:'start'});}else if(prev.type=='html'&&prev.url){this.load({type:'url',data:prev.url},true);}else{this.load(prev,true,true);}},reload:function(){if(this.content){if(this.content.type=='html'&&this.content.url){this.load({type:'url',data:this.content.url},true);}else{this.load(this.content,true,true);}}},reset:function(){if(!this.confirmClose())return;this.loaded=false;if(this.active){og.eventManager.fireEvent("content panel reset",this.id);this.load(this.defaultContent,true,true,true);}
this.history=[];}});og.ContentPanel.preventCloseCount=0;og.contextManager=new function(){this.currentDimension=0;this.lastCheckedMembers={};this.dimensionMembers={};this.contextDimensions={};this.formDimensionTrees=[];this.construct=function(){for(var i=0;i<og.dimensionPanels.length;i++){if(d=og.dimensionPanels[i]){this.contextDimensions[d.id]={id:d.id,dimensionId:d.dimensionId,title:d.title,checked:(d.isRoot)?true:false,visible:(d.isRoot)?true:false};}}}
this.getDimensionMenu=function(){var menu=[];for(var i in this.contextDimensions){if(i!="remove"){var did=this.contextDimensions[i].dimensionId;menu.push({id:"dimension-selector-"+did,text:this.contextDimensions[i].title,checked:this.contextDimensions[i].checked,dimensionId:this.contextDimensions[i].id,hideOnClick:false,checkHandler:function(item,status){var panel=Ext.getCmp(this.dimensionId);if(!status){panel.removeFromContext();}else{panel.show();panel.expand();if(panel&&panel.getRootNode()){panel.getRootNode().expand();}}
og.contextManager.setDimensionVisibility(item.dimensionId,status);var dim_ids=og.contextManager.getVisibleDimensions();og.openLink(og.getUrl('account','update_user_preference',{name:'root_dimensions',value:dim_ids.join(',')}),{hideLoading:true});}});}}
return menu;}
this.getVisibleDimensions=function(){var dim_ids=[];for(var idx in og.contextManager.contextDimensions){if(idx!="remove"&&og.contextManager.contextDimensions[idx].visible){dim_ids.push(og.contextManager.contextDimensions[idx].dimensionId);}}
return dim_ids;}
this.setDimensionVisibility=function(dimension_id,visibility){this.contextDimensions[dimension_id].visible=visibility?true:false;}
this.addFormDimensionTree=function(id,objectType,dimensionId){if(!this.formDimensionTrees[objectType]){this.formDimensionTrees[objectType]=[];}
if(this.formDimensionTrees.indexOf(id)==-1){this.formDimensionTrees[objectType][dimensionId]=id;}}
this.getFormDimensionTrees=function(objectType){if(this.formDimensionTrees[objectType]){return this.formDimensionTrees[objectType];}
return null}
this.cleanFormDimensionTrees=function(objectType,dimensionId){if(this.formDimensionTrees[objectType]){delete this.formDimensionTrees[objectType][dimensionId];}}
this.cleanActiveMembers=function(dimensionId){if(dimensionId!=undefined){delete this.dimensionMembers[dimensionId];this.dimensionMembers[dimensionId]=[0];}}
this.addActiveMember=function(member,dimension,node){if(dimension){if(!this.dimensionMembers[dimension])
this.dimensionMembers[dimension]=[];if(this.dimensionMembers[dimension].indexOf(member)==-1)
this.dimensionMembers[dimension].push(member);}
og.eventManager.fireEvent("after add active member",node);}
this.removeActiveMember=function(member,dimensionId){if(this.dimensionMembers[dimensionId]){var index=this.dimensionMembers[i].indexOf(member);if(index!=-1)
delete this.dimensionMembers[i][index];}}
this.getDimensionName=function(dimId){return this.contextDimensions["dimension-panel-"+dimId].title;}
this.getTreeNode=function(dimId,memberId){var tree=Ext.getCmp("dimension-panel-"+dimId);return tree?tree.getNodeById(memberId):null;}
this.getMemberName=function(dimId,memberId){var node=this.getTreeNode(dimId,memberId);if(node){return node.text;}else{return"";}}
this.getMemberPath=function(dimId,memberId,return_array,separator,direction){separator=separator||"/";direction=direction||"ltr";var path=return_array?[]:"";var node=this.getTreeNode(dimId,memberId);if(node){var depth=node.getDepth();if(depth>=2){while(depth>1){node=node.parentNode;if(node){if(!return_array){if(!path){path=node.text;}else{if(direction=="ltr"){path=node.text+separator+path;}else{path=path+separator+node.text;}}}else{path.push(node);}
depth--;}}}
if(!return_array&&path){if(direction=="ltr"){path=path+separator;}else{path=separator+path;}}}
if(return_array&&direction=="ltr"){path=path.reverse();}
return path;}
this.getDimensionMembers=function(dimension){if(dimension&&this.dimensionMembers[dimension])return this.dimensionMembers[dimension];else if(dimension)return[];else return null;}
this.getSelectedMembers=function(){var mem_ids=[];for(var dimension in this.dimensionMembers){if(this.dimensionMembers[dimension]){mem_ids=mem_ids.concat(this.dimensionMembers[dimension]);}}
return mem_ids.filter(function(mid){return mid>0;});}
this.plainActiveMembers=function(){return"["+this.activeMembers.join(",")+"]";}
this.plainContext=function(){return Ext.util.JSON.encode(this.dimensionMembers);}
this.plainCheckedMembers=function(objectTypeId){return Ext.util.JSON.encode(this.lastCheckedMembers[objectTypeId]);}
this.getCheckedMembers=function(objectTypeId){return this.lastCheckedMembers[objectTypeId];}
this.hasCheckedMembers=function(objectTypeId){var checked=this.getCheckedMembers(objectTypeId);for(var i in checked){if(checked[i].length)return true;}
return false;}
this.cleanCheckedMembers=function(objectTypeId){this.lastCheckedMembers[objectTypeId]={};}
this.addCheckedMember=function(objectTypeId,member,dimension){if(!this.lastCheckedMembers[objectTypeId]){this.lastCheckedMembers[objectTypeId]={};}
if(!this.lastCheckedMembers[objectTypeId][dimension]){this.lastCheckedMembers[objectTypeId][dimension]=[];}
if(this.lastCheckedMembers[objectTypeId][dimension].indexOf(member)==-1){this.lastCheckedMembers[objectTypeId][dimension].push(member);}}
this.getActiveContextNames=function(){var context_names=[];context_ids=Ext.util.JSON.decode(this.plainContext());for(dim_id in context_ids){var mids=context_ids[dim_id];for(i=0;i<mids.length;i++){if(mids[i]>0)context_names.push(this.getMemberName(dim_id,mids[i]));}}
return context_names;}
this.getSelectedMemberObjectTypeId=function(dimension_id){var sel_member_type=0;context_ids=Ext.util.JSON.decode(this.plainContext());for(dim_id in context_ids){if(dim_id==dimension_id){var mids=context_ids[dim_id];for(i=0;i<mids.length;i++){if(mids[i]>0){var tree=Ext.getCmp('dimension-panel-'+dimension_id);if(tree){var node=tree.getNodeById(mids[i]);if(node)sel_member_type=node.object_type_id;}}}
break;}}
return sel_member_type;}}
og.DateField=function(config){if(!config)config={};Ext.apply(this,config,{format:og.preferences['date_format'],altFormats:lang('date format alternatives'),width:120});og.DateField.superclass.constructor.call(this,config);};Ext.extend(og.DateField,Ext.form.DateField,{onTriggerClick:function(){if(this.disabled){return;}
if(this.menu==null){this.menu=new Ext.menu.DateMenu();if(this.picker_select_listener&&typeof(this.picker_select_listener)=='function'){this.menu.picker.addListener("select",this.picker_select_listener);}}
Ext.apply(this.menu.picker,{nextText:lang('next month'),prevText:lang('prev month'),todayText:lang('today'),monthNames:[lang('month 1'),lang('month 2'),lang('month 3'),lang('month 4'),lang('month 5'),lang('month 6'),lang('month 7'),lang('month 8'),lang('month 9'),lang('month 10'),lang('month 11'),lang('month 12')],dayNames:[lang('sunday'),lang('monday'),lang('tuesday'),lang('wednesday'),lang('thursday'),lang('friday'),lang('saturday')],monthYearText:'',todayTip:lang('today'),minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.format,showToday:this.showToday,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue)),startDay:og.preferences['start_monday']?1:0});this.menu.on(Ext.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");}});og.UserPicker=function(config){this.GID=10000000;if(!config)config={};var users=config.users;delete config.users;this.userField=Ext.getDom(config.field)||{};if(!this.userField.value)this.userField.value="";Ext.applyIf(config,{autoScroll:true,rootVisible:false,lines:false,root:new Ext.tree.TreeNode(lang('users')),collapseFirst:false,tbar:[{xtype:'textfield',width:config.width?config.width-6:234,emptyText:lang('filter users and groups'),listeners:{render:{fn:function(f){f.el.on('keyup',function(e){this.filterTree(e.target.value);},this,{buffer:350});},scope:this}}}]});og.UserPicker.superclass.constructor.call(this,config);this.users=this.root.appendChild(new Ext.tree.TreeNode({id:"users",text:lang('users'),expanded:true,name:lang('users'),iconCls:'ico-users',listeners:{click:function(){this.select();}}}));this.users.user={id:0,n:lang('users')};this.groups=this.root.appendChild(new Ext.tree.TreeNode({id:"groups",text:lang('groups'),expanded:true,name:lang('groups'),iconCls:'ico-groups',listeners:{click:function(){this.select();}}}));this.groups.user={id:0,n:lang('groups')};if(users)this.addUsers(users);var ids=this.userField.value.split(",");for(var i=0;i<ids.length;i++){var n=ids[i].trim();var node=this.getNodeById(n);if(node){node.ensureVisible();node.suspendEvents();node.ui.toggleCheck(true);node.user.checked=true;node.resumeEvents();}}
var ownerCo=this.getNode("c1");if(ownerCo)ownerCo.expand();this.getSelectionModel().on({'selectionchange':function(sm,node){if(node&&!this.pauseEvents&&node.user&&node.user.t=='user'||node.user.t=='group'){this.fireEvent("userselect",node.user);this.clearFilter();node.expand();node.ensureVisible();}else if(node&&!this.pauseEvents&&node.user&&(node.user.t!='user'&&node.user.t!='group')){this.fireEvent("noneselected",node.user);}},scope:this});this.addEvents({userselect:true});this.addEvents({noneselected:true});};Ext.extend(og.UserPicker,Ext.tree.TreePanel,{removeUser:function(user){var node=this.getNodeById(this.nodeId(user.id));if(node){if(node.isSelected()){if(user.id<this.GID){this.users.select();}else{this.groups.select();}}
Ext.fly(node.ui.elNode).ghost('l',{callback:node.remove,scope:node,duration:.4});}},updateUser:function(user){this.addUser(user);},addUser:function(user){var nid=this.nodeId(user.id);var exists=this.getNodeById(nid);if(exists){exists.setText(user.n);if(user.p!=exists.user.p){var selected=exists.isSelected();var parent=this.getNode(user.p);if(parent){parent.appendChild(exists);exists.user.parent=parent.user.id;if(selected)exists.select();}}
return;}
var config={text:og.clean(user.n),id:nid,listeners:{click:function(){this.select();},checkchange:{fn:function(node,checkedValue){if(!node)return;node.user.checked=checkedValue;node.select();if(this.userField){var tids=this.userField.value.split(",");var ids=[];for(var i=0,j=0;i<tids.length;i++){var x=tids[i].trim();if(x&&x!=node.user.id){ids.push(x);}}
if(checkedValue){ids.push(node.user.id);}
this.userField.value=ids.join(",");}
this.fireEvent("usercheck",node.user,checkedValue);},scope:this}}};if(user.t!='company'){config.checked=false;config.cls='x-tree-noicon';}else{config.iconCls='ico-company';}
var node=new Ext.tree.TreeNode(config);node.user=user;node.user.checked=false;if(user.p=='users'){var parent=this.users;}else if(user.p=='groups'){var parent=this.groups;}else{var parent=this.getNodeById(this.nodeId(user.p));}
if(!parent){if(user.t=='company'||user.id<this.GID){parent=this.users;}else{parent=this.groups;}}
var iter=parent.firstChild;while(iter&&node.text.toLowerCase()>iter.text.toLowerCase()){iter=iter.nextSibling;}
parent.insertBefore(node,iter);return node;},uncheckAll:function(node){if(!node)node=this.root;var child=node.firstChild;if(node.ui.isChecked())node.ui.toggleCheck(false);while(child){this.uncheckAll(child);child=child.nextSibling;}},getSelectedUser:function(){var s=this.getSelectionModel().getSelectedNode();if(s){return this.getSelectionModel().getSelectedNode().user;}else{return{id:0,name:'users'};}},getSelected:function(){return this.getSelectedUser();},nodeId:function(id){return"u"+id;},addUsers:function(users){for(var i=0;i<users.length;i++){this.addUser(users[i]);}
this.root.expand();},select:function(id){if(!id){this.root.ensureVisible();this.root.select();}else{var node=this.getNodeById(this.nodeId(id));if(node){node.ensureVisible();node.select();}}},getNode:function(id){if(!id){return this.root;}else{var node=this.getNodeById(this.nodeId(id));if(node){return node;}}
return null;},filterNode:function(n,re){var f=false;var c=n.firstChild;while(c){f=this.filterNode(c,re)||f;c=c.nextSibling;}
f=re.test(n.text.toLowerCase())||f;if(!n.previousState){n.previousState=n.expanded?"expanded":"collapsed";}
if(f){n.getUI().show();}else{n.getUI().hide();}
return f;},filterTree:function(text){var re=new RegExp(Ext.escapeRe(text.toLowerCase()),'i');this.filterNode(this.root,re);this.root.getUI().show();this.expandAll();},clearFilter:function(n){if(!n)n=this.root;if(!n.previousState)return;var c=n.firstChild;while(c){this.clearFilter(c);c=c.nextSibling;}
n.getUI().show();if(this.getSelectionModel().getSelectedNode().isAncestor(n)){n.previousState="expanded";}
if(n.previousState=="expanded"){n.expand();}else if(n.previousState=="collapsed"){n.collapse();}
n.previousState=null;},getValue:function(){return this.userField.value;}});Ext.reg('userpicker',og.UserPicker);og.permissionInfo={};og.ogLoadPermissions=function(genid,isNew){var hf=document.getElementById(genid+'hfPerms');if(hf&&hf.value!=''){var hf_ot=document.getElementById(genid+'hfAllowedOT');var hf_ot_mem=document.getElementById(genid+'hfAllowedOTbyMemType');var hf_memt=document.getElementById(genid+'hfMemTypes');og.permissionInfo[genid]={permissions:Ext.util.JSON.decode(hf.value),allowedOt:Ext.util.JSON.decode(hf_ot.value),allowedOtByMemType:Ext.util.JSON.decode(hf_ot_mem.value),member_types:Ext.util.JSON.decode(hf_memt.value)}
Ext.removeNode(hf);Ext.removeNode(hf_ot);Ext.removeNode(hf_ot_mem);Ext.removeNode(hf_memt);}else{og.permissionInfo[genid]={};}
og.eventManager.fireEvent('on load user permissions',{});}
og.getPermissionsForMember=function(genid,member_id){if(!og.permissionInfo[genid].permissions[member_id])
og.permissionInfo[genid].permissions[member_id]=[];return og.permissionInfo[genid].permissions[member_id];}
og.addPermissionsForMember=function(genid,member_id,perm){og.permissionInfo[genid].permissions[member_id].push(perm);}
og.deletePermissionsForMember=function(genid,member_id){og.permissionInfo[genid].permissions[member_id]=[];}
og.canEditPermissionObjType=function(genid,member_id,obj_type){var mem_type=og.permissionInfo[genid].member_types[member_id];if(!mem_type)return false;var allowed=og.permissionInfo[genid].allowedOtByMemType[mem_type];for(var i=0;i<allowed.length;i++){if(allowed[i]==obj_type)return true;}
return false;}
og.setReadOnlyObjectTypeRow=function(genid,dim_id,obj_type,readonly){for(var i=0;i<4;i++){var radio=null;var el=Ext.get(genid+'rg_'+i+'_'+dim_id+'_'+obj_type);if(el)radio=el.dom;if(radio)radio.disabled=readonly;}
var label=Ext.get(genid+'obj_type_label'+dim_id+'_'+obj_type);if(label){if(readonly)label.addClass('desc');else label.removeClass('desc');}}
og.loadMemberPermissions=function(genid,dim_id,member_id){var allowed_ot=og.permissionInfo[genid].allowedOt;var member_perms=og.getPermissionsForMember(genid,member_id);for(var i=0;i<allowed_ot[dim_id].length;i++){var val=0;var found=false;for(var j=0;j<member_perms.length;j++){var perm=member_perms[j];if(!perm)continue;if(perm.o==allowed_ot[dim_id][i]){val=perm.w==1&&perm.d==1?3:(perm.w==1?2:(perm.r?1:0));found=true;break;}}
if(!found){og.permissionInfo[genid].permissions[member_id].push({o:allowed_ot[dim_id][i],d:0,w:0,r:0});}
og.ogSetCheckedValue(document.getElementsByName(genid+"rg_"+dim_id+"_"+allowed_ot[dim_id][i]),val);og.setReadOnlyObjectTypeRow(genid,dim_id,allowed_ot[dim_id][i],!og.canEditPermissionObjType(genid,member_id,allowed_ot[dim_id][i]));}
og.permSetCheckboxesSelected(member_perms);og.eventManager.fireEvent('on load member permissions for user',{genid:genid,dim_id:dim_id,member_id:member_id});}
og.ogPermValueChanged=function(genid,dim_id,obj_type){var member_id=og.permissionInfo[genid].selectedMember;var member_perms=og.getPermissionsForMember(genid,member_id);for(var i=0;i<member_perms.length;i++){var tmp=member_perms[i];if(tmp.o==obj_type){perm=tmp;break;}}
if(!perm)return;var value=og.ogGetCheckedValue(document.getElementsByName(genid+"rg_"+dim_id+"_"+obj_type));perm.modified=true;perm.d=(value==3);perm.w=(value>=2);perm.r=(value>=1);og.markMemberPermissionModified(genid,dim_id,member_id);og.permSetCheckboxesSelected(member_perms);}
og.permSetCheckboxesSelected=function(perms,base_cls){var assigned_vals=[];for(var i=0;i<perms.length;i++){var tmp=perms[i];var v=Boolean(tmp.d)?3:(Boolean(tmp.w)?2:(Boolean(tmp.r)?1:0));if(assigned_vals.indexOf(v)==-1)assigned_vals.push(v);}
if(!base_cls)base_cls="all-radio-sel-chk";$("."+base_cls).removeAttr('checked');if(assigned_vals.length==1){$("."+base_cls+"#chk-"+assigned_vals[0]).attr('checked','checked');}}
og.hasAllPermissions=function(genid,member_id,member_permissions){for(var i=0;i<member_permissions.length;i++){if(!member_permissions[i]||!og.canEditPermissionObjType(genid,member_id,member_permissions[i].o))continue;if(!(member_permissions[i].d&&member_permissions[i].w&&member_permissions[i].r))return false;}
return true;}
og.hasAnyPermissions=function(genid,member_id){var member_perms=og.getPermissionsForMember(genid,member_id);for(var x=0;x<member_perms.length;x++){if(!member_perms[x]||!og.canEditPermissionObjType(genid,member_id,member_perms[x].o))continue;if(member_perms[x]&&member_perms[x].r==1)return true;}
return false;}
og.ogPermSetLevel=function(genid,dim_id,level){var member_id=og.permissionInfo[genid].selectedMember;var member_perms=og.getPermissionsForMember(genid,member_id);for(var i=0;i<member_perms.length;i++){if(!member_perms[i]){member_perms[i]={o:og.permissionInfo[genid].allowedOt[dim_id][i],d:0,w:0,r:0};og.addPermissionsForMember(genid,member_id,member_perms[i]);}
var radio_el=document.getElementById(genid+"rg_"+level+"_"+dim_id+"_"+member_perms[i].o);if(!radio_el||radio_el.style.display=='none'){continue;}
member_perms[i].d=(level==3);member_perms[i].w=(level>=2);member_perms[i].r=(level>=1);member_perms[i].modified=true;og.ogSetCheckedValue(document.getElementsByName(genid+"rg_"+dim_id+"_"+member_perms[i].o),level);}
og.markMemberPermissionModified(genid,dim_id,member_id);$(".all-radio-sel-chk").removeAttr('checked');$(".all-radio-sel-chk#chk-"+level).attr('checked','checked');}
og.ogPermSetLevelCheckbox=function(checkbox,genid,dim_id,radio_id){var is_checked=$(checkbox).attr('checked')=='checked';var id=is_checked?radio_id:0;og.ogPermSetLevel(genid,dim_id,id);}
og.ogPermAllChecked=function(genid,dim_id,value){var level=value?3:0;if(level==3){og.ogPermSetLevel(genid,1);og.ogPermSetLevel(genid,2);og.ogPermSetLevel(genid,3);}else{og.ogPermSetLevel(genid,level);}}
og.ogPermApplyToSubmembers=function(genid,dim_id,from_root_node){var member_id=og.permissionInfo[genid].selectedMember;var member_perms=og.getPermissionsForMember(genid,member_id);var trees=[Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree'),Ext.getCmp(genid+'_without_permissions_'+dim_id+'-tree')];for(var t=0;t<trees.length;t++){var tree=trees[t];if(from_root_node){var node=tree.getRootNode();}else{var node=tree.getNodeById(member_id);}
if(!node)return;node.submember_ids=og.ogPermGetSubMemberIdsFromNode(node);node.expanded_subnodes=0;node.expand(true,false,function(n){if(isNaN(n.id)&&n.id!=tree.getRootNode().id){return;}
node.expanded_subnodes++;if(node.expanded_subnodes<node.submember_ids.length+1){return;}
for(var i=0;i<node.submember_ids.length;i++){og.deletePermissionsForMember(genid,node.submember_ids[i]);for(var j=0;j<member_perms.length;j++){if(!member_perms[j]){if(og.tmp_role_id[genid]&&og.defaultRolePermissions){var role_id=og.tmp_role_id[genid];var def_perms=og.defaultRolePermissions[role_id];member_perms[j]={o:ot,d:def_perms[ot].d,w:def_perms[ot].w,r:def_perms[ot].r,modified:true};}
if(!member_perms[j]){member_perms[j]={o:og.permissionInfo[genid].allowedOt[dim_id][j].o,d:0,w:0,r:0};}
og.addPermissionsForMember(genid,member_id,member_perms[j]);}
var radio=Ext.get(genid+'rg_3_'+dim_id+'_'+member_perms[j].o);var perm={o:member_perms[j].o,d:member_perms[j].d,w:member_perms[j].w,r:member_perms[j].r,modified:true};og.addPermissionsForMember(genid,node.submember_ids[i],perm);}
og.markMemberPermissionModified(genid,dim_id,node.submember_ids[i]);}
og.eventManager.fireEvent('after apply permissions to submembers',{node:node,dim_id:dim_id,subids:node.submember_ids,member_id:member_id,genid:genid,mark_modified:true});});}}
og.eventManager.addListener('after apply permissions to submembers',function(data){var node=data.node;var ids=data.subids;var dim_id=data.dim_id;var member_id=data.member_id;og.ogPermRelocateNodesInTrees(genid,dim_id,ids);if(!node.hasChildNodes()&&node.ownerTree){if(node.ownerTree.getId()==genid+'_with_permissions_'+dim_id+'-tree'&&!og.hasAnyPermissions(genid,member_id)||node.ownerTree.getId()==genid+'_without_permissions_'+dim_id+'-tree'&&og.hasAnyPermissions(genid,member_id)){node.remove();}}
if(data.mark_modified){for(var i=0;i<ids.length;i++){og.markMemberPermissionModified(genid,dim_id,ids[i]);}}});og.ogPermApplyToAllMembers=function(genid,dim_id){og.ogPermApplyToSubmembers(genid,dim_id,true);}
og.ogPermGetSubMemberIdsFromNode=function(node){var result=new Array();if(node&&node.firstChild){var children=node.childNodes;for(var i=0;i<children.length;i++){if(children[i]&&!isNaN(children[i].id)){result[result.length]=children[i].id;result=result.concat(og.ogPermGetSubMemberIdsFromNode(children[i]));}}}
return result;}
og.ogPermRelocateNodesInTrees=function(genid,dim_id,ids){new_ids=[];for(var i=0;i<ids.length;i++)new_ids.push(parseInt(ids[i]));ids=new_ids;var perm_tree=Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree');var no_perm_tree=Ext.getCmp(genid+'_without_permissions_'+dim_id+'-tree');var nodes_to_remove=[];for(var i=0;i<ids.length;i++){var member_id=parseInt(ids[i]);var node=perm_tree.getNodeById(member_id);if(node&&!og.hasAnyPermissions(genid,member_id)){var node_exist=no_perm_tree.getNodeById(member_id);if(node_exist){node_exist.ensureVisible();}else{og.ogPermInsertNodeInTree(node,no_perm_tree,{cancel:false});}
if(node.parentNode){if(!node.hasChildNodes())node.remove();else nodes_to_remove.push(node);}}else{var node2=no_perm_tree.getNodeById(member_id);if(node2&&og.hasAnyPermissions(genid,member_id)){var node_exist=perm_tree.getNodeById(node2.id);if(node_exist){node_exist.ensureVisible();}else{og.ogPermInsertNodeInTree(node2,perm_tree,{cancel:false});}
if(node2.parentNode){if(!node2.hasChildNodes())node2.remove();else nodes_to_remove.push(node2);}}}}
nodes_to_remove.reverse();for(var j=0;j<nodes_to_remove.length;j++){node=nodes_to_remove[j];if(!node.hasChildNodes())node.remove();}}
og.setDefaultPermissionsForMember=function(genid,dimension_id,member_id,role_id){var current_permissions=og.getPermissionsForMember(genid,member_id);var perms=og.defaultRolePermissions[role_id];for(ot in perms){var id='';if(perms[ot].d=="1")id=(genid+'rg_3_'+dimension_id+'_'+ot);else if(perms[ot].w=="1")id=(genid+'rg_2_'+dimension_id+'_'+ot);else if(perms[ot].r=="1")id=(genid+'rg_1_'+dimension_id+'_'+ot);if(id!=''&&document.getElementById(id)){var new_p={o:ot,d:perms[ot].d,w:perms[ot].w,r:perms[ot].r,modified:true};og.addPermissionsForMember(genid,member_id,new_p);$("#"+id).click();}}}
og.ogPermInsertNodeHierarchy=function(node,tree_to){var empty_nodes=[];for(var i=0;i<tree_to.getRootNode().childNodes.length;i++){var elnode=tree_to.getRootNode().childNodes[i];if(elnode&&elnode.text=='')empty_nodes.push(elnode);}
for(var i=0;i<empty_nodes.length;i++){empty_nodes[i].remove();}
var new_node=new Ext.tree.TreeNode(node.attributes);new_node.object_type_id=node.object_type_id;new_node.dimension_id=node.dimension_id;var node_id=node.id;if(!isNaN(node.parentNode.id)&&node.parentNode.id>0){var to_parent=tree_to.getNodeById(node.parentNode.id);if(to_parent){to_parent.expand();var ok=to_parent.appendChild(new_node);}else{og.ogPermInsertNodeHierarchy(node.parentNode,tree_to);to_parent=tree_to.getNodeById(node.parentNode.id);to_parent.expand();var ok=to_parent.appendChild(new_node);}}else{var ok=tree_to.getRootNode().appendChild(new_node);}
var inserted=tree_to.getNodeById(node_id)
if(inserted)inserted.ensureVisible();}
og.ogPermRemoveNodeHierarchy=function(node,child_id){node.expand(true,false,function(){var can_remove=false;if(!node.childNodes||node.childNodes.length==0){can_remove=true;}else{if(node.childNodes.length==1&&child_id&&(!node.firstChild||node.firstChild.id==child_id)){can_remove=true;}}
if(can_remove){if(node.parentNode&&!isNaN(node.parentNode.id)&&node.parentNode.id>0){og.ogPermRemoveNodeHierarchy(node.parentNode,node.id);}
node.remove();}});}
og.ogPermInsertNodeInTree=function(node,tree_to,dropEvent){og.ogPermInsertNodeHierarchy(node,tree_to);og.ogPermRemoveNodeHierarchy(node);dropEvent.cancel=true;return dropEvent;}
og.permissionsDDAddRemovePermissions=function(dropEvent){var tree_from=dropEvent.source.tree;var tree_to=dropEvent.tree;var node=dropEvent.data.node;if(tree_from.id==tree_to.id){dropEvent.cancel=true;return;}
var node_exist=tree_to.getNodeById(node.id);if(node_exist){dropEvent.cancel=true;if(!node.hasChildNodes())node.remove();node_exist.ensureVisible();}
if(!dropEvent.cancel){node.expand(true);dropEvent=og.ogPermInsertNodeInTree(node,tree_to,dropEvent);}
var remove_permissions=true;if(tree_from.id.indexOf('_without_permissions_')>0){remove_permissions=false;}
if(!isNaN(node.id)){if(remove_permissions){og.permissionInfo[genid].selectedMember=node.id;og.ogPermSetLevel(genid,tree_to.dimensionId,0);if(node.hasChildNodes()){var tree_title=tree_to.title.toLowerCase().replace("&","and");var question=lang('do you want to remove permissions for all submembers too',tree_title,node.text);$("#"+genid+"ask_to_remove_sumbembers_text").html(question);$("#"+genid+"parent_member_removed_perms").val(node.id);$("#"+genid+"dimension_id_removed_perms").val(tree_to.dimensionId);$('#'+genid+'ask_to_remove_from_submembers').modal({'escClose':true,'overlayClose':false,'closeHTML':'<a id="'+genid+'_remove_submembers_close_link" class="modal-close" title="'+lang('close')+'"></a>','onShow':function(dialog){$("#"+genid+"_close_link").addClass("modal-close-img");}});}}else{og.showPermissionsPopup(genid,tree_to.dimensionId,node.id,node.text,true);}}}
og.toggleManualPermissions=function(genid,is_modal){var checked=$("#"+genid+"_set_manual_permissions_checkbox").attr('checked')=='checked';$("#"+genid+"_set_manual_permissions").val(checked?1:0);if(checked){$("#"+genid+"_dimension_permissions").show();$("#"+genid+"_manual_perm_help").hide();var type=$("#"+genid+"_user_type_sel_role").find('option:selected').val();var executive_selected=og.executive_permission_group_ids.indexOf(parseInt(type))>=0;if(executive_selected){$("#"+genid+"_root_permissions").show();}else{$("#"+genid+"_root_permissions").hide();}
if(is_modal){setTimeout(function(){$("#"+genid+"permissions").animate({scrollTop:$("#"+genid+"_set_manual_permissions_checkbox").offset().top-120});},600);og.resize_modal_form();}else{$("#"+genid+"permissions").closest('form').parent().animate({scrollTop:$("#"+genid+"_set_manual_permissions_checkbox").offset().top-140});}}else{$("#"+genid+"_dimension_permissions").hide();$("#"+genid+"_root_permissions").hide();$("#"+genid+"_manual_perm_help").show();}}
og.removePermissionsForSubmembers=function(genid){var dim_id=$("#"+genid+"dimension_id_removed_perms").val();og.ogPermApplyToSubmembers(genid,dim_id);var tree=Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree');node=tree.getNodeById(og.permissionInfo[genid].selectedMember);if(node)node.remove();}
og.showPermissionsPopup=function(genid,dim_id,mem_id,name,set_default_permissions){og.permissionInfo[genid].selectedMember=mem_id;og.loadMemberPermissions(genid,dim_id,mem_id);$('#'+genid+'_'+dim_id+'member_name').html(name);var tree=Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree');var member_type='member';var member_node=tree.getNodeById(mem_id);if(member_node){member_type=og.objectTypes[member_node.object_type_id].c_name;}
var tree_title=tree.title.toLowerCase().replace("&","and");$("#"+genid+"_"+dim_id+"_apply_to_submembers_label").html(lang('apply to all submembers',tree_title,name));$("#"+genid+"_"+dim_id+"_apply_to_all_members_label").html(lang('apply to all members',tree_title));$("#"+genid+"_"+dim_id+"_apply_to_only_current_label").html(lang('apply to only current',member_type));$('#'+genid+'member_permissions'+dim_id).modal({'escClose':true,'overlayClose':false,'closeHTML':'<a id="'+genid+'_close_link" class="modal-close" title="'+lang('close')+'"></a>','onShow':function(dialog){$("#"+genid+"_close_link").addClass("modal-close-img");var role_id=$("#"+genid+"_user_type_sel_role").val();if(set_default_permissions){og.setDefaultPermissionsForMember(genid,dim_id,mem_id,role_id);}
og.showHidePermissionsRadioButtonsByRole(genid,dim_id,role_id);}});}
og.showHidePermissionsRadioButtonsByRole=function(genid,dim_id,role_id){var max_perms=og.maxRoleObjectTypePermissions[role_id];var object_types=[];var ot_radios=$("#"+genid+"member_permissions"+dim_id+" input.radio_3");for(var j=0;j<ot_radios.length;j++){var ot=ot_radios[j].id.substring(ot_radios[j].id.lastIndexOf('_')+1);object_types.push(ot);}
if(!max_perms){for(var i=0;i<object_types.length;i++){var ot=object_types[i];$("#"+genid+"rg_3_"+dim_id+'_'+ot).show();$("#"+genid+"rg_2_"+dim_id+'_'+ot).show();$("#"+genid+"rg_1_"+dim_id+'_'+ot).show();}}else{for(var i=0;i<object_types.length;i++){var ot=object_types[i];if(max_perms[ot]&&max_perms[ot].can_delete)$("#"+genid+"rg_3_"+dim_id+'_'+ot).show();else $("#"+genid+"rg_3_"+dim_id+'_'+ot).hide();if(max_perms[ot]&&max_perms[ot].can_write)$("#"+genid+"rg_2_"+dim_id+'_'+ot).show();else $("#"+genid+"rg_2_"+dim_id+'_'+ot).hide();if(max_perms[ot])$("#"+genid+"rg_1_"+dim_id+'_'+ot).show();else $("#"+genid+"rg_1_"+dim_id+'_'+ot).hide();}}}
og.onApplyToRadioChange=function(radio,genid,dimension_id){$("#"+genid+"_"+dimension_id+"_apply_to").val(radio.value);}
og.afterChangingPermissions=function(genid,dimension_id){var member_id=og.permissionInfo[genid].selectedMember;var permissions=og.getPermissionsForMember(genid,member_id);var apply_to=$("#"+genid+"_"+dimension_id+"_apply_to").val();if(apply_to=='apply_to_all'){var hf=document.getElementById(genid+'hfPermsApplyToAll');if(hf){var all_member_permissions=hf.value==''?{}:Ext.util.JSON.decode(hf.value);all_member_permissions[dimension_id]=permissions;hf.value=Ext.util.JSON.encode(all_member_permissions);og.ogPermApplyToAllMembers(genid,dimension_id);var hf_sub=document.getElementById(genid+'hfPermsApplyToSubmembers');if(hf_sub)hf_sub.value='';}}
if(apply_to=='apply_to_submembers'){var hf=document.getElementById(genid+'hfPermsApplyToSubmembers');if(hf){var sub_member_permissions=hf.value==''?{}:Ext.util.JSON.decode(hf.value);sub_member_permissions[member_id]=permissions;hf.value=Ext.util.JSON.encode(sub_member_permissions);og.ogPermApplyToSubmembers(genid,dimension_id);}}}
og.markMemberPermissionModified=function(genid,dim_id,member_id){var trees=[Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree'),Ext.getCmp(genid+'_without_permissions_'+dim_id+'-tree')];for(var t=0;t<trees.length;t++){var tree=trees[t];if(!tree)return;var node=tree.getNodeById(member_id);if(node){if(og.hasAnyPermissions(genid,member_id)){node.getUI().removeClass('tree-node-no-permissions');node.getUI().addClass('tree-node-modified');}else{node.getUI().removeClass('tree-node-modified');node.getUI().addClass('tree-node-no-permissions');}
var pnode=node.parentNode;while(pnode&&!isNaN(pnode.id)){if(!og.hasAnyPermissions(genid,pnode.id)){pnode.getUI().addClass('tree-node-no-permissions');}
pnode=pnode.parentNode;}}}}
og.ogPermPrepareSendData=function(genid){var result=new Array();if(!og.permissionInfo[genid]){return true;}
var permissions=og.permissionInfo[genid].permissions;for(i in permissions){for(var j=0;j<permissions[i].length;j++){var p=permissions[i][j];if(p&&p.modified){result[result.length]={'m':i,'o':p.o,'d':p.d,'w':p.w,'r':p.r};}}}
var hf=document.getElementById(genid+'hfPermsSend');if(hf){hf.value=Ext.util.JSON.encode(result);}
var hfpg=document.getElementById(genid+'hfPgId');var pg_id=hfpg?hfpg.value:0;og.eventManager.fireEvent('on send user permissions',{pg_id:pg_id,perms:result,genid:genid});return true;}
og.removeAllPermissionsForObjType=function(genid,obj_type){for(member_id in og.permissionInfo[genid].permissions){for(var i=0;i<og.permissionInfo[genid].permissions[member_id].length;i++){var perm=og.permissionInfo[genid].permissions[member_id][i];if(perm.o==obj_type){perm.r=0;perm.w=0;perm.d=0;break;}}}
for(var i=0;i<og.permissionDimensions.length;i++){var radio=document.getElementsByName(genid+"rg_"+og.permissionDimensions[i]+"_"+obj_type);if(radio)og.ogSetCheckedValue(radio,0);}}
og.ogGetCheckedValue=function(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
og.ogSetCheckedValue=function(radioObj,newValue){if(!radioObj)
return;var radioLength=radioObj.length;if(radioLength==undefined){radioObj.checked=(radioObj.value==newValue.toString());return;}
for(var i=0;i<radioLength;i++){radioObj[i].checked=false;if(radioObj[i].value==newValue.toString()){radioObj[i].checked=true;}}}
og.afterUserTypeChangeAndPermissionsClick=function(genid){if(og.tmp_must_check_member_permissions&&og.tmp_must_check_member_permissions[genid]){if(og.is_new_contact){og.setDefaultPermissionsForAllMembers(genid);}else{og.checkMemberPermissionsForRole(genid);}}}
og.checkMemberPermissionsForRole=function(genid){var def_perms=og.defaultRolePermissions[og.tmp_role_id[genid]];var permissions=og.permissionInfo[genid].permissions;var all_mem_ids=[];for(mem_id in permissions){var perms=permissions[mem_id];for(var i=0;i<perms.length;i++){var p=perms[i];var dp=def_perms[parseInt(p.o)];if(!dp)dp={};if(!parseInt(dp.d)&&parseInt(p.d)||!parseInt(dp.w)&&parseInt(p.w)||!parseInt(dp.r)&&parseInt(p.r)){p.modified=true;if(!parseInt(dp.d))p.d=0;if(!parseInt(dp.w))p.w=0;if(!parseInt(dp.r))p.r=0;all_mem_ids.push(mem_id);}}}
var trees=[];var containers=$(".single-tree.member-chooser-container");for(var i=0;i<containers.length;i++){var id=containers[i].id;if(idx=containers[i].id.indexOf('with_permissions')>=0){dim_id=containers[i].id.replace('-container','');dim_id=dim_id.substring(containers[i].id.lastIndexOf('_')+1);}
trees.push(Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree'));trees.push(Ext.getCmp(genid+'_without_permissions_'+dim_id+'-tree'));}
for(var t=0;t<trees.length;t++){var tree=trees[t];og.ogPermRelocateNodesInTrees(genid,tree.dimensionId,all_mem_ids);}}
og.setDefaultPermissionsForAllMembers=function(genid){var def_perms=og.defaultRolePermissions[og.tmp_role_id[genid]];var trees=[];var containers=$(".single-tree.member-chooser-container");for(var i=0;i<containers.length;i++){var id=containers[i].id;if(idx=containers[i].id.indexOf('with_permissions')>=0){dim_id=containers[i].id.replace('-container','');dim_id=dim_id.substring(containers[i].id.lastIndexOf('_')+1);}
trees.push(Ext.getCmp(genid+'_with_permissions_'+dim_id+'-tree'));trees.push(Ext.getCmp(genid+'_without_permissions_'+dim_id+'-tree'));}
if(og.config.with_perm_user_types.indexOf(og.tmp_role_id[genid])<0){for(var t=0;t<trees.length;t++){var tree=trees[t];var mem_ids=og.ogPermGetSubMemberIdsFromNode(tree.getRootNode());for(var j=0;j<mem_ids.length;j++){if(isNaN(mem_ids[j]))continue;og.deletePermissionsForMember(genid,mem_ids[j]);}
og.ogPermRelocateNodesInTrees(genid,tree.dimensionId,mem_ids);}}else{for(var t=0;t<trees.length;t++){var tree=trees[t];var mem_ids=og.ogPermGetSubMemberIdsFromNode(tree.getRootNode());for(var j=0;j<mem_ids.length;j++){if(isNaN(mem_ids[j]))continue;og.deletePermissionsForMember(genid,mem_ids[j]);for(ot in def_perms){var p={o:ot,d:def_perms[ot].d,w:def_perms[ot].w,r:def_perms[ot].r,modified:true};og.addPermissionsForMember(genid,mem_ids[j],p);}}
og.ogPermRelocateNodesInTrees(genid,tree.dimensionId,mem_ids);}}
og.ogPermPrepareSendData(genid);}
og.userPermissions={};og.userPermissions.permissionInfo={};og.userPermissions.loadPermissions=function(genid,selector_id){var hf=document.getElementById(genid+'hfPerms');if(hf&&hf.value!=''){var hf_ot=document.getElementById(genid+'hfAllowedOT');og.userPermissions.permissionInfo[genid]={permissions:Ext.util.JSON.decode(hf.value),original_permissions:Ext.util.JSON.decode(hf.value),allowedOt:Ext.util.JSON.decode(hf_ot.value)}
if(selector_id){og.userPermissions.permissionInfo[genid].selectorId=selector_id;for(pg_id in og.userPermissions.permissionInfo[genid].permissions){og.userPermissions.setCheckedPG(genid,pg_id);}}
Ext.removeNode(hf);Ext.removeNode(hf_ot);}else{og.userPermissions.permissionInfo[genid]={};}}
og.userPermissions.setCheckedPG=function(genid,pg_id){var selector=Ext.getCmp(genid+og.userPermissions.permissionInfo[genid].selectorId);if(!selector)return;var node=selector.getNodeById(selector.nodeId(pg_id));if(node){node.ensureVisible();node.suspendEvents();var checked=og.userPermissions.hasAnyPermissions(genid,pg_id);node.ui.toggleCheck(checked);node.user.checked=checked;node.resumeEvents();}}
og.userPermissions.getPermissionsForPG=function(genid,pg_id){if(!og.userPermissions.permissionInfo[genid].permissions[pg_id]){og.userPermissions.permissionInfo[genid].permissions[pg_id]=[];}
return og.userPermissions.permissionInfo[genid].permissions[pg_id];}
og.userPermissions.loadPGPermissions=function(genid,pg_id){var allowed_ot=og.userPermissions.permissionInfo[genid].allowedOt;var permissions=og.userPermissions.getPermissionsForPG(genid,pg_id);for(var i=0;i<allowed_ot.length;i++){var val=0;var found=false;for(var j=0;j<permissions.length;j++){var perm=permissions[j];if(perm.o==allowed_ot[i]){val=perm.w==1&&perm.d==1?3:(perm.w==1?2:(perm.r?1:0));found=true;break;}}
if(!found){og.userPermissions.permissionInfo[genid].permissions[pg_id].push({o:allowed_ot[i],d:0,w:0,r:0});}
$(".member.permission-form-container #"+genid+'rg_'+val+'_'+allowed_ot[i]).attr("checked","checked");}
og.permSetCheckboxesSelected(permissions);}
og.userPermissions.hasAllPermissions=function(genid,pg_id){var permissions=og.userPermissions.getPermissionsForPG(genid,pg_id);for(var i=0;i<permissions.length;i++){if(!(permissions[i].d&&permissions[i].w&&permissions[i].r))return false;}
return true;}
og.userPermissions.hasAnyPermissions=function(genid,pg_id){var permissions=og.userPermissions.getPermissionsForPG(genid,pg_id);for(var i=0;i<permissions.length;i++){if(permissions[i].d||permissions[i].w||permissions[i].r)return true;}
return false;}
og.userPermissions.ogPermSetLevel=function(genid,level){var pg_id=og.userPermissions.permissionInfo[genid].selectedPG;var permissions=og.userPermissions.getPermissionsForPG(genid,pg_id);for(var i=0;i<permissions.length;i++){var radio_el=document.getElementById(genid+"rg_"+level+"_"+permissions[i].o);if(!radio_el||radio_el.style.display=='none'){continue;}
permissions[i].d=(level==3);permissions[i].w=(level>=2);permissions[i].r=(level>=1);permissions[i].modified=true;og.ogSetCheckedValue(document.getElementsByName(genid+"rg_"+permissions[i].o),level);}
og.userPermissions.setCheckedPG(genid,pg_id);$(".all-radio-sel-chk").removeAttr('checked');$(".all-radio-sel-chk#chk-"+level).attr('checked','checked');}
og.userPermissions.ogPermSetLevelCheckbox=function(checkbox,genid,radio_id){var is_checked=$(checkbox).attr('checked')=='checked';var id=is_checked?radio_id:0;og.userPermissions.ogPermSetLevel(genid,id);}
og.userPermissions.ogPermValueChanged=function(genid,obj_type){var pg_id=og.userPermissions.permissionInfo[genid].selectedPG;var permissions=og.userPermissions.getPermissionsForPG(genid,pg_id);var perm=null;for(var i=0;i<permissions.length;i++){var tmp=permissions[i];if(tmp.o==obj_type){perm=tmp;break;}}
if(perm==null)return;var value=og.ogGetCheckedValue(document.getElementsByName(genid+"rg_"+obj_type));perm.modified=true;perm.d=(value==3);perm.w=(value>=2);perm.r=(value>=1);og.userPermissions.setCheckedPG(genid,pg_id);og.permSetCheckboxesSelected(permissions);}
og.userPermissions.ogPermAllChecked=function(genid,value){var level=value?3:0;if(level==3){og.userPermissions.ogPermSetLevel(genid,1);og.userPermissions.ogPermSetLevel(genid,2);og.userPermissions.ogPermSetLevel(genid,3);}else{og.userPermissions.ogPermSetLevel(genid,level);}}
og.userPermissions.ogPermPrepareSendData=function(genid,send_all){var result=new Array();if(!og.userPermissions.permissionInfo[genid]){return true;}
var permissions=og.userPermissions.permissionInfo[genid].permissions;for(i in permissions){if(!permissions[i]||typeof(permissions[i])=='function')continue;for(var j=0;j<permissions[i].length;j++){var p=permissions[i][j];if(p&&typeof(p)!='function'&&(p.modified||send_all)){result[result.length]={'pg':i,'o':p.o,'d':p.d,'w':p.w,'r':p.r};}}}
var hf=document.getElementById(genid+'hfPermsSend');if(hf){hf.value=Ext.util.JSON.encode(result);}
return true;}
og.userPermissions.afterChangingPermissions=function(genid){if(!og.userPermissions.hasAnyPermissions(genid,og.userPermissions.current_pg_id)){$('#'+genid+'_pg_'+og.userPermissions.current_pg_id).remove();}
if(og.on_member_permissions_after_change&&og.on_member_permissions_after_change.length>0){for(var x=0;x<og.on_member_permissions_after_change.length;x++){var func=og.on_member_permissions_after_change[x];if(typeof(func)=='function'){func.call(null,genid,og.userPermissions.current_pg_id);}}}
og.userPermissions.current_pg_id=0;}
og.userPermissions.showPermissionsPopup=function(container,genid,user_type){var id=$(container).attr('id');var pg_id=id.substr(id.lastIndexOf('_')+1);var name=$("#username_"+pg_id).html();var is_guest=$("#"+genid+"_is_guest_"+pg_id).val()>0;if(!user_type)user_type=$("#"+genid+"_user_type_"+pg_id).val();var dim_id=$("#"+genid+"_dim_id").val();var tree=Ext.getCmp("dimension-panel-"+dim_id);if(tree){var mem_name=$("#"+genid+"-name").val();var tree_title=tree.title.toLowerCase().replace("&","and");$("#"+genid+"_apply_to_submembers_label").html(lang('apply to all submembers',tree_title,mem_name));}
og.userPermissions.onUserSelect(genid,{id:pg_id,n:name,isg:is_guest});og.userPermissions.showHidePermissionsRadioButtonsByRole(genid,user_type);og.userPermissions.current_pg_id=pg_id;var id=$('#'+genid+'member_permissions').attr('id');var html=$('#'+genid+'member_permissions').html();og.ExtModal.show({basecls:'member-permissions-definition',html:'<div id="'+id+'" class="member permission-form-container">'+html+'</div>'});og.userPermissions.loadPGPermissions(genid,pg_id);$(".member-permissions-definition.ext-modal-object-list .x-tool-close").click(function(){og.userPermissions.cancelPermissionsModification(genid,og.userPermissions.current_pg_id);});var permissions=og.userPermissions.permissionInfo[genid].permissions[pg_id];if(permissions.length>0){for(var i=0;i<permissions.length;i++){if(permissions[i])permissions[i].modified=true;}}}
og.userPermissions.cancelPermissionsModification=function(genid,pg_id){var json=Ext.util.JSON.encode(og.userPermissions.permissionInfo[genid].original_permissions[pg_id]);og.userPermissions.permissionInfo[genid].permissions[pg_id]=Ext.util.JSON.decode(json);}
og.userPermissions.showHidePermissionsRadioButtonsByRole=function(genid,role_id){var max_perms=og.maxRoleObjectTypePermissions[role_id];var object_types=[];var ot_radios=$("#"+genid+"member_permissions input.radio_3");for(var j=0;j<ot_radios.length;j++){var ot=ot_radios[j].id.substring(ot_radios[j].id.lastIndexOf('_')+1);object_types.push(ot);}
var dim_id=$("#"+genid+"_dim_id").val();if(!max_perms){for(var i=0;i<object_types.length;i++){var ot=object_types[i];$("#"+genid+"rg_3_"+dim_id+'_'+ot).show();$("#"+genid+"rg_2_"+dim_id+'_'+ot).show();$("#"+genid+"rg_1_"+dim_id+'_'+ot).show();}}else{for(var i=0;i<object_types.length;i++){var ot=object_types[i];if(max_perms[ot]&&max_perms[ot].can_delete)$("#"+genid+"rg_3_"+ot).show();else $("#"+genid+"rg_3_"+ot).hide();if(max_perms[ot]&&max_perms[ot].can_write)$("#"+genid+"rg_2_"+ot).show();else $("#"+genid+"rg_2_"+ot).hide();if(max_perms[ot])$("#"+genid+"rg_1_"+ot).show();else $("#"+genid+"rg_1_"+ot).hide();}}}
og.userPermissions.onUserSelect=function(genid,arguments){var panel=Ext.get(genid+'member_permissions');var pg_id=arguments['id'];var name=arguments['n'];og.showHideNonGuestPermissionOptions(arguments['isg']);og.userPermissions.permissionInfo[genid].selectedPG=pg_id;og.userPermissions.loadPGPermissions(genid,pg_id);Ext.get(genid+'pg_name').dom.innerHTML=name;if(og.on_member_permissions_user_select&&og.on_member_permissions_user_select.length>0){for(var x=0;x<og.on_member_permissions_user_select.length;x++){var func=og.on_member_permissions_user_select[x];if(typeof(func)=='function'){func.call(null,genid,pg_id);}}}}
og.userPermissions.removeAllPermissions=function(genid){og.userPermissions.permissionInfo[genid].permissions={};}
og.userPermissions.reload_member_permissions=function(genid,dimension_id,parent_id){if(og.member_is_new){og.openLink(og.getUrl('member','get_parent_permissions',{dim_id:dimension_id,parent:parent_id}),{preventPanelLoad:true,callback:function(success,data){if(data.perms){$("#"+genid+"_permissions_list").html("");$("#"+genid+"_more_users_permissions").hide();og.userPermissions.removeAllPermissions(genid);for(pg_id in data.perms){var p=data.perms[pg_id];og.userPermissions.permissionInfo[genid].permissions[pg_id]=p;og.userPermissions.drawUserListItem(genid,data.pg_data[pg_id],true);}}}});}}
og.userPermissions.drawUserListItem=function(genid,item,noclick){var el=document.getElementById(genid+'_pg_'+item.pg_id);if(!el){var html='<li class="user-data" id="'+genid+'_pg_'+item.pg_id+'" onclick="og.userPermissions.showPermissionsPopup(this, \''+genid+'\','+item.role_id+');">';if(item.type=='group'){html+='<div class="coViewIconImage ico-large-group"></div>';}else if(item.picture_url){html+='<div class="coViewIconImage"><img src="'+item.picture_url+'" alt="'+item.name+'" /></div>';}else{html+='<div class="coViewIconImage ico-large-contact"></div>';}
html+='<div class="user-name-container">'+'<span id="username_'+item.pg_id+'" class="bold">'+item.name+'</span>'+'<input id="'+genid+'_is_guest_'+item.pg_id+'" name="is_guest" type="hidden" value="'+item.is_guest+'"/>'+'<input id="'+genid+'_user_id_'+item.pg_id+'" name="user_id" type="hidden" value="'+(item.user_id?item.user_id:0)+'"/>'+'<div class="desc">'+(item.company_name?item.company_name:'')+'</div>'+'<div class="desc">'+(item.role?item.role:'')+'</div>'+'</div>'+'<div class="clear"></div>'+'</li>';$("#"+genid+"_permissions_list").append(html);}
if(!noclick){$("#"+genid+'_pg_'+item.pg_id).click();}}
og.showHideNonGuestPermissionOptions=function(guest_selected){if(guest_selected){$('.radio_3').hide();$('.radio_2').hide();$('.radio-title-3').hide();$('.radio-title-2').hide();$('.perm_all_checkbox_container').hide();}else{$('.radio_3').show();$('.radio_2').show();$('.radio-title-3').show();$('.radio-title-2').show();$('.perm_all_checkbox_container').show();}}
og.afterUserTypeChange=function(genid,type){if(!og.tmp_role_id)og.tmp_role_id={};og.tmp_role_id[genid]=type;$('#'+genid+'userSystemPermissions :input').attr('checked',false);$('#'+genid+'userModulePermissions :input').attr('checked',false);for(i=0;i<og.userRolesPermissions[type].length;i++){$('#'+genid+'userSystemPermissions :input[name$="sys_perm['+og.userRolesPermissions[type][i]+']"]').attr('checked',true);}
for(f=0;f<og.tabs_allowed[type].length;f++){$('#'+genid+og.tabs_allowed[type][f]+' :input').attr('checked',true);}
og.userPermissions.enableDisableSystemPermissionsByRole(genid,type);var guest_selected=false;for(j=0;j<og.guest_permission_group_ids.length;j++){if(type==og.guest_permission_group_ids[j]){guest_selected=true;break;}}
var executive_selected=og.executive_permission_group_ids.indexOf(parseInt(type))>=0;if(executive_selected){$("#"+genid+"_root_permissions").show();}else{$("#"+genid+"_root_permissions").hide();}
og.showHideNonGuestPermissionOptions(guest_selected);if(!og.tmp_must_check_member_permissions)og.tmp_must_check_member_permissions={};og.tmp_must_check_member_permissions[genid]=true;var hint_text=og.userRoles[type].hint;$("#"+genid+'user_role_explanation').html(hint_text);};og.userPermissions.savePermissions=function(genid,member_id){if(og.userPermissions.current_pg_id>0){og.userPermissions.ogPermPrepareSendData(genid);var hf=document.getElementById(genid+'hfPermsSend');if(hf){var to_send=[];var temp_pg_id=og.userPermissions.current_pg_id;var perms=Ext.util.JSON.decode(hf.value);if(perms.length>0){for(var i=0;i<perms.length;i++){if(perms[i].pg==temp_pg_id){to_send.push(perms[i]);}}}
var applysub=$("#"+genid+"apply_to_submembers:checked").length;if(to_send.length>0){var post_vars={pg_id:og.userPermissions.current_pg_id,member_id:member_id,apply_submembers:applysub,perms:Ext.util.JSON.encode(to_send)};if(og.before_send_member_permissions&&og.before_send_member_permissions.length>0){for(var x=0;x<og.before_send_member_permissions.length;x++){var func=og.before_send_member_permissions[x];if(typeof(func)=='function'){func.call(null,genid,post_vars);}}}
og.openLink(og.getUrl('member','save_permission_group'),{preventPanelLoad:true,post:post_vars,callback:function(success,data){if(success){var permissions=og.userPermissions.permissionInfo[genid].permissions[temp_pg_id];if(permissions.length>0){for(var i=0;i<permissions.length;i++){if(permissions[i])permissions[i].modified=false;}
var json=Ext.util.JSON.encode(permissions);og.userPermissions.permissionInfo[genid].original_permissions[temp_pg_id]=Ext.util.JSON.decode(json);}}}});}}}}
og.userPermissions.enableDisableSystemPermissionsByRole=function(genid,type){$('#'+genid+'userSystemPermissions :input').prop('disabled',true);$('#'+genid+'userSystemPermissions label').css('opacity','0.7');if(og.userMaxRolesPermissions[type]){for(i=0;i<og.userMaxRolesPermissions[type].length;i++){$('#'+genid+'userSystemPermissions :input[name$="sys_perm['+og.userMaxRolesPermissions[type][i]+']"]').prop('disabled',false);$('#'+genid+'userSystemPermissions label[for$="'+genid+'sys_perm['+og.userMaxRolesPermissions[type][i]+']"]').css('opacity','1.0');}}}
Ext.onReady(function(){Ext.get("loading").hide();Ext.MessageBox.getDialog().on("show",function(d){var div=Ext.get(d.el);div.setStyle("overflow","auto");var text=div.select(".ext-mb-textarea",true);if(!text.item(0))
text=div.select(".ext-mb-text",true);if(text.item(0))
text.item(0).dom.select();});if(og.preferences&&og.preferences['rememberGUIState']){Ext.state.Manager.setProvider(new og.HttpProvider({saveUrl:og.getUrl('gui','save_state'),readUrl:og.getUrl('gui','read_state'),autoRead:false}));Ext.state.Manager.getProvider().initState(og.initialGUIState);}
Ext.QuickTips.init();og.openLink(og.getUrl('panel','list_all'),{onSuccess:function(data){var panelData=data['panels'];og.panels={};var panels=[];for(var i=0;i<panelData.length;i++){og.eventManager.fireEvent("before tab panel construct",panelData[i]);if(panelData[i]['id']=='more-panel'&&panelData[i]['closable']){panelData[i].onClose=og.setSettingsClosed;}
var p=new og.ContentPanel(panelData[i]);og.panels[p.title]=p;panels.push(p);};var tab_panel=new Ext.TabPanel({id:'tabs-panel',region:'center',activeTab:0,enableTabScroll:false,listeners:{render:{fn:function(tabp){setTimeout(function(){og.checkAndAdjustTabsSize();},500);}},tabchange:{fn:function(tabp){setTimeout(function(){og.checkAndAdjustTabsSize(tabp.lastSize.width,tabp.items.length);},500);}}},items:(panels&&panels.length)?panels:null});var center_panel=new Ext.Panel({layout:'border',id:'center-panel',minWidth:800,region:'center',items:[tab_panel]});og.eventManager.addListener('config option changed',function(option){if(option.name.substring(0,7)=='enable_'&&option.name.substring(option.name.length-7)=='_module'){var module=option.name.substring(7,option.name.length-7);var tab=tab_panel.id+"__"+og.panels[module].id;Ext.get(tab).setDisplayed(option.value);}});var viewport=new Ext.Viewport({layout:'border',stateful:false,items:[new Ext.BoxComponent({region:'north',el:'header'}),new Ext.BoxComponent({region:'south',el:'footer'}),{region:'west',id:'menu-panel',split:true,width:250,minWidth:200,hideCollapseTool:true,collapseMode:'mini',collapsible:true,collapsed:og.menuPanelCollapsed,layout:'multi-accordion',listeners:{'resize':function(p){og.eventManager.fireEvent("menu-panel resize");setTimeout(function(){og.checkAndAdjustTabsSize();ogTasks.initColResize();},200);},'collapse':function(p){og.eventManager.fireEvent("menu-panel collapse");setTimeout(function(){og.checkAndAdjustTabsSize();ogTasks.initColResize();},200);},'expand':function(p){og.eventManager.fireEvent("menu-panel expand");setTimeout(function(){og.checkAndAdjustTabsSize();ogTasks.initColResize();},200);}},layoutConfig:{fill:true,titleCollapse:true,animate:true,maxActiveItems:3,autoWidth:true,collapsed:true,expanded:false},stateful:og.preferences['rememberGUIState'],items:og.dimensionPanels,bbar:[{iconCls:'op-ico-details',tooltip:'<b>'+lang('see more')+'</b>',text:lang('see more'),menu:{items:og.contextManager.getDimensionMenu(),cls:"context-menu"},hidden:!og.preferences['can_modify_navigation_panel']},'->',{iconCls:'ico-trash',tooltip:lang('trash'),text:lang('trash'),handler:function(){var cp=Ext.getCmp('trash-panel');var tp=Ext.getCmp('tabs-panel');if(!cp){cp=new og.ContentPanel({closable:true,title:lang('trash'),id:'trash-panel',iconCls:'ico-trash',refreshOnWorkspaceChange:true,refreshOnTagChange:true,defaultContent:{type:"url",data:og.getUrl('object','init_trash')}});tp.add(cp);}
tp.setActiveTab(cp);}},{iconCls:'ico-archive-obj',tooltip:lang('archived objects'),text:lang('archived'),handler:function(){var cp=Ext.getCmp('archivedobjs-panel');var tp=Ext.getCmp('tabs-panel');if(!cp){cp=new og.ContentPanel({closable:true,title:lang('archived objects'),id:'archivedobjs-panel',iconCls:'ico-archive-obj',refreshOnWorkspaceChange:true,refreshOnTagChange:true,defaultContent:{type:"url",data:og.getUrl('object','init_archivedobjs')}});tp.add(cp);}
tp.setActiveTab(cp);}}]},center_panel]});og.captureLinks();if(og.preferences['email_polling']>0){function updateUnreadCount(){og.openLink(og.getUrl('mail','get_unread_count'),{onSuccess:function(d){if(typeof d.unreadCount!='undefined'){og.updateUnreadEmail(d.unreadCount);}},hideLoading:true,hideErrors:true,preventPanelLoad:true});}
updateUnreadCount();setInterval(updateUnreadCount,Math.max(og.preferences['email_polling'],5000));}
if(og.hasNewVersions){og.msg(lang('new version notification title'),og.hasNewVersions,0);}},onError:function(data){}});});og.reloadCompanies=function(context,genid){Ext.Ajax.request({url:og.getUrl('contact','list_companies',{'ajax':true,'context':Ext.util.JSON.encode(context)}),success:function(result,request){var jsonData=Ext.util.JSON.decode(result.responseText);var companies=jsonData.companies;var combo=document.getElementById(genid+"profileFormCompany");firstOption=combo.options[0];combo.innerHTML='';combo.appendChild(firstOption);for(var i=0;i<companies.length;i++){var option=document.createElement('option');option.innerHTML=companies[i].name;option.value=companies[i].value;combo.appendChild(option);}}});}
og.addNewCompany=function(genid){var name_el=document.getElementById(genid+'profileFormNewCompanyName');if(name_el)name_el.value='';var el0=document.getElementById(genid+'new_company');var show=el0&&el0.style.display=='none';var el1=document.getElementById(genid+'new_company');if(el1)el1.style.display=show?'block':'none';var el2=document.getElementById(genid+'existing_company');if(el2)el2.style.display=show?'none':'block';var el3=document.getElementById(genid+'hfIsNewCompany');if(el3)el3.value=show;var el4=document.getElementById(genid+'duplicateCompanyName');if(el4)el4.style.display='none';if(name_el&&show)name_el.focus();var el5=Ext.get(genid+'submit1');if(el5)el5.dom.disabled=false;var el6=Ext.get(genid+'submit2');if(el6)el6.dom.disabled=false;};og.checkNewCompanyName=function(genid){var fff=document.getElementById(genid+'profileFormNewCompanyName');var name=fff.value.toUpperCase();document.getElementById(genid+'duplicateCompanyName').style.display='none';document.getElementById(genid+'duplicateCompanyName').innerHTML='';var select=document.getElementById(genid+'profileFormCompany');for(var i=1;i<select.options.length;i++){if(select.options[i].text.toUpperCase()==name){document.getElementById(genid+'duplicateCompanyName').innerHTML=lang('duplicate company name',select.options[i].text,genid,i);document.getElementById(genid+'companyInfo').style.display="none";document.getElementById(genid+'duplicateCompanyName').style.display='block';Ext.get(genid+'submit1').dom.disabled=true;Ext.get(genid+'submit2').dom.disabled=true;document.getElementById(genid+'duplicateCompanyName').focus();return;}}
Ext.get(genid+'submit1').dom.disabled=false;Ext.get(genid+'submit2').dom.disabled=false;document.getElementById(genid+'companyInfo').style.display="block";};og.selectCompany=function(genid,index){var select=document.getElementById(genid+'profileFormCompany');select.selectedIndex=index;og.addNewCompany(genid);og.companySelectedIndexChanged(genid);};og.companySelectedIndexChanged=function(genid,data_js){select=document.getElementById(genid+'profileFormCompany');Ext.get(genid+'submit1').dom.disabled=true;Ext.get(genid+'submit2').dom.disabled=true;og.openLink(og.getUrl('contact','get_company_data',{id:select.options[select.selectedIndex].value}),{caller:this,callback:function(success,data){if(success){Ext.get(genid+'submit1').dom.disabled=false;Ext.get(genid+'submit2').dom.disabled=false;}}});}
og.addContactTypeChanged=function(type,genid){if(type==0){document.getElementById(genid+'non-registered-person-form').style.display='';document.getElementById(genid+'registered-person-form').style.display='none';}else{document.getElementById(genid+'non-registered-person-form').style.display='none';document.getElementById(genid+'registered-person-form').style.display='';}}
og.markAsDeleted=function(del_el,container_id,input_id){$('#'+input_id+'_deleted').val(1);$('#'+container_id).css('background-color','#ECC');del_el.style.display='none';$('#'+container_id+' textarea').attr('disabled','disabled');$('#'+container_id+' input').attr('disabled','disabled');$('#'+container_id+' select').attr('disabled','disabled');$('#'+input_id+'_deleted').removeAttr('disabled');$('#'+input_id+'_id').removeAttr('disabled');$('#'+container_id+' .undo-delete').css('display','');}
og.undoMarkAsDeleted=function(undo_el,container_id,input_id){$('#'+input_id+'_deleted').val(0);$('#'+container_id).css('background-color','#fff');undo_el.style.display='none';$('#'+container_id+' textarea').removeAttr('disabled');$('#'+container_id+' input').removeAttr('disabled');$('#'+container_id+' select').removeAttr('disabled');$('#'+container_id+' .delete-link').css('display','');}
og.renderTelephoneTypeSelector=function(id,name,container_id,selected_value){var select=$('<select name="'+name+'" id="'+id+'" style="min-width:60px;max-width:100px;"></select>');for(var i=0;i<og.telephone_types.length;i++){var type=og.telephone_types[i];var option=$('<option></option>');option.attr('value',type.id);if(selected_value==type.id)option.attr('selected','selected');option.text(type.name);select.append(option);}
$('#'+container_id).empty().append(select);}
og.renderTelephoneInput=function(id,name,container_id,sel_type,sel_number,sel_name,sel_id){if(!sel_number)sel_number='';if(!sel_name)sel_name='';if(!sel_id)sel_id=0;$('#'+container_id).append('<input type="hidden" name="'+name+'[id]" id="'+id+'_id" value="'+sel_id+'" />');$('#'+container_id).append('<input type="hidden" name="'+name+'[deleted]" id="'+id+'_deleted" value="0" />');$('#'+container_id).append('<span id="'+id+'_type"></span>');og.renderTelephoneTypeSelector(id+'_type',name+'[type]',id+'_type',sel_type);var number_input=$('<input name="'+name+'[number]" id="'+id+'_number" value="'+sel_number+'" placeholder="'+lang('phone number')+'" style="width:140px;" />');$('#'+container_id).append(number_input);var name_input=$('<input name="'+name+'[name]" id="'+id+'_name" value="'+sel_name+'" placeholder="'+lang('name')+'"/>');$('#'+container_id).append(name_input);var delete_or_undo=$(`<div class="removeUndo"><a href="#"onclick="og.markAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-delete delete-link"title="${lang('delete')}"></a><a href="#"onclick="og.undoMarkAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-undo undo-delete"style="display:none;"title="${lang('undo')}"></a></div>`);$('#'+container_id).append(delete_or_undo);}
og.addNewTelephoneInput=function(container_id,pre_id,sel_type,sel_number,sel_name,sel_id){if(!pre_id)pre_id='contact';if(!og.telephoneCount)og.telephoneCount={};if(!og.telephoneCount[container_id])og.telephoneCount[container_id]=0;var tcount=og.telephoneCount[container_id];var id=pre_id+'Phone_'+tcount;var name=pre_id+'[phone]['+tcount+']';$('#'+container_id).append('<div id="'+container_id+tcount+'" class="phone-input-container"></div>');og.renderTelephoneInput(id,name,container_id+tcount,sel_type,sel_number,sel_name,sel_id);og.telephoneCount[container_id]=og.telephoneCount[container_id]+1;}
og.addNewAddressInput=function(container_id,pre_id,sel_type,sel_data,ignore_pre_id){if(!pre_id)pre_id='contact';if(!og.addressCount)og.addressCount={};if(!og.addressCount[container_id])og.addressCount[container_id]=0;var tcount=og.addressCount[container_id];var pre_name=pre_id;pre_id=pre_id.replace("[","_").replace("]","_");var id=pre_id+'Address_'+tcount;if(!ignore_pre_id){var name=pre_name+'[address]['+tcount+']';}else{var name=pre_name;}
$('#'+container_id).append('<div id="'+container_id+tcount+'" class="address-input-container"></div>');og.renderAddressInput(id,name,container_id+tcount,sel_type,sel_data);let dataBillingAttr=$('#'+container_id).parent().siblings(".addNewLineButton").children('a').attr('data-defaultBilling');if(dataBillingAttr!=undefined&&Number(dataBillingAttr)==1){og.income.onAppendDefaultBilling(id,name,container_id+tcount,'address',sel_data,false);};$(".address-input-container").css('max-width',($('#'+container_id).width()-270)+'px');og.addressCount[container_id]=og.addressCount[container_id]+1;}
og.renderWebpageTypeSelector=function(id,name,container_id,selected_value){var select=$('<select name="'+name+'" id="'+id+'" style="min-width:60px;max-width:100px;"></select>');for(var i=0;i<og.webpage_types.length;i++){var type=og.webpage_types[i];var option=$('<option></option>');option.attr('value',type.id);if(selected_value==type.id)option.attr('selected','selected');option.text(type.name);select.append(option);}
$('#'+container_id).empty().append(select);}
og.renderWebpageInput=function(id,name,container_id,sel_type,sel_url,sel_id){if(!sel_url)sel_url='';if(!sel_id)sel_id=0;$('#'+container_id).append('<input type="hidden" name="'+name+'[id]" id="'+id+'_id" value="'+sel_id+'" />');$('#'+container_id).append('<input type="hidden" name="'+name+'[deleted]" id="'+id+'_deleted" value="0" />');$('#'+container_id).append('<td><span id="'+id+'_type"></span></td>');og.renderWebpageTypeSelector(id+'_type',name+'[type]',id+'_type',sel_type);var webpage_input=$('<td><input name="'+name+'[url]" id="'+id+'_url" value="'+sel_url+'" placeholder="'+lang('webpage')+'"/></td>');$('#'+container_id).append(webpage_input);var delete_or_undo=$(`<td class="removeUndo"><a href="#"onclick="og.markAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-delete delete-link"title="${lang('delete')}"></a><a href="#"onclick="og.undoMarkAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-undo undo-delete"style="display:none;"title="${lang('undo')}"></a></td>`);$('#'+container_id).append(delete_or_undo);}
og.addNewWebpageInput=function(container_id,pre_id,sel_type,sel_url,sel_id){if(!pre_id)pre_id='contact';if(!og.webpageCount)og.webpageCount={};if(!og.webpageCount[container_id])og.webpageCount[container_id]=0;var tcount=og.webpageCount[container_id];var id=pre_id+'Webpage_'+tcount;var name=pre_id+'[webpage]['+tcount+']';$('#'+container_id).append('<div id="'+container_id+tcount+'" class="webpage-input-container"></div>');og.renderWebpageInput(id,name,container_id+tcount,sel_type,sel_url,sel_id);og.webpageCount[container_id]=og.webpageCount[container_id]+1;}
og.renderEmailTypeSelector=function(id,name,container_id,selected_value){var select=$('<select name="'+name+'" id="'+id+'" style="min-width:60px;max-width:100px;"></select>');for(var i=0;i<og.email_types.length;i++){var type=og.email_types[i];var option=$('<option></option>');option.attr('value',type.id);if(selected_value==type.id)option.attr('selected','selected');option.text(type.name);select.append(option);}
$('#'+container_id).empty().append(select);}
og.renderEmailInput=function(id,name,container_id,sel_type,sel_address,sel_id,defaultEmail=0){if(!sel_address)sel_address='';if(!sel_id)sel_id=0;$('#'+container_id).append('<input type="hidden" name="'+name+'[id]" id="'+id+'_id" value="'+sel_id+'" />');$('#'+container_id).append('<input type="hidden" name="'+name+'[deleted]" id="'+id+'_deleted" value="0" />');$('#'+container_id).append('<span id="'+id+'_type"></span>');og.renderEmailTypeSelector(id+'_type',name+'[type]',id+'_type',sel_type);var email_input=$('<input name="'+name+'[email_address]" id="'+id+'_email_address" value="'+sel_address+'" class="moreEmailInputs" placeholder="'+lang('email address')+'"/>');$('#'+container_id).append(email_input);var undo_or_remove=$(`<div class="removeUndo"><a href="#"onclick="og.markAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-delete delete-link"title="${lang('delete')}"></a><a href="#"onclick="og.undoMarkAsDeleted(this, \'${container_id}\', \'${id}\');"class="coViewAction ico-undo undo-delete"style="display:none;"title="${lang('undo')}"></a></div>`);$('#'+container_id).append(undo_or_remove);}
og.addNewEmailInput=function(container_id,pre_id,sel_type,sel_address,sel_id,default_email_value=0){if(!pre_id)pre_id='contact';if(!og.emailCount)og.emailCount={};if(!og.emailCount[container_id])og.emailCount[container_id]=0;var tcount=og.emailCount[container_id];var id=pre_id+'Email_'+tcount;var name=pre_id+'[emails]['+tcount+']';$('#'+container_id).append('<div id="'+container_id+tcount+'" class="email-input-container"></div>');og.renderEmailInput(id,name,container_id+tcount,sel_type,sel_address,sel_id,default_email_value);let dataBillingAttr=$('#'+container_id).parent().siblings(".addNewLineButton").children('a').attr('data-defaultBilling');if(dataBillingAttr!=undefined&&Number(dataBillingAttr)==1){og.income.onAppendDefaultBilling(id,name,container_id+tcount,'email',default_email_value,false);};og.emailCount[container_id]=og.emailCount[container_id]+1;let othersEmail=document.querySelectorAll('.moreEmailInputs');othersEmail.forEach((element)=>{og.checkEmailAddress('#'+element.getAttribute('id'),'','','contact');});}
og
App.modules.addMemberForm={object_types:[],assignableParents:[],buildIdNameComboStore:function(items){var store=[];if(items){for(i=0;i<items.length;i++){store[store.length]=[items[i].id,items[i].name];}}
return store;},updateParentsSelector:function(genid,dimension_id,object_type_id){var parents_container=document.getElementById(genid+"memberParentContainer");og.openLink(og.getUrl('member','get_assignable_parents',{dim:dimension_id,otype:object_type_id}),{hideLoading:true,callback:function(success,data){var show_parents=false;if(data.parents.length>0){if(data.parents[0].id==0){show_parents=data.parents.length>1;}
else show_parents=true;}
if(parents_container){if(show_parents){parents_container.style.display="block"}else{parents_container.style.display="none";document.getElementById(genid+"memberParent").value="";}}}});},deprecated_updateAssignableParents:function(genid,dimension_id,object_type_id){var self=this;og.openLink(og.getUrl('member','get_assignable_parents',{dim:dimension_id,otype:object_type_id}),{hideLoading:true,callback:function(success,data){self.assignableParents=data.parents;}});},drawObjectTypesSelectBox:function(genid,obj_types,container_div,obj_type_hf,selected,disabled){this.object_types=obj_types;if(!selected)selected=0;store=App.modules.addMemberForm.buildIdNameComboStore(obj_types);var combo=og.drawComboBox({render_to:genid+container_div,id:genid+'memberObjectTypesCombo',name:'memberObjectTypesCombo',selected:selected,store:store,disabled:disabled});combo.on('select',function(){var hf=document.getElementById(genid+obj_type_hf);if(hf)hf.value=this.getValue();App.modules.addMemberForm.objectTypeChanged(this.value,genid);});if(selected){hf=document.getElementById(genid+obj_type_hf);if(hf)hf.value=selected;}},objectTypeChanged:function(selected,genid,dont_update_parents){var ot=null;for(var i=0;i<this.object_types.length;i++){if(this.object_types[i].id==selected){ot=this.object_types[i];break;}}
if(ot==null)return;if(!dont_update_parents)
this.updateParentsSelector(genid,document.getElementById(genid+'dimension_id').value,ot.id);if(ot.type=='dimension_object'){var mem_el=Ext.get(genid+'member_id');var mem_id=0;if(mem_el)mem_id=mem_el.dom.value;var parent_el=document.getElementById(genid+'memberParent');var parent_id=parent_el?parent_el.value:0;og.openLink(og.getUrl('member','get_dimension_object_fields',{id:ot.id,mem_id:mem_id,parent_id:parent_id}),{callback:function(success,data){if(success){App.modules.addMemberForm.renderDimensionObjectFields(data.fields,data.title);}}});}else if(ot.type=='dimension_group'){var container=document.getElementById(genid+'dimension_object_fields');if(container)container.innerHTML='';}
if(og.dimRestrictions.ot_with_restrictions&&og.dimRestrictions.ot_with_restrictions[ot.id]){var del_res_link=document.getElementById(genid+'delRestrictionsLink');if(del_res_link.style.display!='none'){this.drawDimensionRestrictions(genid,document.getElementById(genid+'dimension_id').value);}
Ext.get(genid+'restriction_links').setDisplayed(true);}else{Ext.get(genid+'restriction_links').setDisplayed(false);var restrictions_container=Ext.get(genid+'dimension_restrictions');if(restrictions_container)restrictions_container.dom.innerHTML="";}
if(!og.ot_hide_vinculations_link||!og.ot_hide_vinculations_link[ot.id]){if(og.dimProperties.ot_with_properties&&og.dimProperties.ot_with_properties[ot.id]){var del_prop_link=document.getElementById(genid+'delPropertiesLink');if(del_prop_link.style.display!='none'){this.drawDimensionProperties(genid,document.getElementById(genid+'dimension_id').value);}}else{Ext.get(genid+'property_links').setDisplayed(false);var properties_container=Ext.get(genid+'dimension_properties');if(properties_container)properties_container.dom.innerHTML="";}}},renderDimensionObjectFields:function(fields,obj_type_name){if(!fields||fields.length==0){return;}
var container=document.getElementById(genid+'dimension_object_fields');var js='';var html='';html+='<div id="'+genid+'dimension-memberfields" class="dimension-memberfields" >';for(var i=0;i<fields.length;i++){var f=fields[i];html+='<div class="member-field type-'+f.type.toLowerCase()+'">';html+='<label for="'+genid+'dim_obj_'+f.col+'">'+(f.col_lang?f.col_lang:lang(f.col));if(f.mandatory)html+='&nbsp;<span class="label_required">*</span>';html+='</label>';switch(f.type){case'STRING':if(f.large)
html+='<textarea name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'" class="long">'+(f.val?f.val:'')+'</textarea>';else
html+='<input name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'" type="text" value="'+(f.val?f.val:'')+'" />';break;case'DATE':case'DATETIME':html+='<div id="'+genid+'dim_obj_'+f.col+'_container"></div>';js+="var "+f.col+genid+" = new og.DateField({\n"+"renderTo: '"+genid+"dim_obj_"+f.col+"_container',\n"+"id: '"+genid+"dim_obj_"+f.col+"',\n"+"name: 'dim_obj["+f.col+"]',\n"+"style:'width:100px',\n"+"value:'"+(f.val?f.val:'')+"'\n"+"});\n";break;case'INTEGER':if(!f.fixed_values){html+='<input name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'" type="text" class="short" value="'+(f.val?f.val:'')+'" '+'onblur="App.modules.addMemberForm.checkNumericField(this, \''+f.col_lang+'\');"/>';}else{html+='<select name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'">';for(k in f.fixed_values){var selected=f.val?f.val==k:(f.fixed_values[k]=='default');html+='<option value="'+k+'"'+(selected?' selected="selected"':'')+'>'+(f.use_langs?lang(f.lang_pre+f.col+k):k)+'</option>';}
html+='</select>';}
break;case'BOOLEAN':html+='<input name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'" type="checkbox" class="checkbox" '+(f.val?' checked':'')+' />';break;case'WSCOLOR':html+='<input name="dim_obj['+f.col+']" id="'+genid+'dim_obj_'+f.col+'" class="color-code" type="hidden" value="'+f.val+'" />';html+="<div class='ws-color-chooser'>";for(var i=0;i<=24;i++){var cls=(f.val==i)?'selected':'';html+="<div  class='ico-color"+i+" "+cls+" color-cell'  onClick='$(\"input.color-code\").val(\""+i+"\");$(\".color-cell\").removeClass(\"selected\");$(this).addClass(\"selected\");'></div>";if(i==12){html+='<div class="x-clear"></div><div style="width:20px;float:left;height:10px;"></div>';}}
html+='<div class="x-clear"></div>';html+='</div>';break;default:break;}
html+='</div>';}
html+='</div>';container.innerHTML=html;eval(js);container.style.display='block';},checkNumericField:function(field,field_name){if(isNaN(field.value)){alert(lang('must be numeric',field_name));field.focus();}},drawDimensionRestrictions:function(genid,dimension_id){var otype=Ext.get(genid+'memberObjectType');if(otype&&otype.dom.value==0){alert(lang('you must select object type to show the possible restrictions'));return;}
var mem_el=Ext.get(genid+'member_id');var mem_id=0;if(mem_el)mem_id=mem_el.dom.value;og.openLink(og.getUrl('member','get_dimensions_for_restrictions',{id:dimension_id,otype:otype.dom.value,genid:genid,mem_id:mem_id}),{preventPanelLoad:true,callback:function(success,data){if(success){og.dimRestrictions.clearOrders();var container=Ext.get(genid+'dimension_restrictions');container.setDisplayed(false);container.dom.innerHTML=data.current.data;container.slideIn('t',{useDisplay:true});for(var i=0;i<data.ord_members.length;i++){og.dimRestrictions.orderableMembers.push(data.ord_members[i]);}
if(data.actual_order){for(var i=0;i<data.actual_order.length;i++){og.dimRestrictions.addMemberToOrderList(genid,data.actual_order[i].dim,data.actual_order[i].mem,data.actual_order[i].parent);}}
for(var i=0;i<data.childs.length;i++){og.dimRestrictions.childs.push(data.childs[i]);}
og.dimRestrictions.init(genid);var to_hide=Ext.get(genid+'addRestrictionsLink');if(to_hide)to_hide.setDisplayed(false);var to_show=Ext.get(genid+'delRestrictionsLink');if(to_show)to_show.setDisplayed(true);}}});},deleteDimensionRestrictions:function(genid){var to_remove=Ext.get(genid+'dimension_restrictions');if(to_remove)to_remove.dom.innerHTML='';var to_hide=Ext.get(genid+'delRestrictionsLink');if(to_hide)to_hide.setDisplayed(false);var to_show=Ext.get(genid+'addRestrictionsLink');if(to_show)to_show.setDisplayed(true);},drawDimensionProperties:function(genid,dimension_id){var otype=Ext.get(genid+'memberObjectType');if(otype&&otype.dom.value==0){alert(lang('you must select object type to show the possible properties'));return;}
var mem_el=Ext.get(genid+'member_id');var mem_id=0;if(mem_el)mem_id=mem_el.dom.value;var parent_id=Ext.get(genid+'memberParent').dom.value;og.openLink(og.getUrl('member','get_dimensions_for_properties',{id:dimension_id,otype:otype.dom.value,genid:genid,mem_id:mem_id,parent:parent_id}),{preventPanelLoad:true,callback:function(success,data){if(success){og.dimRestrictions.clearOrders();var container=Ext.get(genid+'dimension_properties');container.setDisplayed(false);container.dom.innerHTML=data.current.data;container.slideIn('t',{useDisplay:true});og.dimProperties.propertyParents=data.parents;og.dimProperties.disableChildProperties(data.genid);var to_hide=Ext.get(genid+'addPropertiesLink');if(to_hide)to_hide.setDisplayed(false);var to_show=Ext.get(genid+'delPropertiesLink');if(to_show)to_show.setDisplayed(true);}}});},deleteDimensionProperties:function(genid){var to_remove=Ext.get(genid+'dimension_properties');if(to_remove)to_remove.dom.innerHTML='';var to_hide=Ext.get(genid+'delPropertiesLink');if(to_hide)to_hide.setDisplayed(false);var to_show=Ext.get(genid+'addPropertiesLink');if(to_show)to_show.setDisplayed(true);}};og.dimRestrictions={};og.dimRestrictions.orders=[];og.dimRestrictions.orderableMembers=[];og.dimRestrictions.childs=[];og.dimRestrictions.clearOrders=function(){og.dimRestrictions.orders=[];og.dimRestrictions.orderableMembers=[];}
og.dimRestrictions.addMemberToOrderList=function(genid,dim,mem,parent){if(!this.isOrderable(mem))return;var add=false;var dorder=this.getDimensionOrders(dim,parent);if(!dorder){dorder=[];add=true;}
dorder.push(mem);if(add)og.dimRestrictions.orders.push({dim:dim,parent:parent,members:dorder});var el=Ext.get(genid+'order_'+dim+'_'+mem);if(el)el.dom.innerHTML=dorder.length;el=Ext.get(genid+'order_num_'+dim+'_'+mem)
if(el)el.dom.value=dorder.length;}
og.dimRestrictions.delMemberOfOrderList=function(genid,dim,mem,parent){if(!this.isOrderable(mem))return;var dorder=this.getDimensionOrders(dim,parent);if(!dorder)return;var new_dorder=[];for(var i=0;i<dorder.length;i++){if(dorder[i]!=mem){new_dorder.push(dorder[i]);}}
this.setDimensionOrder(dim,parent,new_dorder);this.redrawDimensionOrders(genid,dim,parent);Ext.get(genid+'order_'+dim+'_'+mem).dom.innerHTML='';Ext.get(genid+'order_num_'+dim+'_'+mem).dom.value=0;}
og.dimRestrictions.redrawDimensionOrders=function(genid,dim,parent){var order=this.getDimensionOrders(dim,parent);for(var i=0;i<order.length;i++){Ext.get(genid+'order_'+dim+'_'+order[i]).dom.innerHTML=(i+1);Ext.get(genid+'order_num_'+dim+'_'+order[i]).dom.value=(i+1);}}
og.dimRestrictions.getDimensionOrders=function(dim,parent){for(var i=0;i<og.dimRestrictions.orders.length;i++){if(og.dimRestrictions.orders[i].dim==dim&&og.dimRestrictions.orders[i].parent==parent){return og.dimRestrictions.orders[i].members;}}
return null;}
og.dimRestrictions.setDimensionOrder=function(dim,parent,new_order){for(var i=0;i<og.dimRestrictions.orders.length;i++){if(og.dimRestrictions.orders[i].dim==dim&&og.dimRestrictions.orders[i].parent==parent){og.dimRestrictions.orders[i]={dim:dim,parent:parent,members:new_order};return;}}}
og.dimRestrictions.move=function(genid,dim,mem,parent,dir){if(!this.isOrderable(mem))return;if(dir<0)dir=-1;else dir=1;var order=this.getDimensionOrders(dim,parent);for(var i=0;i<order.length;i++){if(order[i]==mem){var swap_with=-1;if((dir>0&&i<order.length-1)||(dir<0&&i>0))swap_with=i+dir;if(swap_with>-1){var tmp=order[i];order[i]=order[swap_with];order[swap_with]=tmp;}
break;}}
this.redrawDimensionOrders(genid,dim,parent);}
og.dimRestrictions.isOrderable=function(mem){for(var i=0;i<og.dimRestrictions.orderableMembers.length;i++){if(mem==og.dimRestrictions.orderableMembers[i])return true;}
return false;}
og.dimRestrictions.getChildMembers=function(parent){for(var i=0;i<og.dimRestrictions.childs.length;i++){if(parent==og.dimRestrictions.childs[i].p){return og.dimRestrictions.childs[i].ch;}}}
og.dimRestrictions.enableDisableChilds=function(genid,dim,parent,enable){var childs=this.getChildMembers(parent);for(var i=0;i<childs.length;i++){var name=Ext.get(genid+'name_'+dim+'_'+childs[i]);if(name){name.setStyle('color',enable?'#333':'#AAA');}
var check_res=Ext.get(genid+'restricted_members_'+dim+'_'+childs[i]);if(check_res){check_res.dom.disabled=!enable;}
if(!enable){this.delMemberOfOrderList(genid,dim,childs[i],parent);if(check_res)
check_res.dom.checked='';var order_ctrls=Ext.get(genid+'order_controls_'+dim+'_'+childs[i]);if(order_ctrls){order_ctrls.setDisplayed(enable);}}}}
og.dimRestrictions.showHide=function(el_id,show){var el=Ext.get(el_id);if(el)el.setDisplayed(show);}
og.dimRestrictions.init=function(genid){for(var i=0;i<this.childs.length;i++){var check_res=Ext.get(genid+'restricted_members_'+this.childs[i].d+'_'+this.childs[i].p);this.enableDisableChilds(genid,this.childs[i].d,this.childs[i].p,check_res&&check_res.dom.checked);}}
og.dimProperties={};og.dimProperties.uncheckOtherMembers=function(checkbox,table_id){if(!checkbox)return;if(checkbox.checked){var table=Ext.get(table_id).dom;var other_checkboxes=table.getElementsByTagName('input');for(var i=0;i<other_checkboxes.length;i++){if(other_checkboxes[i].id!=checkbox.id)other_checkboxes[i].checked=false;}}}
og.dimProperties.disableChildProperties=function(genid,dim_id){for(dim in og.dimProperties.propertyParents){if(dim_id&&dim_id!=dim)continue;for(mem_id in og.dimProperties.propertyParents[dim]){var parent_id=og.dimProperties.propertyParents[dim][mem_id];if(typeof(parent_id)=='function')continue;var parent_input=Ext.get(genid+'associated_members_'+dim+'_'+parent_id);var checkbox=Ext.get(genid+'associated_members_'+dim+'_'+mem_id);if(checkbox){checkbox.dom.disabled=!parent_input.dom.checked;if(checkbox.dom.disabled)checkbox.dom.checked=false;}
var name=Ext.get(genid+'name_'+dim+'_'+mem_id);if(name)name.setStyle('color',checkbox.dom.disabled?'#AAA':'#333');}}}
og.color_selector={};og.color_selector.close_palette=function(input_id){$("#"+input_id+"_sample").popover('hide');}
og.color_selector.select=function(color_id,input_id){var prev_color=$("#"+input_id).val();$("#"+input_id).val(color_id);$("#"+input_id+"_sample").removeClass("color-"+prev_color);$("#"+input_id+"_sample").addClass("color-"+color_id);$("#"+input_id+"_sample").popover('hide');}
og.sendComment=function(id,ele){var comms=$("."+ele).parent().find('textarea').val();if(comms!=''){var args=[];args['object_id']=id;jQuery.ajax({url:og.getUrl('comment','add',args),type:"POST",data:{'comment':{'text':comms}},success:function(){var path=og.getUrl('dashboard','activity_feed',{ajax:true});$.getJSON(path,function(obj)
{$('div.activity_feed_loader').html(obj.current.data);})}});}}
og.sendCommentFromTextBox=function(id,ele,e){var code=(e.keyCode?e.keyCode:e.which);if(code==13&&!e.shiftKey){$(ele).attr("disabled","disabled");var msgid=$(ele).attr("class");var comms=$(ele).val();comms=comms.replace(/\n/g,"<br />");if(comms!=''){var args=[];args['object_id']=id;jQuery.ajax({url:og.getUrl('comment','add',args),type:"POST",data:{'comment':{'text':comms}},success:function(data)
{var path=og.getUrl('dashboard','activity_feed',{ajax:true});$.getJSON(path,function(obj)
{$('div.activity_feed_loader').html(obj.current.data);$("div.x-panel-body").scrollTo($("."+msgid).siblings('div').children(':last'),800);})}});}}}
og.commentBoxKeyDown=function(ele,e,id){og.sendCommentFromTextBox(id,ele,e);if(e.keyCode==13&&e.shiftKey){ele.value=(ele.value+"\n");newHeight=parseInt($(ele).css('height'))+15;$(ele).css('height',newHeight+"px");return true;}else if(e.keyCode==8){if($(ele)[0].value.charAt($(ele)[0].value.length-1)=="\n"){newHeight=parseInt($(ele).css('height'))-15;$(ele).css('height',newHeight+"px");ele.rows-=1;}}}
if(!member_selector)var member_selector={};member_selector.init=function(genid){member_selector[genid].sel_context={};var json_sel_ids=document.getElementById(genid+member_selector[genid].hiddenFieldName).value;var selected_member_ids=json_sel_ids==""?[]:Ext.util.JSON.decode(json_sel_ids);var dimension_to_get=new Array();if(selected_member_ids){for(i=0;i<selected_member_ids.length;i++){var mid=selected_member_ids[i];if(member_selector[genid].members_dimension[mid]>0){var dim=member_selector[genid].members_dimension[mid];if(!member_selector[genid].sel_context[dim]){member_selector[genid].sel_context[dim]=[];}
member_selector[genid].sel_context[dim].push(mid);if(selected_member_ids.length==i){var idshf=document.getElementById(genid+'subscribers_ids_hidden');if(idshf)og.reload_subscribers(genid,member_selector[genid].otid,idshf.value);}}else{dimension_to_get.push(mid);}}}
member_selector.preload_members(genid);if(dimension_to_get.length>0){og.openLink(og.getUrl('member','get_dimension_id',{member_id:Ext.util.JSON.encode(dimension_to_get)}),{callback:function(success,data){if(!data.dim_ids){og.eventManager.fireEvent('after member_selector init',{genid:genid});return;}
for(var i=0;i<data.dim_ids.length;i++){if(!member_selector[genid].sel_context[data.dim_ids[i].dim_id]){member_selector[genid].sel_context[data.dim_ids[i].dim_id]=[];}
member_selector[genid].sel_context[data.dim_ids[i].dim_id].push(data.dim_ids[i].member_id);member_selector[genid].members_dimension[data.dim_ids[i].member_id]=data.dim_ids[i].dim_id;}
if(selected_member_ids.length==i){var idshf=document.getElementById(genid+'subscribers_ids_hidden');if(idshf)og.reload_subscribers(genid,member_selector[genid].otid,idshf.value);}
if($("#"+genid+"add_event_invitation_div").length>0){og.redrawPeopleList(genid);}
for(dim in member_selector[genid].sel_context){if(!dim)continue;if(member_selector[genid].sel_context[dim].length>0){member_selector.reload_dependant_selectors(dim,genid);}}
og.eventManager.fireEvent('after member_selector init',{genid:genid});og.eventManager.fireEvent('replace all empty breadcrumb',null);}});}
if(!selected_member_ids||selected_member_ids.length==0){var idshf=document.getElementById(genid+'subscribers_ids_hidden');if(idshf)og.reload_subscribers(genid,member_selector[genid].otid,idshf.value);}}
member_selector.autocomplete_select=function(dimension_id,genid,combo,record,preload){combo.setValue(record.data.name);combo.selected_member=record.data;member_selector.add_relation(dimension_id,genid);if(preload){member_selector.preload_members(genid,dimension_id);}}
member_selector.add_relation=function(dimension_id,genid,member_id,show_actions,dont_reload_dep_selectors,dont_select_assoc_members){if(typeof member_id=="undefined"){var combo=Ext.getCmp(genid+'add-member-input-dim'+dimension_id);var member=combo.selected_member;if(member==null)return;}else{var member={};member.id=member_id;}
if(!member_selector[genid].properties[dimension_id]){member_selector[genid].properties[dimension_id]={listeners:{},isMultiple:false};}
if(typeof show_actions=="undefined"){var show_actions=member_selector[genid].properties[dimension_id].isMultiple;}
var hf_input=document.getElementById(genid+member_selector[genid].hiddenFieldName);if(hf_input.value=="")hf_input="[]";var json_sel_ids=Ext.util.JSON.decode(hf_input.value);var selected_member_ids=json_sel_ids?json_sel_ids:[];var ind=selected_member_ids.indexOf(member_id);if(ind>=0)return;var i=0;while(selected_member_ids[i]!=member.id&&i<selected_member_ids.length)i++;if(!member_selector[genid].sel_context[dimension_id])member_selector[genid].sel_context[dimension_id]=[];if(member_selector[genid].properties[dimension_id].isMultiple){member_selector[genid].sel_context[dimension_id].push(member.id);}else{member_selector[genid].sel_context[dimension_id]=[member.id];}
var sel_members_div=Ext.get(genid+'selected-members-dim'+dimension_id);if(sel_members_div){var already_selected=sel_members_div.select('div.selected-member-div').elements;}
var last=already_selected&&already_selected.length>0?Ext.fly(already_selected[already_selected.length-1]):null;var alt_cls=last==null||last.hasClass('alt-row')?"":" alt-row";var checkbox_class="";if(member_selector[genid].defaultSelectionCheckboxes){checkbox_class="with-checkbox";}
var html='<div class="selected-member-div'+alt_cls+'" id="'+genid+'selected-member'+member.id+'">';html+='<div class="completePath '+checkbox_class+'">';html+='</div>';if(show_actions){html+='<div class="selected-member-actions '+checkbox_class+'"'+(Ext.isIE?'style="display:inline;margin-left:40px;float:none;"':'')+'>';if(member_selector[genid].defaultSelectionCheckboxes){html+='<input type="checkbox" class="checkbox" name="member[default_selection]['+member_id+']" title="'+lang('select by default')+'"/>&nbsp;';}
if(member_selector[genid].properties[dimension_id].isMultiple){html+='<a class="coViewAction ico-delete" onclick="member_selector.remove_relation('+dimension_id+',\''+genid+'\', '+member.id+')" href="#"></a>';}
html+='</div>';}
html+='</div><div class="separator"></div>';if(sel_members_div){var sep=sel_members_div.select('div.separator').elements;for(x in sep)Ext.fly(sep[x]).remove();if(member_selector[genid].properties[dimension_id].isMultiple){sel_members_div.insertHtml('beforeEnd',html);}else{$("#"+sel_members_div.id).html(html);}}
if(og.fn_sel_member_additional_html&&og.fn_sel_member_additional_html.length>0){for(var x=0;x<og.fn_sel_member_additional_html.length;x++){var fn=og.fn_sel_member_additional_html[x];if(typeof(fn)=='function')fn.call(null,genid,member);}}
var minfo=null;if(og.dimensions[dimension_id]){minfo=og.dimensions[dimension_id][member.id];}
if(!minfo){var tree=Ext.getCmp(genid+'-member-chooser-panel-'+dimension_id+'-tree');if(tree){var node=tree.getNodeById(member.id);if(node)minfo=node.attributes;}}
if(minfo){var tmp_dim={};tmp_dim[dimension_id]={};tmp_dim[dimension_id][minfo.object_type_id]=[member.id];mem_path=og.getEmptyCrumbHtml(tmp_dim,".completePath",null,false);$("#"+genid+"selected-member"+member.id+" .completePath").append(mem_path);og.eventManager.fireEvent('replace all empty breadcrumb',null);}
if(!member_selector[genid].properties[dimension_id].isMultiple){var form=Ext.get(genid+'add-member-form-dim'+dimension_id);if(form){f=Ext.fly(form);f.enableDisplayMode();f.hide();}}
var sel_members_str="";for(dim_id in member_selector[genid].sel_context){if(member_selector[genid].sel_context[dim_id]&&member_selector[genid].sel_context[dim_id].length>0){sel_members_str+=(sel_members_str==""?"":",")+member_selector[genid].sel_context[dim_id].join(',');}}
sel_members_str="["+sel_members_str+"]";var member_ids_input=Ext.fly(Ext.get(genid+member_selector[genid].hiddenFieldName));member_ids_input.dom.value=sel_members_str;if(member_selector[genid].properties[dimension_id].listeners.on_selection_change){eval(member_selector[genid].properties[dimension_id].listeners.on_selection_change);}
if(!dont_reload_dep_selectors){member_selector.reload_dependant_selectors(dimension_id,genid);}
if(!dont_select_assoc_members&&!member_selector[genid].properties[dimension_id].dontSelectAssociatedMembers){og.selectDefaultAssociatedMembers(genid,dimension_id,member.id,true);}
if(!member_selector[genid].properties[dimension_id].isMultiple){$("#"+genid+"-member-chooser-panel-"+dimension_id+"-tree-current-selected .empty-text").hide();}}
member_selector.remove_relation=function(dimension_id,genid,member_id,dont_reload){var div=Ext.get(genid+'selected-member'+member_id);if(div){div=Ext.fly(div);var next=div;while(next=next.next('div.selected-member-div')){if(next.hasClass('alt-row'))next.removeClass('alt-row');else next.addClass('alt-row');}
div.remove();}
var sel_members_div=Ext.get(genid+'selected-members-dim'+dimension_id);if(sel_members_div){var already_selected=sel_members_div.select('div.selected-member-div').elements;if(already_selected.length==0){var sep=sel_members_div.select('div.separator').elements;for(x in sep)Ext.fly(sep[x]).remove();}}
var member_ids_input=Ext.fly(Ext.get(genid+member_selector[genid].hiddenFieldName));var member_ids_input_val=member_ids_input.getValue();var member_ids=[];if(member_ids_input_val){member_ids=Ext.util.JSON.decode(member_ids_input.getValue());}
for(index in member_ids){if(member_ids[index]==member_id)member_ids.splice(index,1);}
member_ids_input.dom.value=Ext.util.JSON.encode(member_ids);if(member_selector[genid].sel_context[dimension_id]){for(var i=0;i<member_selector[genid].sel_context[dimension_id].length;i++){if(member_selector[genid].sel_context[dimension_id][i]==member_id){member_selector[genid].sel_context[dimension_id].splice(i,1);}}}
if(member_selector[genid].properties[dimension_id]&&member_selector[genid].properties[dimension_id].isMultiple||!member_selector[genid].sel_context[dimension_id]||member_selector[genid].sel_context[dimension_id].length==0){var form=Ext.get(genid+'add-member-form-dim'+dimension_id);if(form){f=Ext.fly(form);f.enableDisplayMode();f.show();}}
if(!dont_reload){member_selector.reload_dependant_selectors(dimension_id,genid);if(member_selector[genid].properties[dimension_id]&&member_selector[genid].properties[dimension_id].listeners.on_selection_change){eval(member_selector[genid].properties[dimension_id].listeners.on_selection_change);}}
if(member_selector[genid].properties[dimension_id]&&member_selector[genid].properties[dimension_id].listeners.on_remove_relation){eval(member_selector[genid].properties[dimension_id].listeners.on_remove_relation);}}
member_selector.reload_dependant_selectors=function(dimension_id,genid){if(typeof member_selector[genid].properties[dimension_id]=='undefined')return;var dimensions_to_reload_object=member_selector[genid].properties[dimension_id].reloadDimensions;var dimensions_to_reload_ots=[];var dimensions_to_reload=[];for(ot in dimensions_to_reload_object){for(var i=0;i<dimensions_to_reload_object[ot].length;i++){dimensions_to_reload.push(dimensions_to_reload_object[ot][i]);dimensions_to_reload_ots.push(ot);}}
var hf=Ext.get(genid+member_selector[genid].hiddenFieldName);var form_id=hf&&hf.dom&&hf.dom.form?hf.dom.form.id:null;if(typeof(form_id)!='string')return;var member_ids_input=Ext.fly(Ext.get(genid+member_selector[genid].hiddenFieldName));var selected_members=eval(member_ids_input.getValue());var main_tree=Ext.getCmp(genid+'-member-chooser-panel-'+dimension_id+'-tree');if(main_tree&&main_tree.filterOnChange){for(i=0;i<dimensions_to_reload.length;i++){var dim_id=dimensions_to_reload[i];var dep_genid="";var selector_inputs=form_id?$("#"+form_id+' .dimension-panel-textfilter'):[];for(var x=0;x<selector_inputs.length;x++){var sel_id=selector_inputs[x].id;var key="-member-chooser-panel-"+dim_id+"-tree-textfilter";if(sel_id.indexOf(key)>=0){dep_genid=selector_inputs[x].id.substring(0,selector_inputs[x].id.indexOf("-"));break;}}
var selector_object=member_selector[dep_genid];if(selector_object&&selector_object.properties[dim_id]&&!selector_object.dontFilterThisSelector){if(selected_members){var selected_node=null;var k=0;while(!selected_node&&k<selected_members.length){selected_node=main_tree.getNodeById(selected_members[k]);k++;}
var tree=Ext.getCmp(dep_genid+'-member-chooser-panel-'+dim_id+'-tree');var filter_options={};if(og.reload_selectors_modify_filter_options_functions){fn_params={dimension_id:dimension_id,dimensions_to_reload_ots:dimensions_to_reload_ots,tree:tree,genid:genid};for(var x=0;x<og.reload_selectors_modify_filter_options_functions.length;x++){var fn=og.reload_selectors_modify_filter_options_functions[x];if(typeof(fn)=='function'){fn.call(null,fn_params,filter_options);}}}
tree.filterByMember(selected_members,selected_node,function(){self.filteredTrees++;if(self.filteredTrees==self.totalFilterTrees){self.resumeEvents();og.eventManager.fireEvent('member trees updated',selected_node);}},filter_options);}}}}}
member_selector.remove_all_dimension_selections=function(genid,dim_id,dont_relaod_dependant_selectors){if(!member_selector[genid])return;if(member_selector[genid].sel_context[dim_id]){var length=member_selector[genid].sel_context[dim_id].length;for(var i=0;i<length;i++){var member_id=member_selector[genid].sel_context[dim_id][0];member_selector.remove_relation(dim_id,genid,member_id,true);}
if(!dont_relaod_dependant_selectors){member_selector.reload_dependant_selectors(dim_id,genid);}}}
member_selector.remove_all_selections=function(genid,excluded_dim_ids,dont_relaod_dependant_selectors){if(typeof(excluded_dim_ids)=='undefined')excluded_dim_ids=[];for(dim_id in member_selector[genid].properties){if(excluded_dim_ids.indexOf(parseInt(dim_id))==-1){member_selector.remove_all_dimension_selections(genid,dim_id,dont_relaod_dependant_selectors);if(!member_selector[genid].properties[dim_id].isMultiple){$("#"+genid+"-member-chooser-panel-"+dim_id+"-tree-current-selected .empty-text").show();}}}}
member_selector.reset_all_selections=function(genid,dont_relaod_dependant_selectors){member_selector.remove_all_selections(genid,[],dont_relaod_dependant_selectors);var added_dim_ids=[];var dimensionMembers=og.contextManager.dimensionMembers;for(dim_id in dimensionMembers){var mids=dimensionMembers[dim_id];for(i=0;i<mids.length;i++){if(mids[i]>0){member_selector.add_relation(dim_id,genid,mids[i],true,true,false);added_dim_ids.push(dim_id);}}}
for(dim_id in og.dimensions_info){var dim_info=og.dimensions_info[dim_id];if(added_dim_ids.indexOf(dim_id)==-1&&dim_info.default_member){member_selector.add_relation(dim_id,genid,dim_info.default_member,true,true,false);}}}
member_selector.set_selected=function(genid,sel_member_ids,preload){for(var idx=0;idx<sel_member_ids.length;idx++){var sel_id=Number(sel_member_ids[idx]);var members=og.getMemberFromOgDimensions(sel_id);if(members.length>0){var member=members[0];if(member_selector[genid].properties[member.dimension_id]){member_selector.add_relation(member.dimension_id,genid,member.id,true);}}}}
member_selector.preload_members=function(genid,d){}
timeslots={};timeslots._minutes_multiplier=1000*60;timeslots._hours_multiplier=timeslots._minutes_multiplier*60;timeslots._days_multiplier=timeslots._hours_multiplier*24;timeslots._years_multiplier=timeslots._days_multiplier*365;timeslots.turn_into_total_milliseconds=function(worked_hours,worked_minutes,paused_hours,paused_minutes){var total_worked_hours=0;if(worked_hours>0&&worked_hours!=''){total_worked_hours=timeslots._hours_multiplier*worked_hours;}
if(paused_hours>0&&paused_hours!=''){total_worked_hours+=timeslots._hours_multiplier*paused_hours;}
var total_worked_minutes=0;if(worked_minutes>0&&worked_minutes!=''){total_worked_minutes=timeslots._minutes_multiplier*worked_minutes;}
if(paused_minutes>0&&paused_minutes!=''){total_worked_minutes+=timeslots._minutes_multiplier*paused_minutes;}
total_work_in_milliseconds=total_worked_hours+total_worked_minutes;return total_work_in_milliseconds;}
timeslots.format_hours_and_minutes=function(date_object){var return_string='';var formatted_minutes=date_object.getMinutes();if(date_object.getMinutes()<10){formatted_minutes='0'+date_object.getMinutes();}
if(og.preferences.time_format_use_24=="0"){return_string=date_object.getHours()+':'+formatted_minutes+' AM';if(date_object.getHours()>12){return_string=(date_object.getHours()-12)+':'+formatted_minutes+' PM';}
if(date_object.getHours()==12){return_string=(date_object.getHours()+':'+formatted_minutes+' PM');}
if(date_object.getHours()==0){return_string='12:'+formatted_minutes+' AM';}}else{return_string=date_object.getHours()+':'+formatted_minutes;}
return return_string;}
ofc_chart={image_binary:function(src){swf_cont=document.getElementById(src);swf=null;for(i=0;i<swf_cont.childNodes.length;i++){child=swf_cont.childNodes.item(i);if(child.id=='chart'||child.id=='ie_chart'){swf=child;break;}}
return swf.get_img_binary();},image_tag:function(src){return"<img src='data:image/png;base64,"+ofc_chart.image_binary(src)+"' />";},post_image_from_swf:function(genid,filename){var form=document.createElement('form');form.method='post';form.enctype='multipart/form-data';form.encoding='multipart/form-data';form.action=og.getUrl('report','upload_image');form.style.display='none';i_name=document.createElement("input");i_name.type='hidden';i_name.name='filename';i_name.value=genid+filename;form.appendChild(i_name);i_data=document.createElement("input");i_data.type='hidden';i_data.name='imgdata';i_data.value=ofc_chart.image_binary(genid);form.appendChild(i_data);document.body.appendChild(form);og.submit(form,{hideLoading:true,callback:function(){form.removeChild(input);document.body.removeChild(form);}});}};og.Breadcrumbs={resetSelection:function(){if(og.try_to_select_member_intervals){for(x in og.try_to_select_member_intervals){clearInterval(og.try_to_select_member_intervals[x]);}
og.try_to_select_member_intervals={};}
for(dimId in og.contextManager.dimensionMembers){og.contextManager.cleanActiveMembers(dimId);}
for(dimId in og.contextManager.dimensionMembers){og.clickRootNodeAndCallNext(dimId,0);break;}},refresh:function(node){var mainDimensionId=node.ownerTree.dimensionId;var secondary_htmls=[];var primary_html='';$('#headerBreadcrumb div.primary-breadcrumb').html('');$('#headerBreadcrumb div.secondary-breadcrumb').html('');for(dimId in og.contextManager.dimensionMembers){var members=og.contextManager.dimensionMembers[dimId];if(members.length>0){for(var j in members){var member=members[j];if(member>0){memberTitle=og.contextManager.getMemberName(dimId,member);if(memberTitle){var parent_html='';var first=true;var path_array=og.contextManager.getMemberPath(dimId,member,true);for(var p in path_array){if(typeof path_array[p]=='function')continue;var dcode=path_array[p].ownerTree.dimensionCode;var onclick='og.memberTreeExternalClick(\''+dcode+'\','+path_array[p].id+');';var ico_html='<div class="member-icon '+path_array[p].attributes.iconCls+'" style="padding-left:10px; margin-right:5px; float:left; height:18px;">&nbsp;</div>';parent_html+='<div class="header-breadcrumb" onclick="'+onclick+'" title="'+path_array[p].text+'">'+ico_html+path_array[p].text+'</div>';first=false;}
var n=og.contextManager.getTreeNode(dimId,member);var ico_html='<div class="member-icon '+n.attributes.iconCls+'" style="padding-left:10px; margin-right:5px; float:left; height:18px;">&nbsp;</div>';var dcode=n.ownerTree.dimensionCode;var onclick='og.memberTreeExternalClick(\''+dcode+'\','+n.id+');';var on_close_click=n.parentNode?'og.memberTreeExternalClick(\''+dcode+'\',\''+n.parentNode.id+'\');':'return true;';var close_html='<div class="header-breadcrumb-close" onclick="'+on_close_click+'"></div>';var bhtml=parent_html+'<div class="header-breadcrumb" title="'+memberTitle+'" onclick="'+onclick+'">'+ico_html+memberTitle+'</div>'+close_html;;if(dimId==mainDimensionId){primary_html+=bhtml;}else{secondary_htmls.push(bhtml);}}}}}}
if(primary_html==''){primary_html=secondary_htmls.shift();}
secondary_html=secondary_htmls.join('<div class="separator">|</div>');$('#headerBreadcrumb div.primary-breadcrumb').html(primary_html);$('#headerBreadcrumb div.secondary-breadcrumb').html(secondary_html);if(secondary_htmls.length==0){$('#headerBreadcrumb .header-breadcrumb.home').css('line-height','35px');$('#headerBreadcrumb div.primary-breadcrumb').css({'height':'45px'});$('#headerBreadcrumb div.primary-breadcrumb .header-breadcrumb').css({'height':'45px','line-height':'35px'});$('#headerBreadcrumb div.primary-breadcrumb .member-icon').css({'margin-top':'8px'});$('#headerBreadcrumb div.primary-breadcrumb .header-breadcrumb-close').css({'margin-top':'7px'});$('.header-content-left #logodiv h1').css({'height':'45px','line-height':'35px'});}else{$('#headerBreadcrumb div.primary-breadcrumb').css({'height':'21px'});$('#headerBreadcrumb .header-breadcrumb.home').css({'line-height':'20px'});$('.header-content-left #logodiv h1').css({'height':'21px','line-height':'21px'});}
og.Breadcrumbs.resizeHeaderBreadcrumbs();},resizeHeaderBreadcrumbs:function(){setTimeout(function(){$(".header-breadcrumb.home").show();var left_w=$('.header-content-left').width();if(left_w<60)left_w=60;$('#left-header-cell').css('min-width',(left_w)+'px');$('#left-header-cell').css('width',(left_w)+'px');var user_link_w=$('.header-content-right #userboxWrapper #userLink').width();$('.header-content-right #userboxWrapper').css('width',(user_link_w+65)+'px');var right_w=$('.header-content-right').outerWidth();if($.browser.msie){if(right_w>600)right_w=600;else if(right_w<370)right_w=370;}
$('#right-header-cell').css('min-width',(right_w+30)+'px');$('#right-header-cell').css('width',(right_w+30)+'px');var center_w=$("#headerContent").outerWidth()-left_w-right_w-100;$('#center-header-cell').css('width',center_w+'px');$('.header-breadcrumb-container').css('max-width',(center_w)+'px');$('.breadcrumb-members').css('width',(center_w-$('.header-breadcrumb.home').width()-15)+'px');$('.primary-breadcrumb').css('width',$('.breadcrumb-members').width());$('.secondary-breadcrumb').css('width',$('.breadcrumb-members').width());var prim_bcs=$('.primary-breadcrumb .header-breadcrumb');if(prim_bcs.length>1){og.Breadcrumbs.resizeHeaderBreadcrumbLine(prim_bcs,22);}
var sec_bcs=$('.secondary-breadcrumb .header-breadcrumb');if(sec_bcs.length>1){og.Breadcrumbs.resizeHeaderBreadcrumbLine(sec_bcs,15);}},500);},resizeHeaderBreadcrumbLine:function(br_array,max_font_size){var min_font_size=14;var next_font_size=max_font_size-1;var total_w=$('.breadcrumb-members').width();var sum_w=0;for(var i=0;i<br_array.length;i++){$(br_array[i]).css('max-width','1000px').css('font-size',max_font_size+'px');sum_w+=$(br_array[i]).width();}
while(sum_w>total_w&&next_font_size>=min_font_size){sum_w=0;for(var i=0;i<br_array.length;i++){$(br_array[i]).css('font-size',next_font_size+'px');sum_w+=$(br_array[i]).width()+10;}
next_font_size=next_font_size-1;}
if(sum_w>total_w){var last_w=$(br_array[br_array.length-1]).width();var tw=total_w-last_w;var single_w=Math.floor(tw/(br_array.length-1))-15;if(single_w<40)single_w=40;var actual_w=0;for(var i=0;i<(br_array.length-1);i++){$(br_array[i]).css('max-width',single_w+'px');actual_w+=single_w+10;}
if(total_w-actual_w<last_w){$(br_array[br_array.length-1]).css('max-width',(total_w-actual_w-15)+'px');}}}}
og.emptyBreadcrumbsToRefresh=new Array();og.eventManager.addListener('replace all empty breadcrumb',function(){var callback=function(emptyBreadcrumbs){og.replaceAllEmptyBreadcrumbForThisMemberInterval(emptyBreadcrumbs);}
var copy=og.emptyBreadcrumbsToRefresh.slice(0);if(copy.length>0){var members=og.getMembersFromServer(og.emptyBreadcrumbsToRefresh,callback,copy);}
og.emptyBreadcrumbsToRefresh.length=0;});og.replaceAllEmptyBreadcrumbForThisMemberInterval=function(emptyBreadcrumbs){var curNewsIndex=-1;function advanceNewsItem(){++curNewsIndex;if(curNewsIndex>=emptyBreadcrumbs.length){clearInterval(intervalID);}
var id=emptyBreadcrumbs[curNewsIndex];var members=og.getMemberFromOgDimensions(id,true);if(members.length>0){var member=members[0];og.replaceAllEmptyBreadcrumbForThisMember(0,member);}
var btns=$(".breadcrumbBtn.btnPopoverNotInitialized").toArray();og.initBreadcrumbsBtns(btns);}
var intervalID=setInterval(advanceNewsItem,20);}
og.getRealCrumbHtml=function(dims,draw_all_members,skipped_dimensions,show_archived,fixed_mem_len,show_link){var html='';var dim_index=0;var max_members_per_dim=og.preferences['breadcrumb_member_count'];for(x in dims){if(isNaN(x))continue;var skip_this_dimension=false;if(skipped_dimensions){for(sd in skipped_dimensions){if(skipped_dimensions[sd]==x){skip_this_dimension=true;break;}}}
if(skip_this_dimension)continue;var members=dims[x];var inner_html="";var title="";var total_texts=0;var all_texts=[];for(id in members){id=parseInt(id);if(isNaN(id))continue;var m=members[id];var texts=og.getMemberTextsFromOgDimensions(id,true);if(texts.length==0){texts.push({id:id,text:m.name,ot:m.ot,c:m.c});}
total_texts+=texts.length;all_texts[id]=texts;}
if(fixed_mem_len&&!isNaN(fixed_mem_len)){max_len=fixed_mem_len;}else{if(total_texts==1)max_len=13
else if(total_texts<3)max_len=9;else if(total_texts<5)max_len=5;else max_len=4;}
breadcrumb_count=0;for(id in members){if(isNaN(id))continue;texts=all_texts[id];if(texts.length>0){breadcrumb_count++;}
if(!draw_all_members&&breadcrumb_count>max_members_per_dim)break;if(title!=""&&breadcrumb_count<=max_members_per_dim)title+='- ';var color=members[id]['c'];var member_path_span='<span class="bread-crumb-'+id+' member-path real-breadcrumb og-wsname-color-'+color+'">';var member_path_content="";for(i=texts.length-1;i>=0;i--){var text=texts[i].text;text=text.replace("&amp;","&");if(i>0){str=text.length>max_len?text.substring(0,max_len-3)+"..":text;}else{str=text.length>12?text.substring(0,10)+"..":text;}
if(breadcrumb_count<=max_members_per_dim){title+=texts[i].text+(i>0?"/":" ");}
var onclick="return false;";if(og.additional_on_dimension_object_click[texts[i].ot]){onclick=og.additional_on_dimension_object_click[texts[i].ot].replace('<parameters>',texts[i].id);}
if(show_link){var link='<a href="#" onclick="'+onclick+'">'+str+'</a>';}else{var link=str;}
member_path_content+=link;if(i>0)member_path_content+=" > ";}
member_path_span+=member_path_content+'</span>';if(member_path_content!='')inner_html+=member_path_span;}
if(members['total']>max_members_per_dim){title+=lang('and number more',(members['total']-max_members_per_dim));}
if(inner_html!="")html+='<span class="member-path" title="'+title+'">'+inner_html+'</span>';dim_index++;}
return html;}
og.getCrumbHtml=function(dims,draw_all_members,skipped_dimensions,show_archived,fixed_mem_len,show_link){var all_bread_crumbs="";if(typeof show_link=="undefined"){show_link=true;}
for(x in dims){if(isNaN(x))continue;var dim={};var empty_bread_crumbs="";var members=dims[x];for(id in members){if(isNaN(id))continue;var members=og.getMemberFromOgDimensions(id,false);if(members.length>0){var member=members[0];if(typeof dim[member.dimension_id]=="undefined"){dim[member.dimension_id]={};}
member_info={"id":member.id,"ot":member.object_type_id,"c":member.color,"name":member.name};dim[member.dimension_id][member.id]=member_info;}else{empty_bread_crumbs+='<span class="member-path"><span class="bread-crumb-'+id+' member-path"></span></span>';}}
all_bread_crumbs+=og.getRealCrumbHtml(dim,draw_all_members,skipped_dimensions,show_archived,fixed_mem_len,show_link);all_bread_crumbs+=empty_bread_crumbs;}
return all_bread_crumbs;}
og.getCrumbHtmlWithoutLinksMemPath=function(dims,draw_all_members,skipped_dimensions,show_archived,fixed_mem_len,total_length,genid){var html='';var dim_index=0;var max_members_per_dim=og.preferences['breadcrumb_member_count'];for(x in dims){if(isNaN(x))continue;var skip_this_dimension=false;if(skipped_dimensions){for(sd in skipped_dimensions){if(skipped_dimensions[sd]==x){skip_this_dimension=true;break;}}}
if(skip_this_dimension)continue;var members=dims[x];var inner_html="";var title="";var total_texts=0;var all_texts=[];var total_text_length=0;var total_texts_in_Crumb=0;var important_member_name="";for(id in members){id=parseInt(id);if(isNaN(id))continue;var m=members[id];if(!m.archived){var callback_extra_params={genid:genid};var texts=og.getMemberTextsFromOgDimensions(id,true,og.replaceCrumbHtmlWithoutLinks,callback_extra_params);}else{var texts=[];texts.push({id:m.id,text:m.name,ot:m.ot,c:m.c});}
if(texts.length==0&&show_archived){texts.push({id:id,text:m.name,ot:m.ot,c:m.c});}
total_texts+=texts.length;all_texts[id]=texts;if(total_length&&!isNaN(total_length)){for(x in texts){total_text_length+=texts[x].length;total_texts_in_Crumb++;}}}
if(fixed_mem_len&&!isNaN(fixed_mem_len)){max_len=fixed_mem_len;}else{if(total_texts==1)max_len=13
else if(total_texts<3)max_len=9;else if(total_texts<5)max_len=5;else max_len=4;if(total_length&&!isNaN(total_length)){max_len=Math.floor(total_length/total_texts_in_Crumb);}}
breadcrumb_count=0;for(id in members){if(isNaN(id))continue;texts=all_texts[id];if(texts.length>0){breadcrumb_count++;}
if(!draw_all_members&&breadcrumb_count>max_members_per_dim)break;if(title!=""&&breadcrumb_count<=max_members_per_dim)title+='- ';var color=members[id]['c'];var member_path_span='<span class="member-path og-wsname-color-'+color+'">';var member_path_content="";for(i=texts.length-1;i>=0;i--){var text=texts[i].text;text=text.replace("&amp;","&");if(i>0){str=text.length>max_len?text.substring(0,max_len-3)+"..":text;}else{min_len=max_len<12?10:max_len-3;str=(text.length>12&&text.length>max_len)?text.substring(0,min_len)+"..":text;important_member_name=text.substring(0,total_length);}
if(breadcrumb_count<=max_members_per_dim){title+=texts[i].text+(i>0?"/":" ");}
var onclick="return false;";if(og.additional_on_dimension_object_click[texts[i].ot]){onclick=og.additional_on_dimension_object_click[texts[i].ot].replace('<parameters>',texts[i].id);}
member_path_content+=str;if(i>0)member_path_content+="/";}
if(member_path_content.length>total_length&&max_len<=3){member_path_content=".../"+important_member_name;}
member_path_span+=member_path_content+'</span>';if(member_path_content!='')inner_html+=member_path_span;}
if(members['total']>max_members_per_dim){title+=lang('and number more',(members['total']-max_members_per_dim));}
if(inner_html!="")html+='<span class="member-path" title="'+title+'">'+inner_html+'</span>';dim_index++;}
return html;}
og.getCrumbHtmlWithoutLinks=function(member_id,dimension_id,genid){member_id=parseInt(member_id);if(isNaN(member_id))return false;dimension_id=parseInt(dimension_id);if(isNaN(dimension_id))return false;width=$("#"+genid+"selected-member"+member_id+" .completePath").width();if(width==null||width==0){width=240;}
var callback_extra_params={genid:genid};var texts=og.getMemberTextsFromOgDimensions(member_id,false,og.replaceCrumbHtmlWithoutLinks,callback_extra_params);bredcrumb_total_length=width/7;if(texts.length>0){var member={};member[member_id]=texts[0];var member_path={};member_path[dimension_id]=member;mem_path=og.getCrumbHtmlWithoutLinksMemPath(member_path,false,null,false,null,bredcrumb_total_length,genid);return mem_path;}else{return false;}}
og.replaceCrumbHtmlWithoutLinks=function(dimension_id,member,extra_params){var html=og.getCrumbHtmlWithoutLinks(member.id,dimension_id,extra_params.genid);$("#"+extra_params.genid+"selected-member"+member.id+" > .completePath").replaceWith(html);}
og.replaceAllEmptyBreadcrumbForThisMember=function(dimension_id,member,extra_params){var targets=".empty-bread-crumb.bread-crumb-"+member.id;var all_targets=$(targets);var j=0;var new_target_id='bread-crumb-'+Ext.id()+member.id;var container_to_fill=$(all_targets[j]).data("container-to-fill");var show_link=$(all_targets[j]).data("show-link");var exclude_parents_path=$(all_targets[j]).data("exclude-parents-path");var epp=exclude_parents_path?'1':'0';$(all_targets[j]).parent().html('<span id="'+new_target_id+'" class="bread-crumb-'+member.id+' member-path real-breadcrumb og-wsname-color-'+member.color+'" data-container-to-fill="'+container_to_fill+'" data-show-link="'+show_link+'" data-exclude-parents-path="'+epp+'"></span>');og.insertBreadcrumb(member.id,new_target_id,false,null,exclude_parents_path);var target_0_html=$("#"+new_target_id).html();for(var j=1;j<all_targets.length;j++){var copy_target_id='bread-crumb-'+Ext.id()+member.id;var container_to_fill=$(all_targets[j]).data("container-to-fill");var show_link=$(all_targets[j]).data("show-link");var exclude_parents_path=$(all_targets[j]).data("exclude-parents-path");var epp=exclude_parents_path?'1':'0';$(all_targets[j]).parent().html('<span id="'+copy_target_id+'" class="bread-crumb-'+member.id+' member-path real-breadcrumb og-wsname-color-'+member.color+'" data-container-to-fill="'+container_to_fill+'" data-show-link="'+show_link+'" data-exclude-parents-path="'+epp+'"></span>');$('#'+copy_target_id).append(target_0_html);var container_width=$(all_targets[j]).closest(container_to_fill).width();og.checkMultiMemberBreadcrumb($(all_targets[j]),container_width);}}
og.getEmptyCrumbHtml=function(dims,container_to_fill,skipped_dimensions,show_link,exclude_parents_path,allow_associated_dimensions){var all_bread_crumbs="";if(typeof show_link=="undefined"||show_link==null){var show_link=true;}
var epp=exclude_parents_path?'1':'0';for(x in dims){if(isNaN(x))continue;if(typeof skipped_dimensions!="undefined"&&skipped_dimensions!=null){if(skipped_dimensions.indexOf(x)!=-1)continue;}
var dim={};var empty_bread_crumbs="";var members_by_ot=dims[x];if(!allow_associated_dimensions&&dims[x]&&dims[x].is_assoc_dim)continue;for(ot_id in members_by_ot){if(isNaN(ot_id))continue;var members=members_by_ot[ot_id];if(!members)continue;for(idx=0;idx<members.length;idx++){id=members[idx];if(isNaN(id))continue;empty_bread_crumbs+='<span class="member-path"><span class="bread-crumb-'+id+' empty-bread-crumb member-path" '+'data-container-to-fill="'+container_to_fill+'" data-show-link="'+show_link+'" data-exclude-parents-path="'+epp+'"></span></span>';if(og.emptyBreadcrumbsToRefresh.indexOf(id)==-1){og.emptyBreadcrumbsToRefresh.push(id);}}}
all_bread_crumbs+=empty_bread_crumbs;}
return all_bread_crumbs;}
og.insertBreadcrumb=function(member_id,target,from_callback){target="#"+target;var container_to_fill=$(target).data("container-to-fill");var show_link=$(target).data("show-link");var exclude_parents_path=$(target).data("exclude-parents-path");var extra_params={};var members=og.getMemberTextsFromOgDimensions(member_id,!exclude_parents_path);var title='';members.reverse();for(var i=0;i<members.length;i++){var m=members[i];title+=m.text;if(m.id!=member_id){title+=" • ";}
member=m;}
$(target).attr('title',title);$(target).parent().data('object-type',member.ot);var container_width=$(target).closest(container_to_fill).width();if($(target).closest(container_to_fill).css('max-width')!=='none'){container_width=parseFloat($(target).closest(container_to_fill).css('max-width'));}
var real_container_width=container_width;var container_current_childs=$(target).parent().siblings();var container_current_childs_width=0;for(var j=0;j<container_current_childs.length;j++){container_current_childs_width+=$(container_current_childs[j]).outerWidth(true);}
container_width=container_width-container_current_childs_width;var clone=$(target).closest(container_to_fill).clone(true);$('body').append(clone);var original_container=$(target).closest(container_to_fill);original_container.html('');var last=true;var ordained_members=new Array();var length=members.length;for(var i=1;i<=length;i++){if(last){ordained_members.push(members.pop());last=false;}else{ordained_members.push(members.shift());last=true;}}
last=true;var more_members='<span class="more-members-separator">...<span class="bullet-separator"></span> </span>';$(target).prepend(more_members);for(var i=0;i<ordained_members.length;i++){var m=ordained_members[i];var member_name=m.text;if(show_link){var onclick="return false;";if(og.additional_on_dimension_object_click[m.ot]){onclick=og.additional_on_dimension_object_click[m.ot].replace('<parameters>',m.id);}else{if(m.dim){var dim_tree=Ext.getCmp("dimension-panel-"+m.dim);if(dim_tree){onclick="og.memberTreeExternalClick('"+dim_tree.dimensionCode+"', "+m.id+");";}}}
member_name='<a onclick="'+onclick+';" href="#">'+m.text+'</a>';}
var member_text='<span>'+member_name+' <span class="bullet-separator"></span> </span>';if(m.id==member_id){member_text='<span>'+member_name+'</span>';}
var childs=$(target).children();var childs_width=0;for(var j=0;j<childs.length;j++){childs_width+=$(childs[j]).outerWidth(true);}
var calc='<span id="test_width" style="display:none">'+member_text+'</span>';$('body').append(calc);var member_text_width=$('#test_width').outerWidth(true)+30;$('#test_width').remove();if(childs_width+member_text_width<container_width){if(i==ordained_members.length-1){more_members="";}
if(last){$(target).children(".more-members-separator").replaceWith(more_members+member_text);last=false;}else{$(target).children(".more-members-separator").replaceWith(member_text+more_members);last=true;}}else{if(i==0){if(ordained_members.length>1){$(target).children(".more-members-separator").replaceWith(more_members+member_text);}else{$(target).children(".more-members-separator").replaceWith(member_text);}}
break;}}
og.checkMultiMemberBreadcrumb(target,real_container_width);original_container.replaceWith(clone);}
og.checkMultiMemberBreadcrumb=function(target,container_width){var member_paths_in_container=$(target).parent().siblings(".member-path");member_paths_in_container.push($(target).parent());var member_paths_in_container_width=0;var object_types_totals={};for(var i=0,length=member_paths_in_container.length;i<length;i++){member_paths_in_container_width+=$(member_paths_in_container[i]).outerWidth(true);var object_type=$(member_paths_in_container[i]).data("object-type");if(typeof(object_type)!=='undefined'){if(typeof(object_types_totals[object_type])!=='undefined'){object_types_totals[object_type]=object_types_totals[object_type]+1;}else{object_types_totals[object_type]=1;}}}
var total_paths=member_paths_in_container.length;if(member_paths_in_container_width>container_width&&total_paths>1){var object_types_totals_text="";object_types_totals_text+="<button class='members-total-colapsed breadcrumbBtn btnPopoverNotInitialized'>";for(var prop in object_types_totals){var total=object_types_totals[prop];var plural=total>1;var name_to_show=plural?og.objectTypes[prop].c_name_plural:og.objectTypes[prop].c_name;object_types_totals_text+="<span class='ctmBadge'>"+total+"</span> ";if(og.objectTypes[prop]&&og.objectTypes[prop].name){object_types_totals_text+=name_to_show+" ";}}
object_types_totals_text+="</button>";var old_colapsed_btns=$(target).parent().parent().children(".members-total-colapsed");if(old_colapsed_btns.length>0){for(var i=0,length=old_colapsed_btns.length;i<length;i++){$(old_colapsed_btns[i]).remove();}}
$(target).parent().parent().prepend(object_types_totals_text);for(var i=0,length=member_paths_in_container.length;i<length;i++){$(member_paths_in_container[i]).hide();}
og.checkObjectTypesTotalsOverflow(target,container_width);}}
og.checkObjectTypesTotalsOverflow=function(target,container_width){var object_types_in_container=$(target).parent().siblings(".members-total-colapsed");var object_types_in_container_width=0;for(var i=0,length=object_types_in_container.length;i<length;i++){object_types_in_container_width+=$(object_types_in_container[i]).outerWidth(true);}
if(object_types_in_container_width>container_width){for(var i=0,length=object_types_in_container.length;i<length;i++){$(object_types_in_container[i]).remove();}
if($(target).parent().parent().children(".breadcrumbAllBtn").length==0){var view_classification_btn='<button class="breadcrumbAllBtn breadcrumbBtn btnPopoverNotInitialized">'+lang("view classification")+'</button>';$(target).parent().parent().prepend(view_classification_btn);}}}
og.initBreadcrumbsBtns=function(btns){for(var i=0;i<btns.length;i++){var btn=$(btns[i]);var member_paths=btn.siblings(".member-path");var breadcrumbs_html=new Array();var max_width=0;var tmp_ot={};for(var j=0;j<member_paths.length;j++){var ot=$(member_paths[j]).data("object-type");if(typeof ot=="undefined"){continue;}
if(!og.objectTypes[ot])continue;var ot_name=og.objectTypes[ot].c_name;if(typeof tmp_ot[ot_name]=="undefined"){tmp_ot[ot_name]=new Array();}
if($(member_paths[j]).outerWidth(true)>max_width){max_width=$(member_paths[j]).outerWidth(true);}
var tmp_member={};tmp_member["html"]=$(member_paths[j]).html();tmp_ot[ot_name].push(tmp_member);}
var btn_id=Ext.id();var source=$("#breadcrumb-popover-template").html();var template=Handlebars.compile(source);var data={breadcrumbs:tmp_ot,btn_id:btn_id,max_width:max_width}
var html=template(data);btn.attr("id",btn_id);btn.data("visible",0);btn.popover('destroy');btn.popover({content:"example",delay:{show:"100",hide:"100"},html:true,container:'body',template:html,placement:'auto left',trigger:'hover'});btn.removeClass("btnPopoverNotInitialized");btn.on('hide.bs.popover',function(event){if($(this).data("visible")){event.preventDefault();}});}}
og.showBreadcrumbsPopover=function(btn_id){$('#'+btn_id).data("visible",1);}
og.hideBreadcrumbsPopover=function(btn_id,pop_id){$('#'+btn_id).data("visible",0);$('#'+btn_id).popover('hide');$('#'+pop_id).remove();}
ogMemberCache={};ogMemberCache.dimensions_root_members=new Array();ogMemberCache.addDimToDimRootMembers=function(dim_id){if(!ogMemberCache.areDimRootMembersLoaded(dim_id)){ogMemberCache.dimensions_root_members.push(dim_id);}}
ogMemberCache.areDimRootMembersLoaded=function(dim_id){if(ogMemberCache.dimensions_root_members.indexOf(dim_id)!=-1){return true;}
return false;}
ogMemberCache.reset_dimensions_cache=function(){og.dimensions={};og.dimensions_check_date=new Date();ogMemberCache.dimensions_root_members.length=0;}
og.getMemberFromOgDimensions=function(mem_id,include_parents,func_callback,callback_extra_params){if(isNaN(mem_id))return false;var members=[];if(typeof include_parents=="undefined"){include_parents=false;}
for(did in og.dimensions_info){if(isNaN(did))continue;if(og.dimensions&&og.dimensions[did]){var member=og.dimensions[did][mem_id];if(typeof member!="undefined"){members.push(member);if(!include_parents){return members;}else{while(member&&member.parent&&member.parent>0){member=og.dimensions[did][member.parent];if(member){members.push(member);}}}}}}
if(members.length<=0){og.getMemberFromServer(mem_id,func_callback,callback_extra_params);}
return members;}
og.getMemberFromServer=function(mem_id,func_callback,callback_extra_params){if(isNaN(mem_id))return false;if(searchingMemberOnTheServer.indexOf(mem_id)==-1){searchingMemberOnTheServer.push(mem_id);og.openLink(og.getUrl('dimension','get_member_parents',{member:mem_id}),{hideLoading:true,callback:function(s,d){for(var prop in d.members){var mem=d.members[prop];og.addMemberToOgDimensions(d.dimension_id,mem);if(d.member_id==mem.id){var member=mem;}}
var index=searchingMemberOnTheServer.indexOf(d.member_id);searchingMemberOnTheServer.splice(index,1);if(typeof member!="undefined"){if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(d.dimension_id,member,callback_extra_params);}}}})}}
og.getMemberTextsFromOgDimensions=function(mem_id,include_parents,func_callback,callback_extra_params){var texts=[];var members=og.getMemberFromOgDimensions(mem_id,include_parents,func_callback,callback_extra_params);if(members.length>0){for(i=0;i<members.length;i++){var member=members[i];var member_info={};member_info={"id":member.id,"dim":member.dimension_id,"ot":member.object_type_id,"c":member.color,"text":member.name};texts.push(member_info);}}
return texts;}
og.addMemberToOgDimensions=function(dim_id,member){if(typeof og.dimensions=='undefined'){og.dimensions={};}
if(typeof og.dimensions[dim_id]=='undefined'){og.dimensions[dim_id]={};}
og.dimensions[dim_id][member.id]=member;}
og.searchMemberOnServer=function(dimension_id,search_params,func_callback){var params={dimension_id:dimension_id};params.query=Ext.escapeRe(search_params.text.toLowerCase());if(typeof search_params.limit!='undefined'){params.limit=search_params.limit;}
if(typeof search_params.order!='undefined'){params.order=search_params.order;}
if(typeof search_params.start!='undefined'){params.start=search_params.start;}
if(typeof search_params.parents!='undefined'){params.parents=search_params.parents;}
if(typeof search_params.random!='undefined'){params.random=search_params.random;}
if(typeof search_params.allowed_member_types!='undefined'){params.allowed_member_types=search_params.allowed_member_types;}
params.ignore_context_filter=true;og.openLink(og.getUrl('dimension','search_dimension_members_tree',params),{hideLoading:true,hideErrors:true,callback:function(success,data){if(typeof func_callback!="undefined"){func_callback(data);}}});}
og.getMembersFromServer=function(members_ids,func_callback,callback_extra_params){var missing_members_ids=new Array();for(var i=0;i<members_ids.length;i++){var mem_id=members_ids[i];var missing=true;for(did in og.dimensions_info){if(isNaN(did))continue;if(og.dimensions&&og.dimensions[did]){var member=og.dimensions[did][mem_id];if(typeof member!="undefined"){missing=false;}}}
if(missing){missing_members_ids.push(mem_id);}}
if(missing_members_ids.length>0){og.openLink(og.getUrl('dimension','get_members'),{method:'POST',post:{member_ids:Ext.encode(missing_members_ids)},hideLoading:true,callback:function(s,d){for(var prop in d.members){var mem_path=d.members[prop];for(var mem in mem_path){var member=mem_path[mem];if(typeof(member.dimension_id)!="undefined"){og.addMemberToOgDimensions(member.dimension_id,member);}}}
if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(callback_extra_params);}}})}else{if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(callback_extra_params);}}}
ogMemberCache={};ogMemberCache.dimensions_root_members=new Array();ogMemberCache.addDimToDimRootMembers=function(dim_id){if(!ogMemberCache.areDimRootMembersLoaded(dim_id)){ogMemberCache.dimensions_root_members.push(dim_id);}}
ogMemberCache.areDimRootMembersLoaded=function(dim_id){if(ogMemberCache.dimensions_root_members.indexOf(dim_id)!=-1){return true;}
return false;}
ogMemberCache.reset_dimensions_cache=function(){og.dimensions={};og.dimensions_check_date=new Date();ogMemberCache.dimensions_root_members.length=0;}
og.getMemberFromOgDimensions=function(mem_id,include_parents,func_callback,callback_extra_params){if(isNaN(mem_id))return false;var members=[];if(typeof include_parents=="undefined"){include_parents=false;}
for(did in og.dimensions_info){if(isNaN(did))continue;if(og.dimensions&&og.dimensions[did]){var member=og.dimensions[did][mem_id];if(typeof member!="undefined"){members.push(member);if(!include_parents){return members;}else{while(member&&member.parent&&member.parent>0){member=og.dimensions[did][member.parent];if(member){members.push(member);}}}}}}
if(members.length<=0){og.getMemberFromServer(mem_id,func_callback,callback_extra_params);}
return members;}
og.getMemberFromServer=function(mem_id,func_callback,callback_extra_params){if(isNaN(mem_id))return false;if(searchingMemberOnTheServer.indexOf(mem_id)==-1){searchingMemberOnTheServer.push(mem_id);og.openLink(og.getUrl('dimension','get_member_parents',{member:mem_id}),{hideLoading:true,callback:function(s,d){for(var prop in d.members){var mem=d.members[prop];og.addMemberToOgDimensions(d.dimension_id,mem);if(d.member_id==mem.id){var member=mem;}}
var index=searchingMemberOnTheServer.indexOf(d.member_id);searchingMemberOnTheServer.splice(index,1);if(typeof member!="undefined"){if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(d.dimension_id,member,callback_extra_params);}}}})}}
og.getMemberTextsFromOgDimensions=function(mem_id,include_parents,func_callback,callback_extra_params){var texts=[];var members=og.getMemberFromOgDimensions(mem_id,include_parents,func_callback,callback_extra_params);if(members.length>0){for(i=0;i<members.length;i++){var member=members[i];var member_info={};member_info={"id":member.id,"dim":member.dimension_id,"ot":member.object_type_id,"c":member.color,"text":member.name};texts.push(member_info);}}
return texts;}
og.addMemberToOgDimensions=function(dim_id,member){if(typeof og.dimensions=='undefined'){og.dimensions={};}
if(typeof og.dimensions[dim_id]=='undefined'){og.dimensions[dim_id]={};}
og.dimensions[dim_id][member.id]=member;}
og.searchMemberOnServer=function(dimension_id,search_params,func_callback){var params={dimension_id:dimension_id};params.query=Ext.escapeRe(search_params.text.toLowerCase());if(typeof search_params.limit!='undefined'){params.limit=search_params.limit;}
if(typeof search_params.order!='undefined'){params.order=search_params.order;}
if(typeof search_params.start!='undefined'){params.start=search_params.start;}
if(typeof search_params.parents!='undefined'){params.parents=search_params.parents;}
if(typeof search_params.random!='undefined'){params.random=search_params.random;}
if(typeof search_params.allowed_member_types!='undefined'){params.allowed_member_types=search_params.allowed_member_types;}
params.ignore_context_filter=true;og.openLink(og.getUrl('dimension','search_dimension_members_tree',params),{hideLoading:true,hideErrors:true,callback:function(success,data){if(typeof func_callback!="undefined"){func_callback(data);}}});}
og.getMembersFromServer=function(members_ids,func_callback,callback_extra_params){var missing_members_ids=new Array();for(var i=0;i<members_ids.length;i++){var mem_id=members_ids[i];var missing=true;for(did in og.dimensions_info){if(isNaN(did))continue;if(og.dimensions&&og.dimensions[did]){var member=og.dimensions[did][mem_id];if(typeof member!="undefined"){missing=false;}}}
if(missing){missing_members_ids.push(mem_id);}}
if(missing_members_ids.length>0){og.openLink(og.getUrl('dimension','get_members'),{method:'POST',post:{member_ids:Ext.encode(missing_members_ids)},hideLoading:true,callback:function(s,d){for(var prop in d.members){var mem_path=d.members[prop];for(var mem in mem_path){var member=mem_path[mem];if(typeof(member.dimension_id)!="undefined"){og.addMemberToOgDimensions(member.dimension_id,member);}}}
if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(callback_extra_params);}}})}else{if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(callback_extra_params);}}}
og.MemberCombo=Ext.extend(Ext.form.ComboBox,{onLoad:function(){if(!this.hasFocus){return;}
if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){}
if(!this.selectByValue(this.value,true)){this.select(0,true);}}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);}}}else{this.onEmptyResults();}
this.el.on('change',function(){this.setValue(this.getRawValue());},this);},doQuery:function(q,forceAll){if(q===undefined||q===null){q='';}
var qe={query:q,forceAll:forceAll,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
q=qe.query;forceAll=qe.forceAll;if(forceAll===true||(q.length>=this.minChars)){if(this.lastQuery!==q){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(forceAll){this.store.clearFilter();}else{rexp=new RegExp(Ext.escapeRe(q),'i');this.store.filter(this.searchField,rexp);}
this.onLoad();}else{if(q.length>=this.minChars){this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});}
this.expand();}}else{this.selectedIndex=-1;this.onLoad();}}}});Ext.reg('membercombo',og.MemberCombo);og.ObjectPicker=function(config,object_id,object_id_no_select,ignore_context){if(!config)config={};if(!config.extra_list_params)config.extra_list_params={};extra_list_param=Ext.util.JSON.encode(config.extra_list_params);var url_params={ajax:true,include_comments:true,id_no_select:object_id_no_select,count_results:0,extra_list_params:extra_list_param};var url_controller='object';var url_action='list_objects';if(config.url_controller)url_controller=config.url_controller;if(config.url_action)url_action=config.url_action;var Grid=function(config){if(!config)config={};this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy(new Ext.data.Connection({method:'GET',url:og.getUrl(url_controller,url_action,url_params)})),reader:new Ext.data.JsonReader({root:'objects',totalProperty:'totalCount',id:'id',fields:['name','object_id','type','ot_id','icon','object_id','mimeType','createdBy','createdById','dateCreated','assignedTo','updatedBy','updatedById','dateUpdated','startDate','dueDate']}),remoteSort:true,listeners:{'load':function(store,result){var bbar=Ext.getCmp('obj_picker_grid').getBottomToolbar();if(bbar){bbar.displayMsg='';bbar.afterPageText='';}}}});this.store.baseParams.ignore_context=ignore_context?'1':'0';if(config.extra_member_ids){this.store.baseParams.extra_member_ids=config.extra_member_ids;}
this.store.setDefaultSort('dateUpdated','desc');function renderIcon(value,p,r){var classes="db-ico ico-unknown ico-"+r.data.type;if(r.data.mimeType){var path=r.data.mimeType.replace(/\./ig,"_").replace(/\//ig,"-").split("-");var acc="";for(var i=0;i<path.length;i++){acc+=path[i];classes+=" ico-"+acc;acc+="-";}}
return String.format('<div class="{0}" />',classes);}
function renderDate(value,p,r){if(!value){return"";}
return value;}
var sm=new Ext.grid.RowSelectionModel();var arrayColumns=[{id:'icon',header:'&nbsp;',dataIndex:'icon',width:28,renderer:renderIcon,sortable:false,fixed:true,resizable:false,hideable:false,menuDisabled:true},{id:'name',header:lang("name"),dataIndex:'name',renderer:og.clean},{id:'type',header:lang('type'),dataIndex:'type',width:60,hidden:true,sortable:false},{id:'last',header:lang("last update"),dataIndex:'dateUpdated',width:60,renderer:renderDate},{id:'user',header:lang('updated by'),dataIndex:'updatedBy',width:60,renderer:og.clean,sortable:false,hidden:true},{id:'created',header:lang("created on"),dataIndex:'dateCreated',width:60,renderer:renderDate,hidden:true},{id:'assignedto',header:lang('assigned to'),dataIndex:'assignedTo',width:60,renderer:'string',hidden:true},{id:'author',header:lang("created by"),dataIndex:'createdBy',width:60,renderer:og.clean,hidden:true},{id:'start',header:lang("start date"),dataIndex:'startDate',width:60,renderer:renderDate,sortable:false,hidden:false},{id:'due',header:lang("due date"),dataIndex:'dueDate',width:60,renderer:renderDate,sortable:false,hidden:false}];var cm=new Ext.grid.ColumnModel(arrayColumns);cm.defaultSortable=true;Grid.superclass.constructor.call(this,Ext.apply(config,{store:this.store,layout:'fit',id:'obj_picker_grid',cm:cm,stripeRows:true,loadMask:true,bbar:new og.CurrentPagingToolbar({pageSize:og.config['files_per_page'],store:this.store,displayInfo:true,displayMsg:lang('displaying objects of'),emptyMsg:lang("no objects to display")}),viewConfig:{forceFit:true},sm:sm}));}
Ext.extend(Grid,Ext.grid.GridPanel,{member_filter:{},getSelected:function(){return this.getSelectionModel().getSelections();},filterSelect:function(filter){var dueDateIndex=this.getColumnModel().findColumnIndex('dueDate');var startDateIndex=this.getColumnModel().findColumnIndex('startDate');var nameIndex=this.getColumnModel().findColumnIndex('name');var lastUpdateIndex=this.getColumnModel().findColumnIndex('dateUpdated');var assignedToIndex=this.getColumnModel().findColumnIndex('assignedTo');if(filter&&filter.type){let filtersMenu=filter.type.split(',');if(filtersMenu.indexOf("task")>-1){this.getColumnModel().setHidden(startDateIndex,false);this.getColumnModel().setHidden(dueDateIndex,false);this.getColumnModel().setHidden(assignedToIndex,false);}
else{this.getColumnModel().setHidden(startDateIndex,true);this.getColumnModel().setHidden(dueDateIndex,true);this.getColumnModel().setHidden(assignedToIndex,true);}
this.getColumnModel().setColumnWidth(nameIndex,400);this.getColumnModel().setColumnWidth(lastUpdateIndex,130);this.getColumnModel().setColumnWidth(startDateIndex,130);this.getColumnModel().setColumnWidth(dueDateIndex,130);this.getColumnModel().setColumnWidth(assignedToIndex,130);}
if(filter&&filter.filter=='type'){this.type=filter.type;this.store.baseParams.type=this.type;if(this.store.baseParams.type==''){var types=[];for(var i=0;i<og.objPickerTypeFilters.length;i++){types.push(og.objPickerTypeFilters[i].type);}
this.store.baseParams.type=types.join(',');}}
var member_ids=[];for(x in this.member_filter){for(var mi=0;mi<this.member_filter[x].length;mi++){member_ids.push(this.member_filter[x][mi]);}}
this.store.baseParams.ignore_context=1;this.store.baseParams.extra_member_ids=Ext.util.JSON.encode(member_ids);this.load();},load:function(params){Ext.apply(params,{start:0,limit:og.config['files_per_page']});this.store.removeAll();this.store.load({params:params});}});var TypeFilter=function(config){TypeFilter.superclass.constructor.call(this,Ext.apply(config,{rootVisible:false,lines:false,root:new Ext.tree.TreeNode(lang('filter')),collapseFirst:false}));this.filters=this.root.appendChild(new Ext.tree.TreeNode({text:lang('all'),expanded:true}));this.filters.filter={filter:'type',id:0,name:''};this.getSelectionModel().on({'selectionchange':function(sm,node){if(node&&!this.pauseEvents){this.fireEvent("filterselect",node.filter);}},scope:this});this.addEvents({filterselect:true});};Ext.extend(TypeFilter,Ext.tree.TreePanel,{addFilter:function(filter,selected,config){if(!config)config={};var exists=this.getNodeById(filter.filter+filter.id);if(exists){return;}
var config=Ext.apply(config,{iconCls:filter.iconCls||'ico-'+filter.id,leaf:true,text:filter.name,cls:selected?'x-tree-selected':'',id:filter.id});var node=new Ext.tree.TreeNode(config);node.filter=filter;this.filters.appendChild(node);return node;},loadFilters:function(types,selected_type){this.removeAll();var all_types=[];for(var i=0;i<og.objPickerTypeFilters.length;i++){var filter=og.objPickerTypeFilters[i];if(!types){this.addFilter(filter,filter.type==selected_type);}else{for(var j=0;j<types.length;j++){if(types[j]==filter.type){this.addFilter(filter,filter.type==selected_type);break;}}}
all_types.push(filter.type);}
this.filters.filter.type=selected_type?selected_type:all_types.join(',');this.filters.expand();this.pauseEvents=true;this.filters.select();this.pauseEvents=false;},removeAll:function(){var node=this.filters.firstChild;while(node){var aux=node;node=node.nextSibling;aux.remove();}}});Ext.reg('typefilter',TypeFilter);var hideUploadButton=config.hideUploadButton||og.preferences.link_objects_hide_upload_button;var tbarItems=[{text:lang('upload'),tooltip:lang('quick upload desc'),iconCls:'ico-upload',hidden:(hideUploadButton?hideUploadButton:false),handler:function(){var quickId=Ext.id();var picker=this;og.openLink(og.getUrl('files','quick_add_files',{genid:quickId,object_id:object_id}),{preventPanelLoad:true,onSuccess:function(data){og.ExtendedDialog.show({html:data.current.data,height:300,width:600,title:lang('upload file'),ok_fn:function(){og.doFileUpload(quickId,{callback:function(){form=document.getElementById(quickId+'quickaddfile');og.ajaxSubmit(form,{callback:function(success,data){if(success){picker.grid.store.reload();}}});}});og.ExtendedDialog.hide();}});return;}});},scope:this},{text:lang('refresh'),tooltip:lang('refresh desc'),iconCls:'op-ico-refresh',handler:function(){this.grid.store.reload();},scope:this},"-",{xtype:'textfield',id:'txtFilreByObjectName',fieldLabel:lang('name'),emptyText:lang('filter')+'...',tooltip:lang('filtre name desc'),listeners:{render:{fn:function(f){f.el.on('keyup',function(e){this.filterName(e.target.value);this.grid.store.reload();},this,{buffer:350});},scope:this}},scope:this}];if(config.more_tbar_items){for(var i=0;i<config.more_tbar_items.length;i++){tbarItems.push(config.more_tbar_items[i]);}}
og.ObjectPicker.superclass.constructor.call(this,Ext.apply(config,{y:50,width:640,height:480,id:'object-picker',layout:'border',modal:true,closeAction:'close',iconCls:'op-ico',title:lang('select an object'),buttons:[{text:lang('ok'),handler:this.accept,scope:this},{text:lang('cancel'),handler:this.cancel,scope:this}],items:[{region:'center',layout:'fit',tbar:tbarItems,items:[this.grid=new Grid(config)]},{layout:'border',split:true,width:200,region:'west',collapsible:true,hidden:config.hideFilters,title:lang('filter'),items:[{xtype:'typefilter',id:'typeFilter',region:'north',autoScroll:true,listeners:{filterselect:{fn:this.grid.filterSelect,scope:this.grid}}},{xtype:'panel',id:'dimFilter',region:'center',autoScroll:true,split:true,autoLoad:{scripts:true,url:og.getUrl('dimension','linked_object_filters',{context:og.contextManager.plainContext()})},listeners:{memberselected:{fn:function(context){var grid=Ext.getCmp('obj_picker_grid');if(grid){grid.member_filter=context;grid.filterSelect();}}},clearfilters:{fn:function(genid){grid=Ext.getCmp('obj_picker_grid');for(x in grid.member_filter){var combo=Ext.getCmp(genid+'add-member-input-dim'+x);if(combo)combo.clearValue();}
grid.member_filter={};grid.filterSelect();}}}}]}]}));this.grid.on('rowdblclick',this.accept,this);this.addEvents({'objectselected':true});}
Ext.extend(og.ObjectPicker,Ext.Window,{accept:function(){this.fireEvent('objectselected',this.grid.getSelected());this.close();},cancel:function(){this.close();},loadFilters:function(config){if(!config)config={};delete this.grid.store.baseParams.type;var typef=this.findById('typeFilter');typef.loadFilters(config.types,config.selected_type);this.grid.store.baseParams.type=typef.filters.filter.type;},filterName:function(value){this.grid.store.baseParams.name=value;},load:function(){this.grid.store.baseParams.context=og.contextManager.plainContext();this.grid.load();}});og.ObjectPicker.show=function(callback,scope,config,object_id,object_id_no_select){if(!config)config={};this.dialog=new og.ObjectPicker(config,object_id,object_id_no_select,config.ignore_context);this.dialog.loadFilters(config);if(config.context){this.dialog.grid.store.baseParams.context=config.context;var con=eval(config.context);}else{var con=og.contextManager.dimensionMembers;}
var has_extra_member_ids=typeof(config.extra_member_ids)!='undefined';if(!has_extra_member_ids)config.extra_member_ids=[];config.ignore_context=1;this.dialog.grid.member_filter={};for(x in con){this.dialog.grid.member_filter[x]=[];for(i=0;i<con[x].length;i++){if(parseInt(con[x][i])>0){this.dialog.grid.member_filter[x].push(con[x][i]);if(!has_extra_member_ids){config.extra_member_ids.push(con[x][i]);}}}}
this.dialog.load();this.dialog.purgeListeners();this.dialog.on('objectselected',callback,scope,{single:true});this.dialog.on('hide',og.restoreFlashObjects);this.dialog.on('close',og.restoreFlashObjects);og.hideFlashObjects();this.dialog.show();var pos=this.dialog.getPosition();if(pos[0]<0)pos[0]=0;if(pos[1]<0)pos[1]=0;this.dialog.setPosition(pos[0],pos[1]);}
og.ContactCombo=Ext.extend(Ext.form.ComboBox,{onLoad:function(){if(!this.hasFocus){return;}
og.ContactCombo.addQuickContactButton(this);if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){}
if(!this.selectByValue(this.value,true)){this.select(0,true);}}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);}}}else{this.onEmptyResults();}
this.el.on('change',function(){this.setValue(this.getRawValue());},this);},doQuery:function(q,forceAll){if(q===undefined||q===null){q='';}
var qe={query:q,forceAll:forceAll,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
q=qe.query;forceAll=qe.forceAll;if(forceAll===true||(q.length>=this.minChars)){if(this.lastQuery!==q){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(forceAll){this.store.clearFilter();}else{rexp=new RegExp(Ext.escapeRe(q),'i');this.store.filter(this.searchField,rexp);}
this.onLoad();}else{if(q.length>=this.minChars){this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});}
this.expand();}}else{this.selectedIndex=-1;this.onLoad();}}}});Ext.reg('contactcombo',og.ContactCombo);og.renderContactSelector=function(config){var genid=config.genid;var id=config.id;var name=config.name;var render_to=config.render_to;var is_multiple=config.is_multiple;var custom_selected_class=config.custom_selected_class;var no_style_in_selected=config.no_style_in_selected;var selected=config.selected;var selected_name=config.selected_name;var onchange_fn=config.onchange_fn;var tabindex=config.tabindex|0;var url_params=null;if(!isNaN(selected)&&selected>0){}
if(config.filters){if(!url_params)url_params={};url_params['filters']=Ext.util.JSON.encode(config.filters);url_params['object_id']=Ext.util.JSON.encode(config.id);}
if(config.plugin_filters){if(!url_params)url_params={};url_params['plugin_filters']=Ext.util.JSON.encode(config.plugin_filters);url_params['object_id']=Ext.util.JSON.encode(config.id);}
var selector_filters=config.filters;var store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({method:"GET",url:og.makeAjaxUrl(og.getUrl('contact','get_contacts_for_selector',url_params))}),reader:new Ext.data.JsonReader({root:"contacts",fields:[{name:"id"},{name:"name"}]})});var list_class=(config.listClass?config.listClass:'')+' '+genid;var list_align=(config.listAlign?config.listAlign:'tl-bl');if(config.is_bootstrap){config.width='100%';}else{config.width=!isNaN(config.width)?config.width:300;}
var contactsCombo=new og.ContactCombo({renderTo:genid+render_to,name:name+'combo',id:genid+id+'combo',value:selected,minChars:0,store:store,displayField:'name',mode:'remote',width:config.width,listWidth:config.listWidth?config.listWidth:'auto',listClass:list_class,listAlign:list_align,cls:config.cls?config.cls:'assigned-to-combo',shadow:config.shadow!='undefined'?config.shadow:true,triggerAction:'all',selectOnFocus:true,valueField:'id',tabIndex:tabindex,emptyText:config.empty_text?config.empty_text:(lang('select contact')+'...'),valueNotFoundText:'',inline_selector:config.inline_selector,disabled:config.disabled,hidden:config.disabled||config.hidden,cp_type:config.cp_type,is_bootstrap:config.is_bootstrap});contactsCombo.doQuery('',true);contactsCombo.config_parameters=config;contactsCombo.on('focus',function(combo){og.ContactCombo.addQuickContactButton(this);if(combo)combo.expand();});contactsCombo.on('beforeselect',function(combo,record,index){if(record.data.id==-1){setTimeout(function(){combo.emptyText='';combo.clearValue();combo.focus();},100);}else if(record.data.id==-2){setTimeout(function(){combo.clearValue();},100);og.ObjectPicker.show(function(objs){if(objs&&objs.length>0){var obj=objs[0].data;if(obj.type!='contact'){og.msg(lang("error"),lang("object type not supported"),4,"err");}else{records=[];var r=new Ext.data.Record({'id':obj.object_id,'name':obj.name},obj.object_id);records.push(r);this.store.removeAll();this.store.add(records);this.reset();this.setValue(r.data[this.valueField||this.displayField]);this.fireEvent('select',combo,r,0);og.selectContactFromCombo(obj.object_id,obj.name,combo,genid+render_to,genid+id,onchange_fn,is_multiple);}}},combo,{ignore_context:true,hideFilters:true,sort:'name',dir:'ASC',extra_list_params:selector_filters,types:['contact'],selected_type:'contact'});}else if(record.data.id==-3){setTimeout(function(){combo.emptyText='';combo.clearValue();combo.focus();},50);var quickConfig={combo:combo,genid_r:genid+render_to,gendid:genid+id,onchange:onchange_fn,multiple:is_multiple,class:custom_selected_class,style:no_style_in_selected}
og.renderModalQuickContact(config.memberId,combo.id,genid+render_to,genid+id,is_multiple);return true;}else{og.selectContactFromCombo(record.data.id,record.data.name,combo,genid+render_to,genid+id,onchange_fn,is_multiple,custom_selected_class,no_style_in_selected,record.json.unclassified);}});if(is_multiple){var html_labels='<div id="'+genid+id+'_labels" class="multiple-cp-contact-labels-container"></div>';document.getElementById(genid+render_to).insertAdjacentHTML('beforeend',html_labels);}
var input=document.createElement("input");input.setAttribute("type","hidden");input.setAttribute("id",genid+id);if(is_multiple){input.setAttribute("name",'pivot_'+name);}else{input.setAttribute("name",name);}
input.setAttribute("data-name",name);input.setAttribute("value","");var container=document.getElementById(genid+render_to);if(container){container.appendChild(input);}
if(!is_multiple){if(!isNaN(selected)&&selected>0){og.selectContactFromCombo(selected,selected_name,contactsCombo,genid+render_to,genid+id,onchange_fn,is_multiple);}}else{var array_selected_ids=selected!=''?selected.split(","):[];var array_selected_names=selected_name!=''?selected_name.split(","):[];if(array_selected_ids.length>0&&array_selected_names.length>0){for(var i=0;i<array_selected_ids.length;i++){og.selectContactFromCombo(array_selected_ids[i],array_selected_names[i],contactsCombo,genid+render_to,genid+id,onchange_fn,is_multiple);}}}
if(config.disabled){$("#"+genid+render_to+" a.link-ico.ico-delete").remove();}}
og.selectContactFromCombo=function(contact_id,contact_name,combo,container_id,hf_id,onchange_fn,is_multiple,custom_selected_class,no_style_in_selected,unclassified){if(no_style_in_selected==null){no_style_in_selected=false;}
if(is_multiple){if(document.getElementById(hf_id).name==document.getElementById(hf_id).getAttribute('data-name')+"[0]"){document.getElementById(hf_id).name='pivot_'+document.getElementById(hf_id).getAttribute('data-name');}
if(document.getElementById(hf_id).value==0)document.getElementById(hf_id).value="";var name_hidden=document.getElementById(hf_id).getAttribute("data-name");if(document.getElementById(hf_id).value!=lang('select user')){var array_contact_ids=JSON.parse("["+document.getElementById(hf_id).value+"]");}else{var array_contact_ids=[];}
if(!array_contact_ids.includes(contact_id)){array_contact_ids.push(contact_id);document.getElementById(hf_id).value=array_contact_ids.join(", ");var i=array_contact_ids.length-1;var item=array_contact_ids[i];html_hiddens='<input id=hidden_'+name_hidden+'['+i+'] class='+hf_id+' type="hidden" name='+name_hidden+'['+i+'] value='+item+' contact-id='+contact_id+'>';Ext.get(container_id).insertHtml('beforeEnd',html_hiddens);}else{return;}}else{document.getElementById(hf_id).value=contact_id;}
if(!is_multiple)combo.hide();var style="";var remove_text=lang('remove');if(combo.config_parameters.remove_text)remove_text=combo.config_parameters.remove_text;var rem_float_dir='right';if(combo.initialConfig.inline_selector){style="display:inline-flex; width:"+combo.initialConfig.width+"px;";remove_text="";rem_float_dir='left';}
if(no_style_in_selected==true){style="";}
var onchange_fn_str='';if(typeof(onchange_fn)=='function'){onchange_fn(contact_id);onchange_fn_str=onchange_fn.name+"("+contact_id+");";}
if(combo.initialConfig.is_bootstrap){var html='<div class="contact-sel-name-cont '+((custom_selected_class!=null)?custom_selected_class:"")+'" style="font-size: 1rem;white-space: nowrap;'+style+'">'+'<label>'+contact_name+'</label>'+'<a href="#" onclick="og.reCalculateValue('+contact_id+',\''+hf_id+'\');'+'og.showContactCombo(\''+combo.getId()+'\'); Ext.get(this).parent().remove();'+onchange_fn_str+'" '+'class="link-ico ico-delete multiple-cp-contact-a-remove" '+'style="padding-left:18px;font-size: 0.75rem;padding-top: 1px;padding-bottom: 19px;">'+remove_text+'</a>'+'</div>';}else{if(!is_multiple){var html='<div class="contact-sel-name-cont '+((custom_selected_class!=null)?custom_selected_class:"")+'" style="'+style+'"><div style="float:left;margin-right:5px;">'+contact_name+'</div>'+'<a href="#" onclick="document.getElementById(\''+hf_id+'\').value=0;og.showContactCombo(\''+combo.getId()+'\'); Ext.get(this).parent().remove();'+onchange_fn_str+'" style="padding-left:18px;" class="link-ico ico-delete">'+remove_text+'</a></div>';}else{var html='<div class="contact-sel-name-cont '+((custom_selected_class!=null)?custom_selected_class:"")+'" style="white-space: nowrap;'+style+'"><div class="multiple-cp-contact-div-name">'+contact_name+'</div>'+'<a href="#" onclick="og.reCalculateValue('+contact_id+',\''+hf_id+'\');og.showContactCombo(\''+combo.getId()+'\'); Ext.get(this).parent().remove();'+onchange_fn_str+'" class="link-ico ico-delete multiple-cp-contact-a-remove">'+remove_text+'</a></div>';}}
var div_id=hf_id+'_labels';if(unclassified){og.elementToAddUnclassified=html;og.ExtModal.show({title:lang('add unclassified contact'),html:og.contentModalAddUnclassified(container_id,div_id)})}else{if(document.getElementById(div_id)){document.getElementById(div_id).insertAdjacentHTML('beforeend',html);}else{Ext.get(container_id).insertHtml('beforeEnd',html);}}}
og.reCalculateValue=function(contact_id,hf_id){var array_ids=JSON.parse("["+document.getElementById(hf_id).value+"]");var index=array_ids.indexOf(contact_id);if(index>-1){array_ids.splice(index,1);}
if(array_ids.length>0){var new_value=array_ids.join(", ");}else{var new_value="";document.getElementById(hf_id).name=document.getElementById(hf_id).getAttribute('data-name')+"[0]";}
document.getElementById(hf_id).value=new_value;var elms=document.getElementsByClassName(hf_id);for(var i=0;i<elms.length;i++){if(parseInt(elms[i].getAttribute("contact-id"))===contact_id){var id_to_delete=elms[i].id;var element_to_delete=document.getElementById(id_to_delete);element_to_delete.parentNode.removeChild(element_to_delete);}}}
og.showContactCombo=function(id){combo=Ext.getCmp(id);if(combo){combo.clearValue();combo.show();combo.doQuery(' ',true);}}
og.renderModalQuickContact=function(member,combo_id,render,gen,multiple){og.ExtModal.show({title:lang('new contact'),html:og.contentModalQuickContact(member,combo_id,render,gen,multiple)});setTimeout(function(){$("#"+gen+"profileFormFirstName").focus();$("#"+gen+"profileFormFirstName").focusout(function(){$("#"+gen+"profileFormSurname").focus();});$("#"+gen+"profileFormSurname").focusout(function(){$("#"+gen+"profileFormEmail").focus();});$("#"+gen+"profileFormEmail").focusout(function(){$("#"+gen+"submit").focus();});$("#"+gen+"submit").focusout(function(){$("#"+gen+"profileFormFirstName").focus();});},100);}
og.contentModalQuickContact=function(member,combo_id,render,gen,multiple){var method="og.addQuickContactFromModal('"+member+"','"+combo_id+"','"+render+"','"+gen+"',"+multiple+")";var button_content=lang("add contact");var placeholder_f_name=lang("first name");var placeholder_l_name=lang("last name");var placeholder_e_mail=lang("email address");return'<div id="modalQuickContact" class="coInputHeader">'
+'<div class="coInputName"><form>'
+'<input id="'+gen+'profileFormFirstName" tabindex="0" maxlength="50" placeholder="'+placeholder_f_name+' *" class="title short" type="text" name="contact[first_name]" value="">'
+'<input id="'+gen+'profileFormSurname" tabindex="0" maxlength="50" placeholder="'+placeholder_l_name+' *" class="title short" type="text" name="contact[surname]" value="">'
+'<input id="'+gen+'profileFormEmail" tabindex="0" maxlength="90" placeholder="'+placeholder_e_mail+'" class="title short" type="text" name="contact[email]" value=""></form></div>'
+'<div class="coInputButtons" style="float:  none;width: 100%;">'
+'<button style="margin-top:0px;margin-left:10px;float: right;" id="'+gen+'submit" class="submit " type="submit" accesskey="s" onclick="'+method+'">'+button_content+'</button></div>'
+'<input type="hidden" name="contact[new_contact_from_mail_div_id]" value="">'
+'<input type="hidden" name="contact[hf_contacts]" value="">'
+'<div class="clear"></div>'
+'<div class="clear"></div>'
+'</div>'};og.addQuickContactFromModal=function(member,combo_id,render,gen,multiple){var modalQuickContact=$('#modalQuickContact');var name=modalQuickContact.find('#'+gen+'profileFormFirstName').val();var surname=modalQuickContact.find('#'+gen+'profileFormSurname').val();var email=modalQuickContact.find('#'+gen+'profileFormEmail').val();og.openLink(og.getUrl('contact','add',{}),{hideLoading:true,post:{'contact[first_name]':name,'contact[surname]':surname,'contact[email]':email,'members':'['+member+']'},callback:function(success,data){if(success){var combo=Ext.getCmp(combo_id);og.selectContactFromCombo(data.contact_id,data.contact_name,combo,render,gen,'',multiple);og.ExtModal.hide();}}});}
og.ContactCombo.addQuickContactButton=function(object){if(object.cp_type=="contact"){var flag=true;var data={'id':-3,'name':'<a href="#" class="db-ico ico-expand ico-task" style="color:blue;text-decoration:underline;padding-left:20px;">'+lang('add contact')+'</a>'};if(object.store.getCount()>0){object.store.each(function(D){if(D.data.id==data.id){flag=false;}})};if(flag){var r=new Ext.data.Record(data,0);object.store.insert(0,r);}}}
og.contentModalAddUnclassified=function(container_id,div_id){var method="og.addUnclassifiedContactFromModal('"+container_id+"','"+div_id+"')";var button_content=lang("accept");return'<div id="modalQuickContact" class="coInputHeader">'
+'<div class="coInputName">'
+'<p class="coInputName" style="max-width: 510px;text-align:  justify;font-size: 17px;">'+lang('unclassified message')+'</p>'
+'</div>'
+'<div class="coInputButtons" style="float:  none;width: 100%;">'
+'<button style="margin-top:0px;margin-left:10px;float: right;" id="submit" class="submit " type="submit" accesskey="s" onclick="'+method+'">'+button_content+'</button></div>'
+'<div class="clear"></div>'
+'<div class="clear"></div>'
+'</div>';};og.addUnclassifiedContactFromModal=function(container_id,div_id){if(document.getElementById(div_id)){document.getElementById(div_id).insertAdjacentHTML('beforeend',og.elementToAddUnclassified);}else{Ext.get(container_id).insertHtml('beforeEnd',og.elementToAddUnclassified);}
og.ExtModal.hide();}
og.reminderDurations=[0,1,2,5,10,15,30];og.reminderDurationTypes={"1":"minutes","60":"hours","1440":"days","10080":"weeks"};og.addReminder=function(parent,context,type,duration,duration_type,for_subscribers,button,date_reminder=null,type_object=null){if(typeof(og.addAdvancedReminder)=='function'){return og.addAdvancedReminder(parent,context,type,duration,duration_type,for_subscribers,button,date_reminder,type_object);}
var count=parent.getElementsByTagName("div").length;var div=document.createElement("div");var html='<select name="reminder_type['+context+']['+count+']">';for(var i=0;i<og.reminderTypes.length;i++){html+='<option value="'+og.reminderTypes[i]+'"';if(og.reminderTypes[i]==type){html+=' selected="selected"';}
html+='>'+lang(og.reminderTypes[i])+'</option>';}
html+='</select>';html+='<select name="reminder_duration['+context+']['+count+']">';for(var i=0;i<og.reminderDurations.length;i++){html+='<option value="'+og.reminderDurations[i]+'"';if(og.reminderDurations[i]==duration){html+=' selected="selected"';}
html+='>'+og.reminderDurations[i]+'</option>';}
html+='</select>';html+='<select name="reminder_duration_type['+context+']['+count+']">';for(var i in og.reminderDurationTypes){html+='<option value="'+i+'"';if(i==duration_type){html+=' selected="selected"';}
html+='>'+lang(og.reminderDurationTypes[i])+'</option>';}
html+='</select>';html+='&nbsp;'+lang('before');html+='<span style="margin-left:30px;position:relative;"><input class="checkbox" type="checkbox" name="reminder_subscribers['+context+']['+count+']" '+(for_subscribers?'checked="checked"':"")+' id="'+id+'" />&nbsp;'+lang("apply to subscribers")+'</span>';var id=Ext.id();html+='<a href="#" onclick="og.removeReminder(this.parentNode, \''+context+'\');return false;" style="margin-left:30px;">';html+='<img title="'+lang("remove object reminder")+'" class="ico ico-delete" src="s.gif" style="vertical-align:middle;width:16px;height:20px;margin: 0 5px;position:relative;top:-2px;cursor:pointer" />';html+=lang('remove');html+='</a>';div.innerHTML=html;parent.insertBefore(div,button);};og.removeReminder=function(div,context){var parent=div.parentNode;parent.removeChild(div);var row=parent.firstChild;var num=0;while(row!=null){if(row.tagName=="DIV"){var inputs=row.getElementsByTagName("select");for(var i=0;i<inputs.length;i++){var input=inputs[i];if(input.name.substring(0,13)=="reminder_type"){input.name="reminder_type["+context+"]["+num+"]";}else if(input.name.substring(0,20)=="reminder_subscribers"){input.name="reminder_subscribers["+context+"]["+num+"]";}else if(input.name.substring(0,22)=="reminder_duration_type"){input.name="reminder_duration_type["+context+"]["+num+"]";}else{input.name="reminder_duration["+context+"]["+num+"]";}}
num++;}
row=row.nextSibling;}};og.reports={};og.reports.createPrintWindow=function(title,hide_report_header){var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,";var printWindow=window.open("","",disp_setting);printWindow.document.open();printWindow.document.write('<html><head><title>'+title+'</title>');printWindow.document.write('<link href="'+og.hostName+'/public/assets/themes/default/stylesheets/website.css" rel="stylesheet" type="text/css">');printWindow.document.write('<link href="'+og.hostName+'/public/assets/themes/default/stylesheets/general/rewrites.css" rel="stylesheet" type="text/css">');if(og.reports.additional_print_window_css){for(var i=0;i<og.reports.additional_print_window_css.length;i++){printWindow.document.write('<link href="'+og.hostName+og.reports.additional_print_window_css[i]+'" rel="stylesheet" type="text/css">');}}
printWindow.document.write('</head><body onLoad="self.print()" id="body" style="padding:10px;">');if(!hide_report_header){printWindow.document.write(og.reports.buildReportHeader(title));}
return printWindow;}
og.reports.buildReportHeader=function(title){var html='<div class="report-print-header"><div class="title-container"><h1>'+title+'</h1></div>';html+='<div class="company-info">';if(og.ownerCompany.logo_url){html+='<div class="logo-container"><img src="'+og.ownerCompany.logo_url+'"/></div>';}else{html+='<div class="comp-name-container">'+og.ownerCompany.name+'</div><br />';}
if(og.ownerCompany.address){html+='<div class="address-container">'+og.ownerCompany.address+'</div>';html+='<br />';}
if(og.ownerCompany.email){html+='<div class="email-container link-ico ico-email">'+og.ownerCompany.email+'</div>';}
if(og.ownerCompany.phone){html+='<div class="phone-container link-ico ico-phone">'+og.ownerCompany.phone+'</div>';}
html+='</div></div>';html+='<div class="clear"></div>';return html;}
og.reports.closePrintWindow=function(printWindow){printWindow.document.write('</body></html>');printWindow.document.close();printWindow.focus();}
og.reports.fillDisabledParams=function(genid,params){var post_vars=$("#post"+genid).val().replace(/\'/g,'"');var post_json=null;try{post_json=$.parseJSON(post_vars);}catch(e){}
if(post_json&&post_json.disabled_params){for(x in post_json.disabled_params){if(typeof(post_json.disabled_params[x])=='function')continue;params['disabled_params['+x+']']=post_json.disabled_params[x];}}}
og.reports.printReport=function(genid,title,report_id){var params={id:report_id};var params_json=$("#params_"+genid).val();var p=Ext.util.JSON.decode(params_json);for(var x in p){params['params['+x+']']=p[x];}
og.reports.fillDisabledParams(genid,params);og.openLink(og.getUrl('reporting','print_custom_report',params),{callback:function(success,data){var printWindow=og.reports.createPrintWindow(title,!og.config.show_company_info_report_print);var html='';if(!og.config.show_company_info_report_print){html='<div class="report-print-header"><div class="title-container"><h1>'+title+'</h1></div></div><div class="clear"></div>';}
html+=data.html;printWindow.document.write(html);og.reports.closePrintWindow(printWindow);}});}
og.reports.printNoPaginatedReport=function(genid,title,hide_report_header){if(typeof(hide_report_header)=='undefined'){hide_report_header=!og.config.show_company_info_report_print;}
var printWindow=og.reports.createPrintWindow(title,hide_report_header);var has_scroll=$('#'+genid+'report_container .report.custom-report').hasClass('scroll');if(has_scroll){$('#'+genid+'report_container .report.custom-report').removeClass('scroll');}
printWindow.document.write(document.getElementById(genid+'report_container').innerHTML);if(has_scroll){$('#'+genid+'report_container .report.custom-report').addClass('scroll');}
og.reports.closePrintWindow(printWindow);}
og.reports.go_to_custom_report_page=function(params){var offset=params.offset;var limit=params.limit;var link=params.link;if(!offset)offset=0;if(!limit)limit=50;if(!link)return;var report_config_el=$(params.link).closest("form").children("[name='post']");if(!report_config_el||report_config_el.length==0)return;var str=$(report_config_el[0]).val();str=str.replace(/'/ig,'"');var report_config=$.parseJSON(str);for(prop in report_config){if(typeof report_config[prop]=='object'){report_config[prop]=Ext.util.JSON.encode(report_config[prop]);}}
var more_params_el=$(params.link).closest("form").children("[name='params']");if(more_params_el){var more_str=$(more_params_el[0]).val().replace(/'/ig,'"').replace(/\\/g,"");;if(more_str){report_config['params']=more_str;}}
report_config.offset=offset;report_config.limit=limit;report_config.replace=1;og.openLink(og.getUrl(report_config.c,report_config.a,report_config));}
og.removeCPValueGeneral=function(id,genid,index){var base_id=genid+"listValues"+id;$("#"+base_id+" #value"+index).remove();}
og.removeCPMemoValue=function(id,genid,index){return og.removeCPValueGeneral(id,genid,index);}
og.addCPMemoValue=function(id,genid,is_member_cp){var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';var base_id=genid+"listValues"+id;var count=$("#"+base_id+" .cp-val").length;$("#"+base_id+" .ico-add").remove();$("#"+base_id+" #value"+(count-1)).append('<a href="#" class="link-ico ico-delete" onclick="og.removeCPMemoValue('+id+', \''+genid+'\','+(count-1)+',0)" ></a>');var html='<div id="value'+count+'" class="cp-val">';html+='<textarea name="'+field_name+'['+id+']['+count+']" id="object_custom_properties['+id+'][]" rows="5" cols="40"></textarea>';html+='<a href="#" class="link-ico ico-add" onclick="og.addCPMemoValue('+id+', \''+genid+'\', '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a>';html+='</div>';$("#"+base_id).append(html);}
og.removeCPNumericValue=function(id,genid,index){return og.removeCPValueGeneral(id,genid,index);}
og.addCPNumericValue=function(id,genid,is_member_cp){var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';var base_id=genid+"listValues"+id;var count=$("#"+base_id+" .cp-val").length;$("#"+base_id+" .ico-add").remove();$("#"+base_id+" #value"+(count-1)).append('<a href="#" class="link-ico ico-delete" onclick="og.removeCPNumericValue('+id+', \''+genid+'\','+(count-1)+',0)" ></a>');var html='<div id="value'+count+'" class="cp-val">';html+='<input type="text" name="'+field_name+'['+id+']['+count+']" id="object_custom_properties['+id+'][]" />';html+='<a href="#" class="link-ico ico-add" onclick="og.addCPNumericValue('+id+', \''+genid+'\', '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a>';html+='</div>';$("#"+base_id).append(html);}
og.removeCPTextValue=function(id,genid,index){return og.removeCPValueGeneral(id,genid,index);}
og.addCPTextValue=function(id,genid,is_member_cp){var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';var base_id=genid+"listValues"+id;var count=$("#"+base_id+" .cp-val").length;$("#"+base_id+" .ico-add").remove();$("#"+base_id+" #value"+(count-1)).append('<a href="#" class="link-ico ico-delete" onclick="og.removeCPTextValue('+id+', \''+genid+'\','+(count-1)+',0)" ></a>');var html='<div id="value'+count+'" class="cp-val">';html+='<input type="text" name="'+field_name+'['+id+']['+count+']" id="object_custom_properties['+id+'][]" />';html+='<a href="#" class="link-ico ico-add" onclick="og.addCPTextValue('+id+', \''+genid+'\', '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a>';html+='</div>';$("#"+base_id).append(html);}
og.addCPValue=function(id,memo,is_member_cp){var listDiv=document.getElementById('listValues'+id);var newValue=document.createElement('div');var count=listDiv.getElementsByTagName('div').length;newValue.id='value'+count;var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';if(memo){newValue.innerHTML='<textarea cols="40" rows="10" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]"></textarea>'+'&nbsp;<a href="#" class="link-ico ico-add" onclick="og.addCPValue('+id+', true, '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a><br/>';}else{newValue.innerHTML='<input type="text" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]" />'+'&nbsp;<a href="#" class="link-ico ico-add" onclick="og.addCPValue('+id+', false, '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a><br/>';}
listDiv.appendChild(newValue);var item=listDiv.childNodes.item(count-1);var value=item.firstChild.value;if(memo){item.innerHTML='<textarea cols="40" rows="10" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]">'+value+'</textarea>'+'&nbsp;<a href="#" class="link-ico ico-delete" onclick="og.removeCPValue('+id+','+(count-1)+', true, '+(is_member_cp?'1':'0')+')" ></a>';}else{item.innerHTML='<input type="text" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]" value="'+value+'" />'+'&nbsp;<a href="#" class="link-ico ico-delete" onclick="og.removeCPValue('+id+','+(count-1)+', false, '+(is_member_cp?'1':'0')+')" ></a>';}};og.removeCPValue=function(id,pos,memo,is_member_cp){var field_name=is_member_cp?'member_custom_properties':'object_custom_properties';var listDiv=document.getElementById('listValues'+id);var item=listDiv.childNodes.item(pos);listDiv.removeChild(item);var value='';var count=listDiv.getElementsByTagName('div').length;if(count==1){item=listDiv.childNodes.item(0);value=item.firstChild.value;if(memo){item.innerHTML='<textarea cols="40" rows="10" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]">'+value+'</textarea>'+'&nbsp;<a href="#" class="link-ico ico-add" onclick="og.addCPValue('+id+', true, '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a><br/>';}else{item.innerHTML='<input type="text" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]" value="'+value+'" />'+'&nbsp;<a href="#" class="link-ico ico-add" onclick="og.addCPValue('+id+', false, '+(is_member_cp?'1':'0')+')">'+lang('add value')+'</a><br/>';}}else{for(i=0;i<listDiv.childNodes.length;i++){item=listDiv.childNodes.item(i);item.id='value'+i;value=item.firstChild.value;if(i<listDiv.childNodes.length-1){if(memo){item.innerHTML='<textarea cols="40" rows="10" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]">'+value+'</textarea>'+'&nbsp;<a href="#" class="link-ico ico-delete" onclick="og.removeCPValue('+id+','+i+', true, '+(is_member_cp?'1':'0')+')" ></a>';}else{item.innerHTML='<input type="text" name="'+field_name+'['+id+'][]" id="object_custom_properties['+id+'][]" value="'+value+'" />'+'&nbsp;<a href="#" class="link-ico ico-delete" onclick="og.removeCPValue('+id+','+i+', false, '+(is_member_cp?'1':'0')+')" ></a>';}}}}};og.addCPDateValue=function(genid,id,is_member_cp,use_time){var dateTable=document.getElementById('table'+genid+id);var tBody=dateTable.getElementsByTagName('tbody')[0];var dateCount=tBody.childNodes.length;if(typeof(og.tmp_date_cps_amount)!='undefined'){dateCount=og.tmp_date_cps_amount[id];og.tmp_date_cps_amount[id]++;}
var newTR=document.createElement('tr');var dateTD=document.createElement('td');var name=(is_member_cp?'member_custom_properties':'object_custom_properties')+'['+id+'][]';dateTD.id='td'+genid+id+dateCount;var dateCond=new og.DateField({renderTo:dateTD,name:name,id:genid+name+dateCount});if(use_time){var time_name=(is_member_cp?'member_custom_properties':'object_custom_properties')+'[time]['+id+']['+dateCount+']';var dateCond=new Ext.form.TimeField({renderTo:dateTD,name:time_name,width:60,id:genid+time_name+dateCount});}
var deleteTD=document.createElement('td');deleteTD.innerHTML='<a href="#" class="link-ico ico-delete" onclick="og.removeCPDateValue(\''+genid+'\','+id+','+dateCount+', '+(is_member_cp?'1':'0')+')"></a>';newTR.appendChild(dateTD);newTR.appendChild(deleteTD);tBody.appendChild(newTR);};og.removeCPDateValue=function(genid,id,pos,is_member_cp){var dateTable=document.getElementById('table'+genid+id);var tBody=dateTable.getElementsByTagName('tbody')[0];var item=tBody.childNodes.item(pos);tBody.removeChild(item);var newTBody=document.createElement('tbody');var name=(is_member_cp?'member_custom_properties':'object_custom_properties')+'['+id+'][]';for(var i=0;i<tBody.childNodes.length;i++){dateTR=tBody.childNodes.item(i);var value=dateTR.firstChild.getElementsByTagName('input')[0].value;var newTR=document.createElement('tr');var dateTD=document.createElement('td');dateTD.id='td'+genid+id+i;dateTD.style.width='150px';var dateCond=new og.DateField({renderTo:dateTD,name:name,id:genid+name+i,value:value});var deleteTD=document.createElement('td');deleteTD.innerHTML='<a href="#" class="link-ico ico-delete" onclick="og.removeCPDateValue(\''+genid+'\','+id+','+i+', '+(is_member_cp?'1':'0')+')"></a>';newTR.appendChild(dateTD);newTR.appendChild(deleteTD);newTBody.appendChild(newTR);}
dateTable.replaceChild(newTBody,tBody);};og.removeTableCustomPropertyRow=function(tr){var parent=tr.parentNode;parent.removeChild(tr);}
og.cp_list_remove=function(remove_link,genid,cp_id){document.getElementById(genid+'_remove_cp_'+cp_id).value=1;var inputs=remove_link.parentNode.getElementsByTagName('input');var input=inputs[0];var value=input.value;var tmp=[];for(var i=0;i<og.cp_list_selected_values[cp_id][genid].length;i++){if(og.cp_list_selected_values[cp_id][genid][i]!=value){tmp.push(og.cp_list_selected_values[cp_id][genid][i]);}}
og.cp_list_selected_values[cp_id][genid]=tmp;og.eventManager.fireEvent('after cp list change',[{cp_id:cp_id,genid:genid,values:og.cp_list_selected_values[cp_id][genid]}]);remove_link.parentNode.parentNode.removeChild(remove_link.parentNode);return false;}
og.cp_list_selected=function(combo,genid,name,cp_id,is_multiple){var rem=document.getElementById(genid+'_remove_cp_'+cp_id);if(rem)rem.value=0;var i=og.cp_list_selected_index[cp_id][genid];var div=document.getElementById(genid+'cp_list_selected'+cp_id);if(!og.cp_list_selected_values)og.cp_list_selected_values=[];if(!og.cp_list_selected_values[cp_id])og.cp_list_selected_values[cp_id]=[];if(!og.cp_list_selected_values[cp_id][genid])og.cp_list_selected_values[cp_id][genid]=[];var val=combo.options[combo.selectedIndex].value;if(val==''||og.cp_list_selected_values[cp_id][genid].indexOf(val)>=0)return;var html='';if(is_multiple){html='<div>'+og.clean(val)+'&nbsp;<a href=\"#\" onclick=\"og.cp_list_remove(this, \''+genid+'\', '+cp_id+');\" class=\"db-ico coViewAction ico-delete\">&nbsp;</a>';}
html+='<input type=\"hidden\" name=\"'+name+'['+i+']\" value=\"'+val+'\" />';if(is_multiple){html+='</div>';}
if(is_multiple){div.innerHTML+=html;og.cp_list_selected_index[cp_id][genid]=i+1;og.cp_list_selected_values[cp_id][genid].push(val);}else{div.innerHTML=html;og.cp_list_selected_values[cp_id][genid]=[val];}
og.eventManager.fireEvent('after cp list change',[{cp_id:cp_id,genid:genid,values:og.cp_list_selected_values[cp_id][genid]}]);}
og.check_if_valid_cp_num=function(inp){if(inp.value.includes('%')){let removePorcent=inp.value.replace(/[%.]/g,'');if(Number(removePorcent)){inp.value=removePorcent;}else{inp.value='';}}else{if(isNaN(inp.value)){inp.value='';}}}
var H5F=H5F||{};(function(d){var field=d.createElement("input"),emailPatt=/^[a-z0-9_.%+\-]+@[0-9a-z.\-]+\.[a-z.]{2,6}$/i,urlPatt=/[a-z][\-\.+a-z]*:\/\//i,nodes=/^(input|select|textarea)$/i,isSubmit,usrPatt,curEvt,args,custMsg="",setup,validation,validity,checkField,checkValidity,setCustomValidity,support,pattern,placeholder,range,required,valueMissing,listen,unlisten,preventActions,getTarget,addClass,removeClass,isHostMethod;setup=function(form,settings){var isCollection=!form.nodeType||false;var opts={validClass:"valid",invalidClass:"error",requiredClass:"required",placeholderClass:"placeholder"};if(typeof settings=="object"){for(var i in opts){if(typeof settings[i]=="undefined"){settings[i]=opts[i];}}}
args=settings||opts;if(isCollection){for(var k=0,len=form.length;k<len;k++){validation(form[k]);}}else{validation(form);}};validation=function(form){var f=form.elements,flen=f.length,isRequired,noValidate=!!(form.attributes["novalidate"]);listen(form,"invalid",checkField,true);listen(form,"blur",checkField,true);listen(form,"input",checkField,true);listen(form,"keyup",checkField,true);listen(form,"focus",checkField,true);listen(form,"submit",function(e){isSubmit=true;if(!noValidate&&!form.checkValidity()){preventActions(e);}},false);if(!support()){form.checkValidity=function(){return checkValidity(form);};while(flen--){isRequired=!!(f[flen].attributes["required"]);if(f[flen].nodeName!=="FIELDSET"){validity(f[flen]);}}}};validity=function(el){var elem=el,missing=valueMissing(elem),attrs={type:elem.getAttribute("type"),pattern:elem.getAttribute("pattern"),placeholder:elem.getAttribute("placeholder")},isType=/^(email|url)$/i,evt=/^(input|keyup)$/i,fType=((isType.test(attrs.type))?attrs.type:((attrs.pattern)?attrs.pattern:false)),patt=pattern(elem,fType),step=range(elem,"step"),min=range(elem,"min"),max=range(elem,"max"),customError=(custMsg!=="");elem.checkValidity=function(){return checkValidity.call(this,elem);};elem.setCustomValidity=function(msg){setCustomValidity.call(elem,msg);};elem.validationMessage=custMsg;elem.validity={valueMissing:missing,patternMismatch:patt,rangeUnderflow:min,rangeOverflow:max,stepMismatch:step,customError:customError,valid:(!missing&&!patt&&!step&&!min&&!max&&!customError)};if(attrs.placeholder&&!evt.test(curEvt)){placeholder(elem);}};checkField=function(e){var el=getTarget(e)||e,events=/^(input|keyup|focusin|focus)$/i,ignoredTypes=/^(submit|image|button|reset)$/i,checkForm=true;if(nodes.test(el.nodeName)&&!(ignoredTypes.test(el.type)||ignoredTypes.test(el.nodeName))){curEvt=e.type;if(!support()){validity(el);}
if(el.validity.valid){removeClass(el,[args.invalidClass,args.requiredClass]);addClass(el,args.validClass);}else if(!events.test(curEvt)){if(el.validity.valueMissing){removeClass(el,[args.invalidClass,args.validClass]);addClass(el,args.requiredClass);}else{removeClass(el,[args.validClass,args.requiredClass]);addClass(el,args.invalidClass);}}else if(el.validity.valueMissing){removeClass(el,[args.requiredClass,args.invalidClass,args.validClass]);}
if(curEvt==="input"&&checkForm){unlisten(el.form,"keyup",checkField,true);checkForm=false;}}};checkValidity=function(el){var f,ff,isRequired,hasPattern,invalid=false;if(el.nodeName==="FORM"){f=el.elements;for(var i=0,len=f.length;i<len;i++){ff=f[i];isRequired=!!(ff.attributes["required"]);hasPattern=!!(ff.attributes["pattern"]);if(ff.nodeName!=="FIELDSET"&&(isRequired||hasPattern&&isRequired)){checkField(ff);if(!ff.validity.valid&&!invalid){if(isSubmit){ff.focus();}
invalid=true;}}}
return!invalid;}else{checkField(el);return el.validity.valid;}};setCustomValidity=function(msg){var el=this;custMsg=msg;el.validationMessage=custMsg;};support=function(){return(isHostMethod(field,"validity")&&isHostMethod(field,"checkValidity"));};pattern=function(el,type){if(type==="email"){return!emailPatt.test(el.value);}else if(type==="url"){return!urlPatt.test(el.value);}else if(!type){return false;}else{var placeholder=el.getAttribute("placeholder"),val=el.value;usrPatt=new RegExp('^(?:'+type+')$');if(val===placeholder){return true;}else if(val===""){return false;}else{return!usrPatt.test(el.value);}}};placeholder=function(el){var attrs={placeholder:el.getAttribute("placeholder")},focus=/^(focus|focusin|submit)$/i,node=/^(input|textarea)$/i,ignoredType=/^password$/i,isNative=!!("placeholder"in field);if(!isNative&&node.test(el.nodeName)&&!ignoredType.test(el.type)){if(el.value===""&&!focus.test(curEvt)){el.value=attrs.placeholder;listen(el.form,'submit',function(){curEvt='submit';placeholder(el);},true);addClass(el,args.placeholderClass);}else if(el.value===attrs.placeholder&&focus.test(curEvt)){el.value="";removeClass(el,args.placeholderClass);}}};range=function(el,type){var min=parseInt(el.getAttribute("min"),10)||0,max=parseInt(el.getAttribute("max"),10)||false,step=parseInt(el.getAttribute("step"),10)||1,val=parseInt(el.value,10),mismatch=(val-min)%step;if(!valueMissing(el)&&!isNaN(val)){if(type==="step"){return(el.getAttribute("step"))?(mismatch!==0):false;}else if(type==="min"){return(el.getAttribute("min"))?(val<min):false;}else if(type==="max"){return(el.getAttribute("max"))?(val>max):false;}}else if(el.getAttribute("type")==="number"){return true;}else{return false;}};required=function(el){var required=!!(el.attributes["required"]);return(required)?valueMissing(el):false;};valueMissing=function(el){var placeholder=el.getAttribute("placeholder"),isRequired=!!(el.attributes["required"]);return!!(isRequired&&(el.value===""||el.value===placeholder));};listen=function(node,type,fn,capture){if(isHostMethod(window,"addEventListener")){node.addEventListener(type,fn,capture);}else if(isHostMethod(window,"attachEvent")&&typeof window.event!=="undefined"){if(type==="blur"){type="focusout";}else if(type==="focus"){type="focusin";}
node.attachEvent("on"+type,fn);}};unlisten=function(node,type,fn,capture){if(isHostMethod(window,"removeEventListener")){node.removeEventListener(type,fn,capture);}else if(isHostMethod(window,"detachEvent")&&typeof window.event!=="undefined"){node.detachEvent("on"+type,fn);}};preventActions=function(evt){evt=evt||window.event;if(evt.stopPropagation&&evt.preventDefault){evt.stopPropagation();evt.preventDefault();}else{evt.cancelBubble=true;evt.returnValue=false;}};getTarget=function(evt){evt=evt||window.event;return evt.target||evt.srcElement;};addClass=function(e,c){var re;if(!e.className){e.className=c;}
else{re=new RegExp('(^|\\s)'+c+'(\\s|$)');if(!re.test(e.className)){e.className+=' '+c;}}};removeClass=function(e,c){var re,m,arr=(typeof c==="object")?c.length:1,len=arr;if(e.className){if(e.className==c){e.className='';}
else{while(arr--){re=new RegExp('(^|\\s)'+((len>1)?c[arr]:c)+'(\\s|$)');m=e.className.match(re);if(m&&m.length==3){e.className=e.className.replace(re,(m[1]&&m[2])?' ':'');}}}}};isHostMethod=function(o,m){var t=typeof o[m],reFeaturedMethod=new RegExp('^function|object$','i');return!!((reFeaturedMethod.test(t)&&o[m])||t=='unknown');};window["H5F"]={setup:setup};})(document);$(function(){$('#quick-form .close').click(function(){$(this).parent().slideUp();});$('body').click(function(e){var toClose=['#quick-form','.user-box-actions'];var ignoreClickIds={'userboxWrapper':'userboxWrapper','modcoder_colorpicker':'modcoder_colorpicker','modcoder_picker':'modcoder_picker','modcoder_ok':'modcoder_ok','modcoder_ok':'modcoder_ok','modcoder_close':'modcoder_close','modcoder_hue_wrap':'modcoder_hue_wrap','modcoder_sample':'modcoder_sample','quick-form-3':'quick-form-3','modcoder_grad':'modcoder_grad','modcoder_r':'modcoder_r','modcoder_g':'modcoder_g','modcoder_b':'modcoder_b','modcoder_hex':'modcoder_hex'};var clicked=$(e.target);if(!clicked[0]||ignoreClickIds[clicked[0].id])return;var doClose=true;main_loop:for(var i in ignoreClickIds){if(i=="remove"||!ignoreClickIds[i])continue;var toIgnore=$("#"+ignoreClickIds[i]);if(!toIgnore.length){continue;}else if(jQuery.contains(toIgnore[0],clicked[0])){doClose=false;break main_loop;}}
if($("#modcoder_grad div").length&&jQuery.contains($("#modcoder_grad div"),clicked[0])){doClose=false;}
if(doClose){for(var i in toClose){if(i=="remove"||!toClose[i])continue;var box=$(toClose[i]);if(box[0]&&!jQuery.contains(box[0],clicked[0])){box.slideUp();}}}});og.eventManager.addListener('before tab panel construct',function(tabConfig){if(og.queryString!=""&&og.queryString!="c=access&a=index"){tabConfig.initialContent={type:"url",data:og.initialURL};og.queryString="";}});});var ogSearchSelector={};ogSearchSelector.getItemTemplateCopy=function(container_id,template_id,data){var copy=$("#"+container_id+" > #searchSelectorItemTemplate"+template_id).clone();ogSearchSelector.loadDataToItemTemplateCopy(copy,data);copy.removeClass("item-template");return copy;}
ogSearchSelector.getShowMoreItem=function(container_id,template_id){var copy=$("#"+container_id+" > #showMoreTemplate"+template_id).clone();copy.removeClass("item-template");return copy;}
ogSearchSelector.loadDataToItemTemplateCopy=function(copy,data){for(var param in data){switch(param){case"style":for(var style in data[param]){if(copy.attr('id')==style){copy.addClass(data[param][style]);copy.removeAttr("id");}else{copy.find("#"+style).addClass(data[param][style]);copy.find("#"+style).removeAttr("id");}}
break;default:copy.find("."+param).append(data[param]);}}}
ogSearchSelector.resetLimit=function(container_id,limit){if(typeof limit=="undefined"){var first_limit=$("#"+container_id+"-input-first-limit").val();$("#"+container_id+"-input-limit").val(first_limit);}else{$("#"+container_id+"-input-limit").val(limit);}}
ogSearchSelector.init=function(genid,container_id,extra_param,search_func,select_function,search_minLength,search_delay){var position_obj={my:"right top",at:"right bottom",collision:"flipfit"};if(ogSearchSelector.position_obj&&ogSearchSelector.position_obj[container_id]){position_obj=ogSearchSelector.position_obj[container_id];}
$("#"+container_id+"-input").autocomplete({position:position_obj,search:function(){$(this).autocomplete("widget").show();$(this).autocomplete("widget").empty();$(this).autocomplete("widget").prepend("<li id='ui_menu_item_loading_indicator' class='ui-menu-item loading-indicator'></li>");},response:function(){$(this).autocomplete("widget").remove("#ui_menu_item_loading_indicator");},delay:search_delay,minLength:search_minLength,source:function(request,callback){var searchParam=request.term;search_func(genid,container_id,extra_param,searchParam,callback);},focus:function(event,ui){if(typeof(ui.item)!="undefined"){if(ui.item.label!="advanced"){$("#"+container_id+"-input").val(ui.item.label);}}
return false;},select:function(event,ui){$("#"+container_id+"-input").val(ui.item.label);select_function(genid,container_id,extra_param,ui.item);return false;}}).autocomplete("instance")._renderItem=function(ul,item){return $("<li>").append(item.desc).appendTo(ul);};$("#"+container_id+"-input").on("click",function(){$(this).keydown();});$("#"+container_id+"-ico-search-m").on("click",function(){$(this).siblings(".search-input").keydown();});}
ogSearchSelector.searchMember=function(genid,container_id,dimension_id,search_text,callback){var template_id=1;var result_limit=parseInt($("#"+container_id+"-input-limit").val());var callback_func=function(data){if(typeof data.members!="undefined"){var items=[];for(var prop in data.members){var mem=data.members[prop];var dim_id=data.dimension_id;var searchResultInfo=mem.name;if(mem.parent>0){var mpath_aux={};mpath_aux[dim_id]={};mpath_aux[dim_id][mem.id]=mem;text=og.getEmptyCrumbHtml(mpath_aux,".search-selector-result",null,false);searchResultInfo+="<br>"+text;}
rowHeight=data.row_class;var result={searchResultInfo:searchResultInfo};result["style"]={searchSelectorItemTemplate1:rowHeight,searchResultImgTemplate1:mem.iconCls};var item_desc=ogSearchSelector.getItemTemplateCopy(container_id,template_id,result);var item={value:mem.id,label:mem.name,desc:item_desc};items.push(item);}
if(data.show_more){var last_item={value:'more',label:search_text,limit:items.length+5,desc:ogSearchSelector.getShowMoreItem(container_id,template_id)};items.push(last_item);}
callback(items);og.eventManager.fireEvent('replace all empty breadcrumb',null);}else{callback();}}
var search_params={};search_params.text=search_text;search_params.start=0;search_params.limit=result_limit;search_params.order='name';search_params.parents=0;if(search_text.length==0){search_params.random=1;}
if(member_selector[genid].properties[dimension_id].allowedMemberTypes){search_params.allowed_member_types=member_selector[genid].properties[dimension_id].allowedMemberTypes}
og.searchMemberOnServer(dimension_id,search_params,callback_func);ogSearchSelector.resetLimit(container_id);}
ogSearchSelector.onItemMemberSelect=function(genid,container_id,dimension_id,item){var member_id=item.value;if(member_id!="more"){member_selector.add_relation(dimension_id,genid,member_id);}else if(member_id=="more"){$("#"+container_id+"-input").val(item.label);ogSearchSelector.resetLimit(container_id,item.limit);$("#"+container_id+"-input").keydown();}}
ogSearchSelector.searchPermissionGroup=function(genid,container_id,ignored,search_text,callback){var template_id=1;var result_limit=parseInt($("#"+container_id+"-input-limit").val());var callback_func=function(data){if(typeof data.permission_groups!="undefined"){var items=[];for(var prop in data.permission_groups){var pg=data.permission_groups[prop];if(typeof pg=='function')continue;var img_link='';if(pg.picture_url&&pg.type=='user'){img_link='<div class="selector-user-img-container"><img src="'+pg.picture_url+'" /></div>';}else if(pg.type=='group'){img_link='<div class="selector-user-img-container ico-large-group" style="width:48px;height:48px;">&nbsp;</div>';}
name_html='<div class="selector-user-name-container">'+pg.name;if(pg.company_name){name_html+="<br><span class='desc'>"+pg.company_name+"</span>";}
name_html+='</div><div class="clear"></div>';var searchResultInfo=img_link+name_html;rowHeight=data.row_class;var result={searchResultInfo:searchResultInfo};result["style"]={searchSelectorItemTemplate1:rowHeight,searchResultImgTemplate1:pg.iconCls};var item_desc=ogSearchSelector.getItemTemplateCopy(container_id,template_id,result);var item={value:pg.id,label:pg.name,desc:item_desc};for(x in pg){item[x]=pg[x];}
items.push(item);}
if(data.show_more){var last_item={value:'more',label:search_text,limit:items.length+5,desc:ogSearchSelector.getShowMoreItem(container_id,template_id)};items.push(last_item);}
callback(items);}}
var search_params={};search_params.text=search_text;search_params.start=0;search_params.limit=result_limit;search_params.order='name';search_params.parents=0;og.searchPermissionGroupOnServer(search_params,callback_func);ogSearchSelector.resetLimit(container_id);}
ogSearchSelector.onItemPermissionGroupSelect=function(genid,container_id,ignored,item){if(item.value!="more"){og.userPermissions.drawUserListItem(genid,item);$("#"+container_id+"-input").val('');}else if(item.value=="more"){if(item.label=="more"){item.label="";}
$("#"+container_id+"-input").val(item.label);ogSearchSelector.resetLimit(container_id,item.limit);$("#"+container_id+"-input").keydown();}}
og.searchPermissionGroupOnServer=function(search_params,func_callback){var params={};params.query=Ext.escapeRe(search_params.text.toLowerCase());if(typeof search_params.limit!='undefined'){params.limit=search_params.limit;}
if(typeof search_params.order!='undefined'){params.order=search_params.order;}
if(typeof search_params.start!='undefined'){params.start=search_params.start;}
if(typeof search_params.parents!='undefined'){params.parents=search_params.parents;}
og.openLink(og.getUrl('group','search_permission_group',params),{hideLoading:true,hideErrors:true,callback:function(success,data){if(typeof func_callback!="undefined"){func_callback(data);}}});}
ogSearchSelector.generalSearch=function(genid,container_id,dimension_id,search_text,callback){var template_id=2;var result_limit=parseInt($("#"+container_id+"-input-limit").val());var callback_func=function(data){var items=[];if(typeof data.search_results!="undefined"){for(var prop in data.search_results){if(isNaN(parseInt(prop))){continue;}
var obj=data.search_results[prop];var dim_id=data.dimension_id;var searchResultInfo=obj.text_match;if(obj.name==obj.text_match){searchResultInfo="";}
rowHeight=data.row_class;var result={searchResultName:obj.name,searchResultInfo:searchResultInfo};result["style"]={searchSelectorItemTemplate2:rowHeight,searchResultImgTemplate2:obj.iconCls};var item_desc=ogSearchSelector.getItemTemplateCopy(container_id,template_id,result);var item={value:obj.id,label:search_text,desc:item_desc};items.push(item);}
if(data.show_more){var last_item={value:'more',label:search_text,limit:items.length+5,desc:ogSearchSelector.getShowMoreItem(container_id,template_id)};items.push(last_item);}}
var last_item={value:'advanced',label:"",desc:ogSearchSelector.getAdvancedSearchItem(container_id,template_id)};items.push(last_item);callback(items);}
var search_params={};search_params.query=search_text;search_params.start=0;search_params.limit=result_limit;search_params.order='name';og.openLink(og.getUrl('search','general_search',search_params),{hideLoading:true,hideErrors:true,callback:function(success,data){if(typeof callback_func!="undefined"){callback_func(data);}}});ogSearchSelector.resetLimit(container_id);}
ogSearchSelector.getAdvancedSearchItem=function(container_id,template_id){var copy=$("#"+container_id+" > #advancedSearchTemplate"+template_id).clone();copy.removeClass("item-template");return copy;}
ogSearchSelector.onGeneralSearchResultSelect=function(genid,container_id,ignored,item){switch(item.value){case"more":$("#"+container_id+"-input").val('');var search_params={};search_params.search_for=item.label;search_params.current='search';og.openLink(og.getUrl('search','search',search_params));break;case"advanced":$("#"+container_id+"-input").val('');var search_params={};search_params.advanced=true;search_params.current='search';og.openLink(og.getUrl('search','search',search_params),{hideLoading:true,hideErrors:true});break;default:$("#"+container_id+"-input").val('');og.openLink(og.getUrl('object','view',{id:item.value}));}}
og.ObjectGrid=function(config,ignore_context){if(!config)config={};var url_params={ajax:true,count_results:0};var list_url=og.getUrl('object','list_objects');if(config.url){list_url=config.url;}
if(config.store_params){url_params=config.store_params;}
if(ignore_context){url_params['ignore_context']=ignore_context?'1':'0';}
var grid_id='obj_list_grid';if(config.grid_id){grid_id=config.grid_id;}
var response_objects_root='objects';if(config.response_objects_root){response_objects_root=config.response_objects_root;}
if(config.dont_use_gooproxy){var connection_proxy=new Ext.data.HttpProxy(new Ext.data.Connection({method:'GET',url:list_url}));}else{var connection_proxy=new og.GooProxy({url:list_url});}
var filters=config.filters;this.needRefresh=false;this.fields=['id','object_id','type','ot_id','name','ix','isRead','memPath','type_controller'];if(config.columns){for(i=0;i<config.columns.length;i++){var col=config.columns[i];if(col){this.fields.push(col.name);}}}else{config.columns=[];}
if(typeof(config.add_default_actions_column)!="undefined"){this.add_default_actions_column=config.add_default_actions_column;}else{this.add_default_actions_column=true;}
if(config.columns.indexOf('actions')>=0){this.add_default_actions_column=false;}
var cps=og.custom_properties_by_type[config.type_name]?og.custom_properties_by_type[config.type_name]:[];var cp_names=[];for(i=0;i<cps.length;i++){cp_names.push('cp_'+cps[i].id);}
this.fields=this.fields.concat(cp_names);var dim_names=[];for(did in og.dimensions_info){if(isNaN(did))continue;dim_names.push('dim_'+did);}
this.fields=this.fields.concat(dim_names);this.store=new Ext.data.Store({proxy:connection_proxy,reader:new Ext.data.JsonReader({root:response_objects_root,totalProperty:'totalCount',id:'id',fields:this.fields}),remoteSort:true,listeners:{'load':function(store,result){var d=this.reader.jsonData;var grid=Ext.getCmp(grid_id);if(grid){this.lastOptions.params=this.baseParams;this.lastOptions.params.count_results=1;var h;if(!config.fixed_height){var min_h=config.min_height|245;var max_h=config.max_height|500;h=(d[response_objects_root].length*36)+125;if(h>max_h)h=max_h;if(h<min_h)h=min_h;}else{if(config.max_height){h=config.max_height;}else{h=grid.container.dom.offsetHeight;}}
grid.setHeight(h);if(config.no_totals_row)d.totals=null;if(config.quick_add_row){og.add_object_grid_quick_add_row(grid,config);}
og.eventManager.fireEvent('after grid panel load',{man:grid,data:d});if(config.separate_totals_request){grid.reloadTotalsRow({scroll_to_top:true});}else{if(d&&d.totals){grid.updateGridPagingToolbar({totalCount:d.totals.total_rows});}else if(this.baseParams.url_controller&&this.baseParams.url_action){grid.reloadGridPagingToolbar(this.baseParams.url_controller,this.baseParams.url_action,grid_id);}}}
og.eventManager.fireEvent('replace all empty breadcrumb',null);}}});this.store.baseParams=jQuery.extend({},url_params);function renderIcon(value,p,r){if(r.data.id=='__total_row__'||r.data.id<=0)return'';var classes="db-ico ico-unknown ico-"+r.data.type;if(r.data.mimeType){var path=r.data.mimeType.replace(/\./ig,"_").replace(/\//ig,"-").split("-");var acc="";for(var i=0;i<path.length;i++){acc+=path[i];classes+=" ico-"+acc;acc+="-";}}
return String.format('<div class="{0}" />',classes);}
function renderDate(value,p,r){if(!value){return"";}
return value;}
this.getValidSelections=function(){var selections=this.getSelectionModel().getSelections();var valid_selections=[];for(var i=0;i<selections.length;i++){if(selections[i]&&selections[i].id!="#__total_row__"&&selections[i].id!="quick_add_row"){valid_selections.push(selections[i]);}}
return valid_selections;}
this.getSelectedIds=function(){var ret='';var selections=this.getValidSelections();for(var i=0;i<selections.length;i++){ret+=(ret==""?"":",")+selections[i].data.object_id;}
return ret;}
this.getFirstSelectedId=function(){var selections=this.getValidSelections();if(selections.length<=0){return'';}else{return selections[0].data.object_id;}
return'';}
if(config.checkbox_sel_model){if(config.sm){var sm=config.sm;}else{var sm=new Ext.grid.CheckboxSelectionModel();sm.on('selectionchange',function(){var selections=this.grid.getValidSelections();var sel_count=selections.length;for(x in this.grid.tbar_items){var action=this.grid.tbar_items[x];if(typeof(action)=='object'){if(action.initialConfig.selection_dependant){if(sel_count==0){action.setDisabled(true);}else if(sel_count==1){action.setDisabled(false);}else{action.setDisabled(!action.initialConfig.is_multiple);}}}}});}
var cm_info=[sm];}else{var sm=new Ext.grid.RowSelectionModel();var cm_info=[];}
if(!config.no_icon_col){cm_info.push({id:'icon',header:'&nbsp;',dataIndex:'icon',width:28,renderer:renderIcon,sortable:false,fixed:true,resizable:false,hideable:false,menuDisabled:true});}
if(config.columns){for(i=0;i<config.columns.length;i++){var col=config.columns[i];if(col&&!col.is_system&&!col.is_right_column&&col.before_name){cm_info.push({id:col.id?col.id:col.name,header:col.header?col.header:lang(col.name),dataIndex:col.dataIndex?col.dataIndex:col.name,width:col.width?col.width:100,renderer:col.renderer?col.renderer:og.default_grid_column_renderer,sortable:col.sortable?col.sortable:false,fixed:col.fixed?col.fixed:false,align:col.align?col.align:'left',resizable:col.resizable?col.resizable:true,hidden:col.hidden?col.hidden:false,menuDisabled:col.menuDisabled?col.menuDisabled:false});}}}
cm_info.push({id:'name',header:config.name_column_text?config.name_column_text:lang("name"),dataIndex:'name',hidden:config.hide_name_column,fixed:config.name_fixed|false,width:typeof(config.name_width)!="undefined"?config.name_width:200,renderer:config.nameRenderer?config.nameRenderer:og.default_grid_column_renderer});if(config.columns){for(i=0;i<config.columns.length;i++){var col=config.columns[i];if(col&&!col.is_system&&!col.is_right_column&&!col.before_name){cm_info.push({id:col.id?col.id:col.name,header:col.header?col.header:lang(col.name),dataIndex:col.dataIndex?col.dataIndex:col.name,width:col.width?col.width:100,renderer:col.renderer?col.renderer:og.default_grid_column_renderer,sortable:col.sortable?col.sortable:false,fixed:col.fixed?col.fixed:false,align:col.align?col.align:'left',resizable:col.resizable?col.resizable:true,hidden:col.hidden?col.hidden:false,menuDisabled:col.menuDisabled?col.menuDisabled:false});}}}
var cps=og.custom_properties_by_type[config.type_name]?og.custom_properties_by_type[config.type_name]:[];this.addCustomPropertyColumns(cps,cm_info,grid_id);if(!config.skip_dimension_columns){for(did in og.dimensions_info){if(isNaN(did))continue;if(config.allowed_dimension_columns&&config.allowed_dimension_columns.length>0){if(config.allowed_dimension_columns.indexOf(did)==-1)continue;}
var key='lp_dim_'+did+'_show_as_column';if(og.preferences['listing_preferences'][key]){cm_info.push({id:'dim_'+did,header:og.dimensions_info[did].name,dataIndex:'dim_'+did,sortable:true,renderer:og.renderDimCol});og.breadcrumbs_skipped_dimensions[did]=did;}}}
if(this.add_default_actions_column){config.columns.push({name:'actions',is_right_column:true,fixed:true,width:100,renderer:og.render_default_grid_actions});}
if(config.columns){for(i=0;i<config.columns.length;i++){var col=config.columns[i];if(col&&!col.is_system&&col.is_right_column){cm_info.push({id:col.id?col.id:col.name,header:col.header?col.header:lang(col.name),dataIndex:col.dataIndex?col.dataIndex:col.name,width:col.width?col.width:100,renderer:col.renderer?col.renderer:og.default_grid_column_renderer,sortable:col.sortable?col.sortable:false,fixed:col.fixed?col.fixed:false,align:col.align?col.align:'left',resizable:col.resizable?col.resizable:true,hidden:col.hidden?col.hidden:false,menuDisabled:col.menuDisabled?col.menuDisabled:false});}}}
var cm=new Ext.grid.ColumnModel(cm_info);cm.defaultSortable=true;cm.on('hiddenchange',this.afterColumnShowHide,this);var tbar=[];if(config.tbar_items){for(i=0;i<config.tbar_items.length;i++){if(!config.tbar_items[i].initialConfig||!config.tbar_items[i].initialConfig.secondToolbar){tbar.push(config.tbar_items[i]);}}}
if(config.filters){for(var filter_name in config.filters){var filter_data=config.filters[filter_name];if(!filter_data.secondToolbar){var items=og.buildToolbarFilterAction(filter_name,filter_data,grid_id);if(items.length>0&&tbar.length==0){tbar.push('&nbsp;'+lang('filters')+":");}
for(var x=0;x<items.length;x++){tbar.push(items[x]);}}}}
if(config.tbar_right_items){tbar.push('->');for(i=0;i<config.tbar_right_items.length;i++){if(!config.tbar_right_items[i].initialConfig||!config.tbar_right_items[i].initialConfig.secondToolbar){tbar.push(config.tbar_right_items[i]);}}}
var tbar2=[];if(config.tbar_items){for(i=0;i<config.tbar_items.length;i++){if(config.tbar_items[i].initialConfig&&config.tbar_items[i].initialConfig.secondToolbar){tbar2.push(config.tbar_items[i]);}}}
if(config.filters){for(var filter_name in config.filters){var filter_data=config.filters[filter_name];if(filter_data.secondToolbar){var items=og.buildToolbarFilterAction(filter_name,filter_data,grid_id);if(items.length>0&&tbar2.length==0){tbar2.push('&nbsp;'+lang('filters')+":");}
for(var x=0;x<items.length;x++){tbar2.push(items[x]);}}}}
if(config.allow_drag_drop){config.enableDrag=true;config.ddGroup='MemberDD';}
og.ObjectGrid.superclass.constructor.call(this,Ext.apply(config,{store:this.store,layout:'fit',id:grid_id,cm:cm,stripeRows:true,stateful:og.preferences['rememberGUIState'],loadMask:true,bbar:new og.CurrentPagingToolbar({pageSize:og.config['files_per_page'],store:this.store,displayInfo:true,displayMsg:lang('displaying objects of'),emptyMsg:lang("no objects to display")}),viewConfig:{forceFit:typeof(config.forceFit)!="undefined"?config.forceFit:true},sm:sm,tbar:tbar,cls:"object-grid",listeners:{'render':{fn:function(){this.innerMessage=document.createElement('div');this.innerMessage.className='inner-message';var msg=this.innerMessage;var elem=Ext.get(this.getEl());var scroller=elem.select('.x-grid3-scroller');scroller.each(function(){this.dom.appendChild(msg);});if(config.hide_name_column){var col_model=this.getColumnModel();col_model.setHidden(col_model.getIndexById('name'),true);}
if(tbar2.length>0){this.topTbar2=new Ext.Toolbar({renderTo:this.tbar,items:tbar2});}},scope:this},'resize':{fn:function(){if(!this.hidden){var v=this.getView();if(v){setTimeout(function(){if(v.forceFit){v.fitColumns();}
$("#"+v.grid.id+" .x-grid3").css('width','');$("#"+v.grid.id+" .x-grid3 .x-grid3-header-inner").css('width','');$("#"+v.grid.id+" .x-grid3 .x-grid3-scroller").css('width','');var h=$("#"+v.grid.id).parent().height();v.grid.setSize({height:h});},200);}}},scope:this},'columnmove':{fn:function(old_index,new_index){og.eventManager.fireEvent('replace all empty breadcrumb',null);if(config.quick_add_row){this.store.remove(this.store.getAt(0));this.initialConfig.dont_focus_in_first_input=true;og.add_object_grid_quick_add_row(this,this.initialConfig);}},scope:this}}}));}
Ext.extend(og.ObjectGrid,Ext.grid.GridPanel,{load:function(params){if(!params)params={};if(typeof params.start=='undefined'){var start=(this.getBottomToolbar().getPageData().activePage-1)*og.config['files_per_page'];}else{var start=0;}
if(this.filters){for(var key in this.filters){var f_val=this.filters[key].value;if(f_val){this.store.baseParams[key]=f_val;}else if(this.store.baseParams[key]){delete this.store.baseParams[key];}}}
if(!this.hidden){this.updateColumnModelHiddenColumns();if(!params.req_channel&&params.action){params.req_channel=this.store_params.url_controller+' list - toolbar '+params.action;}
this.store.removeAll();this.store.load({params:Ext.apply(params,{start:start,limit:og.config['files_per_page']}),callback:typeof(params.load_callback)=='function'?params.load_callback:null});}},reloadTotalsRow:function(params){if(!params)params={};params.load_totals_row=1;Ext.apply(params,this.store_params);if(!this.filters)this.filters={};for(var filter_name in this.filters){if(typeof filter_name=='function')continue;params[filter_name]=this.filters[filter_name].value;}
var objects_grid_id=this.id;og.openLink(og.getUrl(this.store_params.url_controller,this.store_params.url_action,params),{hideLoading:true,callback:function(success,data){var g=Ext.getCmp(objects_grid_id);if(g&&data&&data.totals){g.updateGridPagingToolbar({totalCount:data.totals.total_rows});}
if(g&&typeof(g.addTotalsRow)=='function'&&data&&data.totals){var totals_row_record=g.store.getById("#__total_row__");if(totals_row_record){g.store.remove(totals_row_record);}
g.addTotalsRow(data,!params.scroll_to_top);}}})},activate:function(){if(this.needRefresh){this.load({start:0});}},reset:function(){this.load({start:0});}});!function($){"use strict"
var toggle='[data-toggle="dropdown"]',Dropdown=function(element){var $el=$(element).on('click.dropdown.data-api',this.toggle);$('html').on('click.dropdown.data-api',function(){$el.parent().removeClass('open');});}
Dropdown.prototype={constructor:Dropdown,toggle:function(e){var $this=$(this),selector=$this.attr('data-target'),$parent,isActive;if(!selector){selector=$this.attr('href');selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'');}
$parent=$(selector);$parent.length||($parent=$this.parent());isActive=$parent.hasClass('open');clearMenus();!isActive&&$parent.toggleClass('open');return false;}}
function clearMenus(){$(toggle).parent().removeClass('open');}
$.fn.dropdown=function(option){return this.each(function(){var $this=$(this),data=$this.data('dropdown');if(!data)$this.data('dropdown',(data=new Dropdown(this)));if(typeof option=='string')data[option].call($this);});};$.fn.dropdown.Constructor=Dropdown
$(function(){$('html').on('click.dropdown.data-api',clearMenus);$('body').on('click.dropdown.data-api',toggle,Dropdown.prototype.toggle);})}(window.jQuery);!function($){"use strict"
var Button=function(element,options){this.$element=$(element)
this.options=$.extend({},$.fn.button.defaults,options)}
Button.prototype={constructor:Button,setState:function(state){var d='disabled',$el=this.$element,data=$el.data(),val=$el.is('input')?'val':'html'
state=state+'Text'
data.resetText||$el.data('resetText',$el[val]())
$el[val](data[state]||this.options[state])
setTimeout(function(){state=='loadingText'?$el.addClass(d).attr(d,d):$el.removeClass(d).removeAttr(d)},0)},toggle:function(){var $parent=this.$element.parent('[data-toggle="buttons-radio"]')
$parent&&$parent.find('.active').removeClass('active')
this.$element.toggleClass('active')}}
$.fn.button=function(option){return this.each(function(){var $this=$(this),data=$this.data('button'),options=typeof option=='object'&&option
if(!data)$this.data('button',(data=new Button(this,options)))
if(option=='toggle')data.toggle()
else if(option)data.setState(option)})}
$.fn.button.defaults={loadingText:'loading...'}
$.fn.button.Constructor=Button
$(function(){$('body').on('click.button.data-api','[data-toggle^=button]',function(e){var $btn=$(e.target)
if(!$btn.hasClass('btn'))$btn=$btn.closest('.btn')
$btn.button('toggle')})})}(window.jQuery);+function($){'use strict';var Tooltip=function(element,options){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null
this.init('tooltip',element,options)}
Tooltip.VERSION='3.3.0'
Tooltip.TRANSITION_DURATION=150
Tooltip.DEFAULTS={animation:true,placement:'top',selector:false,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:'hover focus',title:'',delay:0,html:false,container:false,viewport:{selector:'body',padding:0}}
Tooltip.prototype.init=function(type,element,options){this.enabled=true
this.type=type
this.$element=$(element)
this.options=this.getOptions(options)
this.$viewport=this.options.viewport&&$(this.options.viewport.selector||this.options.viewport)
var triggers=this.options.trigger.split(' ')
for(var i=triggers.length;i--;){var trigger=triggers[i]
if(trigger=='click'){this.$element.on('click.'+this.type,this.options.selector,$.proxy(this.toggle,this))}else if(trigger!='manual'){var eventIn=trigger=='hover'?'mouseenter':'focusin'
var eventOut=trigger=='hover'?'mouseleave':'focusout'
this.$element.on(eventIn+'.'+this.type,this.options.selector,$.proxy(this.enter,this))
this.$element.on(eventOut+'.'+this.type,this.options.selector,$.proxy(this.leave,this))}}
this.options.selector?(this._options=$.extend({},this.options,{trigger:'manual',selector:''})):this.fixTitle()}
Tooltip.prototype.getDefaults=function(){return Tooltip.DEFAULTS}
Tooltip.prototype.getOptions=function(options){options=$.extend({},this.getDefaults(),this.$element.data(),options)
if(options.delay&&typeof options.delay=='number'){options.delay={show:options.delay,hide:options.delay}}
return options}
Tooltip.prototype.getDelegateOptions=function(){var options={}
var defaults=this.getDefaults()
this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value})
return options}
Tooltip.prototype.enter=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type)
if(self&&self.$tip&&self.$tip.is(':visible')){self.hoverState='in'
return}
if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions())
$(obj.currentTarget).data('bs.'+this.type,self)}
clearTimeout(self.timeout)
self.hoverState='in'
if(!self.options.delay||!self.options.delay.show)return self.show()
self.timeout=setTimeout(function(){if(self.hoverState=='in')self.show()},self.options.delay.show)}
Tooltip.prototype.leave=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type)
if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions())
$(obj.currentTarget).data('bs.'+this.type,self)}
clearTimeout(self.timeout)
self.hoverState='out'
if(!self.options.delay||!self.options.delay.hide)return self.hide()
self.timeout=setTimeout(function(){if(self.hoverState=='out')self.hide()},self.options.delay.hide)}
Tooltip.prototype.show=function(){var e=$.Event('show.bs.'+this.type)
if(this.hasContent()&&this.enabled){this.$element.trigger(e)
var inDom=$.contains(this.$element[0].ownerDocument.documentElement,this.$element[0])
if(e.isDefaultPrevented()||!inDom)return
var that=this
var $tip=this.tip()
var tipId=this.getUID(this.type)
this.setContent()
$tip.attr('id',tipId)
this.$element.attr('aria-describedby',tipId)
if(this.options.animation)$tip.addClass('fade')
var placement=typeof this.options.placement=='function'?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement
var autoToken=/\s?auto?\s?/i
var autoPlace=autoToken.test(placement)
if(autoPlace)placement=placement.replace(autoToken,'')||'top'
$tip.detach().css({top:0,left:0,display:'block'}).addClass(placement).data('bs.'+this.type,this)
this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element)
var pos=this.getPosition()
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(autoPlace){var orgPlacement=placement
var $container=this.options.container?$(this.options.container):this.$element.parent()
var containerDim=this.getPosition($container)
placement=placement=='bottom'&&pos.bottom+actualHeight>containerDim.bottom?'top':placement=='top'&&pos.top-actualHeight<containerDim.top?'bottom':placement=='right'&&pos.right+actualWidth>containerDim.width?'left':placement=='left'&&pos.left-actualWidth<containerDim.left?'right':placement
$tip.removeClass(orgPlacement).addClass(placement)}
var calculatedOffset=this.getCalculatedOffset(placement,pos,actualWidth,actualHeight)
this.applyPlacement(calculatedOffset,placement)
var complete=function(){var prevHoverState=that.hoverState
that.$element.trigger('shown.bs.'+that.type)
that.hoverState=null
if(prevHoverState=='out')that.leave(that)}
$.support.transition&&this.$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete()}}
Tooltip.prototype.applyPlacement=function(offset,placement){var $tip=this.tip()
var width=$tip[0].offsetWidth
var height=$tip[0].offsetHeight
var marginTop=parseInt($tip.css('margin-top'),10)
var marginLeft=parseInt($tip.css('margin-left'),10)
if(isNaN(marginTop))marginTop=0
if(isNaN(marginLeft))marginLeft=0
offset.top=offset.top+marginTop
offset.left=offset.left+marginLeft
$.offset.setOffset($tip[0],$.extend({using:function(props){$tip.css({top:Math.round(props.top),left:Math.round(props.left)})}},offset),0)
$tip.addClass('in')
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(placement=='top'&&actualHeight!=height){offset.top=offset.top+height-actualHeight}
var delta=this.getViewportAdjustedDelta(placement,offset,actualWidth,actualHeight)
if(delta.left)offset.left+=delta.left
else offset.top+=delta.top
var isVertical=/top|bottom/.test(placement)
var arrowDelta=isVertical?delta.left*2-width+actualWidth:delta.top*2-height+actualHeight
var arrowOffsetPosition=isVertical?'offsetWidth':'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta,$tip[0][arrowOffsetPosition],isVertical)}
Tooltip.prototype.replaceArrow=function(delta,dimension,isHorizontal){this.arrow().css(isHorizontal?'left':'top',50*(1-delta/dimension)+'%').css(isHorizontal?'top':'left','')}
Tooltip.prototype.setContent=function(){var $tip=this.tip()
var title=this.getTitle()
$tip.find('.tooltip-inner')[this.options.html?'html':'text'](title)
$tip.removeClass('fade in top bottom left right')}
Tooltip.prototype.hide=function(callback){var that=this
var $tip=this.tip()
var e=$.Event('hide.bs.'+this.type)
function complete(){if(that.hoverState!='in')$tip.detach()
that.$element.removeAttr('aria-describedby').trigger('hidden.bs.'+that.type)
callback&&callback()}
this.$element.trigger(e)
if(e.isDefaultPrevented())return
$tip.removeClass('in')
$.support.transition&&this.$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete()
this.hoverState=null
return this}
Tooltip.prototype.fixTitle=function(){var $e=this.$element
if($e.attr('title')||typeof($e.attr('data-original-title'))!='string'){$e.attr('data-original-title',$e.attr('title')||'').attr('title','')}}
Tooltip.prototype.hasContent=function(){return this.getTitle()}
Tooltip.prototype.getPosition=function($element){$element=$element||this.$element
var el=$element[0]
var isBody=el.tagName=='BODY'
var elRect=el.getBoundingClientRect()
if(elRect.width==null){elRect=$.extend({},elRect,{width:elRect.right-elRect.left,height:elRect.bottom-elRect.top})}
var elOffset=isBody?{top:0,left:0}:$element.offset()
var scroll={scroll:isBody?document.documentElement.scrollTop||document.body.scrollTop:$element.scrollTop()}
var outerDims=isBody?{width:$(window).width(),height:$(window).height()}:null
return $.extend({},elRect,scroll,outerDims,elOffset)}
Tooltip.prototype.getCalculatedOffset=function(placement,pos,actualWidth,actualHeight){return placement=='bottom'?{top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2}:placement=='top'?{top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2}:placement=='left'?{top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth}:{top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width}}
Tooltip.prototype.getViewportAdjustedDelta=function(placement,pos,actualWidth,actualHeight){var delta={top:0,left:0}
if(!this.$viewport)return delta
var viewportPadding=this.options.viewport&&this.options.viewport.padding||0
var viewportDimensions=this.getPosition(this.$viewport)
if(/right|left/.test(placement)){var topEdgeOffset=pos.top-viewportPadding-viewportDimensions.scroll
var bottomEdgeOffset=pos.top+viewportPadding-viewportDimensions.scroll+actualHeight
if(topEdgeOffset<viewportDimensions.top){delta.top=viewportDimensions.top-topEdgeOffset}else if(bottomEdgeOffset>viewportDimensions.top+viewportDimensions.height){delta.top=viewportDimensions.top+viewportDimensions.height-bottomEdgeOffset}}else{var leftEdgeOffset=pos.left-viewportPadding
var rightEdgeOffset=pos.left+viewportPadding+actualWidth
if(leftEdgeOffset<viewportDimensions.left){delta.left=viewportDimensions.left-leftEdgeOffset}else if(rightEdgeOffset>viewportDimensions.width){delta.left=viewportDimensions.left+viewportDimensions.width-rightEdgeOffset}}
return delta}
Tooltip.prototype.getTitle=function(){var title
var $e=this.$element
var o=this.options
title=$e.attr('data-original-title')||(typeof o.title=='function'?o.title.call($e[0]):o.title)
return title}
Tooltip.prototype.getUID=function(prefix){do prefix+=~~(Math.random()*1000000)
while(document.getElementById(prefix))
return prefix}
Tooltip.prototype.tip=function(){return(this.$tip=this.$tip||$(this.options.template))}
Tooltip.prototype.arrow=function(){return(this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow'))}
Tooltip.prototype.enable=function(){this.enabled=true}
Tooltip.prototype.disable=function(){this.enabled=false}
Tooltip.prototype.toggleEnabled=function(){this.enabled=!this.enabled}
Tooltip.prototype.toggle=function(e){var self=this
if(e){self=$(e.currentTarget).data('bs.'+this.type)
if(!self){self=new this.constructor(e.currentTarget,this.getDelegateOptions())
$(e.currentTarget).data('bs.'+this.type,self)}}
self.tip().hasClass('in')?self.leave(self):self.enter(self)}
Tooltip.prototype.destroy=function(){var that=this
clearTimeout(this.timeout)
this.hide(function(){that.$element.off('.'+that.type).removeData('bs.'+that.type)})}
function Plugin(option){return this.each(function(){var $this=$(this)
var data=$this.data('bs.tooltip')
var options=typeof option=='object'&&option
var selector=options&&options.selector
if(!data&&option=='destroy')return
if(selector){if(!data)$this.data('bs.tooltip',(data={}))
if(!data[selector])data[selector]=new Tooltip(this,options)}else{if(!data)$this.data('bs.tooltip',(data=new Tooltip(this,options)))}
if(typeof option=='string')data[option]()})}
var old=$.fn.tooltip
$.fn.tooltip=Plugin
$.fn.tooltip.Constructor=Tooltip
$.fn.tooltip.noConflict=function(){$.fn.tooltip=old
return this}}(jQuery);+function($){'use strict';var Popover=function(element,options){this.init('popover',element,options)}
if(!$.fn.tooltip)throw new Error('Popover requires tooltip.js')
Popover.VERSION='3.3.0'
Popover.DEFAULTS=$.extend({},$.fn.tooltip.Constructor.DEFAULTS,{placement:'right',trigger:'click',content:'',template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'})
Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor=Popover
Popover.prototype.getDefaults=function(){return Popover.DEFAULTS}
Popover.prototype.setContent=function(){var $tip=this.tip()
var title=this.getTitle()
var content=this.getContent()
$tip.find('.popover-title')[this.options.html?'html':'text'](title)
$tip.find('.popover-content').children().detach().end()[this.options.html?(typeof content=='string'?'html':'append'):'text'](content)
$tip.removeClass('fade top bottom left right in')
if(!$tip.find('.popover-title').html())$tip.find('.popover-title').hide()}
Popover.prototype.hasContent=function(){return this.getTitle()||this.getContent()}
Popover.prototype.getContent=function(){var $e=this.$element
var o=this.options
return $e.attr('data-content')||(typeof o.content=='function'?o.content.call($e[0]):o.content)}
Popover.prototype.arrow=function(){return(this.$arrow=this.$arrow||this.tip().find('.arrow'))}
Popover.prototype.tip=function(){if(!this.$tip)this.$tip=$(this.options.template)
return this.$tip}
function Plugin(option){return this.each(function(){var $this=$(this)
var data=$this.data('bs.popover')
var options=typeof option=='object'&&option
var selector=options&&options.selector
if(!data&&option=='destroy')return
if(selector){if(!data)$this.data('bs.popover',(data={}))
if(!data[selector])data[selector]=new Popover(this,options)}else{if(!data)$this.data('bs.popover',(data=new Popover(this,options)))}
if(typeof option=='string')data[option]()})}
var old=$.fn.popover
$.fn.popover=Plugin
$.fn.popover.Constructor=Popover
$.fn.popover.noConflict=function(){$.fn.popover=old
return this}}(jQuery);(function(root,factory){if(typeof define==='function'&&define.amd){define([],factory);}else if(typeof exports==='object'){module.exports=factory();}else{root.Handlebars=root.Handlebars||factory();}}(this,function(){var __module4__=(function(){"use strict";var __exports__;function SafeString(string){this.string=string;}
SafeString.prototype.toString=function(){return""+this.string;};__exports__=SafeString;return __exports__;})();var __module3__=(function(__dependency1__){"use strict";var __exports__={};var SafeString=__dependency1__;var escape={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var badChars=/[&<>"'`]/g;var possible=/[&<>"'`]/;function escapeChar(chr){return escape[chr];}
function extend(obj){for(var i=1;i<arguments.length;i++){for(var key in arguments[i]){if(Object.prototype.hasOwnProperty.call(arguments[i],key)){obj[key]=arguments[i][key];}}}
return obj;}
__exports__.extend=extend;var toString=Object.prototype.toString;__exports__.toString=toString;var isFunction=function(value){return typeof value==='function';};if(isFunction(/x/)){isFunction=function(value){return typeof value==='function'&&toString.call(value)==='[object Function]';};}
var isFunction;__exports__.isFunction=isFunction;var isArray=Array.isArray||function(value){return(value&&typeof value==='object')?toString.call(value)==='[object Array]':false;};__exports__.isArray=isArray;function escapeExpression(string){if(string instanceof SafeString){return string.toString();}else if(string==null){return"";}else if(!string){return string+'';}
string=""+string;if(!possible.test(string)){return string;}
return string.replace(badChars,escapeChar);}
__exports__.escapeExpression=escapeExpression;function isEmpty(value){if(!value&&value!==0){return true;}else if(isArray(value)&&value.length===0){return true;}else{return false;}}
__exports__.isEmpty=isEmpty;function appendContextPath(contextPath,id){return(contextPath?contextPath+'.':'')+id;}
__exports__.appendContextPath=appendContextPath;return __exports__;})(__module4__);var __module5__=(function(){"use strict";var __exports__;var errorProps=['description','fileName','lineNumber','message','name','number','stack'];function Exception(message,node){var line;if(node&&node.firstLine){line=node.firstLine;message+=' - '+line+':'+node.firstColumn;}
var tmp=Error.prototype.constructor.call(this,message);for(var idx=0;idx<errorProps.length;idx++){this[errorProps[idx]]=tmp[errorProps[idx]];}
if(line){this.lineNumber=line;this.column=node.firstColumn;}}
Exception.prototype=new Error();__exports__=Exception;return __exports__;})();var __module2__=(function(__dependency1__,__dependency2__){"use strict";var __exports__={};var Utils=__dependency1__;var Exception=__dependency2__;var VERSION="2.0.0";__exports__.VERSION=VERSION;var COMPILER_REVISION=6;__exports__.COMPILER_REVISION=COMPILER_REVISION;var REVISION_CHANGES={1:'<= 1.0.rc.2',2:'== 1.0.0-rc.3',3:'== 1.0.0-rc.4',4:'== 1.x.x',5:'== 2.0.0-alpha.x',6:'>= 2.0.0-beta.1'};__exports__.REVISION_CHANGES=REVISION_CHANGES;var isArray=Utils.isArray,isFunction=Utils.isFunction,toString=Utils.toString,objectType='[object Object]';function HandlebarsEnvironment(helpers,partials){this.helpers=helpers||{};this.partials=partials||{};registerDefaultHelpers(this);}
__exports__.HandlebarsEnvironment=HandlebarsEnvironment;HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:logger,log:log,registerHelper:function(name,fn){if(toString.call(name)===objectType){if(fn){throw new Exception('Arg not supported with multiple helpers');}
Utils.extend(this.helpers,name);}else{this.helpers[name]=fn;}},unregisterHelper:function(name){delete this.helpers[name];},registerPartial:function(name,partial){if(toString.call(name)===objectType){Utils.extend(this.partials,name);}else{this.partials[name]=partial;}},unregisterPartial:function(name){delete this.partials[name];}};function registerDefaultHelpers(instance){instance.registerHelper('helperMissing',function(){if(arguments.length===1){return undefined;}else{throw new Exception("Missing helper: '"+arguments[arguments.length-1].name+"'");}});instance.registerHelper('blockHelperMissing',function(context,options){var inverse=options.inverse,fn=options.fn;if(context===true){return fn(this);}else if(context===false||context==null){return inverse(this);}else if(isArray(context)){if(context.length>0){if(options.ids){options.ids=[options.name];}
return instance.helpers.each(context,options);}else{return inverse(this);}}else{if(options.data&&options.ids){var data=createFrame(options.data);data.contextPath=Utils.appendContextPath(options.data.contextPath,options.name);options={data:data};}
return fn(context,options);}});instance.registerHelper('each',function(context,options){if(!options){throw new Exception('Must pass iterator to #each');}
var fn=options.fn,inverse=options.inverse;var i=0,ret="",data;var contextPath;if(options.data&&options.ids){contextPath=Utils.appendContextPath(options.data.contextPath,options.ids[0])+'.';}
if(isFunction(context)){context=context.call(this);}
if(options.data){data=createFrame(options.data);}
if(context&&typeof context==='object'){if(isArray(context)){for(var j=context.length;i<j;i++){if(data){data.index=i;data.first=(i===0);data.last=(i===(context.length-1));if(contextPath){data.contextPath=contextPath+i;}}
ret=ret+fn(context[i],{data:data});}}else{for(var key in context){if(context.hasOwnProperty(key)){if(data){data.key=key;data.index=i;data.first=(i===0);if(contextPath){data.contextPath=contextPath+key;}}
ret=ret+fn(context[key],{data:data});i++;}}}}
if(i===0){ret=inverse(this);}
return ret;});instance.registerHelper('if',function(conditional,options){if(isFunction(conditional)){conditional=conditional.call(this);}
if((!options.hash.includeZero&&!conditional)||Utils.isEmpty(conditional)){return options.inverse(this);}else{return options.fn(this);}});instance.registerHelper('unless',function(conditional,options){return instance.helpers['if'].call(this,conditional,{fn:options.inverse,inverse:options.fn,hash:options.hash});});instance.registerHelper('with',function(context,options){if(isFunction(context)){context=context.call(this);}
var fn=options.fn;if(!Utils.isEmpty(context)){if(options.data&&options.ids){var data=createFrame(options.data);data.contextPath=Utils.appendContextPath(options.data.contextPath,options.ids[0]);options={data:data};}
return fn(context,options);}else{return options.inverse(this);}});instance.registerHelper('log',function(message,options){var level=options.data&&options.data.level!=null?parseInt(options.data.level,10):1;instance.log(level,message);});instance.registerHelper('lookup',function(obj,field){return obj&&obj[field];});}
var logger={methodMap:{0:'debug',1:'info',2:'warn',3:'error'},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(level,message){if(logger.level<=level){var method=logger.methodMap[level];if(typeof console!=='undefined'&&console[method]){console[method].call(console,message);}}}};__exports__.logger=logger;var log=logger.log;__exports__.log=log;var createFrame=function(object){var frame=Utils.extend({},object);frame._parent=object;return frame;};__exports__.createFrame=createFrame;return __exports__;})(__module3__,__module5__);var __module6__=(function(__dependency1__,__dependency2__,__dependency3__){"use strict";var __exports__={};var Utils=__dependency1__;var Exception=__dependency2__;var COMPILER_REVISION=__dependency3__.COMPILER_REVISION;var REVISION_CHANGES=__dependency3__.REVISION_CHANGES;var createFrame=__dependency3__.createFrame;function checkRevision(compilerInfo){var compilerRevision=compilerInfo&&compilerInfo[0]||1,currentRevision=COMPILER_REVISION;if(compilerRevision!==currentRevision){if(compilerRevision<currentRevision){var runtimeVersions=REVISION_CHANGES[currentRevision],compilerVersions=REVISION_CHANGES[compilerRevision];throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");}else{throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+"Please update your runtime to a newer version ("+compilerInfo[1]+").");}}}
__exports__.checkRevision=checkRevision;function template(templateSpec,env){if(!env){throw new Exception("No environment passed to template");}
if(!templateSpec||!templateSpec.main){throw new Exception('Unknown template object: '+typeof templateSpec);}
env.VM.checkRevision(templateSpec.compiler);var invokePartialWrapper=function(partial,indent,name,context,hash,helpers,partials,data,depths){if(hash){context=Utils.extend({},context,hash);}
var result=env.VM.invokePartial.call(this,partial,name,context,helpers,partials,data,depths);if(result==null&&env.compile){var options={helpers:helpers,partials:partials,data:data,depths:depths};partials[name]=env.compile(partial,{data:data!==undefined,compat:templateSpec.compat},env);result=partials[name](context,options);}
if(result!=null){if(indent){var lines=result.split('\n');for(var i=0,l=lines.length;i<l;i++){if(!lines[i]&&i+1===l){break;}
lines[i]=indent+lines[i];}
result=lines.join('\n');}
return result;}else{throw new Exception("The partial "+name+" could not be compiled when running in runtime-only mode");}};var container={lookup:function(depths,name){var len=depths.length;for(var i=0;i<len;i++){if(depths[i]&&depths[i][name]!=null){return depths[i][name];}}},lambda:function(current,context){return typeof current==='function'?current.call(context):current;},escapeExpression:Utils.escapeExpression,invokePartial:invokePartialWrapper,fn:function(i){return templateSpec[i];},programs:[],program:function(i,data,depths){var programWrapper=this.programs[i],fn=this.fn(i);if(data||depths){programWrapper=program(this,i,fn,data,depths);}else if(!programWrapper){programWrapper=this.programs[i]=program(this,i,fn);}
return programWrapper;},data:function(data,depth){while(data&&depth--){data=data._parent;}
return data;},merge:function(param,common){var ret=param||common;if(param&&common&&(param!==common)){ret=Utils.extend({},common,param);}
return ret;},noop:env.VM.noop,compilerInfo:templateSpec.compiler};var ret=function(context,options){options=options||{};var data=options.data;ret._setup(options);if(!options.partial&&templateSpec.useData){data=initData(context,data);}
var depths;if(templateSpec.useDepths){depths=options.depths?[context].concat(options.depths):[context];}
return templateSpec.main.call(container,context,container.helpers,container.partials,data,depths);};ret.isTop=true;ret._setup=function(options){if(!options.partial){container.helpers=container.merge(options.helpers,env.helpers);if(templateSpec.usePartial){container.partials=container.merge(options.partials,env.partials);}}else{container.helpers=options.helpers;container.partials=options.partials;}};ret._child=function(i,data,depths){if(templateSpec.useDepths&&!depths){throw new Exception('must pass parent depths');}
return program(container,i,templateSpec[i],data,depths);};return ret;}
__exports__.template=template;function program(container,i,fn,data,depths){var prog=function(context,options){options=options||{};return fn.call(container,context,container.helpers,container.partials,options.data||data,depths&&[context].concat(depths));};prog.program=i;prog.depth=depths?depths.length:0;return prog;}
__exports__.program=program;function invokePartial(partial,name,context,helpers,partials,data,depths){var options={partial:true,helpers:helpers,partials:partials,data:data,depths:depths};if(partial===undefined){throw new Exception("The partial "+name+" could not be found");}else if(partial instanceof Function){return partial(context,options);}}
__exports__.invokePartial=invokePartial;function noop(){return"";}
__exports__.noop=noop;function initData(context,data){if(!data||!('root'in data)){data=data?createFrame(data):{};data.root=context;}
return data;}
return __exports__;})(__module3__,__module5__,__module2__);var __module1__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__,__dependency5__){"use strict";var __exports__;var base=__dependency1__;var SafeString=__dependency2__;var Exception=__dependency3__;var Utils=__dependency4__;var runtime=__dependency5__;var create=function(){var hb=new base.HandlebarsEnvironment();Utils.extend(hb,base);hb.SafeString=SafeString;hb.Exception=Exception;hb.Utils=Utils;hb.escapeExpression=Utils.escapeExpression;hb.VM=runtime;hb.template=function(spec){return runtime.template(spec,hb);};return hb;};var Handlebars=create();Handlebars.create=create;Handlebars['default']=Handlebars;__exports__=Handlebars;return __exports__;})(__module2__,__module4__,__module5__,__module3__,__module6__);var __module7__=(function(__dependency1__){"use strict";var __exports__;var Exception=__dependency1__;function LocationInfo(locInfo){locInfo=locInfo||{};this.firstLine=locInfo.first_line;this.firstColumn=locInfo.first_column;this.lastColumn=locInfo.last_column;this.lastLine=locInfo.last_line;}
var AST={ProgramNode:function(statements,strip,locInfo){LocationInfo.call(this,locInfo);this.type="program";this.statements=statements;this.strip=strip;},MustacheNode:function(rawParams,hash,open,strip,locInfo){LocationInfo.call(this,locInfo);this.type="mustache";this.strip=strip;if(open!=null&&open.charAt){var escapeFlag=open.charAt(3)||open.charAt(2);this.escaped=escapeFlag!=='{'&&escapeFlag!=='&';}else{this.escaped=!!open;}
if(rawParams instanceof AST.SexprNode){this.sexpr=rawParams;}else{this.sexpr=new AST.SexprNode(rawParams,hash);}
this.id=this.sexpr.id;this.params=this.sexpr.params;this.hash=this.sexpr.hash;this.eligibleHelper=this.sexpr.eligibleHelper;this.isHelper=this.sexpr.isHelper;},SexprNode:function(rawParams,hash,locInfo){LocationInfo.call(this,locInfo);this.type="sexpr";this.hash=hash;var id=this.id=rawParams[0];var params=this.params=rawParams.slice(1);this.isHelper=!!(params.length||hash);this.eligibleHelper=this.isHelper||id.isSimple;},PartialNode:function(partialName,context,hash,strip,locInfo){LocationInfo.call(this,locInfo);this.type="partial";this.partialName=partialName;this.context=context;this.hash=hash;this.strip=strip;this.strip.inlineStandalone=true;},BlockNode:function(mustache,program,inverse,strip,locInfo){LocationInfo.call(this,locInfo);this.type='block';this.mustache=mustache;this.program=program;this.inverse=inverse;this.strip=strip;if(inverse&&!program){this.isInverse=true;}},RawBlockNode:function(mustache,content,close,locInfo){LocationInfo.call(this,locInfo);if(mustache.sexpr.id.original!==close){throw new Exception(mustache.sexpr.id.original+" doesn't match "+close,this);}
content=new AST.ContentNode(content,locInfo);this.type='block';this.mustache=mustache;this.program=new AST.ProgramNode([content],{},locInfo);},ContentNode:function(string,locInfo){LocationInfo.call(this,locInfo);this.type="content";this.original=this.string=string;},HashNode:function(pairs,locInfo){LocationInfo.call(this,locInfo);this.type="hash";this.pairs=pairs;},IdNode:function(parts,locInfo){LocationInfo.call(this,locInfo);this.type="ID";var original="",dig=[],depth=0,depthString='';for(var i=0,l=parts.length;i<l;i++){var part=parts[i].part;original+=(parts[i].separator||'')+part;if(part===".."||part==="."||part==="this"){if(dig.length>0){throw new Exception("Invalid path: "+original,this);}else if(part===".."){depth++;depthString+='../';}else{this.isScoped=true;}}else{dig.push(part);}}
this.original=original;this.parts=dig;this.string=dig.join('.');this.depth=depth;this.idName=depthString+this.string;this.isSimple=parts.length===1&&!this.isScoped&&depth===0;this.stringModeValue=this.string;},PartialNameNode:function(name,locInfo){LocationInfo.call(this,locInfo);this.type="PARTIAL_NAME";this.name=name.original;},DataNode:function(id,locInfo){LocationInfo.call(this,locInfo);this.type="DATA";this.id=id;this.stringModeValue=id.stringModeValue;this.idName='@'+id.stringModeValue;},StringNode:function(string,locInfo){LocationInfo.call(this,locInfo);this.type="STRING";this.original=this.string=this.stringModeValue=string;},NumberNode:function(number,locInfo){LocationInfo.call(this,locInfo);this.type="NUMBER";this.original=this.number=number;this.stringModeValue=Number(number);},BooleanNode:function(bool,locInfo){LocationInfo.call(this,locInfo);this.type="BOOLEAN";this.bool=bool;this.stringModeValue=bool==="true";},CommentNode:function(comment,locInfo){LocationInfo.call(this,locInfo);this.type="comment";this.comment=comment;this.strip={inlineStandalone:true};}};__exports__=AST;return __exports__;})(__module5__);var __module9__=(function(){"use strict";var __exports__;var handlebars=(function(){var parser={trace:function trace(){},yy:{},symbols_:{"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"CONTENT":12,"COMMENT":13,"openRawBlock":14,"END_RAW_BLOCK":15,"OPEN_RAW_BLOCK":16,"sexpr":17,"CLOSE_RAW_BLOCK":18,"openBlock":19,"block_option0":20,"closeBlock":21,"openInverse":22,"block_option1":23,"OPEN_BLOCK":24,"CLOSE":25,"OPEN_INVERSE":26,"inverseAndProgram":27,"INVERSE":28,"OPEN_ENDBLOCK":29,"path":30,"OPEN":31,"OPEN_UNESCAPED":32,"CLOSE_UNESCAPED":33,"OPEN_PARTIAL":34,"partialName":35,"param":36,"partial_option0":37,"partial_option1":38,"sexpr_repetition0":39,"sexpr_option0":40,"dataName":41,"STRING":42,"NUMBER":43,"BOOLEAN":44,"OPEN_SEXPR":45,"CLOSE_SEXPR":46,"hash":47,"hash_repetition_plus0":48,"hashSegment":49,"ID":50,"EQUALS":51,"DATA":52,"pathSegments":53,"SEP":54,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:yy.prepareProgram($$[$0-1].statements,true);return $$[$0-1];break;case 2:this.$=new yy.ProgramNode(yy.prepareProgram($$[$0]),{},this._$);break;case 3:this.$=$$[$0];break;case 4:this.$=$$[$0];break;case 5:this.$=$$[$0];break;case 6:this.$=$$[$0];break;case 7:this.$=new yy.ContentNode($$[$0],this._$);break;case 8:this.$=new yy.CommentNode($$[$0],this._$);break;case 9:this.$=new yy.RawBlockNode($$[$0-2],$$[$0-1],$$[$0],this._$);break;case 10:this.$=new yy.MustacheNode($$[$0-1],null,'','',this._$);break;case 11:this.$=yy.prepareBlock($$[$0-3],$$[$0-2],$$[$0-1],$$[$0],false,this._$);break;case 12:this.$=yy.prepareBlock($$[$0-3],$$[$0-2],$$[$0-1],$$[$0],true,this._$);break;case 13:this.$=new yy.MustacheNode($$[$0-1],null,$$[$0-2],yy.stripFlags($$[$0-2],$$[$0]),this._$);break;case 14:this.$=new yy.MustacheNode($$[$0-1],null,$$[$0-2],yy.stripFlags($$[$0-2],$$[$0]),this._$);break;case 15:this.$={strip:yy.stripFlags($$[$0-1],$$[$0-1]),program:$$[$0]};break;case 16:this.$={path:$$[$0-1],strip:yy.stripFlags($$[$0-2],$$[$0])};break;case 17:this.$=new yy.MustacheNode($$[$0-1],null,$$[$0-2],yy.stripFlags($$[$0-2],$$[$0]),this._$);break;case 18:this.$=new yy.MustacheNode($$[$0-1],null,$$[$0-2],yy.stripFlags($$[$0-2],$$[$0]),this._$);break;case 19:this.$=new yy.PartialNode($$[$0-3],$$[$0-2],$$[$0-1],yy.stripFlags($$[$0-4],$$[$0]),this._$);break;case 20:this.$=new yy.PartialNode($$[$0-2],undefined,$$[$0-1],yy.stripFlags($$[$0-3],$$[$0]),this._$);break;case 21:this.$=new yy.SexprNode([$$[$0-2]].concat($$[$0-1]),$$[$0],this._$);break;case 22:this.$=new yy.SexprNode([$$[$0]],null,this._$);break;case 23:this.$=$$[$0];break;case 24:this.$=new yy.StringNode($$[$0],this._$);break;case 25:this.$=new yy.NumberNode($$[$0],this._$);break;case 26:this.$=new yy.BooleanNode($$[$0],this._$);break;case 27:this.$=$$[$0];break;case 28:$$[$0-1].isHelper=true;this.$=$$[$0-1];break;case 29:this.$=new yy.HashNode($$[$0],this._$);break;case 30:this.$=[$$[$0-2],$$[$0]];break;case 31:this.$=new yy.PartialNameNode($$[$0],this._$);break;case 32:this.$=new yy.PartialNameNode(new yy.StringNode($$[$0],this._$),this._$);break;case 33:this.$=new yy.PartialNameNode(new yy.NumberNode($$[$0],this._$));break;case 34:this.$=new yy.DataNode($$[$0],this._$);break;case 35:this.$=new yy.IdNode($$[$0],this._$);break;case 36:$$[$0-2].push({part:$$[$0],separator:$$[$0-1]});this.$=$$[$0-2];break;case 37:this.$=[{part:$$[$0]}];break;case 38:this.$=[];break;case 39:$$[$0-1].push($$[$0]);break;case 48:this.$=[];break;case 49:$$[$0-1].push($$[$0]);break;case 52:this.$=[$$[$0]];break;case 53:$$[$0-1].push($$[$0]);break;}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function parseError(str,hash){throw new Error(str);},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")
this.lexer.yylloc={};var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")
this.parseError=this.yy.parseError;function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n;}
function lex(){var token;token=self.lexer.lex()||1;if(typeof token!=="number"){token=self.symbols_[token]||token;}
return token;}
var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state];}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex();}
action=table[state]&&table[state][symbol];}
if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";if(!recovering){expected=[];for(p in table[state])
if(this.terminals_[p]&&p>2){expected.push("'"+this.terminals_[p]+"'");}
if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'";}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==1?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'");}
this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected});}}
if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);}
switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0)
recovering--;}else{symbol=preErrorSymbol;preErrorSymbol=null;}
break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]];}
r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r;}
if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len);}
stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true;}}
return true;}};var lexer=(function(){var lexer=({EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash);}else{throw new Error(str);}},setInput:function(input){this._input=input;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match='';this.conditionStack=['INITIAL'];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this;},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++;}else{this.yylloc.last_column++;}
if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return ch;},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len-1);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1)this.yylineno-=lines.length-1;var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len];}
return this;},more:function(){this._more=true;return this;},less:function(n){this.unput(this.match.slice(n));},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?'...':'')+past.substr(-20).replace(/\n/g,"");},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length);}
return(next.substr(0,20)+(next.length>20?'...':'')).replace(/\n/g,"");},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^";},next:function(){if(this.done){return this.EOF;}
if(!this._input)this.done=true;var token,match,tempMatch,index,col,lines;if(!this._more){this.yytext='';this.match='';}
var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(!this.options.flex)break;}}
if(match){lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines)this.yylineno+=lines.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng];}
this._more=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(token)return token;else return;}
if(this._input===""){return this.EOF;}else{return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),{text:"",token:null,line:this.yylineno});}},lex:function lex(){var r=this.next();if(typeof r!=='undefined'){return r;}else{return this.lex();}},begin:function begin(condition){this.conditionStack.push(condition);},popState:function popState(){return this.conditionStack.pop();},_currentRules:function _currentRules(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;},topState:function(){return this.conditionStack[this.conditionStack.length-2];},pushState:function begin(condition){this.begin(condition);}});lexer.options={};lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){function strip(start,end){return yy_.yytext=yy_.yytext.substr(start,yy_.yyleng-end);}
var YYSTATE=YY_START
switch($avoiding_name_collisions){case 0:if(yy_.yytext.slice(-2)==="\\\\"){strip(0,1);this.begin("mu");}else if(yy_.yytext.slice(-1)==="\\"){strip(0,1);this.begin("emu");}else{this.begin("mu");}
if(yy_.yytext)return 12;break;case 1:return 12;break;case 2:this.popState();return 12;break;case 3:yy_.yytext=yy_.yytext.substr(5,yy_.yyleng-9);this.popState();return 15;break;case 4:return 12;break;case 5:strip(0,4);this.popState();return 13;break;case 6:return 45;break;case 7:return 46;break;case 8:return 16;break;case 9:this.popState();this.begin('raw');return 18;break;case 10:return 34;break;case 11:return 24;break;case 12:return 29;break;case 13:this.popState();return 28;break;case 14:this.popState();return 28;break;case 15:return 26;break;case 16:return 26;break;case 17:return 32;break;case 18:return 31;break;case 19:this.popState();this.begin('com');break;case 20:strip(3,5);this.popState();return 13;break;case 21:return 31;break;case 22:return 51;break;case 23:return 50;break;case 24:return 50;break;case 25:return 54;break;case 26:break;case 27:this.popState();return 33;break;case 28:this.popState();return 25;break;case 29:yy_.yytext=strip(1,2).replace(/\\"/g,'"');return 42;break;case 30:yy_.yytext=strip(1,2).replace(/\\'/g,"'");return 42;break;case 31:return 52;break;case 32:return 44;break;case 33:return 44;break;case 34:return 43;break;case 35:return 50;break;case 36:yy_.yytext=strip(1,2);return 50;break;case 37:return'INVALID';break;case 38:return 5;break;}};lexer.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];lexer.conditions={"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,38],"inclusive":true}};return lexer;})()
parser.lexer=lexer;function Parser(){this.yy={};}Parser.prototype=parser;parser.Parser=Parser;return new Parser;})();__exports__=handlebars;return __exports__;})();var __module10__=(function(__dependency1__){"use strict";var __exports__={};var Exception=__dependency1__;function stripFlags(open,close){return{left:open.charAt(2)==='~',right:close.charAt(close.length-3)==='~'};}
__exports__.stripFlags=stripFlags;function prepareBlock(mustache,program,inverseAndProgram,close,inverted,locInfo){if(mustache.sexpr.id.original!==close.path.original){throw new Exception(mustache.sexpr.id.original+' doesn\'t match '+close.path.original,mustache);}
var inverse=inverseAndProgram&&inverseAndProgram.program;var strip={left:mustache.strip.left,right:close.strip.right,openStandalone:isNextWhitespace(program.statements),closeStandalone:isPrevWhitespace((inverse||program).statements)};if(mustache.strip.right){omitRight(program.statements,null,true);}
if(inverse){var inverseStrip=inverseAndProgram.strip;if(inverseStrip.left){omitLeft(program.statements,null,true);}
if(inverseStrip.right){omitRight(inverse.statements,null,true);}
if(close.strip.left){omitLeft(inverse.statements,null,true);}
if(isPrevWhitespace(program.statements)&&isNextWhitespace(inverse.statements)){omitLeft(program.statements);omitRight(inverse.statements);}}else{if(close.strip.left){omitLeft(program.statements,null,true);}}
if(inverted){return new this.BlockNode(mustache,inverse,program,strip,locInfo);}else{return new this.BlockNode(mustache,program,inverse,strip,locInfo);}}
__exports__.prepareBlock=prepareBlock;function prepareProgram(statements,isRoot){for(var i=0,l=statements.length;i<l;i++){var current=statements[i],strip=current.strip;if(!strip){continue;}
var _isPrevWhitespace=isPrevWhitespace(statements,i,isRoot,current.type==='partial'),_isNextWhitespace=isNextWhitespace(statements,i,isRoot),openStandalone=strip.openStandalone&&_isPrevWhitespace,closeStandalone=strip.closeStandalone&&_isNextWhitespace,inlineStandalone=strip.inlineStandalone&&_isPrevWhitespace&&_isNextWhitespace;if(strip.right){omitRight(statements,i,true);}
if(strip.left){omitLeft(statements,i,true);}
if(inlineStandalone){omitRight(statements,i);if(omitLeft(statements,i)){if(current.type==='partial'){current.indent=(/([ \t]+$)/).exec(statements[i-1].original)?RegExp.$1:'';}}}
if(openStandalone){omitRight((current.program||current.inverse).statements);omitLeft(statements,i);}
if(closeStandalone){omitRight(statements,i);omitLeft((current.inverse||current.program).statements);}}
return statements;}
__exports__.prepareProgram=prepareProgram;function isPrevWhitespace(statements,i,isRoot){if(i===undefined){i=statements.length;}
var prev=statements[i-1],sibling=statements[i-2];if(!prev){return isRoot;}
if(prev.type==='content'){return(sibling||!isRoot?(/\r?\n\s*?$/):(/(^|\r?\n)\s*?$/)).test(prev.original);}}
function isNextWhitespace(statements,i,isRoot){if(i===undefined){i=-1;}
var next=statements[i+1],sibling=statements[i+2];if(!next){return isRoot;}
if(next.type==='content'){return(sibling||!isRoot?(/^\s*?\r?\n/):(/^\s*?(\r?\n|$)/)).test(next.original);}}
function omitRight(statements,i,multiple){var current=statements[i==null?0:i+1];if(!current||current.type!=='content'||(!multiple&&current.rightStripped)){return;}
var original=current.string;current.string=current.string.replace(multiple?(/^\s+/):(/^[ \t]*\r?\n?/),'');current.rightStripped=current.string!==original;}
function omitLeft(statements,i,multiple){var current=statements[i==null?statements.length-1:i-1];if(!current||current.type!=='content'||(!multiple&&current.leftStripped)){return;}
var original=current.string;current.string=current.string.replace(multiple?(/\s+$/):(/[ \t]+$/),'');current.leftStripped=current.string!==original;return current.leftStripped;}
return __exports__;})(__module5__);var __module8__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__){"use strict";var __exports__={};var parser=__dependency1__;var AST=__dependency2__;var Helpers=__dependency3__;var extend=__dependency4__.extend;__exports__.parser=parser;var yy={};extend(yy,Helpers,AST);function parse(input){if(input.constructor===AST.ProgramNode){return input;}
parser.yy=yy;return parser.parse(input);}
__exports__.parse=parse;return __exports__;})(__module9__,__module7__,__module10__,__module3__);var __module11__=(function(__dependency1__,__dependency2__){"use strict";var __exports__={};var Exception=__dependency1__;var isArray=__dependency2__.isArray;var slice=[].slice;function Compiler(){}
__exports__.Compiler=Compiler;Compiler.prototype={compiler:Compiler,equals:function(other){var len=this.opcodes.length;if(other.opcodes.length!==len){return false;}
for(var i=0;i<len;i++){var opcode=this.opcodes[i],otherOpcode=other.opcodes[i];if(opcode.opcode!==otherOpcode.opcode||!argEquals(opcode.args,otherOpcode.args)){return false;}}
len=this.children.length;for(i=0;i<len;i++){if(!this.children[i].equals(other.children[i])){return false;}}
return true;},guid:0,compile:function(program,options){this.opcodes=[];this.children=[];this.depths={list:[]};this.options=options;this.stringParams=options.stringParams;this.trackIds=options.trackIds;var knownHelpers=this.options.knownHelpers;this.options.knownHelpers={'helperMissing':true,'blockHelperMissing':true,'each':true,'if':true,'unless':true,'with':true,'log':true,'lookup':true};if(knownHelpers){for(var name in knownHelpers){this.options.knownHelpers[name]=knownHelpers[name];}}
return this.accept(program);},accept:function(node){return this[node.type](node);},program:function(program){var statements=program.statements;for(var i=0,l=statements.length;i<l;i++){this.accept(statements[i]);}
this.isSimple=l===1;this.depths.list=this.depths.list.sort(function(a,b){return a-b;});return this;},compileProgram:function(program){var result=new this.compiler().compile(program,this.options);var guid=this.guid++,depth;this.usePartial=this.usePartial||result.usePartial;this.children[guid]=result;for(var i=0,l=result.depths.list.length;i<l;i++){depth=result.depths.list[i];if(depth<2){continue;}
else{this.addDepth(depth-1);}}
return guid;},block:function(block){var mustache=block.mustache,program=block.program,inverse=block.inverse;if(program){program=this.compileProgram(program);}
if(inverse){inverse=this.compileProgram(inverse);}
var sexpr=mustache.sexpr;var type=this.classifySexpr(sexpr);if(type==="helper"){this.helperSexpr(sexpr,program,inverse);}else if(type==="simple"){this.simpleSexpr(sexpr);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('blockValue',sexpr.id.original);}else{this.ambiguousSexpr(sexpr,program,inverse);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('ambiguousBlockValue');}
this.opcode('append');},hash:function(hash){var pairs=hash.pairs,i,l;this.opcode('pushHash');for(i=0,l=pairs.length;i<l;i++){this.pushParam(pairs[i][1]);}
while(i--){this.opcode('assignToHash',pairs[i][0]);}
this.opcode('popHash');},partial:function(partial){var partialName=partial.partialName;this.usePartial=true;if(partial.hash){this.accept(partial.hash);}else{this.opcode('push','undefined');}
if(partial.context){this.accept(partial.context);}else{this.opcode('getContext',0);this.opcode('pushContext');}
this.opcode('invokePartial',partialName.name,partial.indent||'');this.opcode('append');},content:function(content){if(content.string){this.opcode('appendContent',content.string);}},mustache:function(mustache){this.sexpr(mustache.sexpr);if(mustache.escaped&&!this.options.noEscape){this.opcode('appendEscaped');}else{this.opcode('append');}},ambiguousSexpr:function(sexpr,program,inverse){var id=sexpr.id,name=id.parts[0],isBlock=program!=null||inverse!=null;this.opcode('getContext',id.depth);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.ID(id);this.opcode('invokeAmbiguous',name,isBlock);},simpleSexpr:function(sexpr){var id=sexpr.id;if(id.type==='DATA'){this.DATA(id);}else if(id.parts.length){this.ID(id);}else{this.addDepth(id.depth);this.opcode('getContext',id.depth);this.opcode('pushContext');}
this.opcode('resolvePossibleLambda');},helperSexpr:function(sexpr,program,inverse){var params=this.setupFullMustacheParams(sexpr,program,inverse),id=sexpr.id,name=id.parts[0];if(this.options.knownHelpers[name]){this.opcode('invokeKnownHelper',params.length,name);}else if(this.options.knownHelpersOnly){throw new Exception("You specified knownHelpersOnly, but used the unknown helper "+name,sexpr);}else{id.falsy=true;this.ID(id);this.opcode('invokeHelper',params.length,id.original,id.isSimple);}},sexpr:function(sexpr){var type=this.classifySexpr(sexpr);if(type==="simple"){this.simpleSexpr(sexpr);}else if(type==="helper"){this.helperSexpr(sexpr);}else{this.ambiguousSexpr(sexpr);}},ID:function(id){this.addDepth(id.depth);this.opcode('getContext',id.depth);var name=id.parts[0];if(!name){this.opcode('pushContext');}else{this.opcode('lookupOnContext',id.parts,id.falsy,id.isScoped);}},DATA:function(data){this.options.data=true;this.opcode('lookupData',data.id.depth,data.id.parts);},STRING:function(string){this.opcode('pushString',string.string);},NUMBER:function(number){this.opcode('pushLiteral',number.number);},BOOLEAN:function(bool){this.opcode('pushLiteral',bool.bool);},comment:function(){},opcode:function(name){this.opcodes.push({opcode:name,args:slice.call(arguments,1)});},addDepth:function(depth){if(depth===0){return;}
if(!this.depths[depth]){this.depths[depth]=true;this.depths.list.push(depth);}},classifySexpr:function(sexpr){var isHelper=sexpr.isHelper;var isEligible=sexpr.eligibleHelper;var options=this.options;if(isEligible&&!isHelper){var name=sexpr.id.parts[0];if(options.knownHelpers[name]){isHelper=true;}else if(options.knownHelpersOnly){isEligible=false;}}
if(isHelper){return"helper";}
else if(isEligible){return"ambiguous";}
else{return"simple";}},pushParams:function(params){for(var i=0,l=params.length;i<l;i++){this.pushParam(params[i]);}},pushParam:function(val){if(this.stringParams){if(val.depth){this.addDepth(val.depth);}
this.opcode('getContext',val.depth||0);this.opcode('pushStringParam',val.stringModeValue,val.type);if(val.type==='sexpr'){this.sexpr(val);}}else{if(this.trackIds){this.opcode('pushId',val.type,val.idName||val.stringModeValue);}
this.accept(val);}},setupFullMustacheParams:function(sexpr,program,inverse){var params=sexpr.params;this.pushParams(params);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);if(sexpr.hash){this.hash(sexpr.hash);}else{this.opcode('emptyHash');}
return params;}};function precompile(input,options,env){if(input==null||(typeof input!=='string'&&input.constructor!==env.AST.ProgramNode)){throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+input);}
options=options||{};if(!('data'in options)){options.data=true;}
if(options.compat){options.useDepths=true;}
var ast=env.parse(input);var environment=new env.Compiler().compile(ast,options);return new env.JavaScriptCompiler().compile(environment,options);}
__exports__.precompile=precompile;function compile(input,options,env){if(input==null||(typeof input!=='string'&&input.constructor!==env.AST.ProgramNode)){throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+input);}
options=options||{};if(!('data'in options)){options.data=true;}
if(options.compat){options.useDepths=true;}
var compiled;function compileInput(){var ast=env.parse(input);var environment=new env.Compiler().compile(ast,options);var templateSpec=new env.JavaScriptCompiler().compile(environment,options,undefined,true);return env.template(templateSpec);}
var ret=function(context,options){if(!compiled){compiled=compileInput();}
return compiled.call(this,context,options);};ret._setup=function(options){if(!compiled){compiled=compileInput();}
return compiled._setup(options);};ret._child=function(i,data,depths){if(!compiled){compiled=compileInput();}
return compiled._child(i,data,depths);};return ret;}
__exports__.compile=compile;function argEquals(a,b){if(a===b){return true;}
if(isArray(a)&&isArray(b)&&a.length===b.length){for(var i=0;i<a.length;i++){if(!argEquals(a[i],b[i])){return false;}}
return true;}}
return __exports__;})(__module5__,__module3__);var __module12__=(function(__dependency1__,__dependency2__){"use strict";var __exports__;var COMPILER_REVISION=__dependency1__.COMPILER_REVISION;var REVISION_CHANGES=__dependency1__.REVISION_CHANGES;var Exception=__dependency2__;function Literal(value){this.value=value;}
function JavaScriptCompiler(){}
JavaScriptCompiler.prototype={nameLookup:function(parent,name){if(JavaScriptCompiler.isValidJavaScriptVariableName(name)){return parent+"."+name;}else{return parent+"['"+name+"']";}},depthedLookup:function(name){this.aliases.lookup='this.lookup';return'lookup(depths, "'+name+'")';},compilerInfo:function(){var revision=COMPILER_REVISION,versions=REVISION_CHANGES[revision];return[revision,versions];},appendToBuffer:function(string){if(this.environment.isSimple){return"return "+string+";";}else{return{appendToBuffer:true,content:string,toString:function(){return"buffer += "+string+";";}};}},initializeBuffer:function(){return this.quotedString("");},namespace:"Handlebars",compile:function(environment,options,context,asObject){this.environment=environment;this.options=options;this.stringParams=this.options.stringParams;this.trackIds=this.options.trackIds;this.precompile=!asObject;this.name=this.environment.name;this.isChild=!!context;this.context=context||{programs:[],environments:[]};this.preamble();this.stackSlot=0;this.stackVars=[];this.aliases={};this.registers={list:[]};this.hashes=[];this.compileStack=[];this.inlineStack=[];this.compileChildren(environment,options);this.useDepths=this.useDepths||environment.depths.list.length||this.options.compat;var opcodes=environment.opcodes,opcode,i,l;for(i=0,l=opcodes.length;i<l;i++){opcode=opcodes[i];this[opcode.opcode].apply(this,opcode.args);}
this.pushSource('');if(this.stackSlot||this.inlineStack.length||this.compileStack.length){throw new Exception('Compile completed with content left on stack');}
var fn=this.createFunctionContext(asObject);if(!this.isChild){var ret={compiler:this.compilerInfo(),main:fn};var programs=this.context.programs;for(i=0,l=programs.length;i<l;i++){if(programs[i]){ret[i]=programs[i];}}
if(this.environment.usePartial){ret.usePartial=true;}
if(this.options.data){ret.useData=true;}
if(this.useDepths){ret.useDepths=true;}
if(this.options.compat){ret.compat=true;}
if(!asObject){ret.compiler=JSON.stringify(ret.compiler);ret=this.objectLiteral(ret);}
return ret;}else{return fn;}},preamble:function(){this.lastContext=0;this.source=[];},createFunctionContext:function(asObject){var varDeclarations='';var locals=this.stackVars.concat(this.registers.list);if(locals.length>0){varDeclarations+=", "+locals.join(", ");}
for(var alias in this.aliases){if(this.aliases.hasOwnProperty(alias)){varDeclarations+=', '+alias+'='+this.aliases[alias];}}
var params=["depth0","helpers","partials","data"];if(this.useDepths){params.push('depths');}
var source=this.mergeSource(varDeclarations);if(asObject){params.push(source);return Function.apply(this,params);}else{return'function('+params.join(',')+') {\n  '+source+'}';}},mergeSource:function(varDeclarations){var source='',buffer,appendOnly=!this.forceBuffer,appendFirst;for(var i=0,len=this.source.length;i<len;i++){var line=this.source[i];if(line.appendToBuffer){if(buffer){buffer=buffer+'\n    + '+line.content;}else{buffer=line.content;}}else{if(buffer){if(!source){appendFirst=true;source=buffer+';\n  ';}else{source+='buffer += '+buffer+';\n  ';}
buffer=undefined;}
source+=line+'\n  ';if(!this.environment.isSimple){appendOnly=false;}}}
if(appendOnly){if(buffer||!source){source+='return '+(buffer||'""')+';\n';}}else{varDeclarations+=", buffer = "+(appendFirst?'':this.initializeBuffer());if(buffer){source+='return buffer + '+buffer+';\n';}else{source+='return buffer;\n';}}
if(varDeclarations){source='var '+varDeclarations.substring(2)+(appendFirst?'':';\n  ')+source;}
return source;},blockValue:function(name){this.aliases.blockHelperMissing='helpers.blockHelperMissing';var params=[this.contextName(0)];this.setupParams(name,0,params);var blockName=this.popStack();params.splice(1,0,blockName);this.push('blockHelperMissing.call('+params.join(', ')+')');},ambiguousBlockValue:function(){this.aliases.blockHelperMissing='helpers.blockHelperMissing';var params=[this.contextName(0)];this.setupParams('',0,params,true);this.flushInline();var current=this.topStack();params.splice(1,0,current);this.pushSource("if (!"+this.lastHelper+") { "+current+" = blockHelperMissing.call("+params.join(", ")+"); }");},appendContent:function(content){if(this.pendingContent){content=this.pendingContent+content;}
this.pendingContent=content;},append:function(){this.flushInline();var local=this.popStack();this.pushSource('if ('+local+' != null) { '+this.appendToBuffer(local)+' }');if(this.environment.isSimple){this.pushSource("else { "+this.appendToBuffer("''")+" }");}},appendEscaped:function(){this.aliases.escapeExpression='this.escapeExpression';this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"));},getContext:function(depth){this.lastContext=depth;},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext));},lookupOnContext:function(parts,falsy,scoped){var i=0,len=parts.length;if(!scoped&&this.options.compat&&!this.lastContext){this.push(this.depthedLookup(parts[i++]));}else{this.pushContext();}
for(;i<len;i++){this.replaceStack(function(current){var lookup=this.nameLookup(current,parts[i],'context');if(!falsy){return' != null ? '+lookup+' : '+current;}else{return' && '+lookup;}});}},lookupData:function(depth,parts){if(!depth){this.pushStackLiteral('data');}else{this.pushStackLiteral('this.data(data, '+depth+')');}
var len=parts.length;for(var i=0;i<len;i++){this.replaceStack(function(current){return' && '+this.nameLookup(current,parts[i],'data');});}},resolvePossibleLambda:function(){this.aliases.lambda='this.lambda';this.push('lambda('+this.popStack()+', '+this.contextName(0)+')');},pushStringParam:function(string,type){this.pushContext();this.pushString(type);if(type!=='sexpr'){if(typeof string==='string'){this.pushString(string);}else{this.pushStackLiteral(string);}}},emptyHash:function(){this.pushStackLiteral('{}');if(this.trackIds){this.push('{}');}
if(this.stringParams){this.push('{}');this.push('{}');}},pushHash:function(){if(this.hash){this.hashes.push(this.hash);}
this.hash={values:[],types:[],contexts:[],ids:[]};},popHash:function(){var hash=this.hash;this.hash=this.hashes.pop();if(this.trackIds){this.push('{'+hash.ids.join(',')+'}');}
if(this.stringParams){this.push('{'+hash.contexts.join(',')+'}');this.push('{'+hash.types.join(',')+'}');}
this.push('{\n    '+hash.values.join(',\n    ')+'\n  }');},pushString:function(string){this.pushStackLiteral(this.quotedString(string));},push:function(expr){this.inlineStack.push(expr);return expr;},pushLiteral:function(value){this.pushStackLiteral(value);},pushProgram:function(guid){if(guid!=null){this.pushStackLiteral(this.programExpression(guid));}else{this.pushStackLiteral(null);}},invokeHelper:function(paramSize,name,isSimple){this.aliases.helperMissing='helpers.helperMissing';var nonHelper=this.popStack();var helper=this.setupHelper(paramSize,name);var lookup=(isSimple?helper.name+' || ':'')+nonHelper+' || helperMissing';this.push('(('+lookup+').call('+helper.callParams+'))');},invokeKnownHelper:function(paramSize,name){var helper=this.setupHelper(paramSize,name);this.push(helper.name+".call("+helper.callParams+")");},invokeAmbiguous:function(name,helperCall){this.aliases.functionType='"function"';this.aliases.helperMissing='helpers.helperMissing';this.useRegister('helper');var nonHelper=this.popStack();this.emptyHash();var helper=this.setupHelper(0,name,helperCall);var helperName=this.lastHelper=this.nameLookup('helpers',name,'helper');this.push('((helper = (helper = '+helperName+' || '+nonHelper+') != null ? helper : helperMissing'
+(helper.paramsInit?'),('+helper.paramsInit:'')+'),'
+'(typeof helper === functionType ? helper.call('+helper.callParams+') : helper))');},invokePartial:function(name,indent){var params=[this.nameLookup('partials',name,'partial'),"'"+indent+"'","'"+name+"'",this.popStack(),this.popStack(),"helpers","partials"];if(this.options.data){params.push("data");}else if(this.options.compat){params.push('undefined');}
if(this.options.compat){params.push('depths');}
this.push("this.invokePartial("+params.join(", ")+")");},assignToHash:function(key){var value=this.popStack(),context,type,id;if(this.trackIds){id=this.popStack();}
if(this.stringParams){type=this.popStack();context=this.popStack();}
var hash=this.hash;if(context){hash.contexts.push("'"+key+"': "+context);}
if(type){hash.types.push("'"+key+"': "+type);}
if(id){hash.ids.push("'"+key+"': "+id);}
hash.values.push("'"+key+"': ("+value+")");},pushId:function(type,name){if(type==='ID'||type==='DATA'){this.pushString(name);}else if(type==='sexpr'){this.pushStackLiteral('true');}else{this.pushStackLiteral('null');}},compiler:JavaScriptCompiler,compileChildren:function(environment,options){var children=environment.children,child,compiler;for(var i=0,l=children.length;i<l;i++){child=children[i];compiler=new this.compiler();var index=this.matchExistingProgram(child);if(index==null){this.context.programs.push('');index=this.context.programs.length;child.index=index;child.name='program'+index;this.context.programs[index]=compiler.compile(child,options,this.context,!this.precompile);this.context.environments[index]=child;this.useDepths=this.useDepths||compiler.useDepths;}else{child.index=index;child.name='program'+index;}}},matchExistingProgram:function(child){for(var i=0,len=this.context.environments.length;i<len;i++){var environment=this.context.environments[i];if(environment&&environment.equals(child)){return i;}}},programExpression:function(guid){var child=this.environment.children[guid],depths=child.depths.list,useDepths=this.useDepths,depth;var programParams=[child.index,'data'];if(useDepths){programParams.push('depths');}
return'this.program('+programParams.join(', ')+')';},useRegister:function(name){if(!this.registers[name]){this.registers[name]=true;this.registers.list.push(name);}},pushStackLiteral:function(item){return this.push(new Literal(item));},pushSource:function(source){if(this.pendingContent){this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));this.pendingContent=undefined;}
if(source){this.source.push(source);}},pushStack:function(item){this.flushInline();var stack=this.incrStack();this.pushSource(stack+" = "+item+";");this.compileStack.push(stack);return stack;},replaceStack:function(callback){var prefix='',inline=this.isInline(),stack,createdStack,usedLiteral;if(!this.isInline()){throw new Exception('replaceStack on non-inline');}
var top=this.popStack(true);if(top instanceof Literal){prefix=stack=top.value;usedLiteral=true;}else{createdStack=!this.stackSlot;var name=!createdStack?this.topStackName():this.incrStack();prefix='('+this.push(name)+' = '+top+')';stack=this.topStack();}
var item=callback.call(this,stack);if(!usedLiteral){this.popStack();}
if(createdStack){this.stackSlot--;}
this.push('('+prefix+item+')');},incrStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot);}
return this.topStackName();},topStackName:function(){return"stack"+this.stackSlot;},flushInline:function(){var inlineStack=this.inlineStack;if(inlineStack.length){this.inlineStack=[];for(var i=0,len=inlineStack.length;i<len;i++){var entry=inlineStack[i];if(entry instanceof Literal){this.compileStack.push(entry);}else{this.pushStack(entry);}}}},isInline:function(){return this.inlineStack.length;},popStack:function(wrapped){var inline=this.isInline(),item=(inline?this.inlineStack:this.compileStack).pop();if(!wrapped&&(item instanceof Literal)){return item.value;}else{if(!inline){if(!this.stackSlot){throw new Exception('Invalid stack pop');}
this.stackSlot--;}
return item;}},topStack:function(){var stack=(this.isInline()?this.inlineStack:this.compileStack),item=stack[stack.length-1];if(item instanceof Literal){return item.value;}else{return item;}},contextName:function(context){if(this.useDepths&&context){return'depths['+context+']';}else{return'depth'+context;}},quotedString:function(str){return'"'+str.replace(/\\/g,'\\\\').replace(/"/g,'\\"').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/\u2028/g,'\\u2028').replace(/\u2029/g,'\\u2029')+'"';},objectLiteral:function(obj){var pairs=[];for(var key in obj){if(obj.hasOwnProperty(key)){pairs.push(this.quotedString(key)+':'+obj[key]);}}
return'{'+pairs.join(',')+'}';},setupHelper:function(paramSize,name,blockHelper){var params=[],paramsInit=this.setupParams(name,paramSize,params,blockHelper);var foundHelper=this.nameLookup('helpers',name,'helper');return{params:params,paramsInit:paramsInit,name:foundHelper,callParams:[this.contextName(0)].concat(params).join(", ")};},setupOptions:function(helper,paramSize,params){var options={},contexts=[],types=[],ids=[],param,inverse,program;options.name=this.quotedString(helper);options.hash=this.popStack();if(this.trackIds){options.hashIds=this.popStack();}
if(this.stringParams){options.hashTypes=this.popStack();options.hashContexts=this.popStack();}
inverse=this.popStack();program=this.popStack();if(program||inverse){if(!program){program='this.noop';}
if(!inverse){inverse='this.noop';}
options.fn=program;options.inverse=inverse;}
var i=paramSize;while(i--){param=this.popStack();params[i]=param;if(this.trackIds){ids[i]=this.popStack();}
if(this.stringParams){types[i]=this.popStack();contexts[i]=this.popStack();}}
if(this.trackIds){options.ids="["+ids.join(",")+"]";}
if(this.stringParams){options.types="["+types.join(",")+"]";options.contexts="["+contexts.join(",")+"]";}
if(this.options.data){options.data="data";}
return options;},setupParams:function(helperName,paramSize,params,useRegister){var options=this.objectLiteral(this.setupOptions(helperName,paramSize,params));if(useRegister){this.useRegister('options');params.push('options');return'options='+options;}else{params.push(options);return'';}}};var reservedWords=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};for(var i=0,l=reservedWords.length;i<l;i++){compilerWords[reservedWords[i]]=true;}
JavaScriptCompiler.isValidJavaScriptVariableName=function(name){return!JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);};__exports__=JavaScriptCompiler;return __exports__;})(__module2__,__module5__);var __module0__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__,__dependency5__){"use strict";var __exports__;var Handlebars=__dependency1__;var AST=__dependency2__;var Parser=__dependency3__.parser;var parse=__dependency3__.parse;var Compiler=__dependency4__.Compiler;var compile=__dependency4__.compile;var precompile=__dependency4__.precompile;var JavaScriptCompiler=__dependency5__;var _create=Handlebars.create;var create=function(){var hb=_create();hb.compile=function(input,options){return compile(input,options,hb);};hb.precompile=function(input,options){return precompile(input,options,hb);};hb.AST=AST;hb.Compiler=Compiler;hb.JavaScriptCompiler=JavaScriptCompiler;hb.Parser=Parser;hb.parse=parse;return hb;};Handlebars=create();Handlebars.create=create;Handlebars['default']=Handlebars;__exports__=Handlebars;return __exports__;})(__module1__,__module7__,__module8__,__module11__,__module12__);return __module0__;}));Handlebars.registerHelper("lang",function(text){return lang(text);});Handlebars.registerHelper('escape',function(variable){return variable.replace(/(['"])/g,'\$1');});Handlebars.registerHelper('if_eq',function(a,b,opts){if(a==b)
return opts.fn(this);else
return opts.inverse(this);});Handlebars.registerHelper('unless_or',function(a,b,opts){if(a!=true||b!=true){return opts.fn(this);}else{return opts.inverse(this);}});ogTasks.Tasks=[];ogTasks.Users=[];ogTasks.Companies=[];ogTasks.Milestones=[];ogTasks.TasksList={};ogTasks.Groups=[];ogTasks.redrawGroups=true;ogTasks.assignedTo='-1';ogTasks.selectedMilestone=0;ogTasksTask=function(){this.id;this.title;this.description;this.dependants;this.createdOn;this.createdBy;this.status=0;this.statusOnCreate=0;this.parentId=0;this.priority=200;this.milestoneId;this.assignedToId;this.assignedById;this.dueDate;this.startDate;this.workingOnIds;this.workingOnTimes;this.workingOnPauses;this.previous_tasks_total;this.pauseTime;this.isAdditional=false;this.isRead=true;this.mark_as_started;this.completedById;this.completedOn;this.repetitive=false;this.otype;this.percentCompleted=0;this.members;this.depCount;this.memPath;this.useDueTime=false;this.useStartTime=false;this.multiAssignment=0;this.createdByName;this.assignedToName;this.milestoneName;this.workspacePaths;this.subtasks=[];this.subtasksIds=[];this.parent;this.divInfo=[];this.isChecked=false;this.isExpanded=false;this.isCreatedClientSide=false;this.canAddTimeslots=false;this.additional_data={};this.custom_properties={};this.toggleSubtasksShow=false;}
ogTasksTask.prototype.flatten=function(){var result=[this];if(this.subtasks.length>0){for(var i=0;i<this.subtasks.length;i++){result=result.concat(this.subtasks[i].flatten());}}
return result;}
ogTasksTask.prototype.setFromTdata=function(tdata){this.id=tdata.id;this.title=tdata.name;this.description=tdata.description;this.createdOn=tdata.createdOn;this.createdBy=tdata.createdById;this.mark_as_started=parseInt(tdata.mark_as_started)==1;var dummyDate=new Date();if(tdata.dependants)this.dependants=tdata.dependants;else this.dependants=[];if(tdata.status)this.status=tdata.status;else this.status=0;if(tdata.parentId)this.parentId=tdata.parentId;else this.parentId=0;if(tdata.priority)this.priority=tdata.priority;else this.priority=200;if(tdata.milestoneId)this.milestoneId=tdata.milestoneId;else this.milestoneId=null;if(tdata.assignedToContactId)this.assignedToId=tdata.assignedToContactId;else this.assignedToId=null;if(tdata.assignedById)this.assignedById=tdata.assignedById;else this.assignedById=null;if(tdata.dueDate)this.dueDate=tdata.dueDate;else this.dueDate=null;if(tdata.startDate)this.startDate=tdata.startDate;else this.startDate=null;if(tdata.workingOnIds)this.workingOnIds=tdata.workingOnIds;else this.workingOnIds=null;if(tdata.workingOnTimes)this.workingOnTimes=tdata.workingOnTimes;else this.workingOnTimes=null;if(tdata.workingOnPauses)this.workingOnPauses=tdata.workingOnPauses;else this.workingOnPauses=null;if(tdata.previous_tasks_total)this.previous_tasks_total=tdata.previous_tasks_total;else this.previous_tasks_total=0;if(tdata.pauseTime)this.pauseTime=tdata.pauseTime;else this.pauseTime=null;if(tdata.completedById)this.completedById=tdata.completedById;else this.completedById=null;if(tdata.completedOn)this.completedOn=tdata.completedOn;else this.completedOn=null;if(tdata.repetitive)this.repetitive=true;if(tdata.isread)this.isRead=true;else this.isRead=false;if(tdata.otype)this.otype=tdata.otype;else this.otype=null;if(tdata.percentCompleted)this.percentCompleted=tdata.percentCompleted;else this.percentCompleted=0;if(tdata.members)this.members=tdata.members;else this.members=[];if(tdata.timeEstimateString)this.estimatedTime=tdata.timeEstimateString;else this.estimatedTime='';if(tdata.pending_time)this.pending_time=tdata.pending_time;else this.pending_time=0;if(tdata.pending_time_string)this.pending_time_string=tdata.pending_time_string;else this.pending_time_string='';if(tdata.worked_time)this.worked_time=tdata.worked_time;else this.worked_time=0;if(tdata.worked_time_string)this.worked_time_string=tdata.worked_time_string;else this.worked_time_string='';if(tdata.overall_worked_time_string)this.overall_worked_time_string=tdata.overall_worked_time_string;else this.overall_worked_time_string='';if(tdata.totalTimeEstimate)this.totalTimeEstimate=tdata.totalTimeEstimate;else this.totalTimeEstimate=0;if(tdata.totalTimeEstimateString)this.totalTimeEstimateString=tdata.totalTimeEstimateString;else this.totalTimeEstimateString='';if(tdata.timeEstimate)this.TimeEstimate=tdata.timeEstimate;else this.TimeEstimate=0;if(tdata.depCount)this.depCount=tdata.depCount;else this.depCount=null;if(tdata.memPath)this.memPath=tdata.memPath;else this.memPath=[];if(tdata.useDueTime)this.useDueTime=tdata.useDueTime;if(tdata.useStartTime)this.useStartTime=tdata.useStartTime;if(tdata.multiAssignment)this.multiAssignment=tdata.multiAssignment;if(tdata.subtasksIds)this.subtasksIds=tdata.subtasksIds;if(tdata.can_add_timeslots)this.canAddTimeslots=tdata.can_add_timeslots;if(tdata.additional_data)this.additional_data=tdata.additional_data;if(tdata.custom_properties)this.custom_properties=tdata.custom_properties;if(tdata.prevent_add_time_to_parent_task)this.prevent_add_time_to_parent_task=tdata.prevent_add_time_to_parent_task;if(tdata.is_parent)this.is_parent=tdata.is_parent;}
ogTasksMilestone=function(id,title,dueDate,totalTasks,completedTasks,isInternal,isUrgent){this.id=id;this.title=title;var dummyDate=new Date();this.dueDate=dueDate;this.completedTasks=completedTasks;this.totalTasks=totalTasks;this.isInternal=isInternal;this.isUrgent=isUrgent;this.completedById;}
ogTasksCompany=function(id,name){this.id=id;this.name=name;}
ogTasksUser=function(id,name,companyId){this.id=id;this.name=name;this.companyId=companyId;}
ogTasksObjectSubtype=function(id,name){this.id=id;this.name=name;}
ogTasksDependencyCount=function(id,count,dependants){this.id=id;this.count=count;this.dependants=dependants;}
ogTasks.loadDataFromHF=function(){var result=[];var tasksString=document.getElementById('hfTasks').value;result['tasks']=Ext.util.JSON.decode(tasksString);result['internalMilestones']=Ext.util.JSON.decode(document.getElementById('hfIMilestones').value);result['externalMilestones']=Ext.util.JSON.decode(document.getElementById('hfEMilestones').value);result['users']=Ext.util.JSON.decode(document.getElementById('hfUsers').value);result['allUsers']=Ext.util.JSON.decode(document.getElementById('hfAllUsers').value);result['companies']=Ext.util.JSON.decode(document.getElementById('hfCompanies').value);result['objectSubtypes']=Ext.util.JSON.decode(document.getElementById('hfObjectSubtypes').value);result['dependencyCount']=Ext.util.JSON.decode(document.getElementById('hfDependencyCount').value);return ogTasks.loadData(result);}
ogTasks.loadData=function(data){var i;this.Users=[];for(var i=0;i<data['users'].length;i++){var udata=data['users'][i];if(udata.id){var user=new ogTasksUser(udata.id,udata.name,udata.cid);this.Users[ogTasks.Users.length]=user;if(udata.isCurrent)
this.currentUser=user;}}
if(!this.currentUser)this.currentUser=og.loggedUser;this.TotalCols={};var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var drawOptions=topToolbar.getDrawOptions();if(drawOptions.show_time_estimates){this.TotalCols.estimatedTime={title:'estimated',group_total_field:'TimeEstimate',row_field:'estimatedTime'};}
if(drawOptions.show_total_time_estimates){this.TotalCols.totalEstimatedTime={title:'total estimated',group_total_field:'TotalTimeEstimate',row_field:'totalTimeEstimateString'};}
if(drawOptions.show_time_pending){this.TotalCols.pendingTime={title:'pending',group_total_field:'pending_time',row_field:'pending_time_string'};}
if(drawOptions.show_time_worked){this.TotalCols.workedTime={title:'worked',group_total_field:'worked_time',row_field:'worked_time_string'};}
if(drawOptions.show_total_time_worked){this.TotalCols.totalWorkedTime={title:'total worked',group_total_field:'overall_worked_time',row_field:'overall_worked_time_string'};}
this.AllUsers=[];for(var i=0;i<data['allUsers'].length;i++){var udata=data['allUsers'][i];if(udata.id){var user=new ogTasksUser(udata.id,udata.name,udata.cid);this.AllUsers[ogTasks.AllUsers.length]=user;}}
this.Companies=[];for(var i=0;i<data['companies'].length;i++){var cdata=data['companies'][i];if(cdata.id)
this.Companies[ogTasks.Companies.length]=new ogTasksCompany(cdata.id,cdata.name);}
this.Milestones=[];for(var i=0;i<data['internalMilestones'].length;i++){var mdata=data['internalMilestones'][i];if(mdata.id){with(mdata){var milestone=new ogTasksMilestone(id,t,dd,tnum,tc,true,is_urgent);}
if(milestone){if(mdata.compId)milestone.completedById=mdata.compId;if(mdata.compOn)milestone.completedOn=mdata.compOn;this.Milestones[ogTasks.Milestones.length]=milestone;}}}
for(var i=0;i<data['externalMilestones'].length;i++){var mdata=data['externalMilestones'][i];if(mdata.id){with(mdata){var milestone=new ogTasksMilestone(id,t,dd,tnum,tc,false,is_urgent);}
if(mdata.compId)milestone.completedById=mdata.compId;if(mdata.compOn)milestone.completedOn=mdata.compOn;this.Milestones[ogTasks.Milestones.length]=milestone;}}
this.ObjectSubtypes=[];for(var i=0;i<data['objectSubtypes'].length;i++){var otdata=data['objectSubtypes'][i];if(otdata.id){var ot=new ogTasksObjectSubtype(otdata.id,otdata.name);this.ObjectSubtypes[ogTasks.ObjectSubtypes.length]=ot;}}
this.DependencyCount=[];for(var i=0;i<data['dependencyCount'].length;i++){var dcdata=data['dependencyCount'][i];if(dcdata.id){var dc=new ogTasksDependencyCount(dcdata.id,dcdata.count,dcdata.dependants);this.DependencyCount[ogTasks.DependencyCount.length]=dc;}}}
ogTasks.getBottomParent=function(task){if(task.parent)
return this.getBottomParent(task.parent);else
return task;}
ogTasks.TaskSelected=function(checkbox,task_id,group_id){var task=this.getTask(task_id);task.isChecked=checkbox.checked;var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');topToolbar.updateCheckedStatus();}
ogTasks.GroupSelected=function(checkbox,group_id){this.expandGroup(group_id);var group=this.getGroup(group_id);var tasks=[];for(var i in group.group_tasks){tasks.push(group.group_tasks[i]);}
for(var i=0;i<tasks.length;i++){tasks[i].isChecked=checkbox.checked;var tgId="T"+tasks[i].id+'G'+group_id;var chkTask=document.getElementById('ogTasksPanelChk'+tgId);if(chkTask)chkTask.checked=checkbox.checked;var table=document.getElementById('ogTasksPanelTaskTable'+tgId);if(table)
table.className=checkbox.checked?'ogTasksTaskTableSelected':'ogTasksTaskTable';}
var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');topToolbar.updateCheckedStatus();}
ogTasks.updateDependantTasks=function(task_id,add){var task=ogTasksCache.getTask(task_id);var dependant_task;for(var i=0;i<task.dependants.length;i++){dependant_task=ogTasksCache.getTask(task.dependants[i]);if(add){dependant_task.previous_tasks_total++;}else{dependant_task.previous_tasks_total--;}
ogTasks.UpdateTask(task.dependants[i],true);}}
ogTasks.executeAction=function(actionName,ids,options,partent){if(actionName=='start_work'){if(partent!=undefined){var listOfRunningTime=$(partent).find('.og-timeslot-work-started, .og-timeslot-work-paused')
if(listOfRunningTime.length>0&&og.config.stop_running_timeslots==1){listOfRunningTime.each(function(index){var data_id=$(this).parent().find('a:first').attr('data-id');ogTasks.closeTimeslot([data_id],function(status){if(status){ogTasks.executeActionFinal(actionName,ids,options,function(){});}});})}else{ogTasks.executeActionFinal(actionName,ids,options,function(){});}}else{ogTasks.executeActionFinal(actionName,ids,options,function(){})}}else if(actionName=='cancel_work'){if(confirm(lang('confirm discard work timeslot'))){ogTasks.executeActionFinal(actionName,ids,options,function(){});}}else{ogTasks.executeActionFinal(actionName,ids,options,function(){})}}
ogTasks.executeActionFinal=function(actionName,ids,options,callback){if(!ids)
var ids=this.getSelectedIds();og.openLink(og.getUrl('task','multi_task_action'),{method:'POST',post:{"ids":ids.join(','),"action":actionName,"options":options,"req_channel":'task list - '+actionName},callback:function(success,data){if(success&&!data.errorCode&&data.tasks){for(var i=0;i<data.tasks.length;i++){var tdata=data.tasks[i];var task=ogTasksCache.addTasks(tdata);if(actionName=='delete'||actionName=='archive'){if(actionName=='delete'){ogTasks.updateDependantTasks(task.id,false);}
ogTasksCache.removeTask(task);ogTasks.removeTaskFromView(task);}else if(actionName=='close_work'){ogTasks.UpdateTask(task.id,true);}else{ogTasks.UpdateTask(task.id,false);}}
if(actionName=='delete'||actionName=='archive'){var task=data.tasks[data.tasks.length-1];ogTasks.drawElbows(task.parentId);}
var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');topToolbar.updateCheckedStatus();ogTasks.refreshGroupsTotals();if(typeof callback=='function'){callback(success);}}else{if(typeof callback=='function'){callback(false);}}},scope:this});}
ogTasks.setAllCheckedValue=function(checked){for(var i=0;i<this.Tasks.length;i++){this.Tasks[i].isChecked=checked;}}
ogTasks.resetSelection=function(){for(var prop in ogTasksCache.Tasks){var task=ogTasksCache.Tasks[prop];task.isChecked=false;}
ogTasks.setAllCheckedValue(false);}
ogTasks.getSelectedIds=function(){var result=[];for(var prop in ogTasksCache.Tasks){var task=ogTasksCache.Tasks[prop];if(task.isChecked){result.push(task.id);}}
return result;}
ogTasks.setAllExpandedValue=function(expanded){for(var i=0;i<this.Tasks.length;i++){this.Tasks[i].isExpanded=expanded;}}
ogTasks.getUserCompanyName=function(assigned_to){var user=this.getUser(assigned_to,true);if(user){return user.name;}else{user=this.getCompany(assigned_to);if(user){return user.name;}}
return"";}
ogTasks.getTask=function(id){return ogTasksCache.getTask(id);}
ogTasks.removeTask=function(id){for(var i=0;i<this.Tasks.length;i++){if(this.Tasks[i].id==id){if(this.Tasks[i].milestoneId>0){var mstone=ogTasks.getMilestone(this.Tasks[i].milestoneId);if(mstone&&!this.Tasks[i].isCreatedClientSide){mstone.totalTasks-=1;mstone.completedTasks-=(this.Tasks[i].status==0&&(this.Tasks[i].statusOnCreate==1))?1:0?1:0;}}
this.Tasks.splice(i,1);return true;}}
return false;}
ogTasks.redrawTask=function(id){for(var i=0;i<this.Tasks.length;i++){if(this.Tasks[i].id==id){if(this.Tasks[i].milestoneId>0){var mstone=ogTasks.getMilestone(this.Tasks[i].milestoneId);if(mstone&&!this.Tasks[i].isCreatedClientSide){mstone.totalTasks-=1;mstone.completedTasks-=(this.Tasks[i].status==0&&(this.Tasks[i].statusOnCreate==1))?1:0?1:0;}}
this.Tasks.splice(i,1);return true;}}
return false;}
ogTasks.getMilestone=function(id){for(var i=0;i<this.Milestones.length;i++){if(this.Milestones[i].id==id){return this.Milestones[i];}}
return null;}
ogTasks.getUser=function(id,lookInAll){if(lookInAll){for(var i=0;i<this.AllUsers.length;i++){if(this.AllUsers[i].id==id){return this.AllUsers[i];}}}else{for(var i=0;i<this.Users.length;i++){if(this.Users[i].id==id){return this.Users[i];}}}
return null;}
ogTasks.getCompany=function(id){for(var i=0;i<this.Companies.length;i++){if(this.Companies[i].id==id){return this.Companies[i];}}
return null;}
ogTasks.getObjectSubtype=function(id){for(var i=0;i<this.ObjectSubtypes.length;i++){if(this.ObjectSubtypes[i].id==id){return this.ObjectSubtypes[i];}}
return null;}
ogTasks.getDependencyCount=function(id){for(var i=0;i<this.DependencyCount.length;i++){if(this.DependencyCount[i].id==id){return this.DependencyCount[i];}}
return null;}
ogTasks.setSubtasksFromData=function(task,subtdata){for(var j=0;j<task.subtasks.length;j++){var subt=task.subtasks[j];for(var k=0;k<subtdata.length;k++){if(subtdata[k].id==subt.id){subt.setFromTdata(subtdata[k]);break;}}
ogTasks.setSubtasksFromData(subt,subtdata);}}
ogTasks.mouseMovement=function(task_id,group_id,mouse_is_over){if(og.loggedUser.isGuest)return;if(mouse_is_over){if(!task_id)
this.groupMouseOver(group_id);else
this.taskMouseOver(task_id,group_id);ogTaskEvents.lastTaskId=task_id;ogTaskEvents.lastGroupId=group_id;ogTaskEvents.showGroupHeader=group_id==ogTaskEvents.lastGroupId;}else{if(!task_id){ogTaskEvents.mouseOutTimeout=setTimeout('ogTasks.groupMouseOut("'+group_id+'")',20);}else{ogTaskEvents.mouseOutTimeout=setTimeout('ogTasks.taskMouseOut('+task_id+',"'+group_id+'")',20);}
ogTaskEvents.lastTaskId=null;ogTaskEvents.lastGroupId=null;}}
ogTasks.groupMouseOver=function(group_id){var actions=document.getElementById('ogTasksPanelGroupActions'+group_id);if(actions){actions.style.opacity='1.0';actions.style.filter='alpha(opacity=100)';}}
ogTasks.groupMouseOut=function(group_id){if(!ogTaskEvents.lastGroupId||ogTaskEvents.lastGroupId!=group_id){var actions=document.getElementById('ogTasksPanelGroupActions'+group_id);if(actions){actions.style.opacity='0.35';actions.style.filter='alpha(opacity=35)';}}}
ogTasks.taskMouseOver=function(task_id,group_id){var table=document.getElementById('ogTasksPanelTaskTableT'+task_id+'G'+group_id);if(table)
table.className='ogTasksTaskTableSelected';var expander=document.getElementById('ogTasksPanelExpanderT'+task_id+'G'+group_id);if(expander)
expander.style.visibility='visible';var actions=document.getElementById('ogTasksPanelTaskActionsT'+task_id+'G'+group_id);if(actions)
actions.style.visibility='visible';this.groupMouseOver(group_id);}
ogTasks.taskMouseOut=function(task_id,group_id){if(!ogTaskEvents.lastTaskId||ogTaskEvents.lastTaskId!=task_id){var table=document.getElementById('ogTasksPanelTaskTableT'+task_id+'G'+group_id);var chk=document.getElementById('ogTasksPanelChkT'+task_id+'G'+group_id);if(table&&chk)
if(!chk.checked)
table.className='ogTasksTaskTable';var expander=document.getElementById('ogTasksPanelExpanderT'+task_id+'G'+group_id);if(expander)
expander.style.visibility='hidden';var actions=document.getElementById('ogTasksPanelTaskActionsT'+task_id+'G'+group_id);if(actions)
actions.style.visibility='hidden';this.groupMouseOut(group_id);}}
ogTasks.flattenTasks=function(tasks){var result=[];for(var i=0;i<tasks.length;i++){result=result.concat(tasks[i].flatten());}
return result;}
$(function(){});ogTasks.drawAddNewTaskForm=function(group_id,parent_id,level,position,reload,req_channel){var additionalParams={};var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterNamesCompaniesCombo.isVisible()){var value=toolbar.filterNamesCompaniesCombo.getValue();if(value){additionalParams.assigned_to_contact_id=value;}}
if(parent_id>0)
additionalParams.parent_id=parent_id;if(reload>0)
additionalParams.reload=1;if(req_channel){additionalParams.req_channel=req_channel;}
og.render_modal_form('',{c:'task',a:'add_task',params:additionalParams});return;}
ogTasks.drawEditTaskForm=function(task_id,group_id){var task=this.getTask(task_id);var containerName='ogTasksPanelTask'+task.id+'G'+group_id;if(task){og.render_modal_form('',{c:'task',a:'edit_task',params:{id:task.id,use_ajx:1,req_channel:'task list - line edit task'}});}}
ogTasks.checkEnterPress=function(e,id)
{var characterCode;if(e&&e.which){characterCode=e.which;}else{characterCode=e.keyCode;}
if(characterCode==13){ogTasks.SubmitNewTask(id,true);return false;}
return true;}
ogTasks.drawAddNewTaskFromData=function(container_id,req_channel){if(!req_channel)req_channel='task list - grid add task';var task={req_channel:req_channel,name:'',assigned_to_contact_id:0};$("#"+container_id+" :input").each(function(){var input=$(this);task[input.attr("name")]=input.val();input.val("");});var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterNamesCompaniesCombo.isVisible()){var value=toolbar.filterNamesCompaniesCombo.getValue();if(value){task['assigned_to_contact_id']=value;}}
og.render_modal_form('',{c:'task',a:'add_task',params:task});}
ogTasks.drawTaskForm=function(container_id,data){this.hideAddNewTaskForm();var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var drawOptions=topToolbar.getDrawOptions();var padding=(15)-1;var html="<div style='margin-left:"+padding+"px; margin-right:"+padding+"px' class='ogTasksAddTaskForm'>";if(data.member_id&&bottomToolbar.getDisplayCriteria().group_by.indexOf('dimension_')==0){html+="<input type='hidden' id='ogTasksPanelATMemberId' value='"+data.member_id+"'>";}
if(data.parentId>0){var parentTask=ogTasks.getTask(data.parentId);html+="<input type='hidden' id='ogTasksPanelATParentId' value='"+data.parentId+"'>";}
html+="<b>"+lang('title')+":</b><br/>";html+="<input id='ogTasksPanelATTitle' type='text' class='title' name='task[name]' tabIndex=1000 value='' maxlength='255' size='255'>";html+="<table style='width:100%; margin-top:7px'><tr>";html+="<td style='padding-left:10px; margin-right:10px;width:420px;'>";html+="<div id='tasks_quick_add_selectors'>";function dimCombo(dim){var comboHtml='<div style="width: 100%; display: table;">'+'<label style="font-size: 100%;"><b>'+dim.name+':</b></label>'+'<div style="float: right; width: 267px;">'+'<div class="search-selector" id="og_1409320459_864588member-seleector-dim3">'+'<div class="search-input-div">'+'<input type="text" placeholder="'+dim.desc+'" class="search-input ico-search-m">'+'</div>'+'</div>'+'</div>'+'</div>'+'<div style="height: 4px;"></div>';return comboHtml;}
html+="<div id='member_selectors_quick_add'>";for(var x=0;x<og.config.quick_add_task_combos.length;x++){if(og.config.quick_add_task_combos[x]){html+=dimCombo(og.config.quick_add_task_combos[x]);}}
html+="</div>";html+="<div id='ogTasksPanelATAssigned' class='small-member-selector'>"+"<b>"+lang('assigned to')+":&nbsp;</b>"+"<span id='ogTasksPanelATAssignedCont' style='float:right;'></span>"+"</div>";html+="<div id='ogTasksPanelATDates'>";var time_picker_html_start=og.config.use_time_in_task_dates?"<div style='float:left;margin-left: 5px;' id='ogTasksPanelATStartTime'></div>":"";html+="<div id='ogTasksPanelStartDateCont' class='small-member-selector'>"+"<div style='float:left;width: 125px;'><b>"+lang('start date')+":</b></div>&nbsp;"+"<div style='float:right;width: 267px;'>"+"<div style='float:left;' id='ogTasksPanelATStartDate'></div>"+
time_picker_html_start+"</div>"+"</div>";var time_picker_html_duetime=og.config.use_time_in_task_dates?"<div style='float:left;margin-left: 5px;' id='ogTasksPanelATDueTime'></div>":"";html+="<div id='ogTasksPanelDueDateCont' class='small-member-selector'>"+"<div style='float:left;width: 125px;'><b>"+lang('due date')+":</b></div>&nbsp;"+"<div style='float:right;width: 267px;'>"+"<div style='float:left;' id='ogTasksPanelATDueDate'></div>"+
time_picker_html_duetime+"</div>"+"</div>";html+="</div>";if(drawOptions.show_time_estimates){var totalTime=data.time_estimated;var minutes=totalTime%60;var hours=(totalTime-minutes)/60;var minuteOptionsHtml="";var minuteOption=0;for(var i=0;i<12;i++){minuteOption=i*5;minuteOptionsHtml+="<option value=\""+minuteOption+"\"";if(minutes==minuteOption)minuteOptionsHtml+=' selected="selected"';minuteOptionsHtml+=">"+minuteOption+"</option>\n";}
html+="<div id='ogTasksPanelATTime' class='small-member-selector'>"+"<b>"+lang('estimated time')+":</b>"+"<div class='timeSelectors'>"+"<input type='text' id='ogTasksPanelATHours' style='width:25px' tabIndex=1000  name='task[time_estimate_hours]' value='"+hours+"'/>"+"&nbsp;"+
lang('hours')+"&nbsp;"+"<select name='task[time_estimate_minutes]' id='ogTasksPanelATMinutes' size='1' tabindex='1000'>"+
minuteOptionsHtml+"</select>"+"&nbsp;"+
lang('minutes')+"</div>"+"</div>";}
html+="<div id='ogTasksPanelATPriority' class='small-member-selector'>"+"<b>"+lang('priority')+":&nbsp;</b>"+"<span id='ogTasksPanelATPriorityCont' style='float:right;margin-right: 165px;'></span>"+"</div>";html+="<a href='#' class='internalLink' style='float: left;' tabIndex=1000 onclick='ogTasks.TaskFormShowAll("+data.taskId+")' id='ogTasksPanelATShowAll'>"+lang('all options')+"...</a>";html+="<input type='hidden' value='false' name='control_dates' id='control_dates'/>";html+="<div style='display: inline-block; float: left; clear: left;'>";if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){if(data.multiAssignment){html+="<button onclick='if (og.TaskMultiAssignment) {og.TaskMultiAssignment();return false;}' tabIndex=1001 type='submit' class='submit'>"
+(data.isEdit?lang('save changes'):lang('add task'))
+"</button>&nbsp;&nbsp;<button class='submit' tabIndex=1001 onclick='ogTasks.hideAddNewTaskForm();return false;'>"
+lang('cancel')+"</button>";}else{html+="<button onclick='ogTasks.SubmitNewTask("
+data.taskId
+", true);return false;' tabIndex=1001 type='submit' class='submit'>"
+(data.isEdit?lang('save changes'):lang('add task'))
+"</button>&nbsp;&nbsp;<button class='submit' tabIndex=1001 onclick='ogTasks.hideAddNewTaskForm();return false;'>"
+lang('cancel')+"</button>";}}else{html+="<button onclick='ogTasks.SubmitNewTask("
+data.taskId
+", true);return false;' tabIndex=1001 type='submit' class='submit'>"
+(data.isEdit?lang('save changes'):lang('add task'))
+"</button>&nbsp;&nbsp;<button class='submit' tabIndex=1001 onclick='ogTasks.hideAddNewTaskForm();return false;'>"
+lang('cancel')+"</button>";}}else{html+="<button onclick='ogTasks.SubmitNewTask("
+data.taskId
+", true);return false;' tabIndex=1001 type='submit' class='submit'>"
+(data.isEdit?lang('save changes'):lang('add task'))
+"</button>&nbsp;&nbsp;<button class='submit' tabIndex=1001 onclick='ogTasks.hideAddNewTaskForm();return false;'>"
+lang('cancel')+"</button>";}
html+="</div>";html+="</div>";html+="</td>";html+="<td>";if(og.config.wysiwyg_tasks){html+="<div id='ogTasksPanelATDesc'><b>"+lang('description')+":</b><br/>";html+="<textarea id='"+og.genid+"ckeditor"+data.taskId+"' cols='40' rows='10' name='task[text]' class='short ckeditor' tabIndex=1000 style='height:50px'>"+data.description+"</textarea></div>";}else{html+="<div id='ogTasksPanelATDesc'><b>"+lang('description')+":</b><br/>";html+="<textarea id='ogTasksPanelATDescCtl' cols='40' rows='10' name='task[text]' class='short' tabIndex=1000 style='height:50px'>"+data.description+"</textarea></div>";}
if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){html+='<a href="#" class="link-ico ico-add" onclick="addMultiAssignment(\''+og.genid+'\',\'\',\'\',\'\',\'\');return false;">'+lang('add multi assignment')+'</a>';}}
var chkIsVisible=data.assignedTo&&data.assignedTo!='0';var chkIsChecked=parseInt(chkIsVisible&&ogTasks.userPreferences.defaultNotifyValue);if(og.config.show_notify_checkbox_in_quick_add){html+='<div  id="ogTasksPanelATNotifyDiv" style="float: right;"><label for="ogTasksPanelATNotify">'+lang('send notification')+'<input style="width:14px; vertical-align: middle; margin-left: 10px;" type="checkbox" tabindex="1000" name="task[notify]" id="ogTasksPanelATNotify" '+(chkIsChecked?'checked':'')+'/>&nbsp;</label></div>';}
if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){html+=loadMultiAssignmentHtml(data.taskId);}}
html+="<div id='ogTasksPanelATContext' style='padding-top:5px;padding-bottom: 10px; display:none'><table><tr><td style='width:120px;'><b>"+lang('context')+":&nbsp;</b></td><td><input type=\"hidden\" id=\"ogTasksPanelMembers\" name=\"members\" value=\"\"/><div id='ogTasksPanelContextSelector'>";html+=og.popupMemberChooserHtml('',ogTasks.tasks_object_type_id,"ogTasksPanelMembers",data.members,true);html+="</div></td>";html+="</tr></table></div>";html+="<div id='ogTasksPanelATMilestone' style='padding-top:5px; display:none'><table><tr><td style='width:120px;'><b>"+lang('milestone')+":&nbsp;</b></td><td><div id='ogTasksPanelMilestoneSelector'></div></td>";html+="</tr></table></div>";if(data.milestoneId){html+="<input type='hidden' name='task_milestone_id' value='"+data.milestoneId+"'/>";}
html+="<div id='ogTasksPanelATObjectType' style='padding-top:5px;'><table><tr><td style='width:120px;'><b>"+lang('object type')+":&nbsp;</b></td><td><input id='ogTasksPanelObjectTypeSelector' style='min-width:120px;max-width:300px' type='text' value='"+(data.otype?data.otype:og.defaultTaskType)+"' name='task[object_subtype]'/></td></tr></table></div>";html+="</td>";html+="</tr><tr>";html+="</tr></table>";html+='</div>';var div=document.createElement('div');div.className='ogTasksTaskRow';div.id='ogTasksPanelAT';div.innerHTML=html;var modal_params={'escClose':true,'overlayClose':false,'closeHTML':'<a id="ogTasksPanelAT_close_link" class="modal-close"></a>'};if(data.position){modal_params['maxWidth']=($(window).width()-$('#ogTasksPanelListATTitle').offset().left*2);modal_params['position']=[$('#ogTasksPanelListATTitle').offset().top-30,$('#ogTasksPanelListATTitle').offset().left-30];}
$.modal(div,modal_params);var object_subtypes=ogTasks.ObjectSubtypes;var co_types=[];for(var i=0;i<object_subtypes.length;i++){co_types.push([object_subtypes[i].id,og.clean(object_subtypes[i].name)]);}
new Ext.form.ComboBox({store:new Ext.data.SimpleStore({fields:["value","text"],data:co_types}),id:'ogTasksPanelObjectTypeSelector',valueField:'value',displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,valueNotFoundText:'',applyTo:"ogTasksPanelObjectTypeSelector"});if(co_types.length==0){document.getElementById('ogTasksPanelATObjectType').style.display='none';}
var milestoneCombo=bottomToolbar.filterMilestonesCombo.cloneConfig({name:'task[milestone_id]',renderTo:'ogTasksPanelMilestoneSelector',id:'ogTasksPanelATMilestoneCombo',hidden:true,width:200,value:data.milestoneId,tabIndex:1000});ogTasks.selectedMilestone=data.milestoneId;og.openLink(og.getUrl('milestone','get_assignable_milestones'),{callback:ogTasks.drawMilestonesCombo});var get_params={};if(data.members&&data.members.length>0){get_params['member_ids']=data.members;}
var member_to_render=[];if(data.member_id&&data.member_id>0){member_to_render=data.member_id;}else{}
var task_cp_vals=null;if(task_cp_vals){var extra_params={};extra_params['cp_list_values']=[];for(cpi in task_cp_vals){extra_params['cp_list_values'].push({cp_id:cpi,values:task_cp_vals[cpi]});}
get_params['extra_params']=Ext.util.JSON.encode(extra_params);}
ogTasks.assignedTo=data.assignedTo?data.assignedTo:0;og.openLink(og.getUrl('task','allowed_users_to_assign',get_params),{callback:ogTasks.drawAssignedToCombo});if(og.config.quick_add_task_combos.length>0){og.openLink(og.getUrl('member','get_rendered_member_selectors',{id:data.taskId,view_name:'quick_add_task',members:member_to_render,objtypeid:ogTasks.tasks_object_type_id,genid:og.genid,ajax:true}),{callback:function(success,data){$('#member_selectors_quick_add').html(data.htmlToAdd);var height_sel=$("#tasks_quick_add_selectors").height()
$("#ogTasksPanelATDesc").css({height:height_sel+20});if(og.genid in member_selector){for(var dim in og.dimensions_info){if(dim in member_selector[og.genid].properties){member_selector[og.genid].properties[dim].listeners["on_selection_change"]='ogTasks.renderAssignedToCombo()';}}}
var editor=og.getCkEditorInstance(og.genid+'ckeditor'+data.objectId);editor.resize('100%',height_sel);},scope:this});}
document.getElementById('ogTasksPanelATTitle').value=data.title;document.getElementById('ogTasksPanelATTitle').focus();if(data.startDate){var date=new Date(data.startDate*1000);date=new Date(Date.parse(date.toUTCString().slice(0,-4)));var sd=date.dateFormat(og.preferences['date_format']);var starttime=date.dateFormat(og.preferences['time_format_use_24']==1?'G:i':'g:i A');}else sd='';var DtStart=new og.DateField({renderTo:'ogTasksPanelATStartDate',id:'ogTasksPanelATStartDateCmp',style:'width:100px',emptyText:og.preferences.date_format_tip,tabIndex:1000,value:sd});if(data.dueDate){var date=new Date(data.dueDate*1000);date=new Date(Date.parse(date.toUTCString().slice(0,-4)));var dd=date.dateFormat(og.preferences['date_format']);var duetime=date.dateFormat(og.preferences['time_format_use_24']==1?'G:i':'g:i A');}else dd='';var DtDue=new og.DateField({renderTo:'ogTasksPanelATDueDate',id:'ogTasksPanelATDueDateCmp',style:'width:100px',tabIndex:1000,value:dd,emptyText:og.preferences.date_format_tip,listeners:{'change':{fn:function(due,val,old){if(this.getValue()&&this.getValue()>due.getValue()){alert(lang("warning start date greater than due date"));}},scope:DtStart}}});DtStart.on('change',function(start,val,old){if(this.getValue()&&this.getValue()<start.getValue()){alert(lang("warning start date greater than due date"));}},DtDue);if(og.config.use_time_in_task_dates){if(starttime==undefined){var start_time=new Date(og.config.work_day_start_time*1000);start_time=new Date(Date.parse(start_time.toUTCString().slice(0,-4)));starttime=start_time.dateFormat(og.preferences['time_format_use_24']==1?'G:i':'g:i A');}
var startTime=new Ext.form.TimeField({renderTo:'ogTasksPanelATStartTime',id:'ogTasksPanelATStartTimeCmp',width:80,format:og.config.time_format_use_24_duetime,tabIndex:1000,emptyText:'hh:mm',value:starttime});if(duetime==undefined){var date_time=new Date(og.config.work_day_end_time*1000);date_time=new Date(Date.parse(date_time.toUTCString().slice(0,-4)));duetime=date_time.dateFormat(og.preferences['time_format_use_24']==1?'G:i':'g:i A');}
var dueTime=new Ext.form.TimeField({renderTo:'ogTasksPanelATDueTime',id:'ogTasksPanelATDueTimeCmp',width:80,format:og.config.time_format_use_24_duetime,tabIndex:1000,emptyText:'hh:mm',value:duetime});}
var priorityCombo=bottomToolbar.filterPriorityCombo.cloneConfig({name:'task[priority]',renderTo:'ogTasksPanelATPriorityCont',id:'ogTasksPanelATPriorityCombo',hidden:false,width:100,value:data.priority,tabIndex:1000});}
ogTasks.closeModal=function(){$('#ogTasksPanelAT_close_link').click();}
ogTasks.addNewTaskShowMore=function(){document.getElementById('ogTasksPanelATShowMore').style.display='none';document.getElementById('ogTasksPanelATShowAll').style.display='inline';document.getElementById('ogTasksPanelATDesc').style.display='block';if(document.getElementById('ogTasksPanelATDates'))
document.getElementById('ogTasksPanelATDates').style.display='block';if(document.getElementById('ogTasksPanelATPriority'))
document.getElementById('ogTasksPanelATPriority').style.display='block';document.getElementById('ogTasksPanelATAssigned').style.visibility='visible';document.getElementById('ogTasksPanelATContext').style.display='block';document.getElementById('ogTasksPanelATMilestone').style.display='block';if(ogTasks.ObjectSubtypes&&ogTasks.ObjectSubtypes.length>0){document.getElementById('ogTasksPanelATObjectType').style.display='block';}else{document.getElementById('ogTasksPanelATObjectType').style.display='none';}
document.getElementById('ogTasksPanelATDesc').focus();}
ogTasks.TaskFormShowAll=function(task_id){var params=this.GetNewTaskParameters(false,task_id);if(task_id)
og.openLink(og.getUrl('task','edit_task',{id:task_id}),{'post':params});else
og.openLink(og.getUrl('task','add_task'),{'post':params});}
ogTasks.hideAddNewTaskForm=function(){ogTasks.closeModal();var oldForm=document.getElementById('ogTasksPanelAT');if(oldForm)
oldForm.parentNode.removeChild(oldForm);}
ogTasks.GetNewTaskParameters=function(wrapWith,task_id){var parameters=[];var members=$("#"+og.genid+"members").val();parameters.members=members;var parentField=document.getElementById('ogTasksPanelATParentId');if(parentField)
parameters["parent_id"]=parentField.value;var controlDates=document.getElementById('control_dates');if(controlDates)
parameters["control_dates"]=controlDates.value;var hoursPanel=document.getElementById('ogTasksPanelATHours');if(hoursPanel)
parameters["hours"]=hoursPanel.value;var minutePanel=document.getElementById('ogTasksPanelATMinutes');if(minutePanel)
parameters["minutes"]=minutePanel.value;var startPanel=Ext.getCmp('ogTasksPanelATStartDateCmp');if(startPanel&&startPanel.getValue()!=''){parameters["task_start_date"]=startPanel.getValue().format(og.preferences['date_format']);var startTimePanel=Ext.getCmp('ogTasksPanelATStartTimeCmp');if(startTimePanel&&startTimePanel.getValue()!=''){parameters["task_start_time"]=startTimePanel.getValue();}}
var duePanel=Ext.getCmp('ogTasksPanelATDueDateCmp');if(duePanel&&duePanel.getValue()!=''){parameters["task_due_date"]=duePanel.getValue().format(og.preferences['date_format']);var dueTimePanel=Ext.getCmp('ogTasksPanelATDueTimeCmp');if(dueTimePanel&&dueTimePanel.getValue()!=''){parameters["task_due_time"]=dueTimePanel.getValue();}}
var notify=document.getElementById('ogTasksPanelATNotify');if(notify&&notify.style.display!='none'&&notify.checked)
parameters["notify"]=true;else
parameters["notify"]=false;if(og.config.wysiwyg_tasks){var editor=og.getCkEditorInstance(og.genid+'ckeditor'+task_id);parameters["text"]=editor.getData();}else{var description=document.getElementById('ogTasksPanelATDescCtl');parameters["text"]=description?description.value:"";}
var applyMI=document.getElementById('ogTasksPanelApplyMI');parameters["apply_milestone_subtasks"]=applyMI&&applyMI.checked?"checked":"";var applyWS=document.getElementById('ogTasksPanelApplyWS');parameters["apply_ws_subtasks"]=applyWS&&applyWS.checked?"checked":"";var applyAT=document.getElementById('ogTasksPanelApplyAssignee');parameters["apply_assignee_subtasks"]=applyAT&&applyAT.checked?"checked":"";var milestones_combo=Ext.getCmp('ogTasksPanelATMilestoneCombo');var milestone_id=milestones_combo?milestones_combo.getValue():(milestone_hf=document.getElementById('task_milestone_id')?milestone_hf.value:null);if(milestone_id)parameters["milestone_id"]=milestone_id;parameters["assigned_to_contact_id"]=Ext.getCmp('ogTasksPanelATUserCompanyCombo').getValue();parameters["priority"]=Ext.getCmp('ogTasksPanelATPriorityCombo').getValue();parameters["name"]=document.getElementById('ogTasksPanelATTitle').value;parameters["object_subtype"]=Ext.getCmp('ogTasksPanelObjectTypeSelector').getValue();if(member_input=document.getElementById('ogTasksPanelATMemberId')){parameters["member_id"]=member_input.value;}
if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){var applyChange=document.getElementById(og.genid+'multi_assignment_aplly_change');if(applyChange)
parameters["multi_assignment_aplly_change"]=applyChange.value;var multi_assignment={};var assigned_to_contact_id=new Array();var name=new Array();var time_estimate_hours=new Array();var time_estimate_minutes=new Array();var pos=1;var line=0;$("#"+og.genid+"multi_assignment :input").each(function(){if(pos==1){assigned_to_contact_id[line]=$(this).val();}else if(pos==3){name[line]=$(this).val();}else if(pos==4){time_estimate_hours[line]=$(this).val();}else if(pos==5){time_estimate_minutes[line]=$(this).val();}
if(pos==5){pos=1;line++;}else{pos++;}});for(i=0;i<line;i++){multi_assignment[i]={assigned_to_contact_id:assigned_to_contact_id[i],name:name[i],time_estimate_hours:time_estimate_hours[i],time_estimate_minutes:time_estimate_minutes[i]};}}}
if(wrapWith){var params2=[];for(var i in parameters){if(parameters[i]||parameters[i]===0||parameters[i]===""){params2[wrapWith+"["+i+"]"]=parameters[i];}}
if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){params2["multi_assignment"]=Ext.util.JSON.encode(multi_assignment);}}
return params2;}else{if(og.config.multi_assignment==1){if(typeof window.loadMultiAssignmentHtml=='function'){parameters["multi_assignment"]=Ext.util.JSON.encode(multi_assignment);}}
return parameters;}}
ogTasks.SubmitNewTask=function(task_id,view_popup){if(typeof window.og.ControlQuickDates=='function'){var continuing_process=og.ControlQuickDates(task_id);if(!continuing_process){return false;}}
var parameters=this.GetNewTaskParameters('task',task_id);var url='';if(task_id>0){if(view_popup){var related=og.checkRelated("task",task_id);if(related){this.dialog=new og.TaskPopUp("edit",task_id);this.dialog.setTitle(lang('tasks related'));this.dialog.show();return false;}else{url=og.getUrl('task','quick_edit_task',{id:task_id});}}else{var opt=$("#"+og.genid+"type_related").val();parameters["type_related"]=opt;url=og.getUrl('task','quick_edit_task',{id:task_id});}}else{url=og.getUrl('task','quick_add_task');}
og.openLink(url,{method:'POST',post:parameters,callback:function(success,data){if(success&&!data.errorCode){this.drawTaskRowAfterEdit(data);}else{if(!data.errorMessage||data.errorMessage==''){og.err(lang("error adding task"));}}},scope:this});ogTasks.hideAddNewTaskForm();}
ogTasks.drawTaskRowAfterEdit=function(data){if(!data||!data.task)return;var task=ogTasksCache.addTasks(data.task);ogTasks.getGroupsForTask(task.id);var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');if(!topToolbar)return;var drawOptions=topToolbar.getDrawOptions();if(drawOptions.show_subtasks_structure&&task.parentId>0){var parent=ogTasksCache.getTask(task.parentId);ogTasks.reDrawTask(task);}}
ogTasks.drawTasksRowsAfterAddEdit=function(data){if(!data||!data.tasks)return;for(var j=0;j<data.tasks.length;j++){ogTasks.drawTaskRowAfterEdit({'task':data.tasks[j]});}}
ogTasks.sortAssignedCombo=function(a,b){var namea=a[1]?a[1].toLowerCase():'';var nameb=b[1]?b[1].toLowerCase():'';if(namea<nameb)return-1;if(namea>nameb)return 1;return 0;}
ogTasks.buildAssignedToComboStore=function(companies,only_me,groups,for_template_task){if(!for_template_task&&typeof(og.replace_build_assigned_combo_store)=='function'){return og.replace_build_assigned_combo_store.call(null,companies,only_me,groups);}
var usersStore=[];var comp_array=[];var cantU=0;var cantC=0;var preserveSelectedUser=false;if(!only_me){usersStore[cantU++]=['0',lang('dont assign')];}
if(og.config.multi_assignment==1&&groups&&groups.length>0){for(i=0;i<groups.length;i++){var group=groups[i];comp_array[cantC++]=["group-"+group.id,og.clean(group.name)];}
comp_array[cantC++]=['0','--'];}
if(companies){for(i=0;i<companies.length;i++){comp=companies[i];if(!only_me&&comp.id>0){comp_array[cantC++]=[comp.id,og.clean(comp.name)];}
for(j=0;j<comp.users.length;j++){usr=comp.users[j];if(usr.isCurrent){var uname=lang('me')+" ("+usr.name+")";usersStore.unshift([usr.id,uname]);cantU++;}else if(!only_me){usersStore[cantU++]=[usr.id,og.clean(usr.name)];}
if(usr.id==ogTasks.assignedTo){preserveSelectedUser=true;}}}
var me=usersStore.shift();if(!only_me)var dont_assign=usersStore.shift();usersStore.sort(ogTasks.sortAssignedCombo);if(!only_me)usersStore.unshift(dont_assign);usersStore.unshift(me);if(og.config['can_assign_tasks_to_companies']&&comp_array.length>0){usersStore[cantU++]=['0','--'];}}
if(og.config['can_assign_tasks_to_companies']&&comp_array.length>0){usersStore=usersStore.concat(comp_array);}
if(!preserveSelectedUser){ogTasks.assignedTo=0;}
var cleanStore=[];for(x in usersStore){if(usersStore[x]&&typeof(usersStore[x])!='function')cleanStore.push(usersStore[x]);}
return cleanStore;}
ogTasks.buildMilestonesComboStore=function(ms){var milestonesData=[[0,"--"+lang('none')+"--"]];for(i in ms){if(typeof(ms[i])=='function')continue;if(ms[i].id)
milestonesData[milestonesData.length]=[ms[i].id,ms[i].t];}
return milestonesData;}
ogTasks.drawAssignedToCombo=function(success,data){var only_me=data.only_me?data.only_me:null;var usersStore=ogTasks.buildAssignedToComboStore(data.companies,only_me,data.groups);var prev_combo=Ext.get('ogTasksPanelATUserCompanyCombo');if(prev_combo)prev_combo.remove();var namesCombo=new Ext.form.ComboBox({name:'task[assigned_to]',renderTo:'ogTasksPanelATAssignedCont',id:'ogTasksPanelATUserCompanyCombo',store:usersStore,hidden:false,width:265,displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,value:ogTasks.assignedTo,emptyText:(lang('select user or group')+'...'),valueNotFoundText:'',tabIndex:1000,listeners:{'select':function(combo,record){var checkbox=document.getElementById('ogTasksPanelATNotify');if(checkbox){var checkboxDiv=document.getElementById('ogTasksPanelATNotifyDiv');var user=ogTasks.getUser(record.data.value);if(user&&record.data.value!='-1'&&record.data.value!='0'){checkboxDiv.style.display='block';var currentUser=ogTasks.currentUser;if(ogTasks.userPreferences.defaultNotifyValue==1){checkbox.checked=(record.data.value!=(currentUser.id));}else{checkbox.checked=false;}
ogTasks.assignedTo=combo.getValue();}else{checkboxDiv.style.display='none';checkbox.checked=false;}}}}});}
ogTasks.renderAssignedToCombo=function(){var member_ids_input=Ext.fly(Ext.get(og.genid+member_selector[og.genid].hiddenFieldName));var selected_members=member_ids_input.getValue();var slected_user=Ext.getCmp('ogTasksPanelATUserCompanyCombo').getValue();var task_user=$("#ogTasksPanelATUserCompanyCombo");if(task_user&&task_user.is(":visible")){var get_params={};get_params['member_ids']=JSON.parse(selected_members).toString();ogTasks.assignedTo=slected_user;og.openLink(og.getUrl('task','allowed_users_to_assign',get_params),{callback:ogTasks.drawAssignedToCombo});}}
ogTasks.drawMilestonesCombo=function(success,data){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');mStore=ogTasks.buildMilestonesComboStore(data.milestones);prev_combo=Ext.get('ogTasksPanelATMilestoneCombo');if(prev_combo){m_val=Ext.getCmp('ogTasksPanelATMilestoneCombo').getValue();var found=false;for(var i=0;i<mStore.length;i++){if(mStore[i][0]==m_val){ogTasks.selectedMilestone=mStore[i][0];found=true;break;}}
if(!found)ogTasks.selectedMilestone=0;prev_combo.remove();}
var milestoneCombo=bottomToolbar.filterMilestonesCombo.cloneConfig({name:'task[milestone_id]',renderTo:'ogTasksPanelMilestoneSelector',id:'ogTasksPanelATMilestoneCombo',store:mStore,hidden:false,width:200,value:ogTasks.selectedMilestone,tabIndex:1000});}
ogTasks.drawAddSubTaskInputs=function(genid,data){if(!data)data={};if(!data.id)data.id=0;if(!data.name)data.name='';if(!data.assigned_to)data.assigned_to=0;if(!ogTasks.subtask_count)ogTasks.subtask_count={};if(!ogTasks.subtask_count[genid])ogTasks.subtask_count[genid]=0;var i=ogTasks.subtask_count[genid];var html='<div class="subtask-inputs-container '+genid+'">';html+='<div class="inputs-container">';html+='<input type="hidden" name="task[subtasks]['+i+'][id]" value="'+data.id+'">';html+='<input type="text" name="task[subtasks]['+i+'][name]" value="'+data.name+'" placeholder="'+lang('task')+'" class="subtask-name">';html+='<input type="hidden" name="task[subtasks]['+i+'][assigned_to]" value="'+data.assigned_to+'" id="'+genid+'_'+i+'_assigned_to">';html+='<input type="hidden" name="task[subtasks]['+i+'][deleted]" value="0" id="'+genid+'_'+i+'_deleted" class="deleted-hf">';html+='</div>';html+='<div id="'+genid+'_'+i+'assigned_to_container" class="assigned-container"></div>';html+='<div class="remove-link-container">';html+='<a href="#" class="link-ico ico-delete remove-subtask-link" onclick="this.parentNode.parentNode.style.display=\'none\'; document.getElementById(\''+genid+'_'+i+'_deleted\').value=1; document.getElementById(\''+genid+'undo_remove\').style.display=\'\'">'+lang('remove')+'</a>';html+='</div><div class="clear"></div></div>';$('#'+genid+'subtasks').append(html);if(!ogTasks.usersStore||!ogTasks.usersStore[genid]){var parameters=og.contextManager.plainContext()?{context:og.contextManager.plainContext()}:{};og.openLink(og.getUrl('task','allowed_users_to_assign',parameters),{callback:function(success,d){only_me=d.only_me?d.only_me:null;ogTasks.usersStore[genid]=ogTasks.buildAssignedToComboStore(d.companies,only_me,d.groups);ogTasks.drawAddSubTaskAssignedToInput(ogTasks.usersStore[genid],data,genid,i);}});}else{ogTasks.drawAddSubTaskAssignedToInput(ogTasks.usersStore[genid],data,genid,i);}
ogTasks.subtask_count[genid]=ogTasks.subtask_count[genid]+1;}
ogTasks.drawAddSubTaskAssignedToInput=function(usersStore,data,genid,i){var container=document.getElementById(genid+'_'+i+'assigned_to_container');if(!container){return;}
only_me=data.only_me?data.only_me:null;var stAssignCombo=new Ext.form.ComboBox({subtask_index:i,renderTo:genid+'_'+i+'assigned_to_container',name:'subtask_assigned_to_'+i,id:genid+'subtask_assigned_to_'+i,value:data.assigned_to,store:usersStore,displayField:'text',mode:'local',cls:'assigned-to-combo',triggerAction:'all',selectOnFocus:true,valueField:'value',emptyText:(lang('select user or group')+'...')});stAssignCombo.on('select',function(combo,record,index){var hf=document.getElementById(genid+'_'+combo.subtask_index+'_assigned_to');if(hf)hf.value=combo.getValue();});}
ogTasks.applyAssignedToSubtasksInTaskForm=function(genid){if($('#'+genid+'taskFormApplyAssignee').attr('checked')=='checked'){var combos_aux=$('.assigned-to-combo');for(var i=0;i<combos_aux.length;i++){if(combos_aux[i].id.indexOf(genid+'subtask_assigned_to_')>=0){var combo=Ext.getCmp(combos_aux[i].id);var original_assigned=document.getElementById(genid+'taskFormAssignedTo');if(original_assigned){combo.setValue(original_assigned.value);var idx=combos_aux[i].id.substring(combos_aux[i].id.lastIndexOf('_')+1);$('#'+genid+'_'+idx+'_assigned_to').val(original_assigned.value);}}}}}
ogTasks.undoRemoveSubtasks=function(genid){$('.'+genid+'.subtask-inputs-container').show();$('#'+genid+'undo_remove').hide();var inputs=$('.'+genid+'.subtask-inputs-container input.deleted-hf');for(var i=0;i<inputs.length;i++){$(inputs[i]).val(0);}}
og.init_rep_by_selectbox=function(genid){var sd=Ext.getCmp(genid+"start_date").getValue();var dd=Ext.getCmp(genid+"due_date").getValue();if(!dd||!sd){if(!dd&&!sd){$("#"+genid+"_rep_by_warning").show();}else{$("#"+genid+"_rep_by_warning").hide();if(!dd){$("#"+genid+"_rep_by").val("start_date");}else if(!sd){$("#"+genid+"_rep_by").val('due_date');}}}}
ogTasks.draw=function(){ogTasks.resetSelection();if(!ogTasks.Groups.loaded){ogTasks.resetPaginationVariables();ogTasks.getGroups();return;}
ogTasks.Groups.loaded=false;ogTasks.LevelMultiplier=20;if(typeof ogTasks.userPreferences.showTasksListAsGantt!='undefined'&&ogTasks.userPreferences.showTasksListAsGantt){return;}
var start=new Date();for(var i=0;i<this.Tasks.length;i++)
this.Tasks[i].divInfo=[];var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');if(!bottomToolbar||!topToolbar)return;var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();var sb=new StringBuffer();var header_html=ogTasks.newTaskFormTopList();if($("#ogTasksPanelColNamesThead").length==0){sb.append(header_html);}
var first_group_to_draw_index=-1;for(var i=0;i<this.Groups.length;i++){var gr_html=this.drawGroup(displayCriteria,drawOptions,this.Groups[i]);if(gr_html){if(first_group_to_draw_index==-1){first_group_to_draw_index=i;}
sb.append(gr_html);}}
if(this.Groups.length==0&&ogTasks.groupsPaginationOffset==0){var context_names=og.contextManager.getActiveContextNames();if(context_names.length==0)context_names.push(lang('all'));sb.append('<tr id="no_tasks_info"><td colspan="10">'+'<div class="inner-message">'+lang('no tasks to display','"'+context_names.join('", "')+'"')+'</div>'+'</td></tr>');}
if(this.Groups.length==0){ogTasks.allGroupsLoaded=true;}
var container=document.getElementById('tasksPanelContainer');if(container){if(ogTasks.groupsPaginationOffset==0){container.innerHTML='';}
container.innerHTML+=sb.toString();}
ogTasks.initColResize();if(this.Groups.length!=0){ogTasks.drawAllGroupsTasks(first_group_to_draw_index);}
ogTasks.initDragDrop();}
ogTasks.initColResize=function(){$("#tasksPanelContainer").colResizable({disable:true});$("#tasksPanelContainer").colResizable({fixed:false,minWidth:50,postbackSafe:true,disable:false});}
ogTasks.toggleSubtasks=function(taskId,groupId,not_expand){var expander=document.getElementById('ogTasksPanelFixedExpanderT'+taskId+'G'+groupId);var task=this.getTask(taskId);if($("[data-level!='1'][data-parent-id='"+taskId+"']").length){task.isExpanded=!task.isExpanded;if(task.isExpanded&&not_expand!=true){$("[data-parent-id='"+taskId+"']").show();}else{$("[data-parent-id='"+taskId+"']").hide();if(task.subtasksIds&&task.subtasksIds.length>0){task.subtasksIds.forEach(function(value){ogTasks.toggleSubtasks(value,groupId,true);});}}}else{if(task.subtasksIds.length>0&&not_expand!=true&&!task.toggleSubtasksShow){task.isExpanded=!task.isExpanded;og.getSubTasksAndDraw(task,groupId);task.toggleSubtasksShow=true;}}
if(expander){expander.className="og-task-expander "+((task.isExpanded)?'toggle_expanded':'toggle_collapsed');}}
ogTasks.loadAllDescriptions=function(task_ids){ogTasks.all_descriptions_loaded=false;og.openLink(og.getUrl('task','get_task_descriptions'),{hideLoading:true,scope:this,method:'POST',post:{ids:task_ids.join(',')},callback:function(success,data){for(i=0;i<ogTasks.Tasks.length;i++){var task=ogTasks.Tasks[i];if(data.descriptions['t'+task.id]){task.description=data.descriptions['t'+task.id];}}
ogTasks.all_descriptions_loaded=true;}});}
ogTasks.drawGroup=function(displayCriteria,drawOptions,group){if($("#ogTasksPanelGroup"+group.group_id).length>0)return'';group.view=[];if(displayCriteria.group_by=='milestone'){var sb=new StringBuffer();var milestone=this.getMilestone(group.group_id);if(milestone){if(milestone.isUrgent){group.group_icon='ico-urgent-milestone';}
if(milestone.completedById){var user=this.getUser(milestone.completedById,true);var tooltip='';if(user){var time=new Date(milestone.completedOn*1000);var now=new Date();var timeFormatted=time.getYear()!=now.getYear()?time.dateFormat('M j, Y'):time.dateFormat('M j');tooltip=lang('completed by name on',og.clean(user.name),timeFormatted).replace(/'\''/g,'\\\'');}
group.group_name="<a href='#' style='text-decoration:line-through' class='internalLink' onclick='og.openLink(\""+og.getUrl('milestone','view',{id:group.group_id})+"\")' title='"+tooltip+"'>"+og.clean(group.group_name)+'</a>';}else{group.group_name="<a href='#' class='internalLink' onclick='og.openLink(\""+og.getUrl('milestone','view',{id:group.group_id})+"\")'>"+og.clean(group.group_name)+'</a>';}
var date=new Date();date.setTime((milestone.dueDate+date.getTimezoneOffset()*60)*1000);var now=new Date();var dateFormatted=date.getYear()!=now.getYear()?date.dateFormat('M j, Y'):date.dateFormat('M j');css_class="milestone-date";if(milestone.completedById>0){css_class="milestone-date milestone-completed";}else{if((date<now))
css_class="milestone-date milestone-delayed";}
group.view.push({id:'ogTasksPanelMileGroupDate'+group.group_id,text:lang('due')+':&nbsp;'+dateFormatted,css_class:css_class});group.view.push({id:'ogTasksPanelCompleteBar'+group.group_id,text:this.drawMilestoneCompleteBar(group),css_class:"group-milestone-complete-bar"});}}
var mem_path="";var mpath=Ext.util.JSON.decode(group.group_memPath);if(mpath)mem_path=og.getEmptyCrumbHtml(mpath,".task-breadcrumb-container");var source=$("#task-list-group-template").html();var template=Handlebars.compile(source);var data={group:group,mem_path:mem_path,cols_total:ogTasks.TasksList.tasks_list_cols.length}
var html=template(data);html=html+ogTasks.newTaskGroupTotals(group);return html;}
ogTasks.newTaskGroupTotals=function(group){var source=$("#task-list-group-totals-template").html();var template=Handlebars.compile(source);var total_cols=[];for(var i=0;i<ogTasks.TasksList.tasks_list_cols.length;i++){if(ogTasks.TasksList.tasks_list_cols[i].id=="task_name"){var total=lang('total')+':';}else{var total=group[ogTasks.TasksList.tasks_list_cols[i].group_total_field];}
total_cols.push({id:ogTasks.TasksList.tasks_list_cols[i].id,text:total});}
var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var drawOptions=topToolbar.getDrawOptions();drawOptions.groupId=group.group_id;if(group.total_tasks_loaded<group.root_total){drawOptions.showMore=true;}else{drawOptions.showMore=false;}
var data={draw_options:drawOptions,group:group,total_cols:total_cols}
if(ogTasks.additional_task_list_columns){data.additional_task_list_columns=ogTasks.additional_task_list_columns;}
var html=template(data);return html;}
ogTasks.drawMilestoneCompleteBar=function(group){var html='';var milestone=this.getMilestone(group.group_id);if(!milestone)return html;var complete=0;var completedTasks=parseInt(milestone.completedTasks);var totalTasks=parseInt(milestone.totalTasks);var tasks=this.flattenTasks(group.group_tasks);for(var i=0;i<tasks.length;i++){var t=tasks[i];if(t.milestoneId==group.group_id){completedTasks+=(t.status==1&&(t.statusOnCreate==0))?parseInt(1):parseInt(0);completedTasks-=(t.status==0&&(t.statusOnCreate==1))?parseInt(1):parseInt(0);totalTasks=(t.isCreatedClientSide)?totalTasks+parseInt(1):totalTasks+parseInt(0);}}
if(totalTasks>0)
complete=((100*completedTasks)/totalTasks);html+="<table><tr><td style='padding-left:15px;padding-top:5px'>"+"<table style='height:7px;width:50px'><tr><td style='height:7px;width:"+(complete)+"%;background-color:#6C2'></td><td style='width:"+(100-complete)+"%;background-color:#DDD'></td></tr></table>"+"</td><td style='padding-left:3px;line-height:12px'><span style='font-size:8px;color:#AAA'>("+completedTasks+'/'+totalTasks+")</span></td></tr></table>";return html;}
ogTasks.minutesToHoursAndMinutes=function(minutes){var total_estimate_split=Math.round(minutes*100/60)/100;var total_estimate=(total_estimate_split+'').split(".");var hours_estimate=total_estimate[0]+" "+lang('hours');var minutes_estimate="";if(total_estimate[1]){if(total_estimate[1].length==1){minutes_estimate=", "+Math.round(((total_estimate[1]*60)/10))+" "+lang('minutes');}else{minutes_estimate=", "+Math.round(((total_estimate[1]*60)/100))+" "+lang('minutes');}
var format_total_estimate=hours_estimate+minutes_estimate;}else{var format_total_estimate=hours_estimate;}
return format_total_estimate;}
ogTasks.drawGroupActions=function(group){var html='<a id="ogTasksPanelGroupSoloOn'+group.group_id+'" style="margin-right:15px;display:'+(group.solo?"none":"inline")+'" href="#" class="internalLink" onClick="ogTasks.hideShowGroups(\''+group.group_id+'\')" title="'+lang('hide other groups')+'">'+(lang('hide others'))+'</a>'+'<a id="ogTasksPanelGroupSoloOff'+group.group_id+'" style="display:'+(group.solo?"inline":"none")+';margin-right:15px;" href="#" class="internalLink" onClick="ogTasks.hideShowGroups(\''+group.group_id+'\')" title="'+lang('show all groups')+'">'+(lang('show all'))+'</a>'+'<a href="#" class="internalLink ogTasksGroupAction ico-print" style="margin-right:15px;" onClick="ogTasks.printGroup(\''+group.group_id+'\')" title="'+lang('print this group')+'">'+(lang('print'))+'</a>';if(ogTasks.userPermissions.can_add){html+='<a href="#" class="internalLink ogTasksGroupAction ico-add" onClick="ogTasks.drawAddNewTaskForm(\''+group.group_id+'\', 0, 0, 0, 0, \'task list - add task to group\')" title="'+lang('add a new task to this group')+'">'+(lang('add task'))+'</a>';}
return html;}
ogTasks.hideShowGroups=function(group_id){var group=this.getGroup(group_id);if(group){var soloOn=document.getElementById('ogTasksPanelGroupSoloOn'+group_id);var soloOff=document.getElementById('ogTasksPanelGroupSoloOff'+group_id);group.solo=!group.solo;soloOn.style.display=group.solo?'none':'inline';soloOff.style.display=group.solo?'inline':'none';for(var i=0;i<this.Groups.length;i++){if(this.Groups[i].group_id!=group_id){var groupEl=document.getElementById('ogTasksPanelGroup'+this.Groups[i].group_id);if(groupEl)
groupEl.style.display=group.solo?'none':'block';}}
if(group.solo)
this.expandGroup(group_id);else
this.collapseGroup(group_id);}}
ogTasks.expandGroup=function(group_id){var div=document.getElementById('ogTasksGroupExpandTasks'+group_id);var divLink=document.getElementById('ogTasksGroupExpandTasksTitle'+group_id);if(div){var group=this.getGroup(group_id);group.isExpanded=true;var html='';var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();for(var i=og.noOfTasks;i<group.group_tasks.length;i++)
html+=this.drawTask(group.group_tasks[i],drawOptions,displayCriteria,group.group_id,1);div.innerHTML=html;divLink.style.display='none';ogTasks.expandedGroups.push(group.group_id);var btns=$("#ogTasksGroupExpandTasks"+group_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);og.eventManager.fireEvent('replace all empty breadcrumb',null);}}
ogTasks.collapseGroup=function(group_id){var div=document.getElementById('ogTasksGroupExpandTasks'+group_id);var divLink=document.getElementById('ogTasksGroupExpandTasksTitle'+group_id);if(div){var group=this.getGroup(group_id);group.isExpanded=false;div.innerHTML='';divLink.style.display='block';}}
ogTasks.expandCollapseAllTasksGroup=function(group_id){var group=this.getGroup(group_id);if(group){var expander=document.getElementById('ogTasksPanelGroupExpanderG'+group_id);if(group.alltasks_collapsed){group.alltasks_collapsed=false;if(expander)expander.className='og-task-expander toggle_expanded';}else{group.alltasks_collapsed=true;if(expander)expander.className='og-task-expander toggle_collapsed';}
$("#ogTasksPanelGroup"+group.group_id+" .task-list-row").slideToggle();}}
ogTasks.drawAddTask=function(id_subtask,group_id,level){var padding=(15*(level+1))+ogTasks.LevelMultiplier;return'<div class="ogTasksTaskRow" style="padding-left:'+padding+'px">'+'</div>';}
ogTasks.drawGroupNextTask=function(group,drawOptions,displayCriteria){var task_id=group.group_tasks_order[group.task_interval_iteration];ogTasks.drawTask(group.group_tasks[task_id],drawOptions,displayCriteria,group.group_id,1);var clocks=$(".og-timeslot-work-started span");for(i=0;i<clocks.length;i++){var clockId=clocks[i].id;clockId=clockId.replace("timespan","");var user_start_time=parseInt($("#"+clockId+"user_start_time").val());og.startClock(clockId,user_start_time);}
$("#tasksPanel"+og.genid).parent().css('overflow','hidden');var btns=$(".tasksActionsBtn").toArray();og.initPopoverBtns(btns);++group.task_interval_iteration;if(group.task_interval_iteration==group.group_tasks_order.length){clearInterval(group.task_interval);++ogTasks.Groups.group_interval_iteration;var group=ogTasks.Groups[ogTasks.Groups.group_interval_iteration];if(typeof group!='undefined'){ogTasks.drawGroupTasks(group);}else{if(ogTasks.Groups.group_interval_iteration==ogTasks.Groups.length){ogTasks.initColResize();og.eventManager.fireEvent('replace all empty breadcrumb',null);ogTasks.isLoadingGroups=false;var task_content_div=$("#tasksPanelContent").get(0);if(!ogTasks.allGroupsLoaded&&task_content_div&&task_content_div.scrollHeight<=task_content_div.clientHeight){ogTasks.loadMoreGroups();}}}}}
ogTasks.drawGroupTasks=function(group){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();group.isExpanded=ogTasks.expandedGroups.indexOf(group.group_id)>-1;group.task_interval_iteration=0;group.task_interval=setInterval(function(){ogTasks.drawGroupNextTask(group,drawOptions,displayCriteria)},50);};ogTasks.drawAllGroupsTasks=function(first_group_to_draw_index){og.loading();if(!first_group_to_draw_index||first_group_to_draw_index<0){ogTasks.Groups.group_interval_iteration=0;}else{ogTasks.Groups.group_interval_iteration=first_group_to_draw_index;}
var group=ogTasks.Groups[ogTasks.Groups.group_interval_iteration];ogTasks.drawGroupTasks(group);og.hideLoading();};ogTasks.drawTask=function(task,drawOptions,displayCriteria,group_id,level,target,returnHtml){if(!task)return;var pos=(task.divInfo&&!isNaN(task.divInfo.length))?task.divInfo.length:0;task.divInfo[pos]={group_id:group_id,drawOptions:drawOptions,displayCriteria:displayCriteria,group_id:group_id,level:level};var html=this.drawTaskRow(task,drawOptions,displayCriteria,group_id,level,returnHtml);if(typeof returnHtml!='undefined'){return html;}else if(typeof target!='undefined'){$(target).append(html);}else{$("#ogTasksPanelGroup"+group_id).append(html);}}
ogTasks.removeTaskFromView=function(task){$("[id^='ogTasksPanelTask"+task.id+"']").each(function(index){$(this).remove();});if(task.parentId>0){var parent=ogTasksCache.getTask(task.parentId);if(typeof parent!="undefined"&&parent.subtasksIds.length==0){ogTasks.reDrawTask(parent);}}}
ogTasks.reDrawTask=function(task){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();if(drawOptions.show_subtasks_structure){if(task.parentId>0){var parent=ogTasksCache.getTask(task.parentId);if(typeof parent!='undefined'){$("[id^='ogTasksPanelSubtasksT"+parent.id+"']").each(function(index){var group_id=$(this).attr('id');var remove="ogTasksPanelSubtasksT"+task.id+"G";group_id=group_id.replace(remove,"");if($("#ogTasksPanelTask"+task.id+"G"+group_id).length==0){var html=ogTasks.drawTask(task,drawOptions,displayCriteria,group_id,$(this).attr("data-level"),null,true);$(this).append(html);var btns=$("#ogTasksPanelTask"+task.id+"G"+group_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);}});$("[id^='ogTasksPanelTask"+parent.id+"']").each(function(index){var group_id=$(this).attr('id');var remove="ogTasksPanelTask"+parent.id+"G";group_id=group_id.replace(remove,"");var html=ogTasks.drawTask(parent,drawOptions,displayCriteria,group_id,$(this).attr("data-level"),null,true);$("#ogTasksPanelTask"+parent.id+"G"+group_id).replaceWith(html);var btns=$("#ogTasksPanelTask"+parent.id+"G"+group_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);});}}else{if($("[id^='ogTasksPanelTask"+task.id+"']").length==0){ogTasks.Groups.loaded=false;ogTasks.draw();return;}}}else{if($("[id^='ogTasksPanelTask"+task.id+"']").length==0){ogTasks.Groups.loaded=false;ogTasks.draw();return;}}
$("[id^='ogTasksPanelTask"+task.id+"']").each(function(index){var group_id=$(this).attr('id');var remove="ogTasksPanelTask"+task.id+"G";group_id=group_id.replace(remove,"");var html=ogTasks.drawTask(task,drawOptions,displayCriteria,group_id,$(this).attr("data-level"),null,true);$("#ogTasksPanelTask"+task.id+"G"+group_id).replaceWith(html);var btns=$("#ogTasksPanelTask"+task.id+"G"+group_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);});var clocks=$(".og-timeslot-work-started span");for(i=0;i<clocks.length;i++){var clockId=clocks[i].id;clockId=clockId.replace("timespan","");var user_start_time_string=$("#"+clockId+"user_start_time + span").html();if(user_start_time_string!=""){var time_array=user_start_time_string.split(':');var seconds=parseInt(time_array[0]*60*60)+parseInt(time_array[1]*60)+parseInt(time_array[2]);}else{var seconds=0;}
og.startClock(clockId,seconds);}
og.eventManager.fireEvent('replace all empty breadcrumb',null);if(task.parentId>0){ogTasks.drawElbows(task.parentId);}}
ogTasks.drawTaskRow=function(task,drawOptions,displayCriteria,group_id,level,returnHtml){var sb=new StringBuffer();var tgId="T"+task.id+'G'+group_id;if(!returnHtml&&$("#tasksPanel"+og.genid+" #ogTasksPanelTask"+task.id+"G"+group_id).length>0){return;}
var priorityColor="priority-default";if(typeof task.priority!='undefined'){priorityColor="priority-"+task.priority;}
var showSubtasksExpander=false;var subtasksExpander="toggle_collapsed";if(drawOptions.show_subtasks_structure&&task.subtasksIds.length>0){showSubtasksExpander=true;if(task.isExpanded){subtasksExpander="toggle_expanded";}}
var assignedTo=false;if(task.assignedToId){assignedTo=og.allUsers[task.assignedToId];}
var assignedBy=false;if(task.assignedById){assignedBy=og.allUsers[task.assignedById];}
taskName=task.title;var tooltip='';if(task.status>0){var user=this.getUser(task.completedById,true);if(user){var time=new Date(task.completedOn*1000);var now=new Date();var timeFormatted=time.getYear()!=now.getYear()?time.dateFormat('M j, Y'):time.dateFormat('M j');tooltip=lang('completed by name on',og.clean(user.name),timeFormatted).replace(/'\''/g,'\\\'');}}
mem_path="";var mpath=typeof(task.memPath)=='string'?Ext.util.JSON.decode(task.memPath):{};if(mpath)mem_path=og.getEmptyCrumbHtml(mpath,".task-breadcrumb-container",og.breadcrumbs_skipped_dimensions);var dim_classification=new Array();drawOptions.show_dimension_cols=drawOptions.show_dimension_cols.filter(function(x){return(x!='')});for(var x=0;x<drawOptions.show_dimension_cols.length;x++){did=drawOptions.show_dimension_cols[x];var dim_mpath={};var exclude_parents_path=false;if(!isNaN(did)){dim_mpath[did]=mpath[did];}
if(ogTasks.override_task_dim_col_value&&ogTasks.override_task_dim_col_value.length>0){for(var i=0;i<ogTasks.override_task_dim_col_value.length;i++){var fn=ogTasks.override_task_dim_col_value[i];if(typeof(fn)=='function'){var result=fn.call(null,did,mpath);if(result){dim_mpath=result.dim_mpath;exclude_parents_path=result.exclude_parents_path;}}}}
if(isNaN(did)){for(z in dim_mpath){did=z;break;}}
if(og.config.enabled_dimensions.indexOf(did+"")==-1){continue;}
var dim_mem_path="";if(typeof mpath[did]!="undefined"){dim_mem_path=og.getEmptyCrumbHtml(dim_mpath,".task-breadcrumb-container",null,null,exclude_parents_path,true);}
var key='lp_dim_'+did+'_show_as_column';if(og.preferences['listing_preferences'][key]){dim_classification.push({id:'task_clasification_dim_'+drawOptions.show_dimension_cols[x],dim_mem_path:dim_mem_path});}}
var start_date='';task.already_started=false;if(task.startDate){var date=new Date(task.startDate*1000);date=new Date(Date.parse(date.toUTCString().slice(0,-4)));var hm_format=task.useStartTime?(og.preferences['time_format_use_24']==1?' <br> G:i':' <br> g:i A'):'';var now=new Date();var dateFormatted=date.getYear()!=now.getYear()?date.dateFormat('M j, Y'+hm_format):date.dateFormat('M j'+hm_format);start_date=dateFormatted;if(date<now)task.already_started=true;}
var due_date='';var due_date_late=false;if(task.dueDate){var date=new Date((task.dueDate)*1000);date=new Date(Date.parse(date.toUTCString().slice(0,-4)));var hm_format=task.useDueTime?(og.preferences['time_format_use_24']==1?' <br> G:i':' <br> g:i A'):'';var now=new Date();var dateFormatted=date.getYear()!=now.getYear()?date.dateFormat('M j, Y'+hm_format):date.dateFormat('M j'+hm_format);due_date=dateFormatted;if(task.status==0&&date<now){due_date_late=true;}}
var userIsWorking=false;var userPaused=false;var userStartTime=0;var userState='started';var userPausedTime='';var workingOnUsers=new Array();var showWorkingOnUsers=false;if(drawOptions.show_time){if(task.workingOnIds){var ids=(task.workingOnIds+' ').split(',');for(var i=0;i<ids.length;i++){if(this.currentUser&&ids[i]==this.currentUser.id){userIsWorking=true;userStartTime=task.workingOnTimes[i];var pauses=(task.workingOnPauses+' ').split(',');userPaused=pauses[i]==1;if(userPaused){userState='paused';userPausedTime=og.calculateTimeForClock(new Date(),userStartTime);}}else{var usrId=parseInt(ids[i]);workingOnUsers.push(og.allUsers[usrId]);showWorkingOnUsers=true;}}}}
if(drawOptions.show_time_quick){}
var taskActions=new Array();taskActions.push({act_collapsed:!drawOptions.show_quick_add_sub_tasks,act_onclick:"ogTasks.drawAddNewTaskForm",act_onclick_param:[{param_val:"'"+group_id+"',"},{param_val:task.id+","},{param_val:level+","},{param_val:"'',"},{param_val:"0,"},{param_val:"'task list - line add subtask'"}],act_text:lang('add subtask'),act_id:"ogTasksPanelExpander"+tgId,act_class:"add-subtask-link ico-add coViewAction"});taskActions.push({act_collapsed:!drawOptions.show_quick_edit,act_onclick:"ogTasks.drawEditTaskForm",act_onclick_param:[{param_val:task.id+","},{param_val:"'"+group_id+"'"}],act_text:lang('edit'),act_class:"ico-edit coViewAction"});if(task.mark_as_started){taskActions.push({act_collapsed:!drawOptions.show_quick_mark_as_started,act_onclick:"ogTasks.ToggleChangeMarkAsStarted",act_onclick_param:[{param_val:task.id}],act_text:lang('unmark as started this task'),act_class:"ico-undo coViewAction"});}else{taskActions.push({act_collapsed:!drawOptions.show_quick_mark_as_started,act_onclick:"ogTasks.ToggleChangeMarkAsStarted",act_onclick_param:[{param_val:task.id}],act_text:lang('mark as started this task'),act_class:"ico-start coViewAction"});}
if(task.status){taskActions.push({act_collapsed:!drawOptions.show_quick_complete,act_onclick:"ogTasks.ToggleCompleteStatus",act_onclick_param:[{param_val:task.id+","},{param_val:task.status}],act_text:lang('reopen this task'),act_class:"ico-reopen coViewAction"});}else{taskActions.push({act_collapsed:!drawOptions.show_quick_complete,act_onclick:"ogTasks.ToggleCompleteStatus",act_onclick_param:[{param_val:task.id+","},{param_val:task.status}],act_text:lang('complete this task'),act_class:"ico-complete coViewAction"});}
for(var i=taskActions.length;i>0;i--){if(taskActions[i-1].act_collapsed){taskActions[i-1].act_last=true;break;}}
var collapsed_actions=0;var show_quick_actions_container=false;for(var i=taskActions.length;i>0;i--){if(!taskActions[i-1].act_collapsed){show_quick_actions_container=true;}else{collapsed_actions++;}}
var show_actions_popover_button=collapsed_actions>0;waiting_tasks=task.dependants;var row_total_cols=[];for(var key in ogTasks.TotalCols){var row_field=ogTasks.TotalCols[key].row_field;var color='#888';if(row_field=='worked_time_string'&&task.TimeEstimate!='0'&&task.TimeEstimate<task.worked_time){color='#f00';}
row_total_cols.push({text:task[row_field],color:color});}
var row_dim_cols=[];for(did in og.dimensions_info){if(isNaN(did))continue;var key='lp_dim_'+did+'_show_as_column';if(og.preferences['listing_preferences'][key]){}}
if(typeof ogTasks.task_list_row_template=="undefined"){var source=$("#task-list-row-template").html();var template=Handlebars.compile(source);ogTasks.task_list_row_template=template;}
var action_trigger="focus";var is_safari=navigator.userAgent?navigator.userAgent.indexOf("Safari")>-1:false;var is_safari_vendor=navigator.vendor?navigator.vendor.indexOf("Apple")>-1:false;if(is_safari&&is_safari_vendor){action_trigger="click";}
color_start_date="#888";if(task.already_started&&!task.mark_as_started){color_start_date="#F00";}
var data={task:task,task_actions:taskActions,action_trigger:action_trigger,show_quick_actions_container:show_quick_actions_container,show_actions_popover_button:show_actions_popover_button,can_add_timeslots:task.canAddTimeslots,genid:og.genid,start_date:start_date,due_date:due_date,due_date_late:due_date_late,draw_options:drawOptions,subtasksExpander:subtasksExpander,showSubtasksExpander:showSubtasksExpander,priorityColor:priorityColor,tgId:tgId,group_id:group_id,assigned_to_show_name:og.config.tasks_show_assigned_to_name,assigned_to:assignedTo,assigned_by:assignedBy,view_url:og.getUrl('task','view',{id:task.id}),task_name:taskName,tool_tip:tooltip,mem_path:mem_path,dim_classification:dim_classification,percent_completed_bar:ogTasks.buildTaskPercentCompletedBar(task),level:level,user_is_working:userIsWorking,user_paused:userPaused,user_paused_time:userPausedTime,user_state:userState,user_start_time:userStartTime,working_on_users:workingOnUsers,show_working_on_users:showWorkingOnUsers,row_total_cols:row_total_cols,color_start_date:color_start_date}
if(ogTasks.additional_task_list_columns){data.additional_task_list_columns=[];for(var i=0;i<ogTasks.additional_task_list_columns.length;i++){var col=ogTasks.additional_task_list_columns[i];data.additional_task_list_columns.push({id:col.id,cls:col.cls?col.cls:'',html:task.additional_data[col.id]?task.additional_data[col.id].html:''});}}
var html=ogTasks.task_list_row_template(data);sb.append(html);return sb.toString();}
ogTasks.closeTimeslot=function(tId,callback){if(og.config.tasks_show_description_on_time_forms){var source=$("#small-task-timespan-template").html();var template=Handlebars.compile(source);var data={taskId:tId,genid:og.genid}
var html=template(data);var modal_params={'escClose':true,'overlayClose':true,'minWidth':400,'minHeight':200,'closeHTML':'<a id="ogTasksPanelAT_close_link" class="modal-close modal-close-img"></a>'};$.modal(html,modal_params);$("#small-task-timespan-modal-form"+og.genid).submit(function(event){var parameters=[];var form_params=$(this).serializeArray();for(i=0;i<form_params.length;i++){parameters[form_params[i].name]=form_params[i].value;}
ogTasks.executeActionFinal("close_work",tId,parameters['timeslot[description]'],callback);ogTasks.closeModal();event.preventDefault();});}else{ogTasks.executeActionFinal("close_work",tId,'',callback);}}
ogTasks.drawSubtasks=function(params){var task=ogTasksCache.getTask(params.task_id);var group_id=params.group_id;var $task_view=$('#ogTasksPanelTask'+task.id+'G'+group_id);var subtasks_container_id='SubtasksT'+task.id+'G'+group_id;var level=parseInt($task_view.attr("data-level"))+ogTasks.LevelMultiplier;var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();task.subtasksIds=task.subtasksIds.reverse();for(var i=0;i<task.subtasksIds.length;i++){var subtask=ogTasks.getTask(task.subtasksIds[i]);var subtask_row=ogTasks.drawTask(subtask,drawOptions,displayCriteria,group_id,level,null,1);subtask_row=$(subtask_row).attr("class",$task_view.attr("class"));$task_view.after(subtask_row);}
var btns=$("."+subtasks_container_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);og.eventManager.fireEvent('replace all empty breadcrumb',null);ogTasks.drawElbows(params.task_id);}
ogTasks.refresElbows=function(task_id){var task_parent_id=$("[data-task-id='"+task_id+"']").first().attr("data-parent-id");var task_grand_id=$("[data-task-id='"+task_parent_id+"']").first().attr("data-parent-id");ogTasks.drawElbows(task_grand_id);ogTasks.drawElbows(task_parent_id);}
ogTasks.removeTaskToRefreshElbows=function(parent_id){$("[data-parent-id="+parent_id+"]").each(function(index,element){var $element=$(element);var current_task_id=$element.attr("data-task-id");if($("[data-parent-id="+current_task_id+"]").length>0){ogTasks.removeTaskToRefreshElbows(current_task_id);}
$element.remove();});var $toggle=$("[data-task-toggle="+parent_id+"]").first();$toggle.removeClass("toggle_expanded").addClass("toggle_collapsed");$toggle.click();$toggle.removeClass("toggle_collapsed").addClass("toggle_expanded");}
ogTasks.drawElbows=function(parentTaskId){var task_level=parseInt($("[data-parent-id='"+parentTaskId+"']").attr("data-level"));var $parent=$("[data-task-id='"+parentTaskId+"']").first();var margin_of_level=task_level/2;var count_of_eblow_lines=0;var margin_elbow_line=0;if(task_level<=21){margin_of_level=0;}else{count_of_eblow_lines=parseInt((task_level-ogTasks.LevelMultiplier)/ogTasks.LevelMultiplier);var elbows_line_parent=$parent.find(".task-elbow-line").length;if($parent.find("[data-elbow-type]").hasClass("task-elbow-end")){count_of_eblow_lines=elbows_line_parent;if(elbows_line_parent>0){margin_elbow_line=parseInt($parent.find(".task-elbow-line").css('marginLeft').replace("px",""));}}else{if(elbows_line_parent==0){if($parent.find(".task-elbow").length>0){margin_elbow_line=parseInt($parent.find(".task-elbow").css('marginLeft').replace("px",""));}
count_of_eblow_lines=1}else{count_of_eblow_lines=elbows_line_parent+1;}}}
$("[data-parent-id='"+parentTaskId+"'][data-elbow-line-container]").removeClass("task-elbow");$("[data-parent-id='"+parentTaskId+"']").each(function(index,value){var $value=$(value);for(var i=count_of_eblow_lines;i>0;i--){var margin_line=(((i-1)*ogTasks.LevelMultiplier)+margin_elbow_line);if(i==count_of_eblow_lines){var my_parent=$("[data-task-id="+$value.attr('data-parent-id')+"]").first();if(my_parent.find(".task-elbow").length>0){margin_line=parseInt(my_parent.find(".task-elbow").css('marginLeft').replace("px",""));}else{var elbow=my_parent.find(".task-elbow-line").last().css('marginLeft');if(elbow){margin_line=parseInt(elbow.replace("px",""));}}}
$value.find("[data-elbow-line-container]").prepend("<span class='task-elbow-line' style='margin-left: "+margin_line+"px;'></span>");}
$value.find("[data-elbow-type]").addClass("task-elbow").css("marginLeft",parseInt(margin_of_level));if(margin_of_level>0){$value.find("[data-task-span-name]").css("marginLeft",parseInt(margin_of_level)+25);}});$('.tasks-panel-group').each(function(i,v){var rowAux=$(v).find("[data-parent-id='"+parentTaskId+"'].task-list-row-template:last");rowAux.find("[data-elbow-type]").removeClass("task-elbow").addClass("task-elbow-end").css("marginLeft",parseInt(margin_of_level));});}
ogTasks.ToggleCompleteStatus=function(task_id,status){var related=false;if(status==0){var task=ogTasks.getTask(task_id);for(var j=0;j<task.subtasks.length;j++){if(task.subtasks[j].status==0){related=true;}
if(related){break;}}}
if(related){this.dialog=new og.TaskCompletePopUp(task_id);this.dialog.setTitle(lang('do complete'));this.dialog.show();}else{ogTasks.ToggleCompleteStatusOk(task_id,status,'');}}
ogTasks.ToggleCompleteStatusOk=function(task_id,status,opt){var action=(status==0)?'complete_task':'open_task';og.openLink(og.getUrl('task',action,{id:task_id,quick:true,options:opt,req_channel:'task list - line '+action}),{callback:function(success,data){if(success||!data.errorCode){if(data.task){var task=ogTasksCache.addTasks(data.task);if(task.status){ogTasks.updateDependantTasks(task.id,false);}else{ogTasks.updateDependantTasks(task.id,true);}
ogTasks.UpdateTask(task.id,false);}else{ogTasks.UpdateTask(task_id,true);}
if(data.more_tasks){for(var j=0;j<data.more_tasks.length;j++){ogTasks.drawTaskRowAfterEdit({'task':data.more_tasks[j]});}}
ogTasks.refreshGroupsTotals();}},scope:this});}
ogTasks.ToggleChangeMarkAsStarted=function(task_id){og.openLink(og.getUrl('task',"change_mark_as_started",{id:task_id,quick:true,req_channel:'task list - line mark as started'}),{callback:function(success,data){if(!success||data.errorCode){}else{if(data.task){var task=ogTasksCache.addTasks(data.task);ogTasks.UpdateTask(task.id,false);}else{ogTasks.UpdateTask(task_id,true);}
ogTasks.refreshGroupsTotals();}},scope:this});}
ogTasks.loadTimeslotUsers=function(genid,task_id){og.openLink(og.getUrl('timeslot','get_users_for_timeslot',{task_id:task_id}),{callback:function(success,data){if(data.users&&data.users.length>0){for(var i=0;i<data.users.length;i++){var u=data.users[i];var sel=u.id==og.loggedUser.id?'selected="selected"':'';$('#'+genid+'tsUser').append('<option value="'+u.id+'" '+sel+'>'+u.name+'</option>');}
$('#'+genid+'tsUserContainer').show();}else{$('#'+genid+'tsUser').remove();$('#'+genid+'tsUserContainer').append('<input type="hidden" name="timeslot[contact_id]" value="'+og.loggedUser.id+'" />');}}});}
ogTasks.AddWorkTime=function(task_id){og.render_modal_form('',{c:'time',a:'add',params:{object_id:task_id,contact_id:og.loggedUser.id,dont_reload:1,req_channel:'task list - add worked hours'}});return;}
ogTasks.readTask=function(task_id,isUnRead){var task=ogTasks.getTask(task_id);if(!isUnRead){og.openLink(og.getUrl('task','multi_task_action'),{method:'POST',post:{ids:task_id,action:'markasread',req_channel:'task list - mark as read'},callback:function(success,data){if(!success||data.errorCode){}else{var td=document.getElementById('ogTasksPanelMarkasTd'+task_id);td.innerHTML="<div title=\""+lang('mark as unread')+"\" id=\"readunreadtask"+task_id+"\" class=\"db-ico ico-read\" onclick=\"ogTasks.readTask("+task_id+",true)\" />";task.isRead=true;}}});}else{og.openLink(og.getUrl('task','multi_task_action'),{method:'POST',post:{ids:task_id,action:'markasunread',req_channel:'task list - mark as unread'},callback:function(success,data){if(!success||data.errorCode){}else{var td=document.getElementById('ogTasksPanelMarkasTd'+task_id);td.innerHTML="<div title=\""+lang('mark as read')+"\" id=\"readunreadtask"+task_id+"\" class=\"db-ico ico-unread\" onclick=\"ogTasks.readTask("+task_id+",false)\" />";task.isRead=false;}}});}}
ogTasks.UpdateTask=function(task_id,from_server){if(typeof from_server!='undefined'&&from_server){og.openLink(og.getUrl('task','get_task_data',{id:task_id,task_info:true}),{callback:function(success,data){if(!success||data.errorCode){}else{ogTasks.drawTaskRowAfterEdit(data);}},scope:this});}else{var task=ogTasksCache.getTask(task_id);ogTasks.reDrawTask(task);ogTasks.refresElbows(task_id);}}
ogTasks.buildTaskPercentCompletedBar=function(task){var color_cls='task-percent-completed-';if(task.percentCompleted<25)color_cls+='0';else if(task.percentCompleted<50)color_cls+='25';else if(task.percentCompleted<75)color_cls+='50';else if(task.percentCompleted<100)color_cls+='75';else if(task.percentCompleted==100)color_cls+='100';else color_cls+='more-estimate';var percent_complete=100;if(task.percentCompleted<=100){percent_complete=task.percentCompleted;}
var html="<span><span class='nobr'><table style='display:inline;'><tr><td style='padding-left:15px;padding-top:6px'>"+"<table style='height:7px;width:50px'><tr><td style='height:7px;width:"+percent_complete+"%;' class='"+color_cls+"'></td><td style='width:"+(100-percent_complete)+"%;background-color:#DDD'></td></tr></table>"+"</td><td style='padding-left:3px;line-height:12px'><span class='percent_num' style='font-size:8px;color:#777'>"+percent_complete+"%</span></td></tr></table></span></span>";return html;}
ogTasks.UpdateDependants=function(task,complete,prev_status){var deps=this.getDependencyCount(task.id);if(deps){var dependants=deps.dependants.split(',');for(var i=0;i<dependants.length;i++){var dependant_id=dependants[i];var dc=this.getDependencyCount(dependant_id);if(dc){if(complete){dc.count-=1;this.UpdateTask(dependant_id);}else{if(prev_status==1){dc.count+=1;var dep=this.getTask(dependant_id);dep.status=0;this.UpdateTask(dependant_id);this.UpdateDependants(dep,false);}}}}}}
ogTasks.initTasksList=function(){var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var drawOptions=topToolbar.getDrawOptions();var tasks_list_cols=[];tasks_list_cols.push({id:'task_actions',col_width:'70px'});if(drawOptions.show_by){tasks_list_cols.push({id:'task_assigned_by_id',title:lang('by uppercase'),group_total_field:'',data:'data-resizable=1',row_field:'assignedById',col_width:'30px'});}
tasks_list_cols.push({id:'task_assigned_to_id',title:lang('to'),group_total_field:'',data:'data-resizable=1',row_field:'assignedToId',col_width:'30px'});tasks_list_cols.push({id:'task_name',title:lang('task'),data:'data-resizable=1',group_total_field:'',row_field:'title',col_width:'auto'});if(drawOptions.show_classification){tasks_list_cols.push({id:'task_clasification',title:lang('classified under'),data:'data-resizable=1',group_total_field:'',row_field:'memPath',col_width:'auto'});}
for(x in drawOptions.show_dimension_cols){did=drawOptions.show_dimension_cols[x];ot_id=null;if(typeof(did)=='function')continue;if(isNaN(did)&&did.indexOf("-")!=-1){exp=did.split("-");did=exp[0];if(!isNaN(ot_id))ot_id=exp[1];}
if(did==0||!og.dimensions_info[did])continue;var key='lp_dim_'+did+'_show_as_column';if(og.preferences['listing_preferences'][key]){var col_name=og.dimensions_info[did].name;if(ot_id){col_name=og.objectTypes[ot_id].c_name_plural?og.objectTypes[ot_id].c_name_plural:lang(og.objectTypes[ot_id].name+'s');}
tasks_list_cols.push({id:'task_clasification'+drawOptions.show_dimension_cols[x],css_class:'task_clasification',title:col_name,data:'data-resizable=1',group_total_field:'',col_width:'auto'});}}
if(drawOptions.show_percent_completed_bar){tasks_list_cols.push({id:'task_completed_bar',title:lang('completed'),group_total_field:'',row_field:'ogTasks.buildTaskPercentCompletedBar(task)',col_width:'100px'});}
if(drawOptions.show_start_dates){tasks_list_cols.push({id:'task_start_date',title:lang('start m'),group_total_field:'',row_field:'startDate',col_width:'100px'});}
if(drawOptions.show_end_dates){tasks_list_cols.push({id:'task_due_date',title:lang('due m'),group_total_field:'',row_field:'dueDate',col_width:'100px'});}
if(drawOptions.show_time_estimates){tasks_list_cols.push({id:'task_estimated',title:lang('estimated'),group_total_field:'estimatedTime',row_field:'estimatedTime',col_width:'100px'});}
if(drawOptions.show_total_time_estimates){tasks_list_cols.push({id:'task_total_estimated',title:lang('total estimated'),group_total_field:'totalEstimatedTime',row_field:'totalTimeEstimateString',col_width:'100px'});}
if(drawOptions.show_time_pending){tasks_list_cols.push({id:'task_pending',title:lang('pending'),group_total_field:'pending_time_string',row_field:'pending_time_string',col_width:'100px'});}
if(drawOptions.show_time_worked){tasks_list_cols.push({id:'task_worked',title:lang('worked'),group_total_field:'worked_time_string',row_field:'worked_time_string',col_width:'100px'});}
if(drawOptions.show_total_time_worked){tasks_list_cols.push({id:'task_total_worked',title:lang('total worked'),group_total_field:'overall_worked_time_string',row_field:'overall_worked_time_string',col_width:'100px'});}
if(ogTasks.additional_task_list_columns){for(var i=0;i<ogTasks.additional_task_list_columns.length;i++){var col=ogTasks.additional_task_list_columns[i];var field=col.row_field?col.row_field:col.id;var total_field=col.group_total_field?col.group_total_field:'';var width=col.width?col.width:'100px';if(drawOptions[col.id]){tasks_list_cols.push({id:col.id,title:col.name,data:col.data?col.data:'',group_total_field:total_field,row_field:field,col_width:width});}}}
if(drawOptions.show_previous_pending_tasks){tasks_list_cols.push({id:'task_previous',title:lang('previous tasks'),group_total_field:'',row_field:'previous_tasks_total',col_width:'100px'});}
for(x in ogTasks.custom_properties){var cp=ogTasks.custom_properties[x];if(typeof(cp)=='object'&&ogTasks.userPreferences['tasksShowCP_'+cp.id]==1){tasks_list_cols.push({id:'cp_'+cp.id,css_class:'',title:cp.name,data:'data-resizable=1',group_total_field:'',col_width:'auto'});}}
tasks_list_cols.push({id:'task_quick_actions',col_width:'100px'});tasks_list_cols.push({id:'task_btn_actions',col_width:'100px'});ogTasks.TasksList.tasks_list_cols=tasks_list_cols;}
ogTasks.newTaskFormTopList=function(){ogTasks.initTasksList();var title_cols=[];var source=$("#task-list-col-names-template").html();var template=Handlebars.compile(source);var add_btn_position='task_quick_actions';for(var i=0;i<ogTasks.TasksList.tasks_list_cols.length;i++){var col=ogTasks.TasksList.tasks_list_cols[i];if(ogTasks.TasksList.tasks_list_cols[i].id=='task_name'){add_btn_position=ogTasks.TasksList.tasks_list_cols[i+1].id;}}
var data={tasks_list_cols:ogTasks.TasksList.tasks_list_cols,add_btn_position:add_btn_position,genid:og.genid}
var html=template(data);return html;}
ogTasks.initDragDrop=function(){$(".tasks-panel-group").sortable({connectWith:".tasks-panel-group-droppable:not(.ui-sortable-helper)",stop:function(event,object,c,d){ogTasks.processTaskDrop(event,object);$(".dragging").removeClass("dragging");var add_trs=$(object.item).children('.task-list-row');for(var i=0;i<add_trs.length;i++){var tr=add_trs[i];$(tr).remove();$(object.item).after(tr);}},helper:function(e,item){var ids_str=ogTasks.getSelectedIds()+'';var selected_ids=ids_str.split(',');$(item).addClass('dragging');var html=item;var processed_ids=[item[0].id];for(var i=0;i<selected_ids.length;i++){var sel_task=ogTasks.getTask(selected_ids[i]);if(sel_task&&sel_task.divInfo&&sel_task.divInfo[0]){var sel_el_id="ogTasksPanelTask"+sel_task.id+"G"+sel_task.divInfo[0].group_id;var sel_el=$("#"+sel_el_id);if(sel_el.length>0&&processed_ids.indexOf(sel_el[0].id)==-1){$(sel_el).addClass('dragging');$(html).append(sel_el[0]);processed_ids.push(sel_el[0].id);}}}
return html;},handle:".ddhandle",cursor:"move",dropOnEmpty:false,placeholder:"tasks-dd-placeholder"});$(".tasks-panel-group").disableSelection();};ogTasks.processTaskDrop=function(event,object){if(object.item.length>0&&object.item[0].parentNode&&object.item[0].parentNode.id){var from_group_id=event.target.id.replace("ogTasksPanelGroup","");var to_group_id=object.item[0].parentNode.id.replace("ogTasksPanelGroup","");var task_id=object.item[0].id.replace("ogTasksPanelTask","");var gpos=task_id.indexOf("G");if(gpos>=0){task_id=task_id.substring(0,gpos);}
var ids_str=ogTasks.getSelectedIds()+'';ids_str+=(ids_str==''?'':',')+task_id;var task_ids=ids_str.split(',');var valid_dropzone=$(event.toElement).closest(".tasks-panel-group-droppable");var member_id=null;var dimension_id=null;if(event.toElement.hasAttribute("ext:tree-node-id")){var node_id=$(event.toElement).attr("ext:tree-node-id");if(!isNaN(node_id)){member_id=node_id;}
dimension_id=parseInt($(event.toElement).closest(".x-panel.x-tree").attr('id').replace('dimension-panel-',''));}else if(event.toElement.id.indexOf("extdd-")>=0){var node_id=$(event.toElement).closest(".x-tree-node-el").attr("ext:tree-node-id");if(!isNaN(node_id)){member_id=node_id;}
dimension_id=parseInt($(event.toElement).closest(".x-panel.x-tree").attr('id').replace('dimension-panel-',''));}
if(dimension_id!=null&&!isNaN(dimension_id)){ogTasks.cancelDrop();ogTasks.classifyTasks(task_ids,member_id,dimension_id,from_group_id);}else{if(valid_dropzone.length>0&&from_group_id!=to_group_id){ogTasks.changeTasksGroup(task_ids,from_group_id,to_group_id);}else{ogTasks.cancelDrop();}}}}
ogTasks.cancelDrop=function(){try{$(".tasks-panel-group").sortable("cancel");}catch(e){}}
ogTasks.changeTasksGroup=function(task_ids,from_group_id,to_group_id){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var filters=bottomToolbar.getFilters();var displayCriteria=bottomToolbar.getDisplayCriteria();if(displayCriteria.group_by.indexOf('dimension_')>=0){var dimension_id=displayCriteria.group_by.replace('dimension_','');ogTasks.classifyTasks(task_ids,to_group_id,dimension_id,from_group_id);}else{switch(displayCriteria.group_by){case'assigned_to':case'priority':case'status':case'milestone':ogTasks.editTasksAttribute(task_ids,displayCriteria.group_by,to_group_id,from_group_id);break;case'due_date':case'start_date':ogTasks.promptDate(task_ids,displayCriteria.group_by,to_group_id,from_group_id);break;default:ogTasks.cancelDrop();break;}}}
ogTasks.promptDate=function(task_ids,attribute,to_group_id,from_group_id){var extid=Ext.id();var title=(attribute=='due_date'?lang('new due date'):lang('new start date'));var description=(attribute=='due_date'?lang('new due date desc'):lang('new start date desc'));var source=$("#change-tasks-date").html();var template=Handlebars.compile(source);var html=template({genid:extid,attribute:attribute,title:title,description:description});var modal_params={'escClose':true,'overlayClose':true,'minWidth':400,'minHeight':200,'closeHTML':'<a id="ogTasksPanelAT_close_link" class="modal-close modal-close-img"></a>','onClose':function(dialog){ogTasks.cancelDrop();$.modal.close();},'onShow':function(dialog){var dtp=new og.DateField({renderTo:extid+'_date_picker_container',name:'new_date_value',emptyText:og.preferences.date_format_tip,id:extid+'_date_picker',value:''});}};$.modal(html,modal_params);$("#change-tasks-date-modal-form-"+extid).submit(function(event){var date_picker=Ext.getCmp(extid+"_date_picker");var dp_value=date_picker.getValue();var date_value=dp_value?dp_value.format(og.preferences.date_format):'';ogTasks.editTasksAttribute(task_ids,attribute,date_value,from_group_id);$.modal.close();return false;});}
ogTasks.editTasksAttribute=function(task_ids,attribute,new_value,from_group_id){var params={task_ids:Ext.util.JSON.encode(task_ids),attribute:attribute,new_value:new_value,req_channel:'task list - edit attribute '+attribute};og.openLink(og.getUrl('task','edit_tasks_attribute'),{method:'POST',post:params,callback:function(success,data){for(var x=0;x<task_ids.length;x++){var t=ogTasks.getTask(task_ids[x]);if(t){$("#ogTasksPanelTask"+t.id+"G"+from_group_id).remove();ogTasks.UpdateTask(t.id,true);}}}});}
ogTasks.classifyTasks=function(task_ids,member_id,dimension_id,from_group_id){var multiple_sel=task_ids.length>1;var is_classified_in_dim=false;for(var i=0;i<task_ids.length;i++){var task=ogTasks.getTask(task_ids[i]);var classification=Ext.util.JSON.decode(task.memPath);var task_classified_in_dim=classification&&typeof(classification[dimension_id])=='object';if(task_classified_in_dim){is_classified_in_dim=true;}}
var rm_prev=0;var after_classification_fn=function(ids,mem_id){for(var x=0;x<ids.length;x++){var t=ogTasks.getTask(ids[x]);if(t){$("#ogTasksPanelTask"+t.id+"G"+from_group_id).remove();ogTasks.UpdateTask(t.id,true);}}}
var member_type_id=0;var mem_array=og.getMemberFromTrees(dimension_id,member_id);if(mem_array&&mem_array.length>0){member_type_id=mem_array[0].ot;}
var tasks_type=og.get_object_type_by_name('task');var allows_multiple_classification=og.dimension_object_type_contents[dimension_id]&&og.dimension_object_type_contents[dimension_id][member_type_id]&&og.dimension_object_type_contents[dimension_id][member_type_id][tasks_type.id]&&og.dimension_object_type_contents[dimension_id][member_type_id][tasks_type.id].multiple;if(is_classified_in_dim&&allows_multiple_classification&&!isNaN(member_id)&&member_id>0){if(og.preferences['drag_drop_prompt']=='prompt'){og.drag_drop_classification_keep_or_move_prompt('',null,task_ids,member_id,null,true,after_classification_fn);}else{if(og.preferences['drag_drop_prompt']=='move'){var rm_prev=1;}else if(og.preferences['drag_drop_prompt']=='keep'){var rm_prev=0;}
og.call_add_objects_to_member(null,task_ids,member_id,null,true,rm_prev,after_classification_fn);}}else{if(isNaN(member_id)||member_id==null){og.call_add_objects_to_member(null,task_ids,null,null,true,rm_prev,after_classification_fn,dimension_id);}else{og.call_add_objects_to_member(null,task_ids,member_id,null,true,true,after_classification_fn);}}}
ogTasks.createDimensionColumnMenuItems=function(did,option_name,ignore_listing_preferences){var menu_items=[];var key='lp_dim_'+did+'_show_as_column';if(ignore_listing_preferences||og.preferences['listing_preferences'][key]){if(og.dimensions_info[did]){var general_item=ogTasks.createDimensionColumnMenuItem(did,og.dimensions_info[did].name,did,option_name);menu_items.push(general_item);}
if(ogTasks.list_dimension_column_hooks){for(var j=0;j<ogTasks.list_dimension_column_hooks.length;j++){var fn=ogTasks.list_dimension_column_hooks[j];if(typeof(fn)=='function'){more_items=fn.call(null,did,option_name);if(more_items&&more_items.length>0){menu_items=menu_items.concat(more_items);}}}}
if(ogTasks.userPreferences.showDimensionCols.indexOf(did)!=-1){og.breadcrumbs_skipped_dimensions[did]=did.toString();}else{og.breadcrumbs_skipped_dimensions[did]=0;}}
return menu_items;}
ogTasks.createDimensionColumnMenuItem=function(did,label,menu_key,option_name){if(!option_name)option_name='tasksShowDimensionCols';var checked=ogTasks.userPreferences.showDimensionCols.indexOf(menu_key)!=-1;if(option_name.indexOf("gantt")==0){checked=ogTasks.ganttPreferences.ganttShowDimensionCols.indexOf(menu_key)!=-1;}
var menu_config={option_name:option_name,text:label,value:menu_key,checked:checked,hideOnClick:false,checkHandler:function(){if(this.option_name.indexOf("gantt")==0){var dim_index=ogTasks.ganttPreferences.ganttShowDimensionCols.indexOf(this.value);if(dim_index!=-1){ogTasks.ganttPreferences.ganttShowDimensionCols.splice(dim_index,1);}else{ogTasks.ganttPreferences.ganttShowDimensionCols.push(this.value);}}else{var dim_index=ogTasks.userPreferences.showDimensionCols.indexOf(this.value);if(dim_index!=-1){ogTasks.userPreferences.showDimensionCols.splice(dim_index,1);}else{ogTasks.userPreferences.showDimensionCols.push(this.value);}}
var opt_val=ogTasks.userPreferences.showDimensionCols.toString();if(this.option_name.indexOf("gantt")==0){checked=ogTasks.ganttPreferences.ganttShowDimensionCols.toString();}
var url=og.getUrl('account','update_user_preference',{name:this.option_name,value:opt_val});if(this.value.indexOf("-")==-1&&this.option_name.indexOf("gantt")==-1){var d=this.value.toString();if(ogTasks.userPreferences.showDimensionCols.indexOf(d)!=-1){og.breadcrumbs_skipped_dimensions[d]=d;}else{og.breadcrumbs_skipped_dimensions[d]=0;}}
ogTasksMakeRequestAndReloadWithTimeout(url);}};return menu_config;}
ogTasksCache={'Tasks':{}};ogTasksCache.addTasks=function(task_data){var task=new ogTasksTask();task.setFromTdata(task_data);this.Tasks[task.id]=task;if(task.parentId>0){var parent=ogTasksCache.getTask(task.parentId);if(typeof parent!="undefined"){if(parent.subtasksIds.indexOf(task.id)==-1){parent.subtasksIds.push(task.id);}}}
return task;};ogTasksCache.getTask=function(id){return this.Tasks[id];};ogTasksCache.removeTask=function(task){if(task.parentId>0){var parent=ogTasksCache.getTask(task.parentId);if(typeof parent!="undefined"&&parent.subtasksIds.indexOf(task.id)!=-1){parent.subtasksIds.splice(parent.subtasksIds.indexOf(task.id),1);}}
delete ogTasksCache.Tasks.id;};ogTasks.addNewTaskGroup=function(data,group_index,draw){var group={};for(var key in data.groups[group_index]){if(key!='group_tasks'){group[key]=data.groups[group_index][key];}}
group.group_tasks={};group.group_tasks_order=new Array();group.total_tasks_loaded=0;group.total=parseInt(group.total);group.root_total=parseInt(group.root_total);group.offset=parseInt(og.noOfTasks);if(typeof draw!='undefined'&&draw){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();var group_html=ogTasks.drawGroup(displayCriteria,drawOptions,group);if(typeof group.group_order!='undefined'){var target_order=0;var target_id=0;for(var i=0;i<ogTasks.Groups.length;i++){if(ogTasks.Groups[i].group_order>target_order&&ogTasks.Groups[i].group_order<group.group_order){target_order=ogTasks.Groups[i].group_order;target_id=ogTasks.Groups[i].group_id;}}
if(target_id==0){$("#ogTasksPanelAddNewTaskThead").after(group_html);}else{$("#ogTasksPanelGroup"+target_id+"Totals").after(group_html);}}else{$("#tasksPanelContainer").append(group_html);}};for(var j=0;j<data.groups[group_index].group_tasks.length;j++){var task_data=data.groups[group_index].group_tasks[j];var task=ogTasksCache.addTasks(task_data);ogTasks.addTaskToGroup(group,task,draw);}
ogTasks.Groups.push(group);if(typeof draw!='undefined'&&draw){ogTasks.initDragDrop();}};ogTasks.removeTaskGroup=function(group){for(var i=0;i<ogTasks.Groups.length;i++){if(ogTasks.Groups[i].group_id==group.group_id){ogTasks.Groups.splice(i,1);}}
if($("#ogTasksPanelGroup"+group.group_id).length>0){$("#ogTasksPanelGroup"+group.group_id).remove();$("#ogTasksPanelGroup"+group.group_id+"Totals").remove();}};ogTasks.updateTaskGroups=function(data,add_new_tasks){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();if(data&&data.groups){for(var i=0;i<data.groups.length;i++){if(!data.groups[i])continue;var group=ogTasks.getGroup(data.groups[i].group_id);if(!group)continue;if(typeof add_new_tasks!='undefined'){for(var j=0;j<data.groups[i].group_tasks.length;j++){var task_data=data.groups[i].group_tasks[j];var task=ogTasksCache.addTasks(task_data);ogTasks.addTaskToGroup(group,task,true);}}
for(var key in data.groups[i]){if(key!='group_tasks'&&data.groups[i]){group[key]=data.groups[i][key];}}
group.rendering=false;$("#ogTasksPanelGroup"+group.group_id+"Totals").replaceWith(ogTasks.newTaskGroupTotals(group));}}};ogTasks.getGroup=function(id){for(var i=0;i<ogTasks.Groups.length;i++){if(ogTasks.Groups[i].group_id==id){return ogTasks.Groups[i];}}
return null;};ogTasks.addTaskToGroup=function(group,task,draw){var update=false;if(group.group_tasks[task.id]){update=true;}
group.group_tasks[task.id]=task;var task_id=parseInt(task.id);if(group.group_tasks_order.indexOf(task_id)==-1){group.group_tasks_order.push(task_id);}
if(!update){group.total_tasks_loaded++;}
if(typeof draw!='undefined'&&draw){if(update){ogTasks.reDrawTask(task);}else{var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();$("#no_tasks_info").remove();ogTasks.drawTask(task,drawOptions,displayCriteria,group.group_id,1);var btns=$("#ogTasksPanelTask"+task.id+"G"+group.group_id+" .tasksActionsBtn").toArray();og.initPopoverBtns(btns);}}};ogTasks.removeTaskFromGroup=function(group,task){delete group.group_tasks[task.id];group.total_tasks_loaded--;if($("#ogTasksPanelTask"+task.id+"G"+group.group_id).length>0){$("#ogTasksPanelTask"+task.id+"G"+group.group_id).remove();}
if(group.total_tasks_loaded<=0){ogTasks.removeTaskGroup(group);}};ogTasks.updateTaskGroupsForTask=function(data){var task=ogTasksCache.getTask(data.taskId);var task_groups_ids=new Array();for(var i=0;i<data.groups.length;i++){var group=ogTasks.getGroup(data.groups[i].group_id);if(!group){ogTasks.addNewTaskGroup(data,i,true);group=ogTasks.getGroup(data.groups[i].group_id);}else{var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();if(drawOptions.show_subtasks_structure&&task.parentId>0){if($("#ogTasksPanelTask"+task.parentId+"G"+group.group_id).length==0){ogTasks.addTaskToGroup(group,task,true);}}else{ogTasks.addTaskToGroup(group,task,true);}}
task_groups_ids.push(group.group_id);}
var remove_task_groups_ids=new Array();for(var j=0;j<ogTasks.Groups.length;j++){var group=ogTasks.Groups[j];if(group.group_tasks[task.id]&&task_groups_ids.indexOf(group.group_id)==-1){ogTasks.removeTaskFromGroup(group,task);remove_task_groups_ids.push(group.group_id);}}
for(var j=0;j<task_groups_ids.length;j++){ogTasks.refreshGroupsTotals(task_groups_ids[j]);}
for(var j=0;j<remove_task_groups_ids.length;j++){ogTasks.refreshGroupsTotals(remove_task_groups_ids[j]);}};ogTasks.resetPaginationVariables=function(){ogTasks.Groups.length=0;ogTasks.allGroupsLoaded=false;ogTasks.groupsPaginationOffset=0;if(ogTasks.userPreferences.showTasksListAsGantt){ogTasks.groupsPaginationCount=1000;}else{ogTasks.groupsPaginationCount=ogTasks.userPreferences.groupsPaginationCount;}}
ogTasks.loadMoreGroups=function(){if(!ogTasks.allGroupsLoaded&&!ogTasks.isLoadingGroups){ogTasks.getGroups();}}
ogTasks.getGroups=function(dont_reset_groups){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(!bottomToolbar)return;var filters=bottomToolbar.getFilters();if(bottomToolbar.groupcombo){filters.tasksGroupBy=bottomToolbar.groupcombo.value;}
if(bottomToolbar.ordercombo){filters.tasksOrderBy=bottomToolbar.ordercombo.value;}
if(typeof ogTasks.userPreferences.showTasksListAsGantt!='undefined'&&ogTasks.userPreferences.showTasksListAsGantt){filters.limit=500;}
if(typeof(ogTasks.groupsPaginationOffset)!='undefined'){filters.groups_offset=ogTasks.groupsPaginationOffset;}
if(typeof(ogTasks.groupsPaginationCount)!='undefined'){filters.groups_count=ogTasks.groupsPaginationCount;}
ogTasks.isLoadingGroups=true;og.openLink(og.getUrl('task','get_tasks_groups_list'),{hideLoading:false,scope:this,post:filters,callback:function(success,data){if(data.groups){if(data.groups.length==0){ogTasks.isLoadingGroups=false;ogTasks.Groups.loaded=true;ogTasks.allGroupsLoaded=true;}
for(var i=0;i<data.groups.length;i++){ogTasks.removeTaskGroup(data.groups[i]);ogTasks.addNewTaskGroup(data,i);}}
if(typeof(ogTasks.groupsPaginationOffset)!='undefined'){ogTasks.groupsPaginationOffset=parseInt(data.new_groups_offset)+parseInt(ogTasks.groupsPaginationCount);}
ogTasks.Groups.loaded=true;og.eventManager.fireEvent('after ogTasks.Groups list completely loaded',null);ogTasks.draw();}});};ogTasks.showAllTasks=function(group_id){ogTasks.showMoreTasks(group_id,true);};ogTasks.showMoreTasks=function(group_id,show_all){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(!bottomToolbar)return;var filters=bottomToolbar.getFilters();if(bottomToolbar.groupcombo){filters.tasksGroupBy=bottomToolbar.groupcombo.value;}
if(bottomToolbar.ordercombo){filters.tasksOrderBy=bottomToolbar.ordercombo.value;}
var group=ogTasks.getGroup(group_id);filters.start=group.offset;group.offset=group.offset+parseInt(og.noOfTasks);if(typeof show_all=="undefined"){show_all=false;}
if(show_all){filters.limit=group.root_total;}
filters.groupId=group.group_id;og.openLink(og.getUrl('task','get_tasks_groups_list'),{hideLoading:true,scope:this,post:filters,callback:function(success,data){ogTasks.updateTaskGroups(data,true);og.eventManager.fireEvent('replace all empty breadcrumb',null);}});};og.getTasksFromServer=function(tasks_ids,func_callback,callback_extra_params){if(tasks_ids.length>0){og.openLink(og.getUrl('task','get_tasks',{tasks_ids:Ext.encode(tasks_ids)}),{hideLoading:true,callback:function(s,data){for(var j=0;j<data.tasks.length;j++){var task_data=data.tasks[j];var task=ogTasksCache.addTasks(task_data);}
if(typeof callback_extra_params=="undefined"){callback_extra_params={};}
if(typeof func_callback!="undefined"){func_callback(callback_extra_params);}}})}};og.getSubTasksAndDraw=function(task,groupId){og.getTasksFromServer(task.subtasksIds,ogTasks.drawSubtasks,{task_id:task.id,group_id:groupId});}
ogTasks.refreshGroupsTotals=function(group_id){if(this.Groups.length==0){return;};var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(!bottomToolbar)return;var filters=bottomToolbar.getFilters();if(bottomToolbar.groupcombo){filters.tasksGroupBy=bottomToolbar.groupcombo.value;}
if(bottomToolbar.ordercombo){filters.tasksOrderBy=bottomToolbar.ordercombo.value;}
filters.start=0;filters.limit=0;if(typeof group_id!='undefined'){filters.groupId=group_id;}
filters.only_totals=1;og.openLink(og.getUrl('task','get_tasks_groups_list'),{hideLoading:true,scope:this,post:filters,callback:function(success,data){ogTasks.updateTaskGroups(data);og.eventManager.fireEvent('replace all empty breadcrumb',null);}});};ogTasks.getGroupsForTask=function(task_id){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(!bottomToolbar)return;var filters=bottomToolbar.getFilters();filters.taskId=task_id;og.openLink(og.getUrl('task','get_groups_for_task'),{hideLoading:true,scope:this,post:filters,callback:function(success,data){ogTasks.updateTaskGroupsForTask(data);}});};og.TasksTopToolbar=function(config){Ext.applyIf(config,{id:"tasksPanelTopToolbarObject",renderTo:"tasksPanelTopToolbar",style:"border:0px none;"});og.TasksTopToolbar.superclass.constructor.call(this,config);var allTemplates=[];var allTemplatesArray=Ext.util.JSON.decode(document.getElementById(config.allTemplatesHfId).value);if(allTemplatesArray&&allTemplatesArray.length>0){for(var i=0;i<allTemplatesArray.length;i++){allTemplates[allTemplates.length]={text:allTemplatesArray[i].t,iconCls:'ico-template',handler:function(){var tid=this.id;og.openLink(og.getUrl('template','template_parameters',{id:this.id}),{callback:function(success,data){if(success){if(data.parameters.length==0){var url=og.getUrl('template','instantiate',{id:tid,req_channel:'task list - toolbar instantiate template'});og.openLink(url);}else{og.render_modal_form('',{c:'template',a:'instantiate_parameters',params:{id:tid,req_channel:'task list - toolbar instantiate template'},overlayClose:false,escClose:false,hideCloseIcon:false});}}}});},scope:allTemplatesArray[i]};}}
var menuItems=[{id:'new_button_task',text:lang('new task'),iconCls:'ico-task',cls:'tasks-panel-add-button',handler:function(){var additionalParams={};var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterNamesCompaniesCombo.isVisible()){var value=toolbar.filterNamesCompaniesCombo.getValue();if(value){additionalParams.assigned_to_contact_id=value;}}
additionalParams.req_channel='task list - toolbar new task';og.render_modal_form('',{c:'task',a:'add_task',params:additionalParams});}}];if(og.replace_list_new_action&&og.replace_list_new_action.task){for(var k=0;k<og.replace_list_new_action.task.menu.items.items.length;k++){var act=new Ext.Action(og.replace_list_new_action.task.menu.items.items[k].initialConfig);menuItems.push(act);}}
if(og.config.use_milestones){menuItems=menuItems.concat([{text:lang('new milestone'),iconCls:'ico-milestone',handler:function(){og.render_modal_form('',{c:'milestone',a:'add'});}}]);}
var projectTemplates=[];var projectTemplatesArray=Ext.util.JSON.decode(document.getElementById(config.projectTemplatesHfId).value);if(projectTemplatesArray&&projectTemplatesArray.length>0){for(var i=0;i<projectTemplatesArray.length;i++){projectTemplates[projectTemplates.length]={text:projectTemplatesArray[i].t,iconCls:'ico-template',handler:function(){var tid=this.id;og.openLink(og.getUrl('template','template_parameters',{id:this.id}),{callback:function(success,data){if(success){if(data.parameters.length==0){var url=og.getUrl('template','instantiate',{id:tid,req_channel:'task list - toolbar instantiate template'});og.openLink(url);}else{og.openLink(og.getUrl('template','instantiate_parameters',{id:tid,req_channel:'task list - toolbar instantiate template'}));}}}});},scope:projectTemplatesArray[i]};}
projectTemplates[projectTemplates.length]='-';menuItems=menuItems.concat(projectTemplates);}
var newTemplate=[{text:lang('new template'),iconCls:'ico-template',handler:function(){var url=og.getUrl('template','add');og.openLink(url);}},'-'];allTemplates=newTemplate.concat(allTemplates);if(og.loggedUser.can_instantiate_templates){menuItems=menuItems.concat([{text:lang('templates'),iconCls:'ico-template',cls:'scrollable-menu',menu:{items:allTemplates}}]);}
var butt=new Ext.Button({iconCls:'ico-new',text:lang('new'),id:'new_menu_task',menu:{cls:'scrollable-menu',items:menuItems}});var markactions={markAsRead:new Ext.Action({text:lang('mark as read'),tooltip:lang('mark as read desc'),iconCls:'ico-mark-as-read',disabled:true,handler:function(){ogTasks.executeAction('markasread');},scope:this}),markAsUnread:new Ext.Action({text:lang('mark as unread'),tooltip:lang('mark as unread desc'),iconCls:'ico-mark-as-read',disabled:true,handler:function(){ogTasks.executeAction('markasunread');},scope:this})};if(ogTasks.additional_mark_actions){for(var i=0;i<ogTasks.additional_mark_actions.length;i++){var action=ogTasks.additional_mark_actions[i];var action_name=action['action_name'];markactions[action_name]=new Ext.Action({text:action['text'],tooltip:action['tooltip'],iconCls:action['iconCls'],handler:action['handler'],scope:this});}}
this.markactions=markactions;this.markactions_menuitems=[markactions.markAsRead,markactions.markAsUnread];if(markactions.markAsBillable)this.markactions_menuitems.push(markactions.markAsBillable);if(markactions.markAsNonBillable)this.markactions_menuitems.push(markactions.markAsNonBillable);var actions={del:new Ext.Action({text:lang('move to trash'),tooltip:lang('move selected objects to trash'),iconCls:'ico-trash',disabled:true,handler:function(){var ids=ogTasks.getSelectedIds()+'';var arr_ids=ids.split(',')
for(var i=0;i<arr_ids.length;i++){var related=og.checkRelated("task",arr_ids[i]);if(related){break;}}
if(related){this.dialog=new og.TaskPopUp("delete",'');this.dialog.setTitle(lang('tasks related'));this.dialog.show();}else{if(confirm(lang('confirm move to trash'))){ogTasks.executeAction('delete');}}},scope:this}),complete:new Ext.Action({text:lang('do complete'),tooltip:lang('complete selected tasks'),iconCls:'ico-complete',disabled:true,handler:function(){var ids=ogTasks.getSelectedIds();var related=false;for(var i=0;i<ids.length;i++){var task=ogTasks.getTask(ids[i]);for(var j=0;j<task.subtasks.length;j++){if(task.subtasks[j].status==0){related=true;}
if(related){break;}}}
if(related){this.dialog=new og.TaskCompletePopUp('');this.dialog.setTitle(lang('do complete'));this.dialog.show();}else{ogTasks.executeAction('complete');}},scope:this}),markAs:new Ext.Action({text:lang('mark as'),tooltip:lang('mark as desc'),menu:this.markactions_menuitems}),archive:new Ext.Action({text:lang('archive'),tooltip:lang('archive selected object'),iconCls:'ico-archive-obj',disabled:true,handler:function(){var ids=ogTasks.getSelectedIds()+'';var arr_ids=ids.split(',')
for(var i=0;i<arr_ids.length;i++){var related=og.checkRelated("task",arr_ids[i]);if(related){break;}}
if(related){this.dialog=new og.TaskPopUp("archive",'');this.dialog.setTitle(lang('tasks related'));this.dialog.show();}else{if(confirm(lang('confirm archive selected objects'))){ogTasks.executeAction('archive');}}},scope:this})};this.actions=actions;if(!og.loggedUser.isGuest){this.add(butt);this.addSeparator();this.add(actions.complete);this.add(actions.archive);this.add(actions.del);this.addSeparator();}
this.add(actions.markAs);this.addSeparator();this.displayOptions={by:{text:lang('assigned by'),checked:(ogTasks.userPreferences.showBy==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowAssignedBy',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},time:{hidden:(typeof(ogTasks.userPreferences.showTime)=="undefined"),text:lang('time'),checked:(ogTasks.userPreferences.showTime==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowTime',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},time_quick:{hidden:(typeof(ogTasks.userPreferences.showTimeQuick)=="undefined"),text:lang('quick time'),checked:(ogTasks.userPreferences.showTimeQuick==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowTimeQuick',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},dates_start:{text:lang('start date'),checked:(ogTasks.userPreferences.showStartDates==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowStartDates',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},dates_end:{text:lang('due date'),checked:(ogTasks.userPreferences.showEndDates==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowEndDates',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},empty_milestones:{text:lang('empty milestones'),checked:(ogTasks.userPreferences.showEmptyMilestones==1),hideOnClick:false,checkHandler:function(){ogTasks.userPreferences.showEmptyMilestones=1-ogTasks.userPreferences.showEmptyMilestones;var url=og.getUrl('account','update_user_preference',{name:'tasksShowEmptyMilestones',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);},hidden:(!og.config.use_milestones)},time_estimates:{text:lang('estimated time'),checked:(ogTasks.userPreferences.showTimeEstimates==1),hideOnClick:false,checkHandler:function(){if(this.checked){ogTasks.TotalCols.estimatedTime={title:'estimated',group_total_field:'TimeEstimate',row_field:'estimatedTime'};}else{delete ogTasks.TotalCols.estimatedTime;}
var url=og.getUrl('account','update_user_preference',{name:'tasksShowTimeEstimates',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},total_time_estimates:{text:lang('total estimated time'),checked:(ogTasks.userPreferences.showTotalTimeEstimates==1),hideOnClick:false,checkHandler:function(){if(this.checked){ogTasks.TotalCols.estimatedTime={title:'total estimated',group_total_field:'TotalTimeEstimate',row_field:'totalTimeEstimateString'};}else{delete ogTasks.TotalCols.estimatedTime;}
var url=og.getUrl('account','update_user_preference',{name:'tasksShowTotalTimeEstimates',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},time_pending:{text:lang('pending time'),checked:(ogTasks.userPreferences.showTimePending==1),hideOnClick:false,checkHandler:function(){if(this.checked){ogTasks.TotalCols.pendingTime={title:'pending',group_total_field:'pending_time',row_field:'pending_time_string'};}else{delete ogTasks.TotalCols.pendingTime;}
var url=og.getUrl('account','update_user_preference',{name:'tasksShowTimePending',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},time_worked:{text:lang('worked time'),checked:(ogTasks.userPreferences.showTimeWorked==1),hideOnClick:false,checkHandler:function(){if(this.checked){ogTasks.TotalCols.workedTime={title:'worked',group_total_field:'worked_time',row_field:'worked_time_string'};}else{delete ogTasks.TotalCols.workedTime;}
var url=og.getUrl('account','update_user_preference',{name:'tasksShowTimeWorked',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},total_worked_time:{text:lang('total worked time'),checked:(ogTasks.userPreferences.showTotalTimeWorked==1),hideOnClick:false,checkHandler:function(){if(this.checked){ogTasks.TotalCols.totalWorkedTime={title:'total worked',group_total_field:'overall_worked_time',row_field:'overall_worked_time_string'};}else{delete ogTasks.TotalCols.totalWorkedTime;}
var url=og.getUrl('account','update_user_preference',{name:'tasksShowTotalTimeWorked',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},percent_completed_bar:{text:lang('percent completed'),checked:(ogTasks.userPreferences.showPercentCompletedBar==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowPercentCompletedBar',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_quick_edit:{text:lang('quick edit'),checked:(ogTasks.userPreferences.showQuickEdit==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowQuickEdit',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_quick_mark_as_started:{text:lang('quick mark as started'),checked:(parseInt(ogTasks.userPreferences.showQuickMarkAsStarted)==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowQuickMarkAsStarted',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_quick_complete:{text:lang('quick complete'),checked:(ogTasks.userPreferences.showQuickComplete==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowQuickComplete',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_quick_comment:{text:lang('quick comment'),checked:(ogTasks.userPreferences.showQuickComment==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowQuickComment',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_quick_add_sub_tasks:{text:lang('quick add sub tasks'),checked:(ogTasks.userPreferences.showQuickAddSubTasks==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowQuickAddSubTasks',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},show_classification:{text:lang('classified under'),checked:(ogTasks.userPreferences.showClassification==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowClassification',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}},previous_pending_tasks:{text:lang('previous pending tasks'),checked:(ogTasks.userPreferences.previousPendingTasks==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksPreviousPendingTasks',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);},hidden:(!og.config.use_tasks_dependencies)},show_subtasks_structure:{text:lang('subtasks structure'),checked:(ogTasks.userPreferences.showSubtasksStructure==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:'tasksShowSubtasksStructure',value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}}};var menu_items=[this.displayOptions.by,this.displayOptions.time,this.displayOptions.time_quick,this.displayOptions.dates_start,this.displayOptions.dates_end,this.displayOptions.empty_milestones,this.displayOptions.time_estimates,this.displayOptions.total_time_estimates,this.displayOptions.time_pending,this.displayOptions.time_worked,this.displayOptions.total_worked_time,this.displayOptions.percent_completed_bar,this.displayOptions.show_quick_edit,this.displayOptions.show_quick_mark_as_started,this.displayOptions.show_quick_complete,this.displayOptions.show_quick_add_sub_tasks,this.displayOptions.show_classification,this.displayOptions.previous_pending_tasks,this.displayOptions.show_subtasks_structure,];for(var cp_order=0;cp_order<ogTasks.custom_properties.length;cp_order++){var cp=ogTasks.custom_properties[cp_order];var opt_key='tasksShowCP_'+cp.id;this.displayOptions[opt_key]={id:opt_key,text:cp.name,checked:(ogTasks.userPreferences[opt_key]==1),hideOnClick:false,checkHandler:function(){ogTasks.userPreferences[this.id]=(this.checked?1:0);var url=og.getUrl('account','update_user_preference',{name:this.id,value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}}
menu_items.push(this.displayOptions[opt_key]);}
for(did in og.dimensions_info){if(isNaN(did))continue;tmp_menu_items=ogTasks.createDimensionColumnMenuItems(did);if(tmp_menu_items&&tmp_menu_items.length>0){menu_items=menu_items.concat(tmp_menu_items);}}
if(ogTasks.additional_task_list_columns){for(var i=0;i<ogTasks.additional_task_list_columns.length;i++){var col=ogTasks.additional_task_list_columns[i];menu_items.push({configId:col.id,text:col.name,checked:(ogTasks.userPreferences[col.id]==1),hideOnClick:false,checkHandler:function(){var url=og.getUrl('account','update_user_preference',{name:this.configId,value:(this.checked?1:0)});ogTasksMakeRequestAndReloadWithTimeout(url);}});}}
this.show_menu=new Ext.Action({id:'table-show-columns-task',iconCls:'op-ico-details',text:lang('show'),menu:{items:menu_items}});this.add(this.show_menu);this.add('-');this.add(new Ext.Action({id:'button-print',text:lang('print'),tooltip:lang('print all groups'),iconCls:'ico-print',handler:function(){var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(!bottomToolbar)return;var filters=bottomToolbar.getFilters();if(bottomToolbar.groupcombo){filters.tasksGroupBy=bottomToolbar.groupcombo.value;}
if(bottomToolbar.ordercombo){filters.tasksOrderBy=bottomToolbar.ordercombo.value;}
filters.draw_options=Ext.util.JSON.encode(this.getDrawOptions());filters.tasks_list_cols=Ext.util.JSON.encode(ogTasks.TasksList.tasks_list_cols);var row_total_cols=[];for(var key in ogTasks.TotalCols){row_total_cols.push({row_field:ogTasks.TotalCols[key].row_field});}
filters.row_total_cols=Ext.util.JSON.encode(row_total_cols);og.openLink(og.getUrl('task','print_tasks_list'),{preventPanelLoad:true,hideLoading:false,scope:this,post:filters,callback:function(success,data){var html=data.current.data;var printWindow=ogTasks.createPrintWindow();printWindow.document.write(html);ogTasks.closePrintWindow(printWindow);}});},scope:this}));Ext.get('button-print').set({id:"tasks_print_btn"});if(ogTasks.extraTopToolbarItems){for(i=0;i<ogTasks.extraTopToolbarItems.length;i++){this.add(ogTasks.extraTopToolbarItems[i]);}}};function ogTasksLoadFilterValuesCombo(newValue){var combo=Ext.getCmp('ogTasksFilterValuesCombo');}
function ogTasksOrderUsers(usersList){for(var i=0;i<usersList.length-1;i++)
for(var j=i+1;j<usersList.length;j++)
if(usersList[i][1].toUpperCase()>usersList[j][1].toUpperCase()){var aux=usersList[i];usersList[i]=usersList[j];usersList[j]=aux;}
return usersList;}
function ogTasksMakeRequestAndReloadWithTimeout(url){og.openLink(url,{hideLoading:true,callback:function(success,data){ogTasksWaitTimeOutAndDraw();}});}
function ogTasksWaitTimeOutAndDraw(){if(og.task_show_by_select_timeout){clearTimeout(og.task_show_by_select_timeout);}
og.task_show_by_select_timeout=setTimeout(function(){var tp=Ext.getCmp("tasks-panel");if(tp)tp.reset();var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');topToolbar.items.get('table-show-columns-task').menu.hide();},3000);}
Ext.extend(og.TasksTopToolbar,Ext.Toolbar,{getDrawOptions:function(){var draw_options={show_by:this.show_menu.items[0].menu.items.items[0].checked,show_time:this.show_menu.items[0].menu.items.items[1].checked,show_time_quick:this.show_menu.items[0].menu.items.items[2].checked,show_start_dates:this.show_menu.items[0].menu.items.items[3].checked,show_end_dates:this.show_menu.items[0].menu.items.items[4].checked,show_ms:this.show_menu.items[0].menu.items.items[5].checked,show_time_estimates:this.show_menu.items[0].menu.items.items[6].checked,show_total_time_estimates:this.show_menu.items[0].menu.items.items[7].checked,show_time_pending:this.show_menu.items[0].menu.items.items[8].checked,show_time_worked:this.show_menu.items[0].menu.items.items[9].checked,show_total_time_worked:this.show_menu.items[0].menu.items.items[10].checked,show_percent_completed_bar:this.show_menu.items[0].menu.items.items[11].checked,show_quick_edit:this.show_menu.items[0].menu.items.items[12].checked,show_quick_mark_as_started:this.show_menu.items[0].menu.items.items[13].checked,show_quick_complete:this.show_menu.items[0].menu.items.items[14].checked,show_quick_add_sub_tasks:this.show_menu.items[0].menu.items.items[15].checked,show_classification:this.show_menu.items[0].menu.items.items[16].checked,show_previous_pending_tasks:this.show_menu.items[0].menu.items.items[17].checked,show_subtasks_structure:this.show_menu.items[0].menu.items.items[18].checked,show_dimension_cols:ogTasks.userPreferences.showDimensionCols}
var show_cp_config={};var the_menu_items=this.show_menu.items[0].menu.items.items;for(var x=0;x<the_menu_items.length;x++){var mitem=the_menu_items[x];if(mitem.id.indexOf('tasksShowCP_')==0){var cpid=mitem.id.replace('tasksShowCP_','');show_cp_config[cpid]=mitem.checked;}}
draw_options.tasksShowCP=show_cp_config;if(ogTasks.additional_task_list_columns){for(var i=0;i<ogTasks.additional_task_list_columns.length;i++){var col=ogTasks.additional_task_list_columns[i];draw_options[col.id]=ogTasks.userPreferences[col.id]?true:false;}}
return draw_options;},updateCheckedStatus:function(){var checked=false;var allIncomplete=true,anyIncomplete=false,allUnread=true,allRead=true;for(var prop in ogTasksCache.Tasks){var task=ogTasksCache.Tasks[prop];if(task.isChecked){checked=true;if(task.status==1){allIncomplete=false;}else{anyIncomplete=true;}
if(task.isRead){allUnread=false;}else{allRead=false;}}}
if(!checked){this.actions.del.disable();this.actions.complete.disable();this.actions.archive.disable();this.markactions.markAsRead.disable();this.markactions.markAsUnread.disable();}else{this.actions.del.enable();this.actions.archive.enable();if(allUnread){this.markactions.markAsUnread.disable();}else{this.markactions.markAsUnread.enable();}
if(allRead){this.markactions.markAsRead.disable();}else{this.markactions.markAsRead.enable();}
if(anyIncomplete){this.actions.complete.enable();}else{this.actions.complete.disable();}}
og.eventManager.fireEvent('task list updateCheckedStatus',{checked:checked});}});Ext.reg("tasksTopToolbar",og.TasksTopToolbar);og.TasksBottomToolbar=function(config){Ext.applyIf(config,{id:"tasksPanelBottomToolbarObject",renderTo:"tasksPanelBottomToolbar",style:"border:0px none; padding-top:0; padding-left:5px;"});og.TasksBottomToolbar.superclass.constructor.call(this,config);var groupcombo_store_data=[['nothing','--'+lang('nothing (groups)')+'--'],['milestone',lang('milestone')],['priority',lang('priority')],['assigned_to',lang('assigned to')],['due_date',lang('due date')],['start_date',lang('start date')],['created_on',lang('created on')],['created_by',lang('created by')],['completed_on',lang('completed on')],['completed_by',lang('completed by')],['status',lang('status')]];if(!og.config.use_milestones){for(var x=0;x<groupcombo_store_data.length;x++){if(groupcombo_store_data[x][0]=='milestone'){groupcombo_store_data.splice(x,1);}}}
if(ogTasks.additional_groupby_dimensions_member_types){for(i=0;i<ogTasks.additional_groupby_dimensions_member_types.length;i++){var gb=ogTasks.additional_groupby_dimensions_member_types[i];var found=false;for(k=0;k<groupcombo_store_data.length;k++){gsd=groupcombo_store_data[k];found=gsd[0]=='dimmembertypeid_'+gb.dim_id+'_'+gb.mem_type_id;if(found)break;}
if(!found)groupcombo_store_data.push(['dimmembertypeid_'+gb.dim_id+'_'+gb.mem_type_id,gb.mem_type_name]);}}
this.groupcombo=new Ext.form.ComboBox({id:'ogTasksGroupByCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:groupcombo_store_data}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:120,valueField:'value',listeners:{'select':function(combo,record){ogTasks.setAllCheckedValue(false);ogTasks.setAllExpandedValue(false);ogTasks.expandedGroups=[];var url=og.getUrl('account','update_user_preference',{name:'tasksGroupBy',value:record.data.value});og.openLink(url,{hideLoading:true,callback:function(success,data){var tp=Ext.getCmp("tasks-panel");if(tp)tp.reset();}});}}});this.groupcombo.setValue(ogTasks.userPreferences.groupBy);var ordercombo_data=[['priority',lang('priority')],['name',lang('task name')],['due_date',lang('due date')],['created_on',lang('created on')],['completed_on',lang('completed on')],['assigned_to',lang('assigned to')],['start_date',lang('start date')],['percent_completed',lang('progress')]];if(og.additional_tasks_list_order_by_fn){for(var i=0;i<og.additional_tasks_list_order_by_fn.length;i++){var add_fn=og.additional_tasks_list_order_by_fn[i];if(typeof(add_fn)=='function'){ordercombo_data=add_fn.call(null,ordercombo_data);}}}
this.ordercombo=new Ext.form.ComboBox({id:'ogTasksOrderByCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:ordercombo_data}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:120,valueField:'value',listeners:{'select':function(combo,record){ogTasks.redrawGroups=false;ogTasks.redrawGroups=true;var url=og.getUrl('account','update_user_preference',{name:'tasksOrderBy',value:record.data.value});og.openLink(url,{hideLoading:true,callback:function(success,data){var tp=Ext.getCmp("tasks-panel");if(tp)tp.reset();}});}}});this.ordercombo.setValue(ogTasks.userPreferences.orderBy);var filtercombo_store_data=[['no_filter','--'+lang('no filter')+'--'],['created_by',lang('created by')],['completed_by',lang('completed by')],['assigned_to',lang('assigned to')],['assigned_by',lang('assigned by')],['milestone',lang('milestone')],['priority',lang('priority')],['subscribed_to',lang('subscribed to')]];if(!og.config.use_milestones){for(var x=0;x<filtercombo_store_data.length;x++){if(filtercombo_store_data[x][0]=='milestone'){filtercombo_store_data.splice(x,1);}}}
if(ogTasks.additional_filtercombo_types){for(i=0;i<ogTasks.additional_filtercombo_types.length;i++){var gb=ogTasks.additional_filtercombo_types[i];var found=false;for(k=0;k<filtercombo_store_data.length;k++){gsd=filtercombo_store_data[k];found=gsd[0]==gb.id;if(found)break;}
if(!found)filtercombo_store_data.push([gb.id,gb.name]);}}
this.filtercombo=new Ext.form.ComboBox({id:'ogTasksFilterCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:filtercombo_store_data}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:100,valueField:'value',listeners:{'select':function(combo,record){switch(record.data.value){case'no_filter':Ext.getCmp('ogTasksFilterNamesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').hide();Ext.getCmp('ogTasksFilterMilestonesCombo').hide();Ext.getCmp('ogTasksFilterPriorityCombo').hide();Ext.getCmp('ogTasksFilterSubtypeCombo').hide();var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');toolbar.load();break;case'milestone':Ext.getCmp('ogTasksFilterNamesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').hide();Ext.getCmp('ogTasksFilterMilestonesCombo').show();Ext.getCmp('ogTasksFilterMilestonesCombo').setValue('');Ext.getCmp('ogTasksFilterPriorityCombo').hide();Ext.getCmp('ogTasksFilterSubtypeCombo').hide();break;case'priority':Ext.getCmp('ogTasksFilterNamesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').hide();Ext.getCmp('ogTasksFilterMilestonesCombo').hide();Ext.getCmp('ogTasksFilterPriorityCombo').show();Ext.getCmp('ogTasksFilterPriorityCombo').setValue('');Ext.getCmp('ogTasksFilterSubtypeCombo').hide();break;case'assigned_to':Ext.getCmp('ogTasksFilterNamesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').show();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').setValue('');Ext.getCmp('ogTasksFilterMilestonesCombo').hide();Ext.getCmp('ogTasksFilterPriorityCombo').hide();Ext.getCmp('ogTasksFilterSubtypeCombo').hide();break;case'subtype':Ext.getCmp('ogTasksFilterNamesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').hide();Ext.getCmp('ogTasksFilterNamesCompaniesCombo').setValue('');Ext.getCmp('ogTasksFilterMilestonesCombo').hide();Ext.getCmp('ogTasksFilterPriorityCombo').hide();Ext.getCmp('ogTasksFilterSubtypeCombo').show();break;default:Ext.getCmp('ogTasksFilterNamesCombo').show();Ext.getCmp('ogTasksFilterNamesCombo').setValue('');Ext.getCmp('ogTasksFilterNamesCompaniesCombo').hide();Ext.getCmp('ogTasksFilterMilestonesCombo').hide();Ext.getCmp('ogTasksFilterPriorityCombo').hide();Ext.getCmp('ogTasksFilterSubtypeCombo').hide();if(ogTasks.additional_filtercombo_types){for(var x=0;x<ogTasks.additional_filtercombo_types.length;x++){var fc_type=ogTasks.additional_filtercombo_types[x];if(fc_type&&typeof(fc_type.onselect)=='function'){fc_type.onselect.call(null,record.data.value);}}}
break;}}}});this.filtercombo.setValue(ogTasks.userPreferences.filter);setTimeout(function(){og.openLink(og.getUrl('task','users_for_tasks_list_filter'),{callback:function(success,data){if(!data)return;var currentUser='';var usersArray=data.users;var companiesArray=data.companies;for(var i=0;i<usersArray.length;i++){if(usersArray[i].isCurrent){currentUser=usersArray[i].id;}}
var ucsData=[[currentUser,lang('me')],['0',lang('everyone')],['-1',lang('unassigned')],['0','--']];ucsOtherUsers=[];for(var i=0;i<usersArray.length;i++){var companyName='';var j;for(var j=0;j<companiesArray.length;j++){if(companiesArray[j]&&companiesArray[j].id==usersArray[i].cid){companyName=companiesArray[j].name;break;}}
if(usersArray[i]&&typeof(usersArray[i])!='function'){var toshow=og.clean(usersArray[i].name)+(usersArray[i].cid?' : '+og.clean(companyName):"");ucsOtherUsers[ucsOtherUsers.length]=[usersArray[i].id,toshow];}
if(usersArray[i].isCurrent){currentUser=usersArray[i].id;}}
var compData=[];if(og.config.can_assign_tasks_to_companies){compData=compData.concat([['0','--']]);for(var i=0;i<companiesArray.length;i++){if(companiesArray[i].id)compData[compData.length]=[companiesArray[i].id,og.clean(companiesArray[i].name)];}}
var namesCompaniesComboShowIf=['assigned_to'];ucsData=ucsData.concat(ucsOtherUsers).concat(compData);var com=Ext.getCmp('ogTasksFilterNamesCompaniesCombo');if(com){com.reset();com.store.removeAll();com.store.loadData(ucsData);com.setValue(ogTasks.userPreferences.filterValue);com.enable();}
for(var i=0;i<usersArray.length;i++){if(usersArray[i].isCurrent)
currentUser=usersArray[i].id;}
var uData=[[currentUser,lang('me')],['0',lang('everyone')],['0','--']];uDOtherUsers=[];for(var i=0;i<usersArray.length;i++){if(usersArray[i]&&!usersArray[i].isCurrent&&usersArray[i].id){var companyName='';var j;for(var j=0;j<companiesArray.length;j++){if(companiesArray[j]&&companiesArray[j].id==usersArray[i].cid){companyName=companiesArray[j].name;break;}}
var toshow=og.clean(usersArray[i].name)+(usersArray[i].cid?' : '+og.clean(companyName):"");uDOtherUsers[uDOtherUsers.length]=[usersArray[i].id,toshow];}}
uData=uData.concat(uDOtherUsers).concat(compData);var com2=Ext.getCmp('ogTasksFilterNamesCombo');if(com2){com2.reset();com2.store.removeAll();com2.store.loadData(uData);com2.setValue(ogTasks.userPreferences.filterValue);com2.enable();}},scope:og.TasksBottomToolbar});},1000);var namesCompaniesComboShowIf=['assigned_to'];this.filterNamesCompaniesCombo=new Ext.form.ComboBox({id:'ogTasksFilterNamesCompaniesCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:[]}),hidden:namesCompaniesComboShowIf.indexOf(ogTasks.userPreferences.filter)<0,displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,listWidth:'auto',valueField:'value',emptyText:(lang('select user or group')+'...'),valueNotFoundText:'',listeners:{'blur':function(combo){if(combo.el.dom.value==""){combo.setValue(0);var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterNamesCompaniesCombo==this){toolbar.load();}}},'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterNamesCompaniesCombo==this){toolbar.load();}else{if(this.initialConfig.isInternalSelector){ogTasks.UserCompanySelected(this.initialConfig.controlName,record.data.value,this.initialConfig.taskId);}}}}});this.filterNamesCompaniesCombo.setValue(ogTasks.userPreferences.filterValue);this.filterNamesCompaniesCombo.disable();var namesComboShowIf=['completed_by','created_by','assigned_by','subscribed_to'];this.filterNamesCombo=new Ext.form.ComboBox({id:'ogTasksFilterNamesCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:[]}),hidden:namesComboShowIf.indexOf(ogTasks.userPreferences.filter)<0,displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,listWidth:'auto',valueField:'value',emptyText:(lang('select user or group')+'...'),valueNotFoundText:'',listeners:{'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');toolbar.load();}}});this.filterNamesCombo.setValue(ogTasks.userPreferences.filterValue);this.filterNamesCombo.disable();this.filterPriorityCombo=new Ext.form.ComboBox({id:'ogTasksFilterPriorityCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:[[100,lang('low')],[200,lang('normal')],[300,lang('high')],[400,lang('urgent')]]}),hidden:ogTasks.userPreferences.filter!='priority',displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,valueField:'value',emptyText:(lang('select priority')+'...'),valueNotFoundText:'',listeners:{'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterPriorityCombo==this)
toolbar.load();}}});this.filterPriorityCombo.setValue(ogTasks.userPreferences.filterValue);var subtypesArray=Ext.util.JSON.decode(document.getElementById(config.subtypesHfId).value);var subtypes_data=[[0,lang('all')]];for(i=0;i<subtypesArray.length;i++){var ost=subtypesArray[i];subtypes_data[subtypes_data.length]=[ost.id,ost.name];}
this.filterSubtypeCombo=new Ext.form.ComboBox({id:'ogTasksFilterSubtypeCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:subtypes_data}),hidden:ogTasks.userPreferences.filter!='subtype',displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,valueField:'value',emptyText:'...',valueNotFoundText:'',listeners:{'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterSubtypeCombo==this)
toolbar.load();}}});this.filterSubtypeCombo.setValue(ogTasks.userPreferences.filterValue);var milestones=Ext.util.JSON.decode(document.getElementById(config.internalMilestonesHfId).value);milestones=milestones.concat(Ext.util.JSON.decode(document.getElementById(config.externalMilestonesHfId).value));milestonesData=[[0,"--"+lang('none')+"--"]];for(var i=0;i<milestones.length;i++){if(milestones[i].id)
milestonesData[milestonesData.length]=[milestones[i].id,og.clean(milestones[i].t)];}
this.filterMilestonesCombo=new Ext.form.ComboBox({id:'ogTasksFilterMilestonesCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:milestonesData,sortInfo:{field:'text',direction:'ASC'}}),hidden:(ogTasks.userPreferences.filter!='milestone'),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:140,valueField:'value',emptyText:(lang('select milestone')+'...'),valueNotFoundText:'',listeners:{'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(toolbar.filterMilestonesCombo==this)
toolbar.load();}}});this.filterMilestonesCombo.setValue(ogTasks.userPreferences.filterValue);this.statusCombo=new Ext.form.ComboBox({id:'ogTasksStatusCombo',store:new Ext.data.SimpleStore({fields:['value','text'],data:[[2,'--'+lang('no filter')+'--'],[0,lang('pending')],[1,lang('complete')],[10,lang('active')],[11,lang('overdue')],[12,lang('today')],[13,lang('overdue')+"+"+lang('today')],[14,lang('no due date')],[15,lang('upcoming tasks w')]]}),displayField:'text',mode:'local',triggerAction:'all',selectOnFocus:true,width:130,valueField:'value',listeners:{'select':function(combo,record){var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');toolbar.load();}}});if(og.config.tasks_use_date_filters){this.dateFieldStart=new og.DateField({displayField:'text',emptyText:og.preferences['date_format_tip'],name:'ogTasksDateFieldStart',id:'ogTasksDateFieldStart',allowBlank:true,value:'',listeners:{'change':function(A,newValue,oldValue){var to_date=null;var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var dateFieldEnd=Ext.getCmp('ogTasksDateFieldEnd');if(newValue==''){this.setValue('');var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');toolbar.load({resetDateStart:oldValue});}else{var from_date=newValue.format(og.preferences['date_format']);if(dateFieldEnd.getValue()!=''){to_date=dateFieldEnd.getValue().format(og.preferences['date_format']);toolbar.load({from_date:from_date,to_date:to_date});}else{toolbar.load({from_date:from_date});}}}},menuListeners:{select:function(A,B){this.setValue(B);var from_date=B.format(og.preferences['date_format']);var to_date=null;var dateFieldEnd=Ext.getCmp('ogTasksDateFieldEnd');var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(dateFieldEnd.getValue()!=''){to_date=dateFieldEnd.getValue().format(og.preferences['date_format']);toolbar.load({from_date:from_date,to_date:to_date});}else{toolbar.load({from_date:from_date});}
this.setValue(B);}}});this.dateFieldEnd=new og.DateField({emptyText:og.preferences['date_format_tip'],name:'ogTasksDateFieldEnd',id:'ogTasksDateFieldEnd',value:'',listeners:{'change':function(A,newValue,oldValue){var from_date=null;var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var dateFieldStart=Ext.getCmp('ogTasksDateFieldStart');if(newValue==''){this.setValue('');var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');toolbar.load({resetDateEnd:oldValue});}else{var to_date=newValue.format(og.preferences['date_format']);if(dateFieldStart.getValue()!=''){from_date=dateFieldStart.getValue().format(og.preferences['date_format']);toolbar.load({from_date:from_date,to_date:to_date});}else{toolbar.load({to_date:to_date});}}}},menuListeners:{select:function(A,B){this.setValue(B);to_date=B.format(og.preferences['date_format']);from_date=null;var dateFieldStart=Ext.getCmp('ogTasksDateFieldStart');var toolbar=Ext.getCmp('tasksPanelBottomToolbarObject');if(dateFieldStart.getValue()!=''){from_date=dateFieldStart.getValue().format(og.preferences['date_format']);toolbar.load({from_date:from_date,to_date:to_date});}else{toolbar.load({to_date:to_date});}
this.setValue(B);}}});this.dateFieldEnd.setValue(ogTasks.userPreferences.dateEnd);this.dateFieldStart.setValue(ogTasks.userPreferences.dateStart);}
this.statusCombo.setValue(ogTasks.userPreferences.status);this.add(lang('filter')+':');this.add(this.filtercombo);this.add(this.filterNamesCombo);this.add(this.filterNamesCompaniesCombo);this.add(this.filterPriorityCombo);this.add(this.filterSubtypeCombo);this.add(this.filterMilestonesCombo);if(ogTasks.additional_filtercombo_types){for(var x=0;x<ogTasks.additional_filtercombo_types.length;x++){var fc_type=ogTasks.additional_filtercombo_types[x];try{if(fc_type&&fc_type.component_id){var comp=Ext.getCmp(fc_type.component_id);if(comp)this.add(comp);}}catch(e){}}}
this.add('&nbsp;&nbsp;&nbsp;'+lang('status')+':');this.add(this.statusCombo);this.add('&nbsp;&nbsp;&nbsp;'+lang('group by')+':');this.add(this.groupcombo);this.add('&nbsp;&nbsp;&nbsp;'+lang('order by')+':');this.add(this.ordercombo);if(og.config.tasks_use_date_filters){this.add('&nbsp;&nbsp;&nbsp;'+lang('from date')+':');this.add(this.dateFieldStart);this.add('&nbsp;&nbsp;&nbsp;'+lang('to date')+':');this.add(this.dateFieldEnd);}
if(ogTasks.extraBottomToolbarItems){for(i=0;i<ogTasks.extraBottomToolbarItems.length;i++){this.add(ogTasks.extraBottomToolbarItems[i]);}}};Ext.extend(og.TasksBottomToolbar,Ext.Toolbar,{load:function(params){if(!params)params={};Ext.apply(params,this.getFilters());og.openLink(og.getUrl('task','new_list_tasks',params));},getDisplayCriteria:function(){return{group_by:this.groupcombo.getValue(),order_by:this.ordercombo.getValue()}},getFilters:function(){var filterValue;switch(this.filtercombo.getValue()){case'milestone':filterValue=this.filterMilestonesCombo.getValue();break;case'priority':filterValue=this.filterPriorityCombo.getValue();break;case'subtype':filterValue=this.filterSubtypeCombo.getValue();break;case'assigned_to':filterValue=this.filterNamesCompaniesCombo.getValue();break;default:filterValue=this.filterNamesCombo.getValue();if(ogTasks.additional_filtercombo_types){for(var x=0;x<ogTasks.additional_filtercombo_types.length;x++){var fc_type=ogTasks.additional_filtercombo_types[x];if(fc_type&&fc_type.component_id&&this.filtercombo.getValue()==fc_type.id){var comp=Ext.getCmp(fc_type.component_id);if(comp)filterValue=comp.getValue();else filterValue="";}}}
break;}
return{status:this.statusCombo.getValue(),filter:this.filtercombo.getValue(),fval:filterValue}},cloneUserCompanyCombo:function(newId){var clone=this.filterNamesCompaniesCombo.cloneConfig({id:newId});return clone;}});Ext.reg("TasksBottomToolbar",og.TasksBottomToolbar);ogTasks.printAllGroups=function(){var printWindow=this.createPrintWindow();for(var i=0;i<this.Groups.length;i++){if(this.Groups[i].group_tasks!={}){this.printGroupHeader(this.Groups[i],printWindow);this.printGroupTasks(this.Groups[i],printWindow);}}
this.closePrintWindow(printWindow);}
ogTasks.printGroup=function(group_id){var group=this.getGroup(group_id);if(group){var printWindow=this.createPrintWindow();this.printGroupHeader(group,printWindow);this.printGroupTasks(group,printWindow);this.closePrintWindow(printWindow);}}
ogTasks.createPrintWindow=function(){var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width="+($(document).outerWidth()-100)+", height="+($(document).outerHeight()-50)+", left=50, top=25";var printWindow=window.open("","",disp_setting);printWindow.document.open();printWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">');printWindow.document.write('<html><head><title>'+lang('tasks list')+'</title>');printWindow.document.write('<LINK href="'+og.hostName+'/public/assets/themes/default/stylesheets/og/printTasks.css" rel="stylesheet" type="text/css">');printWindow.document.write('<LINK href="'+og.hostName+'/public/assets/themes/default/stylesheets/og/tasks.css" rel="stylesheet" type="text/css">');printWindow.document.write('<link href="'+og.hostName+'/public/assets/themes/default/stylesheets/website.css" rel="stylesheet" type="text/css">');printWindow.document.write('<link href="'+og.hostName+'/public/assets/themes/default/stylesheets/general/rewrites.css" rel="stylesheet" type="text/css">');printWindow.document.write('</head><body onLoad="self.print()">');return printWindow;}
ogTasks.closePrintWindow=function(printWindow){printWindow.document.write('</body></html>');printWindow.document.close();printWindow.focus();}
ogTasks.printGroupHeader=function(group,printWindow){printWindow.document.write('<h1>'+group.group_name+'</h1>');}
ogTasks.printGroupTasks=function(group,printWindow){var sb=new StringBuffer();sb.append("<table style='width:100%;max-width:1000px'>");var bottomToolbar=Ext.getCmp('tasksPanelBottomToolbarObject');var topToolbar=Ext.getCmp('tasksPanelTopToolbarObject');var displayCriteria=bottomToolbar.getDisplayCriteria();var drawOptions=topToolbar.getDrawOptions();for(var i in group.group_tasks){sb.append("<tr><td>");var task=group.group_tasks[i];var level=0;var parent=task.parent
while(i-level>0&&parent!=null){level++;parent=parent.parent;}
var color='White';if(task.priority==400){color='6';}else if(task.priority==300){color='18';}else if(task.priority==200){color='0';}
sb.append("<div class='task' style='margin-left:"+(4+(level*15))+"px;'>");sb.append("<table style='width:100%'><tr><td width=20><img src='"+og.hostName+"/public/assets/themes/default/images/16x16/wscolors/color"+color+".png' style='padding-right:3px'/></td><td>");if(task.assignedToId&&(displayCriteria.group_by!='assigned_to'||task.assignedToId!=group.group_id)){sb.append("<b>"+og.clean(this.getUserCompanyName(task.assignedToId))+'</b>:&nbsp;');}
sb.append(og.clean(task.title));sb.append("</td>");sb.append("<td width='1px' align=right><table><tr>");if(drawOptions.show_end_dates||drawOptions.show_start_dates){sb.append('<td style="color:#888;font-size:10px;padding-left:6px;padding-right:6px;white-space:nowrap">');if(task.status==1)
sb.append('<span style="text-decoration:line-through;">');else
sb.append('<span>');if(task.estimatedTime){sb.append(lang('estimated')+': '+task.estimatedTime+'<br/>');var task_percent=task.percentCompleted;if(task.percentCompleted>100){task_percent=100;}
sb.append(lang('progress')+": "+task_percent+'%<br/>');}
if(task.startDate){var date=new Date(task.startDate*1000);sb.append(lang('start')+':&nbsp;'+date.dateFormat('M j'));}
if(task.startDate&&task.dueDate)
sb.append('<br/>');if(task.dueDate){var date=new Date((task.dueDate)*1000);var dueString=lang('due')+':&nbsp;'+date.dateFormat('M j');if(task.status==0){var now=new Date();if(date<now)
dueString='<span style="font-weight:bold;color:#F00">'+dueString+'</span>';}
sb.append(dueString);}
sb.append('</span></td>');}
if(drawOptions.show_time&&task.workingOnIds){var ids=(task.workingOnIds+' ').split(',');var userIsWorking=false;for(var j=0;j<ids.length;j++)
if(ids[j]==this.currentUser.id){userIsWorking=true;var pauses=(task.workingOnPauses+' ').split(',');var userPaused=pauses[j]==1;}
sb.append("<td><img src='"+og.hostName+"/public/assets/themes/default/images/16x16/time.png' style='padding-right:3px'/></td>");sb.append("<td class='ogTasksTimeTd' style='background-color:transparent;white-space:nowrap'>");for(var j=0;j<ids.length;j++){var user=this.getUser(ids[j]);if(user){sb.append(og.clean(user.name));if(j<ids.length-1)
sb.append("<br/>");}}
sb.append("</td>");}
sb.append("</tr></table>");sb.append("</td></tr></table>");sb.append("</div></td></tr>");}
sb.append("</table>");printWindow.document.write(sb.toString());}
og.TaskPopUp=function(action,task_id){var html_option="<div style='width:100%; margin: 10px; padding: 10px;'>";if(action=="task_complete"){html_option+="<div>"+lang('option repetitive title popup')+"</div>";html_option+="<div><input type='radio' name='type_related' value='only' onclick='selectRelated(this.value)' checked/>"+lang('option repetitive only task')+"</div>";html_option+="<div><input type='radio' name='type_related' value='pending' onclick='selectRelated(this.value)'/>"+lang('option repetitive pending task')+"</div>";}else{html_option+="<div>"+lang('apply changes to')+"</div>";html_option+="<div><input type='radio' name='type_related' value='only' onclick='selectRelated(this.value)'/>"+lang('only this task')+"</div>";html_option+="<div><input type='radio' name='type_related' value='news' onclick='selectRelated(this.value)' checked='checked'/>"+lang('this task alone and all to come forward')+"</div>";html_option+="<div><input type='radio' name='type_related' value='all' onclick='selectRelated(this.value)'/>"+lang('all tasks related')+"</div>";}
html_option+="<div><input type='hidden' name='action_related' id='action_related' value='"+action+"'/></div>";html_option+="<div><input type='hidden' name='complete_task_id' id='related_task_id' value='"+task_id+"'/></div>";html_option+="</div>";og.TaskPopUp.superclass.constructor.call(this,{y:220,width:390,height:230,id:'task-related',layout:'border',modal:true,resizable:false,closeAction:'close',border:false,buttons:[{text:lang('accept'),handler:this.accept,scope:this}],items:[{region:'center',layout:'fit',html:html_option}]});}
og.TaskCompletePopUp=function(task_id){var html_option="<div style='width:100%; margin: 10px; padding: 10px;'>";html_option+="<div>"+lang('complete task and subtask')+"</div>";html_option+="<div><input type='radio' name='complete_task' value='yes' onclick='selectTaskCompletePopUp(this.value)' checked/>"+lang('yes')+"</div>";html_option+="<div><input type='radio' name='complete_task' value='no' onclick='selectTaskCompletePopUp(this.value)'/>"+lang('no')+"</div>";html_option+="<div><input type='hidden' name='complete_task_id' id='complete_task_id' value='"+task_id+"'/></div>";html_option+="</div>";og.TaskCompletePopUp.superclass.constructor.call(this,{y:220,width:390,height:230,id:'task-complete',layout:'border',modal:true,resizable:false,closeAction:'close',border:false,buttons:[{text:lang('accept'),handler:this.accept,scope:this}],items:[{region:'center',layout:'fit',html:html_option}]});}
og.reportsFiltersData={temporal_selection:null,count_choosen:0,listeners_called:0};og.loadFiltersReport=function(report_id,skip_member=false){var temporal_selection=JSON.parse(localStorage.getItem('preload_filters_'+report_id));og.reportsFiltersData.temporal_selection=temporal_selection;og.reportsFiltersData.listeners_called=0;var total_preload_col=0;setTimeout(function(){total_preload_col=$(".cols_doble_contol select").eq(1).find('option').length;var count_choosen=0;$(temporal_selection).each(function(v,j){var current_element=$('[name="'+j.name+'"]');var type='';var tag_name='';try{var tag_name=$(current_element).get(0).tagName;var type=$(current_element).get(0).type;}catch(e){}
if(j.custom=='choosen'){}else if(j.custom=='combo'){if(comboBoxes!="undefined"&&Object.keys(comboBoxes).length===0){tsContactCombo.setValue(j.values);}else{var combo=comboBoxes[j.name];combo.setValue(j.values);}}else if(j.custom=='second_col'){$(j.values).each(function(c,v){if(c>total_preload_col){$(".cols_doble_contol").find('select:first').find('option[value="'+v+'"]').prop('selected','selected');$('.ico-arrowright').click();}})}else if(tag_name=='INPUT'&&type=='checkbox'){var check_value=$('[name="'+j.name+'"][value="'+j.value+'"]');$(check_value).prop('checked','checked');}else if(tag_name=='INPUT'&&type=='radio'){var check_value=$('[name="'+j.name+'"][value="'+j.value+'"]');$(check_value).prop('checked','checked');}else if(tag_name=='INPUT'){$(current_element).val(j.value);}else if(tag_name=='SELECT'){if(j.value!=0){var current_select=$("option[value='"+j.value+"']",current_element);current_select.prop('selected',true);current_select.change();}}})},500);}
og.setMemoryFilttersReport=function(object,report_id){var form=$(object).closest("form");var information=[];var standar_controls=$('select,input',form).serializeArray();var select_obj=$(".cols_doble_contol select").eq(1);var values_selected={"name":$(select_obj).attr('name'),"custom":"second_col","values":[]};$(select_obj).find('option').each(function(){values_selected.values.push($(this).val());})
$('.x-form-field-wrap').each(function(k,o){var have_combo=$(o).find('.assigned-to-combo');if(have_combo.length){var value=$(o).find('[type="hidden"]:first').val();var name=$(o).find('[type="hidden"]:first').prop("name");information.push({"name":name,"custom":"combo","values":value});}})
$(standar_controls).each(function(k,o){var current_object=$("[name='"+o.name+"']");var is_hidden=$(current_object).prop('type');var is_text_filter=$(current_object).hasClass('dimension-panel-textfilter');if(is_hidden!='hidden'&&!is_text_filter){information.push({"name":o.name,"custom":"","value":o.value});}})
information.push(values_selected);localStorage.setItem('preload_filters_'+report_id,JSON.stringify(information));}
(function($){var d=$(document);var h=$("head");var drag=null;var tables=[];var count=0;var ID="id";var PX="px";var SIGNATURE="JColResizer";var FLEX="JCLRFlex";var I=parseInt;var M=Math;var ie=navigator.userAgent.indexOf('Trident/4.0')>0;var S;try{S=sessionStorage;}catch(e){}
h.append("<style type='text/css'>  .JColResizer{table-layout:fixed;} .JColResizer td, .JColResizer th{overflow:hidden;padding-right:0!important;}  .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: e-resize;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black; } .JCLRFlex{width:auto!important;}</style>");var init=function(tb,options){var t=$(tb);t.opt=options;if(t.opt.disable)return destroy(t);var id=t.id=t.attr(ID)||SIGNATURE+count++;t.p=t.opt.postbackSafe;if(!t.is("table")||tables[id]&&!t.opt.partialRefresh)return;t.addClass(SIGNATURE).attr(ID,id).before('<div class="JCLRgrips"/>');t.g=[];t.c=[];t.w=t.width();t.gc=t.prev();t.f=t.opt.fixed;if(options.marginLeft)t.gc.css("marginLeft",options.marginLeft);if(options.marginRight)t.gc.css("marginRight",options.marginRight);t.cs=I(ie?tb.cellSpacing||tb.currentStyle.borderSpacing:t.css('border-spacing'))||2;t.b=I(ie?tb.border||tb.currentStyle.borderLeftWidth:t.css('border-left-width'))||1;tables[id]=t;createGrips(t);syncGrips(t);};var destroy=function(t){var id=t.attr(ID),t=tables[id];if(!t||!t.is("table"))return;t.removeClass(SIGNATURE+" "+FLEX).gc.remove();delete tables[id];};var createGrips=function(t){var th=t.find(">thead>tr>th,>thead>tr>td");if(!th.length)th=t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td");th=th.filter(":visible");t.cg=t.find("col");t.ln=th.length;if(t.p&&S&&S[t.id])memento(t,th);th.each(function(i){var noresize='style="display: none;"';if($(this).data('resizable')){noresize='';}
var c=$(this);var g=$(t.gc.append('<div class="JCLRgrip" '+noresize+'></div>')[0].lastChild);g.append(t.opt.gripInnerHtml).append('<div class="'+SIGNATURE+'"></div>');if(i==t.ln-1){g.addClass("JCLRLastGrip");if(t.f)g.html("");}
g.bind('touchstart mousedown',onGripMouseDown);g.t=t;g.i=i;g.c=c;c.w=c.width();t.g.push(g);t.c.push(c);c.width(c.w).removeAttr("width");g.data(SIGNATURE,{i:i,t:t.attr(ID),last:i==t.ln-1});});t.cg.removeAttr("width");syncGrips(t);t.find('td, th').not(th).not('table th, table td').each(function(){$(this).removeAttr('width');});if(!t.f){t.removeAttr('width').addClass(FLEX);}};var memento=function(t,th){var w,m=0,i=0,aux=[],tw;if(th){t.cg.removeAttr("width");if(t.opt.flush){S[t.id]="";return;}
w=S[t.id].split(";");tw=w[t.ln+1];if(!t.f&&tw)t.width(tw);for(;i<t.ln;i++){if(th.eq(i).data('resizable')){aux.push(w[i]+PX);}else{aux.push(th.eq(i).css('min-width'));}
th.eq(i).css("width",aux[i]);}
for(i=0;i<t.ln;i++){t.cg.eq(i).css("width",aux[i]);if(th.eq(i).data('resizable')){t.cg.eq(i).css("min-width",aux[i]);th.eq(i).css("min-width",aux[i]);}}}else{S[t.id]="";for(;i<t.c.length;i++){w=t.c[i].width();S[t.id]+=w+";";m+=w;}
S[t.id]+=m;if(!t.f)S[t.id]+=";"+t.width();}};var syncGrips=function(t){t.gc.width(t.w);for(var i=0;i<t.ln;i++){var c=t.c[i];t.g[i].css({left:c.offset().left-t.offset().left+c.outerWidth(false)+t.cs/2+PX,height:t.opt.headerOnly?t.c[0].outerHeight(false):t.outerHeight(false)});}};var syncCols=function(t,i,isOver){var inc=drag.x-drag.l,c=t.c[i],c2=t.c[i+1];var w=c.w+inc;var w2=c2.w-inc;c.width(w+PX);c.css(w+PX);c.css({"min-width":w+PX});t.cg.eq(i).css("min-width",w+PX);t.cg.eq(i).width(w+PX);if(t.f){c2.width(w2+PX);t.cg.eq(i+1).width(w2+PX);}
if(isOver){c.w=w;c2.w=t.f?w2:c2.w;}};var applyBounds=function(t){var w=$.map(t.c,function(c){return c.width();});t.width(t.width()).removeClass(FLEX);$.each(t.c,function(i,c){if(c.data('resizable')){c.width(w[i]).w=w[i];}});t.addClass(FLEX);};var onGripDrag=function(e){if(!drag)return;var t=drag.t;var oe=e.originalEvent.touches;var ox=oe?oe[0].pageX:e.pageX;var x=ox-drag.ox+drag.l;var mw=t.opt.minWidth,i=drag.i;var l=t.cs*1.5+mw+t.b;var last=i==t.ln-1;var min=i?t.g[i-1].position().left+t.cs+mw:l;var max=t.f?i==t.ln-1?t.w-l:t.g[i+1].position().left-t.cs-mw:Infinity;x=M.max(min,M.min(max,x));drag.x=x;drag.css("left",x+PX);if(last){var c=t.c[drag.i];drag.w=c.w+x-drag.l;}
if(t.opt.liveDrag){if(last){c.width(drag.w);t.w=t.width();}else{syncCols(t,i);}
syncGrips(t);var cb=t.opt.onDrag;if(cb){e.currentTarget=t[0];cb(e);}}
return false;};var onGripDragOver=function(e){d.unbind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE).unbind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE);$("head :last-child").remove();if(!drag)return;drag.removeClass(drag.t.opt.draggingClass);var t=drag.t;var cb=t.opt.onResize;var i=drag.i;var last=i==t.ln-1;var c=t.g[i].c;if(last){c.width(drag.w);c.w=drag.w;}else{syncCols(t,i,true);}
if(!t.f)applyBounds(t);syncGrips(t);if(cb){e.currentTarget=t[0];cb(e);}
if(t.p&&S)memento(t);drag=null;};var onGripMouseDown=function(e){var o=$(this).data(SIGNATURE);var t=tables[o.t],g=t.g[o.i];var oe=e.originalEvent.touches;g.ox=oe?oe[0].pageX:e.pageX;g.l=g.position().left;d.bind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE,onGripDrag).bind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE,onGripDragOver);h.append("<style type='text/css'>*{cursor:"+t.opt.dragCursor+"!important}</style>");g.addClass(t.opt.draggingClass);drag=g;if(t.c[o.i].l)for(var i=0,c;i<t.ln;i++){c=t.c[i];c.l=false;c.w=c.width();}
return false;};var onResize=function(){for(t in tables){var t=tables[t],i,mw=0;if(t instanceof jQuery){t.removeClass(SIGNATURE);t.removeClass(FLEX);if(t.f&&t.w!=t.width()){t.w=t.width();for(i=0;i<t.ln;i++)mw+=t.c[i].w;for(i=0;i<t.ln;i++)t.c[i].css("width",M.round(1000*t.c[i].w/mw)/10+"%").l=true;}
t.addClass(FLEX);t.addClass(SIGNATURE);syncGrips(t);}}};$(window).bind('resize.'+SIGNATURE,onResize);$.fn.extend({colResizable:function(options){var defaults={draggingClass:'JCLRgripDrag',gripInnerHtml:'',liveDrag:false,fixed:true,minWidth:15,headerOnly:false,hoverCursor:"e-resize",dragCursor:"e-resize",postbackSafe:false,flush:false,marginLeft:null,marginRight:null,disable:false,partialRefresh:false,onDrag:null,onResize:null}
var options=$.extend(defaults,options);return this.each(function(){init(this,options);});}});})(jQuery);!function(e){var a=function(){"use strict";var e="s",s={DAY:864e5,HOUR:36e5,MINUTE:6e4,SECOND:1e3,BASELINE_YEAR:2014,MAX_SCORE:864e6,AMBIGUITIES:{"America/Denver":["America/Mazatlan"],"Europe/London":["Africa/Casablanca"],"America/Chicago":["America/Mexico_City"],"America/Asuncion":["America/Campo_Grande","America/Santiago"],"America/Montevideo":["America/Sao_Paulo","America/Santiago"],"Asia/Beirut":["Asia/Amman","Asia/Jerusalem","Europe/Helsinki","Asia/Damascus","Africa/Cairo","Asia/Gaza","Europe/Minsk"],"Pacific/Auckland":["Pacific/Fiji"],"America/Los_Angeles":["America/Santa_Isabel"],"America/New_York":["America/Havana"],"America/Halifax":["America/Goose_Bay"],"America/Godthab":["America/Miquelon"],"Asia/Dubai":["Asia/Yerevan"],"Asia/Jakarta":["Asia/Krasnoyarsk"],"Asia/Shanghai":["Asia/Irkutsk","Australia/Perth"],"Australia/Sydney":["Australia/Lord_Howe"],"Asia/Tokyo":["Asia/Yakutsk"],"Asia/Dhaka":["Asia/Omsk"],"Asia/Baku":["Asia/Yerevan"],"Australia/Brisbane":["Asia/Vladivostok"],"Pacific/Noumea":["Asia/Vladivostok"],"Pacific/Majuro":["Asia/Kamchatka","Pacific/Fiji"],"Pacific/Tongatapu":["Pacific/Apia"],"Asia/Baghdad":["Europe/Minsk","Europe/Moscow"],"Asia/Karachi":["Asia/Yekaterinburg"],"Africa/Johannesburg":["Asia/Gaza","Africa/Cairo"]}},i=function(e){var a=-e.getTimezoneOffset();return null!==a?a:0},r=function(){var a=i(new Date(s.BASELINE_YEAR,0,2)),r=i(new Date(s.BASELINE_YEAR,5,2)),n=a-r;return 0>n?a+",1":n>0?r+",1,"+e:a+",0"},n=function(){var e,a;if("undefined"!=typeof Intl&&"undefined"!=typeof Intl.DateTimeFormat&&(e=Intl.DateTimeFormat(),"undefined"!=typeof e&&"undefined"!=typeof e.resolvedOptions))return a=e.resolvedOptions().timeZone,a&&(a.indexOf("/")>-1||"UTC"===a)?a:void 0},o=function(e){for(var a=new Date(e,0,1,0,0,1,0).getTime(),s=new Date(e,12,31,23,59,59).getTime(),i=a,r=new Date(i).getTimezoneOffset(),n=null,o=null;s-864e5>i;){var t=new Date(i),A=t.getTimezoneOffset();A!==r&&(r>A&&(n=t),A>r&&(o=t),r=A),i+=864e5}return n&&o?{s:u(n).getTime(),e:u(o).getTime()}:!1},u=function l(e,a,i){"undefined"==typeof a&&(a=s.DAY,i=s.HOUR);for(var r=new Date(e.getTime()-a).getTime(),n=e.getTime()+a,o=new Date(r).getTimezoneOffset(),u=r,t=null;n-i>u;){var A=new Date(u),c=A.getTimezoneOffset();if(c!==o){t=A;break}u+=i}return a===s.DAY?l(t,s.HOUR,s.MINUTE):a===s.HOUR?l(t,s.MINUTE,s.SECOND):t},t=function(e,a,s,i){if("N/A"!==s)return s;if("Asia/Beirut"===a){if("Africa/Cairo"===i.name&&13983768e5===e[6].s&&14116788e5===e[6].e)return 0;if("Asia/Jerusalem"===i.name&&13959648e5===e[6].s&&14118588e5===e[6].e)return 0}else if("America/Santiago"===a){if("America/Asuncion"===i.name&&14124816e5===e[6].s&&1397358e6===e[6].e)return 0;if("America/Campo_Grande"===i.name&&14136912e5===e[6].s&&13925196e5===e[6].e)return 0}else if("America/Montevideo"===a){if("America/Sao_Paulo"===i.name&&14136876e5===e[6].s&&1392516e6===e[6].e)return 0}else if("Pacific/Auckland"===a&&"Pacific/Fiji"===i.name&&14142456e5===e[6].s&&13961016e5===e[6].e)return 0;return s},A=function(e,i){for(var r=function(a){for(var r=0,n=0;n<e.length;n++)if(a.rules[n]&&e[n]){if(!(e[n].s>=a.rules[n].s&&e[n].e<=a.rules[n].e)){r="N/A";break}if(r=0,r+=Math.abs(e[n].s-a.rules[n].s),r+=Math.abs(a.rules[n].e-e[n].e),r>s.MAX_SCORE){r="N/A";break}}return r=t(e,i,r,a)},n={},o=a.olson.dst_rules.zones,u=o.length,A=s.AMBIGUITIES[i],c=0;u>c;c++){var m=o[c],l=r(o[c]);"N/A"!==l&&(n[m.name]=l)}for(var f in n)if(n.hasOwnProperty(f))for(var d=0;d<A.length;d++)if(A[d]===f)return f;return i},c=function(e){var s=function(){for(var e=[],s=0;s<a.olson.dst_rules.years.length;s++){var i=o(a.olson.dst_rules.years[s]);e.push(i)}return e},i=function(e){for(var a=0;a<e.length;a++)if(e[a]!==!1)return!0;return!1},r=s(),n=i(r);return n?A(r,e):e},m=function(){var e=n();return e||(e=a.olson.timezones[r()],"undefined"!=typeof s.AMBIGUITIES[e]&&(e=c(e))),{name:function(){return e}}};return{determine:m}}();a.olson=a.olson||{},a.olson.timezones={"-720,0":"Etc/GMT+12","-660,0":"Pacific/Pago_Pago","-660,1,s":"Pacific/Apia","-600,1":"America/Adak","-600,0":"Pacific/Honolulu","-570,0":"Pacific/Marquesas","-540,0":"Pacific/Gambier","-540,1":"America/Anchorage","-480,1":"America/Los_Angeles","-480,0":"Pacific/Pitcairn","-420,0":"America/Phoenix","-420,1":"America/Denver","-360,0":"America/Guatemala","-360,1":"America/Chicago","-360,1,s":"Pacific/Easter","-300,0":"America/Bogota","-300,1":"America/New_York","-270,0":"America/Caracas","-240,1":"America/Halifax","-240,0":"America/Santo_Domingo","-240,1,s":"America/Asuncion","-210,1":"America/St_Johns","-180,1":"America/Godthab","-180,0":"America/Argentina/Buenos_Aires","-180,1,s":"America/Montevideo","-120,0":"America/Noronha","-120,1":"America/Noronha","-60,1":"Atlantic/Azores","-60,0":"Atlantic/Cape_Verde","0,0":"UTC","0,1":"Europe/London","60,1":"Europe/Berlin","60,0":"Africa/Lagos","60,1,s":"Africa/Windhoek","120,1":"Asia/Beirut","120,0":"Africa/Johannesburg","180,0":"Asia/Baghdad","180,1":"Europe/Moscow","210,1":"Asia/Tehran","240,0":"Asia/Dubai","240,1":"Asia/Baku","270,0":"Asia/Kabul","300,1":"Asia/Yekaterinburg","300,0":"Asia/Karachi","330,0":"Asia/Kolkata","345,0":"Asia/Kathmandu","360,0":"Asia/Dhaka","360,1":"Asia/Omsk","390,0":"Asia/Rangoon","420,1":"Asia/Krasnoyarsk","420,0":"Asia/Jakarta","480,0":"Asia/Shanghai","480,1":"Asia/Irkutsk","525,0":"Australia/Eucla","525,1,s":"Australia/Eucla","540,1":"Asia/Yakutsk","540,0":"Asia/Tokyo","570,0":"Australia/Darwin","570,1,s":"Australia/Adelaide","600,0":"Australia/Brisbane","600,1":"Asia/Vladivostok","600,1,s":"Australia/Sydney","630,1,s":"Australia/Lord_Howe","660,1":"Asia/Kamchatka","660,0":"Pacific/Noumea","690,0":"Pacific/Norfolk","720,1,s":"Pacific/Auckland","720,0":"Pacific/Majuro","765,1,s":"Pacific/Chatham","780,0":"Pacific/Tongatapu","780,1,s":"Pacific/Apia","840,0":"Pacific/Kiritimati"},a.olson.dst_rules={years:[2008,2009,2010,2011,2012,2013,2014],zones:[{name:"Africa/Cairo",rules:[{e:12199572e5,s:12090744e5},{e:1250802e6,s:1240524e6},{e:12858804e5,s:12840696e5},!1,!1,!1,{e:14116788e5,s:1406844e6}]},{name:"Africa/Casablanca",rules:[{e:12202236e5,s:12122784e5},{e:12508092e5,s:12438144e5},{e:1281222e6,s:12727584e5},{e:13120668e5,s:13017888e5},{e:13489704e5,s:1345428e6},{e:13828392e5,s:13761e8},{e:14142888e5,s:14069448e5}]},{name:"America/Asuncion",rules:[{e:12050316e5,s:12243888e5},{e:12364812e5,s:12558384e5},{e:12709548e5,s:12860784e5},{e:13024044e5,s:1317528e6},{e:1333854e6,s:13495824e5},{e:1364094e6,s:1381032e6},{e:13955436e5,s:14124816e5}]},{name:"America/Campo_Grande",rules:[{e:12032172e5,s:12243888e5},{e:12346668e5,s:12558384e5},{e:12667212e5,s:1287288e6},{e:12981708e5,s:13187376e5},{e:13302252e5,s:1350792e6},{e:136107e7,s:13822416e5},{e:13925196e5,s:14136912e5}]},{name:"America/Goose_Bay",rules:[{e:122559486e4,s:120503526e4},{e:125704446e4,s:123648486e4},{e:128909886e4,s:126853926e4},{e:13205556e5,s:129998886e4},{e:13520052e5,s:13314456e5},{e:13834548e5,s:13628952e5},{e:14149044e5,s:13943448e5}]},{name:"America/Havana",rules:[{e:12249972e5,s:12056436e5},{e:12564468e5,s:12364884e5},{e:12885012e5,s:12685428e5},{e:13211604e5,s:13005972e5},{e:13520052e5,s:13332564e5},{e:13834548e5,s:13628916e5},{e:14149044e5,s:13943412e5}]},{name:"America/Mazatlan",rules:[{e:1225008e6,s:12074724e5},{e:12564576e5,s:1238922e6},{e:1288512e6,s:12703716e5},{e:13199616e5,s:13018212e5},{e:13514112e5,s:13332708e5},{e:13828608e5,s:13653252e5},{e:14143104e5,s:13967748e5}]},{name:"America/Mexico_City",rules:[{e:12250044e5,s:12074688e5},{e:1256454e6,s:12389184e5},{e:12885084e5,s:1270368e6},{e:1319958e6,s:13018176e5},{e:13514076e5,s:13332672e5},{e:13828572e5,s:13653216e5},{e:14143068e5,s:13967712e5}]},{name:"America/Miquelon",rules:[{e:12255984e5,s:12050388e5},{e:1257048e6,s:12364884e5},{e:12891024e5,s:12685428e5},{e:1320552e6,s:12999924e5},{e:13520016e5,s:1331442e6},{e:13834512e5,s:13628916e5},{e:14149008e5,s:13943412e5}]},{name:"America/Santa_Isabel",rules:[{e:12250116e5,s:1207476e6},{e:12564612e5,s:12389256e5},{e:12885156e5,s:12703752e5},{e:13199652e5,s:13018248e5},{e:13514148e5,s:13332744e5},{e:13828644e5,s:13653288e5},{e:1414314e6,s:13967784e5}]},{name:"America/Santiago",rules:[{e:1206846e6,s:1223784e6},{e:1237086e6,s:12552336e5},{e:127035e7,s:12866832e5},{e:13048236e5,s:13138992e5},{e:13356684e5,s:13465584e5},{e:1367118e6,s:13786128e5},{e:13985676e5,s:14100624e5}]},{name:"America/Sao_Paulo",rules:[{e:12032136e5,s:12243852e5},{e:12346632e5,s:12558348e5},{e:12667176e5,s:12872844e5},{e:12981672e5,s:1318734e6},{e:13302216e5,s:13507884e5},{e:13610664e5,s:1382238e6},{e:1392516e6,s:14136876e5}]},{name:"Asia/Amman",rules:[{e:1225404e6,s:12066552e5},{e:12568536e5,s:12381048e5},{e:12883032e5,s:12695544e5},{e:13197528e5,s:13016088e5},!1,!1,{e:14147064e5,s:13959576e5}]},{name:"Asia/Damascus",rules:[{e:12254868e5,s:120726e7},{e:125685e7,s:12381048e5},{e:12882996e5,s:12701592e5},{e:13197492e5,s:13016088e5},{e:13511988e5,s:13330584e5},{e:13826484e5,s:1364508e6},{e:14147028e5,s:13959576e5}]},{name:"Asia/Dubai",rules:[!1,!1,!1,!1,!1,!1,!1]},{name:"Asia/Gaza",rules:[{e:12199572e5,s:12066552e5},{e:12520152e5,s:12381048e5},{e:1281474e6,s:126964086e4},{e:1312146e6,s:130160886e4},{e:13481784e5,s:13330584e5},{e:13802292e5,s:1364508e6},{e:1414098e6,s:13959576e5}]},{name:"Asia/Irkutsk",rules:[{e:12249576e5,s:12068136e5},{e:12564072e5,s:12382632e5},{e:12884616e5,s:12697128e5},!1,!1,!1,!1]},{name:"Asia/Jerusalem",rules:[{e:12231612e5,s:12066624e5},{e:1254006e6,s:1238112e6},{e:1284246e6,s:12695616e5},{e:131751e7,s:1301616e6},{e:13483548e5,s:13330656e5},{e:13828284e5,s:13645152e5},{e:1414278e6,s:13959648e5}]},{name:"Asia/Kamchatka",rules:[{e:12249432e5,s:12067992e5},{e:12563928e5,s:12382488e5},{e:12884508e5,s:12696984e5},!1,!1,!1,!1]},{name:"Asia/Krasnoyarsk",rules:[{e:12249612e5,s:12068172e5},{e:12564108e5,s:12382668e5},{e:12884652e5,s:12697164e5},!1,!1,!1,!1]},{name:"Asia/Omsk",rules:[{e:12249648e5,s:12068208e5},{e:12564144e5,s:12382704e5},{e:12884688e5,s:126972e7},!1,!1,!1,!1]},{name:"Asia/Vladivostok",rules:[{e:12249504e5,s:12068064e5},{e:12564e8,s:1238256e6},{e:12884544e5,s:12697056e5},!1,!1,!1,!1]},{name:"Asia/Yakutsk",rules:[{e:1224954e6,s:120681e7},{e:12564036e5,s:12382596e5},{e:1288458e6,s:12697092e5},!1,!1,!1,!1]},{name:"Asia/Yekaterinburg",rules:[{e:12249684e5,s:12068244e5},{e:1256418e6,s:1238274e6},{e:12884724e5,s:12697236e5},!1,!1,!1,!1]},{name:"Asia/Yerevan",rules:[{e:1224972e6,s:1206828e6},{e:12564216e5,s:12382776e5},{e:1288476e6,s:12697272e5},{e:13199256e5,s:13011768e5},!1,!1,!1]},{name:"Australia/Lord_Howe",rules:[{e:12074076e5,s:12231342e5},{e:12388572e5,s:12545838e5},{e:12703068e5,s:12860334e5},{e:13017564e5,s:1317483e6},{e:1333206e6,s:13495374e5},{e:13652604e5,s:1380987e6},{e:139671e7,s:14124366e5}]},{name:"Australia/Perth",rules:[{e:12068136e5,s:12249576e5},!1,!1,!1,!1,!1,!1]},{name:"Europe/Helsinki",rules:[{e:12249828e5,s:12068388e5},{e:12564324e5,s:12382884e5},{e:12884868e5,s:1269738e6},{e:13199364e5,s:13011876e5},{e:1351386e6,s:13326372e5},{e:13828356e5,s:13646916e5},{e:14142852e5,s:13961412e5}]},{name:"Europe/Minsk",rules:[{e:12249792e5,s:12068352e5},{e:12564288e5,s:12382848e5},{e:12884832e5,s:12697344e5},!1,!1,!1,!1]},{name:"Europe/Moscow",rules:[{e:12249756e5,s:12068316e5},{e:12564252e5,s:12382812e5},{e:12884796e5,s:12697308e5},!1,!1,!1,!1]},{name:"Pacific/Apia",rules:[!1,!1,!1,{e:13017528e5,s:13168728e5},{e:13332024e5,s:13489272e5},{e:13652568e5,s:13803768e5},{e:13967064e5,s:14118264e5}]},{name:"Pacific/Fiji",rules:[!1,!1,{e:12696984e5,s:12878424e5},{e:13271544e5,s:1319292e6},{e:1358604e6,s:13507416e5},{e:139005e7,s:1382796e6},{e:14215032e5,s:14148504e5}]},{name:"Europe/London",rules:[{e:12249828e5,s:12068388e5},{e:12564324e5,s:12382884e5},{e:12884868e5,s:1269738e6},{e:13199364e5,s:13011876e5},{e:1351386e6,s:13326372e5},{e:13828356e5,s:13646916e5},{e:14142852e5,s:13961412e5}]}]},"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a:"undefined"!=typeof define&&null!==define&&null!=define.amd?define([],function(){return a}):"undefined"==typeof e?window.jstz=a:e.jstz=a}();(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return/(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetParent,i=o&&o.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(o.nodeName)&&'static'===t(o,'position')?r(o):o:e?e.ownerDocument.documentElement:document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,a=document.createRange();a.setStart(i,0),a.setEnd(n,0);var l=a.commonAncestorContainer;if(e!==l&&t!==l||i.contains(n))return p(l)?l:r(l);var f=s(e);return f.host?d(f.host,t):d(e,s(t).host)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',i=e.nodeName;if('BODY'===i||'HTML'===i){var n=e.ownerDocument.documentElement,r=e.ownerDocument.scrollingElement||n;return r[o]}return e[o]}function l(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=a(t,'top'),n=a(t,'left'),r=o?-1:1;return e.top+=i*r,e.bottom+=i*r,e.left+=n*r,e.right+=n*r,e}function f(e,t){var o='x'===t?'Left':'Top',i='Left'==o?'Right':'Bottom';return parseFloat(e['border'+o+'Width'],10)+parseFloat(e['border'+i+'Width'],10)}function m(e,t,o,i){return J(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],ie()?o['offset'+e]+i['margin'+('Height'===e?'Top':'Left')]+i['margin'+('Height'===e?'Bottom':'Right')]:0)}function h(){var e=document.body,t=document.documentElement,o=ie()&&getComputedStyle(t);return{height:m('Height',e,t,o),width:m('Width',e,t,o)}}function c(e){return se({},e,{right:e.left+e.width,bottom:e.top+e.height})}function g(e){var o={};if(ie())try{o=e.getBoundingClientRect();var i=a(e,'top'),n=a(e,'left');o.top+=i,o.left+=n,o.bottom+=i,o.right+=n}catch(e){}else o=e.getBoundingClientRect();var r={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},p='HTML'===e.nodeName?h():{},s=p.width||e.clientWidth||r.right-r.left,d=p.height||e.clientHeight||r.bottom-r.top,l=e.offsetWidth-s,m=e.offsetHeight-d;if(l||m){var g=t(e);l-=f(g,'x'),m-=f(g,'y'),r.width-=l,r.height-=m}return c(r)}function u(e,o){var i=ie(),r='HTML'===o.nodeName,p=g(e),s=g(o),d=n(e),a=t(o),f=parseFloat(a.borderTopWidth,10),m=parseFloat(a.borderLeftWidth,10),h=c({top:p.top-s.top-f,left:p.left-s.left-m,width:p.width,height:p.height});if(h.marginTop=0,h.marginLeft=0,!i&&r){var u=parseFloat(a.marginTop,10),b=parseFloat(a.marginLeft,10);h.top-=f-u,h.bottom-=f-u,h.left-=m-b,h.right-=m-b,h.marginTop=u,h.marginLeft=b}return(i?o.contains(d):o===d&&'BODY'!==d.nodeName)&&(h=l(h,o)),h}function b(e){var t=e.ownerDocument.documentElement,o=u(e,t),i=J(t.clientWidth,window.innerWidth||0),n=J(t.clientHeight,window.innerHeight||0),r=a(t),p=a(t,'left'),s={top:r-o.top+o.marginTop,left:p-o.left+o.marginLeft,width:i,height:n};return c(s)}function w(e){var i=e.nodeName;return'BODY'===i||'HTML'===i?!1:'fixed'===t(e,'position')||w(o(e))}function y(e,t,i,r){var p={top:0,left:0},s=d(e,t);if('viewport'===r)p=b(s);else{var a;'scrollParent'===r?(a=n(o(t)),'BODY'===a.nodeName&&(a=e.ownerDocument.documentElement)):'window'===r?a=e.ownerDocument.documentElement:a=r;var l=u(a,s);if('HTML'===a.nodeName&&!w(s)){var f=h(),m=f.height,c=f.width;p.top+=l.top-l.marginTop,p.bottom=m+l.top,p.left+=l.left-l.marginLeft,p.right=c+l.left}else p=l}return p.left+=i,p.top+=i,p.right-=i,p.bottom-=i,p}function E(e){var t=e.width,o=e.height;return t*o}function v(e,t,o,i,n){var r=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var p=y(o,i,r,n),s={top:{width:p.width,height:t.top-p.top},right:{width:p.right-t.right,height:p.height},bottom:{width:p.width,height:p.bottom-t.bottom},left:{width:t.left-p.left,height:p.height}},d=Object.keys(s).map(function(e){return se({key:e},s[e],{area:E(s[e])})}).sort(function(e,t){return t.area-e.area}),a=d.filter(function(e){var t=e.width,i=e.height;return t>=o.clientWidth&&i>=o.clientHeight}),l=0<a.length?a[0].key:d[0].key,f=e.split('-')[1];return l+(f?'-'+f:'')}function O(e,t,o){var i=d(t,o);return u(o,i)}function L(e){var t=getComputedStyle(e),o=parseFloat(t.marginTop)+parseFloat(t.marginBottom),i=parseFloat(t.marginLeft)+parseFloat(t.marginRight),n={width:e.offsetWidth+i,height:e.offsetHeight+o};return n}function x(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function S(e,t,o){o=o.split('-')[0];var i=L(e),n={width:i.width,height:i.height},r=-1!==['right','left'].indexOf(o),p=r?'top':'left',s=r?'left':'top',d=r?'height':'width',a=r?'width':'height';return n[p]=t[p]+t[d]/2-i[d]/2,n[s]=o===s?t[s]-i[a]:t[x(s)],n}function T(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function D(e,t,o){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===o});var i=T(e,function(e){return e[t]===o});return e.indexOf(i)}function C(t,o,i){var n=void 0===i?t:t.slice(0,D(t,'name',i));return n.forEach(function(t){t['function']&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var i=t['function']||t.fn;t.enabled&&e(i)&&(o.offsets.popper=c(o.offsets.popper),o.offsets.reference=c(o.offsets.reference),o=i(o,t))}),o}function N(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=O(this.state,this.popper,this.reference),e.placement=v(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=S(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position='absolute',e=C(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function k(e,t){return e.some(function(e){var o=e.name,i=e.enabled;return i&&o===t})}function W(e){for(var t=[!1,'ms','Webkit','Moz','O'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length-1;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof document.body.style[r])return r}return null}function P(){return this.state.isDestroyed=!0,k(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[W('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function B(e){var t=e.ownerDocument;return t?t.defaultView:window}function H(e,t,o,i){var r='BODY'===e.nodeName,p=r?e.ownerDocument.defaultView:e;p.addEventListener(t,o,{passive:!0}),r||H(n(p.parentNode),t,o,i),i.push(p)}function A(e,t,o,i){o.updateBound=i,B(e).addEventListener('resize',o.updateBound,{passive:!0});var r=n(e);return H(r,'scroll',o.updateBound,o.scrollParents),o.scrollElement=r,o.eventsEnabled=!0,o}function I(){this.state.eventsEnabled||(this.state=A(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return B(e).removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function R(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function U(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function Y(e,t){Object.keys(t).forEach(function(o){var i='';-1!==['width','height','top','right','bottom','left'].indexOf(o)&&U(t[o])&&(i='px'),e.style[o]=t[o]+i})}function j(e,t){Object.keys(t).forEach(function(o){var i=t[o];!1===i?e.removeAttribute(o):e.setAttribute(o,t[o])})}function F(e,t,o){var i=T(e,function(e){var o=e.name;return o===t}),n=!!i&&e.some(function(e){return e.name===o&&e.enabled&&e.order<i.order});if(!n){var r='`'+t+'`';console.warn('`'+o+'`'+' modifier is required by '+r+' modifier in order to work, be sure to include it before '+r+'!')}return n}function K(e){return'end'===e?'start':'start'===e?'end':e}function q(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=ae.indexOf(e),i=ae.slice(o+1).concat(ae.slice(0,o));return t?i.reverse():i}function V(e,t,o,i){var n=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+n[1],p=n[2];if(!r)return e;if(0===p.indexOf('%')){var s;switch(p){case'%p':s=o;break;case'%':case'%r':default:s=i;}var d=c(s);return d[t]/100*r}if('vh'===p||'vw'===p){var a;return a='vh'===p?J(document.documentElement.clientHeight,window.innerHeight||0):J(document.documentElement.clientWidth,window.innerWidth||0),a/100*r}return r}function z(e,t,o,i){var n=[0,0],r=-1!==['right','left'].indexOf(i),p=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=p.indexOf(T(p,function(e){return-1!==e.search(/,|\s/)}));p[s]&&-1===p[s].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var d=/\s*,\s*|\s+/,a=-1===s?[p]:[p.slice(0,s).concat([p[s].split(d)[0]]),[p[s].split(d)[1]].concat(p.slice(s+1))];return a=a.map(function(e,i){var n=(1===i?!r:r)?'height':'width',p=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,p=!0,e):p?(e[e.length-1]+=t,p=!1,e):e.concat(t)},[]).map(function(e){return V(e,n,t,o)})}),a.forEach(function(e,t){e.forEach(function(o,i){U(o)&&(n[t]+=o*('-'===e[i-1]?-1:1))})}),n}function G(e,t){var o,i=t.offset,n=e.placement,r=e.offsets,p=r.popper,s=r.reference,d=n.split('-')[0];return o=U(+i)?[+i,0]:z(i,p,s,d),'left'===d?(p.top+=o[0],p.left-=o[1]):'right'===d?(p.top+=o[0],p.left+=o[1]):'top'===d?(p.left+=o[0],p.top-=o[1]):'bottom'===d&&(p.left+=o[0],p.top+=o[1]),e.popper=p,e}for(var _=Math.min,X=Math.floor,J=Math.max,Q='undefined'!=typeof window&&'undefined'!=typeof document,Z=['Edge','Trident','Firefox'],$=0,ee=0;ee<Z.length;ee+=1)if(Q&&0<=navigator.userAgent.indexOf(Z[ee])){$=1;break}var i,te=Q&&window.Promise,oe=te?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},$))}},ie=function(){return void 0==i&&(i=-1!==navigator.appVersion.indexOf('MSIE 10')),i},ne=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},re=function(){function e(e,t){for(var o,n=0;n<t.length;n++)o=t[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),pe=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},se=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var i in t=arguments[o],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},de=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],ae=de.slice(3),le={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},fe=function(){function t(o,i){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};ne(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=oe(this.update.bind(this)),this.options=se({},t.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=o&&o.jquery?o[0]:o,this.popper=i&&i.jquery?i[0]:i,this.options.modifiers={},Object.keys(se({},t.Defaults.modifiers,r.modifiers)).forEach(function(e){n.options.modifiers[e]=se({},t.Defaults.modifiers[e]||{},r.modifiers?r.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return se({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(n.reference,n.popper,n.options,t,n.state)}),this.update();var p=this.options.eventsEnabled;p&&this.enableEventListeners(),this.state.eventsEnabled=p}return re(t,[{key:'update',value:function(){return N.call(this)}},{key:'destroy',value:function(){return P.call(this)}},{key:'enableEventListeners',value:function(){return I.call(this)}},{key:'disableEventListeners',value:function(){return R.call(this)}}]),t}();return fe.Utils=('undefined'==typeof window?global:window).PopperUtils,fe.placements=de,fe.Defaults={placement:'bottom',eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,o=t.split('-')[0],i=t.split('-')[1];if(i){var n=e.offsets,r=n.reference,p=n.popper,s=-1!==['bottom','top'].indexOf(o),d=s?'left':'top',a=s?'width':'height',l={start:pe({},d,r[d]),end:pe({},d,r[d]+r[a]-p[a])};e.offsets.popper=se({},p,l[i])}return e}},offset:{order:200,enabled:!0,fn:G,offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var o=t.boundariesElement||r(e.instance.popper);e.instance.reference===o&&(o=r(o));var i=y(e.instance.popper,e.instance.reference,t.padding,o);t.boundaries=i;var n=t.priority,p=e.offsets.popper,s={primary:function(e){var o=p[e];return p[e]<i[e]&&!t.escapeWithReference&&(o=J(p[e],i[e])),pe({},e,o)},secondary:function(e){var o='right'===e?'left':'top',n=p[o];return p[e]>i[e]&&!t.escapeWithReference&&(n=_(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=X,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]<r(i[d])&&(e.offsets.popper[d]=r(i[d])-o[a]),o[d]>r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var i;if(!F(e.instance.modifiers,'arrow','keepTogether'))return e;var n=o.element;if('string'==typeof n){if(n=e.instance.popper.querySelector(n),!n)return e;}else if(!e.instance.popper.contains(n))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexOf(r),l=a?'height':'width',f=a?'Top':'Left',m=f.toLowerCase(),h=a?'left':'top',g=a?'bottom':'right',u=L(n)[l];d[g]-u<s[m]&&(e.offsets.popper[m]-=s[m]-(d[g]-u)),d[m]+u>s[g]&&(e.offsets.popper[m]+=d[m]+u-s[g]),e.offsets.popper=c(e.offsets.popper);var b=d[m]+d[l]/2-u/2,w=t(e.instance.popper),y=parseFloat(w['margin'+f],10),E=parseFloat(w['border'+f+'Width'],10),v=b-e.offsets.popper[m]-y-E;return v=J(_(s[l]-u,v),0),e.arrowElement=n,e.offsets.arrow=(i={},pe(i,m,Math.round(v)),pe(i,h,''),i),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(k(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=y(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),i=e.placement.split('-')[0],n=x(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case le.FLIP:p=[i,n];break;case le.CLOCKWISE:p=q(i);break;case le.COUNTERCLOCKWISE:p=q(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=x(i);var a=e.offsets.popper,l=e.offsets.reference,f=X,m='left'===i&&f(a.right)>f(l.left)||'right'===i&&f(a.left)<f(l.right)||'top'===i&&f(a.bottom)>f(l.top)||'bottom'===i&&f(a.top)<f(l.bottom),h=f(a.left)<f(o.left),c=f(a.right)>f(o.right),g=f(a.top)<f(o.top),u=f(a.bottom)>f(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,w=-1!==['top','bottom'].indexOf(i),y=!!t.flipVariations&&(w&&'start'===r&&h||w&&'end'===r&&c||!w&&'start'===r&&g||!w&&'end'===r&&u);(m||b||y)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),y&&(r=K(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,S(e.instance.popper,e.offsets.reference,e.placement)),e=C(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[o]-(s?n[p?'width':'height']:0),e.placement=x(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!F(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=T(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<o.top||t.left>o.right||t.top>o.bottom||t.right<o.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var o=t.x,i=t.y,n=e.offsets.popper,p=T(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==p&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var s,d,a=void 0===p?t.gpuAcceleration:p,l=r(e.instance.popper),f=g(l),m={position:n.position},h={left:X(n.left),top:X(n.top),bottom:X(n.bottom),right:X(n.right)},c='bottom'===o?'top':'bottom',u='right'===i?'left':'right',b=W('transform');if(d='bottom'==c?-f.height+h.bottom:h.top,s='right'==u?-f.width+h.right:h.left,a&&b)m[b]='translate3d('+s+'px, '+d+'px, 0)',m[c]=0,m[u]=0,m.willChange='transform';else{var w='bottom'==c?-1:1,y='right'==u?-1:1;m[c]=d*w,m[u]=s*y,m.willChange=c+', '+u}var E={"x-placement":e.placement};return e.attributes=se({},E,e.attributes),e.styles=se({},m,e.styles),e.arrowStyles=se({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return Y(e.instance.popper,e.styles),j(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&Y(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,o,i,n){var r=O(n,t,e),p=v(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('x-placement',p),Y(t,{position:'absolute'}),o},gpuAcceleration:void 0}}},fe});og.bootstrap_helper={renderContactCombo:function(config){config.custom_selected_class='col-md-12 row';config.no_style_in_selected=true;config.is_bootstrap=true;og.renderContactSelector(config);$($("#"+config.id).children()[0]).removeClass().removeAttr("style").addClass("col-md-12 col-no-padding");$($("#"+config.id).children()[0]).find('img').remove();$($("#"+config.id).children()[0]).find('input').removeClass().removeAttr("style").addClass('form-control');},}