/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;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||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){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(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},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(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},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");},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(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){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;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(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:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!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);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/jquery-1.2.6.min.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/jquery-1.2.6.min.js');
/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext={version:"2.2.1"};window["undefined"]=window["undefined"];Ext.apply=function(d,e,b){if(b){Ext.apply(d,b)}if(d&&e&&typeof e=="object"){for(var a in e){d[a]=e[a]}}return d};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isChrome=ua.indexOf("chrome")>-1,isSafari=!isChrome&&(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=!isOpera&&ua.indexOf("msie")>-1,isIE7=!isOpera&&ua.indexOf("msie 7")>-1,isIE8=!isOpera&&ua.indexOf("msie 8")>-1,isGecko=!isSafari&&!isChrome&&ua.indexOf("gecko")>-1,isGecko3=isGecko&&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]}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){if(typeof v!="number"||isNaN(v)){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?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,isChrome:isChrome,isSafari:isSafari,isSafari3:isSafari3,isSafari2:isSafari&&!isSafari3,isIE:isIE,isIE6:isIE&&!isIE7&&!isIE8,isIE7:isIE7,isIE8:isIE8,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 q=parseInt(k.getStyle("borderTopWidth"),10)||0;var h=parseInt(k.getStyle("borderLeftWidth"),10)||0;o+=h;l+=q;if(f!=g&&k.getStyle("overflow")!="visible"){o+=h;l+=q}}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(q,r,o){var s=this.getListeners(q,o);if(s){for(var p=0,m=s.length;p<m;++p){var n=s[p];this.removeListener(q,n.type,n.fn)}}if(r&&q&&q.childNodes){for(p=0,m=q.childNodes.length;p<m;++p){this.purgeElement(q.childNodes[p],r,o)}}},getListeners:function(n,s){var q=[],m;if(!s){m=[g,k]}else{if(s=="unload"){m=[k]}else{m=[g]}}for(var p=0;p<m.length;++p){var u=m[p];if(u&&u.length>0){for(var r=0,t=u.length;r<t;++r){var o=u[r];if(o&&o[this.EL]===n&&(!s||s===o[this.TYPE])){q.push({type:o[this.TYPE],fn:o[this.FN],obj:o[this.OBJ],adjust:o[this.ADJ_SCOPE],index:r})}}}}return(q.length)?q:null},_unload:function(t){var s=Ext.lib.Event,q,p,n,m,o;for(q=0,m=k.length;q<m;++q){n=k[q];if(n){var r=window;if(n[s.ADJ_SCOPE]){if(n[s.ADJ_SCOPE]===true){r=n[s.OBJ]}else{r=n[s.ADJ_SCOPE]}}n[s.FN].call(r,s.getEvent(t),n[s.OBJ]);k[q]=null;n=null;r=null}}k=null;if(g&&g.length>0){p=g.length;while(p){o=p-1;n=g[o];if(n){s.removeListener(n[s.EL],n[s.TYPE],n[s.FN],o)}p=p-1}n=null;s.clearCache()}s.doRemove(window,"unload",s._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(l,j,e,k,f){if(f){var g=f.headers;if(g){for(var i in g){if(g.hasOwnProperty(i)){this.initHeader(i,g[i],false)}}}if(f.xmlData){if(!g||!g["Content-Type"]){this.initHeader("Content-Type","text/xml",false)}l=(l?l:(f.method?f.method:"POST"));k=f.xmlData}else{if(f.jsonData){if(!g||!g["Content-Type"]){this.initHeader("Content-Type","application/json",false)}l=(l?l:(f.method?f.method:"POST"));k=typeof f.jsonData=="object"?Ext.encode(f.jsonData):f.jsonData}}}return this.asyncRequest(l,j,e,k)},serializeForm:function(f){if(typeof f=="string"){f=(document.getElementById(f)||document.forms[f])}var g,e,h,l,m="",o=false;for(var n=0;n<f.elements.length;n++){g=f.elements[n];l=f.elements[n].disabled;e=f.elements[n].name;h=f.elements[n].value;if(!l&&e){switch(g.type){case"select-one":case"select-multiple":for(var k=0;k<g.options.length;k++){if(g.options[k].selected){if(Ext.isIE){m+=encodeURIComponent(e)+"="+encodeURIComponent(g.options[k].attributes.value.specified?g.options[k].value:g.options[k].text)+"&"}else{m+=encodeURIComponent(e)+"="+encodeURIComponent(g.options[k].hasAttribute("value")?g.options[k].value:g.options[k].text)+"&"}}}break;case"radio":case"checkbox":if(g.checked){m+=encodeURIComponent(e)+"="+encodeURIComponent(h)+"&"}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(o==false){m+=encodeURIComponent(e)+"="+encodeURIComponent(h)+"&";o=true}break;default:m+=encodeURIComponent(e)+"="+encodeURIComponent(h)+"&";break}}}m=m.substr(0,m.length-1);return m},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(k){var j,f;try{f=new XMLHttpRequest();j={conn:f,tId:k}}catch(h){for(var g=0;g<this.activeX.length;++g){try{f=new ActiveXObject(this.activeX[g]);j={conn:f,tId:k};break}catch(h){}}}finally{return j}},getConnectionObject:function(){var g;var h=this.transactionId;try{g=this.createXhrObject(h);if(g){this.transactionId++}}catch(f){}finally{return g}},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(j,k,f){if(!k){this.releaseObject(j);return}var h,g;try{if(j.conn.status!==undefined&&j.conn.status!=0){h=j.conn.status}else{h=13030}}catch(i){h=13030}if((h>=200&&h<300)||(Ext.isIE&&h==1223)){g=this.createResponseObject(j,k.argument);if(k.success){if(!k.scope){k.success(g)}else{k.success.apply(k.scope,[g])}}}else{switch(h){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:g=this.createExceptionObject(j.tId,k.argument,(f?f:false));if(k.failure){if(!k.scope){k.failure(g)}else{k.failure.apply(k.scope,[g])}}break;default:g=this.createResponseObject(j,k.argument);if(k.failure){if(!k.scope){k.failure(g)}else{k.failure.apply(k.scope,[g])}}}}this.releaseObject(j);g=null},createResponseObject:function(f,m){var j={};var p={};try{var h=f.conn.getAllResponseHeaders();var l=h.split("\n");for(var k=0;k<l.length;k++){var g=l[k].indexOf(":");if(g!=-1){p[l[k].substring(0,g)]=l[k].substring(g+2)}}}catch(n){}j.tId=f.tId;j.status=f.conn.status;j.statusText=f.conn.statusText;j.getResponseHeader=p;j.getAllResponseHeaders=h;j.responseText=f.conn.responseText;j.responseXML=f.conn.responseXML;if(typeof m!==undefined){j.argument=m}return j},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(h,e){var g=function(){this.onComplete.removeListener(g);if(typeof h=="function"){h.call(e||this,this)}};this.onComplete.addListener(g,this);this.animate()},setRuntimeAttribute:function(f){var l;var g;var h=this.attributes;this.runtimeAttributes[f]={};var k=function(i){return(typeof i!=="undefined")};if(!k(h[f]["to"])&&!k(h[f]["by"])){return false}l=(k(h[f]["from"]))?h[f]["from"]:this.getAttribute(f);if(k(h[f]["to"])){g=h[f]["to"]}else{if(k(h[f]["by"])){if(l.constructor==Array){g=[];for(var j=0,e=l.length;j<e;++j){g[j]=l[j]+h[f]["by"][j]}}else{g=l+h[f]["by"]}}}this.runtimeAttributes[f].start=l;this.runtimeAttributes[f].end=g;this.runtimeAttributes[f].unit=(k(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(k,h){var l=k.length;var g=[];for(var f=0;f<l;++f){g[f]=[k[f][0],k[f][1]]}for(var e=1;e<l;++e){for(f=0;f<l-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(j,n,k){var m;if(this.patterns.color.test(j)){m=[];for(var l=0,h=n.length;l<h;++l){m[l]=g.doMethod.call(this,j,n[l],k[l])}m="rgb("+Math.floor(m[0])+","+Math.floor(m[1])+","+Math.floor(m[2])+")"}else{m=g.doMethod.call(this,j,n,k)}return m};e.setRuntimeAttribute=function(j){g.setRuntimeAttribute.call(this,j);if(this.patterns.color.test(j)){var l=this.attributes;var n=this.parseColor(this.runtimeAttributes[j].start);var k=this.parseColor(this.runtimeAttributes[j].end);if(typeof l[j]["to"]==="undefined"&&typeof l[j]["by"]!=="undefined"){k=this.parseColor(l[j].by);for(var m=0,h=n.length;m<h;++m){k[m]=n[m]+k[m]}}this.runtimeAttributes[j].start=n;this.runtimeAttributes[j].end=k}}})();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)}}})()})();

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext-base-2-2-1.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext-base-2-2-1.js');
/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.DomHelper=function(){var n=null;var g=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var b=/^table|tbody|tr|td$/i;var a=function(w){if(typeof w=="string"){return w}var q="";if(Ext.isArray(w)){for(var u=0,r=w.length;u<r;u++){q+=a(w[u])}return q}if(!w.tag){w.tag="div"}q+="<"+w.tag;for(var p in w){if(p=="tag"||p=="children"||p=="cn"||p=="html"||typeof w[p]=="function"){continue}if(p=="style"){var v=w.style;if(typeof v=="function"){v=v.call()}if(typeof v=="string"){q+=' style="'+v+'"'}else{if(typeof v=="object"){q+=' style="';for(var t in v){if(typeof v[t]!="function"){q+=t+":"+v[t]+";"}}q+='"'}}}else{if(p=="cls"){q+=' class="'+w.cls+'"'}else{if(p=="htmlFor"){q+=' for="'+w.htmlFor+'"'}else{q+=" "+p+'="'+w[p]+'"'}}}}if(g.test(w.tag)){q+="/>"}else{q+=">";var x=w.children||w.cn;if(x){q+=a(x)}else{if(w.html){q+=w.html}}q+="</"+w.tag+">"}return q};var o=function(v,q){var u;if(Ext.isArray(v)){u=document.createDocumentFragment();for(var t=0,r=v.length;t<r;t++){o(v[t],u)}}else{if(typeof v=="string"){u=document.createTextNode(v)}else{u=document.createElement(v.tag||"div");var s=!!u.setAttribute;for(var p in v){if(p=="tag"||p=="children"||p=="cn"||p=="html"||p=="style"||typeof v[p]=="function"){continue}if(p=="cls"){u.className=v.cls}else{if(s){u.setAttribute(p,v[p])}else{u[p]=v[p]}}}Ext.DomHelper.applyStyles(u,v.style);var w=v.children||v.cn;if(w){o(w,u)}else{if(v.html){u.innerHTML=v.html}}}}if(q){q.appendChild(u)}return u};var k=function(v,t,r,u){n.innerHTML=[t,r,u].join("");var p=-1,q=n;while(++p<v){q=q.firstChild}return q};var l="<table>",e="</table>",c=l+"<tbody>",m="</tbody>"+e,i=c+"<tr>",d="</tr>"+m;var h=function(p,q,s,r){if(!n){n=document.createElement("div")}var t;var u=null;if(p=="td"){if(q=="afterbegin"||q=="beforeend"){return}if(q=="beforebegin"){u=s;s=s.parentNode}else{u=s.nextSibling;s=s.parentNode}t=k(4,i,r,d)}else{if(p=="tr"){if(q=="beforebegin"){u=s;s=s.parentNode;t=k(3,c,r,m)}else{if(q=="afterend"){u=s.nextSibling;s=s.parentNode;t=k(3,c,r,m)}else{if(q=="afterbegin"){u=s.firstChild}t=k(4,i,r,d)}}}else{if(p=="tbody"){if(q=="beforebegin"){u=s;s=s.parentNode;t=k(2,l,r,e)}else{if(q=="afterend"){u=s.nextSibling;s=s.parentNode;t=k(2,l,r,e)}else{if(q=="afterbegin"){u=s.firstChild}t=k(3,c,r,m)}}}else{if(q=="beforebegin"||q=="afterend"){return}if(q=="afterbegin"){u=s.firstChild}t=k(2,l,r,e)}}}s.insertBefore(t,u);return t};return{useDom:false,markup:function(p){return a(p)},applyStyles:function(r,s){if(s){r=Ext.fly(r);if(typeof s=="string"){var q=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var t;while((t=q.exec(s))!=null){r.setStyle(t[1],t[2])}}else{if(typeof s=="object"){for(var p in s){r.setStyle(p,s[p])}}else{if(typeof s=="function"){Ext.DomHelper.applyStyles(r,s.call())}}}}},insertHtml:function(r,t,s){r=r.toLowerCase();if(t.insertAdjacentHTML){if(b.test(t.tagName)){var q;if(q=h(t.tagName.toLowerCase(),r,t,s)){return q}}switch(r){case"beforebegin":t.insertAdjacentHTML("BeforeBegin",s);return t.previousSibling;case"afterbegin":t.insertAdjacentHTML("AfterBegin",s);return t.firstChild;case"beforeend":t.insertAdjacentHTML("BeforeEnd",s);return t.lastChild;case"afterend":t.insertAdjacentHTML("AfterEnd",s);return t.nextSibling}throw'Illegal insertion point -> "'+r+'"'}var p=t.ownerDocument.createRange();var u;switch(r){case"beforebegin":p.setStartBefore(t);u=p.createContextualFragment(s);t.parentNode.insertBefore(u,t);return t.previousSibling;case"afterbegin":if(t.firstChild){p.setStartBefore(t.firstChild);u=p.createContextualFragment(s);t.insertBefore(u,t.firstChild);return t.firstChild}else{t.innerHTML=s;return t.firstChild}case"beforeend":if(t.lastChild){p.setStartAfter(t.lastChild);u=p.createContextualFragment(s);t.appendChild(u);return t.lastChild}else{t.innerHTML=s;return t.lastChild}case"afterend":p.setStartAfter(t);u=p.createContextualFragment(s);t.parentNode.insertBefore(u,t.nextSibling);return t.nextSibling}throw'Illegal insertion point -> "'+r+'"'},insertBefore:function(p,r,q){return this.doInsert(p,r,q,"beforeBegin")},insertAfter:function(p,r,q){return this.doInsert(p,r,q,"afterEnd","nextSibling")},insertFirst:function(p,r,q){return this.doInsert(p,r,q,"afterBegin","firstChild")},doInsert:function(s,u,t,v,r){s=Ext.getDom(s);var q;if(this.useDom){q=o(u,null);(r==="firstChild"?s:s.parentNode).insertBefore(q,r?s[r]:s)}else{var p=a(u);q=this.insertHtml(v,s,p)}return t?Ext.get(q,true):q},append:function(r,t,s){r=Ext.getDom(r);var q;if(this.useDom){q=o(t,null);r.appendChild(q)}else{var p=a(t);q=this.insertHtml("beforeEnd",r,p)}return s?Ext.get(q,true):q},overwrite:function(p,r,q){p=Ext.getDom(p);p.innerHTML=a(r);return q?Ext.get(p.firstChild,true):p.firstChild},createTemplate:function(q){var p=a(q);return new Ext.Template(p)}}}();Ext.Template=function(g){var c=arguments;if(Ext.isArray(g)){g=g.join("")}else{if(c.length>1){var d=[];for(var e=0,b=c.length;e<b;e++){if(typeof c[e]=="object"){Ext.apply(this,c[e])}else{d[d.length]=c[e]}}g=d.join("")}}this.html=g;if(this.compiled){this.compile()}};Ext.Template.prototype={applyTemplate:function(b){if(this.compiled){return this.compiled(b)}var a=this.disableFormats!==true;var e=Ext.util.Format,c=this;var d=function(h,l,p,k){if(p&&a){if(p.substr(0,5)=="this."){return c.call(p.substr(5),b[l],b)}else{if(k){var o=/^\s*['"](.*)["']\s*$/;k=k.split(",");for(var n=0,g=k.length;n<g;n++){k[n]=k[n].replace(o,"$1")}k=[b[l]].concat(k)}else{k=[b[l]]}return e[p].apply(e,k)}}else{return b[l]!==undefined?b[l]:""}};return this.html.replace(this.re,d)},set:function(a,b){this.html=a;this.compiled=null;if(b){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(c,b,a){return this[c](b,a)},insertFirst:function(b,a,c){return this.doInsert("afterBegin",b,a,c)},insertBefore:function(b,a,c){return this.doInsert("beforeBegin",b,a,c)},insertAfter:function(b,a,c){return this.doInsert("afterEnd",b,a,c)},append:function(b,a,c){return this.doInsert("beforeEnd",b,a,c)},doInsert:function(c,e,b,a){e=Ext.getDom(e);var d=Ext.DomHelper.insertHtml(c,e,this.applyTemplate(b));return a?Ext.get(d,true):d},overwrite:function(b,a,c){b=Ext.getDom(b);b.innerHTML=this.applyTemplate(a);return c?Ext.get(b.firstChild,true):b.firstChild}};Ext.Template.prototype.apply=Ext.Template.prototype.applyTemplate;Ext.DomHelper.Template=Ext.Template;Ext.Template.from=function(b,a){b=Ext.getDom(b);return new Ext.Template(b.value||b.innerHTML,a||"")};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 a=this.events[arguments[0].toLowerCase()];if(typeof a=="object"){return a.fire.apply(a,Array.prototype.slice.call(arguments,1))}}return true},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(a,c,b,h){if(typeof a=="object"){h=a;for(var g in h){if(this.filterOptRe.test(g)){continue}if(typeof h[g]=="function"){this.addListener(g,h[g],h.scope,h)}else{this.addListener(g,h[g].fn,h[g].scope,h[g])}}return}h=(!h||typeof h=="boolean")?{}:h;a=a.toLowerCase();var d=this.events[a]||true;if(typeof d=="boolean"){d=new Ext.util.Event(this,a);this.events[a]=d}d.addListener(c,b,h)},removeListener:function(a,c,b){var d=this.events[a.toLowerCase()];if(typeof d=="object"){d.removeListener(c,b)}},purgeListeners:function(){for(var a in this.events){if(typeof this.events[a]=="object"){this.events[a].clearListeners()}}},relayEvents:function(g,d){var e=function(h){return function(){return this.fireEvent.apply(this,Ext.combine(h,Array.prototype.slice.call(arguments,0)))}};for(var c=0,a=d.length;c<a;c++){var b=d[c];if(!this.events[b]){this.events[b]=true}g.on(b,e(b),this)}},addEvents:function(e){if(!this.events){this.events={}}if(typeof e=="string"){for(var d=0,b=arguments,c;c=b[d];d++){if(!this.events[b[d]]){this.events[b[d]]=true}}}else{Ext.applyIf(this.events,e)}},hasListener:function(a){var b=this.events[a];return typeof b=="object"&&b.listeners.length>0},suspendEvents:function(){this.eventsSuspended=true},resumeEvents:function(){this.eventsSuspended=false},getMethodEvent:function(i){if(!this.methodEvents){this.methodEvents={}}var h=this.methodEvents[i];if(!h){h={};this.methodEvents[i]=h;h.originalFn=this[i];h.methodName=i;h.before=[];h.after=[];var c,b,d;var g=this;var a=function(l,k,e){if((b=l.apply(k||g,e))!==undefined){if(typeof b==="object"){if(b.returnValue!==undefined){c=b.returnValue}else{c=b}if(b.cancel===true){d=true}}else{if(b===false){d=true}else{c=b}}}};this[i]=function(){c=b=undefined;d=false;var k=Array.prototype.slice.call(arguments,0);for(var l=0,e=h.before.length;l<e;l++){a(h.before[l].fn,h.before[l].scope,k);if(d){return c}}if((b=h.originalFn.apply(g,k))!==undefined){c=b}for(var l=0,e=h.after.length;l<e;l++){a(h.after[l].fn,h.after[l].scope,k);if(d){return c}}return c}}return h},beforeMethod:function(d,b,a){var c=this.getMethodEvent(d);c.before.push({fn:b,scope:a})},afterMethod:function(d,b,a){var c=this.getMethodEvent(d);c.after.push({fn:b,scope:a})},removeMethodListener:function(h,d,c){var g=this.getMethodEvent(h);for(var b=0,a=g.before.length;b<a;b++){if(g.before[b].fn==d&&g.before[b].scope==c){g.before.splice(b,1);return}}for(var b=0,a=g.after.length;b<a;b++){if(g.after[b].fn==d&&g.after[b].scope==c){g.after.splice(b,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(c,b,a){c.fireEvent=c.fireEvent.createInterceptor(b,a)};Ext.util.Observable.releaseCapture=function(a){a.fireEvent=Ext.util.Observable.prototype.fireEvent};(function(){var b=function(g,i,e){var d=new Ext.util.DelayedTask();return function(){d.delay(i.buffer,g,e,Array.prototype.slice.call(arguments,0))}};var c=function(i,k,g,d){return function(){k.removeListener(g,d);return i.apply(d,arguments)}};var a=function(e,g,d){return function(){var h=Array.prototype.slice.call(arguments,0);setTimeout(function(){e.apply(d,h)},g.delay||10)}};Ext.util.Event=function(e,d){this.name=d;this.obj=e;this.listeners=[]};Ext.util.Event.prototype={addListener:function(h,g,e){g=g||this.obj;if(!this.isListening(h,g)){var d=this.createListener(h,g,e);if(!this.firing){this.listeners.push(d)}else{this.listeners=this.listeners.slice(0);this.listeners.push(d)}}},createListener:function(i,g,k){k=k||{};g=g||this.obj;var d={fn:i,scope:g,options:k};var e=i;if(k.delay){e=a(e,k,g)}if(k.single){e=c(e,this,i,g)}if(k.buffer){e=b(e,k,g)}d.fireFn=e;return d},findListener:function(m,k){k=k||this.obj;var g=this.listeners;for(var h=0,d=g.length;h<d;h++){var e=g[h];if(e.fn==m&&e.scope==k){return h}}return -1},isListening:function(e,d){return this.findListener(e,d)!=-1},removeListener:function(g,e){var d;if((d=this.findListener(g,e))!=-1){if(!this.firing){this.listeners.splice(d,1)}else{this.listeners=this.listeners.slice(0);this.listeners.splice(d,1)}return true}return false},clearListeners:function(){this.listeners=[]},fire:function(){var g=this.listeners,m,d=g.length;if(d>0){this.firing=true;var h=Array.prototype.slice.call(arguments,0);for(var k=0;k<d;k++){var e=g[k];if(e.fireFn.apply(e.scope||this.obj||window,arguments)===false){this.firing=false;return false}}this.firing=false}return true}}})();Ext.EventManager=function(){var x,q,m=false;var n,w,g,s;var p=Ext.lib.Event;var r=Ext.lib.Dom;var a="Ext";var i={};var o=function(D,z,C,B,A){var F=Ext.id(D);if(!i[F]){i[F]={}}var E=i[F];if(!E[z]){E[z]=[]}var y=E[z];y.push({id:F,ename:z,fn:C,wrap:B,scope:A});p.on(D,z,B);if(z=="mousewheel"&&D.addEventListener){D.addEventListener("DOMMouseScroll",B,false);p.on(window,"unload",function(){D.removeEventListener("DOMMouseScroll",B,false)})}if(z=="mousedown"&&D==document){Ext.EventManager.stoppedMouseDownEvent.addListener(B)}};var h=function(A,C,G,I){A=Ext.getDom(A);var y=Ext.id(A),H=i[y],z;if(H){var E=H[C],B;if(E){for(var D=0,F=E.length;D<F;D++){B=E[D];if(B.fn==G&&(!I||B.scope==I)){z=B.wrap;p.un(A,C,z);E.splice(D,1);break}}}}if(C=="mousewheel"&&A.addEventListener&&z){A.removeEventListener("DOMMouseScroll",z,false)}if(C=="mousedown"&&A==document&&z){Ext.EventManager.stoppedMouseDownEvent.removeListener(z)}};var d=function(C){C=Ext.getDom(C);var E=Ext.id(C),D=i[E],z;if(D){for(var B in D){if(D.hasOwnProperty(B)){z=D[B];for(var A=0,y=z.length;A<y;A++){p.un(C,B,z[A].wrap);z[A]=null}}D[B]=null}delete i[E]}};var c=function(){if(!m){m=true;Ext.isReady=true;if(q){clearInterval(q)}if(Ext.isGecko||Ext.isOpera){document.removeEventListener("DOMContentLoaded",c,false)}if(Ext.isIE){var y=document.getElementById("ie-deferred-loader");if(y){y.onreadystatechange=null;y.parentNode.removeChild(y)}}if(x){x.fire();x.clearListeners()}}};var b=function(){x=new Ext.util.Event();if(Ext.isGecko||Ext.isOpera){document.addEventListener("DOMContentLoaded",c,false)}else{if(Ext.isIE){document.write('<script id="ie-deferred-loader" defer="defer" src="//:"><\/script>');var y=document.getElementById("ie-deferred-loader");y.onreadystatechange=function(){if(this.readyState=="complete"){c()}}}else{if(Ext.isSafari){q=setInterval(function(){var z=document.readyState;if(z=="complete"){c()}},10)}}}p.on(window,"load",c)};var v=function(z,A){var y=new Ext.util.DelayedTask(z);return function(B){B=new Ext.EventObjectImpl(B);y.delay(A.buffer,z,null,[B])}};var t=function(C,B,y,A,z){return function(D){Ext.EventManager.removeListener(B,y,A,z);C(D)}};var e=function(y,z){return function(A){A=new Ext.EventObjectImpl(A);setTimeout(function(){y(A)},z.delay||10)}};var l=function(A,z,y,E,D){var F=(!y||typeof y=="boolean")?{}:y;E=E||F.fn;D=D||F.scope;var C=Ext.getDom(A);if(!C){throw'Error listening for "'+z+'". Element "'+A+"\" doesn't exist."}var B=function(H){if(!window[a]){return}H=Ext.EventObject.setEvent(H);var G;if(F.delegate){G=H.getTarget(F.delegate,C);if(!G){return}}else{G=H.target}if(F.stopEvent===true){H.stopEvent()}if(F.preventDefault===true){H.preventDefault()}if(F.stopPropagation===true){H.stopPropagation()}if(F.normalized===false){H=H.browserEvent}E.call(D||C,H,G,F)};if(F.delay){B=e(B,F)}if(F.single){B=t(B,C,z,E,D)}if(F.buffer){B=v(B,F)}o(C,z,E,B,D);return B};var k=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var u={addListener:function(A,y,C,B,z){if(typeof y=="object"){var E=y;for(var D in E){if(k.test(D)){continue}if(typeof E[D]=="function"){l(A,D,E,E[D],E.scope)}else{l(A,D,E[D])}}return}return l(A,y,z,C,B)},removeListener:function(z,y,B,A){return h(z,y,B,A)},removeAll:function(y){return d(y)},onDocumentReady:function(A,z,y){if(m){x.addListener(A,z,y);x.fire();x.clearListeners();return}if(!x){b()}y=y||{};if(!y.delay){y.delay=1}x.addListener(A,z,y)},doResizeEvent:function(){n.fire(r.getViewWidth(),r.getViewHeight())},onWindowResize:function(A,z,y){if(!n){n=new Ext.util.Event();w=new Ext.util.DelayedTask(this.doResizeEvent);p.on(window,"resize",this.fireWindowResize,this)}n.addListener(A,z,y)},fireWindowResize:function(){if(n){if((Ext.isIE||Ext.isAir)&&w){w.delay(50)}else{n.fire(r.getViewWidth(),r.getViewHeight())}}},onTextResize:function(B,A,y){if(!g){g=new Ext.util.Event();var z=new Ext.Element(document.createElement("div"));z.dom.className="x-text-resize";z.dom.innerHTML="X";z.appendTo(document.body);s=z.dom.offsetHeight;setInterval(function(){if(z.dom.offsetHeight!=s){g.fire(s,s=z.dom.offsetHeight)}},this.textResizeInterval)}g.addListener(B,A,y)},removeResizeListener:function(z,y){if(n){n.removeListener(z,y)}},fireResize:function(){if(n){n.fire(r.getViewWidth(),r.getViewHeight())}},ieDeferSrc:false,textResizeInterval:50};u.on=u.addListener;u.un=u.removeListener;u.stoppedMouseDownEvent=new Ext.util.Event();return u}();Ext.onReady=Ext.EventManager.onDocumentReady;(function(){var a=function(){var c=document.body||document.getElementsByTagName("body")[0];if(!c){return false}var b=[" ",Ext.isIE?"ext-ie "+(Ext.isIE6?"ext-ie6":(Ext.isIE7?"ext-ie7":"ext-ie8")):Ext.isGecko?"ext-gecko "+(Ext.isGecko2?"ext-gecko2":"ext-gecko3"):Ext.isOpera?"ext-opera":Ext.isSafari?"ext-safari":Ext.isChrome?"ext-chrome":""];if(Ext.isMac){b.push("ext-mac")}if(Ext.isLinux){b.push("ext-linux")}if(Ext.isBorderBox){b.push("ext-border-box")}if(Ext.isStrict){var d=c.parentNode;if(d){d.className+=" ext-strict"}}c.className+=b.join(" ");return true};if(!a()){Ext.onReady(a)}})();Ext.EventObject=function(){var b=Ext.lib.Event;var a={3:13,63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var c=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(d){if(d){this.setEvent(d.browserEvent||d)}};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(d){if(d==this||(d&&d.browserEvent)){return d}this.browserEvent=d;if(d){this.button=d.button?c[d.button]:(d.which?d.which-1:-1);if(d.type=="click"&&this.button==-1){this.button=0}this.type=d.type;this.shiftKey=d.shiftKey;this.ctrlKey=d.ctrlKey||d.metaKey;this.altKey=d.altKey;this.keyCode=d.keyCode;this.charCode=d.charCode;this.target=b.getTarget(d);this.xy=b.getXY(d)}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)}b.stopEvent(this.browserEvent)}},preventDefault:function(){if(this.browserEvent){b.preventDefault(this.browserEvent)}},isNavKeyPress:function(){var d=this.keyCode;d=Ext.isSafari?(a[d]||d):d;return(d>=33&&d<=40)||d==this.RETURN||d==this.TAB||d==this.ESC},isSpecialKey:function(){var d=this.keyCode;return(this.type=="keypress"&&this.ctrlKey)||d==9||d==13||d==40||d==27||(d==16)||(d==17)||(d>=18&&d<=20)||(d>=33&&d<=35)||(d>=36&&d<=39)||(d>=44&&d<=45)},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this)}b.stopPropagation(this.browserEvent)}},getCharCode:function(){return this.charCode||this.keyCode},getKey:function(){var d=this.keyCode||this.charCode;return Ext.isSafari?(a[d]||d):d},getPageX:function(){return this.xy[0]},getPageY:function(){return this.xy[1]},getTime:function(){if(this.browserEvent){return b.getTime(this.browserEvent)}return null},getXY:function(){return this.xy},getTarget:function(e,g,d){return e?Ext.fly(this.target).findParent(e,g,d):(d?Ext.get(this.target):this.target)},getRelatedTarget:function(){if(this.browserEvent){return b.getRelatedTarget(this.browserEvent)}return null},getWheelDelta:function(){var d=this.browserEvent;var g=0;if(d.wheelDelta){g=d.wheelDelta/120}else{if(d.detail){g=-d.detail/3}}return g},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false},within:function(g,h,d){var e=this[h?"getRelatedTarget":"getTarget"]();return e&&((d?(e===Ext.getDom(g)):false)||Ext.fly(g).contains(e))},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)||0.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(0.01);this.setVisible(true)}this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,0.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){width=this.adjustWidth(width);if(!animate||!A){this.dom.style.width=this.addUnits(width)}else{this.anim({width:{to:width}},this.preanim(arguments,1))}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,0.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*0.5);y=r(h*0.5);break;case"t":x=r(w*0.5);y=0;break;case"l":x=0;y=r(h*0.5);break;case"r":x=w;y=r(h*0.5);break;case"b":x=r(w*0.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.addClass("x-masked-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.getWidth(),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","x-masked-relative"])},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);Ext.removeNode(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;try{if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(eid))){delete El.cache[eid];if(d&&Ext.enableListenerCollection){Ext.EventManager.removeAll(d)}}} catch(e){}}};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(a,c){var b=this.getFxEl();c=c||{};b.queueFx(c,function(){a=a||"t";this.fixDisplay();var d=this.getFxRestore();var k=this.getBox();this.setSize(k);var g=this.fxWrap(d.pos,c,"hidden");var m=this.dom.style;m.visibility="visible";m.position="absolute";var e=function(){b.fxUnwrap(g,d.pos,c);m.width=d.width;m.height=d.height;b.afterFx(c)};var l,n={to:[k.x,k.y]},i={to:k.width},h={to:k.height};switch(a.toLowerCase()){case"t":g.setSize(k.width,0);m.left=m.bottom="0";l={height:h};break;case"l":g.setSize(0,k.height);m.right=m.top="0";l={width:i};break;case"r":g.setSize(0,k.height);g.setX(k.right);m.left=m.top="0";l={width:i,points:n};break;case"b":g.setSize(k.width,0);g.setY(k.bottom);m.left=m.top="0";l={height:h,points:n};break;case"tl":g.setSize(0,0);m.right=m.bottom="0";l={width:i,height:h};break;case"bl":g.setSize(0,0);g.setY(k.y+k.height);m.right=m.top="0";l={width:i,height:h,points:n};break;case"br":g.setSize(0,0);g.setXY([k.right,k.bottom]);m.left=m.top="0";l={width:i,height:h,points:n};break;case"tr":g.setSize(0,0);g.setX(k.x+k.width);m.left=m.bottom="0";l={width:i,height:h,points:n};break}this.dom.style.visibility="visible";g.show();arguments.callee.anim=g.fxanim(l,c,"motion",0.5,"easeOut",e)});return this},slideOut:function(a,c){var b=this.getFxEl();c=c||{};b.queueFx(c,function(){a=a||"t";var k=this.getFxRestore();var d=this.getBox();this.setSize(d);var h=this.fxWrap(k.pos,c,"visible");var g=this.dom.style;g.visibility="visible";g.position="absolute";h.setSize(d);var l=function(){if(c.useDisplay){b.setDisplayed(false)}else{b.hide()}b.fxUnwrap(h,k.pos,c);g.width=k.width;g.height=k.height;b.afterFx(c)};var e,i={to:0};switch(a.toLowerCase()){case"t":g.left=g.bottom="0";e={height:i};break;case"l":g.right=g.top="0";e={width:i};break;case"r":g.left=g.top="0";e={width:i,points:{to:[d.right,d.y]}};break;case"b":g.left=g.top="0";e={height:i,points:{to:[d.x,d.bottom]}};break;case"tl":g.right=g.bottom="0";e={width:i,height:i};break;case"bl":g.right=g.top="0";e={width:i,height:i,points:{to:[d.x,d.bottom]}};break;case"br":g.left=g.top="0";e={width:i,height:i,points:{to:[d.x+d.width,d.bottom]}};break;case"tr":g.left=g.bottom="0";e={width:i,height:i,points:{to:[d.right,d.y]}};break}arguments.callee.anim=h.fxanim(e,c,"motion",0.5,"easeOut",l)});return this},puff:function(b){var a=this.getFxEl();b=b||{};a.queueFx(b,function(){this.clearOpacity();this.show();var g=this.getFxRestore();var d=this.dom.style;var h=function(){if(b.useDisplay){a.setDisplayed(false)}else{a.hide()}a.clearOpacity();a.setPositioning(g.pos);d.width=g.width;d.height=g.height;d.fontSize="";a.afterFx(b)};var e=this.getWidth();var c=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(e*2)},height:{to:this.adjustHeight(c*2)},points:{by:[-(e*0.5),-(c*0.5)]},opacity:{to:0},fontSize:{to:200,unit:"%"}},b,"motion",0.5,"easeOut",h)});return this},switchOff:function(b){var a=this.getFxEl();b=b||{};a.queueFx(b,function(){this.clearOpacity();this.clip();var d=this.getFxRestore();var c=this.dom.style;var e=function(){if(b.useDisplay){a.setDisplayed(false)}else{a.hide()}a.clearOpacity();a.setPositioning(d.pos);c.width=d.width;c.height=d.height;a.afterFx(b)};this.fxanim({opacity:{to:0.3}},null,null,0.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*0.5]}},b,"motion",0.3,"easeIn",e)}).defer(100,this)})});return this},highlight:function(a,c){var b=this.getFxEl();c=c||{};b.queueFx(c,function(){a=a||"ffff9c";var d=c.attr||"backgroundColor";this.clearOpacity();this.show();var h=this.getColor(d);var i=this.dom.style[d];var g=(c.endColor||h)||"ffffff";var k=function(){b.dom.style[d]=i;b.afterFx(c)};var e={};e[d]={from:a,to:g};arguments.callee.anim=this.fxanim(e,c,"color",1,"easeIn",k)});return this},frame:function(a,c,d){var b=this.getFxEl();d=d||{};b.queueFx(d,function(){a=a||"#C3DAF9";if(a.length==6){a="#"+a}c=c||1;var h=d.duration||1;this.show();var e=this.getBox();var g=function(){var i=Ext.getBody().createChild({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+a}});var k=Ext.isBorderBox?2:1;i.animate({top:{from:e.y,to:e.y-20},left:{from:e.x,to:e.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:e.height,to:(e.height+(20*k))},width:{from:e.width,to:(e.width+(20*k))}},h,function(){i.remove();if(--c>0){g()}else{b.afterFx(d)}})};g.call(this)});return this},pause:function(c){var a=this.getFxEl();var b={};a.queueFx(b,function(){setTimeout(function(){a.afterFx(b)},c*1000)});return this},fadeIn:function(b){var a=this.getFxEl();b=b||{};a.queueFx(b,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var c=b.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:c}},b,null,0.5,"easeOut",function(){if(c==1){this.clearOpacity()}a.afterFx(b)})});return this},fadeOut:function(b){var a=this.getFxEl();b=b||{};a.queueFx(b,function(){var c=b.endOpacity||0;arguments.callee.anim=this.fxanim({opacity:{to:c}},b,null,0.5,"easeOut",function(){if(c===0){if(this.visibilityMode==Ext.Element.DISPLAY||b.useDisplay){this.dom.style.display="none"}else{this.dom.style.visibility="hidden"}this.clearOpacity()}a.afterFx(b)})});return this},scale:function(a,b,c){this.shift(Ext.apply({},c,{width:a,height:b}));return this},shift:function(b){var a=this.getFxEl();b=b||{};a.queueFx(b,function(){var e={},d=b.width,g=b.height,c=b.x,k=b.y,i=b.opacity;if(d!==undefined){e.width={to:this.adjustWidth(d)}}if(g!==undefined){e.height={to:this.adjustHeight(g)}}if(b.left!==undefined){e.left={to:b.left}}if(b.top!==undefined){e.top={to:b.top}}if(b.right!==undefined){e.right={to:b.right}}if(b.bottom!==undefined){e.bottom={to:b.bottom}}if(c!==undefined||k!==undefined){e.points={to:[c!==undefined?c:this.getX(),k!==undefined?k:this.getY()]}}if(i!==undefined){e.opacity={to:i}}if(b.xy!==undefined){e.points={to:b.xy}}arguments.callee.anim=this.fxanim(e,b,"motion",0.35,"easeOut",function(){a.afterFx(b)})});return this},ghost:function(a,c){var b=this.getFxEl();c=c||{};b.queueFx(c,function(){a=a||"b";var k=this.getFxRestore();var e=this.getWidth(),i=this.getHeight();var g=this.dom.style;var m=function(){if(c.useDisplay){b.setDisplayed(false)}else{b.hide()}b.clearOpacity();b.setPositioning(k.pos);g.width=k.width;g.height=k.height;b.afterFx(c)};var d={opacity:{to:0},points:{}},l=d.points;switch(a.toLowerCase()){case"t":l.by=[0,-i];break;case"l":l.by=[-e,0];break;case"r":l.by=[e,0];break;case"b":l.by=[0,i];break;case"tl":l.by=[-e,-i];break;case"bl":l.by=[-e,i];break;case"br":l.by=[e,i];break;case"tr":l.by=[e,-i];break}arguments.callee.anim=this.fxanim(d,c,"motion",0.5,"easeOut",m)});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 a=this.fxQueue[0];if(a){a.call(this)}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0]},stopFx:function(){if(this.hasActiveFx()){var a=this.fxQueue[0];if(a&&a.anim&&a.anim.isAnimated()){this.fxQueue=[a];a.anim.stop(true)}}return this},beforeFx:function(a){if(this.hasActiveFx()&&!a.concurrent){if(a.stopFx){this.stopFx();return true}return false}return true},hasFxBlock:function(){var a=this.fxQueue;return a&&a[0]&&a[0].block},queueFx:function(c,a){if(!this.fxQueue){this.fxQueue=[]}if(!this.hasFxBlock()){Ext.applyIf(c,this.fxDefaults);if(!c.concurrent){var b=this.beforeFx(c);a.block=c.block;this.fxQueue.push(a);if(b){this.nextFx()}}else{a.call(this)}}return this},fxWrap:function(g,d,c){var b;if(!d.wrap||!(b=Ext.get(d.wrap))){var a;if(d.fixPosition){a=this.getXY()}var e=document.createElement("div");e.style.visibility=c;b=Ext.get(this.dom.parentNode.insertBefore(e,this.dom));b.setPositioning(g);if(b.getStyle("position")=="static"){b.position("relative")}this.clearPositioning("auto");b.clip();b.dom.appendChild(this.dom);if(a){b.setXY(a)}}return b},fxUnwrap:function(a,c,b){this.clearPositioning();this.setPositioning(c);if(!b.wrap){a.dom.parentNode.insertBefore(this.dom,a.dom);a.remove()}},getFxRestore:function(){var a=this.dom.style;return{pos:this.getPositioning(),width:a.width,height:a.height}},afterFx:function(a){if(a.afterStyle){this.applyStyles(a.afterStyle)}if(a.afterCls){this.addClass(a.afterCls)}if(a.remove===true){this.remove()}Ext.callback(a.callback,a.scope,[this]);if(!a.concurrent){this.fxQueue.shift();this.nextFx()}},getFxEl:function(){return Ext.get(this.dom)},fxanim:function(d,e,b,g,c,a){b=b||"run";e=e||{};var h=Ext.lib.Anim[b](this.dom,d,(e.duration||g)||0.35,(e.easing||c)||"easeOut",function(){Ext.callback(a,this)},this);e.anim=h;return h}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx);Ext.CompositeElement=function(a){this.elements=[];this.addElements(a)};Ext.CompositeElement.prototype={isComposite:true,addElements:function(e){if(!e){return this}if(typeof e=="string"){e=Ext.Element.selectorFunction(e)}var d=this.elements;var b=d.length-1;for(var c=0,a=e.length;c<a;c++){d[++b]=Ext.get(e[c])}return this},fill:function(a){this.elements=[];this.add(a);return this},filter:function(a){var b=[];this.each(function(c){if(c.is(a)){b[b.length]=c.dom}});this.fill(b);return this},invoke:function(e,b){var d=this.elements;for(var c=0,a=d.length;c<a;c++){Ext.Element.prototype[e].apply(d[c],b)}return this},add:function(a){if(typeof a=="string"){this.addElements(Ext.Element.selectorFunction(a))}else{if(a.length!==undefined){this.addElements(a)}else{this.addElements([a])}}return this},each:function(e,d){var c=this.elements;for(var b=0,a=c.length;b<a;b++){if(e.call(d||c[b],c[b],this,b)===false){break}}return this},item:function(a){return this.elements[a]||null},first:function(){return this.item(0)},last:function(){return this.item(this.elements.length-1)},getCount:function(){return this.elements.length},contains:function(a){return this.indexOf(a)!==-1},indexOf:function(a){return this.elements.indexOf(Ext.get(a))},removeElement:function(e,h){if(Ext.isArray(e)){for(var c=0,a=e.length;c<a;c++){this.removeElement(e[c])}return this}var b=typeof e=="number"?e:this.indexOf(e);if(b!==-1&&this.elements[b]){if(h){var g=this.elements[b];if(g.dom){g.remove()}else{Ext.removeNode(g)}}this.elements.splice(b,1)}return this},replaceElement:function(d,c,a){var b=typeof d=="number"?d:this.indexOf(d);if(b!==-1){if(a){this.elements[b].replaceWith(c)}else{this.elements.splice(b,1,Ext.get(c))}}return this},clear:function(){this.elements=[]}};(function(){Ext.CompositeElement.createCall=function(b,c){if(!b[c]){b[c]=function(){return this.invoke(c,arguments)}}};for(var a in Ext.Element.prototype){if(typeof Ext.Element.prototype[a]=="function"){Ext.CompositeElement.createCall(Ext.CompositeElement.prototype,a)}}})();Ext.CompositeElementLite=function(a){Ext.CompositeElementLite.superclass.constructor.call(this,a);this.el=new Ext.Element.Flyweight()};Ext.extend(Ext.CompositeElementLite,Ext.CompositeElement,{addElements:function(e){if(e){if(Ext.isArray(e)){this.elements=this.elements.concat(e)}else{var d=this.elements;var b=d.length-1;for(var c=0,a=e.length;c<a;c++){d[++b]=e[c]}}}return this},invoke:function(g,b){var d=this.elements;var e=this.el;for(var c=0,a=d.length;c<a;c++){e.dom=d[c];Ext.Element.prototype[g].apply(e,b)}return this},item:function(a){if(!this.elements[a]){return null}this.el.dom=this.elements[a];return this.el},addListener:function(b,h,g,e){var d=this.elements;for(var c=0,a=d.length;c<a;c++){Ext.EventManager.on(d[c],b,h,g||d[c],e)}return this},each:function(g,e){var c=this.elements;var d=this.el;for(var b=0,a=c.length;b<a;b++){d.dom=c[b];if(g.call(e||d,d,this,b)===false){break}}return this},indexOf:function(a){return this.elements.indexOf(Ext.getDom(a))},replaceElement:function(e,c,a){var b=typeof e=="number"?e:this.indexOf(e);if(b!==-1){c=Ext.getDom(c);if(a){var g=this.elements[b];g.parentNode.insertBefore(c,g);Ext.removeNode(g)}this.elements.splice(b,1,c)}return this}});Ext.CompositeElementLite.prototype.on=Ext.CompositeElementLite.prototype.addListener;if(Ext.DomQuery){Ext.Element.selectorFunction=Ext.DomQuery.select}Ext.Element.select=function(a,d,b){var c;if(typeof a=="string"){c=Ext.Element.selectorFunction(a,b)}else{if(a.length!==undefined){c=a}else{throw"Invalid selector"}}if(d===true){return new Ext.CompositeElement(c)}else{return new Ext.CompositeElementLite(c)}};Ext.select=Ext.Element.select;Ext.data.Connection=function(a){Ext.apply(this,a);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(e){if(this.fireEvent("beforerequest",this,e)!==false){var c=e.params;if(typeof c=="function"){c=c.call(e.scope||window,e)}if(typeof c=="object"){c=Ext.urlEncode(c)}if(this.extraParams){var h=Ext.urlEncode(this.extraParams);c=c?(c+"&"+h):h}var b=e.url||this.url;if(typeof b=="function"){b=b.call(e.scope||window,e)}if(e.form){var d=Ext.getDom(e.form);b=b||d.action;var l=d.getAttribute("enctype");if(e.isUpload||(l&&l.toLowerCase()=="multipart/form-data")){return this.doFormUpload(e,c,b)}var k=Ext.lib.Ajax.serializeForm(d);c=c?(c+"&"+k):k}var m=e.headers;if(this.defaultHeaders){m=Ext.apply(m||{},this.defaultHeaders);if(!e.headers){e.headers=m}}var g={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:e},timeout:e.timeout||this.timeout};var a=e.method||this.method||((c||e.xmlData||e.jsonData)?"POST":"GET");if(a=="GET"&&(this.disableCaching&&e.disableCaching!==false)||e.disableCaching===true){var i=e.disableCachingParam||this.disableCachingParam;b+=(b.indexOf("?")!=-1?"&":"?")+i+"="+(new Date().getTime())}if(typeof e.autoAbort=="boolean"){if(e.autoAbort){this.abort()}}else{if(this.autoAbort!==false){this.abort()}}if((a=="GET"||e.xmlData||e.jsonData)&&c){b+=(b.indexOf("?")!=-1?"&":"?")+c;c=""}this.transId=Ext.lib.Ajax.request(a,b,g,c,e);return this.transId}else{Ext.callback(e.callback,e.scope,[e,null,null]);return null}},isLoading:function(a){if(a){return Ext.lib.Ajax.isCallInProgress(a)}else{return this.transId?true:false}},abort:function(a){if(a||this.isLoading()){Ext.lib.Ajax.abort(a||this.transId)}},handleResponse:function(a){this.transId=false;var b=a.argument.options;a.argument=b?b.argument:null;this.fireEvent("requestcomplete",this,a,b);Ext.callback(b.success,b.scope,[a,b]);Ext.callback(b.callback,b.scope,[b,true,a])},handleFailure:function(a,c){this.transId=false;var b=a.argument.options;a.argument=b?b.argument:null;this.fireEvent("requestexception",this,a,b,c);Ext.callback(b.failure,b.scope,[a,b]);Ext.callback(b.callback,b.scope,[b,false,a])},doFormUpload:function(e,a,b){var c=Ext.id();var g=document.createElement("iframe");g.id=c;g.name=c;g.className="x-hidden";if(Ext.isIE){g.src=Ext.SSL_SECURE_URL}document.body.appendChild(g);if(Ext.isIE){document.frames[c].name=c}var d=Ext.getDom(e.form);d.target=c;d.method="POST";d.enctype=d.encoding="multipart/form-data";if(b){d.action=b}var q,n;if(a){q=[];a=Ext.urlDecode(a,false);for(var l in a){if(a.hasOwnProperty(l)){n=document.createElement("input");n.type="hidden";n.name=l;n.value=a[l];d.appendChild(n);q.push(n)}}}function h(){var i={responseText:"",responseXML:null};i.argument=e?e.argument:null;try{var o;if(Ext.isIE){o=g.contentWindow.document}else{o=(g.contentDocument||window.frames[c].document)}if(o&&o.body){i.responseText=o.body.innerHTML}if(o&&o.XMLDocument){i.responseXML=o.XMLDocument}else{i.responseXML=o}}catch(k){}Ext.EventManager.removeListener(g,"load",h,this);this.fireEvent("requestcomplete",this,i,e);Ext.callback(e.success,e.scope,[i,e]);Ext.callback(e.callback,e.scope,[e,true,i]);setTimeout(function(){Ext.removeNode(g)},100)}Ext.EventManager.on(g,"load",h,this);d.submit();if(q){for(var m=0,p=q.length;m<p;m++){Ext.removeNode(q[m])}}}});Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(a){return Ext.lib.Ajax.serializeForm(a)}});Ext.Updater=Ext.extend(Ext.util.Observable,{constructor:function(b,a){b=Ext.get(b);if(!a&&b.updateManager){return b.updateManager}this.el=b;this.defaultUrl=null;this.addEvents("beforeupdate","update","failure");var c=Ext.Updater.defaults;this.sslBlankUrl=c.sslBlankUrl;this.disableCaching=c.disableCaching;this.indicatorText=c.indicatorText;this.showLoadIndicator=c.showLoadIndicator;this.timeout=c.timeout;this.loadScripts=c.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(b,g,h,d){if(this.fireEvent("beforeupdate",this.el,b,g)!==false){var a,c;if(typeof b=="object"){a=b;b=a.url;g=g||a.params;h=h||a.callback;d=d||a.discardUrl;c=a.scope;if(typeof a.nocache!="undefined"){this.disableCaching=a.nocache}if(typeof a.text!="undefined"){this.indicatorText='<div class="loading-indicator">'+a.text+"</div>"}if(typeof a.scripts!="undefined"){this.loadScripts=a.scripts}if(typeof a.timeout!="undefined"){this.timeout=a.timeout}}this.showLoading();if(!d){this.defaultUrl=b}if(typeof b=="function"){b=b.call(this)}var e=Ext.apply({},{url:b,params:(typeof g=="function"&&c)?g.createDelegate(c):g,success:this.processSuccess,failure:this.processFailure,scope:this,callback:undefined,timeout:(this.timeout*1000),disableCaching:this.disableCaching,argument:{options:a,url:b,form:null,callback:h,scope:c||window,params:g}},a);this.transaction=Ext.Ajax.request(e)}},formUpdate:function(c,a,b,d){if(this.fireEvent("beforeupdate",this.el,c,a)!==false){if(typeof a=="function"){a=a.call(this)}c=Ext.getDom(c);this.transaction=Ext.Ajax.request({form:c,url:a,success:this.processSuccess,failure:this.processFailure,scope:this,timeout:(this.timeout*1000),argument:{url:a,form:c,callback:d,reset:b}});this.showLoading.defer(1,this)}},refresh:function(a){if(this.defaultUrl==null){return}this.update(this.defaultUrl,null,a,true)},startAutoRefresh:function(b,c,d,e,a){if(a){this.update(c||this.defaultUrl,d,e,true)}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId)}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[c||this.defaultUrl,d,e,true]),b*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(a){this.transaction=null;if(a.argument.form&&a.argument.reset){try{a.argument.form.reset()}catch(b){}}if(this.loadScripts){this.renderer.render(this.el,a,this,this.updateComplete.createDelegate(this,[a]))}else{this.renderer.render(this.el,a,this);this.updateComplete(a)}},updateComplete:function(a){this.fireEvent("update",this.el,a);if(typeof a.argument.callback=="function"){a.argument.callback.call(a.argument.scope,this.el,true,a,a.argument.options)}},processFailure:function(a){this.transaction=null;this.fireEvent("failure",this.el,a);if(typeof a.argument.callback=="function"){a.argument.callback.call(a.argument.scope,this.el,false,a,a.argument.options)}},setRenderer:function(a){this.renderer=a},getRenderer:function(){return this.renderer},setDefaultUrl:function(a){this.defaultUrl=a},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(d,c,e,b){var a=Ext.get(d).getUpdater();Ext.apply(a,b);a.update(c,e,b?b.callback:null)};Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(c,a,b,d){c.update(a.responseText,b.loadScripts,d)}};Ext.UpdateManager=Ext.Updater;(function(){function xf(format){var args=Array.prototype.slice.call(arguments,1);return format.replace(/\{(\d+)\}/g,function(m,i){return args[i]})}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?xf(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++,code="Date.prototype."+funcName+" = function(){return ",special=false,ch="";Date.formatFunctions[format]=funcName;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(){var code=["Date.{0} = function(input){","var y, m, d, h = 0, i = 0, s = 0, ms = 0, o, z, u, v;","input = String(input);","d = new Date();","y = d.getFullYear();","m = d.getMonth();","d = d.getDate();","var results = input.match(Date.parseRegexes[{1}]);","if(results && results.length > 0){","{2}","if(u){","v = new Date(u * 1000);","}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0){","v = new Date(y, m, d, h, i, s, ms);","}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0){","v = new Date(y, m, d, h, i, s);","}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0){","v = new Date(y, m, d, h, i);","}else if (y >= 0 && m >= 0 && d > 0 && h >= 0){","v = new Date(y, m, d, h);","}else if (y >= 0 && m >= 0 && d > 0){","v = new Date(y, m, d);","}else if (y >= 0 && m >= 0){","v = new Date(y, m);","}else if (y >= 0){","v = new Date(y);","}","}","return (v && (z != null || o != null))? (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;","}"].join("\n");return function(format){var funcName="parse"+Date.parseFunctions.count++,regexNum=Date.parseRegexes.length,currentGroup=1,calc="",regex="",special=false,ch="";Date.parseFunctions[format]=funcName;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=$f(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){calc+=obj.c}}}}Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$","i");eval(xf(code,funcName,regexNum,calc))}}(),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);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"},a:{g:1,c:"if (results[{0}] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"},A:{g:1,c:"if (results[{0}] == 'AM') {\nif (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;\nz = (-43200 <= z && z <= 50400)? z : null;\n",s:"([+-]?\\d{1,5})"},c:function(){var calc=[],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'){","z = 0;","}else{",$f("P",9).c,"}"].join("\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+)?(Z|([+-]\\d{2}:\\d{2}))"}},U:{g:1,c:"u = parseInt(results[{0}], 10);\n",s:"(-?\\d+)"}}})}());Ext.apply(Date.prototype,{dateFormat:function(b){if(Date.formatFunctions[b]==null){Date.createNewFormat(b)}var a=Date.formatFunctions[b];return this[a]()},getTimezone:function(){return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/,"$1$2").replace(/[^A-Z]/g,"")},getGMTOffset:function(a){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+(a?":":"")+String.leftPad(Math.abs(this.getTimezoneOffset()%60),2,"0")},getDayOfYear:function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b]}return a+this.getDate()-1},getWeekOfYear:function(){var a=86400000,b=7*a;return function(){var d=Date.UTC(this.getFullYear(),this.getMonth(),this.getDate()+3)/a,c=Math.floor(d/7),e=new Date(c*b).getUTCFullYear();return c-Math.floor(Date.UTC(e,0,7)/b)+1}}(),isLeapYear:function(){var a=this.getFullYear();return !!((a&3)==0&&(a%100||(a%400==0&&a)))},getFirstDayOfMonth:function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a},getLastDayOfMonth:function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a},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(a){if(a){return this.clone().clearTime()}this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this},add:function(b,c){var e=this.clone();if(!b||c===0){return e}switch(b.toLowerCase()){case Date.MILLI:e.setMilliseconds(this.getMilliseconds()+c);break;case Date.SECOND:e.setSeconds(this.getSeconds()+c);break;case Date.MINUTE:e.setMinutes(this.getMinutes()+c);break;case Date.HOUR:e.setHours(this.getHours()+c);break;case Date.DAY:e.setDate(this.getDate()+c);break;case Date.MONTH:var a=this.getDate();if(a>28){a=Math.min(a,this.getFirstDateOfMonth().add("mo",c).getLastDateOfMonth().getDate())}e.setDate(a);e.setMonth(this.getMonth()+c);break;case Date.YEAR:e.setFullYear(this.getFullYear()+c);break}return e},between:function(c,a){var b=this.getTime();return c.getTime()<=b&&b<=a.getTime()}});Date.prototype.format=Date.prototype.dateFormat;if(Ext.isSafari){Date.brokenSetMonth=Date.prototype.setMonth;Date.prototype.setMonth=function(a){if(a<=-1){var d=Math.ceil(-a);var c=Math.ceil(d/12);var b=(d%12)?12-d%12:0;this.setFullYear(this.getFullYear()-c);return Date.brokenSetMonth.call(this,b)}else{return Date.brokenSetMonth.apply(this,arguments)}}}Ext.util.DelayedTask=function(g,e,a){var i=null,h,b;var c=function(){var d=new Date().getTime();if(d-b>=h){clearInterval(i);i=null;g.apply(e,a||[])}};this.delay=function(k,m,l,d){if(i&&k!=h){this.cancel()}h=k;b=new Date().getTime();g=m||g;e=l||e;a=d||a;if(!i){i=setInterval(c,h)}};this.cancel=function(){if(i){clearInterval(i);i=null}}};Ext.util.TaskRunner=function(e){e=e||10;var g=[],a=[];var b=0;var h=false;var d=function(){h=false;clearInterval(b);b=0};var i=function(){if(!h){h=true;b=setInterval(k,e)}};var c=function(l){a.push(l);if(l.onStop){l.onStop.apply(l.scope||l)}};var k=function(){if(a.length>0){for(var q=0,m=a.length;q<m;q++){g.remove(a[q])}a=[];if(g.length<1){d();return}}var o=new Date().getTime();for(var q=0,m=g.length;q<m;++q){var p=g[q];var l=o-p.taskRunTime;if(p.interval<=l){var n=p.run.apply(p.scope||p,p.args||[++p.taskRunCount]);p.taskRunTime=o;if(n===false||p.taskRunCount===p.repeat){c(p);return}}if(p.duration&&p.duration<=(o-p.taskStartTime)){c(p)}}};this.start=function(l){g.push(l);l.taskStartTime=new Date().getTime();l.taskRunTime=0;l.taskRunCount=0;i();return l};this.stop=function(l){c(l);return l};this.stopAll=function(){d();for(var m=0,l=g.length;m<l;m++){if(g[m].onStop){g[m].onStop()}}g=[];a=[]}};Ext.TaskMgr=new Ext.util.TaskRunner();Ext.util.MixedCollection=function(b,a){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents("clear","add","replace","remove","sort");this.allowFunctions=b===true;if(a){this.getKey=a}Ext.util.MixedCollection.superclass.constructor.call(this)};Ext.extend(Ext.util.MixedCollection,Ext.util.Observable,{allowFunctions:false,add:function(b,c){if(arguments.length==1){c=arguments[0];b=this.getKey(c)}if(typeof b=="undefined"||b===null){this.length++;this.items.push(c);this.keys.push(null)}else{var a=this.map[b];if(a){return this.replace(b,c)}this.length++;this.items.push(c);this.map[b]=c;this.keys.push(b)}this.fireEvent("add",this.length-1,c,b);return c},getKey:function(a){return a.id},replace:function(c,d){if(arguments.length==1){d=arguments[0];c=this.getKey(d)}var a=this.item(c);if(typeof c=="undefined"||c===null||typeof a=="undefined"){return this.add(c,d)}var b=this.indexOfKey(c);this.items[b]=d;this.map[c]=d;this.fireEvent("replace",c,a,d);return d},addAll:function(e){if(arguments.length>1||Ext.isArray(e)){var b=arguments.length>1?arguments:e;for(var d=0,a=b.length;d<a;d++){this.add(b[d])}}else{for(var c in e){if(this.allowFunctions||typeof e[c]!="function"){this.add(c,e[c])}}}},each:function(e,d){var b=[].concat(this.items);for(var c=0,a=b.length;c<a;c++){if(e.call(d||b[c],b[c],c,a)===false){break}}},eachKey:function(d,c){for(var b=0,a=this.keys.length;b<a;b++){d.call(c||window,this.keys[b],this.items[b],b,a)}},find:function(d,c){for(var b=0,a=this.items.length;b<a;b++){if(d.call(c||window,this.items[b],this.keys[b])){return this.items[b]}}return null},insert:function(a,b,c){if(arguments.length==2){c=arguments[1];b=this.getKey(c)}if(a>=this.length){return this.add(b,c)}this.length++;this.items.splice(a,0,c);if(typeof b!="undefined"&&b!=null){this.map[b]=c}this.keys.splice(a,0,b);this.fireEvent("add",a,c,b);return c},remove:function(a){return this.removeAt(this.indexOf(a))},removeAt:function(a){if(a<this.length&&a>=0){this.length--;var c=this.items[a];this.items.splice(a,1);var b=this.keys[a];if(typeof b!="undefined"){delete this.map[b]}this.keys.splice(a,1);this.fireEvent("remove",c,b);return c}return false},removeKey:function(a){return this.removeAt(this.indexOfKey(a))},getCount:function(){return this.length},indexOf:function(a){return this.items.indexOf(a)},indexOfKey:function(a){return this.keys.indexOf(a)},item:function(a){var b=typeof this.map[a]!="undefined"?this.map[a]:this.items[a];return typeof b!="function"||this.allowFunctions?b:null},itemAt:function(a){return this.items[a]},key:function(a){return this.map[a]},contains:function(a){return this.indexOf(a)!=-1},containsKey:function(a){return typeof this.map[a]!="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(n,a,m){var d=String(a).toUpperCase()=="DESC"?-1:1;m=m||function(i,c){return i-c};var l=[],b=this.keys,h=this.items;for(var e=0,g=h.length;e<g;e++){l[l.length]={key:b[e],value:h[e],index:e}}l.sort(function(i,c){var k=m(i[n],c[n])*d;if(k==0){k=(i.index<c.index?-1:1)}return k});for(var e=0,g=l.length;e<g;e++){h[e]=l[e].value;b[e]=l[e].key}this.fireEvent("sort",this)},sort:function(a,b){this._sort("value",a,b)},keySort:function(a,b){this._sort("key",a,b||function(d,c){var g=String(d).toUpperCase(),e=String(c).toUpperCase();return g>e?1:(g<e?-1:0)})},getRange:function(e,a){var b=this.items;if(b.length<1){return[]}e=e||0;a=Math.min(typeof a=="undefined"?this.length-1:a,this.length-1);var d=[];if(e<=a){for(var c=e;c<=a;c++){d[d.length]=b[c]}}else{for(var c=e;c>=a;c--){d[d.length]=b[c]}}return d},filter:function(c,b,d,a){if(Ext.isEmpty(b,false)){return this.clone()}b=this.createValueMatcher(b,d,a);return this.filterBy(function(e){return e&&b.test(e[c])})},filterBy:function(g,e){var h=new Ext.util.MixedCollection();h.getKey=this.getKey;var b=this.keys,d=this.items;for(var c=0,a=d.length;c<a;c++){if(g.call(e||this,d[c],b[c])){h.add(b[c],d[c])}}return h},findIndex:function(c,b,e,d,a){if(Ext.isEmpty(b,false)){return -1}b=this.createValueMatcher(b,d,a);return this.findIndexBy(function(g){return g&&b.test(g[c])},null,e)},findIndexBy:function(g,e,h){var b=this.keys,d=this.items;for(var c=(h||0),a=d.length;c<a;c++){if(g.call(e||this,d[c],b[c])){return c}}if(typeof h=="number"&&h>0){for(var c=0;c<h;c++){if(g.call(e||this,d[c],b[c])){return c}}}return -1},createValueMatcher:function(b,c,a){if(!b.exec){b=String(b);b=new RegExp((c===true?"":"^")+Ext.escapeRe(b),a?"":"i")}return b},clone:function(){var e=new Ext.util.MixedCollection();var b=this.keys,d=this.items;for(var c=0,a=d.length;c<a;c++){e.add(b[c],d[c])}e.getKey=this.getKey;return e}});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 u=this.html;u=["<tpl>",u,"</tpl>"].join("");var t=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var r=/^<tpl\b[^>]*?for="(.*?)"/;var p=/^<tpl\b[^>]*?if="(.*?)"/;var n=/^<tpl\b[^>]*?exec="(.*?)"/;var c,b=0;var h=[];while(c=u.match(t)){var q=c[0].match(r);var o=c[0].match(p);var l=c[0].match(n);var e=null,k=null,d=null;var a=q&&q[1]?q[1]:"";if(o){e=o&&o[1]?o[1]:null;if(e){k=new Function("values","parent","xindex","xcount","with(values){ return "+(Ext.util.Format.htmlDecode(e))+"; }")}}if(l){e=l&&l[1]?l[1]:null;if(e){d=new Function("values","parent","xindex","xcount","with(values){ "+(Ext.util.Format.htmlDecode(e))+"; }")}}if(a){switch(a){case".":a=new Function("values","parent","with(values){ return values; }");break;case"..":a=new Function("values","parent","with(values){ return parent; }");break;default:a=new Function("values","parent","with(values){ return "+a+"; }")}}h.push({id:b,target:a,exec:d,test:k,body:c[1]||""});u=u.replace(c[0],"{xtpl"+b+"}");++b}for(var g=h.length-1;g>=0;--g){this.compileTpl(h[g])}this.master=h[h.length-1];this.tpls=h};Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(a,k,h,d,c){var m=this.tpls[a];if(m.test&&!m.test.call(this,k,h,d,c)){return""}if(m.exec&&m.exec.call(this,k,h,d,c)){return""}var l=m.target?m.target.call(this,k,h):k;h=m.target?k:h;if(m.target&&Ext.isArray(l)){var b=[];for(var e=0,g=l.length;e<g;e++){b[b.length]=m.compiled.call(this,l[e],h,e+1,g)}return b.join("")}return m.compiled.call(this,l,h,d,c)},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(a){return this.master.compiled.call(this,a,{},1,1)},compile:function(){return this}});Ext.XTemplate.prototype.apply=Ext.XTemplate.prototype.applyTemplate;Ext.XTemplate.from=function(a){a=Ext.getDom(a);return new Ext.XTemplate(a.value||a.innerHTML)};Ext.util.CSS=function(){var d=null;var c=document;var b=/(-[a-z])/gi;var a=function(e,g){return g.charAt(1).toUpperCase()};return{createStyleSheet:function(i,m){var h;var g=c.getElementsByTagName("head")[0];var l=c.createElement("style");l.setAttribute("type","text/css");if(m){l.setAttribute("id",m)}if(Ext.isIE){g.appendChild(l);h=l.styleSheet;h.cssText=i}else{try{l.appendChild(c.createTextNode(i))}catch(k){l.cssText=i}g.appendChild(l);h=l.styleSheet?l.styleSheet:(l.sheet||c.styleSheets[c.styleSheets.length-1])}this.cacheStyleSheet(h);return h},removeStyleSheet:function(g){var e=c.getElementById(g);if(e){e.parentNode.removeChild(e)}},swapStyleSheet:function(h,e){this.removeStyleSheet(h);var g=c.createElement("link");g.setAttribute("rel","stylesheet");g.setAttribute("type","text/css");g.setAttribute("id",h);g.setAttribute("href",e);c.getElementsByTagName("head")[0].appendChild(g)},refreshCache:function(){return this.getRules(true)},cacheStyleSheet:function(h){if(!d){d={}}try{var k=h.cssRules||h.rules;for(var g=k.length-1;g>=0;--g){d[k[g].selectorText]=k[g]}}catch(i){}},getRules:function(h){if(d==null||h){d={};var l=c.styleSheets;for(var k=0,g=l.length;k<g;k++){try{this.cacheStyleSheet(l[k])}catch(m){}}}return d},getRule:function(e,h){var g=this.getRules(h);if(!Ext.isArray(e)){return g[e]}for(var k=0;k<e.length;k++){if(g[e[k]]){return g[e[k]]}}return null},updateRule:function(e,k,h){if(!Ext.isArray(e)){var l=this.getRule(e);if(l){l.style[k.replace(b,a)]=h;return true}}else{for(var g=0;g<e.length;g++){if(this.updateRule(e[g],k,h)){return true}}}return false}}}();Ext.util.ClickRepeater=function(b,a){this.el=Ext.get(b);this.el.unselectable();Ext.apply(this,a);this.addEvents("mousedown","click","mouseup");this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(c){if(this.preventDefault){c.preventDefault()}if(this.stopDefault){c.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,destroy:function(){Ext.destroy(this.el);this.purgeListeners()},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(e,a,h,g){return(e==g)?a+h:h*(-Math.pow(2,-10*e/g)+1)+a},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(b,a){this.el=Ext.get(b);Ext.apply(this,a);if(!this.disabled){this.disabled=true;this.enable()}};Ext.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",forceKeyDown:false,prepareEvent:function(c){var a=c.getKey();var b=this.keyToHandler[a];if(Ext.isSafari2&&b&&a>=37&&a<=40){c.stopEvent()}},relay:function(c){var a=c.getKey();var b=this.keyToHandler[a];if(b&&this[b]){if(this.doRelay(c,this[b],b)!==true){c[this.defaultEventAction]()}}},doRelay:function(c,b,a){return b.call(this.scope||this,c)},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,this)}else{this.el.un("keydown",this.prepareEvent,this);this.el.un("keypress",this.relay,this)}this.disabled=true}}};Ext.KeyMap=function(c,b,a){this.el=Ext.get(c);this.eventName=a||"keydown";this.bindings=[];if(b){this.addBinding(b)}this.enable()};Ext.KeyMap.prototype={stopEvent:false,addBinding:function(d){if(Ext.isArray(d)){for(var g=0,k=d.length;g<k;g++){this.addBinding(d[g])}return}var q=d.key,c=d.shift,a=d.ctrl,h=d.alt,m=d.fn||d.handler,p=d.scope;if(d.stopEvent){this.stopEvent=d.stopEvent}if(typeof q=="string"){var n=[];var l=q.toUpperCase();for(var e=0,k=l.length;e<k;e++){n.push(l.charCodeAt(e))}q=n}var b=Ext.isArray(q);var o=function(u){if((!c||u.shiftKey)&&(!a||u.ctrlKey)&&(!h||u.altKey)){var s=u.getKey();if(b){for(var t=0,r=q.length;t<r;t++){if(q[t]==s){if(this.stopEvent){u.stopEvent()}m.call(p||window,s,u);return}}}else{if(s==q){if(this.stopEvent){u.stopEvent()}m.call(p||window,s,u)}}}};this.bindings.push(o)},on:function(b,d,c){var h,a,e,g;if(typeof b=="object"&&!Ext.isArray(b)){h=b.key;a=b.shift;e=b.ctrl;g=b.alt}else{h=b}this.addBinding({key:h,shift:a,ctrl:e,alt:g,fn:d,scope:c})},handleKeyDown:function(g){if(this.enabled){var c=this.bindings;for(var d=0,a=c.length;d<a;d++){c[d].call(this,g)}}},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 a;return{measure:function(b,c,d){if(!a){a=Ext.util.TextMetrics.Instance(b,d)}a.bind(b);a.setFixedWidth(d||"auto");return a.getSize(c)},createInstance:function(b,c){return Ext.util.TextMetrics.Instance(b,c)}}}();Ext.util.TextMetrics.Instance=function(b,d){var c=new Ext.Element(document.createElement("div"));document.body.appendChild(c.dom);c.position("absolute");c.setLeftTop(-1000,-1000);c.hide();if(d){c.setWidth(d)}var a={getSize:function(g){c.update(g);var e=c.getSize();c.update("");return e},bind:function(e){c.setStyle(Ext.fly(e).getStyles("font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"))},setFixedWidth:function(e){c.setWidth(e)},getWidth:function(e){c.dom.style.width="auto";return this.getSize(e).width},getHeight:function(e){return this.getSize(e).height}};a.bind(b);return a};Ext.Element.measureText=Ext.util.TextMetrics.measure;(function(){var a=Ext.EventManager;var b=Ext.lib.Dom;Ext.dd.DragDrop=function(e,c,d){if(e){this.init(e,c,d)}};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},moveOnly:false,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(c,d){},startDrag:function(c,d){},b4Drag:function(c){},onDrag:function(c){},onDragEnter:function(c,d){},b4DragOver:function(c){},onDragOver:function(c,d){},b4DragOut:function(c){},onDragOut:function(c,d){},b4DragDrop:function(c){},onDragDrop:function(c,d){},onInvalidDrop:function(c){},b4EndDrag:function(c){},endDrag:function(c){},b4MouseDown:function(c){},onMouseDown:function(c){},onMouseUp:function(c){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(k,h,p){if(typeof h=="number"){h={left:h,right:h,top:h,bottom:h}}h=h||this.defaultPadding;var m=Ext.get(this.getEl()).getBox();var d=Ext.get(k);var o=d.getScroll();var l,e=d.dom;if(e==document.body){l={x:o.left,y:o.top,width:Ext.lib.Dom.getViewWidth(),height:Ext.lib.Dom.getViewHeight()}}else{var n=d.getXY();l={x:n[0]+o.left,y:n[1]+o.top,width:e.clientWidth,height:e.clientHeight}}var i=m.y-l.y;var g=m.x-l.x;this.resetConstraints();this.setXConstraint(g-(h.left||0),l.width-g-m.width-(h.right||0),this.xTickSize);this.setYConstraint(i-(h.top||0),l.height-i-m.height-(h.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(e,c,d){this.initTarget(e,c,d);a.on(this.id,"mousedown",this.handleMouseDown,this)},initTarget:function(e,c,d){this.config=d||{};this.DDM=Ext.dd.DDM;this.groups={};if(typeof e!=="string"){e=Ext.id(e)}this.id=e;this.addToGroup((c)?c:"default");this.handleElId=e;this.setDragElId(e);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(e,c,g,d){if(!c&&0!==c){this.padding=[e,e,e,e]}else{if(!g&&0!==g){this.padding=[e,c,e,c]}else{this.padding=[e,c,g,d]}}},setInitPosition:function(g,e){var h=this.getEl();if(!this.DDM.verifyEl(h)){return}var d=g||0;var c=e||0;var i=b.getXY(h);this.initPageX=i[0]-d;this.initPageY=i[1]-c;this.lastPageX=i[0];this.lastPageY=i[1];this.setStartPosition(i)},setStartPosition:function(d){var c=d||b.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=c[0];this.startPageY=c[1]},addToGroup:function(c){this.groups[c]=true;this.DDM.regDragDrop(this,c)},removeFromGroup:function(c){if(this.groups[c]){delete this.groups[c]}this.DDM.removeDDFromGroup(this,c)},setDragElId:function(c){this.dragElId=c},setHandleElId:function(c){if(typeof c!=="string"){c=Ext.id(c)}this.handleElId=c;this.DDM.regHandle(this.id,c)},setOuterHandleElId:function(c){if(typeof c!=="string"){c=Ext.id(c)}a.on(c,"mousedown",this.handleMouseDown,this);this.setHandleElId(c);this.hasOuterHandles=true},unreg:function(){a.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(g,d){if(this.primaryButtonOnly&&g.button!=0){return}if(this.isLocked()){return}this.DDM.refreshCache(this.groups);var c=new Ext.lib.Point(Ext.lib.Event.getPageX(g),Ext.lib.Event.getPageY(g));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(c,this)){}else{if(this.clickValidator(g)){this.setStartPosition();this.b4MouseDown(g);this.onMouseDown(g);this.DDM.handleMouseDown(g,this);this.DDM.stopEvent(g)}else{}}},clickValidator:function(d){var c=d.getTarget();return(this.isValidHandleChild(c)&&(this.id==this.handleElId||this.DDM.handleWasClicked(c,this.id)))},addInvalidHandleType:function(c){var d=c.toUpperCase();this.invalidHandleTypes[d]=d},addInvalidHandleId:function(c){if(typeof c!=="string"){c=Ext.id(c)}this.invalidHandleIds[c]=c},addInvalidHandleClass:function(c){this.invalidHandleClasses.push(c)},removeInvalidHandleType:function(c){var d=c.toUpperCase();delete this.invalidHandleTypes[d]},removeInvalidHandleId:function(c){if(typeof c!=="string"){c=Ext.id(c)}delete this.invalidHandleIds[c]},removeInvalidHandleClass:function(d){for(var e=0,c=this.invalidHandleClasses.length;e<c;++e){if(this.invalidHandleClasses[e]==d){delete this.invalidHandleClasses[e]}}},isValidHandleChild:function(h){var g=true;var l;try{l=h.nodeName.toUpperCase()}catch(k){l=h.nodeName}g=g&&!this.invalidHandleTypes[l];g=g&&!this.invalidHandleIds[h.id];for(var d=0,c=this.invalidHandleClasses.length;g&&d<c;++d){g=!Ext.fly(h).hasClass(this.invalidHandleClasses[d])}return g},setXTicks:function(g,c){this.xTicks=[];this.xTickSize=c;var e={};for(var d=this.initPageX;d>=this.minX;d=d-c){if(!e[d]){this.xTicks[this.xTicks.length]=d;e[d]=true}}for(d=this.initPageX;d<=this.maxX;d=d+c){if(!e[d]){this.xTicks[this.xTicks.length]=d;e[d]=true}}this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(g,c){this.yTicks=[];this.yTickSize=c;var e={};for(var d=this.initPageY;d>=this.minY;d=d-c){if(!e[d]){this.yTicks[this.yTicks.length]=d;e[d]=true}}for(d=this.initPageY;d<=this.maxY;d=d+c){if(!e[d]){this.yTicks[this.yTicks.length]=d;e[d]=true}}this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(e,d,c){this.leftConstraint=e;this.rightConstraint=d;this.minX=this.initPageX-e;this.maxX=this.initPageX+d;if(c){this.setXTicks(this.initPageX,c)}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(c,e,d){this.topConstraint=c;this.bottomConstraint=e;this.minY=this.initPageY-c;this.maxY=this.initPageY+e;if(d){this.setYTicks(this.initPageY,d)}this.constrainY=true},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var d=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var c=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(d,c)}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(l,g){if(!g){return l}else{if(g[0]>=l){return g[0]}else{for(var d=0,c=g.length;d<c;++d){var e=d+1;if(g[e]&&g[e]>=l){var k=l-g[d];var h=g[e]-l;return(h>k)?g[d]:g[e]}}return g[g.length-1]}}},toString:function(){return("DragDrop "+this.id)}}})();if(!Ext.dd.DragDropMgr){Ext.dd.DragDropMgr=function(){var a=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(d,c){for(var e in this.ids){for(var b in this.ids[e]){var g=this.ids[e][b];if(!this.isTypeOfDD(g)){continue}g[d].apply(g,c)}}},_onLoad:function(){this.init();a.on(document,"mouseup",this.handleMouseUp,this,true);a.on(document,"mousemove",this.handleMouseMove,this,true);a.on(window,"unload",this._onUnload,this,true);a.on(window,"resize",this._onResize,this,true)},_onResize:function(b){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(c,b){if(!this.initialized){this.init()}if(!this.ids[b]){this.ids[b]={}}this.ids[b][c.id]=c},removeDDFromGroup:function(d,b){if(!this.ids[b]){this.ids[b]={}}var c=this.ids[b];if(c&&c[d.id]){delete c[d.id]}},_remove:function(c){for(var b in c.groups){if(b&&this.ids[b]&&this.ids[b][c.id]){delete this.ids[b][c.id]}}delete this.handleIds[c.id]},regHandle:function(c,b){if(!this.handleIds[c]){this.handleIds[c]={}}this.handleIds[c][b]=b},isDragDrop:function(b){return(this.getDDById(b))?true:false},getRelated:function(g,c){var e=[];for(var d in g.groups){for(j in this.ids[d]){var b=this.ids[d][j];if(!this.isTypeOfDD(b)){continue}if(!c||b.isTarget){e[e.length]=b}}}return e},isLegalTarget:function(g,e){var c=this.getRelated(g,true);for(var d=0,b=c.length;d<b;++d){if(c[d].id==e.id){return true}}return false},isTypeOfDD:function(b){return(b&&b.__ygDragDrop)},isHandle:function(c,b){return(this.handleIds[c]&&this.handleIds[c][b])},getDDById:function(c){for(var b in this.ids){if(this.ids[b][c]){return this.ids[b][c]}}return null},handleMouseDown:function(d,c){if(Ext.QuickTips){Ext.QuickTips.disable()}if(this.dragCurrent){this.handleMouseUp(d)}this.currentTarget=d.getTarget();this.dragCurrent=c;var b=c.getEl();this.startX=d.getPageX();this.startY=d.getPageY();this.deltaX=this.startX-b.offsetLeft;this.deltaY=this.startY-b.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var e=Ext.dd.DDM;e.startDrag(e.startX,e.startY)},this.clickTimeThresh)},startDrag:function(b,c){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(b,c);this.dragCurrent.startDrag(b,c)}this.dragThreshMet=true},handleMouseUp:function(b){if(Ext.QuickTips){Ext.QuickTips.enable()}if(!this.dragCurrent){return}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(b,true)}else{}this.stopDrag(b);this.stopEvent(b)},stopEvent:function(b){if(this.stopPropagation){b.stopPropagation()}if(this.preventDefault){b.preventDefault()}},stopDrag:function(b){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(b);this.dragCurrent.endDrag(b)}this.dragCurrent.onMouseUp(b)}this.dragCurrent=null;this.dragOvers={}},handleMouseMove:function(d){if(!this.dragCurrent){return true}if(Ext.isIE&&(d.button!==0&&d.button!==1&&d.button!==2)){this.stopEvent(d);return this.handleMouseUp(d)}if(!this.dragThreshMet){var c=Math.abs(this.startX-d.getPageX());var b=Math.abs(this.startY-d.getPageY());if(c>this.clickPixelThresh||b>this.clickPixelThresh){this.startDrag(this.startX,this.startY)}}if(this.dragThreshMet){this.dragCurrent.b4Drag(d);this.dragCurrent.onDrag(d);if(!this.dragCurrent.moveOnly){this.fireEvents(d,false)}}this.stopEvent(d);return true},fireEvents:function(o,p){var r=this.dragCurrent;if(!r||r.isLocked()){return}var s=o.getPoint();var b=[];var g=[];var m=[];var k=[];var d=[];for(var h in this.dragOvers){var c=this.dragOvers[h];if(!this.isTypeOfDD(c)){continue}if(!this.isOverTarget(s,c,this.mode)){g.push(c)}b[h]=true;delete this.dragOvers[h]}for(var q in r.groups){if("string"!=typeof q){continue}for(h in this.ids[q]){var l=this.ids[q][h];if(!this.isTypeOfDD(l)){continue}if(l.isTarget&&!l.isLocked()&&l!=r){if(this.isOverTarget(s,l,this.mode)){if(p){k.push(l)}else{if(!b[l.id]){d.push(l)}else{m.push(l)}this.dragOvers[l.id]=l}}}}}if(this.mode){if(g.length){r.b4DragOut(o,g);r.onDragOut(o,g)}if(d.length){r.onDragEnter(o,d)}if(m.length){r.b4DragOver(o,m);r.onDragOver(o,m)}if(k.length){r.b4DragDrop(o,k);r.onDragDrop(o,k)}}else{var n=0;for(h=0,n=g.length;h<n;++h){r.b4DragOut(o,g[h].id);r.onDragOut(o,g[h].id)}for(h=0,n=d.length;h<n;++h){r.onDragEnter(o,d[h].id)}for(h=0,n=m.length;h<n;++h){r.b4DragOver(o,m[h].id);r.onDragOver(o,m[h].id)}for(h=0,n=k.length;h<n;++h){r.b4DragDrop(o,k[h].id);r.onDragDrop(o,k[h].id)}}if(p&&!k.length){r.onInvalidDrop(o)}},getBestMatch:function(d){var g=null;var c=d.length;if(c==1){g=d[0]}else{for(var e=0;e<c;++e){var b=d[e];if(b.cursorIsOver){g=b;break}else{if(!g||g.overlap.getArea()<b.overlap.getArea()){g=b}}}}return g},refreshCache:function(c){for(var b in c){if("string"!=typeof b){continue}for(var d in this.ids[b]){var e=this.ids[b][d];if(this.isTypeOfDD(e)){var g=this.getLocation(e);if(g){this.locationCache[e.id]=g}else{delete this.locationCache[e.id]}}}}},verifyEl:function(c){if(c){var b;if(Ext.isIE){try{b=c.offsetParent}catch(d){}}else{b=c.offsetParent}if(b){return true}}return false},getLocation:function(k){if(!this.isTypeOfDD(k)){return null}var h=k.getEl(),o,g,d,q,p,s,c,n,i;try{o=Ext.lib.Dom.getXY(h)}catch(m){}if(!o){return null}g=o[0];d=g+h.offsetWidth;q=o[1];p=q+h.offsetHeight;s=q-k.padding[0];c=d+k.padding[1];n=p+k.padding[2];i=g-k.padding[3];return new Ext.lib.Region(s,c,n,i)},isOverTarget:function(l,b,d){var g=this.locationCache[b.id];if(!g||!this.useCache){g=this.getLocation(b);this.locationCache[b.id]=g}if(!g){return false}b.cursorIsOver=g.contains(l);var k=this.dragCurrent;if(!k||!k.getTargetCoord||(!d&&!k.constrainX&&!k.constrainY)){return b.cursorIsOver}b.overlap=null;var h=k.getTargetCoord(l.x,l.y);var c=k.getDragEl();var e=new Ext.lib.Region(h.y,h.x+c.offsetWidth,h.y+c.offsetHeight,h.x);var i=e.intersect(g);if(i){b.overlap=i;return(d)?true:b.cursorIsOver}else{return false}},_onUnload:function(c,b){Ext.dd.DragDropMgr.unregAll()},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null}this._execOnAll("unreg",[]);for(var b in this.elementCache){delete this.elementCache[b]}this.elementCache={};this.ids={}},elementCache:{},getElWrapper:function(c){var b=this.elementCache[c];if(!b||!b.el){b=this.elementCache[c]=new this.ElementWrapper(Ext.getDom(c))}return b},getElement:function(b){return Ext.getDom(b)},getCss:function(c){var b=Ext.getDom(c);return(b)?b.style:null},ElementWrapper:function(b){this.el=b||null;this.id=this.el&&b.id;this.css=this.el&&b.style},getPosX:function(b){return Ext.lib.Dom.getX(b)},getPosY:function(b){return Ext.lib.Dom.getY(b)},swapNode:function(d,b){if(d.swapNode){d.swapNode(b)}else{var e=b.parentNode;var c=b.nextSibling;if(c==d){e.insertBefore(d,b)}else{if(b==d.nextSibling){e.insertBefore(b,d)}else{d.parentNode.replaceChild(b,d);e.insertBefore(d,c)}}}},getScroll:function(){var d,b,e=document.documentElement,c=document.body;if(e&&(e.scrollTop||e.scrollLeft)){d=e.scrollTop;b=e.scrollLeft}else{if(c){d=c.scrollTop;b=c.scrollLeft}else{}}return{top:d,left:b}},getStyle:function(c,b){return Ext.fly(c).getStyle(b)},getScrollTop:function(){return this.getScroll().top},getScrollLeft:function(){return this.getScroll().left},moveToEl:function(b,d){var c=Ext.lib.Dom.getXY(d);Ext.lib.Dom.setXY(b,c)},numericSort:function(d,c){return(d-c)},_timeoutCount:0,_addListeners:function(){var b=Ext.dd.DDM;if(Ext.lib.Event&&document){b._onLoad()}else{if(b._timeoutCount>2000){}else{setTimeout(b._addListeners,10);if(document&&document.body){b._timeoutCount+=1}}}},handleWasClicked:function(b,d){if(this.isHandle(d,b.id)){return true}else{var c=b.parentNode;while(c){if(this.isHandle(d,c.id)){return true}else{c=c.parentNode}}}return false}}}();Ext.dd.DDM=Ext.dd.DragDropMgr;Ext.dd.DDM._addListeners()}Ext.dd.DD=function(c,a,b){if(c){this.init(c,a,b)}};Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{scroll:true,autoOffset:function(c,b){var a=c-this.startPageX;var d=b-this.startPageY;this.setDelta(a,d)},setDelta:function(b,a){this.deltaX=b;this.deltaY=a},setDragElPos:function(c,b){var a=this.getDragEl();this.alignElWithMouse(a,c,b)},alignElWithMouse:function(c,h,g){var e=this.getTargetCoord(h,g);var b=c.dom?c:Ext.fly(c,"_dd");if(!this.deltaSetXY){var i=[e.x,e.y];b.setXY(i);var d=b.getLeft(true);var a=b.getTop(true);this.deltaSetXY=[d-e.x,a-e.y]}else{b.setLeftTop(e.x+this.deltaSetXY[0],e.y+this.deltaSetXY[1])}this.cachePosition(e.x,e.y);this.autoScroll(e.x,e.y,c.offsetHeight,c.offsetWidth);return e},cachePosition:function(b,a){if(b){this.lastPageX=b;this.lastPageY=a}else{var c=Ext.lib.Dom.getXY(this.getEl());this.lastPageX=c[0];this.lastPageY=c[1]}},autoScroll:function(m,l,e,n){if(this.scroll){var o=Ext.lib.Dom.getViewHeight();var b=Ext.lib.Dom.getViewWidth();var q=this.DDM.getScrollTop();var d=this.DDM.getScrollLeft();var k=e+l;var p=n+m;var i=(o+q-l-this.deltaY);var g=(b+d-m-this.deltaX);var c=40;var a=(document.all)?80:30;if(k>o&&i<c){window.scrollTo(d,q+a)}if(l<q&&q>0&&l-q<c){window.scrollTo(d,q-a)}if(p>b&&g<c){window.scrollTo(d+a,q)}if(m<d&&d>0&&m-d<c){window.scrollTo(d-a,q)}}},getTargetCoord:function(c,b){var a=c-this.deltaX;var d=b-this.deltaY;if(this.constrainX){if(a<this.minX){a=this.minX}if(a>this.maxX){a=this.maxX}}if(this.constrainY){if(d<this.minY){d=this.minY}if(d>this.maxY){d=this.maxY}}a=this.getTick(a,this.xTicks);d=this.getTick(d,this.yTicks);return{x:a,y:d}},applyConfig:function(){Ext.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false)},b4MouseDown:function(a){this.autoOffset(a.getPageX(),a.getPageY())},b4Drag:function(a){this.setDragElPos(a.getPageX(),a.getPageY())},toString:function(){return("DD "+this.id)}});Ext.dd.DDProxy=function(c,a,b){if(c){this.init(c,a,b);this.initFrame()}};Ext.dd.DDProxy.dragElId="ygddfdiv";Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var b=this;var a=document.body;if(!a||!a.firstChild){setTimeout(function(){b.createFrame()},50);return}var d=this.getDragEl();if(!d){d=document.createElement("div");d.id=this.dragElId;var c=d.style;c.position="absolute";c.visibility="hidden";c.cursor="move";c.border="2px solid #aaa";c.zIndex=999;a.insertBefore(d,a.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(e,d){var c=this.getEl();var a=this.getDragEl();var b=a.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(b.width,10)/2),Math.round(parseInt(b.height,10)/2))}this.setDragElPos(e,d);Ext.fly(a).show()},_resizeProxy:function(){if(this.resizeFrame){var a=this.getEl();Ext.fly(this.getDragEl()).setSize(a.offsetWidth,a.offsetHeight)}},b4MouseDown:function(b){var a=b.getPageX();var c=b.getPageY();this.autoOffset(a,c);this.setDragElPos(a,c)},b4StartDrag:function(a,b){this.showFrame(a,b)},b4EndDrag:function(a){Ext.fly(this.getDragEl()).hide()},endDrag:function(c){var b=this.getEl();var a=this.getDragEl();a.style.visibility="";this.beforeMove();b.style.visibility="hidden";Ext.dd.DDM.moveToEl(b,a);a.style.visibility="hidden";b.style.visibility="";this.afterDrag()},beforeMove:function(){},afterDrag:function(){},toString:function(){return("DDProxy "+this.id)}});Ext.dd.DDTarget=function(c,a,b){if(c){this.initTarget(c,a,b)}};Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{toString:function(){return("DDTarget "+this.id)}});Ext.dd.DragTracker=function(a){Ext.apply(this,a);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(a){this.el=Ext.get(a);a.on("mousedown",this.onMouseDown,this,this.delegate?{delegate:this.delegate}:undefined)},destroy:function(){this.el.un("mousedown",this.onMouseDown,this)},onMouseDown:function(c,b){if(this.fireEvent("mousedown",this,c)!==false&&this.onBeforeStart(c)!==false){this.startXY=this.lastXY=c.getXY();this.dragTarget=this.delegate?b:this.el.dom;c.preventDefault();var a=Ext.getDoc();a.on("mouseup",this.onMouseUp,this);a.on("mousemove",this.onMouseMove,this);a.on("selectstart",this.stopSelect,this);if(this.autoStart){this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this)}}},onMouseMove:function(d,c){d.preventDefault();var b=d.getXY(),a=this.startXY;this.lastXY=b;if(!this.active){if(Math.abs(a[0]-b[0])>this.tolerance||Math.abs(a[1]-b[1])>this.tolerance){this.triggerStart()}else{return}}this.fireEvent("mousemove",this,d);this.onDrag(d);this.fireEvent("drag",this,d)},onMouseUp:function(b){var a=Ext.getDoc();a.un("mousemove",this.onMouseMove,this);a.un("mouseup",this.onMouseUp,this);a.un("selectstart",this.stopSelect,this);b.preventDefault();this.clearStart();this.active=false;delete this.elRegion;this.fireEvent("mouseup",this,b);this.onEnd(b);this.fireEvent("dragend",this,b)},triggerStart:function(a){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(a){a.stopEvent();return false},onBeforeStart:function(a){},onStart:function(a){},onDrag:function(a){},onEnd:function(a){},getDragTarget:function(){return this.dragTarget},getDragCt:function(){return this.el},getXY:function(a){return a?this.constrainModes[a].call(this,this.lastXY):this.lastXY},getOffset:function(c){var b=this.getXY(c);var a=this.startXY;return[a[0]-b[0],a[1]-b[1]]},constrainModes:{point:function(b){if(!this.elRegion){this.elRegion=this.getDragCt().getRegion()}var a=this.dragRegion;a.left=b[0];a.top=b[1];a.right=b[0];a.bottom=b[1];a.constrainTo(this.elRegion);return[a.left,a.top]}}});Ext.dd.ScrollManager=function(){var c=Ext.dd.DragDropMgr;var e={};var b=null;var i={};var h=function(m){b=null;a()};var k=function(){if(c.dragCurrent){c.refreshCache(c.dragCurrent.groups)}};var d=function(){if(c.dragCurrent){var m=Ext.dd.ScrollManager;var n=i.el.ddScrollConfig?i.el.ddScrollConfig.increment:m.increment;if(!m.animate){if(i.el.scroll(i.dir,n)){k()}}else{i.el.scroll(i.dir,n,true,m.animDuration,k)}}};var a=function(){if(i.id){clearInterval(i.id)}i.id=0;i.el=null;i.dir=""};var g=function(n,m){a();i.el=n;i.dir=m;var o=(n.ddScrollConfig&&n.ddScrollConfig.frequency)?n.ddScrollConfig.frequency:Ext.dd.ScrollManager.frequency;i.id=setInterval(d,o)};var l=function(p,s){if(s||!c.dragCurrent){return}var t=Ext.dd.ScrollManager;if(!b||b!=c.dragCurrent){b=c.dragCurrent;t.refreshCache()}var u=Ext.lib.Event.getXY(p);var v=new Ext.lib.Point(u[0],u[1]);for(var n in e){var o=e[n],m=o._region;var q=o.ddScrollConfig?o.ddScrollConfig:t;if(m&&m.contains(v)&&o.isScrollable()){if(m.bottom-v.y<=q.vthresh){if(i.el!=o){g(o,"down")}return}else{if(m.right-v.x<=q.hthresh){if(i.el!=o){g(o,"left")}return}else{if(v.y-m.top<=q.vthresh){if(i.el!=o){g(o,"up")}return}else{if(v.x-m.left<=q.hthresh){if(i.el!=o){g(o,"right")}return}}}}}}a()};c.fireEvents=c.fireEvents.createSequence(l,c);c.stopDrag=c.stopDrag.createSequence(h,c);return{register:function(o){if(Ext.isArray(o)){for(var n=0,m=o.length;n<m;n++){this.register(o[n])}}else{o=Ext.get(o);e[o.id]=o}},unregister:function(o){if(Ext.isArray(o)){for(var n=0,m=o.length;n<m;n++){this.unregister(o[n])}}else{o=Ext.get(o);delete e[o.id]}},vthresh:25,hthresh:25,increment:100,frequency:500,animate:true,animDuration:0.4,refreshCache:function(){for(var m in e){if(typeof e[m]=="object"){e[m]._region=e[m].getRegion()}}}}}();Ext.dd.Registry=function(){var d={};var b={};var a=0;var c=function(g,e){if(typeof g=="string"){return g}var h=g.id;if(!h&&e!==false){h="extdd-"+(++a);g.id=h}return h};return{register:function(k,l){l=l||{};if(typeof k=="string"){k=document.getElementById(k)}l.ddel=k;d[c(k)]=l;if(l.isHandle!==false){b[l.ddel.id]=l}if(l.handles){var h=l.handles;for(var g=0,e=h.length;g<e;g++){b[c(h[g])]=l}}},unregister:function(k){var m=c(k,false);var l=d[m];if(l){delete d[m];if(l.handles){var h=l.handles;for(var g=0,e=h.length;g<e;g++){delete b[c(h[g],false)]}}}},getHandle:function(e){if(typeof e!="string"){e=e.id}return b[e]},getHandleFromEvent:function(h){var g=Ext.lib.Event.getTarget(h);return g?b[g.id]:null},getTarget:function(e){if(typeof e!="string"){e=e.id}return d[e]},getTargetFromEvent:function(h){var g=Ext.lib.Event.getTarget(h);return g?d[g.id]||b[g.id]:null}}}();Ext.dd.StatusProxy=function(a){Ext.apply(this,a);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:!a||a.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(a){a=a||this.dropNotAllowed;if(this.dropStatus!=a){this.el.replaceClass(this.dropStatus,a);this.dropStatus=a}},reset:function(a){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(a){this.ghost.update("")}},update:function(a){if(typeof a=="string"){this.ghost.update(a)}else{this.ghost.update("");a.style.margin="0";this.ghost.dom.appendChild(a)}var b=this.ghost.dom.firstChild;if(b){Ext.fly(b).setStyle(Ext.isIE?"styleFloat":"cssFloat","none")}},getEl:function(){return this.el},getGhost:function(){return this.ghost},hide:function(a){this.el.hide();if(a){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(b,c,a){this.callback=c;this.scope=a;if(b&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||0.5,easing:"easeOut",xy:b,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(b,a){this.el=Ext.get(b);if(!this.dragData){this.dragData={}}Ext.apply(this,a);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(a){return this.dragData},onDragEnter:function(c,d){var b=Ext.dd.DragDropMgr.getDDById(d);this.cachedTarget=b;if(this.beforeDragEnter(b,c,d)!==false){if(b.isNotifyTarget){var a=b.notifyEnter(this,c,this.dragData);this.proxy.setStatus(a)}else{this.proxy.setStatus(this.dropAllowed)}if(this.afterDragEnter){this.afterDragEnter(b,c,d)}}},beforeDragEnter:function(b,a,c){return true},alignElWithMouse:function(){Ext.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync()},onDragOver:function(c,d){var b=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(d);if(this.beforeDragOver(b,c,d)!==false){if(b.isNotifyTarget){var a=b.notifyOver(this,c,this.dragData);this.proxy.setStatus(a)}if(this.afterDragOver){this.afterDragOver(b,c,d)}}},beforeDragOver:function(b,a,c){return true},onDragOut:function(b,c){var a=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(c);if(this.beforeDragOut(a,b,c)!==false){if(a.isNotifyTarget){a.notifyOut(this,b,this.dragData)}this.proxy.reset();if(this.afterDragOut){this.afterDragOut(a,b,c)}}this.cachedTarget=null},beforeDragOut:function(b,a,c){return true},onDragDrop:function(b,c){var a=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(c);if(this.beforeDragDrop(a,b,c)!==false){if(a.isNotifyTarget){if(a.notifyDrop(this,b,this.dragData)){this.onValidDrop(a,b,c)}else{this.onInvalidDrop(a,b,c)}}else{this.onValidDrop(a,b,c)}if(this.afterDragDrop){this.afterDragDrop(a,b,c)}}delete this.cachedTarget},beforeDragDrop:function(b,a,c){return true},onValidDrop:function(b,a,c){this.hideProxy();if(this.afterValidDrop){this.afterValidDrop(b,a,c)}},getRepairXY:function(b,a){return this.el.getXY()},onInvalidDrop:function(b,a,c){this.beforeInvalidDrop(b,a,c);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,a,this.dragData)}this.cacheTarget=null}this.proxy.repair(this.getRepairXY(a,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(a,c)}},afterRepair:function(){if(Ext.enableFx){this.el.highlight(this.hlColor||"c3daf9")}this.dragging=false},beforeInvalidDrop:function(b,a,c){return true},handleMouseDown:function(b){if(this.dragging){return}var a=this.getDragData(b);if(a&&this.onBeforeDrag(a,b)!==false){this.dragData=a;this.proxy.stop();Ext.dd.DragSource.superclass.handleMouseDown.apply(this,arguments)}},onBeforeDrag:function(a,b){return true},onStartDrag:Ext.emptyFn,startDrag:function(a,b){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(a,b);this.proxy.show()},onInitDrag:function(a,c){var b=this.el.dom.cloneNode(true);b.id=Ext.id();this.proxy.update(b);this.onStartDrag(a,c);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(a){},endDrag:function(a){this.onEndDrag(this.dragData,a)},onEndDrag:function(a,b){},autoOffset:function(a,b){this.setDelta(-12,-20)}});Ext.dd.DropTarget=function(b,a){this.el=Ext.get(b);Ext.apply(this,a);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(a,c,b){if(this.overClass){this.el.addClass(this.overClass)}return this.dropAllowed},notifyOver:function(a,c,b){return this.dropAllowed},notifyOut:function(a,c,b){if(this.overClass){this.el.removeClass(this.overClass)}},notifyDrop:function(a,c,b){return false}});Ext.dd.DragZone=function(b,a){Ext.dd.DragZone.superclass.constructor.call(this,b,a);if(this.containerScroll){Ext.dd.ScrollManager.register(this.el)}};Ext.extend(Ext.dd.DragZone,Ext.dd.DragSource,{getDragData:function(a){return Ext.dd.Registry.getHandleFromEvent(a)},onInitDrag:function(a,b){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(a,b);return true},afterRepair:function(){if(Ext.enableFx){Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9")}this.dragging=false},getRepairXY:function(a){return Ext.Element.fly(this.dragData.ddel).getXY()}});Ext.dd.DropZone=function(b,a){Ext.dd.DropZone.superclass.constructor.call(this,b,a)};Ext.extend(Ext.dd.DropZone,Ext.dd.DropTarget,{getTargetFromEvent:function(a){return Ext.dd.Registry.getTargetFromEvent(a)},onNodeEnter:function(d,a,c,b){},onNodeOver:function(d,a,c,b){return this.dropAllowed},onNodeOut:function(d,a,c,b){},onNodeDrop:function(d,a,c,b){return false},onContainerOver:function(a,c,b){return this.dropNotAllowed},onContainerDrop:function(a,c,b){return false},notifyEnter:function(a,c,b){return this.dropNotAllowed},notifyOver:function(a,c,b){var d=this.getTargetFromEvent(c);if(!d){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,a,c,b);this.lastOverNode=null}return this.onContainerOver(a,c,b)}if(this.lastOverNode!=d){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,a,c,b)}this.onNodeEnter(d,a,c,b);this.lastOverNode=d}return this.onNodeOver(d,a,c,b)},notifyOut:function(a,c,b){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,a,c,b);this.lastOverNode=null}},notifyDrop:function(a,c,b){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,a,c,b);this.lastOverNode=null}var d=this.getTargetFromEvent(c);return d?this.onNodeDrop(d,a,c,b):this.onContainerDrop(a,c,b)},triggerCacheRefresh:function(){Ext.dd.DDM.refreshCache(this.groups)}});Ext.data.SortTypes={none:function(a){return a},stripTagsRE:/<\/?[^>]+>/gi,asText:function(a){return String(a).replace(this.stripTagsRE,"")},asUCText:function(a){return String(a).toUpperCase().replace(this.stripTagsRE,"")},asUCString:function(a){return String(a).toUpperCase()},asDate:function(a){if(!a){return 0}if(Ext.isDate(a)){return a.getTime()}return Date.parse(String(a))},asFloat:function(a){var b=parseFloat(String(a).replace(/,/g,""));if(isNaN(b)){b=0}return b},asInt:function(a){var b=parseInt(String(a).replace(/,/g,""));if(isNaN(b)){b=0}return b}};Ext.data.Record=function(a,b){this.id=(b||b===0)?b:++Ext.data.Record.AUTO_ID;this.data=a};Ext.data.Record.create=function(e){var c=Ext.extend(Ext.data.Record,{});var d=c.prototype;d.fields=new Ext.util.MixedCollection(false,function(g){return g.name});for(var b=0,a=e.length;b<a;b++){d.fields.add(new Ext.data.Field(e[b]))}c.getField=function(g){return d.fields.get(g)};return c};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(a){this.store=a},set:function(a,b){if(String(this.data[a])==String(b)){return}this.dirty=true;if(!this.modified){this.modified={}}if(typeof this.modified[a]=="undefined"){this.modified[a]=this.data[a]}this.data[a]=b;if(!this.editing&&this.store){this.store.afterEdit(this)}},get:function(a){return this.data[a]},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(b){var a=this.modified;for(var c in a){if(typeof a[c]!="function"){this.data[c]=a[c]}}this.dirty=false;delete this.modified;this.editing=false;if(this.store&&b!==true){this.store.afterReject(this)}},commit:function(a){this.dirty=false;delete this.modified;this.editing=false;if(this.store&&a!==true){this.store.afterCommit(this)}},getChanges:function(){var a=this.modified,b={};for(var c in a){if(a.hasOwnProperty(c)){b[c]=this.data[c]}}return b},hasError:function(){return this.error!=null},clearError:function(){this.error=null},copy:function(a){return new this.constructor(Ext.apply({},this.data),a||this.id)},isModified:function(a){return !!(this.modified&&this.modified.hasOwnProperty(a))}};Ext.StoreMgr=Ext.apply(new Ext.util.MixedCollection(),{register:function(){for(var a=0,b;b=arguments[a];a++){this.add(b)}},unregister:function(){for(var a=0,b;b=arguments[a];a++){this.remove(this.lookup(b))}},lookup:function(a){return typeof a=="object"?a:this.get(a)},getKey:function(a){return a.storeId||a.id}});Ext.data.Store=function(a){this.data=new Ext.util.MixedCollection(false);this.data.getKey=function(b){return b.id};this.baseParams={};this.paramNames={start:"start",limit:"limit",sort:"sort",dir:"dir"};if(a&&a.data){this.inlineData=a.data;delete a.data}Ext.apply(this,a);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.storeId||this.id){Ext.StoreMgr.unregister(this)}this.data=null;this.purgeListeners()},add:function(b){b=[].concat(b);if(b.length<1){return}for(var d=0,a=b.length;d<a;d++){b[d].join(this)}var c=this.data.length;this.data.addAll(b);if(this.snapshot){this.snapshot.addAll(b)}this.fireEvent("add",this,b,c)},addSorted:function(a){var b=this.findInsertIndex(a);this.insert(b,a)},remove:function(a){var b=this.data.indexOf(a);this.data.removeAt(b);if(this.pruneModifiedRecords){this.modified.remove(a)}if(this.snapshot){this.snapshot.remove(a)}this.fireEvent("remove",this,a,b)},removeAt:function(a){this.remove(this.getAt(a))},removeAll:function(){this.data.clear();if(this.snapshot){this.snapshot.clear()}if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},insert:function(c,b){b=[].concat(b);for(var d=0,a=b.length;d<a;d++){this.data.insert(c,b[d]);b[d].join(this)}this.fireEvent("add",this,b,c)},indexOf:function(a){return this.data.indexOf(a)},indexOfId:function(a){return this.data.indexOfKey(a)},getById:function(a){return this.data.key(a)},getAt:function(a){return this.data.itemAt(a)},getRange:function(b,a){return this.data.getRange(b,a)},storeOptions:function(a){a=Ext.apply({},a);delete a.callback;delete a.scope;this.lastOptions=a},load:function(b){b=b||{};if(this.fireEvent("beforeload",this,b)!==false){this.storeOptions(b);var c=Ext.apply(b.params||{},this.baseParams);if(this.sortInfo&&this.remoteSort){var a=this.paramNames;c[a.sort]=this.sortInfo.field;c[a.dir]=this.sortInfo.direction}this.proxy.load(c,this.reader,this.loadRecords,this,b);return true}else{return false}},reload:function(a){this.load(Ext.applyIf(a||{},this.lastOptions))},loadRecords:function(h,b,g){if(!h||g===false){if(g!==false){this.fireEvent("load",this,[],b)}if(b.callback){b.callback.call(b.scope||this,[],b,false)}return}var e=h.records,d=h.totalRecords||e.length;if(!b||b.add!==true){if(this.pruneModifiedRecords){this.modified=[]}for(var c=0,a=e.length;c<a;c++){e[c].join(this)}if(this.snapshot){this.data=this.snapshot;delete this.snapshot}this.data.clear();this.data.addAll(e);this.totalLength=d;this.applySort();this.fireEvent("datachanged",this)}else{this.totalLength=Math.max(d,this.data.length+e.length);this.add(e)}this.fireEvent("load",this,e,b);if(b.callback){b.callback.call(b.scope||this,e,b,true)}},loadData:function(c,a){var b=this.reader.readRecords(c);this.loadRecords(b,{add:a},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 a=this.sortInfo,b=a.field;this.sortData(b,a.direction)}},sortData:function(c,d){d=d||"ASC";var a=this.fields.get(c).sortType;var b=function(g,e){var i=a(g.data[c]),h=a(e.data[c]);return i>h?1:(i<h?-1:0)};this.data.sort(d,b);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(d,b)}},setDefaultSort:function(b,a){a=a?a.toUpperCase():"ASC";this.sortInfo={field:b,direction:a};this.sortToggle[b]=a},sort:function(e,c){var d=this.fields.get(e);if(!d){return false}if(!c){if(this.sortInfo&&this.sortInfo.field==d.name){c=(this.sortToggle[d.name]||"ASC").toggle("ASC","DESC")}else{c=d.sortDir}}var b=(this.sortToggle)?this.sortToggle[d.name]:null;var a=(this.sortInfo)?this.sortInfo:null;this.sortToggle[d.name]=c;this.sortInfo={field:d.name,direction:c};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this)}else{if(!this.load(this.lastOptions)){if(b){this.sortToggle[d.name]=b}if(a){this.sortInfo=a}}}},each:function(b,a){this.data.each(b,a)},getModifiedRecords:function(){return this.modified},createFilterFn:function(c,b,d,a){if(Ext.isEmpty(b,false)){return false}b=this.data.createValueMatcher(b,d,a);return function(e){return b.test(e.data[c])}},sum:function(e,g,a){var c=this.data.items,b=0;g=g||0;a=(a||a===0)?a:c.length-1;for(var d=g;d<=a;d++){b+=(c[d].data[e]||0)}return b},filter:function(d,c,e,a){var b=this.createFilterFn(d,c,e,a);return b?this.filterBy(b):this.clearFilter()},filterBy:function(b,a){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(b,a||this);this.fireEvent("datachanged",this)},query:function(d,c,e,a){var b=this.createFilterFn(d,c,e,a);return b?this.queryBy(b):this.data.clone()},queryBy:function(b,a){var c=this.snapshot||this.data;return c.filterBy(b,a||this)},find:function(d,c,g,e,a){var b=this.createFilterFn(d,c,e,a);return b?this.data.findIndexBy(b,null,g):-1},findBy:function(b,a,c){return this.data.findIndexBy(b,a,c)},collect:function(k,m,b){var h=(b===true&&this.snapshot)?this.snapshot.items:this.data.items;var n,o,a=[],c={};for(var e=0,g=h.length;e<g;e++){n=h[e].data[k];o=String(n);if((m||!Ext.isEmpty(n))&&!c[o]){c[o]=true;a[a.length]=n}}return a},clearFilter:function(a){if(this.isFiltered()){this.data=this.snapshot;delete this.snapshot;if(a!==true){this.fireEvent("datachanged",this)}}},isFiltered:function(){return this.snapshot&&this.snapshot!=this.data},afterEdit:function(a){if(this.modified.indexOf(a)==-1){this.modified.push(a)}this.fireEvent("update",this,a,Ext.data.Record.EDIT)},afterReject:function(a){this.modified.remove(a);this.fireEvent("update",this,a,Ext.data.Record.REJECT)},afterCommit:function(a){this.modified.remove(a);this.fireEvent("update",this,a,Ext.data.Record.COMMIT)},commitChanges:function(){var b=this.modified.slice(0);this.modified=[];for(var c=0,a=b.length;c<a;c++){b[c].commit()}},rejectChanges:function(){var b=this.modified.slice(0);this.modified=[];for(var c=0,a=b.length;c<a;c++){b[c].reject()}},onMetaChange:function(b,a,c){this.recordType=a;this.fields=a.prototype.fields;delete this.snapshot;this.sortInfo=b.sortInfo;this.modified=[];this.fireEvent("metachange",this,this.reader.meta)},findInsertIndex:function(a){this.suspendEvents();var c=this.data.clone();this.data.add(a);this.applySort();var b=this.data.indexOf(a);this.data=c;this.resumeEvents();return b}});Ext.data.SimpleStore=function(a){Ext.data.SimpleStore.superclass.constructor.call(this,Ext.apply(a,{reader:new Ext.data.ArrayReader({id:a.id},Ext.data.Record.create(a.fields))}))};Ext.extend(Ext.data.SimpleStore,Ext.data.Store,{loadData:function(e,b){if(this.expandData===true){var d=[];for(var c=0,a=e.length;c<a;c++){d[d.length]=[e[c]]}e=d}Ext.data.SimpleStore.superclass.loadData.call(this,e,b)}});Ext.data.JsonStore=function(a){Ext.data.JsonStore.superclass.constructor.call(this,Ext.apply(a,{proxy:a.proxy||(!a.data?new Ext.data.HttpProxy({url:a.url}):undefined),reader:new Ext.data.JsonReader(a,a.fields)}))};Ext.extend(Ext.data.JsonStore,Ext.data.Store);Ext.data.Field=function(d){if(typeof d=="string"){d={name:d}}Ext.apply(this,d);if(!this.type){this.type="auto"}var c=Ext.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=c[this.sortType]}if(!this.sortType){switch(this.type){case"string":this.sortType=c.asUCString;break;case"date":this.sortType=c.asDate;break;default:this.sortType=c.none}}var e=/[\$,%]/g;if(!this.convert){var b,a=this.dateFormat;switch(this.type){case"":case"auto":case undefined:b=function(g){return g};break;case"string":b=function(g){return(g===undefined||g===null)?"":String(g)};break;case"int":b=function(g){return g!==undefined&&g!==null&&g!==""?parseInt(String(g).replace(e,""),10):""};break;case"float":b=function(g){return g!==undefined&&g!==null&&g!==""?parseFloat(String(g).replace(e,""),10):""};break;case"bool":case"boolean":b=function(g){return g===true||g==="true"||g==1};break;case"date":b=function(h){if(!h){return""}if(Ext.isDate(h)){return h}if(a){if(a=="timestamp"){return new Date(h*1000)}if(a=="time"){return new Date(parseInt(h,10))}return Date.parseDate(h,a)}var g=Date.parse(h);return g?new Date(g):null};break}this.convert=b}};Ext.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};Ext.data.DataReader=function(a,b){this.meta=a;this.recordType=Ext.isArray(b)?Ext.data.Record.create(b):b};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(a){Ext.data.MemoryProxy.superclass.constructor.call(this);this.data=a};Ext.extend(Ext.data.MemoryProxy,Ext.data.DataProxy,{load:function(h,c,i,d,b){h=h||{};var a;try{a=c.readRecords(this.data)}catch(g){this.fireEvent("loadexception",this,b,null,g);i.call(d,null,b,false);return}i.call(d,a,b,true)},update:function(b,a){}});Ext.data.HttpProxy=function(a){Ext.data.HttpProxy.superclass.constructor.call(this);this.conn=a;this.useAjax=!a||!a.events};Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{getConnection:function(){return this.useAjax?Ext.Ajax:this.conn},load:function(e,b,g,c,a){if(this.fireEvent("beforeload",this,e)!==false){var d={params:e||{},request:{callback:g,scope:c,arg:a},reader:b,callback:this.loadResponse,scope:this};if(this.useAjax){Ext.applyIf(d,this.conn);if(this.activeRequest){Ext.Ajax.abort(this.activeRequest)}this.activeRequest=Ext.Ajax.request(d)}else{this.conn.request(d)}}else{g.call(c||this,null,a,false)}},loadResponse:function(g,d,b){delete this.activeRequest;if(!d){this.fireEvent("loadexception",this,g,b);g.request.callback.call(g.request.scope,null,g.request.arg,false);return}var a;try{a=g.reader.read(b)}catch(c){this.fireEvent("loadexception",this,g,b,c);g.request.callback.call(g.request.scope,null,g.request.arg,false);return}this.fireEvent("load",this,g,g.request.arg);g.request.callback.call(g.request.scope,a,g.request.arg,true)},update:function(a){},updateResponse:function(a){}});Ext.data.ScriptTagProxy=function(a){Ext.data.ScriptTagProxy.superclass.constructor.call(this);Ext.apply(this,a);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(e,g,i,k,l){if(this.fireEvent("beforeload",this,e)!==false){var c=Ext.urlEncode(Ext.apply(e,this.extraParams));var b=this.url;b+=(b.indexOf("?")!=-1?"&":"?")+c;if(this.nocache){b+="&_dc="+(new Date().getTime())}var a=++Ext.data.ScriptTagProxy.TRANS_ID;var m={id:a,cb:"stcCallback"+a,scriptId:"stcScript"+a,params:e,arg:l,url:b,callback:i,scope:k,reader:g};var d=this;window[m.cb]=function(n){d.handleResponse(n,m)};b+=String.format("&{0}={1}",this.callbackParam,m.cb);if(this.autoAbort!==false){this.abort()}m.timeoutId=this.handleFailure.defer(this.timeout,this,[m]);var h=document.createElement("script");h.setAttribute("src",b);h.setAttribute("type","text/javascript");h.setAttribute("id",m.scriptId);this.head.appendChild(h);this.trans=m}else{i.call(k||this,null,l,false)}},isLoading:function(){return this.trans?true:false},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans)}},destroyTrans:function(b,a){this.head.removeChild(document.getElementById(b.scriptId));clearTimeout(b.timeoutId);if(a){window[b.cb]=undefined;try{delete window[b.cb]}catch(c){}}else{window[b.cb]=function(){window[b.cb]=undefined;try{delete window[b.cb]}catch(d){}}}},handleResponse:function(d,b){this.trans=false;this.destroyTrans(b,true);var a;try{a=b.reader.readRecords(d)}catch(c){this.fireEvent("loadexception",this,d,b.arg,c);b.callback.call(b.scope||window,null,b.arg,false);return}this.fireEvent("load",this,d,b.arg);b.callback.call(b.scope||window,a,b.arg,true)},handleFailure:function(a){this.trans=false;this.destroyTrans(a,false);this.fireEvent("loadexception",this,null,a.arg);a.callback.call(a.scope||window,null,a.arg,false)}});Ext.data.JsonReader=function(a,b){a=a||{};Ext.data.JsonReader.superclass.constructor.call(this,a,b||a.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(a,c,b){},simpleAccess:function(b,a){return b[a]},getJsonAccessor:function(){var a=/[\[\.]/;return function(c){try{return(a.test(c))?new Function("obj","return obj."+c):function(d){return d[c]}}catch(b){}return Ext.emptyFn}}(),readRecords:function(r){this.jsonData=r;if(r.metaData){delete this.ef;this.meta=r.metaData;this.recordType=Ext.data.Record.create(r.metaData.fields);this.onMetaChange(this.meta,this.recordType,r)}var m=this.meta,a=this.recordType,A=a.prototype.fields,k=A.items,h=A.length;if(!this.ef){if(m.totalProperty){this.getTotal=this.getJsonAccessor(m.totalProperty)}if(m.successProperty){this.getSuccess=this.getJsonAccessor(m.successProperty)}this.getRoot=m.root?this.getJsonAccessor(m.root):function(c){return c};if(m.id){var z=this.getJsonAccessor(m.id);this.getId=function(g){var c=z(g);return(c===undefined||c==="")?null:c}}else{this.getId=function(){return null}}this.ef=[];for(var x=0;x<h;x++){A=k[x];var C=(A.mapping!==undefined&&A.mapping!==null)?A.mapping:A.name;this.ef[x]=this.getJsonAccessor(C)}}var u=this.getRoot(r),B=u.length,p=B,e=true;if(m.totalProperty){var l=parseInt(this.getTotal(r),10);if(!isNaN(l)){p=l}}if(m.successProperty){var l=this.getSuccess(r);if(l===false||l==="false"){e=false}}var y=[];for(var x=0;x<B;x++){var t=u[x];var b={};var q=this.getId(t);for(var w=0;w<h;w++){A=k[w];var l=this.ef[w](t);b[A.name]=A.convert((l!==undefined)?l:A.defaultValue,t)}var d=new a(b,q);d.json=t;y[x]=d}return{success:e,records:y,totalRecords:p}}});Ext.data.XmlReader=function(a,b){a=a||{};Ext.data.XmlReader.superclass.constructor.call(this,a,b||a.fields)};Ext.extend(Ext.data.XmlReader,Ext.data.DataReader,{read:function(a){var b=a.responseXML;if(!b){throw {message:"XmlReader.read: XML Document not available"}}return this.readRecords(b)},readRecords:function(z){this.xmlData=z;var s=z.documentElement||z;var l=Ext.DomQuery;var b=this.recordType,p=b.prototype.fields;var d=this.meta.id;var h=0,e=true;if(this.meta.totalRecords){h=l.selectNumber(this.meta.totalRecords,s,0)}if(this.meta.success){var o=l.selectValue(this.meta.success,s,true);e=o!==false&&o!=="false"}var w=[];var A=l.select(this.meta.record,s);for(var u=0,x=A.length;u<x;u++){var r=A[u];var a={};var m=d?l.selectValue(d,r):undefined;for(var t=0,k=p.length;t<k;t++){var y=p.items[t];var g=l.selectValue(y.mapping||y.name,r,y.defaultValue);g=y.convert(g,r);a[y.name]=g}var c=new b(a,m);c.node=r;w[w.length]=c}return{success:e,records:w,totalRecords:h||w.length}}});Ext.data.ArrayReader=Ext.extend(Ext.data.JsonReader,{readRecords:function(c){var b=this.meta?this.meta.id:null;var h=this.recordType,q=h.prototype.fields;var e=[];var s=c;for(var m=0;m<s.length;m++){var d=s[m];var u={};var a=((b||b===0)&&d[b]!==undefined&&d[b]!==""?d[b]:null);for(var l=0,w=q.length;l<w;l++){var r=q.items[l];var g=r.mapping!==undefined&&r.mapping!==null?r.mapping:l;var t=d[g]!==undefined?d[g]:r.defaultValue;t=r.convert(t,d);u[r.name]=t}var p=new h(u,a);p.json=d;e[e.length]=p}return{records:e,totalRecords:e.length}}});Ext.data.Tree=function(a){this.nodeHash={};this.root=null;if(a){this.setRootNode(a)}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(a){this.root=a;a.ownerTree=this;a.isRoot=true;this.registerNode(a);return a},getNodeById:function(a){return this.nodeHash[a]},registerNode:function(a){this.nodeHash[a.id]=a},unregisterNode:function(a){delete this.nodeHash[a.id]},toString:function(){return"[Tree"+(this.id?" "+this.id:"")+"]"}});Ext.data.Node=function(a){this.attributes=a||{};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(d){for(var c=0,b=this.length;c<b;c++){if(this[c]==d){return c}}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(b){if(Ext.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false}var a=this.getOwnerTree();if(a){if(a.proxyNodeEvent.apply(a,arguments)===false){return false}}return true},isLeaf:function(){return this.leaf===true},setFirstChild:function(a){this.firstChild=a},setLastChild:function(a){this.lastChild=a},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(e){var g=false;if(Ext.isArray(e)){g=e}else{if(arguments.length>1){g=arguments}}if(g){for(var d=0,a=g.length;d<a;d++){this.appendChild(g[d])}}else{if(this.fireEvent("beforeappend",this.ownerTree,this,e)===false){return false}var b=this.childNodes.length;var c=e.parentNode;if(c){if(e.fireEvent("beforemove",e.getOwnerTree(),e,c,this,b)===false){return false}c.removeChild(e)}b=this.childNodes.length;if(b==0){this.setFirstChild(e)}this.childNodes.push(e);e.parentNode=this;var h=this.childNodes[b-1];if(h){e.previousSibling=h;h.nextSibling=e}else{e.previousSibling=null}e.nextSibling=null;this.setLastChild(e);e.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,e,b);if(c){e.fireEvent("move",this.ownerTree,e,c,this,b)}return e}},removeChild:function(b){var a=this.childNodes.indexOf(b);if(a==-1){return false}if(this.fireEvent("beforeremove",this.ownerTree,this,b)===false){return false}this.childNodes.splice(a,1);if(b.previousSibling){b.previousSibling.nextSibling=b.nextSibling}if(b.nextSibling){b.nextSibling.previousSibling=b.previousSibling}if(this.firstChild==b){this.setFirstChild(b.nextSibling)}if(this.lastChild==b){this.setLastChild(b.previousSibling)}b.setOwnerTree(null);b.parentNode=null;b.previousSibling=null;b.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,b);return b},insertBefore:function(d,a){if(!a){return this.appendChild(d)}if(d==a){return false}if(this.fireEvent("beforeinsert",this.ownerTree,this,d,a)===false){return false}var b=this.childNodes.indexOf(a);var c=d.parentNode;var e=b;if(c==this&&this.childNodes.indexOf(d)<b){e--}if(c){if(d.fireEvent("beforemove",d.getOwnerTree(),d,c,this,b,a)===false){return false}c.removeChild(d)}if(e==0){this.setFirstChild(d)}this.childNodes.splice(e,0,d);d.parentNode=this;var g=this.childNodes[e-1];if(g){d.previousSibling=g;g.nextSibling=d}else{d.previousSibling=null}d.nextSibling=a;a.previousSibling=d;d.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,d,a);if(c){d.fireEvent("move",this.ownerTree,d,c,this,e,a)}return d},remove:function(){this.parentNode.removeChild(this);return this},item:function(a){return this.childNodes[a]},replaceChild:function(a,c){var b=c?c.nextSibling:null;this.removeChild(c);this.insertBefore(a,b);return c},indexOf:function(a){return this.childNodes.indexOf(a)},getOwnerTree:function(){if(!this.ownerTree){var a=this;while(a){if(a.ownerTree){this.ownerTree=a.ownerTree;break}a=a.parentNode}}return this.ownerTree},getDepth:function(){var b=0;var a=this;while(a.parentNode){++b;a=a.parentNode}return b},setOwnerTree:function(b){if(b!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this)}this.ownerTree=b;var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].setOwnerTree(b)}if(b){b.registerNode(this)}}},getPath:function(c){c=c||"id";var e=this.parentNode;var a=[this.attributes[c]];while(e){a.unshift(e.attributes[c]);e=e.parentNode}var d=this.getOwnerTree().pathSeparator;return d+a.join(d)},bubble:function(c,b,a){var d=this;while(d){if(c.apply(b||d,a||[d])===false){break}d=d.parentNode}},cascade:function(g,e,b){if(g.apply(e||this,b||[this])!==false){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].cascade(g,e,b)}}},eachChild:function(g,e,b){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){if(g.apply(e||this,b||[d[c]])===false){break}}},findChild:function(d,e){var c=this.childNodes;for(var b=0,a=c.length;b<a;b++){if(c[b].attributes[d]==e){return c[b]}}return null},findChildBy:function(e,d){var c=this.childNodes;for(var b=0,a=c.length;b<a;b++){if(e.call(d||c[b],c[b])===true){return c[b]}}return null},sort:function(e,d){var c=this.childNodes;var a=c.length;if(a>0){var g=d?function(){e.apply(d,arguments)}:e;c.sort(g);for(var b=0;b<a;b++){var h=c[b];h.previousSibling=c[b-1];h.nextSibling=c[b+1];if(b==0){this.setFirstChild(h)}if(b==a-1){this.setLastChild(h)}}}},contains:function(a){return a.isAncestor(this)},isAncestor:function(a){var b=this.parentNode;while(b){if(b==a){return true}b=b.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(c,b){if(this.groupField==c&&!b){return}this.groupField=c;if(this.remoteGroup){if(!this.baseParams){this.baseParams={}}this.baseParams.groupBy=c}if(this.groupOnSort){this.sort(c);return}if(this.remoteGroup){this.reload()}else{var a=this.sortInfo||{};if(a.field!=c){this.applySort()}else{this.sortData(c)}this.fireEvent("datachanged",this)}},applySort:function(){Ext.data.GroupingStore.superclass.applySort.call(this);if(!this.groupOnSort&&!this.remoteGroup){var a=this.getGroupState();if(a&&a!=this.sortInfo.field){this.sortData(this.groupField)}}},applyGrouping:function(a){if(this.groupField!==false){this.groupBy(this.groupField,true);return true}else{if(a===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 b=new Ext.util.MixedCollection();var a={};return{register:function(d){b.add(d)},unregister:function(d){b.remove(d)},get:function(c){return b.get(c)},onAvailable:function(e,d,c){b.on("add",function(g,h){if(h.id==e){d.call(c||h,h);b.un("add",d,c)}})},all:b,registerType:function(d,c){a[d]=c;c.xtype=d},create:function(c,d){return new a[c.xtype||d](c)}}}();Ext.reg=Ext.ComponentMgr.registerType;Ext.Component=function(b){b=b||{};if(b.initialConfig){if(b.isAction){this.baseAction=b}b=b.initialConfig}else{if(b.tagName||b.dom||typeof b=="string"){b={applyTo:b,id:b.id||b}}}this.initialConfig=b;Ext.apply(this,b);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 c=0,a=this.plugins.length;c<a;c++){this.plugins[c]=this.initPlugin(this.plugins[c])}}else{this.plugins=this.initPlugin(this.plugins)}}if(this.stateful!==false){this.initState(b)}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(a){a.init(this);return a},initComponent:Ext.emptyFn,render:function(b,a){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!b&&this.el){this.el=Ext.get(this.el);b=this.el.dom.parentNode;this.allowDomMove=false}this.container=Ext.get(b);if(this.ctCls){this.container.addClass(this.ctCls)}this.rendered=true;if(a!==undefined){if(typeof a=="number"){a=this.container.dom.childNodes[a]}else{a=Ext.getDom(a)}}this.onRender(this.container,a||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}if(this.overCls){this.el.addClassOnOver(this.overCls)}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(a){if(Ext.state.Manager){var c=this.getStateId();if(c){var b=Ext.state.Manager.get(c);if(b){if(this.fireEvent("beforestaterestore",this,b)!==false){this.applyState(b);this.fireEvent("staterestore",this,b)}}}}},getStateId:function(){return this.stateId||((this.id.indexOf("ext-comp-")==0||this.id.indexOf("ext-gen")==0)?null:this.id)},initStateEvents:function(){if(this.stateEvents){for(var a=0,b;b=this.stateEvents[a];a++){this.on(b,this.saveState,this,{delay:100})}}},applyState:function(b,a){if(b){Ext.apply(this,b)}},getState:function(){return null},saveState:function(){if(Ext.state.Manager){var b=this.getStateId();if(b){var a=this.getState();if(this.fireEvent("beforestatesave",this,a)!==false){Ext.state.Manager.set(b,a);this.fireEvent("statesave",this,a)}}}},applyToMarkup:function(a){this.allowDomMove=false;this.el=Ext.get(a);this.render(this.el.dom.parentNode)},addClass:function(a){if(this.el){this.el.addClass(a)}else{this.cls=this.cls?this.cls+" "+a:a}},removeClass:function(a){if(this.el){this.el.removeClass(a)}else{if(this.cls){this.cls=this.cls.split(" ").remove(a).join(" ")}}},onRender:function(b,a){if(this.autoEl){if(typeof this.autoEl=="string"){this.el=document.createElement(this.autoEl)}else{var c=document.createElement("div");Ext.DomHelper.overwrite(c,this.autoEl);this.el=c.firstChild}if(!this.el.id){this.el.id=this.getId()}}if(this.el){this.el=Ext.get(this.el);if(this.allowDomMove!==false){b.dom.insertBefore(this.el.dom,a)}}},getAutoCreate:function(){var a=typeof this.autoCreate=="object"?this.autoCreate:Ext.apply({},this.defaultAutoCreate);if(this.id&&!a.id){a.id=this.id}return a},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(b,a){if(a){this.focus.defer(typeof a=="number"?a:10,this,[b,false]);return}if(this.rendered){this.el.focus();if(b===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(a){this[a?"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(a){if(a){this.show()}else{this.hide()}return this},isVisible:function(){return this.rendered&&this.getActionEl().isVisible()},cloneConfig:function(b){b=b||{};var c=b.id||Ext.id();var a=Ext.applyIf(b,this.initialConfig);a.id=c;return new this.constructor(a)},getXType:function(){return this.constructor.xtype},isXType:function(b,a){if(typeof b=="function"){b=b.xtype}else{if(typeof b=="object"){b=b.constructor.xtype}}return !a?("/"+this.getXTypes()+"/").indexOf("/"+b+"/")!=-1:this.constructor.xtype==b},getXTypes:function(){var a=this.constructor;if(!a.xtypes){var d=[],b=this;while(b&&b.constructor.xtype){d.unshift(b.constructor.xtype);b=b.constructor.superclass}a.xtypeChain=d;a.xtypes=d.join("/")}return a.xtypes},findParentBy:function(a){for(var b=this.ownerCt;(b!=null)&&!a(b,this);b=b.ownerCt){}return b||null},findParentByType:function(a){return typeof a=="function"?this.findParentBy(function(b){return b.constructor===a}):this.findParentBy(function(b){return b.constructor.xtype===a})},mon:function(e,b,d,c,a){if(!this.mons){this.mons=[];this.on("beforedestroy",function(){for(var k=0,h=this.mons.length;k<h;k++){var g=this.mons[k];g.item.un(g.ename,g.fn,g.scope)}},this)}this.mons.push({item:e,ename:b,fn:d,scope:c});e.on(b,d,c,a)}});Ext.reg("component",Ext.Component);Ext.Action=function(a){this.initialConfig=a;this.items=[]};Ext.Action.prototype={isAction:true,setText:function(a){this.initialConfig.text=a;this.callEach("setText",[a])},getText:function(){return this.initialConfig.text},setIconClass:function(a){this.initialConfig.iconCls=a;this.callEach("setIconClass",[a])},getIconClass:function(){return this.initialConfig.iconCls},setDisabled:function(a){this.initialConfig.disabled=a;this.callEach("setDisabled",[a])},enable:function(){this.setDisabled(false)},disable:function(){this.setDisabled(true)},isDisabled:function(){return this.initialConfig.disabled},setHidden:function(a){this.initialConfig.hidden=a;this.callEach("setVisible",[!a])},show:function(){this.setHidden(false)},hide:function(){this.setHidden(true)},isHidden:function(){return this.initialConfig.hidden},setHandler:function(b,a){this.initialConfig.handler=b;this.initialConfig.scope=a;this.callEach("setHandler",[b,a])},each:function(b,a){Ext.each(this.items,b,a)},callEach:function(e,b){var d=this.items;for(var c=0,a=d.length;c<a;c++){d[c][e].apply(d[c],b)}},addComponent:function(a){this.items.push(a);a.on("destroy",this.removeComponent,this)},removeComponent:function(a){this.items.remove(a)},execute:function(){this.initialConfig.handler.apply(this.initialConfig.scope||window,arguments)}};(function(){Ext.Layer=function(d,c){d=d||{};var e=Ext.DomHelper;var h=d.parentEl,g=h?Ext.getDom(h):document.body;if(c){this.dom=Ext.getDom(c)}if(!this.dom){var i=d.dh||{tag:"div",cls:"x-layer"};this.dom=e.append(g,i)}if(d.cls){this.addClass(d.cls)}this.constrain=d.constrain!==false;this.visibilityMode=Ext.Element.VISIBILITY;if(d.id){this.id=this.dom.id=d.id}else{this.id=Ext.id(this.dom)}this.zindex=d.zindex||this.getZIndex();this.position("absolute",this.zindex);if(d.shadow){this.shadowOffset=d.shadowOffset||4;this.shadow=new Ext.Shadow({offset:this.shadowOffset,mode:d.shadow})}else{this.shadowOffset=0}this.useShim=d.shim!==false&&Ext.useShims;this.useDisplay=d.useDisplay;this.hide()};var a=Ext.Element.prototype;var b=[];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 d=b.shift();if(!d){d=this.createShim();d.enableDisplayMode("block");d.dom.style.display="none";d.dom.style.visibility="visible"}var c=this.dom.parentNode;if(d.dom.parentNode!=c){c.insertBefore(d.dom,this.dom)}d.setStyle("z-index",this.getZIndex()-2);this.shim=d;return d},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);b.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(c){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(c){this.sync(true)}}},sync:function(c){var m=this.shadow;if(!this.updating&&this.isVisible()&&(m||this.useShim)){var g=this.getShim();var k=this.getWidth(),e=this.getHeight();var d=this.getLeft(true),n=this.getTop(true);if(m&&!this.shadowDisabled){if(c&&!m.isVisible()){m.show(this)}else{m.realign(d,n,k,e)}if(g){if(c){g.show()}var i=m.adjusts,o=g.dom.style;o.left=(Math.min(d,d+i.l))+"px";o.top=(Math.min(n,n+i.t))+"px";o.width=(k+i.w)+"px";o.height=(e+i.h)+"px"}}else{if(g){if(c){g.show()}g.setSize(k,e);g.setLeftTop(d,n)}}}},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(c){if(this.shadow){this.shadow.hide()}this.hideShim()},constrainXY:function(){if(this.constrain){var i=Ext.lib.Dom.getViewWidth(),c=Ext.lib.Dom.getViewHeight();var o=Ext.getDoc().getScroll();var n=this.getXY();var k=n[0],g=n[1];var l=this.dom.offsetWidth+this.shadowOffset,d=this.dom.offsetHeight+this.shadowOffset;var e=false;if((k+l)>i+o.left){k=i-l-this.shadowOffset;e=true}if((g+d)>c+o.top){g=c-d-this.shadowOffset;e=true}if(k<o.left){k=o.left;e=true}if(g<o.top){g=o.top;e=true}if(e){if(this.avoidY){var m=this.avoidY;if(g<=m&&(g+d)>=m){g=m-d-5}}n=[k,g];this.storeXY(n);a.setXY.call(this,n);this.sync()}}},isVisible:function(){return this.visible},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("")}else{if(this.lastXY){a.setXY.call(this,this.lastXY)}else{if(this.lastLT){a.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(i,h,l,m,k){if(i){this.showAction()}if(h&&i){var g=function(){this.sync(true);if(m){m()}}.createDelegate(this);a.setVisible.call(this,true,true,l,g,k)}else{if(!i){this.hideUnders(true)}var g=m;if(h){g=function(){this.hideAction();if(m){m()}}.createDelegate(this)}a.setVisible.call(this,i,h,l,g,k);if(i){this.sync(true)}else{if(!h){this.hideAction()}}}},storeXY:function(c){delete this.lastLT;this.lastXY=c},storeLeftTop:function(d,c){delete this.lastXY;this.lastLT=[d,c]},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(c){this.storeLeftTop(c,this.getTop(true));a.setLeft.apply(this,arguments);this.sync()},setTop:function(c){this.storeLeftTop(this.getLeft(true),c);a.setTop.apply(this,arguments);this.sync()},setLeftTop:function(d,c){this.storeLeftTop(d,c);a.setLeftTop.apply(this,arguments);this.sync()},setXY:function(k,h,l,m,i){this.fixDisplay();this.beforeAction();this.storeXY(k);var g=this.createCB(m);a.setXY.call(this,k,h,l,g,i);if(!h){g()}},createCB:function(e){var d=this;return function(){d.constrainXY();d.sync(true);if(e){e()}}},setX:function(g,h,k,l,i){this.setXY([g,this.getY()],h,k,l,i)},setY:function(l,g,i,k,h){this.setXY([this.getX(),l],g,i,k,h)},setSize:function(k,l,i,n,o,m){this.beforeAction();var g=this.createCB(o);a.setSize.call(this,k,l,i,n,g,m);if(!i){g()}},setWidth:function(i,h,l,m,k){this.beforeAction();var g=this.createCB(m);a.setWidth.call(this,i,h,l,g,k);if(!h){g()}},setHeight:function(k,i,m,n,l){this.beforeAction();var g=this.createCB(n);a.setHeight.call(this,k,i,m,g,l);if(!i){g()}},setBounds:function(p,n,q,i,o,l,m,k){this.beforeAction();var g=this.createCB(m);if(!o){this.storeXY([p,n]);a.setXY.call(this,[p,n]);a.setSize.call(this,q,i,o,l,g,k);g()}else{a.setBounds.call(this,p,n,q,i,o,l,g,k)}return this},setZIndex:function(c){this.zindex=c;this.setStyle("z-index",c+2);if(this.shadow){this.shadow.setZIndex(c+1)}if(this.shim){this.shim.setStyle("z-index",c)}}})})();Ext.Shadow=function(d){Ext.apply(this,d);if(typeof this.mode!="string"){this.mode=this.defaultMode}var e=this.offset,c={h:0};var b=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case"drop":c.w=0;c.l=c.t=e;c.t-=1;if(Ext.isIE){c.l-=this.offset+b;c.t-=this.offset+b;c.w-=b;c.h-=b;c.t+=1}break;case"sides":c.w=(e*2);c.l=-e;c.t=e-1;if(Ext.isIE){c.l-=(this.offset-b);c.t-=this.offset+b;c.l+=1;c.w-=(this.offset-b)*2;c.w-=b+1;c.h-=1}break;case"frame":c.w=c.h=(e*2);c.l=c.t=-e;c.t+=1;c.h-=2;if(Ext.isIE){c.l-=(this.offset-b);c.t-=(this.offset-b);c.l+=1;c.w-=(this.offset+b+1);c.h-=(this.offset+b);c.h+=1}break}this.adjusts=c};Ext.Shadow.prototype={offset:4,defaultMode:"drop",show:function(a){a=Ext.get(a);if(!this.el){this.el=Ext.Shadow.Pool.pull();if(this.el.dom.nextSibling!=a.dom){this.el.insertBefore(a)}}this.el.setStyle("z-index",this.zIndex||parseInt(a.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(a.getLeft(true),a.getTop(true),a.getWidth(),a.getHeight());this.el.dom.style.display="block"},isVisible:function(){return this.el?true:false},realign:function(b,u,r,g){if(!this.el){return}var o=this.adjusts,m=this.el.dom,v=m.style;var i=0;v.left=(b+o.l)+"px";v.top=(u+o.t)+"px";var q=(r+o.w),e=(g+o.h),k=q+"px",p=e+"px";if(v.width!=k||v.height!=p){v.width=k;v.height=p;if(!Ext.isIE){var n=m.childNodes;var c=Math.max(0,(q-12))+"px";n[0].childNodes[1].style.width=c;n[1].childNodes[1].style.width=c;n[2].childNodes[1].style.width=c;n[1].style.height=Math.max(0,(e-12))+"px"}}},hide:function(){if(this.el){this.el.dom.style.display="none";Ext.Shadow.Pool.push(this.el);delete this.el}},setZIndex:function(a){this.zIndex=a;if(this.el){this.el.setStyle("z-index",a)}}};Ext.Shadow.Pool=function(){var b=[];var a=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 c=b.shift();if(!c){c=Ext.get(Ext.DomHelper.insertHtml("beforeBegin",document.body.firstChild,a));c.autoBoxAdjust=false}return c},push:function(c){b.push(c)}}}();Ext.BoxComponent=Ext.extend(Ext.Component,{initComponent:function(){Ext.BoxComponent.superclass.initComponent.call(this);this.addEvents("resize","move")},boxReady:false,deferHeight:false,setSize:function(b,d){if(typeof b=="object"){d=b.height;b=b.width}if(!this.boxReady){this.width=b;this.height=d;return this}if(this.lastSize&&this.lastSize.width==b&&this.lastSize.height==d){return this}this.lastSize={width:b,height:d};var c=this.adjustSize(b,d);var g=c.width,a=c.height;if(g!==undefined||a!==undefined){var e=this.getResizeEl();if(!this.deferHeight&&g!==undefined&&a!==undefined){e.setSize(g,a)}else{if(!this.deferHeight&&a!==undefined){e.setHeight(a)}else{if(g!==undefined){e.setWidth(g)}}}this.onResize(g,a,b,d);this.fireEvent("resize",this,g,a,b,d)}return this},setWidth:function(a){return this.setSize(a)},setHeight:function(a){return this.setSize(undefined,a)},getSize:function(){return this.el.getSize()},getPosition:function(a){if(a===true){return[this.el.getLeft(true),this.el.getTop(true)]}return this.xy||this.el.getXY()},getBox:function(a){var b=this.el.getSize();if(a===true){b.x=this.el.getLeft(true);b.y=this.el.getTop(true)}else{var c=this.xy||this.el.getXY();b.x=c[0];b.y=c[1]}return b},updateBox:function(a){this.setSize(a.width,a.height);this.setPagePosition(a.x,a.y);return this},getResizeEl:function(){return this.resizeEl||this.el},getPositionEl:function(){return this.positionEl||this.el},setPosition:function(a,g){if(a&&typeof a[1]=="number"){g=a[1];a=a[0]}this.x=a;this.y=g;if(!this.boxReady){return this}var b=this.adjustPosition(a,g);var e=b.x,d=b.y;var c=this.getPositionEl();if(e!==undefined||d!==undefined){if(e!==undefined&&d!==undefined){c.setLeftTop(e,d)}else{if(e!==undefined){c.setLeft(e)}else{if(d!==undefined){c.setTop(d)}}}this.onPosition(e,d);this.fireEvent("move",this,e,d)}return this},setPagePosition:function(a,c){if(a&&typeof a[1]=="number"){c=a[1];a=a[0]}this.pageX=a;this.pageY=c;if(!this.boxReady){return}if(a===undefined||c===undefined){return}var b=this.el.translatePoints(a,c);this.setPosition(b.left,b.top);return this},onRender:function(b,a){Ext.BoxComponent.superclass.onRender.call(this,b,a);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(d,b,a,c){},onPosition:function(a,b){},adjustSize:function(a,b){if(this.autoWidth){a="auto"}if(this.autoHeight){b="auto"}return{width:a,height:b}},adjustPosition:function(a,b){return{x:a,y:b}}});Ext.reg("box",Ext.BoxComponent);Ext.SplitBar=function(c,e,b,d,a){this.el=Ext.get(c,true);this.el.dom.unselectable="on";this.resizingEl=Ext.get(e,true);this.orientation=b||Ext.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!a){this.proxy=Ext.SplitBar.createProxy(this.orientation)}else{this.proxy=Ext.get(a).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=d||(this.el.getX()>this.resizingEl.getX()?Ext.SplitBar.LEFT:Ext.SplitBar.RIGHT);this.el.addClass("x-splitbar-h")}else{this.placement=d||(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(a,e){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 c=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();this.activeMaxSize=this.getMaximumSize();var d=c-this.activeMinSize;var b=Math.max(this.activeMaxSize-c,0);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Ext.SplitBar.LEFT?d:b,this.placement==Ext.SplitBar.LEFT?b:d);this.dd.setYConstraint(0,0)}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Ext.SplitBar.TOP?d:b,this.placement==Ext.SplitBar.TOP?b:d)}this.dragSpecs.startSize=c;this.dragSpecs.startPoint=[a,e];Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd,a,e)},onEndProxyDrag:function(c){Ext.get(this.proxy).setDisplayed(false);var b=Ext.lib.Event.getXY(c);if(this.overlay){Ext.destroy(this.overlay);delete this.overlay}var a;if(this.orientation==Ext.SplitBar.HORIZONTAL){a=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.LEFT?b[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-b[0])}else{a=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.TOP?b[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-b[1])}a=Math.min(Math.max(a,this.activeMinSize),this.activeMaxSize);if(a!=this.dragSpecs.startSize){if(this.fireEvent("beforeapply",this,a)!==false){this.adapter.setElementSize(this,a);this.fireEvent("moved",this,a);this.fireEvent("resize",this,a)}}},getAdapter:function(){return this.adapter},setAdapter:function(a){this.adapter=a;this.adapter.init(this)},getMinimumSize:function(){return this.minSize},setMinimumSize:function(a){this.minSize=a},getMaximumSize:function(){return this.maxSize},setMaximumSize:function(a){this.maxSize=a},setCurrentSize:function(b){var a=this.animate;this.animate=false;this.adapter.setElementSize(this,b);this.animate=a},destroy:function(a){if(this.shim){this.shim.remove()}this.dd.unreg();Ext.destroy(Ext.get(this.proxy));if(a){this.el.remove()}}});Ext.SplitBar.createProxy=function(b){var c=new Ext.Element(document.createElement("div"));c.unselectable();var a="x-splitbar-proxy";c.addClass(a+" "+(b==Ext.SplitBar.HORIZONTAL?a+"-h":a+"-v"));document.body.appendChild(c.dom);return c.dom};Ext.SplitBar.BasicLayoutAdapter=function(){};Ext.SplitBar.BasicLayoutAdapter.prototype={init:function(a){},getElementSize:function(a){if(a.orientation==Ext.SplitBar.HORIZONTAL){return a.resizingEl.getWidth()}else{return a.resizingEl.getHeight()}},setElementSize:function(b,a,c){if(b.orientation==Ext.SplitBar.HORIZONTAL){if(!b.animate){b.resizingEl.setWidth(a);if(c){c(b,a)}}else{b.resizingEl.setWidth(a,true,0.1,c,"easeOut")}}else{if(!b.animate){b.resizingEl.setHeight(a);if(c){c(b,a)}}else{b.resizingEl.setHeight(a,true,0.1,c,"easeOut")}}}};Ext.SplitBar.AbsoluteLayoutAdapter=function(a){this.basic=new Ext.SplitBar.BasicLayoutAdapter();this.container=Ext.get(a)};Ext.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(a){this.basic.init(a)},getElementSize:function(a){return this.basic.getElementSize(a)},setElementSize:function(b,a,c){this.basic.setElementSize(b,a,this.moveSplitter.createDelegate(this,[b]))},moveSplitter:function(a){var b=Ext.SplitBar;switch(a.placement){case b.LEFT:a.el.setX(a.resizingEl.getRight());break;case b.RIGHT:a.el.setStyle("right",(this.container.getWidth()-a.resizingEl.getLeft())+"px");break;case b.TOP:a.el.setY(a.resizingEl.getBottom());break;case b.BOTTOM:a.el.setY(a.resizingEl.getTop()-a.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 a=this.items;if(a){delete this.items;if(Ext.isArray(a)&&a.length>0){this.add.apply(this,a)}else{this.add(a)}}},initItems:function(){if(!this.items){this.items=new Ext.util.MixedCollection(false,this.getComponentId);this.getLayout()}},setLayout:function(a){if(this.layout&&this.layout!=a){this.layout.setContainer(null)}this.initItems();this.layout=a;a.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 a=this.activeItem;delete this.activeItem;this.layout.setActiveItem(a);return}}if(!this.ownerCt){this.doLayout()}if(this.monitorResize===true){Ext.EventManager.onWindowResize(this.doLayout,this,[false])}},getLayoutTarget:function(){return this.el},getComponentId:function(a){return a.itemId||a.id},add:function(e){if(!this.items){this.initItems()}var d=arguments,b=d.length;if(b>1){for(var g=0;g<b;g++){this.add(d[g])}return}var k=this.lookupComponent(this.applyDefaults(e));var h=this.items.length;if(this.fireEvent("beforeadd",this,k,h)!==false&&this.onBeforeAdd(k)!==false){this.items.add(k);k.ownerCt=this;this.fireEvent("add",this,k,h)}return k},insert:function(g,e){if(!this.items){this.initItems()}var d=arguments,b=d.length;if(b>2){for(var h=b-1;h>=1;--h){this.insert(g,d[h])}return}var k=this.lookupComponent(this.applyDefaults(e));if(k.ownerCt==this&&this.items.indexOf(k)<g){--g}if(this.fireEvent("beforeadd",this,k,g)!==false&&this.onBeforeAdd(k)!==false){this.items.insert(g,k);k.ownerCt=this;this.fireEvent("add",this,k,g)}return k},applyDefaults:function(a){if(this.defaults){if(typeof a=="string"){a=Ext.ComponentMgr.get(a);Ext.apply(a,this.defaults)}else{if(!a.events){Ext.applyIf(a,this.defaults)}else{Ext.apply(a,this.defaults)}}}return a},onBeforeAdd:function(a){if(a.ownerCt){a.ownerCt.remove(a,false)}if(this.hideBorders===true){a.border=(a.border===true)}},remove:function(a,b){var d=this.getComponent(a);if(d&&this.fireEvent("beforeremove",this,d)!==false){this.items.remove(d);delete d.ownerCt;if(b===true||(b!==false&&this.autoDestroy)){d.destroy()}if(this.layout&&this.layout.activeItem==d){delete this.layout.activeItem}this.fireEvent("remove",this,d)}return d},removeAll:function(b){var c,a=[];while((c=this.items.last())){a.unshift(this.remove(c,b))}return a},getComponent:function(a){if(typeof a=="object"){return a}return this.items.get(a)},lookupComponent:function(a){if(typeof a=="string"){return Ext.ComponentMgr.get(a)}else{if(!a.events){return this.createComponent(a)}}return a},createComponent:function(a){return Ext.ComponentMgr.create(a,this.defaultType)},doLayout:function(e){if(this.rendered&&this.layout){this.layout.layout()}if(e!==false&&this.items){var d=this.items.items;for(var b=0,a=d.length;b<a;b++){var g=d[b];if(g.doLayout){g.doLayout()}}}},getLayout:function(){if(!this.layout){var a=new Ext.layout.ContainerLayout(this.layoutConfig);this.setLayout(a)}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(c,b,a){var d=this;while(d){if(c.apply(b||d,a||[d])===false){break}d=d.ownerCt}},cascade:function(g,e,b){if(g.apply(e||this,b||[this])!==false){if(this.items){var d=this.items.items;for(var c=0,a=d.length;c<a;c++){if(d[c].cascade){d[c].cascade(g,e,b)}else{g.apply(e||d[c],b||[d[c]])}}}}},findById:function(c){var a,b=this;this.cascade(function(d){if(b!=d&&d.id===c){a=d;return false}});return a||null},findByType:function(b,a){return this.findBy(function(d){return d.isXType(b,a)})},find:function(b,a){return this.findBy(function(d){return d[b]===a})},findBy:function(d,c){var a=[],b=this;this.cascade(function(e){if(b!=e&&d.call(c||e,e,b)===true){a.push(e)}});return a}});Ext.Container.LAYOUTS={};Ext.reg("container",Ext.Container);Ext.layout.ContainerLayout=function(a){Ext.apply(this,a)};Ext.layout.ContainerLayout.prototype={monitorResize:false,activeItem:null,layout:function(){var a=this.container.getLayoutTarget();this.onLayout(this.container,a);this.container.fireEvent("afterlayout",this.container,this)},onLayout:function(a,b){this.renderAll(a,b)},isValidParent:function(d,b){var a=d.getPositionEl?d.getPositionEl():d.getEl();return a.dom.parentNode==b.dom},renderAll:function(e,g){var b=e.items.items;for(var d=0,a=b.length;d<a;d++){var h=b[d];if(h&&(!h.rendered||!this.isValidParent(h,g))){this.renderItem(h,d,g)}}},renderItem:function(e,a,d){if(e&&!e.rendered){e.render(d,a);if(this.extraCls){var b=e.getPositionEl?e.getPositionEl():e;b.addClass(this.extraCls)}if(this.renderHidden&&e!=this.activeItem){e.hide()}}else{if(e&&!this.isValidParent(e,d)){if(this.extraCls){var b=e.getPositionEl?e.getPositionEl():e;b.addClass(this.extraCls)}if(typeof a=="number"){a=d.dom.childNodes[a]}d.dom.insertBefore(e.getEl().dom,a||null);if(this.renderHidden&&e!=this.activeItem){e.hide()}}}},onResize:function(){if(this.container.collapsed){return}var a=this.container.bufferResize;if(a){if(!this.resizeTask){this.resizeTask=new Ext.util.DelayedTask(this.layout,this);this.resizeBuffer=typeof a=="number"?a:100}this.resizeTask.delay(this.resizeBuffer)}else{this.layout()}},setContainer:function(a){if(this.monitorResize&&a!=this.container){if(this.container){this.container.un("resize",this.onResize,this)}if(a){a.on("resize",this.onResize,this)}}this.container=a},parseMargins:function(b){var c=b.split(" ");var a=c.length;if(a==1){c[1]=c[0];c[2]=c[0];c[3]=c[0]}if(a==2){c[2]=c[0];c[3]=c[1]}return{top:parseInt(c[0],10)||0,right:parseInt(c[1],10)||0,bottom:parseInt(c[2],10)||0,left:parseInt(c[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(a,b){Ext.layout.FitLayout.superclass.onLayout.call(this,a,b);if(!this.container.collapsed){this.setItemSize(this.activeItem||a.items.itemAt(0),b.getStyleSize())}},setItemSize:function(b,a){if(b&&a.height>0){b.setSize(a)}}});Ext.Container.LAYOUTS.fit=Ext.layout.FitLayout;Ext.layout.CardLayout=Ext.extend(Ext.layout.FitLayout,{deferredRender:false,renderHidden:true,setActiveItem:function(a){a=this.container.getComponent(a);if(this.activeItem!=a){if(this.activeItem){this.activeItem.hide()}this.activeItem=a;a.show();this.layout()}},renderAll:function(a,b){if(this.deferredRender){this.renderItem(this.activeItem,undefined,b)}else{Ext.layout.CardLayout.superclass.renderAll.call(this,a,b)}}});Ext.Container.LAYOUTS.card=Ext.layout.CardLayout;Ext.layout.AnchorLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,getAnchorViewSize:function(a,b){return b.dom==document.body?b.getViewSize():b.getStyleSize()},onLayout:function(l,o){Ext.layout.AnchorLayout.superclass.onLayout.call(this,l,o);var u=this.getAnchorViewSize(l,o);var s=u.width,k=u.height;if(s<20||k<20){return}var d,q;if(l.anchorSize){if(typeof l.anchorSize=="number"){d=l.anchorSize}else{d=l.anchorSize.width;q=l.anchorSize.height}}else{d=l.initialConfig.width;q=l.initialConfig.height}var n=l.items.items,m=n.length,g,p,r,e,b;for(g=0;g<m;g++){p=n[g];if(p.anchor){r=p.anchorSpec;if(!r){var t=p.anchor.split(" ");p.anchorSpec=r={right:this.parseAnchor(t[0],p.initialConfig.width,d),bottom:this.parseAnchor(t[1],p.initialConfig.height,q)}}e=r.right?this.adjustWidthAnchor(r.right(s),p):undefined;b=r.bottom?this.adjustHeightAnchor(r.bottom(k),p):undefined;if(e||b){p.setSize(e||undefined,b||undefined)}}}},parseAnchor:function(c,h,b){if(c&&c!="none"){var e;if(/^(r|right|b|bottom)$/i.test(c)){var g=b-h;return function(a){if(a!==e){e=a;return a-g}}}else{if(c.indexOf("%")!=-1){var d=parseFloat(c.replace("%",""))*0.01;return function(a){if(a!==e){e=a;return Math.floor(a*d)}}}else{c=parseInt(c,10);if(!isNaN(c)){return function(a){if(a!==e){e=a;return a+c}}}}}}return false},adjustWidthAnchor:function(b,a){return b},adjustHeightAnchor:function(b,a){return b}});Ext.Container.LAYOUTS.anchor=Ext.layout.AnchorLayout;Ext.layout.ColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:"x-column",scrollOffset:0,isValidParent:function(b,a){return(b.getPositionEl?b.getPositionEl():b.getEl()).dom.parentNode==this.innerCt.dom},onLayout:function(d,k){var e=d.items.items,g=e.length,l,a;if(!this.innerCt){k.addClass("x-column-layout-ct");this.innerCt=k.createChild({cls:"x-column-inner"});this.innerCt.createChild({cls:"x-clear"})}this.renderAll(d,this.innerCt);var o=Ext.isIE&&k.dom!=Ext.getBody().dom?k.getStyleSize():k.getViewSize();if(o.width<1&&o.height<1){return}var m=o.width-k.getPadding("lr")-this.scrollOffset,b=o.height-k.getPadding("tb"),n=m;this.innerCt.setWidth(m);for(a=0;a<g;a++){l=e[a];if(!l.columnWidth){n-=(l.getSize().width+l.getEl().getMargins("lr"))}}n=n<0?0:n;for(a=0;a<g;a++){l=e[a];if(l.columnWidth){l.setSize(Math.floor(l.columnWidth*n)-l.getEl().getMargins("lr"))}}}});Ext.Container.LAYOUTS.column=Ext.layout.ColumnLayout;Ext.layout.BorderLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,rendered:false,onLayout:function(d,I){var g;if(!this.rendered){I.position();I.addClass("x-border-layout-ct");var x=d.items.items;g=[];for(var B=0,C=x.length;B<C;B++){var F=x[B];var o=F.region;if(F.collapsed){g.push(F)}F.collapsed=false;if(!F.rendered){F.cls=F.cls?F.cls+" x-border-panel":"x-border-panel";F.render(I,B)}this[o]=o!="center"&&F.split?new Ext.layout.BorderLayout.SplitRegion(this,F.initialConfig,o):new Ext.layout.BorderLayout.Region(this,F.initialConfig,o);this[o].render(I,F)}this.rendered=true}var v=I.getViewSize();if(v.width<20||v.height<20){if(g){this.restoreCollapsed=g}return}else{if(this.restoreCollapsed){g=this.restoreCollapsed;delete this.restoreCollapsed}}var t=v.width,D=v.height;var r=t,A=D,p=0,q=0;var y=this.north,u=this.south,l=this.west,E=this.east,F=this.center;if(!F&&Ext.layout.BorderLayout.WARN!==false){throw"No center region defined in BorderLayout "+d.id}if(y&&y.isVisible()){var H=y.getSize();var z=y.getMargins();H.width=t-(z.left+z.right);H.x=z.left;H.y=z.top;p=H.height+H.y+z.bottom;A-=p;y.applyLayout(H)}if(u&&u.isVisible()){var H=u.getSize();var z=u.getMargins();H.width=t-(z.left+z.right);H.x=z.left;var G=(H.height+z.top+z.bottom);H.y=D-G+z.top;A-=G;u.applyLayout(H)}if(l&&l.isVisible()){var H=l.getSize();var z=l.getMargins();H.height=A-(z.top+z.bottom);H.x=z.left;H.y=p+z.top;var a=(H.width+z.left+z.right);q+=a;r-=a;l.applyLayout(H)}if(E&&E.isVisible()){var H=E.getSize();var z=E.getMargins();H.height=A-(z.top+z.bottom);var a=(H.width+z.left+z.right);H.x=t-a+z.left;H.y=p+z.top;r-=a;E.applyLayout(H)}if(F){var z=F.getMargins();var k={x:q+z.left,y:p+z.top,width:r-(z.left+z.right),height:A-(z.top+z.bottom)};F.applyLayout(k)}if(g){for(var B=0,C=g.length;B<C;B++){g[B].collapse(false)}}if(Ext.isIE&&Ext.isStrict){I.repaint()}},destroy:function(){var b=["north","south","east","west"];for(var a=0;a<b.length;a++){var c=this[b[a]];if(c){if(c.destroy){c.destroy()}else{if(c.split){c.split.destroy(true)}}}}Ext.layout.BorderLayout.superclass.destroy.call(this)}});Ext.layout.BorderLayout.Region=function(b,a,c){Ext.apply(this,a);this.layout=b;this.position=c;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||{},c=="north"||c=="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(b,c){this.panel=c;c.el.enableDisplayMode();this.targetEl=b;this.el=c.el;var a=c.getState,d=this.position;c.getState=function(){return Ext.apply(a.call(c)||{},this.state)}.createDelegate(this);if(d!="center"){c.allowQueuedExpand=false;c.on({beforecollapse:this.beforeCollapse,collapse:this.onCollapse,beforeexpand:this.beforeExpand,expand:this.onExpand,hide:this.onHide,show:this.onShow,scope:this});if(this.collapsible){c.collapseEl="el";c.slideAnchor=this.getSlideAnchor()}if(c.tools&&c.tools.toggle){c.tools.toggle.addClass("x-tool-collapse-"+d);c.tools.toggle.addClassOnOver("x-tool-collapse-"+d+"-over")}}},getCollapsedEl:function(){if(!this.collapsedEl){if(!this.toolTemplate){var b=new Ext.Template('<div class="x-tool x-tool-{id}">&#160;</div>');b.disableFormats=true;b.compile();Ext.layout.BorderLayout.Region.prototype.toolTemplate=b}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 a=this.toolTemplate.append(this.collapsedEl.dom,{id:"expand-"+this.position},true);a.addClassOnOver("x-tool-expand-"+this.position+"-over");a.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(a){if(this.isSlid){this.afterSlideIn();this.panel.expand(false)}else{this.panel.expand()}},onCollapseClick:function(a){this.panel.collapse()},beforeCollapse:function(b,a){this.lastAnim=a;if(this.splitEl){this.splitEl.hide()}this.getCollapsedEl().show();this.panel.el.setStyle("z-index",100);this.isCollapsed=true;this.layout.layout()},onCollapse:function(a){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:0.2})}this.state.collapsed=true;this.panel.saveState()},beforeExpand:function(a){var b=this.getCollapsedEl();this.el.show();if(this.position=="east"||this.position=="west"){this.panel.setSize(undefined,b.getHeight())}else{this.panel.setSize(b.getWidth(),undefined)}b.hide();b.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(a){if(this.isSlid){a.stopPropagation();this.slideIn()}else{a.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(a){this.panel=a},getMinWidth:function(){return this.minWidth},getMinHeight:function(){return this.minHeight},applyLayoutCollapsed:function(a){var b=this.getCollapsedEl();b.setLeftTop(a.x,a.y);b.setSize(a.width,a.height)},applyLayout:function(a){if(this.isCollapsed){this.applyLayoutCollapsed(a)}else{this.panel.setPosition(a.x,a.y);this.panel.setSize(a.width,a.height)}},beforeSlide:function(){this.panel.beforeEffect()},afterSlide:function(){this.panel.afterEffect()},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var a=new Ext.util.DelayedTask(this.slideIn,this);this.autoHideHd={mouseout:function(b){if(!b.within(this.el,true)){a.delay(500)}},mouseover:function(b){a.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 a=this.panel.tools;if(a&&a.toggle){a.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);this.panel.el.replaceClass("x-panel-collapsed","x-panel-floating");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.panel.el.replaceClass("x-panel-floating","x-panel-collapsed");this.el.dom.style.left=this.restoreLT[0];this.el.dom.style.top=this.restoreLT[1];var a=this.panel.tools;if(a&&a.toggle){a.toggle.show()}},slideIn:function(a){if(!this.isSlid||this.el.hasActiveFx()){Ext.callback(a);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(a)},scope:this,block:true})}else{this.el.hide();this.afterSlideIn()}},slideInIf:function(a){if(!a.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 a=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 b=this.collapsedEl,a=this.cmargins;switch(this.position){case"west":return[-(a.right+b.getWidth()+a.left),0];break;case"east":return[a.right+b.getWidth()+a.left,0];break;case"north":return[0,-(a.top+a.bottom+b.getHeight())];break;case"south":return[0,a.top+a.bottom+b.getHeight()];break}}};Ext.layout.BorderLayout.SplitRegion=function(b,a,c){Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this,b,a,c);this.applyLayout=this.applyFns[c]};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(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;this.panel.setPosition(c.x,c.y);var a=d.offsetWidth;b.left=(c.x+c.width-a)+"px";b.top=(c.y)+"px";b.height=Math.max(0,c.height)+"px";this.panel.setSize(c.width-a,c.height)},east:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetWidth;this.panel.setPosition(c.x+a,c.y);b.left=(c.x)+"px";b.top=(c.y)+"px";b.height=Math.max(0,c.height)+"px";this.panel.setSize(c.width-a,c.height)},north:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetHeight;this.panel.setPosition(c.x,c.y);b.left=(c.x)+"px";b.top=(c.y+c.height-a)+"px";b.width=Math.max(0,c.width)+"px";this.panel.setSize(c.width,c.height-a)},south:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetHeight;this.panel.setPosition(c.x,c.y+a);b.left=(c.x)+"px";b.top=(c.y)+"px";b.width=Math.max(0,c.width)+"px";this.panel.setSize(c.width,c.height-a)}},render:function(a,c){Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this,a,c);var d=this.position;this.splitEl=a.createChild({cls:"x-layout-split x-layout-split-"+d,html:"&#160;",id:this.panel.id+"-xsplit"});if(this.collapseMode=="mini"){this.miniSplitEl=this.splitEl.createChild({cls:"x-layout-mini x-layout-mini-"+d,html:"&#160;"});this.miniSplitEl.addClassOnOver("x-layout-mini-over");this.miniSplitEl.on("click",this.onCollapseClick,this,{stopEvent:true})}var b=this.splitSettings[d];this.split=new Ext.SplitBar(this.splitEl.dom,c.el,b.orientation);this.split.placement=b.placement;this.split.getMaximumSize=this[b.maxFn].createDelegate(this);this.split.minSize=this.minSize||this[b.minProp];this.split.on("beforeapply",this.onSplitMove,this);this.split.useShim=this.useShim===true;this.maxSize=this.maxSize||this[b.maxProp];if(c.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 a=this.panel.getSize();if(this.position=="north"||this.position=="south"){a.height+=this.splitEl.dom.offsetHeight}else{a.width+=this.splitEl.dom.offsetWidth}return a},getHMaxSize:function(){var b=this.maxSize||10000;var a=this.layout.center;return Math.min(b,(this.el.getWidth()+a.el.getWidth())-a.getMinWidth())},getVMaxSize:function(){var b=this.maxSize||10000;var a=this.layout.center;return Math.min(b,(this.el.getHeight()+a.el.getHeight())-a.getMinHeight())},onSplitMove:function(b,a){var c=this.panel.getSize();this.lastSplitSize=a;if(this.position=="north"||this.position=="south"){this.panel.setSize(c.width,a);this.state.height=a}else{this.panel.setSize(a,c.height);this.state.width=a}this.layout.layout();this.panel.saveState();return false},getSplitBar:function(){return this.split},destroy:function(){Ext.destroy(this.miniSplitEl,this.split,this.splitEl)}});Ext.Container.LAYOUTS.border=Ext.layout.BorderLayout;Ext.layout.FormLayout=Ext.extend(Ext.layout.AnchorLayout,{labelSeparator:":",getAnchorViewSize:function(a,b){return(a.body||a.el).getStyleSize()},setContainer:function(b){Ext.layout.FormLayout.superclass.setContainer.call(this,b);if(b.labelAlign){b.addClass("x-form-label-"+b.labelAlign)}if(b.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";this.labelAdjust=0}else{this.labelSeparator=b.labelSeparator||this.labelSeparator;b.labelWidth=b.labelWidth||100;if(typeof b.labelWidth=="number"){var c=(typeof b.labelPad=="number"?b.labelPad:5);this.labelAdjust=b.labelWidth+c;this.labelStyle="width:"+b.labelWidth+"px;";this.elementStyle="padding-left:"+(b.labelWidth+c)+"px"}if(b.labelAlign=="top"){this.labelStyle="width:auto;";this.labelAdjust=0;this.elementStyle="padding-left:0;"}}if(!this.fieldTpl){var a=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>");a.disableFormats=true;a.compile();Ext.layout.FormLayout.prototype.fieldTpl=a}},getLabelStyle:function(e){var b="",c=[this.labelStyle,e];for(var d=0,a=c.length;d<a;++d){if(c[d]){b+=c[d];if(b.substr(-1,1)!=";"){b+=";"}}}return b},renderItem:function(e,a,d){if(e&&!e.rendered&&e.isFormField&&e.inputType!="hidden"){var b=[e.id,e.fieldLabel,this.getLabelStyle(e.labelStyle),this.elementStyle||"",typeof e.labelSeparator=="undefined"?this.labelSeparator:e.labelSeparator,(e.itemCls||this.container.itemCls||"")+(e.hideLabel?" x-hide-label":""),e.clearCls||"x-form-clear-left"];if(typeof a=="number"){a=d.dom.childNodes[a]||null}if(a){this.fieldTpl.insertBefore(a,b)}else{this.fieldTpl.append(d,b)}e.render("x-form-el-"+e.id)}else{Ext.layout.FormLayout.superclass.renderItem.apply(this,arguments)}},adjustWidthAnchor:function(b,a){return b-(a.isFormField?(a.hideLabel?0:this.labelAdjust):0)},isValidParent:function(b,a){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(a){if(this.animate===false){a.animCollapse=false}a.collapsible=true;if(this.autoWidth){a.autoWidth=true}if(this.titleCollapse){a.titleCollapse=true}if(this.hideCollapseTool){a.hideCollapseTool=true}if(this.collapseFirst!==undefined){a.collapseFirst=this.collapseFirst}if(!this.activeItem&&!a.collapsed){this.activeItem=a}else{if(this.activeItem){a.collapsed=true}}Ext.layout.Accordion.superclass.renderItem.apply(this,arguments);a.header.addClass("x-accordion-hd");a.on("beforeexpand",this.beforeExpand,this)},beforeExpand:function(c,b){var a=this.activeItem;if(a){if(this.sequence){delete this.activeItem;if(!a.collapsed){a.collapse({callback:function(){c.expand(b||true)},scope:this});return false}}else{a.collapse(this.animate)}}this.activeItem=c;if(this.activeOnTop){c.el.dom.parentNode.insertBefore(c.el.dom,c.el.dom.parentNode.firstChild)}this.layout()},setItemSize:function(g,e){if(this.fill&&g){var b=this.container.items.items;var d=0;for(var c=0,a=b.length;c<a;c++){var h=b[c];if(h!=g){d+=(h.getSize().height-h.bwrap.getHeight())}}e.height-=d;g.setSize(e)}}});Ext.Container.LAYOUTS.accordion=Ext.layout.Accordion;Ext.layout.TableLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:false,setContainer:function(a){Ext.layout.TableLayout.superclass.setContainer.call(this,a);this.currentRow=0;this.currentColumn=0;this.cells=[]},onLayout:function(d,g){var e=d.items.items,a=e.length,h,b;if(!this.table){g.addClass("x-table-layout-ct");this.table=g.createChild({tag:"table",cls:"x-table-layout",cellspacing:0,cn:{tag:"tbody"}},null,true);this.renderAll(d,g)}},getRow:function(a){var b=this.table.tBodies[0].childNodes[a];if(!b){b=document.createElement("tr");this.table.tBodies[0].appendChild(b)}return b},getNextCell:function(k){var a=this.getNextNonSpan(this.currentColumn,this.currentRow);var g=this.currentColumn=a[0],e=this.currentRow=a[1];for(var i=e;i<e+(k.rowspan||1);i++){if(!this.cells[i]){this.cells[i]=[]}for(var d=g;d<g+(k.colspan||1);d++){this.cells[i][d]=true}}var h=document.createElement("td");if(k.cellId){h.id=k.cellId}var b="x-table-layout-cell";if(k.cellCls){b+=" "+k.cellCls}h.className=b;if(k.colspan){h.colSpan=k.colspan}if(k.rowspan){h.rowSpan=k.rowspan}this.getRow(e).appendChild(h);return h},getNextNonSpan:function(a,c){var b=this.columns;while((b&&a>=b)||(this.cells[c]&&this.cells[c][a])){if(b&&a>=b){c++;a=0}else{a++}}return[a,c]},renderItem:function(e,a,d){if(e&&!e.rendered){e.render(this.getNextCell(e));if(this.extraCls){var b=e.getPositionEl?e.getPositionEl():e;b.addClass(this.extraCls)}}},isValidParent:function(b,a){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(a){Ext.layout.AbsoluteLayout.superclass.setContainer.call(this,a);if(a.isXType("form")){this.isForm=true}},onLayout:function(a,b){if(this.isForm){a.body.position()}else{b.position()}Ext.layout.AbsoluteLayout.superclass.onLayout.call(this,a,b)},getAnchorViewSize:function(a,b){return this.isForm?a.body.getStyleSize():Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this,a,b)},isValidParent:function(b,a){return this.isForm?true:Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this,b,a)},adjustWidthAnchor:function(b,a){return b?b-a.getPosition(true)[0]:b},adjustHeightAnchor:function(b,a){return b?b-a.getPosition(true)[1]:b}});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(a,b){this.fireEvent("resize",this,a,b,a,b)}});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:0.25},collapseDefaults:{duration:0.25},initComponent:function(){Ext.Panel.superclass.initComponent.call(this);this.addEvents("bodyresize","titlechange","iconchange","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 c=this.buttons;this.buttons=[];for(var b=0,a=c.length;b<a;b++){if(c[b].render){c[b].ownerCt=this;this.buttons.push(c[b])}else{this.addButton(c[b])}}}if(this.autoLoad){this.on("render",this.doAutoLoad,this,{delay:10})}},createElement:function(a,c){if(this[a]){c.appendChild(this[a].dom);return}if(a==="bwrap"||this.elements.indexOf(a)!=-1){if(this[a+"Cfg"]){this[a]=Ext.fly(c).createChild(this[a+"Cfg"])}else{var b=document.createElement("div");b.className=this[a+"Cls"];this[a]=Ext.get(c.appendChild(b))}if(this[a+"CssClass"]){this[a].addClass(this[a+"CssClass"])}if(this[a+"Style"]){this[a].applyStyles(this[a+"Style"])}}},onRender:function(m,l){Ext.Panel.superclass.onRender.call(this,m,l);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 r=this.bwrap?this.bwrap:this.el;this.tbar=r.down("."+this.tbarCls);this.body=r.down("."+this.bodyCls);this.bbar=r.down("."+this.bbarCls);this.footer=r.down("."+this.footerCls);this.fromMarkup=true}else{this.el=m.createChild({id:this.id,cls:this.baseCls},l)}var a=this.el,p=a.dom;if(this.cls){this.el.addClass(this.cls)}if(this.buttons){this.elements+=",footer"}if(this.frame){a.insertHtml("afterBegin",String.format(Ext.Element.boxMarkup,this.baseCls));this.createElement("header",p.firstChild.firstChild.firstChild);this.createElement("bwrap",p);var t=this.bwrap.dom;var h=p.childNodes[1],c=p.childNodes[2];t.appendChild(h);t.appendChild(c);var u=t.firstChild.firstChild.firstChild;this.createElement("tbar",u);this.createElement("body",u);this.createElement("bbar",u);this.createElement("footer",t.lastChild.firstChild.firstChild);if(!this.footer){this.bwrap.dom.lastChild.className+=" x-panel-nofooter"}}else{this.createElement("header",p);this.createElement("bwrap",p);var t=this.bwrap.dom;this.createElement("tbar",t);this.createElement("body",t);this.createElement("bbar",t);this.createElement("footer",t);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")}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 o=this.tools;this.tools={};this.addTool.apply(this,o)}else{this.tools={}}if(this.buttons&&this.buttons.length>0){var g=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 q=g.getElementsByTagName("tr")[0];for(var k=0,n=this.buttons.length;k<n;k++){var s=this.buttons[k];var e=document.createElement("td");e.className="x-panel-btn-td";s.render(q.appendChild(e))}}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(b){var a=this.iconCls;this.iconCls=b;if(this.rendered&&this.header){if(this.frame){this.header.addClass("x-panel-icon");this.header.replaceClass(a,this.iconCls)}else{var d=this.header.dom;var c=d.firstChild&&String(d.firstChild.tagName).toLowerCase()=="img"?d.firstChild:null;if(c){Ext.fly(c).replaceClass(a,this.iconCls)}else{Ext.DomHelper.insertBefore(d.firstChild,{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-panel-inline-icon "+this.iconCls})}}}this.fireEvent("iconchange",this,b,a)},makeFloating:function(a){this.floating=true;this.el=new Ext.Layer(typeof a=="object"?a:{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(a,d,c){var e={handler:d,scope:c,minWidth:this.minButtonWidth,hideParent:true};if(typeof a=="string"){e.text=a}else{Ext.apply(e,a)}var b=new Ext.Button(e);b.ownerCt=this;if(!this.buttons){this.buttons=[]}this.buttons.push(b);return b},addTool:function(){if(!this[this.toolTarget]){return}if(!this.toolTemplate){var h=new Ext.Template('<div class="x-tool x-tool-{id}">&#160;</div>');h.disableFormats=true;h.compile();Ext.Panel.prototype.toolTemplate=h}for(var g=0,d=arguments,c=d.length;g<c;g++){var b=d[g];if(!this.tools[b.id]){var k="x-tool-"+b.id+"-over";var e=this.toolTemplate.insertFirst((b.align!=="left")?this[this.toolTarget]:this[this.toolTarget].child("span"),b,true);this.tools[b.id]=e;e.enableDisplayMode("block");e.on("click",this.createToolHandler(e,b,k,this));if(b.on){e.on(b.on)}if(b.hidden){e.hide()}if(b.qtip){if(typeof b.qtip=="object"){Ext.QuickTips.register(Ext.apply({target:e.id},b.qtip))}else{e.dom.qtip=b.qtip}}e.addClassOnOver(k)}}},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(c,a,d,b){return function(g){c.removeClass(d);g.stopEvent();if(a.handler){a.handler.call(a.scope||c,g,c,b)}}},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 a=Ext.getDom(this.contentEl);Ext.fly(a).removeClass(["x-hidden","x-hide-display"]);this.body.dom.appendChild(a)}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 a=this.body||this.el;if(a){a.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(c,b,d){var e={scope:d,block:true};if(c===true){e.callback=b;return e}else{if(!c.callback){e.callback=b}else{e.callback=function(){b.call(d);Ext.callback(c.callback,c.scope)}}}return Ext.applyIf(e,c)},collapse:function(b){if(this.collapsed||this.el.hasFxBlock()||this.fireEvent("beforecollapse",this,b)===false){return}var a=b===true||(b!==false&&this.animCollapse);this.beforeEffect();this.onCollapse(a,b);return this},onCollapse:function(a,b){if(a){this[this.collapseEl].slideOut(this.slideAnchor,Ext.apply(this.createEffect(b||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(b){if(!this.collapsed||this.el.hasFxBlock()||this.fireEvent("beforeexpand",this,b)===false){return}var a=b===true||(b!==false&&this.animCollapse);this.el.removeClass(this.collapsedCls);this.beforeEffect();this.onExpand(a,b);return this},onExpand:function(a,b){if(a){this[this.collapseEl].slideIn(this.slideAnchor,Ext.apply(this.createEffect(b||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(a){this[this.collapsed?"expand":"collapse"](a);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(a,b){if(a!==undefined||b!==undefined){if(!this.collapsed){if(typeof a=="number"){this.body.setWidth(this.adjustBodyWidth(a-this.getFrameWidth()))}else{if(a=="auto"){this.body.setWidth(a)}}if(typeof b=="number"){this.body.setHeight(this.adjustBodyHeight(b-this.getFrameHeight()))}else{if(b=="auto"){this.body.setHeight(b)}}if(this.disabled&&this.el._mask){this.el._mask.setSize(this.el.dom.clientWidth,this.el.getHeight())}}else{this.queuedBodySize={width:a,height:b};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,a,b)}this.syncShadow()},adjustBodyHeight:function(a){return a},adjustBodyWidth:function(a){return a},onPosition:function(){this.syncShadow()},getFrameWidth:function(){var b=this.el.getFrameWidth("lr");if(this.frame){var a=this.bwrap.dom.firstChild;b+=(Ext.fly(a).getFrameWidth("l")+Ext.fly(a.firstChild).getFrameWidth("r"));var c=this.bwrap.dom.firstChild.firstChild.firstChild;b+=Ext.fly(c).getFrameWidth("lr")}return b},getFrameHeight:function(){var a=this.el.getFrameWidth("tb");a+=(this.tbar?this.tbar.getHeight():0)+(this.bbar?this.bbar.getHeight():0);if(this.frame){var c=this.el.dom.firstChild;var d=this.bwrap.dom.lastChild;a+=(c.offsetHeight+d.offsetHeight);var b=this.bwrap.dom.firstChild.firstChild.firstChild;a+=Ext.fly(b).getFrameWidth("tb")}else{a+=(this.header?this.header.getHeight():0)+(this.footer?this.footer.getHeight():0)}return a},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(b,a){this.title=b;if(this.header&&this.headerAsText){this.header.child("span").update(b)}if(a){this.setIconClass(a)}this.fireEvent("titlechange",this,b);return this},getUpdater:function(){return this.body.getUpdater()},load:function(){var a=this.body.getUpdater();a.update.apply(a,arguments);return this},beforeDestroy:function(){if(this.header){this.header.removeAllListeners();if(this.headerAsText){Ext.Element.uncache(this.header.child("span"))}}Ext.Element.uncache(this.header,this.tbar,this.bbar,this.footer,this.body,this.bwrap);if(this.tools){for(var c in this.tools){Ext.destroy(this.tools[c])}}if(this.buttons){for(var a in this.buttons){Ext.destroy(this.buttons[a])}}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(a,e,b){var d=document.createElement("div");d.className="x-panel-ghost "+(a?a:"");if(this.header){d.appendChild(this.el.dom.firstChild.cloneNode(true))}Ext.fly(d.appendChild(document.createElement("ul"))).setHeight(this.bwrap.getHeight());d.style.width=this.el.dom.offsetWidth+"px";if(!b){this.container.dom.appendChild(d)}else{Ext.getDom(b).appendChild(d)}if(e!==false&&this.el.useShim!==false){var c=new Ext.Layer({shadow:false,useDisplay:true,constrain:false},d);c.show();return c}else{return new Ext.Element(d)}},doAutoLoad:function(){this.body.load(typeof this.autoLoad=="object"?this.autoLoad:{url:this.autoLoad})},getTool:function(a){return this.tools[a]}});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(b,a){Ext.Window.superclass.onRender.call(this,b,a);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();this.mask.on("click",this.focus,this)}},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 a=this.getKeyMap();a.on(27,this.onEsc,this);a.disable()}},initDraggable:function(){this.dd=new Ext.Window.DD(this)},onEsc:function(){this[this.closeAction]()},beforeDestroy:function(){this.hide();if(this.doAnchor){Ext.EventManager.removeResizeListener(this.doAnchor,this);Ext.EventManager.un(window,"scroll",this.doAnchor,this)}Ext.destroy(this.focusEl,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 a=this.proxy.getBox();this.proxy.hide();this.window.handleResize(a);return a},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(b){var a=this.resizeBox;if(a.x!=b.x||a.y!=b.y){this.updateBox(b)}else{this.setSize(b)}this.focus();this.updateHandles();this.saveState();if(this.layout){this.doLayout()}this.fireEvent("resize",this,b.width,b.height)},focus:function(){var c=this.focusEl,a=this.defaultButton,b=typeof a;if(b!="undefined"){if(b=="number"){c=this.buttons[a]}else{if(b=="string"){c=Ext.getCmp(a)}else{c=a}}}c.focus.defer(10,c)},setAnimateTarget:function(a){a=Ext.get(a);this.animateTarget=a},beforeShow:function(){delete this.el.lastXY;delete this.el.lastLT;if(this.x===undefined||this.y===undefined){var a=this.el.getAlignToXY(this.container,"c-c");var b=this.el.translatePoints(a[0],a[1]);this.x=this.x===undefined?b.left:this.x;this.y=this.y===undefined?b.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(c,a,b){if(!this.rendered){this.render(Ext.getBody())}if(this.hidden===false){this.toFront();return}if(this.fireEvent("beforeshow",this)===false){return}if(a){this.on("show",a,b,{single:true})}this.hidden=false;if(c!==undefined){this.setAnimateTarget(c)}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 a=this.getBox(false);a.callback=this.afterShow;a.scope=this;a.duration=0.25;a.easing="easeNone";a.opacity=0.5;a.block=true;this.el.setStyle("display","none");this.proxy.shift(a)},hide:function(c,a,b){if(this.activeGhost){this.hide.defer(100,this,[c,a,b]);return}if(this.hidden||this.fireEvent("beforehide",this)===false){return}if(a){this.on("hide",a,b,{single:true})}this.hidden=true;if(c!==undefined){this.setAnimateTarget(c)}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(0.5);this.proxy.show();var c=this.getBox(false);this.proxy.setBox(c);this.el.hide();var a=this.animateTarget.getBox();a.callback=this.afterHide;a.scope=this;a.duration=0.25;a.easing="easeNone";a.block=true;a.opacity=0;this.proxy.shift(a)},onWindowResize:function(){if(this.maximized){this.fitContainer()}if(this.modal){this.mask.setSize("100%","100%");var a=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 b;if(this.constrain){b={right:this.el.shadowOffset,left:this.el.shadowOffset,bottom:this.el.shadowOffset}}else{var a=this.getSize();b={right:-(a.width-100),bottom:-(a.height-25)}}var c=this.el.getConstrainToXY(this.container,true,b);if(c){this.setPosition(c[0],c[1])}}},ghost:function(a){var c=this.createGhost(a);var b=this.getBox(true);c.setLeftTop(b.x,b.y);c.setWidth(b.width);this.el.hide();this.activeGhost=c;return c},unghost:function(b,a){if(b!==false){this.el.show();this.focus();if(Ext.isMac&&Ext.isGecko){this.cascade(this.setAutoScroll)}}if(a!==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 a=this.container.getViewSize();this.setSize(a.width,a.height)},setZIndex:function(a){if(this.modal){this.mask.setStyle("z-index",a)}this.el.setZIndex(++a);a+=5;if(this.resizer){this.resizer.proxy.setStyle("z-index",++a)}this.lastZIndex=a},alignTo:function(b,a,c){var d=this.el.getAlignToXY(b,a,c);this.setPagePosition(d[0],d[1]);return this},anchorTo:function(c,e,d,b){if(this.doAnchor){Ext.EventManager.removeResizeListener(this.doAnchor,this);Ext.EventManager.un(window,"scroll",this.doAnchor,this)}this.doAnchor=function(){this.alignTo(c,e,d)};Ext.EventManager.onWindowResize(this.doAnchor,this);var a=typeof b;if(a!="undefined"){Ext.EventManager.on(window,"scroll",this.doAnchor,this,{buffer:a=="number"?b:50})}this.doAnchor();return this},toFront:function(a){if(this.manager.bringToFront(this)){if(!a||!a.getTarget().focus){this.focus()}}return this},setActive:function(a){if(a){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 a=this.el.getAlignToXY(this.container,"c-c");this.setPagePosition(a[0],a[1]);return this}});Ext.reg("window",Ext.Window);Ext.Window.DD=function(a){this.win=a;Ext.Window.DD.superclass.constructor.call(this,a.el.id,"WindowDD-"+a.id);this.setHandleElId(a.header.id);this.scroll=false};Ext.extend(Ext.Window.DD,Ext.dd.DD,{moveOnly:true,headerOffsets:[100,25],startDrag:function(){var a=this.win;this.proxy=a.ghost();if(a.constrain!==false){var c=a.el.shadowOffset;this.constrainTo(a.container,{right:c,left:c,bottom:c})}else{if(a.constrainHeader!==false){var b=this.proxy.getSize();this.constrainTo(a.container,{right:-(b.width-this.headerOffsets[0]),bottom:-(b.height-this.headerOffsets[1])})}}},b4Drag:Ext.emptyFn,onDrag:function(a){this.alignElWithMouse(this.proxy,a.getPageX(),a.getPageY())},endDrag:function(a){this.win.unghost();this.win.saveState()}});Ext.WindowGroup=function(){var g={};var d=[];var e=null;var c=function(k,i){return(!k._lastAccess||k._lastAccess<i._lastAccess)?-1:1};var h=function(){var m=d,k=m.length;if(k>0){m.sort(c);var l=m[0].manager.zseed;for(var n=0;n<k;n++){var o=m[n];if(o&&!o.hidden){o.setZIndex(l+(n*10))}}}a()};var b=function(i){if(i!=e){if(e){e.setActive(false)}e=i;if(i){i.setActive(true)}}};var a=function(){for(var k=d.length-1;k>=0;--k){if(!d[k].hidden){b(d[k]);return}}b(null)};return{zseed:9000,register:function(i){g[i.id]=i;d.push(i);i.on("hide",a)},unregister:function(i){delete g[i.id];i.un("hide",a);d.remove(i)},get:function(i){return typeof i=="object"?i:g[i]},bringToFront:function(i){i=this.get(i);if(i!=e){i._lastAccess=new Date().getTime();h();return true}return false},sendToBack:function(i){i=this.get(i);i._lastAccess=-(new Date().getTime());h();return i},hideAll:function(){for(var i in g){if(g[i]&&typeof g[i]!="function"&&g[i].isVisible()){g[i].hide()}}},getActive:function(){return e},getBy:function(m,l){var n=[];for(var k=d.length-1;k>=0;--k){var o=d[k];if(m.call(l||o,o)!==false){n.push(o)}}return n},each:function(k,i){for(var l in g){if(g[l]&&typeof g[l]!="function"){if(k.call(i||g[l],g[l])===false){return}}}}}};Ext.WindowMgr=new Ext.WindowGroup();Ext.dd.PanelProxy=function(a,b){this.panel=a;this.id=this.panel.id+"-ddproxy";Ext.apply(this,b)};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(b,c,a){this.hide();if(typeof c=="function"){c.call(a||this)}},moveProxy:function(a,b){if(this.proxy){a.insertBefore(this.proxy.dom,b)}}};Ext.Panel.DD=function(b,a){this.panel=b;this.dragData={panel:b};this.proxy=new Ext.dd.PanelProxy(b,a);Ext.Panel.DD.superclass.constructor.call(this,b.el,a);var c=b.header;if(c){this.setHandleElId(c.id)}(c?c: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(a,b){this.proxy.show()},b4MouseDown:function(b){var a=b.getPageX();var c=b.getPageY();this.autoOffset(a,c)},onInitDrag:function(a,b){this.onStartDrag(a,b);return true},createFrame:Ext.emptyFn,getDragEl:function(a){return this.proxy.ghost.dom},endDrag:function(a){this.proxy.hide();this.panel.saveState()},autoOffset:function(a,b){a-=this.startPageX;b-=this.startPageY;this.setDelta(a,b)}});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(b,a){return typeof this.state[b]=="undefined"?a:this.state[b]},clear:function(a){delete this.state[a];this.fireEvent("statechange",this,a,null)},set:function(a,b){this.state[a]=b;this.fireEvent("statechange",this,a,b)},decodeValue:function(a){var m=/^(a|n|d|b|s|o)\:(.*)$/;var c=m.exec(unescape(a));if(!c||!c[1]){return}var g=c[1];var k=c[2];switch(g){case"n":return parseFloat(k);case"d":return new Date(Date.parse(k));case"b":return(k=="1");case"a":var h=[];var l=k.split("^");for(var b=0,d=l.length;b<d;b++){h.push(this.decodeValue(l[b]))}return h;case"o":var h={};var l=k.split("^");for(var b=0,d=l.length;b<d;b++){var e=l[b].split("=");h[e[0]]=this.decodeValue(e[1])}return h;default:return k}},encodeValue:function(c){var b;if(typeof c=="number"){b="n:"+c}else{if(typeof c=="boolean"){b="b:"+(c?"1":"0")}else{if(Ext.isDate(c)){b="d:"+c.toGMTString()}else{if(Ext.isArray(c)){var g="";for(var e=0,a=c.length;e<a;e++){g+=this.encodeValue(c[e]);if(e!=a-1){g+="^"}}b="a:"+g}else{if(typeof c=="object"){var g="";for(var d in c){if(typeof c[d]!="function"&&c[d]!==undefined){g+=d+"="+this.encodeValue(c[d])+"^"}}b="o:"+g.substring(0,g.length-1)}else{b="s:"+c}}}}}return escape(b)}});Ext.state.Manager=function(){var a=new Ext.state.Provider();return{setProvider:function(b){a=b},get:function(c,b){return a.get(c,b)},set:function(b,c){a.set(b,c)},clear:function(b){a.clear(b)},getProvider:function(){return a}}}();Ext.state.CookieProvider=function(a){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,a);this.state=this.readCookies()};Ext.extend(Ext.state.CookieProvider,Ext.state.Provider,{set:function(a,b){if(typeof b=="undefined"||b===null){this.clear(a);return}this.setCookie(a,b);Ext.state.CookieProvider.superclass.set.call(this,a,b)},clear:function(a){this.clearCookie(a);Ext.state.CookieProvider.superclass.clear.call(this,a)},readCookies:function(){var d={};var h=document.cookie+";";var b=/\s?(.*?)=(.*?);/g;var g;while((g=b.exec(h))!=null){var a=g[1];var e=g[2];if(a&&a.substring(0,3)=="ys-"){d[a.substr(3)]=this.decodeValue(e)}}return d},setCookie:function(a,b){document.cookie="ys-"+a+"="+this.encodeValue(b)+((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(a){document.cookie="ys-"+a+"=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 a=this.store.getRange();if(a.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(a,0));this.all.fill(Ext.query(this.itemSelector,this.el.dom));this.updateIndexes(0)},prepareData:function(a){return a},collectData:function(b,e){var d=[];for(var c=0,a=b.length;c<a;c++){d[d.length]=this.prepareData(b[c].data,e+c,b[c])}return d},bufferRender:function(a){var b=document.createElement("div");this.tpl.overwrite(b,this.collectData(a));return Ext.query(this.itemSelector,b)},onUpdate:function(g,a){var b=this.store.indexOf(a);var e=this.isSelected(b);var c=this.all.elements[b];var d=this.bufferRender([a],b)[0];this.all.replaceElement(b,d,true);if(e){this.selected.replaceElement(c,d);this.all.item(b).addClass(this.selectedClass)}this.updateIndexes(b,b)},onAdd:function(g,d,e){if(this.all.getCount()==0){this.refresh();return}var c=this.bufferRender(d,e),h,b=this.all.elements;if(e<this.all.getCount()){h=this.all.item(e).insertSibling(c,"before",true);b.splice.apply(b,[e,0].concat(c))}else{h=this.all.last().insertSibling(c,"after",true);b.push.apply(b,c)}this.updateIndexes(e)},onRemove:function(c,a,b){this.deselect(b);this.all.removeElement(b,true);this.updateIndexes(b)},refreshNode:function(a){this.onUpdate(this.store,this.store.getAt(a))},updateIndexes:function(d,c){var b=this.all.elements;d=d||0;c=c||((c===0)?0:(b.length-1));for(var a=d;a<=c;a++){b[a].viewIndex=a}},getStore:function(){return this.store},setStore:function(a,b){if(!b&&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(a){a=Ext.StoreMgr.lookup(a);a.on("beforeload",this.onBeforeLoad,this);a.on("datachanged",this.refresh,this);a.on("add",this.onAdd,this);a.on("remove",this.onRemove,this);a.on("update",this.onUpdate,this);a.on("clear",this.refresh,this)}this.store=a;if(a){this.refresh()}},findItemFromChild:function(a){return Ext.fly(a).findParent(this.itemSelector,this.el)},onClick:function(c){var b=c.getTarget(this.itemSelector,this.el);if(b){var a=this.indexOf(b);if(this.onItemClick(b,a,c)!==false){this.fireEvent("click",this,a,b,c)}}else{if(this.fireEvent("containerclick",this,c)!==false){this.clearSelections()}}},onContextMenu:function(b){var a=b.getTarget(this.itemSelector,this.el);if(a){this.fireEvent("contextmenu",this,this.indexOf(a),a,b)}},onDblClick:function(b){var a=b.getTarget(this.itemSelector,this.el);if(a){this.fireEvent("dblclick",this,this.indexOf(a),a,b)}},onMouseOver:function(b){var a=b.getTarget(this.itemSelector,this.el);if(a&&a!==this.lastItem){this.lastItem=a;Ext.fly(a).addClass(this.overClass);this.fireEvent("mouseenter",this,this.indexOf(a),a,b)}},onMouseOut:function(a){if(this.lastItem){if(!a.within(this.lastItem,true,true)){Ext.fly(this.lastItem).removeClass(this.overClass);this.fireEvent("mouseleave",this,this.indexOf(this.lastItem),this.lastItem,a);delete this.lastItem}}},onItemClick:function(b,a,c){if(this.fireEvent("beforeclick",this,a,b,c)===false){return false}if(this.multiSelect){this.doMultiSelection(b,a,c);c.preventDefault()}else{if(this.singleSelect){this.doSingleSelection(b,a,c);c.preventDefault()}}return true},doSingleSelection:function(b,a,c){if(c.ctrlKey&&this.isSelected(a)){this.deselect(a)}else{this.select(a,false)}},doMultiSelection:function(c,a,d){if(d.shiftKey&&this.last!==false){var b=this.last;this.selectRange(b,a,d.ctrlKey);this.last=b}else{if((d.ctrlKey||this.simpleSelect)&&this.isSelected(a)){this.deselect(a)}else{this.select(a,d.ctrlKey||d.shiftKey||this.simpleSelect)}}},getSelectionCount:function(){return this.selected.getCount()},getSelectedNodes:function(){return this.selected.elements},getSelectedIndexes:function(){var b=[],d=this.selected.elements;for(var c=0,a=d.length;c<a;c++){b.push(d[c].viewIndex)}return b},getSelectedRecords:function(){var d=[],c=this.selected.elements;for(var b=0,a=c.length;b<a;b++){d[d.length]=this.store.getAt(c[b].viewIndex)}return d},getRecords:function(b){var e=[],d=b;for(var c=0,a=d.length;c<a;c++){e[e.length]=this.store.getAt(d[c].viewIndex)}return e},getRecord:function(a){return this.store.getAt(a.viewIndex)},clearSelections:function(a,b){if((this.multiSelect||this.singleSelect)&&this.selected.getCount()>0){if(!b){this.selected.removeClass(this.selectedClass)}this.selected.clear();this.last=false;if(!a){this.fireEvent("selectionchange",this,this.selected.elements)}}},isSelected:function(a){return this.selected.contains(this.getNode(a))},deselect:function(a){if(this.isSelected(a)){a=this.getNode(a);this.selected.removeElement(a);if(this.last==a.viewIndex){this.last=false}Ext.fly(a).removeClass(this.selectedClass);this.fireEvent("selectionchange",this,this.selected.elements)}},select:function(d,g,b){if(Ext.isArray(d)){if(!g){this.clearSelections(true)}for(var c=0,a=d.length;c<a;c++){this.select(d[c],true,true)}if(!b){this.fireEvent("selectionchange",this,this.selected.elements)}}else{var e=this.getNode(d);if(!g){this.clearSelections(true)}if(e&&!this.isSelected(e)){if(this.fireEvent("beforeselect",this,e,this.selected.elements)!==false){Ext.fly(e).addClass(this.selectedClass);this.selected.add(e);this.last=e.viewIndex;if(!b){this.fireEvent("selectionchange",this,this.selected.elements)}}}}},selectRange:function(c,a,b){if(!b){this.clearSelections(true)}this.select(this.getNodes(c,a),true)},getNode:function(a){if(typeof a=="string"){return document.getElementById(a)}else{if(typeof a=="number"){return this.all.elements[a]}}return a},getNodes:function(e,a){var d=this.all.elements;e=e||0;a=typeof a=="undefined"?Math.max(d.length-1,0):a;var b=[],c;if(e<=a){for(c=e;c<=a&&d[c];c++){b.push(d[c])}}else{for(c=e;c>=a&&d[c];c--){b.push(d[c])}}return b},indexOf:function(a){a=this.getNode(a);if(typeof a.viewIndex=="number"){return a.viewIndex}return this.all.indexOf(a)},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(a){Ext.ColorPalette.superclass.constructor.call(this,a);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(b,a){var c=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 d=document.createElement("div");d.id=this.getId();d.className=this.itemCls;c.overwrite(d,this.colors);b.dom.insertBefore(d,a);this.el=Ext.get(d);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 a=this.value;this.value=null;this.select(a)}},handleClick:function(b,a){b.preventDefault();if(!this.disabled){var d=a.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];this.select(d.toUpperCase())}},select:function(a){a=a.replace("#","");if(a!=this.value||this.allowReselect){var b=this.el;if(this.value){b.child("a.color-"+this.value).removeClass("x-color-palette-sel")}b.child("a.color-"+a).addClass("x-color-palette-sel");this.value=a;this.fireEvent("select",this,a)}}});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 a=this.disabledDates;var c="(?:";for(var b=0;b<a.length;b++){c+=a[b];if(b!=a.length-1){c+="|"}}this.disabledDatesRE=new RegExp(c+")")}},setDisabledDates:function(a){if(Ext.isArray(a)){this.disabledDates=a;this.disabledDatesRE=null}else{this.disabledDatesRE=a}this.initDisabledDays();this.update(this.value,true)},setDisabledDays:function(a){this.disabledDays=a;this.update(this.value,true)},setMinDate:function(a){this.minDate=a;this.update(this.value,true)},setMaxDate:function(a){this.maxDate=a;this.update(this.value,true)},setValue:function(b){var a=this.value;this.value=b.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(a,h){var c=['<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 g=this.dayNames;for(var e=0;e<7;e++){var k=this.startDay+e;if(k>6){k=k-7}c.push("<th><span>",g[k].substr(0,1),"</span></th>")}c[c.length]="</tr></thead><tbody><tr>";for(var e=0;e<42;e++){if(e%7==0&&e!=0){c[c.length]="</tr><tr>"}c[c.length]='<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>'}c.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 b=document.createElement("div");b.className="x-date-picker";b.innerHTML=c.join("");a.dom.insertBefore(b,h);this.el=Ext.get(b);this.eventEl=Ext.get(b.firstChild);this.leftClickRpt=new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});this.rightClickRpt=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 n=new Ext.KeyNav(this.eventEl,{left:function(d){d.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1))},right:function(d){d.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1))},up:function(d){d.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7))},down:function(d){d.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7))},pageUp:function(d){this.showNextMonth()},pageDown:function(d){this.showPrevMonth()},enter:function(d){d.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 l=(new Date()).dateFormat(this.format);this.todayBtn=new Ext.Button({renderTo:this.el.child("td.x-date-bottom",true),text:String.format(this.todayText,l),tooltip:String.format(this.todayTip,l),handler:this.selectToday,scope:this})}if(Ext.isIE){this.el.repaint()}this.update(this.value)},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var a=['<table border="0" cellspacing="0">'];for(var b=0;b<6;b++){a.push('<tr><td class="x-date-mp-month"><a href="#">',this.monthNames[b].substr(0,3),"</a></td>",'<td class="x-date-mp-month x-date-mp-sep"><a href="#">',this.monthNames[b+6].substr(0,3),"</a></td>",b==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>')}a.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(a.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(c,d,e){e+=1;if((e%2)==0){c.dom.xmonth=5+Math.round(e*0.5)}else{c.dom.xmonth=Math.round((e-1)*0.5)}})}},showMonthPicker:function(){this.createMonthPicker();var a=this.el.getSize();this.monthPicker.setSize(a);this.monthPicker.child("table").setSize(a);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:0.2})},updateMPYear:function(e){this.mpyear=e;var c=this.mpYears.elements;for(var b=1;b<=10;b++){var d=c[b-1],a;if((b%2)==0){a=e+Math.round(b*0.5);d.firstChild.innerHTML=a;d.xyear=a}else{a=e-(5-Math.round(b*0.5));d.firstChild.innerHTML=a;d.xyear=a}this.mpYears.item(b-1)[a==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel")}},updateMPMonth:function(a){this.mpMonths.each(function(b,c,d){b[b.dom.xmonth==a?"addClass":"removeClass"]("x-date-mp-sel")})},selectMPMonth:function(a){},onMonthClick:function(g,b){g.stopEvent();var c=new Ext.Element(b),a;if(c.is("button.x-date-mp-cancel")){this.hideMonthPicker()}else{if(c.is("button.x-date-mp-ok")){var h=new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate());if(h.getMonth()!=this.mpSelMonth){h=new Date(this.mpSelYear,this.mpSelMonth,1).getLastDateOfMonth()}this.update(h);this.hideMonthPicker()}else{if(a=c.up("td.x-date-mp-month",2)){this.mpMonths.removeClass("x-date-mp-sel");a.addClass("x-date-mp-sel");this.mpSelMonth=a.dom.xmonth}else{if(a=c.up("td.x-date-mp-year",2)){this.mpYears.removeClass("x-date-mp-sel");a.addClass("x-date-mp-sel");this.mpSelYear=a.dom.xyear}else{if(c.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10)}else{if(c.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10)}}}}}}},onMonthDblClick:function(d,b){d.stopEvent();var c=new Ext.Element(b),a;if(a=c.up("td.x-date-mp-month",2)){this.update(new Date(this.mpSelYear,a.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}else{if(a=c.up("td.x-date-mp-year",2)){this.update(new Date(a.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}}},hideMonthPicker:function(a){if(this.monthPicker){if(a===true){this.monthPicker.hide()}else{this.monthPicker.slideOut("t",{duration:0.2})}}},showPrevMonth:function(a){this.update(this.activeDate.add("mo",-1))},showNextMonth:function(a){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(a){var b=a.getWheelDelta();if(b>0){this.showPrevMonth();a.stopEvent()}else{if(b<0){this.showNextMonth();a.stopEvent()}}},handleDateClick:function(b,a){b.stopEvent();if(a.dateValue&&!Ext.fly(a.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(a.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(H,B){var a=this.activeDate;this.activeDate=H;if(!B&&a&&this.el){var p=H.getTime();if(a.getMonth()==H.getMonth()&&a.getFullYear()==H.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(d){if(d.dom.firstChild.dateValue==p){d.addClass("x-date-selected");setTimeout(function(){try{d.dom.firstChild.focus()}catch(i){}},50);return false}});return}}var l=H.getDaysInMonth();var q=H.getFirstDateOfMonth();var g=q.getDay()-this.startDay;if(g<=this.startDay){g+=7}var C=H.add("mo",-1);var h=C.getDaysInMonth()-g;var e=this.cells.elements;var r=this.textNodes;l+=g;var y=86400000;var E=(new Date(C.getFullYear(),C.getMonth(),h)).clearTime();var D=new Date().clearTime().getTime();var v=H.clearTime().getTime();var u=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var z=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var G=this.disabledDatesRE;var s=this.disabledDatesText;var J=this.disabledDays?this.disabledDays.join(""):false;var F=this.disabledDaysText;var A=this.format;if(this.showToday){var n=new Date().clearTime();var c=(n<u||n>z||(G&&A&&G.test(n.dateFormat(A)))||(J&&J.indexOf(n.getDay())!=-1));this.todayBtn.setDisabled(c);this.todayKeyListener[c?"disable":"enable"]()}var m=function(K,d){d.title="";var i=E.getTime();d.firstChild.dateValue=i;if(i==D){d.className+=" x-date-today";d.title=K.todayText}if(i==v){d.className+=" x-date-selected";setTimeout(function(){try{d.firstChild.focus()}catch(t){}},50)}if(i<u){d.className=" x-date-disabled";d.title=K.minText;return}if(i>z){d.className=" x-date-disabled";d.title=K.maxText;return}if(J){if(J.indexOf(E.getDay())!=-1){d.title=F;d.className=" x-date-disabled"}}if(G&&A){var w=E.dateFormat(A);if(G.test(w)){d.title=s.replace("%0",w);d.className=" x-date-disabled"}}};var x=0;for(;x<g;x++){r[x].innerHTML=(++h);E.setDate(E.getDate()+1);e[x].className="x-date-prevday";m(this,e[x])}for(;x<l;x++){var b=x-g+1;r[x].innerHTML=(b);E.setDate(E.getDate()+1);e[x].className="x-date-active";m(this,e[x])}var I=0;for(;x<42;x++){r[x].innerHTML=(++I);E.setDate(E.getDate()+1);e[x].className="x-date-nextday";m(this,e[x])}this.mbtn.setText(this.monthNames[H.getMonth()]+" "+H.getFullYear());if(!this.internalRender){var k=this.el.dom.firstChild;var o=k.offsetWidth;this.el.setWidth(o+this.el.getBorderWidth("lr"));Ext.fly(k).setWidth(o);this.internalRender=true;if(Ext.isOpera&&!this.secondPass){k.rows[0].cells[1].style.width=(o-(k.rows[0].cells[0].offsetWidth+k.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[H])}}},beforeDestroy:function(){if(this.rendered){Ext.destroy(this.leftClickRpt,this.rightClickRpt,this.monthPicker,this.eventEl,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:0.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 a=this.activeTab;delete this.activeTab;this.setActiveTab(a)}},onRender:function(c,a){Ext.TabPanel.superclass.onRender.call(this,c,a);if(this.plain){var g=this.tabPosition=="top"?"header":"footer";this[g].addClass("x-tab-panel-"+g+"-plain")}var b=this[this.stripTarget];this.stripWrap=b.createChild({cls:"x-tab-strip-wrap",cn:{tag:"ul",cls:"x-tab-strip x-tab-strip-"+this.tabPosition}});var e=(this.tabPosition=="bottom"?this.stripWrap:null);this.stripSpacer=b.createChild({cls:"x-tab-strip-spacer"},e);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 d=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>");d.disableFormats=true;d.compile();Ext.TabPanel.prototype.itemTpl=d}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(c){var b=null;var a=c.getTarget("li",this.strip);if(a){b=this.getComponent(a.id.split(this.idDelimiter)[1]);if(b.disabled){return{close:null,item:null,el:null}}}return{close:c.getTarget(".x-tab-strip-close",this.strip),item:b,el:a}},onStripMouseDown:function(b){if(b.button!=0){return}b.preventDefault();var a=this.findTargets(b);if(a.close){this.remove(a.item);return}if(a.item&&a.item!=this.activeTab){this.setActiveTab(a.item)}},onStripContextMenu:function(b){b.preventDefault();var a=this.findTargets(b);if(a.item){this.fireEvent("contextmenu",this,a.item,b)}},readTabs:function(d){if(d===true){this.items.each(function(h){this.remove(h)},this)}var c=this.el.query(this.autoTabSelector);for(var b=0,a=c.length;b<a;b++){var e=c[b];var g=e.getAttribute("title");e.removeAttribute("title");this.add({title:g,el:e})}},initTab:function(d,b){var e=this.strip.dom.childNodes[b];var a=d.closable?"x-tab-strip-closable":"";if(d.disabled){a+=" x-item-disabled"}if(d.iconCls){a+=" x-tab-with-icon"}if(d.tabCls){a+=" "+d.tabCls}var g={id:this.id+this.idDelimiter+d.getItemId(),text:d.title,cls:a,iconCls:d.iconCls||""};var c=e?this.itemTpl.insertBefore(e,g):this.itemTpl.append(this.strip,g);Ext.fly(c).addClassOnOver("x-tab-strip-over");if(d.tabTip){Ext.fly(c).child("span.x-tab-strip-text",true).qtip=d.tabTip}d.tabEl=c;d.on("disable",this.onItemDisabled,this);d.on("enable",this.onItemEnabled,this);d.on("titlechange",this.onItemTitleChanged,this);d.on("iconchange",this.onItemIconChanged,this);d.on("beforeshow",this.onBeforeShowItem,this)},onAdd:function(c,b,a){this.initTab(b,a);if(this.items.getCount()==1){this.syncSize()}this.delegateUpdates()},onBeforeAdd:function(b){var a=b.events?(this.items.containsKey(b.getItemId())?b:null):this.items.get(b);if(a){this.setActiveTab(b);return false}Ext.TabPanel.superclass.onBeforeAdd.apply(this,arguments);var c=b.elements;b.elements=c?c.replace(",header",""):c;b.border=(b.border===true)},onRemove:function(c,b){Ext.destroy(Ext.get(this.getTabEl(b)));this.stack.remove(b);b.un("disable",this.onItemDisabled,this);b.un("enable",this.onItemEnabled,this);b.un("titlechange",this.onItemTitleChanged,this);b.un("iconchange",this.onItemIconChanged,this);b.un("beforeshow",this.onBeforeShowItem,this);if(b==this.activeTab){var a=this.stack.next();if(a){this.setActiveTab(a)}else{if(this.items.getCount()>0){this.setActiveTab(0)}else{this.activeTab=null}}}this.delegateUpdates()},onBeforeShowItem:function(a){if(a!=this.activeTab){this.setActiveTab(a);return false}},onItemDisabled:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).addClass("x-item-disabled")}this.stack.remove(b)},onItemEnabled:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).removeClass("x-item-disabled")}},onItemTitleChanged:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).child("span.x-tab-strip-text",true).innerHTML=b.title}},onItemIconChanged:function(d,a,c){var b=this.getTabEl(d);if(b){Ext.fly(b).child("span.x-tab-strip-text").replaceClass(c,a)}},getTabEl:function(a){var b=(typeof a==="number")?this.items.items[a].getItemId():a.getItemId();return document.getElementById(this.id+this.idDelimiter+b)},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(b){b=this.getComponent(b);var a=this.getTabEl(b);if(a){a.style.display="none";this.delegateUpdates()}this.stack.remove(b)},unhideTabStripItem:function(b){b=this.getComponent(b);var a=this.getTabEl(b);if(a){a.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 h=this.items.length;var b=this.tabPosition!="bottom"?"header":"footer";var c=this[b].dom.offsetWidth;var a=this[b].dom.clientWidth;if(!this.resizeTabs||h<1||!a){return}var l=Math.max(Math.min(Math.floor((a-4)/h)-this.tabMargin,this.tabWidth),this.minTabWidth);this.lastTabWidth=l;var n=this.stripWrap.dom.getElementsByTagName("li");for(var e=0,k=n.length-1;e<k;e++){var m=n[e];var o=m.childNodes[1].firstChild.firstChild;var g=m.offsetWidth;var d=o.offsetWidth;o.style.width=(l-(g-d))+"px"}},adjustBodyWidth:function(a){if(this.header){this.header.setWidth(a)}if(this.footer){this.footer.setWidth(a)}return a},setActiveTab:function(c){c=this.getComponent(c);if(!c||this.fireEvent("beforetabchange",this,c,this.activeTab)===false){return}if(!this.rendered){this.activeTab=c;return}if(this.activeTab!=c){if(this.activeTab){var a=this.getTabEl(this.activeTab);if(a){Ext.fly(a).removeClass("x-tab-strip-active")}this.activeTab.fireEvent("deactivate",this.activeTab)}var b=this.getTabEl(c);Ext.fly(b).addClass("x-tab-strip-active");this.activeTab=c;this.stack.add(c);this.layout.setActiveItem(c);if(this.layoutOnTabChange&&c.doLayout){c.doLayout()}if(this.scrolling){this.scrollToTab(c,this.animScroll)}c.fireEvent("activate",c);this.fireEvent("tabchange",this,c)}},getActiveTab:function(){return this.activeTab||null},getItem:function(a){return this.getComponent(a)},autoScrollTabs:function(){this.pos=this.tabPosition=="bottom"?this.footer:this.header;var h=this.items.length;var d=this.pos.dom.offsetWidth;var c=this.pos.dom.clientWidth;var g=this.stripWrap;var e=g.dom;var b=e.offsetWidth;var i=this.getScrollPos();var a=this.edge.getOffsetsTo(this.stripWrap)[0]+i;if(!this.enableTabScroll||h<1||b<20){return}if(a<=c){e.scrollLeft=0;g.setWidth(c);if(this.scrolling){this.scrolling=false;this.pos.removeClass("x-tab-scrolling");this.scrollLeft.hide();this.scrollRight.hide();if(Ext.isAir||Ext.isSafari){e.style.marginLeft="";e.style.marginRight=""}}}else{if(!this.scrolling){this.pos.addClass("x-tab-scrolling");if(Ext.isAir||Ext.isSafari){e.style.marginLeft="18px";e.style.marginRight="18px"}}c-=g.getMargins("lr");g.setWidth(c>20?c:20);if(!this.scrolling){if(!this.scrollLeft){this.createScrollers()}else{this.scrollLeft.show();this.scrollRight.show()}}this.scrolling=true;if(i>(a-c)){e.scrollLeft=a-c}else{this.scrollToTab(this.activeTab,false)}this.updateScrollButtons()}},createScrollers:function(){this.pos.addClass("x-tab-scrolling-"+this.tabPosition);var c=this.stripWrap.dom.offsetHeight;var a=this.pos.insertFirst({cls:"x-tab-scroller-left"});a.setHeight(c);a.addClassOnOver("x-tab-scroller-left-over");this.leftRepeater=new Ext.util.ClickRepeater(a,{interval:this.scrollRepeatInterval,handler:this.onScrollLeft,scope:this});this.scrollLeft=a;var b=this.pos.insertFirst({cls:"x-tab-scroller-right"});b.setHeight(c);b.addClassOnOver("x-tab-scroller-right-over");this.rightRepeater=new Ext.util.ClickRepeater(b,{interval:this.scrollRepeatInterval,handler:this.onScrollRight,scope:this});this.scrollRight=b},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(e,a){if(!e){return}var c=this.getTabEl(e);var h=this.getScrollPos(),d=this.getScrollArea();var g=Ext.fly(c).getOffsetsTo(this.stripWrap)[0]+h;var b=g+c.offsetWidth;if(g<h){this.scrollTo(g,a)}else{if(b>(h+d)){this.scrollTo(b-d,a)}}},scrollTo:function(b,a){this.stripWrap.scrollTo("left",b,a?this.getScrollAnim():false);if(!a){this.updateScrollButtons()}},onWheel:function(g){var h=g.getWheelDelta()*this.wheelIncrement*-1;g.stopEvent();var i=this.getScrollPos();var c=i+h;var a=this.getScrollWidth()-this.getScrollArea();var b=Math.max(0,Math.min(a,c));if(b!=i){this.scrollTo(b,false)}},onScrollRight:function(){var a=this.getScrollWidth()-this.getScrollArea();var c=this.getScrollPos();var b=Math.min(a,c+this.getScrollIncrement());if(b!=c){this.scrollTo(b,this.animScroll)}},onScrollLeft:function(){var b=this.getScrollPos();var a=Math.max(0,b-this.getScrollIncrement());if(a!=b){this.scrollTo(a,this.animScroll)}},updateScrollButtons:function(){var a=this.getScrollPos();this.scrollLeft[a==0?"addClass":"removeClass"]("x-tab-scroller-left-disabled");this.scrollRight[a>=(this.getScrollWidth()-this.getScrollArea())?"addClass":"removeClass"]("x-tab-scroller-right-disabled")},beforeDestroy:function(){if(this.items){this.items.each(function(a){if(a&&a.tabEl){Ext.get(a.tabEl).removeAllListeners();a.tabEl=null}},this)}if(this.strip){this.strip.removeAllListeners()}Ext.TabPanel.superclass.beforeDestroy.apply(this)}});Ext.reg("tabpanel",Ext.TabPanel);Ext.TabPanel.prototype.activate=Ext.TabPanel.prototype.setActiveTab;Ext.TabPanel.AccessStack=function(){var a=[];return{add:function(b){a.push(b);if(a.length>10){a.shift()}},remove:function(e){var d=[];for(var c=0,b=a.length;c<b;c++){if(a[c]!=e){d.push(a[c])}}a=d},next:function(){return a.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-child",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(c,a){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 b,e=[this.text||"&#160;",this.type];if(a){b=this.template.insertBefore(a,e,true)}else{b=this.template.append(c,e,true)}var d=b.child(this.buttonSelector);d.on("focus",this.onFocus,this);d.on("blur",this.onBlur,this);this.initButtonEl(b,d);if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu")}Ext.ButtonToggleMgr.register(this)},initButtonEl:function(b,c){this.el=b;b.addClass("x-btn");if(this.id){this.el.dom.id=this.el.id=this.id}if(this.icon){c.setStyle("background-image","url("+this.icon+")")}if(this.iconCls){c.addClass(this.iconCls);if(!this.cls){b.addClass(this.text?"x-btn-text-icon":"x-btn-icon")}}if(this.tabIndex!==undefined){c.dom.tabIndex=this.tabIndex}if(this.tooltip){if(typeof this.tooltip=="object"){Ext.QuickTips.register(Ext.apply({target:c.id},this.tooltip))}else{c.dom[this.tooltipType]=this.tooltip}}if(this.pressed){this.el.addClass("x-btn-pressed")}if(this.handleMouseEvents){b.on("mouseover",this.onMouseOver,this);b.on("mousedown",this.onMouseDown,this)}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this)}if(this.repeat){var a=new Ext.util.ClickRepeater(b,typeof this.repeat=="object"?this.repeat:{});a.on("click",this.onClick,this)}b.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(a){if(this.el){this.el.child(this.buttonSelector).replaceClass(this.iconCls,a)}this.iconCls=a},beforeDestroy:function(){if(this.rendered){var a=this.el.child(this.buttonSelector);if(a){if(this.tooltip){Ext.QuickTips.unregister(a)}a.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 a=this.el.child(this.buttonSelector);if(a&&a.getWidth()>20){a.clip();a.setWidth(Ext.util.TextMetrics.measure(a,this.text).width+a.getFrameWidth("lr"))}}if(this.minWidth){if(this.el.getWidth()<this.minWidth){this.el.setWidth(this.minWidth)}}}},setHandler:function(b,a){this.handler=b;this.scope=a},setText:function(a){this.text=a;if(this.el){this.el.child("td.x-btn-center "+this.buttonSelector).update(a)}this.autoWidth()},getText:function(){return this.text},toggle:function(a){a=a===undefined?!this.pressed:a;if(a!=this.pressed){if(a){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,a)}}},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(a){if(a){a.preventDefault()}if(a.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,a);if(this.handler){this.handler.call(this.scope||this,this,a)}}},isMenuTriggerOver:function(b,a){return this.menu&&!a},isMenuTriggerOut:function(b,a){return this.menu&&!a},onMouseOver:function(b){if(!this.disabled){var a=b.within(this.el,true);if(!a){this.el.addClass("x-btn-over");if(!this.monitoringMouseOver){Ext.getDoc().on("mouseover",this.monitorMouseOver,this);this.monitoringMouseOver=true}this.fireEvent("mouseover",this,b)}if(this.isMenuTriggerOver(b,a)){this.fireEvent("menutriggerover",this,this.menu,b)}}},monitorMouseOver:function(a){if(a.target!=this.el.dom&&!a.within(this.el)){if(this.monitoringMouseOver){Ext.getDoc().un("mouseover",this.monitorMouseOver,this);this.monitoringMouseOver=false}this.onMouseOut(a)}},onMouseOut:function(b){var a=b.within(this.el)&&b.target!=this.el.dom;this.el.removeClass("x-btn-over");this.fireEvent("mouseout",this,b);if(this.isMenuTriggerOut(b,a)){this.fireEvent("menutriggerout",this,this.menu,b)}},onFocus:function(a){if(!this.disabled){this.el.addClass("x-btn-focus")}},onBlur:function(a){this.el.removeClass("x-btn-focus")},getClickEl:function(b,a){return this.el},onMouseDown:function(a){if(!this.disabled&&a.button==0){this.getClickEl(a).addClass("x-btn-click");Ext.getDoc().on("mouseup",this.onMouseUp,this)}},onMouseUp:function(a){if(a.button==0){this.getClickEl(a,true).removeClass("x-btn-click");Ext.getDoc().un("mouseup",this.onMouseUp,this)}},onMenuShow:function(a){this.ignoreNextClick=0;this.el.addClass("x-btn-menu-active");this.fireEvent("menushow",this,this.menu)},onMenuHide:function(a){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 a={};function b(e,k){if(k){var h=a[e.toggleGroup];for(var d=0,c=h.length;d<c;d++){if(h[d]!=e){h[d].toggle(false)}}}}return{register:function(c){if(!c.toggleGroup){return}var d=a[c.toggleGroup];if(!d){d=a[c.toggleGroup]=[]}d.push(c);c.on("toggle",b)},unregister:function(c){if(!c.toggleGroup){return}var d=a[c.toggleGroup];if(d){d.remove(c);c.un("toggle",b)}}}}();Ext.SplitButton=Ext.extend(Ext.Button,{arrowSelector:"button:last",initComponent:function(){Ext.SplitButton.superclass.initComponent.call(this);this.addEvents("arrowclick")},onRender:function(d,a){var b=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 c,g=[this.text||"&#160;",this.type];if(a){c=b.insertBefore(a,g,true)}else{c=b.append(d,g,true)}var e=c.child(this.buttonSelector);this.initButtonEl(c,e);this.arrowBtnTable=c.child("table:last");if(this.arrowTooltip){c.child(this.arrowSelector).dom[this.tooltipType]=this.arrowTooltip}},autoWidth:function(){if(this.el){var c=this.el.child("table:first");var b=this.el.child("table:last");this.el.setWidth("auto");c.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var a=this.el.child(this.buttonSelector);if(a&&a.getWidth()>20){a.clip();a.setWidth(Ext.util.TextMetrics.measure(a,this.text).width+a.getFrameWidth("lr"))}}if(this.minWidth){if((c.getWidth()+b.getWidth())<this.minWidth){c.setWidth(this.minWidth-b.getWidth())}}this.el.setWidth(c.getWidth()+b.getWidth())}},setArrowHandler:function(b,a){this.arrowHandler=b;this.scope=a},onClick:function(a){a.preventDefault();if(!this.disabled){if(a.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){this.showMenu()}this.fireEvent("arrowclick",this,a);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,a)}}else{if(this.enableToggle){this.toggle()}this.fireEvent("click",this,a);if(this.handler){this.handler.call(this.scope||this,this,a)}}}},getClickEl:function(b,a){if(!a){return(this.lastClickEl=b.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(a){return this.menu&&a.within(this.arrowBtnTable)&&!a.within(this.arrowBtnTable,true)},isMenuTriggerOut:function(b,a){return this.menu&&!b.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(a){if(a&&this.showText===true){var b="";if(this.prependText){b+=this.prependText}b+=a.text;return b}return undefined},setActiveItem:function(c,a){if(typeof c!="object"){c=this.menu.items.get(c)}if(c){if(!this.rendered){this.text=this.getItemText(c);this.iconCls=c.iconCls}else{var b=this.getItemText(c);if(b){this.setText(b)}this.setIconClass(c.iconCls)}this.activeItem=c;if(!c.checked){c.setChecked(true,true)}if(this.forceIcon){this.setIconClass(this.forceIcon)}if(!a){this.fireEvent("change",this,c)}}},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 d;for(var b=0,a=this.itemCount;b<a;b++){var c=this.items[b];c.group=c.group||this.id;c.itemIndex=b;c.checkHandler=this.checkHandler;c.scope=this;c.checked=c.checked||false;this.menu.items.push(c);if(c.checked){d=c}}this.setActiveItem(d,true);Ext.CycleButton.superclass.initComponent.call(this);this.on("click",this.toggleSelected,this)},checkHandler:function(a,b){if(b){this.setActiveItem(a)}},toggleSelected:function(){this.menu.render();var c,a;for(var b=1;b<this.itemCount;b++){c=(this.activeItem.itemIndex+b)%this.itemCount;a=this.menu.items.itemAt(c);if(!a.disabled){a.setChecked(true);break}}}});Ext.reg("cycle",Ext.CycleButton);Ext.Toolbar=function(a){if(Ext.isArray(a)){a={buttons:a}}Ext.Toolbar.superclass.constructor.call(this,a)};(function(){var a=Ext.Toolbar;Ext.extend(a,Ext.BoxComponent,{trackMenus:true,initComponent:function(){a.superclass.initComponent.call(this);if(this.items){this.buttons=this.items}this.items=new Ext.util.MixedCollection(false,function(b){return b.itemId||b.id||Ext.id()})},autoCreate:{cls:"x-toolbar x-small-editor",html:'<table cellspacing="0"><tr></tr></table>'},onRender:function(c,b){this.el=c.createChild(Ext.apply({id:this.id},this.autoCreate),b);this.tr=this.el.child("tr",true)},afterRender:function(){a.superclass.afterRender.call(this);if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons}},add:function(){var c=arguments,b=c.length;for(var d=0;d<b;d++){var e=c[d];if(e.isFormField){this.addField(e)}else{if(e.render){this.addItem(e)}else{if(typeof e=="string"){if(e=="separator"||e=="-"){this.addSeparator()}else{if(e==" "){this.addSpacer()}else{if(e=="->"){this.addFill()}else{this.addText(e)}}}}else{if(e.tagName){this.addElement(e)}else{if(typeof e=="object"){if(e.xtype){this.addField(Ext.ComponentMgr.create(e,"button"))}else{this.addButton(e)}}}}}}}},addSeparator:function(){return this.addItem(new a.Separator())},addSpacer:function(){return this.addItem(new a.Spacer())},addFill:function(){return this.addItem(new a.Fill())},addElement:function(b){return this.addItem(new a.Item(b))},addItem:function(b){var c=this.nextBlock();this.initMenuTracking(b);b.render(c);this.items.add(b);return b},addButton:function(e){if(Ext.isArray(e)){var h=[];for(var g=0,d=e.length;g<d;g++){h.push(this.addButton(e[g]))}return h}var c=e;if(!(e instanceof a.Button)){c=e.split?new a.SplitButton(e):new a.Button(e)}var k=this.nextBlock();this.initMenuTracking(c);c.render(k);this.items.add(c);return c},initMenuTracking:function(b){if(this.trackMenus&&b.menu){b.on({menutriggerover:this.onButtonTriggerOver,menushow:this.onButtonMenuShow,menuhide:this.onButtonMenuHide,scope:this})}},addText:function(b){return this.addItem(new a.TextItem(b))},insertButton:function(c,g){if(Ext.isArray(g)){var e=[];for(var d=0,b=g.length;d<b;d++){e.push(this.insertButton(c+d,g[d]))}return e}if(!(g instanceof a.Button)){g=new a.Button(g)}var h=document.createElement("td");this.tr.insertBefore(h,this.tr.childNodes[c]);this.initMenuTracking(g);g.render(h);this.items.insert(c,g);return g},addDom:function(c,b){var e=this.nextBlock();Ext.DomHelper.overwrite(e,c);var d=new a.Item(e.firstChild);d.render(e);this.items.add(d);return d},addField:function(c){var d=this.nextBlock();c.render(d);var b=new a.Item(d.firstChild);b.render(d);this.items.add(c);return b},nextBlock:function(){var b=document.createElement("td");this.tr.appendChild(b);return b},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(b){if(b.disable){b.disable()}})},onEnable:function(){this.items.each(function(b){if(b.enable){b.enable()}})},onButtonTriggerOver:function(b){if(this.activeMenuBtn&&this.activeMenuBtn!=b){this.activeMenuBtn.hideMenu();b.showMenu();this.activeMenuBtn=b}},onButtonMenuShow:function(b){this.activeMenuBtn=b},onButtonMenuHide:function(b){delete this.activeMenuBtn}});Ext.reg("toolbar",Ext.Toolbar);a.Item=function(b){this.el=Ext.getDom(b);this.id=Ext.id(this.el);this.hidden=false};a.Item.prototype={getEl:function(){return this.el},render:function(b){this.td=b;b.appendChild(this.el)},destroy:function(){if(this.el){var b=Ext.get(this.el);Ext.destroy(b)}Ext.removeNode(this.td)},show:function(){this.hidden=false;this.td.style.display=""},hide:function(){this.hidden=true;this.td.style.display="none"},setVisible:function(b){if(b){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",a.Item);a.Separator=function(){var b=document.createElement("span");b.className="ytb-sep";a.Separator.superclass.constructor.call(this,b)};Ext.extend(a.Separator,a.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg("tbseparator",a.Separator);a.Spacer=function(){var b=document.createElement("div");b.className="ytb-spacer";a.Spacer.superclass.constructor.call(this,b)};Ext.extend(a.Spacer,a.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg("tbspacer",a.Spacer);a.Fill=Ext.extend(a.Spacer,{render:function(b){b.style.width="100%";a.Fill.superclass.render.call(this,b)}});Ext.reg("tbfill",a.Fill);a.TextItem=function(b){var c=document.createElement("span");c.className="ytb-text";c.innerHTML=b.text?b.text:b;a.TextItem.superclass.constructor.call(this,c)};Ext.extend(a.TextItem,a.Item,{enable:Ext.emptyFn,disable:Ext.emptyFn,focus:Ext.emptyFn});Ext.reg("tbtext",a.TextItem);a.Button=Ext.extend(Ext.Button,{hideParent:true,onDestroy:function(){a.Button.superclass.onDestroy.call(this);if(this.container){this.container.remove()}}});Ext.reg("tbbutton",a.Button);a.SplitButton=Ext.extend(Ext.SplitButton,{hideParent:true,onDestroy:function(){a.SplitButton.superclass.onDestroy.call(this);if(this.container){this.container.remove()}}});Ext.reg("tbsplit",a.SplitButton);a.MenuButton=a.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(b,a){Ext.PagingToolbar.superclass.onRender.call(this,b,a);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.on("blur",this.onPagingBlur,this);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 a=this.store.getCount();var b=a==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+a,this.store.getTotalCount());this.displayEl.update(b)}},onLoad:function(a,c,h){if(!this.rendered){this.dsLoaded=[a,c,h];return}this.cursor=h.params?h.params[this.paramNames.start]:0;var g=this.getPageData(),b=g.activePage,e=g.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,g.pages);this.field.dom.value=b;this.first.setDisabled(b==1);this.prev.setDisabled(b==1);this.next.setDisabled(b==e);this.last.setDisabled(b==e);this.loading.enable();this.updateInfo();this.fireEvent("change",this,g)},getPageData:function(){var a=this.store.getTotalCount();return{total:a,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:a<this.pageSize?1:Math.ceil(a/this.pageSize)}},onLoadError:function(){if(!this.rendered){return}this.loading.enable()},readPage:function(c){var a=this.field.dom.value,b;if(!a||isNaN(b=parseInt(a,10))){this.field.dom.value=c.activePage;return false}return b},onPagingBlur:function(a){this.field.dom.value=this.getPageData().activePage},onPagingKeydown:function(g){var b=g.getKey(),h=this.getPageData(),c;if(b==g.RETURN){g.stopEvent();c=this.readPage(h);if(c!==false){c=Math.min(Math.max(1,c),h.pages)-1;this.doLoad(c*this.pageSize)}}else{if(b==g.HOME||b==g.END){g.stopEvent();c=b==g.HOME?1:h.pages;this.field.dom.value=c}else{if(b==g.UP||b==g.PAGEUP||b==g.DOWN||b==g.PAGEDOWN){g.stopEvent();if(c=this.readPage(h)){var a=g.shiftKey?10:1;if(b==g.DOWN||b==g.PAGEDOWN){a*=-1}c+=a;if(c>=1&c<=h.pages){this.field.dom.value=c}}}}}},beforeLoad:function(){if(this.rendered&&this.loading){this.loading.disable()}},doLoad:function(c){var b={},a=this.paramNames;b[a.start]=c;b[a.limit]=this.pageSize;if(this.fireEvent("beforechange",this,b)!==false){this.store.load({params:b})}},changePage:function(a){this.doLoad(((a-1)*this.pageSize).constrain(0,this.store.getTotalCount()))},onClick:function(e){var b=this.store;switch(e){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 d=b.getTotalCount();var a=d%this.pageSize;var c=a?(d-a):d-this.pageSize;this.doLoad(c);break;case"refresh":this.doLoad(this.cursor);break}},unbind:function(a){a=Ext.StoreMgr.lookup(a);a.un("beforeload",this.beforeLoad,this);a.un("load",this.onLoad,this);a.un("loadexception",this.onLoadError,this);this.store=undefined},bind:function(a){a=Ext.StoreMgr.lookup(a);a.on("beforeload",this.beforeLoad,this);a.on("load",this.onLoad,this);a.on("loadexception",this.onLoadError,this);this.store=a},onDestroy:function(){if(this.store){this.unbind(this.store)}Ext.PagingToolbar.superclass.onDestroy.call(this)}});Ext.reg("paging",Ext.PagingToolbar);Ext.Resizable=function(d,e){this.el=Ext.get(d);if(e&&e.wrap){e.resizeChild=this.el;this.el=this.el.wrap(typeof e.wrap=="object"?e.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=e.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(e.resizeChild.getPositioning());e.resizeChild.clearPositioning();if(!e.width||!e.height){var g=e.resizeChild.getSize();this.el.setSize(g.width,g.height)}if(e.pinned&&!e.adjustments){e.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,e);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned")}var l=this.el.getStyle("position");if(l!="absolute"&&l!="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 p=this.handles.split(/\s*?[,;]\s*?| /);var c=Ext.Resizable.positions;for(var k=0,m=p.length;k<m;k++){if(p[k]&&c[p[k]]){var o=c[p[k]];this[o]=new Ext.Resizable.Handle(this,o,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 b=this.resizeChild;var n=this.west,h=this.east,a=this.north,p=this.south;if(b&&(n||a)){b.position("relative");b.setLeft(n?n.el.getWidth():0);b.setTop(a?a.el.getHeight():0)}this.adjustments=[(h?-h.el.getWidth():0)+(n?-n.el.getWidth():0),(a?-a.el.getHeight():0)+(p?-p.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:0.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(b,a){this.el.setSize(b,a);this.updateChildSize();this.fireEvent("resize",this,b,a,null)},startSizing:function(c,b){this.fireEvent("beforeresize",this,c);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",b.el.getStyle("cursor"));this.resizing=true;this.startBox=this.el.getBox();this.startPoint=c.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 a=Ext.get(this.constrainTo);this.resizeRegion=a.getRegion().adjust(a.getFrameWidth("t"),a.getFrameWidth("l"),-a.getFrameWidth("b"),-a.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(a,b){if(this.enabled){b.stopEvent();this.activeHandle=a;this.startSizing(b,a)}},onMouseUp:function(b){var a=this.resizeElement();this.resizing=false;this.handleOut();this.overlay.hide();this.proxy.hide();this.fireEvent("resize",this,a.width,a.height,b)},updateChildSize:function(){if(this.resizeChild){var d=this.el;var e=this.resizeChild;var c=this.adjustments;if(d.dom.offsetWidth){var a=d.getSize(true);e.setSize(a.width+c[0],a.height+c[1])}if(Ext.isIE){setTimeout(function(){if(d.dom.offsetWidth){var g=d.getSize(true);e.setSize(g.width+c[0],g.height+c[1])}},10)}}},snap:function(c,e,b){if(!e||!c){return c}var d=c;var a=c%e;if(a>0){if(a>(e/2)){d=c+(e-a)}else{d=c-a}}return Math.max(b,d)},resizeElement:function(){var a=this.proxy.getBox();if(this.updateBox){this.el.setBox(a,false,this.animate,this.duration,null,this.easing)}else{this.el.setSize(a.width,a.height,this.animate,this.duration,null,this.easing)}this.updateChildSize();if(!this.dynamic){this.proxy.hide()}return a},constrain:function(b,c,a,d){if(b-c<a){c=b-a}else{if(b-c>d){c=d-b}}return c},onMouseMove:function(z){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(z.getPoint())){return}var u=this.curSize||this.startBox;var m=this.startBox.x,l=this.startBox.y;var c=m,b=l;var n=u.width,v=u.height;var d=n,p=v;var o=this.minWidth,A=this.minHeight;var t=this.maxWidth,D=this.maxHeight;var i=this.widthIncrement;var a=this.heightIncrement;var B=z.getXY();var s=-(this.startPoint[0]-Math.max(this.minX,B[0]));var q=-(this.startPoint[1]-Math.max(this.minY,B[1]));var k=this.activeHandle.position;switch(k){case"east":n+=s;n=Math.min(Math.max(o,n),t);break;case"south":v+=q;v=Math.min(Math.max(A,v),D);break;case"southeast":n+=s;v+=q;n=Math.min(Math.max(o,n),t);v=Math.min(Math.max(A,v),D);break;case"north":q=this.constrain(v,q,A,D);l+=q;v-=q;break;case"west":s=this.constrain(n,s,o,t);m+=s;n-=s;break;case"northeast":n+=s;n=Math.min(Math.max(o,n),t);q=this.constrain(v,q,A,D);l+=q;v-=q;break;case"northwest":s=this.constrain(n,s,o,t);q=this.constrain(v,q,A,D);l+=q;v-=q;m+=s;n-=s;break;case"southwest":s=this.constrain(n,s,o,t);v+=q;v=Math.min(Math.max(A,v),D);m+=s;n-=s;break}var r=this.snap(n,i,o);var C=this.snap(v,a,A);if(r!=n||C!=v){switch(k){case"northeast":l-=C-v;break;case"north":l-=C-v;break;case"southwest":m-=r-n;break;case"west":m-=r-n;break;case"northwest":m-=r-n;l-=C-v;break}n=r;v=C}if(this.preserveRatio){switch(k){case"southeast":case"east":v=p*(n/d);v=Math.min(Math.max(A,v),D);n=d*(v/p);break;case"south":n=d*(v/p);n=Math.min(Math.max(o,n),t);v=p*(n/d);break;case"northeast":n=d*(v/p);n=Math.min(Math.max(o,n),t);v=p*(n/d);break;case"north":var E=n;n=d*(v/p);n=Math.min(Math.max(o,n),t);v=p*(n/d);m+=(E-n)/2;break;case"southwest":v=p*(n/d);v=Math.min(Math.max(A,v),D);var E=n;n=d*(v/p);m+=E-n;break;case"west":var g=v;v=p*(n/d);v=Math.min(Math.max(A,v),D);l+=(g-v)/2;var E=n;n=d*(v/p);m+=E-n;break;case"northwest":var E=n;var g=v;v=p*(n/d);v=Math.min(Math.max(A,v),D);n=d*(v/p);l+=g-v;m+=E-n;break}}this.proxy.setBounds(m,l,n,v);if(this.dynamic){this.resizeElement()}}catch(z){}}},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(b){if(this.dd){this.dd.destroy()}if(this.overlay){Ext.destroy(this.overlay);this.overlay=null}Ext.destroy(this.proxy);this.proxy=null;var c=Ext.Resizable.positions;for(var a in c){if(typeof c[a]!="function"&&this[c[a]]){this[c[a]].destroy()}}if(b){this.el.update("");Ext.destroy(this.el);this.el=null}},syncHandleHeight:function(){var a=this.el.getHeight(true);if(this.west){this.west.el.setHeight(a)}if(this.east){this.east.el.setHeight(a)}}});Ext.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast"};Ext.Resizable.Handle=function(c,e,b,d){if(!this.tpl){var a=Ext.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});a.compile();Ext.Resizable.Handle.prototype.tpl=a}this.position=e;this.rz=c;this.el=this.tpl.append(c.el.dom,[this.position],true);this.el.unselectable();if(d){this.el.setOpacity(0)}this.el.on("mousedown",this.onMouseDown,this);if(!b){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this)}};Ext.Resizable.Handle.prototype={afterResize:function(a){},onMouseDown:function(a){this.rz.onMouseDown(this,a)},onMouseOver:function(a){this.rz.handleOver(this,a)},onMouseOut:function(a){this.rz.handleOut(this,a)},destroy:function(){Ext.destroy(this.el);this.el=null}};Ext.Editor=function(b,a){this.field=b;Ext.Editor.superclass.constructor.call(this,a)};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(b,a){this.el=new Ext.Layer({shadow:this.shadow,cls:"x-editor",parentEl:b,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(c,b){var a=b.getKey();if(this.completeOnEnter&&a==b.ENTER){b.stopEvent();this.completeEdit()}else{if(this.cancelOnEsc&&a==b.ESC){this.cancelEdit()}else{this.fireEvent("specialkey",c,b)}}if(this.field.triggerBlur&&(a==b.ENTER||a==b.ESC||a==b.TAB)){this.field.triggerBlur()}},startEdit:function(b,c){if(this.editing){this.completeEdit()}this.boundEl=Ext.get(b);var a=c!==undefined?c:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body)}if(this.fireEvent("beforestartedit",this,this.boundEl,a)===false){return}this.startValue=a;this.field.setValue(a);this.doAutoSize();this.el.alignTo(this.boundEl,this.alignment);this.editing=true;this.show()},doAutoSize:function(){if(this.autoSize){var a=this.boundEl.getSize();switch(this.autoSize){case"width":this.setSize(a.width,"");break;case"height":this.setSize("",a.height);break;default:this.setSize(a.width,a.height)}}},setSize:function(a,b){delete this.field.lastSize;this.field.setSize(a,b);if(this.el){if(Ext.isGecko2||Ext.isOpera){this.el.setSize(a,b)}this.el.sync()}},realign:function(){this.el.alignTo(this.boundEl,this.alignment)},completeEdit:function(a){if(!this.editing){return}var b=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){b=this.startValue;this.cancelEdit(true)}if(String(b)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return}if(this.fireEvent("beforecomplete",this,b,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(b)}if(a!==true){this.hide()}this.fireEvent("complete",this,b,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(a){if(this.editing){var b=this.getValue();this.setValue(this.startValue);if(a!==true){this.hide()}this.fireEvent("canceledit",this,b,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(a){this.field.setValue(a)},getValue:function(){return this.field.getValue()},beforeDestroy:function(){Ext.destroy(this.field);this.field=null}});Ext.reg("editor",Ext.Editor);Ext.MessageBox=function(){var t,b,p,s;var h,l,r,a,m,o,i,g;var q,u,n,c="";var d=function(w){if(t.isVisible()){t.hide();Ext.callback(b.fn,b.scope||window,[w,u.dom.value,b],1)}};var v=function(){if(b&&b.cls){t.el.removeClass(b.cls)}m.reset()};var e=function(y,w,x){if(b&&b.closable!==false){t.hide()}if(x){x.stopEvent()}};var k=function(w){var y=0;if(!w){q.ok.hide();q.cancel.hide();q.yes.hide();q.no.hide();return y}t.footer.dom.style.display="";for(var x in q){if(typeof q[x]!="function"){if(w[x]){q[x].show();q[x].setText(typeof w[x]=="string"?w[x]:Ext.MessageBox.buttonText[x]);y+=q[x].el.getWidth()+15}else{q[x].hide()}}}return y};return{getDialog:function(w){if(!t){t=new Ext.Window({autoCreate:true,title:w,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(b&&b.buttons&&b.buttons.no&&!b.buttons.cancel){d("no")}else{d("cancel")}}});q={};var x=this.buttonText;q.ok=t.addButton(x.ok,d.createCallback("ok"));q.yes=t.addButton(x.yes,d.createCallback("yes"));q.no=t.addButton(x.no,d.createCallback("no"));q.cancel=t.addButton(x.cancel,d.createCallback("cancel"));q.ok.hideMode=q.yes.hideMode=q.no.hideMode=q.cancel.hideMode="offsets";t.render(document.body);t.getEl().addClass("x-window-dlg");p=t.mask;h=t.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>'});i=Ext.get(h.dom.firstChild);var y=h.dom.childNodes[1];l=Ext.get(y.firstChild);r=Ext.get(y.childNodes[2].firstChild);r.enableDisplayMode();r.addKeyListener([10,13],function(){if(t.isVisible()&&b&&b.buttons){if(b.buttons.ok){d("ok")}else{if(b.buttons.yes){d("yes")}}}});a=Ext.get(y.childNodes[2].childNodes[1]);a.enableDisplayMode();m=new Ext.ProgressBar({renderTo:h});h.createChild({cls:"x-clear"})}return t},updateText:function(A){if(!t.isVisible()&&!b.width){t.setSize(this.maxWidth,100)}l.update(A||"&#160;");var y=c!=""?(i.getWidth()+i.getMargins("lr")):0;var C=l.getWidth()+l.getMargins("lr");var z=t.getFrameWidth("lr");var B=t.body.getFrameWidth("lr");if(Ext.isIE&&y>0){y+=3}var x=Math.max(Math.min(b.width||y+C+z+B,this.maxWidth),Math.max(b.minWidth||this.minWidth,n||0));if(b.prompt===true){u.setWidth(x-y-z-B)}if(b.progress===true||b.wait===true){m.setSize(x-y-z-B)}if(Ext.isIE&&x==n){x+=4}t.setSize(x,"auto").center();return this},updateProgress:function(x,w,y){m.updateProgress(x,w);if(y){this.updateText(y)}return this},isVisible:function(){return t&&t.isVisible()},hide:function(){var w=t.activeGhost;if(this.isVisible()||w){t.hide();v();if(w){w.hide()}}return this},show:function(z){if(this.isVisible()){this.hide()}b=z;var A=this.getDialog(b.title||"&#160;");A.setTitle(b.title||"&#160;");var w=(b.closable!==false&&b.progress!==true&&b.wait!==true);A.tools.close.setDisplayed(w);u=r;b.prompt=b.prompt||(b.multiline?true:false);if(b.prompt){if(b.multiline){r.hide();a.show();a.setHeight(typeof b.multiline=="number"?b.multiline:this.defaultTextHeight);u=a}else{r.show();a.hide()}}else{r.hide();a.hide()}u.dom.value=b.value||"";if(b.prompt){A.focusEl=u}else{var y=b.buttons;var x=null;if(y&&y.ok){x=q.ok}else{if(y&&y.yes){x=q.yes}}if(x){A.focusEl=x}}if(b.iconCls){A.setIconClass(b.iconCls)}this.setIcon(b.icon);n=k(b.buttons);m.setVisible(b.progress===true||b.wait===true);this.updateProgress(0,b.progressText);this.updateText(b.msg);if(b.cls){A.el.addClass(b.cls)}A.proxyDrag=b.proxyDrag===true;A.modal=b.modal!==false;A.mask=b.modal!==false?p:false;if(!A.isVisible()){document.body.appendChild(t.el.dom);A.setAnimateTarget(b.animEl);A.show(b.animEl)}A.on("show",function(){if(w===true){A.keyMap.enable()}else{A.keyMap.disable()}},this,{single:true});if(b.wait===true){m.wait(b.waitConfig)}return this},setIcon:function(w){if(w&&w!=""){i.removeClass("x-hidden");i.replaceClass(c,w);c=w}else{i.replaceClass(c,"x-hidden");c=""}return this},progress:function(y,x,w){this.show({title:y,msg:x,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,progressText:w});return this},wait:function(y,x,w){this.show({title:x,msg:y,buttons:false,closable:false,wait:true,modal:true,minWidth:this.minProgressWidth,waitConfig:w});return this},alert:function(z,y,x,w){this.show({title:z,msg:y,buttons:this.OK,fn:x,scope:w});return this},confirm:function(z,y,x,w){this.show({title:z,msg:y,buttons:this.YESNO,fn:x,scope:w,icon:this.QUESTION});return this},prompt:function(B,A,y,x,w,z){this.show({title:B,msg:A,buttons:this.OKCANCEL,fn:y,minWidth:250,scope:x,prompt:true,multiline:w,value:z});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(a){Ext.Tip.superclass.show.call(this);if(this.measureWidth!==false&&(!this.initialConfig||typeof this.initialConfig.width!="number")){this.doAutoWidth()}if(this.constrainPosition){a=this.el.adjustForConstraints(a)}this.setPagePosition(a[0],a[1])},doAutoWidth:function(){var a=this.body.getTextWidth();if(this.title){a=Math.max(a,this.header.child("span").getTextWidth(this.title))}a+=this.getFrameWidth()+(this.closable?20:0)+this.body.getPadding("lr");this.setWidth(a.constrain(this.minWidth,this.maxWidth));if(Ext.isIE7&&!this.repainted){this.el.repaint();this.repainted=true}},showBy:function(a,b){if(!this.rendered){this.render(Ext.getBody())}this.showAt(this.el.getAlignToXY(a,b||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(b,a){Ext.apply(this,a);this.tip=b;Ext.Tip.DD.superclass.constructor.call(this,b.el.id,"WindowDD-"+b.id);this.setHandleElId(b.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(a){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(a){this.targetXY=a.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(a){if(this.disabled||a.within(this.target.dom,true)){return}this.clearTimer("hide");this.targetXY=a.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(a){if(this.disabled||a.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(a){this.lastActive=new Date();this.clearTimers();Ext.ToolTip.superclass.showAt.call(this,a);if(this.dismissDelay&&this.autoHide!==false){this.dismissTimer=this.hide.defer(this.dismissDelay,this)}},clearTimer:function(a){a=a+"Timer";clearTimeout(this[a]);delete this[a]},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(a){if(this.autoHide!==false&&!a.within(this.el.dom)){this.disable();this.enable.defer(100,this)}},onDisable:function(){this.clearTimers();this.hide()},adjustPosition:function(a,d){var c=this.targetXY[1],b=this.getSize().height;if(this.constrainPosition&&d<=c&&(d+b)>=c){d=c-b-5}return{x:a,y:d}},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(e){var h=Ext.isArray(e)?e:arguments;for(var g=0,a=h.length;g<a;g++){var l=h[g];var k=l.target;if(k){if(Ext.isArray(k)){for(var d=0,b=k.length;d<b;d++){this.targets[Ext.id(k[d])]=l}}else{this.targets[Ext.id(k)]=l}}}},unregister:function(a){delete this.targets[Ext.id(a)]},onTargetOver:function(i){if(this.disabled){return}this.targetXY=i.getXY();var c=i.getTarget();if(!c||c.nodeType!==1||c==document||c==document.body){return}if(this.activeTarget&&c==this.activeTarget.el){this.clearTimer("hide");this.show();return}if(c&&this.targets[c.id]){this.activeTarget=this.targets[c.id];this.activeTarget.el=c;this.delayShow();return}var g,h=Ext.fly(c),b=this.tagConfig;var d=b.namespace;if(this.interceptTitles&&c.title){g=c.title;c.qtip=g;c.removeAttribute("title");i.preventDefault()}else{g=c.qtip||h.getAttributeNS(d,b.attribute)}if(g){var a=h.getAttributeNS(d,b.hide);this.activeTarget={el:c,text:g,width:h.getAttributeNS(d,b.width),autoHide:a!="user"&&a!=="false",title:h.getAttributeNS(d,b.title),cls:h.getAttributeNS(d,b.cls),align:h.getAttributeNS(d,b.align)};this.delayShow()}},onTargetOut:function(a){this.clearTimer("show");if(this.autoHide!==false){this.delayHide()}},showAt:function(b){var a=this.activeTarget;if(a){if(!this.rendered){this.render(Ext.getBody());this.activeTarget=a}if(a.width){this.setWidth(a.width);this.body.setWidth(this.adjustBodyWidth(a.width-this.getFrameWidth()));this.measureWidth=false}else{this.measureWidth=true}this.setTitle(a.title||"");this.body.update(a.text);this.autoHide=a.autoHide;this.dismissDelay=a.dismissDelay||this.dismissDelay;if(this.lastCls){this.el.removeClass(this.lastCls);delete this.lastCls}if(a.cls){this.el.addClass(a.cls);this.lastCls=a.cls}if(a.align){b=this.el.getAlignToXY(a.el,a.align);this.constrainPosition=false}else{this.constrainPosition=true}}Ext.QuickTip.superclass.showAt.call(this,b)},hide:function(){delete this.activeTarget;Ext.QuickTip.superclass.hide.call(this)}});Ext.QuickTips=function(){var b,a=[];return{init:function(c){if(!b){if(!Ext.isReady){Ext.onReady(function(){Ext.QuickTips.init(c)});return}b=new Ext.QuickTip({elements:"header,body"});if(c!==false){b.render(Ext.getBody())}}},enable:function(){if(b){a.pop();if(a.length<1){b.enable()}}},disable:function(){if(b){b.disable()}a.push(1)},isEnabled:function(){return b!==undefined&&!b.disabled},getQuickTip:function(){return b},register:function(){b.register.apply(b,arguments)},unregister:function(){b.unregister.apply(b,arguments)},tips:function(){b.register.apply(b,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 a=this.loader;if(!a){a=new Ext.tree.TreeLoader({dataUrl:this.dataUrl})}else{if(typeof a=="object"&&!a.load){a=new Ext.tree.TreeLoader(a)}}this.loader=a;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(c,b,a,h,g,e,d){if(c=="collapse"||c=="expand"||c=="beforecollapse"||c=="beforeexpand"||c=="move"||c=="beforemove"){c=c+"node"}return this.fireEvent(c,b,a,h,g,e,d)},getRootNode:function(){return this.root},setRootNode:function(b){if(!b.render){b=this.loader.createNode(b)}this.root=b;b.ownerTree=this;b.isRoot=true;this.registerNode(b);if(!this.rootVisible){var a=b.attributes.uiProvider;b.ui=a?new a(b):new Ext.tree.RootTreeNodeUI(b)}return b},getNodeById:function(a){return this.nodeHash[a]},registerNode:function(a){this.nodeHash[a.id]=a},unregisterNode:function(a){delete this.nodeHash[a.id]},toString:function(){return"[Tree"+(this.id?" "+this.id:"")+"]"},restrictExpand:function(a){var b=a.parentNode;if(b){if(b.expandedChild&&b.expandedChild.parentNode==b){b.expandedChild.collapse()}b.expandedChild=a}},getChecked:function(b,c){c=c||this.root;var d=[];var e=function(){if(this.attributes.checked){d.push(!b?this:(b=="id"?this.id:this.attributes[b]))}};c.cascade(e);return d},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(g,a,h){a=a||"id";var d=g.split(this.pathSeparator);var c=this.root;if(c.attributes[a]!=d[1]){if(h){h(false,null)}return}var b=1;var e=function(){if(++b==d.length){if(h){h(true,c)}return}var i=c.findChild(a,d[b]);if(!i){if(h){h(false,c)}return}c=i;i.expand(false,false,e)};c.expand(false,false,e)},selectPath:function(e,a,g){a=a||"id";var c=e.split(this.pathSeparator);var b=c.pop();if(c.length>0){var d=function(i,h){if(i&&h){var k=h.findChild(a,b);if(k){k.select();if(g){g(true,k)}}else{if(g){g(false,k)}}}else{if(g){g(false,k)}}};this.expandPath(c.join(this.pathSeparator),a,d)}else{this.root.select();if(g){g(true,this.root)}}},getTreeEl:function(){return this.body},onRender:function(b,a){Ext.tree.TreePanel.superclass.onRender.call(this,b,a);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(a){this.tree=a;this.tree.on("render",this.initEvents,this)};Ext.tree.TreeEventModel.prototype={initEvents:function(){var a=this.tree.getTreeEl();a.on("click",this.delegateClick,this);if(this.tree.trackMouseOver!==false){a.on("mouseover",this.delegateOver,this);a.on("mouseout",this.delegateOut,this)}a.on("dblclick",this.delegateDblClick,this);a.on("contextmenu",this.delegateContextMenu,this)},getNode:function(b){var a;if(a=b.getTarget(".x-tree-node-el",10)){var c=Ext.fly(a,"_treeEvents").getAttributeNS("ext","tree-node-id");if(c){return this.tree.getNodeById(c)}}return null},getNodeTarget:function(b){var a=b.getTarget(".x-tree-node-icon",1);if(!a){a=b.getTarget(".x-tree-node-el",6)}return a},delegateOut:function(b,a){if(!this.beforeEvent(b)){return}if(b.getTarget(".x-tree-ec-icon",1)){var c=this.getNode(b);this.onIconOut(b,c);if(c==this.lastEcOver){delete this.lastEcOver}}if((a=this.getNodeTarget(b))&&!b.within(a,true)){this.onNodeOut(b,this.getNode(b))}},delegateOver:function(b,a){if(!this.beforeEvent(b)){return}if(this.lastEcOver){this.onIconOut(b,this.lastEcOver);delete this.lastEcOver}if(b.getTarget(".x-tree-ec-icon",1)){this.lastEcOver=this.getNode(b);this.onIconOver(b,this.lastEcOver)}if(a=this.getNodeTarget(b)){this.onNodeOver(b,this.getNode(b))}},delegateClick:function(b,a){if(!this.beforeEvent(b)){return}if(b.getTarget("input[type=checkbox]",1)){this.onCheckboxClick(b,this.getNode(b))}else{if(b.getTarget(".x-tree-ec-icon",1)){this.onIconClick(b,this.getNode(b))}else{if(this.getNodeTarget(b)){this.onNodeClick(b,this.getNode(b))}}}},delegateDblClick:function(b,a){if(this.beforeEvent(b)&&this.getNodeTarget(b)){this.onNodeDblClick(b,this.getNode(b))}},delegateContextMenu:function(b,a){if(this.beforeEvent(b)&&this.getNodeTarget(b)){this.onNodeContextMenu(b,this.getNode(b))}},onNodeClick:function(b,a){a.ui.onClick(b)},onNodeOver:function(b,a){a.ui.onOver(b)},onNodeOut:function(b,a){a.ui.onOut(b)},onIconOver:function(b,a){a.ui.addClass("x-tree-ec-over")},onIconOut:function(b,a){a.ui.removeClass("x-tree-ec-over")},onIconClick:function(b,a){a.ui.ecClick(b)},onCheckboxClick:function(b,a){a.ui.onCheckChange(b)},onNodeDblClick:function(b,a){a.ui.onDblClick(b)},onNodeContextMenu:function(b,a){a.ui.onContextMenu(b)},beforeEvent:function(a){if(this.disabled){a.stopEvent();return false}return true},disable:function(){this.disabled=true},enable:function(){this.disabled=false}};Ext.tree.DefaultSelectionModel=function(a){this.selNode=null;this.addEvents("selectionchange","beforeselect");Ext.apply(this,a);Ext.tree.DefaultSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{init:function(a){this.tree=a;a.getTreeEl().on("keydown",this.onKeyDown,this);a.on("click",this.onNodeClick,this)},onNodeClick:function(a,b){this.select(a)},select:function(b){var a=this.selNode;if(a!=b&&this.fireEvent("beforeselect",this,b,a)!==false){if(a){a.ui.onSelectedChange(false)}this.selNode=b;b.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,b,a)}return b},unselect:function(a){if(this.selNode==a){this.clearSelections()}},clearSelections:function(){var a=this.selNode;if(a){a.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null)}return a},getSelectedNode:function(){return this.selNode},isSelected:function(a){return this.selNode==a},selectPrevious:function(){var a=this.selNode||this.lastSelNode;if(!a){return null}var c=a.previousSibling;if(c){if(!c.isExpanded()||c.childNodes.length<1){return this.select(c)}else{var b=c.lastChild;while(b&&b.isExpanded()&&b.childNodes.length>0){b=b.lastChild}return this.select(b)}}else{if(a.parentNode&&(this.tree.rootVisible||!a.parentNode.isRoot)){return this.select(a.parentNode)}}return null},selectNext:function(){var b=this.selNode||this.lastSelNode;if(!b){return null}if(b.firstChild&&b.isExpanded()){return this.select(b.firstChild)}else{if(b.nextSibling){return this.select(b.nextSibling)}else{if(b.parentNode){var a=null;b.parentNode.bubble(function(){if(this.nextSibling){a=this.getOwnerTree().selModel.select(this.nextSibling);return false}});return a}}}return null},onKeyDown:function(c){var b=this.selNode||this.lastSelNode;var d=this;if(!b){return}var a=c.getKey();switch(a){case c.DOWN:c.stopEvent();this.selectNext();break;case c.UP:c.stopEvent();this.selectPrevious();break;case c.RIGHT:c.preventDefault();if(b.hasChildNodes()){if(!b.isExpanded()){b.expand()}else{if(b.firstChild){this.select(b.firstChild,c)}}}break;case c.LEFT:c.preventDefault();if(b.hasChildNodes()&&b.isExpanded()){b.collapse()}else{if(b.parentNode&&(this.tree.rootVisible||b.parentNode!=this.tree.getRootNode())){this.select(b.parentNode,c)}}break}}});Ext.tree.MultiSelectionModel=function(a){this.selNodes=[];this.selMap={};this.addEvents("selectionchange");Ext.apply(this,a);Ext.tree.MultiSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{init:function(a){this.tree=a;a.getTreeEl().on("keydown",this.onKeyDown,this);a.on("click",this.onNodeClick,this)},onNodeClick:function(a,b){this.select(a,b,b.ctrlKey)},select:function(a,c,b){if(b!==true){this.clearSelections(true)}if(this.isSelected(a)){this.lastSelNode=a;return a}this.selNodes.push(a);this.selMap[a.id]=a;this.lastSelNode=a;a.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return a},unselect:function(b){if(this.selMap[b.id]){b.ui.onSelectedChange(false);var c=this.selNodes;var a=c.indexOf(b);if(a!=-1){this.selNodes.splice(a,1)}delete this.selMap[b.id];this.fireEvent("selectionchange",this,this.selNodes)}},clearSelections:function(b){var d=this.selNodes;if(d.length>0){for(var c=0,a=d.length;c<a;c++){d[c].ui.onSelectedChange(false)}this.selNodes=[];this.selMap={};if(b!==true){this.fireEvent("selectionchange",this,this.selNodes)}}},isSelected:function(a){return this.selMap[a.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(a){a=a||{};if(typeof a=="string"){a={text:a}}this.childrenRendered=false;this.rendered=false;Ext.tree.TreeNode.superclass.constructor.call(this,a);this.expanded=a.expanded===true;this.isTarget=a.isTarget!==false;this.draggable=a.draggable!==false&&a.allowDrag!==false;this.allowChildren=a.allowChildren!==false&&a.allowDrop!==false;this.text=a.text;this.disabled=a.disabled===true;this.addEvents("textchange","beforeexpand","beforecollapse","expand","disabledchange","collapse","beforeclick","click","checkchange","dblclick","contextmenu","beforechildrenrendered");var b=this.attributes.uiProvider||this.defaultUI||Ext.tree.TreeNodeUI;this.ui=new b(this)};Ext.extend(Ext.tree.TreeNode,Ext.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded},getUI:function(){return this.ui},getLoader:function(){var a;return this.loader||((a=this.getOwnerTree())&&a.loader?a.loader:new Ext.tree.TreeLoader())},setFirstChild:function(a){var b=this.firstChild;Ext.tree.TreeNode.superclass.setFirstChild.call(this,a);if(this.childrenRendered&&b&&a!=b){b.renderIndent(true,true)}if(this.rendered){this.renderIndent(true,true)}},setLastChild:function(b){var a=this.lastChild;Ext.tree.TreeNode.superclass.setLastChild.call(this,b);if(this.childrenRendered&&a&&b!=a){a.renderIndent(true,true)}if(this.rendered){this.renderIndent(true,true)}},appendChild:function(b){if(!b.render&&!Ext.isArray(b)){b=this.getLoader().createNode(b)}var a=Ext.tree.TreeNode.superclass.appendChild.call(this,b);if(a&&this.childrenRendered){a.render()}this.ui.updateExpandIcon();return a},removeChild:function(a){this.ownerTree.getSelectionModel().unselect(a);Ext.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){a.ui.remove()}if(this.childNodes.length<1){this.collapse(false,false)}else{this.ui.updateExpandIcon()}if(!this.firstChild&&!this.isHiddenRoot()){this.childrenRendered=false}return a},insertBefore:function(c,a){if(!c.render){c=this.getLoader().createNode(c)}var b=Ext.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(b&&a&&this.childrenRendered){c.render()}this.ui.updateExpandIcon();return b},setText:function(b){var a=this.text;this.text=b;this.attributes.text=b;if(this.rendered){this.ui.onTextChange(this,b,a)}this.fireEvent("textchange",this,b,a)},select:function(){this.getOwnerTree().getSelectionModel().select(this)},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this)},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this)},expand:function(a,b,c){if(!this.expanded){if(this.fireEvent("beforeexpand",this,a,b)===false){return}if(!this.childrenRendered){this.renderChildren()}this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&b!==false)||b){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof c=="function"){c(this)}if(a===true){this.expandChildNodes(true)}}.createDelegate(this));return}else{this.ui.expand();this.fireEvent("expand",this);if(typeof c=="function"){c(this)}}}else{if(typeof c=="function"){c(this)}}if(a===true){this.expandChildNodes(true)}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible},collapse:function(b,e){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,b,e)===false){return}this.expanded=false;if((this.getOwnerTree().animate&&e!==false)||e){this.ui.animCollapse(function(){this.fireEvent("collapse",this);if(b===true){this.collapseChildNodes(true)}}.createDelegate(this));return}else{this.ui.collapse();this.fireEvent("collapse",this)}}if(b===true){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].collapse(true,false)}}},delayedExpand:function(a){if(!this.expandProcId){this.expandProcId=this.expand.defer(a,this)}},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId)}this.expandProcId=false},toggle:function(){if(this.expanded){this.collapse()}else{this.expand()}},ensureVisible:function(b){var a=this.getOwnerTree();a.expandPath(this.parentNode?this.parentNode.getPath():this.getPath(),false,function(){var c=a.getNodeById(this.id);a.getTreeEl().scrollChildIntoView(c.ui.anchor);Ext.callback(b)}.createDelegate(this))},expandChildNodes:function(b){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].expand(b)}},collapseChildNodes:function(b){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].collapse(b)}},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(b){if(b!==false){this.fireEvent("beforechildrenrendered",this)}var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].render(true)}this.childrenRendered=true},sort:function(e,d){Ext.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var c=this.childNodes;for(var b=0,a=c.length;b<a;b++){c[b].render(true)}}},render:function(a){this.ui.render(a);if(!this.rendered){this.getOwnerTree().registerNode(this);this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false)}}},renderIndent:function(b,e){if(e){this.ui.childIndent=null}this.ui.renderIndent();if(b===true&&this.childrenRendered){var d=this.childNodes;for(var c=0,a=d.length;c<a;c++){d[c].renderIndent(true,e)}}},beginUpdate:function(){this.childrenRendered=false},endUpdate:function(){if(this.expanded&&this.rendered){this.renderChildren()}},destroy:function(){if(this.childNodes){for(var b=0,a=this.childNodes.length;b<a;b++){this.childNodes[b].destroy()}this.childNodes=null}if(this.ui.destroy){this.ui.destroy()}}});Ext.tree.TreePanel.nodeTypes.node=Ext.tree.TreeNode;Ext.tree.AsyncTreeNode=function(a){this.loaded=a&&a.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(b,d,g){if(this.loading){var e;var c=function(){if(!this.loading){clearInterval(e);this.expand(b,d,g)}}.createDelegate(this);e=setInterval(c,200);return}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return}this.loading=true;this.ui.beforeLoad(this);var a=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(a){a.load(this,this.loadComplete.createDelegate(this,[b,d,g]));return}}Ext.tree.AsyncTreeNode.superclass.expand.call(this,b,d,g)},isLoading:function(){return this.loading},loadComplete:function(a,b,c){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(a,b,c)},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(a){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild).destroy()}this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false}this.expand(false,false,a)}});Ext.tree.TreePanel.nodeTypes.async=Ext.tree.AsyncTreeNode;Ext.tree.TreeNodeUI=function(a){this.node=a;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(a){if(this.rendered){this.ctNode.removeChild(a.ui.getEl())}},beforeLoad:function(){this.addClass("x-tree-node-loading")},afterLoad:function(){this.removeClass("x-tree-node-loading")},onTextChange:function(b,c,a){if(this.rendered){this.textNode.innerHTML=c}},onDisableChange:function(a,b){this.disabled=b;if(this.checkbox){this.checkbox.disabled=b}if(b){this.addClass("x-tree-node-disabled")}else{this.removeClass("x-tree-node-disabled")}},onSelectedChange:function(a){if(a){this.focus();this.addClass("x-tree-selected")}else{this.removeClass("x-tree-selected")}},onMove:function(a,h,e,g,d,b){this.childIndent=null;if(this.rendered){var i=g.ui.getContainer();if(!i){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return}var c=b?b.ui.getEl():null;if(c){i.insertBefore(this.wrap,c)}else{i.appendChild(this.wrap)}this.node.renderIndent(true)}},addClass:function(a){if(this.elNode){Ext.fly(this.elNode).addClass(a)}},removeClass:function(a){if(this.elNode){Ext.fly(this.elNode).removeClass(a)}},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 b=this.node.getOwnerTree();var a=b.enableDD||b.enableDrag||b.enableDrop;if(a&&(!this.node.isRoot||b.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(a){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){a.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,a)}},onClick:function(c){if(this.dropping){c.stopEvent();return}if(this.fireEvent("beforeclick",this.node,c)!==false){var b=c.getTarget("a");if(!this.disabled&&this.node.attributes.href&&b){this.fireEvent("click",this.node,c);return}else{if(b&&c.ctrlKey){c.stopEvent()}}c.preventDefault();if(this.disabled){return}if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.isExpandable()){this.node.toggle()}this.fireEvent("click",this.node,c)}else{c.stopEvent()}},onDblClick:function(a){a.preventDefault();if(this.disabled){return}if(this.checkbox){this.toggleCheck()}if(!this.animating&&this.node.isExpandable()){this.node.toggle()}this.fireEvent("dblclick",this.node,a)},onOver:function(a){this.addClass("x-tree-node-over")},onOut:function(a){this.removeClass("x-tree-node-over")},onCheckChange:function(){var a=this.checkbox.checked;this.checkbox.defaultChecked=a;this.node.attributes.checked=a;this.fireEvent("checkchange",this.node,a)},ecClick:function(a){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(c){}}else{try{var b=this.node.getOwnerTree().getTreeEl().dom;var a=b.scrollLeft;this.anchor.focus();b.scrollLeft=a}catch(c){}}},toggleCheck:function(b){var a=this.checkbox;if(a){a.checked=(b===undefined?!a.checked:b);this.onCheckChange()}},blur:function(){try{this.anchor.blur()}catch(a){}},animExpand:function(b){var a=Ext.get(this.ctNode);a.stopFx();if(!this.node.isExpandable()){this.updateExpandIcon();this.ctNode.style.display="";Ext.callback(b);return}this.animating=true;this.updateExpandIcon();a.slideIn("t",{callback:function(){this.animating=false;Ext.callback(b)},scope:this,duration:this.node.ownerTree.duration||0.25})},highlight:function(){var a=this.node.getOwnerTree();Ext.fly(this.wrap).highlight(a.hlColor||"C3DAF9",{endColor:a.hlBaseColor})},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none"},animCollapse:function(b){var a=Ext.get(this.ctNode);a.enableDisplayMode("block");a.stopFx();this.animating=true;this.updateExpandIcon();a.slideOut("t",{callback:function(){this.animating=false;Ext.callback(b)},scope:this,duration:this.node.ownerTree.duration||0.25})},getContainer:function(){return this.ctNode},getEl:function(){return this.wrap},appendDDGhost:function(a){a.appendChild(this.elNode.cloneNode(true))},getDDRepairXY:function(){return Ext.lib.Dom.getXY(this.iconNode)},onRender:function(){this.render()},render:function(c){var e=this.node,b=e.attributes;var d=e.parentNode?e.parentNode.ui.getContainer():e.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(e,b,d,c);if(b.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",b.qtip);if(b.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",b.qtipTitle)}}else{this.textNode.setAttribute("ext:qtip",b.qtip);if(b.qtipTitle){this.textNode.setAttribute("ext:qtitle",b.qtipTitle)}}}else{if(b.qtipCfg){b.qtipCfg.target=Ext.id(this.textNode);Ext.QuickTips.register(b.qtipCfg)}}this.initEvents();if(!this.node.expanded){this.updateExpandIcon(true)}}else{if(c===true){d.appendChild(this.wrap)}}},renderElements:function(e,l,k,m){this.indentMarkup=e.parentNode?e.parentNode.ui.getChildIndent():"";var g=typeof l.checked=="boolean";var c=l.href?l.href:Ext.isGecko?"":"#";var d=['<li class="x-tree-node"><div ext:tree-node-id="',e.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ',l.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="',l.icon||this.emptyIcon,'" class="x-tree-node-icon',(l.icon?" x-tree-node-inline-icon":""),(l.iconCls?" "+l.iconCls:""),'" unselectable="on" />',g?('<input class="x-tree-node-cb" type="checkbox" '+(l.checked?'checked="checked" />':"/>")):"",'<a hidefocus="on" class="x-tree-node-anchor" href="',c,'" tabIndex="1" ',l.hrefTarget?' target="'+l.hrefTarget+'"':"",'><span unselectable="on">',e.text,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"].join("");var b;if(m!==true&&e.nextSibling&&(b=e.nextSibling.ui.getEl())){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",b,d)}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",k,d)}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var i=this.elNode.childNodes;this.indentNode=i[0];this.ecNode=i[1];this.iconNode=i[2];var h=3;if(g){this.checkbox=i[3];this.checkbox.defaultChecked=this.checkbox.checked;h++}this.anchor=i[h];this.textNode=i[h].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 e=this.node,d,c;var a=e.isLast()?"x-tree-elbow-end":"x-tree-elbow";if(e.isExpandable()){if(e.expanded){a+="-minus";d="x-tree-node-collapsed";c="x-tree-node-expanded"}else{a+="-plus";d="x-tree-node-expanded";c="x-tree-node-collapsed"}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false}if(this.c1!=d||this.c2!=c){Ext.fly(this.elNode).replaceClass(d,c);this.c1=d;this.c2=c}}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 b="x-tree-ec-icon "+a;if(this.ecc!=b){this.ecNode.className=b;this.ecc=b}}},getChildIndent:function(){if(!this.childIndent){var a=[];var b=this.node;while(b){if(!b.isRoot||(b.isRoot&&b.ownerTree.rootVisible)){if(!b.isLast()){a.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />')}else{a.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />')}}b=b.parentNode}this.childIndent=a.join("")}return this.childIndent},renderIndent:function(){if(this.rendered){var a="";var b=this.node.parentNode;if(b){a=b.ui.getChildIndent()}if(this.indentMarkup!=a){this.indentNode.innerHTML=a;this.indentMarkup=a}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;if(this.holder){delete this.wrap;Ext.removeNode(this.holder);delete this.holder}else{Ext.removeNode(this.wrap);delete this.wrap}}};Ext.tree.RootTreeNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{render:function(){if(!this.rendered){var a=this.node.ownerTree.innerCt.dom;this.node.expanded=true;a.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=a.firstChild}},collapse:Ext.emptyFn,expand:Ext.emptyFn});Ext.tree.TreeLoader=function(a){this.baseParams={};Ext.apply(this,a);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(a,b){if(this.clearOnLoad){while(a.firstChild){a.removeChild(a.firstChild)}}if(this.doPreload(a)){if(typeof b=="function"){b()}}else{if(this.dataUrl||this.url){this.requestData(a,b)}}},doPreload:function(d){if(d.attributes.children){if(d.childNodes.length<1){var c=d.attributes.children;d.beginUpdate();for(var b=0,a=c.length;b<a;b++){var e=d.appendChild(this.createNode(c[b]));if(this.preloadChildren){this.doPreload(e)}}d.endUpdate()}return true}else{return false}},getParams:function(d){var a=[],c=this.baseParams;for(var b in c){if(typeof c[b]!="function"){a.push(encodeURIComponent(b),"=",encodeURIComponent(c[b]),"&")}}a.push("node=",encodeURIComponent(d.id));return a.join("")},requestData:function(a,b){if(this.fireEvent("beforeload",this,a,b)!==false){this.transId=Ext.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:b,node:a},params:this.getParams(a)})}else{if(typeof b=="function"){b()}}},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(c){this.transId=false;var b=c.argument;this.processResponse(c,b.node,b.callback);this.fireEvent("load",this,b.node,c)},handleFailure:function(c){this.transId=false;var b=c.argument;this.fireEvent("loadexception",this,b.node,c);if(typeof b.callback=="function"){b.callback(this,b.node)}}});Ext.tree.TreeFilter=function(a,b){this.tree=a;this.filtered={};Ext.apply(this,b)};Ext.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(d,a,b){a=a||"text";var c;if(typeof d=="string"){var e=d.length;if(e==0&&this.clearBlank){this.clear();return}d=d.toLowerCase();c=function(g){return g.attributes[a].substr(0,e).toLowerCase()==d}}else{if(d.exec){c=function(g){return d.test(g.attributes[a])}}else{throw"Illegal filter type, must be string or regex"}}this.filterBy(c,null,b)},filterBy:function(d,c,b){b=b||this.tree.root;if(this.autoClear){this.clear()}var a=this.filtered,i=this.reverse;var e=function(l){if(l==b){return true}if(a[l.id]){return false}var k=d.call(c||l,l);if(!k||i){a[l.id]=l;l.ui.hide();return false}return true};b.cascade(e);if(this.remove){for(var h in a){if(typeof h!="function"){var g=a[h];if(g&&g.parentNode){g.parentNode.removeChild(g)}}}}},clear:function(){var b=this.tree;var a=this.filtered;for(var d in a){if(typeof d!="function"){var c=a[d];if(c){c.ui.show()}}}this.filtered={}}};Ext.tree.TreeSorter=function(b,c){Ext.apply(this,c);b.on("beforechildrenrendered",this.doSort,this);b.on("append",this.updateSort,this);b.on("insert",this.updateSort,this);b.on("textchange",this.updateSortParent,this);var e=this.dir&&this.dir.toLowerCase()=="desc";var g=this.property||"text";var h=this.sortType;var a=this.folderSort;var d=this.caseSensitive===true;var i=this.leafAttr||"leaf";this.sortFn=function(l,k){if(a){if(l.attributes[i]&&!k.attributes[i]){return 1}if(!l.attributes[i]&&k.attributes[i]){return -1}}var n=h?h(l):(d?l.attributes[g]:l.attributes[g].toUpperCase());var m=h?h(k):(d?k.attributes[g]:k.attributes[g].toUpperCase());if(n<m){return e?+1:-1}else{if(n>m){return e?-1:+1}else{return 0}}}};Ext.tree.TreeSorter.prototype={doSort:function(a){a.sort(this.sortFn)},compareNodes:function(b,a){return(b.text.toUpperCase()>a.text.toUpperCase()?1:-1)},updateSort:function(a,b){if(b.childrenRendered){this.doSort.defer(1,this,[b])}},updateSortParent:function(a){var b=a.parentNode;if(b&&b.childrenRendered){this.doSort.defer(1,this,[b])}}};if(Ext.dd.DropZone){Ext.tree.TreeDropZone=function(a,b){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Ext.tree.TreeDropZone.superclass.constructor.call(this,a.innerCt,b);this.tree=a;this.dragOverData={};this.lastInsertClass="x-tree-no-status"};Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(a){if(a.hasChildNodes()&&!a.isExpanded()){a.expand(false,null,this.triggerCacheRefresh.createDelegate(this))}},queueExpand:function(a){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[a])},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false}},isValidDropPoint:function(a,l,i,d,c){if(!a||!c){return false}var g=a.node;var h=c.node;if(!(g&&g.isTarget&&l)){return false}if(l=="append"&&g.allowChildren===false){return false}if((l=="above"||l=="below")&&(g.parentNode&&g.parentNode.allowChildren===false)){return false}if(h&&(g==h||h.contains(g))){return false}var b=this.dragOverData;b.tree=this.tree;b.target=g;b.data=c;b.point=l;b.source=i;b.rawEvent=d;b.dropNode=h;b.cancel=false;var k=this.tree.fireEvent("nodedragover",b);return b.cancel===false&&k!==false},getDropPoint:function(h,g,m){var o=g.node;if(o.isRoot){return o.allowChildren!==false?"append":false}var c=g.ddel;var p=Ext.lib.Dom.getY(c),k=p+c.offsetHeight;var i=Ext.lib.Event.getPageY(h);var l=o.allowChildren===false||o.isLeaf();if(this.appendOnly||o.parentNode.allowChildren===false){return l?false:"append"}var d=false;if(!this.allowParentInsert){d=o.hasChildNodes()&&o.isExpanded()}var a=(k-p)/(l?2:3);if(i>=p&&i<(p+a)){return"above"}else{if(!d&&(l||i>=k-a&&i<=k)){return"below"}else{return"append"}}},onNodeEnter:function(d,a,c,b){this.cancelExpand()},onNodeOver:function(b,i,h,g){var l=this.getDropPoint(h,b,i);var c=b.node;if(!this.expandProcId&&l=="append"&&c.hasChildNodes()&&!b.node.isExpanded()){this.queueExpand(c)}else{if(l!="append"){this.cancelExpand()}}var d=this.dropNotAllowed;if(this.isValidDropPoint(b,l,i,h,g)){if(l){var a=b.ddel;var k;if(l=="above"){d=b.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";k="x-tree-drag-insert-above"}else{if(l=="below"){d=b.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";k="x-tree-drag-insert-below"}else{d="x-tree-drop-ok-append";k="x-tree-drag-append"}}if(this.lastInsertClass!=k){Ext.fly(a).replaceClass(this.lastInsertClass,k);this.lastInsertClass=k}}}return d},onNodeOut:function(d,a,c,b){this.cancelExpand();this.removeDropIndicators(d)},onNodeDrop:function(c,l,g,d){var k=this.getDropPoint(g,c,l);var h=c.node;h.ui.startDrop();if(!this.isValidDropPoint(c,k,l,g,d)){h.ui.endDrop();return false}var i=d.node||(l.getTreeNode?l.getTreeNode(d,h,k,g):null);var b={tree:this.tree,target:h,data:d,point:k,source:l,rawEvent:g,dropNode:i,cancel:!i,dropStatus:false};var a=this.tree.fireEvent("beforenodedrop",b);if(a===false||b.cancel===true||!b.dropNode){h.ui.endDrop();return b.dropStatus}h=b.target;if(k=="append"&&!h.isExpanded()){h.expand(false,null,function(){this.completeDrop(b)}.createDelegate(this))}else{this.completeDrop(b)}return true},completeDrop:function(h){var d=h.dropNode,e=h.point,c=h.target;if(!Ext.isArray(d)){d=[d]}var g;for(var b=0,a=d.length;b<a;b++){g=d[b];if(e=="above"){c.parentNode.insertBefore(g,c)}else{if(e=="below"){c.parentNode.insertBefore(g,c.nextSibling)}else{c.appendChild(g)}}}g.ui.focus();if(Ext.enableFx&&this.tree.hlDrop){g.ui.highlight()}c.ui.endDrop();this.tree.fireEvent("nodedrop",h)},afterNodeMoved:function(a,c,g,d,b){if(Ext.enableFx&&this.tree.hlDrop){b.ui.focus();b.ui.highlight()}this.tree.fireEvent("nodedrop",this.tree,d,c,a,g)},getTree:function(){return this.tree},removeDropIndicators:function(b){if(b&&b.ddel){var a=b.ddel;Ext.fly(a).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass"}},beforeDragDrop:function(b,a,c){this.cancelExpand();return true},afterRepair:function(a){if(a&&Ext.enableFx){a.node.ui.highlight()}this.hideProxy()}})}if(Ext.dd.DragZone){Ext.tree.TreeDragZone=function(a,b){Ext.tree.TreeDragZone.superclass.constructor.call(this,a.getTreeEl(),b);this.tree=a};Ext.extend(Ext.tree.TreeDragZone,Ext.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(a,b){var c=a.node;return c&&c.draggable&&!c.disabled},onInitDrag:function(b){var a=this.dragData;this.tree.getSelectionModel().select(a.node);this.tree.eventModel.disable();this.proxy.update("");a.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,a.node,b)},getRepairXY:function(b,a){return a.node.ui.getDDRepairXY()},onEndDrag:function(a,b){this.tree.eventModel.enable.defer(100,this.tree.eventModel);this.tree.fireEvent("enddrag",this.tree,a.node,b)},onValidDrop:function(a,b,c){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,a,b);this.hideProxy()},beforeInvalidDrop:function(a,c){var b=this.tree.getSelectionModel();b.clearSelections();b.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(a,c,b){c=c||{};var d=c.events?c:new Ext.form.TextField(c);Ext.tree.TreeEditor.superclass.constructor.call(this,d,b);this.tree=a;if(!a.rendered){a.on("render",this.initEditor,this)}else{this.initEditor(a)}};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(a){a.on("beforeclick",this.beforeNodeClick,this);a.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(b,c){var e=this.tree.getTreeEl().dom,d=c.dom;if(e.scrollLeft>d.offsetLeft){e.scrollLeft=d.offsetLeft}var a=Math.min(this.maxWidth,(e.clientWidth>20?e.clientWidth:e.offsetWidth)-Math.max(0,d.offsetLeft-e.scrollLeft)-5);this.setSize(a,"")},triggerEdit:function(a,b){this.completeEdit();if(a.attributes.editable!==false){this.editNode=a;if(this.tree.autoScroll){a.ui.getEl().scrollIntoView(this.tree.body)}this.autoEditTimer=this.startEdit.defer(this.editDelay,this,[a.ui.textNode,a.text]);return false}},bindScroll:function(){this.tree.getTreeEl().on("scroll",this.cancelEdit,this)},beforeNodeClick:function(a,b){clearTimeout(this.autoEditTimer);if(this.tree.getSelectionModel().isSelected(a)){b.stopEvent();return this.triggerEdit(a)}},onNodeDblClick:function(a,b){clearTimeout(this.autoEditTimer)},updateNode:function(a,b){this.tree.getTreeEl().un("scroll",this.cancelEdit,this);this.editNode.setText(b)},onHide:function(){Ext.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus.defer(50,this.editNode.ui)}},onSpecialKey:function(c,b){var a=b.getKey();if(a==b.ESC){b.stopEvent();this.cancelEdit()}else{if(a==b.ENTER&&!b.hasModifier()){b.stopEvent();this.completeEdit()}}}});Ext.menu.Menu=function(a){if(Ext.isArray(a)){a={items:a}}Ext.apply(this,a);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 b=this.items;this.items=new Ext.util.MixedCollection();if(b){this.add.apply(this,b)}};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 b=this.el=this.createEl();if(!this.keyNav){this.keyNav=new Ext.menu.MenuNav(this)}if(this.plain){b.addClass("x-menu-plain")}if(this.cls){b.addClass(this.cls)}this.focusEl=b.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var a=b.createChild({tag:"ul",cls:"x-menu-list"});a.on("click",this.onClick,this);a.on("mouseover",this.onMouseOver,this);a.on("mouseout",this.onMouseOut,this);this.items.each(function(d){var c=document.createElement("li");c.className="x-menu-list-item";a.dom.appendChild(c);d.render(c,this)},this);this.ul=a;this.autoWidth()},autoWidth:function(){var d=this.el,c=this.ul;if(!d){return}var a=this.width;if(a){d.setWidth(a)}else{if(Ext.isIE){d.setWidth(this.minWidth);var b=d.dom.offsetWidth;d.setWidth(c.getWidth()+d.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(b){var a=b.getTarget(".x-menu-list-item",this.ul,true);if(a&&a.menuItemId){return this.items.get(a.menuItemId)}},onClick:function(b){var a;if(a=this.findTargetItem(b)){if(a.menu&&this.ignoreParentClicks){a.expandMenu()}else{a.onClick(b);this.fireEvent("click",this,a,b)}}},setActiveItem:function(a,b){if(a!=this.activeItem){if(this.activeItem){this.activeItem.deactivate()}this.activeItem=a;a.activate(b)}else{if(b){a.expandMenu()}}},tryActivate:function(g,e){var b=this.items;for(var c=g,a=b.length;c>=0&&c<a;c+=e){var d=b.get(c);if(!d.disabled&&d.canActivate){this.setActiveItem(d,false);return d}}return false},onMouseOver:function(b){var a;if(a=this.findTargetItem(b)){if(a.canActivate&&!a.disabled){this.setActiveItem(a,true)}}this.over=true;this.fireEvent("mouseover",this,b,a)},onMouseOut:function(b){var a;if(a=this.findTargetItem(b)){if(a==this.activeItem&&a.shouldDeactivate(b)){this.activeItem.deactivate();delete this.activeItem}}this.over=false;this.fireEvent("mouseout",this,b,a)},isVisible:function(){return this.el&&!this.hidden},show:function(b,c,a){this.parentMenu=a;if(!this.el){this.render()}this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(b,c||this.defaultAlign),a,false)},showAt:function(c,b,a){this.parentMenu=b;if(!this.el){this.render()}if(a!==false){this.fireEvent("beforeshow",this);c=this.el.adjustForConstraints(c)}this.el.setXY(c);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(a){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(a===true&&this.parentMenu){this.parentMenu.hide(true)}},add:function(){var c=arguments,b=c.length,g;for(var d=0;d<b;d++){var e=c[d];if(e.render){g=this.addItem(e)}else{if(typeof e=="string"){if(e=="separator"||e=="-"){g=this.addSeparator()}else{g=this.addText(e)}}else{if(e.tagName||e.el){g=this.addElement(e)}else{if(typeof e=="object"){Ext.applyIf(e,this.defaults);g=this.addMenuItem(e)}}}}}return g},getEl:function(){if(!this.el){this.render()}return this.el},addSeparator:function(){return this.addItem(new Ext.menu.Separator())},addElement:function(a){return this.addItem(new Ext.menu.BaseItem(a))},addItem:function(b){this.items.add(b);if(this.ul){var a=document.createElement("li");a.className="x-menu-list-item";this.ul.dom.appendChild(a);b.render(a,this);this.delayAutoWidth()}return b},addMenuItem:function(a){if(!(a instanceof Ext.menu.Item)){if(typeof a.checked=="boolean"){a=new Ext.menu.CheckItem(a)}else{a=new Ext.menu.Item(a)}}return this.addItem(a)},addText:function(a){return this.addItem(new Ext.menu.TextItem(a))},insert:function(b,c){this.items.insert(b,c);if(this.ul){var a=document.createElement("li");a.className="x-menu-list-item";this.ul.dom.insertBefore(a,this.ul.dom.childNodes[b]);c.render(a,this);this.delayAutoWidth()}return c},remove:function(a){this.items.removeKey(a.id);a.destroy()},removeAll:function(){if(this.items){var a;while(a=this.items.first()){this.remove(a)}}},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(a){Ext.menu.MenuNav.superclass.constructor.call(this,a.el);this.scope=this.menu=a};Ext.extend(Ext.menu.MenuNav,Ext.KeyNav,{doRelay:function(c,b){var a=c.getKey();if(!this.menu.activeItem&&c.isNavKeyPress()&&a!=c.SPACE&&a!=c.RETURN){this.menu.tryActivate(0,1);return false}return b.call(this.scope||this,c,this.menu)},up:function(b,a){if(!a.tryActivate(a.items.indexOf(a.activeItem)-1,-1)){a.tryActivate(a.items.length-1,-1)}},down:function(b,a){if(!a.tryActivate(a.items.indexOf(a.activeItem)+1,1)){a.tryActivate(0,1)}},right:function(b,a){if(a.activeItem){a.activeItem.expandMenu(true)}},left:function(b,a){a.hide();if(a.parentMenu&&a.parentMenu.activeItem){a.parentMenu.activeItem.activate()}},enter:function(b,a){if(a.activeItem){b.stopPropagation();a.activeItem.onClick(b);a.fireEvent("click",this,a.activeItem);return true}}});Ext.menu.MenuMgr=function(){var g,d,c={},a=false,m=new Date();function o(){g={};d=new Ext.util.MixedCollection();Ext.getDoc().addKeyListener(27,function(){if(d.length>0){i()}})}function i(){if(d&&d.length>0){var p=d.clone();p.each(function(q){q.hide()})}}function e(p){d.remove(p);if(d.length<1){Ext.getDoc().un("mousedown",n);a=false}}function l(p){var q=d.last();m=new Date();d.add(p);if(!a){Ext.getDoc().on("mousedown",n);a=true}if(p.parentMenu){p.getEl().setZIndex(parseInt(p.parentMenu.getEl().getStyle("z-index"),10)+3);p.parentMenu.activeChild=p}else{if(q&&q.isVisible()){p.getEl().setZIndex(parseInt(q.getEl().getStyle("z-index"),10)+3)}}}function b(p){if(p.activeChild){p.activeChild.hide()}if(p.autoHideTimer){clearTimeout(p.autoHideTimer);delete p.autoHideTimer}}function h(p){var q=p.parentMenu;if(!q&&!p.allowOtherMenus){i()}else{if(q&&q.activeChild){q.activeChild.hide()}}}function n(p){if(m.getElapsed()>50&&d.length>0&&!p.getTarget(".x-menu")){i()}}function k(q,t){if(t){var s=c[q.group];for(var r=0,p=s.length;r<p;r++){if(s[r]!=q){s[r].setChecked(false)}}}}return{hideAll:function(){i()},register:function(q){if(!g){o()}g[q.id]=q;q.on("beforehide",b);q.on("hide",e);q.on("beforeshow",h);q.on("show",l);var p=q.group;if(p&&q.events.checkchange){if(!c[p]){c[p]=[]}c[p].push(q);q.on("checkchange",onCheck)}},get:function(p){if(typeof p=="string"){if(!g){return null}return g[p]}else{if(p.events){return p}else{if(typeof p.length=="number"){return new Ext.menu.Menu({items:p})}else{return new Ext.menu.Menu(p)}}}},unregister:function(q){delete g[q.id];q.un("beforehide",b);q.un("hide",e);q.un("beforeshow",h);q.un("show",l);var p=q.group;if(p&&q.events.checkchange){c[p].remove(q);q.un("checkchange",onCheck)}},registerCheckable:function(p){var q=p.group;if(q){if(!c[q]){c[q]=[]}c[q].push(p);p.on("beforecheckchange",k)}},unregisterCheckable:function(p){var q=p.group;if(q){c[q].remove(p);p.un("beforecheckchange",k)}},getCheckedItem:function(r){var s=c[r];if(s){for(var q=0,p=s.length;q<p;q++){if(s[q].checked){return s[q]}}}return null},setCheckedItem:function(r,t){var s=c[r];if(s){for(var q=0,p=s.length;q<p;q++){if(s[q].id==t){s[q].setChecked(true)}}}return null}}}();Ext.menu.BaseItem=function(a){Ext.menu.BaseItem.superclass.constructor.call(this,a);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(a,b){this.parentMenu=b;Ext.menu.BaseItem.superclass.render.call(this,a);this.container.menuItemId=this.id},onRender:function(b,a){this.el=Ext.get(this.el);if(this.id){this.el.id=this.id}b.dom.appendChild(this.el.dom)},setHandler:function(b,a){if(this.handler){this.un("click",this.handler,this.scope)}this.on("click",this.handler=b,this.scope=a)},onClick:function(a){if(!this.disabled&&this.fireEvent("click",this,a)!==false&&this.parentMenu.fireEvent("itemclick",this,a)!==false){this.handleClick(a)}else{a.stopEvent()}},activate:function(){if(this.disabled){return false}var a=this.container;a.addClass(this.activeClass);this.region=a.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(a){return !this.region||!this.region.contains(a.getPoint())},handleClick:function(a){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true])}},expandMenu:function(a){},hideMenu:function(){}});Ext.menu.TextItem=function(a){if(typeof a=="string"){a={text:a}}Ext.menu.TextItem.superclass.constructor.call(this,a)};Ext.extend(Ext.menu.TextItem,Ext.menu.BaseItem,{hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var a=document.createElement("span");a.className=this.itemCls;a.innerHTML=this.text;this.el=a;Ext.menu.TextItem.superclass.onRender.apply(this,arguments)}});Ext.menu.Separator=function(a){Ext.menu.Separator.superclass.constructor.call(this,a)};Ext.extend(Ext.menu.Separator,Ext.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(a){var b=document.createElement("span");b.className=this.itemCls;b.innerHTML="&#160;";this.el=b;a.addClass("x-menu-sep-li");Ext.menu.Separator.superclass.onRender.apply(this,arguments)}});Ext.menu.Item=function(a){Ext.menu.Item.superclass.constructor.call(this,a);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(b,a){var c=document.createElement("a");c.hideFocus=true;c.unselectable="on";c.href=this.href||"#";if(this.hrefTarget){c.target=this.hrefTarget}c.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");c.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=c;Ext.menu.Item.superclass.onRender.call(this,b,a)},setText:function(a){this.text=a;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(a){var b=this.iconCls;this.iconCls=a;if(this.rendered){this.el.child("img.x-menu-item-icon").replaceClass(b,this.iconCls)}},beforeDestroy:function(){if(this.menu){this.menu.destroy()}Ext.menu.Item.superclass.beforeDestroy.call(this)},handleClick:function(a){if(!this.href){a.stopEvent()}Ext.menu.Item.superclass.handleClick.apply(this,arguments)},activate:function(a){if(Ext.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(a){this.expandMenu()}}return true},shouldDeactivate:function(a){if(Ext.menu.Item.superclass.shouldDeactivate.call(this,a)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(a.getPoint())}return true}return false},deactivate:function(){Ext.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu()},expandMenu:function(a){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,[a])}else{if(this.menu.isVisible()&&a){this.menu.tryActivate(0,1)}}}},deferExpand:function(a){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(a){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(a){Ext.menu.CheckItem.superclass.constructor.call(this,a);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(a){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(b,a){if(this.checked!=b&&this.fireEvent("beforecheckchange",this,b)!==false){if(this.container){this.container[b?"addClass":"removeClass"]("x-menu-item-checked")}this.checked=b;if(a!==true){this.fireEvent("checkchange",this,b)}}},handleClick:function(a){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked)}Ext.menu.CheckItem.superclass.handleClick.apply(this,arguments)}});Ext.menu.Adapter=function(b,a){Ext.menu.Adapter.superclass.constructor.call(this,a);this.component=b};Ext.extend(Ext.menu.Adapter,Ext.menu.BaseItem,{canActivate:true,onRender:function(b,a){this.component.render(b);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(a){Ext.menu.DateItem.superclass.constructor.call(this,new Ext.DatePicker(a),a);this.picker=this.component;this.addEvents("select");this.picker.on("render",function(b){b.getEl().swallowEvent("click");b.container.addClass("x-menu-date-item")});this.picker.on("select",this.onSelect,this)};Ext.extend(Ext.menu.DateItem,Ext.menu.Adapter,{onSelect:function(b,a){this.fireEvent("select",this,a,b);Ext.menu.DateItem.superclass.handleClick.call(this)}});Ext.menu.ColorItem=function(a){Ext.menu.ColorItem.superclass.constructor.call(this,new Ext.ColorPalette(a),a);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(a){Ext.menu.DateMenu.superclass.constructor.call(this,a);this.plain=true;var b=new Ext.menu.DateItem(a);this.add(b);this.picker=b.picker;this.relayEvents(b,["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(a){Ext.menu.ColorMenu.superclass.constructor.call(this,a);this.plain=true;var b=new Ext.menu.ColorItem(a);this.add(b);this.palette=b.palette;this.relayEvents(b,["select"])};Ext.extend(Ext.menu.ColorMenu,Ext.menu.Menu,{beforeDestroy:function(){this.palette.destroy()}});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(c,a){Ext.form.Field.superclass.onRender.call(this,c,a);if(!this.el){var b=this.getAutoCreate();if(!b.name){b.name=this.name||this.id}if(this.inputType){b.type=this.inputType}this.el=c.createChild(b,a)}var d=this.el.dom.type;if(d){if(d=="password"){d="text"}this.el.addClass("x-form-"+d)}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(a){if(a.isSpecialKey()){this.fireEvent("specialkey",this,a)}},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 a=this.inEditor&&Ext.isWindows&&Ext.isGecko?{buffer:10}:null;this.el.on("blur",this.onBlur,this,a)},onFocus:function(){if(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(this.focusClass){this.el.removeClass(this.focusClass)}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate()}var a=this.getValue();if(String(a)!==String(this.startValue)){this.fireEvent("change",this,a,this.startValue)}this.fireEvent("blur",this)},isValid:function(a){if(this.disabled){return true}var c=this.preventMark;this.preventMark=a===true;var b=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=c;return b},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true}return false},processValue:function(a){return a},validateValue:function(a){return true},markInvalid:function(c){if(!this.rendered||this.preventMark){return}this.el.addClass(this.invalidClass);c=c||this.invalidText;switch(this.msgTarget){case"qtip":this.el.dom.qtip=c;this.el.dom.qclass="x-form-invalid-tip";if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=c;break;case"under":if(!this.errorEl){var b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorEl=b.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(b.getWidth(true)-20)}this.errorEl.update(c);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){var b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorIcon=b.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();this.errorIcon.dom.qtip=c;this.errorIcon.dom.qclass="x-form-invalid-tip";this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:var a=Ext.getDom(this.msgTarget);a.innerHTML=c;a.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,c)},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 a=Ext.getDom(this.msgTarget);a.innerHTML="";a.style.display="none";break}this.fireEvent("valid",this)},getRawValue:function(){var a=this.rendered?this.el.getValue():Ext.value(this.value,"");if(a===this.emptyText){a=""}return a},getValue:function(){if(!this.rendered){return this.value}var a=this.el.getValue();if(a===this.emptyText||a===undefined){a=""}return a},setRawValue:function(a){return this.el.dom.value=(a===null||a===undefined?"":a)},setValue:function(a){this.value=a;if(this.rendered){this.el.dom.value=(a===null||a===undefined?"":a);this.validate()}},adjustSize:function(a,c){var b=Ext.form.Field.superclass.adjustSize.call(this,a,c);b.width=this.adjustWidth(this.el.dom.tagName,b.width);return b},adjustWidth:function(a,b){a=a.toLowerCase();if(typeof b=="number"&&!Ext.isSafari){if(Ext.isIE&&(a=="input"||a=="textarea")){if(a=="input"&&!Ext.isStrict){return this.inEditor?b:b-3}if(a=="input"&&Ext.isStrict){return b-(Ext.isIE6?4:1)}if(a=="textarea"&&Ext.isStrict){return b-2}}else{if(Ext.isOpera&&Ext.isStrict){if(a=="input"){return b+2}if(a=="textarea"){return b-2}}}}return b}});Ext.form.MessageTargets={qtip:{mark:function(a){this.el.dom.qtip=msg;this.el.dom.qclass="x-form-invalid-tip";if(Ext.QuickTips){Ext.QuickTips.enable()}},clear:function(a){this.el.dom.qtip=""}},title:{mark:function(a){this.el.dom.title=msg},clear:function(a){this.el.dom.title=""}},under:{mark:function(b){if(!this.errorEl){var a=this.getErrorCt();if(!a){this.el.dom.title=msg;return}this.errorEl=a.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(a.getWidth(true)-20)}this.errorEl.update(msg);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this)},clear:function(a){if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}else{this.el.dom.title=""}}},side:{mark:function(b){if(!this.errorIcon){var a=this.getErrorCt();if(!a){this.el.dom.title=msg;return}this.errorIcon=a.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(a){if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}else{this.el.dom.title=""}}},around:{mark:function(a){},clear:function(a){}}};Ext.form.Field.msgFx={normal:{show:function(a,b){a.setDisplayed("block")},hide:function(a,b){a.setDisplayed(false).update("")}},slide:{show:function(a,b){a.slideIn("t",{stopFx:true})},hide:function(a,b){a.slideOut("t",{stopFx:true,useDisplay:true})}},slideRight:{show:function(a,b){a.fixDisplay();a.alignTo(b.el,"tl-tr");a.slideIn("l",{stopFx:true})},hide:function(a,b){a.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(a){a.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(a){if(this.stripCharsRe){var b=a.replace(this.stripCharsRe,"");if(b!==a){this.setRawValue(b);return b}}return a},filterValidation:function(a){if(!a.isNavKeyPress()){this.validationTask.delay(this.validationDelay)}},onDisable:function(){Ext.form.TextField.superclass.onDisable.call(this);if(Ext.isIE){this.el.dom.unselectable="on"}},onEnable:function(){Ext.form.TextField.superclass.onEnable.call(this);if(Ext.isIE){this.el.dom.unselectable=""}},onKeyUpBuffered:function(a){if(!a.isNavKeyPress()){this.autoSize()}},onKeyUp:function(a){this.fireEvent("keyup",this,a)},onKeyDown:function(a){this.fireEvent("keydown",this,a)},onKeyPress:function(a){this.fireEvent("keypress",this,a)},reset:function(){Ext.form.TextField.superclass.reset.call(this);this.applyEmptyText()},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1&&!this.hasFocus){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(b){if(b.ctrlKey){return}var a=b.getKey();if(Ext.isGecko&&(b.isNavKeyPress()||a==b.BACKSPACE||(a==b.DELETE&&b.button==-1))){return}var g=b.getCharCode(),d=String.fromCharCode(g);if(!Ext.isGecko&&b.isSpecialKey()&&!d){return}if(!this.maskRe.test(d)){b.stopEvent()}},setValue:function(a){if(this.emptyText&&this.el&&a!==undefined&&a!==null&&a!==""){this.el.removeClass(this.emptyClass)}Ext.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize()},validateValue:function(a){if(a.length<1||a===this.emptyText){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false}if(a.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false}if(this.vtype){var c=Ext.form.VTypes;if(!c[this.vtype](a,this)){this.markInvalid(this.vtypeText||c[this.vtype+"Text"]);return false}}if(typeof this.validator=="function"){var b=this.validator(a);if(b!==true){this.markInvalid(b);return false}}if(this.regex&&!this.regex.test(a)){this.markInvalid(this.regexText);return false}return true},selectText:function(h,a){var c=this.getRawValue();var e=false;if(c.length>0){h=h===undefined?0:h;a=a===undefined?c.length:a;var g=this.el.dom;if(g.setSelectionRange){g.setSelectionRange(h,a)}else{if(g.createTextRange){var b=g.createTextRange();b.moveStart("character",h);b.moveEnd("character",a-c.length);b.select()}}e=Ext.isGecko||Ext.isOpera}else{e=true}if(e){this.focus()}},autoSize:function(){if(!this.grow||!this.rendered){return}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el;var b=c.dom.value;var e=document.createElement("div");e.appendChild(document.createTextNode(b));b=e.innerHTML;Ext.removeNode(e);e=null;b+="&#160;";var a=Math.min(this.growMax,Math.max(this.metrics.getWidth(b)+10,this.growMin));this.el.setWidth(a);this.fireEvent("autosize",this,a)}});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(a,b){Ext.form.TriggerField.superclass.onResize.call(this,a,b);if(typeof a=="number"){this.el.setWidth(this.adjustWidth("input",a-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(b,a){Ext.form.TriggerField.superclass.onRender.call(this,b,a);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 a;if(Ext.isIE&&!this.hideTrigger&&this.el.getY()!=(a=this.trigger.getY())){this.el.position();this.el.setY(a)}},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(a){if(a.getKey()==a.TAB){this.triggerBlur()}},onBlur:function(){},mimicBlur:function(a){if(!this.wrap.contains(a.target)&&this.validateBlur(a)){this.triggerBlur()}},triggerBlur:function(){this.mimicing=false;Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this);if(this.monitorTab&&this.el){this.el.un("keydown",this.checkTab,this)}this.beforeBlur();if(this.wrap){this.wrap.removeClass("x-trigger-wrap-focus")}Ext.form.TriggerField.superclass.onBlur.call(this)},beforeBlur:Ext.emptyFn,validateBlur:function(a){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(a){return this.triggers[a]},initTrigger:function(){var a=this.trigger.select(".x-form-trigger",true);this.wrap.setStyle("overflow","hidden");var b=this;a.each(function(d,g,c){d.hide=function(){var h=b.wrap.getWidth();this.dom.style.display="none";b.el.setWidth(h-b.trigger.getWidth())};d.show=function(){var h=b.wrap.getWidth();this.dom.style.display="";b.el.setWidth(h-b.trigger.getWidth())};var e="Trigger"+(c+1);if(this["hide"+e]){d.dom.style.display="none"}d.on("click",this["on"+e+"Click"],this,{preventDefault:true});d.addClassOnOver("x-form-trigger-over");d.addClassOnClick("x-form-trigger-click")},this);this.triggers=a.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(b,a){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:100px;height:60px;",autocomplete:"off"}}Ext.form.TextArea.superclass.onRender.call(this,b,a);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(a){if(a.isSpecialKey()&&(this.enterIsSpecial||(a.getKey()!=a.ENTER||a.hasModifier()))){this.fireEvent("specialkey",this,a)}},onKeyUp:function(a){if(!a.isNavKeyPress()||a.getKey()==a.ENTER){this.autoSize()}Ext.form.TextArea.superclass.onKeyUp.call(this,a)},autoSize:function(){if(!this.grow||!this.textSizeEl){return}var c=this.el;var a=c.dom.value;var d=this.textSizeEl;d.innerHTML="";d.appendChild(document.createTextNode(a));a=d.innerHTML;Ext.fly(d).setWidth(this.el.getWidth());if(a.length<1){a="&#160;&#160;"}else{if(Ext.isIE){a=a.replace(/\n/g,"<p>&#160;</p>")}a+=this.growAppend}d.innerHTML=a;var b=Math.min(this.growMax,Math.max(d.offsetHeight,this.growMin)+this.growPad);if(b!=this.lastHeight){this.lastHeight=b;this.el.setHeight(b);this.fireEvent("autosize",this,b)}}});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 b=this.baseChars+"";if(this.allowDecimals){b+=this.decimalSeparator}if(this.allowNegative){b+="-"}this.stripCharsRe=new RegExp("[^"+b+"]","gi");var a=function(g){var d=g.getKey();if(!Ext.isIE&&(g.isSpecialKey()||d==g.BACKSPACE||d==g.DELETE)){return}var h=g.getCharCode();if(b.indexOf(String.fromCharCode(h))===-1){g.stopEvent()}};this.el.on("keypress",a,this)},validateValue:function(b){if(!Ext.form.NumberField.superclass.validateValue.call(this,b)){return false}if(b.length<1){return true}b=String(b).replace(this.decimalSeparator,".");if(isNaN(b)){this.markInvalid(String.format(this.nanText,b));return false}var a=this.parseValue(b);if(a<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false}if(a>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(a){a=typeof a=="number"?a:parseFloat(String(a).replace(this.decimalSeparator,"."));a=isNaN(a)?"":String(a).replace(".",this.decimalSeparator);Ext.form.NumberField.superclass.setValue.call(this,a)},parseValue:function(a){a=parseFloat(String(a).replace(this.decimalSeparator,"."));return isNaN(a)?"":a},fixPrecision:function(b){var a=isNaN(b);if(!this.allowDecimals||this.decimalPrecision==-1||a||!b){return a?"":b}return parseFloat(parseFloat(b).toFixed(this.decimalPrecision))},beforeBlur:function(){var a=this.parseValue(this.getRawValue());if(a||a===0){this.setValue(this.fixPrecision(a))}}});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);this.addEvents("select");if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue)}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue)}this.disabledDatesRE=null;this.initDisabledDays()},initDisabledDays:function(){if(this.disabledDates){var a=this.disabledDates;var c="(?:";for(var b=0;b<a.length;b++){c+=a[b];if(b!=a.length-1){c+="|"}}this.disabledDatesRE=new RegExp(c+")")}},setDisabledDates:function(a){this.disabledDates=a;this.initDisabledDays();if(this.menu){this.menu.picker.setDisabledDates(this.disabledDatesRE)}},setDisabledDays:function(a){this.disabledDays=a;if(this.menu){this.menu.picker.setDisabledDays(a)}},setMinValue:function(a){this.minValue=(typeof a=="string"?this.parseDate(a):a);if(this.menu){this.menu.picker.setMinDate(this.minValue)}},setMaxValue:function(a){this.maxValue=(typeof a=="string"?this.parseDate(a):a);if(this.menu){this.menu.picker.setMaxDate(this.maxValue)}},validateValue:function(e){e=this.formatDate(e);if(!Ext.form.DateField.superclass.validateValue.call(this,e)){return false}if(e.length<1){return true}var c=e;e=this.parseDate(e);if(!e){this.markInvalid(String.format(this.invalidText,c,this.format));return false}var g=e.getTime();if(this.minValue&&g<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false}if(this.maxValue&&g>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false}if(this.disabledDays){var a=e.getDay();for(var b=0;b<this.disabledDays.length;b++){if(a===this.disabledDays[b]){this.markInvalid(this.disabledDaysText);return false}}}var d=this.formatDate(e);if(this.disabledDatesRE&&this.disabledDatesRE.test(d)){this.markInvalid(String.format(this.disabledDatesText,d));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(a){Ext.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(a)))},parseDate:function(d){if(!d||Ext.isDate(d)){return d}var b=Date.parseDate(d,this.format);if(!b&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|")}for(var c=0,a=this.altFormatsArray.length;c<a&&!b;c++){b=Date.parseDate(d,this.altFormatsArray[c])}}return b},onDestroy:function(){if(this.menu){this.menu.destroy()}if(this.wrap){this.wrap.remove()}Ext.form.DateField.superclass.onDestroy.call(this)},formatDate:function(a){return Ext.isDate(a)?a.dateFormat(this.format):a},menuListeners:{select:function(a,b){this.setValue(b);this.fireEvent("select",this,b)},show:function(){this.onFocus()},hide:function(){this.focus.defer(10,this);var a=this.menuListeners;this.menu.un("select",a.select,this);this.menu.un("show",a.show,this);this.menu.un("hide",a.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.disabledDatesRE,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 a=this.parseDate(this.getRawValue());if(a){this.setValue(a)}}});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 c=Ext.getDom(this.transform);if(!this.hiddenName){this.hiddenName=c.name}if(!this.store){this.mode="local";var k=[],e=c.options;for(var b=0,a=e.length;b<a;b++){var h=e[b];var g=(Ext.isIE?h.getAttributeNode("value").specified:h.hasAttribute("value"))?h.value:h.text;if(h.selected){this.value=g}k.push([g,h.text])}this.store=new Ext.data.SimpleStore({id:0,fields:["value","text"],data:k});this.valueField="value";this.displayField="text"}c.name=Ext.id();if(!this.lazyRender){this.target=true;this.el=Ext.DomHelper.insertBefore(c,this.autoCreate||this.defaultAutoCreate);Ext.removeNode(c);this.render(this.el.parentNode)}else{Ext.removeNode(c)}}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(b,a){Ext.form.ComboBox.superclass.onRender.call(this,b,a);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 a="x-combo-list";this.list=new Ext.Layer({shadow:this.shadow,cls:[a,this.listClass].join(" "),constrain:false});var b=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(b);this.list.swallowEvent("mousewheel");this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:a+"-hd",html:this.title});this.assetHeight+=this.header.getHeight()}this.innerList=this.list.createChild({cls:a+"-inner"});this.innerList.on("mouseover",this.onViewOver,this);this.innerList.on("mousemove",this.onViewMove,this);this.innerList.setWidth(b-this.list.getFrameWidth("lr"));if(this.pageSize){this.footer=this.list.createChild({cls:a+"-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="'+a+'-item">{'+this.displayField+"}</div></tpl>"}this.view=new Ext.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,selectedClass:this.selectedClass,itemSelector:this.itemSelector||"."+a+"-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(e,c,d){this.maxHeight=d-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=c;this.innerList.setWidth(c-this.list.getFrameWidth("lr"));this.restrictHeight()},this);this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px")}}},getStore:function(){return this.store},bindStore:function(a,b){if(this.store&&!b){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("loadexception",this.collapse,this);if(!a){this.store=null;if(this.view){this.view.setStore(null)}}}if(a){this.store=Ext.StoreMgr.lookup(a);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(a)}}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Ext.KeyNav(this.el,{up:function(a){this.inKeyMode=true;this.selectPrev()},down:function(a){if(!this.isExpanded()){this.onTriggerClick()}else{this.inKeyMode=true;this.selectNext()}},enter:function(a){this.onViewClick();this.delayedCheck=true;this.unsetDelayCheck.defer(10,this)},esc:function(a){this.collapse()},tab:function(a){this.onViewClick(false);return true},scope:this,doRelay:function(c,b,a){if(a=="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){Ext.destroy(this.view)}if(this.list){if(this.innerList){this.innerList.un("mouseover",this.onViewOver,this);this.innerList.un("mousemove",this.onViewMove,this)}this.list.destroy()}if(this.dqTask){this.dqTask.cancel();this.dqTask=null}this.bindStore(null);Ext.form.ComboBox.superclass.onDestroy.call(this)},unsetDelayCheck:function(){delete this.delayedCheck},fireKey:function(a){if(a.isNavKeyPress()&&!this.isExpanded()&&!this.delayedCheck){this.fireEvent("specialkey",this,a)}},onResize:function(a,b){Ext.form.ComboBox.superclass.onResize.apply(this,arguments);if(this.list&&this.listWidth===undefined){var c=Math.max(a,this.minListWidth);this.list.setWidth(c);this.innerList.setWidth(c-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(a){if(a==this.editable){return}this.editable=a;if(!a){this.el.dom.setAttribute("readOnly",true);this.el.on("mousedown",this.onTriggerClick,this);this.el.addClass("x-combo-noedit")}else{this.el.dom.removeAttribute("readOnly");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 b=this.store.getAt(0);var c=b.data[this.displayField];var a=c.length;var d=this.getRawValue().length;if(d!=a){this.setRawValue(c);this.selectText(d,c.length)}}},onSelect:function(a,b){if(this.fireEvent("beforeselect",this,a,b)!==false){this.setValue(a.data[this.valueField||this.displayField]);this.collapse();this.fireEvent("select",this,a,b)}},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(a){var c=a;if(this.valueField){var b=this.findRecord(this.valueField,a);if(b){c=b.data[this.displayField]}else{if(this.valueNotFoundText!==undefined){c=this.valueNotFoundText}}}this.lastSelectionText=c;if(this.hiddenField){this.hiddenField.value=a}Ext.form.ComboBox.superclass.setValue.call(this,c);this.value=a},findRecord:function(c,b){var a;if(this.store.getCount()>0){this.store.each(function(d){if(d.data[c]==b){a=d;return false}})}return a},onViewMove:function(b,a){this.inKeyMode=false},onViewOver:function(d,b){if(this.inKeyMode){return}var c=this.view.findItemFromChild(b);if(c){var a=this.view.indexOf(c);this.select(a,false)}},onViewClick:function(b){var a=this.view.getSelectedIndexes()[0];var c=this.store.getAt(a);if(c){this.onSelect(c,a)}if(b!==false){this.el.focus()}},restrictHeight:function(){this.innerList.dom.style.height="";var b=this.innerList.dom;var e=this.list.getFrameWidth("tb")+(this.resizable?this.handleHeight:0)+this.assetHeight;var c=Math.max(b.clientHeight,b.offsetHeight,b.scrollHeight);var a=this.getPosition()[1]-Ext.getBody().getScroll().top;var g=Ext.lib.Dom.getViewHeight()-a-this.getSize().height;var d=Math.max(a,g,this.minHeight||0)-this.list.shadowOffset-e-5;c=Math.min(c,d,this.maxHeight);this.innerList.setHeight(c);this.list.beginUpdate();this.list.setHeight(c+e);this.list.alignTo(this.wrap,this.listAlign);this.list.endUpdate()},onEmptyResults:function(){this.collapse()},isExpanded:function(){return this.list&&this.list.isVisible()},selectByValue:function(a,c){if(a!==undefined&&a!==null){var b=this.findRecord(this.valueField||this.displayField,a);if(b){this.select(this.store.indexOf(b),c);return true}}return false},select:function(a,c){this.selectedIndex=a;this.view.select(a);if(c!==false){var b=this.view.getNode(a);if(b){this.innerList.scrollChildIntoView(b,false)}}},selectNext:function(){var a=this.store.getCount();if(a>0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex<a-1){this.select(this.selectedIndex+1)}}}},selectPrev:function(){var a=this.store.getCount();if(a>0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex!=0){this.select(this.selectedIndex-1)}}}},onKeyUp:function(a){if(this.editable!==false&&!a.isSpecialKey()){this.lastKey=a.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(c,b){if(c===undefined||c===null){c=""}var a={query:c,forceAll:b,combo:this,cancel:false};if(this.fireEvent("beforequery",a)===false||a.cancel){return false}c=a.query;b=a.forceAll;if(b===true||(c.length>=this.minChars)){if(this.lastQuery!==c){this.lastQuery=c;if(this.mode=="local"){this.selectedIndex=-1;if(b){this.store.clearFilter()}else{this.store.filter(this.displayField,c)}this.onLoad()}else{this.store.baseParams[this.queryParam]=c;this.store.load({params:this.getParams(c)});this.expand()}}else{this.selectedIndex=-1;this.onLoad()}}},getParams:function(a){var b={};if(this.pageSize){b.start=0;b.limit=this.pageSize}return b},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(a){if(!a.within(this.wrap)&&!a.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(b,a){Ext.form.Checkbox.superclass.onRender.call(this,b,a);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},afterRender:function(){Ext.form.Checkbox.superclass.afterRender.call(this);this.wrap[this.checked?"addClass":"removeClass"](this.checkedCls)},onDestroy:function(){if(this.rendered){Ext.destroy(this.imageEl,this.labelEl,this.innerWrap,this.wrap)}Ext.form.Checkbox.superclass.onDestroy.call(this)},onFocus:function(a){Ext.form.Checkbox.superclass.onFocus.call(this,a);this.el.addClass(this.focusCls)},onBlur:function(a){Ext.form.Checkbox.superclass.onBlur.call(this,a);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(a){if(a.getKey()==Ext.EventObject.SPACE){this.onClick(a)}},onClick:function(a){if(!this.disabled&&!this.readOnly){this.toggleValue()}a.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 this.checked},setValue:function(a){var b=this.checked;this.checked=(a===true||a==="true"||a=="1"||String(a).toLowerCase()=="on");if(this.rendered){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked;this.wrap[this.checked?"addClass":"removeClass"](this.checkedCls)}if(b!=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(k,g){if(!this.el){var q={cls:this.groupCls,layout:"column",border:false,renderTo:k};var a={defaultType:this.defaultType,layout:"form",border:false,defaults:{hideLabel:true,anchor:"100%"}};if(this.items[0].items){Ext.apply(q,{layoutConfig:{columns:this.items.length},defaults:this.defaults,items:this.items});for(var e=0,n=this.items.length;e<n;e++){Ext.applyIf(this.items[e],a)}}else{var d,o=[];if(typeof this.columns=="string"){this.columns=this.items.length}if(!Ext.isArray(this.columns)){var m=[];for(var e=0;e<this.columns;e++){m.push((100/this.columns)*0.01)}this.columns=m}d=this.columns.length;for(var e=0;e<d;e++){var b=Ext.apply({items:[]},a);b[this.columns[e]<=1?"columnWidth":"width"]=this.columns[e];if(this.defaults){b.defaults=Ext.apply(b.defaults||{},this.defaults)}o.push(b)}if(this.vertical){var s=Math.ceil(this.items.length/d),p=0;for(var e=0,n=this.items.length;e<n;e++){if(e>0&&e%s==0){p++}if(this.items[e].fieldLabel){this.items[e].hideLabel=false}o[p].items.push(this.items[e])}}else{for(var e=0,n=this.items.length;e<n;e++){var r=e%d;if(this.items[e].fieldLabel){this.items[e].hideLabel=false}o[r].items.push(this.items[e])}}Ext.apply(q,{layoutConfig:{columns:d},items:o})}this.panel=new Ext.Panel(q);this.el=this.panel.getEl();if(this.forId&&this.itemCls){var c=this.el.up(this.itemCls).child("label",true);if(c){c.setAttribute("htmlFor",this.forId)}}var h=this.panel.findBy(function(i){return i.isFormField},this);this.items=new Ext.util.MixedCollection();this.items.addAll(h)}Ext.form.CheckboxGroup.superclass.onRender.call(this,k,g)},validateValue:function(a){if(!this.allowBlank){var b=true;this.items.each(function(c){if(c.checked){return b=false}},this);if(b){this.markInvalid(this.blankText);return false}}return true},onDisable:function(){this.items.each(function(a){a.disable()})},onEnable:function(){this.items.each(function(a){a.enable()})},onResize:function(a,b){this.panel.setSize(a,b);this.panel.doLayout()},reset:function(){Ext.form.CheckboxGroup.superclass.reset.call(this);this.items.each(function(a){if(a.reset){a.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 a=this.getParent().child("input[name="+this.el.dom.name+"]:checked",true);return a?a.value:null},getParent:function(){return this.el.up("form")||Ext.getBody()},toggleValue:function(){if(!this.checked){var a=this.getParent().select("input[name="+this.el.dom.name+"]");a.each(function(b){if(b.dom.id==this.id){this.setValue(true)}else{Ext.getCmp(b.dom.id).setValue(false)}},this)}},setValue:function(a){if(typeof a=="boolean"){Ext.form.Radio.superclass.setValue.call(this,a)}else{var b=this.getParent().child("input[name="+this.el.dom.name+"][value="+a+"]",true);if(b&&!b.checked){Ext.getCmp(b.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(b,a){Ext.apply(this,a);this.items=new Ext.util.MixedCollection(false,function(c){return c.id||(c.id=Ext.id())});this.addEvents("beforeaction","actionfailed","actioncomplete");if(b){this.initEl(b)}Ext.form.BasicForm.superclass.constructor.call(this)};Ext.extend(Ext.form.BasicForm,Ext.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,initEl:function(a){this.el=Ext.get(a);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(a){a.stopEvent()},destroy:function(){this.items.each(function(a){Ext.destroy(a)});if(this.el){this.el.removeAllListeners();this.el.remove()}this.purgeListeners()},isValid:function(){var a=true;this.items.each(function(b){if(!b.validate()){a=false}});return a},isDirty:function(){var a=false;this.items.each(function(b){if(b.isDirty()){a=true;return false}});return a},doAction:function(b,a){if(typeof b=="string"){b=new Ext.form.Action.ACTION_TYPES[b](this,a)}if(this.fireEvent("beforeaction",this,b)!==false){this.beforeAction(b);b.run.defer(100,b)}return this},submit:function(b){if(this.standardSubmit){var a=this.isValid();if(a){this.el.dom.submit()}return a}this.doAction("submit",b);return this},load:function(a){this.doAction("load",a);return this},updateRecord:function(b){b.beginEdit();var a=b.fields;a.each(function(c){var d=this.findField(c.name);if(d){b.set(c.name,d.getValue())}},this);b.endEdit();return this},loadRecord:function(a){this.setValues(a.data);return this},beforeAction:function(a){var b=a.options;if(b.waitMsg){if(this.waitMsgTarget===true){this.el.mask(b.waitMsg,"x-mask-loading")}else{if(this.waitMsgTarget){this.waitMsgTarget=Ext.get(this.waitMsgTarget);this.waitMsgTarget.mask(b.waitMsg,"x-mask-loading")}else{Ext.MessageBox.wait(b.waitMsg,b.waitTitle||this.waitTitle||"Please Wait...")}}}},afterAction:function(a,c){this.activeAction=null;var b=a.options;if(b.waitMsg){if(this.waitMsgTarget===true){this.el.unmask()}else{if(this.waitMsgTarget){this.waitMsgTarget.unmask()}else{Ext.MessageBox.updateProgress(1);Ext.MessageBox.hide()}}}if(c){if(b.reset){this.reset()}Ext.callback(b.success,b.scope,[this,a]);this.fireEvent("actioncomplete",this,a)}else{Ext.callback(b.failure,b.scope,[this,a]);this.fireEvent("actionfailed",this,a)}},findField:function(b){var a=this.items.get(b);if(!a){this.items.each(function(c){if(c.isFormField&&(c.dataIndex==b||c.id==b||c.getName()==b)){a=c;return false}})}return a||null},markInvalid:function(h){if(Ext.isArray(h)){for(var c=0,a=h.length;c<a;c++){var b=h[c];var d=this.findField(b.id);if(d){d.markInvalid(b.msg)}}}else{var e,g;for(g in h){if(typeof h[g]!="function"&&(e=this.findField(g))){e.markInvalid(h[g])}}}return this},setValues:function(c){if(Ext.isArray(c)){for(var d=0,a=c.length;d<a;d++){var b=c[d];var e=this.findField(b.id);if(e){e.setValue(b.value);if(this.trackResetOnLoad){e.originalValue=e.getValue()}}}}else{var g,h;for(h in c){if(typeof c[h]!="function"&&(g=this.findField(h))){g.setValue(c[h]);if(this.trackResetOnLoad){g.originalValue=g.getValue()}}}}return this},getValues:function(b){var a=Ext.lib.Ajax.serializeForm(this.el.dom);if(b===true){return a}return Ext.urlDecode(a)},clearInvalid:function(){this.items.each(function(a){a.clearInvalid()});return this},reset:function(){this.items.each(function(a){a.reset()});return this},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this},remove:function(a){this.items.remove(a);return this},render:function(){this.items.each(function(a){if(a.isFormField&&!a.rendered&&document.getElementById(a.id)){a.applyToMarkup(a.id)}});return this},applyToFields:function(a){this.items.each(function(b){Ext.apply(b,a)});return this},applyIfToFields:function(a){this.items.each(function(b){Ext.applyIf(b,a)});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.initItems();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 c=this.form;var a=this;var b=function(d){if(d.isFormField){c.add(d)}else{if(d.doLayout&&d!=a){Ext.applyIf(d,{labelAlign:d.ownerCt.labelAlign,labelWidth:d.ownerCt.labelWidth,itemCls:d.ownerCt.itemCls});if(d.items){d.items.each(b)}}}};this.items.each(b)},getLayoutTarget:function(){return this.form.el},getForm:function(){return this.form},onRender:function(b,a){this.initFields();Ext.FormPanel.superclass.onRender.call(this,b,a);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(a,b){if(b.isFormField){this.form.add(b)}},onRemove:function(a){if(a.isFormField){Ext.destroy(a.container.up(".x-form-item"));this.form.remove(a)}},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 d=true;this.form.items.each(function(e){if(!e.isValid(true)){d=false;return false}});if(this.buttons){for(var c=0,a=this.buttons.length;c<a;c++){var b=this.buttons[c];if(b.formBind===true&&b.disabled===d){b.setDisabled(!d)}}}this.fireEvent("clientvalidation",this,d)}});Ext.reg("form",Ext.FormPanel);Ext.form.FormPanel=Ext.FormPanel;Ext.form.FieldSet=Ext.extend(Ext.Panel,{baseCls:"x-fieldset",layout:"form",animCollapse:false,onRender:function(b,a){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,b,a);if(this.checkboxToggle){var c=typeof this.checkboxToggle=="object"?this.checkboxToggle:{tag:"input",type:"checkbox",name:this.checkboxName||this.id+"-checkbox"};this.checkbox=this.header.insertFirst(c);this.checkbox.dom.checked=!this.collapsed;this.checkbox.on("click",this.onCheckClick,this)}},onCollapse:function(a,b){if(this.checkbox){this.checkbox.dom.checked=false}Ext.form.FieldSet.superclass.onCollapse.call(this,a,b)},onExpand:function(a,b){if(this.checkbox){this.checkbox.dom.checked=true}Ext.form.FieldSet.superclass.onExpand.call(this,a,b)},onCheckClick:function(){this[this.checkbox.dom.checked?"expand":"collapse"]()},beforeDestroy:function(){if(this.checkbox){this.checkbox.un("click",this.onCheckClick,this)}Ext.form.FieldSet.superclass.beforeDestroy.call(this)}});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 d=[],b=this.fontFamilies,c,g;for(var e=0,a=b.length;e<a;e++){c=b[e];g=c.toLowerCase();d.push('<option value="',g,'" style="font-family:',c,';"',(this.defaultFont==g?' selected="true">':">"),c,"</option>")}return d.join("")},createToolbar:function(d){var a=Ext.QuickTips&&Ext.QuickTips.isEnabled();function c(h,e,g){return{itemId:h,cls:"x-btn-icon x-edit-"+h,enableToggle:e!==false,scope:d,handler:g||d.relayBtnCmd,clickEvent:"mousedown",tooltip:a?d.buttonTips[h]||undefined:undefined,tabIndex:-1}}var b=new Ext.Toolbar({renderTo:this.wrap.dom.firstChild});b.el.on("click",function(g){g.preventDefault()});if(this.enableFont&&!Ext.isSafari2){this.fontSelect=b.el.createChild({tag:"select",cls:"x-font-select",html:this.createFontOptions()});this.fontSelect.on("change",function(){var e=this.fontSelect.dom.value;this.relayCmd("fontname",e);this.deferFocus()},this);b.add(this.fontSelect.dom,"-")}if(this.enableFormat){b.add(c("bold"),c("italic"),c("underline"))}if(this.enableFontSize){b.add("-",c("increasefontsize",false,this.adjustFont),c("decreasefontsize",false,this.adjustFont))}if(this.enableColors){b.add("-",{itemId:"forecolor",cls:"x-btn-icon x-edit-forecolor",clickEvent:"mousedown",tooltip:a?d.buttonTips.forecolor||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({allowReselect:true,focus:Ext.emptyFn,value:"000000",plain:true,selectHandler:function(g,e){this.execCmd("forecolor",Ext.isSafari||Ext.isIE?"#"+e:e);this.deferFocus()},scope:this,clickEvent:"mousedown"})},{itemId:"backcolor",cls:"x-btn-icon x-edit-backcolor",clickEvent:"mousedown",tooltip:a?d.buttonTips.backcolor||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({focus:Ext.emptyFn,value:"FFFFFF",plain:true,allowReselect:true,selectHandler:function(g,e){if(Ext.isGecko){this.execCmd("useCSS",false);this.execCmd("hilitecolor",e);this.execCmd("useCSS",true);this.deferFocus()}else{this.execCmd(Ext.isOpera?"hilitecolor":"backcolor",Ext.isSafari||Ext.isIE?"#"+e:e);this.deferFocus()}},scope:this,clickEvent:"mousedown"})})}if(this.enableAlignments){b.add("-",c("justifyleft"),c("justifycenter"),c("justifyright"))}if(!Ext.isSafari2){if(this.enableLinks){b.add("-",c("createlink",false,this.createLink))}if(this.enableLists){b.add("-",c("insertorderedlist"),c("insertunorderedlist"))}if(this.enableSourceEdit){b.add("-",c("sourceedit",true,function(e){this.toggleSourceEdit(e.pressed)}))}}this.tb=b},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(b,a){Ext.form.HtmlEditor.superclass.onRender.call(this,b,a);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(e){if(e.itemId!="sourceedit"){e.disable()}});var c=document.createElement("iframe");c.name=Ext.id();c.frameBorder="0";c.src=Ext.isIE?Ext.SSL_SECURE_URL:"javascript:;";this.wrap.dom.appendChild(c);this.iframe=c;this.initFrame();if(this.autoMonitorDesignMode!==false){this.monitorTask=Ext.TaskMgr.start({run:this.checkDesignMode,scope:this,interval:100})}if(!this.width){var d=this.el.getSize();this.setSize(d.width,this.height||d.height)}},initFrame:function(){this.doc=this.getDoc();this.win=this.getWin();this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var a={run:function(){if(this.doc.body||this.doc.readyState=="complete"){Ext.TaskMgr.stop(a);this.doc.designMode="on";this.initEditor.defer(10,this)}},interval:10,duration:10000,scope:this};Ext.TaskMgr.start(a)},checkDesignMode:function(){if(this.wrap&&this.wrap.dom.offsetWidth){var a=this.getDoc();if(!a){return}if(!a.editorInitialized||String(a.designMode).toLowerCase()!="on"){this.initFrame()}}},onResize:function(b,c){Ext.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(typeof b=="number"){var d=b-this.wrap.getFrameWidth("lr");this.el.setWidth(this.adjustWidth("textarea",d));this.iframe.style.width=Math.max(d,0)+"px"}if(typeof c=="number"){var a=c-this.wrap.getFrameWidth("tb")-this.tb.el.getHeight();this.el.setHeight(this.adjustWidth("textarea",a));this.iframe.style.height=Math.max(a,0)+"px";if(this.doc){this.getEditorBody().style.height=Math.max((a-(this.iframePad*2)),0)+"px"}}}},toggleSourceEdit:function(a){if(a===undefined){a=!this.sourceEditMode}this.sourceEditMode=a===true;var c=this.tb.items.get("sourceedit");if(c.pressed!==this.sourceEditMode){c.toggle(this.sourceEditMode);return}if(this.sourceEditMode){this.tb.items.each(function(d){if(d.itemId!="sourceedit"){d.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(d){d.enable()})}this.pushValue();this.iframe.className="";this.el.addClass("x-hidden");this.el.dom.setAttribute("tabIndex",-1);this.deferFocus()}var b=this.lastSize;if(b){delete this.lastSize;this.setSize(b)}this.fireEvent("editmodechange",this,this.sourceEditMode)},createLink:function(){var a=prompt(this.createLinkText,this.defaultLinkValue);if(a&&a!="http://"){this.relayCmd("createlink",a)}},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(a){Ext.form.HtmlEditor.superclass.setValue.call(this,a);this.pushValue()},cleanHtml:function(a){a=String(a);if(a.length>5){if(Ext.isSafari){a=a.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,"")}}if(a=="&nbsp;"){a=""}return a},syncValue:function(){if(this.initialized){var d=this.getEditorBody();var c=d.innerHTML;if(Ext.isSafari){var b=d.getAttribute("style");var a=b.match(/text-align:(.*?);/i);if(a&&a[1]){c='<div style="'+a[0]+'">'+c+"</div>"}}c=this.cleanHtml(c);if(this.fireEvent("beforesync",this,c)!==false){this.el.dom.value=c;this.fireEvent("sync",this,c)}}},getValue:function(){this.syncValue();return Ext.form.HtmlEditor.superclass.getValue.call(this)},pushValue:function(){if(this.initialized){var a=this.el.dom.value;if(!this.activated&&a.length<1){a="&nbsp;"}if(this.fireEvent("beforepush",this,a)!==false){this.getEditorBody().innerHTML=a;this.fireEvent("push",this,a)}}},deferFocus:function(){this.focus.defer(10,this)},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus()}else{this.el.focus()}},initEditor:function(){var b=this.getEditorBody();var a=this.el.getStyles("font-size","font-family","background-image","background-repeat");a["background-attachment"]="fixed";b.bgProperties="fixed";Ext.DomHelper.applyStyles(b,a);if(this.doc){try{Ext.EventManager.removeAll(this.doc)}catch(c){}}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(a){if(a.menu){a.menu.removeAll();if(a.menu.el){a.menu.el.destroy()}}a.destroy()});this.wrap.dom.innerHTML="";this.wrap.remove()}},onFirstFocus:function(){this.activated=true;this.tb.items.each(function(d){d.enable()});if(Ext.isGecko){this.win.focus();var a=this.win.getSelection();if(!a.focusNode||a.focusNode.nodeType!=3){var b=a.getRangeAt(0);b.selectNodeContents(this.getEditorBody());b.collapse(true);this.deferFocus()}try{this.execCmd("useCSS",true);this.execCmd("styleWithCSS",false)}catch(c){}}this.fireEvent("activate",this)},adjustFont:function(b){var c=b.itemId=="increasefontsize"?1:-1;var a=parseInt(this.doc.queryCommandValue("FontSize")||2,10);if(Ext.isSafari3||Ext.isAir){if(a<=10){a=1+c}else{if(a<=13){a=2+c}else{if(a<=16){a=3+c}else{if(a<=18){a=4+c}else{if(a<=24){a=5+c}else{a=6+c}}}}}a=a.constrain(1,6)}else{if(Ext.isSafari){c*=2}a=Math.max(1,a+c)+(Ext.isSafari?"px":0)}this.execCmd("FontSize",a)},onEditorEvent:function(a){this.updateToolbar()},updateToolbar:function(){if(!this.activated){this.onFirstFocus();return}var b=this.tb.items.map,c=this.doc;if(this.enableFont&&!Ext.isSafari2){var a=(this.doc.queryCommandValue("FontName")||this.defaultFont).toLowerCase();if(a!=this.fontSelect.dom.value){this.fontSelect.dom.value=a}}if(this.enableFormat){b.bold.toggle(c.queryCommandState("bold"));b.italic.toggle(c.queryCommandState("italic"));b.underline.toggle(c.queryCommandState("underline"))}if(this.enableAlignments){b.justifyleft.toggle(c.queryCommandState("justifyleft"));b.justifycenter.toggle(c.queryCommandState("justifycenter"));b.justifyright.toggle(c.queryCommandState("justifyright"))}if(!Ext.isSafari2&&this.enableLists){b.insertorderedlist.toggle(c.queryCommandState("insertorderedlist"));b.insertunorderedlist.toggle(c.queryCommandState("insertunorderedlist"))}Ext.menu.MenuMgr.hideAll();this.syncValue()},relayBtnCmd:function(a){this.relayCmd(a.itemId)},relayCmd:function(b,a){(function(){this.focus();this.execCmd(b,a);this.updateToolbar()}).defer(10,this)},execCmd:function(b,a){this.doc.execCommand(b,false,a===undefined?null:a);this.syncValue()},applyCommand:function(b){if(b.ctrlKey){var d=b.getCharCode(),a;if(d>0){d=String.fromCharCode(d);switch(d){case"b":a="bold";break;case"i":a="italic";break;case"u":a="underline";break}if(a){this.win.focus();this.execCmd(a);this.deferFocus();b.preventDefault()}}}},insertAtCursor:function(b){if(!this.activated){return}if(Ext.isIE){this.win.focus();var a=this.doc.selection.createRange();if(a){a.collapse(true);a.pasteHTML(b);this.syncValue();this.deferFocus()}}else{if(Ext.isGecko||Ext.isOpera){this.win.focus();this.execCmd("InsertHTML",b);this.deferFocus()}else{if(Ext.isSafari){this.execCmd("InsertText",b);this.deferFocus()}}}},fixKeys:function(){if(Ext.isIE){return function(d){var a=d.getKey(),b;if(a==d.TAB){d.stopEvent();b=this.doc.selection.createRange();if(b){b.collapse(true);b.pasteHTML("&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}else{if(a==d.ENTER){b=this.doc.selection.createRange();if(b){var c=b.parentElement();if(!c||c.tagName.toLowerCase()!="li"){d.stopEvent();b.pasteHTML("<br />");b.collapse(false);b.select()}}}}}}else{if(Ext.isOpera){return function(b){var a=b.getKey();if(a==b.TAB){b.stopEvent();this.win.focus();this.execCmd("InsertHTML","&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}}else{if(Ext.isSafari){return function(b){var a=b.getKey();if(a==b.TAB){b.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 b=this.parseDate(this.minValue);if(!b){b=new Date(this.initDate).clearTime()}var a=this.parseDate(this.maxValue);if(!a){a=new Date(this.initDate).clearTime().add("mi",(24*60)-1)}var c=[];while(b<=a){c.push([b.dateFormat(this.format)]);b=b.add("mi",this.increment)}this.store=new Ext.data.SimpleStore({fields:["text"],data:c});this.displayField="text"}},getValue:function(){var a=Ext.form.TimeField.superclass.getValue.call(this);return this.formatDate(this.parseDate(a))||""},setValue:function(a){Ext.form.TimeField.superclass.setValue.call(this,this.formatDate(this.parseDate(a)))},validateValue:Ext.form.DateField.prototype.validateValue,parseDate:Ext.form.DateField.prototype.parseDate,formatDate:Ext.form.DateField.prototype.formatDate,beforeBlur:function(){var a=this.parseDate(this.getRawValue());if(a){this.setValue(a.dateFormat(this.format))}}});Ext.reg("timefield",Ext.form.TimeField);Ext.form.Label=Ext.extend(Ext.BoxComponent,{onRender:function(b,a){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("for",this.forId)}}Ext.form.Label.superclass.onRender.call(this,b,a)},setText:function(a,b){this.text=a;if(this.rendered){this.el.dom.innerHTML=b!==false?Ext.util.Format.htmlEncode(a):a}return this}});Ext.reg("label",Ext.form.Label);Ext.form.Action=function(b,a){this.form=b;this.options=a||{}};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(a){},success:function(a){},handleResponse:function(a){},failure:function(a){this.response=a;this.failureType=Ext.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false)},processResponse:function(a){this.response=a;if(!a.responseText){return true}this.result=this.handleResponse(a);return this.result},getUrl:function(c){var a=this.options.url||this.form.url||this.form.el.dom.action;if(c){var b=this.getParams();if(b){a+=(a.indexOf("?")!=-1?"&":"?")+b}}return a},getMethod:function(){return(this.options.method||this.form.method||this.form.el.dom.method||"POST").toUpperCase()},getParams:function(){var a=this.form.baseParams;var b=this.options.params;if(b){if(typeof b=="object"){b=Ext.urlEncode(Ext.applyIf(b,a))}else{if(typeof b=="string"&&a){b+="&"+Ext.urlEncode(a)}}}else{if(a){b=Ext.urlEncode(a)}}return b},createCallback:function(a){var a=a||{};return{success:this.success,failure:this.failure,scope:this,timeout:(a.timeout*1000)||(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined}}};Ext.form.Action.Submit=function(b,a){Ext.form.Action.Submit.superclass.constructor.call(this,b,a)};Ext.extend(Ext.form.Action.Submit,Ext.form.Action,{type:"submit",run:function(){var b=this.options;var c=this.getMethod();var a=c=="GET";if(b.clientValidation===false||this.form.isValid()){Ext.Ajax.request(Ext.apply(this.createCallback(b),{form:this.form.el.dom,url:this.getUrl(a),method:c,headers:b.headers,params:!a?this.getParams():null,isUpload:this.form.fileUpload}))}else{if(b.clientValidation!==false){this.failureType=Ext.form.Action.CLIENT_INVALID;this.form.afterAction(this,false)}}},success:function(b){var a=this.processResponse(b);if(a===true||a.success){this.form.afterAction(this,true);return}if(a.errors){this.form.markInvalid(a.errors);this.failureType=Ext.form.Action.SERVER_INVALID}this.form.afterAction(this,false)},handleResponse:function(c){if(this.form.errorReader){var b=this.form.errorReader.read(c);var g=[];if(b.records){for(var d=0,a=b.records.length;d<a;d++){var e=b.records[d];g[d]=e.data}}if(g.length<1){g=null}return{success:b.success,errors:g}}return Ext.decode(c.responseText)}});Ext.form.Action.Load=function(b,a){Ext.form.Action.Load.superclass.constructor.call(this,b,a);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(b){var a=this.processResponse(b);if(a===true||!a.success||!a.data){this.failureType=Ext.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return}this.form.clearInvalid();this.form.setValues(a.data);this.form.afterAction(this,true)},handleResponse:function(b){if(this.form.reader){var a=this.form.reader.read(b);var c=a.records&&a.records[0]?a.records[0].data:null;return{success:a.success,data:c}}return Ext.decode(b.responseText)}});Ext.form.Action.ACTION_TYPES={load:Ext.form.Action.Load,submit:Ext.form.Action.Submit};Ext.form.VTypes=function(){var c=/^[a-zA-Z_]+$/;var d=/^[a-zA-Z0-9_]+$/;var b=/^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/;var a=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return{email:function(e){return b.test(e)},emailText:'This field should be an e-mail address in the format "user@domain.com"',emailMask:/[a-z0-9_\.\-@]/i,url:function(e){return a.test(e)},urlText:'This field should be a URL in the format "http://www.domain.com"',alpha:function(e){return c.test(e)},alphaText:"This field should only contain letters and _",alphaMask:/[a-z_]/i,alphanum:function(e){return d.test(e)},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(d,a){Ext.grid.GridPanel.superclass.onRender.apply(this,arguments);var e=this.body;this.el.addClass("x-grid-panel");var b=this.getView();b.init(this);e.on("mousedown",this.onMouseDown,this);e.on("click",this.onClick,this);e.on("dblclick",this.onDblClick,this);e.on("contextmenu",this.onContextMenu,this);e.on("keydown",this.onKeyDown,this);this.relayEvents(e,["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(h){var b=this.colModel;var g=h.columns;if(g){for(var d=0,a=g.length;d<a;d++){var e=g[d];var l=b.getColumnById(e.id);if(l){l.hidden=e.hidden;l.width=e.width;var k=b.getIndexById(e.id);if(k!=d){b.moveColumn(k,d)}}}}if(h.sort){this.store[this.store.remoteSort?"setDefaultSort":"sort"](h.sort.field,h.sort.direction)}},getState:function(){var d={columns:[]};for(var b=0,e;e=this.colModel.config[b];b++){d.columns[b]={id:e.id,width:e.width};if(e.hidden){d.columns[b].hidden=true}}var a=this.store.getSortState();if(a){d.sort=a}return d},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(a,b){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Ext.LoadMask(this.bwrap,Ext.apply({store:a},this.initialConfig.loadMask))}this.view.bind(a,b);this.store=a;this.colModel=b;if(this.rendered){this.view.refresh(true)}},onKeyDown:function(a){this.fireEvent("keydown",a)},onDestroy:function(){if(this.rendered){if(this.loadMask){this.loadMask.destroy()}var a=this.body;a.removeAllListeners();this.view.destroy();a.update("")}this.colModel.purgeListeners();Ext.grid.GridPanel.superclass.onDestroy.call(this)},processEvent:function(c,g){this.fireEvent(c,g);var d=g.getTarget();var b=this.view;var i=b.findHeaderIndex(d);if(i!==false){this.fireEvent("header"+c,this,i,g)}else{var h=b.findRowIndex(d);var a=b.findCellIndex(d);if(h!==false){this.fireEvent("row"+c,this,h,g);if(a!==false){this.fireEvent("cell"+c,this,h,a,g)}}}},onClick:function(a){this.processEvent("click",a)},onMouseDown:function(a){this.processEvent("mousedown",a)},onContextMenu:function(b,a){this.processEvent("contextmenu",b)},onDblClick:function(a){this.processEvent("dblclick",a)},walkCells:function(l,c,b,e,k){var i=this.colModel,g=i.getColumnCount();var a=this.store,h=a.getCount(),d=true;if(b<0){if(c<0){l--;d=false}while(l>=0){if(!d){c=g-1}d=false;while(c>=0){if(e.call(k||this,l,c,i)===true){return[l,c]}c--}l--}}else{if(c>=g){l++;d=false}while(l<h){if(!d){c=0}d=false;while(c<g){if(e.call(k||this,l,c,i)===true){return[l,c]}c++}l++}}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:Ext.emptyFn,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 a=this.selModel.getCount();return String.format(this.ddText,a,a==1?"":"s")}});Ext.reg("grid",Ext.grid.GridPanel);Ext.grid.GridView=function(a){Ext.apply(this,a);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 c=this.templates||{};if(!c.master){c.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(!c.header){c.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(!c.hcell){c.hcell=new Ext.Template('<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id} {css}" 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(!c.body){c.body=new Ext.Template("{rows}")}if(!c.row){c.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(!c.cell){c.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 a in c){var b=c[a];if(b&&typeof b.compile=="function"&&!b.compiled){b.disableFormats=true;b.compile()}}this.templates=c;this.colRe=new RegExp("x-grid3-td-([^\\s]+)","")},fly:function(a){if(!this._flyweight){this._flyweight=new Ext.Element.Flyweight(document.body)}this._flyweight.dom=a;return this._flyweight},getEditorParent:function(){return this.scroller.dom},initElements:function(){var c=Ext.Element;var b=this.grid.getGridEl().dom.firstChild;var a=b.childNodes;this.el=new c(b);this.mainWrap=new c(a[0]);this.mainHd=new c(this.mainWrap.dom.firstChild);if(this.grid.hideHeaders){this.mainHd.setDisplayed(false)}this.innerHd=this.mainHd.dom.firstChild;this.scroller=new c(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new c(this.scroller.dom.firstChild);this.focusEl=new c(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new c(a[1]);this.resizeProxy=new c(a[2])},getRows:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},findCell:function(a){if(!a){return false}return this.fly(a).findParent(this.cellSelector,this.cellSelectorDepth)},findCellIndex:function(c,b){var a=this.findCell(c);if(a&&(!b||this.fly(a).hasClass(b))){return this.getCellIndex(a)}return false},getCellIndex:function(b){if(b){var a=b.className.match(this.colRe);if(a&&a[1]){return this.cm.getIndexById(a[1])}}return false},findHeaderCell:function(b){var a=this.findCell(b);return a&&this.fly(a).hasClass(this.hdCls)?a:null},findHeaderIndex:function(a){return this.findCellIndex(a,this.hdCls)},findRow:function(a){if(!a){return false}return this.fly(a).findParent(this.rowSelector,this.rowSelectorDepth)},findRowIndex:function(a){var b=this.findRow(a);return b?b.rowIndex:false},getRow:function(a){return this.getRows()[a]},getCell:function(b,a){return this.getRow(b).getElementsByTagName("td")[a]},getHeaderCell:function(a){return this.mainHd.dom.getElementsByTagName("td")[a]},addRowClass:function(c,a){var b=this.getRow(c);if(b){this.fly(b).addClass(a)}},removeRowClass:function(c,a){var b=this.getRow(c);if(b){this.fly(b).removeClass(a)}},removeRow:function(a){Ext.removeNode(this.getRow(a));this.syncFocusEl(a)},removeRows:function(c,a){var b=this.mainBody.dom;for(var d=c;d<=a;d++){Ext.removeNode(b.childNodes[c])}this.syncFocusEl(c)},getScrollState:function(){var a=this.scroller.dom;return{left:a.scrollLeft,top:a.scrollTop}},restoreScroll:function(a){var b=this.scroller.dom;b.scrollLeft=a.left;b.scrollTop=a.top},scrollToTop:function(){this.scroller.dom.scrollTop=0;this.scroller.dom.scrollLeft=0},syncScroll:function(){this.syncHeaderScroll();var a=this.scroller.dom;this.grid.fireEvent("bodyscroll",a.scrollLeft,a.scrollTop)},syncHeaderScroll:function(){var a=this.scroller.dom;this.innerHd.scrollLeft=a.scrollLeft;this.innerHd.scrollLeft=a.scrollLeft},updateSortIcon:function(b,a){var d=this.sortClasses;var c=this.mainHd.select("td").removeClass(d);c.item(b).addClass(d[a=="DESC"?1:0])},updateAllColumnWidths:function(){var d=this.getTotalWidth();var l=this.cm.getColumnCount();var g=[];for(var b=0;b<l;b++){g[b]=this.getColumnWidth(b)}this.innerHd.firstChild.firstChild.style.width=d;for(var b=0;b<l;b++){var c=this.getHeaderCell(b);c.style.width=g[b]}var h=this.getRows(),m,k;for(var b=0,e=h.length;b<e;b++){m=h[b];m.style.width=d;if(m.firstChild){m.firstChild.style.width=d;k=m.firstChild.rows[0];for(var a=0;a<l;a++){k.childNodes[a].style.width=g[a]}}}this.onAllColumnWidthsUpdated(g,d)},updateColumnWidth:function(b,a){var k=this.getColumnWidth(b);var e=this.getTotalWidth();this.innerHd.firstChild.firstChild.style.width=e;var d=this.getHeaderCell(b);d.style.width=k;var h=this.getRows(),l;for(var c=0,g=h.length;c<g;c++){l=h[c];l.style.width=e;if(l.firstChild){l.firstChild.style.width=e;l.firstChild.rows[0].childNodes[b].style.width=k}}this.onColumnWidthUpdated(b,k,e)},updateColumnHidden:function(a,e){var d=this.getTotalWidth();this.innerHd.firstChild.firstChild.style.width=d;var h=e?"none":"";var c=this.getHeaderCell(a);c.style.display=h;var k=this.getRows(),l;for(var b=0,g=k.length;b<g;b++){l=k[b];l.style.width=d;if(l.firstChild){l.firstChild.style.width=d;l.firstChild.rows[0].childNodes[a].style.display=h}}this.onColumnHiddenUpdated(a,e,d);delete this.lastViewWidth;this.layout()},doRender:function(g,k,s,a,q,w){var b=this.templates,e=b.cell,h=b.row,l=q-1;var d="width:"+this.getTotalWidth()+";";var z=[],t,A,u={},m={tstyle:d},o;for(var v=0,y=k.length;v<y;v++){o=k[v];t=[];var n=(v+a);for(var x=0;x<q;x++){A=g[x];u.id=A.id;u.css=x==0?"x-grid3-cell-first ":(x==l?"x-grid3-cell-last ":"");u.attr=u.cellAttr="";u.value=A.renderer(o.data[A.name],u,o,n,x,s);u.style=A.style;if(u.value==undefined||u.value===""){u.value="&#160;"}if(o.dirty&&typeof o.modified[A.name]!=="undefined"){u.css+=" x-grid3-dirty-cell"}t[t.length]=e.apply(u)}var B=[];if(w&&((n+1)%2==0)){B[0]="x-grid3-row-alt"}if(o.dirty){B[1]=" x-grid3-dirty-row"}m.cols=q;if(this.getRowClass){B[2]=this.getRowClass(o,n,m,s)}m.alt=B.join(" ");m.cells=t.join("");z[z.length]=h.apply(m)}return z.join("")},processRows:function(e,d){if(this.ds.getCount()<1){return}d=d||!this.grid.stripeRows;e=e||0;var l=this.getRows();var g=" x-grid3-row-alt ";l[0].className+=" x-grid3-row-first";l[l.length-1].className+=" x-grid3-row-last";for(var b=e,c=l.length;b<c;b++){var k=l[b];k.rowIndex=b;if(!d){var a=((b+1)%2==0);var h=(" "+k.className+" ").indexOf(g)!=-1;if(a==h){continue}if(a){k.className+=" x-grid3-row-alt"}else{k.className=k.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 d=this.renderHeaders();var a=this.templates.body.apply({rows:""});var b=this.templates.master.apply({body:a,header:d});var c=this.grid;c.getGridEl().dom.innerHTML=b;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(c.enableColumnResize!==false){this.splitZone=new Ext.grid.GridView.SplitDragZone(c,this.mainHd.dom)}if(c.enableColumnMove){this.columnDrag=new Ext.grid.GridView.ColumnDragZone(c,this.innerHd);this.columnDrop=new Ext.grid.HeaderDropZone(c,this.mainHd.dom)}if(c.enableHdMenu!==false){if(c.enableColumnHide!==false){this.colMenu=new Ext.menu.Menu({id:c.id+"-hcols-menu"});this.colMenu.on("beforeshow",this.beforeColMenuShow,this);this.colMenu.on("itemclick",this.handleHdMenuClick,this)}this.hmenu=new Ext.menu.Menu({id:c.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(c.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(c.trackMouseOver){this.mainBody.on("mouseover",this.onRowOver,this);this.mainBody.on("mouseout",this.onRowOut,this)}if(c.enableDragDrop||c.enableDrag){this.dragZone=new Ext.grid.GridDragZone(c,{ddGroup:c.ddGroup||"GridDD"})}this.updateHeaderSortState()},layout:function(){if(!this.mainBody){return}var d=this.grid;var i=d.getGridEl();var a=i.getSize(true);var b=a.width;if(b<20||a.height<20){return}if(d.autoHeight){this.scroller.dom.style.overflow="visible";if(Ext.isSafari){this.scroller.dom.style.position="static"}}else{this.el.setSize(a.width,a.height);var h=this.mainHd.getHeight();var e=a.height-(h);this.scroller.setSize(b,e);if(this.innerHd){this.innerHd.style.width=(b)+"px"}}if(this.forceFit){if(this.lastViewWidth!=b){this.fitColumns(false,false);this.lastViewWidth=b}}else{this.autoExpand();this.syncHeaderScroll()}this.onLayout(b,e)},onLayout:function(a,b){},onColumnWidthUpdated:function(c,a,b){this.focusEl.setWidth(b)},onAllColumnWidthsUpdated:function(a,b){this.focusEl.setWidth(b)},onColumnHiddenUpdated:function(b,c,a){this.focusEl.setWidth(a)},updateColumnText:function(a,b){},afterMove:function(a){},init:function(a){this.grid=a;this.initTemplates();this.initData(a.store,a.colModel);this.initUI(a)},getColumnId:function(a){return this.cm.getColumnId(a)},renderHeaders:function(){var k=this.cm,g=this.templates;var d=g.hcell;var b=[],h=[],a={};var e=k.getColumnCount();var l=e-1;for(var c=0;c<e;c++){a.id=k.getColumnId(c);a.value=k.getColumnHeader(c)||"";a.style=this.getColumnStyle(c,true);a.tooltip=this.getColumnTooltip(c);a.css=c==0?"x-grid3-cell-first ":(c==l?"x-grid3-cell-last ":"");if(k.config[c].align=="right"){a.istyle="padding-right:16px"}else{delete a.istyle}b[b.length]=d.apply(a)}return g.header.apply({cells:b.join(""),tstyle:"width:"+this.getTotalWidth()+";"})},getColumnTooltip:function(a){var b=this.cm.getColumnTooltip(a);if(b){if(Ext.QuickTips.isEnabled()){return'ext:qtip="'+b+'"'}else{return'title="'+b+'"'}}return""},beforeUpdate:function(){this.grid.stopEditing(true)},updateHeaders:function(){this.innerHd.firstChild.innerHTML=this.renderHeaders()},focusRow:function(a){this.focusCell(a,0,false)},focusCell:function(c,a,b){this.syncFocusEl(this.ensureVisible(c,a,b));if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},resolveCell:function(e,c,d){if(typeof e!="number"){e=e.rowIndex}if(!this.ds){return null}if(e<0||e>=this.ds.getCount()){return null}c=(c!==undefined?c:0);var b=this.getRow(e),a;if(!(d===false&&c===0)){while(this.cm.isHidden(c)){c++}a=this.getCell(e,c)}return{row:b,cell:a}},getResolvedXY:function(a){if(!a){return null}var b=this.scroller.dom,e=a.cell,d=a.row;return e?Ext.fly(e).getXY():[this.el.getX(),Ext.fly(d).getY()]},syncFocusEl:function(d,a,c){var b=d;if(!Ext.isArray(b)){d=Math.min(d,Math.max(0,this.getRows().length-1));b=this.getResolvedXY(this.resolveCell(d,a,c))}this.focusEl.setXY(b||this.scroller.getXY())},ensureVisible:function(u,g,e){var s=this.resolveCell(u,g,e);if(!s||!s.row){return}var l=s.row,h=s.cell;var o=this.scroller.dom;var t=0;var d=l,q=this.el.dom;while(d&&d!=q){t+=d.offsetTop;d=d.offsetParent}t-=this.mainHd.dom.offsetHeight;var r=t+l.offsetHeight;var a=o.clientHeight;var q=parseInt(o.scrollTop,10);var n=q+a;if(t<q){o.scrollTop=t}else{if(r>n){o.scrollTop=r-a}}if(e!==false){var m=parseInt(h.offsetLeft,10);var k=m+h.offsetWidth;var i=parseInt(o.scrollLeft,10);var b=i+o.clientWidth;if(m<i){o.scrollLeft=m}else{if(k>b){o.scrollLeft=k-o.clientWidth}}}return this.getResolvedXY(s)},insertRows:function(a,g,c,e){if(!e&&g===0&&c>=a.getCount()-1){this.refresh()}else{if(!e){this.fireEvent("beforerowsinserted",this,g,c)}var b=this.renderRows(g,c);var d=this.getRow(g);if(d){Ext.DomHelper.insertHtml("beforeBegin",d,b)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,b)}if(!e){this.fireEvent("rowsinserted",this,g,c);this.processRows(g)}}this.syncFocusEl(g)},deleteRows:function(a,c,b){if(a.getRowCount()<1){this.refresh()}else{this.fireEvent("beforerowsdeleted",this,c,b);this.removeRows(c,b);this.processRows(c);this.fireEvent("rowsdeleted",this,c,b)}},getColumnStyle:function(a,c){var b=!c?(this.cm.config[a].css||""):"";b+="width:"+this.getColumnWidth(a)+";";if(this.cm.isHidden(a)){b+="display:none;"}var d=this.cm.config[a].align;if(d){b+="text-align:"+d+";"}return b},getColumnWidth:function(b){var a=this.cm.getColumnWidth(b);if(typeof a=="number"){return(Ext.isBorderBox?a:(a-this.borderWidth>0?a-this.borderWidth:0))+"px"}return a},getTotalWidth:function(){return this.cm.getTotalWidth()+"px"},fitColumns:function(d,h,e){var g=this.cm,v,o,r;var u=g.getTotalWidth(false);var m=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(m<20){return}var b=m-u;if(b===0){return false}var a=g.getColumnCount(true);var s=a-(typeof e=="number"?1:0);if(s===0){s=1;e=undefined}var n=g.getColumnCount();var l=[];var q=0;var p=0;var k;for(r=0;r<n;r++){if(!g.isHidden(r)&&!g.isFixed(r)&&r!==e){k=g.getColumnWidth(r);l.push(r);q=r;l.push(k);p+=k}}var c=(m-g.getTotalWidth())/p;while(l.length){k=l.pop();r=l.pop();g.setColumnWidth(r,Math.max(this.grid.minColumnWidth,Math.floor(k+k*c)),true)}if((u=g.getTotalWidth(false))>m){var t=s!=a?e:q;g.setColumnWidth(t,Math.max(1,g.getColumnWidth(t)-(u-m)),true)}if(d!==true){this.updateAllColumnWidths()}return true},autoExpand:function(b){var i=this.grid,a=this.cm;if(!this.userResized&&i.autoExpandColumn){var d=a.getTotalWidth(false);var k=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(d!=k){var h=a.getIndexById(i.autoExpandColumn);var e=a.getColumnWidth(h);var c=Math.min(Math.max(((k-d)+e),i.autoExpandMin),i.autoExpandMax);if(c!=e){a.setColumnWidth(h,c,true);if(b!==true){this.updateColumnWidth(h,c)}}}}},getColumnData:function(){var d=[],a=this.cm,e=a.getColumnCount();for(var c=0;c<e;c++){var b=a.getDataIndex(c);d[c]={name:(typeof b=="undefined"?this.ds.fields.get(c).name:b),renderer:a.getRenderer(c),id:a.getColumnId(c),style:this.getColumnStyle(c)}}return d},renderRows:function(k,c){var d=this.grid,h=d.colModel,a=d.store,l=d.stripeRows;var i=h.getColumnCount();if(a.getCount()<1){return""}var e=this.getColumnData();k=k||0;c=typeof c=="undefined"?a.getCount()-1:c;var b=a.getRange(k,c);return this.doRender(e,b,a,k,i,l)},renderBody:function(){var a=this.renderRows();return this.templates.body.apply({rows:a})},refreshRow:function(b){var d=this.ds,c;if(typeof b=="number"){c=b;b=d.getAt(c)}else{c=d.indexOf(b)}var a=[];this.insertRows(d,c,c,true);this.getRow(c).rowIndex=c;this.onRemove(d,b,c+1,true);this.fireEvent("rowupdated",this,c,b)},refresh:function(b){this.fireEvent("beforerefresh",this);this.grid.stopEditing(true);var a=this.renderBody();this.mainBody.update(a);if(b===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 b=this.ds.getSortState();if(!b){return}if(!this.sortState||(this.sortState.field!=b.field||this.sortState.direction!=b.direction)){this.grid.fireEvent("sortchange",this.grid,b)}this.sortState=b;var c=this.cm.findColumnIndex(b.field);if(c!=-1){var a=b.direction;this.updateSortIcon(c,a)}},destroy:function(){if(this.colMenu){Ext.menu.MenuMgr.unregister(this.colMenu);this.colMenu.destroy();delete this.colMenu}if(this.hmenu){Ext.menu.MenuMgr.unregister(this.hmenu);this.hmenu.destroy();delete this.hmenu}if(this.grid.enableColumnMove){var c=Ext.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id];if(c){for(var a in c){if(!c[a].config.isTarget&&c[a].dragElId){var b=c[a].dragElId;c[a].unreg();Ext.get(b).remove()}else{if(c[a].config.isTarget){c[a].proxyTop.remove();c[a].proxyBottom.remove();c[a].unreg()}}if(Ext.dd.DDM.locationCache[a]){delete Ext.dd.DDM.locationCache[a]}}delete Ext.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id]}}if(this.dragZone){this.dragZone.unreg()}Ext.fly(this.innerHd).removeAllListeners();Ext.removeNode(this.innerHd);Ext.destroy(this.resizeMarker,this.resizeProxy,this.focusEl,this.mainBody,this.scroller,this.mainHd,this.mainWrap,this.dragZone,this.splitZone,this.columnDrag,this.columnDrop);this.initData(null,null);Ext.EventManager.removeResizeListener(this.onWindowResize,this);this.purgeListeners()},onDenyColumnHide:function(){},render:function(){if(this.autoFill){var a=this.grid.ownerCt;if(a&&a.getLayout()){a.on("afterlayout",function(){this.fitColumns(true,true);this.updateHeaders()},this,{single:true})}else{this.fitColumns(true,true)}}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.renderUI()},initData:function(b,a){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(b){b.on("load",this.onLoad,this);b.on("datachanged",this.onDataChange,this);b.on("add",this.onAdd,this);b.on("remove",this.onRemove,this);b.on("update",this.onUpdate,this);b.on("clear",this.onClear,this)}this.ds=b;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(a){delete this.lastViewWidth;a.on("configchange",this.onColConfigChange,this);a.on("widthchange",this.onColWidthChange,this);a.on("headerchange",this.onHeaderChange,this);a.on("hiddenchange",this.onHiddenChange,this);a.on("columnmoved",this.onColumnMove,this);a.on("columnlockchange",this.onColumnLock,this)}this.cm=a},onDataChange:function(){this.refresh();this.updateHeaderSortState();this.syncFocusEl(0)},onClear:function(){this.refresh();this.syncFocusEl(0)},onUpdate:function(b,a){this.refreshRow(a)},onAdd:function(c,a,b){this.insertRows(c,b,b+(a.length-1))},onRemove:function(d,a,b,c){if(c!==true){this.fireEvent("beforerowremoved",this,b,a)}this.removeRow(b);if(c!==true){this.processRows(b);this.applyEmptyText();this.fireEvent("rowremoved",this,b,a)}},onLoad:function(){this.scrollToTop()},onColWidthChange:function(a,b,c){this.updateColumnWidth(b,c)},onHeaderChange:function(a,b,c){this.updateHeaders()},onHiddenChange:function(a,b,c){this.updateColumnHidden(b,c)},onColumnMove:function(a,d,b){this.indexMap=null;var c=this.getScrollState();this.refresh(true);this.restoreScroll(c);this.afterMove(b)},onColConfigChange:function(){delete this.lastViewWidth;this.indexMap=null;this.refresh(true)},initUI:function(a){a.on("headerclick",this.onHeaderClick,this)},initEvents:function(){},onHeaderClick:function(b,a){if(this.headersDisabled||!this.cm.isSortable(a)){return}b.stopEditing(true);b.store.sort(this.cm.getDataIndex(a))},onRowOver:function(b,a){var c;if((c=this.findRowIndex(a))!==false){this.addRowClass(c,"x-grid3-row-over")}},onRowOut:function(b,a){var c;if((c=this.findRowIndex(a))!==false&&!b.within(this.getRow(c),true)){this.removeRowClass(c,"x-grid3-row-over")}},handleWheel:function(a){a.stopPropagation()},onRowSelect:function(a){this.addRowClass(a,"x-grid3-row-selected")},onRowDeselect:function(a){this.removeRowClass(a,"x-grid3-row-selected")},onCellSelect:function(c,b){var a=this.getCell(c,b);if(a){this.fly(a).addClass("x-grid3-cell-selected")}},onCellDeselect:function(c,b){var a=this.getCell(c,b);if(a){this.fly(a).removeClass("x-grid3-cell-selected")}},onColumnSplitterMoved:function(c,b){this.userResized=true;var a=this.grid.colModel;a.setColumnWidth(c,b,true);if(this.forceFit){this.fitColumns(true,false,c);this.updateAllColumnWidths()}else{this.updateColumnWidth(c,b);this.syncHeaderScroll()}this.grid.fireEvent("columnresize",c,b)},handleHdMenuClick:function(c){var b=this.hdCtxIndex;var a=this.cm,d=this.ds;switch(c.id){case"asc":d.sort(a.getDataIndex(b),"ASC");break;case"desc":d.sort(a.getDataIndex(b),"DESC");break;default:b=a.getIndexById(c.id.substr(4));if(b!=-1){if(c.checked&&a.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false}a.setHidden(b,c.checked)}}return true},isHideableColumn:function(a){return !a.hidden&&!a.fixed},beforeColMenuShow:function(){var a=this.cm,c=a.getColumnCount();this.colMenu.removeAll();for(var b=0;b<c;b++){if(a.config[b].fixed!==true&&a.config[b].hideable!==false){this.colMenu.add(new Ext.menu.CheckItem({id:"col-"+a.getColumnId(b),text:a.getColumnHeader(b),checked:!a.isHidden(b),hideOnClick:false,disabled:a.config[b].hideable===false}))}}},handleHdDown:function(h,d){if(Ext.fly(d).hasClass("x-grid3-hd-btn")){h.stopEvent();var g=this.findHeaderCell(d);Ext.fly(g).addClass("x-grid3-hd-menu-open");var c=this.getCellIndex(g);this.hdCtxIndex=c;var b=this.hmenu.items,a=this.cm;b.get("asc").setDisabled(!a.isSortable(c));b.get("desc").setDisabled(!a.isSortable(c));this.hmenu.on("hide",function(){Ext.fly(g).removeClass("x-grid3-hd-menu-open")},this,{single:true});this.hmenu.show(d,"tl-bl?")}},handleHdOver:function(d,a){var c=this.findHeaderCell(a);if(c&&!this.headersDisabled){this.activeHd=c;this.activeHdIndex=this.getCellIndex(c);var b=this.fly(c);this.activeHdRegion=b.getRegion();if(!this.cm.isMenuDisabled(this.activeHdIndex)){b.addClass("x-grid3-hd-over");this.activeHdBtn=b.child(".x-grid3-hd-btn");if(this.activeHdBtn){this.activeHdBtn.dom.style.height=(c.firstChild.offsetHeight-1)+"px"}}}},handleHdMove:function(h,d){if(this.activeHd&&!this.headersDisabled){var b=this.splitHandleWidth||5;var g=this.activeHdRegion;var a=h.getPageX();var c=this.activeHd.style;if(a-g.left<=b&&this.cm.isResizable(this.activeHdIndex-1)){c.cursor=Ext.isAir?"move":Ext.isSafari?"e-resize":"col-resize"}else{if(g.right-a<=(!this.activeHdBtn?b:2)&&this.cm.isResizable(this.activeHdIndex)){c.cursor=Ext.isAir?"move":Ext.isSafari?"w-resize":"col-resize"}else{c.cursor=""}}}},handleHdOut:function(c,a){var b=this.findHeaderCell(a);if(b&&(!Ext.isIE||!c.within(b,true))){this.activeHd=null;this.fly(b).removeClass("x-grid3-hd-over");b.style.cursor=""}},hasRows:function(){var a=this.mainBody.dom.firstChild;return a&&a.className!="x-grid-empty"},bind:function(a,b){this.initData(a,b)}});Ext.grid.GridView.SplitDragZone=function(a,b){this.grid=a;this.view=a.getView();this.marker=this.view.resizeMarker;this.proxy=this.view.resizeProxy;Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this,b,"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(a,e){this.view.headersDisabled=true;var d=this.view.mainWrap.getHeight();this.marker.setHeight(d);this.marker.show();this.marker.alignTo(this.view.getHeaderCell(this.cellIndex),"tl-tl",[-2,0]);this.proxy.setHeight(d);var b=this.cm.getColumnWidth(this.cellIndex);var c=Math.max(b-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(c,1000);this.setYConstraint(0,0);this.minX=a-c;this.maxX=a+1000;this.startPos=a;Ext.dd.DDProxy.prototype.b4StartDrag.call(this,a,e)},handleMouseDown:function(a){var k=this.view.findHeaderCell(a.getTarget());if(k){var n=this.view.fly(k).getXY(),g=n[0],d=n[1];var l=a.getXY(),c=l[0],b=l[1];var i=k.offsetWidth,h=false;if((c-g)<=this.hw){h=-1}else{if((g+i)-c<=this.hw){h=0}}if(h!==false){this.cm=this.grid.colModel;var m=this.view.getCellIndex(k);if(h==-1){if(m+h<0){return}while(this.cm.isHidden(m+h)){--h;if(m+h<0){return}}}this.cellIndex=m+h;this.split=k.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(a)}}}},endDrag:function(d){this.marker.hide();var a=this.view;var b=Math.max(this.minX,d.getPageX());var c=b-this.startPos;a.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+c);setTimeout(function(){a.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 a=this.grid.getSelectionModel();a.on(a.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(a){return Ext.fly(a).up(".x-grid-group",this.mainBody.dom)},getGroups:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},onAdd:function(){if(this.enableGrouping&&!this.ignoreAdd){var a=this.getScrollState();this.refresh();this.restoreScroll(a)}else{if(!this.enableGrouping){Ext.grid.GroupingView.superclass.onAdd.apply(this,arguments)}}},onRemove:function(e,a,b,d){Ext.grid.GroupingView.superclass.onRemove.apply(this,arguments);var c=document.getElementById(a._groupId);if(c&&c.childNodes[1].childNodes.length<1){Ext.removeNode(c)}this.applyEmptyText()},refreshRow:function(a){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 c=this.getGroupField();var b=this.hmenu.items.get("groupBy");if(b){b.setDisabled(this.cm.config[this.hdCtxIndex].groupable===false)}var a=this.hmenu.items.get("showGroups");if(a){a.setDisabled(!c&&this.cm.config[this.hdCtxIndex].groupable===false);a.setChecked(!!c,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(a,b){if(b){this.onGroupByClick()}else{this.grid.store.clearGrouping()}},toggleGroup:function(c,b){this.grid.stopEditing(true);c=Ext.getDom(c);var a=Ext.fly(c);b=b!==undefined?b:a.hasClass("x-grid-group-collapsed");this.state[a.dom.id]=b;a[b?"removeClass":"addClass"]("x-grid-group-collapsed")},toggleAllGroups:function(c){var b=this.getGroups();for(var d=0,a=b.length;d<a;d++){this.toggleGroup(b[d],c)}},expandAllGroups:function(){this.toggleAllGroups(true)},collapseAllGroups:function(){this.toggleAllGroups(false)},interceptMouse:function(b){var a=b.getTarget(".x-grid-group-hd",this.mainBody);if(a){b.stopEvent();this.toggleGroup(a.parentNode)}},getGroup:function(a,d,h,i,b,e){var c=h?h(a,{},d,i,b,e):String(a);if(c===""){c=this.cm.config[b].emptyGroupText||this.emptyGroupText}return c},getGroupField:function(){return this.grid.store.getGroupState()},renderRows:function(){var a=this.getGroupField();var d=!!a;if(this.hideGroupedColumn){var b=this.cm.findColumnIndex(a);if(!d&&this.lastGroupField!==undefined){this.mainBody.update("");this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField),false);delete this.lastGroupField}else{if(d&&this.lastGroupField===undefined){this.lastGroupField=a;this.cm.setHidden(b,true)}else{if(d&&this.lastGroupField!==undefined&&a!==this.lastGroupField){this.mainBody.update("");var c=this.cm.findColumnIndex(this.lastGroupField);this.cm.setHidden(c,false);this.lastGroupField=a;this.cm.setHidden(b,true)}}}}return Ext.grid.GroupingView.superclass.renderRows.apply(this,arguments)},doRender:function(d,k,u,a,t,w){if(k.length<1){return""}var D=this.getGroupField();var s=this.cm.findColumnIndex(D);this.enableGrouping=!!D;if(!this.enableGrouping||this.isUpdating){return Ext.grid.GroupingView.superclass.doRender.apply(this,arguments)}var l="width:"+this.getTotalWidth()+";";var v=this.grid.getGridEl().id;var h=this.cm.config[s];var b=h.groupRenderer||h.renderer;var x=this.showGroupName?(h.groupName||h.header)+": ":"";var C=[],o,y,z,q;for(y=0,z=k.length;y<z;y++){var n=a+y;var p=k[y],e=p.data[D],A=this.getGroup(e,p,b,n,s,u);if(!o||o.group!=A){q=v+"-gp-"+D+"-"+Ext.util.Format.htmlEncode(A);var c=typeof this.state[q]!=="undefined"?!this.state[q]:this.startCollapsed;var m=c?"x-grid-group-collapsed":"";o={group:A,gvalue:e,text:x+A,groupId:q,startRow:n,rs:[p],cls:m,style:l};C.push(o)}else{o.rs.push(p)}p._groupId=q}var B=[];for(y=0,z=C.length;y<z;y++){var A=C[y];this.doGroupStart(B,A,d,u,t);B[B.length]=Ext.grid.GroupingView.superclass.doRender.call(this,d,A.rs,u,A.startRow,t,w);this.doGroupEnd(B,A,d,u,t)}return B.join("")},getGroupId:function(g){var d=this.grid.getGridEl().id;var c=this.getGroupField();var e=this.cm.findColumnIndex(c);var b=this.cm.config[e];var h=b.groupRenderer||b.renderer;var a=this.getGroup(g,{data:{}},h,0,e,this.ds);return d+"-gp-"+c+"-"+Ext.util.Format.htmlEncode(g)},doGroupStart:function(a,d,b,e,c){a[a.length]=this.startGroup.apply(d)},doGroupEnd:function(a,d,b,e,c){a[a.length]=this.endGroup},getRows:function(){if(!this.enableGrouping){return Ext.grid.GroupingView.superclass.getRows.call(this)}var k=[];var h,c=this.getGroups();for(var e=0,a=c.length;e<a;e++){h=c[e].childNodes[1].childNodes;for(var d=0,b=h.length;d<b;d++){k[k.length]=h[d]}}return k},updateGroupWidths:function(){if(!this.enableGrouping||!this.hasRows()){return}var c=Math.max(this.cm.getTotalWidth(),this.el.dom.offsetWidth-this.scrollOffset)+"px";var b=this.getGroups();for(var d=0,a=b.length;d<a;d++){b[d].firstChild.style.width=c}},onColumnWidthUpdated:function(c,a,b){Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this,c,a,b);this.updateGroupWidths()},onAllColumnWidthsUpdated:function(a,b){Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this,a,b);this.updateGroupWidths()},onColumnHiddenUpdated:function(b,c,a){Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this,b,c,a);this.updateGroupWidths()},onLayout:function(){this.updateGroupWidths()},onBeforeRowSelect:function(d,c){if(!this.enableGrouping){return}var b=this.getRow(c);if(b&&!b.offsetParent){var a=this.findGroup(b);this.toggleGroup(a,true)}},groupByText:"Group By This Field",showGroupsText:"Show in Groups"});Ext.grid.GroupingView.GROUP_ID=1000;Ext.grid.HeaderDragZone=function(a,c,b){this.grid=a;this.view=a.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Ext.grid.HeaderDragZone.superclass.constructor.call(this,c);if(b){this.setHandleElId(Ext.id(c));this.setOuterHandleElId(Ext.id(b))}this.scroll=false};Ext.extend(Ext.grid.HeaderDragZone,Ext.dd.DragZone,{maxDragWidth:120,getDragData:function(c){var a=Ext.lib.Event.getTarget(c);var b=this.view.findHeaderCell(a);if(b){return{ddel:b.firstChild,header:b}}return false},onInitDrag:function(a){this.view.headersDisabled=true;var b=this.dragData.ddel.cloneNode(true);b.id=Ext.id();b.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(b);return true},afterValidDrop:function(){var a=this.view;setTimeout(function(){a.headersDisabled=false},50)},afterInvalidDrop:function(){var a=this.view;setTimeout(function(){a.headersDisabled=false},50)}});Ext.grid.HeaderDropZone=function(a,c,b){this.grid=a;this.view=a.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,a.getGridEl().dom)};Ext.extend(Ext.grid.HeaderDropZone,Ext.dd.DropZone,{proxyOffsets:[-4,-9],fly:Ext.Element.fly,getTargetFromEvent:function(c){var a=Ext.lib.Event.getTarget(c);var b=this.view.findCellIndex(a);if(b!==false){return this.view.getHeaderCell(b)}},nextVisible:function(c){var b=this.view,a=this.grid.colModel;c=c.nextSibling;while(c){if(!a.isHidden(b.getCellIndex(c))){return c}c=c.nextSibling}return null},prevVisible:function(c){var b=this.view,a=this.grid.colModel;c=c.prevSibling;while(c){if(!a.isHidden(b.getCellIndex(c))){return c}c=c.prevSibling}return null},positionIndicator:function(d,b,g){var l=Ext.lib.Event.getPageX(g);var a=Ext.lib.Dom.getRegion(b.firstChild);var m,p,k=a.top+this.proxyOffsets[1];if((a.right-l)<=(a.right-a.left)/2){m=a.right+this.view.borderWidth;p="after"}else{m=a.left;p="before"}var i=this.view.getCellIndex(d);var o=this.view.getCellIndex(b);if(this.grid.colModel.isFixed(o)){return false}var c=this.grid.colModel.isLocked(o);if(p=="after"){o++}if(i<o){o--}if(i==o&&(c==this.grid.colModel.isLocked(i))){return false}m+=this.proxyOffsets[0];this.proxyTop.setLeftTop(m,k);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight()}this.proxyBottom.setLeftTop(m,k+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return p},onNodeEnter:function(d,a,c,b){if(b.header!=d){this.positionIndicator(b.header,d,c)}},onNodeOver:function(g,b,d,c){var a=false;if(c.header!=g){a=this.positionIndicator(c.header,g,d)}if(!a){this.proxyTop.hide();this.proxyBottom.hide()}return a?this.dropAllowed:this.dropNotAllowed},onNodeOut:function(d,a,c,b){this.proxyTop.hide();this.proxyBottom.hide()},onNodeDrop:function(b,p,i,d){var g=d.header;if(g!=b){var m=this.grid.colModel;var l=Ext.lib.Event.getPageX(i);var a=Ext.lib.Dom.getRegion(b.firstChild);var q=(a.right-l)<=((a.right-a.left)/2)?"after":"before";var k=this.view.getCellIndex(g);var o=this.view.getCellIndex(b);var c=m.isLocked(o);if(q=="after"){o++}if(k<o){o--}if(k==o&&(c==m.isLocked(k))){return false}m.setLocked(k,c,true);m.moveColumn(k,o);this.grid.fireEvent("columnmove",k,o);return true}return false}});Ext.grid.GridView.ColumnDragZone=function(a,b){Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this,a,b,null);this.proxy.el.addClass("x-grid3-col-dd")};Ext.extend(Ext.grid.GridView.ColumnDragZone,Ext.grid.HeaderDragZone,{handleMouseDown:function(a){},callHandleMouseDown:function(a){Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,a)}});Ext.grid.SplitDragZone=function(a,c,b){this.grid=a;this.view=a.getView();this.proxy=this.view.resizeProxy;Ext.grid.SplitDragZone.superclass.constructor.call(this,c,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Ext.id(this.proxy.dom),resizeFrame:false});this.setHandleElId(Ext.id(c));this.setOuterHandleElId(Ext.id(b));this.scroll=false};Ext.extend(Ext.grid.SplitDragZone,Ext.dd.DDProxy,{fly:Ext.Element.fly,b4StartDrag:function(a,d){this.view.headersDisabled=true;this.proxy.setHeight(this.view.mainWrap.getHeight());var b=this.cm.getColumnWidth(this.cellIndex);var c=Math.max(b-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(c,1000);this.setYConstraint(0,0);this.minX=a-c;this.maxX=a+1000;this.startPos=a;Ext.dd.DDProxy.prototype.b4StartDrag.call(this,a,d)},handleMouseDown:function(b){ev=Ext.EventObject.setEvent(b);var a=this.fly(ev.getTarget());if(a.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(a.dom);this.split=a.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(c){this.view.headersDisabled=false;var a=Math.max(this.minX,Ext.lib.Event.getPageX(c));var b=a-this.startPos;this.view.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+b)},autoOffset:function(){this.setDelta(0,0)}});Ext.grid.GridDragZone=function(b,a){this.view=b.getView();Ext.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,a);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=b;this.ddel=document.createElement("div");this.ddel.className="x-grid-dd-wrap"};Ext.extend(Ext.grid.GridDragZone,Ext.dd.DragZone,{ddGroup:"GridDD",getDragData:function(b){var a=Ext.lib.Event.getTarget(b);var d=this.view.findRowIndex(a);if(d!==false){var c=this.grid.selModel;if(!c.isSelected(d)||b.hasModifier()){c.handleMouseDown(this.grid,d,b)}return{grid:this.grid,ddel:this.ddel,rowIndex:d,selections:c.getSelections()}}return false},onInitDrag:function(b){var a=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel)},afterRepair:function(){this.dragging=false},getRepairXY:function(b,a){return false},onEndDrag:function(a,b){},onValidDrop:function(a,b,c){this.hideProxy()},beforeInvalidDrop:function(a,b){}});Ext.grid.ColumnModel=function(a){this.defaultWidth=100;this.defaultSortable=false;if(a.columns){Ext.apply(this,a);this.setConfig(a.columns,true)}else{this.setConfig(a,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(a){return this.config[a].id},setConfig:function(d,b){if(!b){delete this.totalWidth;for(var e=0,a=this.config.length;e<a;e++){var g=this.config[e];if(g.editor){g.editor.destroy()}}}this.config=d;this.lookup={};for(var e=0,a=d.length;e<a;e++){var g=d[e];if(typeof g.renderer=="string"){g.renderer=Ext.util.Format[g.renderer]}if(typeof g.id=="undefined"){g.id=e}if(g.editor&&g.editor.isFormField){g.editor=new Ext.grid.GridEditor(g.editor)}this.lookup[g.id]=g}if(!b){this.fireEvent("configchange",this)}},getColumnById:function(a){return this.lookup[a]},getIndexById:function(c){for(var b=0,a=this.config.length;b<a;b++){if(this.config[b].id==c){return b}}return -1},moveColumn:function(d,a){var b=this.config[d];this.config.splice(d,1);this.config.splice(a,0,b);this.dataMap=null;this.fireEvent("columnmoved",this,d,a)},isLocked:function(a){return this.config[a].locked===true},setLocked:function(b,c,a){if(this.isLocked(b)==c){return}this.config[b].locked=c;if(!a){this.fireEvent("columnlockchange",this,b,c)}},getTotalLockedWidth:function(){var a=0;for(var b=0;b<this.config.length;b++){if(this.isLocked(b)&&!this.isHidden(b)){this.totalWidth+=this.getColumnWidth(b)}}return a},getLockedCount:function(){for(var b=0,a=this.config.length;b<a;b++){if(!this.isLocked(b)){return b}}},getColumnCount:function(d){if(d===true){var e=0;for(var b=0,a=this.config.length;b<a;b++){if(!this.isHidden(b)){e++}}return e}return this.config.length},getColumnsBy:function(e,d){var g=[];for(var b=0,a=this.config.length;b<a;b++){var h=this.config[b];if(e.call(d||this,h,b)===true){g[g.length]=h}}return g},isSortable:function(a){if(typeof this.config[a].sortable=="undefined"){return this.defaultSortable}return this.config[a].sortable},isMenuDisabled:function(a){return !!this.config[a].menuDisabled},getRenderer:function(a){if(!this.config[a].renderer){return Ext.grid.ColumnModel.defaultRenderer}return this.config[a].renderer},setRenderer:function(a,b){this.config[a].renderer=b},getColumnWidth:function(a){return this.config[a].width||this.defaultWidth},setColumnWidth:function(b,c,a){this.config[b].width=c;this.totalWidth=null;if(!a){this.fireEvent("widthchange",this,b,c)}},getTotalWidth:function(b){if(!this.totalWidth){this.totalWidth=0;for(var c=0,a=this.config.length;c<a;c++){if(b||!this.isHidden(c)){this.totalWidth+=this.getColumnWidth(c)}}}return this.totalWidth},getColumnHeader:function(a){return this.config[a].header},setColumnHeader:function(a,b){this.config[a].header=b;this.fireEvent("headerchange",this,a,b)},getColumnTooltip:function(a){return this.config[a].tooltip},setColumnTooltip:function(a,b){this.config[a].tooltip=b},getDataIndex:function(a){return this.config[a].dataIndex},setDataIndex:function(a,b){this.config[a].dataIndex=b},findColumnIndex:function(d){var e=this.config;for(var b=0,a=e.length;b<a;b++){if(e[b].dataIndex==d){return b}}return -1},isCellEditable:function(a,b){return(this.config[a].editable||(typeof this.config[a].editable=="undefined"&&this.config[a].editor))?true:false},getCellEditor:function(a,b){return this.config[a].editor},setEditable:function(a,b){this.config[a].editable=b},isHidden:function(a){return this.config[a].hidden},isFixed:function(a){return this.config[a].fixed},isResizable:function(a){return a>=0&&this.config[a].resizable!==false&&this.config[a].fixed!==true},setHidden:function(a,b){var d=this.config[a];if(d.hidden!==b){d.hidden=b;this.totalWidth=null;this.fireEvent("hiddenchange",this,a,b)}},setEditor:function(a,b){this.config[a].editor=b}});Ext.grid.ColumnModel.defaultRenderer=function(a){if(typeof a=="string"&&a.length<1){return"&#160;"}return a};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(a){this.grid=a;this.initEvents()},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked}});Ext.grid.RowSelectionModel=function(a){Ext.apply(this,a);this.selections=new Ext.util.MixedCollection(false,function(b){return b.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(b,d,c){if(c.button===0&&!c.shiftKey&&!c.ctrlKey){this.selectRow(d,false);b.view.focusRow(d)}},this)}this.rowNav=new Ext.KeyNav(this.grid.getGridEl(),{up:function(c){if(!c.shiftKey||this.singleSelect){this.selectPrevious(false)}else{if(this.last!==false&&this.lastActive!==false){var b=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(b!==false){this.last=b}}else{this.selectFirstRow()}}},down:function(c){if(!c.shiftKey||this.singleSelect){this.selectNext(false)}else{if(this.last!==false&&this.lastActive!==false){var b=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(b!==false){this.last=b}}else{this.selectFirstRow()}}},scope:this});var a=this.grid.view;a.on("refresh",this.onRefresh,this);a.on("rowupdated",this.onRowUpdated,this);a.on("rowremoved",this.onRemove,this)},onRefresh:function(){var g=this.grid.store,b;var d=this.getSelections();this.clearSelections(true);for(var c=0,a=d.length;c<a;c++){var e=d[c];if((b=g.indexOfId(e.id))!=-1){this.selectRow(b,true)}}if(d.length!=this.selections.getCount()){this.fireEvent("selectionchange",this)}},onRemove:function(a,b,c){if(this.selections.remove(c)!==false){this.fireEvent("selectionchange",this)}},onRowUpdated:function(a,b,c){if(this.isSelected(c)){a.onRowSelect(b)}},selectRecords:function(b,e){if(!e){this.clearSelections()}var d=this.grid.store;for(var c=0,a=b.length;c<a;c++){this.selectRow(d.indexOf(b[c]),true)}},getCount:function(){return this.selections.length},selectFirstRow:function(){this.selectRow(0)},selectLastRow:function(a){this.selectRow(this.grid.store.getCount()-1,a)},selectNext:function(a){if(this.hasNext()){this.selectRow(this.last+1,a);this.grid.getView().focusRow(this.last);return true}return false},selectPrevious:function(a){if(this.hasPrevious()){this.selectRow(this.last-1,a);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(e,d){var c=this.getSelections();for(var b=0,a=c.length;b<a;b++){if(e.call(d||this,c[b],b)===false){return false}}return true},clearSelections:function(a){if(this.isLocked()){return}if(a!==true){var c=this.grid.store;var b=this.selections;b.each(function(d){this.deselectRow(c.indexOfId(d.id))},this);b.clear()}else{this.selections.clear()}this.last=false},selectAll:function(){if(this.isLocked()){return}this.selections.clear();for(var b=0,a=this.grid.store.getCount();b<a;b++){this.selectRow(b,true)}},hasSelection:function(){return this.selections.length>0},isSelected:function(a){var b=typeof a=="number"?this.grid.store.getAt(a):a;return(b&&this.selections.key(b.id)?true:false)},isIdSelected:function(a){return(this.selections.key(a)?true:false)},handleMouseDown:function(d,i,h){if(h.button!==0||this.isLocked()){return}var a=this.grid.getView();if(h.shiftKey&&!this.singleSelect&&this.last!==false){var c=this.last;this.selectRange(c,i,h.ctrlKey);this.last=c;a.focusRow(i)}else{var b=this.isSelected(i);if(h.ctrlKey&&b){this.deselectRow(i)}else{if(!b||this.getCount()>1){this.selectRow(i,h.ctrlKey||h.shiftKey);a.focusRow(i)}}}},selectRows:function(c,d){if(!d){this.clearSelections()}for(var b=0,a=c.length;b<a;b++){this.selectRow(c[b],true)}},selectRange:function(b,a,d){if(this.isLocked()){return}if(!d){this.clearSelections()}if(b<=a){for(var c=b;c<=a;c++){this.selectRow(c,true)}}else{for(var c=b;c>=a;c--){this.selectRow(c,true)}}},deselectRange:function(c,b,a){if(this.isLocked()){return}for(var d=c;d<=b;d++){this.deselectRow(d,a)}},selectRow:function(b,d,a){if(this.isLocked()||(b<0||b>=this.grid.store.getCount())||this.isSelected(b)){return}var c=this.grid.store.getAt(b);if(c&&this.fireEvent("beforerowselect",this,b,d,c)!==false){if(!d||this.singleSelect){this.clearSelections()}this.selections.add(c);this.last=this.lastActive=b;if(!a){this.grid.getView().onRowSelect(b)}this.fireEvent("rowselect",this,b,c);this.fireEvent("selectionchange",this)}},deselectRow:function(b,a){if(this.isLocked()){return}if(this.last==b){this.last=false}if(this.lastActive==b){this.lastActive=false}var c=this.grid.store.getAt(b);if(c){this.selections.remove(c);if(!a){this.grid.getView().onRowDeselect(b)}this.fireEvent("rowdeselect",this,b,c);this.fireEvent("selectionchange",this)}},restoreLast:function(){if(this._last){this.last=this._last}},acceptsNav:function(c,b,a){return !a.isHidden(b)&&a.isCellEditable(b,c)},onEditorKey:function(i,h){var c=h.getKey(),l,d=this.grid,b=d.activeEditor;var a=h.shiftKey;if(c==h.TAB){h.stopEvent();b.completeEdit();if(a){l=d.walkCells(b.row,b.col-1,-1,this.acceptsNav,this)}else{l=d.walkCells(b.row,b.col+1,1,this.acceptsNav,this)}}else{if(c==h.ENTER){h.stopEvent();b.completeEdit();if(this.moveEditorOnEnter!==false){if(a){l=d.walkCells(b.row-1,b.col,-1,this.acceptsNav,this)}else{l=d.walkCells(b.row+1,b.col,1,this.acceptsNav,this)}}}else{if(c==h.ESC){b.cancelEdit()}}}if(l){d.startEditing(l[0],l[1])}}});Ext.grid.CellSelectionModel=function(a){Ext.apply(this,a);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 a=this.grid.view;a.on("refresh",this.onViewChange,this);a.on("rowupdated",this.onRowUpdated,this);a.on("beforerowremoved",this.clearSelections,this);a.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this)}},beforeEdit:function(a){this.select(a.row,a.column,false,true,a.record)},onRowUpdated:function(a,b,c){if(this.selection&&this.selection.record==c){a.onCellSelect(b,this.selection.cell[1])}},onViewChange:function(){this.clearSelections(true)},getSelectedCell:function(){return this.selection?this.selection.cell:null},clearSelections:function(b){var a=this.selection;if(a){if(b!==true){this.grid.view.onCellDeselect(a.cell[0],a.cell[1])}this.selection=null;this.fireEvent("selectionchange",this,null)}},hasSelection:function(){return this.selection?true:false},handleMouseDown:function(b,d,a,c){if(c.button!==0||this.isLocked()){return}this.select(d,a)},select:function(g,c,b,e,d){if(this.fireEvent("beforecellselect",this,g,c)!==false){this.clearSelections();d=d||this.grid.store.getAt(g);this.selection={record:d,cell:[g,c]};if(!b){var a=this.grid.getView();a.onCellSelect(g,c);if(e!==true){a.focusCell(g,c)}}this.fireEvent("cellselect",this,g,c);this.fireEvent("selectionchange",this,this.selection)}},isSelectable:function(c,b,a){return !a.isHidden(b)},handleKeyDown:function(l){if(!l.isNavKeyPress()){return}var i=this.grid,p=this.selection;if(!p){l.stopEvent();var o=i.walkCells(0,0,1,this.isSelectable,this);if(o){this.select(o[0],o[1])}return}var b=this;var n=function(g,c,e){return i.walkCells(g,c,e,b.isSelectable,b)};var d=l.getKey(),a=p.cell[0],m=p.cell[1];var h;switch(d){case l.TAB:if(l.shiftKey){h=n(a,m-1,-1)}else{h=n(a,m+1,1)}break;case l.DOWN:h=n(a+1,m,1);break;case l.UP:h=n(a-1,m,-1);break;case l.RIGHT:h=n(a,m+1,1);break;case l.LEFT:h=n(a,m-1,-1);break;case l.ENTER:if(i.isEditor&&!i.editing){i.startEditing(a,m);l.stopEvent();return}break}if(h){this.select(h[0],h[1]);l.stopEvent()}},acceptsNav:function(c,b,a){return !a.isHidden(b)&&a.isCellEditable(b,c)},onEditorKey:function(h,d){var b=d.getKey(),i,c=this.grid,a=c.activeEditor;if(b==d.TAB){if(d.shiftKey){i=c.walkCells(a.row,a.col-1,-1,this.acceptsNav,this)}else{i=c.walkCells(a.row,a.col+1,1,this.acceptsNav,this)}d.stopEvent()}else{if(b==d.ENTER){a.completeEdit();d.stopEvent()}else{if(b==d.ESC){d.stopEvent();a.cancelEdit()}}}if(i){c.startEditing(i[0],i[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]);this.on("columnresize",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)}},onCellDblClick:function(b,c,a){this.startEditing(c,a)},onAutoEditClick:function(c,b){if(c.button!==0){return}var g=this.view.findRowIndex(b);var a=this.view.findCellIndex(b);if(g!==false&&a!==false){this.stopEditing();if(this.selModel.getSelectedCell){var d=this.selModel.getSelectedCell();if(d&&d.cell[0]===g&&d.cell[1]===a){this.startEditing(g,a)}}else{if(this.selModel.isSelected(g)){this.startEditing(g,a)}}}},onEditComplete:function(b,d,a){this.editing=false;this.activeEditor=null;b.un("specialkey",this.selModel.onEditorKey,this.selModel);var c=b.record;var h=this.colModel.getDataIndex(b.col);d=this.postEditValue(d,a,c,h);if(String(d)!==String(a)){var g={grid:this,record:c,field:h,originalValue:a,value:d,row:b.row,column:b.col,cancel:false};if(this.fireEvent("validateedit",g)!==false&&!g.cancel){c.set(h,g.value);delete g.cancel;this.fireEvent("afteredit",g)}}this.view.focusCell(b.row,b.col)},startEditing:function(h,b){this.stopEditing();if(this.colModel.isCellEditable(b,h)){this.view.ensureVisible(h,b,true);var c=this.store.getAt(h);var g=this.colModel.getDataIndex(b);var d={grid:this,record:c,field:g,value:c.data[g],row:h,column:b,cancel:false};if(this.fireEvent("beforeedit",d)!==false&&!d.cancel){this.editing=true;var a=this.colModel.getCellEditor(b,h);if(!a.rendered){a.render(this.view.getEditorParent(a))}(function(){a.row=h;a.col=b;a.record=c;a.on("complete",this.onEditComplete,this,{single:true});a.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=a;var e=this.preEditValue(c,g);a.startEdit(this.view.getCell(h,b).firstChild,e===undefined?"":e)}).defer(50,this)}}},preEditValue:function(a,c){var b=a.data[c];return this.autoEncode&&typeof b=="string"?Ext.util.Format.htmlDecode(b):b},postEditValue:function(c,a,b,d){return this.autoEncode&&typeof c=="string"?Ext.util.Format.htmlEncode(c):c},stopEditing:function(a){if(this.activeEditor){this.activeEditor[a===true?"cancelEdit":"completeEdit"]()}this.activeEditor=null},onDestroy:function(){if(this.rendered){var d=this.colModel.config;for(var b=0,a=d.length;b<a;b++){var e=d[b];Ext.destroy(e.editor)}}Ext.grid.EditorGridPanel.superclass.onDestroy.call(this)}});Ext.reg("editorgrid",Ext.grid.EditorGridPanel);Ext.grid.GridEditor=function(b,a){Ext.grid.GridEditor.superclass.constructor.call(this,b,a);b.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(a,b){this.grid=a;this.store=new Ext.data.Store({recordType:Ext.grid.PropertyRecord});this.store.on("update",this.onUpdate,this);if(b){this.setSource(b)}Ext.grid.PropertyStore.superclass.constructor.call(this)};Ext.extend(Ext.grid.PropertyStore,Ext.util.Observable,{setSource:function(c){this.source=c;this.store.removeAll();var b=[];for(var a in c){if(this.isEditableValue(c[a])){b.push(new Ext.grid.PropertyRecord({name:a,value:c[a]},a))}}this.store.loadRecords({records:b},{},true)},onUpdate:function(e,a,d){if(d==Ext.data.Record.EDIT){var b=a.data.value;var c=a.modified.value;if(this.grid.fireEvent("beforepropertychange",this.source,a.id,b,c)!==false){this.source[a.id]=b;a.commit();this.grid.fireEvent("propertychange",this.source,a.id,b,c)}else{a.reject()}}},getProperty:function(a){return this.store.getAt(a)},isEditableValue:function(a){if(Ext.isDate(a)){return true}else{if(typeof a=="object"||typeof a=="function"){return false}}return true},setValue:function(b,a){this.source[b]=a;this.store.getById(b).set("value",a)},getSource:function(){return this.source}});Ext.grid.PropertyColumnModel=function(c,b){this.grid=c;var d=Ext.grid;d.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=b;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 e=Ext.form;var a=new e.Field({el:this.bselect,bselect:this.bselect,autoShow:true,getValue:function(){return this.bselect.value=="true"}});this.editors={date:new d.GridEditor(new e.DateField({selectOnFocus:true})),string:new d.GridEditor(new e.TextField({selectOnFocus:true})),number:new d.GridEditor(new e.NumberField({selectOnFocus:true,style:"text-align:left;"})),"boolean":new d.GridEditor(a)};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(a){return a.dateFormat(this.dateFormat)},renderBool:function(a){return a?"true":"false"},isCellEditable:function(a,b){return a==1},getRenderer:function(a){return a==1?this.renderCellDelegate:this.renderPropDelegate},renderProp:function(a){return this.getPropertyName(a)},renderCell:function(a){var b=a;if(Ext.isDate(a)){b=this.renderDate(a)}else{if(typeof a=="boolean"){b=this.renderBool(a)}}return Ext.util.Format.htmlEncode(b)},getPropertyName:function(b){var a=this.grid.propertyNames;return a&&a[b]?a[b]:b},getCellEditor:function(a,e){var b=this.store.getProperty(e);var d=b.data.name,c=b.data.value;if(this.grid.customEditors[d]){return this.grid.customEditors[d]}if(Ext.isDate(c)){return this.editors.date}else{if(typeof c=="number"){return this.editors.number}else{if(typeof c=="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 b=new Ext.grid.PropertyStore(this);this.propStore=b;var a=new Ext.grid.PropertyColumnModel(this,b);b.store.sort("name","ASC");this.addEvents("beforepropertychange","propertychange");this.cm=a;this.ds=b.store;Ext.grid.PropertyGrid.superclass.initComponent.call(this);this.selModel.on("beforecellselect",function(e,d,c){if(c===0){this.startEditing.defer(200,this,[d,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(a){this.propStore.setSource(a)},getSource:function(){return this.propStore.getSource()}});Ext.reg("propertygrid",Ext.grid.PropertyGrid);Ext.grid.RowNumberer=function(a){Ext.apply(this,a);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(b,c,a,d){if(this.rowspan){c.cellAttr='rowspan="'+this.rowspan+'"'}return d+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 a=this.grid.getView();a.mainBody.on("mousedown",this.onMouseDown,this);Ext.fly(a.innerHd).on("mousedown",this.onHdMouseDown,this)},this)},onMouseDown:function(c,b){if(c.button===0&&b.className=="x-grid3-row-checker"){c.stopEvent();var d=c.getTarget(".x-grid3-row");if(d){var a=d.rowIndex;if(this.isSelected(a)){this.deselectRow(a)}else{this.selectRow(a,true)}}}},onHdMouseDown:function(c,a){if(a.className=="x-grid3-hd-checker"){c.stopEvent();var b=Ext.fly(a.parentNode);var d=b.hasClass("x-grid3-hd-checker-on");if(d){b.removeClass("x-grid3-hd-checker-on");this.clearSelections()}else{b.addClass("x-grid3-hd-checker-on");this.selectAll()}}},renderer:function(b,c,a){return'<div class="x-grid3-row-checker">&#160;</div>'}});Ext.LoadMask=function(c,b){this.el=Ext.get(c);Ext.apply(this,b);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 a=this.el.getUpdater();a.showLoadIndicator=false;a.on("beforeupdate",this.onBeforeLoad,this);a.on("update",this.onLoad,this);a.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 a=this.el.getUpdater();a.un("beforeupdate",this.onBeforeLoad,this);a.un("update",this.onLoad,this);a.un("failure",this.onLoad,this)}}};Ext.ProgressBar=Ext.extend(Ext.BoxComponent,{baseCls:"x-progress",animate:false,waitTimer:null,initComponent:function(){Ext.ProgressBar.superclass.initComponent.call(this);this.addEvents("update")},onRender:function(d,a){Ext.ProgressBar.superclass.onRender.call(this,d,a);var c=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(a){this.el=c.insertBefore(a,{cls:this.baseCls},true)}else{this.el=c.append(d,{cls:this.baseCls},true)}if(this.id){this.el.dom.id=this.id}var b=this.el.dom.firstChild;this.progressBar=Ext.get(b.firstChild);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.firstChild);var e=Ext.get(b.childNodes[1]);this.textTopEl.setStyle("z-index",99).addClass("x-hidden");this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,e.dom.firstChild]);this.textEl.setWidth(b.offsetWidth)}this.progressBar.setHeight(b.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(c,d,b){this.value=c||0;if(d){this.updateText(d)}if(this.rendered){var a=Math.floor(c*this.el.dom.firstChild.offsetWidth);this.progressBar.setWidth(a,b===true||(b!==false&&this.animate));if(this.textTopEl){this.textTopEl.removeClass("x-hidden").setWidth(a)}}this.fireEvent("update",this,c,d);return this},wait:function(b){if(!this.waitTimer){var a=this;b=b||{};this.updateText(b.text);this.waitTimer=Ext.TaskMgr.start({run:function(c){var d=b.increment||10;this.updateProgress(((((c+d)%d)+1)*(100/d))*0.01,null,b.animate)},interval:b.interval||1000,duration:b.duration,onStop:function(){if(b.fn){b.fn.apply(b.scope||this)}this.reset()},scope:a})}return this},isWaiting:function(){return this.waitTimer!=null},updateText:function(a){this.text=a||"&#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(a,c){Ext.ProgressBar.superclass.setSize.call(this,a,c);if(this.textTopEl){var b=this.el.dom.firstChild;this.textEl.setSize(b.offsetWidth,b.offsetHeight)}this.syncProgressBar();return this},reset:function(a){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(a===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(b){if(this.disabled){return}if(this.clickToChange&&b.target!=this.thumb.dom){var a=this.innerEl.translatePoints(b.getXY());this.onClickChange(a)}this.focus()},onClickChange:function(a){if(a.top>this.clickRange[0]&&a.top<this.clickRange[1]){this.setValue(Math.round(this.reverseValue(a.left)),undefined,true)}},onKeyDown:function(b){if(this.disabled){b.preventDefault();return}var a=b.getKey();switch(a){case b.UP:case b.RIGHT:b.stopEvent();if(b.ctrlKey){this.setValue(this.maxValue,undefined,true)}else{this.setValue(this.value+this.keyIncrement,undefined,true)}break;case b.DOWN:case b.LEFT:b.stopEvent();if(b.ctrlKey){this.setValue(this.minValue,undefined,true)}else{this.setValue(this.value-this.keyIncrement,undefined,true)}break;default:b.preventDefault()}},doSnap:function(b){if(!this.increment||this.increment==1||!b){return b}var d=b,c=this.increment;var a=b%c;if(a>0){if(a>(c/2)){d=b+(c-a)}else{d=b-a}}return d.constrain(this.minValue,this.maxValue)},afterRender:function(){Ext.Slider.superclass.afterRender.apply(this,arguments);if(this.value!==undefined){var a=this.normalizeValue(this.value);if(a!==this.value){delete this.value;this.setValue(a,false)}else{this.moveThumb(this.translateValue(a),false)}}},getRatio:function(){var a=this.innerEl.getWidth();var b=this.maxValue-this.minValue;return b==0?a:(a/b)},normalizeValue:function(a){if(typeof a!="number"){a=parseInt(a)}a=Math.round(a);a=this.doSnap(a);a=a.constrain(this.minValue,this.maxValue);return a},setValue:function(b,a,c){b=this.normalizeValue(b);if(b!==this.value&&this.fireEvent("beforechange",this,b,this.value)!==false){this.value=b;this.moveThumb(this.translateValue(b),a!==false);this.fireEvent("change",this,b);if(c){this.fireEvent("changecomplete",this,b)}}},translateValue:function(a){var b=this.getRatio();return(a*b)-(this.minValue*b)-this.halfThumb},reverseValue:function(b){var a=this.getRatio();return(b+this.halfThumb+(this.minValue*a))/a},moveThumb:function(b,a){if(!a||this.animate===false){this.thumb.setLeft(b)}else{this.thumb.shift({left:b,stopFx:true,duration:0.35})}},focus:function(){this.focusEl.focus(10)},onBeforeDragStart:function(a){return !this.disabled},onDragStart:function(a){this.thumb.addClass("x-slider-thumb-drag");this.dragging=true;this.dragStartValue=this.value;this.fireEvent("dragstart",this,a)},onDrag:function(a){var b=this.innerEl.translatePoints(this.tracker.getXY());this.setValue(Math.round(this.reverseValue(b.left)),false);this.fireEvent("drag",this,a)},onDragEnd:function(a){this.thumb.removeClass("x-slider-thumb-drag");this.dragging=false;this.fireEvent("dragend",this,a);if(this.dragStartValue!=this.value){this.fireEvent("changecomplete",this,this.value)}},onDisable:function(){Ext.Slider.superclass.onDisable.call(this);this.thumb.addClass(this.disabledClass);if(Ext.isIE){var a=this.thumb.getXY();this.thumb.hide();this.innerEl.addClass(this.disabledClass).dom.disabled=true;if(!this.thumbHolder){this.thumbHolder=this.endEl.createChild({cls:"x-slider-thumb "+this.disabledClass})}this.thumbHolder.show().setXY(a)}},onEnable:function(){Ext.Slider.superclass.onEnable.call(this);this.thumb.removeClass(this.disabledClass);if(Ext.isIE){this.innerEl.removeClass(this.disabledClass).dom.disabled=false;if(this.thumbHolder){this.thumbHolder.hide()}this.thumb.show();this.syncThumb()}},onResize:function(a,b){this.innerEl.setWidth(a-(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(a,b){this.innerEl.setHeight(b-(this.el.getPadding("t")+this.endEl.getPadding("b")));this.syncThumb()},getRatio:function(){var b=this.innerEl.getHeight();var a=this.maxValue-this.minValue;return b/a},moveThumb:function(b,a){if(!a||this.animate===false){this.thumb.setBottom(b)}else{this.thumb.shift({bottom:b,stopFx:true,duration:0.35})}},onDrag:function(b){var c=this.innerEl.translatePoints(this.tracker.getXY());var a=this.innerEl.getHeight()-c.top;this.setValue(this.minValue+Math.round(a/this.getRatio()),false);this.fireEvent("drag",this,b)},onClickChange:function(b){if(b.left>this.clickRange[0]&&b.left<this.clickRange[1]){var a=this.innerEl.getHeight()-b.top;this.setValue(this.minValue+Math.round(a/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 a=this.statusAlign=="right",b=Ext.get(this.nextBlock());if(a){this.tr.appendChild(b.dom)}else{b.insertBefore(this.tr.firstChild)}this.statusEl=b.createChild({cls:"x-status-text "+(this.iconCls||this.defaultIconCls||""),html:this.text||this.defaultText||""});this.statusEl.unselectable();this.spacerEl=b.insertSibling({tag:"td",style:"width:100%",cn:[{cls:"ytb-spacer"}]},a?"before":"after")},setStatus:function(d){d=d||{};if(typeof d=="string"){d={text:d}}if(d.text!==undefined){this.setText(d.text)}if(d.iconCls!==undefined){this.setIcon(d.iconCls)}if(d.clear){var e=d.clear,b=this.autoClear,a={useDefaults:true,anim:true};if(typeof e=="object"){e=Ext.applyIf(e,a);if(e.wait){b=e.wait}}else{if(typeof e=="number"){b=e;e=a}else{if(typeof e=="boolean"){e=a}}}e.threadId=this.activeThreadId;this.clearStatus.defer(b,this,[e])}return this},clearStatus:function(c){c=c||{};if(c.threadId&&c.threadId!==this.activeThreadId){return this}var b=c.useDefaults?this.defaultText:"",a=c.useDefaults?(this.defaultIconCls?this.defaultIconCls:""):"";if(c.anim){this.statusEl.fadeOut({remove:false,useDisplay:true,scope:this,callback:function(){this.setStatus({text:b,iconCls:a});this.statusEl.show()}})}else{this.statusEl.hide();this.setStatus({text:b,iconCls:a});this.statusEl.show()}return this},setText:function(a){this.activeThreadId++;this.text=a||"";if(this.rendered){this.statusEl.update(this.text)}return this},getText:function(){return this.text},setIcon:function(a){this.activeThreadId++;a=a||"";if(this.rendered){if(this.currIconCls){this.statusEl.removeClass(this.currIconCls);this.currIconCls=null}if(a.length>0){this.statusEl.addClass(a);this.currIconCls=a}}else{this.currIconCls=a}return this},showBusy:function(a){if(typeof a=="string"){a={text:a}}a=Ext.applyIf(a||{},{text:this.busyText,iconCls:this.busyIconCls});return this.setStatus(a)}});Ext.reg("statusbar",Ext.StatusBar);Ext.History=(function(){var e,c;var l=false;var d;function g(){var m=top.location.href,n=m.indexOf("#");return n>=0?m.substr(n+1):null}function a(){c.value=d}function h(m){d=m;Ext.History.fireEvent("change",m)}function i(n){var m=['<html><body><div id="state">',n,"</div></body></html>"].join("");try{var p=e.contentWindow.document;p.open();p.write(m);p.close();return true}catch(o){return false}}function b(){if(!e.contentWindow||!e.contentWindow.document){setTimeout(b,10);return}var p=e.contentWindow.document;var n=p.getElementById("state");var m=n?n.innerText:null;var o=g();setInterval(function(){p=e.contentWindow.document;n=p.getElementById("state");var r=n?n.innerText:null;var q=g();if(r!==m){m=r;h(m);top.location.hash=m;o=m;a()}else{if(q!==o){o=q;i(q)}}},50);l=true;Ext.History.fireEvent("ready",Ext.History)}function k(){d=c.value?c.value:g();if(Ext.isIE){b()}else{var m=g();setInterval(function(){var n=g();if(n!==m){m=n;h(m);a()}},50);l=true;Ext.History.fireEvent("ready",Ext.History)}}return{fieldId:"x-history-field",iframeId:"x-history-frame",events:{},init:function(n,m){if(l){Ext.callback(n,m,[this]);return}if(!Ext.isReady){Ext.onReady(function(){Ext.History.init(n,m)});return}c=Ext.getDom(Ext.History.fieldId);if(Ext.isIE){e=Ext.getDom(Ext.History.iframeId)}this.addEvents("ready","change");if(n){this.on("ready",n,m,{single:true})}k()},add:function(m,n){if(n!==false){if(this.getToken()==m){return true}}if(Ext.isIE){return i(m)}else{top.location.hash=m;return true}},back:function(){history.go(-1)},forward:function(){history.go(1)},getToken:function(){return l?d:g()}}})();Ext.apply(Ext.History,new Ext.util.Observable());
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext-all-2-2-1.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext-all-2-2-1.js');
/**
 * List compiled by mystix on the extjs.com forums.
 * Thank you Mystix!
 *
 * English (UK) Translations
 * updated to 2.2 by Condor (8 Aug 2008)
 */

Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">Loading...</div>';

if(Ext.DataView){
  Ext.DataView.prototype.emptyText = "";
}

if(Ext.grid.GridPanel){
  Ext.grid.GridPanel.prototype.ddText = "{0} selected row{1}";
}

if(Ext.LoadMask){
  Ext.LoadMask.prototype.msg = "Loading...";
}

Date.monthNames = [
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
];

Date.getShortMonthName = function(month) {
  return Date.monthNames[month].substring(0, 3);
};

Date.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
};

Date.getMonthNumber = function(name) {
  return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
};

Date.dayNames = [
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
];

Date.getShortDayName = function(day) {
  return Date.dayNames[day].substring(0, 3);
};

Date.parseCodes.S.s = "(?:st|nd|rd|th)";

if(Ext.MessageBox){
  Ext.MessageBox.buttonText = {
    ok     : "OK",
    cancel : "Cancel",
    yes    : "Yes",
    no     : "No"
  };
}

if(Ext.util.Format){
  Ext.util.Format.date = function(v, format){
    if(!v) return "";
    if(!(v instanceof Date)) v = new Date(Date.parse(v));
    return v.dateFormat(format || "d/m/Y");
  };
}

if(Ext.DatePicker){
  Ext.apply(Ext.DatePicker.prototype, {
    todayText         : "Today",
    minText           : "This date is before the minimum date",
    maxText           : "This date is after the maximum date",
    disabledDaysText  : "",
    disabledDatesText : "",
    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)',
    todayTip          : "{0} (Spacebar)",
    format            : "d/m/Y",
    okText            : "&#160;OK&#160;",
    cancelText        : "Cancel",
    startDay          : 0
  });
}

if(Ext.PagingToolbar){
  Ext.apply(Ext.PagingToolbar.prototype, {
    beforePageText : "Page",
    afterPageText  : "of {0}",
    firstText      : "First Page",
    prevText       : "Previous Page",
    nextText       : "Next Page",
    lastText       : "Last Page",
    refreshText    : "Refresh",
    displayMsg     : "Displaying {0} - {1} of {2}",
    emptyMsg       : 'No data to display'
  });
}

if(Ext.form.Field){
  Ext.form.Field.prototype.invalidText = "The value in this field is invalid";
}

if(Ext.form.TextField){
  Ext.apply(Ext.form.TextField.prototype, {
    minLengthText : "The minimum length for this field is {0}",
    maxLengthText : "The maximum length for this field is {0}",
    blankText     : "This field is required",
    regexText     : "",
    emptyText     : null
  });
}

if(Ext.form.NumberField){
  Ext.apply(Ext.form.NumberField.prototype, {
    decimalSeparator : ".",
    decimalPrecision : 2,
    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"
  });
}

if(Ext.form.DateField){
  Ext.apply(Ext.form.DateField.prototype, {
    disabledDaysText  : "Disabled",
    disabledDatesText : "Disabled",
    minText           : "The date in this field must be after {0}",
    maxText           : "The date in this field must be before {0}",
    invalidText       : "{0} is not a valid date - it must be in the format {1}",
    format            : "d/m/y",
    altFormats        : "d/m/Y|d/m/y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|Y-m-d"
  });
}

if(Ext.form.ComboBox){
  Ext.apply(Ext.form.ComboBox.prototype, {
    loadingText       : "Loading...",
    valueNotFoundText : undefined
  });
}

if(Ext.form.VTypes){
  Ext.apply(Ext.form.VTypes, {
    emailText    : 'This field should be an e-mail address in the format "user@domain.com"',
    urlText      : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
    alphaText    : 'This field should only contain letters and _',
    alphanumText : 'This field should only contain letters, numbers and _'
  });
}

if(Ext.form.HtmlEditor){
  Ext.apply(Ext.form.HtmlEditor.prototype, {
    createLinkText : 'Please enter the URL for the link:',
    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'
      }
    }
  });
}

if(Ext.grid.GridView){
  Ext.apply(Ext.grid.GridView.prototype, {
    sortAscText  : "Sort Ascending",
    sortDescText : "Sort Descending",
    columnsText  : "Columns"
  });
}

if(Ext.grid.GroupingView){
  Ext.apply(Ext.grid.GroupingView.prototype, {
    emptyGroupText : '(None)',
    groupByText    : 'Group By This Field',
    showGroupsText : 'Show in Groups'
  });
}

if(Ext.grid.PropertyColumnModel){
  Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
    nameText   : "Name",
    valueText  : "Value",
    dateFormat : "j/m/Y"
  });
}

if(Ext.layout.BorderLayout && Ext.layout.BorderLayout.SplitRegion){
  Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
    splitTip            : "Drag to resize.",
    collapsibleSplitTip : "Drag to resize. Double click to hide."
  });
}

if(Ext.form.TimeField){
  Ext.apply(Ext.form.TimeField.prototype, {
    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"
  });
}

if(Ext.form.CheckboxGroup){
  Ext.apply(Ext.form.CheckboxGroup.prototype, {
    blankText : "You must select at least one item in this group"
  });
}

if(Ext.form.RadioGroup){
  Ext.apply(Ext.form.RadioGroup.prototype, {
    blankText : "You must select one item in this group"
  });
}

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext-lang-en_GB.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext-lang-en_GB.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/**
 * Ext.ux.form.LovCombo, List of Values Combo
 *
 * @author    Ing. Jozef Sakáloš
 * @copyright (c) 2008, by Ing. Jozef Sakáloš
 * @date      16. April 2008
 * @version   $Id: Ext.ux.form.LovCombo.js 285 2008-06-06 09:22:20Z jozo $
 *
 * @license Ext.ux.form.LovCombo.js is licensed under the terms of the Open Source
 * LGPL 3.0 license. Commercial use is permitted to the extent that the 
 * code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * License details: http://www.gnu.org/licenses/lgpl.html
 */
 
/*global Ext */

// add RegExp.escape if it has not been already added
if('function' !== typeof RegExp.escape) {
	RegExp.escape = function(s) {
		if('string' !== typeof s) {
			return s;
		}
		// Note: if pasting from forum, precede ]/\ with backslash manually
		return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
	}; // eo function escape
}

// create namespace
Ext.ns('Ext.ux.form');
 
/**
 *
 * @class Ext.ux.form.LovCombo
 * @extends Ext.form.ComboBox
 */
Ext.ux.form.LovCombo = Ext.extend(Ext.form.ComboBox, {

	// {{{
    // configuration options
	/**
	 * @cfg {String} checkField name of field used to store checked state.
	 * It is automatically added to existing fields.
	 * Change it only if it collides with your normal field.
	 */
	 checkField:'checked'

	/**
	 * @cfg {String} separator separator to use between values and texts
	 */
    ,separator:','

	/**
	 * @cfg {String/Array} tpl Template for items. 
	 * Change it only if you know what you are doing.
	 */
	// }}}
    // {{{
    ,initComponent:function() {
        
		// template with checkbox
		if(!this.tpl) {
			this.tpl = 
				 '<tpl for=".">'
				+'<div class="x-combo-list-item">'
				+'<img src="' + Ext.BLANK_IMAGE_URL + '" '
				+'class="ux-lovcombo-icon ux-lovcombo-icon-'
				+'{[values.' + this.checkField + '?"checked":"unchecked"' + ']}">'
				+'<div class="ux-lovcombo-item-text">{' + (this.displayField || 'text' )+ '}</div>'
				+'</div>'
				+'</tpl>'
			;
		}
 
        // call parent
        Ext.ux.form.LovCombo.superclass.initComponent.apply(this, arguments);

		// install internal event handlers
		this.on({
			 scope:this
			,beforequery:this.onBeforeQuery
			,blur:this.onRealBlur
		});

		// remove selection from input field
		this.onLoad = this.onLoad.createSequence(function() {
			if(this.el) {
				var v = this.el.dom.value;
				this.el.dom.value = '';
				this.el.dom.value = v;
			}
		});
 
    } // e/o function initComponent
    // }}}
	// {{{
	/**
	 * Disables default tab key bahavior
	 * @private
	 */
	,initEvents:function() {
		Ext.ux.form.LovCombo.superclass.initEvents.apply(this, arguments);

		// disable default tab handling - does no good
		this.keyNav.tab = false;

	} // eo function initEvents
	// }}}
	// {{{
	/**
	 * clears value
	 */
	,clearValue:function() {
		this.value = '';
		this.setRawValue(this.value);
		this.store.clearFilter();
		this.store.each(function(r) {
			r.set(this.checkField, false);
		}, this);
		if(this.hiddenField) {
			this.hiddenField.value = '';
		}
		this.applyEmptyText();
	} // eo function clearValue
	// }}}
	// {{{
	/**
	 * @return {String} separator (plus space) separated list of selected displayFields
	 * @private
	 */
	,getCheckedDisplay:function() {
		var re = new RegExp(this.separator, "g");
		return this.getCheckedValue(this.displayField).replace(re, this.separator + ' ');
	} // eo function getCheckedDisplay
	// }}}
	// {{{
	/**
	 * @return {String} separator separated list of selected valueFields
	 * @private
	 */
	,getCheckedValue:function(field) {
		field = field || this.valueField;
		var c = [];

		// store may be filtered so get all records
		var snapshot = this.store.snapshot || this.store.data;

		snapshot.each(function(r) {
			if(r.get(this.checkField)) {
				c.push(r.get(field));
			}
		}, this);

		return c.join(this.separator);
	} // eo function getCheckedValue
	// }}}
	// {{{
	/**
	 * beforequery event handler - handles multiple selections
	 * @param {Object} qe query event
	 * @private
	 */
	,onBeforeQuery:function(qe) {
		qe.query = qe.query.replace(new RegExp(this.getCheckedDisplay() + '[ ' + this.separator + ']*'), '');
	} // eo function onBeforeQuery
	// }}}
	// {{{
	/**
	 * blur event handler - runs only when real blur event is fired
	 */
	,onRealBlur:function() {
		this.list.hide();
		var rv = this.getRawValue();
		var rva = rv.split(new RegExp(RegExp.escape(this.separator) + ' *'));
		var va = [];
		var snapshot = this.store.snapshot || this.store.data;

		// iterate through raw values and records and check/uncheck items
		Ext.each(rva, function(v) {
			snapshot.each(function(r) {
				if(v === r.get(this.displayField)) {
					va.push(r.get(this.valueField));
				}
			}, this);
		}, this);
		this.setValue(va.join(this.separator));
		this.store.clearFilter();
	} // eo function onRealBlur
	// }}}
	// {{{
	/**
	 * Combo's onSelect override
	 * @private
	 * @param {Ext.data.Record} record record that has been selected in the list
	 * @param {Number} index index of selected (clicked) record
	 */
	,onSelect:function(record, index) {
        if(this.fireEvent('beforeselect', this, record, index) !== false){

			// toggle checked field
			record.set(this.checkField, !record.get(this.checkField));

			// display full list
			if(this.store.isFiltered()) {
				this.doQuery(this.allQuery);
			}

			// set (update) value and fire event
			this.setValue(this.getCheckedValue());
            this.fireEvent('select', this, record, index);
        }
	} // eo function onSelect
	// }}}
	// {{{
	/**
	 * Sets the value of the LovCombo
	 * @param {Mixed} v value
	 */
	,setValue:function(v) {
		if(v) {
			v = '' + v;
			if(this.valueField) {
				this.store.clearFilter();
				this.store.each(function(r) {
					var checked = !(!v.match(
						 '(^|' + this.separator + ')' + RegExp.escape(r.get(this.valueField))
						+'(' + this.separator + '|$)'))
					;

					r.set(this.checkField, checked);
				}, this);
				this.value = this.getCheckedValue();
				this.setRawValue(this.getCheckedDisplay());
				if(this.hiddenField) {
					this.hiddenField.value = this.value;
				}
			}
			else {
				this.value = v;
				this.setRawValue(v);
				if(this.hiddenField) {
					this.hiddenField.value = v;
				}
			}
			if(this.el) {
				this.el.removeClass(this.emptyClass);
			}
		}
		else {
			this.clearValue();
		}
	} // eo function setValue
	// }}}
	// {{{
	/**
	 * Selects all items
	 */
	,selectAll:function() {
        this.store.each(function(record){
            // toggle checked field
            record.set(this.checkField, true);
        }, this);

        //display full list
        this.doQuery(this.allQuery);
        this.setValue(this.getCheckedValue());
    } // eo full selectAll
	// }}}
	// {{{
	/**
	 * Deselects all items. Synonym for clearValue
	 */
    ,deselectAll:function() {
		this.clearValue();
    } // eo full deselectAll 
	// }}}

}); // eo extend
 
// register xtype
Ext.reg('lovcombo', Ext.ux.form.LovCombo); 
 
// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.ux.form.LovCombo.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.ux.form.LovCombo.js');
Ext.namespace('Ext.ux.form');

/**
 * @class Ext.ux.form.BrowseButton
 * @extends Ext.Button
 * Ext.Button that provides a customizable file browse button.
 * Clicking this button, pops up a file dialog box for a user to select the file to upload.
 * This is accomplished by having a transparent <input type="file"> box above the Ext.Button.
 * When a user thinks he or she is clicking the Ext.Button, they're actually clicking the hidden input "Browse..." box.
 * Note: this class can be instantiated explicitly or with xtypes anywhere a regular Ext.Button can be except in 2 scenarios:
 * - Panel.addButton method both as an instantiated object or as an xtype config object.
 * - Panel.buttons config object as an xtype config object.
 * These scenarios fail because Ext explicitly creates an Ext.Button in these cases.
 * Browser compatibility:
 * Internet Explorer 6:
 * - no issues
 * Internet Explorer 7:
 * - no issues
 * Firefox 2 - Windows:
 * - pointer cursor doesn't display when hovering over the button.
 * Safari 3 - Windows:
 * - no issues.
 * @author loeppky - based on the work done by MaximGB in Ext.ux.UploadDialog (http://extjs.com/forum/showthread.php?t=21558)
 * The follow the curosr float div idea also came from MaximGB.
 * @see http://extjs.com/forum/showthread.php?t=29032
 * @constructor
 * Create a new BrowseButton.
 * @param {Object} config Configuration options
 */
Ext.ux.form.BrowseButton = Ext.extend(Ext.Button, {
	/*
	 * Config options:
	 */
	/**
	 * @cfg {String} inputFileName
	 * Name to use for the hidden input file DOM element.  Deaults to "file".
	 */
	inputFileName: 'file',
	/**
	 * @cfg {Boolean} debug
	 * Toggle for turning on debug mode.
	 * Debug mode doesn't make clipEl transparent so that one can see how effectively it covers the Ext.Button.
	 * In addition, clipEl is given a green background and floatEl a red background to see how well they are positioned.
	 */
	debug: false,
	
	
	/*
	 * Private constants:
	 */
	/**
	 * @property FLOAT_EL_WIDTH
	 * @type Number
	 * The width (in pixels) of floatEl.
	 * It should be less than the width of the IE "Browse" button's width (65 pixels), since IE doesn't let you resize it.
	 * We define this width so we can quickly center floatEl at the mouse cursor without having to make any function calls.
	 * @private
	 */
	FLOAT_EL_WIDTH: 60,
	
	/**
	 * @property FLOAT_EL_HEIGHT
	 * @type Number
	 * The heigh (in pixels) of floatEl.
	 * It should be less than the height of the "Browse" button's height.
	 * We define this height so we can quickly center floatEl at the mouse cursor without having to make any function calls.
	 * @private
	 */
	FLOAT_EL_HEIGHT: 18,
	
	
	/*
	 * Private properties:
	 */
	/**
	 * @property buttonCt
	 * @type Ext.Element
	 * Element that contains the actual Button DOM element.
	 * We store a reference to it, so we can easily grab its size for sizing the clipEl.
	 * @private
	 */
	buttonCt: null,
	/**
	 * @property clipEl
	 * @type Ext.Element
	 * Element that contains the floatEl.
	 * This element is positioned to fill the area of Ext.Button and has overflow turned off.
	 * This keeps floadEl tight to the Ext.Button, and prevents it from masking surrounding elements.
	 * @private
	 */
	clipEl: null,
	/**
	 * @property floatEl
	 * @type Ext.Element
	 * Element that contains the inputFileEl.
	 * This element is size to be less than or equal to the size of the input file "Browse" button.
	 * It is then positioned wherever the user moves the cursor, so that their click always clicks the input file "Browse" button.
	 * Overflow is turned off to preven inputFileEl from masking surrounding elements.
	 * @private
	 */
	floatEl: null,
	/**
	 * @property inputFileEl
	 * @type Ext.Element
	 * Element for the hiden file input.
	 * @private
	 */
	inputFileEl: null,
	/**
	 * @property originalHandler
	 * @type Function
	 * The handler originally defined for the Ext.Button during construction using the "handler" config option.
	 * We need to null out the "handler" property so that it is only called when a file is selected.
	 * @private
	 */
	originalHandler: null,
	/**
	 * @property originalScope
	 * @type Object
	 * The scope originally defined for the Ext.Button during construction using the "scope" config option.
	 * While the "scope" property doesn't need to be nulled, to be consistent with originalHandler, we do.
	 * @private
	 */
	originalScope: null,
	
	
	/*
	 * Protected Ext.Button overrides
	 */
	/**
	 * @see Ext.Button.initComponent
	 */
	initComponent: function(){
		Ext.ux.form.BrowseButton.superclass.initComponent.call(this);
		// Store references to the original handler and scope before nulling them.
		// This is done so that this class can control when the handler is called.
		// There are some cases where the hidden file input browse button doesn't completely cover the Ext.Button.
		// The handler shouldn't be called in these cases.  It should only be called if a new file is selected on the file system.  
		this.originalHandler = this.handler;
		this.originalScope = this.scope;
		this.handler = null;
		this.scope = null;
	},
	
	/**
	 * @see Ext.Button.onRender
	 */
	onRender: function(ct, position){
		Ext.ux.form.BrowseButton.superclass.onRender.call(this, ct, position); // render the Ext.Button
		this.buttonCt = this.el.child('.x-btn-center em');
		this.buttonCt.position('relative'); // this is important!
		var styleCfg = {
			position: 'absolute',
			overflow: 'hidden',
			top: '0px', // default
			left: '0px' // default
		};
		// browser specifics for better overlay tightness
		if (Ext.isIE) {
			Ext.apply(styleCfg, {
				left: '-3px',
				top: '-3px'
			});
		} else if (Ext.isGecko) {
			Ext.apply(styleCfg, {
				left: '-3px',
				top: '-3px'
			});
		} else if (Ext.isSafari) {
			Ext.apply(styleCfg, {
				left: '-4px',
				top: '-2px'
			});
		}
		this.clipEl = this.buttonCt.createChild({
			tag: 'div',
			style: styleCfg
		});
		this.setClipSize();
		this.clipEl.on({
			'mousemove': this.onButtonMouseMove,
			'mouseover': this.onButtonMouseMove,
			scope: this
		});
		
		this.floatEl = this.clipEl.createChild({
			tag: 'div',
			style: {
				position: 'absolute',
				width: this.FLOAT_EL_WIDTH + 'px',
				height: this.FLOAT_EL_HEIGHT + 'px',
				overflow: 'hidden'
			}
		});
		
		
		if (this.debug) {
			this.clipEl.applyStyles({
				'background-color': 'green'
			});
			this.floatEl.applyStyles({
				'background-color': 'red'
			});
		} else {
			this.clipEl.setOpacity(0.0);
		}
		
		// Cover cases where someone tabs to the button:
		// Listen to focus of the button so we can translate the focus to the input file el.
		var buttonEl = this.el.child(this.buttonSelector);
		buttonEl.on('focus', this.onButtonFocus, this);
		// In IE, it's possible to tab to the text portion of the input file el.  
		// We want to listen to keyevents so that if a space is pressed, we "click" the input file el.
		if (Ext.isIE) {
			this.el.on('keydown', this.onButtonKeyDown, this);
		}
		
		this.createInputFile();
	},
	
	
	/*
	 * Private helper methods:
	 */
	/**
	 * Sets the size of clipEl so that is covering as much of the button as possible.
	 * @private
	 */
	setClipSize: function(){
		if (this.clipEl) {
			var width = this.buttonCt.getWidth();
			var height = this.buttonCt.getHeight();
			// The button container can have a width and height of zero when it's rendered in a hidden panel.
			// This is most noticable when using a card layout, as the items are all rendered but hidden,
			// (unless deferredRender is set to true). 
			// In this case, the clip size can't be determined, so we attempt to set it later.
			// This check repeats until the button container has a size. 
			if (width === 0 || height === 0) {
				this.setClipSize.defer(100, this);
			} else {
				if (Ext.isIE) {
					width = width + 5;
					height = height + 5;
				} else if (Ext.isGecko) {
					width = width + 6;
					height = height + 6;
				} else if (Ext.isSafari) {
					width = width + 6;
					height = height + 6;
				}
				this.clipEl.setSize(width, height);
			}
		}
	},
	
	/**
	 * Creates the input file element and adds it to inputFileCt.
	 * The created input file elementis sized, positioned, and styled appropriately.
	 * Event handlers for the element are set up, and a tooltip is applied if defined in the original config.
	 * @private
	 */
	createInputFile: function(){
		// When an input file gets detached and set as the child of a different DOM element,
		// straggling <em> elements get left behind.  
		// I don't know why this happens but we delete any <em> elements we can find under the floatEl to prevent a memory leak.
		this.floatEl.select('em').each(function(el){
			el.remove();
		});
		this.inputFileEl = this.floatEl.createChild({
			tag: 'input',
			type: 'file',
			size: 1, // must be > 0. It's value doesn't really matter due to our masking div (inputFileCt).  
			name: this.inputFileName || Ext.id(this.el),
			tabindex: this.tabIndex,
			// Use the same pointer as an Ext.Button would use.  This doesn't work in Firefox.
			// This positioning right-aligns the input file to ensure that the "Browse" button is visible.
			style: {
				position: 'absolute',
				cursor: 'pointer',
				right: '0px',
				top: '0px'
			}
		});
		this.inputFileEl = this.inputFileEl.child('input') || this.inputFileEl;
		
		// setup events
		this.inputFileEl.on({
			'click': this.onInputFileClick,
			'change': this.onInputFileChange,
			'focus': this.onInputFileFocus,
			'select': this.onInputFileFocus,
			'blur': this.onInputFileBlur,
			scope: this
		});
		
		// add a tooltip
		if (this.tooltip) {
			if (typeof this.tooltip == 'object') {
				Ext.QuickTips.register(Ext.apply({
					target: this.inputFileEl
				}, this.tooltip));
			} else {
				this.inputFileEl.dom[this.tooltipType] = this.tooltip;
			}
		}
	},
	
	/**
	 * Redirecting focus to the input file element so the user can press space and select files.
	 * @param {Event} e focus event.
	 * @private
	 */
	onButtonFocus: function(e){
		if (this.inputFileEl) {
			this.inputFileEl.focus();
			e.stopEvent();
		}
	},
	
	/**
	 * Handler for the IE case where once can tab to the text box of an input file el.
	 * If the key is a space, we simply "click" the inputFileEl.
	 * @param {Event} e key event.
	 * @private
	 */
	onButtonKeyDown: function(e){
		if (this.inputFileEl && e.getKey() == Ext.EventObject.SPACE) {
			this.inputFileEl.dom.click();
			e.stopEvent();
		}
	},
	
	/**
	 * Handler when the cursor moves over the clipEl.
	 * The floatEl gets centered to the cursor location.
	 * @param {Event} e mouse event.
	 * @private
	 */
	onButtonMouseMove: function(e){
		var xy = e.getXY();
		xy[0] -= this.FLOAT_EL_WIDTH / 2;
		xy[1] -= this.FLOAT_EL_HEIGHT / 2;
		this.floatEl.setXY(xy);
	},
	
	/**
	 * Add the visual enhancement to the button when the input file recieves focus. 
	 * This is the tip for the user that now he/she can press space to select the file.
	 * @private
	 */
	onInputFileFocus: function(e){
		if (!this.isDisabled) {
			this.el.addClass("x-btn-over");
		}
	},
	
	/**
	 * Removes the visual enhancement from the button.
	 * @private
	 */
	onInputFileBlur: function(e){
		this.el.removeClass("x-btn-over");
	},
	
	/**
	 * Handler when inputFileEl's "Browse..." button is clicked.
	 * @param {Event} e click event.
	 * @private
	 */
	onInputFileClick: function(e){
		e.stopPropagation();
	},
	
	/**
	 * Handler when inputFileEl changes value (i.e. a new file is selected).
	 * @private
	 */
	onInputFileChange: function(){
		if (this.originalHandler) {
			this.originalHandler.call(this.originalScope, this);
		}
	},
	
	
	/*
	 * Public methods:
	 */
	/**
	 * Detaches the input file associated with this BrowseButton so that it can be used for other purposed (e.g. uplaoding).
	 * The returned input file has all listeners and tooltips applied to it by this class removed.
	 * @param {Boolean} whether to create a new input file element for this BrowseButton after detaching.
	 * True will prevent creation.  Defaults to false.
	 * @return {Ext.Element} the detached input file element.
	 */
	detachInputFile: function(noCreate){
		var result = this.inputFileEl;
		
		if (typeof this.tooltip == 'object') {
			Ext.QuickTips.unregister(this.inputFileEl);
		} else {
			this.inputFileEl.dom[this.tooltipType] = null;
		}
		this.inputFileEl.removeAllListeners();
		this.inputFileEl = null;
		
		if (!noCreate) {
			this.createInputFile();
		}
		return result;
	},
	
	/**
	 * @return {Ext.Element} the input file element attached to this BrowseButton.
	 */
	getInputFile: function(){
		return this.inputFileEl;
	},
	
	/**
	 * @see Ext.Button.disable
	 */
	disable: function(){
		Ext.ux.form.BrowseButton.superclass.disable.call(this);
		this.inputFileEl.dom.disabled = true;
	},
	
	/**
	 * @see Ext.Button.enable
	 */
	enable: function(){
		Ext.ux.form.BrowseButton.superclass.enable.call(this);
		this.inputFileEl.dom.disabled = false;
	}
});

Ext.reg('browsebutton', Ext.ux.form.BrowseButton);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.ux.form.BrowseButton.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.ux.form.BrowseButton.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/**
 * Ext.ux.FileUploader
 *
 * @author  Ing. Jozef Sakáloš
 * @version $Id: Ext.ux.FileUploader.js 302 2008-08-03 20:57:33Z jozo $
 * @date    15. March 2008
 *
 * @license Ext.ux.FileUploader is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * License details: http://www.gnu.org/licenses/lgpl.html
 */

/*global Ext */

/**
 * @class Ext.ux.FileUploader
 * @extends Ext.util.Observable
 * @constructor
 */
Ext.ux.FileUploader = function(config) {
	Ext.apply(this, config);

	// call parent
	Ext.ux.FileUploader.superclass.constructor.apply(this, arguments);

	// add events
	// {{{
	this.addEvents(
		/**
		 * @event beforeallstart
		 * Fires before an upload (of all files) is started. Return false to cancel the event.
		 * @param {Ext.ux.FileUploader} this
		 */
		 'beforeallstart'
		/**
		 * @event allfinished
		 * Fires after upload (of all files) is finished
		 * @param {Ext.ux.FileUploader} this
		 */
		,'allfinished'
		/**
		 * @event beforefilestart
		 * Fires before the file upload is started. Return false to cancel the event.
		 * Fires only when singleUpload = false
		 * @param {Ext.ux.FileUploader} this
		 * @param {Ext.data.Record} record upload of which is being started
		 */
		,'beforefilestart'
		/**
		 * @event filefinished
		 * Fires when file finished uploading.
		 * Fires only when singleUpload = false
		 * @param {Ext.ux.FileUploader} this
		 * @param {Ext.data.Record} record upload of which has finished
		 */
		,'filefinished'
		/**
		 * @event progress
		 * Fires when progress has been updated
		 * @param {Ext.ux.FileUploader} this
		 * @param {Object} data Progress data object
		 * @param {Ext.data.Record} record Only if singleUpload = false
		 */
		,'progress'
	);
	// }}}

}; // eo constructor

Ext.extend(Ext.ux.FileUploader, Ext.util.Observable, {
	
	// configuration options
	// {{{
	/**
	 * @cfg {Object} baseParams baseParams are sent to server in each request.
	 */
	 baseParams:{cmd:'upload',dir:'.'}

	/**
	 * @cfg {Boolean} concurrent true to start all requests upon upload start, false to start
	 * the next request only if previous one has been completed (or failed). Applicable only if
	 * singleUpload = false
	 */
	,concurrent:true

	/**
	 * @cfg {Boolean} enableProgress true to enable querying server for progress information
	 */
	,enableProgress:true

	/**
	 * @cfg {String} jsonErrorText Text to use for json error
	 */
	,jsonErrorText:'Cannot decode JSON object'

	/**
	 * @cfg {Number} Maximum client file size in bytes
	 */
	,maxFileSize:524288

	/**
	 * @cfg {String} progressIdName Name to give hidden field for upload progress identificator
	 */
	,progressIdName:'UPLOAD_IDENTIFIER'

	/**
	 * @cfg {Number} progressInterval How often (in ms) is progress requested from server
	 */
	,progressInterval:2000

	/**
	 * @cfg {String} progressUrl URL to request upload progress from
	 */
	,progressUrl:'progress.php'

	/**
	 * @cfg {Object} progressMap Mapping of received progress fields to store progress fields
	 */
	,progressMap:{
		 bytes_total:'bytesTotal'
		,bytes_uploaded:'bytesUploaded'
		,est_sec:'estSec'
		,files_uploaded:'filesUploaded'
		,speed_average:'speedAverage'
		,speed_last:'speedLast'
		,time_last:'timeLast'
		,time_start:'timeStart'
	}
	/**
	 * @cfg {Boolean} singleUpload true to upload files in one form, false to upload one by one
	 */
	,singleUpload:false
	
	/**
	 * @cfg {Ext.data.Store} store Mandatory. Store that holds files to upload
	 */

	/**
	 * @cfg {String} unknownErrorText Text to use for unknow error
	 */
	,unknownErrorText:'Unknown error'

	/**
	 * @cfg {String} url Mandatory. URL to upload to
	 */

	// }}}

	// private
	// {{{
	/**
	 * uploads in progress count
	 * @private
	 */
	,upCount:0
	// }}}

	// methods
	// {{{
	/**
	 * creates form to use for upload.
	 * @private
	 * @return {Ext.Element} form
	 */
	,createForm:function(record) {
		var progressId = parseInt(Math.random() * 1e10, 10);
		var form = Ext.getBody().createChild({
			 tag:'form'
			,action:this.url
			,method:'post'
			,cls:'x-hidden'
			,id:Ext.id()
			,cn:[{
				 tag:'input'
				,type:'hidden'
				,name:'APC_UPLOAD_PROGRESS'
				,value:progressId
			},{
				 tag:'input'
				,type:'hidden'
				,name:this.progressIdName
				,value:progressId
			},{
				 tag:'input'
				,type:'hidden'
				,name:'MAX_FILE_SIZE'
				,value:this.maxFileSize
			}]
		});
		if(record) {
			record.set('form', form);
			record.set('progressId', progressId);
		}
		else {
			this.progressId = progressId;
		}
		return form;

	} // eo function createForm
	// }}}
	// {{{
	,deleteForm:function(form, record) {
		form.remove();
		if(record) {
			record.set('form', null);
		}
	} // eo function deleteForm
	// }}}
	// {{{
	/**
	 * Fires event(s) on upload finish/error
	 * @private
	 */
	,fireFinishEvents:function(options) {
		if(true !== this.eventsSuspended && !this.singleUpload) {
			this.fireEvent('filefinished', this, options && options.record);
		}
		if(true !== this.eventsSuspended && 0 === this.upCount) {
			this.stopProgress();
			this.fireEvent('allfinished', this);
		}
	} // eo function fireFinishEvents
	// }}}
	// {{{
	/**
	 * Geg the iframe identified by record
	 * @private
	 * @param {Ext.data.Record} record
	 * @return {Ext.Element} iframe or null if not found
	 */
	,getIframe:function(record) {
		var iframe = null;
		var form = record.get('form');
		if(form && form.dom && form.dom.target) {
			iframe = Ext.get(form.dom.target);
		}
		return iframe;
	} // eo function getIframe
	// }}}
	// {{{
	/**
	 * returns options for Ajax upload request
	 * @private
	 * @param {Ext.data.Record} record
	 * @param {Object} params params to add
	 */
	,getOptions:function(record, params) {
		var o = {
			 url:this.url
			,method:'post'
			,isUpload:true
			,scope:this
			,callback:this.uploadCallback
			,record:record
			,params:this.getParams(record, params)
		};
		return o;
	} // eo function getOptions
	// }}}
	// {{{
	/**
	 * get params to use for request
	 * @private
	 * @return {Object} params
	 */
	,getParams:function(record, params) {
		var p = {path:this.path};
		Ext.apply(p, this.baseParams || {}, params || {});
		return p;
	}
	// }}}
	// {{{
	/**
	 * processes success response
	 * @private
	 * @param {Object} options options the request was called with
	 * @param {Object} response request response object
	 * @param {Object} o decoded response.responseText
	 */
	,processSuccess:function(options, response, o) {
		var record = false;

		// all files uploadded ok
		if(this.singleUpload) {
			this.store.each(function(r) {
				r.set('state', 'done');
				r.set('error', '');
				r.commit();
			});
		}
		else {
			record = options.record;
			record.set('state', 'done');
			record.set('error', '');
			record.commit();
		}

		this.deleteForm(options.form, record);

	} // eo processSuccess
	// }}}
	// {{{
	/**
	 * processes failure response
	 * @private
	 * @param {Object} options options the request was called with
	 * @param {Object} response request response object
	 * @param {String/Object} error Error text or JSON decoded object. Optional.
	 */
	,processFailure:function(options, response, error) {
		var record = options.record;
		var records;

		// singleUpload - all files uploaded in one form
		if(this.singleUpload) {
			// some files may have been successful
			records = this.store.queryBy(function(r){
				var state = r.get('state');
				return 'done' !== state && 'uploading' !== state;
			});
			records.each(function(record) {
				var e = error.errors ? error.errors[record.id] : this.unknownErrorText;
				if(e) {
					record.set('state', 'failed');
					record.set('error', e);
					Ext.getBody().appendChild(record.get('input'));
				}
				else {
					record.set('state', 'done');
					record.set('error', '');
				}
				record.commit();
			}, this);

			this.deleteForm(options.form);
		}
		// multipleUpload - each file uploaded in it's own form
		else {
			if(error && 'object' === Ext.type(error)) {
				record.set('error', error.errors && error.errors[record.id] ? error.errors[record.id] : this.unknownErrorText);
			}
			else if(error) {
				record.set('error', error);
			}
			else if(response && response.responseText) {
				record.set('error', response.responseText);
			}
			else {
				record.set('error', this.unknownErrorText);
			}
			record.set('state', 'failed');
			record.commit();
		}
	} // eof processFailure
	// }}}
	// {{{
	/**
	 * Delayed task callback
	 */
	,requestProgress:function() {
		var records, p;
		var o = {
			 url:this.progressUrl
			,method:'post'
			,params:{}
			,scope:this
			,callback:function(options, success, response) {
				var o;
				if(true !== success) {
					return;
				}
				try {
					o = Ext.decode(response.responseText);
				}
				catch(e) {
					return;
				}
				if('object' !== Ext.type(o) || true !== o.success) {
					return;
				}

				if(this.singleUpload) {
					this.progress = {};
					for(p in o) {
						if(this.progressMap[p]) {
							this.progress[this.progressMap[p]] = parseInt(o[p], 10);
						}
					}
					if(true !== this.eventsSuspended) {
						this.fireEvent('progress', this, this.progress);
					}

				}
				else {
					for(p in o) {
						if(this.progressMap[p] && options.record) {
							options.record.set(this.progressMap[p], parseInt(o[p], 10));
						}
					}
					if(options.record) {
						options.record.commit();
						if(true !== this.eventsSuspended) {
							this.fireEvent('progress', this, options.record.data, options.record);
						}
					}
				}
				this.progressTask.delay(this.progressInterval);
			}
		};
		if(this.singleUpload) {
			o.params[this.progressIdName] = this.progressId;
			o.params.APC_UPLOAD_PROGRESS = this.progressId;
			Ext.Ajax.request(o);
		}
		else {
			records = this.store.query('state', 'uploading');
			records.each(function(r) {
				o.params[this.progressIdName] = r.get('progressId');
				o.params.APC_UPLOAD_PROGRESS = o.params[this.progressIdName];
				o.record = r;
				(function() {
					Ext.Ajax.request(o);
				}).defer(250);
			}, this);
		}
	} // eo function requestProgress
	// }}}
	// {{{
	/**
	 * path setter
	 * @private
	 */
	,setPath:function(path) {
		this.path = path;
	} // eo setPath
	// }}}
	// {{{
	/**
	 * url setter
	 * @private
	 */
	,setUrl:function(url) {
		this.url = url;
	} // eo setUrl
	// }}}
	// {{{
	/**
	 * Starts progress fetching from server
	 * @private
	 */
	,startProgress:function() {
		if(!this.progressTask) {
			this.progressTask = new Ext.util.DelayedTask(this.requestProgress, this);
		}
		this.progressTask.delay.defer(this.progressInterval / 2, this.progressTask, [this.progressInterval]);
	} // eo function startProgress
	// }}}
	// {{{
	/**
	 * Stops progress fetching from server
	 * @private
	 */
	,stopProgress:function() {
		if(this.progressTask) {
			this.progressTask.cancel();
		}
	} // eo function stopProgress
	// }}}
	// {{{
	/**
	 * Stops all currently running uploads
	 */
	,stopAll:function() {
		var records = this.store.query('state', 'uploading');
		records.each(this.stopUpload, this);
	} // eo function stopAll
	// }}}
	// {{{
	/**
	 * Stops currently running upload
	 * @param {Ext.data.Record} record Optional, if not set singleUpload = true is assumed
	 * and the global stop is initiated
	 */
	,stopUpload:function(record) {
		// single abord
		var iframe = false;
		if(record) {
			iframe = this.getIframe(record);
			this.stopIframe(iframe);
			this.upCount--;
			this.upCount = 0 > this.upCount ? 0 : this.upCount;
			record.set('state', 'stopped');
			this.fireFinishEvents({record:record});
		}
		// all abort
		else if(this.form) {
			iframe = Ext.fly(this.form.dom.target);
			this.stopIframe(iframe);
			this.upCount = 0;
			this.fireFinishEvents();
		}

	} // eo function abortUpload
	// }}}
	// {{{
	/**
	 * Stops uploading in hidden iframe
	 * @private
	 * @param {Ext.Element} iframe
	 */
	,stopIframe:function(iframe) {
		if(iframe) {
			try {
				iframe.dom.contentWindow.stop();
				iframe.remove.defer(250, iframe);
			}
			catch(e){}
		}
	} // eo function stopIframe
	// }}}
	// {{{
	/**
	 * Main public interface function. Preforms the upload
	 */
	,upload:function() {
		
		var records = this.store.queryBy(function(r){return 'done' !== r.get('state');});
		if(!records.getCount()) {
			return;
		}

		// fire beforeallstart event
		if(true !== this.eventsSuspended && false === this.fireEvent('beforeallstart', this)) {
			return;
		}
		if(this.singleUpload) {
			this.uploadSingle();
		}
		else {
			records.each(this.uploadFile, this);
		}
		
		if(true === this.enableProgress) {
			this.startProgress();
		}

	} // eo function upload
	// }}}
	// {{{
	/**
	 * called for both success and failure. Does nearly nothing
	 * @private
	 * but dispatches processing to processSuccess and processFailure functions
	 */
	,uploadCallback:function(options, success, response) {

		var o;
		this.upCount--;
		this.form = false;

		// process ajax success
		if(true === success) {
			try {
				o = Ext.decode(response.responseText);
			}
			catch(e) {
				this.processFailure(options, response, this.jsonErrorText);
				this.fireFinishEvents(options);
				return;
			}
			// process command success
			if(true === o.success) {
				this.processSuccess(options, response, o);
			}
			// process command failure
			else {
				this.processFailure(options, response, o);
			}
		}
		// process ajax failure
		else {
			this.processFailure(options, response);
		}

		this.fireFinishEvents(options);

	} // eo function uploadCallback
	// }}}
	// {{{
	/**
	 * Uploads one file
	 * @param {Ext.data.Record} record
	 * @param {Object} params Optional. Additional params to use in request.
	 */
	,uploadFile:function(record, params) {
		// fire beforestart event
		if(true !== this.eventsSuspended && false === this.fireEvent('beforefilestart', this, record)) {
			return;
		}

		// create form for upload
		var form = this.createForm(record);

		// append input to the form
		var inp = record.get('input');
		inp.set({name:inp.id});
		form.appendChild(inp);

		// get params for request
		var o = this.getOptions(record, params);
		o.form = form;

		// set state 
		record.set('state', 'uploading');
		record.set('pctComplete', 0);

		// increment active uploads count
		this.upCount++;

		// request upload
		Ext.Ajax.request(o);

		// todo:delete after devel
		this.getIframe.defer(100, this, [record]);

	} // eo function uploadFile
	// }}}
	// {{{
	/**
	 * Uploads all files in single request
	 */
	,uploadSingle:function() {

		// get records to upload
		var records = this.store.queryBy(function(r){return 'done' !== r.get('state');});
		if(!records.getCount()) {
			return;
		}

		// create form and append inputs to it
		var form = this.createForm();
		records.each(function(record) {
			var inp = record.get('input');
			inp.set({name:inp.id});
			form.appendChild(inp);
			record.set('state', 'uploading');
		}, this);

		// create options for request
		var o = this.getOptions();
		o.form = form;

		// save form for stop
		this.form = form;

		// increment active uploads counter
		this.upCount++;

		// request upload
		Ext.Ajax.request(o);
	
	} // eo function uploadSingle
	// }}}

}); // eo extend

// register xtype
Ext.reg('fileuploader', Ext.ux.FileUploader);

 // eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/fileupload/Ext.ux.FileUploader.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/fileupload/Ext.ux.FileUploader.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/**
 * Ext.ux.form.UploadPanel
 *
 * @author  Ing. Jozef Sakáloš
 * @version $Id: Ext.ux.UploadPanel.js 310 2008-08-14 17:23:48Z jozo $
 * @date    13. March 2008
 *
 * @license Ext.ux.form.UploadPanel is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * License details: http://www.gnu.org/licenses/lgpl.html
 */

/*global Ext */

/**
 * @class Ext.ux.UploadPanel
 * @extends Ext.Panel
 */
Ext.ux.UploadPanel = Ext.extend(Ext.Panel, {

	// configuration options overridable from outside
	// {{{
	/**
	 * @cfg {String} addIconCls icon class for add (file browse) button
	 */
	 addIconCls:'icon-plus'

	/**
	 * @cfg {String} addText Text on Add button
	 */
	,addText:'Add'

	/**
	 * @cfg {Object} baseParams This object is not used directly by FileTreePanel but it is
	 * propagated to lower level objects instead. Included here for convenience.
	 */

	/**
	 * @cfg {String} bodyStyle style to use for panel body
	 */
	,bodyStyle:'padding:2px'

	/**
	 * @cfg {String} buttonsAt Where buttons are placed. Valid values are tbar, bbar, body (defaults to 'tbar')
	 */
	,buttonsAt:'tbar'

	/**
	 * @cfg {String} clickRemoveText
	 */
	,clickRemoveText:'Click to remove'

	/**
	 * @cfg {String} clickStopText
	 */
	,clickStopText:'Click to stop'

	/**
	 * @cfg {String} emptyText empty text for dataview
	 */
	,emptyText:'No files'

	/**
	 * @cfg {Boolean} enableProgress true to enable querying server for progress information
	 * Passed to underlying uploader. Included here for convenience.
	 */
	,enableProgress:true

	/**
	 * @cfg {String} errorText
	 */
	,errorText:'Error'

	/**
	 * @cfg {String} fileCls class prefix to use for file type classes
	 */
	,fileCls:'file'

	/**
	 * @cfg {String} fileQueuedText File upload status text
	 */
	,fileQueuedText:'File <b>{0}</b> is queued for upload' 

	/**
	 * @cfg {String} fileDoneText File upload status text
	 */
	,fileDoneText:'File <b>{0}</b> has been successfully uploaded'

	/**
	 * @cfg {String} fileFailedText File upload status text
	 */
	,fileFailedText:'File <b>{0}</b> failed to upload'

	/**
	 * @cfg {String} fileStoppedText File upload status text
	 */
	,fileStoppedText:'File <b>{0}</b> stopped by user'

	/**
	 * @cfg {String} fileUploadingText File upload status text
	 */
	,fileUploadingText:'Uploading file <b>{0}</b>'

	/**
	 * @cfg {Number} maxFileSize Maximum upload file size in bytes
	 * This config property is propagated down to uploader for convenience
	 */
	,maxFileSize:524288

	/**
	 * @cfg {Number} Maximum file name length for short file names
	 */
	,maxLength:18

	/**
	 * @cfg {String} removeAllIconCls iconClass to use for Remove All button (defaults to 'icon-cross'
	 */
	,removeAllIconCls:'icon-cross'

	/**
	 * @cfg {String} removeAllText text to use for Remove All button tooltip
	 */
	,removeAllText:'Remove All'

	/**
	 * @cfg {String} removeIconCls icon class to use for remove file icon
	 */
	,removeIconCls:'icon-minus'

	/**
	 * @cfg {String} removeText Remove text
	 */
	,removeText:'Remove'

	/**
	 * @cfg {String} selectedClass class for selected item of DataView
	 */
	,selectedClass:'ux-up-item-selected'

	/**
	 * @cfg {Boolean} singleUpload true to upload files in one form, false to upload one by one
	 * This config property is propagated down to uploader for convenience
	 */
	,singleUpload:false

	/**
	 * @cfg {String} stopAllText
	 */
	,stopAllText:'Stop All'

	/** 
	 * @cfg {String} stopIconCls icon class to use for stop
	 */
	,stopIconCls:'icon-stop'

	/**
	 * @cfg {String/Ext.XTemplate} tpl Template for DataView.
	 */

	/**
	 * @cfg {String} uploadText Upload text
	 */
	,uploadText:'Upload'

	/**
	 * @cfg {String} uploadIconCls icon class to use for upload button
	 */
	,uploadIconCls:'icon-upload'

	/**
	 * @cfg {String} workingIconCls iconClass to use for busy indicator
	 */
	,workingIconCls:'icon-working'

	// }}}

	// overrides
	// {{{
	,initComponent:function() {

		// {{{
		// create buttons
		// add (file browse button) configuration
		var addCfg = {
			 xtype:'browsebutton'
			,text:this.addText + '...'
			,iconCls:this.addIconCls
			,scope:this
			,handler:this.onAddFile
		};

		// upload button configuration
		var upCfg = {
			 xtype:'button'
			,iconCls:this.uploadIconCls
			,text:this.uploadText
			,scope:this
			,handler:this.onUpload
			,disabled:true
		};

		// remove all button configuration
		var removeAllCfg = {
			 xtype:'button'
			,iconCls:this.removeAllIconCls
			,tooltip:this.removeAllText
			,scope:this
			,handler:this.onRemoveAllClick
			,disabled:true
		};

		// todo: either to cancel buttons in body or implement it
		if('body' !== this.buttonsAt) {
			this[this.buttonsAt] = [addCfg, upCfg, '->', removeAllCfg];
		}
		// }}}
		// {{{
		// create store
		// fields for record
		var fields = [
			 {name:'id', type:'text', system:true}
			,{name:'shortName', type:'text', system:true}
			,{name:'fileName', type:'text', system:true}
			,{name:'filePath', type:'text', system:true}
			,{name:'fileCls', type:'text', system:true}
			,{name:'input', system:true}
			,{name:'form', system:true}
			,{name:'state', type:'text', system:true}
			,{name:'error', type:'text', system:true}
			,{name:'progressId', type:'int', system:true}
			,{name:'bytesTotal', type:'int', system:true}
			,{name:'bytesUploaded', type:'int', system:true}
			,{name:'estSec', type:'int', system:true}
			,{name:'filesUploaded', type:'int', system:true}
			,{name:'speedAverage', type:'int', system:true}
			,{name:'speedLast', type:'int', system:true}
			,{name:'timeLast', type:'int', system:true}
			,{name:'timeStart', type:'int', system:true}
			,{name:'pctComplete', type:'int', system:true}
		];

		// add custom fields if passed
		if(Ext.isArray(this.customFields)) {
			fields.push(this.customFields);
		}

		// create store
		this.store = new Ext.data.SimpleStore({
			 id:0
			,fields:fields
			,data:[]
		});
		// }}}
		// {{{
		// create view
		Ext.apply(this, {
			items:[{
				 xtype:'dataview'
				,itemSelector:'div.ux-up-item'
				,store:this.store
				,selectedClass:this.selectedClass
				,singleSelect:true
				,emptyText:this.emptyText
				,tpl: this.tpl || new Ext.XTemplate(
					  '<tpl for=".">'
					+ '<div class="ux-up-item">'
//					+ '<div class="ux-up-indicator">&#160;</div>'
					+ '<div class="ux-up-icon-file {fileCls}">&#160;</div>'
					+ '<div class="ux-up-text x-unselectable" qtip="{fileName}">{shortName}</div>'
					+ '<div id="remove-{[values.input.id]}" class="ux-up-icon-state ux-up-icon-{state}"'
					+ 'qtip="{[this.scope.getQtip(values)]}">&#160;</div>'
					+ '</div>'
					+ '</tpl>'
					, {scope:this}
				)
				,listeners:{click:{scope:this, fn:this.onViewClick}}

			}]
		});
		// }}}

		// call parent
		Ext.ux.UploadPanel.superclass.initComponent.apply(this, arguments);

		// save useful references
		this.view = this.items.itemAt(0);

		// {{{
		// add events
		this.addEvents(
			/**
			 * Fires before the file is added to store. Return false to cancel the add
			 * @event beforefileadd
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.Element} input (type=file) being added
			 */
			'beforefileadd'
			/**
			 * Fires after the file is added to the store
			 * @event fileadd
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.data.Store} store
			 * @param {Ext.data.Record} Record (containing the input) that has been added to the store
			 */
			,'fileadd'
			/**
			 * Fires before the file is removed from the store. Return false to cancel the remove
			 * @event beforefileremove
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.data.Store} store
			 * @param {Ext.data.Record} Record (containing the input) that is being removed from the store
			 */
			,'beforefileremove'
			/**
			 * Fires after the record (file) has been removed from the store
			 * @event fileremove
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.data.Store} store
			 */
			,'fileremove'
			/**
			 * Fires before all files are removed from the store (queue). Return false to cancel the clear.
			 * Events for individual files being removed are suspended while clearing the queue.
			 * @event beforequeueclear
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.data.Store} store
			 */
			,'beforequeueclear'
			/**
			 * Fires after the store (queue) has been cleared
			 * Events for individual files being removed are suspended while clearing the queue.
			 * @event queueclear
			 * @param {Ext.ux.UploadPanel} this
			 * @param {Ext.data.Store} store
			 */
			,'queueclear'
			/**
			 * Fires after the upload button is clicked but before any upload is started
			 * Return false to cancel the event
			 * @param {Ext.ux.UploadPanel} this
			 */
			,'beforeupload'
		);
		// }}}
		// {{{
		// relay view events
		this.relayEvents(this.view, [
			 'beforeclick'
			,'beforeselect'
			,'click'
			,'containerclick'
			,'contextmenu'
			,'dblclick'
			,'selectionchange'
		]);
		// }}}

		// create uploader
		var config = {
			 store:this.store
			,singleUpload:this.singleUpload
			,maxFileSize:this.maxFileSize
			,enableProgress:this.enableProgress
			,url:this.url
			,path:this.path
		};
		if(this.baseParams) {
			config.baseParams = this.baseParams;
		}
		this.uploader = new Ext.ux.FileUploader(config);

		// relay uploader events
		this.relayEvents(this.uploader, [
			 'beforeallstart'
			,'allfinished'
			,'progress'
		]);

		// install event handlers
		this.on({
			 beforeallstart:{scope:this, fn:function() {
			 	this.uploading = true;
				this.updateButtons();
			}}
			,allfinished:{scope:this, fn:function() {
				this.uploading = false;
				this.updateButtons();
			}}
			,progress:{fn:this.onProgress.createDelegate(this)}
		});
	} // eo function initComponent
	// }}}
	// {{{
	/**
	 * onRender override, saves references to buttons
	 * @private
	 */
	,onRender:function() {
		// call parent
		Ext.ux.UploadPanel.superclass.onRender.apply(this, arguments);

		// save useful references
		var tb = 'tbar' === this.buttonsAt ? this.getTopToolbar() : this.getBottomToolbar();
		this.addBtn = Ext.getCmp(tb.items.first().id);
		this.uploadBtn = Ext.getCmp(tb.items.itemAt(1).id);
		this.removeAllBtn = Ext.getCmp(tb.items.last().id);
	} // eo function onRender
	// }}}

	// added methods
	// {{{
	/**
	 * called by XTemplate to get qtip depending on state
	 * @private
	 * @param {Object} values XTemplate values
	 */
	,getQtip:function(values) {
		var qtip = '';
		switch(values.state) {
			case 'queued':
				qtip = String.format(this.fileQueuedText, values.fileName);
				qtip += '<br>' + this.clickRemoveText;
			break;

			case 'uploading':
				qtip = String.format(this.fileUploadingText, values.fileName);
				qtip += '<br>' + values.pctComplete + '% done';
				qtip += '<br>' + this.clickStopText;
			break;

			case 'done':
				qtip = String.format(this.fileDoneText, values.fileName);
				qtip += '<br>' + this.clickRemoveText;
			break;

			case 'failed':
				qtip = String.format(this.fileFailedText, values.fileName);
				qtip += '<br>' + this.errorText + ':' + values.error;
				qtip += '<br>' + this.clickRemoveText;
			break;

			case 'stopped':
				qtip = String.format(this.fileStoppedText, values.fileName);
				qtip += '<br>' + this.clickRemoveText;
			break;
		}
		return qtip;
	} // eo function getQtip
	// }}}
	// {{{
	/**
	 * get file name
	 * @private
	 * @param {Ext.Element} inp Input element containing the full file path
	 * @return {String}
	 */
	,getFileName:function(inp) {
		return inp.getValue().split(/[\/\\]/).pop();
	} // eo function getFileName
	// }}}
	// {{{
	/**
	 * get file path (excluding the file name)
	 * @private
	 * @param {Ext.Element} inp Input element containing the full file path
	 * @return {String}
	 */
	,getFilePath:function(inp) {
		return inp.getValue().replace(/[^\/\\]+$/,'');
	} // eo function getFilePath
	// }}}
	// {{{
	/**
	 * returns file class based on name extension
	 * @private
	 * @param {String} name File name to get class of
	 * @return {String} class to use for file type icon
	 */
	,getFileCls: function(name) {
		var atmp = name.split('.');
		if(1 === atmp.length) {
			return this.fileCls;
		}
		else {
			return this.fileCls + '-' + atmp.pop().toLowerCase();
		}
	}
	// }}}
	// {{{
	/**
	 * called when file is added - adds file to store
	 * @private
	 * @param {Ext.ux.BrowseButton}
	 */
	,onAddFile:function(bb) {
		if(true !== this.eventsSuspended && false === this.fireEvent('beforefileadd', this, bb.getInputFile())) {
			return;
		}
		var inp = bb.detachInputFile();
		inp.addClass('x-hidden');
		var fileName = this.getFileName(inp);

		// create new record and add it to store
		var rec = new this.store.recordType({
			 input:inp
			,fileName:fileName
			,filePath:this.getFilePath(inp)
			,shortName: Ext.util.Format.ellipsis(fileName, this.maxLength)
			,fileCls:this.getFileCls(fileName)
			,state:'queued'
		}, inp.id);
		rec.commit();
		this.store.add(rec);

		this.syncShadow();

		this.uploadBtn.enable();
		this.removeAllBtn.enable();

		if(true !== this.eventsSuspended) {
			this.fireEvent('fileadd', this, this.store, rec);
		}

	} // eo onAddFile
	// }}}
	// {{{
	/**
	 * destroys child components
	 * @private
	 */
	,onDestroy:function() {

		// destroy uploader
		if(this.uploader) {
			this.uploader.stopAll();
			this.uploader.purgeListeners();
			this.uploader = null;
		}

		// destroy view
		if(this.view) {
			this.view.purgeListeners();
			this.view.destroy();
			this.view = null;
		}

		// destroy store
		if(this.store) {
			this.store.purgeListeners();
			this.store.destroy();
			this.store = null;
		}

	} // eo function onDestroy
	// }}}
	// {{{
	/**
	 * progress event handler
	 * @private
	 * @param {Ext.ux.FileUploader} uploader
	 * @param {Object} data progress data
	 * @param {Ext.data.Record} record
	 */
	,onProgress:function(uploader, data, record) {
		var bytesTotal, bytesUploaded, pctComplete, state, idx, item, width, pgWidth;
		if(record) {
			state = record.get('state');
			bytesTotal = record.get('bytesTotal') || 1;
			bytesUploaded = record.get('bytesUploaded') || 0;
			if('uploading' === state) {
				pctComplete = Math.round(1000 * bytesUploaded/bytesTotal) / 10;
			}
			else if('done' === state) {
				pctComplete = 100;
			}
			else {
				pctComplete = 0;
			}
			record.set('pctComplete', pctComplete);

			idx = this.store.indexOf(record);
			item = Ext.get(this.view.getNode(idx));
			if(item) {
				width = item.getWidth();
				item.applyStyles({'background-position':width * pctComplete / 100 + 'px'});
			}
		}
	} // eo function onProgress
	// }}}
	// {{{
	/**
	 * called when file remove icon is clicked - performs the remove
	 * @private
	 * @param {Ext.data.Record}
	 */
	,onRemoveFile:function(record) {
		if(true !== this.eventsSuspended && false === this.fireEvent('beforefileremove', this, this.store, record)) {
			return;
		}

		// remove DOM elements
		var inp = record.get('input');
		var wrap = inp.up('em');
		inp.remove();
		if(wrap) {
			wrap.remove();
		}

		// remove record from store
		this.store.remove(record);

		var count = this.store.getCount();
		this.uploadBtn.setDisabled(!count);
		this.removeAllBtn.setDisabled(!count);

		if(true !== this.eventsSuspended) {
			this.fireEvent('fileremove', this, this.store);
			this.syncShadow();
		}
	} // eo function onRemoveFile
	// }}}
	// {{{
	/**
	 * Remove All/Stop All button click handler
	 * @private
	 */
	,onRemoveAllClick:function(btn) {
		if(true === this.uploading) {
			this.stopAll();
		}
		else {
			this.removeAll();
		}
	} // eo function onRemoveAllClick

	,stopAll:function() {
		this.uploader.stopAll();
	} // eo function stopAll
	// }}}
	// {{{
	/**
	 * DataView click handler
	 * @private
	 */
	,onViewClick:function(view, index, node, e) {
		var t = e.getTarget('div:any(.ux-up-icon-queued|.ux-up-icon-failed|.ux-up-icon-done|.ux-up-icon-stopped)');
		if(t) {
			this.onRemoveFile(this.store.getAt(index));
		}
		t = e.getTarget('div.ux-up-icon-uploading');
		if(t) {
			this.uploader.stopUpload(this.store.getAt(index));
		}
	} // eo function onViewClick
	// }}}
	// {{{
	/**
	 * tells uploader to upload
	 * @private
	 */
	,onUpload:function() {
		if(true !== this.eventsSuspended && false === this.fireEvent('beforeupload', this)) {
			return false;
		}
		this.uploader.upload();
	} // eo function onUpload
	// }}}
	// {{{
	/**
	 * url setter
	 */
	,setUrl:function(url) {
		this.url = url;
		this.uploader.setUrl(url);
	} // eo function setUrl
	// }}}
	// {{{
	/**
	 * path setter
	 */
	,setPath:function(path) {
		this.uploader.setPath(path);
	} // eo function setPath
	// }}}
	// {{{
	/**
	 * Updates buttons states depending on uploading state
	 * @private
	 */
	,updateButtons:function() {
		if(true === this.uploading) {
			this.addBtn.disable();
			this.uploadBtn.disable();
			this.removeAllBtn.setIconClass(this.stopIconCls);
			this.removeAllBtn.getEl().child(this.removeAllBtn.buttonSelector).dom[this.removeAllBtn.tooltipType] = this.stopAllText;
		}
		else {
			this.addBtn.enable();
			this.uploadBtn.enable();
			this.removeAllBtn.setIconClass(this.removeAllIconCls);
			this.removeAllBtn.getEl().child(this.removeAllBtn.buttonSelector).dom[this.removeAllBtn.tooltipType] = this.removeAllText;
		}
	} // eo function updateButtons
	// }}}
	// {{{
	/**
	 * Removes all files from store and destroys file inputs
	 */
	,removeAll:function() {
		var suspendState = this.eventsSuspended;
		if(false !== this.eventsSuspended && false === this.fireEvent('beforequeueclear', this, this.store)) {
			return false;
		}
		this.suspendEvents();

		this.store.each(this.onRemoveFile, this);

		this.eventsSuspended = suspendState;
		if(true !== this.eventsSuspended) {
			this.fireEvent('queueclear', this, this.store);
		}
		this.syncShadow();
	} // eo function removeAll
	// }}}
	// {{{
	/**
	 * synchronize context menu shadow if we're in contextmenu
	 * @private
	 */
	,syncShadow:function() {
		if(this.contextmenu && this.contextmenu.shadow) {
			this.contextmenu.getEl().shadow.show(this.contextmenu.getEl());
		}
	} // eo function syncShadow
	// }}}

}); // eo extend

// register xtype
Ext.reg('uploadpanel', Ext.ux.UploadPanel);

// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/fileupload/Ext.ux.UploadPanel.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/fileupload/Ext.ux.UploadPanel.js');
// Ext.ux.HTMLEditorImage
// a plugin to handle images in the Ext.ux.HtmlEditor
Ext.ux.HTMLEditorTextUpload = function(form) {

    // PRIVATE

    // pointer to Ext.ux.HTMLEditor
    var editor;

    // pointer to Ext.Window
    var win;

    // pointer to Ext.FormPanel
    var tabs;

    // pointer to Ext.ux.ImageBrowser
    var imageBrowser;

    // other private variables
    var constrained = false;
    var originalWidth = 0;
    var originalHeight = 0;


    // PUBLIC

    return {
        // Ext.ux.HTMLEditorImage.init
        // called upon instantiation
        init: function(htmlEditor) {
            editor = htmlEditor;

            // append the insert image icon to the toolbar
            editor.tb.insertToolsAfter('createlink', {
                itemId: 'image',
                cls: 'x-btn-icon x-edit-textupload',
                handler: this.openUploadWindow,
                scope: this,
                clickEvent: 'mousedown',
                tooltip: {
                    title: 'Newsletter',
                    text: 'Upload newsletter',
                    cls: 'x-html-editor-tip'
                }
            });
        },

        openUploadWindow: function() {
            if (!win) {
                win = new Ext.Window({
                    width:180
                    ,minWidth:165
                    ,id:'winid'
                    ,height:220
                    ,minHeight:200
                    // ,stateful:false
                    ,layout:'fit'
                    ,border:false
                    ,title:'UploadPanel'
                    ,iconCls:'icon-upload'
                    ,items:[{
                        xtype:'uploadpanel'
                        ,buttonsAt:'tbar'
                        ,id:'uppanel'
                        ,url:'/Newsletter/Handler.ashx'
                        ,baseParams: { CallbackMethod: 'UploadNewsletterForm', CallbackParmCount: 1, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' }
                        ,path:'root'
                        , maxFileSize: 1048576
                        , listeners: { scope: this, allfinished: function(event, target) { debugger; } }
                        // ,enableProgress:false
                        // ,singleUpload:true
                    }]
                });
                win.show.defer(200, win);
            }
        }
    }


}

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/htmleditor/htmleditortextupload.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/htmleditor/htmleditortextupload.js');
// Ext.ux.HTMLEditorUndoRedo
// a plugin that adds Undo/Redo functionality to Ext.ux.HtmlEditor
// note: this is mostly for IE only as Gecko functionality is adequate,
// however, code is included to add toolbar buttons for non-IE browsers
Ext.ux.HTMLEditorUndoRedo = function(size) {

  // PRIVATE

  // pointer to Ext.ux.HTMLEditor
  var editor;

  // IE only: variables
  // size parameter limits the rollback history
  var volume = size || -1;
  var history = new Array();
  var index = 0;
  var placeholder = 0;
  var count = 0;
  var ignore = false;

  // IE only: updates the toolbar buttons
  var updateToolbar = function() {
    editor.tb.items.map.undo.setDisabled(index < 2);
    editor.tb.items.map.redo.setDisabled(index == count);
  }

  // IE only: updates the editor body
  var reset = function() {
    editor.getEditorBody().innerHTML = history[index].content;
    resetBookmark();
  }

  // IE only: updates the element (when in source edit mode)
  var resetElement = function() {
    editor.el.dom.value = history[index].content;
    resetBookmark();
  }

  // IE only: reposition the cursor
  var resetBookmark = function() {
    var range = editor.doc.selection.createRange();
    range.moveToBookmark(history[index].bookmark);
    range.select();
  }

  // PUBLIC

  return {

    // Ext.ux.HTMLEditorUndoRedo.init
    // called upon instantiation
    init: function(htmlEditor) {
      editor = htmlEditor;

      // add the undo and redo buttons to the toolbar.
      // insert before the sourceedit button
      editor.tb.insertToolsBefore('sourceedit', ['-',
      {
        itemId: 'undo',
        cls: 'x-btn-icon x-edit-undo',
        queryEnabled: ! Ext.isIE,
        handler: Ext.isIE ? this.undo : editor.relayBtnCmd,
        scope: Ext.isIE ? this : editor,
        clickEvent: 'mousedown',
        tooltip: {
          title: 'Undo (Ctrl+Z)',
          text: 'Undo the last edit.',
          cls: 'x-html-editor-tip'
        }
      }, {
        itemId: 'redo',
        cls: 'x-btn-icon x-edit-redo',
        queryEnabled: ! Ext.isIE,
        handler: Ext.isIE ? this.redo : editor.relayBtnCmd,
        scope: Ext.isIE ? this : editor,
        clickEvent: 'mousedown',
        tooltip: {
          title: 'Redo (Ctrl+Y)',
          text: 'Redo the last edit.',
          cls: 'x-html-editor-tip'
        }
      }, '-']);

      // IE only: set up event listeners
      if (Ext.isIE) {
        
        // set element listeners on render
        editor.on('render', function() {

          // monitor for ctrl-z (undo) and ctrl-y (redo) keys
          var keyCommands = [{
            key: 'z',
            ctrlKey: true,
            fn: this.undo,
            scope: this
          }, {
            key: 'y',
            ctrlKey: true,
            fn: this.redo,
            scope: this
          }];
          new Ext.KeyMap(editor.getEditorBody(), keyCommands);

          // record changed data when in source edit mode
          editor.el.on('keyup', this.record, this);
        }, this);

        // record changed data when saved back to element
        editor.on('sync', function() {
          if (ignore) {
            ignore = false;
          }
          else {
            this.record();
          }
        }, this);
        
        // perform maintenance when edit mode has changed
        editor.on('editmodechange', function() {

          // set a placeholder when source edit mode is selected
          if (editor.sourceEditMode) {
            placeholder = index;
          }
  
          // else record all changes made in source edit mode as a
          // single historic entry.
          // note: undo/redo functions continue to work while in
          // source edit mode (even when undoing changes made before
          // the mode was changed), but those made while in source
          // edit mode are no longer available once source edit mode
          // is exited as they can appear undesirable or meaningless
          // when in normal edit mode, so they are rolled together
          // to form a single historic change
          else {

            // if changes were made while in source edit mode then
            if (index > placeholder) {
  
              // if starting point was lost to history then
              if (placeholder < 0) {

                // record all source edit mode changes as first
                // historic record
                placeholder == 0;
                history[placeholder] = history[index];
              }

              // else check to see if data has actually changed
              // while in source edit mode then
              else if (history[placeholder].content != history[index].content) {
    
                // record all source edit mode changes as single
                // historic record, to follow last record change
                // made in normal edit mode
                placeholder++;
                history[placeholder] = history[index];
              }

              // reset index and count to placeholder
              index = placeholder;
              count = index;
            }

            // if no changes were made then reset count as it
            // may have grown if changes were made and reversed
            else {
              count = placeholder;
            }
  
            // update the undo/redo buttons on the toolbar
            updateToolbar();
          }
        } , this);
      }
    },
    
    // IE only: record changes to data
    record: function() {

      // get the current html content from the element
      var content = editor.el.dom.value;

      // if no historic records exist yet or content has
      // changed since the last record then
      if (index == 0 || history[index].content != content) {

        // if size of rollbacks has been reached then drop
        // the oldest record from the array
        if (count == volume) {
          history.shift();
          placeholder--;
        }

        // else increment the index
        else {
          index++;
        }

        // record the changed content and cursor position
        history[index] = {
          content: content,
          bookmark: editor.doc.selection.createRange().getBookmark()
        };
        count = index;
      }

      // update the undo/redo buttons on the toolbar
      updateToolbar();
    },
    
    // IE only: perform the undo
    undo: function() {

      // ensure that there is data to undo
      if (index > 1) {

        // decrement the index
        index--;

        // if in source edit mode then update the element directly
        if (editor.sourceEditMode) {
          resetElement();
        }

        // else update the editor body
        else {
          reset();

          // ignore next record request as syncValue is called
          // by Ext.form.HtmlEditor.updateToolBar and we don't
          // want our undo reversed again
          ignore = true;

          // update the editor toolbar and return focus
          editor.updateToolbar();
          editor.deferFocus();
        }

        // update the undo/redo buttons on the toolbar
        updateToolbar();
      }
    },

    // IE only: perform the redo
    redo: function() {

      // ensure that there is data to redo
      if (index < count) {

        // increment the index
        index++;

        // if in source edit mode then update the element directly
        if (editor.sourceEditMode) {
          resetElement();
        }

        // else update the editor body
        else {
          reset();

          // ignore next record request as syncValue is called
          // by Ext.form.HtmlEditor.updateToolBar and we don't
          // want our redo reversed again
          ignore = true;

          // update the editor toolbar and return focus
          editor.updateToolbar();
          editor.deferFocus();
        }

        // update the undo/redo buttons on the toolbar
        updateToolbar();
      }
    }
  }
}

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/htmleditor/htmleditorundoredo.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/htmleditor/htmleditorundoredo.js');
Ext.namespace('Ext.ux');

// Ext.ux.HTMLEditorToolbar
// extension of Ext.Toolbar to cater for extensibility
Ext.ux.HTMLEditorToolbar = Ext.extend(Ext.Toolbar, {

  // overrides Ext.Toolbar.initComponent
  // first function to be called upon creation of toolbar
  initComponent: function() {

    // call Ext.Toolbar.initComponent
    Ext.ux.HTMLEditorToolbar.superclass.initComponent.call(this);

    // unable to use existing items collection for pre-render
    // configuration as it's updated by Ext.Toolbar during render
    this.tools = new Ext.util.MixedCollection(false, function(tool) {
      return tool.itemId || tool.id || Ext.id();
    });

  },

  // add tools (pre-render)
  addTools: function(tools) {
    tools = (tools instanceof Array) ? tools : [tools];
    for (var i = 0, len = tools.length; i < len; i++) {
      this.tools.add(tools[i]);
    }
  },

  // insert tools (pre-render)
  insertTools: function(index, tools) {
    tools = (tools instanceof Array) ? tools : [tools];
    for (var i = 0, len = tools.length; i < len; i++) {
      this.tools.insert(index + i, tools[i]);
    }
  },
  
  // insert tools before another tool (pre-render)
  insertToolsBefore: function(itemId, tools) {
    var index = this.tools.indexOfKey(itemId);
    this.insertTools(index, tools);
  },
  
  // insert tools after another tool (pre-render)
  insertToolsAfter: function(itemId, tools) {
    var index = this.tools.indexOfKey(itemId) + 1;
    this.insertTools(index, tools);
  },

  // render tools (performed after tools/plugins have been configured/reordered)
  renderTool: function(tool) {

    // cater for new tbcombo component
    // created to split configuration from render
    if (typeof tool == "object" && tool.xtype && tool.xtype == "tbcombo") {

      // not catered for in Ext.Toolbar.add function
      // as it defaults to addField instead of addItem
      this.addItem(Ext.ComponentMgr.create(tool));

    }
    else {
      
      // else use existing Ext.Toolbar.add function
      // to render tools
      this.add(tool);

    }

  },

  // overrides Ext.Toolbar.onRender
  onRender: function(ct, position) {
    
    // call Ext.Toolbar.onRender
    Ext.ux.HTMLEditorToolbar.superclass.onRender.call(this, ct, position);

    // loop through pre-configured/reordered tools and render each accordingly
    this.tools.each(this.renderTool, this);

  }
  
});

// Ext.ux.HTMLEditorToolbar.ComboBox
// created to handle the pre-configuration of a combobox (pre-render)
Ext.ux.HTMLEditorToolbar.ComboBox = function(config) {
  
  Ext.apply(this, config);

  // create combobox in memory before render
  var selEl = document.createElement("select");
  selEl.className = this.cls;
  for (var i = 0, len = this.opts.length; i < len; i++) {
    var opt = this.opts[i];
    var optEl = document.createElement('option');
    optEl.text = opt.text;
    optEl.value = opt.value;
    if (opt.selected) {
      optEl.selected = true;
      this.defaultValue = opt.value;
    }
    selEl.options.add(optEl);
  }
  if (! this.defaultValue) {
    this.defaultValue = this.opts[0].value;
  }
  
  // call Ext.Toolbar.Item constructor passing combobox
  Ext.ux.HTMLEditorToolbar.ComboBox.superclass.constructor.call(this, selEl);
  
}

// Ext.ux.HTMLEditorToolbar.ComboBox
// extension of Ext.Toolbar.Item
Ext.extend(Ext.ux.HTMLEditorToolbar.ComboBox, Ext.Toolbar.Item, {

  // overrides Ext.Toolbar.Item.render
  render: function(td) {
    
    // call Ext.Toolbar.Item.render
    Ext.ux.HTMLEditorToolbar.ComboBox.superclass.render.call(this, td);

    // add handler for combobox change event
    Ext.EventManager.on(this.el, 'change', this.handler, this.scope);
    
  }
  
});

// register Ext.ux.HTMLEditorToolbar.ComboBox as a new component
Ext.ComponentMgr.registerType('tbcombo', Ext.ux.HTMLEditorToolbar.ComboBox);

// Ext.ux.HTMLEditor
// extends Ext.form.HtmlEditor to provide extensibility
Ext.ux.HTMLEditor = Ext.extend(Ext.form.HtmlEditor, {

  // using the enable... flags to define content meant that items
  // were always added in the same order.
  // using the toolbarItems list instead allows the user to override
  // the order of items, and even exclude items not wanted.
  // the enable... flags are now no longer used
  toolbarItems: [
    'fonts',
  	'allformats',
  	'allfontsizes',
  	'allcolors',
  	'allalignments',
  	'alllinks',
  	'alllists',
  	'sourceedit'
  ],

  // as an alternative, the toolbarItemExcludes list can be used to
  // exclude items from the toolbarItem list
  toolbarItemExcludes: [],

  // overrides Ext.form.HtmlEditor.initComponent
  // first function to be called upon creation of the editor
  initComponent: function() {

    // call Ext.form.HtmlEditor.initComponent
    Ext.ux.HTMLEditor.superclass.initComponent.call(this);

    // add important event missing from Ext.form.HtmlEditor
    this.addEvents({
      editorevent: true
    });

    // remove any toolbarItemExcludes from the toolbarItems array
    for (var i = 0, iMax = this.toolbarItemExcludes.length; i < iMax; i++) {
      var item = this.toolbarItemExcludes[i].toLowerCase();
      for (var j = 0, jMax = this.toolbarItems.length; j < jMax; j++) {
        if (this.toolbarItems[j] == item) {
          this.toolbarItems.splice(j, 1);
          break;
        }
      }
    }

    // create the editor toolbar
    this.tb = new Ext.ux.HTMLEditorToolbar();
    
    // create the toolbar items
    this.createTools(this.toolbarItems);
        
  },

  // overrides Ext.form.HtmlEditor.createFontOptions
  createFontOptions: function() {
    var opts = [], ffs = this.fontFamilies, ff;
    for (var i = 0, len = ffs.length; i < len; i++) {
      ff = ffs[i];
      fflc = ff.toLowerCase();
      var opt = {text: ff, value: fflc};
      if (fflc == this.defaultFont) opt.selected = true;
      opts.push(opt);
    }
    return opts;
  },

  // create default button config
  btn: function(id, toggle, queryState, handler) {
    return {
      itemId: id,
      cls: 'x-btn-icon x-edit-' + id,
      enableToggle: toggle !== false,
      queryState: queryState !== false,
      handler: handler || this.relayBtnCmd,
      scope: this,
      clickEvent: 'mousedown',
      tooltip: this.buttonTips[id] || undefined,
      tabIndex: -1
    };
  },

  // create known tools based on the passed item list (initially
  // from the toolbarItems list) and add it to the tools collection.
  // this function allows random tool allocation as opposed
  // to the old version that added tools sequentially
  createTools: function(toolbarItems) {

    // convert single items to a list
    toolbarItems = (toolbarItems instanceof Array) ? toolbarItems : [toolbarItems];

    // loop through the item list
    for (var i = 0, len = toolbarItems.length; i < len; i++) {

      //add the item to the toolbar
      var item = toolbarItems[i];
      switch (item) {
        
        // add the fonts combobox
        case 'fonts':
          if (! Ext.isSafari) {
            this.tb.addTools({
              itemId: 'fontname',
              xtype: 'tbcombo',
              cls: 'x-font-select',
              opts: this.createFontOptions(),
              queryValue: true,
              handler: function(event, el) {
                this.relayCmd('fontname', el.value);
                this.deferFocus();
              },
              scope: this
            });
  	      }
          break;
  
        // add the bold button
        case 'bold':
          this.tb.addTools(this.btn('bold'));
          break;
  
        // add the italic button
        case 'italic':
          this.tb.addTools(this.btn('italic'));
          break;
  
        // add the underline button
        case 'underline':
          this.tb.addTools(this.btn('underline'));
          break;
  
        // add all format buttons (with a leading separator)
        case 'allformats':
          this.createTools(['-', 'bold', 'italic', 'underline']);
          break;
  
        // add the increasefontsize button
        case 'increasefontsize':
          this.tb.addTools(this.btn('increasefontsize', false, false, this.adjustFont));
          break;
  
        // add the decreasefontsize button
        case 'decreasefontsize':
          this.tb.addTools(this.btn('decreasefontsize', false, false, this.adjustFont));
          break;
  
        // add both fontsize buttons (with a leading separator)
        case 'allfontsizes':
          this.createTools(['-', 'increasefontsize', 'decreasefontsize']);
          break;
  
        // add the forecolor button and associated menu
        case 'forecolor':
          this.tb.addTools({
            itemId: 'forecolor',
            cls: 'x-btn-icon x-edit-forecolor',
            clickEvent: 'mousedown',
            tooltip: this.buttonTips['forecolor'],
            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'
            })
          });
          break;
  
        // add the backcolor button and associated menu
        case 'backcolor':
          this.tb.addTools({
            itemId: 'backcolor',
            cls: 'x-btn-icon x-edit-backcolor',
            clickEvent: 'mousedown',
            tooltip: this.buttonTips['backcolor'],
            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'
            })
          });
          break;
  
        // add both color buttons (with a leading separator)
        case 'allcolors':
          this.createTools(['-', 'forecolor', 'backcolor']);
          break;
  
        // add the justifyleft button
        case 'justifyleft':
          this.tb.addTools(this.btn('justifyleft'));
          break;
  
        // add the justifycenter button
        case 'justifycenter':
          this.tb.addTools(this.btn('justifycenter'));
          break;
  
        // add the justifyright button
        case 'justifyright':
          this.tb.addTools(this.btn('justifyright'));
          break;
  
        // add all alignment buttons (with a leading separator)
        case 'allalignments':
          this.createTools(['-', 'justifyleft', 'justifycenter', 'justifyright']);
          break;
  
        // add the link button
        case 'link':
          if (! Ext.isSafari) {
            this.tb.addTools(this.btn('createlink', false, false, this.createLink));
          }
          break;
  
        // add the link button (with a leading separator)
        case 'alllinks':
          if (! Ext.isSafari) {
            this.createTools(['-', 'link']);
          }
          break;
  
        // add the orderedlist button
        case 'orderedlist':
          if (! Ext.isSafari) {
            this.tb.addTools(this.btn('insertorderedlist'));
          }
          break;
  
        // add the unorderedlist button
        case 'unorderedlist':
          if (! Ext.isSafari) {
            this.tb.addTools(this.btn('insertunorderedlist'));
          }
          break;
  
        // add both list buttons (with a leading separator)
        case 'alllists':
          if (! Ext.isSafari) {
            this.createTools(['-', 'orderedlist', 'unorderedlist']);
          }
          break;
  
        // add the sourceedit button
        case 'sourceedit':
          if (! Ext.isSafari) {
            this.tb.addTools(this.btn('sourceedit', true, false, function(btn) {
              this.toggleSourceEdit(btn.pressed);
            }));
          }
          break;
  
        // allows for '-', 'separator', ' ', '->', labels, or other item types
        default:
          this.tb.addTools(item);
  
      }
    }

  },

  // overrides Ext.form.HtmlEditor.createToolbar
  // most functionality has been removed as this is called
  // upon render 
  createToolbar: function() {

    // render toolbar
    this.tb.render(this.wrap.dom.firstChild);

    // inherited
    this.tb.el.on('click', function(e) {
      e.preventDefault();
    });

  },

  // overrides Ext.form.HtmlEditor.getDocMarkup
  // provides ability to include stylesheets in the editor document
  // created by bpjohnson (see http://extjs.com/forum/showthread.php?t=9588)
  getDocMarkup: function() {
    var markup = '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style>';
    if (this.styles) {
      for (var i = 0; i < this.styles.length; i++) {
        markup = markup + '<link rel="stylesheet" type="text/css" href="' + this.styles[i] + '" />';
      }
    }
    markup = markup + '</head><body></body></html>';
    return markup;
  },

  // overrides Ext.form.HtmlEditor.onEditorEvent
  onEditorEvent: function(e) {
    
    // call Ext.form.HtmlEditor.onEditorEvent
    Ext.ux.HTMLEditor.superclass.onEditorEvent.call(this, e);

    // fire new editorevent to tell plugins that an event occurred
    // in the editor.
    // this saves plugins from having to monitor multiple events
    // i.e. 'click', 'keyup', etc.
    this.fireEvent('editorevent', this, e);
    
  },

  // overrides Ext.form.HtmlEditor.updateToolbar
  // does not call superclass function as much of it was no
  // longer needed, but duplicates some code
  updateToolbar: function() {

    // inherited
    if (! this.activated) {
      this.onFirstFocus();
      return;
    }
    
    // loop through toolbar items and update status based on
    // query values return from the browser (if configured)
    this.tb.items.each(function(item) {
      if (item.queryState) {
        item.toggle(this.doc.queryCommandState(item.itemId));
      }
      else if (item.queryEnabled) {
        item.setDisabled(! this.doc.queryCommandEnabled(item.itemId));
      }
      else if (item.xtype = "tbcombo" && item.queryValue) {
        var value = (this.doc.queryCommandValue(item.itemId) || item.defaultValue).toLowerCase();
        if (value != item.el.value) {
          item.el.value = value;
        }
      }
    }, this);
    
    // inherited
    Ext.menu.MenuMgr.hideAll();

    // inherited
    this.syncValue();

  }

});
Ext.reg('ux-htmleditor', Ext.ux.HTMLEditor);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/htmleditor/htmleditor.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/htmleditor/htmleditor.js');
/*
* Ext JS Library 2.2.1
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/


Ext.form.FileUploadField = Ext.extend(Ext.form.TextField, {
    /**
    * @cfg {String} buttonText The button text to display on the upload button (defaults to
    * 'Browse...').  Note that if you supply a value for {@link #buttonCfg}, the buttonCfg.text
    * value will be used instead if available.
    */
    buttonText: 'Browse...',
    /**
    * @cfg {Boolean} buttonOnly True to display the file upload field as a button with no visible
    * text field (defaults to false).  If true, all inherited TextField members will still be available.
    */
    buttonOnly: false,
    /**
    * @cfg {Number} buttonOffset The number of pixels of space reserved between the button and the text field
    * (defaults to 3).  Note that this only applies if {@link #buttonOnly} = false.
    */
    buttonOffset: 3,
    /**
    * @cfg {Object} buttonCfg A standard {@link Ext.Button} config object.
    */

    // private
    readOnly: true,

    /**
    * @hide 
    * @method autoSize
    */
    autoSize: Ext.emptyFn,

    // private
    initComponent: function() {
        Ext.form.FileUploadField.superclass.initComponent.call(this);

        this.addEvents(
        /**
        * @event fileselected
        * Fires when the underlying file input field's value has changed from the user
        * selecting a new file from the system file selection dialog.
        * @param {Ext.form.FileUploadField} this
        * @param {String} value The file value returned by the underlying file input field
        */
            'fileselected'
        );
    },

    // private
    onRender: function(ct, position) {
        Ext.form.FileUploadField.superclass.onRender.call(this, ct, position);

        this.wrap = this.el.wrap({ cls: 'x-form-field-wrap x-form-file-wrap' });
        this.el.addClass('x-form-file-text');
        this.el.dom.removeAttribute('name');

        this.fileInput = this.wrap.createChild({
            id: this.getFileInputId(),
            name: this.name || this.getId(),
            cls: 'x-form-file',
            tag: 'input',
            type: 'file',
            size: 1
        });

        var btnCfg = Ext.applyIf(this.buttonCfg || {}, {
            text: this.buttonText
        });
        this.button = new Ext.Button(Ext.apply(btnCfg, {
            renderTo: this.wrap,
            cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : '')
        }));

        if (this.buttonOnly) {
            this.el.hide();
            this.wrap.setWidth(this.button.getEl().getWidth());
        }

        this.fileInput.on('change', function() {
            var v = this.fileInput.dom.value;
            this.setValue(v);
            this.fireEvent('fileselected', this, v);
        }, this);
    },

    // private
    getFileInputId: function() {
        return this.id + '-file';
    },

    // private
    onResize: function(w, h) {
        Ext.form.FileUploadField.superclass.onResize.call(this, w, h);

        this.wrap.setWidth(w);

        if (!this.buttonOnly) {
            var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset;
            this.el.setWidth(w);
        }
    },

    // private
    preFocus: Ext.emptyFn,

    // private
    getResizeEl: function() {
        return this.wrap;
    },

    // private
    getPositionEl: function() {
        return this.wrap;
    },

    // private
    alignErrorIcon: function() {
        this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
    }

});
Ext.reg('fileuploadfield', Ext.form.FileUploadField)
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.form.FileUploadField.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.form.FileUploadField.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/**
 * RowActions plugin for Ext grid
 *
 * Contains renderer for icons and fires events when an icon is clicked
 *
 * @author    Ing. Jozef Sakáloš
 * @date      22. March 2008
 * @version   $Id: Ext.ux.grid.RowActions.js 262 2008-05-15 14:55:29Z jozo $
 *
 * @license Ext.ux.grid.RowActions is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * License details: http://www.gnu.org/licenses/lgpl.html
 */

/*global Ext */

// add RegExp.escape if it has not been already added
if('function' !== typeof RegExp.escape) {
	RegExp.escape = function(s) {
		if('string' !== typeof s) {
			return s;
		}
		// Note: if pasting from forum, precede ]/\ with backslash manually
		return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
	}; // eo function escape
}


Ext.ns('Ext.ux.grid');

/**
 * @class Ext.ux.grid.RowActions
 * @extends Ext.util.Observable
 *
 * CSS rules from Ext.ux.RowActions.css are mandatory
 *
 * Important general information: Actions are identified by iconCls. Wherever an <i>action</i>
 * is referenced (event argument, callback argument), the iconCls of clicked icon is used.
 * In another words, action identifier === iconCls.
 *
 * Creates new RowActions plugin
 * @constructor
 * @param {Object} config The config object
 */
Ext.ux.grid.RowActions = function(config) {
	Ext.apply(this, config);

	// {{{
	this.addEvents(
		/**
		 * @event beforeaction
		 * Fires before action event. Return false to cancel the subsequent action event.
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Ext.data.Record} record Record corresponding to row clicked
		 * @param {String} action Identifies the action icon clicked. Equals to icon css class name.
		 * @param {Integer} rowIndex Index of clicked grid row
		 * @param {Integer} colIndex Index of clicked grid column that contains all action icons
		 */
		 'beforeaction'
		/**
		 * @event action
		 * Fires when icon is clicked
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Ext.data.Record} record Record corresponding to row clicked
		 * @param {String} action Identifies the action icon clicked. Equals to icon css class name.
		 * @param {Integer} rowIndex Index of clicked grid row
		 * @param {Integer} colIndex Index of clicked grid column that contains all action icons
		 */
		,'action'
		/**
		 * @event beforegroupaction
		 * Fires before group action event. Return false to cancel the subsequent groupaction event.
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Array} records Array of records in this group
		 * @param {String} action Identifies the action icon clicked. Equals to icon css class name.
		 * @param {String} groupId Identifies the group clicked
		 */
		,'beforegroupaction'
		/**
		 * @event groupaction
		 * Fires when icon in a group header is clicked
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Array} records Array of records in this group
		 * @param {String} action Identifies the action icon clicked. Equals to icon css class name.
		 * @param {String} groupId Identifies the group clicked
		 */
		,'groupaction'
	);
	// }}}

	// call parent
	Ext.ux.grid.RowActions.superclass.constructor.call(this);
};

Ext.extend(Ext.ux.grid.RowActions, Ext.util.Observable, {

	// configuration options
	// {{{
	/**
	 * @cfg {Array} actions Mandatory. Array of action configuration objects. The following
	 * configuration options of action are recognized:
	 *
	 * - @cfg {Function} callback Optional. Function to call if the action icon is clicked.
	 *   This function is called with same signature as action event and in its original scope.
	 *   If you need to call it in different scope or with another signature use 
	 *   createCallback or createDelegate functions. Works for statically defined actions. Use
	 *   callbacks configuration options for store bound actions.
	 *
	 * - @cfg {Function} cb Shortcut for callback.
	 *
	 * - @cfg {String} iconIndex Optional, however either iconIndex or iconCls must be
	 *   configured. Field name of the field of the grid store record that contains
	 *   css class of the icon to show. If configured, shown icons can vary depending
	 *   of the value of this field.
	 *
	 * - @cfg {String} iconCls. css class of the icon to show. It is ignored if iconIndex is
	 *   configured. Use this if you want static icons that are not base on the values in the record.
	 *
	 * - @cfg {Boolean} hide Optional. True to hide this action while still have a space in 
	 *   the grid column allocated to it. IMO, it doesn't make too much sense, use hideIndex instead.
	 *
	 * - @cfg (string} hideIndex Optional. Field name of the field of the grid store record that
	 *   contains hide flag (falsie [null, '', 0, false, undefined] to show, anything else to hide).
	 *
	 * - @cfg {String} qtipIndex Optional. Field name of the field of the grid store record that 
	 *   contains tooltip text. If configured, the tooltip texts are taken from the store.
	 *
	 * - @cfg {String} tooltip Optional. Tooltip text to use as icon tooltip. It is ignored if 
	 *   qtipIndex is configured. Use this if you want static tooltips that are not taken from the store.
	 *
	 * - @cfg {String} qtip Synonym for tooltip
	 *
	 * - @cfg {String} textIndex Optional. Field name of the field of the grids store record
	 *   that contains text to display on the right side of the icon. If configured, the text
	 *   shown is taken from record.
	 *
	 * - @cfg {String} text Optional. Text to display on the right side of the icon. Use this
	 *   if you want static text that are not taken from record. Ignored if textIndex is set.
	 *
	 * - @cfg {String} style Optional. Style to apply to action icon container.
	 */

	/**
	 * @cfg {String} actionEvnet Event to trigger actions, e.g. click, dblclick, mouseover (defaults to 'click')
	 */
	 actionEvent:'click'

	/**
	 * @cfg {Boolean} autoWidth true to calculate field width for iconic actions only.
	 */
	,autoWidth:true

	/**
	 * @cfg {String} dataIndex - Do not touch!
	 * @private
	 */
	,dataIndex:''

	/**
	 * @cfg {Array} groupActions Array of action to use for group headers of grouping grids.
	 * These actions support static icons, texts and tooltips same way as actions. There is one
	 * more action config recognized:
	 * - @cfg {String} align Set it to 'left' to place action icon next to the group header text.
	 *   (defaults to undefined = icons are placed at the right side of the group header.
	 */

	/**
	 * @cfg {Object} callbacks iconCls keyed object that contains callback functions. For example:
	 * callbacks:{
	 *      'icon-open':function(...) {...}
	 *     ,'icon-save':function(...) {...}
	 * }
	 */

	/**
	 * @cfg {String} header Actions column header
	 */
	,header:''

	/**
	 * @cfg {Boolean} menuDisabled No sense to display header menu for this column
	 */
	,menuDisabled:true

	/**
	 * @cfg {Boolean} sortable Usually it has no sense to sort by this column
	 */
	,sortable:false

	/**
	 * @cfg {String} tplGroup Template for group actions
	 * @private
	 */
	,tplGroup:
		 '<tpl for="actions">'
		+'<div class="ux-grow-action-item<tpl if="\'right\'===align"> ux-action-right</tpl> '
		+'{cls}" style="{style}" qtip="{qtip}">{text}</div>'
		+'</tpl>'

	/**
	 * @cfg {String} tplRow Template for row actions
	 * @private
	 */
	,tplRow:
		 '<div class="ux-row-action">'
		+'<tpl for="actions">'
		+'<div class="ux-row-action-item {cls} <tpl if="text">'
		+'ux-row-action-text</tpl>" style="{hide}{style}" qtip="{qtip}">'
		+'<tpl if="text"><span qtip="{qtip}">{text}</span></tpl></div>'
		+'</tpl>'
		+'</div>'

	/**
	 * @cfg {String} hideMode How to hide hidden icons. Valid values are: visibility and display
	 * (defaluts to visibility).
	 */
	,hideMode:'visiblity'

	/**
	 * @cfg {Number} widthIntercept constant used for auto-width calculation
	 */
	,widthIntercept:4

	/**
	 * @cfg {Number} widthSlope constant used for auto-width calculation
	 */
	,widthSlope:21
	// }}}

	// methods
	// {{{
	/**
	 * Init function
	 * @param {Ext.grid.GridPanel} grid Grid this plugin is in
	 */
	,init:function(grid) {
		this.grid = grid;
		
		// {{{
		// setup template
		if(!this.tpl) {
			this.tpl = this.processActions(this.actions);

		} // eo template setup
		// }}}

		// calculate width
		if(this.autoWidth) {
			this.width =  this.widthSlope * this.actions.length + this.widthIntercept;
			this.fixed = true;
		}

		// body click handler
		var view = grid.getView();
		var cfg = {scope:this};
		cfg[this.actionEvent] = this.onClick;
		grid.afterRender = grid.afterRender.createSequence(function() {
			view.mainBody.on(cfg);
		}, this);
//		grid.on({
//			render:{scope:this, fn:function() {
//				view.mainBody.on(cfg);
//			}}
//		});

		// setup renderer
		if(!this.renderer) {
			this.renderer = function(value, cell, record, row, col, store) {
				cell.css += (cell.css ? ' ' : '') + 'ux-row-action-cell';
				return this.tpl.apply(this.getData(value, cell, record, row, col, store));
			}.createDelegate(this);
		}

		// actions in grouping grids support
		if(view.groupTextTpl && this.groupActions) {
			view.interceptMouse = view.interceptMouse.createInterceptor(function(e) {
				if(e.getTarget('.ux-grow-action-item')) {
					return false;
				}
			});
			view.groupTextTpl = 
				 '<div class="ux-grow-action-text">' + view.groupTextTpl +'</div>' 
				+this.processActions(this.groupActions, this.tplGroup).apply()
			;
		}
		
	} // eo function init
	// }}}
	// {{{
	/**
	 * Returns data to apply to template. Override this if needed.
	 * @param {Mixed} value 
	 * @param {Object} cell object to set some attributes of the grid cell
	 * @param {Ext.data.Record} record from which the data is extracted
	 * @param {Number} row row index
	 * @param {Number} col col index
	 * @param {Ext.data.Store} store object from which the record is extracted
	 * @returns {Object} data to apply to template
	 */
	,getData:function(value, cell, record, row, col, store) {
		return record.data || {};
	} // eo function getData
	// }}}
	// {{{
	/**
	 * Processes actions configs and returns template.
	 * @param {Array} actions
	 * @param {String} template Optional. Template to use for one action item.
	 * @return {String}
	 * @private
	 */
	,processActions:function(actions, template) {
		var acts = [];

		// actions loop
		Ext.each(actions, function(a, i) {
			// save callback
			if(a.iconCls && 'function' === typeof (a.callback || a.cb)) {
				this.callbacks = this.callbacks || {};
				this.callbacks[a.iconCls] = a.callback || a.cb;
			}

			// data for intermediate template
			var o = {
				 cls:a.iconIndex ? '{' + a.iconIndex + '}' : (a.iconCls ? a.iconCls : '')
				,qtip:a.qtipIndex ? '{' + a.qtipIndex + '}' : (a.tooltip || a.qtip ? a.tooltip || a.qtip : '')
				,text:a.textIndex ? '{' + a.textIndex + '}' : (a.text ? a.text : '')
				,hide:a.hideIndex 
					? '<tpl if="' + a.hideIndex + '">' 
						+ ('display' === this.hideMode ? 'display:none' :'visibility:hidden') + ';</tpl>' 
					: (a.hide ? ('display' === this.hideMode ? 'display:none' :'visibility:hidden;') : '')
				,align:a.align || 'right'
				,style:a.style ? a.style : ''
			};
			acts.push(o);

		}, this); // eo actions loop

		var xt = new Ext.XTemplate(template || this.tplRow);
		return new Ext.XTemplate(xt.apply({actions:acts}));

	} // eo function processActions
	// }}}
	// {{{
	/**
	 * Grid body actionEvent event handler
	 * @private
	 */
	,onClick:function(e, target) {

		var view = this.grid.getView();
		var action = false;

		// handle row action click
		var row = e.getTarget('.x-grid3-row');
		var col = view.findCellIndex(target.parentNode.parentNode);

		var t = e.getTarget('.ux-row-action-item');
		if(t) {
			action = t.className.replace(/ux-row-action-item /, '');
			if(action) {
				action = action.replace(/ ux-row-action-text/, '');
				action = action.trim();
			}
		}
		if(false !== row && false !== col && false !== action) {
			var record = this.grid.store.getAt(row.rowIndex);

			// call callback if any
			if(this.callbacks && 'function' === typeof this.callbacks[action]) {
				this.callbacks[action](this.grid, record, action, row.rowIndex, col);
			}

			// fire events
			if(true !== this.eventsSuspended && false === this.fireEvent('beforeaction', this.grid, record, action, row.rowIndex, col)) {
				return;
			}
			else if(true !== this.eventsSuspended) {
				this.fireEvent('action', this.grid, record, action, row.rowIndex, col);
			}

		}

		// handle group action click
		t = e.getTarget('.ux-grow-action-item');
		if(t) {
			// get groupId
			var group = view.findGroup(target);
			var groupId = group ? group.id.replace(/ext-gen[0-9]+-gp-/, '') : null;

			// get matching records
			var records;
			if(groupId) {
				var re = new RegExp(RegExp.escape(groupId));
				records = this.grid.store.queryBy(function(r) {
					return r._groupId.match(re);
				});
				records = records ? records.items : [];
			}
			action = t.className.replace(/ux-grow-action-item (ux-action-right )*/, '');

			// call callback if any
			if('function' === typeof this.callbacks[action]) {
				this.callbacks[action](this.grid, records, action, groupId);
			}

			// fire events
			if(true !== this.eventsSuspended && false === this.fireEvent('beforegroupaction', this.grid, records, action, groupId)) {
				return false;
			}
			this.fireEvent('groupaction', this.grid, records, action, groupId);
		}
	} // eo function onClick
	// }}}

});

// registre xtype
Ext.reg('rowactions', Ext.ux.grid.RowActions);

// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.ux.grid.RowActions.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.ux.grid.RowActions.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/*global Ext */
/**
 * @class Ext.ux.grid.CellActions
 * @extends Ext.util.Observable
 *
 * CellActions plugin for Ext grid
 *
 * CellActions plugin causes that column model recognizes the config property cellAcions
 * that is the array of configuration objects for that column. The documentationi follows.
 *
 * THE FOLLOWING CONFIG OPTIONS ARE FOR COLUMN MODEL COLUMN, NOT FOR CellActions ITSELF.
 *
 * @cfg {Array} cellActions Mandatory. Array of action configuration objects. The following
 * configuration options of action are recognized:
 *
 * - @cfg {Function} callback Optional. Function to call if the action icon is clicked.
 *   This function is called with same signature as action event and in its original scope.
 *   If you need to call it in different scope or with another signature use 
 *   createCallback or createDelegate functions. Works for statically defined actions. Use
 *   callbacks configuration options for store bound actions.
 *
 * - @cfg {Function} cb Shortcut for callback.
 *
 * - @cfg {String} iconIndex Optional, however either iconIndex or iconCls must be
 *   configured. Field name of the field of the grid store record that contains
 *   css class of the icon to show. If configured, shown icons can vary depending
 *   of the value of this field.
 *
 * - @cfg {String} iconCls. css class of the icon to show. It is ignored if iconIndex is
 *   configured. Use this if you want static icons that are not base on the values in the record.
 *
 * - @cfg {String} qtipIndex Optional. Field name of the field of the grid store record that 
 *   contains tooltip text. If configured, the tooltip texts are taken from the store.
 *
 * - @cfg {String} tooltip Optional. Tooltip text to use as icon tooltip. It is ignored if 
 *   qtipIndex is configured. Use this if you want static tooltips that are not taken from the store.
 *
 * - @cfg {String} qtip Synonym for tooltip
 *
 * - @cfg {String} style Optional. Style to apply to action icon container.
 *
 * The following css is required:
 *
 * .ux-cell-value {
 * 	position:relative;
 * 	zoom:1;
 * }
 * .ux-cell-actions {
 * 	position:absolute;
 * 	right:0;
 * 	top:-2px;
 * }
 * .ux-cell-actions-left {
 * 	left:0;
 * 	top:-2px;
 * }
 * .ux-cell-action {
 * 	width:16px;
 * 	height:16px;
 * 	float:left;
 * 	cursor:pointer;
 * 	margin: 0 0 0 4px;
 * }
 * .ux-cell-actions-left .ux-cell-action {
 * 	margin: 0 4px 0 0;
 * }
 * @author    Ing. Jozef Sakáloš
 * @date      22. March 2008
 * @version   1.0
 * @revision  $Id: Ext.ux.grid.CellActions.js 589 2009-02-21 23:30:18Z jozo $
 *
 * @license Ext.ux.grid.CellActions is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
 *
 * @forum     30411
 * @demo      http://cellactions.extjs.eu
 * @download  
 * <ul>
 * <li><a href="http://cellactions.extjs.eu/cellactions.tar.bz2">cellactions.tar.bz2</a></li>
 * <li><a href="http://cellactions.extjs.eu/cellactions.tar.gz">cellactions.tar.gz</a></li>
 * <li><a href="http://cellactions.extjs.eu/cellactions.zip">cellactions.zip</a></li>
 * </ul>
 *
 * @donate
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
 * <input type="hidden" name="cmd" value="_s-xclick">
 * <input type="hidden" name="hosted_button_id" value="3430419">
 * <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" 
 * border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
 * <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 * </form>
 */

Ext.ns('Ext.ux.grid');

// constructor and cellActions documentation
// {{{
/**
 * Creates new CellActions
 * @constructor
 * @param {Object} config A config object
 */
Ext.ux.grid.CellActions = function(config) {
	Ext.apply(this, config);

	this.addEvents(
		/**
		 * @event action
		 * Fires when user clicks a cell action
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Ext.data.Record} record Record containing data of clicked cell
		 * @param {String} action Action clicked (equals iconCls);
		 * @param {Mixed} value Value of the clicke cell
		 * @param {String} dataIndex as specified in column model
		 * @param {Number} rowIndex Index of row clicked
		 * @param {Number} colIndex Incex of col clicked
		 */
		'action'
		/**
		 * @event beforeaction
		 * Fires when user clicks a cell action but before action event is fired. Return false to cancel the action;
		 * @param {Ext.grid.GridPanel} grid
		 * @param {Ext.data.Record} record Record containing data of clicked cell
		 * @param {String} action Action clicked (equals iconCls);
		 * @param {Mixed} value Value of the clicke cell
		 * @param {String} dataIndex as specified in column model
		 * @param {Number} rowIndex Index of row clicked
		 * @param {Number} colIndex Incex of col clicked
		 */
		,'beforeaction'
	);
	// call parent
	Ext.ux.grid.CellActions.superclass.constructor.call(this);

}; // eo constructor
// }}}

Ext.extend(Ext.ux.grid.CellActions, Ext.util.Observable, {

	/**
	 * @cfg {String} actionEvent Event to trigger actions, e.g. click, dblclick, mouseover (defaults to 'click')
	 */
	 actionEvent:'click'

	/**
	 * @cfg {Number} actionWidth Width of action icon in pixels. Has effect only if align:'left'
	 */
	,actionWidth:20

	/**
	 * @cfg {String} align Set to 'left' to put action icons before the cell text. (defaults to undefined, meaning right)
	 */

	/**
	 * @private
	 * @cfg {String} tpl Template for cell with actions
	 */
	,tpl:'<div class="ux-cell-value" style="padding-left:{padding}px">'
			+'<tpl if="\'left\'!==align">{value}</tpl>'
		 	+'<div class="ux-cell-actions<tpl if="\'left\'===align"> ux-cell-actions-left</tpl>" style="width:{width}px">'
				+'<tpl for="actions"><div class="ux-cell-action {cls}" qtip="{qtip}" style="{style}">&#160;</div></tpl>'
			+'</div>'
			+'<tpl if="\'left\'===align">{value}</tpl>'
		+'<div>'
		
	/**
	 * Called at the end of processActions. Override this if you need it.
	 * @param {Object} c Column model configuration object
	 * @param {Object} data See this.processActions method for details
	 */
	,userProcessing:Ext.emptyFn

	// {{{
	/**
	 * Init function
	 * @param {Ext.grid.GridPanel} grid Grid this plugin is in
	 */
	,init:function(grid) {
		this.grid = grid;
//		grid.on({scope:this, render:this.onRenderGrid});
		grid.afterRender = grid.afterRender.createSequence(this.onRenderGrid, this);

		var cm = this.grid.getColumnModel();
		Ext.each(cm.config, function(c, idx) {
			if('object' === typeof c.cellActions) {
				c.origRenderer = cm.getRenderer(idx);
				c.renderer = this.renderActions.createDelegate(this);
			}
		}, this);


	} // eo function init
	// }}}
	// {{{
	/**
	 * grid render event handler, install actionEvent handler on view.mainBody
	 * @private
	 */
	,onRenderGrid:function() {

		// install click event handler on view mainBody
		this.view = this.grid.getView();
		var cfg = {scope:this};
		cfg[this.actionEvent] = this.onClick;
		this.view.mainBody.on(cfg);

	} // eo function onRender
	// }}}
	// {{{
	/**
	 * Returns data to apply to template. Override this if needed
	 * @param {Mixed} value 
	 * @param {Object} cell object to set some attributes of the grid cell
	 * @param {Ext.data.Record} record from which the data is extracted
	 * @param {Number} row row index
	 * @param {Number} col col index
	 * @param {Ext.data.Store} store object from which the record is extracted
	 * @returns {Object} data to apply to template
	 */
	,getData:function(value, cell, record, row, col, store) {
		return record.data || {};
	}
	// }}}
	// {{{
	/**
	 * replaces (but calls) the original renderer from column model
	 * @private
	 * @param {Mixed} value 
	 * @param {Object} cell object to set some attributes of the grid cell
	 * @param {Ext.data.Record} record from which the data is extracted
	 * @param {Number} row row index
	 * @param {Number} col col index
	 * @param {Ext.data.Store} store object from which the record is extracted
	 * @returns {String} markup of cell content
	 */
	,renderActions:function(value, cell, record, row, col, store) {

		// get column config from column model
		var c = this.grid.getColumnModel().config[col];

		// get output of the original renderer
		var val = c.origRenderer(value, cell, record, row, col, store);

		// get actions template if we need but don't have one
		if(c.cellActions && !c.actionsTpl) {
			c.actionsTpl = this.processActions(c);
			c.actionsTpl.compile();
		}
		// return original renderer output if we don't have actions
		else if(!c.cellActions) {
			return val;
		}

		// get and return final markup
		var data = this.getData.apply(this, arguments);
		data.value = val;
		return c.actionsTpl.apply(data);

	} // eo function renderActions
	// }}}
	// {{{
	/**
	 * processes the actions configs from column model column, saves callbacks and creates template
	 * @param {Object} c column model config of one column
	 * @private
	 */
	,processActions:function(c) {

		// callbacks holder
		this.callbacks = this.callbacks || {};

		// data for intermediate template
		var data = {
			 align:this.align || 'right'
			,width:this.actionWidth * c.cellActions.length
			,padding:'left' === this.align ? this.actionWidth * c.cellActions.length : 0
			,value:'{value}'
			,actions:[]
		};

		// cellActions loop
		Ext.each(c.cellActions, function(a, i) {

			// save callback
			if(a.iconCls && 'function' === typeof (a.callback || a.cb)) {
				this.callbacks[a.iconCls] = a.callback || a.cb;
			}

			// data for intermediate xtemplate action
			var o = {
				 cls:a.iconIndex ? '{' + a.iconIndex + '}' : (a.iconCls ? a.iconCls : '')
				,qtip:a.qtipIndex ? '{' + a.qtipIndex + '}' : (a.tooltip || a.qtip ? a.tooltip || a.qtip : '')
				,style:a.style ? a.style : ''
			};
			data.actions.push(o);

		}, this); // eo cellActions loop

		this.userProcessing(c, data);

		// get and return final template
		var xt = new Ext.XTemplate(this.tpl);
		return new Ext.Template(xt.apply(data));

	} // eo function processActions
	// }}}
	// {{{
	/**
	 * Grid body actionEvent event handler
	 * @private
	 */
	,onClick:function(e, target) {

		// collect all variables for callback and/or events
		var t = e.getTarget('div.ux-cell-action');
		var row = e.getTarget('.x-grid3-row');
		var col = this.view.findCellIndex(target.parentNode.parentNode);
		var c = this.grid.getColumnModel().config[col];
		var record, dataIndex, value, action;
		if(t) {
			record = this.grid.store.getAt(row.rowIndex);
			dataIndex = c.dataIndex;
			value = record.get(dataIndex);
			action = t.className.replace(/ux-cell-action /, '');
		}

		// check if we've collected all necessary variables
		if(false !== row && false !== col && record && dataIndex && action) {

			// call callback if any
			if(this.callbacks && 'function' === typeof this.callbacks[action]) {
				this.callbacks[action](this.grid, record, action, value, dataIndex, row.rowIndex, col);
			}

			// fire events
			if(true !== this.eventsSuspended && false === this.fireEvent('beforeaction', this.grid, record, action, value, dataIndex, row.rowIndex, col)) {
				return;
			}
			else if(true !== this.eventsSuspended) {
				this.fireEvent('action', this.grid, record, action, value, dataIndex, row.rowIndex, col);
			}

		}
	} // eo function onClick
	// }}}

});

// register xtype
Ext.reg('cellactions', Ext.ux.grid.CellActions);

// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/Ext.ux.grid.CellActions.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/Ext.ux.grid.CellActions.js');
Ext.namespace("Ext.ux.grid.filter");
/** 
 * @class Ext.ux.grid.filter.Filter
 * @extends Ext.util.Observable
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.Filter = function(config){
	Ext.apply(this, config);
		
	this.addEvents(
		/**
		 * Fires when an inactive filter becomes active
		 * @event activate
		 * @param {Ext.ux.grid.filter.Filter} this
		 */
		'activate',
		/**
		 * Fires when an active filter becomes inactive
		 * @event deactivate
		 * @param {Ext.ux.grid.filter.Filter} this
		 */
		'deactivate',
		/**
		 * Fires after the serialization process. Use this to attach additional parameters to serialization
		 * data before it is encoded and sent to the server.
		 * @event serialize
		 * @param {Array/Object} data A map or collection of maps representing the current filter configuration.
		 * @param {Ext.ux.grid.filter.Filter} filter The filter being serialized.
		 */
		'serialize',
		/**
		 * Fires when a filter configuration has changed
		 * @event update
		 * @param {Ext.ux.grid.filter.Filter} this
		 */
		'update'
	);
	Ext.ux.grid.filter.Filter.superclass.constructor.call(this);
	
	this.menu = new Ext.menu.Menu();
	this.init(config);
	
	if(config && config.value){
		this.setValue(config.value);
		this.setActive(config.active !== false, true);
		delete config.value;
	}
};
/** @private */
Ext.extend(Ext.ux.grid.filter.Filter, Ext.util.Observable, {
	/**
	 * @cfg {Boolean} active
	 * Indicates the default status of the filter (defaults to false).
	 */
    /**
     * True if this filter is active.  Use setActive() to alter after configuration.
     * @type Boolean
     * @property
     */
	active: false,
	/**
	 * @cfg {String} dataIndex 
	 * The {@link Ext.data.Store} data index of the field this filter represents. The dataIndex
	 * does not actually have to exist in the store.
	 */
	dataIndex: null,
	/**
	 * The filter configuration menu that will be installed into the filter submenu of a column menu.
	 * @type Ext.menu.Menu
	 * @property
	 */
	menu: null,
	
	/**
	 * @cfg {Number} updateBuffer
	 * Number of milliseconds to wait after user interaction to fire an update. Only supported 
	 * by filters: 'list', 'numeric', and 'string'. Defaults to 500.
	 */
	updateBuffer: 500,
	
	/**
	 * Initialize the filter and install required menu items.
	 */
	/** @private */
	init: Ext.emptyFn,
	
	/** @private */
	fireUpdate: function(){
		if(this.active)
			this.fireEvent("update", this);
			
		this.setActive(this.isActivatable());
	},
	
	/**
	 * Returns true if the filter has enough configuration information to be activated.
	 * @return {Boolean}
	 */
	isActivatable: function(){
		return true;
	},
	
	/**
	 * Sets the status of the filter and fires the appropriate events.
	 * @param {Boolean} active        The new filter state.
	 * @param {Boolean} suppressEvent True to prevent events from being fired.
	 * @methodOf Ext.ux.grid.filter.Filter
	 */
	setActive: function(active, suppressEvent){
		if(this.active != active){
			this.active = active;
			if(suppressEvent !== true)
				this.fireEvent(active ? 'activate' : 'deactivate', this);
		}
	},
	
	/**
	 * Get the value of the filter
	 * @return {Object} The 'serialized' form of this filter
	 * @methodOf Ext.ux.grid.filter.Filter
	 */
	getValue: Ext.emptyFn,
	
	/**
	 * Set the value of the filter.
	 * @param {Object} data The value of the filter
	 * @methodOf Ext.ux.grid.filter.Filter
	 */	
	setValue: Ext.emptyFn,
	
	/**
	 * Serialize the filter data for transmission to the server.
	 * @return {Object/Array} An object or collection of objects containing key value pairs representing
	 * 	the current configuration of the filter.
	 * @methodOf Ext.ux.grid.filter.Filter
	 */
	serialize: Ext.emptyFn,
	
	/**
	 * Validates the provided Ext.data.Record against the filters configuration.
	 * @param {Ext.data.Record} record The record to validate
	 * @return {Boolean} True if the record is valid with in the bounds of the filter, false otherwise.
	 */
	 validateRecord: function(){return true;}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/Filter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/Filter.js');
/** 
 * Boolean filters use unique radio group IDs (so you can have more than one!)
 * 
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var filters = new Ext.ux.grid.GridFilters({
     ...
     filters: [{
         type: 'boolean',
         defaultValue: null, //leave unselected (false selected by default)
         yesText: 'Yes', //default
         noText: 'No', //default
         dataIndex: 'visible'
     }]
 });
});</code></pre>
 * 
 * @class Ext.ux.grid.filter.BooleanFilter
 * @extends Ext.ux.grid.filter.Filter
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.BooleanFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
	/**
	 * @cfg {Boolean} defaultValue
	 * Set this to null if you do not want either option to be checked by default. Defaults to false.
	 */
	defaultValue: false,
	/**
	 * @cfg {String} yesText
	 * Defaults to "Yes".
	 */
	yesText: "Yes",
	/**
	 * @cfg {String} noText
	 * Defaults to "No".
	 */
	noText:  "No",

	/** @private */
	init: function(){
    var gId = Ext.id();
		this.options = [
			new Ext.menu.CheckItem({text: this.yesText, group: gId, checked: this.defaultValue === true}),
			new Ext.menu.CheckItem({text: this.noText, group: gId, checked: this.defaultValue === false})];
		
		this.menu.add(this.options[0], this.options[1]);
		
		for(var i=0; i<this.options.length; i++){
			this.options[i].on('click', this.fireUpdate, this);
			this.options[i].on('checkchange', this.fireUpdate, this);
		}
	},
	
	isActivatable: function(){
		return true;
	},
	
	fireUpdate: function(){		
		this.fireEvent("update", this);			
		this.setActive(true);
	},
	
	setValue: function(value){
		this.options[value ? 0 : 1].setChecked(true);
	},
	
	getValue: function(){
		return this.options[0].checked;
	},
	
	serialize: function(){
		var args = {type: 'boolean', value: this.getValue()};
		this.fireEvent('serialize', args, this);
		return args;
	},
	
	validateRecord: function(record){
		return record.get(this.dataIndex) == this.getValue();
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/BooleanFilter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/BooleanFilter.js');
/** 
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var filters = new Ext.ux.grid.GridFilters({
     ...
     filters: [{
         type: 'date',
         dateFormat: 'm/d/Y', //default
         beforeText: 'Before', //default
         afterText: 'After', //default
         onText: 'On', //default
         dataIndex: 'dateAdded'
     }]
 });
});</code></pre>
 * 
 * @class Ext.ux.grid.filter.DateFilter
 * @extends Ext.ux.grid.filter.Filter
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.DateFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
	/**
	 * @cfg {String} dateFormat
	 * Defaults to 'm/d/Y'.
	 */
	dateFormat: 'm/d/Y',
	/** @private */
	pickerOpts: {},
	/**
	 * @cfg {String} beforeText
	 * Defaults to 'Before'.
	 */
    beforeText: 'Before',
	/**
	 * @cfg {String} afterText
	 * Defaults to 'After'.
	 */
    afterText:  'After',
	/**
	 * @cfg {String} onText
	 * Defaults to 'On'.
	 */
    onText:     'On',
	
	/** @private */
	init: function(){
		var opts = Ext.apply(this.pickerOpts, {
			minDate: this.minDate, 
			maxDate: this.maxDate, 
			format:  this.dateFormat
		});
		var dates = this.dates = {
			'before': new Ext.menu.CheckItem({text: this.beforeText, menu: new Ext.menu.DateMenu(opts)}),
			'after':  new Ext.menu.CheckItem({text: this.afterText, menu: new Ext.menu.DateMenu(opts)}),
			'on':     new Ext.menu.CheckItem({text: this.onText, menu: new Ext.menu.DateMenu(opts)})};
				
		this.menu.add(dates.before, dates.after, "-", dates.on);
		
		for(var key in dates){
			var date = dates[key];
			date.menu.on('select', function(date, menuItem, value, picker){
				date.setChecked(true);
				
				if(date == dates.on){
					dates.before.setChecked(false, true);
					dates.after.setChecked(false, true);
				} else {
					dates.on.setChecked(false, true);
					
					if(date == dates.after && dates.before.menu.picker.value < value)
            dates.before.setChecked(false, true);
          else if (date == dates.before && dates.after.menu.picker.value > value)
            dates.after.setChecked(false, true);
				}
				
				this.fireEvent("update", this);
			}.createDelegate(this, [date], 0));
			
			date.on('checkchange', function(){
				this.setActive(this.isActivatable());
			}, this);
		};
	},
	
    /**
     * @param {Object} field
     */
	getFieldValue: function(field){
		return this.dates[field].menu.picker.getValue();
	},
	
    /**
     * @param {Object} field
     */
	getPicker: function(field){
		return this.dates[field].menu.picker;
	},
	
	isActivatable: function(){
		return this.dates.on.checked || this.dates.after.checked || this.dates.before.checked;
	},
	
	setValue: function(value){
		for(var key in this.dates)
			if(value[key]){
				this.dates[key].menu.picker.setValue(value[key]);
				this.dates[key].setChecked(true);
			} else {
				this.dates[key].setChecked(false);
			}
	},
	
	getValue: function(){
		var result = {};
		for(var key in this.dates)
			if(this.dates[key].checked)
				result[key] = this.dates[key].menu.picker.getValue();
				
		return result;
	},
	
	serialize: function(){
		var args = [];
		if(this.dates.before.checked)
			args = [{type: 'date', comparison: 'lt', value: this.getFieldValue('before').format(this.dateFormat)}];
		if(this.dates.after.checked)
			args.push({type: 'date', comparison: 'gt', value: this.getFieldValue('after').format(this.dateFormat)});
		if(this.dates.on.checked)
			args = {type: 'date', comparison: 'eq', value: this.getFieldValue('on').format(this.dateFormat)};

    this.fireEvent('serialize', args, this);
		return args;
	},
	
	validateRecord: function(record){
		var val = record.get(this.dataIndex).clearTime(true).getTime();
		
		if(this.dates.on.checked && val != this.getFieldValue('on').clearTime(true).getTime())
			return false;
		
		if(this.dates.before.checked && val >= this.getFieldValue('before').clearTime(true).getTime())
			return false;
		
		if(this.dates.after.checked && val <= this.getFieldValue('after').clearTime(true).getTime())
			return false;
			
		return true;
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/DateFilter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/DateFilter.js');
/** 
 * List filters are able to be preloaded/backed by an Ext.data.Store to load their options the first time they are shown.
 * ListFilter has been refactored to use a new Ext.ux.menu.ListMenu component
 * 
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var filters = new Ext.ux.grid.GridFilters({
     ...
     filters: [{
         type: 'list',
         dataIndex: 'size',
         options: ['extra small', 'small', 'medium', 'large', 'extra large'],
         phpMode: true
     }]
 });
});</code></pre>
 * 
 * @class Ext.ux.grid.filter.ListFilter
 * @extends Ext.ux.grid.filter.Filter
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.ListFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
	/**
	 * @cfg {Boolean} phpMode
	 * Defaults to false.
	 */
	phpMode:     false,
	
	/** @private */
	init: function(config){
		this.dt = new Ext.util.DelayedTask(this.fireUpdate, this);

		this.menu = new Ext.ux.menu.ListMenu(config);
		this.menu.on('checkchange', this.onCheckChange, this);
	},
	
	/** @private */
	onCheckChange: function(){
		this.dt.delay(this.updateBuffer);
	},
	
	isActivatable: function(){
		return this.menu.getSelected().length > 0;
	},
	
	setValue: function(value){
		this.menu.setSelected(value);
			
		this.fireEvent("update", this);
	},
	
	getValue: function(){
		return this.menu.getSelected();
	},
	
	serialize: function(){
	    var args = {type: 'list', value: this.phpMode ? this.getValue().join(',') : this.getValue()};
	    this.fireEvent('serialize', args, this);
		
		return args;
	},
	
	validateRecord: function(record){
		return this.getValue().indexOf(record.get(this.dataIndex)) > -1;
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/ListFilter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/ListFilter.js');
/** 
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var filters = new Ext.ux.grid.GridFilters({
     ...
     filters: [{
         type: 'numeric',
         dataIndex: 'price'
     }]
 });
});</code></pre>
 * 
 * @class Ext.ux.grid.filter.NumericFilter
 * @extends Ext.ux.grid.filter.Filter
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.NumericFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
	/** @private */
	init: function(){
		this.menu = new Ext.ux.menu.RangeMenu({updateBuffer: this.updateBuffer});
		
		this.menu.on("update", this.fireUpdate, this);
	},
	
	/** @private */
	fireUpdate: function(){
		this.setActive(this.isActivatable());
		this.fireEvent("update", this);
	},
	
	isActivatable: function(){
		var value = this.menu.getValue();
		return value.eq !== undefined || value.gt !== undefined || value.lt !== undefined;
	},
	
	setValue: function(value){
		this.menu.setValue(value);
	},
	
	getValue: function(){
		return this.menu.getValue();
	},
	
	serialize: function(){
		var args = [];
		var values = this.menu.getValue();
		for(var key in values)
			args.push({type: 'numeric', comparison: key, value: values[key]});

		this.fireEvent('serialize', args, this);
		return args;
	},
	
	validateRecord: function(record){
		var val    = record.get(this.dataIndex),
			values = this.menu.getValue();
			
		if(values.eq != undefined && val != values.eq)
			return false;
		
		if(values.lt != undefined && val >= values.lt)
			return false;
		
		if(values.gt != undefined && val <= values.gt)
			return false;
			
		return true;
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/NumericFilter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/NumericFilter.js');
/** 
 * 
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var filters = new Ext.ux.grid.GridFilters({
     ...
     filters: [{
         type: 'string',
         dataIndex: 'name',
         icon: 'ux-gridfilter-text-icon' //default
     }]
 });
});</code></pre>
 * 
 * @class Ext.ux.grid.filter.StringFilter
 * @extends Ext.ux.grid.filter.Filter
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.8 (Aug 22, 2008)
 */
Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
	/**
	 * @cfg {String} icon
	 * Defaults to 'ux-gridfilter-text-icon'.
	 */
	icon: 'ux-gridfilter-text-icon',
	
	/** @private */
	init: function(){
		var value = this.value = new Ext.ux.menu.EditableItem({iconCls: this.icon});
		value.on('keyup', this.onKeyUp, this);
		this.menu.add(value);
		
		this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
	},
	
	/** @private */
	onKeyUp: function(event){
		if(event.getKey() == event.ENTER){
			this.menu.hide(true);
			return;
		}
			
		this.updateTask.delay(this.updateBuffer);
	},
	
	isActivatable: function(){
		return this.value.getValue().length > 0;
	},
	
	/** @private */
	fireUpdate: function(){		
		if(this.active)
			this.fireEvent("update", this);
			
		this.setActive(this.isActivatable());
	},
	
	setValue: function(value){
		this.value.setValue(value);
		this.fireEvent("update", this);
	},
	
	getValue: function(){
		return this.value.getValue();
	},
	
	serialize: function(){
		var args = {type: 'string', value: this.getValue()};
		this.fireEvent('serialize', args, this);
		return args;
	},
	
	validateRecord: function(record){
		var val = record.get(this.dataIndex);
		
		if(typeof val != "string")
			return this.getValue().length == 0;
			
		return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/filter/StringFilter.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/filter/StringFilter.js');
Ext.namespace("Ext.ux.grid");
Ext.ux.grid.GridFilters = function(config){		
	this.filters = new Ext.util.MixedCollection();
	this.filters.getKey = function(o){return o ? o.dataIndex : null};
	
	for(var i=0, len=config.filters.length; i<len; i++)
		this.addFilter(config.filters[i]);
	
	this.deferredUpdate = new Ext.util.DelayedTask(this.reload, this);
	
	delete config.filters;
	Ext.apply(this, config);
};
/**
 * <p>GridFilter is a plug-in for grids that allow for a slightly more robust representation of filtering than what is 
 * provided by the default store.</p>
 * <p><b>Feature List:</b></p>
 * <ul>
 * <li>+ Packaged with filters for Strings, Numeric Ranges, Date Ranges, Lists (which can be backed by a Ext.data.Store), and Boolean</li>
 * <li>+ Additional custom filter types and menus are easily created by extending Ext.ux.grid.filter.Filter.</li>
 * <li>+ Optional local store filtering</li>
 * <li>+ Customizable parameter serialization.</li>
 * <li>+ If specified as a plugin to the grid's configured PagingToolbar, the current page will be reset to page 1 whenever you update the filters.</li>
 * <li>+ Grid configuration information can be persisted across page loads by passing a string value for the config option 'stateId'.</li>
 * <li>+ Filters can be configured in the grid's column header menu (this menu can be disabled through configuration). Through this menu users can configure, enable, and disable filters for each column. There has been some criticism by a few developers who feel that the filter configuration should be done in a single panel / window. However, the API does not preclude some one else writing a different interface entirely, but no one has taken up the call as of yet =)
 * <li>+ Fully event driven</li>
 * <li>++ The filter collection binds to the 'beforestaterestore' and 'beforestatesave' events in order to be stateful. Set your stateId on the associated grid.</li>
 * <li>++ A filterupdate event is added to the grid and is fired upon onStateChange completion.</li>
 * <li>+ Columns that are filtered have a configurable css class applied to the column headers.</li>
 * <li>++ Green tinted column header graphics and CSS classes for filtered columns </li>
 * <li>+ <a href="http://extjs.com/forum/showthread.php?p=149052#post149052">Localization support</a></li>
 * <li>+ EditableItem to has improved icon support</li>
 * <li>+ Icons are now all defined as styles in the resources/style.css file. You'll need to link to this in order to have them and get the new column header style. (no more need for prototype changes) </li>
 * </ul>
 * <br /><b>Example Usage:</b>
 * <pre><code>    
 var ds = new Ext.data.GroupingStore({
     ...
 });
 
 var filters = new Ext.ux.grid.GridFilters({
     autoReload: false, //don't reload automatically
     local: true,  //only filter locally
     filters: [{
        type: 'numeric',
         dataIndex: 'id'
     }, {
         type: 'string',
         dataIndex: 'name'
     }, {
         type: 'numeric',
         dataIndex: 'price'
     }, {
         type: 'date',
         dataIndex: 'dateAdded'
     }, {
         type: 'list',
         dataIndex: 'size',
         options: ['extra small', 'small', 'medium', 'large', 'extra large'],
         phpMode: true
     }, {
         type: 'boolean',
         dataIndex: 'visible'
     }]
 });
 
 var cm = new Ext.grid.ColumnModel([{
     ...
 }]);
 
 var grid = new Ext.grid.GridPanel({
     ds: ds,
     cm: cm,
     view: new Ext.grid.GroupingView(),
     plugins: filters,
     height: 400,
     width: 700,
     bbar: new Ext.PagingToolbar({
         store: ds,
         pageSize: 15,
         plugins: filters //reset page to page 1 if filters change
     })
 });
 grid.render();
 ds.load({params: {start: 0, limit: 15}});
});</code></pre>
 * <br /><b>Server side code examples:</b>
 * <ul>
 * <li><a href="http://www.vinylfox.com/extjs/grid-filter-php-backend-code.php">PHP</a> - (Thanks VinylFox)</li>
 * <li><a href="http://extjs.com/forum/showthread.php?p=77326#post77326">Ruby on Rails</a> - (Thanks Zyclops)</li>
 * <li><a href="http://extjs.com/forum/showthread.php?p=176596#post176596">Ruby on Rails</a> - (Thanks Rotomaul)</li>
 * <li><a href="http://www.debatablybeta.com/posts/using-extjss-grid-filtering-with-django/">Python</a> - (Thanks Matt)</li>
 * <li><a href="http://mcantrell.wordpress.com/2008/08/22/extjs-grids-and-grails/">Grails</a> - (Thanks Mike)</li>
 * </ul>
 * @class Ext.ux.grid.GridFilters
 * @extends Ext.util.Observable
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.2.9 (Sep 2, 2008)
 */
Ext.extend(Ext.ux.grid.GridFilters, Ext.util.Observable, {
    /**
    * @cfg {Array} filters
    * An Array of filters config objects. Refer to each filter type class for configuration details specific to each filter type.
    * Filters for Strings, Numeric Ranges, Date Ranges, Lists, and Boolean are the standard filters available.</li>
    */
    /**
    * @cfg {Integer} updateBuffer
    * Number of milliseconds to defer store updates since the last filter change.
    */
    updateBuffer: 500,
    /**
    * @cfg {String} paramPrefix
    * The url parameter prefix for the filters.
    */
    paramPrefix: 'filter',
    /**
    * @cfg {String} fitlerCls
    * The css class to be applied to column headers that active filters. Defaults to 'ux-filterd-column'
    */
    filterCls: 'ux-filtered-column',
    /**
    * @cfg {Boolean} local
    * True to use Ext.data.Store filter functions (local filtering) instead of server side filtering.
    */
    local: false,
    /**
    * @cfg {Boolean} autoReload
    * Defaults to true. Set this to false if you wish to prevent the datastore from being reloaded when
    * you make changes to the filters. True will automagicly reload the datasource when a filter change happens. 
    */
    autoReload: true,
    /**
    * @cfg {String} stateId
    * Name of the Ext.data.Store value to be used to store state information.
    */
    stateId: undefined,
    /**
    * @cfg {Boolean} showMenu
    * Defaults to true, including a filter submenu in the default header menu.
    */
    showMenu: true,
    /**
    * @cfg {String} menuFilterText
    * defaults to 'Filters'.
    */
    menuFilterText: 'Filters',
    /**
    * @cfg {Boolean} Json
    * Defaults to false, submit filter to server as jason.
    */
    json: false,
    /**
    * @cfg {Boolean} Json
    * Defaults to false, submit filter for store not grid.
    */
    justStore: false,

    /** @private */
    init: function(grid) {
        if (grid instanceof Ext.grid.GridPanel) {
            this.grid = grid;

            this.store = this.grid.getStore();
            if (this.local) {
                this.store.on('load', function(store) {
                    store.filterBy(this.getRecordFilter());
                }, this);
            } else {
                this.store.on('beforeload', this.onBeforeLoad, this);
            }

            this.grid.filters = this;

            this.grid.addEvents({ "filterupdate": true });

            grid.on("render", this.onRender, this);

            grid.on("beforestaterestore", this.applyState, this);
            grid.on("beforestatesave", this.saveState, this);

        } else if (grid instanceof Ext.PagingToolbar) {
            this.toolbar = grid;
        } else if (grid instanceof Ext.data.JsonStore) {
            this.grid = null;
            this.store = grid;
            if (this.local) {
                this.store.on('load', function(store) {
                    store.filterBy(this.getRecordFilter());
                }, this);
            } else {
                this.store.on('beforeload', this.onBeforeLoad, this);
            }
        }
    },

    /** @private */
    applyState: function(grid, state) {
        this.applyingState = true;
        this.clearFilters();
        if (state.filters)
            for (var key in state.filters) {
            var filter = this.filters.get(key);
            if (filter) {
                filter.setValue(state.filters[key]);
                filter.setActive(true);
            }
        }

        this.deferredUpdate.cancel();
        if (this.local)
            this.reload();

        delete this.applyingState;
    },

    /** @private */
    saveState: function(grid, state) {
        var filters = {};
        this.filters.each(function(filter) {
            if (filter.active)
                filters[filter.dataIndex] = filter.getValue();
        });
        return state.filters = filters;
    },

    /** @private */
    onRender: function() {
        var hmenu;

        if (this.showMenu) {
            hmenu = this.grid.getView().hmenu;

            this.sep = hmenu.addSeparator();
            this.menu = hmenu.add(new Ext.menu.CheckItem({
                text: this.menuFilterText,
                menu: new Ext.menu.Menu()
            }));
            this.menu.on('checkchange', this.onCheckChange, this);
            this.menu.on('beforecheckchange', this.onBeforeCheck, this);

            hmenu.on('beforeshow', this.onMenu, this);
        }

        this.grid.getView().on("refresh", this.onRefresh, this);
        this.updateColumnHeadings(this.grid.getView());
    },

    /** @private */
    onMenu: function(filterMenu) {
        var filter = this.getMenuFilter();
        if (filter) {
            this.menu.menu = filter.menu;
            this.menu.setChecked(filter.active, false);
        }

        this.menu.setVisible(filter !== undefined);
        this.sep.setVisible(filter !== undefined);
    },

    /** @private */
    onCheckChange: function(item, value) {
        this.getMenuFilter().setActive(value);
    },

    /** @private */
    onBeforeCheck: function(check, value) {
        return !value || this.getMenuFilter().isActivatable();
    },

    /** @private */
    onStateChange: function(event, filter) {
        if (this.grid != null) {
            if (event == "serialize") return;

            if (filter == this.getMenuFilter())
                this.menu.setChecked(filter.active, false);

            if ((this.autoReload || this.local) && !this.applyingState)
                this.deferredUpdate.delay(this.updateBuffer);

            var view = this.grid.getView();
            this.updateColumnHeadings(view);

            if (!this.applyingState)
                this.grid.saveState();

            this.grid.fireEvent('filterupdate', this, filter);
        } else {
            if ((this.autoReload || this.local) && !this.applyingState)
                this.reload();
        }
    },

    /** @private */
    onBeforeLoad: function(store, options) {
        options.params = options.params || {};
        this.cleanParams(options.params);
        var params = this.buildQuery(this.getFilterData());
        Ext.apply(options.params, params);
    },

    /** @private */
    onRefresh: function(view) {
        this.updateColumnHeadings(view);
    },

    /** @private */
    getMenuFilter: function() {
        var view = this.grid.getView();
        if (!view || view.hdCtxIndex === undefined)
            return null;

        return this.filters.get(
			view.cm.config[view.hdCtxIndex].dataIndex);
    },

    /** @private */
    updateColumnHeadings: function(view) {
        if (!view || !view.mainHd) return;

        var hds = view.mainHd.select('td').removeClass(this.filterCls);
        for (var i = 0, len = view.cm.config.length; i < len; i++) {
            var filter = this.getFilter(view.cm.config[i].dataIndex);
            if (filter && filter.active)
                hds.item(i).addClass(this.filterCls);
        }
    },

    /** @private */
    reload: function() {
        if (this.local) {
            this.grid.store.clearFilter(true);
            this.grid.store.filterBy(this.getRecordFilter());
        } else {
            this.deferredUpdate.cancel();
            var store = this.store;
            if (this.toolbar) {
                var start = this.toolbar.paramNames.start;
                if (store.lastOptions && store.lastOptions.params && store.lastOptions.params[start])
                    store.lastOptions.params[start] = 0;
            }
            store.reload();
        }
    },

    /**
    * Method factory that generates a record validator for the filters active at the time
    * of invokation.
    * @private
    */
    getRecordFilter: function() {
        var f = [];
        this.filters.each(function(filter) {
            if (filter.active) f.push(filter);
        });

        var len = f.length;
        return function(record) {
            for (var i = 0; i < len; i++)
                if (!f[i].validateRecord(record))
                return false;

            return true;
        };
    },

    /**
    * Adds a filter to the collection.
    * @param {Object/Ext.ux.grid.filter.Filter} config A filter configuration or a filter object.
    * @return {Ext.ux.grid.filter.Filter} The existing or newly created filter object.
    */
    addFilter: function(config) {
        var filter = config.menu ? config :
				new (this.getFilterClass(config.type))(config);
        this.filters.add(filter);

        Ext.util.Observable.capture(filter, this.onStateChange, this);
        return filter;
    },

    /**
    * Returns a filter for the given dataIndex, if one exists.
    * @param {String} dataIndex The dataIndex of the desired filter object.
    * @return {Ext.ux.grid.filter.Filter}
    */
    getFilter: function(dataIndex) {
        return this.filters.get(dataIndex);
    },

    /**
    * Turns all filters off. This does not clear the configuration information.
    */
    clearFilters: function() {
        this.filters.each(function(filter) {
            filter.setActive(false);
        });
    },

    /**
    * Returns current filters.
    */
    getFilterData: function() {
        var filters = [],
			fields = this.store.fields;

        this.filters.each(function(f) {
            if (f.active) {
                var d = [].concat(f.serialize());
                for (var i = 0, len = d.length; i < len; i++)
                    filters.push({
                        field: f.dataIndex,
                        data: d[i]
                    });
            }
        });

        return filters;
    },

    /**
    * Function to take structured filter data and 'flatten' it into query parameteres. The default function
    * will produce a query string of the form:
    * 		filters[0][field]=dataIndex&filters[0][data][param1]=param&filters[0][data][param2]=param...
    * You can override this function to return json:
    * <pre><code>
    * buildQuery: function(filters) {
    *     var p  = {};
    *     var len  = filters.length;
    *     for(var i=0; i<len; i++) {
    *         var f = filters[i];
    *         if (f.data.comparison) {
    *             if (typeof(p[f.field]) != 'object') {
    *                 p[f.field] = new Object();
    *             }
    *             p[f.field][f.data.comparison] = f.data.value;
    *         } else {
    *             p[f.field] = f.data.value;
    *         }
    *     }
    *     var tmp = {};
    *     tmp["extjs_filter_encoded"] = Ext.util.JSON.encode(p)
    *     return tmp;
    * }
    * </code></pre>
    * @param {Array} filters A collection of objects representing active filters and their configuration.
    * 	  Each element will take the form of {field: dataIndex, data: filterConf}. dataIndex is not assured
    *    to be unique as any one filter may be a composite of more basic filters for the same dataIndex.
    * @return {Object} Query keys and values
    */
    buildQuery: function(filters) {
        if (this.json) {
            var p = new Array();
            var len = filters.length;
            for (var i = 0; i < len; i++) {
                var f = filters[i];
                p[i] = { field: f.field, type: f.data.type, comparison: f.data.comparison, value: f.data.value.toString() };
            }
            var tmp = {};
            //tmp["extjs_filter_encoded"] = Ext.util.JSON.encode(p)
            tmp["extjs_filter_encoded"] = JSON.serialize(p)
            return tmp;
        } else {
            var p = {};
            for (var i = 0, len = filters.length; i < len; i++) {
                var f = filters[i];
                var root = [this.paramPrefix, '[', i, ']'].join('');
                p[root + '[field]'] = f.field;

                var dataPrefix = root + '[data]';
                for (var key in f.data)
                    p[[dataPrefix, '[', key, ']'].join('')] = f.data[key];
            }

            return p;
        }
    },

    /**
    * Removes filter related query parameters from the provided object.
    * @param {Object} p Query parameters that may contain filter related fields.
    */
    cleanParams: function(p) {
        var regex = new RegExp("^" + this.paramPrefix + "\[[0-9]+\]");
        for (var key in p)
            if (regex.test(key))
            delete p[key];
    },

    /**
    * Function for locating filter classes, overwrite this with your favorite
    * loader to provide dynamic filter loading.
    * @param {String} type The type of filter to load.
    * @return {Class}
    */
    getFilterClass: function(type) {
        return Ext.ux.grid.filter[type.substr(0, 1).toUpperCase() + type.substr(1) + 'Filter'];
    }
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/grid/GridFilters.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/grid/GridFilters.js');
Ext.namespace("Ext.ux.menu");
/** 
 * @class Ext.ux.menu.EditableItem
 * @extends Ext.menu.BaseItem
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version X
 */
Ext.ux.menu.EditableItem = Ext.extend(Ext.menu.BaseItem, {
	/**
	 * @cfg {String} itemCls
	 * css class entered as a string. Defaults to 'x-menu-item.
	 */
    itemCls : "x-menu-item",
	/**
	 * @cfg {Boolean} hideOnClick
	 * Defaults to false.
	 */
    hideOnClick: false,
    
	/** @private */
    initComponent: function(){
    	this.addEvents({keyup: true});
		this.editor = this.editor || new Ext.form.TextField();
		if(this.text)
			this.editor.setValue(this.text);
    },
    
	/** @private */
    onRender: function(container){
        var s = container.createChild({
        	cls: this.itemCls,
        	html: '<img src="' + (this.icon||Ext.BLANK_IMAGE_URL)+ '" class="x-menu-item-icon'+(this.iconCls?' '+this.iconCls:'')+'" style="margin: 3px 7px 2px 2px;" />'});
        
        Ext.apply(this.config, {width: 125});
        this.editor.render(s);
        
        this.el = s;
        this.relayEvents(this.editor.el, ["keyup"]);
		
		this.el.swallowEvent(['keydown','keypress']);
        Ext.each(["keydown", "keypress"], function (eventName) {
			this.el.on(eventName, function (e) {
				if (e.isNavKeyPress())
				  e.stopPropagation();
			}, this);
        }, this);
        
        if(Ext.isGecko) {
            s.setOverflow('auto');
            var containerSize = container.getSize();
            this.editor.getEl().setStyle('position', 'fixed');
            container.setSize(containerSize);
        }
			
        Ext.ux.menu.EditableItem.superclass.onRender.apply(this, arguments);
    },
    
    getValue: function(){
    	return this.editor.getValue();
    },
    
    setValue: function(value){
    	this.editor.setValue(value);
    },
    
    /**
     * 
     * @param {Object} preventMark
     */
    isValid: function(preventMark){
    	return this.editor.isValid(preventMark);
    }
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/menu/EditableItem.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/menu/EditableItem.js');
Ext.namespace("Ext.ux.menu");
Ext.ux.menu.ListMenu = function(cfg) {
    this.addEvents('checkchanged');
    Ext.ux.menu.ListMenu.superclass.constructor.call(this, cfg = cfg || {});

    if (!cfg.store && cfg.options) {
        var options = [];
        for (var i = 0, len = cfg.options.length; i < len; i++) {
            var value = cfg.options[i];
            switch (Ext.type(value)) {
                case 'array': options.push(value); break;
                case 'object': options.push([value.id, value[this.labelField]]); break;
                case 'string': options.push([value, value]); break;
            }
        }

        this.store = new Ext.data.Store({
            reader: new Ext.data.ArrayReader({ id: 0 }, ['id', this.labelField]),
            data: options,
            listeners: {
                'load': this.onLoad,
                scope: this
            }
        });
        this.loaded = true;
    } else {
        this.add({ text: this.loadingText, iconCls: 'loading-indicator' });
        this.store.on('load', this.onLoad, this);
        if (!this.loadOnShow) this.store.load(); // Tony : added to preload when used with external filter page
    }
};


/** 
 * @class Ext.ux.menu.ListMenu
 * @extends Ext.menu.Menu
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version X
 */
Ext.extend(Ext.ux.menu.ListMenu, Ext.menu.Menu, {
    /**
    * @cfg {String} labelField
    * Defaults to 'text'.
    */
    labelField: 'text',
    /**
    * @cfg {String} paramPrefix
    * Defaults to 'Loading...'.
    */
    loadingText: 'Loading...',
    /**
    * @cfg {Boolean} loadOnShow
    * Defaults to true.
    */
    loadOnShow: true,
    /**
    * @cfg {Boolean} single
    * Defaults to false.
    */
    single: false,

    /** @private */
    selected: [],

    /**
    * Lists will initially show a 'loading' item while the data is retrieved from the store. In some cases the
    * loaded data will result in a list that goes off the screen to the right (as placement calculations were done
    * with the loading item). This adapter will allow show to be called with no arguments to show with the previous
    * arguments and thus recalculate the width and potentially hang the menu from the left.
    */
    show: function() {
        var lastArgs = null;
        return function() {
            if (arguments.length == 0) {
                Ext.ux.menu.ListMenu.superclass.show.apply(this, lastArgs);
            } else {
                lastArgs = arguments;
                if (this.loadOnShow && !this.loaded) this.store.load();
                Ext.ux.menu.ListMenu.superclass.show.apply(this, arguments);
            }
        };
    } (),

    /** @private */
    onLoad: function(store, records) {
        var visible = this.isVisible();
        this.hide(false);

        this.removeAll();

        var gid = this.single ? Ext.id() : null;
        for (var i = 0, len = records.length; i < len; i++) {
            var item = new Ext.menu.CheckItem({
                text: records[i].get(this.labelField),
                group: gid,
                checked: this.selected.indexOf(records[i].id) > -1,
                hideOnClick: false
            });

            item.itemId = records[i].id;
            item.on('checkchange', this.checkChange, this);

            this.add(item);
        }

        this.loaded = true;

        if (visible)
            this.show();

        this.fireEvent('load', this, records);
    },

    /** @private */
    setSelected: function(value) {
        var value = this.selected = [].concat(value);

        if (this.loaded)
            this.items.each(function(item) {
                item.setChecked(false, true);
                for (var i = 0, len = value.length; i < len; i++)
                    if (item.itemId == value[i])
                    item.setChecked(true, true);
            }, this);
    },

    /**
    * 
    * @param {Object} item
    * @param {Object} checked
    * @return {void}
    */
    checkChange: function(item, checked) {
        var value = [];
        this.items.each(function(item) {
            if (item.checked)
                value.push(item.itemId);
        }, this);
        this.selected = value;

        this.fireEvent("checkchange", item, checked);
    },

    /**
    * @return {array} selected
    */
    getSelected: function() {
        return this.selected;
    }
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/menu/ListMenu.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/menu/ListMenu.js');
Ext.namespace("Ext.ux.menu");
Ext.ux.menu.RangeMenu = function(){
	Ext.ux.menu.RangeMenu.superclass.constructor.apply(this, arguments);
	this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);

	var cfg = this.fieldCfg;
	var cls = this.fieldCls;
	var fields = this.fields = Ext.applyIf(this.fields || {}, {
		'gt': new Ext.ux.menu.EditableItem({
			iconCls:  this.icons.gt,
			editor: new cls(typeof cfg == "object" ? cfg.gt || '' : cfg)}),
		'lt': new Ext.ux.menu.EditableItem({
			iconCls:  this.icons.lt,
			editor: new cls(typeof cfg == "object" ? cfg.lt || '' : cfg)}),
		'eq': new Ext.ux.menu.EditableItem({
			iconCls:   this.icons.eq, 
			editor: new cls(typeof cfg == "object" ? cfg.gt || '' : cfg)})
	});
	this.add(fields.gt, fields.lt, '-', fields.eq);
	
	for(var key in fields)
		fields[key].on('keyup', function(event, input, notSure, field){
			if(event.getKey() == event.ENTER && field.isValid()){
				this.hide(true);
				return;
			}
			
			if(field == fields.eq){
				fields.gt.setValue(null);
				fields.lt.setValue(null);
			} else {
				fields.eq.setValue(null);
			}
			
			this.updateTask.delay(this.updateBuffer);
		}.createDelegate(this, [fields[key]], true));

	this.addEvents(
		/**
		 * Fires when a filter configuration has changed
		 * @event update
		 * @param {Ext.ux.grid.filter.Filter} this
		 */
		'update'
	);
};
/**
 * <br /><b>Example Usage:</b>
 * <pre><code>    
   var rangeMenu = new Ext.menu.RangeMenu({
      listeners: {
        //subscribe to update event
        update: function(menu) {
          Ext.example.msg('range selected');
        }
      }
    });
    
    var menu = new Ext.menu.Menu({
        id: 'mainMenu',
        items: [
            {
                text: 'Choose a range',
                menu: rangeMenu
            }
        ]
    });

    var tb = new Ext.Toolbar();
    tb.render('toolbar');
    tb.add({text:'Button w/ Menu', iconCls: 'bmenu', menu: menu});
 *</code></pre>
 * @class Ext.ux.menu.RangeMenu
 * @extends Ext.menu.Menu
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version 0.1
 */
 Ext.extend(Ext.ux.menu.RangeMenu, Ext.menu.Menu, {
	/**
	 * @cfg {Object} fieldCls
	 * Defaults to Ext.form.NumberField.
	 */
	fieldCls:     Ext.form.NumberField,
	/**
	 * @cfg {String} fieldCfg
	 * Defaults to ''.
	 */
 	fieldCfg:     '',
	/**
	 * @cfg {Number} updateBuffer
	 * Not used?
	 */
	updateBuffer: 500,
	/**
	 * @cfg {Object} icons
	 * Object literal associating each filter type to a css class entered as a string. Defaults to {gt: 'ux-rangemenu-gt',
	 * lt: 'ux-rangemenu-lt', eq: 'ux-rangemenu-eq'}.  May also specify individually as icons.gt, icons.lt, icons.eq.
	 */
	icons: {
		gt: 'ux-rangemenu-gt', 
		lt: 'ux-rangemenu-lt',
		eq: 'ux-rangemenu-eq'},
		
	/** @private */
	fireUpdate: function(){
		this.fireEvent("update", this);
	},
	
	setValue: function(data){
		for(var key in this.fields)
			this.fields[key].setValue(data[key] !== undefined ? data[key] : '');
		
		this.fireEvent("update", this);
	},
	
	getValue: function(){
		var result = {};
		for(var key in this.fields){
			var field = this.fields[key];
			if(field.isValid() && String(field.getValue()).length > 0)
				result[key] = field.getValue();
		}
		
		return result;
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/menu/RangeMenu.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/menu/RangeMenu.js');
Ext.namespace('Ext.ux.menu');
Ext.ux.menu.TreeMenu = function(cfg){
	Ext.ux.menu.TreeMenu.superclass.constructor.call(this, {
		plain: false,
		items: [new Ext.ux.menu.TreeMenuItem(cfg)],
		cls: 'ux-tree-menu'
	});
	this.relayEvents(this.items.get(0), ["select", "search"]);
	this.tree = cfg.tree;
};
/** 
 * @class Ext.ux.menu.TreeMenu
 * @extends Ext.menu.Menu
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version X
 */
Ext.extend(Ext.ux.menu.TreeMenu, Ext.menu.Menu);

Ext.ux.menu.TreeMenuItem = function(cfg){
	/**
	 * Fires when ....
	 * @event select
	 * @param {} node.id
	 * @param {} node
	 */
	this.addEvents({select: true, search: true});
	Ext.ux.menu.TreeMenu.superclass.constructor.call(this, cfg);
	
	this.qTask = new Ext.util.DelayedTask(this.doQuery, this);
	this.searchBox = new Ext.form.TextField({
		cls: 'ux-tree-menu-search',
		emptyText: this.emptyText
	});
	
	this.tree.getSelectionModel().on('selectionchange', this.onSelect, this);
};


/** 
 * @class Ext.ux.menu.TreeMenuItem
 * @extends Ext.menu.BaseItem
 * @author Steve Skrla (<a href="http://extjs.com/forum/member.php?u=865">ambience</a>); published: Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
 * @license Licensed under the terms of the Open Source <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0 license</a>.  Commercial use is permitted to the extent that the code/component(s) do NOT become part of another Open Source or Commercially licensed development library or toolkit without explicit permission. 
 * @version X
 */
Ext.extend(Ext.ux.menu.TreeMenuItem, Ext.menu.BaseItem, {
	minHeight:   240,
	minWidth:    200,
	hideOnClick: false,
	/**
	 * @cfg {Integer} searchDelay
	 * Amount of time in miliseconds to wait before invoking the searchFn after the content of the search box is changed.
	 */
	searchDelay: 500,
	/**
	 * @cfg {Ext.tree.TreePanel} tree
	 * The tree to be encapsulated by the TreeMenu
	 */
	tree:        undefined,
	/**
	 * @cfg {Function} searchFn
	 * The function to call to search the tree. If not set, the search field will be hidden. The method signature should be compatable with:
	 * <code>fn({String} queryString, {Function} callback)</code>
	 */
	searchFn: undefined,
	emptyText: 'Search...',
	handelOffset: 3,
	
	/** @private */
    onRender : function(container){
        var el = this.el = container.createChild({
			cls:      'ux-tree-menu-wrap',
			children: [{cls: 'ux-tree-menu-search-icon'}]
		});
		
		if(this.searchFn){
			this.searchBox.render(el);
			this.searchBox.getEl().setStyle('margin-bottom', '3px');
			this.searchBox.el.on('keyup', function(){this.qTask.delay(this.searchDelay);}, this);
		}	
		
		this.tree.autoScroll = true;
		this.tree.render(el);
		
		var resizer = new Ext.Resizable(el, {
			pinned:true, 
			handles:'se',
			listeners: {
				'resize': function(rsz, w, h){
					this.resize(w, h);
					this.parentMenu.autoWidth();
					this.parentMenu.el.show();
				},
				scope: this
			}
		});
		this.resize(this.minWidth, this.minHeight);
		
		if(this.searchFn)
			this.doQuery();
	},
	
	onSelect: function(model, node){
		this.fireEvent('select', node.id, node);
	},
	
	doQuery: function(callback){
		var value = this.searchBox.getValue();
		
		this.searchFn(value.length > 0 ? value : null, callback);
			
		this.fireEvent('search', value);
	},
	
	resize: function(w, h){
		var search    = this.searchBox.getEl();
			padding   = this.el.getFrameWidth('tb'),
			searchOff = 0;
		
		if(search){
			search.setWidth(w - this.el.getFrameWidth('lr'));
			searchOff = search.getHeight();
		}
		this.tree.setWidth(w);
		this.tree.setHeight(h - searchOff - padding - this.handelOffset);
	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/menu/TreeMenu.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/menu/TreeMenu.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/*global Ext */
/**
 * @class   Ext.ux.tree.CheckTreePanel
 * @extends Ext.tree.TreePanel
 *
 * <p>
 * I've taken Condor's work from 
 * <a href="http://extjs.com/forum/showthread.php?t=44369">http://extjs.com/forum/showthread.php?t=44369</a>,
 * removed tri-state functionality and put all files into one extension.
 * </p>
 * <p>
 * CheckTreePanel has been designed to fully load nodes in one shot using
 * nested "children" array. 
 * </p>
 *
 * @author   Ing. Jozef Sakáloš
 * @copyright (c) 2009, by Ing. Jozef Sakáloš
 * @version  1.0
 * @date     9. January 2009
 * @revision $Id: Ext.ux.tree.CheckTreePanel.js 593 2009-02-24 10:17:11Z jozo $
 *
 * @license Ext.ux.tree.CheckTreePanel is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
 *
 * @forum    56875
 * @demo     http://checktree.extjs.eu
 * @download 
 * <ul>
 * <li><a href="http://checktree.extjs.eu/checktree.tar.bz2">checktree.tar.bz2</a></li>
 * <li><a href="http://checktree.extjs.eu/checktree.tar.gz">checktree.tar.gz</a></li>
 * <li><a href="http://checktree.extjs.eu/checktree.zip">checktree.zip</a></li>
 * </ul>
 *
 * @donate
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
 * <input type="hidden" name="cmd" value="_s-xclick">
 * <input type="hidden" name="hosted_button_id" value="3430419">
 * <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" 
 * border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
 * <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 * </form>
 */

Ext.ns('Ext.ux.tree');

// {{{
/**
 * Creates new CheckTreePanel
 * @constructor
 * @param {Object} config The configuration object
 */
Ext.ux.tree.CheckTreePanel = Ext.extend(Ext.tree.TreePanel, {

	// {{{
	// default config
	/**
	 * @cfg {String} bubbleCheck 
	 * Check/uncheck also parent nodes. Valid values: none, checked, unchecked, all. Defaults to 'checked'.
	 */
	 bubbleCheck:'checked' 

	/**
	 * @cfg {String} cascadeCheck 
	 * Check/uncheck also child nodes. Valid values: none, checked, unchecked, all. Defaults to 'unchecked'.
	 */
	,cascadeCheck:'unchecked'

	/**
	 * @cfg {Boolean} deepestOnly 
	 * Set this to true for getValue to return only deepest checked node ids. Defaults to false.
	 */
	,deepestOnly:false

	/**
	 * @cfg {Boolean} expandOnCheck 
	 * Expand the node on check if true. Defaults to true;
	 */
	,expandOnCheck:true

	/**
	 * @cfg {Boolean/Object} filter
	 * Set it to false to not create tree filter or set a custom filter. Defaults to true.
	 */
	,filter:true

	/**
	 * @cfg {String} separator
	 * Separator for convertValue function. Defaults to ',' (comma).
	 */
	,separator:','

	/**
	 * @cfg {String} cls
	 * Class to add to CheckTreePanel. A suitable css file must be included. Defaults to 'ux-checktree'.
	 */
	,cls:'ux-checktree'

	/**
	 * @cfg {Object} baseAttrs
	 * baseAttrs for loader. Defaults to {} (empty object).
	 */
	,baseAttrs:{}
	// }}}
	// {{{
	,initComponent:function() {

		// use our event model
		this.eventModel = new Ext.ux.tree.CheckTreeEventModel(this);

		// call parent initComponent
		Ext.ux.tree.CheckTreePanel.superclass.initComponent.apply(this, arguments);

		// pass this.baseAttrs and uiProvider down the line
		var baseAttrs = Ext.apply({uiProvider:Ext.ux.tree.CheckTreeNodeUI}, this.baseAttrs);
		Ext.applyIf(this.loader, {baseAttrs:baseAttrs, preloadChildren:true});

		// make sure that nodes are deeply preloaded
		if(true === this.loader.preloadChildren) {
			this.loader.on('load', function(loader, node) {
				node.cascade(function(n) {
					loader.doPreload(n);
					n.loaded = true;
				});
			});
		}

		// create tree filter
		if(true === this.filter) {
			var Filter = Ext.ux.tree.TreeFilterX ? Ext.ux.tree.TreeFilterX : Ext.tree.TreeFilter;
			this.filter = new Filter(this, {autoClear:true});
		}

	} // eo function initComponent
	// }}}
	// {{{
	/*
	 * get "value" (array of checked nodes ids)
	 * @return {Array} Array of chcecked nodes ids
	 */
	,getValue:function() {
		var a = [];
		this.root.cascade(function(n) {
			if(true === n.attributes.checked) {
				if(false === this.deepestOnly || !this.isChildChecked(n)) {
					a.push(n.id);
				}
			}
		}, this);
		return a;
	} // eo function getValue
	// {{{
	/**
	 * Helper function for getValue
	 * @param {Ext.tree.TreeNode} node
	 * @return {Boolean} true if node has a child checked, false otherwise
	 * @private
	 */
	,isChildChecked:function(node) {
		var checked = false;
		Ext.each(node.childNodes, function(child) {
			if(child.attributes.checked) {
				checked = true;
			}
		});
		return checked;
	} // eo function isChildChecked
	// }}}
	// }}}
	// {{{
	/*
	 * clears "value", unchecks all nodes
	 * @return {Ext.ux.tree.CheckTreePanel} this
	 */
	,clearValue:function() {
		this.root.cascade(function(n) {
			var ui = n.getUI();
			if(ui && ui.setChecked) {
				ui.setChecked(false);
			}
		});
		this.value = [];
		return this;
	} // eo function clearValue
	// }}}
	// {{{
	/*
	 * converts passed value to array
	 * @param {Mixed} val variable number of arguments, e.g. convertValue('1,8,7', 3, [9,4])
	 * @return {Array} converted value
	 */
	,convertValue:function(val) {
		// init return array
		var a = [];

		// calls itself recursively if necessary
		if(1 < arguments.length) {
			for(var i = 0; i < arguments.length; i++) {
				a.push(this.convertValue(arguments[i]));
			}
		}

		// nothing to do for arrays
		else if(Ext.isArray(val)) {
			a = val;
		}

		// just push numbers
		else if('number' === typeof val) {
			a.push(val);
		}

		// split strings
		else if('string' === typeof val) {
			a = val.split(this.separator);
		}

		return a;
	} // eo function convertValue
	// }}}
	// {{{
	/*
	 * Set nodes checked/unchecked
	 * @param {Mixed} val variable number of arguments, e.g. setValue('1,8,7', 3, [9,4])
	 * @return {Array} value. Array of checked nodes
	 */
	,setValue:function(val) {

		// uncheck all first
		this.clearValue();

		// process arguments
		this.value = this.convertValue.apply(this, arguments);

		// check nodes
		Ext.each(this.value, function(id) {
			var n = this.getNodeById(id);
			if(n) {
				var ui = n.getUI();
				if(ui && ui.setChecked) {
					ui.setChecked(true);

					// expand checked nodes
					if(true === this.expandOnCheck) {
						n.bubbleExpand();
					}
				}
			}
		}, this);

		return this.value;
	} // eo function setValue
	// }}}
	// {{{
	/*
	 * arbitrary attribute of checked nodes (text by default) is joined and separated with this.separator
	 * @param {String} attr Attribute to serialize
	 * @return {String} serialized attr of checked nodes
	 */
	,serialize:function(attr) {
		attr = attr || 'text';
		var a = [];
		this.root.cascade(function(n) {
			if(true === n.attributes.checked) {
				if(false === this.deepestOnly || !this.isChildChecked(n)) {
					a.push(n[attr]);
				}
			}
		}, this);
		return a.join(this.separator + ' ');
	} // eo function serialize
	// }}}
	// {{{
	/*
	 * alias for serialize function
	 * @param {String} attr Attribute to serialize
	 * @return {String} serialized attr of checked nodes
	 */
	,getText:function(attr) {
		return this.serialize(attr);
	} // eo function getText
	// }}}
	// {{{
	/**
	 * Creates hidden field if we're running in form for BasicForm::getValues to work
	 * @private
	 */
	,onRender:function() {
		Ext.ux.tree.CheckTreePanel.superclass.onRender.apply(this, arguments);
		if(true === this.isFormField) {
			this.hiddenField = this.body.createChild({
				tag:'input', type:'hidden', name:this.name || this.id
			}, undefined, true);
		}
	} // eo function onRender
	// }}}
	// {{{
	/**
	 * Updates hidden field if one exists on checkchange
	 * @private
	 */
	,updateHidden:function() {
		if(this.hiddenField) {
			this.hiddenField.value = this.getValue().join(this.separator);
		}
	} // eo function updateHidden
	// }}}

	// form field compatibility methods
	// todo: They could be made much more clever
	,clearInvalid:Ext.emptyFn
	,markInvalid:Ext.emptyFn
	,validate:function() {
		return true;
	}
	,isValid:function() {
		return true;
	}
	,getName:function() {
		return this.name || this.id || '';
	}

}) // eo extend

Ext.reg('checktreepanel', Ext.ux.tree.CheckTreePanel);
// }}}
// {{{
/**
 * @private
 * @ignore
 */
Ext.override(Ext.tree.TreeNode, {
	/**
	 * Expands all parent nodes of this node
	 * @private
	 */
	bubbleExpand:function() {
		var root = this.getOwnerTree().root;
		var branch = [];
		var p = this;
		while(p !== root) {
			p = p.parentNode;
			branch.push(p);
		}
		branch.reverse();
		Ext.each(branch, function(n) {
			n.expand(false, false);
		});
	}
});
// }}}
// {{{
/**
 * @class Ext.ux.tree.CheckTreeNodeUI
 * @extends Ext.tree.TreeNodeUI
 *
 * Adds checkbox to the tree node UI. This class is not intended
 * to be instantiated explicitly; it is used internally in CheckTreePanel.
 *
 * @author   Ing. Jozef Sakáloš
 * @copyright (c) 2009, by Ing. Jozef Sakáloš
 * @version  1.0
 * @date     9. January 2009
 *
 * @license Ext.ux.tree.CheckTreeNodeUI is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
 *
 * @donate
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
 * <input type="hidden" name="cmd" value="_s-xclick">
 * <input type="hidden" name="hosted_button_id" value="3430419">
 * <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" 
 * border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
 * <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 * </form>
 */
/**
 * @constructor
 * @Creates new CheckTreeNodeUI
 * @param {Ext.tree.TreeNode} node Node to create the UI for
 */
Ext.ux.tree.CheckTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {

	// {{{
	/**
	 * This is slightly adjusted original renderElements method
	 * @private
	 */
	renderElements:function(n, a, targetNode, bulkRender){
		
		this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() :'';
		var checked = n.attributes.checked;
		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" />'
			,'<img src="'+this.emptyIcon+'" class="x-tree-checkbox'+(true === checked ? ' x-tree-node-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];
		this.checkbox = cs[3];
		this.cbEl = Ext.get(this.checkbox);
		this.anchor = cs[4];
		this.textNode = cs[4].firstChild;
	} // eo function renderElements
	// }}}
	// {{{
	/**
	 * Sets iconCls
	 * @param {String} iconCls
	 * @private
	 */
	,setIconCls:function(iconCls) {
		Ext.fly(this.iconNode).set({cls:'x-tree-node-icon ' + iconCls});
	} // eo function setIconCls
	// }}}
	// {{{
	/**
	 * @return {Boolean} true if the node is checked, false otherwise
	 * @private
	 */
	,isChecked:function() {
		return this.node.attributes.checked === true;
	} // eo function isChecked
	// }}}
	// {{{
	/**
	 * Called when check changes
	 * @private
	 */
	,onCheckChange:function() {
		var checked = this.isChecked();
		var tree = this.node.getOwnerTree();
		var bubble = tree.bubbleCheck;
		var cascade = tree.cascadeCheck;

		if('all' === bubble || (checked && 'checked' === bubble) || (!checked && 'unchecked' === bubble)) {
			this.updateParent(checked);
		}
		if('all' === cascade || (checked && 'checked' === cascade) || (!checked && 'unchecked' === cascade)) {
			this.updateChildren(checked);
		}

		tree.updateHidden();
		this.fireEvent('checkchange', this.node, checked);
	} // eo function onCheckChange
	// }}}
	// {{{
	/**
	 * Sets node UI checked/unchecked
	 * @param {Boolean} checked true to set node checked, false to uncheck
	 * @return {Boolean} checked
	 */
	,setChecked:function(checked) {
		checked = true === checked ? checked : false;
		var cb = this.cbEl || false;
		if(cb) {
			true === checked ? cb.addClass('x-tree-node-checked') : cb.removeClass('x-tree-node-checked');
		}
		this.node.attributes.checked = checked;
		this.onCheckChange();
		return checked;
	} // eo function setChecked
	// }}}
	// {{{
	/**
	 * Toggles check
	 * @return {Boolean} value after toggle
	 */
	,toggleCheck:function() {
		var checked = !this.isChecked();
		this.setChecked(checked);
		return checked;
	} // eo function toggleCheck
	// }}}
	// {{{
	/**
	 * Sets parents checked/unchecked. Used if bubbleCheck is not 'none'
	 * @param {Boolean} checked
	 * @private
	 */
	,updateParent:function(checked) {
		var p = this.node.parentNode;
		var ui = p ? p.getUI() : false;
		
		if(ui && ui.setChecked) {
			ui.setChecked(checked);
		}
	} // eo function updateParent
	// }}}
	// {{{
	/**
	 * Sets children checked/unchecked. Used if cascadeCheck is not 'none'
	 * @param {Boolean} checked
	 * @private
	 */
	,updateChildren:function(checked) {
		this.node.eachChild(function(n) {
			var ui = n.getUI();
			if(ui && ui.setChecked) {
				ui.setChecked(checked);
			}
		});
	} // eo function updateChildren
	// }}}
	// {{{
	/**
	 * Checkbox click event handler
	 * @private
	 */
	,onCheckboxClick:function() {
		if(!this.disabled) {
			this.toggleCheck();
		}
	} // eo function onCheckboxClick
	// }}}
	// {{{
	/**
	 * Checkbox over event handler
	 * @private
	 */
	,onCheckboxOver:function() {
		this.addClass('x-tree-checkbox-over');
	} // eo function onCheckboxOver
	// }}}
	// {{{
	/**
	 * Checkbox out event handler
	 * @private
	 */
	,onCheckboxOut:function() {
		this.removeClass('x-tree-checkbox-over');
	} // eo function onCheckboxOut
	// }}}
	// {{{
	/**
	 * Mouse down on checkbox event handler
	 * @private
	 */
	,onCheckboxDown:function() {
		this.addClass('x-tree-checkbox-down');
	} // eo function onCheckboxDown
	// }}}
	// {{{
	/**
	 * Mouse up on checkbox event handler
	 * @private
	 */
	,onCheckboxUp:function() {
		this.removeClass('x-tree-checkbox-down');
	} // eo function onCheckboxUp
	// }}}
 
}); // eo extend
// }}}
// {{{
/**
 * @class   Ext.ux.tree.CheckTreeEventModel
 * @extends Ext.tree.TreeEventModel
 *
 * Tree event model suitable for use with CheckTreePanel.
 * This class is not intended to be instantiated explicitly by a user
 * but it is used internally by CheckTreePanel.
 *
 * @author   Ing. Jozef Sakáloš
 * @copyright (c) 2009, by Ing. Jozef Sakáloš
 * @version  1.0
 * @date     9. January 2009
 *
 * @license Ext.ux.tree.CheckTreeEventModel is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
 *
 * @donate
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
 * <input type="hidden" name="cmd" value="_s-xclick">
 * <input type="hidden" name="hosted_button_id" value="3430419">
 * <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" 
 * border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
 * <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 * </form>
 */
/**
 * Create new CheckTreeEventModel
 * @constructor
 * @param {Ext.ux.tree.CheckTreePanel} tree The tree to apply this event model to
 */
Ext.ux.tree.CheckTreeEventModel = Ext.extend(Ext.tree.TreeEventModel, {
     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('mousedown', this.delegateDown, this);
        el.on('mouseup', this.delegateUp, this);
        el.on('dblclick', this.delegateDblClick, this);
        el.on('contextmenu', this.delegateContextMenu, this);
    }
	,delegateOver:function(e, t){
        if(!this.beforeEvent(e)){
            return;
        }
        if(this.lastEcOver){
            this.onIconOut(e, this.lastEcOver);
            delete this.lastEcOver;
        }
        if(this.lastCbOver){
            this.onCheckboxOut(e, this.lastCbOver);
            delete this.lastCbOver;
        }
        if(e.getTarget('.x-tree-ec-icon', 1)){
            this.lastEcOver = this.getNode(e);
            this.onIconOver(e, this.lastEcOver);
        }
        else if(e.getTarget('.x-tree-checkbox', 1)){
            this.lastCbOver = this.getNode(e);
            this.onCheckboxOver(e, this.lastCbOver);
        }
        if(t = this.getNodeTarget(e)){
            this.onNodeOver(e, this.getNode(e));
        }
    }
	,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;
            }
        }
        else if(e.getTarget('.x-tree-checkbox', 1)){
            var n = this.getNode(e);
            this.onCheckboxOut(e, n);
            if(n == this.lastCbOver){
                delete this.lastCbOver;
            }
        }
        if((t = this.getNodeTarget(e)) && !e.within(t, true)){
            this.onNodeOut(e, this.getNode(e));
        }
    }
	,delegateDown:function(e, t){
        if(!this.beforeEvent(e)){
            return;
        }
        if(e.getTarget('.x-tree-checkbox', 1)){
            this.onCheckboxDown(e, this.getNode(e));
        }
    }
	,delegateUp:function(e, t){
        if(!this.beforeEvent(e)){
            return;
        }
        if(e.getTarget('.x-tree-checkbox', 1)){
            this.onCheckboxUp(e, this.getNode(e));
        }
    }
	,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;
            }
        }
        else if(e.getTarget('.x-tree-checkbox', 1)){
            var n = this.getNode(e);
            this.onCheckboxOut(e, n);
            if(n == this.lastCbOver){
                delete this.lastCbOver;
            }
        }
        if((t = this.getNodeTarget(e)) && !e.within(t, true)){
            this.onNodeOut(e, this.getNode(e));
        }
    }
	,delegateClick:function(e, t){
		if(!this.beforeEvent(e)){
			return;
		}
		if(e.getTarget('.x-tree-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));
		}
	}
	,onCheckboxClick:function(e, node){
		node.ui.onCheckboxClick();
	}
	,onCheckboxOver:function(e, node){
		node.ui.onCheckboxOver();
	}
	,onCheckboxOut:function(e, node){
		node.ui.onCheckboxOut();
	}
	,onCheckboxDown:function(e, node){
		node.ui.onCheckboxDown();
	}
	,onCheckboxUp:function(e, node){
		node.ui.onCheckboxUp();
	}
}); // eo extend
// }}}

// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/tree/Ext.ux.tree.CheckTreePanel.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/tree/Ext.ux.tree.CheckTreePanel.js');
// vim: ts=4:sw=4:nu:fdc=4:nospell
/*global Ext */
/**
 * @class   Ext.ux.tree.TreeFilterX
 * @extends Ext.tree.TreeFilter
 *
 * <p>
 * Shows also parents of matching nodes as opposed to default TreeFilter. In other words
 * this filter works "deep way".
 * </p>
 *
 * @author   Ing. Jozef Sakáloš
 * @version  1.0
 * @date     17. December 2008
 * @revision $Id: Ext.ux.tree.TreeFilterX.js 589 2009-02-21 23:30:18Z jozo $
 * @see      <a href="http://extjs.com/forum/showthread.php?p=252709">http://extjs.com/forum/showthread.php?p=252709</a>
 *
 * @license Ext.ux.tree.CheckTreePanel is licensed under the terms of
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
 * that the code/component(s) do NOT become part of another Open Source or Commercially
 * licensed development library or toolkit without explicit permission.
 * 
 * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
 * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
 *
 * @forum     55489
 * @demo      http://remotetree.extjs.eu
 *
 * @donate
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
 * <input type="hidden" name="cmd" value="_s-xclick">
 * <input type="hidden" name="hosted_button_id" value="3430419">
 * <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" 
 * border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
 * <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 * </form>
 */

Ext.ns('Ext.ux.tree');

/**
 * Creates new TreeFilterX
 * @constructor
 * @param {Ext.tree.TreePanel} tree The tree panel to attach this filter to
 * @param {Object} config A config object of this filter
 */
Ext.ux.tree.TreeFilterX = Ext.extend(Ext.tree.TreeFilter, {
	/**
	 * @cfg {Boolean} expandOnFilter Deeply expands startNode before filtering (defaults to true)
	 */
	 expandOnFilter:true

	// {{{
    /**
     * Filter the data by a specific attribute.
	 *
     * @param {String/RegExp} value Either string that the attribute value 
     * should start with or a RegExp to test against the attribute
     * @param {String} attr (optional) The attribute passed in your node's attributes collection. Defaults to "text".
     * @param {TreeNode} startNode (optional) The node to start the filter at.
     */
	,filter:function(value, attr, startNode) {

		// expand start node
		if(false !== this.expandOnFilter) {
			startNode = startNode || this.tree.root;
			var animate = this.tree.animate;
			this.tree.animate = false;
			startNode.expand(true, false, function() {

				// call parent after expand
				Ext.ux.tree.TreeFilterX.superclass.filter.call(this, value, attr, startNode);

			}.createDelegate(this));
			this.tree.animate = animate;
		}
		else {
			// call parent
			Ext.ux.tree.TreeFilterX.superclass.filter.apply(this, arguments);
		}

	} // eo function filter
	// }}}
	// {{{
    /**
     * Filter by a function. The passed function will be called with each 
     * node in the tree (or from the startNode). If the function returns true, the node is kept 
     * otherwise it is filtered. If a node is filtered, its children are also filtered.
	 * Shows parents of matching nodes.
	 *
     * @param {Function} fn The filter function
     * @param {Object} scope (optional) The scope of the function (defaults to the current node) 
     */
	,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 true;
			}
			else {
				n.ui.show();
				var p = n.parentNode;
				while(p && p !== this.root) {
					p.ui.show();
					p = p.parentNode;
				}
				return true;
			}
			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);
                   }
               }
           } 
        }
	} // eo function filterBy
	// }}}

}); // eo extend

// eof

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/tree/Ext.ux.tree.TreeFilterX.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/tree/Ext.ux.tree.TreeFilterX.js');
(function(){var EV=Ext.lib.Event;Ext.ux.ManagedIFrame=function(){var args=Array.prototype.slice.call(arguments,0),el=Ext.get(args[0]),config=args[0];if(el&&el.dom&&el.dom.tagName=="IFRAME"){config=args[1]||{};}else{config=args[0]||args[1]||{};el=config.autoCreate?Ext.get(Ext.DomHelper.append(config.autoCreate.parent||document.body,Ext.apply({tag:"iframe",src:(Ext.isIE&&Ext.isSecure)?Ext.SSL_SECURE_URL:""},config.autoCreate))):null;}if(!el||el.dom.tagName!="IFRAME"){return el;}el.dom.name||(el.dom.name=el.dom.id);el.dom.mifId=el.dom.id;this.addEvents({"focus":true,"blur":true,"unload":true,"domready":true,"documentloaded":true,"exception":true,"message":true});if(config.listeners){this.listeners=config.listeners;Ext.ux.ManagedIFrame.superclass.constructor.call(this);}Ext.apply(el,this);el.addClass("x-managed-iframe");if(config.style){el.applyStyles(config.style);}el._maskEl=el.parent(".x-managed-iframe-mask")||el.parent().addClass("x-managed-iframe-mask");Ext.apply(el,{disableMessaging:config.disableMessaging===true,loadMask:Ext.apply({msg:"Loading..",msgCls:"x-mask-loading",maskEl:el._maskEl,hideOnReady:true,disabled:!config.loadMask},config.loadMask),_eventName:Ext.isIE?"onreadystatechange":"onload",_windowContext:null,eventsFollowFrameLinks:typeof config.eventsFollowFrameLinks=="undefined"?true:config.eventsFollowFrameLinks});el.dom[el._eventName]=el.loadHandler.createDelegate(el);var um=el.updateManager=new Ext.UpdateManager(el,true);um.showLoadIndicator=config.showLoadIndicator||false;if(config.src){el.setSrc(config.src);}else{var content=config.html||config.content||false;if(content){el.update.defer(10,el,[content]);}}return Ext.ux.ManagedIFrame.Manager.register(el);};var MIM=Ext.ux.ManagedIFrame.Manager=function(){var frames={};var readyHandler=function(e,target){try{var id=target?target.mifId:null,frame;if((frame=this.getFrameById(id||target.id))&&frame._frameAction){frame.loadHandler({type:"domready"});}}catch(rhEx){}};var implementation={shimCls:"x-frame-shim",register:function(frame){frame.manager=this;frames[frame.id]=frames[frame.dom.name]={ref:frame,elCache:{}};return frame;},deRegister:function(frame){frame._unHook();delete frames[frame.id];delete frames[frame.dom.name];},hideShims:function(){if(!this.shimApplied){return ;}Ext.select("."+this.shimCls,true).removeClass(this.shimCls+"-on");this.shimApplied=false;},showShims:function(){if(!this.shimApplied){this.shimApplied=true;Ext.select("."+this.shimCls,true).addClass(this.shimCls+"-on");}},getFrameById:function(id){return typeof id=="string"?(frames[id]?frames[id].ref||null:null):null;},getFrameByName:function(name){return this.getFrameById(name);},getFrameHash:function(frame){return frame.id?frames[frame.id]:null;},eventProxy:function(e){if(!e){return ;}e=Ext.EventObject.setEvent(e);var be=e.browserEvent||e;if(e.type=="unload"){this._unHook();}if(!be["eventPhase"]||(be["eventPhase"]==(be["AT_TARGET"]||2))){return this.fireEvent(e.type,e);}},_flyweights:{},destroy:function(){if(this._domreadySignature){Ext.EventManager.un.apply(Ext.EventManager,this._domreadySignature);}},removeNode:Ext.isIE?function(frame,n){frame=MIM.getFrameHash(frame);if(frame&&n&&n.tagName!="BODY"){d=frame.scratchDiv||(frame.scratchDiv=frame.getDocument().createElement("div"));d.appendChild(n);d.innerHTML="";}}:function(frame,n){if(n&&n.parentNode&&n.tagName!="BODY"){n.parentNode.removeChild(n);}}};if(document.addEventListener){Ext.EventManager.on.apply(Ext.EventManager,implementation._domreadySignature=[window,"DOMFrameContentLoaded",readyHandler,implementation]);}Ext.EventManager.on(window,"beforeunload",implementation.destroy,implementation);return implementation;}();MIM.showDragMask=MIM.showShims;MIM.hideDragMask=MIM.hideShims;MIM.El=function(frame,el,forceNew){var frameObj;frame=(frameObj=MIM.getFrameHash(frame))?frameObj.ref:null;if(!frame){return null;}var elCache=frameObj.elCache||(frameObj.elCache={});var dom=frame.getDom(el);if(!dom){return null;}var id=dom.id;if(forceNew!==true&&id&&elCache[id]){return elCache[id];}this.dom=dom;this.id=id||Ext.id(dom);};MIM.El.get=function(frame,el){var ex,elm,id,doc;if(!frame||!el){return null;}var frameObj;frame=(frameObj=MIM.getFrameHash(frame))?frameObj.ref:null;if(!frame){return null;}var elCache=frameObj.elCache||(frameObj.elCache={});if(!(doc=frame.getDocument())){return null;}if(typeof el=="string"){if(!(elm=frame.getDom(el))){return null;}if(ex=elCache[el]){ex.dom=elm;}else{ex=elCache[el]=new MIM.El(frame,elm);}return ex;}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el);}if(ex=elCache[id]){ex.dom=el;}else{ex=elCache[id]=new MIM.El(frame,el);}return ex;}else{if(el instanceof MIM.El){if(el!=frameObj.docEl){el.dom=frame.getDom(el.id)||el.dom;elCache[el.id]=el;}return el;}else{if(el.isComposite){return el;}else{if(Ext.isArray(el)){return frame.select(el);}else{if(el==doc){if(!frameObj.docEl){var f=function(){};f.prototype=MIM.El.prototype;frameObj.docEl=new f();frameObj.docEl.dom=doc;}return frameObj.docEl;}}}}}}return null;};Ext.apply(MIM.El.prototype,Ext.Element.prototype);Ext.extend(Ext.ux.ManagedIFrame,Ext.util.Observable,{src:null,resetUrl:Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"about:blank",setSrc:function(url,discardUrl,callback){var src=url||this.src||this.resetUrl;this._windowContext=null;this._unHook();this._frameAction=this.frameInit=this._domReady=false;if(Ext.isOpera){this.reset();}this._callBack=callback||false;this.showMask();(function(){var s=typeof src=="function"?src()||"":src;try{this._frameAction=true;this.dom.src=s;this.frameInit=true;this.checkDOM();}catch(ex){this.fireEvent("exception",this,ex);}}).defer(100,this);if(discardUrl!==true){this.src=src;}return this;},reset:function(src,callback){this.dom.src=src||this.resetUrl;if(typeof callback=="function"){callback.defer(100);}return this;},scriptRE:/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/gi,update:function(content,loadScripts,callback){loadScripts=loadScripts||this.getUpdateManager().loadScripts||false;content=Ext.DomHelper.markup(content||"");content=loadScripts===true?content:content.replace(this.scriptRE,"");var doc;if(doc=this.getDocument()){this._frameAction=!!content.length;this._windowContext=this.src=null;this._callBack=callback||false;this._unHook();this.showMask();doc.open();doc.write(content);doc.close();this.frameInit=true;if(this._frameAction){this.checkDOM();}else{this.hideMask(true);if(this._callBack){this._callBack();}}}else{this.hideMask(true);if(this._callBack){this._callBack();}}return this;},disableMessaging:true,_XFrameMessaging:function(){var tagStack={"$":[]};var isEmpty=function(v,allowBlank){return v===null||v===undefined||(!allowBlank?v==="":false);};window.sendMessage=function(message,tag,origin){var MIF;if(MIF=arguments.callee.manager){if(message._fromHost){var fn,result;var compTag=message.tag||tag||null;var mstack=!isEmpty(compTag)?tagStack[compTag.toLowerCase()]||[]:tagStack["$"];for(var i=0,l=mstack.length;i<l;i++){if(fn=mstack[i]){result=fn.apply(fn.__scope,arguments)===false?false:result;if(fn.__single){mstack[i]=null;}if(result===false){break;}}}return result;}else{message={type:isEmpty(tag)?"message":"message:"+tag.toLowerCase().replace(/^\s+|\s+$/g,""),data:message,domain:origin||document.domain,uri:document.documentURI,source:window,tag:isEmpty(tag)?null:tag.toLowerCase()};try{return MIF.disableMessaging!==true?MIF.fireEvent.call(MIF,message.type,MIF,message):null;}catch(ex){}return null;}}};window.onhostmessage=function(fn,scope,single,tag){if(typeof fn=="function"){if(!isEmpty(fn.__index)){throw"onhostmessage: duplicate handler definition"+(tag?" for tag:"+tag:"");}var k=isEmpty(tag)?"$":tag.toLowerCase();tagStack[k]||(tagStack[k]=[]);Ext.apply(fn,{__tag:k,__single:single||false,__scope:scope||window,__index:tagStack[k].length});tagStack[k].push(fn);}else{throw"onhostmessage: function required";}};window.unhostmessage=function(fn){if(typeof fn=="function"&&typeof fn.__index!="undefined"){var k=fn.__tag||"$";tagStack[k][fn.__index]=null;}};},get:function(el){return MIM.El.get(this,el);},fly:function(el,named){named=named||"_global";el=this.getDom(el);if(!el){return null;}if(!MIM._flyweights[named]){MIM._flyweights[named]=new Ext.Element.Flyweight();}MIM._flyweights[named].dom=el;return MIM._flyweights[named];},getDom:function(el){var d;if(!el||!(d=this.getDocument())){return null;}return el.dom?el.dom:(typeof el=="string"?d.getElementById(el):el);},select:function(selector,unique){var d;return(d=this.getDocument())?Ext.Element.select(selector,unique,d):null;},query:function(selector){var d;return(d=this.getDocument())?Ext.DomQuery.select(selector,d):null;},getDoc:function(){return this.get(this.getDocument());},removeNode:function(node){MIM.removeNode(this,this.getDom(node));},_unHook:function(){var elcache,h=MIM.getFrameHash(this)||{};if(this._hooked&&h&&(elcache=h.elCache)){for(var id in elcache){var el=elcache[id];delete elcache[id];if(el.removeAllListeners){el.removeAllListeners();}}if(h.docEl){h.docEl.removeAllListeners();h.docEl=null;delete h.docEl;}}this._hooked=this._domReady=this._domFired=false;},_renderHook:function(){this._windowContext=this.CSS=null;this._hooked=false;try{if(this.writeScript('(function(){(window.hostMIF = parent.Ext.get("'+this.dom.id+'"))._windowContext='+(Ext.isIE?"window":"{eval:function(s){return eval(s);}}")+";})();")){this._frameProxy||(this._frameProxy=MIM.eventProxy.createDelegate(this));var w=this.getWindow();EV.doAdd(w,"focus",this._frameProxy);EV.doAdd(w,"blur",this._frameProxy);EV.doAdd(w,"unload",this._frameProxy);if(this.disableMessaging!==true){this.loadFunction({name:"XMessage",fn:this._XFrameMessaging},false,true);var sm;if(sm=w.sendMessage){sm.manager=this;}}this.CSS=new CSSInterface(this.getDocument());}}catch(ex){}return this.domWritable();},sendMessage:function(message,tag,origin){var win;if(this.disableMessaging!==true&&(win=this.getWindow())){tag||(tag=message.tag||"");tag=tag.toLowerCase();message=Ext.applyIf(message.data?message:{data:message},{type:Ext.isEmpty(tag)?"message":"message:"+tag,domain:origin||document.domain,uri:document.documentURI,source:window,tag:tag||null,_fromHost:this});return win.sendMessage?win.sendMessage.call(null,message,tag,origin):null;}return null;},_windowContext:null,getDocument:function(){var win=this.getWindow(),doc=null;try{doc=(Ext.isIE&&win?win.document:null)||this.dom.contentDocument||window.frames[this.id].document||null;}catch(gdEx){return false;}return doc;},getBody:function(){var d;return(d=this.getDocument())?d.body:null;},getDocumentURI:function(){var URI,d;try{URI=this.src&&(d=this.getDocument())?d.location.href:null;}catch(ex){}return URI||this.src;},getWindow:function(){var dom=this.dom,win=null;try{win=dom.contentWindow||window.frames[dom.name]||null;}catch(gwEx){}return win;},print:function(){try{var win=this.getWindow();if(Ext.isIE){win.focus();}win.print();}catch(ex){throw"print exception: "+(ex.description||ex.message||ex);}},destroy:function(){this.removeAllListeners();if(this.dom){this.dom[this._eventName]=null;Ext.ux.ManagedIFrame.Manager.deRegister(this);this._windowContext=null;if(Ext.isIE&&this.dom.src){this.dom.src="javascript:false";}this._maskEl=null;this.remove();}if(this.loadMask){Ext.apply(this.loadMask,{masker:null,maskEl:null});}},domWritable:function(){return !!this._windowContext;},execScript:function(block,useDOM){try{if(this.domWritable()){if(useDOM){this.writeScript(block);}else{return this._windowContext.eval(block);}}else{throw"execScript:non-secure context";}}catch(ex){this.fireEvent("exception",this,ex);return false;}return true;},writeScript:function(block,attributes){attributes=Ext.apply({},attributes||{},{type:"text/javascript",text:block});try{var head,script,doc=this.getDocument();if(doc&&typeof doc.getElementsByTagName!="undefined"){if(!(head=doc.getElementsByTagName("head")[0])){head=doc.createElement("head");doc.getElementsByTagName("html")[0].appendChild(head);}if(head&&(script=doc.createElement("script"))){for(var attrib in attributes){if(attributes.hasOwnProperty(attrib)&&attrib in script){script[attrib]=attributes[attrib];}}return !!head.appendChild(script);}}}catch(ex){this.fireEvent("exception",this,ex);}return false;},loadFunction:function(fn,useDOM,invokeIt){var name=fn.name||fn;var fn=fn.fn||window[fn];this.execScript(name+"="+fn,useDOM);if(invokeIt){this.execScript(name+"()");}},showMask:function(msg,msgCls,forced){var lmask;if((lmask=this.loadMask)&&(!lmask.disabled||forced)){if(lmask._vis){return ;}lmask.masker||(lmask.masker=Ext.get(lmask.maskEl||this.dom.parentNode||this.wrap({tag:"div",style:{position:"relative"}})));lmask._vis=true;lmask.masker.mask.defer(lmask.delay||5,lmask.masker,[msg||lmask.msg,msgCls||lmask.msgCls]);}},hideMask:function(forced){var tlm;if((tlm=this.loadMask)&&!tlm.disabled&&tlm.masker){if(!forced&&(tlm.hideOnReady!==true&&this._domReady)){return ;}tlm._vis=false;tlm.masker.unmask.defer(tlm.delay||5,tlm.masker);}},loadHandler:function(e,target){if(!this.frameInit||(!this._frameAction&&!this.eventsFollowFrameLinks)){return ;}target||(target={});var rstatus=(e&&typeof e.type!=="undefined"?e.type:this.dom.readyState);switch(rstatus){case"loading":case"interactive":break;case"domready":if(this._domReady){return ;}this._domReady=true;if(this._hooked=this._renderHook()){this._domFired=true;this.fireEvent("domready",this);}case"domfail":this._domReady=true;this.hideMask();break;case"load":case"complete":if(!this._domReady){this.loadHandler({type:"domready",id:this.id});}this.hideMask(true);if(this._frameAction||this.eventsFollowFrameLinks){this.fireEvent.defer(50,this,["documentloaded",this]);}this._frameAction=this._frameInit=false;if(this.eventsFollowFrameLinks){this._domFired=this._domReady=false;}if(this._callBack){this._callBack(this);}break;default:}this.frameState=rstatus;},checkDOM:function(win){if(Ext.isOpera||Ext.isGecko||!this._frameAction){return ;}var n=0,win=win||this.getWindow(),manager=this,domReady=false,max=300;var poll=function(){try{var doc=manager.getDocument(),body=null;if(doc===false){throw"Document Access Denied";}if(!manager._domReady){domReady=!!(doc&&doc.getElementsByTagName);domReady=domReady&&(body=doc.getElementsByTagName("body")[0])&&!!body.innerHTML.length;}}catch(ex){n=max;}if(!manager._frameAction||manager._domReady){return ;}if((++n<max)&&!domReady){setTimeout(arguments.callee,10);return ;}manager.loadHandler({type:domReady?"domready":"domfail"});};setTimeout(poll,40);}});var styleCamelRe=/(-[a-z])/gi;var styleCamelFn=function(m,a){return a.charAt(1).toUpperCase();};var CSSInterface=function(hostDocument){var doc;if(hostDocument){doc=hostDocument;return{rules:null,createStyleSheet:function(cssText,id){var ss;if(!doc){return ;}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){if(!doc){return ;}var existing=doc.getElementById(id);if(existing){existing.parentNode.removeChild(existing);}},swapStyleSheet:function(id,url){this.removeStyleSheet(id);if(!doc){return ;}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(this.rules){this.rules={};}try{var ssRules=ss.cssRules||ss.rules;for(var j=ssRules.length-1;j>=0;--j){this.rules[ssRules[j].selectorText]=ssRules[j];}}catch(e){}},getRules:function(refreshCache){if(this.rules==null||refreshCache){this.rules={};if(doc){var ds=doc.styleSheets;for(var i=0,len=ds.length;i<len;i++){try{this.cacheStyleSheet(ds[i]);}catch(e){}}}}return this.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(styleCamelRe,styleCamelFn)]=value;return true;}}else{for(var i=0;i<selector.length;i++){if(this.updateRule(selector[i],property,value)){return true;}}}return false;}};}};Ext.ux.ManagedIframePanel=Ext.extend(Ext.Panel,{defaultSrc:null,bodyStyle:{height:"100%",width:"100%",position:"relative"},frameStyle:{overflow:"auto"},frameConfig:null,hideMode:!Ext.isIE?"nosize":"display",shimCls:Ext.ux.ManagedIFrame.Manager.shimCls,shimUrl:null,loadMask:false,stateful:false,animCollapse:Ext.isIE&&Ext.enableFx,autoScroll:false,closable:true,ctype:"Ext.ux.ManagedIframePanel",showLoadIndicator:false,unsupportedText:"Inline frames are NOT enabled/supported by your browser.",initComponent:function(){this.bodyCfg||(this.bodyCfg={cls:"x-managed-iframe-mask",children:[Ext.apply({tag:"iframe",frameborder:0,cls:"x-managed-iframe",style:this.frameStyle||null,html:this.unsupportedText||null},this.frameConfig?this.frameConfig.autoCreate||{}:false,Ext.isIE&&Ext.isSecure?{src:Ext.SSL_SECURE_URL}:false),{tag:"img",src:this.shimUrl||Ext.BLANK_IMAGE_URL,cls:this.shimCls,galleryimg:"no"}]});this.autoScroll=false;this.items=null;if(this.stateful!==false){this.stateEvents||(this.stateEvents=["documentloaded"]);}Ext.ux.ManagedIframePanel.superclass.initComponent.call(this);this.monitorResize||(this.monitorResize=this.fitToParent);this.addEvents({documentloaded:true,domready:true,message:true,exception:true});this.addListener=this.on;},doLayout:function(){if(this.fitToParent&&!this.ownerCt){var pos=this.getPosition(),size=(Ext.get(this.fitToParent)||this.getEl().parent()).getViewSize();this.setSize(size.width-pos[0],size.height-pos[1]);}Ext.ux.ManagedIframePanel.superclass.doLayout.apply(this,arguments);},beforeDestroy:function(){if(this.rendered){if(this.tools){for(var k in this.tools){Ext.destroy(this.tools[k]);}}if(this.header&&this.headerAsText){var s;if(s=this.header.child("span")){s.remove();}this.header.update("");}Ext.each(["iframe","shim","header","topToolbar","bottomToolbar","footer","loadMask","body","bwrap"],function(elName){if(this[elName]){if(typeof this[elName].destroy=="function"){this[elName].destroy();}else{Ext.destroy(this[elName]);}this[elName]=null;delete this[elName];}},this);}Ext.ux.ManagedIframePanel.superclass.beforeDestroy.call(this);},onDestroy:function(){Ext.Panel.superclass.onDestroy.call(this);},onRender:function(ct,position){Ext.ux.ManagedIframePanel.superclass.onRender.call(this,ct,position);if(this.iframe=this.body.child("iframe.x-managed-iframe")){this.iframe.ownerCt=this;var El=Ext.Element;var mode=El[this.hideMode.toUpperCase()]||"x-hide-nosize";Ext.each([this[this.collapseEl],this.floating?null:this.getActionEl(),this.iframe],function(el){if(el){el.setVisibilityMode(mode);}},this);if(this.loadMask){this.loadMask=Ext.apply({disabled:false,maskEl:this.body,hideOnReady:true},this.loadMask);}if(this.iframe=new Ext.ux.ManagedIFrame(this.iframe,{loadMask:this.loadMask,showLoadIndicator:this.showLoadIndicator,disableMessaging:this.disableMessaging,style:this.frameStyle})){this.loadMask=this.iframe.loadMask;this.relayEvents(this.iframe,["blur","focus","unload","documentloaded","domready","exception","message"].concat(this._msgTagHandlers||[]));delete this._msgTagHandlers;}this.getUpdater().showLoadIndicator=this.showLoadIndicator||false;var ownerCt=this.ownerCt;while(ownerCt){ownerCt.on("afterlayout",function(container,layout){var MIM=Ext.ux.ManagedIFrame.Manager,st=false;Ext.each(["north","south","east","west"],function(region){var reg;if((reg=layout[region])&&reg.splitEl){st=true;if(!reg.split._splitTrapped){reg.split.on("beforeresize",MIM.showShims,MIM);reg.split._splitTrapped=true;}}},this);if(st&&!this._splitTrapped){this.on("resize",MIM.hideShims,MIM);this._splitTrapped=true;}},this,{single:true});ownerCt=ownerCt.ownerCt;}}this.shim=Ext.get(this.body.child("."+this.shimCls));},toggleShim:function(){if(this.shim&&this.shimCls){this.shim.toggleClass(this.shimCls+"-on");}},afterRender:function(container){var html=this.html;delete this.html;Ext.ux.ManagedIframePanel.superclass.afterRender.call(this);if(this.iframe){if(this.defaultSrc){this.setSrc();}else{if(html){this.iframe.update(typeof html=="object"?Ext.DomHelper.markup(html):html);}}}},sendMessage:function(){if(this.iframe){this.iframe.sendMessage.apply(this.iframe,arguments);}},on:function(name){var tagRE=/^message\:/i,n=null;if(typeof name=="object"){for(var na in name){if(!this.filterOptRe.test(na)&&tagRE.test(na)){n||(n=[]);n.push(na.toLowerCase());}}}else{if(tagRE.test(name)){n=[name.toLowerCase()];}}if(this.getFrame()&&n){this.relayEvents(this.iframe,n);}else{this._msgTagHandlers||(this._msgTagHandlers=[]);if(n){this._msgTagHandlers=this._msgTagHandlers.concat(n);}}Ext.ux.ManagedIframePanel.superclass.on.apply(this,arguments);},setSrc:function(url,discardUrl,callback){url=url||this.defaultSrc||false;if(!url){return this;}if(url.url){callback=url.callback||false;discardUrl=url.discardUrl||false;url=url.url||false;}var src=url||(Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"");if(this.rendered&&this.iframe){this.iframe.setSrc(src,discardUrl,callback);}return this;},getState:function(){var URI=this.iframe?this.iframe.getDocumentURI()||null:null;return Ext.apply(Ext.ux.ManagedIframePanel.superclass.getState.call(this)||{},URI?{defaultSrc:typeof URI=="function"?URI():URI}:null);},getUpdater:function(){return this.rendered?(this.iframe||this.body).getUpdater():null;},getFrame:function(){return this.rendered?this.iframe:null;},getFrameWindow:function(){return this.rendered&&this.iframe?this.iframe.getWindow():null;},getFrameDocument:function(){return this.rendered&&this.iframe?this.iframe.getDocument():null;},getFrameDoc:function(){return this.rendered&&this.iframe?this.iframe.getDoc():null;},getFrameBody:function(){return this.rendered&&this.iframe?this.iframe.getBody():null;},load:function(loadCfg){var um;if(um=this.getUpdater()){if(loadCfg&&loadCfg.renderer){um.setRenderer(loadCfg.renderer);delete loadCfg.renderer;}um.update.apply(um,arguments);}return this;},doAutoLoad:function(){this.load(typeof this.autoLoad=="object"?this.autoLoad:{url:this.autoLoad});}});Ext.reg("iframepanel",Ext.ux.ManagedIframePanel);Ext.ux.ManagedIframePortlet=Ext.extend(Ext.ux.ManagedIframePanel,{anchor:"100%",frame:true,collapseEl:"bwrap",collapsible:true,draggable:true,cls:"x-portlet"});Ext.reg("iframeportlet",Ext.ux.ManagedIframePortlet);Ext.apply(Ext.Element.prototype,{setVisible:function(visible,animate){if(!animate||!Ext.lib.Anim){if(this.visibilityMode==Ext.Element.DISPLAY){this.setDisplayed(visible);}else{if(this.visibilityMode==Ext.Element.VISIBILITY){this.fixDisplay();this.dom.style.visibility=visible?"visible":"hidden";}else{this[visible?"removeClass":"addClass"](String(this.visibilityMode));}}}else{var dom=this.dom;var visMode=this.visibilityMode;if(visible){this.setOpacity(0.01);this.setVisible(true);}this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!visible){if(visMode==Ext.Element.DISPLAY){dom.style.display="none";}else{if(visMode==Ext.Element.VISIBILITY){dom.style.visibility="hidden";}else{Ext.get(dom).addClass(String(visMode));}}Ext.get(dom).setOpacity(1);}});}return this;},isVisible:function(deep){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none"||this.hasClass(this.visibilityMode));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;}});Ext.onReady(function(){var CSS=Ext.util.CSS,rules=[];CSS.getRule(".x-managed-iframe")||(rules.push(".x-managed-iframe {height:100%;width:100%;overflow:auto;}"));CSS.getRule(".x-managed-iframe-mask")||(rules.push(".x-managed-iframe-mask{width:100%;height:100%;position:relative;}"));if(!CSS.getRule(".x-frame-shim")){rules.push(".x-frame-shim {z-index:8500;position:absolute;top:0px;left:0px;background:transparent!important;overflow:hidden;display:none;}");rules.push(".x-frame-shim-on{width:100%;height:100%;display:block;zoom:1;}");rules.push(".ext-ie6 .x-frame-shim{margin-left:5px;margin-top:3px;}");}CSS.getRule(".x-hide-nosize")||(rules.push(".x-hide-nosize,.x-hide-nosize *{height:0px!important;width:0px!important;border:none;}"));if(!!rules.length){CSS.createStyleSheet(rules.join(" "));}});})();
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/miframe-min.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/miframe-min.js');
Ext.layout.BorderLayoutMargin = 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();
        // the foolling block was added to support a marging of 10px and set body to correct heighht
        size.width = size.width - 20;
        size.height = size.height - 20;
        target.dom.style.height = size.height+'px';
        
        
        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.Container.LAYOUTS['border-margin'] = Ext.layout.BorderLayoutMargin;

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/borderlayout-margin.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/borderlayout-margin.js');
/**
* @author Shea Frederick
* http://www.vinylfox.com
*/

Ext.namespace('Ext.ux');

/**
* This extension adds Google maps functionality to any panel or panel based component (ie: windows).
* @class Ext.ux.GMapPanel
* @extends Ext.Panel
* @param {Object} config The config object
*/
Ext.ux.GMapPanel = Ext.extend(Ext.Panel, {
    respErrors: [{
        code: 400, // G_GEO_BAD_REQUEST
        msg: 'A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.'
    }, {
        code: G_GEO_SERVER_ERROR,
        msg: 'A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.'
    }, {
        code: 601, // G_GEO_MISSING_QUERY
        msg: 'The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.'
    }, {
        code: G_GEO_MISSING_ADDRESS,
        msg: 'Synonym for G_GEO_MISSING_QUERY.'
    }, {
        code: G_GEO_UNKNOWN_ADDRESS,
        msg: 'No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect.'
    }, {
        code: G_GEO_UNAVAILABLE_ADDRESS,
        msg: 'The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.'
    }, {
        code: 604, // G_GEO_UNKNOWN_DIRECTIONS
        msg: 'The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region.'
    }, {
        code: G_GEO_BAD_KEY,
        msg: 'The given key is either invalid or does not match the domain for which it was given.'
    }, {
        code: G_GEO_TOO_MANY_QUERIES,
        msg: 'The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you\'re sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don\'t send the requests too quickly.'
}],
        respErrorTitle: 'Error',
        geoErrorMsgUnable: 'Unable to Locate the Address you provided',
        geoErrorTitle: 'Address Location Error',
        geoErrorMsgAccuracy: 'The address provided has a low accuracy.<br><br>Level {0} Accuracy (8 = Exact Match, 1 = Vague Match)',
        /**
        * @cfg {String} gmapType
        * The type of map to display, generic options available are: 'map', 'panorama'. 
        * More specific maps can be used by specifying the google map type:
        * 
        * G_NORMAL_MAP displays the default road map view
        * G_SATELLITE_MAP displays Google Earth satellite images
        * G_HYBRID_MAP displays a mixture of normal and satellite views
        * G_DEFAULT_MAP_TYPES contains an array of the above three types, useful for iterative processing.
        * G_PHYSICAL_MAP displays a physical map based on terrain information. 
        * G_MOON_ELEVATION_MAP displays a shaded terrain map of the surface of the Moon, color-coded by altitude.
        * G_MOON_VISIBLE_MAP displays photographic imagery taken from orbit around the moon.
        * G_MARS_ELEVATION_MAP displays a shaded terrain map of the surface of Mars, color-coded by altitude.
        * G_MARS_VISIBLE_MAP displays photographs taken from orbit around Mars.
        * G_MARS_INFRARED_MAP displays a shaded infrared map of the surface of Mars, where warmer areas appear brighter and colder areas appear darker.
        * G_SKY_VISIBLE_MAP displays a mosaic of the sky, as seen from Earth, covering the full celestial sphere.
        * 
        * These map types can be used within a configuration like this:  { gmapType: G_MOON_VISIBLE_MAP }
        */
        /**
        * @cfg {Object} setCenter
        * A center starting point for the map. The map needs to be centered before it can be used.
        * The config can contain an address to geocode, and even a marker
        * \{
        *   geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
        *   marker: \{title: 'Fenway Park'\}
        * \}
        * Or it can simply be a lat/lng. Either way, a marker is not required, all we are really looking for here is a starting center point for the map.
        * \{
        *   lat: 42.339641,
        *   lng: -71.094224
        * \}
        */
        /**
        * @cfg {Number} zoomLevel
        * The zoom level to initialize the map at, generally between 1 (whole planet) and 40 (street). Also used as the zoom level for panoramas, zero specifies no zoom at all.
        */
        /**
        * @cfg {Number} yaw
        * The Yaw, or rotational direction of the users perspective in degrees. Only applies to panoramas.
        */
        /**
        * @cfg {Number} pitch
        * The pitch, or vertical direction of the users perspective in degrees. Default is 0 (zero), straight ahead. Valid values are between +90 (straight up) and -90 (straight down). 
        */
        /**
        * @cfg {Boolean} displayGeoErrors
        * True to display geocoding errors to the end user via a message box.
        */
        /**
        * @cfg {Boolean} minGeoAccuracy
        * The level (between 1 & 8) to display an accuracy error below. Defaults to seven (7).
        * see: http://code.google.com/apis/maps/documentation/reference.html#GGeoAddressAccuracy
        */
        /**
        * @cfg {Array} mapConfOpts
        * Array of strings representing configuration methods to call, a full list can be found here: http://code.google.com/apis/maps/documentation/reference.html#GMap2
        */
        /**
        * @cfg {Array} mapControls
        * Array of strings representing map controls to initialize, a full list can be found here: http://code.google.com/apis/maps/documentation/reference.html#GControlImpl
        */
        // private
        initComponent: function() {

            var defConfig = {
                plain: true,
                zoomLevel: 0,
                yaw: 180,
                pitch: 0,
                gmapType: 'map',
                border: false,
                displayGeoErrors: false,
                minGeoAccuracy: 7,
                mapDefined: false,
                mapDefinedGMap: false
            };

            Ext.applyIf(this, defConfig);

            Ext.ux.GMapPanel.superclass.initComponent.call(this);

        },
        // private
        afterRender: function() {

            var wh = this.ownerCt.getSize();
            Ext.applyIf(this, wh);

            Ext.ux.GMapPanel.superclass.afterRender.call(this);

            if (this.gmapType === 'map') {
                this.gmap = new GMap2(this.body.dom);
                this.mapDefined = true;
                this.mapDefinedGMap = true;
            }

            if (this.gmapType === 'panorama') {
                this.gmap = new GStreetviewPanorama(this.body.dom);
                this.mapDefined = true;
            }

            if (!this.mapDefined && this.gmapType) {
                this.gmap = new GMap2(this.body.dom);
                this.gmap.setMapType(this.gmapType);
                this.mapDefined = true;
                this.mapDefinedGMap = true;
            }

            GEvent.bind(this.getMap(), 'load', this, this.onMapReady);

            if (typeof this.setCenter === 'object') {
                if (typeof this.setCenter.geoCodeAddr === 'string') {
                    this.geoCodeLookup(this.setCenter.geoCodeAddr, this.setCenter.marker, false, true, this.setCenter.listeners);
                } else {
                    if (this.gmapType === 'map') {
                        var point = this.fixLatLng(new GLatLng(this.setCenter.lat, this.setCenter.lng));
                        this.getMap().setCenter(point, this.zoomLevel);
                    }
                    if (typeof this.setCenter.marker === 'object' && typeof point === 'object') {
                        this.addMarker(point, this.setCenter.marker, this.setCenter.marker.clear);
                    }
                }
                if (this.gmapType === 'panorama') {
                    this.getMap().setLocationAndPOV(new GLatLng(this.setCenter.lat, this.setCenter.lng), { yaw: this.yaw, pitch: this.pitch, zoom: this.zoomLevel });
                }
            }

        },
        // private
        onMapReady: function() {

            this.addMapControls();
            this.addOptions();

            this.addMarkers(this.markers);
            this.addKMLOverlay(this.autoLoadKML);

        },
        // private
        onResize: function(w, h) {

            // check for the existance of the google map in case the onResize fires too early
            if (typeof this.getMap() == 'object') {
                this.getMap().checkResize();
            }

            Ext.ux.GMapPanel.superclass.onResize.call(this, w, h);

        },
        // private
        setSize: function(width, height, animate) {

            // check for the existance of the google map in case setSize is called too early
            if (typeof this.getMap() == 'object') {
                this.getMap().checkResize();
            }

            Ext.ux.GMapPanel.superclass.setSize.call(this, width, height, animate);

        },
        /**
        * Returns the current google map
        * @return {GMap} this
        */
        getMap: function() {

            return this.gmap;

        },
        /**
        * Returns the maps center as a GLatLng object
        * @return {GLatLng} this
        */
        getCenter: function() {

            return this.fixLatLng(this.getMap().getCenter());

        },
        /**
        * Returns the maps center as a simple object
        * @return {Object} this has lat and lng properties only
        */
        getCenterLatLng: function() {

            var ll = this.getCenter();
            return { lat: ll.lat(), lng: ll.lng() };

        },
        /**
        * Creates markers from the array that is passed in. Each marker must consist of at least lat and lng properties.
        * @param {Array} markers an array of marker objects
        */
        addMarkers: function(markers) {

            if (Ext.isArray(markers)) {
                for (var i = 0; i < markers.length; i++) {
                    if (typeof markers[i].geoCodeAddr == 'string') {
                        this.geoCodeLookup(markers[i].geoCodeAddr, markers[i].marker, false, markers[i].setCenter, markers[i].listeners);
                    } else {
                        var mkr_point = this.fixLatLng(new GLatLng(markers[i].lat, markers[i].lng));
                        this.addMarker(mkr_point, markers[i].marker, false, markers[i].setCenter, markers[i].listeners);
                    }
                }
            }

        },
        /**
        * Creates a single marker.
        * @param {Object} point a GLatLng point
        * @param {Object} marker a marker object consisting of at least lat and lng
        * @param {Boolean} clear clear other markers before creating this marker
        * @param {Boolean} center true to center the map on this marker
        * @param {Object} listeners a listeners config
        */
        addMarker: function(point, marker, clear, center, listeners) {

            Ext.applyIf(marker, G_DEFAULT_ICON);

            if (clear === true) {
                this.getMap().clearOverlays();
            }
            if (center === true) {
                this.getMap().setCenter(point, this.zoomLevel);
            }

            var mark = new GMarker(point, marker);
            if (typeof listeners === 'object') {
                for (evt in listeners) {
                    GEvent.bind(mark, evt, this, listeners[evt]);
                }
            }
            this.getMap().addOverlay(mark);

        },
        // private
        addMapControls: function() {

            if (this.gmapType === 'map') {
                if (Ext.isArray(this.mapControls)) {
                    for (i = 0; i < this.mapControls.length; i++) {
                        this.addMapControl(this.mapControls[i]);
                    }
                } else if (typeof this.mapControls === 'string') {
                    this.addMapControl(this.mapControls);
                } else if (typeof this.mapControls === 'object') {
                    this.getMap().addControl(this.mapControls);
                }
            }

        },
        /**
        * Adds a GMap control to the map.
        * @param {String} mc a string representation of the control to be instantiated.
        */
        addMapControl: function(mc) {

            var mcf = window[mc];
            if (typeof mcf === 'function') {
                this.getMap().addControl(new mcf());
            }

        },
        // private
        addOptions: function() {

            if (Ext.isArray(this.mapConfOpts)) {
                var mc;
                for (i = 0; i < this.mapConfOpts.length; i++) {
                    this.addOption(this.mapConfOpts[i]);
                }
            } else if (typeof this.mapConfOpts === 'string') {
                this.addOption(this.mapConfOpts);
            }

        },
        /**
        * Adds a GMap option to the map.
        * @param {String} mo a string representation of the option to be instantiated.
        */
        addOption: function(mo) {

            var mof = this.getMap()[mo];
            if (typeof mof === 'function') {
                this.getMap()[mo]();
            }

        },
        /**
        * Loads a KML file into the map.
        * @param {String} kmlfile a string URL to the KML file.
        */
        addKMLOverlay: function(kmlfile) {

            if (typeof kmlfile === 'string' && kmlfile !== '') {
                var geoXml = new GGeoXml(kmlfile);
                this.getMap().addOverlay(geoXml);
            }

        },
        /**
        * Adds a marker to the map based on an address string (ie: "123 Fake Street, Springfield, NA, 12345, USA") or center the map on the address.
        * @param {String} addr the address to lookup.
        * @param {Object} marker the marker to add (optional).
        * @param {Boolean} clear clear other markers before creating this marker
        * @param {Boolean} center true to set this point as the center of the map.
        * @param {Object} listeners a listeners config
        */
        geoCodeLookup: function(addr, marker, clear, center, listeners) {

            if (!this.geocoder) {
                this.geocoder = new GClientGeocoder();
            }
            this.geocoder.getLocations(addr, this.addAddressToMap.createDelegate(this, [addr, marker, clear, center, listeners], true));

        },
        // private
        addAddressToMap: function(response, addr, marker, clear, center, listeners) {
            if (!response || response.Status.code != 200) {
                this.respErrorMsg(response.Status.code);
            } else {
                place = response.Placemark[0];
                addressinfo = place.AddressDetails;
                accuracy = addressinfo.Accuracy;
                if (accuracy === 0) {
                    this.geoErrorMsg(this.geoErrorTitle, this.geoErrorMsgUnable);
                } else {
                    if (accuracy < this.minGeoAccuracy) {
                        this.geoErrorMsg(this.geoErrorTitle, String.format(this.geoErrorMsgAccuracy, accuracy));
                    } else {
                        point = this.fixLatLng(new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]));
                        if (center) {
                            this.getMap().setCenter(point, this.zoomLevel);
                        }
                        if (typeof marker === 'object') {
                            if (!marker.title) {
                                marker.title = place.address;
                            }
                            Ext.applyIf(marker, G_DEFAULT_ICON);
                            this.addMarker(point, marker, clear, false, listeners);
                        }
                    }
                }
            }

        },
        // private
        geoErrorMsg: function(title, msg) {
            if (this.displayGeoErrors) {
                Ext.MessageBox.alert(title, msg);
            }
        },
        // private
        respErrorMsg: function(code) {
            Ext.each(this.respErrors, function(obj) {
                if (code == obj.code) {
                    Ext.MessageBox.alert(this.respErrorTitle, obj.msg);
                }
            }, this);
        },
        // private
        // used to inverse the lat/lng coordinates to correct locations on the sky map
        fixLatLng: function(llo) {
            if (this.getMap().getCurrentMapType()) {
                if (this.getMap().getCurrentMapType().QO == 'visible') {
                    llo.lat(180 - llo.lat());
                    llo.lng(180 - llo.lng());
                }
            }
            return llo;
        }
    });

    Ext.reg('gmappanel', Ext.ux.GMapPanel); 
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.ux.GMapPanel.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.ux.GMapPanel.js');
/**********
*
* http://TDG-i.com TDG innovations, LLC
* 03/15/2008, Jay Garcia, jgarcia@tdg-i.com
* borderLayout extension example displaying 'collapsed titles' 
* Blog Link: http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout
* Purpose : Adds ability to insert title in collapsed layout panels.  
* Note: You must use layout 'tdgi_border' to use this extension.
* Works with EXT 2.0+
*
* Parameters: collapsedTitle, object || string || boolean
* 
* Example Object: 
	collapsedTitle: {
		//Just like an Ext.DomHelper config object
		element : {
			// Required0
			tag  : 'div',
			// Required
			html : 'NorthPanel Collapsed',
			// Set this if you need to.
			style  : "margin-left:3px; color: #FF0000; font-weight: bold;"
		}
	}

*
* Example String: (Html fragment)
	collapsedTitle: '<div style="myStyle">My Collapsed Title</div>'
*
* Example Boolean: (This allows you to use the original title)
	collapsedTitle: true

*
* License : Free to use, just please don't sell without permission.
* This was made for myself, my customers, and the EXT Community.  
* 
* Waranty : None. I can answer questions via email: jgarcia@tdg-i.com
*
**********/

Ext.namespace('Ext.ux', 'Ext.ux.TDGi');

Ext.ux.TDGi.BorderLayout = function(config) {

	Ext.ux.TDGi.BorderLayout.superclass.constructor.call(this, config, this);
	
	
};

Ext.extend(Ext.ux.TDGi.BorderLayout, Ext.layout.BorderLayout, {
	northTitleAdded  : false,
	southTitleAdded  : false,
	eastTitleAdded  : false,
	westTitleAdded  : false,

	doCollapsedTitle : function (ct) {
		function doHtmlInsert(ct, element) {
			if (ct.region == 'east' || ct.region =='west') {
				if (Ext.isIE6 || Ext.isIE7) {
					if (ct.region == 'east') {
						Ext.get(ct.collapsedEl.dom.firstChild).applyStyles({margin:'3px 3px 5px 3px'});
					}
					else {
						Ext.get(ct.collapsedEl.dom.firstChild).applyStyles({margin:'3px auto 5px 3px'});
					}
				}
				return(Ext.DomHelper.append(ct.collapsedEl, element));
			}
			else {
				return(Ext.DomHelper.insertFirst(ct.collapsedEl, element));
			}			
			
		}
		
		if (ct.collapsedTitle) {
			if (typeof ct.collapsedTitle == 'object') {
				if (typeof ct.collapsedTitle.element == 'object') {
					var element = ct.collapsedTitle.element;
					if (element.style) {
						element.style += 'float: left;';	
					}
					else {
						element.style = 'float: left;';	
					}
					doHtmlInsert(ct, element);
					return(true);
				}
			}
			else if (typeof ct.collapsedTitle == 'string') {
				var element = ct.collapsedTitle;
				doHtmlInsert(ct, element);
				return(true)	
			}
			else if (typeof ct.collapsedTitle == 'boolean' && ct.collapsedTitle == true) {
				if (ct.region == 'east' || ct.region =='west') {
					if (Ext.isIE6 || Ext.isIE7) {
						var element = {
							tag : 'div',
							style : "writing-mode: tb-rl; ",
							html : ct.title 
						}
					}
					else {
						var y = 0, txt = '';
						for (i = 0; y < ct.title.length ; i ++ ) {
							txt += ct.title.substr(y, 1) + '<br />';
							y++;	
						}
						var element = {
							tag : 'div',
							style : "text-align: center;",
							html : txt 
						}
					}
				}
				else {
					var element = {
						tag : 'div',
						html : ct.title ,
						style : 'float: left;'
					}
				
				}
				doHtmlInsert(ct, element);
				return(true);				
			}
			
		}

	},
	// private
	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){ // display none?
			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);
					
			/**********
			*
			* http://TDG-i.com TDG innovations, LLC
			* 03/15/2008, Jay Garcia, jgarcia@tdg-i.com
			* borderLayout extension example displaying 'collapsed titles' 
			* Blog Link: http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout
			* Purpose : Adds ability to insert title in collapsed layout panels.
			*
			************/
			if (typeof n.collapsedEl != 'undefined' && n.collapsedTitle && this.northTitleAdded == false) {
				if (this.doCollapsedTitle(n)) {
					this.northTitleAdded = true;
				}
			}                    
		}
		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);

			/**********
			*
			* http://TDG-i.com TDG innovations, LLC
			* 03/15/2008, Jay Garcia, jgarcia@tdg-i.com
			* borderLayout extension example displaying 'collapsed titles' 
			* Blog Link: http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout
			* Purpose : Adds ability to insert title in collapsed layout panels.
			*
			************/

			if (typeof s.collapsedEl != 'undefined' && s.collapsedTitle && this.southTitleAdded == false) {
				if (this.doCollapsedTitle(s)) {
					this.southTitleAdded = true;
				}
			}                
		}
		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);

			/**********
			*
			* http://TDG-i.com TDG innovations, LLC
			* 03/15/2008, Jay Garcia, jgarcia@tdg-i.com
			* borderLayout extension example displaying 'collapsed titles' 
			* Blog Link: http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout
			* Purpose : Adds ability to insert title in collapsed layout panels.
			*
			************/
			if (typeof west.collapsedEl != 'undefined' && west.collapsedTitle && this.westTitleAdded == false) {
				if (this.doCollapsedTitle(west)) {
					this.westTitleAdded = true;
				}
			
			}                
			
		}
		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);
	
			/**********
			*
			* http://TDG-i.com TDG innovations, LLC
			* 03/15/2008, Jay Garcia, jgarcia@tdg-i.com
			* borderLayout extension example displaying 'collapsed titles' 
			* Blog Link: http://tdg-i.com/30/how-to-get-titles-in-collapsed-panels-for-border-layout
			* Purpose : Adds ability to insert title in collapsed layout panels.
			*
			************/
			if (typeof e.collapsedEl != 'undefined' && e.collapsedTitle && this.eastTitleAdded == false) {
				if (this.doCollapsedTitle(e)) {
					this.eastTitleAdded = true;
				}
			}                
			
		}

		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){ // workaround IE strict repainting issue
			target.repaint();
		}
	}
});

Ext.Container.LAYOUTS['tdgi_border'] = Ext.ux.TDGi.BorderLayout;
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/tdgi.borderLayout.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/tdgi.borderLayout.js');
/**
 * Class Ext.ux.SlideZone
 * @author Jared Gisin
 * @version $Id: Ext.ux.SlideZone.js 93 2007-12-12 04:41:40Z jaredgisin $
 * @license http://www.opensource.org/licenses/mit-license.php
 * 
 * TODO: make sure slider limits work when snap = 1 or snap < slider width/height
 * TODO: API to dynamically modify the snap 
 * TODO: zone with slider zone responds to click and keypress
 * TODO: API to programatically set slider value with animation
 *
 */

Ext.ux.SlideZone = function(id, config) {
	if(id) {
		Ext.apply(this, config); 
		this.init(id, config || {}); 
	} else {
		return false;
	}
} 

Ext.extend(Ext.ux.SlideZone, Ext.BoxComponent, {
	size: 100,
	sliderSnap: [0],
	type: 'horizontal',
	sliderWidth: 20,
	sliderHeight: 20,
	cls: null,
	minValue: 0,
	maxValue: 100,
	allowSliderCrossing: true,
	value: null,
	  
	init: function(id, config) { 
		this.size = this.size instanceof Array ? this.size : [this.size];
		this.minValue = this.minValue instanceof Array ? this.minValue : [this.minValue];
		this.maxValue = this.maxValue instanceof Array ? this.maxValue : [this.maxValue];
		this.sliderSnap = this.sliderSnap instanceof Array ? this.sliderSnap : [this.sliderSnap];

		this.el = Ext.DomHelper.append(Ext.get(id),  { tag: 'div', 
						id: Ext.id(), 
						style: 'position: relative; '
						 }, true);
		this.el.addClass('x-slide-zone-' + this.type);
		this.el.addClass(this.cls);
		
		switch(this.type) {
			case 'horizontal':
				this.sliderSize = [this.sliderWidth];
				this.el.applyStyles({width:this.size[0] + 'px'});
				this.el.lowLimit = [this.el.getX()];
				this.el.highLimit = [this.el.getRight()];
				break;
							
			case 'vertical':
				this.sliderSize = [this.sliderHeight]
				this.el.applyStyles({height:this.size[0] + 'px'});
				this.el.lowLimit = [this.el.getY()];
				this.el.highLimit = [this.el.getBottom()];
				break;
							
			case 'area':
				this.sliderSize = [this.sliderWidth, this.sliderHeight];
				this.el.applyStyles({width:this.size[0] + 'px'});
				this.el.applyStyles({height:this.size[1] + 'px'});
				this.el.lowLimit = this.el.getXY();
				this.el.highLimit = [this.el.getRight(), this.el.getBottom()];
				break
		}

		//normalize width/height for slider centering calculations
		var l = this.sliderSize.length;
		for(var i = 0; i < l; i++) {
			this.sliderSize[i] = this.sliderSize[i] % 2 ? this.sliderSize[i] + 1: this.sliderSize[i] 
		}


		var s = this.sliders;
	    this.sliders = new Ext.util.MixedCollection();
	    if(s){
	        this.add.apply(this, s);
	    }

	},
	
	add: function(){
		var a = arguments, l = a.length
		for(var i = 0; i < l; i++){
			var el = a[i];
			if (el instanceof Ext.ux.Slider) {
				this.initSlider(el);
				this.sliders.add(el)
			} else if (typeof el == 'object') {
				//initalize new slider and add to the items list
				var s = new Ext.ux.ThumbSlider(el);
				this.initSlider(s);
				this.sliders.add(s)
			}
		}
		this.updateValues();
		this.updateConstraints();
 	},
	
	enableCrossing: function() {
		this.allowSliderCrossing = true;
		this.updateConstraints();
	},
	
	disableCrossing: function() {
		this.allowSliderCrossing = false;
		this.updateConstraints();		
	},
	
	getSlider: function(selector) {
		/* Given a slider index or name, returns a slider object
		 * @selector   slider index|name
		 */
		switch (typeof selector)  {
			case 'number':
				return this.sliders.items[selector];
				break;
				
			case 'string':
				var l = this.sliders.length;
				for(var i = 0; i < l; i++){
					if(this.sliders.items[i].name ==  selector) return this.sliders.items[i];
				}
				break;
		}
	},


	updateConstraints: function() {
		if(!this.allowSliderCrossing && this.sliders.length > 1 && this.type != 'area') {
			// multiple sliders exists and sliders can't cross,
			// so we have to take into account the
			// positions of all sliders
			sortFN = function(a,b){
				var v1 = a.value instanceof Array ? a.value[0] : a.value;
				var v2 = b.value instanceof Array ? b.value[0] : b.value;
	            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
			}
			this.sliders.sort('asc',sortFN);//put in order by their value
			
			var l = this.sliders.length; 
			for (var i=0; i< l; i++) { //forloop required, as we have to get -1 and +1 slider positions
				var leftTravel = 0, rightTravel = 0;
				var sliderL = this.sliders.get(i-1);
				var slider = this.sliders.get(i);
				var sliderR = this.sliders.get(i+1);

				
				if (sliderL && sliderR) {
					if (sliderL instanceof Ext.ux.ThumbSlider) {
						var leftTravel = slider.getTL()[0] - sliderL.getTL()[0] - this.sliderSnap[0];
					}
					if (sliderL instanceof Ext.ux.RangeSlider) {
						var leftTravel = slider.getTL()[0] - sliderL.getBR()[0] - this.sliderSnap[0];					
					}
					if (sliderR instanceof Ext.ux.ThumbSlider) {
						var rightTravel = sliderR.getTL()[0] - slider.getTL()[0] - this.sliderSnap[0];	
					}
					if (sliderR instanceof Ext.ux.RangeSlider) {
						var rightTravel = sliderR.getTL()[0] - slider.getBR()[0] - this.sliderSnap[0] ;							
					}
				} else if(sliderL) {
					if (sliderL instanceof Ext.ux.ThumbSlider) {
						var rightTravel = this.el.highLimit[0] - slider.getTL()[0] - ( 0.5 * this.sliderSize[0]) ;	
						var leftTravel = slider.getTL()[0] - sliderL.getTL()[0] - this.sliderSnap[0];
					}
					if (sliderL instanceof Ext.ux.RangeSlider) {
						var rightTravel = this.el.highLimit[0] - slider.getBR()[0];	
						var leftTravel = slider.getTL()[0] - sliderL.getBR()[0] - this.sliderSnap[0];
					}
				} else if(sliderR) {
					if (sliderR instanceof Ext.ux.ThumbSlider) {
						var leftTravel = slider.getTL()[0] - this.el.lowLimit[0] + ( 0.5 * this.sliderSize[0]);
						var rightTravel = sliderR.getTL()[0] - slider.getTL()[0] - this.sliderSnap[0] ;
					}
					if (sliderR instanceof Ext.ux.RangeSlider) {
						var leftTravel = slider.getTL()[0] - this.el.lowLimit[0];
						var rightTravel = sliderR.getTL()[0] - slider.getBR()[0] - this.sliderSnap[0] ;					
					}
				}
				if(slider instanceof Ext.ux.RangeSlider) {
					slider.resizable.leftTravel = [leftTravel];
					slider.resizable.rightTravel = [rightTravel];
				}
				slider.setConstraint([leftTravel], [rightTravel], this.sliderSnap);
			}
		} else {
			var l = this.sliders.length;
			for (var i=0; i< l; i++) {
				var slider = this.sliders.get(i);
				if (slider instanceof Ext.ux.ThumbSlider ) {
					slider.setConstraint([slider.getTL()[0]-this.el.lowLimit[0]  + ( 1/2 * this.sliderSize[0]),
										  slider.getTL()[1]-this.el.lowLimit[1]  + ( 1/2 * this.sliderSize[1])], 
								[this.el.highLimit[0]- (slider.getTL()[0] + this.sliderSize[0]) + ( 1/2 * this.sliderSize[0]),
								 this.el.highLimit[1]- (slider.getTL()[1] + this.sliderSize[1]) + ( 1/2 * this.sliderSize[1]) ],
								this.sliderSnap)
				}
				if (slider instanceof Ext.ux.RangeSlider) {
					slider.setConstraint([slider.getTL()[0] - this.el.lowLimit[0],
										  slider.getTL()[1] - this.el.lowLimit[1]], 
								[this.el.highLimit[0] - slider.getBR()[0],
								 this.el.highLimit[1] - slider.getBR()[1] ],
								this.sliderSnap)				
				}
			}
		}
	},
	
	updateValues: function() {
		var that = this;
		var vals = {};
		this.sliders.each(function(i) {

			if(this.type == 'area') {
				if (i instanceof Ext.ux.ThumbSlider) {
					i.value = [(i.getTL()[0] + 1/2 * that.sliderSize[0] - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0],
							   (i.getTL()[1] + 1/2 * that.sliderSize[1] - that.el.lowLimit[1]) / (that.size[1]) * (that.maxValue[1] - that.minValue[1]) + that.minValue[1]];
					i.percent = [parseFloat((i.getTL()[0]  + 1/2 * that.sliderSize[0] - that.el.lowLimit[0]) / (that.size[0]) * 100),
								 parseFloat((i.getTL()[1]  + 1/2 * that.sliderSize[1] - that.el.lowLimit[1]) / (that.size[1]) * 100)];
				} 
				if (i instanceof Ext.ux.RangeSlider) {
					i.value = [[
								(i.getTL()[0] - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0],
							    (i.getBR()[0] - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0]


							   ],[
								(i.getTL()[1]  - that.el.lowLimit[1]) / (that.size[1]) * (that.maxValue[1] - that.minValue[1]) + that.minValue[1],
							    (i.getBR()[1]  - that.el.lowLimit[1]) / (that.size[1]) * (that.maxValue[1] - that.minValue[1]) + that.minValue[1]
							   ]];
					i.percent = [[
								  parseFloat((i.getTL()[0] - that.el.lowLimit[0]) / (that.size[0]) * 100).toFixed(2),
								  parseFloat((i.getBR()[0] - that.el.lowLimit[0]) / (that.size[0]) * 100).toFixed(2)
								],[
								  parseFloat((i.getTL()[1] - that.el.lowLimit[1]) / (that.size[1]) * 100).toFixed(2),
								  parseFloat((i.getBR()[1] - that.el.lowLimit[1]) / (that.size[1]) * 100).toFixed(2)
								 ]];
				}
			} else {
				if (i instanceof Ext.ux.ThumbSlider) {
					i.value = (i.getTL()[0] + 1/2 * that.sliderSize[0] - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0];
					i.percent = parseFloat((i.getTL()[0]  + 1/2 * that.sliderSize[0] - that.el.lowLimit[0]) / (that.size[0]) * 100);
				} 
				if (i instanceof Ext.ux.RangeSlider) {
					i.value =  [(i.getTL()[0]  - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0],
							   (i.getBR()[0] - that.el.lowLimit[0]) / (that.size[0]) * (that.maxValue[0] - that.minValue[0]) + that.minValue[0]];
					i.percent = [  parseFloat((i.getTL()[0]  - that.el.lowLimit[0]) / (that.size[0]) * 100),
								   parseFloat((i.getBR()[0] - that.el.lowLimit[0]) / (that.size[0]) * 100)];	
				}
			}
			vals[this.name] = this.value;
		});

		this.value = vals;
	},
	
	initSliderPosition: function(slider) {
		/* Sets a sliders's initial position within the slide zone.
		 * If slideZone has a sliderSnap set, the slider 
		 * is positioned at a multiple of the sliderSnap value that is
		 * closest where the slider's value would otherwise position it.
		 * After positioning, the slider's actual value will be modified
		 * in Ext.ux.SlideZone.updateValues()
		 * to jibe with the actual position in the slide zone given the 
		 * sliderSnap constraint.
		 */
		var initialPosition = [0,0];
		slider.repositionDelta = [0,0];
		var l = this.type == 'area' ? 2 : 1;
		for(var i=0; i < l; i++ ) {
			/* Make sure initial value is in slider bar range, 
			   if it's outside, set to closest limit.
			   The slider value is modified if it's out of range. */
			if(slider.value instanceof Array) {
				if (slider instanceof Ext.ux.ThumbSlider) {

					slider.value[i] = Number(slider.value[i]).constrain(this.minValue[i], this.maxValue[i]);
					initialPosition[i] = parseInt((slider.value[i] - this.minValue[i]) / (this.maxValue[i] - this.minValue[i]) * this.size[i] + this.el.lowLimit[i]);
				}
				if (slider instanceof Ext.ux.RangeSlider) {
					switch (this.type) {
						case 'horizontal':
						case 'vertical':
							slider.value[i] = Number(slider.value[i]).constrain(this.minValue[i], this.maxValue[i]);
							initialPosition[i] = parseInt((slider.value[i] - this.minValue[i]) / (this.maxValue[i] - this.minValue[i]) * this.size[i] + this.el.lowLimit[i]);
							break;
						
						case 'area':
							slider.value[i][0] = Number(slider.value[i][0]).constrain(this.minValue[i], this.maxValue[i]);
							slider.value[i][1] = Number(slider.value[i][1]).constrain(this.minValue[i], this.maxValue[i]);
							
							initialPosition[i] = parseInt((slider.value[i][0] - this.minValue[i]) / (this.maxValue[i] - this.minValue[i]) * this.size[i] + this.el.lowLimit[i]);

							break;
					}
				}
			} else {
				slider.value = Number(slider.value).constrain(this.minValue[i], this.maxValue[i]);
				initialPosition[i] = parseInt((slider.value - this.minValue[i]) / (this.maxValue[i] - this.minValue[i]) * this.size[i] + this.el.lowLimit[i]);
			}
			
			/* Calculate slider value versus closest snap-to location,
			   and calculate an offset value to apply when positioning it. */
			if (this.sliderSnap[i] > 1) {
				var positionToSnapDiff = [0,0];
				positionToSnapDiff[i] = (initialPosition[i] - this.el.lowLimit[i]) % this.sliderSnap[i];
				if (positionToSnapDiff[i]) {
					if(positionToSnapDiff[i] < 1/2 * this.sliderSnap[i]) {
						slider.repositionDelta[i] = -positionToSnapDiff[i];
					} else {
						slider.repositionDelta[i] = this.sliderSnap[i] - positionToSnapDiff[i];
					} 
				}
			} 
		}

		if (slider instanceof Ext.ux.ThumbSlider) {
			slider.setPosition([initialPosition[0] + slider.repositionDelta[0] - (0.5 * this.sliderSize[0]),
								initialPosition[1] + slider.repositionDelta[1] - (0.5 * this.sliderSize[1])]);
		}
		if (slider instanceof Ext.ux.RangeSlider) {

			slider.setPosition([initialPosition[0] + slider.repositionDelta[0],
								initialPosition[1] + slider.repositionDelta[1]]);
		}
	},
	
	initSlider: function(slider) {		
		slider.init(this);
		this.initSliderPosition(slider);
	} 

});  


Ext.ux.Slider = function(config) {

	Ext.apply(this, config);
	
	this.addEvents( {
		"dragstart" : true,
		"dragend" : true,
		"drag" : true,
		"mouseover":true, 
		"mouseout":true
	});	
}

Ext.extend(Ext.ux.Slider, Ext.BoxComponent, {
	value: 0,
	ddEl: null,
	name: null,
	cls: null,
	
	init: function() {
		//Do nothing
	},

	getTL: function() {
		switch(this.type) {
			case 'horizontal':
				return [this.el.getX()];
				break;
				
			case 'vertical':
				return [this.el.getY()];
				break;
				
			case 'area':
				return this.el.getXY();
				break;
		}
	},
	
	getBR: function() {
		switch(this.type) {
			case 'horizontal':
				return [this.el.getRight()];
				break;
				
			case 'vertical':
				return [this.el.getBottom()];
				break;
				
			case 'area':
				return [this.el.getRight(), this.el.getBottom()];
				break;
		}
		
	},
	
	setPosition: function(position) {
		var l = position.length;
		for (i=0; i<l; i++) {
			position[i] = parseInt(position[i]);
		}

		switch(this.type) {
			case 'horizontal':
				this.el.setX(position[0]);
				break;
				
			case 'vertical':
				this.el.setY(position[0]);
				break;
				
			case 'area':
				this.el.setX(position[0]);
				this.el.setY(position[1]);
				break;
		}		
	},
	
	setConstraint: function(low, high, snap) {
		var l = low.length;
		for (i=0; i<l; i++) {
			low[i] = parseInt(low[i] = low[i] < 0 ? 0 : low[i]);
			high[i] = parseInt(high[i] = high[i] < 0 ? 0 : high[i]);				
		}


		switch(this.type) {
			case 'horizontal':
				this.ddEl.setXConstraint(low[0], high[0], snap[0]);
				this.ddEl.setYConstraint(0, 0);
				break;
				
			case 'vertical':
				this.ddEl.clearConstraints();
				this.ddEl.setXConstraint(0, 0);
				this.ddEl.setYConstraint(low[0], high[0], snap[0]);
				break;
				
			case 'area':
				this.ddEl.setXConstraint(low[0], high[0], snap[0]);
				this.ddEl.setYConstraint(low[1], high[1], snap[1]);
				break;
		}		
		this.ddEl.resetConstraints(true);
	}
	

});

Ext.ux.ThumbSlider = function(config) { 
	Ext.ux.ThumbSlider.superclass.constructor.call(this, config);	
};


Ext.ux.RangeSlider = function(config) {
	Ext.ux.RangeSlider.superclass.constructor.call(this, config);	
};

Ext.extend(Ext.ux.ThumbSlider, Ext.ux.Slider, {
	//init must be passed an instance of a SliderZon e
	init: function(parentSlideZone) {
		this.type = parentSlideZone.type;

		this.pointer = this.type == 'horizontal' ? 'w-resize' : this.type == 'vertical' ? 'n-resize' : 'move';
		
		this.el = Ext.DomHelper.append(parentSlideZone.el,  { 
						tag: 'div', 
						id: Ext.id(),
						style: 'position:absolute;'+
								'overflow: hidden;'
								}, true);
		this.el.addClass('x-thumb-slider-' + this.type);
		this.el.addClass(parentSlideZone.cls);

		this.ddEl = new Ext.dd.DD(this.el); 

		var sliderInstance = this;
		var slideZoneInstance = parentSlideZone;

		this.el.on('mouseover', function() {
			sliderInstance.fireEvent('mouseover', sliderInstance);
			sliderInstance.el.setStyle('cursor', sliderInstance.pointer); 
		}); 
		this.el.on('mouseout', function() { 
			sliderInstance.fireEvent('mouseout', sliderInstance);
			sliderInstance.el.setStyle('cursor', 'default'); 
		}); 
		this.ddEl.onMouseDown = function(x, y) { 
			sliderInstance.fireEvent('dragstart', sliderInstance);
		}; 
		this.ddEl.onMouseUp = function(x, y) { 
			slideZoneInstance.updateConstraints();
			slideZoneInstance.updateValues();
			sliderInstance.fireEvent('dragend', sliderInstance)
		}; 
		this.ddEl.onDrag = function(e) { 
			slideZoneInstance.updateValues();
			sliderInstance.fireEvent('drag', sliderInstance);
		}; 

		Ext.ux.ThumbSlider.superclass.init.call(parentSlideZone);
	}
});

Ext.extend(Ext.ux.RangeSlider, Ext.ux.Slider, {
	init: function(parentSlideZone) {
		this.type = parentSlideZone.type;
		
		var el = Ext.DomHelper.append(parentSlideZone.el,  { 
						tag: 'div', 
						id: Ext.id(),
						style: 'position:absolute;'+
								'overflow: hidden;'
								}, true);

		//this.el.addClass(parentSlideZone.cls);
		switch(this.type) {
			case 'horizontal':
				var w = Math.abs(this.value[0] - this.value[1]) / (parentSlideZone.maxValue - parentSlideZone.minValue) * parentSlideZone.size;
				var h = parentSlideZone.sliderHeight;
				var handles = 'e,w';
				this.pointer = 'w-resize';
				break;
				
			case 'vertical':
				var w = parentSlideZone.sliderWidth;
				var h = Math.abs(this.value[0] - this.value[1]) / (parentSlideZone.maxValue - parentSlideZone.minValue) * parentSlideZone.size;
				var handles = 'n,s';
				this.pointer = 'n-resize';
				break;
				
			case 'area':
				var w = Math.abs(this.value[0][0] - this.value[0][1]) / (parentSlideZone.maxValue[0] - parentSlideZone.minValue[0]) * parentSlideZone.size[0];
				var h = Math.abs(this.value[1][0] - this.value[1][1]) / (parentSlideZone.maxValue[1] - parentSlideZone.minValue[1]) * parentSlideZone.size[1];
				var handles = 'all';
				this.pointer = 'move';
				break;
		}

		this.resizable = new Ext.Resizable(el, {
			wrap:false,
			pinned:true, 
			width: w,
			height: h,
			minWidth: 20,
			widthIncrement: parentSlideZone.sliderSnap[0],
			heightIncrement: parentSlideZone.sliderSnap[1],
			minHeight: 20,
			dynamic: true,
			handles: handles,
			draggable: true,
			transparent: false,
			constrainTo: parentSlideZone.el,
			leftTravel: null,
			rightTravel: null
		});
		var sliderInstance = this;
		var slideZoneInstance = parentSlideZone;
		
		this.el = this.resizable.el;
		this.el.addClass('x-range-slider-' + this.type);
		this.el.addClass(this.cls);		
		this.ddEl = this.resizable.dd;
		

		this.resizable.on('beforeresize', function() {
			sliderInstance.fireEvent('dragstart', sliderInstance);	
		})
		
		/* Parts of this.resizable.onMouseMove handler taken from:
		 * http://extjs.com/forum/showthread.php?p=23122&highlight=resizable+constrainto#post23122
		 */
		this.resizable.onMouseMove = function( e ) {
				var box = this.constrainTo.getRegion(), tgt = e.getXY();
				//redefine the constraining box if slider crossing resrictions
				if(!parentSlideZone.allowSliderCrossing) {
					if( parentSlideZone.type == 'vertical') {
							box = {left:   box.left,  right:  box.right,
								   top:    this.startBox.y - this.leftTravel[0],
								   bottom: this.startBox.y + this.startBox.height + this.rightTravel[0] }
					}
					if( parentSlideZone.type == 'horizontal') {
							box = {left:   this.startBox.x - this.leftTravel[0],
								   right:  this.startBox.x + this.startBox.width + this.rightTravel[0],
								   top:    box.top, bottom: box.bottom }
					}
				}

				e.xy = [
					tgt[0] - box.left < 0 ? box.left - this.startBox.x + this.startPoint[0] : tgt[0] - box.right > 0 ? box.right - this.startBox.right + this.startPoint[0] : tgt[0],
					tgt[1] - box.top < 0 ? box.top - this.startBox.y + this.startPoint[1] : tgt[1] - box.bottom > 0 ? box.bottom - this.startBox.bottom + this.startPoint[1] : tgt[1]
				];

				Ext.Resizable.prototype.onMouseMove.call(this, e);
				slideZoneInstance.updateValues();
				sliderInstance.fireEvent('drag', sliderInstance);
			};
			
		this.resizable.on('resize', function(width, height) {
			slideZoneInstance.updateConstraints();
			slideZoneInstance.updateValues();
			sliderInstance.fireEvent('dragend', sliderInstance);
		})
		
		this.el.on('mouseover', function() {
			sliderInstance.fireEvent('mouseover', sliderInstance);
			sliderInstance.el.setStyle('cursor', sliderInstance.pointer); 
		}); 
		this.el.on('mouseout', function() { 
			sliderInstance.fireEvent('mouseout', sliderInstance);
			sliderInstance.el.setStyle('cursor', 'default'); 
		}); 
		this.ddEl.onMouseDown = function(x, y) { 
			sliderInstance.fireEvent('dragstart', sliderInstance);
		}; 
		this.ddEl.onMouseUp = function(x, y) { 
			slideZoneInstance.updateConstraints();
			slideZoneInstance.updateValues();
			sliderInstance.fireEvent('dragend', sliderInstance)
		}; 
		this.ddEl.onDrag = function(e) { 
			slideZoneInstance.updateValues();
			sliderInstance.fireEvent('drag', sliderInstance);
		}; 

		Ext.ux.ThumbSlider.superclass.init.call(parentSlideZone);

	}
});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/Ext.ux.SlideZone.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/Ext.ux.SlideZone.js');
/**
* Ext.ux.form.DateTime Extension Class for Ext 2.x Library
*
* @author    Ing. Jozef Sakalos
* @copyright (c) 2008, Ing. Jozef Sakalos
* @version $Id: Ext.ux.form.DateTime.js 311 2008-08-16 21:23:05Z jozo $
*
* @license Ext.ux.form.DateTime is licensed under the terms of
* the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
* that the code/component(s) do NOT become part of another Open Source or Commercially
* licensed development library or toolkit without explicit permission.
* 
* License details: http://www.gnu.org/licenses/lgpl.html
*/

/*global Ext */

Ext.ns('Ext.ux.form');

/**
* @class Ext.ux.form.DateTime
* @extends Ext.form.Field
*/
Ext.ux.form.DateTime = Ext.extend(Ext.form.Field, {
    /**
    * @cfg {String/Object} defaultAutoCreate DomHelper element spec
    * Let superclass to create hidden field instead of textbox. Hidden will be submittend to server
    */
    defaultAutoCreate: { tag: 'input', type: 'hidden' }
    /**
    * @cfg {Number} timeWidth Width of time field in pixels (defaults to 100)
    */
    , timeWidth: 100
    /**
    * @cfg {String} dtSeparator Date - Time separator. Used to split date and time (defaults to ' ' (space))
    */
    , dtSeparator: ' '
    /**
    * @cfg {String} hiddenFormat Format of datetime used to store value in hidden field
    * and submitted to server (defaults to 'Y-m-d H:i:s' that is mysql format)
    */
    , hiddenFormat: 'Y-m-d H:i:s'
    /**
    * @cfg {Boolean} otherToNow Set other field to now() if not explicly filled in (defaults to true)
    */
    , otherToNow: true
    /**
    * @cfg {Boolean} emptyToNow Set field value to now on attempt to set empty value.
    * If it is true then setValue() sets value of field to current date and time (defaults to false)
    */
    /**
    * @cfg {String} timePosition Where the time field should be rendered. 'right' is suitable for forms
    * and 'below' is suitable if the field is used as the grid editor (defaults to 'right')
    */
    , timePosition: 'right' // valid values:'below', 'right'
    /**
    * @cfg {String} dateFormat Format of DateField. Can be localized. (defaults to 'm/y/d')
    */
    , dateFormat: 'm/d/y'
    /**
    * @cfg {String} timeFormat Format of TimeField. Can be localized. (defaults to 'g:i A')
    */
    , timeFormat: 'g:i A'
    /**
    * @cfg {Object} dateConfig Config for DateField constructor.
    */
    /**
    * @cfg {Object} timeConfig Config for TimeField constructor.
    */

    // {{{
    /**
    * private
    * creates DateField and TimeField and installs the necessary event handlers
    */
    , initComponent: function() {
        // call parent initComponent
        Ext.ux.form.DateTime.superclass.initComponent.call(this);

        // create DateField
        var dateConfig = Ext.apply({}, {
            id: this.id + '-date'
            , format: this.dateFormat || Ext.form.DateField.prototype.format
            , width: this.timeWidth
            , selectOnFocus: this.selectOnFocus
            , listeners: {
                blur: { scope: this, fn: this.onBlur }
                 , focus: { scope: this, fn: this.onFocus }
            }
        }, this.dateConfig);
        this.df = new Ext.form.DateField(dateConfig);
        this.df.ownerCt = this;
        delete (this.dateFormat);


        // create TimeField
        var timeConfig = Ext.apply({}, {
            id: this.id + '-time'
            , format: this.timeFormat || Ext.form.TimeField.prototype.format
            , width: this.timeWidth
            , selectOnFocus: this.selectOnFocus
            , listeners: {
                blur: { scope: this, fn: this.onBlur }
                 , focus: { scope: this, fn: this.onFocus }
            }
        }, this.timeConfig);
        this.tf = new Ext.form.TimeField(timeConfig);
        this.tf.ownerCt = this;
        delete (this.timeFormat);

        // relay events
        this.relayEvents(this.df, ['focus', 'specialkey', 'invalid', 'valid']);
        this.relayEvents(this.tf, ['focus', 'specialkey', 'invalid', 'valid']);

    } // eo function initComponent
    // }}}
    // {{{
    /**
    * private
    * Renders underlying DateField and TimeField and provides a workaround for side error icon bug
    */
    , onRender: function(ct, position) {
        // don't run more than once
        if (this.isRendered) {
            return;
        }

        // render underlying hidden field
        Ext.ux.form.DateTime.superclass.onRender.call(this, ct, position);

        // render DateField and TimeField
        // create bounding table
        var t;
        if ('below' === this.timePosition || 'bellow' === this.timePosition) {
            t = Ext.DomHelper.append(ct, { tag: 'table', style: 'border-collapse:collapse', children: [
                 { tag: 'tr', children: [{ tag: 'td', style: 'padding-bottom:1px', cls: 'ux-datetime-date'}] }
                , { tag: 'tr', children: [{ tag: 'td', cls: 'ux-datetime-time'}] }
            ]
            }, true);
        }
        else {
            t = Ext.DomHelper.append(ct, { tag: 'table', style: 'border-collapse:collapse', children: [
                { tag: 'tr', children: [
                    { tag: 'td', style: 'padding-right:4px', cls: 'ux-datetime-date' }, { tag: 'td', cls: 'ux-datetime-time' }
                ]
                }
            ]
            }, true);
        }

        this.tableEl = t;
        //        this.wrap = t.wrap({cls:'x-form-field-wrap'});
        this.wrap = t.wrap();
        this.wrap.on("mousedown", this.onMouseDown, this, { delay: 10 });

        // render DateField & TimeField
        this.df.render(t.child('td.ux-datetime-date'));
        this.tf.render(t.child('td.ux-datetime-time'));

        // workaround for IE trigger misalignment bug
        if (Ext.isIE && Ext.isStrict) {
            t.select('input').applyStyles({ top: 0 });
        }

        this.on('specialkey', this.onSpecialKey, this);
        this.df.el.swallowEvent(['keydown', 'keypress']);
        this.tf.el.swallowEvent(['keydown', 'keypress']);

        // create icon for side invalid errorIcon
        if ('side' === this.msgTarget) {
            var elp = this.el.findParent('.x-form-element', 10, true);
            this.errorIcon = elp.createChild({ cls: 'x-form-invalid-icon' });

            this.df.errorIcon = this.errorIcon;
            this.tf.errorIcon = this.errorIcon;
        }

        // setup name for submit
        this.el.dom.name = this.hiddenName || this.name || this.id;

        // prevent helper fields from being submitted
        this.df.el.dom.removeAttribute("name");
        this.tf.el.dom.removeAttribute("name");

        // we're rendered flag
        this.isRendered = true;

        // update hidden field
        this.updateHidden();

    } // eo function onRender
    // }}}
    // {{{
    /**
    * private
    */
    , adjustSize: Ext.BoxComponent.prototype.adjustSize
    // }}}
    // {{{
    /**
    * private
    */
    , alignErrorIcon: function() {
        this.errorIcon.alignTo(this.tableEl, 'tl-tr', [2, 0]);
    }
    // }}}
    // {{{
    /**
    * private initializes internal dateValue
    */
    , initDateValue: function() {
        this.dateValue = this.otherToNow ? new Date() : new Date(1970, 0, 1, 0, 0, 0);
    }
    // }}}
    // {{{
    /**
    * Calls clearInvalid on the DateField and TimeField
    */
    , clearInvalid: function() {
        this.df.clearInvalid();
        this.tf.clearInvalid();
    } // eo function clearInvalid
    // }}}

    /**
    * @private
    * called from Component::destroy. 
    * Destroys all elements and removes all listeners we've created.
    */
    , beforeDestroy: function() {
        if (this.isRendered) {
            //            this.removeAllListeners();
            this.wrap.removeAllListeners();
            this.wrap.remove();
            this.tableEl.remove();
            this.df.destroy();
            this.tf.destroy();
        }
    } // eo function beforeDestroy

    // {{{
    /**
    * Disable this component.
    * @return {Ext.Component} this
    */
    , disable: function() {
        if (this.isRendered) {
            this.df.disabled = this.disabled;
            this.df.onDisable();
            this.tf.onDisable();
        }
        this.disabled = true;
        this.df.disabled = true;
        this.tf.disabled = true;
        this.fireEvent("disable", this);
        return this;
    } // eo function disable
    // }}}
    // {{{
    /**
    * Enable this component.
    * @return {Ext.Component} this
    */
    , enable: function() {
        if (this.rendered) {
            this.df.onEnable();
            this.tf.onEnable();
        }
        this.disabled = false;
        this.df.disabled = false;
        this.tf.disabled = false;
        this.fireEvent("enable", this);
        return this;
    } // eo function enable
    // }}}
    // {{{
    /**
    * private Focus date filed
    */
    , focus: function() {
        this.df.focus();
    } // eo function focus
    // }}}
    // {{{
    /**
    * private
    */
    , getPositionEl: function() {
        return this.wrap;
    }
    // }}}
    // {{{
    /**
    * private
    */
    , getResizeEl: function() {
        return this.wrap;
    }
    // }}}
    // {{{
    /**
    * @return {Date/String} Returns value of this field
    */
    , getValue: function() {
        // create new instance of date
        return this.dateValue ? new Date(this.dateValue) : '';
    } // eo function getValue
    // }}}
    // {{{
    /**
    * @return {Boolean} true = valid, false = invalid
    * private Calls isValid methods of underlying DateField and TimeField and returns the result
    */
    , isValid: function() {
        return this.df.isValid() && this.tf.isValid();
    } // eo function isValid
    // }}}
    // {{{
    /**
    * Returns true if this component is visible
    * @return {boolean} 
    */
    , isVisible: function() {
        return this.df.rendered && this.df.getActionEl().isVisible();
    } // eo function isVisible
    // }}}
    // {{{
    /** 
    * private Handles blur event
    */
    , onBlur: function(f) {
        // called by both DateField and TimeField blur events

        // revert focus to previous field if clicked in between
        if (this.wrapClick) {
            f.focus();
            this.wrapClick = false;
        }

        // update underlying value
        if (f === this.df) {
            this.updateDate();
        }
        else {
            this.updateTime();
        }
        this.updateHidden();

        // fire events later
        (function() {
            if (!this.df.hasFocus && !this.tf.hasFocus) {
                var v = this.getValue();
                if (String(v) !== String(this.startValue)) {
                    this.fireEvent("change", this, v, this.startValue);
                }
                this.hasFocus = false;
                this.fireEvent('blur', this);
            }
        }).defer(100, this);

    } // eo function onBlur
    // }}}
    // {{{
    /**
    * private Handles focus event
    */
    , onFocus: function() {
        if (!this.hasFocus) {
            this.hasFocus = true;
            this.startValue = this.getValue();
            this.fireEvent("focus", this);
        }
    }
    // }}}
    // {{{
    /**
    * private Just to prevent blur event when clicked in the middle of fields
    */
    , onMouseDown: function(e) {
        if (!this.disabled) {
            this.wrapClick = 'td' === e.target.nodeName.toLowerCase();
        }
    }
    // }}}
    // {{{
    /**
    * private
    * Handles Tab and Shift-Tab events
    */
    , onSpecialKey: function(t, e) {
        var key = e.getKey();
        if (key === e.TAB) {
            if (t === this.df && !e.shiftKey) {
                e.stopEvent();
                this.tf.focus();
            }
            if (t === this.tf && e.shiftKey) {
                e.stopEvent();
                this.df.focus();
            }
        }
        // otherwise it misbehaves in editor grid
        if (key === e.ENTER) {
            this.updateValue();
        }

    } // eo function onSpecialKey
    // }}}
    // {{{
    /**
    * private Sets the value of DateField
    */
    , setDate: function(date) {
        this.df.setValue(date);
    } // eo function setDate
    // }}}
    // {{{
    /** 
    * private Sets the value of TimeField
    */
    , setTime: function(date) {
        this.tf.setValue(date);
    } // eo function setTime
    // }}}
    // {{{
    /**
    * private
    * Sets correct sizes of underlying DateField and TimeField
    * With workarounds for IE bugs
    */
    , setSize: function(w, h) {
        if (!w) {
            return;
        }
        if ('below' === this.timePosition) {
            this.df.setSize(w, h);
            this.tf.setSize(w, h);
            if (Ext.isIE) {
                this.df.el.up('td').setWidth(w);
                this.tf.el.up('td').setWidth(w);
            }
        }
        else {
            this.df.setSize(w - this.timeWidth - 4, h);
            this.tf.setSize(this.timeWidth, h);

            if (Ext.isIE) {
                this.df.el.up('td').setWidth(w - this.timeWidth - 4);
                this.tf.el.up('td').setWidth(this.timeWidth);
            }
        }
    } // eo function setSize
    // }}}
    // {{{
    /**
    * @param {Mixed} val Value to set
    * Sets the value of this field
    */
    , setValue: function(val) {
        if (!val && true === this.emptyToNow) {
            this.setValue(new Date());
            return;
        }
        else if (!val) {
            this.setDate('');
            this.setTime('');
            this.updateValue();
            return;
        }
        if ('number' === typeof val) {
            val = new Date(val);
        }
        val = val ? val : new Date(1970, 0, 1, 0, 0, 0);
        var da, time;
        if (val instanceof Date) {
            this.setDate(val);
            this.setTime(val);
            this.dateValue = new Date(val);
        }
        else {
            da = val.split(this.dtSeparator);
            this.setDate(da[0]);
            if (da[1]) {
                if (da[2]) {
                    // add am/pm part back to time
                    da[1] += da[2];
                }
                this.setTime(da[1]);
            }
        }
        this.updateValue();
    } // eo function setValue
    // }}}
    // {{{
    /**
    * Hide or show this component by boolean
    * @return {Ext.Component} this
    */
    , setVisible: function(visible) {
        if (visible) {
            this.df.show();
            this.tf.show();
        } else {
            this.df.hide();
            this.tf.hide();
        }
        return this;
    } // eo function setVisible
    // }}}
    //{{{
    , show: function() {
        return this.setVisible(true);
    } // eo function show
    //}}}
    //{{{
    , hide: function() {
        return this.setVisible(false);
    } // eo function hide
    //}}}
    // {{{
    /**
    * private Updates the date part
    */
    , updateDate: function() {

        var d = this.df.getValue();
        if (d) {
            if (!(this.dateValue instanceof Date)) {
                this.initDateValue();
                if (!this.tf.getValue()) {
                    this.setTime(this.dateValue);
                }
            }
            this.dateValue.setMonth(0); // because of leap years
            this.dateValue.setFullYear(d.getFullYear());
            this.dateValue.setMonth(d.getMonth());
            this.dateValue.setDate(d.getDate());
        }
        else {
            this.dateValue = '';
            this.setTime('');
        }
    } // eo function updateDate
    // }}}
    // {{{
    /**
    * private
    * Updates the time part
    */
    , updateTime: function() {
        var t = this.tf.getValue();
        if (t && !(t instanceof Date)) {
            t = Date.parseDate(t, this.tf.format);
        }
        if (t && !this.df.getValue()) {
            this.initDateValue();
            this.setDate(this.dateValue);
        }
        if (this.dateValue instanceof Date) {
            if (t) {
                this.dateValue.setHours(t.getHours());
                this.dateValue.setMinutes(t.getMinutes());
                this.dateValue.setSeconds(t.getSeconds());
            }
            else {
                this.dateValue.setHours(0);
                this.dateValue.setMinutes(0);
                this.dateValue.setSeconds(0);
            }
        }
    } // eo function updateTime
    // }}}
    // {{{
    /**
    * private Updates the underlying hidden field value
    */
    , updateHidden: function() {
        if (this.isRendered) {
            var value = this.dateValue instanceof Date ? this.dateValue.format(this.hiddenFormat) : '';
            this.el.dom.value = value;
        }
    }
    // }}}
    // {{{
    /**
    * private Updates all of Date, Time and Hidden
    */
    , updateValue: function() {

        this.updateDate();
        this.updateTime();
        this.updateHidden();

        return;
    } // eo function updateValue
    // }}}
    // {{{
    /**
    * @return {Boolean} true = valid, false = invalid
    * callse validate methods of DateField and TimeField
    */
    , validate: function() {
        return this.df.validate() && this.tf.validate();
    } // eo function validate
    // }}}
    // {{{
    /**
    * Returns renderer suitable to render this field
    * @param {Object} Column model config
    */
    , renderer: function(field) {
        var format = field.editor.dateFormat || Ext.ux.form.DateTime.prototype.dateFormat;
        format += ' ' + (field.editor.timeFormat || Ext.ux.form.DateTime.prototype.timeFormat);
        var renderer = function(val) {
            var retval = Ext.util.Format.date(val, format);
            return retval;
        };
        return renderer;
    } // eo function renderer
    // }}}

}); // eo extend

// register xtype
Ext.reg('xdatetime', Ext.ux.form.DateTime);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/saki-datetime-field-1-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/saki-datetime-field-1-0.js');
/* Copyright (c) 2007 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.2
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;$.livequery.run(q.id);return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)this.elements.unbind(this.type,this.fn);else if(this.fn2)this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)$.event.remove(el,query.type,query.fn);});}else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);}else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)r.context=a.context,r.selector=a.selector;if(typeof a=='string')r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/plugins/jquery.livequery.min.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/plugins/jquery.livequery.min.js');
jQuery.fn.extend({
	everyTime: function(interval, label, fn, times, belay) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times, belay);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		guid: 1,
		global: {},
		regex: /^([0-9]+)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseInt(result[1], 10);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times, belay) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
				return;

			if (times && times.constructor != Number) {
				belay = !!times;
				times = 0;
			}
			
			times = times || 0;
			belay = belay || false;
			
			if (!element.$timers) 
				element.$timers = {};
			
			if (!element.$timers[label])
				element.$timers[label] = {};
			
			fn.$timerID = fn.$timerID || this.guid++;
			
			var handler = function() {
				if (belay && this.inProgress) 
					return;
				this.inProgress = true;
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
				this.inProgress = false;
			};
			
			handler.$timerID = fn.$timerID;
			
			if (!element.$timers[label][fn.$timerID]) 
				element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
			
			if ( !this.global[label] )
				this.global[label] = [];
			this.global[label].push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = element.$timers, ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.$timerID ) {
							window.clearInterval(timers[label][fn.$timerID]);
							delete timers[label][fn.$timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					element.$timers = null;
			}
		}
	}
});

if (jQuery.browser.msie)
	jQuery(window).one("unload", function() {
		var global = jQuery.timer.global;
		for ( var label in global ) {
			var els = global[label], i = els.length;
			while ( --i )
				jQuery.timer.remove(els[i], label);
		}
	});



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/plugins/jquery.timers.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/plugins/jquery.timers.js');
(function($) {
  
  var addMethods = function(source) {
    var ancestor   = this.superclass && this.superclass.prototype;
    var properties = $.keys(source);

    if (!$.keys({ toString: true }).length) properties.push("toString", "valueOf");

    for (var i = 0, length = properties.length; i < length; i++) {
      var property = properties[i], value = source[property];
      if (ancestor && $.isFunction(value) && $.argumentNames(value)[0] == "$super") {
        
        var method = value, value = $.extend($.wrap((function(m) {
          return function() { return ancestor[m].apply(this, arguments) };
        })(property), method), {
          valueOf:  function() { return method },
          toString: function() { return method.toString() }
        });
      }
      this.prototype[property] = value;
    }

    return this;
  }
  
  $.extend({
    keys: function(obj) {
      var keys = [];
      for (var key in obj) keys.push(key);
      return keys;
    },

    argumentNames: function(func) {
      var names = func.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(/, ?/);
      return names.length == 1 && !names[0] ? [] : names;
    },

    bind: function(func, scope) {
      return function() {
        return func.apply(scope, $.makeArray(arguments));
      }
    },

    wrap: function(func, wrapper) {
      var __method = func;
      return function() {
        return wrapper.apply(this, [$.bind(__method, this)].concat($.makeArray(arguments)));
      }
    },
    
    klass: function() {
      var parent = null, properties = $.makeArray(arguments);
      if ($.isFunction(properties[0])) parent = properties.shift();

      var klass = function() { 
        this.initialize.apply(this, arguments);
      };

      klass.superclass = parent;
      klass.subclasses = [];
      klass.addMethods = addMethods;

      if (parent) {
        var subclass = function() { };
        subclass.prototype = parent.prototype;
        klass.prototype = new subclass;
        parent.subclasses.push(klass);
      }

      for (var i = 0; i < properties.length; i++)
        klass.addMethods(properties[i]);

      if (!klass.prototype.initialize)
        klass.prototype.initialize = function() {};

      klass.prototype.constructor = klass;

      return klass;
    },
    delegate: function(rules) {
      return function(e) {
        var target = $(e.target);
        for (var selector in rules) {
          if (target.is(selector) || ((target = target.parents(selector)) && target.length > 0)) 
            return rules[selector].apply(this, [target].concat($.makeArray(arguments)));
        }
      }
    }
  });
  
  var bindEvents = function(instance) {
    for (var member in instance) {
      if (member.match(/^on(.+)/) && typeof instance[member] == 'function') {
        instance.element.bind(RegExp.$1, $.bind(instance[member], instance));
      }
    }
  }
  
  var behaviorWrapper = function(behavior) {
    return $.klass(behavior, {
      initialize: function($super, element, args) {
        this.element = $(element);
        if ($super) $super.apply(this, args);
      }
    });
  }
  
  var attachBehavior = function(el, behavior, args) {
      var wrapper = behaviorWrapper(behavior);
      instance = new wrapper(el, args);

      bindEvents(instance);

      if (!behavior.instances) behavior.instances = [];

      behavior.instances.push(instance);
      
      return instance;
  };
  
  
  $.fn.extend({
    attach: function() {
      var args = $.makeArray(arguments), behavior = args.shift();
      
      if ($.livequery && this.selector) {
        return this.livequery(function() {
          attachBehavior(this, behavior, args);
        });
      } else {
        return this.each(function() {
          attachBehavior(this, behavior, args);
        });
      }
    },
    attachAndReturn: function() {
      var args = $.makeArray(arguments), behavior = args.shift();
      
      return $.map(this, function(el) {
        return attachBehavior(el, behavior, args);
      });
    },
    delegate: function(type, rules) {
      return this.bind(type, $.delegate(rules));
    },
    attached: function(behavior) {
      var instances = [];
      
      if (!behavior.instances) return instances;
      
      this.each(function(i, element) {
        $.each(behavior.instances, function(i, instance) {
          if (instance.element.get(0) == element) instances.push(instance);
        });
      });
      
      return instances;
    },
    firstAttached: function(behavior) {
      return this.attached(behavior)[0];
    }
  });
  
  Remote = $.klass({
    initialize: function(options) {
      if (this.element.attr('nodeName') == 'FORM') this.element.attach(Remote.Form, options);
      else this.element.attach(Remote.Link, options);
    }
  });
  
  Remote.Base = $.klass({
    initialize : function(options) {
      this.options = $.extend({
        
      }, options || {});
    },
    _makeRequest : function(options) {
      $.ajax(options);
      return false;
    }
  });
  
  Remote.Link = $.klass(Remote.Base, {
    onclick: function() {
      var options = $.extend({ url: this.element.attr('href'), type: 'GET' }, this.options);
      return this._makeRequest(options);
    }
  });
  
  Remote.Form = $.klass(Remote.Base, {
    onclick: function(e) {
      var target = e.target;
      
      if ($.inArray(target.nodeName.toLowerCase(), ['input', 'button']) >= 0 && target.type.match(/submit|image/))
        this._submitButton = target;
    },
    onsubmit: function() {
      var data = this.element.serializeArray();
      
      if (this._submitButton) data.push({ name: this._submitButton.name, value: this._submitButton.value });
      
      var options = $.extend({
        url : this.element.attr('action'),
        type : this.element.attr('method') || 'GET',
        data : data
      }, this.options);
      
      this._makeRequest(options);
      
      return false;
    }
  });
  
  $.ajaxSetup({ 
    beforeSend: function(xhr) {
      xhr.setRequestHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
    } 
  });
  
})(jQuery);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/plugins/lowpro.jquery.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/plugins/lowpro.jquery.js');
/*
 * jQuery UI 1.6rc2

 *
 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
;(function($) {

/** jQuery core modifications and additions **/

var _remove = $.fn.remove;
$.fn.remove = function() {
	$("*", this).add(this).triggerHandler("remove");
	return _remove.apply(this, arguments );
};

function isVisible(element) {
	function checkStyles(element) {
		var style = element.style;
		return (style.display != 'none' && style.visibility != 'hidden');
	}
	
	var visible = checkStyles(element);
	
	(visible && $.each($.dir(element, 'parentNode'), function() {
		return (visible = checkStyles(this));
	}));
	
	return visible;
}

$.extend($.expr[':'], {
	data: function(a, i, m) {
		return $.data(a, m[3]);
	},
	
	// TODO: add support for object, area
	tabbable: function(a, i, m) {
		var nodeName = a.nodeName.toLowerCase();
		
		return (
			// in tab order
			a.tabIndex >= 0 &&
			
			( // filter node types that participate in the tab order
				
				// anchor tag
				('a' == nodeName && a.href) ||
				
				// enabled form element
				(/input|select|textarea|button/.test(nodeName) &&
					'hidden' != a.type && !a.disabled)
			) &&
			
			// visible on page
			isVisible(a)
		);
	}
});

$.keyCode = {
	BACKSPACE: 8,
	CAPS_LOCK: 20,
	COMMA: 188,
	CONTROL: 17,
	DELETE: 46,
	DOWN: 40,
	END: 35,
	ENTER: 13,
	ESCAPE: 27,
	HOME: 36,
	INSERT: 45,
	LEFT: 37,
	NUMPAD_ADD: 107,
	NUMPAD_DECIMAL: 110,
	NUMPAD_DIVIDE: 111,
	NUMPAD_ENTER: 108,
	NUMPAD_MULTIPLY: 106,
	NUMPAD_SUBTRACT: 109,
	PAGE_DOWN: 34,
	PAGE_UP: 33,
	PERIOD: 190,
	RIGHT: 39,
	SHIFT: 16,
	SPACE: 32,
	TAB: 9,
	UP: 38
};

// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
// created by Scott González and Jörn Zaefferer
function getter(namespace, plugin, method, args) {
	function getMethods(type) {
		var methods = $[namespace][plugin][type] || [];
		return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
	}
	
	var methods = getMethods('getter');
	if (args.length == 1 && typeof args[0] == 'string') {
		methods = methods.concat(getMethods('getterSetter'));
	}
	return ($.inArray(method, methods) != -1);
}

$.widget = function(name, prototype) {
	var namespace = name.split(".")[0];
	name = name.split(".")[1];
	
	// create plugin method
	$.fn[name] = function(options) {
		var isMethodCall = (typeof options == 'string'),
			args = Array.prototype.slice.call(arguments, 1);
		
		// prevent calls to internal methods
		if (isMethodCall && options.substring(0, 1) == '_') {
			return this;
		}
		
		// handle getter methods
		if (isMethodCall && getter(namespace, name, options, args)) {
			var instance = $.data(this[0], name);
			return (instance ? instance[options].apply(instance, args)
				: undefined);
		}
		
		// handle initialization and non-getter methods
		return this.each(function() {
			var instance = $.data(this, name);
			
			// constructor
			(!instance && !isMethodCall &&
				$.data(this, name, new $[namespace][name](this, options)));
			
			// method call
			(instance && isMethodCall && $.isFunction(instance[options]) &&
				instance[options].apply(instance, args));
		});
	};
	
	// create widget constructor
	$[namespace][name] = function(element, options) {
		var self = this;
		
		this.widgetName = name;
		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
		this.widgetBaseClass = namespace + '-' + name;
		
		this.options = $.extend({},
			$.widget.defaults,
			$[namespace][name].defaults,
			$.metadata && $.metadata.get(element)[name],
			options);
		
		this.element = $(element)
			.bind('setData.' + name, function(e, key, value) {
				return self._setData(key, value);
			})
			.bind('getData.' + name, function(e, key) {
				return self._getData(key);
			})
			.bind('remove', function() {
				return self.destroy();
			});
		
		this._init();
	};
	
	// add widget prototype
	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
	
	// TODO: merge getter and getterSetter properties from widget prototype
	// and plugin prototype
	$[namespace][name].getterSetter = 'option';
};

$.widget.prototype = {
	_init: function() {},
	destroy: function() {
		this.element.removeData(this.widgetName);
	},
	
	option: function(key, value) {
		var options = key,
			self = this;
		
		if (typeof key == "string") {
			if (value === undefined) {
				return this._getData(key);
			}
			options = {};
			options[key] = value;
		}
		
		$.each(options, function(key, value) {
			self._setData(key, value);
		});
	},
	_getData: function(key) {
		return this.options[key];
	},
	_setData: function(key, value) {
		this.options[key] = value;
		
		if (key == 'disabled') {
			this.element[value ? 'addClass' : 'removeClass'](
				this.widgetBaseClass + '-disabled');
		}
	},
	
	enable: function() {
		this._setData('disabled', false);
	},
	disable: function() {
		this._setData('disabled', true);
	},
	
	_trigger: function(type, e, data) {
		var eventName = (type == this.widgetEventPrefix
			? type : this.widgetEventPrefix + type);
		e = e  || $.event.fix({ type: eventName, target: this.element[0] });
		return this.element.triggerHandler(eventName, [e, data], this.options[type]);
	}
};

$.widget.defaults = {
	disabled: false
};


/** jQuery UI core **/

$.ui = {
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set) { return; }
			
			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}	
	},
	cssCache: {},
	css: function(name) {
		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
		
		//if (!$.browser.safari)
			//tmp.appendTo('body'); 
		
		//Opera and Safari set width and height to 0px instead of auto
		//Safari returns rgba(0,0,0,0) when bgcolor is not set
		$.ui.cssCache[name] = !!(
			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
		);
		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
		return $.ui.cssCache[name];
	},
	disableSelection: function(el) {
		return $(el)
			.attr('unselectable', 'on')
			.css('MozUserSelect', 'none')
			.bind('selectstart.ui', function() { return false; });
	},
	enableSelection: function(el) {
		return $(el)
			.attr('unselectable', 'off')
			.css('MozUserSelect', '')
			.unbind('selectstart.ui');
	},
	hasScroll: function(e, a) {
		
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(e).css('overflow') == 'hidden') { return false; }
		
		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;
		
		if (e[scroll] > 0) { return true; }
		
		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		e[scroll] = 1;
		has = (e[scroll] > 0);
		e[scroll] = 0;
		return has;
	}
};


/** Mouse Interaction Plugin **/

$.ui.mouse = {
	_mouseInit: function() {
		var self = this;
	
		this.element.bind('mousedown.'+this.widgetName, function(e) {
			return self._mouseDown(e);
		});
		
		// Prevent text selection in IE
		if ($.browser.msie) {
			this._mouseUnselectable = this.element.attr('unselectable');
			this.element.attr('unselectable', 'on');
		}
		
		this.started = false;
	},
	
	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);
		
		// Restore text selection in IE
		($.browser.msie
			&& this.element.attr('unselectable', this._mouseUnselectable));
	},
	
	_mouseDown: function(e) {
		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(e));
		
		this._mouseDownEvent = e;
		
		var self = this,
			btnIsLeft = (e.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
			return true;
		}
		
		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}
		
		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
			this._mouseStarted = (this._mouseStart(e) !== false);
			if (!this._mouseStarted) {
				e.preventDefault();
				return true;
			}
		}
		
		// these delegates are required to keep context
		this._mouseMoveDelegate = function(e) {
			return self._mouseMove(e);
		};
		this._mouseUpDelegate = function(e) {
			return self._mouseUp(e);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		return false;
	},
	
	_mouseMove: function(e) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !e.button) {
			return this._mouseUp(e);
		}
		
		if (this._mouseStarted) {
			this._mouseDrag(e);
			return false;
		}
		
		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, e) !== false);
			(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
		}
		
		return !this._mouseStarted;
	},
	
	_mouseUp: function(e) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._mouseStop(e);
		}
		
		return false;
	},
	
	_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(e) {
		return this.mouseDelayMet;
	},
	
	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(e) {},
	_mouseDrag: function(e) {},
	_mouseStop: function(e) {},
	_mouseCapture: function(e) { return true; }
};

$.ui.mouse.defaults = {
	cancel: null,
	distance: 1,
	delay: 0
};

})(jQuery);
/*
 * jQuery UI Autocomplete 1.6rc2

 *
 * Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * 
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	ui.core.js
 */
(function($) {

$.widget("ui.autocomplete", {
	
	_init: function() {

		$.extend(this.options, {
			delay: this.options.url ? $.Autocompleter.defaults.delay : 10,
			max: !this.options.scroll ? 10 : 150,
			highlight: this.options.highlight || function(value) { return value; }, // if highlight is set to false, replace it with a do-nothing function
			formatMatch: this.options.formatMatch || this.options.formatItem // if the formatMatch option is not specified, then use formatItem for backwards compatibility
		});
		
		new $.Autocompleter(this.element[0], this.options);
		
	},
	
	result: function(handler) {
		return this.element.bind("result", handler);
	},
	search: function(handler) {
		return this.element.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.element.trigger("flushCache");
	},
	setData: function(key, value){
		return this.element.trigger("setOptions", [{ key: value }]);
	},
	destroy: function() {
		return this.element.trigger("unautocomplete");
	}
	
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
	if(options.result) $input.bind('result.autocomplete', options.result);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				if( selectCurrent() ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && [result.data, result.value]);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent() {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [selected.data, selected.value]);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if ( !value ) {
			return [""];
		}
		var words = value.split( options.multipleSeparator );
		var result = [];
		$.each(words, function(i, value) {
			if ( $.trim(value) )
				result[i] = $.trim(value);
		});
		return result;
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.autocomplete("search", function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else
							$input.val( "" );
					}
				}
			);
		}
		if (wasVisible)
			// position cursor at end of input field
			$.Autocompleter.Selection(input, input.value.length, input.value.length);
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data
		if (data && data.length) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});
			
			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
				}
			});
		}

		else if (options.source && typeof options.source == 'function') {
			var resultData = options.source(term);
			var parsed = (options.parse) ? options.parse(resultData) : resultData;

			cache.add(term, parsed);
			success(term, parsed);
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ui-autocomplete-input",
	resultsClass: "ui-autocomplete-results",
	loadingClass: "ui-autocomplete-loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180
};

$.extend($.ui.autocomplete, {
	defaults: $.Autocompleter.defaults
});

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ui-autocomplete-over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(document.body);
	
		list = $("<ul/>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
			input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ui-autocomplete-even" : "ui-autocomplete-odd").appendTo(list)[0];
			$.data(li, "ui-autocomplete-data", data[i]);
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE)
			active = -1;
			$(input).triggerHandler("autocompletehide", [{}, { options: options }], options["hide"]);
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight,
				left: offset.left
			}).show();
			
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
            
            $(input).triggerHandler("autocompleteshow", [{}, { options: options }], options["show"]);
            
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ui-autocomplete-data");
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.Autocompleter.Selection = function(field, start, end) {
	if( field.createTextRange ){
		var selRange = field.createTextRange();
		selRange.collapse(true);
		selRange.moveStart("character", start);
		selRange.moveEnd("character", end);
		selRange.select();
	} else if( field.setSelectionRange ){
		field.setSelectionRange(start, end);
	} else {
		if( field.selectionStart ){
			field.selectionStart = start;
			field.selectionEnd = end;
		}
	}
	field.focus();
};

})(jQuery);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/plugins/jquery-ui-personalized-1.6rc2.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/plugins/jquery-ui-personalized-1.6rc2.js');
var $j = jQuery.noConflict();
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/jquery-local-name-1.0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/jquery-local-name-1.0.js');
jQuery.fn.outerHTML = function() {
    return $j('<div>').append(this.eq(0).clone()).html();
};


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/jquery/my-plugins-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/jquery/my-plugins-0-0.js');
function namespace(spec, context) {
    var validIdentifier = /^(?:[a-zA-Z_]\w*[.])*[a-zA-Z_]\w*$/,
        i, N;
    context = context || window;
    if (typeof spec === 'object') {
        if (typeof spec.length === 'number') {//assume an array-like object
            for (i = 0, N = spec.length; i < N; i++) {
                namespace(spec[i], context);
            }
        }
        else {//spec is a specification object e.g, {com: {trifork: ['model,view']}}
            for (i in spec) if (spec.hasOwnProperty(i)) {
                context[i] = context[i] || {};
                namespace(spec[i], context[i]); //recursively descend tree
            }
        }
    } else if (typeof spec === 'string') {
        (function handleStringCase() {
            var parts;
            if (!validIdentifier.test(spec)) {
                throw new Error('"' + spec + '" is not a valid name for a package.');
            }
            parts = spec.split('.');
            for (i = 0, N = parts.length; i < N; i++) {
                spec = parts[i];
                context[spec] = context[spec] || {};
                context = context[spec];
            }
        })();
    }
    else {
        throw new TypeError();
    }
}

function using() {
    var args = arguments;
    return { run: function(inner) { return inner.apply(args[0], args); } };
}


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/namespace-1-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/namespace-1-0.js');
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.2
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var A=YAHOO.lang,C=["toString","valueOf"],B={isArray:function(D){if(D){return A.isNumber(D.length)&&A.isFunction(D.splice);}return false;},isBoolean:function(D){return typeof D==="boolean";},isFunction:function(D){return typeof D==="function";},isNull:function(D){return D===null;},isNumber:function(D){return typeof D==="number"&&isFinite(D);},isObject:function(D){return(D&&(typeof D==="object"||A.isFunction(D)))||false;},isString:function(D){return typeof D==="string";},isUndefined:function(D){return typeof D==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(F,E){for(var D=0;D<C.length;D=D+1){var H=C[D],G=E[H];if(A.isFunction(G)&&G!=Object.prototype[H]){F[H]=G;}}}:function(){},extend:function(H,I,G){if(!I||!H){throw new Error("extend failed, please check that "+"all dependencies are included.");}var E=function(){};E.prototype=I.prototype;H.prototype=new E();H.prototype.constructor=H;H.superclass=I.prototype;if(I.prototype.constructor==Object.prototype.constructor){I.prototype.constructor=I;}if(G){for(var D in G){if(A.hasOwnProperty(G,D)){H.prototype[D]=G[D];}}A._IEEnumFix(H.prototype,G);}},augmentObject:function(H,G){if(!G||!H){throw new Error("Absorb failed, verify dependencies.");}var D=arguments,F,I,E=D[2];if(E&&E!==true){for(F=2;F<D.length;F=F+1){H[D[F]]=G[D[F]];}}else{for(I in G){if(E||!(I in H)){H[I]=G[I];}}A._IEEnumFix(H,G);}},augmentProto:function(G,F){if(!F||!G){throw new Error("Augment failed, verify dependencies.");}var D=[G.prototype,F.prototype];for(var E=2;E<arguments.length;E=E+1){D.push(arguments[E]);}A.augmentObject.apply(this,D);},dump:function(D,I){var F,H,K=[],L="{...}",E="f(){...}",J=", ",G=" => ";if(!A.isObject(D)){return D+"";}else{if(D instanceof Date||("nodeType" in D&&"tagName" in D)){return D;}else{if(A.isFunction(D)){return E;}}}I=(A.isNumber(I))?I:3;if(A.isArray(D)){K.push("[");for(F=0,H=D.length;F<H;F=F+1){if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F<D;F=F+1){A.augmentObject(G,E[F],true);}return G;},later:function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=G,I,D;if(A.isString(L)){F=E[L];}if(!F){throw new TypeError("method undefined");}if(!A.isArray(J)){J=[G];}I=function(){F.apply(E,J);};D=(H)?setInterval(I,K):setTimeout(I,K);return{interval:H,cancel:function(){if(this.interval){clearInterval(D);}else{clearTimeout(D);}}};},isValue:function(D){return(A.isObject(D)||A.isString(D)||A.isNumber(D)||A.isBoolean(D));}};A.hasOwnProperty=(Object.prototype.hasOwnProperty)?function(D,E){return D&&D.hasOwnProperty(E);}:function(D,E){return !A.isUndefined(D[E])&&D.constructor.prototype[E]!==D[E];};B.augmentObject(A,B,true);YAHOO.util.Lang=A;A.augment=A.augmentProto;YAHOO.augment=A.augmentProto;YAHOO.extend=A.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.5.2",build:"1076"});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/yahoo/yahoo-min-2-5-2.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/yahoo/yahoo-min-2-5-2.js');
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.2
*/
YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var K=[],E=this.subscribers.length;if(!E&&this.silent){return true;}var I=[].slice.call(arguments,0),G=true,D,J=false;if(!this.silent){}var C=this.subscribers.slice(),A=YAHOO.util.Event.throwErrors;for(D=0;D<E;++D){var M=C[D];if(!M){J=true;}else{if(!this.silent){}var L=M.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(I.length>0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L<K.length;L=L+1){F.push({id:K[L],fn:M,obj:Q,override:O,checkReady:N});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(M,K,N,L){this.onAvailable(M,K,N,L,true);},onDOMReady:function(K,M,L){if(this.DOMReady){setTimeout(function(){var N=window;if(L){if(L===true){N=M;}else{N=L;}}K.call(N,"DOMReady",[],M);},0);}else{this.DOMReadyEvent.subscribe(K,M,L);}},addListener:function(M,K,V,Q,L){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var R=0,T=M.length;R<T;++R){W=this.on(M[R],K,V,Q,L)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var P=this.getEl(M);if(P){M=P;}else{this.onAvailable(M,function(){YAHOO.util.Event.on(M,K,V,Q,L);});return true;}}}if(!M){return false;}if("unload"==K&&Q!==this){J[J.length]=[M,K,V,Q,L];return true;}var Y=M;if(L){if(L===true){Y=Q;}else{Y=L;}}var N=function(Z){return V.call(Y,YAHOO.util.Event.getEvent(Z,M),Q);};var X=[M,K,V,N,Y,Q,L];var S=I.length;I[S]=X;if(this.useLegacyEvent(M,K)){var O=this.getLegacyIndex(M,K);if(O==-1||M!=G[O][0]){O=G.length;B[M.id+K]=O;G[O]=[M,K,M["on"+K]];E[O]=[];M["on"+K]=function(Z){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z),O);};}E[O].push(X);}else{try{this._simpleAdd(M,K,N,false);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}}return true;},fireLegacyEvent:function(O,M){var Q=true,K,S,R,T,P;S=E[M].slice();for(var L=0,N=S.length;L<N;++L){R=S[L];if(R&&R[this.WFN]){T=R[this.ADJ_SCOPE];P=R[this.WFN].call(T,O);Q=(Q&&P);}}K=G[M];if(K&&K[2]){K[2](O);}return Q;},getLegacyIndex:function(L,M){var K=this.generateId(L)+M;if(typeof B[K]=="undefined"){return -1;}else{return B[K];}},useLegacyEvent:function(L,M){if(this.webkit&&("click"==M||"dblclick"==M)){var K=parseInt(this.webkit,10);if(!isNaN(K)&&K<418){return true;}}return false;},removeListener:function(L,K,T){var O,R,V;if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var U=true;for(O=L.length-1;O>-1;O--){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=J.length-1;O>-1;O--){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J.splice(O,1);return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O<R;++O){V=M[O];if(V&&V[this.EL]==L&&V[this.TYPE]==K&&V[this.FN]==T){M.splice(O,1);break;}}}}else{try{this._simpleRemove(L,K,P[this.WFN],false);}catch(S){this.lastError=S;return false;}}delete I[Q][this.WFN];delete I[Q][this.FN];I.splice(Q,1);return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;
},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];},getRelatedTarget:function(L){var K=L.relatedTarget;if(!K){if(L.type=="mouseout"){K=L.toElement;}else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){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){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in D)){K=D[K];}return K;},_getCacheIndex:function(O,P,N){for(var M=0,L=I.length;M<L;M=M+1){var K=I[M];if(K&&K[this.FN]==N&&K[this.EL]==O&&K[this.TYPE]==P){return M;}}return -1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+A;++A;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(L){if(!H){H=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;clearInterval(this._interval);this._interval=null;return ;}if(this.locked){return ;}if(this.isIE){if(!this.DOMReady){this.startInterval();return ;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0&&F.length>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var L,K,O,N,M=[];for(L=0,K=F.length;L<K;L=L+1){O=F[L];if(O){N=this.getEl(O.id);if(N){if(O.checkReady){if(H||N.nextSibling||!Q){M.push(O);F[L]=null;}}else{R(N,O);F[L]=null;}}else{P.push(O);}}}for(L=0,K=M.length;L<K;L=L+1){O=M[L];R(this.getEl(O.id),O);}C--;if(Q){for(L=F.length-1;L>-1;L--){O=F[L];if(!O||!O.id){F.splice(L,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=Q.length-1;N>-1;N--){var L=Q[N];this.removeListener(M,L.type,L.fn);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[I,J];}else{if(K==="unload"){L=[J];}else{L=[I];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(Q){var K=YAHOO.util.Event,N,M,L,P,O,R=J.slice();for(N=0,P=J.length;N<P;++N){L=R[N];if(L){var S=window;if(L[K.ADJ_SCOPE]){if(L[K.ADJ_SCOPE]===true){S=L[K.UNLOAD_OBJ];}else{S=L[K.ADJ_SCOPE];}}L[K.FN].call(S,K.getEvent(Q,L[K.EL]),L[K.UNLOAD_OBJ]);R[N]=null;L=null;S=null;}}J=null;if(I){for(M=I.length-1;M>-1;M--){L=I[M];if(L){K.removeListener(L[K.EL],L[K.TYPE],L[K.FN],M);}}L=null;}G=null;K._simpleRemove(window,"unload",K._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;
if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.5.2",build:"1076"});
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/yahoo/event-min-2-5-2.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/yahoo/event-min-2-5-2.js');
/**
 * Copyright (c) 2006-2007, TIBCO Software Inc.
 * Use, modification, and distribution subject to terms of license.
 * 
 * TIBCO(R) PageBus 1.2.0
 */

/*******************************************************************************
 *
 * Contains an implementation of the OpenAjax Hub
 * 
 * Copyright 2006-2007 OpenAjax Alliance
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 * use this file except in compliance with the License. You may obtain a copy 
 * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless 
 * required by applicable law or agreed to in writing, software distributed 
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 * specific language governing permissions and limitations under the License.
 *
 ******************************************************************************/

// prevent re-definition of the OpenAjax object
if(!window["OpenAjax"]){
	OpenAjax = new function() {
		var t = true;
		var f = false;
		var g = window;
		var libs;
		var ooh = "org.openajax.hub.";

		var h = {};
		this.hub = h;
		h.implementer = "http://tibco.com";
		h.implVersion = "0.6";
		h.specVersion = "0.6";
		h.implExtraData = {};
		var libs = {};
		h.libraries = libs;

		h.registerLibrary = function(prefix, nsURL, version, extra){
			libs[prefix] = {
				prefix: prefix,
				namespaceURI: nsURL,
				version: version,
				extraData: extra 
			};
			this.publish(ooh+"registerLibrary", libs[prefix]);
		}
		h.unregisterLibrary = function(prefix){
			this.publish(ooh+"unregisterLibrary", libs[prefix]);
			delete libs[prefix];
		}

		h._subscriptions = { c:{}, s:[] };
		h._cleanup = [];
		h._subIndex = 0;
		h._pubDepth = 0;

		h.subscribe = function(name, callback, scope, subscriberData, filter)			
		{
			if(!scope){
				scope = window;
			}
			var handle = name + "." + this._subIndex;
			var sub = { scope: scope, cb: callback, fcb: filter, data: subscriberData, sid: this._subIndex++, hdl: handle };
			var path = name.split(".");
	 		this._subscribe(this._subscriptions, path, 0, sub);
			return handle;
		}

		h.publish = function(name, message)		
		{
			path = name.split(".");
			this._pubDepth++;
			this._publish(this._subscriptions, path, 0, name, message);
			this._pubDepth--;				
			if((this._cleanup.length > 0) && (this._pubDepth == 0)) {
				for(var i = 0; i < this._cleanup.length; i++) 
					this.unsubscribe(this._cleanup[i].hdl);
				delete(this._cleanup);
				this._cleanup = [];
			}
		}

		h.unsubscribe = function(sub) 
		{
			var path = sub.split(".");
			var sid = path.pop();
			this._unsubscribe(this._subscriptions, path, 0, sid);
		}
		
		h._subscribe = function(tree, path, index, sub) 
		{
			var token = path[index];
			if(index == path.length) 	
				tree["."].push(sub);
			else { 
				if(!tree[token]) {
					tree[token] = { ".": [] }; 
					this._subscribe(tree[token], path, index + 1, sub);
				}
				else 
					this._subscribe(tree[token], path, index + 1, sub);
			}
		}

		h._publish = function(tree, path, index, name, msg) {
			if(typeof tree != "undefined") {
				var node;
				if(index == path.length) {
					node = tree;
				} else {
					this._publish(tree[path[index]], path, index + 1, name, msg);
					this._publish(tree["*"], path, index + 1, name, msg);			
					node = tree["**"];
				}
				if(typeof node != "undefined") {
					var callbacks = node["."];
					var max = callbacks.length;
					for(var i = 0; i < max; i++) {
						if(callbacks[i].cb) {
							var sc = callbacks[i].scope;
							var cb = callbacks[i].cb;
							var fcb = callbacks[i].fcb;
							var d = callbacks[i].data;
							if(typeof cb == "string"){
								// get a function object
								cb = sc[cb];
							}
							if(typeof fcb == "string"){
								// get a function object
								fcb = sc[fcb];
							}
							try {
								if((!fcb) || 
							   		(fcb.call(sc, name, msg, d))) {
										cb.call(sc, name, msg, d);
								}
							}
							catch(err) {
								if(err.message == "PageBus.StackOverflow")
									throw err;
								h.publish("com.tibco.pagebus.error.callbackError", { name: escape(name), error: escape(err.message) });
							}
						}
					}
				}
			}
		}
			
		h._unsubscribe = function(tree, path, index, sid) {
			if(typeof tree != "undefined") {
				if(index < path.length) {
					var childNode = tree[path[index]];
					this._unsubscribe(childNode, path, index + 1, sid);
					if(childNode["."].length == 0) {
						for(var x in childNode) 
					 		return;		
						delete tree[path[index]];	
					}
					return;
				}
				else {
					var callbacks = tree["."];
					var max = callbacks.length;
					for(var i = 0; i < max; i++) 
						if(sid == callbacks[i].sid) {
							if(this._pubDepth > 0) {
								callbacks[i].cb = null;	
								this._cleanup.push(callbacks[i]);						
							}
							else
								callbacks.splice(i, 1);
							return; 	
						}
				}
			}
		}
	};
	// Register the OpenAjax Hub itself as a library.
	OpenAjax.hub.registerLibrary("OpenAjax", "http://openajax.org/hub", "0.6", {});
}

if(!window["PageBus"]) {
PageBus = new function() {
	var version = "1.2.0";
	var D = 0;  
	var Q = []; 
	var Reg = {}; 
	var RClean = []; 
	var RD = 0; 

	_throw = function(n) { 
		throw new Error("PageBus." + n); 
	}
	
	_badName = function(n) { 
		_throw("BadName"); 
	}
	
	_fix = function(p) {
		if(typeof p == "undefined")
			return null;
		return p;
	}

	_valPub = function(name) {
		if((name == null) || (name.indexOf("*") != -1) || (name.indexOf("..") != -1) || 
			(name.charAt(0) == ".") || (name.charAt(name.length-1) == ".")) 
			_badName();
	}
	
	_valSub = function(name) {
		var path = name.split(".");
		var len = path.length;
		for(var i = 0; i < len; i++) {
			if((path[i] == "") ||
			  ((path[i].indexOf("*") != -1) && (path[i] != "*") && (path[i] != "**")))
				_badName();
			if((path[i] == "**") && (i < len - 1))
				_badName();
		}
		return path;
	}
	
	this.subscribe = function(name, scope, callback, subscriberData, filter)			
	{
		filter = _fix(filter);
		subscriberData = _fix(subscriberData);
		var path = _valSub(name);
	 	return OpenAjax.hub.subscribe(name, callback, scope, subscriberData, filter);
	}
	
	this.publish = function (name, message) {	
		_valPub(name);
		if(D > 20) 
			_throw("StackOverflow");
		Q.push({ n: name, m: message, d: (D + 1) });
		if(D == 0) {
			while(Q.length > 0) {
				var qitem = Q.shift();
				var path = qitem.n.split(".");
				try {
					D = qitem.d;
					OpenAjax.hub.publish(qitem.n, qitem.m);
					D = 0;
				}
				catch(err) {
					D = 0;
					throw(err);
				}
			}
		}
	}
	
	this.unsubscribe = function(sub) {
		try {
			OpenAjax.hub.unsubscribe(sub);
		}
		catch(err) {
			_throw("BadParameter");
		}
	}

	this.store = function(name, msg, props) {

		_store = function(tree, path, index, name, msg) {
			var tok = path[index];
			var len = path.length;
			if(typeof tree[tok]== "undefined")
				tree[tok] = {};
			var n = tree[tok];
			if(index == len - 1) {
				if(typeof n["."] != "undefined") {
					if(RD == 0) 
						delete n["."];
					else {
						n["."].v = null;
						RClean.push(n["."]);
					}
				}
				if(msg != null) 
					n["."] = { n: name, v: msg };
			}
			else {
				_store(n, path, index+1, name, msg);
				if(msg == null) {
					for(var x in n[path[index+1]]) 
	 					return;		
					if(RD == 0) 
						delete n[path[index+1]];
					else {
						RClean.push(n[path[index+1]]);
						n[path[index+1]] = null;
					}
				}
			}
		}
	
		_valPub(name);
		var path = name.split(".");
		_store(Reg, path, 0, name, msg);
		if(!props || !props.quiet)
			PageBus.publish(name, msg);
	}
	
	this.query = function(name, scope, cb, data, fcb) {

		_query = function(tree, path, idx, rSub) {
	
			function _doRCB(node, rSub) {
				var z = rSub.z;
				var cb = rSub.c;
				var d = rSub.d;
				var fcb = rSub.f;
	
				var n = node["."];
				if(!n || !n.v) 
					return true;
				if((fcb == null) || fcb.call(z, n.n, n.v, d)) 
					return cb.call(z, n.n, n.v, d);
				return true;
			}
		
			var len = path.length;
			var tok = path[idx];
			var last = (idx == len - 1)
			if(tok == "**") {
				for(tok in tree) {
					if(tok != ".") {
						if (!_doRCB(tree[tok], rSub))
							return false;
						if(!_query(tree[tok], path, idx, rSub))
							return false;
					}
				}
			}
			else if(tok == "*") {
				for(tok in tree) {
					if(tok != ".") {
						if(last) { 
							if(!_doRCB(tree[tok], rSub))
								return false;
						}
						else
							if(!_query(tree[tok], path, idx+1, rSub))
								return false;
					}
				}
			}
			else if(typeof tree[tok] != "undefined") {
				if(last) 
					return _doRCB(tree[tok], rSub);
				else
					return _query(tree[tok], path, idx+1, rSub);
			}
			return true;
		}

		if(scope == null)
			scope = window;
		var path = _valSub(name);
		var len = path.length;
		var res;
		try {
			RD++;
			var rSub = { z: scope, c: cb, d: data, f: fcb };
			res = _query(Reg, path, 0, rSub);
			RD--;	
		}
		catch(err) {
			RD--;	
			throw err;
		}
		if(RD == 0) {
			while(RClean.length > 0) {	
				var p = RClean.pop();
				delete p;
			}
		}
		if(!res)
			return;
		var subj = "com.tibco.pagebus.query.done";
		if((fcb == null) || fcb.call(scope, subj, null, data))
			cb.call(scope, subj, null, data);
	}

};
OpenAjax.hub.registerLibrary("PageBus", "http://tibco.com/PageBus", "1.2.0", {});
}


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/tibco/pagebus/js/pagebus.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/tibco/pagebus/js/pagebus.js');
/*
 PdMarker

 Purpose: extends Google Map API GMap and GMarker (hover effects, image swapping, moving)
 Details: http://www.pixeldevelopment.com/pdmarker.asp
 Updated: [see getPdMarkerRevisionInfo]
 Author:  Peter Jones
 Notes:   Relies on undocumented features of the Google Map API which may change.
	    Based on my own PJToolTip and ideas from GxMarker, TLabel and the Google Maps API forum.

 Contact http://www.pixeldevelopment.com for your custom Google Map needs
*/

function getPdMarkerRevisionInfo() {
var cr = "<br/>";
var s =
"2.03  10/02/07 - fixed zindex bug (setMarkerZIndex, topMarkerZIndex)" + cr + 
"2.02  05/22/07 - fixed minor issues (blink, initDetailWin)" + cr + 
"2.01  04/29/07 - improved left hand side detail window positioning, uses new Google setImage &amp; show " + 
"routines for added reliability, fixed zoomToMarkers for single marker case." + cr +
"2.00  04/22/07 - fix for setImage when using Explorer 7." + cr +
"1.99f 07/09/06 - zoomToMarkers now takes into account markers not displayed." + cr +
"1.99e 05/05/06 - fixed zoomed tooltip positioning &amp; non-centered marker graphics." + cr +
"1.99d 05/01/06 - fixed display &amp; blink when defining .transparent." + cr +
"1.99c 04/25/06 - added display and blink." + cr +
"1.99b 04/21/06 - added 'Powered By' version &amp; marker count display." + cr +
"1.99a 04/18/06 - revised for Google Maps API Version 2, GMap2 required." + cr +
"0.99c 01/30/06 - added setDetailWinClass and resetDetailWinClass." + cr +
"0.99a 10/12/05 - now handles maps in containers with undefined widths" + cr +
"define a div with id 'pdmarkerwork' to reduce flicker" + cr +
"0.99  10/03/05 - added setImageEnabled, allowLeftTooltips (global)" + cr +
"0.98  09/30/05 - fixed zoomToMarkers" + cr +
"0.97  09/24/05 - added setHoverImage, setShowDetailOnClick, setDetailWinHTML, showDetailWin, closeDetailWin" + cr +
"0.96  09/22/05 - added setTooltipHiding, getTooltipHiding" + cr +
"0.95  09/20/05 - handle zoom for lingering tooltips mouseOutEnabled(false) " +
		   "disables setImage and restoreImage" + cr +
"0.94  09/20/05 - added setTooltipClass and resetTooltipClass" + cr +
"0.93  09/19/05 - added slopPercentage [optional] parameter to zoomToMarkers" + cr +
"0.92  09/18/05 - added getMouseOutEnabled, setMouseOutEnabled" + cr +
"0.91  09/17/05 - fixed setOpacity";
return s;
}

function getPdMarkerVersion() {
	return getPdMarkerRevisionInfo().substring(0,15);
}

function getPdMarkerShortVersion() {
	return getPdMarkerRevisionInfo().substring(0,5);
}

var APIkey = "";

function getGoogleMapsVersion() {
	var i, a, b, c;
	var v = "unknown";

	if (document.getElementsByTagName)
		for(i=0; (a = document.getElementsByTagName("script")[i]); i++)
			if(a.getAttribute("src"))
			{
				b = a.getAttribute("src");
				c = b.indexOf("/mapfiles/maps"); // /mapfiles/maps
				d = b.indexOf("http://maps.google.com/maps?file=api");
				e = b.indexOf("key=");
				f = b.indexOf("/mapfiles/");
				g = b.indexOf("/maps");
				if (c > 0)
					v = parseFloat(b.substring(c+14));
				else if (f > 0)
					v = "2." + b.substring(f+10,g);
				if (d >= 0)
					if (e > 0)
						APIkey = b.substring(e+4);
			}
	return v;
}

function latLongToPixel(map,coord,zoom) {
    return map.fromLatLngToDivPixel(coord);
}


var pdMarkerExtList = [];

function PdMarkerAddToExtList(marker) {
	pdMarkerExtList.push(marker);
}

function PdMarkerRemoveFromExtList(id) {
	for (var i=0; i<pdMarkerExtList.length; i++)
		if (pdMarkerExtList[i].internalId == id)
			pdMarkerExtList.splice(i,1);
}

function PdMarkerFindInExtList(id) {
	for (var i=0; i<pdMarkerExtList.length; i++)
		if (pdMarkerExtList[i].internalId == id)
			return pdMarkerExtList[i];
}

function PdMarkerClose(id) {
	for (var i=0; i<pdMarkerExtList.length; i++)
		if (pdMarkerExtList[i].internalId == id)
			{
				pdMarkerExtList[i].closeDetailWin();
				pdMarkerExtList.splice(i,1);
			}
}

function PdMarkerBlinkOnOff(id) {
	var marker = PdMarkerFindInExtList(id);
	if (marker)
	{
		if (!marker.blinking) return;
		marker.blinkOn = !marker.blinkOn;
		marker.display(marker.blinkOn);
		setTimeout("PdMarkerBlinkOnOff(" + marker.getId() + ");", marker.blinkSpeed);
	}
}

// GMap extension for walking through PdMarker list
// Note: some overlays are not markers, some may not be PdMarkers

function isPdMarker(a) {
	if (a.isMarker)
		return true;		
	return false;
}

function getPdMarkerCount(a) {
	if (a.pdMarkers)
		return a.pdMarkers.length;
	return 0;
}

GMap2.prototype.getMarkerById = function(id) {
	var count = getPdMarkerCount(this);
	for (var i = 0; i < count; i++)
		if (isPdMarker(this.pdMarkers[i]))
			if (this.pdMarkers[i].internalId == id)
			{
				this.cursor = i;
				return this.pdMarkers[i];
			}
	return null;
}

GMap2.prototype.getFirstMarker = function() {
	var count = getPdMarkerCount(this);
	for (var i = 0; i < count; i++)
		if (isPdMarker(this.pdMarkers[i]))
		{
			this.cursor = i;
			return this.pdMarkers[i];
		}
	return null;
}

GMap2.prototype.getNextMarker = function() {
	var count = getPdMarkerCount(this);
	if (count > 0)
		if (this.cursor >= 0)
			for (var i = this.cursor+1; i < count; i++)
				if (isPdMarker(this.pdMarkers[i]))
				{
					this.cursor = i;
					return this.pdMarkers[i];
				}
	return null;
}

GMap2.prototype.getNthMarker = function(nTh) {
	var count = getPdMarkerCount(this);
	for (var i = 0; i < count; i++)
		if (isPdMarker(this.pdMarkers[i]))
		{
			nTh--;
			if (nTh == 0)
			{
				this.cursor = i;
				return this.pdMarkers[i];
			}
		}
	return null;
}

GMap2.prototype.getMarkerCount = function() {
	return getPdMarkerCount(this);
}

GMap2.prototype.boxMap = function(center, span) {
	var spec = this.spec;
	var zoom = spec.getLowestZoomLevel(center, span, this.viewSize);
	this.centerAndZoom(new GPoint(center.x, center.y), zoom);
}

GMap2.prototype.zoomToMarkers = function(slopPercentage, heightOffsetPct) {
	var count = 0;
	var thePoint, x, y, minX, maxX, minY, maxY, span;
	var marker = this.getFirstMarker();
	while (marker != null)
	{
		if (!marker.isHidden())
		{
			thePoint = marker.getPoint();
			// x = thePoint.x; y = thePoint.y;
			x = thePoint.lat(); y = thePoint.lng();
			if (count == 0)
			{
				minX = x; maxX = x; minY = y; maxY = y;
			}
			else
			{
				if (x < minX) minX = x;
				if (x > maxX) maxX = x;
				if (y < minY) minY = y;
				if (y > maxY) maxY = y;
			}
			count++;
		}
		marker = this.getNextMarker();
	}
	if (count == 1)
		this.setCenter(new GLatLng(x,y), this.getZoom());
	else if (count > 1)
	{
		var center = new GLatLng((minX + maxX) / 2, (minY + maxY) / 2)
		span = new GSize(Math.abs(maxX - minX), Math.abs(maxY - minY));
		slopWid = 0;
		slopHgt = 0;
		if (typeof slopPercentage != "undefined")
		{
			slopWid = span.width * slopPercentage / 200;
			slopHgt = span.height * slopPercentage / 200;
			span.width  *= 1 + slopPercentage / 100;
			span.height *= 1 + slopPercentage / 100;
		}
		deltaHgt = 0;
		if (typeof heightOffsetPct != "undefined")
		{
			deltaHgt = span.height * heightOffsetPct / 100;
			center = new GLatLng(center.lat() + deltaHgt, center.lng());
		}
		// needs slop
		var bounds = new GLatLngBounds(new GLatLng(minX-slopHgt, minY-slopWid), new GLatLng(maxX+slopHgt, maxY+slopWid)); // sw, ne
		var zoom = this.getBoundsZoomLevel(bounds);
		this.setCenter(center, zoom);
	}
}

function shorten(x) {
	var factor = 1000000
	return Math.round(x * factor) / factor;
}

function poweredByClick(map) {
	var center = map.getCenter();
	var span = map.getBounds().toSpan();
	var zoom = map.getZoom();
	var url = "http://maps.google.com/maps?ll=" + center.lat() + "," + center.lng() + "&spn=" + shorten(span.lat()) + "," + shorten(span.lng()) + "&z=" + zoom + "&key=" + APIkey;
	document.location = url;
}

function poweredByMouseover(map) {
	var marker = map.getFirstMarker();
	var bounds = map.getBounds();
	var visibleCount = 0;
	var totalCount = 0;
	while (marker != null) {
		if (!marker.isHidden())
		{
			var point = marker.getPoint();
			if (bounds.contains(point))
				visibleCount++;
			totalCount = totalCount + 1;
		}
		marker = map.getNextMarker();
	}
	var title = map.poweredByTitle + " (" + visibleCount + " markers of " + totalCount + " visible)"
	map.poweredByObj.setAttribute("title",title);
	map.poweredByObj.setAttribute("alt",title);
}

function getPoweredBy(map) {
	try {
		var tooltip = "GMap " + getGoogleMapsVersion() + " & PdMarker " + getPdMarkerShortVersion();
		map.poweredByTitle = tooltip;
		var b = document.createElement("img");
		b.setAttribute("src","http://www.google.com/intl/en_ALL/mapfiles/transparent.gif");
		b.setAttribute("width",62);
		b.setAttribute("alt",tooltip);
		b.setAttribute("title",tooltip);
		b.setAttribute("height",30);
		b.style.display = "block";
		b.style.position = "absolute";
		b.style.left    = "2px";
		b.style.bottom  = "0px";
		b.style.width   = "62px";
		b.style.height  = "30px";
		b.style.cursor  = "pointer";
		b.style.zIndex  = 600001;
		b.onclick = function() { poweredByClick(map); };
		b.onmouseover = function() { poweredByMouseover(map); };
	      map.getPane(G_MAP_FLOAT_PANE).parentNode.parentNode.appendChild(b);
		return b;
	}
	catch (e) {
	}
	return true;
}

function setPoweredBy(map) {
	if (!map.poweredByObj) {
		getGoogleMapsVersion(); // possibly reduce IE memory leak, unchecked
		map.poweredByObj = getPoweredBy(map);
	}
}


// PdMarker code


function PdMarkerNamespace() {

var userAgent = navigator.userAgent.toLowerCase();
var n4=(document.layers);
var n6=(document.getElementById&&!document.all);
var ie=(document.all);
var o6=(userAgent.indexOf("opera") != -1);
var safari=(userAgent.indexOf("safari") != -1);
var msie  = (userAgent.indexOf("msie") != -1) && (userAgent.indexOf("opera") == -1);
var msiePre7 = false;
if (msie)
	msiePre7 = userAgent.substr(userAgent.indexOf("msie")+5,2) < 7;   

var nextMarkerId = 10;
var permitLeft = true;

var icon = new GIcon();
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(9, 34);
icon.infoWindowAnchor = new GPoint(9, 2);
icon.infoShadowAnchor = new GPoint(18, 25);
icon.image = "http://www.google.com/mapfiles/marker.png";

// Globals - careful of multiple maps

function PdMarker(a, b, tooltip) {
	this.inheritFrom = GMarker;
	if (typeof b == "undefined") // pmj oct 23, 2005
		b = icon;
	this.inheritFrom(a,b);
	if (typeof tooltip != "undefined")
		this.pendingTitle = tooltip;
	else
		this.pendingTitle = "";
	if (typeof b != "undefined")
		this.oldImagePath = b.image;
	else
		this.oldImagePath = "http://www.google.com/mapfiles/marker.png";
	this.internalId = nextMarkerId;
	nextMarkerId += 1;
	this.zIndexSaved = false;
	this.pendingCursor = "";
	this.percentOpacity = 70;
	this.mouseOutEnabled = true;
	this.setImageOn = true;
	this.hidingEnabled = true;
	this.showDetailOnClick = true;
	this.detailOpen = false;
	this.userData = "";
	this.displayed = true;
}

// PdMarker.prototype = new GMarker;
PdMarker.prototype = new GMarker(new GLatLng(1, 1));


function addMarkerToMapList(map,marker) {
	try {
		if (map.pdMarkers.length) ;
	}
	catch(e) {
		map.pdMarkers = new Array();
	}
	// add to list
	map.pdMarkers.push(marker);
}

function removeMarkerFromMapList(map,marker) {
	var id = marker.internalId;
	for (var i=0; i<map.pdMarkers.length; i++)
		if (map.pdMarkers[i].internalId == id)
		{
			map.pdMarkers.splice(i,1);
			return;
		}
}

PdMarker.prototype.initialize = function(a) {
	if (typeof a == "GMap")
	{
		GLog.write("PdMarker requires GMap2");
		return;
	}
	addMarkerToMapList(a,this);
	try
	{
		GMarker.prototype.initialize.call(this, a);
		this.isMarker = true;
		if (this.pendingTitle.length > 0)
			this.setTitle(this.pendingTitle);
		if (this.pendingCursor.length > 0)
			this.setCursor(this.pendingCursor);

		this.map = a;
		setPoweredBy(a);

		GEvent.bindDom(this, "mouseover", this, this.onMouseOver);
		GEvent.bindDom(this, "mouseout",  this, this.onMouseOut);
		GEvent.bindDom(this, "click",  this, this.onClick);
		GEvent.bind(this.map, "zoomend", this, this.reZoom);
	}
	catch(e) {
		alert("PdMarker initialize error: " + e);
	}
}

PdMarker.prototype.allowLeftTooltips = function(a){
	permitLeft = a;
}

PdMarker.prototype.reZoom = function(){
	var didSet = false;
	if (this.tooltipObject)
		if (this.tooltipObject.style.display == "block")
		{
			setTTPosition(this);
			didSet = true;
		}
	if (this.detailObject)
	{
		if (!didSet)
			setTTPosition(this);
		setDetailPosition(this);
	}
}

PdMarker.prototype.setId = function(id) {
	this.internalId = id;
}

PdMarker.prototype.getId = function() {
	return this.internalId;
}

PdMarker.prototype.setName = function(a) {
	this.name = a;
}

PdMarker.prototype.getName = function() {
	if (this.name)
		return this.name;
	else
		return null;
}

PdMarker.prototype.setUserData = function(a) {
	this.userData = a;
}

PdMarker.prototype.getUserData = function() {
	if (this.userData)
		return this.userData;
	else
//		return null;
		return "";
}

PdMarker.prototype.setUserData2 = function(a) {
	this.userData2 = a;
}

PdMarker.prototype.getUserData2 = function() {
	if (this.userData2)
		return this.userData2;
	else
		return "";
}

PdMarker.prototype.setImageEnabled = function(a) {
	this.setImageOn = a;
}

var PdMIN = "";
var PdMIA = "";

function PdCompPdMIN(marker) {
	if (PdMIN.length == 0)
		for (var i in marker)
			if (eval("typeof marker." + i) == "object")
				try {
					if (eval("typeof marker." + i + "[0].src") != "undefined")
					{
						PdMIA = "this." + i;
						PdMIN = PdMIA + "[0]";
					}
				}
				catch (e) {}
}

PdMarker.prototype.setImageOld = function(a) {
	// 		GMarker.prototype.initialize.call(this, a);
	var msFilter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + a + '")';
	if (this.mouseOutEnabled && this.setImageOn)
	{
		PdCompPdMIN(this);
		try {
			if (this.oldImagePath.length == 0)
				eval("this.oldImagePath = " + PdMIN + ".src");
			if (msie && msiePre7)
				eval(PdMIN + ".style.filter = msFilter");
			else
				eval(PdMIN + ".src = a");
		}
		catch (e) {}
	}
}

PdMarker.prototype.setImage = function(a) {
	if (this.mouseOutEnabled && this.setImageOn)
		GMarker.prototype.setImage.call(this, a);
}

PdMarker.prototype.restoreImage = function() {
	if (this.mouseOutEnabled && this.setImageOn && this.oldImagePath.length > 0)
		this.setImage(this.oldImagePath);
}

PdMarker.prototype.display = function(a) {
	if (a)
		this.show();
	else
		this.hide();
}

PdMarker.prototype.blink = function(a,b) {
	if (a)
	{
		this.blinkOn = true;
		this.blinkSpeed = b;
		if (!this.blinking)
		{
			this.blinking = a;
			PdMarkerAddToExtList(this);
			PdMarkerBlinkOnOff(this.getId());
		}
	}
	else
	{
		this.blinking = a;
		this.display(true);
		PdMarkerRemoveFromExtList(this);
	}
}

PdMarker.prototype.setIcon = function(a) {
	this.remove();
	this.icon = a;
	this.initialize(this.map);
	this.redraw(true); 
}

PdMarker.prototype.setMarkerZIndex = function(a) {
	PdCompPdMIN(this);
	if (!this.zIndexSaved)
	{
		this.zIndexSaved = true;
		this.oldZIndex = eval(PdMIN + ".style.zIndex");
	}
	eval(PdMIN + ".style.zIndex = a")
	this.redraw(true);
}

PdMarker.prototype.topMarkerZIndex = function() {
	this.setMarkerZIndex (600000);
}

PdMarker.prototype.restoreMarkerZIndex = function() {
	PdCompPdMIN(this);
	if (this.zIndexSaved)
	{
		this.zIndexSaved = false;
		eval(PdMIN + ".style.zIndex = this.oldZIndex")
		this.redraw(true);
	}
}

PdMarker.prototype.onInfoWindowOpen = function() {
	this.hideTooltip();
	GMarker.prototype.onInfoWindowOpen.call(this);
}

PdMarker.prototype.setHoverImage = function(a) {
	this.hoverImage = a;
}

var inMouseOver = false;

PdMarker.prototype.onMouseOver = function() {
	if (inMouseOver)
		return;
	inMouseOver = true;
	if (this.hoverImage)
		this.setImage(this.hoverImage);
	if (!this.detailOpen)
		this.showTooltip();
	inMouseOver = false;
}

PdMarker.prototype.onMouseOut = function() {
	if (this.hoverImage)
		this.restoreImage();
	if (!this.detailOpen)
		if (this.mouseOutEnabled)
			this.hideTooltip();
}

PdMarker.prototype.setMouseOutEnabled = function(a) {
	this.mouseOutEnabled = a;
}

PdMarker.prototype.getMouseOutEnabled = function() {
	return this.mouseOutEnabled;
}

PdMarker.prototype.setTooltipHiding = function(a) {
	this.hidingEnabled = a;
}

PdMarker.prototype.getTooltipHiding = function() {
	return this.hidingEnabled;
}

PdMarker.prototype.setTitle = function(a) {
	this.tooltipText = "";
	PdCompPdMIN(this);
	try {
		eval(PdMIN + ".title = a");
	}
	catch (e) {
		this.pendingTitle = a;
	}
}

PdMarker.prototype.setCursor = function(a) {
	PdCompPdMIN(this);
	try {
		eval(PdMIN + ".style.cursor = a");
	}
	catch (e) {
		this.pendingCursor = a;
	}
}

PdMarker.prototype.setTooltipClass = function(a) {
	this.pendingClassName = a;
	if (this.tooltipObject)
	{
		var showing = (this.tooltipObject.style.display != "none");
		this.deleteObjects();
		if (this.tooltipRaw)
			this.setTooltipNoResize(this.tooltipRaw);
		if (showing)
			this.showTooltip();

	}
	else
		if (this.tooltipRaw)
			this.setTooltipNoResize(this.tooltipRaw);
}

PdMarker.prototype.resetTooltipClass = function() {
	this.setTooltipClass("markerTooltip");
}

PdMarker.prototype.getTooltip = function() {
	try {
		return this.tooltipRaw;
	}
	catch (e)
	{
		return "";
	}
}

PdMarker.prototype.setTooltipNoResize = function(a) {
	this.setTitle("");
	var ttClass = "markerTooltip";
	if (this.pendingClassName)
		ttClass = this.pendingClassName;
	this.tooltipRaw = a;
	this.tooltipText = "<div class='" + ttClass + "'>" + a + "</div>";
	if (this.tooltipObject)
		this.tooltipObject.innerHTML = this.tooltipText;
}

PdMarker.prototype.setTooltip = function(a) {
	this.setTooltipNoResize(a);
	this.deleteObjects();
}

PdMarker.prototype.showTooltip = function() {
	if (this.tooltipText)
	{
		if (!this.tooltipObject)
			initTooltip(this);
		setTTPosition(this);
		this.tooltipObject.style.display = "block";
	}
}

PdMarker.prototype.hideTooltip = function() {
	if (this.tooltipObject)
		if (this.hidingEnabled)
			this.tooltipObject.style.display = "none";
}

PdMarker.prototype.onClick = function(a) {
	if (this.showDetailOnClick && this.detailWinHTML)
		this.showDetailWin();
}

PdMarker.prototype.setShowDetailOnClick = function(a) {
	this.showDetailOnClick = a;
}

PdMarker.prototype.setDetailWinHTML = function(a) {
	this.detailWinHTML = a;
}




PdMarker.prototype.setDetailWinClass = function(a) {
	this.pendingDetailClassName = a;
}

PdMarker.prototype.resetDetailWinClass = function() {
	this.setDetailWinClass("markerDetail");
}



PdMarker.prototype.showDetailWin = function() {
	if (this.detailOpen)
	{
		this.closeDetailWin();
		return;
	}
	this.hideTooltip();
	this.setMouseOutEnabled(false);

	var winClass = "markerDetail";
	if (this.pendingWinClassName)
		winClass = this.pendingWinClassName;

	var html = "<table><tr><td>" + this.detailWinHTML + "<\/td><td valign='top'><a class='markerDetailClose' href='javascript:PdMarkerClose(" + this.internalId + ")'><img src='http://www.google.com/mapfiles/close.gif' width='14' height='13'><\/a><\/td><\/tr><\/table>";
	html = "<div class='" + winClass + "'>" + html + "</div>";
	this.detailOpen = true;
	if (!this.tooltipText)
	{
		this.ttWidth = 150;
		this.ttHeight = 30;
		setTTPosition(this); // compute ttTop, ttLeft
	}
	initDetailWin(this, this.ttTop, this.ttLeft, html);
	PdMarkerAddToExtList(this);
}


PdMarker.prototype.closeDetailWin = function() {
	this.detailOpen = false;
	if (this.detailObject)
	{
		this.setMouseOutEnabled(true);
		this.onMouseOut();
		// GEvent.trigger(this, "mouseout");
	      this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.detailObject);
		this.detailObject = null;
	}
}

PdMarker.prototype.deleteObjects = function() {
	if (this.tooltipObject)
	{
	      this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.tooltipObject);
		this.tooltipObject = null;
	}
	if (this.detailObject)
	{
		this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.detailObject);
		this.detailObject = null;
	}
}

PdMarker.prototype.remove = function(a) {
	removeMarkerFromMapList(this.map, this);
	PdMarkerRemoveFromExtList(this.getId());
	GMarker.prototype.remove.call(this);
	this.deleteObjects();
}

PdMarker.prototype.setOpacity = function(b) {
	if (b < 0)
		b=0;
	if (b >= 100)
		b=100;
	var c = b / 100;
	this.percentOpacity = b;
	var d = document.getElementById(this.objId);
	if (d)
	{
		if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+b+')';}
		if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}
		if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}
		if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}
	}
}

PdMarker.prototype.setOpacityNew = function(b) {
	setObjOpacity(this.objId);
	this.percentOpacity = b;
}

// ***** Private routines *****

function setObjOpacity(objId, b) {
	if (b < 0)
		b=0;
	if (b >= 100)
		b=100;
	var c = b / 100;
	var d = document.getElementById(objId);
	if (d)
	{
		if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+b+')';}
		if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}
		if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}
		if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}
	}
}

function idToElemId(id) {
	return "ttobj" + id;
}

function initTooltip(theObj) {
	theObj.objId = idToElemId(theObj.internalId);
	theObj.anchorLatLng = theObj.point;

	var b = document.createElement('span');
	theObj.tooltipObject = b;
	b.setAttribute('id',theObj.objId);
	b.innerHTML = theObj.tooltipText;

	// append to body for size calculations
	var c = document.body;
	var d = document.getElementById("pdmarkerwork");
	if (d)
		c = d;
	c.appendChild(b);
	b.style.position = "absolute";
	b.style.bottom = "5px";
	b.style.left = "5px";
	b.style.zIndex = 1;
	if (theObj.percentOpacity)
		theObj.setOpacity(theObj.percentOpacity);
	var tempObj = document.getElementById(theObj.objId);
	theObj.ttWidth  = tempObj.offsetWidth;
	theObj.ttHeight = tempObj.offsetHeight;
	c.removeChild(b);

	b.style.zIndex = 600000;
	b.style.bottom = "";
	b.style.left = "";
	theObj.map.getPane(G_MAP_FLOAT_PANE).appendChild(b);
}

function initDetailWin(theObj, top, left, html) {
	theObj.detailId = "detail" + theObj.internalId;
	var b = document.createElement('span');
	theObj.detailObject = b;
	b.setAttribute('id',theObj.detailId);
	b.innerHTML = html;
	b.style.display = "block";
	b.style.position = "absolute";
	b.style.top  = top + "px";
	if (theObj.rightSide)
		b.style.left = left + "px";
	else
		b.style.right = -left + "px";
	b.style.zIndex = 600001;
	theObj.map.getPane(G_MAP_FLOAT_PANE).appendChild(b);
}

function setTTPosition(theObj) {
	var gap = 5;
	var map = theObj.map;
	var pt  = theObj.getPoint();
	var ttPos = latLongToPixel(map, pt, map.getZoom());
	var theIcon = theObj.getIcon();
	
	ttPos.y -= Math.floor(theIcon.iconAnchor.y/2);

	var rightSide = true;
	var bounds = map.getBounds();
	var boundsSpan	= bounds.toSpan();
	var longSpan = boundsSpan.lng();
	var mapWidth = map.getSize().width;

	var tooltipWidthInDeg = (theObj.ttWidth + theIcon.iconSize.width + 6) / mapWidth * longSpan;
	if (pt.lng() + tooltipWidthInDeg > bounds.getNorthEast().lng() && permitLeft)
		rightSide = false;
	ttPos.y -= Math.floor(theObj.ttHeight/2);
	delta = (theIcon.iconSize.width - theIcon.iconAnchor.x) + gap;
	if (rightSide)
		ttPos.x += delta;
	else
		ttPos.x -= delta
	theObj.rightSide = rightSide;
	theObj.ttLeft = ttPos.x;
	theObj.ttTop  = ttPos.y;
	if (theObj.tooltipObject)
	{
		if (rightSide) {
			theObj.tooltipObject.style.left = ttPos.x + "px";
			theObj.tooltipObject.style.right = null;
		}
		else {
			theObj.tooltipObject.style.left = null;
			theObj.tooltipObject.style.right = -ttPos.x + "px";
		}
		theObj.tooltipObject.style.top  = ttPos.y + "px";
	}
}

function makeInterface(a) {
	var b = a || window;
	b.PdMarker = PdMarker;
}

makeInterface();
}


PdMarkerNamespace();

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/google/map/pdmarker.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/google/map/pdmarker.js');
/**
 * @name MarkerManager
 * @version 1.1
 * @copyright (c) 2007 Google Inc.
 * @author Doug Ricket, others
 *
 * @fileoverview Marker manager is an interface between the map and the user,
 * designed to manage adding and removing many points when the viewport changes.
 * <br /><br />
 * <b>How it Works</b>:<br/> 
 * The MarkerManager places its markers onto a grid, similar to the map tiles.
 * When the user moves the viewport, it computes which grid cells have
 * entered or left the viewport, and shows or hides all the markers in those
 * cells.
 * (If the users scrolls the viewport beyond the markers that are loaded,
 * no markers will be visible until the <code>EVENT_moveend</code> 
 * triggers an update.)
 * In practical consequences, this allows 10,000 markers to be distributed over
 * a large area, and as long as only 100-200 are visible in any given viewport,
 * the user will see good performance corresponding to the 100 visible markers,
 * rather than poor performance corresponding to the total 10,000 markers.
 * Note that some code is optimized for speed over space,
 * with the goal of accommodating thousands of markers.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */

/**
 * @name MarkerManagerOptions
 * @class This class represents optional arguments to the {@link MarkerManager}
 *     constructor.
 * @property {Number} [maxZoom] Sets the maximum zoom level monitored by a
 *     marker manager. If not given, the manager assumes the maximum map zoom
 *     level. This value is also used when markers are added to the manager
 *     without the optional {@link maxZoom} parameter.
 * @property {Number} [borderPadding] Specifies, in pixels, the extra padding
 *     outside the map's current viewport monitored by a manager. Markers that
 *     fall within this padding are added to the map, even if they are not fully
 *     visible.
 * @property {Boolean} [trackMarkers=false] Indicates whether or not a marker
 *     manager should track markers' movements. If you wish to move managed
 *     markers using the {@link setPoint}/{@link setLatLng} methods, 
 *     this option should be set to {@link true}.
 */

/**
 * Creates a new MarkerManager that will show/hide markers on a map.
 *
 * @constructor
 * @param {Map} map The map to manage.
 * @param {Object} opt_opts A container for optional arguments:
 *   {Number} maxZoom The maximum zoom level for which to create tiles.
 *   {Number} borderPadding The width in pixels beyond the map border,
 *                   where markers should be display.
 *   {Boolean} trackMarkers Whether or not this manager should track marker
 *                   movements.
 */
function MarkerManager(map, opt_opts) {
  var me = this;
  me.map_ = map;
  me.mapZoom_ = map.getZoom();
  me.projection_ = map.getCurrentMapType().getProjection();

  opt_opts = opt_opts || {};
  me.tileSize_ = MarkerManager.DEFAULT_TILE_SIZE_;

  var mapTypes = map.getMapTypes();
  var mapMaxZoom = mapTypes[0].getMaximumResolution();
  for (var i = 0; i < mapTypes.length; i++) {
    var mapTypeMaxZoom = mapTypes[i].getMaximumResolution();
    if (mapTypeMaxZoom > mapMaxZoom) {
      mapMaxZoom = mapTypeMaxZoom;
    }
  }
  me.maxZoom_  = opt_opts.maxZoom || mapMaxZoom;

  me.trackMarkers_ = opt_opts.trackMarkers;
  me.show_ = opt_opts.show || true;

  var padding;
  if (typeof opt_opts.borderPadding === "number") {
    padding = opt_opts.borderPadding;
  } else {
    padding = MarkerManager.DEFAULT_BORDER_PADDING_;
  }
  // The padding in pixels beyond the viewport, where we will pre-load markers.
  me.swPadding_ = new GSize(-padding, padding);
  me.nePadding_ = new GSize(padding, -padding);
  me.borderPadding_ = padding;

  me.gridWidth_ = [];

  me.grid_ = [];
  me.grid_[me.maxZoom_] = [];
  me.numMarkers_ = [];
  me.numMarkers_[me.maxZoom_] = 0;

  GEvent.bind(map, "moveend", me, me.onMapMoveEnd_);

  // NOTE: These two closures provide easy access to the map.
  // They are used as callbacks, not as methods.
  me.removeOverlay_ = function (marker) {
    map.removeOverlay(marker);
    me.shownMarkers_--;
  };
  me.addOverlay_ = function (marker) {
    if (me.show_) {
	  map.addOverlay(marker);
      me.shownMarkers_++;
    }
  };

  me.resetManager_();
  me.shownMarkers_ = 0;

  me.shownBounds_ = me.getMapGridBounds_();
}

// Static constants:
MarkerManager.DEFAULT_TILE_SIZE_ = 1024;
MarkerManager.DEFAULT_BORDER_PADDING_ = 100;
MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE = 256;


/**
 * Initializes MarkerManager arrays for all zoom levels
 * Called by constructor and by clearAllMarkers
 */
MarkerManager.prototype.resetManager_ = function () {
  var me = this;
  var mapWidth = MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE;
  for (var zoom = 0; zoom <= me.maxZoom_; ++zoom) {
    me.grid_[zoom] = [];
    me.numMarkers_[zoom] = 0;
    me.gridWidth_[zoom] = Math.ceil(mapWidth / me.tileSize_);
    mapWidth <<= 1;
  }
};

/**
 * Removes all markers in the manager, and
 * removes any visible markers from the map.
 */
MarkerManager.prototype.clearMarkers = function () {
  var me = this;
  me.processAll_(me.shownBounds_, me.removeOverlay_);
  me.resetManager_();
};


/**
 * Gets the tile coordinate for a given latlng point.
 *
 * @param {LatLng} latlng The geographical point.
 * @param {Number} zoom The zoom level.
 * @param {GSize} padding The padding used to shift the pixel coordinate.
 *               Used for expanding a bounds to include an extra padding
 *               of pixels surrounding the bounds.
 * @return {GPoint} The point in tile coordinates.
 *
 */
MarkerManager.prototype.getTilePoint_ = function (latlng, zoom, padding) {
  var pixelPoint = this.projection_.fromLatLngToPixel(latlng, zoom);
  return new GPoint(
      Math.floor((pixelPoint.x + padding.width) / this.tileSize_),
      Math.floor((pixelPoint.y + padding.height) / this.tileSize_));
};


/**
 * Finds the appropriate place to add the marker to the grid.
 * Optimized for speed; does not actually add the marker to the map.
 * Designed for batch-processing thousands of markers.
 *
 * @param {Marker} marker The marker to add.
 * @param {Number} minZoom The minimum zoom for displaying the marker.
 * @param {Number} maxZoom The maximum zoom for displaying the marker.
 */
MarkerManager.prototype.addMarkerBatch_ = function (marker, minZoom, maxZoom) {
  var mPoint = marker.getPoint();
  marker.MarkerManager_minZoom = minZoom;
  // Tracking markers is expensive, so we do this only if the
  // user explicitly requested it when creating marker manager.
  if (this.trackMarkers_) {
    GEvent.bind(marker, "changed", this, this.onMarkerMoved_);
  }

  var gridPoint = this.getTilePoint_(mPoint, maxZoom, GSize.ZERO);

  for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
    var cell = this.getGridCellCreate_(gridPoint.x, gridPoint.y, zoom);
    cell.push(marker);

    gridPoint.x = gridPoint.x >> 1;
    gridPoint.y = gridPoint.y >> 1;
  }
};


/**
 * Returns whether or not the given point is visible in the shown bounds. This
 * is a helper method that takes care of the corner case, when shownBounds have
 * negative minX value.
 *
 * @param {Point} point a point on a grid.
 * @return {Boolean} Whether or not the given point is visible in the currently
 * shown bounds.
 */
MarkerManager.prototype.isGridPointVisible_ = function (point) {
  var me = this;
  var vertical = me.shownBounds_.minY <= point.y &&
      point.y <= me.shownBounds_.maxY;
  var minX = me.shownBounds_.minX;
  var horizontal = minX <= point.x && point.x <= me.shownBounds_.maxX;
  if (!horizontal && minX < 0) {
    // Shifts the negative part of the rectangle. As point.x is always less
    // than grid width, only test shifted minX .. 0 part of the shown bounds.
    var width = me.gridWidth_[me.shownBounds_.z];
    horizontal = minX + width <= point.x && point.x <= width - 1;
  }
  return vertical && horizontal;
};


/**
 * Reacts to a notification from a marker that it has moved to a new location.
 * It scans the grid all all zoom levels and moves the marker from the old grid
 * location to a new grid location.
 *
 * @param {Marker} marker The marker that moved.
 * @param {LatLng} oldPoint The old position of the marker.
 * @param {LatLng} newPoint The new position of the marker.
 */
MarkerManager.prototype.onMarkerMoved_ = function (marker, oldPoint, newPoint) {
  // NOTE: We do not know the minimum or maximum zoom the marker was
  // added at, so we start at the absolute maximum. Whenever we successfully
  // remove a marker at a given zoom, we add it at the new grid coordinates.
  var me = this;
  var zoom = me.maxZoom_;
  var changed = false;
  var oldGrid = me.getTilePoint_(oldPoint, zoom, GSize.ZERO);
  var newGrid = me.getTilePoint_(newPoint, zoom, GSize.ZERO);
  while (zoom >= 0 && (oldGrid.x !== newGrid.x || oldGrid.y !== newGrid.y)) {
    var cell = me.getGridCellNoCreate_(oldGrid.x, oldGrid.y, zoom);
    if (cell) {
      if (me.removeFromArray_(cell, marker)) {
        me.getGridCellCreate_(newGrid.x, newGrid.y, zoom).push(marker);
      }
    }
    // For the current zoom we also need to update the map. Markers that no
    // longer are visible are removed from the map. Markers that moved into
    // the shown bounds are added to the map. This also lets us keep the count
    // of visible markers up to date.
    if (zoom === me.mapZoom_) {
      if (me.isGridPointVisible_(oldGrid)) {
        if (!me.isGridPointVisible_(newGrid)) {
          me.removeOverlay_(marker);
          changed = true;
        }
      } else {
        if (me.isGridPointVisible_(newGrid)) {
          me.addOverlay_(marker);
          changed = true;
        }
      }
    }
    oldGrid.x = oldGrid.x >> 1;
    oldGrid.y = oldGrid.y >> 1;
    newGrid.x = newGrid.x >> 1;
    newGrid.y = newGrid.y >> 1;
    --zoom;
  }
  if (changed) {
    me.notifyListeners_();
  }
};


/**
 * Removes marker from the manager and from the map
 * (if it's currently visible).
 * @param {GMarker} marker The marker to delete.
 */
MarkerManager.prototype.removeMarker = function (marker) {
  var me = this;
  var zoom = me.maxZoom_;
  var changed = false;
  var point = marker.getPoint();
  var grid = me.getTilePoint_(point, zoom, GSize.ZERO);
  while (zoom >= 0) {
    var cell = me.getGridCellNoCreate_(grid.x, grid.y, zoom);

    if (cell) {
      me.removeFromArray_(cell, marker);
    }
    // For the current zoom we also need to update the map. Markers that no
    // longer are visible are removed from the map. This also lets us keep the count
    // of visible markers up to date.
    if (zoom === me.mapZoom_) {
      if (me.isGridPointVisible_(grid)) {
        me.removeOverlay_(marker);
        changed = true;
      }
    }
    grid.x = grid.x >> 1;
    grid.y = grid.y >> 1;
    --zoom;
  }
  if (changed) {
    me.notifyListeners_();
  }
  me.numMarkers_[marker.MarkerManager_minZoom]--;
};


/**
 * Add many markers at once.
 * Does not actually update the map, just the internal grid.
 *
 * @param {Array of Marker} markers The markers to add.
 * @param {Number} minZoom The minimum zoom level to display the markers.
 * @param {Number} opt_maxZoom The maximum zoom level to display the markers.
 */
MarkerManager.prototype.addMarkers = function (markers, minZoom, opt_maxZoom) {
  var maxZoom = this.getOptMaxZoom_(opt_maxZoom);
  for (var i = markers.length - 1; i >= 0; i--) {
    this.addMarkerBatch_(markers[i], minZoom, maxZoom);
  }

  this.numMarkers_[minZoom] += markers.length;
};


/**
 * Returns the value of the optional maximum zoom. This method is defined so
 * that we have just one place where optional maximum zoom is calculated.
 *
 * @param {Number} opt_maxZoom The optinal maximum zoom.
 * @return The maximum zoom.
 */
MarkerManager.prototype.getOptMaxZoom_ = function (opt_maxZoom) {
  return opt_maxZoom || this.maxZoom_;
};


/**
 * Calculates the total number of markers potentially visible at a given
 * zoom level.
 *
 * @param {Number} zoom The zoom level to check.
 */
MarkerManager.prototype.getMarkerCount = function (zoom) {
  var total = 0;
  for (var z = 0; z <= zoom; z++) {
    total += this.numMarkers_[z];
  }
  return total;
};

/** 
 * Returns a marker given latitude, longitude and zoom. If the marker does not 
 * exist, the method will return a new marker. If a new marker is created, 
 * it will NOT be added to the manager. 
 * 
 * @param {Number} lat - the latitude of a marker. 
 * @param {Number} lng - the longitude of a marker. 
 * @param {Number} zoom - the zoom level 
 * @return {GMarker} marker - the marker found at lat and lng 
 */ 
MarkerManager.prototype.getMarker = function(lat, lng, zoom) { 
  var me = this; 
  var mPoint = new GLatLng(lat, lng); 
  var gridPoint = me.getTilePoint_(mPoint, zoom, GSize.ZERO); 

  var marker = new GMarker(mPoint); 
  var cellArray = me.getGridCellNoCreate_(gridPoint.x, gridPoint.y, zoom); 
  if(cellArray != undefined){ 
    for (var i = 0; i < cellArray.length; i++) 
    { 
      if(lat == cellArray[i].getLatLng().lat() && 
         lng == cellArray[i].getLatLng().lng()) 
      { 
        marker = cellArray[i]; 
      } 
    } 
  } 
  return marker; 
}; 

/**
 * Add a single marker to the map.
 *
 * @param {Marker} marker The marker to add.
 * @param {Number} minZoom The minimum zoom level to display the marker.
 * @param {Number} opt_maxZoom The maximum zoom level to display the marker.
 */
MarkerManager.prototype.addMarker = function (marker, minZoom, opt_maxZoom) {
  var me = this;
  var maxZoom = this.getOptMaxZoom_(opt_maxZoom);
  me.addMarkerBatch_(marker, minZoom, maxZoom);
  var gridPoint = me.getTilePoint_(marker.getPoint(), me.mapZoom_, GSize.ZERO);
  if (me.isGridPointVisible_(gridPoint) &&
      minZoom <= me.shownBounds_.z &&
      me.shownBounds_.z <= maxZoom) {
    me.addOverlay_(marker);
    me.notifyListeners_();
  }
  this.numMarkers_[minZoom]++;
};

/**
 * Returns true if this bounds (inclusively) contains the given point.
 * @param {Point} point  The point to test.
 * @return {Boolean} This Bounds contains the given Point.
 */
GBounds.prototype.containsPoint = function (point) {
  var outer = this;
  return (outer.minX <= point.x &&
          outer.maxX >= point.x &&
          outer.minY <= point.y &&
          outer.maxY >= point.y);
};

/**
 * Get a cell in the grid, creating it first if necessary.
 *
 * Optimization candidate
 *
 * @param {Number} x The x coordinate of the cell.
 * @param {Number} y The y coordinate of the cell.
 * @param {Number} z The z coordinate of the cell.
 * @return {Array} The cell in the array.
 */
MarkerManager.prototype.getGridCellCreate_ = function (x, y, z) {
  var grid = this.grid_[z];
  if (x < 0) {
    x += this.gridWidth_[z];
  }
  var gridCol = grid[x];
  if (!gridCol) {
    gridCol = grid[x] = [];
    return (gridCol[y] = []);
  }
  var gridCell = gridCol[y];
  if (!gridCell) {
    return (gridCol[y] = []);
  }
  return gridCell;
};


/**
 * Get a cell in the grid, returning undefined if it does not exist.
 *
 * NOTE: Optimized for speed -- otherwise could combine with getGridCellCreate_.
 *
 * @param {Number} x The x coordinate of the cell.
 * @param {Number} y The y coordinate of the cell.
 * @param {Number} z The z coordinate of the cell.
 * @return {Array} The cell in the array.
 */
MarkerManager.prototype.getGridCellNoCreate_ = function (x, y, z) {
  var grid = this.grid_[z];
  if (x < 0) {
    x += this.gridWidth_[z];
  }
  var gridCol = grid[x];
  return gridCol ? gridCol[y] : undefined;
};


/**
 * Turns at geographical bounds into a grid-space bounds.
 *
 * @param {LatLngBounds} bounds The geographical bounds.
 * @param {Number} zoom The zoom level of the bounds.
 * @param {GSize} swPadding The padding in pixels to extend beyond the
 * given bounds.
 * @param {GSize} nePadding The padding in pixels to extend beyond the
 * given bounds.
 * @return {GBounds} The bounds in grid space.
 */
MarkerManager.prototype.getGridBounds_ = function (bounds, zoom, swPadding, nePadding) {
  zoom = Math.min(zoom, this.maxZoom_);

  var bl = bounds.getSouthWest();
  var tr = bounds.getNorthEast();
  var sw = this.getTilePoint_(bl, zoom, swPadding);
  var ne = this.getTilePoint_(tr, zoom, nePadding);
  var gw = this.gridWidth_[zoom];

  // Crossing the prime meridian requires correction of bounds.
  if (tr.lng() < bl.lng() || ne.x < sw.x) {
    sw.x -= gw;
  }
  if (ne.x - sw.x  + 1 >= gw) {
    // Computed grid bounds are larger than the world; truncate.
    sw.x = 0;
    ne.x = gw - 1;
  }
  var gridBounds = new GBounds([sw, ne]);
  gridBounds.z = zoom;
  return gridBounds;
};


/**
 * Gets the grid-space bounds for the current map viewport.
 *
 * @return {Bounds} The bounds in grid space.
 */
MarkerManager.prototype.getMapGridBounds_ = function () {
  var me = this;
  return me.getGridBounds_(me.map_.getBounds(), me.mapZoom_, me.swPadding_, me.nePadding_);
};


/**
 * Event listener for map:movend.
 * NOTE: Use a timeout so that the user is not blocked
 * from moving the map.
 *
 */
MarkerManager.prototype.onMapMoveEnd_ = function () {
  var me = this;
  me.objectSetTimeout_(this, this.updateMarkers_, 0);
};


/**
 * Call a function or evaluate an expression after a specified number of
 * milliseconds.
 *
 * Equivalent to the standard window.setTimeout function, but the given
 * function executes as a method of this instance. So the function passed to
 * objectSetTimeout can contain references to this.
 *    objectSetTimeout(this, function () { alert(this.x) }, 1000);
 *
 * @param {Object} object  The target object.
 * @param {Function} command  The command to run.
 * @param {Number} milliseconds  The delay.
 * @return {Boolean}  Success.
 */
MarkerManager.prototype.objectSetTimeout_ = function (object, command, milliseconds) {
  return window.setTimeout(function () {
    command.call(object);
  }, milliseconds);
};


/**
 * Is this layer visible?
 *
 * Returns visibility setting
 *
 * @return {Boolean} Visible
 */
MarkerManager.prototype.visible = function () {
  return this.show_ ? true : false;
};


/**
 * Returns true if the manager is hidden.
 * Otherwise returns false.
 * @return {Boolean} Hidden
 */
MarkerManager.prototype.isHidden = function () {
  return !this.show_;
};


/**
 * Shows the manager if it's currently hidden.
 */
MarkerManager.prototype.show = function () {
  this.show_ = true;
  this.refresh();
};


/**
 * Hides the manager if it's currently visible
 */
MarkerManager.prototype.hide = function () {
  this.show_ = false;
  this.refresh();
};


/**
 * Toggles the visibility of the manager.
 */
MarkerManager.prototype.toggle = function () {
  this.show_ = !this.show_;
  this.refresh();
};


/**
 * Refresh forces the marker-manager into a good state.
 * <ol>
 *   <li>If never before initialized, shows all the markers.</li>
 *   <li>If previously initialized, removes and re-adds all markers.</li>
 * </ol>
 */
MarkerManager.prototype.refresh = function () {
  var me = this;
  if (me.shownMarkers_ > 0) {
    me.processAll_(me.shownBounds_, me.removeOverlay_);
  }
  // An extra check on me.show_ to increase performance (no need to processAll_)
  if (me.show_) {
    me.processAll_(me.shownBounds_, me.addOverlay_);
  }
  me.notifyListeners_();
};


/**
 * After the viewport may have changed, add or remove markers as needed.
 */
MarkerManager.prototype.updateMarkers_ = function () {
  var me = this;
  me.mapZoom_ = this.map_.getZoom();
  var newBounds = me.getMapGridBounds_();

  // If the move does not include new grid sections,
  // we have no work to do:
  if (newBounds.equals(me.shownBounds_) && newBounds.z === me.shownBounds_.z) {
    return;
  }

  if (newBounds.z !== me.shownBounds_.z) {
    me.processAll_(me.shownBounds_, me.removeOverlay_);
    if (me.show_) { // performance
      me.processAll_(newBounds, me.addOverlay_);
    }
  } else {
    // Remove markers:
    me.rectangleDiff_(me.shownBounds_, newBounds, me.removeCellMarkers_);

    // Add markers:
    if (me.show_) { // performance
      me.rectangleDiff_(newBounds, me.shownBounds_, me.addCellMarkers_);
    }
  }
  me.shownBounds_ = newBounds;

  me.notifyListeners_();
};


/**
 * Notify listeners when the state of what is displayed changes.
 */
MarkerManager.prototype.notifyListeners_ = function () {
  GEvent.trigger(this, "changed", this.shownBounds_, this.shownMarkers_);
};


/**
 * Process all markers in the bounds provided, using a callback.
 *
 * @param {Bounds} bounds The bounds in grid space.
 * @param {Function} callback The function to call for each marker.
 */
MarkerManager.prototype.processAll_ = function (bounds, callback) {
  for (var x = bounds.minX; x <= bounds.maxX; x++) {
    for (var y = bounds.minY; y <= bounds.maxY; y++) {
      this.processCellMarkers_(x, y,  bounds.z, callback);
    }
  }
};


/**
 * Process all markers in the grid cell, using a callback.
 *
 * @param {Number} x The x coordinate of the cell.
 * @param {Number} y The y coordinate of the cell.
 * @param {Number} z The z coordinate of the cell.
 * @param {Function} callback The function to call for each marker.
 */
MarkerManager.prototype.processCellMarkers_ = function (x, y, z, callback) {
  var cell = this.getGridCellNoCreate_(x, y, z);
  if (cell) {
    for (var i = cell.length - 1; i >= 0; i--) {
      callback(cell[i]);
    }
  }
};


/**
 * Remove all markers in a grid cell.
 *
 * @param {Number} x The x coordinate of the cell.
 * @param {Number} y The y coordinate of the cell.
 * @param {Number} z The z coordinate of the cell.
 */
MarkerManager.prototype.removeCellMarkers_ = function (x, y, z) {
  this.processCellMarkers_(x, y, z, this.removeOverlay_);
};


/**
 * Add all markers in a grid cell.
 *
 * @param {Number} x The x coordinate of the cell.
 * @param {Number} y The y coordinate of the cell.
 * @param {Number} z The z coordinate of the cell.
 */
MarkerManager.prototype.addCellMarkers_ = function (x, y, z) {
  this.processCellMarkers_(x, y, z, this.addOverlay_);
};


/**
 * Use the rectangleDiffCoords_ function to process all grid cells
 * that are in bounds1 but not bounds2, using a callback, and using
 * the current MarkerManager object as the instance.
 *
 * Pass the z parameter to the callback in addition to x and y.
 *
 * @param {Bounds} bounds1 The bounds of all points we may process.
 * @param {Bounds} bounds2 The bounds of points to exclude.
 * @param {Function} callback The callback function to call
 *                   for each grid coordinate (x, y, z).
 */
MarkerManager.prototype.rectangleDiff_ = function (bounds1, bounds2, callback) {
  var me = this;
  me.rectangleDiffCoords_(bounds1, bounds2, function (x, y) {
    callback.apply(me, [x, y, bounds1.z]);
  });
};


/**
 * Calls the function for all points in bounds1, not in bounds2
 *
 * @param {Bounds} bounds1 The bounds of all points we may process.
 * @param {Bounds} bounds2 The bounds of points to exclude.
 * @param {Function} callback The callback function to call
 *                   for each grid coordinate.
 */
MarkerManager.prototype.rectangleDiffCoords_ = function (bounds1, bounds2, callback) {
  var minX1 = bounds1.minX;
  var minY1 = bounds1.minY;
  var maxX1 = bounds1.maxX;
  var maxY1 = bounds1.maxY;
  var minX2 = bounds2.minX;
  var minY2 = bounds2.minY;
  var maxX2 = bounds2.maxX;
  var maxY2 = bounds2.maxY;

  var x, y;
  for (x = minX1; x <= maxX1; x++) {  // All x in R1
    // All above:
    for (y = minY1; y <= maxY1 && y < minY2; y++) {  // y in R1 above R2
      callback(x, y);
    }
    // All below:
    for (y = Math.max(maxY2 + 1, minY1);  // y in R1 below R2
         y <= maxY1; y++) {
      callback(x, y);
    }
  }

  for (y = Math.max(minY1, minY2);
       y <= Math.min(maxY1, maxY2); y++) {  // All y in R2 and in R1
    // Strictly left:
    for (x = Math.min(maxX1 + 1, minX2) - 1;
         x >= minX1; x--) {  // x in R1 left of R2
      callback(x, y);
    }
    // Strictly right:
    for (x = Math.max(minX1, maxX2 + 1);  // x in R1 right of R2
         x <= maxX1; x++) {
      callback(x, y);
    }
  }
};


/**
 * Removes value from array. O(N).
 *
 * @param {Array} array  The array to modify.
 * @param {any} value  The value to remove.
 * @param {Boolean} opt_notype  Flag to disable type checking in equality.
 * @return {Number}  The number of instances of value that were removed.
 */
MarkerManager.prototype.removeFromArray_ = function (array, value, opt_notype) {
  var shift = 0;
  for (var i = 0; i < array.length; ++i) {
    if (array[i] === value || (opt_notype && array[i] === value)) {
      array.splice(i--, 1);
      shift++;
    }
  }
  return shift;
};

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/google/map/markermanager.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/google/map/markermanager.js');
/** ************************************************************
	Ext.ux.TinyMCE v0.6
	ExtJS form field containing TinyMCE v3.
	
	Author: Andrew Mayorov (http://blogs.byte-force.com/xor)
	Copyright (c)2008 BYTE-force
	www.byte-force.com
	
	License: LGPLv2.1 or later
*/

(function() {

	Ext.namespace( "Ext.ux" );
	
	var tmceInitialized = false;
	
	/** ----------------------------------------------------------
		Ext.ux.TinyMCE
	*/        
	Ext.ux.TinyMCE = Ext.extend( 

		// Constructor
		function( cfg ){
		
			var config = {
				tinymceSettings: {
					accessibility_focus : false
				}
			};
			
			Ext.apply( config, cfg );

			// Add events
			this.addEvents({
				"editorcreated": true
			});
			
			Ext.ux.TinyMCE.superclass.constructor.call( this, config );
		},
		
		// Base class
		Ext.form.Field,
		
		// Members
		{
			
			// TinyMCE Settings specified for this instance of the editor.
			tinymceSettings: null,
			
			// HTML markup for this field
			defaultAutoCreate: { tag: "div", style: { overflow: "hidden" }, children: [{ tag: "textarea" }] },
			
			// Default width
			width: 200,
			
			// Default height
			height: 200,
			
			/** ----------------------------------------------------------
			*/        
			initComponent: function(){
				this.tinymceSettings = this.tinymceSettings || {};
				Ext.ux.TinyMCE.initTinyMCE({ language: this.tinymceSettings.language });
			},
			
			/** ----------------------------------------------------------
			*/        
			onRender : function( ct, position ){ 
				Ext.ux.TinyMCE.superclass.onRender.call( this, ct, position );
				
				var self = this;
				
				// Fix size if it was specified in config
				var el = this.getEl();
				if( Ext.type( this.width ) == "number" ) {
					el.setWidth( this.width );
					this.tinymceSettings.width = this.width;
				}
				if( Ext.type( this.height ) == "number" ) {
					el.setHeight( this.height );
					this.tinymceSettings.height = this.height;
				}

				// Fetch reference to <textarea> element
				var textarea = el.child( "textarea" );
				this.textareaEl = textarea;
				if( this.name ) textarea.set({ name: this.name });
				var id = textarea.id;
				
				// Create TinyMCE editor.
				this.ed = new tinymce.Editor( id, this.tinymceSettings );
				
				this.ed.onBeforeRenderUI.add( function( ed, controlManager ){
					// Replace control manager
					ed.controlManager = new ControlManager( this, ed );
				}.createDelegate( this ));

				this.ed.onPostRender.add( function( ed, controlManager ){
					// Change window manager
					ed.windowManager = new WindowManager( this.ed );
				}.createDelegate( this ));
				
				// Set event handler on editor init.
				this.ed.onInit.add( function(){
					// Modify markup.
					var tbar = Ext.get( Ext.DomQuery.selectNode( "#" + this.ed.id + "_tbl td.mceToolbar" ));
					var tbars = tbar.select( "> table.mceToolbar" );
					Ext.DomHelper.append( 
						tbar, 
						{ tag: "div", style: { overflow: "hidden" }}, true 
					)
					.appendChild( tbars );
				}.createDelegate( this ));
				
				// Bind to editor focus
				//this.ed.onActivate.add( this.focus.createDelegate( this, [ false, false ], false ));
				
				// Render the editor
				this.ed.render();
				tinyMCE.add( this.ed );
				
				
				// Indicate that editor is created
				this.fireEvent( "editorcreated" );
			},
			
			/** ----------------------------------------------------------
			     * Returns the name attribute of the field if available
			     * @return {String} name The field name
			*/
			getName: function(){
				return this.rendered && this.textareaEl.dom.name ? this.textareaEl.dom.name : (this.name || '');
			},
		 			
			/** ----------------------------------------------------------
			*/        
			initValue : function(){
			
				if( this.value !== undefined )
				{
					this.setValue( this.value );
				}
				else 
				{
					var textarea = this.getEl().child( "textarea", true );
					if( textarea.value.length > 0 )
						this.setValue( textarea.value );
				}
			},

			/** ----------------------------------------------------------
			*/
			beforeDestroy: function() {
				if( this.ed ) tinyMCE.remove( this.ed );
				Ext.ux.TinyMCE.superclass.beforeDestroy.call(this);
			},
			
			/** ----------------------------------------------------------
			*/        
			getValue : function(){
			
				if( !this.rendered || !this.ed.initialized ) 
					return this.value;

				var v = this.ed.getContent();
				if( v === this.emptyText || v === undefined ){
					v = '';
				}
				return v;
			},

			/** ----------------------------------------------------------
			*/        
			setValue : function( v ){
				this.value = v;
				if( this.rendered )
					this.withEd( function(){
						this.ed.undoManager.clear();
						this.ed.setContent( v === null || v === undefined ? '' : v );
						this.ed.startContent = this.ed.getContent({ format : 'raw' });						
						this.validate();
					});
			},
			
			/** ----------------------------------------------------------
			*/        
			isDirty : function() {
			    if( this.disabled || !this.rendered ) {
			        return false;
			    }
			    return this.ed.isDirty();
			},

			/** ----------------------------------------------------------
			*/        
			syncValue : function(){
				if( this.rendered && this.ed.initialized )
					this.ed.save();
			},
			
			/** ----------------------------------------------------------
			*/        
			getEd: function() {
				return this.ed;
			},
			
			/** ----------------------------------------------------------
			*/        
			onResize : function( aw, ah ){
				if( this.rendered ){
					this.withEd( function() {
					
						if( Ext.type( aw ) != "number" ) aw = this.el.getWidth();
						if( Ext.type( ah ) != "number" ) ah = this.el.getHeight();
						
						this.ed.theme.resizeTo( aw, ah );
					});
				}
			},
			
			/** ----------------------------------------------------------
			*/        
			focus: function( selectText, delay ){
				Ext.ux.TinyMCE.superclass.focus.call( this, selectText, delay );
			},
			
			/** ----------------------------------------------------------
			*/        
			onFocus : function(){
				if(!this.hasFocus){
					this.hasFocus = true;
					this.startValue = this.getValue();
					this.withEd( function() {
						this.ed.focus();
						this.fireEvent("focus", this);
					});
				}
			}, 

			/** ----------------------------------------------------------
				If ed (local editor instance) is already initilized, calls
				specified function directly. Otherwise - adds it to ed.onInit event.
			*/        
			withEd: function( func ){
			
				// If editor is not created yet, reschedule this call.
				if( !this.ed ) this.on( 
					"editorcreated", 
					function() { this.withEd( func ) }, 
					this );

				// Else if editor is created and initialized
				else if( this.ed.initialized ) func.call( this );
				
				// Else if editor is created but not initialized yet.
				else this.ed.onInit.add( function(){ func.defer( 10, this ); }.createDelegate( this ));
			}

		}
	);

	// Add static members
	Ext.apply( Ext.ux.TinyMCE, {
	
		/**
			Static field with all the plugins that should be loaded by TinyMCE.
			Should be set before first component would be created.
			@static
		*/
		tinymcePlugins: "safari,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
		
		initTinyMCE: function( settings ) {
			if( !tmceInitialized ){
			
				var s = {
					mode : "none",
					plugins : Ext.ux.TinyMCE.tinymcePlugins,
					theme: "advanced"
				};
				Ext.apply( s, settings );
			
				tinyMCE.init( s );
				tmceInitialized = true;
			}
		}
	});

	Ext.ComponentMgr.registerType( "tinymce", Ext.ux.TinyMCE );
	
	
	/** ----------------------------------------------------------
		WindowManager
	*/        
	var WindowManager = Ext.extend( 
	
		function( editor ) {
			WindowManager.superclass.constructor.call( this, editor );
		},
		
		tinymce.WindowManager,
		
		{
			// Override WindowManager methods
			alert : function( txt, cb, s ) {
				Ext.MessageBox.alert( "", txt, function() { cb.call( this ); }, s );
			},
			
			confirm : function( txt, cb, s ) {
				Ext.MessageBox.confirm( "", txt, function( btn ) { cb.call( this, btn == "yes" ); }, s );
			},
			
			open : function( s, p ) {
				
				s = s || {};
				p = p || {};
				
				if ( !s.type )
					this.bookmark = this.editor.selection.getBookmark( 'simple' );
				
				s.width = parseInt(s.width || 320);
				s.height = parseInt(s.height || 240) + (tinymce.isIE ? 8 : 0);
				s.min_width = parseInt(s.min_width || 150);
				s.min_height = parseInt(s.min_height || 100);
				s.max_width = parseInt(s.max_width || 2000);
				s.max_height = parseInt(s.max_height || 2000);
				s.movable = s.resizable = true;
				p.mce_width = s.width;
				p.mce_height = s.height;
				p.mce_inline = true;

				this.features = s;
				this.params = p;
						
				var win = new Ext.Window(
				{
					title: s.name,
					width: s.width,
					height: s.height,
					minWidth: s.min_width,
					minHeight: s.min_height,
					resizable: true,
					maximizable: s.maximizable == true,
					minimizable: s.minimizable == true,
					modal: true,
					layout: "fit",
					items: [
					{
						xtype: "iframepanel",
						defaultSrc: s.url || s.file
					}
					]
				});
				
				p.mce_window_id = win.getId();
				
				win.show( null,
					function() {
						if( s.left && s.top ) 
							win.setPagePosition( s.left, s.top );
						var pos = win.getPosition();
						s.left = pos[0];
						s.top = pos[1];
						this.onOpen.dispatch( this, s, p );
					},
					this
				);
				
				return win;
			},
			
			close : function( win ) {
			
				// Probably not inline
				if( !win.tinyMCEPopup || !win.tinyMCEPopup.id ) {
					WindowManager.superclass.close.call( this, win );
					return;
				}
					
				var w = Ext.getCmp( win.tinyMCEPopup.id );
				if( w ) {
					this.onClose.dispatch( this );
					w.close();
				}					
			},
			
			setTitle : function( win, ti ) {
			
				// Probably not inline
				if( !win.tinyMCEPopup || !win.tinyMCEPopup.id ) {
					WindowManager.superclass.setTitle.call( this, win, ti );
					return;
				}
				
				var w = Ext.getCmp( win.tinyMCEPopup.id );
				if( w ) w.setTitle( ti );
			},

			resizeBy : function( dw, dh, id ) {
			
				var w = Ext.getCmp( id );
				if( w ) {
					var size = w.getSize();
					w.setSize( size.width + dw, size.height + dh );
				}
			},
			
			focus : function(id) {
				var w = Ext.getCmp( id );
				if( w ) w.setActive( true );
			}
			
		}
	);

	/** ----------------------------------------------------------
		ControlManager
	*/        
	var ControlManager = Ext.extend( 
	
		// Constructor
		function( control, ed, s ) {
			this.control = control;
			ControlManager.superclass.constructor.call( this, ed, s );
		},
		
		// Base class
		tinymce.ControlManager,
	
		// Members
		{
			// Reference to ExtJS control Ext.ux.TinyMCE.
			control: null,
			
			createDropMenu: function( id, s ){
				// Call base method
				var res = ControlManager.superclass.createDropMenu.call( this, id, s );
				
				// Modify returned result
				//var self = this;
				var orig = res.showMenu;
				res.showMenu = function( x, y, px ) {
					orig.call( this, x, y, px );
					//var zi = self.control.getEl().getStyle( "z-index" );
					Ext.fly( 'menu_' + this.id ).setStyle( "z-index", 200001 );
				}
				
				return res;
			},
			
			createColorSplitButton: function( id, s ){
				// Call base method
				var res = ControlManager.superclass.createColorSplitButton.call( this, id, s );
				
				// Modify returned result
				var orig = res.showMenu;
				res.showMenu = function( x, y, px ) {
					orig.call( this, x, y, px );
					Ext.fly( this.id + '_menu' ).setStyle( "z-index", 200001 );
				}
				
				return res;
			}
		}
	);
	
}());

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/tools/extjs/ext/ux/TinyMCE/Ext.ux.TinyMCE.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/tools/extjs/ext/ux/TinyMCE/Ext.ux.TinyMCE.js');
namespace('nnet');

nnet.Log = $j.klass({
    initialize: function(enable) {
        this.Enabled = enable;
        this.Window = null;
    },

    exp: function(msg, e) {
        if (this.Enabled) {
            if (typeof (e) == 'string') this.msg(msg + ' : ' + e);
            else this.msg(msg + ' : ' + e.name + ' : ' + e.message);
        }
        throw e;
    },
    
    
    msg: function(msg) {
        if (this.Enabled) {
            if (!this.Window || this.Window.closed) {
                this.Window = window.open("", null, "width=400,height=200," +
                                      "scrollbars=yes,resizable=yes,status=no," +
                                      "location=no,menubar=no,toolbar=no");
                if (!this.Window) return;
                var doc = this.Window.document;
                doc.write("<html><head><title>Debug Log</title></head>" +
                          "<body></body></html>");
                doc.close();
            }
            var logLine = this.Window.document.createElement("div");
            logLine.appendChild(this.Window.document.createTextNode(msg));
            this.Window.document.body.appendChild(logLine);
        }
    }
    

});

//var NLog = new nnet.Log(sVars.JavaScriptLogging);
var Log = new nnet.Log(true);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/logging-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/logging-0-0.js');
namespace('nnet');
// *************************************
// Global Events
// *************************************
// Page dom fully formed. 
nnet.onPageReady = new YAHOO.util.CustomEvent("nnet.onPageReady");

// Fired after all included page javascript has run, at the beginning of the post set of 
// javascript files, the telerik init should have run. 
nnet.onPageObjectsInitialised = new YAHOO.util.CustomEvent("nnet.onPageObjectsInitialised");
nnet.onOptionsToolBarInitialised = new YAHOO.util.CustomEvent("nnet.onOptionsToolBarInitialised");

var onPageResize = new YAHOO.util.CustomEvent("onPageResize");

// User Events
var onLogIn = new YAHOO.util.CustomEvent("onLogIn");
var onLogOut = new YAHOO.util.CustomEvent("onLogOut");
var onShoppingCart = new YAHOO.util.CustomEvent("onShoppingCart");

// Application Events
nnet.onApplicationActivated = new YAHOO.util.CustomEvent("nnet.onApplicationActivated");
nnet.onApplicationChanged = new YAHOO.util.CustomEvent("nnet.onApplicationChanged");


// Refreshevents
var onRefreshContent = new YAHOO.util.CustomEvent("onRefreshContent");
var onRefreshNavigation = new YAHOO.util.CustomEvent("onRefreshNavigation");

// *************************************
// Convert External Global Events to internal Events
// *************************************

YAHOO.util.Event.onDOMReady(
    function() {
        try {
            nnet.onPageReady.fire();
        } catch (e) { logE("Global - onDOMReady", e); }
    }
);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/events-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/events-0-0.js');
var BrowserDetect = {
    init: function() {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function(data) {
        for (var i = 0; i < data.length; i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function(dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
		{
		    string: navigator.userAgent,
		    subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
		{
		    string: navigator.platform,
		    subString: "Win",
		    identity: "Windows"
		},
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init(); 
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/browser-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/browser-0-0.js');
/*
* Ext JS Library 2.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/

Ext.ux.Portlet = Ext.extend(Ext.Panel, {
    anchor: '100%',
    frame: true,
    collapsible: true,
    draggable: true,
    margin: 5,
    cls: 'x-portlet'
});
Ext.reg('portlet', Ext.ux.Portlet);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/portal/Portlet.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/portal/Portlet.js');
/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.ux.PortalColumn = Ext.extend(Ext.Container, {
    layout: 'anchor',
    autoEl: 'div',
    defaultType: 'portlet',
    cls:'x-portal-column'
});
Ext.reg('portalcolumn', Ext.ux.PortalColumn);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/portal/PortalColumn.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/portal/PortalColumn.js');
/*
* Ext JS Library 2.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/

Ext.ux.Portal = Ext.extend(Ext.Panel, {
    layout: 'column',
    autoScroll: true,
    cls: 'x-portal',
    defaultType: 'portalcolumn',

    initComponent: function() {
        Ext.ux.Portal.superclass.initComponent.call(this);
        this.addEvents({
            validatedrop: true,
            beforedragover: true,
            dragover: true,
            beforedrop: true,
            drop: true
        });
    },

    initEvents: function() {
        Ext.ux.Portal.superclass.initEvents.call(this);
        this.dd = new Ext.ux.Portal.DropZone(this, this.dropConfig);
    },

    beforeDestroy: function() {
        if (this.dd) {
            this.dd.unreg();
        }
        Ext.ux.Portal.superclass.beforeDestroy.call(this);
    }
});
Ext.reg('portal', Ext.ux.Portal);


Ext.ux.Portal.DropZone = function(portal, cfg) {
    this.portal = portal;
    Ext.dd.ScrollManager.register(portal.body);
    Ext.ux.Portal.DropZone.superclass.constructor.call(this, portal.bwrap.dom, cfg);
    portal.body.ddScrollConfig = this.ddScrollConfig;
};

Ext.extend(Ext.ux.Portal.DropZone, Ext.dd.DropTarget, {
    ddScrollConfig: {
        vthresh: 50,
        hthresh: -1,
        animate: true,
        increment: 200
    },

    createEvent: function(dd, e, data, col, c, pos) {
        return {
            portal: this.portal,
            panel: data.panel,
            columnIndex: col,
            column: c,
            position: pos,
            data: data,
            source: dd,
            rawEvent: e,
            status: this.dropAllowed
        };
    },

    notifyOver: function(dd, e, data) {
        var xy = e.getXY(), portal = this.portal, px = dd.proxy;

        // case column widths
        if (!this.grid) {
            this.grid = this.getGrid();
        }

        // handle case scroll where scrollbars appear during drag
        var cw = portal.body.dom.clientWidth;
        if (!this.lastCW) {
            this.lastCW = cw;
        } else if (this.lastCW != cw) {
            this.lastCW = cw;
            portal.doLayout();
            this.grid = this.getGrid();
        }

        // determine column
        var col = 0, xs = this.grid.columnX, cmatch = false;
        for (var len = xs.length; col < len; col++) {
            if (xy[0] < (xs[col].x + xs[col].w)) {
                cmatch = true;
                break;
            }
        }
        // no match, fix last index
        if (!cmatch) {
            col--;
        }

        // find insert position
        var p, match = false, pos = 0,
            c = portal.items.itemAt(col),
            items = c.items.items;

        for (var len = items.length; pos < len; pos++) {
            p = items[pos];
            var h = p.el.getHeight();
            if (h !== 0 && (p.el.getY() + (h / 2)) > xy[1]) {
                match = true;
                break;
            }
        }

        var overEvent = this.createEvent(dd, e, data, col, c,
                match && p ? pos : c.items.getCount());

        if (portal.fireEvent('validatedrop', overEvent) !== false &&
           portal.fireEvent('beforedragover', overEvent) !== false) {

            // make sure proxy width is fluid
            px.getProxy().setWidth('auto');

            if (p) {
                px.moveProxy(p.el.dom.parentNode, match ? p.el.dom : null);
            } else {
                px.moveProxy(c.el.dom, null);
            }

            this.lastPos = { c: c, col: col, p: match && p ? pos : false };
            this.scrollPos = portal.body.getScroll();

            portal.fireEvent('dragover', overEvent);

            return overEvent.status; ;
        } else {
            return overEvent.status;
        }

    },

    notifyOut: function() {
        delete this.grid;
    },

    notifyDrop: function(dd, e, data) {
        delete this.grid;
        if (!this.lastPos) {
            return;
        }
        var c = this.lastPos.c, col = this.lastPos.col, pos = this.lastPos.p;

        var dropEvent = this.createEvent(dd, e, data, col, c,
                pos !== false ? pos : c.items.getCount());

        if (this.portal.fireEvent('validatedrop', dropEvent) !== false &&
           this.portal.fireEvent('beforedrop', dropEvent) !== false) {

            dd.proxy.getProxy().remove();
            dd.panel.el.dom.parentNode.removeChild(dd.panel.el.dom);
            if (pos !== false) {
                c.insert(pos, dd.panel);
            } else {
                c.add(dd.panel);
            }

            c.doLayout();

            this.portal.fireEvent('drop', dropEvent);

            // scroll position is lost on drop, fix it
            var st = this.scrollPos.top;
            if (st) {
                var d = this.portal.body.dom;
                setTimeout(function() {
                    d.scrollTop = st;
                }, 10);
            }

        }
        delete this.lastPos;
    },

    // internal cache of body and column coords
    getGrid: function() {
        var box = this.portal.bwrap.getBox();
        box.columnX = [];
        this.portal.items.each(function(c) {
            box.columnX.push({ x: c.el.getX(), w: c.el.getWidth() });
        });
        return box;
    },

    // unregister the dropzone from ScrollManager
    unreg: function() {
        //Ext.dd.ScrollManager.unregister(this.portal.body);
        Ext.ux.Portal.DropZone.superclass.unreg.call(this);
    }
});

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/portal/Portal.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/portal/Portal.js');
namespace('nnet');

nnet.PopUpWindow = Ext.extend(Ext.Window, {
    minWidth: 200,
    minHeight: 100,
    url: "",
    titlePrefix: "",
    closable: true,
    maximizable: false,
    width: 500,
    height: 600,

    initComponent: function() {
        // if require height is more than window height adjust
        browserHeight = $j(window).height();
        if (browserHeight < this.height) this.height = browserHeight - 25;
        var winId = (new Date()).getTime().toString();
        var taggedURL = this.url + (this.url.indexOf('?') == -1 ? "?" : "&") + "WID=" + winId;
        Ext.apply(this, {
            closable: this.closable,
            maximizable: this.maximizable,
            id: winId,
            height: this.height,
            width: this.width,
            layout: 'fit',
            items: [{
                xtype: 'iframepanel',
                id: "f" + winId,
                layout: 'fit',
                defaultSrc: taggedURL,
                loadMask: { msg: 'Loading. Please wait...' },
                listeners: { documentloaded: function() { this.ownerCt.setTitleFromDocument(this), this.ownerCt.resize(this) } }
}]
            });

            if (this.onClose) this.addListener("close", this.onClose);


            // Call parent (required)
            nnet.PopUpWindow.superclass.initComponent.apply(this, arguments);

            // After parent code
            // e.g. install event handlers on rendered component
        },

        setTitleFromDocument: function(iframe) {
            this.setTitle(this.titlePrefix + iframe.getFrameDocument().title);
        },

        resize: function(iframe) {
            try {
                //calc current offsets for Window body border and padding
                var iframeContents = iframe.getFrameBody();
                if (iframeContents != null) {
                    var maxHeight = $j(window).height() - 25;
                    var heightAdjust = 15;
                    if (BrowserDetect.browser == "Firefox") heightAdjust = 40;
                    var requiredWidth = iframe.getFrameBody().scrollWidth + this.getFrameWidth() + 10;
                    var requiredHeight = iframe.getFrameBody().scrollHeight + this.getFrameHeight() + heightAdjust;
                    var height = requiredHeight > maxHeight ? maxHeight : (requiredHeight < this.minHeight ? this.minHeight : requiredHeight);
                    var width = requiredWidth > this.minWidth ? requiredWidth : this.minWidth;
                    this.setSize(width, height);
                }
            } catch (e) { logE("NNet.PopUpWindow.resize", e); }
        }
    })

nnet.PopUpWindow.resizeFromPopup = function(winId) {
    iframe = Ext.getCmp("f" + winId);
    win = iframe.ownerCt;
    win.resize(iframe);
};

// Not working, need to find reference to iframe in iframe object to call refresh.
// called by parent.nnet.PopUpWindow.refreshAll();
nnet.PopUpWindow.refreshAll = function() {
    Ext.WindowMgr.each(function(win) {
        iframe = win.body.dom.children[0];
        iframe.Refresh();
    });
};

Ext.reg('popupwindowxtype', nnet.PopUpWindow);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/framework/popup-window-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/framework/popup-window-0-0.js');
namespace('nnet');

nnet.Help = $j.klass({
    initialize: function() {
    },

    show: function(config) {
        try {
            var url = "";
            if (config.url) url = config.url;
            else if (config.id) url = '/Help/'+config.id;
            else if (config.uri) url = config.uri;

            var win = new nnet.PopUpWindow({ url: url, minWidth: 500});
            win.show();
        } catch (e) { logE("nnet.Help.show : " + url, e); }
    },

    edit: function(config) {
        try {
            var url = "";
            if (config.id) url = 'Help/Edit/' + config.id;
            //else if (config.uri) url = '/Common/Help/Viewer?URI=' + config.uri;

            var win = new nnet.PopUpWindow({ url: url, minWidth: 600 });
            win.show();
        } catch (e) { logE("nnet.Help.show : " + url, e); }
    }

});


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/help-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/help-0-0.js');
namespace('nnet');

nnet.Page = $j.klass({
    initialize: function() {
        this.Title = null;
        this.Description = null;
        //this.Header = null;
        nnet.onApplicationChanged.subscribe(
            function(type, args, me) {
                try {
                    me.setTitle(args[0].PageTitle);
                } catch (e) { logE("Page.onApplicationActivated handler", e); }
            }, this
        );
    },

    setTitle: function(title) {
        if (title != undefined) {
            this.Title = title;
            document.title = title;
        } else {
            this.Title = sVars.DefaultTitle;
            document.title = this.Title;
        }
    },

    setDescription: function(description) {
        if (description != undefined) {
            this.Description = description;
            $j("meta[name=Description]").attr("content", description);
        } else {
            this.Description = sVars.DefaultDescription;
            $j("meta[name=Description]").attr("content", this.Description);
        }
    }
});


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/page-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/page-0-0.js');
namespace('nnet.prop.sale');

nnet.HeaderLogin = Ext.extend(Ext.FormPanel, {

    MinPrice: 0,
    MaxPrice: 100000000,

    initComponent: function() {
        try {
            Ext.apply(this, {
                labelWidth: 70, // label settings here cascade unless overridden
                bodyStyle: 'background:transparent;padding:3px;',
                border: false,
                //layoutConfig: 'fit',
                //autoHeight: false,
                defaultType: 'textfield',
                monitorValid: true,
                url: '/Security/Handler.ashx',
                items: [{
                    fieldLabel: 'Email Address',
                    tooltip: 'Please enter your username to login',
                    width: 150,
                    vtype: 'email',
                    validationDelay: 500,
                    allowBlank: false,
                    itemCls: 'no-margin',
                    style: 'background-color:pink; font-size: 0.95em; height:1em; line-height: 1em; margin-bottom: 0px;',
                    labelStyle: 'color: rgb(128, 191, 255);font-size: 0.95em; width: 80px;',
                    //height: '1.1em',
                    anchor: '100%',
                    name: 'Username'
                }, {
                    fieldLabel: 'Password',
                    inputType: 'password',
                    width: 100,
                    itemCls: 'no-margin',
                    style: 'background-color:pink; font-size: 0.95em;  height:1em; line-height: 1em; margin-bottom: 0px;',
                    labelStyle: 'color: rgb(128, 191, 255);font-size: 0.95em; width: 80px;',
                    //height: '1.1em',
                    tooltip: 'Password, Leave blank if no password',
                    anchor: '100%',
                    name: 'Password'
                }, {
                    id: 'password-msg',
                    xtype: 'box',
                    hidden: true,
                    autoEl: { tag: 'span', html: '<a href="#" onclick="CurrentUser.passwordReset();" >Forgotten Password ?</a>' },
                    style: 'color: white;font-size: 0.7em; position: absolute; top:27px; right: 40px;',
                    listeners: { scope: this, render: this.onRenderMsg }
                }, {
                    id: 'logon-msg',
                    xtype: 'box',
                    autoEl: { tag: 'span' },
                    style: 'font-size: 0.7em;',
                    listeners: { scope: this, render: this.onRenderMsg }
}],
                    buttons: [{
                        text: 'Login',
                        style: 'font: 0.8em Verdana, Geneva, Arial, Helvetica, sans-serif;',
                        formBind: true,
                        scope: this,
                        handler: this.submit,
                        listeners: { render: this.onRenderButton }
}]
                    });
                    nnet.HeaderLogin.superclass.initComponent.call(this, arguments);
                    this.PasswordMsg = Ext.getCmp('password-msg');
                    this.addEvents('hideLogin');
                } catch (e) { Log.exp("prop.sale.Search.initComponent", e); }
            },

            onRender: function() {
                nnet.HeaderLogin.superclass.onRender.apply(this, arguments);
                this.footer.setStyle({
                    'right': '17px', 'width': '90px', 'position': 'absolute', 'top': '-6px'
                });
                // set wait message target
                //this.getForm().waitMsgTarget = this.getEl();
            },

            onRenderMsg: function(comp) {
                this.Msg = comp;
            },

            onRenderButton: function() {
                this.el.setWidth(45);
            },

            display: function() {
                this.hideErrorMsg();
            },

            submit: function() {
                //this.Waiting.el.show();
                this.showLoggingOnMsg(true);
                var values = this.form.getValues();

                // this.form.fff();
                this.form.submit({
                    url: '/Security/Handler.ashx',
                    params: { 'Parm1': JSON.serialize(values.Username), 'Parm2': JSON.serialize(values.Password), CallbackMethod: 'Logon2', CallbackParmCount: 2, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' },
                    scope: this,
                    success: this.onSuccess,
                    failure: this.onFailure

                });
            },

            onSuccess: function(form, action) {
                onLogIn.fire(action.result);
                this.showLoggingOnMsg(false);
            },

            onFailure: function(form, action) {
                this.showLoggingOnMsg(false);

                if (action.result) {  // Then error resorted by server as success is false
                    if (action.result.AuthenticationFailed) {
                        this.showErrorMsg('Could not login, username or password invalid.');
                        this.PasswordMsg.setVisible(true);
                    } else if (action.result.SiteAuthenticationFailed) {
                        this.fireEvent('hideLogin');
                        CurrentUser.showSiteSignUp();
                    }
                } else {
                    switch (action.failureType) {
                        case Ext.form.Action.CLIENT_INVALID:
                            Ext.Msg.alert("Failure", "Form fields may not be submitted with invalid values");
                            break;
                        case Ext.form.Action.CONNECT_FAILURE:
                            var response = Ext.decode(action.response.responseText);
                            if (response) {
                                if (response.isCallbackError) Ext.MessageBox.alert('Error', 'Form submit failed with error: ' + response.message);
                                else if (response.msg) Ext.MessageBox.alert('Error', 'Form submit failed with error: ' + response.msg);
                            } else Ext.Msg.alert("Failure", "Ajax communication failed");
                            break;
                        case Ext.form.Action.SERVER_INVALID:
                            Ext.Msg.alert("Failure", action.result.msg);
                    }
                }
            },

            showLoggingOnMsg: function(show) {
                this.Msg.el.update('Logging On......');
                this.Msg.removeClass('red');
                this.Msg.addClass('white');
                this.PasswordMsg.setVisible(!show);
                this.Msg.setVisible(show);
            },

            showErrorMsg: function(msg) {
                this.Msg.el.update(msg);
                this.Msg.removeClass('white');
                this.Msg.addClass('red');
                this.Msg.setVisible(true);
            },

            hideErrorMsg: function() {
                this.Msg.el.update('');
                this.Msg.removeClass('white');
                this.Msg.removeClass('red');
                this.Msg.setVisible(false);
                this.PasswordMsg.setVisible(false);
            }
        });
        Ext.reg('header-login', nnet.HeaderLogin);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/header-login-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/header-login-0-0.js');
namespace('nnet');

nnet.HeaderLoginPanel = Ext.extend(Ext.Container, {

    initComponent: function() {
        Ext.apply(this, {
            autoWidth: true,
            autoEl: { tag: 'div' },
            items: [{
                xtype: 'container',
                id: 'header-login-form-container',
                autoEl: { tag: 'div' },
                items: [{
                    xtype: 'header-login',
                    id: 'header-login-form',
                    listeners: { scope: this, hideLogin: function() { this.fireEvent('collapse'); } }
                }]
            }, {
                xtype: 'box',
                id: 'option-collapse',
                autoEl: {
                    tag: 'div',
                    qtip: 'Collapse login panel',
                    children: [{
                        tag: 'a',
                        href: '#'
                    }]
                },
                listeners: {
                    render: function(c) {
                        c.getEl().on({ 'click': function() { c.ownerCt.fireEvent('collapse'); } });
                    }
                }
            }, {
                xtype: 'box',
                id: 'LeftExpandedOptionImage',
                autoEl: { tag: 'img', src: 'http://img5.neighbournet.com/resource/image/nnet/header/options-expanded-left.gif' }
            }, {
                xtype: 'box',
                id: 'RightExpandedOptionImage',
                autoEl: { tag: 'img', src: 'http://img4.neighbournet.com/resource/image/nnet/header/options_right.gif' }
            }]
        });
        nnet.HeaderLoginPanel.superclass.initComponent.call(this, arguments);
        this.addEvents('collapse');
        this.LoginForm = Ext.getCmp('header-login-form');
    },
        
    show: function() {
        nnet.HeaderLoginPanel.superclass.show.call(this, arguments);
        this.LoginForm.display();
    }

});
Ext.reg('header-login-panel', nnet.HeaderLoginPanel);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/header-login-panel-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/header-login-panel-0-0.js');
namespace('nnet');

nnet.HeaderToolBar = Ext.extend(Ext.Container, {

    initComponent: function() {
        Ext.apply(this, {
            autoWidth: true,
            autoEl: { tag: 'div' },
            items: [{
                xtype: 'toolbar',
                id: 'header-toolbar',
                style: 'border:0;',
                listeners: { scope: this, render: this.onRenderToolbar }
            }, {
                xtype: 'box',
                id: 'LeftOptionImage',
                autoEl: { tag: 'img', src: 'http://img1.neighbournet.com/resource/image/nnet/header/options-left-small.gif' }
            }, {
                xtype: 'box',
                id: 'RightOptionImage',
                autoEl: { tag: 'img', src: 'http://img4.neighbournet.com/resource/image/nnet/header/options_right.gif' }
            }]

        });
        nnet.HeaderToolBar.superclass.initComponent.call(this, arguments);

        this.addEvents('requestLogin', 'requestLogout', 'requestSignup');

        this.ToolBarContainer = Ext.getCmp(this.id);
        //this.ToolBar.add(this.HelpButton);
    },

    onRenderToolbar: function(toolbar){
        this.ToolBar = toolbar;

        this.HelpButton = new Ext.Toolbar.Button({
            text: 'HELP',
            tooltip: '<b>Help</b><br/>Displays help for current operation',
            handler: this.onHelpButtonClick
        });
        this.LogonButton = new Ext.Toolbar.Button({
            text: 'LOGON',
            hidden: true,
            tooltip: '<b>Login</b><br/>Logon to the website',
            listeners: { scope: this, click: function() {this.fireEvent('requestLogin'); }}
        });
        this.LogoutButton = new Ext.Toolbar.Button({
            text: 'LOGOUT',
            hidden: true,
            tooltip: '<b>Logout</b><br/>Logout from the website',
            handler: this.onLogoutButtonClick
        });
        this.SignUpButton = new Ext.Toolbar.Button({
            text: 'SIGNUP',
            hidden: true,
            tooltip: '<b>Sign up as member</b><br/>Register as a member of this website to allow you to give feedback and enter and edit services',
            handler: this.onSignUpButtonClick
        });

        this.Separator = new Ext.Toolbar.Separator({ hidden: true });

        toolbar.add(this.LogoutButton, this.LogonButton,this.Separator, this.SignUpButton, '-', this.HelpButton);
        this.showButtons();

        toolbar.getEl().select(".x-btn-text").setStyle({ "color": "rgb(128, 191, 255)" });
    },

    show: function() {
        nnet.HeaderToolBar.superclass.show.call(this, arguments);
        this.showButtons();
    },
    
    showButtons: function() {
        if (CurrentUser.LoggedIn) {
            this.Separator.hide();
            this.LogonButton.hide();
            this.SignUpButton.hide();
            this.LogoutButton.show();
        } else {
            this.LogoutButton.hide();
            this.Separator.show();
            this.LogonButton.show();
            this.SignUpButton.show();
        }
    },

    onLogoutButtonClick: function() {
        CurrentUser.logout();
    },

    onSignUpButtonClick: function() {
        CurrentUser.signUp();
    },
    
    onHelpButtonClick: function(btn) {
        NNet.Help.show({ uri: "/Help/Services/Listing/Guildlines" });
    }

});
Ext.reg('header-toolbar-panel', nnet.HeaderToolBar);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/header-toolbar-prop-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/header-toolbar-prop-0-0.js');
namespace('nnet');

nnet.Header = Ext.extend(Ext.Panel, {

    initComponent: function() {
        Ext.apply(this, {
            items: [{
                xtype: 'header-toolbar-panel',
                id: 'headerToolbarContainer',
                listeners: { scope: this, requestLogin: this.displayLogin }
            }, {
                xtype: 'header-login-panel',
                id: 'headerLoginContainer',
                listeners: { scope: this, collapse: this.displayToolbar },
                hidden: true
            }, {
                xtype: 'box',
                id: 'LeftHeaderImage',
                autoEl: { tag: 'img', src: 'http://img2.neighbournet.com/resource/image/nnet/header/left-header.gif' }
            }, {
                xtype: 'box',
                id: 'HeadingImage',
                autoEl: { tag: 'img', src: 'http://img3.neighbournet.com/resource/image/nnet/nnet-house-logo-105-8.png', width: 100 }
            }, {
                xtype: 'box',
                id: 'HeadingTitle',
                autoEl: { tag: 'span', html: '' }
            }, {
                xtype: 'header-ad',
                id: 'HeadingAd'
            }]
        });
        nnet.Header.superclass.initComponent.call(this, arguments);
        this.TitleEl = Ext.getCmp('HeadingTitle');
        this.Toolbar = Ext.getCmp('headerToolbarContainer');
        this.Login = Ext.getCmp('headerLoginContainer');
        this.Ad = Ext.getCmp('HeadingAd');
        
        //NNetPage.Header = this; // set up ferenceto header in page

        onLogOut.subscribe(function(type, args, me) { me.displayToolbar(); }, this);
        onLogIn.subscribe(function(type, args, me) { me.displayToolbar(); }, this);

        nnet.onApplicationChanged.subscribe(
            function(type, args, me) {
                try {
                    me.setTitle(args[0].PageTitle);
                } catch (e) { logE("Header.onApplicationActivated handler", e); }
            }, this
        );
    },

    displayToolbar: function() {
        try {
            this.Login.hide();
            this.Toolbar.show();
            this.Ad.show();
        } catch (e) { logE("Header.displayLogin", e); }
    },

    displayLogin: function() {
        try {
            this.Toolbar.hide();
            this.Ad.hide();
            this.Login.show();
        } catch (e) { logE("Header.displayLogin", e); }
    },

    setTitle: function(title) {
        if (this.TitleEl.el != undefined) this.TitleEl.el.update(title);
        else this.TitleEl.autoEl.html = title; // not rendered yet so set auto value
    }

});
Ext.reg('header-panel', nnet.Header);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/header-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/header-0-0.js');
namespace('nnet');

nnet.HeaderAd = Ext.extend(Ext.BoxComponent, {

    initComponent: function() {
        Ext.apply(this, {
            hideMode: Ext.isIE ? 'offsets' : 'display',
            autoEl: { tag: 'div' }
        });
        nnet.HeaderAd.superclass.initComponent.call(this, arguments);

        this.AdRunner = {
            run: this.refresh,
            interval: 45000, //45 second
            scope: this
        }
    },

    onRender: function() {
        nnet.HeaderAd.superclass.onRender.apply(this, arguments);
        TaskRunner.start(this.AdRunner);
        this.ContentEl = Ext.getCmp(this.id).getEl();
        this.refresh();
    },


    refresh: function() {
        try {
            Ext.Ajax.request({
                url: '/Ad/Handler.ashx',
                params: { 'CallbackMethod': 'GetAd', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                success: function(response, options) { this.updateAd(Ext.decode(response.responseText)); }.createDelegate(this),
                failure: function() {//Ext.MessageBox.alert('Failure', 'Get Ad failed');
                }
            });
        } catch (e) { logE("HeaderAd - refresh", e); }
    },

    updateAd: function(ad) {
    this.ContentEl.update(ad);
    }

});
Ext.reg('header-ad', nnet.HeaderAd);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/header-ad-1-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/header-ad-1-0.js');
namespace('nnet');

//nnet.FooterToolBar = $j.klass({
//    initialize: function() {
//        this.ToolBar = null;
//        this.CartButton = null;
//        this.ProfileButton = null;
//        this.AdminButton = null;
//    },

//    // event handler so not in context.
//    initFooterToolBar: function(sender) {
//        try {
//            NNet.FooterToolBar.ToolBar = sender;
//            sender.add_buttonClicked(NNet.FooterToolBar.buttonClick);
//            NNet.FooterToolBar.CartButton = sender.findItemByValue('Cart');
//            NNet.FooterToolBar.ProfileButton = sender.findItemByValue('Profile');
//            NNet.FooterToolBar.AdminButton = sender.findItemByValue('Admin');

//            NNet.FooterToolBar.CartButton.hide();
//            NNet.FooterToolBar.ProfileButton.hide();
//            NNet.FooterToolBar.AdminButton.hide();

//            //RefreshUserStatus();
//        } catch (e) { logE("FooterToolBar.initFooterToolBar", e); }
//    },

//    // event handler so not in context.
//    buttonClick: function(sender, e) {
//        try {
//            var button = e.get_item().get_value();
//            if (button == "Admin") {
//                window.open("http://admin.neighbournet.com/", 'NNetAdmin');
//                return false;
//            } else if (button == "Print") {
//                return true;
//            } else if (button == "Cart") {
//                CurrentUser.ShoppingCart.show();
//                return false;
//            } else if (button == "Profile") {
//                CurrentUser.show();
//                return false;
//            }
//        } catch (e) { logE("FooterToolBar.buttonClick", e); }
//    }

//});

FooterToolBar = $j.klass({
    initialize: function(option) {
        //$j('.button', this.element).attach(FooterButton);

        this.CartButton = $j('.footer-toolbar #Cart');
        this.ProfileButton = $j('.footer-toolbar #Profile');
        this.AdminButton = $j('.footer-toolbar #Admin');


        if (option.IsUserLoggedIn) {
            this.ProfileButton.show();
            if (option.IsUserAdmin) this.AdminButton.show();
            if (option.UserHasShoppingCart) this.CartButton.show();
        }

        onLogIn.subscribe(
            function(type, args) {
                try {
                    if (!args[0].IsStartUp) {
                        var tb = FooterToolBar.instances[0];   // get reference to it.
                        tb.ProfileButton.show();
                        if (args[0].IsAdmin) tb.AdminButton.show();
                    }
                } catch (e) { logE("FooterToolBar.onLogIn handler", e); }
            }
        );

        onLogOut.subscribe(
            function(type, args) {
                try {
                    if (!args[0].IsStartUp) {
                        var tb = FooterToolBar.instances[0];   // get reference to it.
                        tb.ProfileButton.hide();
                        tb.AdminButton.hide();
                        tb.CartButton.hide();
                    }
                } catch (e) { logE("FooterToolBar.onLogOut handler", e); }
            }
        );

        onShoppingCart.subscribe(
            function(type, args) {
                try {
                    var tb = FooterToolBar.instances[0];   // get reference to it.
                    if (args[0].DisplyShoppingCart) tb.CartButton.show();
                    else tb.CartButton.hide();
                } catch (e) { logE("FooterToolBar.onShoppingCart handler", e); }
            }
        );

    },

    onclick: function(e) {
        var target = $j(e.target);
        if (target.is('#Admin')) window.open("http://admin.neighbournet.com/", 'NNetAdmin');
        else if (target.is('#Profile')) CurrentUser.show();
        else if (target.is('#Cart')) CurrentUser.ShoppingCart.show();
    }

});


FooterButton = $j.klass({
    initialize: function() {
    },
    onmouseover: function() {
        this.element.addClass('button-over');
    },
    onmouseout: function() {
        this.element.removeClass('button-over');
        this.element.removeClass('button-down');
        $j('img.icon', this).removeClass('icon-over');
    },
    onmousedown: function() {
        this.element.addClass('button-down');
        $j('img.icon', this).addClass('icon-over');
    },
    onmouseup: function() {
        this.element.removeClass('.button-down');
        $j('img.icon', this).removeClass('icon-over');
    },
    hide: function() {
        this.element.hide();
    },
    show: function() {
        this.element.show();
    }

});

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/footer-toolbar-prop-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/footer-toolbar-prop-0-0.js');
namespace('nnet.newsletter');


nnet.newsletter.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.newsletter.ListData.superclass.constructor.call(this, {
            url: '/Newsletter/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetNewsletterList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'PublishedUTC', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'User__FullName',
                { name: 'PublishedUTC', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'SendAtUTC', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'Started', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Status',
                { name: 'TotalTargets', type: 'int' },
                { name: 'SentTargets', type: 'int' },
                { name: 'FailedTargets', type: 'int' },
                { name: 'ViewedTargets', type: 'int' },
                { name: 'RespondedTargets', type: 'int' },
                { name: 'SuccessTargets', type: 'int' },
                'Content',
                'Title',
                { name: 'DisableEdit', type: 'boolean' },
                { name: 'DisableDelete', type: 'boolean' },
                { name: 'DisableReview', type: 'boolean' },
                { name: 'DisableSend', type: 'boolean' },
                { name: 'DisableArchive', type: 'boolean' }
            ]
        });
    },

    getList: function() {
        this.load({
            params: { 'start': 0, 'limit': 50, 'CallbackMethod': 'GetNewsletterList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Newsletters...'
        });
    },

    deleteNewsletter: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'DeleteNewsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    var rec = this.getById(id);
                    this.remove(rec);
                } else Ext.MessageBox.alert('Failure', 'Delete Newsletter failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Delete Newsletter failed.');
            }
        });
    },

    archiveNewsletter: function(id) {
        this.actionNewsletter("Archive", id);
    },

    actionNewsletter: function(action, id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': action + 'Newsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    var rec = this.getById(id);
                    this.remove(rec);
                } else Ext.MessageBox.alert('Failure', action + ' Newsletter failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', action + ' Newsletter failed.');
            }
        });
    },

    sendNewsletter: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'SendNewsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Send Newsletter failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Send Newsletter failed.');
            }
        });
    },

    testNewsletter: function() {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': 0, 'CallbackMethod': 'TestSend', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Test Newsletter failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Test Newsletter failed.');
            }
        });
    },


    updateFromOldSite: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'CallbackMethod': 'UpdateFromOldSite', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var response = Ext.decode(response.responseText);
                if (response.success) {
                    this.reload();
                    Ext.MessageBox.alert('Status', 'Imported : ' + response.successCount + ' Failed: ' + response.failCount + ' Errors : ' + response.errors);
                } else Ext.MessageBox.alert('Failure', 'Send Newsletter failed. Errors : ' + response.errors);
            } .createDelegate(this),
            failure: function(response, options) {
                Ext.MessageBox.alert('Failure', 'Send Newsletter failed.');
            }
        });
    },


    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('newsletter-list-data', nnet.newsletter.ListData);


nnet.newsletter.PreviewData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.newsletter.PreviewData.superclass.constructor.call(this, {
            url: '/Newsletter/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetNewsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'User__FullName',
                { name: 'PublishedUTC', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'SendAtUTC', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'Started', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Status',
                { name: 'TotalTargets', type: 'int' },
                { name: 'SentTargets', type: 'int' },
                { name: 'FailedTargets', type: 'int' },
                { name: 'ViewedTargets', type: 'int' },
                { name: 'RespondedTargets', type: 'int' },
                { name: 'SuccessTargets', type: 'int' },
                'Content',
                'Title',
                { name: 'DisableEdit', type: 'boolean' },
                { name: 'DisableDelete', type: 'boolean' },
                { name: 'DisableReview', type: 'boolean' },
                { name: 'DisableSend', type: 'boolean' }
            ]
        });
    },

    getContent: function(id) {
        this.load({
            params: { 'Parm1': id, 'CallbackMethod': 'GetNewsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Newsletter'
        });
    },



    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }

});
Ext.reg('newsletter-preview-data', nnet.newsletter.PreviewData);






nnet.newsletter.FailedListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.newsletter.FailedListData.superclass.constructor.call(this, {
            url: '/Marketing/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetFailedTargetsList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'Sent', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'Sent', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Subject__Account__Name',
                'Subject__Account__FullName',
                'Subject__Account__CurrentState',
                'StatusMessage'
             ]
        });
    },

    getList: function() {
        this.load({
            params: { 'start': 0, 'limit': 50, 'CallbackMethod': 'GetFailedTargetsList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Newsletters...'
        });
    },

    deleteTarget: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'DeleteTarget', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    var rec = this.getById(id);
                    this.remove(rec);
                    this.reload(); // to redo paging
                } else Ext.MessageBox.alert('Failure', 'Delete Target failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Delete Target failed.');
            }
        });
    },

    deleteTargets: function(ids) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': JSON.serialize(ids), 'CallbackMethod': 'DeleteTargets', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload(); // to redo paging
                } else Ext.MessageBox.alert('Failure', 'Delete Target failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Delete Target failed.');
            }
        });
    },

    resendTargets: function(ids) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': JSON.serialize(ids), 'CallbackMethod': 'ResendTargets', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload(); // to redo paging
                } else Ext.MessageBox.alert('Failure', 'Resend Target failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Resend Target failed.');
            }
        });
    },


    resendNewsletter: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'ResendTarget', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Send Newsletter failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Send Newsletter failed.');
            }
        });
    },

    updateEmail: function(id, email) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'Parm2': JSON.serialize(email), 'CallbackMethod': 'UpdateEmail', 'CallbackParmCount': 2, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Update Email failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Update Email failed.');
            }
        });
    },

    invalidEmail: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'InvalidEmail', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Set Status to Invalid Email failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Set Status to Invalid Email failed.');
            }
        });
    },

    invalidName: function(id) {
        Ext.Ajax.request({
            url: '/Newsletter/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'InvalidName', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Set Status to Invalid Name failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Set Status to Invalid Name failed.');
            }
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }

});
Ext.reg('newsletter-failed-list-data', nnet.newsletter.FailedListData);


nnet.newsletter.FailedDetailData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.newsletter.FailedDetailData.superclass.constructor.call(this, {
            url: '/Marketing/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetFailedNewsletterTarget', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'Sent', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Subject__Account__Name',
                'Subject__Account__FullName',
                'Subject__Account__CurrentState',
                'StatusMessage'
            ]
        });
    },

    getContent: function(id) {
        this.load({
            params: { 'Parm1': id },
            waitMsg: 'Loading Newsletter'
        });
    },



    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('newsletter-failed-preview-data', nnet.newsletter.FailedDetailData);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/data-0-0.js');
namespace('nnet.newsletter.admin');


nnet.newsletter.admin.UploadWindow = Ext.extend(Ext.Window, {

    initComponent: function() {
        try {
            Ext.apply(this, {
                layout: 'fit',
                width: 300,
                height: 97,
                plain: true,
                items: {
                    xtype: 'form',
                    baseParams: { CallbackMethod: 'UploadNewsletterForm', CallbackParmCount: 0, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' },
                    fileUpload: true,
                    id: 'uploadNewsletterForm',
                    style: 'padding: 3px;',
                    border: false,
                    listeners: { scope: this, actioncomplete: this.actionCompleteHandler },
                    items: [{
                        xtype: 'fileuploadfield',
                        id: 'form-file',
                        emptyText: 'Select a newsletter file',
                        width: 270,
                        hideLabel : true,
                        name: 'newsletter',
                        buttonCfg: {
                            text: '',
                            iconCls: 'newspaper-upload'
                        }
}]
                    },
                    buttons: [{
                        id: 'finish-button',
                        text: 'Upload',
                        listeners: { scope: this, click: this.finishButtonClick }
                    }, {
                        text: 'Cancel',
                        scope: this,
                        handler: function() {
                            this.hide();
                        }
}]
                    });
                    nnet.newsletter.admin.UploadWindow.superclass.initComponent.call(this, arguments);
                    this.addEvents('dataChanged');
                    this.Form = Ext.getCmp('uploadNewsletterForm');
                    this.FinishButton = Ext.getCmp('finish-button');
                } catch (e) { Log.exp("prop.sale.Search.initComponent", e); }
            },


            actionCompleteHandler: function(form, action) {
                if (action.type == 'submit') {
                    this.fireEvent('dataChanged', action.result.data);
                    this.close();
                }
            },

            finishButtonClick: function(button, event) {
                this.FinishButton.disable();
                this.Form.form.submit({
                    url: '/Newsletter/Handler.ashx',
                    scope: this,
                    success: function(form, action) {
                        //debugger;
                        //this.fireEvent('dataChanged');
                        //this.close();
                    },
                    failure: function(form, action) { Ext.MessageBox.alert('Message', action); }
                });
            }

        });
Ext.reg('upload-newsletter-window', nnet.newsletter.admin.UploadWindow);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/upload-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/upload-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.ReviewWindow = Ext.extend(Ext.Window, {

    initComponent: function() {
        try {
            Ext.apply(this, {
                layout: 'fit',
                width: 300,
                height: 150,
                plain: true,
                items: {
                    xtype: 'form',
                    id: 'reviewNewsletterForm',
                    defaultType: 'textfield',
                    labelAlign: 'top',
                    baseParams: { CallbackMethod: 'TestNewsletter', CallbackParmCount: 2, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' },
                    style: 'padding: 3px;',
                    border: false,
                    items: [{
                        fieldLabel: 'Email Address',
                        id: 'email',
                        tooltip: 'Please enter email address to send newsletter to',
                        vtype: 'email',
                        validationDelay: 500,
                        allowBlank: false,
                        itemCls: 'no-margin',
                        anchor: '80%',
                        name: 'Email'
                    }],
                    listeners: { scope: this,
                        afterlayout: { fn: this.afterlayoutHandler, buffer: 200, scope: this }
                    }

                },
                buttons: [{
                    id: 'send-button',
                    text: 'Send',
                    listeners: { scope: this, click: this.sendButtonClick }
                }, {
                    text: 'Cancel',
                    scope: this,
                    handler: function() { this.close(); }
                }]
            });
            nnet.newsletter.admin.ReviewWindow.superclass.initComponent.call(this, arguments);
            this.Form = Ext.getCmp('reviewNewsletterForm');
        } catch (e) { Log.exp("newsletter.admin.ReviewWindow.initComponent", e); }
    },

    afterlayoutHandler: function() {
        this.Form.form.findField('Email').setValue(CurrentUser.UserName);
    },

    sendButtonClick: function(button, event) {
        var email = this.Form.form.findField('Email').getValue(); // Overwrite ID with numeric value
        Ext.apply(this.Form.form.baseParams, {  Parm1: this.rec.ID, Parm2: JSON.serialize(email)});
        this.Form.form.submit({
        url: '/Newsletter/Handler.ashx',
            scope: this,
            success: function(form, action) { this.close(); },
            failure: function(form, action) { Ext.MessageBox.alert('Error sending Newsletter', action); }
        });
    }

});
Ext.reg('review-newsletter-window', nnet.newsletter.admin.ReviewWindow);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/review-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/review-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.EditWindow = Ext.extend(Ext.Window, {

    initComponent: function() {
        try {
            if (this.rec == null) this.newNewsletter =true;
            Ext.apply(this, {
                layout: 'fit',
                width: 590,
                height: 550,
                plain: true,
                maximizable: true,
                listeners: { scope: this, close: this.cancel },
                formAction: this.formAction,
                items: {
                    xtype: 'form',
                    id: 'editNewsletterForm',
                    labelAlign: 'top',
                    baseParams: { Parm1: (this.rec != null ? this.rec.ID : 0), CallbackMethod: 'GetNewsletterForm', CallbackParmCount: 1, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' },
                    style: 'padding: 3px;',
                    border: false,
                    listeners: { scope: this,
                        actioncomplete: { fn: this.actionCompleteHandler, scope: this }
                        //afterlayout: { fn: this.afterlayoutHandler, buffer: 200, scope: this }
                    },
                    items: [{
                        xtype: 'tabpanel',
                        activeTab: 0,
                        deferredRender: false,
                        anchor: '100% 100%',
                        //layoutOnTabChange: true,
                        border: false,
                        defaults: {
                            labelWidth: 80,
                            defaultType: 'textfield',
                            hideMode: Ext.isIE ? 'offsets' : 'display'
                        },
                        items: [{
                            title: 'Properties',
                            layout: 'form',
                            bodyStyle: 'padding:5px',
                            items: [{
                                xtype: 'datefield',
                                fieldLabel: 'Publish Date',
                                name: 'PublishedUTC',
                                format: "d/m/Y",
                                menuListeners: Ext.applyIf({ // To implement select listener on date timefied
                                    select: function(m, d) {
                                        Ext.form.DateField.prototype.menuListeners.select.apply(this, arguments);
                                        //this.setPublished(m, d);
                                    }
                                }, Ext.form.DateField.prototype.menuListeners)
                            }, {
                                xtype: 'xdatetime',
                                fieldLabel: 'Send Date & Time',
                                tooltip: 'Set the date and time for the newsletter to be sent',
                                dateFormat: 'd/m/Y', // does not use localization
                                timeFormat: 'H:i',
                                hiddenFormat: 'd/m/Y H:i',
                                name: 'SendAtUTC'
                            }, {
                                fieldLabel: 'Headline',
                                tooltip: 'Appended to Titel (Subject) of the Newsletter',
                                anchor: '100%',
                                name: 'Headline'
                            }, {
                                fieldLabel: 'Title (readonly)',
                                tooltip: 'The title is automatically generated and cannot be edited',
                                anchor: '100%',
                                readOnly: true,
                                name: 'Title'
                            }, {
                                hidden: true,
                                hideLabel: true,
                                xtype: 'numberfield',
                                name: 'ID'
                            }]
//                        }, {
//                            title: 'Newsletter',
//                            layout: 'fit',
//                            items: {
//                                xtype: 'ux-htmleditor',
//                                name: 'Contentx',
//                                enableColors: false,
//                                enableAlignments: false,
//                                plugins: [new Ext.ux.HTMLEditorUndoRedo()
//                                    //, new Ext.ux.HTMLEditorTextUpload(this)
//                                ]
//                            }
                        }, {
                            title: 'Newsletter',
                            layout: 'fit',
                            items: {
                                xtype: "tinymce",
                                id: "Content",
                                name: "Content",
                                tinymceSettings: {
                                    theme: "advanced",
                                    skin: "o2k7",
                                    plugins: "safari,style,advhr,advlink,preview,searchreplace,print,contextmenu,paste,directionality,visualchars,xhtmlxtras",
                                    //plugins: "safari,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
                                    theme_advanced_buttons1: "undo,redo,|,cut,copy,paste,pastetext,pasteword,|,formatselect,bold,italic,underline,strikethrough,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent,indent",
                                    //theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
                                    theme_advanced_buttons2: "search,replace,removeformat,|,link,unlink,anchorforecolor,backcolor,hr,charmap,|,code,preview,|,print",
                                    //theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                                    theme_advanced_buttons3: "",
                                    //theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|",
                                    //theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
                                    theme_advanced_toolbar_location: "top",
                                    theme_advanced_toolbar_align: "left",
                                    theme_advanced_statusbar_location: "bottom",
                                    theme_advanced_resizing: false,
                                    //template_external_list_url: "example_template_list.js",
                                   extended_valid_elements: "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
                                }
                               // value: "<h1>Demo</h1><p>Ext.ux.TinyMCE works...</p>"
                            }
                        }]
                    }]
                },
                buttons: [{
                    id: 'save-button',
                    text: 'Save',
                    disabled: true,
                    listeners: { scope: this, click: this.saveButtonClick }
                }, {
                    id: 'finish-button',
                    text: 'Finish',
                    disabled: true,
                    listeners: { scope: this, click: this.finishButtonClick }
                }, {
                    id: 'cancel-button',
                    text: 'Cancel',
                    disabled: true,
                    listeners: { scope: this, click: this.cancelButtonClick }
                }]
            });
            nnet.newsletter.admin.EditWindow.superclass.initComponent.call(this, arguments);
            this.addListener("beforeclose", this.cancel, this);
            this.addEvents('dataChanged');
            this.EditForm = Ext.getCmp('editNewsletterForm');
            this.SaveButton = Ext.getCmp('save-button');
            this.FinishButton = Ext.getCmp('finish-button');
            this.CancelButton = Ext.getCmp('cancel-button');

            if (this.formAction != 'upload') {
                if (this.formAction == 'copy') Ext.apply(this.EditForm.form.baseParams, { CallbackMethod: 'CopyNewsletterForm', CallbackParmCount: 0 });
                this.EditForm.form.load({ url: '/Newsletter/Handler.ashx' });
            }

        } catch (e) { Log.exp("prop.sale.Search.initComponent", e); }
    },

    afterlayoutHandler: function(form, action) {
        nnet.newsletter.admin.EditWindow.superclass.onShow.apply(this, arguments);
        if (this.formAction == 'upload') {
            this.EditForm.form.setValues(this.rec);
            this.SaveButton.enable();
            this.FinishButton.enable();
            this.CancelButton.enable();
        }
    },


    actionCompleteHandler: function(form, action) {
        if (action.type == 'load') {
            if (this.newNewsletter == true) this.fireEvent('dataChanged'); // as new then brefresh grid with new entry
            this.SaveButton.enable();
            this.FinishButton.enable();
            this.CancelButton.enable();
        } else if (action.type == 'submit') { // Only works on save as finish cloese window so no handler called
            form.setValues(action.result.data);   // Refresh form with any values changed on server
            this.SaveButton.enable();
            this.FinishButton.enable();
            this.CancelButton.enable();
            this.fireEvent('dataChanged');
        }
    },

    saveButtonClick: function(button, event) {
        this.SaveButton.disable();
        this.FinishButton.disable();
        this.CancelButton.disable();
        tinyMCE.triggerSave();
        formData = this.EditForm.form.getValues();
        formData.ID = this.EditForm.form.findField('ID').getValue(); // Overwrite ID with numeric value
        Ext.apply(this.EditForm.form.baseParams, { CallbackMethod: 'SaveNewsletterForm', Parm1: formData.ID, Parm2: JSON.serialize(formData), CallbackParmCount: 2 });
        this.EditForm.form.submit({
            url: '/Newsletter/Handler.ashx',
            scope: this,
            success: function(form, action) { this.fireEvent('dataChanged'); this.newNewsletter = false; },
            failure: function(form, action) { Ext.MessageBox.alert('Message', action); }
        });
    },

    finishButtonClick: function(button, event) {
        this.SaveButton.disable();
        this.FinishButton.disable();
        this.CancelButton.disable();
        tinyMCE.triggerSave();
        formData = this.EditForm.form.getValues();
        formData.ID = this.EditForm.form.findField('ID').getValue(); // Overwrite ID with numeric value
        Ext.apply(this.EditForm.form.baseParams, { CallbackMethod: 'SaveNewsletterForm', Parm1: formData.ID, Parm2: JSON.serialize(formData), CallbackParmCount: 2 });
        this.EditForm.form.submit({
            url: '/Newsletter/Handler.ashx',
            scope: this,
            success: function(form, action) {
                this.fireEvent('dataChanged');
                this.close();
            },
            failure: function(form, action) { Ext.MessageBox.alert('Message', action); }
        });
    },
    
    cancelButtonClick: function(button, event) {
        this.SaveButton.disable();
        this.FinishButton.disable();
        this.CancelButton.disable();
        this.close(); // the cancel handler will be called
    },
    
    cancel: function(){
        if (this.newNewsletter == true) {
            Ext.Ajax.request({
                url: '/Newsletter/Handler.ashx',
                scope: this,
                params: { 'Parm1': this.EditForm.form.findField('ID').getValue(), 'CallbackMethod': 'DeleteNewsletter', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                success: function(response, options) {
                    var success = Ext.decode(response.responseText);
                    if (success) { } 
                    else Ext.MessageBox.alert('Failure', 'Cancellation of new Newsletter failed, please delete manually');
                }.createDelegate(this),
                failure: function() {
                    Ext.MessageBox.alert('Failure', 'Cancellation of new Newsletter failed, please delete manually');
                }
            });
        } 
    }

});
Ext.reg('edit-newsletter-window', nnet.newsletter.admin.EditWindow);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/edit-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/edit-0-0.js');
namespace('nnet.tracking');

nnet.newsletter.admin.FailedList = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {

        // Create RowActions Plugin
        this.action = new Ext.ux.grid.RowActions({
            header: 'Actions',
            autoWidth: false,
            hideMode: 'display',
            actions: [
                { iconCls: 'newspaper-delete', tooltip: 'Delete Newsletter Target', callback: this.deleteTarget },
                { iconCls: 'newspaper-go', tooltip: 'Resend Newsletter to User', callback: this.resendNewsletter  }
            ]
        });
        
        this.actionStatus = new Ext.ux.grid.RowActions({
            header: 'Set User Status',
            autoWidth: false,
            hideMode: 'display',
            actions: [
                {iconCls: 'icon-email-error', tooltip: 'Set account status to Invalid Email', callback: this.invalidEmail },
                {iconCls: 'icon-user-error', tooltip: 'Set account status to Invalid Name', callback: this.invalidName }
            ]
        });
        
        this.cellActions = new Ext.ux.grid.CellActions({
            align:'left'
        });

        this.filters = new Ext.ux.grid.GridFilters({
            filters: [
				{ type: 'date', dataIndex: 'Sent', dateFormat: 'd/m/Y' },
				{ type: 'string', dataIndex: 'Subject__Account__Name' },
				{ type: 'string', dataIndex: 'Subject__Account__FullName' },
				{ type: 'list', dataIndex: 'Subject__Account__CurrentState' , labelField: 'display',
				    store: new Ext.data.JsonStore({
                        url: '/Security/Handler.ashx',
                        baseParams: { 'CallbackMethod': 'GetAccountStates', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                    })
				}
		    ],
			json: true
        });


        Ext.apply(this, {
            viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
            autoScroll: true,
            loadMask: { msg: 'Loading Failed Newsletters...' },
            maskDisabled: false,

            columns: [
				this.action,
	            { id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: "Sent At", width: 100, sortable: true, dataIndex: 'Sent', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	            { header: "Email", width: 180, sortable: true, dataIndex: 'Subject__Account__Name', cellActions:[{ iconCls: 'icon-email-edit',tooltip: 'Edit Email',callback: this.editEmail}]  },
	            { header: "Name", width: 180, sortable: true, dataIndex: 'Subject__Account__FullName' },
	            { header: "Status", width: 100, sortable: true, dataIndex: 'Subject__Account__CurrentState' },
	            this.actionStatus
			],
	        plugins: [this.action, this.actionStatus, this.cellActions, this.filters],
            tbar: [{
                text: 'Delete Selected',
                iconCls: 'newspaper-delete',
                grid: this,
                listeners: { scope: this, click: { fn: this.deleteSelectedTargets, buffer: 200} }
            }, {
                text: 'Resend Selected',
                iconCls: 'newspaper-go',
                grid: this,
                listeners: { scope: this, click: { fn: this.resendSelectedTargets, buffer: 200} }
            }],
            bbar: new Ext.PagingToolbar({
                pageSize:200,
                store: this.store,
                displayInfo: true,
                plugins: this.filters
                //paramNames: { start: 'Parm1', limit: 'Parm2' }
            })

        });
        nnet.newsletter.admin.FailedList.superclass.initComponent.call(this, arguments);
    },

    onRender: function() {
        nnet.newsletter.admin.FailedList.superclass.onRender.apply(this, arguments);
        this.store.getList();
        //this.store.on('load', this.autoSizeColumns, this);
    },

    editUser: function(grid, record, action, row, col) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'Edit Newsletter',
            formAction: 'edit',
            rec: record.data,
            listeners: { scope: this, dataChanged: function() { grid.store.reload(); } }
        });
        win.show();
    },
    
    invalidEmail: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'User Status Confirmation',
            msg: 'Are you certain this users email is invalid',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.invalidEmail(record.id);
                }
            }
        });
    },
    
    invalidName: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'User Status Confirmation',
            msg: 'Are you certain this users Name as invalid',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.invalidName(record.id);
                }
            }
        });
    },

    editEmail: function(grid, record, action, value) {
        Ext.MessageBox.prompt('EMail','Edit Email:',
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateEmail(record.id, text);
                }
            }, this, false, value );
    },
    
    deleteTarget: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Delete Confirmation',
            msg: 'Are you certain you want to delete this Newsletter Target?',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.deleteTarget(record.id);
                }
            }
        });
    },
    
    deleteSelectedTargets: function(button, e) {
        var selected = this.grid.getSelectionModel().getSelections(); 
 
        if (selected.length > 0){
            Ext.Msg.show({
                title: 'Delete Confirmation',
                msg: 'Are you certain you want to delete selected Newsletter Targets?',
                buttons: Ext.Msg.OKCANCEL,
                closable: false,
                icon: Ext.MessageBox.QUESTION,
                scope: this,
                fn: function(btn) {
                    if (btn == 'ok') {
                        var ids= [];
                        for(var i=0; i < selected.length; i++){
                            ids[i] = selected[i].id;
                        }
                        this.grid.store.deleteTargets(ids);
                    }
                }
            });
        } else Ext.Msg.show({title: 'Detete Targets',msg: 'No targets have been selected', icon: Ext.MessageBox.WARNING  });
    },

    sendReviewNewsletter: function(grid, record, action, row, col) {
        win = new nnet.newsletter.admin.ReviewWindow({
            title: 'Send Test Newsletter',
            rec: record.data
        });
        win.show();
    },

    resendNewsletter: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Send Confirmation',
            msg: 'Are you certain you want to resend the Newsletter to this user?',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.resendNewsletter(record.id);
                }
            }
        });

    },

    resendSelectedTargets: function(button, e) {
        var selected = this.grid.getSelectionModel().getSelections();

        if (selected.length > 0) {
            Ext.Msg.show({
                title: 'Resend Nwesletter Confirmation',
                msg: 'Are you certain you want to resend selected Newsletters?',
                buttons: Ext.Msg.OKCANCEL,
                closable: false,
                icon: Ext.MessageBox.QUESTION,
                scope: this,
                fn: function(btn) {
                    if (btn == 'ok') {
                        var ids = [];
                        for (var i = 0; i < selected.length; i++) {
                            ids[i] = selected[i].id;
                        }
                        this.grid.store.resendTargets(ids);
                    }
                }
            });
        } else Ext.Msg.show({ title: 'Resend Targets', msg: 'No targets have been selected', icon: Ext.MessageBox.WARNING });
    },


    newNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'New Newsletter',
            formAction: 'new',
            listeners: { scope: this, dataChanged: function() { this.grid.store.reload(); }, close: function() { this.grid.store.reload(); } }
        });
        win.show();
    },

    newCopyNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'New Newsletter',
            formAction: 'copy',
            listeners: { scope: this, dataChanged: function() { this.grid.store.reload(); } }
        });
        win.show();
    },

    uploadNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.UploadWindow({
            title: 'Upload Newsletter',
            listeners: {
                scope: this,
                dataChanged: function(uploadedNewsletter) {
                    this.grid.store.reload();
                    win2 = new nnet.newsletter.admin.EditWindow({
                        title: 'Edit Newsletter',
                        formAction: 'edit',
                        rec: uploadedNewsletter,
                        listeners: { scope: this, dataChanged: function() {this.grid.store.reload(); } }
                    });
                    win2.show();
                }
            }
        });
        win.show();
    },

    updateFromOldSite: function(button, e) {
        this.grid.store.updateFromOldSite();
    },

    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('newsletter-failed-list-panel', nnet.newsletter.admin.FailedList);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/failed-list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/failed-list-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {

        // Create RowActions Plugin
        this.action = new Ext.ux.grid.RowActions({
            header: 'Actions',
            autoWidth: false,
            hideMode: 'display',
            actions: [
                { iconCls: 'newspaper-edit', tooltip: 'Edit Newsletter', callback: this.editNewsletter, hideIndex: 'DisableEdit' },
                { iconCls: 'newspaper-delete', tooltip: 'Delete Newsletter', callback: this.deleteNewsletter, hideIndex: 'DisableDelete' },
                { iconCls: 'newspaper-review', tooltip: 'Send Newsletter for review', callback: this.sendReviewNewsletter, hideIndex: 'DisableReview' },
                { iconCls: 'newspaper-go', tooltip: 'Send Newsletter (if send time is set then will send at this time)', callback: this.sendNewsletter, hideIndex: 'DisableSend' },
                { iconCls: 'archive', tooltip: 'Archive Newsletter (delete all tracking records, Newsletter is not deleted)', callback: this.archiveNewsletter, hideIndex: 'DisableArchive' }
            ]
        });

        Ext.apply(this, {
            viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
            autoScroll: true,
            loadMask: { msg: 'Loading Newsletters...' },
            maskDisabled: false,

            columns: [
				this.action,
	            { id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: "Published", width: 70, sortable: true, dataIndex: 'PublishedUTC', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
	            { header: "Status", width: 60, sortable: true, dataIndex: 'Status' },
	            { header: "User", width: 90, sortable: true, dataIndex: 'User__FullName' },
	            { header: "Send At", width: 100, sortable: true, dataIndex: 'SendAtUTC', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	            { header: "Sent At", width: 100, sortable: true, dataIndex: 'Started', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	            { header: "Total", width: 50, sortable: true, dataIndex: 'TotalTargets' },
	            { header: "Sent", width: 50, sortable: true, dataIndex: 'SentTargets' },
	            { header: "Success", width: 60, sortable: true, dataIndex: 'SuccessTargets' },
	            { header: "Failed", width: 50, sortable: true, dataIndex: 'FailedTargets' },
	            { header: "Viewed", width: 50, sortable: true, dataIndex: 'ViewedTargets' },
	            { header: "Responded", width: 70, sortable: true, dataIndex: 'RespondedTargets' }
			],
            plugins: [this.action],
            tbar: [{
                text: 'New Newsletter',
                iconCls: 'newspaper-add',
                grid: this,
                listeners: { scope: this, click: { fn: this.newNewsletter, buffer: 200} }
            }, {
                text: 'Upload Newsletter',
                iconCls: 'newspaper-upload',
                grid: this,
                listeners: { scope: this, click: { fn: this.uploadNewsletter, buffer: 200} }
            }, {
                text: 'Copy Newsletter',
                iconCls: 'newspaper-copy-add',
                grid: this,
                listeners: { scope: this, click: { fn: this.newCopyNewsletter, buffer: 200} }
            }, {
                text: 'Test Newsletter',
                iconCls: 'newspaper-test',
                grid: this,
                listeners: { scope: this, click: { fn: this.testNewsletter, buffer: 200} }
            }, {
                text: 'Update From Old',
                hidden: !(CurrentUser.UserName=='tony@steele.uk.com'),
                iconCls: 'newspaper-link',
                grid: this,
                listeners: { scope: this, click: { fn: this.updateFromOldSite, buffer: 200} }
            }],
            bbar: new Ext.PagingToolbar({
                pageSize:50,
                store: this.store,
                displayInfo: true
                //paramNames: { start: 'Parm1', limit: 'Parm2' }
            })

        });
        nnet.newsletter.admin.List.superclass.initComponent.call(this, arguments);
    },

    onRender: function() {
        nnet.newsletter.admin.List.superclass.onRender.apply(this, arguments);
        this.store.getList();
        //this.store.on('load', this.autoSizeColumns, this);
    },

    editNewsletter: function(grid, record, action, row, col) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'Edit Newsletter',
            formAction: 'edit',
            rec: record.data,
            listeners: { scope: this, dataChanged: function() { grid.store.reload(); } }
        });
        win.show();
    },

    deleteNewsletter: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Delete Confirmation',
            msg: 'Are you certain you want to delete this Newsletter?',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.deleteNewsletter(record.id);
                }
            }
        });
    },
    archiveNewsletter: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Archive Confirmation',
            msg: 'Are you certain you want to archive this Newsletter? It will delete all the tracking records but not the Newsletter',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.archiveNewsletter(record.id);
                }
            }
        });
    },

    sendReviewNewsletter: function(grid, record, action, row, col) {
        win = new nnet.newsletter.admin.ReviewWindow({
            title: 'Send Test Newsletter',
            rec: record.data
        });
        win.show();
    },

    sendNewsletter: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Send Confirmation',
            msg: 'Are you certain you want to send this Newsletter? If the send time is set then the Newsletter will be sent at this time.',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.sendNewsletter(record.id);
                }
            }
        });

    },

    newNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'New Newsletter',
            formAction: 'new',
            listeners: { scope: this, dataChanged: function() { this.grid.store.reload(); }, close: function() { this.grid.store.reload(); } }
        });
        win.show();
    },

    newCopyNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.EditWindow({
            title: 'New Newsletter',
            formAction: 'copy',
            listeners: { scope: this, dataChanged: function() { this.grid.store.reload(); } }
        });
        win.show();
    },

    uploadNewsletter: function(button, e) {
        win = new nnet.newsletter.admin.UploadWindow({
            title: 'Upload Newsletter',
            listeners: {
                scope: this,
                dataChanged: function(uploadedNewsletter) {
                    this.grid.store.reload();
                    win2 = new nnet.newsletter.admin.EditWindow({
                        title: 'Edit Newsletter',
                        formAction: 'edit',
                        rec: uploadedNewsletter,
                        listeners: { scope: this, dataChanged: function() {this.grid.store.reload(); } }
                    });
                    win2.show();
                }
            }
        });
        win.show();
    },

    testNewsletter: function(button, e) {
        Ext.Msg.show({
            title: 'Test Confirmation',
            msg: 'This will send the last newsletter to a variety of address. Some will result in successful/failed reports in the failed newsletter list.',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            scope: this,
            fn: function(btn) {
                if (btn == 'ok') {
                    this.grid.store.testNewsletter();
                }
            }
        });
    },



    updateFromOldSite: function(button, e) {
        this.grid.store.updateFromOldSite();
    },

    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('newsletter-list-panel', nnet.newsletter.admin.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/list-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.FailedPreview = Ext.extend(Ext.Panel, {

    initComponent: function() {
        this.Template = new Ext.XTemplate(
            '<tpl for=".">',
                '<div class="header"><h3>{Subject__Account__Name}</h3></div>',
                '<div class="content">{StatusMessage}</div>',
            '</tpl>'
        );
   
    
        Ext.apply(this, {
            cls: 'newsletter-preview',
            autoScroll: true,
            items: new Ext.DataView({
                store: this.store,
                tpl: this.Template,
                autoHeight: true,
                //multiSelect: true,
                //overClass: 'x-view-over',
                itemSelector: 'div.header',
                emptyText: 'No Newsletter to display'
            })
        });
        nnet.newsletter.admin.FailedPreview.superclass.initComponent.call(this, arguments);
    },

    display: function(sm, index, record) {
        this.store.getContent(record.id); 
    }


});
Ext.reg('failed-newsletter-preview-panel', nnet.newsletter.admin.FailedPreview);




if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/failed-preview-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/failed-preview-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.Preview = Ext.extend(Ext.Panel, {

    initComponent: function() {
        this.Template = new Ext.XTemplate(
            '<tpl for=".">',
                '<div class="header"><h3>{Title}</h3></div>',
                '<div class="content">{Content}</div>',
            '</tpl>'
        );
   
    
        Ext.apply(this, {
            cls: 'newsletter-preview',
            autoScroll: true,
            items: new Ext.DataView({
                store: this.store,
                tpl: this.Template,
                autoHeight: true,
                //multiSelect: true,
                //overClass: 'x-view-over',
                itemSelector: 'div.header',
                emptyText: 'No Newsletter to display'
            })
        });
        nnet.newsletter.admin.Preview.superclass.initComponent.call(this, arguments);
    },

    display: function(sm, index, record) {
        this.store.getContent(record.id); 
    }


});
Ext.reg('newsletter-preview-panel', nnet.newsletter.admin.Preview);




if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/preview-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/preview-0-0.js');
namespace('nnet.newsletter.admin');

nnet.newsletter.admin.AdminTabPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        //this.Data = new nnet.newsletter.Data();
        //this.NewsLetterData = new nnet.newsletter.Data();
        this.PreviewPanel = null;

        Ext.applyIf(this, {
            activeTab: 0,
            layoutOnTabChange: true,
            border: false,
            items: [{
                id: 'newsletter-view',
                title: 'List',
                layout: 'border',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    layout: 'fit',
                    region: 'center',
                    items: [{
                        id: 'newsletter-list-panel',
                        xtype: 'newsletter-list-panel',
                        store: new nnet.newsletter.ListData()
                    }]
                 }, {
                    layout: 'fit',
                    items: [{
                        id: 'newsletter-preview-panel',
                        xtype: 'newsletter-preview-panel',   
                        store: new nnet.newsletter.PreviewData()
                     }],
                    height: 250,
                    split: true,
                    border: false,
                    region: 'south'
                 }]
            }, {
                id: 'failed-newsletter-view',
                title: 'Failed Newsletters',
                layout: 'border',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    layout: 'fit',
                    region: 'center',
                    items: [{
                        id: 'newsletter-failed-list-panel',
                        xtype: 'newsletter-failed-list-panel',
                        store: new nnet.newsletter.FailedListData()
                    }]
                }, {
                    layout: 'fit',
                    items: [{
                        id: 'failed-newsletter-preview-panel',
                        xtype: 'failed-newsletter-preview-panel',
                        store: new nnet.newsletter.FailedDetailData()
                    }],
                    height: 250,
                    split: true,
                    border: false,
                    region: 'south'
                }]
            }]
        });

        nnet.newsletter.admin.AdminTabPanel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.newsletter.admin.AdminTabPanel.superclass.onRender.apply(this, arguments);
        this.activate(0);
        var listPanel = Ext.getCmp('newsletter-list-panel');
        this.PreviewPanel = Ext.getCmp('newsletter-preview-panel');
        var gsm = listPanel.getSelectionModel();
        gsm.on('rowselect', this.PreviewPanel.display, this.PreviewPanel); // Sets the context of the handler to be the SalesPreview object
        listPanel.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load

        var failedlistPanel = Ext.getCmp('newsletter-failed-list-panel');
        this.FailedPreviewPanel = Ext.getCmp('failed-newsletter-preview-panel');
        var gsm = failedlistPanel.getSelectionModel();
        gsm.on('rowselect', this.FailedPreviewPanel.display, this.FailedPreviewPanel); // Sets the context of the handler to be the SalesPreview object
        failedlistPanel.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load
    }
});

Ext.reg('newsletter-admin-panel', nnet.newsletter.admin.AdminTabPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/newsletter/admin/newsletter-admin-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/newsletter/admin/newsletter-admin-0-0.js');
namespace('nnet.admin.frontpage');

nnet.admin.frontpage.TabPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        Ext.applyIf(this, {
            activeTab: 0,
            layoutOnTabChange: true,
            border: false,
            items: [{
                id: 'frontpage-view',
                title: 'Stories',
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    xtype: 'iframepanel',
                    defaultSrc: 'http://appasp.nnet-server.com/app.asp?app=siteAdmin&act=frontpage-edit1&site=' + NNetSite.OldSiteId + '&adminUser=' + CurrentUser.UserName + '&siteSearch=' + NNetSite.OldSiteId + '',
                    loadMask: { msg: 'Loading. Please wait...' }
                }]
            }, {
                title: 'Header/Footer',
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    xtype: 'iframepanel',
                    defaultSrc: 'http://appasp.nnet-server.com/app.asp?app=siteAdmin&act=frontpage-edit2&site=' + NNetSite.OldSiteId + '&adminUser=' + CurrentUser.UserName + '&siteSearch=' + NNetSite.OldSiteId + '',
                    loadMask: { msg: 'Loading. Please wait...' }
                }]
           }]
        });
        nnet.admin.frontpage.TabPanel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.admin.frontpage.TabPanel.superclass.onRender.apply(this, arguments);
        if (Ext.isIE) {
            this.activate(0);
        } else {
            Ext.MessageBox.alert('Warning','The FrontPage editor will only work in Internet Explorer');
        }
    }
});

Ext.reg('frontpage-admin-panel', nnet.admin.frontpage.TabPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/admin/frontpage/frontpage-admin-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/admin/frontpage/frontpage-admin-0-0.js');
namespace('nnet.admin');
var AD = null;

nnet.admin.AdminTabPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        Ext.applyIf(this, {
            activeTab: 0,
            layoutOnTabChange: true,
            border: false,
            items: [{
                title: 'Newsletter',
                iconCls: 'newspaper-go',
                items: [{ xtype: 'newsletter-admin-panel'}],
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display'
            }, {
                title: 'FrontPage',
                iconCls: 'newspaper',
                items: [{ xtype: 'frontpage-admin-panel'}],
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display'
            }, {
                title: 'Site Messages',
                iconCls: 'transmit',
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    xtype: 'iframepanel',
                    defaultSrc: 'http://appasp.nnet-server.com/app.asp?app=siteMessage&act=list&site=' + NNetSite.OldSiteId + '&adminUser=' + CurrentUser.UserName + '&siteSearch=' + NNetSite.OldSiteId + '',
                    loadMask: { msg: 'Loading. Please wait...' }
                }]
            }, {
                title: 'Security',
                iconCls: 'icon-security',
                items: [{ xtype: 'security-panel'}],
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display'
            }, {
                title: 'Site Stats',
                id: 'site-stats',
                iconCls: 'transmit',
                layout: 'fit',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    xtype: 'iframepanel',
                    defaultSrc: '/Admin/Stats/SmarterStats.htm',
                    loadMask: { msg: 'Loading. Please wait...' }
                }]
            }]
        });

        nnet.admin.AdminTabPanel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.admin.AdminTabPanel.superclass.onRender.apply(this, arguments);
        this.hideTabStripItem('site-stats');
        this.activate(0);
        this.getEl().child('.x-tab-strip').setStyle({
            'background-color': 'transparent',
            'background-image': 'url(http://img4.neighbournet.com/resource/image/nnet/tab-background-upsidedown.png)',
            'background-repeat': 'repeat-x'
        });
    }

});

Ext.reg('admin-panel', nnet.admin.AdminTabPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/admin/admin-1-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/admin/admin-1-0.js');
namespace('nnet.forum');

nnet.forum.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.forum.ListData.superclass.constructor.call(this, {
            url: '/Forum/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetMessageList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'DatePosted', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'ParentMessage', type: 'int' },
                { name: 'SiteID', type: 'int' },
                'Topic',
                { name: 'DatePosted', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'TopicMessage', type: 'boolean' }
             ]
        });
    },

    getList: function(accountID) {
        this.load({
            params: { 'Parm1': accountID, 'CallbackMethod': 'GetMessageList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                waitMsg: 'Loading Messages...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }
});
Ext.reg('nnet-forum-list-data', nnet.forum.ListData);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/forum/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/forum/data-0-0.js');
namespace('nnet.forum');

nnet.forum.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {
        try {
            Ext.apply(this, {
                viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
                autoScroll: true,
                loadMask: { msg: 'Loading Messages...' },
                maskDisabled: false,
                columns: [
	                { id: 'ID', hidden: true, dataIndex: 'ID' },
	                { header: "Site", width: 50, sortable: true, dataIndex: 'SiteID' },
	                { header: "Posted", width: 100, sortable: true, dataIndex: 'DatePosted', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	                { header: "Title", width: 400, sortable: true, dataIndex: 'Topic' },
	                { header: "Start", width: 50, sortable: true, dataIndex: 'TopicMessage' }
			    ]
            });
            nnet.forum.List.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("NNet.forum.List.initComponent", e); }
    },
    

    onRender: function() {
        nnet.forum.List.superclass.onRender.apply(this, arguments);
        this.store.getList();
        this.on("rowdblclick", this.displayForumMessage);
    },

    displayForumMessage: function(grid, index, e) {
        var record = grid.getStore().getAt(index);
        window.open("http://appasp.nnet-server.com/server/app/forum/ShowMessage.asp?ID="+record.id);
    },

    display: function(userID) {
        //var filter = this.filters.getFilter('User');
        //filter.setValue({ eq: userID });
        //filter.setActive(true);
        this.store.getList(userID);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('forum-list-panel', nnet.forum.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/forum/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/forum/list-0-0.js');
namespace('nnet.prop');

nnet.prop.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
    initComponent: function() {
        nnet.prop.SearchField.superclass.initComponent.call(this);
        this.on('specialkey', function(f, e) {
            if (e.getKey() == e.ENTER) {
                this.onTrigger2Click();
                e.stopEvent();
                e.stopPropagation();
            }
        }, this);
    },

    validationEvent: false,
    validateOnBlur: false,
    trigger1Class: 'x-form-clear-trigger',
    trigger2Class: 'x-form-search-trigger',
    hideTrigger1: true,
    hasSearch: false,
    paramName: 'query',
    tooltipTitle: 'Search Listings for text',
    tooltip: 'Press the return key or the seach button to start a search</br>' +
                'The following options are available for searching:<ul>' +
                '<li>- Words are wild carded by default</li>' +
                '<li>- Multiple words are and’d together by default</li>' +
                '<li>- Exact matches and phases in quotes e.g. “Corgi Registered”</li>' +
                '<li>- Words excluded using – e.g. search using: builder –corgi</li>' +
                '<li>- Fuzzy search using ~ e.g. cogi~</li>' +
                '<li>- To specify fields use :, e.g. name:bell will find Bell and Crown and Bellingers in the name field</li>' +
                '</ul>',
    emptyText: 'enter text to search',


    onTrigger1Click: function() {
        if (this.hasSearch) {
            window.PageBus.publish(this.searchEvent, { name: this.searchName, operator: this.searchOperator, value: undefined });
            this.el.dom.value = '';
            var o = { start: 0 };
            this.triggers[0].hide();
            this.hasSearch = false;
        }
    },

    onTrigger2Click: function() {
        var v = this.getRawValue();
        if (v.length < 1) {
            this.onTrigger1Click();
            return;
        }
        if (v == this.searchTestValue) v=null;
        window.PageBus.publish(this.searchEvent, { name: this.searchName, operator: this.searchOperator, value: v });

        var o = { start: 0 };
        this.hasSearch = true;
        this.triggers[0].show();
    }
});
Ext.reg('property-search-field', nnet.prop.SearchField);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/search-field-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/search-field-0-0.js');
namespace('nnet.prop.sd');


nnet.prop.sd.Data = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {


        nnet.prop.sd.Data.superclass.constructor.call(this, {
            url: '/Directory/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetServicesByCategoryIDList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            remoteSort: true,
            sortInfo: { field: 'ID', direction: 'DESC' },
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'Service__Name',
                { name: 'EnhancedListing', type: 'boolean' },
                'Site',
                'ImageURL',
                'lat',
                'lng',
                'Service__Contact__PhoneNumber',
                'Address__Address1',
                'Service__URL',
                'Description',
            ]
            //listeners: { beforeload: this.beforeLoad }
        });
    },

    startup: function() {
        this.load({
            params: { 'CallbackMethod': 'GetServicesByCategoryIDList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Properties...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }
});

 
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sd/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sd/data-0-0.js');
namespace('nnet.prop.info');

nnet.prop.info.ArticleListGrid = Ext.extend(Ext.grid.GridPanel, {
 
    border:false,
 
    initComponent: function() {
        Ext.apply(this, {
            viewConfig: { forceFit: true }, //  scrollOffset: 1 removes scrollbar space
            height: 150,
            autoScroll: true,
		    enableHdMenu: false,

			// store
			store:new Ext.data.JsonStore({
                url: '/Property/Handler.ashx',
                totalProperty: 'itemCount',
                root: 'data',
                id: 'ID',
                sortInfo: {field: 'Published', direction: 'DESC'},
                fields: [{ name: 'ID', type: 'int' }, { name: 'Published', type: 'date', dateFormat: 'd/m/Y' }, 'Title']
			}),
			columns: [
				{ id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: 'Published', width: 150, sortable: true, dataIndex: 'Published', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
	            { header: "Title", width: 30, sortable: false, dataIndex: 'Title' }
			]
       });
       nnet.prop.info.ArticleListGrid.superclass.initComponent.call(this, arguments);
    },
    
    onRender:function() {
        nnet.prop.info.ArticleListGrid.superclass.onRender.apply(this, arguments);
        this.store.load({
        params: { 'CallbackMethod': 'GetArticleList', 'CallbackParmCount': '0', '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
        });
    }

});


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/info/article-list-portlet-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/info/article-list-portlet-0-0.js');
namespace('nnet.prop.info');

nnet.prop.info.StatGrid = Ext.extend(Ext.grid.GridPanel, {
 
    border:false,
 
    initComponent: function() {
        Ext.apply(this, {
            viewConfig: { forceFit: true, scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
		    autoHeight : true,
		    autoScroll: true,
		    enableHdMenu: false,

			// store
			store:new Ext.data.JsonStore({
                url: '/Property/Handler.ashx',
                totalProperty: 'itemCount',
                root: 'data',
                id: 'ID',
                fields: ['Type', { name: 'ForSale', type: 'int' }, { name: 'ToLet', type: 'int' }]
			}),
			columns:[
	            { header: "", width: 150, sortable: false, dataIndex: 'Type' },
	            { header: "For Sale", width: 30, sortable: false, dataIndex: 'ForSale' },
	            { header: "To Let", width: 30, sortable: false, dataIndex: 'ToLet' }
			]
       });
       nnet.prop.info.StatGrid.superclass.initComponent.call(this, arguments);
    },
    
    onRender:function() {
        nnet.prop.info.StatGrid.superclass.onRender.apply(this, arguments);
        this.store.load({
            params: { 'CallbackMethod': 'GetStats', 'CallbackParmCount': '0', '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
        });
    }

});
Ext.reg('statgrid', nnet.prop.info.StatGrid);


// Does not work with grid

nnet.prop.info.StatPortlet = Ext.extend(Ext.ux.Portlet, {
    layout: 'fit'
    //xtype: 'statgrid'
    //html: "<h2 style='padding: 5px 3px 5px 5px;'>Last Updated - 12/1/2008</h2><div style='padding: 0 5px 5px 5px;'>Properties Total : 350<br/>Properties Updated : 15<br/>Properties Added : 3<br/>Properties Removed : 2</div><a href=''>Read more...</a>"

    //items: [{ xtype: 'statgrid', id: 'sale-stat-grid'}]
    //items: new StatGrid()
});
Ext.reg('prop-stat-portlet', nnet.prop.info.StatPortlet);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/info/stat-portlet-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/info/stat-portlet-0-0.js');
namespace('nnet.prop.info');

nnet.prop.info.Main = $j.klass({
    initialize: function() {
        try {
            // create some portlet tools using built in Ext tool ids
            var tools = [{
                id: 'gear',
                handler: function() {
                    Ext.Msg.alert('Message', 'The Settings tool was clicked.');
                }
            }, {
                id: 'close',
                handler: function(e, target, panel) {
                    panel.ownerCt.remove(panel, true);
                }
            }];

            this.Panel = new Ext.Panel({
                id: 'property-info',
                layout: 'tdgi_border',
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    title: 'Config',
                    id:'propInfoConfigPanel',
                    region: 'west',
                    hidden: true,
                    collapsible: true,
                    collapsedTitle: true,
                    width: 150,
                    minSize: 100,
                    maxSize: 350,
                    split: true
                }, {
                    xtype: 'portal',
                    region: 'center',
                    items:[{
                        columnWidth:.33,
                        style:'padding:10px 0 10px 10px',
                        items:[{
                            title: 'Grid in a Portlet',
                            layout:'fit',
                            tools: tools,
                            items: new SampleGrid([0, 2, 3])
                        },{
                            title: 'For Sale Stats',
                            layout: 'fit',
                            tools: tools,
                            items: new nnet.prop.info.StatGrid()
                        }, {
                        title: '3/12/2008 - Latest Chiswick Property Sales',
                            tools: tools,
                            html: "<h2 style='padding: 5px 3px 5px 5px;'>Still no evidence of a price slump in the local area </h2><img src='http://www.chiswickw4.com/images/site/property/signs4.jpg' width='110' style='float:left;padding: 0 5px 5px 5px;'/>Despite widespread doom and gloom over the economy and financial markets Chiswick property prices still seem to be holding their own.<br/> <a href=''>Read more...</a>"
                        }]
                    },{
                        columnWidth:.33,
                        style:'padding:10px 0 10px 10px',
                        items:[{
                            title: 'Properties For Sale Stats',
                            html: "<h2 style='padding: 5px 3px 5px 5px;'>Last Updated - 12/1/2008</h2><div style='padding: 0 5px 5px 5px;'>Properties Total : 350<br/>Properties Updated : 15<br/>Properties Added : 3<br/>Properties Removed : 2</div><a href=''>Read more...</a>"
                        }, {
                            title: 'Property Articles',
                            layout: 'fit',
                            tools: tools,
                            items: new nnet.prop.info.ArticleListGrid()
                        }]
                    },{
                        columnWidth:.33,
                        style:'padding:10px',
                        items:[{
                            title: 'Panel 3',
                            tools: tools,
                            html: Ext.example.shortBogusMarkup
                        },{
                            title: 'Another Panel 3',
                            tools: tools,
                            html: Ext.example.shortBogusMarkup
                        }]
                    }]
                }]
            });
        } catch (e) { Log.exp("prop.info.Main.initialize", e); }
    },

    startup: function() {
    }
})


SampleGrid = function(limitColumns) {

    function italic(value) {
        return '<i>' + value + '</i>';
    }

    function change(val) {
        if (val > 0) {
            return '<span style="color:green;">' + val + '</span>';
        } else if (val < 0) {
            return '<span style="color:red;">' + val + '</span>';
        }
        return val;
    }

    function pctChange(val) {
        if (val > 0) {
            return '<span style="color:green;">' + val + '%</span>';
        } else if (val < 0) {
            return '<span style="color:red;">' + val + '%</span>';
        }
        return val;
    }


    var columns = [
        { id: 'company', header: "Company", width: 160, sortable: true, dataIndex: 'company' },
        { header: "Price", width: 75, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price' },
        { header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change' },
        { header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange' },
        { header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange' }
    ];

    // allow samples to limit columns
    if (limitColumns) {
        var cs = [];
        for (var i = 0, len = limitColumns.length; i < len; i++) {
            cs.push(columns[limitColumns[i]]);
        }
        columns = cs;
    }

    SampleGrid.superclass.constructor.call(this, {
        store: new Ext.data.Store({
            reader: new Ext.data.ArrayReader({}, [
                   { name: 'company' },
                   { name: 'price', type: 'float' },
                   { name: 'change', type: 'float' },
                   { name: 'pctChange', type: 'float' },
                   { name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia' }
              ]),
            data: [
                ['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'],
                ['Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am'],
                ['Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am'],
                ['American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am'],
                ['American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am'],
                ['AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am'],
                ['Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am'],
                ['Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am'],
                ['Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am'],
                ['E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am'],
                ['Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am'],
                ['General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am'],
                ['General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am'],
                ['Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am'],
                ['Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am'],
                ['Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am'],
                ['International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am'],
                ['Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am'],
                ['JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am'],
                ['McDonald\'s Corporation', 36.76, 0.86, 2.40, '9/1 12:00am'],
                ['Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am'],
                ['Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am'],
                ['Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am'],
                ['The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am'],
                ['The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am'],
                ['The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am'],
                ['United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am'],
                ['Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am'],
                ['Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am']
            ]
        }),
        columns: columns,
        autoExpandColumn: 'company',
        height: 250,
        width: 600
    });


}

Ext.extend(SampleGrid, Ext.grid.GridPanel);
namespace('Ext.example');
Ext.example.shortBogusMarkup = '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.';

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/info/main-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/info/main-0-0.js');
namespace('nnet.prop'); 
/**
 * This extension adds Google maps functionality to any panel or panel based component (ie: windows).
 * @class Ext.ux.GMapPanel
 * @extends Ext.Panel
 */
nnet.prop.GMap = Ext.extend(Ext.ux.GMapPanel, {
    initComponent: function() {
        try {

            this.overlayInfoTemplate = new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="prop-services-info">',
                        '<div class="title">{Service__Name}</div>',
                        '<div class="addr">{Address__Address1}<tpl if="values.Service__Contact__PhoneNumber != null">, {Service__Contact__PhoneNumber}</tpl></div>',
                        '<tpl if="values.ImageURL != \'\'">',
                            '<img src="{ImageURL}" height="75" />',
                        '</tpl>',
                        '<span class="desc">{Description}</span>',
                   '</div>',
                '</tpl>'
            ).compile();

            Ext.applyIf(this,{
            });
            nnet.prop.GMap.superclass.initComponent.call(this);
            this.addEvents('markerClicked');
            this.addEvents('overlayMarkerClicked');
            
            this.houseIcon = new GIcon();
            this.houseIcon.image = 'http://img1.neighbournet.com/resource/image/icon/google/map/house/image.png';
            this.houseIcon.printImage = 'http://img2.neighbournet.com/resource/image/icon/google/map/house/printImage.gif';
            this.houseIcon.mozPrintImage = 'http://img3.neighbournet.com/resource/image/icon/google/map/house/mozPrintImage.gif';
            this.houseIcon.iconSize = new GSize(16, 16);
            this.houseIcon.shadow = 'http://img4.neighbournet.com/resource/image/icon/google/map/house/shadow.png';
            this.houseIcon.transparent = 'http://img5.neighbournet.com/resource/image/icon/google/map/house/transparent.png';
            this.houseIcon.shadowSize = new GSize(24, 16);
            this.houseIcon.printShadow = 'http://img1.neighbournet.com/resource/image/icon/google/map/house/printShadow.gif';
            this.houseIcon.iconAnchor = new GPoint(8, 16);
            this.houseIcon.infoWindowAnchor = new GPoint(8, 0);
            this.houseIcon.imageMap = [9, 0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 15, 7, 15, 8, 14, 9, 13, 10, 13, 11, 15, 12, 15, 13, 15, 14, 0, 14, 0, 13, 0, 12, 3, 11, 3, 10, 1, 9, 0, 8, 0, 7, 0, 6, 1, 5, 2, 4, 3, 3, 4, 2, 5, 1, 6, 0];


            this.flagIcon = new GIcon();
            this.flagIcon.image = 'http://img1.neighbournet.com/resource/image/icon/google/map/flag/image.png';
            this.flagIcon.shadow = 'http://img2.neighbournet.com/resource/image/icon/google/map/flag/shadow.png';
            this.flagIcon.iconSize = new GSize(16, 16);
            this.flagIcon.shadowSize = new GSize(24, 16);
            this.flagIcon.iconAnchor = new GPoint(8, 16);
            this.flagIcon.infoWindowAnchor = new GPoint(8, 0);
            this.flagIcon.printImage = 'http://img3.neighbournet.com/resource/image/icon/google/map/flag/printImage.gif';
            this.flagIcon.mozPrintImage = 'http://img4.neighbournet.com/resource/image/icon/google/map/flag/mozPrintImage.gif';
            this.flagIcon.printShadow = 'http://img5.neighbournet.com/resource/image/icon/google/map/flag/printShadow.gif';
            this.flagIcon.transparent = 'http://img1.neighbournet.com/resource/image/icon/google/map/flag/transparent.png';
            this.flagIcon.imageMap = [14, 1, 14, 2, 14, 3, 14, 4, 13, 5, 13, 6, 13, 7, 13, 8, 13, 9, 12, 10, 12, 11, 12, 12, 12, 13, 12, 14, 12, 15, 9, 15, 9, 14, 9, 13, 9, 12, 9, 11, 0, 10, 0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 6, 2, 6, 1];
        } catch (e) { Log.exp("nnet.prop.GMap.initComponent", e); }
    },

    // private
    afterRender: function() {
        if (this.gmapType === 'panorama') { // set up centre for streetview
            if (this.store != null) {
                var markerData = this.store.getData();       
            }
            //this.getMap().setLocationAndPOV(new GLatLng(this.setCenter.lat, this.setCenter.lng), { yaw: this.yaw, pitch: this.pitch, zoom: this.zoomLevel });
        }
        
        nnet.prop.GMap.superclass.afterRender.call(this); // creates google map
    },

    // private
    onMapReady: function() {
        try{
            nnet.prop.GMap.superclass.onMapReady.call(this); // creates google map
            this.mgr = new MarkerManager(this.gmap);
            if (this.store != null) {
                var markerData = this.store.getData();
                if (markerData != null) {
                    this.addMarkersToMgr(markerData);
                }
                this.store.on('load', this.displayProperties, this); 
                var myMask = new Ext.LoadMask(this.id, { msg: "Please wait...", store: this.store });
            }
            if (this.overlayStore != null) {
                var overlayMarkerData = this.overlayStore.getData();
                if (overlayMarkerData != null) {
                    this.addMarkersToOverlay(overlayMarkerData);
                }
                this.overlayStore.on('load', this.displayOverlayMarkers, this); 
                var myMask = new Ext.LoadMask(this.id, { msg: "Please wait...", store: this.overlayStore });
            }
        } catch (e) { Log.exp("nnet.prop.GMap.onMapReady", e); }

    },

    displayProperties: function() {
        this.addMarkersToMgr(this.store.getData());
    },

    displayOverlayMarkers: function() {
        this.addMarkersToOverlay(this.overlayStore.getData());
    },

    addMarkers: function(markers) {
        var bounds = new GLatLngBounds();
        if (Ext.isArray(markers)) {
            for (var i = 0; i < markers.length; i++) {
                //marker = new PdMarker(new GLatLng(markers[i].lat, markers[i].lng));
                //marker.setTooltip(markers[i].Address);
                //this.getMap().addOverlay(marker);
                //            //var mkr_point = new GLatLng(markers[i].lat, markers[i].lng);
                if (markers.length == 1) marker = this.addMarker(markers[i], true);
                else marker = this.addMarker(markers[i], false);
                if (marker != null) bounds.extend(marker.getPoint());
            }
            if (!bounds.isEmpty()) {
                this.gmap.setZoom(this.gmap.getBoundsZoomLevel(bounds));
                this.gmap.setCenter(bounds.getCenter());
            }
        }
    },

    /**
    * Creates a single marker.
    * @param {markerInfo} property info for map
    */
    addMarker: function(markerInfo, center) {
        if (markerInfo.lat != null || markerInfo.lng != null) {
            var point = new GLatLng(markerInfo.lat, markerInfo.lng);
            var marker = new GMarker(point, { icon: this.houseIcon, title: 'click marker to view full details' });

            GEvent.addListener(marker, "mouseover", function() {
                marker.openInfoWindowHtml('<img class="image" src="' + markerInfo.ImageURL + '" height="75" />');
            });

            var component = this;
            GEvent.addListener(marker, "click", function() {
                component.fireEvent('markerClicked', markerInfo.ID);
            });

            this.gmap.addOverlay(marker);
            if (center) this.getMap().setCenter(point, this.zoomLevel);
            return marker;
        }
    },

    addMarkersToMgr: function(markers) {
        this.mgr.clearMarkers();
        var bounds = new GLatLngBounds();
        if (Ext.isArray(markers)) {
            var batch = [];
            for (var i = 0; i < markers.length; i++) {
                marker = this.createMarker(markers[i], this.houseIcon, 'markerClicked', this.infoTemplate);
                if (marker != null) {
                    bounds.extend(marker.getPoint());
                    batch.push(marker);
                }
            }
            if (!bounds.isEmpty()) {
                this.gmap.setZoom(this.gmap.getBoundsZoomLevel(bounds));
                this.gmap.setCenter(bounds.getCenter());
            }
            this.mgr.addMarkers(batch, 3);
            this.mgr.refresh();
        }
    },

    addMarkersToOverlay: function(markers) {
        if (this.overlayMgr == undefined) this.overlayMgr = new MarkerManager(this.gmap);
        else this.overlayMgr.clearMarkers();

        //var bounds = new GLatLngBounds();
        if (Ext.isArray(markers)) {
            var batch = [];
            for (var i = 0; i < markers.length; i++) {
                marker = this.createMarker(markers[i], this.flagIcon, 'overlayMarkerClicked', this.overlayInfoTemplate);
                if (marker != null) batch.push(marker);
            }
            this.overlayMgr.addMarkers(batch, 3);
            this.overlayMgr.refresh();
        }
    },

    /**
    * Creates a single marker.
    * @param {markerInfo} property info for map
    */
    createMarker: function(markerInfo, icon, markerEvent, infoTemplate) {
        if (markerInfo.lat != null || markerInfo.lng != null) {
            var point = new GLatLng(markerInfo.lat, markerInfo.lng);
            var marker = new GMarker(point, { icon: icon, title: 'click marker to view full details' });
           // var pMap = this;
            GEvent.addListener(marker, "mouseover", function() {
                marker.openInfoWindowHtml(infoTemplate.apply(markerInfo));
            });

            var component = this;
            GEvent.addListener(marker, "click", function() {
                component.fireEvent(markerEvent, markerInfo.ID);
            });

            return marker;
        }
    }


});

Ext.reg('nnetgmappanel', nnet.prop.GMap);


// Display list popup map
function ViewMap(mapElm, lat, lng) {
    try {
        if (GBrowserIsCompatible()) {
            point = new GLatLng(lat, lng);
            var map = new GMap2(mapElm);
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            map.setCenter(point, 16);
            marker = new GMarker(point);
            map.addOverlay(marker);
        }
    } catch (e) { logE("Service - ViewMap", e); }
}



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/map-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/map-0-0.js');
namespace('nnet.prop');


nnet.prop.Data = Ext.extend(Ext.data.JsonStore, {
    constructor: function(config) {
        this.sale = config.sale; //sale of let
        nnet.prop.Data.superclass.constructor.call(this, {
            url: '/Property/Handler.ashx',
            baseParams: { 'Parm1': this.sale, 'CallbackMethod': 'GetList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            remoteSort: true,
            //sortInfo: { field: 'Price', direction: 'DESC' },
            sortInfo: { field: '', direction: '' },
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'Address__Address1',
                { name: 'Price', type: 'float' },
                'PerWeekPrice',
                { name: 'Bedrooms', type: 'int' },
                { name: 'Bathrooms', type: 'int' },
                'Tenure',
                'col__Tags__ID',
                'Description',
                'ImageURL',
                'lat',
                'lng',
                'Agent__Name',
                'Agent__URL',
                'Agent__Contact__PhoneNumber',
                'Agent__Address__Address1',
                { name: 'Agent__ID', type: 'int' },
                'col__Sites__ID',
                'TextSearch',
                'ExternalDetailURL',
                'Furnished'
            ],
            listeners: { beforeload: this.beforeLoad }

        });
    },

    // Required as PagingToolbar requires Parm1 set in baseparameters, so need
    // to update it on each request.
    beforeLoad: function(store, options) {
        //x = JSON.serialize(this.searchData);
    },

    startup: function() {
        this.load({
            params: { 'Parm1': this.sale, 'start': 0, 'limit': 50, 'CallbackMethod': 'GetList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Properties...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }
});

nnet.prop.DetailData = Ext.extend(Ext.data.JsonStore, {
    constructor: function(config) {
        this.sale = config.sale; //sale of let
        if (this.sale) this.CallbackMethod = 'GetSale';
        else this.CallbackMethod = 'GetLet';
        this.selectEvent = config.selectEvent;
        nnet.prop.DetailData.superclass.constructor.call(this, {
            url: '/Property/Handler.ashx',
            baseParams: { 'CallbackMethod': this.CallbackMethod, 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'Address__Address1',
                { name: 'Price', type: 'float' },
                'PerWeekPrice',
                { name: 'Bedrooms', type: 'int' },
                { name: 'Bathrooms', type: 'int' },
                'Tenure',
                'col__Tags__ID', // type text
                'Description',
                'ImageURL',
                'lat',
                'lng',
                'Agent__Name',
                'Agent__URL',
                'Agent__Contact__PhoneNumber',
                'Agent__Address__Address1',
                { name: 'Agent__ID', type: 'int' },
                'col__Sites__ID',
                'TextSearch',
                'ExternalDetailURL',
                'Furnished'
            ]
        });
        this.sub = window.PageBus.subscribe(this.selectEvent, this, function(subj, msg, data) { this.getContent(msg.id); }, null);

    },

    getContent: function(id) {
        this.load({
            params: { 'Parm1': id, 'CallbackMethod': this.CallbackMethod, 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Property Details'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }

});



 
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/data-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.Preview = Ext.extend(Ext.Panel, {

    initComponent: function() {

        this.Template = new Ext.XTemplate(
            '<tpl for=".">',
               '<div class="prop-preview" id="prop-let-preview">',
                    '<div class="header">',
                        '<span class="addr"><a href="{ExternalDetailURL}" class="external" target="t{ID}" >{Address__Address1}</a></span>',
                        '<span class="price">£{Price}</span>',
                    '</div>',
                    '<div  class="body">',
                        '<img class="image" src="{ImageURL}" />',
                        '<img class="map" src="http://maps.google.com/staticmap?center={lat},{lng}&markers={lat},{lng},smallblue|{lat},{lng},smallblue&zoom=15&maptype=street&size=170x170&key={[NNetSite.GoogleApiKey]}" width="170" height="170" border="0"/>',
                        '<table cellspacing="0" cellpadding="0" border="0">',
                            '<tbody>',
                                '<tr><td class="label">Type :</td><td class="info">{col__Tags__ID}</td></tr>',
                                '<tr><td class="label">Bedrooms :</td><td class="info">{Bedrooms}</td></tr>',
                                '<tr><td class="label">Agent :</td><td class="info"><a href="http://{Agent__URL}" class="external" target="t{Agent__ID}" >{Agent__Name}</a></td></tr>',
                                '<tr><td class="label">Agent Phone :</td><td class="info">{Agent__Contact__PhoneNumber}</td></tr>',
                                '<tr><td class="label">Agent Address :</td><td class="info">{Agent__Address__Address1}</td></tr>',
                            '</tbody>',
                        '</table>',
                        '<br/><span class="desc">{Description}</span>',
                    '</div>',
               '</div> ',
            '</tpl>'
        );


        Ext.apply(this, {
            autoScroll: true,
            border: false,
            items: [{
                xtype: 'dataview',
                store: this.store,
                loadingText: 'Loading Property...',
                tpl: this.Template,
                //cellCls: 'user-detail',
                autoHeight: true,
                itemSelector: 'prop-let-preview',
                emptyText: 'No Property to display'
            }]
        });
        nnet.prop.let.Preview.superclass.initComponent.call(this, arguments);
    }

    });
    Ext.reg('property-let-preview-panel', nnet.prop.let.Preview);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/preview-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/preview-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {

        this.filters = new Ext.ux.grid.GridFilters({
            filters: [
				{ type: 'string', dataIndex: 'ID' },
				{ type: 'string', dataIndex: 'Address__Address1' },
			    { type: 'numeric', dataIndex: 'PerWeekPrice' },
			    { type: 'numeric', dataIndex: 'Bedrooms' },
			    { type: 'list', dataIndex: 'col__Tags__ID', labelField: 'display', loadOnShow: false, // set flase to preload options, to use with external search
			        store: new Ext.data.JsonStore({
			            url: '/Property/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetPropertyTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    },
			    { type: 'list', dataIndex: 'Furnished', labelField: 'display', loadOnShow: false, // set flase to preload options, to use with external search
			        store: new Ext.data.JsonStore({
			            url: '/Property/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetLetFurnishedTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    },
			    { type: 'list', dataIndex: 'Tenure', labelField: 'display', loadOnShow: false, // set flase to preload options, to use with external search
			        store: new Ext.data.JsonStore({
			            url: '/Property/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetLetTenureTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    },
				{ type: 'string', dataIndex: 'Agent__Name' },
				{ type: 'string', dataIndex: 'TextSearch' },
			    { type: 'list', dataIndex: 'col__Sites__ID', loadOnShow: false,
			        store: new Ext.data.JsonStore({
			            url: '/Config/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    }
		    ],
		    json: true
        });


        Ext.apply(this, {
            viewConfig: { forceFit: true, scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
            autoScroll: true,
            loadMask: { msg: 'Loading Properties...' },
            columns: [
	            { id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: "Address", width: 150, sortable: true, dataIndex: 'Address__Address1' },
	            { header: "Rent", width: 30, sortable: true, dataIndex: 'PerWeekPrice' },
	            { header: "Bedrooms", width: 30, sortable: true, dataIndex: 'Bedrooms' },
	            { header: "Type", width: 50, sortable: false, dataIndex: 'col__Tags__ID' },
	            { header: "Furnished", width: 50, sortable: false, dataIndex: 'Furnished' },
	            { header: "Tenure", width: 50, sortable: false, dataIndex: 'Tenure' },
	            { header: "Agent", width: 50, sortable: true, dataIndex: 'Agent__Name' },
	            { hidden: true, dataIndex: 'TextSearch' },
	            { hidden: true, dataIndex: 'col__Sites__ID' }
			],
            plugins: [this.filters],
            bbar: new Ext.PagingToolbar({
                pageSize: 50,
                store: this.store,
                displayInfo: true,
                plugins: this.filters
            })

        });
        nnet.prop.let.List.superclass.initComponent.call(this, arguments);
    },

    onRender: function() {
        nnet.prop.let.List.superclass.onRender.apply(this, arguments);
        var gsm = this.getSelectionModel();
        gsm.on('rowselect', function(sm, index, record) { window.PageBus.publish('nnet.prop.let.select', { id: record.id}); }, this); // Sets the context of the handler to be the SalesPreview object
        this.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load
        
        
        var filter = this.filters.getFilter('col__Sites__ID');
        filter.setValue(NNetSite.ID);
        filter.setActive(true);
        this.store.startup();

        this.sub = window.PageBus.subscribe('nnet.prop.let.search', this, function(subj, msg, data) { this.searchHandler(msg); }, null);

        this.store.on('load', this.autoSizeColumns, this);

        if (NNetApplication.PropertyID != 0) {
            if (NNetApplication.CurrentModule == "Let") {
                window.PageBus.publish('nnet.prop.let.search', { name: 'ID', operator: 'value', value: NNetApplication.PropertyID });
            }
        }


    },

    searchHandler: function(search) {
        var activate = true;
        var filter = this.filters.getFilter(search.name);
        var fv = filter.getValue();
        switch (search.operator) {
            case 'eq': filter.setValue({ eq: search.value, lt: fv.lt, gt: fv.gt }); break;
            case 'lt': filter.setValue({ lt: search.value, gt: fv.gt, eq: fv.eq }); break;
            case 'gt': filter.setValue({ gt: search.value, lt: fv.lt, eq: fv.eq }); break;
            case 'value': filter.setValue(search.value); break;
            case 'text': filter.setValue(search.value); activate = search.value != undefined; break;
        }
        filter.setActive(activate);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }


});
Ext.reg('property-let-list-panel', nnet.prop.let.List);
if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/list-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.Panel = Ext.extend(Ext.Panel, {

    initComponent: function() {
        try {
            this.Data = new nnet.prop.Data({ sale: false, selectEvent: 'nnet.prop.let.select' });
            this.DetailData = new nnet.prop.DetailData({ sale: false, selectEvent: 'nnet.prop.let.select' });

            Ext.applyIf(this, {
                layout: 'tdgi_border',
                border: false,
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    title: 'Search',
                    xtype: 'property-let-search-panel',
                    region: 'west',
                    collapsible: true,
                    collapsedTitle: true,
                    width: 180,
                    minSize: 100,
                    maxSize: 350,
                    border: false,
                    split: true
                }, {
                    region: 'center',
                    layout: 'tdgi_border',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        xtype: 'tabpanel',
                        region: 'center',
                        activeTab: 0,
                        border: false,
                        layoutOnTabChange: true,
                        items: [{
                            title: 'Listing',
                            xtype: 'property-let-list-panel',
                            store: this.Data,
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display'
                        }, {
                            title: 'Map',
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display',
                            items: [{
                                id: 'prop-let-map-layout',
                                xtype: 'property-let-map-layout',
                                store: this.Data
                            }]
                        }]
                    }, {
                        xtype: 'tabpanel',
                        region: 'south',
                        height: 250,
                        split: true,
                        collapsible: true,
                        collapsedTitle: true,
                        tabPosition: 'bottom',
                        activeTab: 0,
                        border: false,
                        layoutOnTabChange: true,
                        items: [{
                            title: 'Details',
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display',
                            items: [{
                                xtype: 'property-let-preview-panel',
                                store: this.DetailData
                            }]
                        }, {
                            title: 'Map',
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display',
                            items: [{
                                xtype: 'property-let-map-layout',
                                store: this.DetailData,
                                paging: false
                            }]
                        }]
                    }]
                }]
            });

            nnet.prop.let.Panel.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.nnet.prop.let.Panel.initComponent", e); }
    }

});

Ext.reg('property-let-panel', nnet.prop.let.Panel);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/let-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/let-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.Map = Ext.extend(nnet.prop.GMap, {

    initComponent: function() {
        try {
            this.infoTemplate = new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="prop-sale-info">',
                        '<div class="title">{Address__Address1}</div>',
                        '<img src="{ImageURL}" height="75" />',
                        '<div class="text"><span class="label">Price : </span>£{Price}</div>',
                        '<div class="txt"><span class="label">Type : </span>{col__Tags__ID}</div>',
                        '<div class="txt"><span class="label">Bedrooms : </span>{Bedrooms}</div>',
                        '<div class="txt"><span class="label">Agent : </span>{Agent__Name}</div>',
                   '</div>',
                '</tpl>'
            ).compile();

            Ext.apply(this, {
                zoomLevel: sVars.SiteInfo.GoogleMapZooom,
                gmapType: 'map',
                mapConfOpts: ['enableScrollWheelZoom', 'enableDoubleClickZoom', 'enableDragging'],
                mapControls: ['GSmallMapControl', 'GMapTypeControl', 'NonExistantControl'],
                setCenter: {
                    lat: sVars.SiteInfo.Latitude,
                    lng: sVars.SiteInfo.Longitude
                }
            });
            nnet.prop.let.Map.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("nnet.prop.let.Map.initComponent", e); }
    },

    afterRender: function() {
        try {
            nnet.prop.let.Map.superclass.afterRender.call(this); // creates google map
            this.on('markerClicked', function(propertyID) { window.PageBus.publish('nnet.prop.let.select', { id: propertyID }); });
            this.on('overlayMarkerClicked', function(propertyID) { window.PageBus.publish('nnet.prop.let.service.select', { id: propertyID }); });
        } catch (e) { Log.exp("nnet.prop.let.Map.afterRender", e); }
    }

});
Ext.reg('property-let-map-panel', nnet.prop.let.Map);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/map-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/map-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.MapLayout = Ext.extend(Ext.Panel, {

    paging: true,

    initComponent: function() {
        try {
            this.dirStore = new nnet.prop.sd.Data();
            this.dirStore.on('beforeload', this.setFilterBeforeStoreLoad, this);

            Ext.applyIf(this, {
                id: 'prop-let-map',
                layout: 'tdgi_border',
                items: [{
                    xtype: 'checktreepanel',
                    title: 'Map Options',
                    region: 'east',
                    collapsible: true,
                    collapsedTitle: true,
                    width: 180,
                    minSize: 100,
                    maxSize: 350,
                    split: true,
                    autoScroll: true,
                    rootVisible: false,
                    bubbleCheck: 'none',
                    cascadeCheck: 'none',
                    root: {
                        id: 'root',
                        expanded: true,
                        text: 'root',
                        nodeType: 'async',
                        uiProvider: false
                    },
                    loader: {
                        url: '/Property/Handler.ashx',
                        baseParams: { 'CallbackMethod': 'GetPropertyMapServices', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                    },
                    listeners: {
                        checkchange: function(node) { this.ownerCt.mapOptionSelection(this.getValue()); }
                    }
                }, {
                    region: 'center',
                    xtype: 'property-let-map-panel',
                    store: this.store,
                    overlayStore: this.dirStore
                }, {
                    xtype: 'paging',
                    region: 'south',
                    pageSize: 50,
                    store: this.store,
                    displayInfo: true,
                    hidden: !this.paging
                }]
            });

            nnet.prop.let.MapLayout.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.nnet.prop.let.MapLayout.initComponent", e); }
    },

    onRender: function() {
        nnet.prop.let.MapLayout.superclass.onRender.apply(this, arguments);
    },

    mapOptionSelection: function(selectedOptions) {
        var x = selectedOptions.toString();

        this.filterParams = new Array();

        this.filterParams[0] = { field: 'Site', type: 'list', comparison: 'eq', value: NNetSite.ID.toString() };
        this.filterParams[1] = { field: 'like.Assignments.CategoryPath', type: 'list', comparison: 'eq', value: x };
        this.dirStore.reload();
    },

    setFilterBeforeStoreLoad: function(store, options) {
        options.params = options.params || {};
        //this.cleanParams(options.params);
        var params = {};
        params["extjs_filter_encoded"] = JSON.serialize(this.filterParams);
        Ext.apply(options.params, params);
    }

});

Ext.reg('property-let-map-layout', nnet.prop.let.MapLayout);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/map-layout-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/map-layout-0-0.js');
namespace('nnet.prop.let');

nnet.prop.let.Search = Ext.extend(Ext.FormPanel, {
    displayField: 'value',
    valueField: 'display',

    initComponent: function() {
        try {
            Ext.apply(this, {
                border: true,
                layoutConfig: 'fit',
                autoHeight: false,
                items: [{
                    xtype: 'container',
                    style: 'padding: 3px;',
                    labelAlign: 'top',
                    autoEl: {},
                    layout: 'form',
                    items: [{
                        xtype: 'property-search-field',
                        fieldLabel: 'Text Search',
                        width: 170,
                        searchName: 'TextSearch',
                        searchOperator: 'text',
                        searchTestValue: '',
                        searchEvent: 'nnet.prop.let.search'
                    }, {
                        xtype: 'lovcombo',
                        width: 170,
                        //mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Property Type',
                        name: 'propertyType',
                        emptyText: 'All',
                        displayField: 'display',
                        valueField: 'value',
                        hiddenName: 'propertyTypeID',
                        store: new Ext.data.JsonStore({
                            url: '/Property/Handler.ashx',
                            baseParams: { 'CallbackMethod': 'GetPropertyTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                        }),
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'col__Tags__ID',
                        searchOperator: 'value',
                        searchTestValue: 0
                    }]
                }, {
                    xtype: 'fieldset',
                    title: 'Price Range (pw)',
                    labelAlign: 'left',
                    labelWidth: 32,
                    autoHeight: true,
                    defaultType: 'textfield',
                    collapsible: true,
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Min',
                        hiddenName: 'minPrice',
                        name: 'minPrice',
                        value: 0,
                        store: [[0, 'No Minimum'], [50, '£50'], [75, '£75'], [100, '£100'], [300, '£300'], [400, '£400'], [500, '£500'], [600, '£600'], [700, '£700'], [800, '£800'], [900, '£900'], [1000, '£1,000'], [1250, '£1,250'], [1500, '£1,500'], [1750, '£1,750'], [2000, '£2,000'], [2250, '£2,250'], [2500, '£2,500'], [3500, '£3,500'], [4500, '£4,500'], [5500, '£5,500'], [7500, '£7,500']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'PerWeekPrice',
                        searchOperator: 'gt',
                        searchTestValue: 0
                    }, {
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Max',
                        name: 'maxPrice',
                        value: 100000000,
                        hiddenName: 'maxPrice',
                        store: [[50, '£50'], [75, '£75'], [100, '£100'], [300, '£300'], [400, '£400'], [500, '£500'], [600, '£600'], [700, '£700'], [800, '£800'], [900, '£900'], [1000, '£1,000'], [1250, '£1,250'], [1500, '£1,500'], [1750, '£1,750'], [2000, '£2,000'], [2250, '£2,250'], [2500, '£2,500'], [3500, '£3,500'], [4500, '£4,500'], [5500, '£5,500'], [7500, '£7,500'], [100000000, 'No Maximum']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'PerWeekPrice',
                        searchOperator: 'lt',
                        searchTestValue: 100000000
                    }]
                }, {
                    xtype: 'fieldset',
                    title: 'Bedroom Range',
                    labelAlign: 'left',
                    labelWidth: 32,
                    autoHeight: true,
                    defaultType: 'textfield',
                    collapsible: true,
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Min',
                        name: 'minBedrooms',
                        value: 0,
                        hiddenName: 'minBedrooms',
                        store: [[100000000, 'Show All'], [0, 'Studio'], [1, '1 Bedroom'], [2, '2 Bedrooms'], [3, '3 Bedrooms'], [4, '4 Bedrooms'], [5, '5 Bedrooms'], [6, '6 Bedrooms'], [7, '7 Bedrooms'], [8, '8 Bedrooms']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Bedrooms',
                        searchOperator: 'gt',
                        searchTestValue: 0
                    }, {
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Max',
                        name: 'maxBedrooms',
                        value: 100000000,
                        hiddenName: 'maxBedrooms',
                        store: [[100000000, 'Show All'], [0, 'Studio'], [1, '1 Bedroom'], [2, '2 Bedrooms'], [3, '3 Bedrooms'], [4, '4 Bedrooms'], [5, '5 Bedrooms'], [6, '6 Bedrooms'], [7, '7 Bedrooms'], [8, '8 Bedrooms'], [100000000, '8 or more']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Bedrooms',
                        searchOperator: 'lt',
                        searchTestValue: 100000000
                    }]
                }, {
                    xtype: 'container',
                    labelAlign: 'top',
                    autoEl: {},
                    layout: 'form',
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'lovcombo',
                        width: 170,
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Site',
                        name: 'site',
                        emptyText: 'All',
                        displayField: 'display',
                        valueField: 'value',
                        hiddenName: 'siteID',
                        store: new Ext.data.JsonStore({
                            url: '/Config/Handler.ashx',
                            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                        }),
                        listeners: {
                            scope: this,
                            select: this.triggerSearch,
                            render: { single: true, fn: function(combo) {
                                combo.store.on('load', function() { combo.setValue(NNetSite.ID) }, { single: true });
                                combo.store.load();
                            }
                            }
                        },
                        searchName: 'col__Sites__ID',
                        searchOperator: 'value',
                        searchTestValue: 0
                    }]
                }]
            });
            //          nnet.prop.let.onSearch = new YAHOO.util.CustomEvent("nnet.prop.let.onSearch",this);
            nnet.prop.let.Search.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("prop.let.Search.initComponent", e); }
    },

    triggerSearch: function(control, record, index) {
        var value = null;
        if (control.xtype == 'lovcombo') {
            value = control.value.split(',');
        } else {
            var value = record.data.value;
            if (value == control.searchTestValue || value == 100000000) value = null;
        }
        window.PageBus.publish('nnet.prop.let.search', { name: control.searchName, operator: control.searchOperator, value: value });
    }

});
Ext.reg('property-let-search-panel', nnet.prop.let.Search);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/let/search-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/let/search-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.Panel = Ext.extend(Ext.Panel, {

    initComponent: function() {
        try {
            this.Data = new nnet.prop.Data({ sale: true, selectEvent: 'nnet.prop.sale.select' });
            this.DetailData = new nnet.prop.DetailData({ sale: true, selectEvent: 'nnet.prop.sale.select' });
            //this.AgentData = nnet.prop.sd.Data();

            Ext.applyIf(this, {
                layout: 'tdgi_border',
                border: false,
                hideMode: Ext.isIE ? 'offsets' : 'display',
                items: [{
                    title: 'Search',
                    xtype: 'property-sale-search-panel',
                    region: 'west',
                    collapsible: true,
                    collapsedTitle: true,
                    width: 180,
                    minSize: 100,
                    maxSize: 350,
                    border: false,
                    split: true
                }, {
                    region: 'center',
                    layout: 'tdgi_border',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        xtype: 'tabpanel',
                        region: 'center',
                        activeTab: 0,
                        border: false,
                        layoutOnTabChange: true,
                        items: [{
                            title: 'Listing',
                            xtype: 'property-sale-list-panel',
                            store: this.Data,
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display'
                        }, {
                            title: 'Map',
                            layout: 'fit',
                            hideMode: Ext.isIE ? 'offsets' : 'display',
                            items: [{
                                id: 'prop-sale-map-layout',
                                xtype: 'property-sale-map-layout',
                                store: this.Data
}]
}]
                            }, {
                                xtype: 'tabpanel',
                                region: 'south',
                                height: 250,
                                split: true,
                                collapsible: true,
                                collapsedTitle: true,
                                tabPosition: 'bottom',
                                activeTab: 0,
                                border: false,
                                layoutOnTabChange: true,
                                items: [{
                                    title: 'Details',
                                    layout: 'fit',
                                    hideMode: Ext.isIE ? 'offsets' : 'display',
                                    items: [{
                                        xtype: 'property-sale-preview-panel',
                                        store: this.DetailData
}]
                                    }, {
                                        title: 'Map',
                                        layout: 'fit',
                                        hideMode: Ext.isIE ? 'offsets' : 'display',
                                        items: [{
                                            xtype: 'property-sale-map-layout',
                                            store: this.DetailData,
                                            paging: false
}]
                                            //                        }, {
                                            //                            title: 'Agent Details',
                                            //                            layout: 'fit',
                                            //                            hideMode: Ext.isIE ? 'offsets' : 'display',
                                            //                            items: [{
                                            //                                xtype: 'prop-agent-detail-panel',
                                            //                                store: this.AgentData,
                                            //                                dataEvent: 'nnet.prop.sale.agent.select'
                                            //                            }]
                                            ////                       }, {
                                            //                           title: 'Street View',
                                            //                           layout: 'fit',
                                            //                           hideMode: Ext.isIE ? 'offsets' : 'display',
                                            //                           items: [{
                                            //                               xtype: 'property-sale-map-panel',
                                            //                               gmapType: 'panorama',
                                            //                               store: this.DetailData
                                            //                           }]
}]
}]
}]
                                        });

                                        nnet.prop.sale.Panel.superclass.initComponent.apply(this, arguments);
                                    } catch (e) { Log.exp("NNet.nnet.prop.sale.Panel.initComponent", e); }
                                },

                                onRender: function() {
                                    nnet.prop.sale.Panel.superclass.onRender.apply(this, arguments);
                                }

                            });

Ext.reg('property-sale-panel', nnet.prop.sale.Panel);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/sale-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/sale-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.Search = Ext.extend(Ext.FormPanel, {
    displayField: 'value',
    valueField: 'display',

    initComponent: function() {
        try {
            Ext.apply(this, {
                border: true,
                layoutConfig: 'fit',
                autoHeight: false,
                items: [{
                    xtype: 'container',
                    style: 'padding: 3px;',
                    labelAlign: 'top',
                    autoEl: {},
                    layout: 'form',
                    items: [{
                        xtype: 'property-search-field',
                        fieldLabel: 'Text Search',
                        width: 170,
                        searchName: 'TextSearch',
                        searchOperator: 'text',
                        searchTestValue: '',
                        searchEvent: 'nnet.prop.sale.search'
                    }, {
                        xtype: 'lovcombo',
                        width: 170,
                        //mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Property Type',
                        name: 'propertyType',
                        emptyText: 'All',
                        displayField: 'display',
                        valueField: 'value',
                        hiddenName: 'propertyTypeID',
                        store: new Ext.data.JsonStore({
                            url: '/Property/Handler.ashx',
                            baseParams: { 'CallbackMethod': 'GetPropertyTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                        }),
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'col__Tags__ID',
                        searchOperator: 'value',
                        searchTestValue: 0
                    }]
                }, {
                    xtype: 'fieldset',
                    title: 'Price Range',
                    labelAlign: 'left',
                    labelWidth: 32,
                    autoHeight: true,
                    defaultType: 'textfield',
                    collapsible: true,
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Min',
                        hiddenName: 'minPrice',
                        name: 'minPrice',
                        value: 0,
                        store: [[0, 'No Minimum'], [50000, '£50,000'], [100000, '£100,000'], [150000, '£150,000'], [200000, '£200,000'], [250000, '£250,000'], [300000, '£300,000'], [350000, '£350,000'], [400000, '£400,000'], [450000, '£450,000'], [500000, '£500,000'], [550000, '£550,000'], [600000, '£600,000'], [650000, '£650,000'], [700000, '£700,000'], [750000, '£750,000'], [800000, '£800,000'], [850000, '£850,000'], [900000, '£900,000'], [950000, '£950,000'], [1000000, '£1,000,000'], [1250000, '£1,250,000'], [1500000, '£1,500,000'], [1750000, '£1,750,000'], [2000000, '£2,000,000'], [2500000, '£2,500,000'], [3000000, '£3,000,000'], [4000000, '£4,000,000'], [5000000, '£5,000,000'], [6000000, '£6,000,000'], [7000000, '£7,000,000'], [8000000, '£8,000,000'], [9000000, '£9,000,000'], [10000000, '£10,000,000'], [12000000, '£12,000,000'], [15000000, '£15,000,000']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Price',
                        searchOperator: 'gt',
                        searchTestValue: 0
                    }, {
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Max',
                        name: 'maxPrice',
                        value: 100000000,
                        hiddenName: 'maxPrice',
                        store: [[100000, '£100,000'], [150000, '£150,000'], [200000, '£200,000'], [250000, '£250,000'], [300000, '£300,000'], [350000, '£350,000'], [400000, '£400,000'], [450000, '£450,000'], [500000, '£500,000'], [550000, '£550,000'], [600000, '£600,000'], [650000, '£650,000'], [700000, '£700,000'], [750000, '£750,000'], [800000, '£800,000'], [850000, '£850,000'], [900000, '£900,000'], [950000, '£950,000'], [1000000, '£1,000,000'], [1250000, '£1,250,000'], [1500000, '£1,500,000'], [1750000, '£1,750,000'], [2000000, '£2,000,000'], [2500000, '£2,500,000'], [3000000, '£3,000,000'], [4000000, '£4,000,000'], [5000000, '£5,000,000'], [6000000, '£6,000,000'], [7000000, '£7,000,000'], [8000000, '£8,000,000'], [9000000, '£9,000,000'], [10000000, '£10,000,000'], [12000000, '£12,000,000'], [15000000, '£15,000,000'], [100000000, 'No Maximum']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Price',
                        searchOperator: 'lt',
                        searchTestValue: 100000000
                    }]
                }, {
                    xtype: 'fieldset',
                    title: 'Bedroom Range',
                    labelAlign: 'left',
                    labelWidth: 32,
                    autoHeight: true,
                    defaultType: 'textfield',
                    collapsible: true,
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Min',
                        name: 'minBedrooms',
                        value: 0,
                        hiddenName: 'minBedrooms',
                        store: [[100000000, 'Show All'], [0, 'Studio'], [1, '1 Bedroom'], [2, '2 Bedrooms'], [3, '3 Bedrooms'], [4, '4 Bedrooms'], [5, '5 Bedrooms'], [6, '6 Bedrooms'], [7, '7 Bedrooms'], [8, '8 Bedrooms']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Bedrooms',
                        searchOperator: 'gt',
                        searchTestValue: 0
                    }, {
                        xtype: 'combo',
                        width: 100,
                        mode: 'local',
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Max',
                        name: 'maxBedrooms',
                        value: 100000000,
                        hiddenName: 'maxBedrooms',
                        store: [[100000000, 'Show All'], [0, 'Studio'], [1, '1 Bedroom'], [2, '2 Bedrooms'], [3, '3 Bedrooms'], [4, '4 Bedrooms'], [5, '5 Bedrooms'], [6, '6 Bedrooms'], [7, '7 Bedrooms'], [8, '8 Bedrooms'], [100000000, '8 or more']],
                        listeners: { select: this.triggerSearch, scope: this },
                        searchName: 'Bedrooms',
                        searchOperator: 'lt',
                        searchTestValue: 100000000
                    }]
                }, {
                    xtype: 'container',
                    labelAlign: 'top',
                    autoEl: {},
                    layout: 'form',
                    style: 'padding: 3px;',
                    items: [{
                        xtype: 'lovcombo',
                        width: 170,
                        editable: false,
                        triggerAction: 'all',
                        forceSelection: false,
                        fieldLabel: 'Site',
                        name: 'site',
                        emptyText: 'All',
                        displayField: 'display',
                        valueField: 'value',
                        hiddenName: 'siteID',
                        store: new Ext.data.JsonStore({
                            url: '/Config/Handler.ashx',
                            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                        }),
                        listeners: {
                            scope: this,
                            select: this.triggerSearch,
                            render: { single: true, fn: function(combo) {
                                combo.store.on('load', function() { combo.setValue(NNetSite.ID) }, { single: true });
                                combo.store.load();
                            } 
                            }
                        },
                        searchName: 'col__Sites__ID',
                        searchOperator: 'value',
                        searchTestValue: 0
                    }]
                }]
            });
            //          nnet.prop.sale.onSearch = new YAHOO.util.CustomEvent("nnet.prop.sale.onSearch",this);
            nnet.prop.sale.Search.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("prop.sale.Search.initComponent", e); }
    },

    triggerSearch: function(control, record, index) {
        var value = null;
        if (control.xtype == 'lovcombo') {
            value = control.value.split(',');
        } else {
            var value = record.data.value;
            if (value == control.searchTestValue || value == 100000000) value = null;
       }
       window.PageBus.publish('nnet.prop.sale.search', { name: control.searchName, operator: control.searchOperator, value: value });
    }

});
Ext.reg('property-sale-search-panel', nnet.prop.sale.Search);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/search-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/search-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.Preview = Ext.extend(Ext.Panel, {

    initComponent: function() {

        this.Template = new Ext.XTemplate(
            '<tpl for=".">',
               '<div class="prop-preview" id="prop-sale-preview">',
                    '<div class="header">',
                        '<span class="addr"><a href="{ExternalDetailURL}" class="external" target="t{ID}" >{Address__Address1}</a></span>',
                        '<span class="price">£{Price}</span>',
                    '</div>',
                    '<div  class="body">',
                        '<img class="image" src="{ImageURL}" />',
                        '<img class="map" src="http://maps.google.com/staticmap?center={lat},{lng}&markers={lat},{lng},smallblue|{lat},{lng},smallblue&zoom=15&maptype=street&size=170x170&key={[NNetSite.GoogleApiKey]}" width="170" height="170" border="0"/>',
                        '<table cellspacing="0" cellpadding="0" border="0">',
                            '<tbody>',
                                '<tr><td class="label">Type :</td><td class="info">{col__Tags__ID}</td></tr>',
                                '<tr><td class="label">Bedrooms :</td><td class="info">{Bedrooms}</td></tr>',
                                '<tr><td class="label">Agent :</td><td class="info"><a href="http://{Agent__URL}" class="external" target="t{Agent__ID}" >{Agent__Name}</a></td></tr>',
                                '<tr><td class="label">Agent Phone :</td><td class="info">{Agent__Contact__PhoneNumber}</td></tr>',
                                '<tr><td class="label">Agent Address :</td><td class="info">{Agent__Address__Address1}</td></tr>',
                            '</tbody>',
                        '</table>',
                        '<br/><span class="desc">{Description}</span>',
                    '</div>',
               '</div> ',
            '</tpl>'
        );

   
        Ext.apply(this, {
            autoScroll: true,
            border: false,
            items: [{
                xtype: 'dataview',
                store: this.store,
                loadingText: 'Loading Property...',
                tpl: this.Template,
                //cellCls: 'user-detail',
                autoHeight: true,
                itemSelector: 'prop-sale-preview',
                emptyText: 'No Property to display'
            }]
        });
        nnet.prop.sale.Preview.superclass.initComponent.call(this, arguments);
    }
    
});
Ext.reg('property-sale-preview-panel', nnet.prop.sale.Preview);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/preview-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/preview-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {

        this.filters = new Ext.ux.grid.GridFilters({
            filters: [
				{ type: 'string', dataIndex: 'ID' },
				{ type: 'string', dataIndex: 'Address__Address1' },
			    { type: 'numeric', dataIndex: 'Price' },
			    { type: 'numeric', dataIndex: 'Bedrooms' },
			    { type: 'list', dataIndex: 'col__Tags__ID', labelField: 'display', loadOnShow: false, // set flase to preload options, to use with external search
			        store: new Ext.data.JsonStore({
			            url: '/Property/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetPropertyTypes', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    },
				{ type: 'string', dataIndex: 'Agent__Name' },
				{ type: 'string', dataIndex: 'TextSearch' },
			    { type: 'list', dataIndex: 'col__Sites__ID', loadOnShow: false,
			        store: new Ext.data.JsonStore({
			            url: '/Config/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    }
		    ],
            json: true
        });

        this.paging = new Ext.PagingToolbar({
            pageSize: 50,
            store: this.store,
            displayInfo: true
        })


        Ext.apply(this, {
            viewConfig: { forceFit: true, scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
            autoScroll: true,
            loadMask: { msg: 'Loading Properties...' },
            columns: [
	            { id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: "Address", width: 150, sortable: true, dataIndex: 'Address__Address1' },
	            { header: "Price", width: 30, sortable: true, dataIndex: 'Price' },
	            { header: "Bedrooms", width: 30, sortable: true, dataIndex: 'Bedrooms' },
	            { header: "Type", width: 50, sortable: false, dataIndex: 'col__Tags__ID' },
	            { header: "Agent", width: 50, sortable: true, dataIndex: 'Agent__Name' },
	            { hidden: true, dataIndex: 'TextSearch' },
	            { hidden: true, dataIndex: 'col__Sites__ID' }
			],
            plugins: [this.filters],
            bbar: this.paging
        });
        nnet.prop.sale.List.superclass.initComponent.call(this, arguments);
    },

    onRender: function() {
        nnet.prop.sale.List.superclass.onRender.apply(this, arguments);
        var gsm = this.getSelectionModel();
        gsm.on('rowselect', function(sm, index, record) { window.PageBus.publish('nnet.prop.sale.select', { id: record.id }); }, this); // Sets the context of the handler to be the SalesPreview object
        this.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load

        var filter = this.filters.getFilter('col__Sites__ID');
        filter.setValue(NNetSite.ID);
        filter.setActive(true);
        this.store.startup();

        this.sub = window.PageBus.subscribe('nnet.prop.sale.search', this, function(subj, msg, data) { this.searchHandler(msg); }, null);

        this.store.on('load', this.autoSizeColumns, this);

        if (NNetApplication.PropertyID != 0) {
            if (NNetApplication.CurrentModule == "Sale") {
                //searchHandler( { name: 'ID', operator: 'value', value: NNetApplication.PropertyID })
                window.PageBus.publish('nnet.prop.sale.search', { name: 'ID', operator: 'value', value: NNetApplication.PropertyID });
            }
        }


    },

    searchHandler: function(search) {
        var activate = true;
        this.paging.changePage( 0 ); // Reset to first page
        var filter = this.filters.getFilter(search.name);
        var fv = filter.getValue();
        switch (search.operator) {
            case 'eq': filter.setValue({ eq: search.value, lt: fv.lt, gt: fv.gt }); break;
            case 'lt': filter.setValue({ lt: search.value, gt: fv.gt, eq: fv.eq }); break;
            case 'gt': filter.setValue({ gt: search.value, lt: fv.lt, eq: fv.eq }); break;
            case 'value': filter.setValue(search.value); break;
            case 'text': filter.setValue(search.value); activate = search.value != undefined; break;
        }
        filter.setActive(activate);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }


});
Ext.reg('property-sale-list-panel', nnet.prop.sale.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/list-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.Map = Ext.extend(nnet.prop.GMap, {

    initComponent: function() {
        try {
            this.infoTemplate = new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="prop-sale-info">',
                        '<div class="title">{Address__Address1}</div>',
                        '<img src="{ImageURL}" height="75" />',
                        '<div class="text"><span class="label">Price : </span>£{Price}</div>',
                        '<div class="txt"><span class="label">Type : </span>{col__Tags__ID}</div>',
                        '<div class="txt"><span class="label">Bedrooms : </span>{Bedrooms}</div>',
                        '<div class="txt"><span class="label">Agent : </span>{Agent__Name}</div>',
                   '</div>',
                '</tpl>'
            ).compile() ;

            Ext.apply(this, {
                zoomLevel: sVars.SiteInfo.GoogleMapZooom,
                gmapType: 'map',
                mapConfOpts: ['enableScrollWheelZoom', 'enableDoubleClickZoom', 'enableDragging'],
                mapControls: ['GSmallMapControl', 'GMapTypeControl', 'NonExistantControl'],
                setCenter: {
                    lat: sVars.SiteInfo.Latitude,
                    lng: sVars.SiteInfo.Longitude
                }
            });
            nnet.prop.sale.Map.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("nnet.prop.sale.Map.initComponent", e); }
    },

    afterRender: function() {
        try {
            nnet.prop.sale.Map.superclass.afterRender.call(this); // creates google map
            this.on('markerClicked', function(propertyID) { window.PageBus.publish('nnet.prop.sale.select', { id: propertyID }); });
            this.on('overlayMarkerClicked', function(propertyID) { window.PageBus.publish('nnet.prop.sale.service.select', { id: propertyID }); });
        } catch (e) { Log.exp("nnet.prop.sale.Map.afterRender", e); }
    }

});
Ext.reg('property-sale-map-panel', nnet.prop.sale.Map);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/map-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/map-0-0.js');
namespace('nnet.prop.sale');

nnet.prop.sale.MapLayout = Ext.extend(Ext.Panel, {

    paging: true,

    initComponent: function() {
        try {
            this.dirStore = new nnet.prop.sd.Data()
            this.dirStore.on('beforeload', this.setFilterBeforeStoreLoad, this);

            Ext.applyIf(this, {
                id: 'prop-sale-map',
                layout: 'tdgi_border',
                items: [{
                    xtype: 'checktreepanel',
                    title: 'Map Options',
                    region: 'east',
                    collapsible: true,
                    collapsedTitle: true,
                    width: 180,
                    minSize: 100,
                    maxSize: 350,
                    split: true,
                    autoScroll: true,
                    rootVisible: false,
                    bubbleCheck: 'none',
                    cascadeCheck: 'none',
                    root: {
                        id: 'root',
                        expanded: true,
                        text: 'root',
                        nodeType: 'async',
                        uiProvider: false
                    },
                    loader: {
                        url: '/Property/Handler.ashx',
                        baseParams: { 'CallbackMethod': 'GetPropertyMapServices', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
                    },
                    listeners: {
                        checkchange: function(node) { this.ownerCt.mapOptionSelection(this.getValue()); }
                    }
                }, {
                    region: 'center',
                    xtype: 'property-sale-map-panel',
                    store: this.store,
                    overlayStore: this.dirStore
                }, {
                    xtype: 'paging',
                    region: 'south',
                    pageSize: 50,
                    store: this.store,
                    displayInfo: true,
                    hidden : !this.paging
                }]
            });

            nnet.prop.sale.MapLayout.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.nnet.prop.sale.MapLayout.initComponent", e); }
    },

    onRender: function() {
        nnet.prop.sale.MapLayout.superclass.onRender.apply(this, arguments);
    },

    mapOptionSelection: function(selectedOptions) {
        var x = selectedOptions.toString();
        
        this.filterParams = new Array();
        
        this.filterParams[0] = { field: 'Site', type: 'list', comparison: 'eq', value: NNetSite.ID.toString() };
        this.filterParams[1] = { field: 'like.Assignments.CategoryPath', type: 'list', comparison: 'eq', value: x };
        this.dirStore.reload();
    },
    
    setFilterBeforeStoreLoad: function(store, options) {
        options.params = options.params || {};
        //this.cleanParams(options.params);
        var params= {};
        params["extjs_filter_encoded"] = JSON.serialize(this.filterParams);
        Ext.apply(options.params, params);
    }

});

Ext.reg('property-sale-map-layout', nnet.prop.sale.MapLayout);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/sale/map-layout-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/sale/map-layout-0-0.js');
namespace('nnet.prop');
var PROP = null;

nnet.prop.PropertyTabPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        try {
            this.Modules = new Ext.util.MixedCollection();
            this.Modules.add('Sale', { TabIndex: 1 });
            this.Modules.add('Let', { TabIndex: 2 });
            this.CurrentModule = this.Modules.get(NNetApplication.CurrentModule);
            if (this.CurrentModule == null) this.CurrentModule = this.Modules.get('Sale');

            this.Info = new nnet.prop.info.Main();

            Ext.applyIf(this, {
                activeTab: 1,
                deferredRender: false,
                layoutOnTabChange: true,
                border: false,
                items: [{
                    title: 'Property',
                    id: 'prop-info',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: this.Info.Panel
                }, {
                    title: 'For Sale',
                    id: 'prop-sale',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{ xtype: 'property-sale-panel'}]
                }, {
                    title: 'To Let',
                    id: 'prop-let',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{ xtype: 'property-let-panel'}]
                }, {
                    title: 'Share',
                    id: 'prop-share',
                    contentEl: 'center2',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    autoScroll: true
                }, {
                    title: 'Agents',
                    id: 'prop-agents',
                    contentEl: 'center2',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    autoScroll: true
                }, {
                    title: 'Services',
                    id: 'prop-services',
                    contentEl: 'center2',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    autoScroll: true
                }, {
                    title: 'Statistics',
                    id: 'prop-stats',
                    contentEl: 'center2',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    autoScroll: true
}]
                });

                nnet.prop.PropertyTabPanel.superclass.initComponent.apply(this, arguments);
            } catch (e) { Log.exp("NNet.prop.PropertyTabPanel.initComponent", e); }

        },

        onRender: function() {
            nnet.prop.PropertyTabPanel.superclass.onRender.apply(this, arguments);
            this.hideTabStripItem('prop-info');
            this.hideTabStripItem('prop-share');
            this.hideTabStripItem('prop-agents');
            this.hideTabStripItem('prop-services');
            this.hideTabStripItem('prop-stats');


            //this.activate(1);
            this.activate(this.CurrentModule.TabIndex);

            this.getEl().child('.x-tab-strip').setStyle({
                'background-color': 'transparent',
                'background-image': 'url(http://img4.neighbournet.com/resource/image/nnet/tab-background-upsidedown.png)',
                'background-repeat': 'repeat-x'
            });

        }

    });

Ext.reg('property-panel', nnet.prop.PropertyTabPanel);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/prop/property-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/prop/property-0-0.js');
namespace('nnet.security.siteprofile');

nnet.security.siteprofile.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.siteprofile.ListData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetSiteProfileList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'Visits', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'DateJoined', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'LastVisit', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'Newsletter', type: 'boolean' },
                { name: 'Visits', type: 'int' },
                'Site__SiteName',
                'Account__Name',
                'Account__FullName'
             ]
        });
    },

    getList: function(accountID) {
        this.load({
        params: { 'Parm1': accountID, 'start': 0, 'limit': 50, 'CallbackMethod': 'GetSiteProfileList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Site Profiles...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    },
    
    deleteProfile: function(id){
        Ext.Ajax.request({
            url: '/Security/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'DeleteProfile', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', state + ' failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', state + ' failed.');
            }
        });
    }

});
Ext.reg('nnet-security-siteprofile-list-data', nnet.security.siteprofile.ListData);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/siteprofile/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/siteprofile/data-0-0.js');
namespace('nnet.security.siteprofile');

nnet.security.siteprofile.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,
    hidePaging: false,
    
    initComponent: function() {
        try {
            this.rowActions = new Ext.ux.grid.RowActions({
                header: 'Actions',
                autoWidth: false,
                hideMode: 'display',
                width: 00,
                actions: [
                    { iconCls: 'icon-user-delete', tooltip: 'Delete site profile', callback: this.deleteProfile}
                ]
            });

            this.cellActions = new Ext.ux.grid.CellActions({
                align: 'left'
            });


            this.filters = new Ext.ux.grid.GridFilters({
                filters: [
				    { type: 'list', dataIndex: 'Site__SiteName', labelField: 'display',
				        store: new Ext.data.JsonStore({
				            url: '/Config/Handler.ashx',
				            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
				        })
				    },
			        { type: 'date', dataIndex: 'Joined', dateFormat: 'd/m/Y' },
			        { type: 'date', dataIndex: 'LastVisit', dateFormat: 'd/m/Y' },
				    { type: 'numeric', dataIndex: 'Visits' },
				    { type: 'boolean', dataIndex: 'Newsletter' }
		        ],
				    json: true
            });

            Ext.apply(this, {
                viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
                autoScroll: true,
                loadMask: { msg: 'Loading Site Profiles...' },
                maskDisabled: false,
                columns: [
	                { id: 'ID', hidden: true, dataIndex: 'ID' },
	                { header: "Site", width: 115, sortable: true, dataIndex: 'Site__SiteName' },
	                { header: "Joined", width: 70, sortable: true, dataIndex: 'DateJoined', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
	                { header: "Last Visit", width: 70, sortable: true, dataIndex: 'LastVisit', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
	                { header: "Visits", width: 50, sortable: true, dataIndex: 'Visits' },
	                { header: "Newsletter", width: 70, sortable: true, dataIndex: 'Newsletter' },
	                this.rowActions
			    ],
	            plugins: [this.rowActions, this.cellActions, this.filters],
                bbar: new Ext.PagingToolbar({
                    pageSize: 200,
                    store: this.store,
                    displayInfo: true,
                    hidden: this.hidePaging,
                    plugins: this.filters
                })

            });
            nnet.security.siteprofile.List.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("NNet.security.siteprofile.List.initComponent", e); }
    },

    onRender: function() {
        nnet.security.siteprofile.List.superclass.onRender.apply(this, arguments);
        //this.store.getList();
    },

    display: function(userID) {
        //var filter = this.filters.getFilter('User');
        //filter.setValue({ eq: userID });
        //filter.setActive(true);
        this.store.getList(userID);
    },

    deleteProfile: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Delete Confirmation',
            msg: 'Do you want to delete the site profile, the profile cannot be undeleted',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.deleteProfile(record.id);
                }
            }
        });
    },

    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('security-siteprofile-list-panel', nnet.security.siteprofile.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/siteprofile/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/siteprofile/list-0-0.js');
namespace('nnet.security.activity');

nnet.security.activity.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.activity.ListData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetActivityList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'EventTime', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'EventTime', type: 'date', dateFormat: 'd/m/Y H:i' },
                'EventType1',
                'EventType2',
                'EventType3',
                'UserSession__Site__SiteName',
                'UserSession__User__Name',
                'UserSession__User__FullName'
             ]
        });
    },

    getList: function(accountID) {
        this.load({
            params: { 'Parm1': accountID, 'start': 0, 'limit': 50, 'CallbackMethod': 'GetActivityList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Activities...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }
});
Ext.reg('nnet-security-activity-list-data', nnet.security.activity.ListData);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/activity/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/activity/data-0-0.js');
namespace('nnet.security.activity');

nnet.security.activity.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {
        try {
            this.filters = new Ext.ux.grid.GridFilters({
                filters: [
			        { type: 'date', dataIndex: 'EventTime', dateFormat: 'd/m/Y H:i' },
				    { type: 'list', dataIndex: 'UserSession__Site__SiteName', labelField: 'display',
				        store: new Ext.data.JsonStore({
				            url: '/Config/Handler.ashx',
				            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
				        })
				    },
				    { type: 'string', dataIndex: 'EventType1' },
				    { type: 'string', dataIndex: 'EventType2' },
				    { type: 'string', dataIndex: 'EventType3' }
		        ],
				    json: true
            });

            Ext.apply(this, {
                viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
                autoScroll: true,
                loadMask: { msg: 'Loading Activities...' },
                maskDisabled: false,
                columns: [
	                { id: 'ID', hidden: true, dataIndex: 'ID' },
	                { header: "Time", width: 100, sortable: true, dataIndex: 'EventTime', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	                { header: "Site", width: 200, sortable: true, dataIndex: 'UserSession__Site__SiteName' },
	                { header: "Application", width: 150, sortable: true, dataIndex: 'EventType1' },
	                { header: "Area", width: 150, sortable: true, dataIndex: 'EventType2' },
	                { header: "Function", width: 150, sortable: true, dataIndex: 'EventType3' }
			    ],
                plugins: [this.filters],
                bbar: new Ext.PagingToolbar({
                    pageSize: 200,
                    store: this.store,
                    displayInfo: true,
                    plugins: this.filters
                })

            });
            nnet.security.history.List.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("NNet.security.activity.List.initComponent", e); }
    },

    onRender: function() {
        nnet.security.activity.List.superclass.onRender.apply(this, arguments);
        this.store.getList();
    },

    display: function(userID) {
        //var filter = this.filters.getFilter('User');
        //filter.setValue({ eq: userID });
        //filter.setActive(true);
        this.store.getList(userID);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('security-activity-list-panel', nnet.security.activity.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/activity/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/activity/list-0-0.js');
namespace('nnet.security.history');

nnet.security.history.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.history.ListData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetHistoryList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'Created', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'Created', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Comment',
                'CreatedBy__Name',
                'CreatedBy__FullName'
             ]
        });
    },

    getList: function(accountID) {
        this.load({
        params: { 'Parm1': accountID, 'start': 0, 'limit': 50, 'CallbackMethod': 'GetHistoryList', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading History...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('nnet-security-history-list-data', nnet.security.history.ListData);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/history/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/history/data-0-0.js');
namespace('nnet.security.history');

nnet.security.history.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {
        try {
            this.filters = new Ext.ux.grid.GridFilters({
                filters: [
			        { type: 'date', dataIndex: 'Created', dateFormat: 'd/m/Y H:i' },
				    { type: 'string', dataIndex: 'CreatedBy__Name' },
				    { type: 'string', dataIndex: 'Comment' },
				    { type: 'string', dataIndex: 'CreatedBy__FullName' }
		        ],
				    json: true
            });

            Ext.apply(this, {
                viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
                autoScroll: true,
                loadMask: { msg: 'Loading History...' },
                maskDisabled: false,

                columns: [
	                { id: 'ID', hidden: true, dataIndex: 'ID' },
	                { header: "Created", width: 100, sortable: true, dataIndex: 'Created', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	                { header: "UserID (Email)", width: 200, sortable: true, dataIndex: 'CreatedBy__Name' },
	                { header: "Comment", width: 500, sortable: true, dataIndex: 'Comment' },
	                { header: "Name", width: 100, sortable: true, dataIndex: 'CreatedBy__FullName' }
			    ],
                plugins: [this.filters],
                bbar: new Ext.PagingToolbar({
                    pageSize: 200,
                    store: this.store,
                    displayInfo: true,
                    plugins: this.filters
                })

            });
            nnet.security.history.List.superclass.initComponent.call(this, arguments);
        } catch (e) { Log.exp("NNet.security.history.List.initComponent", e); }
    },

    onRender: function() {
        nnet.security.history.List.superclass.onRender.apply(this, arguments);
        this.store.getList();
    },

    display: function(userID) {
        //var filter = this.filters.getFilter('User');
        //filter.setValue({ eq: userID });
        //filter.setActive(true);
        this.store.getList(userID);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('security-history-list-panel', nnet.security.history.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/history/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/history/list-0-0.js');
namespace('nnet.security.session');

nnet.security.session.ListData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.session.ListData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetSessionList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'Start', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'User__Name',
                'User__FullName',
                'Site__SiteName',
                'IPAddress',
                { name: 'Start', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'End', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'LastActivity', type: 'date', dateFormat: 'd/m/Y H:i' },
                { name: 'IsCurrent', type: 'boolean' },
                { name: 'User', type: 'int' }
             ]
        });
    },

    getList: function() {
        this.load({
            params: { 'start': 0, 'limit': 50, 'CallbackMethod': 'GetSessionList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Users...'
        });
    },

    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }

});
Ext.reg('nnet-security-session-list-data', nnet.security.session.ListData);


nnet.security.session.DetailData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.user.DetailData.superclass.constructor.call(this, {
            url: '/Marketing/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetFailedNewsletterTarget', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                { name: 'Sent', type: 'date', dateFormat: 'd/m/Y H:i' },
                'Subject__Account__Name',
                'Subject__Account__FullName',
                'Subject__Account__CurrentState',
                'StatusMessage'
            ]
        });
    },

    getContent: function(id) {
        this.load({
            params: { 'Parm1': id },
            waitMsg: 'Loading Newsletter'
        });
    },



    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('nnet-security-session-detail-data', nnet.security.session.DetailData);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/session/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/session/data-0-0.js');
namespace('nnet.security.session');

nnet.security.session.InfoPanel = Ext.extend(Ext.TabPanel, {


    initComponent: function() {
        try {
            this.ContentID = 0;
            this.DetailsTabContent = 0;
            //this.SessionTabContent = 0;
           // this.HistorynTabContent = 0;
           // this.ActivityTabContent = 0;
           // this.ForumTabContent = 0;
            
            Ext.applyIf(this, {
                activeTab: 0,
                layoutOnTabChange: true,
                tabPosition: 'bottom',
                border: false,
                items: [{
                    id: 'session-user-details-tab',
                    title: 'Details',
                    iconCls: 'icon-user',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'session-user-detail-panel',
                        idPrefix: 'session',
                        xtype: 'security-user-detail-panel'
                    }]
//                }, {
//                    id: 'user-session-tab',
//                    title: 'Sessions',
//                    iconCls: 'icon-user-session',
//                    layout: 'fit',
//                    hideMode: Ext.isIE ? 'offsets' : 'display',
//                    items: [{
//                        id: 'security-user-sessions-panel',
//                        xtype: 'session-list-panel',
//                        listOnRender: false,
//                        store: new nnet.security.session.ListData()
//                    }]
//                }, {
//                    id: 'user-history-tab',
//                    title: 'History',
//                    iconCls: 'icon-history',
//                    layout: 'fit',
//                    hideMode: Ext.isIE ? 'offsets' : 'display',
//                    items: [{
//                        id: 'security-history-list-panel',
//                        xtype: 'security-history-list-panel',
//                        store: new nnet.security.history.ListData()
//                    }]
//                }, {
//                    id: 'user-activities-tab',
//                    title: 'Activites',
//                    iconCls: 'icon-activities',
//                    layout: 'fit',
//                    hideMode: Ext.isIE ? 'offsets' : 'display',
//                    items: [{
//                        id: 'security-activity-list-panel',
//                        xtype: 'security-activity-list-panel',
//                        store: new nnet.security.activity.ListData()
//                    }]
//                }, {
//                    id: 'forum-messages-tab',
//                    title: 'Forum Messages',
//                    iconCls: 'icon-posts',
//                    layout: 'fit',
//                    hideMode: Ext.isIE ? 'offsets' : 'display',
//                    items: [{
//                        id: 'forum-list-panel',
//                        xtype: 'forum-list-panel',
//                        store: new nnet.forum.ListData()
//                    }]
                }]
            });
            nnet.security.session.InfoPanel.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.security.session.InfoPanel.initComponent", e); }
    },

    onRender: function() {
        nnet.security.session.InfoPanel.superclass.onRender.apply(this, arguments);
        this.UserDetailPanel = Ext.getCmp('session-user-detail-panel');
//        this.SessionListPanel = Ext.getCmp('security-user-sessions-panel');
//        this.HistoryListPanel = Ext.getCmp('security-history-list-panel');
//        this.ActivitesListPanel = Ext.getCmp('security-activity-list-panel');
//        this.ForumListPanel = Ext.getCmp('forum-list-panel');

        this.DetailsTab = Ext.getCmp('session-user-details-tab');
//        this.SessionTab = Ext.getCmp('user-session-tab');
//        this.HistoryTab = Ext.getCmp('user-history-tab');
//        this.ActivitesTab = Ext.getCmp('user-activities-tab');
//        this.ForumTab = Ext.getCmp('forum-messages-tab');
        this.activate(0);
        this.addListener('tabchange', this.tabChange);

    },

    display: function(sm, index, record) {
        this.ContentID = record.data['User'];
        this.displayTabContent(this);
    },
    
    tabChange: function(tab){
        this.displayTabContent(tab);
    },
     
     displayTabContent: function(tab){
         if (this.activeTab == this.DetailsTab && this.DetailsTabContent != this.ContentID) {
            this.DetailsTabContent = this.ContentID;
            this.UserDetailPanel.display(this.ContentID);
         }
//        } else if (this.activeTab == this.SessionTab && this.SessionTabContent != this.ContentID) {
//            this.SessionTabContent=this.ContentID;
//            this.SessionListPanel.display(this.ContentID);
//        } else if (this.activeTab == this.HistoryTab  && this.HistorynTabContent != this.ContentID) {
//            this.HistorynTabContent=this.ContentID;
//            this.HistoryListPanel.display(this.ContentID);
//        } else if (this.activeTab == this.ActivitesTab  && this.ActivityTabContent != this.ContentID) {
//            this.ActivityTabContent=this.ContentID;
//            this.ActivitesListPanel.display(this.ContentID);
//        } else if (this.activeTab == this.ForumTab && this.ForumTabContent != this.ContentID) {
//            this.ForumTabContent = this.ContentID;
//            this.ForumListPanel.display(this.ContentID);
//        }
     }

});

Ext.reg('security-session-info-panel', nnet.security.session.InfoPanel);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/session/session-info-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/session/session-info-0-0.js');
namespace('nnet.security.session');

nnet.security.session.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,
    listOnRender: true,

    initComponent: function() {
        try {

            this.cellActions = new Ext.ux.grid.CellActions({
                align: 'left'
            });

            this.filters = new Ext.ux.grid.GridFilters({
                filters: [
				    { type: 'numeric', dataIndex: 'User' },
			        { type: 'date', dataIndex: 'Start', dateFormat: 'd/m/Y H:i' },
			        { type: 'date', dataIndex: 'End', dateFormat: 'd/m/Y H:i' },
				    { type: 'list', dataIndex: 'Site__SiteName', labelField: 'display',
				        store: new Ext.data.JsonStore({
				            url: '/Config/Handler.ashx',
				            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
				        })
				    },
				    { type: 'string', dataIndex: 'User__Name' },
				    { type: 'string', dataIndex: 'User__FullName' },
				    { type: 'string', dataIndex: 'IPAddress' },
			        { type: 'date', dataIndex: 'LastActivity', dateFormat: 'd/m/Y H:i' }
		        ],
			        json: true
            });


            Ext.apply(this, {
                viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
                autoScroll: true,
                loadMask: { msg: 'Loading Sessions...' },
                maskDisabled: false,

                columns: [
	                { id: 'ID', hidden: true, dataIndex: 'ID' },
	                { header: "User", hidden: true, dataIndex: 'User' },
	                { header: "Start", width: 100, sortable: true, dataIndex: 'Start', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	                { header: "End", width: 100, sortable: true, dataIndex: 'End', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') },
	                { header: "Site", width: 100, sortable: true, dataIndex: 'Site__SiteName' },
	                { header: "UserID (Email)", width: 200, sortable: true, dataIndex: 'User__Name' },
	                { header: "Name", width: 180, sortable: true, dataIndex: 'User__FullName' },
	                { header: "IP Address", width: 100, sortable: true, dataIndex: 'IPAddress' },
	                { header: "Last Activity", width: 100, sortable: true, dataIndex: 'LastActivity', renderer: Ext.util.Format.dateRenderer('d/m/Y H:i') }
			    ],
                plugins: [this.filters],
                bbar: new Ext.PagingToolbar({
                    pageSize: 200,
                    store: this.store,
                    displayInfo: true,
                    plugins: this.filters
                    //paramNames: { start: 'Parm1', limit: 'Parm2' }
                })

                });
                nnet.security.session.List.superclass.initComponent.call(this, arguments);
            } catch (e) { Log.exp("NNet.security.session.List.initComponent", e); }
        },

        onRender: function() {
            nnet.security.session.List.superclass.onRender.apply(this, arguments);
            if (this.listOnRender) this.store.getList();
            //this.store.on('load', this.autoSizeColumns, this);
        },

        display: function(userID) {
            var filter = this.filters.getFilter('User');
            filter.setValue({ eq: userID });
            filter.setActive(true);
            //this.store.getList();
        },

        autoSizeColumns: function() {
            for (var i = 0; i < this.colModel.getColumnCount(); i++) {
                this.autoSizeColumn(i);
            }
        },

        autoSizeColumn: function(c) {
            this.colModel.setColumnWidth(c, 1);
            var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
            for (var i = 0, l = this.store.getCount(); i < l; i++) {
                w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
            }
            this.colModel.setColumnWidth(c, w + 5); // +5 to +10
            return w;
        }

    });
Ext.reg('session-list-panel', nnet.security.session.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/session/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/session/list-0-0.js');
namespace('nnet.security.session');

nnet.security.session.Panel = Ext.extend(Ext.Panel, {

    initComponent: function() {
        this.PreviewPanel = null;

        Ext.applyIf(this, {
            id: 'user-view',
            layout: 'border',
            hideMode: Ext.isIE ? 'offsets' : 'display',
            items: [{
                layout: 'fit',
                region: 'center',
                items: [{
                    id: 'session-list-panel',
                    xtype: 'session-list-panel',
                    store: new nnet.security.session.ListData()
                }]
             }, {
                layout: 'fit',
                region: 'south',
                border: false,
                height: 250,
                split: true,
                items: [{
                    id: 'security-session-info-panel',
                    xtype: 'security-session-info-panel'
                 }]
            }]
        });

        nnet.security.session.Panel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.security.session.Panel.superclass.onRender.apply(this, arguments);
        var listPanel = Ext.getCmp('session-list-panel');
        this.InfoPanel = Ext.getCmp('security-session-info-panel');
        var gsm = listPanel.getSelectionModel();
        gsm.on('rowselect', this.InfoPanel.display, this.InfoPanel); // Sets the context of the handler to be the SalesPreview object
        listPanel.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load

    }
});

Ext.reg('security-session-panel', nnet.security.session.Panel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/session/session-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/session/session-0-0.js');
namespace('nnet.security.user');

nnet.security.user.PromptWindow = Ext.extend(Ext.Window, {

    initComponent: function() {
        try {
            Ext.apply(this, {
                layout: 'fit',
                width: 500,
                height: 250,
                plain: true,
                //maximizable: true,
                formAction: this.formAction,
                items: {
                    id: 'user-prompt-form',
                    xtype: 'form',
                    labelAlign: 'top',
                    //baseParams: { Parm1: (this.rec != null ? this.rec.ID : 0), CallbackMethod: 'GetNewsletterForm', CallbackParmCount: 1, __WWEVENTCALLBACK: 'SDCallback', WWEVENTTARGET: 'Page' },
                    //style: 'padding: 3px;',
                    border: false,
                    //labelWidth: 80,
                    defaultType: 'textarea',
                    items: [{
                        fieldLabel: 'Reason',
                        tooltip: 'Reason is added to history',
                        anchor: '100%',
                        value: this.reasonText,
                        name: 'Reason'
                    }, {
                        fieldLabel: 'Message to User (if blank non sent)',
                        tooltip: 'Message sent to user by email',
                        anchor: '100%',
                        value: this.userText,
                        name: 'UserMessage'
                    }]
                },
                buttons: [{
                    id: 'submit-button',
                    text: 'Submit',
                    listeners: { scope: this, click: this.submitButtonClick }
                }, {
                    id: 'cancel-button',
                    text: 'Cancel',
                    listeners: { scope: this, click: this.cancelButtonClick }
                }]
            });
            nnet.security.user.PromptWindow.superclass.initComponent.call(this, arguments);
            this.addEvents('dataChanged');
            this.EditForm = Ext.getCmp('user-prompt-form');
            this.CancelButton = Ext.getCmp('cancel-button');
            this.SubmitButton = Ext.getCmp('submit-button');

        } catch (e) { Log.exp("nnet.security.user.PromptWindow.initComponent", e); }
    },

    //if (this.formAction != 'suspend') {
    submitButtonClick: function(button, event) {
        this.SubmitButton.disable();
        this.CancelButton.disable();
        formData = this.EditForm.form.getValues();
        
        if (this.formAction == 'suspend') {
            Ext.Ajax.request({
                url: '/Security/Handler.ashx',
                params: { 'Parm1': this.rec.ID, 'Parm2': JSON.serialize(formData.Reason), 'Parm3': JSON.serialize(formData.UserMessage), 'CallbackMethod': 'SuspendAccount', 'CallbackParmCount': 3, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                success: function(response, options) {
                    var success = Ext.decode(response.responseText);
                    if (success) {
                        this.fireEvent('dataChanged');
                        this.close();
                    } else Ext.MessageBox.alert('Failure', 'Suspend Account failed.');
                }.createDelegate(this),
                failure: function() {
                    Ext.MessageBox.alert('Failure', 'Suspend Account failed.');
                }
            });
        } else if (this.formAction == 'invalid-details') {
            Ext.Ajax.request({
                url: '/Security/Handler.ashx',
                params: { 'Parm1': this.rec.ID, 'Parm2': JSON.serialize(formData.Reason), 'Parm3': JSON.serialize(formData.UserMessage), 'CallbackMethod': 'InvalidDetails', 'CallbackParmCount': 3, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                success: function(response, options) {
                    var success = Ext.decode(response.responseText);
                    if (success) {
                        this.fireEvent('dataChanged');
                        this.close();
                    } else Ext.MessageBox.alert('Failure', 'Suspend Account failed.');
                } .createDelegate(this),
                failure: function() {
                    Ext.MessageBox.alert('Failure', 'Suspend Account failed.');
                }
            });
        }
    },
    
    cancelButtonClick: function(button, event) {
        this.close(); 
    }

});
Ext.reg('security.user.PromptWindow', nnet.security.user.PromptWindow);


if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/prompt-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/prompt-0-0.js');
namespace('nnet.security.user');

nnet.security.user.Detail = Ext.extend(Ext.Panel, {
    idPrefix: 'user',

    initComponent: function() {
        this.Template = new Ext.XTemplate(
            '<tpl for=".">',
                '<div id="'+this.idPrefix+'-user-detail-table">',
                    '<table border="0" cellpadding="0" cellspacing="2px">',
                        '<tr><td class="label">User ID (EMail):</td><td>{Name}</td></tr>',
                        '<tr><td class="label">Name:</td><td>{FullName}</td></tr>',
                        '<tr><td class="label">Postcode:</td><td>{Address__PostCode}</td></tr>',
                        '<tr><td class="label">Date of Birth:</td><td>{[fm.date(values.DateOfBirth,"d/m/Y")]}</td></tr>',
                        '<tr><td class="label">Status:</td><td>{CurrentState}</td></tr>',
                        '<tr><td class="label">Date Joined:</td><td>{[fm.date(values.DateJoined,"d/m/Y")]}</td></tr>',
                        '<tr><td class="label">Last Visit:</td><td>{[fm.date(values.LastVisit,"d/m/Y")]}</td></tr>',
                        '<tr><td class="label">Visits:</td><td>{Visits}</td></tr>',
                        '<tr><td class="label">Feedbacks:</td><td>{FeedbackCount}</td></tr>',
                        '<tr><td class="label">Services:</td><td>{ServicesCount}</td></tr>',
                    '</table>',
                '</div>',
            '</tpl>'
        );

        Ext.apply(this, {
            //id: 'security-user-detail-tbl',
            cls: 'security-user-detail-tbl',
            layout: 'table',
            layoutConfig:{columns:2},
            border: false,
            items: [{
                xtype: 'dataview',
                store: this.store,
                tpl: this.Template,
                cellCls: 'user-detail',
                autoHeight: true,
                //multiSelect: true,
                //overClass: 'x-view-over',
                itemSelector: 'div.' + this.idPrefix + '-user-detail-table',
                emptyText: 'No Newsletter to display'
            }, {
                xtype: 'nnetgmappanel',
                store: this.store,
                cellCls: 'user-map',
                width: 200,
                height: 200,
                zoomLevel: 14,
                gmapType: 'map',
                mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl']//,
//                setCenter: {
//                    lat: 42.339419,
//                    lng: -71.09077,
//                    marker: {title: 'Fenway Park'}
//                }//,
////                markers: {
//                    lat: 42.339419,
//                    lng: -71.09077,
//                    marker: {title: 'Northeastern University'}
//                }
            }]
        });
 
        nnet.security.user.Detail.superclass.initComponent.call(this, arguments);
    },

    display: function(id) {
        this.store.getContent(id); 
    }


});
Ext.reg('security-user-detail', nnet.security.user.Detail);




if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/user-detail-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/user-detail-0-0.js');
namespace('nnet.security.user');

nnet.security.user.DetailPanel = Ext.extend(Ext.Panel, {

    idPrefix: 'user',
    
    initComponent: function() {
        Ext.applyIf(this, {
            layout: 'border',
            hideMode: Ext.isIE ? 'offsets' : 'display',
            items: [{
                layout: 'fit',
                region: 'center',
                items: [{
                    id: this.idPrefix + '-security-user-detail',
                    idPrefix: this.idPrefix,
                    xtype: 'security-user-detail',
                    store: new nnet.security.user.DetailData()
                }]
             }, {
                layout: 'fit',
                region: 'east',
                width: 395,
                border: false,
                split: true,
                items: [{
                    id: this.idPrefix + '-security-siteprofile-list-panel',
                    xtype: 'security-siteprofile-list-panel',
                    hidePaging: true,
                    store: new nnet.security.siteprofile.ListData()
                }]
            }]
        });

        nnet.security.user.DetailPanel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.security.user.DetailPanel.superclass.onRender.apply(this, arguments);
        this.ListPanel = Ext.getCmp(this.idPrefix + '-security-siteprofile-list-panel');
        this.Detail = Ext.getCmp(this.idPrefix + '-security-user-detail');
    },
    
    display: function(userID) {
        this.Detail.display(userID);
        this.ListPanel.display(userID);
    }

});

Ext.reg('security-user-detail-panel', nnet.security.user.DetailPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/user-detail-panel-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/user-detail-panel-0-0.js');
namespace('nnet.security.user');

nnet.security.user.InfoPanel = Ext.extend(Ext.TabPanel, {


    initComponent: function() {
        try {
            this.ContentID = 0;
            this.DetailsTabContent = 0;
            this.SessionTabContent = 0;
            this.HistorynTabContent = 0;
            this.ActivityTabContent = 0;
            this.ForumTabContent = 0;
            
            Ext.applyIf(this, {
                activeTab: 0,
                layoutOnTabChange: true,
                tabPosition: 'bottom',
                border: false,
                items: [{
                    id: 'user-details-tab',
                    title: 'Details',
                    iconCls: 'icon-user',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-user-detail-panel',
                        idPrefix: 'user',
                        xtype: 'security-user-detail-panel'
                    }]
                }, {
                    id: 'user-session-tab',
                    title: 'Sessions',
                    iconCls: 'icon-user-session',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-user-sessions-panel',
                        xtype: 'session-list-panel',
                        listOnRender: false,
                        store: new nnet.security.session.ListData()
                    }]
                }, {
                    id: 'user-history-tab',
                    title: 'History',
                    iconCls: 'icon-history',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-history-list-panel',
                        xtype: 'security-history-list-panel',
                        store: new nnet.security.history.ListData()
                    }]
                }, {
                    id: 'user-activities-tab',
                    title: 'Activites',
                    iconCls: 'icon-activities',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-activity-list-panel',
                        xtype: 'security-activity-list-panel',
                        store: new nnet.security.activity.ListData()
                    }]
                }, {
                    id: 'forum-messages-tab',
                    title: 'Forum Messages',
                    iconCls: 'icon-posts',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'forum-list-panel',
                        xtype: 'forum-list-panel',
                        store: new nnet.forum.ListData()
                    }]
                }]
            });
            nnet.security.user.InfoPanel.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.security.user.InfoPanel.initComponent", e); }
    },

    onRender: function() {
        nnet.security.user.InfoPanel.superclass.onRender.apply(this, arguments);
        this.UserDetailPanel = Ext.getCmp('security-user-detail-panel');
        this.SessionListPanel = Ext.getCmp('security-user-sessions-panel');
        this.HistoryListPanel = Ext.getCmp('security-history-list-panel');
        this.ActivitesListPanel = Ext.getCmp('security-activity-list-panel');
        this.ForumListPanel = Ext.getCmp('forum-list-panel');

        this.DetailsTab = Ext.getCmp('user-details-tab');
        this.SessionTab = Ext.getCmp('user-session-tab');
        this.HistoryTab = Ext.getCmp('user-history-tab');
        this.ActivitesTab = Ext.getCmp('user-activities-tab');
        this.ForumTab = Ext.getCmp('forum-messages-tab');
        this.activate(0);
        this.addListener('tabchange', this.tabChange);

    },

    display: function(sm, index, record) {
        this.ContentID=record.id;
        this.displayTabContent(this);
    },
    
    tabChange: function(tab){
        this.displayTabContent(tab);
    },
     
     displayTabContent: function(tab){
         if (this.activeTab == this.DetailsTab && this.DetailsTabContent != this.ContentID) {
            this.DetailsTabContent = this.ContentID;
            this.UserDetailPanel.display(this.ContentID);
        } else if (this.activeTab == this.SessionTab && this.SessionTabContent != this.ContentID) {
            this.SessionTabContent=this.ContentID;
            this.SessionListPanel.display(this.ContentID);
        } else if (this.activeTab == this.HistoryTab  && this.HistorynTabContent != this.ContentID) {
            this.HistorynTabContent=this.ContentID;
            this.HistoryListPanel.display(this.ContentID);
        } else if (this.activeTab == this.ActivitesTab  && this.ActivityTabContent != this.ContentID) {
            this.ActivityTabContent=this.ContentID;
            this.ActivitesListPanel.display(this.ContentID);
        } else if (this.activeTab == this.ForumTab && this.ForumTabContent != this.ContentID) {
            this.ForumTabContent = this.ContentID;
            this.ForumListPanel.display(this.ContentID);
        }
     }

});

Ext.reg('security-user-info-panel', nnet.security.user.InfoPanel);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/user-info-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/user-info-0-0.js');
namespace('nnet.security.user');


    nnet.security.user.ListData = Ext.extend(Ext.data.JsonStore, {
        constructor: function() {
            nnet.security.user.ListData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetUserList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            remoteSort: true,
            sortInfo: { field: 'ID', direction: 'DESC' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'Name',
                'FullName',
                'CurrentState',
                { name: 'DateOfBirth', type: 'date', dateFormat: 'd/m/Y' },
                'Address__PostCode',
                'col__SiteProfiles__Site',
                { name: 'DateJoined', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'LastVisit', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'Newsletter', type: 'boolean' },
                { name: 'Visits', type: 'int' },
                'lat',
                'lng',
                { name: 'FeedbackCount', type: 'int' },
                { name: 'ServicesCount', type: 'int' },
                'Notes',
                { name: 'DisableDelete', type: 'boolean' },
                { name: 'DisableAccept', type: 'boolean' },
                { name: 'DisableApprove', type: 'boolean' },
                { name: 'DisableConfirm', type: 'boolean' },
                { name: 'DisableInvalidEmail', type: 'boolean' },
                { name: 'DisableInvalidDetails', type: 'boolean' },
                { name: 'DisableSuspend', type: 'boolean' },
                { name: 'DisableUnSuspend', type: 'boolean' }
             ]
        });
    },

    getList: function() {
        this.load({
            params: { 'start': 0, 'limit': 50, 'CallbackMethod': 'GetFailedTargetsList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading Users...'
        });
    },

    
    changeAccountState: function(id,state){
        Ext.Ajax.request({
            url: '/Security/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': state, 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', state + ' failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', state + ' failed.');
            }
        });
    },


    updateEmail: function(id, email) {
        Ext.Ajax.request({
        url: '/Security/Handler.ashx',
            params: { 'Parm1': id,'Parm2':  JSON.serialize(email), 'CallbackMethod': 'UpdateEmail', 'CallbackParmCount': 2, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Update Email failed.');
            }.createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Update Email failed.');
            }
        });
    },
    
    updateField: function(id, field ,value) {
        Ext.Ajax.request({
            url: '/Security/Handler.ashx',
            params: { 'Parm1': id, 'Parm2': JSON.serialize(field), 'Parm3': JSON.serialize(value), 'CallbackMethod': 'UpdateField', 'CallbackParmCount': 3, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Update failed.');
            } .createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Update failed.');
            }
        });
    },

    invalidEmail: function(id) {
        Ext.Ajax.request({
            url: '/Security/Handler.ashx',
            params: { 'Parm1': id, 'CallbackMethod': 'InvalidEmail', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            success: function(response, options) {
                var success = Ext.decode(response.responseText);
                if (success) {
                    this.reload();
                } else Ext.MessageBox.alert('Failure', 'Set Status to Invalid Email failed.');
            }.createDelegate(this),
            failure: function() {
                Ext.MessageBox.alert('Failure', 'Set Status to Invalid Email failed.');
            }
        });
    },


    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('nnet-security-user-list-data', nnet.security.user.ListData);


nnet.security.user.DetailData = Ext.extend(Ext.data.JsonStore, {
    constructor: function() {
        nnet.security.user.DetailData.superclass.constructor.call(this, {
            url: '/Security/Handler.ashx',
            baseParams: { 'CallbackMethod': 'GetUser', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            totalProperty: 'itemCount',
            root: 'data',
            id: 'ID',
            fields: [
                { name: 'ID', type: 'int' },
                'Name',
                'FullName',
                'CurrentState',
                { name: 'DateOfBirth', type: 'date', dateFormat: 'd/m/Y' },
                'Address__PostCode',
                'col__SiteProfiles__Site',
                { name: 'DateJoined', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'LastVisit', type: 'date', dateFormat: 'd/m/Y' },
                { name: 'Newsletter', type: 'boolean' },
                { name: 'Visits', type: 'int' },
                'lat',
                'lng',
                { name: 'FeedbackCount', type: 'int' },
                { name: 'ServicesCount', type: 'int' },
                'Notes',
                { name: 'DisableDelete', type: 'boolean' },
                { name: 'DisableAccept', type: 'boolean' },
                { name: 'DisableApprove', type: 'boolean' },
                { name: 'DisableConfirm', type: 'boolean' },
                { name: 'DisableInvalidEmail', type: 'boolean' },
                { name: 'DisableInvalidDetails', type: 'boolean' },
                { name: 'DisableSuspend', type: 'boolean' },
                { name: 'DisableUnSuspend', type: 'boolean' }
            ]
        });
    },

    getContent: function(id) {
        this.load({
            params: { 'Parm1': id, 'CallbackMethod': 'GetUser', 'CallbackParmCount': 1, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            waitMsg: 'Loading User Details'
        });
    },


    // returns JSon data object
    getData: function() {
        var jData = this.reader.jsonData;
        return jData == undefined ? null : jData.data;
    }


});
Ext.reg('nnet-security-user-detail-data', nnet.security.user.DetailData);



if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/data-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/data-0-0.js');
namespace('nnet.security.user');

nnet.security.user.List = Ext.extend(Ext.grid.GridPanel, {

    border: false,

    initComponent: function() {

        this.actionStatus = new Ext.ux.grid.RowActions({
            header: 'Set User Status',
            autoWidth: false,
            hideMode: 'display',
            width: 120,
            actions: [
                { iconCls: 'icon-user-approve', tooltip: 'Approve account or change', callback: this.approveAccount, hideIndex: 'DisableApprove' },
                { iconCls: 'icon-user-accept', tooltip: 'Move user to pending, will send an email confirm mail', callback: this.acceptAccount, hideIndex: 'DisableAccept' },
                { iconCls: 'icon-user-confirm', tooltip: 'Confirm account or change', callback: this.confirmAccount, hideIndex: 'DisableConfirm' },
                { iconCls: 'icon-user-suspend', tooltip: 'Suspend account', callback: this.suspendAccount, hideIndex: 'DisableSuspend' },
                { iconCls: 'icon-user-unsuspend', tooltip: 'UnSuspend account', callback: this.unsuspendAccount, hideIndex: 'DisableUnSuspend' },
                { iconCls: 'icon-email-error', tooltip: 'Set account status to Invalid Email', callback: this.invalidEmail, hideIndex: 'DisableInvalidEmail' },
                { iconCls: 'icon-user-error', tooltip: 'Set account status to Invalid Details', callback: this.invalidDetails, hideIndex: 'DisableInvalidDetails' },
                { iconCls: 'icon-user-delete', tooltip: 'Delete account', callback: this.deleteAccount, hideIndex: 'DisableDelete' }
            ]
        });

        this.cellActions = new Ext.ux.grid.CellActions({
            align: 'left'
        });

        this.filters = new Ext.ux.grid.GridFilters({
            filters: [
			    { type: 'list', dataIndex: 'col__SiteProfiles__Site', labelField: 'display',
			        store: new Ext.data.JsonStore({
			            url: '/Config/Handler.ashx',
			            baseParams: { 'CallbackMethod': 'GetSiteList', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
			        })
			    },
				{ type: 'string', dataIndex: 'Name' },
				{ type: 'string', dataIndex: 'FullName' },
				{ type: 'list', dataIndex: 'CurrentState', labelField: 'display',
				    store: new Ext.data.JsonStore({
				        url: '/Security/Handler.ashx',
				        baseParams: { 'CallbackMethod': 'GetAccountStates', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' }
				    })
				},
			    { type: 'date', dataIndex: 'DateJoined', dateFormat: 'd/m/Y' },
			    { type: 'date', dataIndex: 'LastVisit', dateFormat: 'd/m/Y' },
			    { type: 'numeric', dataIndex: 'Visits' },
			    { type: 'boolean', dataIndex: 'Newsletter' },
			    { type: 'date', dataIndex: 'DateOfBirth', dateFormat: 'd/m/Y' },
				{ type: 'string', dataIndex: 'Address__PostCode' }
		    ],
				json: true
        });


        Ext.apply(this, {
            viewConfig: { scrollOffset: 1 }, //  scrollOffset: 1 removes scrollbar space
            autoScroll: true,
            loadMask: { msg: 'Loading Users...' },
            maskDisabled: false,

            columns: [
            //this.action,
	            {id: 'ID', hidden: true, dataIndex: 'ID' },
	            { header: "Site", width: 115, sortable: false, dataIndex: 'col__SiteProfiles__Site' },
	            { header: "UserID (Email)", width: 200, sortable: true, dataIndex: 'Name', cellActions: [{ iconCls: 'icon-edit-name', tooltip: 'Edit Email', callback: this.editField}] },
	            { header: "Name", width: 160, sortable: true, dataIndex: 'FullName', cellActions: [{ iconCls: 'icon-edit-fullname', tooltip: 'Edit Name', callback: this.editField}] },
	            { header: "Status", width: 80, sortable: true, dataIndex: 'CurrentState' },
	            { header: "Joined", width: 70, sortable: true, dataIndex: 'DateJoined', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
	            { header: "Last Visit", width: 70, sortable: true, dataIndex: 'LastVisit', renderer: Ext.util.Format.dateRenderer('d/m/Y') },
                { header: "Visits", width: 50, sortable: true, dataIndex: 'Visits' },
                { header: "Newsletter", width: 70, sortable: true, dataIndex: 'Newsletter' },
	            { header: "Date of Birth", width: 85, sortable: true, dataIndex: 'DateOfBirth', renderer: Ext.util.Format.dateRenderer('d/m/Y'), cellActions: [{ iconCls: 'icon-edit-dateofbirth', tooltip: 'Edit Date of Bith', callback: this.editField}] },
	            { header: "Postcode", width: 80, sortable: true, dataIndex: 'Address__PostCode', cellActions: [{ iconCls: 'icon-edit-postcode', tooltip: 'Edit Postcode', callback: this.editField}] },
	            this.actionStatus
			],
            plugins: [this.actionStatus, this.cellActions, this.filters],
            bbar: new Ext.PagingToolbar({
                pageSize: 200,
                store: this.store,
                displayInfo: true,
                plugins: this.filters
            }),
            onLoad: Ext.emptyFn, // try this.
            listeners: {
                beforerefresh: function(v) {
                    v.scrollTop = v.scroller.dom.scrollTop;
                    v.scrollHeight = v.scroller.dom.scrollHeight;
                },
                refresh: function(v) {
                    v.scroller.dom.scrollTop = v.scrollTop + (v.scrollTop == 0 ? 0 : v.scroller.dom.scrollHeight - v.scrollHeight);
                }
            }

        });
        nnet.security.user.List.superclass.initComponent.call(this, arguments);
    },

    onRender: function() {
        nnet.security.user.List.superclass.onRender.apply(this, arguments);
        this.store.getList();
        //this.store.on('load', this.autoSizeColumns, this);
    },

    approveAccount: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'User Status Confirmation',
            msg: 'Approve Account',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.changeAccountState(record.id, 'ApproveAccount');
                }
            }
        });
    },

    confirmAccount: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Confirm Confirmation',
            msg: 'Do you want to confirm the account, this is normally done by a user responding to the confirmation email',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.changeAccountState(record.id, 'ConfirmAccount');
                }
            }
        });
    },

    acceptAccount: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Confirm Insert',
            msg: 'Do you want to insert the account, this is normallyafter an error, and will set user to Pending and send a confirmation email',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.changeAccountState(record.id, 'InsertAccount');
                }
            }
        });
    },


    suspendAccount: function(grid, record, action, row, col) {
        win = new nnet.security.user.PromptWindow({
            title: 'Suspend Account',
            formAction: 'suspend',
            userText: 'Your account on $UserSitesList has been suspended following complaints by other users. If you wish it to be reinstated please see the following page which answers frequently asked questions about use of the forum. http://www.nnet-server.com/server/app/forum/moderation.htm',
            reasonText: 'User account has been suspended.',
            rec: record.data,
            listeners: { scope: this, dataChanged: function() { grid.store.reload(); } }
        });
        win.show();
    },

    unsuspendAccount: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'UnSuspend Confirmation',
            msg: 'Do you want to unsuspend account',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.changeAccountState(record.id, 'UnsuspendAccount');
                }
            }
        });
    },

    deleteAccount: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'Delete Confirmation',
            msg: 'Do you want to delete the account, the account cannot be undeleted',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.changeAccountState(record.id, 'DeleteAccount');
                }
            }
        });
    },

    invalidEmail: function(grid, record, action, row, col) {
        Ext.Msg.show({
            title: 'User Status Confirmation',
            msg: 'Are you certain this users email is invalid',
            buttons: Ext.Msg.OKCANCEL,
            closable: false,
            icon: Ext.MessageBox.QUESTION,
            fn: function(btn) {
                if (btn == 'ok') {
                    grid.store.invalidEmail(record.id);
                }
            }
        });
    },

    invalidDetails: function(grid, record, action, row, col) {
        win = new nnet.security.user.PromptWindow({
            title: 'Invalid Details for Account',
            formAction: 'invalid-details',
            userText: 'Your Name, PostCode, Date of Birth on $UserSitesList is invalid, please correct or you account may be suspended. ',
            reasonText: 'User Name, PostCode, Date of Birth is invalid',
            rec: record.data,
            listeners: { scope: this, dataChanged: function() { grid.store.reload(); } }
        });
        win.show();
    },

    editEmail: function(grid, record, action, value) {
        Ext.MessageBox.prompt('EMail', 'Edit Email:',
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateEmail(record.id, text);
                }
            }, this, false, value);
    },
    editName: function(grid, record, action, value) {
        Ext.MessageBox.prompt('Name', 'Edit Name:',
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateField(record.id, "", text);
                }
            }, this, false, value);
    },
    editPostcode: function(grid, record, action, value) {
        Ext.MessageBox.prompt('Postcode', 'Edit Postcode:',
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateField(record.id, "", text);
                }
            }, this, false, value);
    },

    editDateOfBirth: function(grid, record, action, value) {
        Ext.MessageBox.prompt('Date Of Birth', 'Edit Date Of Birth:',
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateField(record.id, "", text);
                }
            }, this, false, value);
    },

    editField: function(grid, record, action, value) {
        switch (action) {
            case 'icon-edit-name': var field = 'Name';  var display='EMail'; break;
            case 'icon-edit-fullname': var field = 'FullName'; var display = 'Name'; break;
            case 'icon-edit-postcode': var field = 'PostCode'; var display = 'Postcode'; break;
            case 'icon-edit-dateofbirth': var field = 'DateOfBirth'; var display = 'Date of Birth'; value = Ext.util.Format.date(value, 'd/m/Y'); break;
        }
        Ext.MessageBox.prompt(display, 'Edit ' + display,
            function(btn, text) {
                if (btn == 'ok') {
                    grid.store.updateField(record.id, field, text);
                }
            }, this, false, value);
    },


    autoSizeColumns: function() {
        for (var i = 0; i < this.colModel.getColumnCount(); i++) {
            this.autoSizeColumn(i);
        }
    },

    autoSizeColumn: function(c) {
        this.colModel.setColumnWidth(c, 1);
        var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
        for (var i = 0, l = this.store.getCount(); i < l; i++) {
            w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
        }
        this.colModel.setColumnWidth(c, w + 5); // +5 to +10
        return w;
    }

});
Ext.reg('user-list-panel', nnet.security.user.List);

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/list-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/list-0-0.js');
namespace('nnet.security.user');

nnet.security.user.Panel = Ext.extend(Ext.Panel, {

    initComponent: function() {
        this.PreviewPanel = null;

        Ext.applyIf(this, {
            id: 'user-view',
            layout: 'border',
            hideMode: Ext.isIE ? 'offsets' : 'display',
            items: [{
                layout: 'fit',
                region: 'center',
                items: [{
                    id: 'user-list-panel',
                    xtype: 'user-list-panel',
                    store: new nnet.security.user.ListData()
                }]
             }, {
                layout: 'fit',
                region: 'south',
                border: false,
                height: 250,
                split: true,
                items: [{
                    id: 'security-user-info-panel',
                    xtype: 'security-user-info-panel'
                    //store: new nnet.security.user.PreviewData()
                 }]
            }]
        });

        nnet.security.user.Panel.superclass.initComponent.apply(this, arguments);
    },

    onRender: function() {
        nnet.security.user.Panel.superclass.onRender.apply(this, arguments);
        var listPanel = Ext.getCmp('user-list-panel');
        this.InfoPanel = Ext.getCmp('security-user-info-panel');
        var gsm = listPanel.getSelectionModel();
        gsm.on('rowselect', this.InfoPanel.display, this.InfoPanel); // Sets the context of the handler to be the SalesPreview object
        //listPanel.store.on('load', gsm.selectFirstRow, gsm); // Display first row in preview on data load

    }
});

Ext.reg('security-user-panel', nnet.security.user.Panel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/user/user-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/user/user-0-0.js');
namespace('nnet.security');

nnet.security.TabPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        try{
            Ext.applyIf(this, {
                activeTab: 0,
                layoutOnTabChange: true,
                border: false,
                items: [{
                    id: 'user-tab',
                    title: 'Users',
                    iconCls: 'icon-user',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-user-panel',
                        xtype: 'security-user-panel'
                    }]
                }, {
                    id: 'session-tab',
                    title: 'Sessions',
                    iconCls: 'icon-user-session',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    items: [{
                        id: 'security-session-panel',
                        xtype: 'security-session-panel'
                    }]
                }]
            });
            nnet.security.TabPanel.superclass.initComponent.apply(this, arguments);
        } catch (e) { Log.exp("NNet.security.TabPanel.initComponent", e); }
    },

    onRender: function() {
        nnet.security.TabPanel.superclass.onRender.apply(this, arguments);
        this.activate(0);
    }
});

Ext.reg('security-panel', nnet.security.TabPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/security/security-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/security/security-0-0.js');
namespace('nnet');

nnet.Application = $j.klass({
    initialize: function(config) {
        try {
            this.Applications = new Ext.util.MixedCollection();
            this.Applications.add('admin', { id: 'admin', Name: 'Admin', PageTitle: NNetSite.SiteName + " Administration", TabIndex: 0 });
            this.Applications.add('property', { id: 'property', Name: 'Property', PageTitle: NNetSite.SiteName + " Property", TabIndex: 1 });

            this.DefaultApp = this.Applications.get('property');
            this.CurrentApp = this.Applications.get(sVars.InitialApp);

            this.CurrentModule = sVars.Module;
            this.PropertyID = sVars.PropertyID;

            nnet.onApplicationActivated.subscribe(this.activate, this);

        } catch (e) { logE("nnet.Application.initialize", e); }
    },

    activate: function(type, args, me) {
        try {
            me.CurrentApp = me.Applications.get(args[0].id);
            nnet.onApplicationChanged.fire(me.CurrentApp);
        } catch (e) { logE("Application.activate handler", e); }
    }

});





if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/application-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/application-0-0.js');
namespace('nnet.admin');
var AD = null;

nnet.ApplicationPanel = Ext.extend(Ext.TabPanel, {

    initComponent: function() {
        try {

            this.ApplicationMap = new Ext.util.MixedCollection();
            this.ApplicationMap.add('admin', 1);
            this.ApplicationMap.add('property', 0);
            this.DefaultApp = 'property';


            Ext.applyIf(this, {
                margins: '0 0 0 0',
                //activeTab: this.ApplicationMap.get(this.intialApp),
                border: false,
                cls: 'background-tabstrip',
                layoutOnTabChange: true,
                items: [{
                    title: 'Admin',
                    pageTitle: NNetSite.SiteName + " Administration",
                    id: 'admin-view',
                    appId: 'admin',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    listeners: { render: this.handleAdminRender, activate: this.activateApplication }
                }, {
                    title: 'Property',
                    pageTitle: NNetSite.SiteName + " Properties",
                    id: 'property-view',
                    appId: 'property',
                    layout: 'fit',
                    hideMode: Ext.isIE ? 'offsets' : 'display',
                    listeners: { render: this.handlePropertyRender, activate: this.activateApplication }
                }]
            });
            nnet.ApplicationPanel.superclass.initComponent.apply(this, arguments);

            onLogOut.subscribe(function(type, args, me) {
                if (args[0].WasAdmin) {
                    me.hideTabStripItem('admin-view');
                    if (NNetApplication.CurrentApp.id == 'admin') me.activate(NNetApplication.DefaultApp.TabIndex); ;
                }
            }, this);
            onLogIn.subscribe(function(type, args, me) { if (args[0].IsAdmin) me.unhideTabStripItem('admin-view'); }, this);
        } catch (e) { Log.exp("NNet.ApplicationPanel.initialize", e); }

    },

    onRender: function() {
        try{
            nnet.ApplicationPanel.superclass.onRender.apply(this, arguments);
            if ( !CurrentUser.IsAdminUser) {
                this.hideTabStripItem('admin-view');
                if (NNetApplication.CurrentApp.id == 'admin') {
                    NNetApplication.CurrentApp = NNetApplication.DefaultApp;
                    Ext.MessageBox.alert('Message', "Please login as an Administrator or Editor to manage the site");
                }
            }
            this.activate(NNetApplication.CurrentApp.TabIndex);
        } catch (e) { Log.exp("NNet.ApplicationPanel.onRender", e); }
    },

    // Only executed once, and component tree only instanciated when Admin Tab selected.
    handleAdminRender: function(tabPanel) {
        if (tabPanel.items != null) {
            var tab;
            while (tab = tabPanel.items.first()) {
                tabPanel.remove(tab, true);
            }
        }
        tabPanel.add.apply(tabPanel, [{ xtype: 'admin-panel'}]); //your new array of config objects
    },

    // Only executed once, and component tree only instanciated when Admin Tab selected.
    handlePropertyRender: function(tabPanel) {
        if (tabPanel.items != null) {
            var tab;
            while (tab = tabPanel.items.first()) {
                tabPanel.remove(tab, true);
            }
        }
        tabPanel.add.apply(tabPanel, [{ xtype: 'property-panel'}]); //your new array of config objects
    },

    activateApplication: function(tabPanel) {
        nnet.onApplicationActivated.fire({ id: tabPanel.appId} );
    }

});

Ext.reg('application-panel', nnet.ApplicationPanel);
   






if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/application-panel-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/application-panel-0-0.js');
namespace('nnet');

nnet.Site = $j.klass({
    initialize: function(config) {
        try {
            this.ID = config.siteID;
            this.LocationName = config.LocationName;
            this.SiteName = config.SiteName;
            this.SiteLatitude = config.Latitude;
            this.SiteLongitude = config.Longitude;
            this.SiteMapZoom = config.GoogleMapZooom;
            this.GoogleApiKey = config.GoogleApiKey;
            this.OldSiteId = config.OldSiteId;
        } catch (e) { logE("nnet.Site.initialize", e); }
    }
});





if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/site-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/site-0-0.js');
namespace('nnet');

nnet.User = $j.klass({
    initialize: function(config) {
        try {
            this.LoggedIn = config.IsLoggedIn;
            this.IsAdminUser = config.IsAdmin;
            this.UserName = config.UserName;
            this.ShoppingCart = config.ShoppingCart;
            this.IsUserAccountManager = config.IsUserAccountManager;
            this.ID = config.Id;
            //           if (config != undefined && config.id) this.ID = config.id;
            //           else this.ShoppingCart = new nnet.fin.ShoppingCart(); // Site user as no id.
            //            onLogOut.subscribe(function(type, args) { NNet.CurrentUser.LoggedIn = false; });
            onLogIn.subscribe(this.onLogon, this);
        } catch (e) { logE("nnet.User.initialize", e); }
    },

    // Show current User Profile, allow editing
    show: function() {
        try {
            var win = new nnet.PopUpWindow({ url: "/Security/Profile" + (this.ID != null ? "/" + this.ID : ""), minWidth: 400 });
            win.show();
        } catch (e) { logE("nnet.User.show", e); }
    },

    onLogon: function(type, args, me) {
        me.LoggedIn = true;
        me.IsAdminUser = args[0].IsAdmin;
        me.UserName = args[0].UserName;
        me.ShoppingCart = args[0].ShoppingCart;
        me.IsUserAccountManager = args[0].IsUserAccountManager;
        me.ID = args[0].Id;
    },


    logout: function() {
        try {
            Ext.Ajax.request({
                url: '/Security/Handler.ashx',
                params: { 'CallbackMethod': 'Logout2', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
                scope: this,
                success: function(response, options) {
                    var result = Ext.decode(response.responseText);
                    if (result.success) {
                        this.LoggedIn = false;
                        this.IsAdminUser = false;
                        this.UserName = null;
                        this.ShoppingCart = false;
                        this.IsUserAccountManager = false;
                        this.ID = 0;
                        onLogOut.fire(result)
                    } else {
                        Ext.MessageBox.alert('Failure', 'Logout failed - ' + result.msg);
                    }
                },
                failure: function(response, options) {
                    Ext.MessageBox.alert('Failure', 'Logout failed');
                }
            });
        } catch (e) { logE("nnet.Security.logout", e); }
    },


    signUp: function() {
        try {
            var win = new nnet.PopUpWindow({ url: '/Security/Profile?F=Insert', onClose: this.signUPCloseWindowHandler, minWidth: 400 });
            win.show();
        } catch (e) { logE("nnet.User.show", e); }
    },

    signUPCloseWindowHandler: function() {
        // Check if logged in now and raise event if have.
        Ext.Ajax.request({
            url: '/Security/Handler.ashx',
            params: { 'CallbackMethod': 'UserStatus', 'CallbackParmCount': 0, '__WWEVENTCALLBACK': 'SDCallback', 'WWEVENTTARGET': 'Page' },
            scope: this,
            success: function(response, options) {
                var result = Ext.decode(response.responseText);
                if (result.success) {
                    // After signup if now logged on fire event
                    if (result.IsLoggedIn && !this.LoggedIn) onLogIn.fire(result);
                    this.LoggedIn = result.IsLoggedIn;
                    this.IsAdminUser = result.IsAdmin;
                    this.UserName = result.UserName;
                    this.ShoppingCart = result.ShoppingCart;
                    this.ID = result.Id;
                } else {
                    Ext.MessageBox.alert('Failure', 'User Status failed - ' + result.msg);
                }
            },
            failure: function(response, options) {
                Ext.MessageBox.alert('Failure', 'User Status failed.');
            }
        });

    },

    // Show current User Profile, allow editing
    showRegConfirm: function() {
        try {
            if (this.ID != null) new nnet.PopUpWindow({ url: "/Security/Confirm/" + this.ID, minWidth: 400 }).show();
            else alert("User could not be found");
        } catch (e) { logE("nnet.User.showRegConfirm", e); }
    },

    showSiteSignUp: function() {
        try {
            new nnet.PopUpWindow({ url: '/Security/Profile?F=Add', onClose: this.signUPCloseWindowHandler, minWidth: 400 }).show();
        } catch (e) { logE("nnet.User.showSiteSignUp", e); }
    },

    passwordReset: function() {
        try {
            new nnet.PopUpWindow({ url: '/Security/PasswordRecovery', minWidth: 400 }).show();
        } catch (e) { logE("nnet.User.passwordReset", e); }
    },

    resetPassword: function() {
        try {
            if (this.ID != null) new nnet.PopUpWindow({ url: "/Security/PasswordReset/" + this.ID, minWidth: 350 }).show();
            else alert("User could not be found");
        } catch (e) { logE("nnet.User.resetPassword", e); }
    }


});





if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/user-prop-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/user-prop-0-0.js');
namespace('nnet');
var NNet = null;

var TaskRunner = new Ext.util.TaskRunner();
var CurrentUser = new nnet.User(sVars.SecInfo);
var NNetSite = new nnet.Site(sVars.SiteInfo);
var NNetPage = new nnet.Page();
var NNetApplication = new nnet.Application();

nnet.NNet = $j.klass({
    initialize: function(startupApp) {
        try {
        
            this.AppContainer = null;
            this.CurrentAppView = null;
            
            document.body.style.cursor = 'wait';
            //            this.ProcessID = null;
            //**fixedContentLayout();
            //**adjustLayout();

            //Ext.state.Manager.setProvider(new Ext.state.CookieProvider());


            // turn on validation errors beside the field globally
            Ext.form.Field.prototype.msgTarget = 'side';

            Ext.QuickTips.init();

            // following is not working for normal tooltips.
            Ext.apply(Ext.QuickTips.getQuickTip(), {
                maxWidth: 200,
                minWidth: 100,
                showDelay: 50,
                dismissDelay: 99999,
                shadow: true,
                trackMouse: true
            });

            // Must use this.id as this does not work.
            Ext.form.Field.prototype.afterRender = Ext.form.Field.prototype.afterRender.createSequence(function() {
                if (this.tooltip) {
                    new Ext.ToolTip({
                        target: this.id,
                        title: this.tooltipTitle,
                        html: this.tooltip,
                        showDelay: 20,
                        dismissDelay: 0,
                        shadow: true,
                        trackMouse: true
                    });
                }
            });
            

            this.Container = new Ext.Viewport({
                layout: 'border-margin',
                style: 'margin: 10px;',
                items: [
                    { // raw
                        id: 'header',
                        region: 'north',
                        xtype: 'header-panel',
                        bodyStyle: 'background-image: url(http://img4.neighbournet.com/resource/image/nnet/header.gif);background-repeat: repeat-x;',
                        height: 100,
                        border: false
                    }, {
                        region: 'south',
                        contentEl: 'footer',
                        bodyStyle: 'background-image: url(http://img2.neighbournet.com/resource/image/nnet/footer.gif);background-repeat: repeat-x;',
                        height: 30,
                        border: false
                    }, {
                        region: 'center',
                        id: 'application-tabpanel',
                        xtype: 'application-panel',
                        tabPosition: 'bottom'
                    }                    
//                    {
//                        id: 'appContainer',
//                        region: 'center',
//                        layout: 'fit',
//                        items: [{
//                            id: 'appView'
//                        }]
//                    }
                  ]
            });

            //this.AppContainer = Ext.getCmp('appContainer');
            //this.CurrentAppView = Ext.getCmp('appView');


            //            if (sVars.CURRENT_APP == "DIRECTORY") {
            //                if (sVars.TREE_DATA == undefined) SD = new nnet.sd.Directory(null, sVars.INITIAL_DATA);
            //                else SD = new nnet.sd.Directory(sVars.TREE_DATA, sVars.INITIAL_DATA); // ******
            //                this.CurrentApp = SD;
            //            } else if (sVars.CURRENT_APP == "ADMIN") {
            //                AD = new nnet.admin.Admin(sVars.TREE_DATA);
            //                this.CurrentApp = AD;
            //            }
            //            // Variables
            //this.Page = new nnet.Page();
            //            this.PageHistory = new nnet.PageHistory();
            //this.FooterToolBar = new nnet.FooterToolBar();

            //            this.Security = new nnet.Security();
            if (CurrentUser.LoggedIn) onLogIn.fire({ IsAdmin: CurrentUser.IsAdminUser, IsStartUp: true })
            else onLogOut.fire({ IsAdmin: false, IsStartUp: true })

            //            onLogOut.subscribe(function(type, args) { this.CurrentUser.LoggedIn = false; });
            //            onLogIn.subscribe(function(type, args) { this.CurrentUser.LoggedIn = true; });

            this.Help = new nnet.Help();

 //           PROP = new nnet.prop.Property();
 //           this.CurrentApp = PROP;


            //            nnet.onPageReady.subscribe(this.PageHistory.startup);
            nnet.onPageReady.subscribe(this.startup);

            $j('.footer-toolbar').attach(FooterToolBar, { IsUserLoggedIn: CurrentUser.LoggedIn, IsUserAdmin: CurrentUser.IsAdminUser, UserHasShoppingCart: CurrentUser.ShoppingCart });
            $j('.footer-toolbar .button').attach(FooterButton);


        } catch (e) { Log.exp("NNet.initialize", e); }
    },

    startup: function() {
        try {
            NNet.ProcessID = $j('#__PROCESSID').val();


            //fixedContentLayout();
            //adjustLayout();
            //**YAHOO.util.Event.addListener(window, 'resize', ResizePage);
            //**YAHOO.util.Event.addListener('splitter', 'click', spliterEvent);

            //            NNet.CurrentApp.startup();
            //            if (sVars.IsAdminSite) InitAdmin();
            //            else InitServiceDirectory();


////////////            NNet.HeaderToolBar.startup();
//            NNet.HeaderAd.startup();
            //NNet.CurrentApp.startup();

 //           NNet.switchApp(NNet.CurrentApp);

            document.body.style.cursor = 'default';
        } catch (e) { Log.exp("NNet.startup", e); }
    },

    // switch to an application fro
    switchApp: function(App) {
        try {
            if (App.Container != this.CurrentAppView) {
                this.AppContainer.remove(this.CurrentAppView);
                this.AppContainer.doLayout();
                App.startup();
                this.AppContainer.add(App.Panel);
                this.AppContainer.doLayout();
                App.tidyup(); // tidy up afer rendering
            }
        } catch (e) { Log.exp("NNet.switchApp", e); }
    },

    refreshContent: function() {
        onRefreshContent.fire();
    },

    onAjaxError: function(result) {
        document.body.style.cursor = 'default';
    }
});


NNet = new nnet.NNet();

// Popup window interface methods - so dont have to change
function RefreshContentPopUp() { };

if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/resource/js/nnet/nnet-prop-0-0.js'); 
                        if( !window._combinedScripts ) { window._combinedScripts = []; } 
                        window._combinedScripts.push('/resource/js/nnet/nnet-prop-0-0.js');

                if(typeof(Sys)!=='undefined')             
                {                
                    if(typeof(Sys._ScriptLoader) !== 'undefined')
                    {                                    
                        Sys._ScriptLoader.isScriptLoaded = function Sys$_ScriptLoader$isScriptLoaded(scriptSrc) 
                        {                                                    
                            var dummyScript = document.createElement('script');
                            dummyScript.src = scriptSrc;
                            var result = Array.contains(Sys._ScriptLoader._getLoadedScripts(), scriptSrc);
                            if( result === true ) return true;
                            result = Array.contains( window._combinedScripts, scriptSrc );
                            if( result === true ) return true;                            
                            var scriptTags = document.getElementsByTagName('script');
                            for(var i = 0; i < scriptTags.length; i ++ ) if( scriptTags[i].src == dummyScript.src ) return true;
                            return false;
                        }
                    }                    
                }