/*****************************************************************

	ActiveWidgets 2.0.b3 (beta3)
	Copyright (C) 2003-2005 ActiveWidgets Ltd. All Rights Reserved. 
	http://www.activewidgets.com/

	WARNING: This software program is protected by copyright law 
	and international treaties. Unauthorized reproduction or
	distribution of this program, or any portion of it, may result
	in severe civil and criminal penalties, and will be prosecuted
	to the maximum extent possible under the law.

	FOR TESTING AND EVALUATION ONLY:
	This software is not free and is licensed to you for testing 
	and evaluation only. You are not allowed to distribute 
	or use any parts of this software for any other purposes.

*****************************************************************/

 if(!window.AW){var AW=function(a,b){return AW.dispatch(a,b)};AW.toString=function(){return "ActiveWidgets 2.0"}}if(!AW.System){AW.System={}}if(!AW.HTML){AW.HTML={}}if(!AW.Templates){AW.Templates={}}if(!AW.Scroll){AW.Scroll={}}if(!AW.Panels){AW.Panels={}}if(!AW.Formats){AW.Formats={}}if(!AW.HTTP){AW.HTTP={}}if(!AW.CSV){AW.CSV={}}if(!AW.XML){AW.XML={}}if(!AW.UI){AW.UI={}}if(!AW.Grid){AW.Grid={}}if(!AW.Tree){AW.Tree={}}if(!AW.Grid.Controllers){AW.Grid.Controllers={}}
(function(){AW.all={id:0};AW.docs=[document];AW.forEach=function(array,handler){var i,custom={};for(i in array){if(!custom[i]){handler(i,array[i])}}};AW.element=function(id){var i,e,docs=AW.docs;for(i=0;i<docs.length;i++){e=docs[i].getElementById(id);if(e){return e}}};AW.object=function(id){var parts=id.split("-");var tag=parts[0];var obj=AW.all[tag];var target=obj;for(var i=1;i<parts.length;i++){if(obj["_"+parts[i]+"Content"]){for(var j=i;j<parts.length;j++){target=target.getContent(parts[j])}break}else if(parts[i+1] && parts[i+1].match(/^(\d+)$/)){if(parts[i+2] && parts[i+2].match(/^(\d+)$/)){if(parts[i+3] && parts[i+3].match(/^(\d+)$/)){obj=obj.getTemplate(parts[i],parts[i+1],parts[i+2],parts[i+3]);i+=3}else{obj=obj.getTemplate(parts[i],parts[i+1],parts[i+2]);i+=2}}else{obj=obj.getTemplate(parts[i],parts[i+1]);i+=1}}else{obj=obj.getTemplate(parts[i])}target=obj}return target};var events={"DOMFocusIn":"focus"};AW.dispatch=function(element,event){var type="_on"+(events[event.type] || event.type)+"Event";var target=AW.object(element.id);var obj=target;while(obj._parent){obj=obj._parent}return target[type].call(obj,event)};AW.paint=function(element){var obj=AW.object(element.id);while(obj._parent){obj=obj._parent}if(obj && obj.raiseEvent && !obj.$paint){obj.$paint=true;obj.raiseEvent("paint")}window.setTimeout(function(){element.style.removeExpression("visibility");element.style.display="none";if(obj && obj.$paint){obj.$paint=false}},0);return "hidden"};AW.camelCase=function(){var i,s=arguments[0];for(i=1;i<arguments.length;i++){s+=arguments[i].substr(0,1).toUpperCase()+arguments[i].substr(1)}return s};AW.textPattern=/(\"|&|<|>)/gm;AW.textTable={"\"":"&quot;","&":"&amp;","<":"&lt;",">":"&gt;"};AW.textReplace=function(c){return AW.textTable[c] || ""};AW.htmlPattern=/(&quot;|&amp;|&lt;|&gt|<[^<>]*>)/gm;AW.htmlTable={"&quot;":"\"","&amp;":"&","&lt;":"<","&gt;":">"};AW.htmlReplace=function(e){return AW.htmlTable[e] || ""};AW.valueToText=function(v){return v?String(v).replace(AW.textPattern,AW.textReplace):""};AW.textToValue=function(t){return t?String(t).replace(AW.htmlPattern,AW.htmlReplace):""}})();
(function(){AW.browser="";if(window.external){AW.browser="ie"}else if(window.__defineGetter__){AW.browser="gecko"}else if(window.opera){AW.browser="opera"}else if(navigator.userAgent.match("Safari")){AW.browser="safari"}if(AW.browser){AW[AW.browser]=true}AW.os="";if(!navigator.userAgent.match("Windows")){AW.unix=true}if(navigator.userAgent.match("Mac OS")){AW.os="mac"}if(navigator.userAgent.match("Linux")){AW.os="linux"}AW.strict=(document.compatMode && document.compatMode.match("CSS"))|| AW.browser=="safari";var htmlc="";if(AW.strict){htmlc+=" aw-strict"}if(AW.browser){htmlc+=" aw-"+AW.browser}if(AW.unix){htmlc+=" aw-unix"}if(AW.os){htmlc+=" aw-"+AW.os}document.getElementsByTagName("html")[0].className+=htmlc;if(AW.strict){AW.dx=8;AW.dy=4}else{AW.dx=0;AW.dy=0}})();
(function(){if(AW.ie){AW.attachEvent=function(element,name,handler){return element.attachEvent(name,handler)};AW.detachEvent=function(element,name,handler){return element.detachEvent(name,handler)};AW.srcElement=function(event){return event.srcElement};AW.toElement=function(event){return event.toElement};AW.setReturnValue=function(event,value){event.returnValue=value};AW.setCapture=function(element){return element.setCapture()};AW.releaseCapture=function(element){return element.releaseCapture()};AW.addRule=function(stylesheet,selector,rule){return stylesheet.addRule(selector,rule)};AW.getRules=function(stylesheet){return stylesheet.rules};AW.setOuterHTML=function(element,html){element.outerHTML=html};AW.createXMLHttpRequest=function(){return new ActiveXObject("MSXML2.XMLHTTP")};AW.getLeft=function(element){return element.getBoundingClientRect().left};AW.getTop=function(element){return element.getBoundingClientRect().top}}})();
(function(){if(AW.gecko){var capture;AW.attachEvent=function(target,name,handler){if(capture){handler[name]=function(event){return handler.call(target,event)};window.addEventListener(name.replace(/^on/,""),handler[name],true)}else{target.addEventListener(name.replace(/^on/,""),handler,false)}};AW.detachEvent=function(target,name,handler){if(capture){window.removeEventListener(name.replace(/^on/,""),handler[name],true);handler[name]=null}else{target.removeEventListener(name.replace(/^on/,""),handler,false)}};AW.srcElement=function(event){try{return(event.target && event.target.nodeType==3)?event.target.parentNode:event.target}catch(e){return event.target}};AW.toElement=function(event){try{return(event.relatedTarget && event.relatedTarget.nodeType==3)?event.relatedTarget.parentNode:event.relatedTarget}catch(e){return event.relatedTarget}};AW.setReturnValue=function(event,value){if(!value){event.preventDefault()}};AW.setCapture=function(element){capture=element};AW.releaseCapture=function(element){capture=null};AW.addRule=function(stylesheet,selector,rule){var i=stylesheet.cssRules.length;stylesheet.insertRule(selector+"{"+rule+"}",i);stylesheet.cssRules[i].style.cssText=rule};AW.getRules=function(stylesheet){return stylesheet.cssRules};AW.setOuterHTML=function(element,html){var range=element.ownerDocument.createRange();range.setStartBefore(element);var fragment=range.createContextualFragment(html);element.parentNode.replaceChild(fragment,element)};AW.createXMLHttpRequest=function(){return new XMLHttpRequest};AW.getLeft=function(element){var doc=document.getBoxObjectFor(document.body);return document.getBoxObjectFor(element).screenX - doc.screenX+doc.x};AW.getTop=function(element){var doc=document.getBoxObjectFor(document.body);return document.getBoxObjectFor(element).screenY - doc.screenY+doc.y}}})();
(function(){if(AW.safari){var capture;AW.attachEvent=function(target,name,handler){if(capture){handler[name]=function(event){return handler.call(target,event)};window.addEventListener(name.replace(/^on/,""),handler[name],true)}else{target.addEventListener(name.replace(/^on/,""),handler,false)}};AW.detachEvent=function(target,name,handler){if(capture){window.removeEventListener(name.replace(/^on/,""),handler[name],true);handler[name]=null}else{target.removeEventListener(name.replace(/^on/,""),handler,false)}};AW.srcElement=function(event){return(event.target && event.target.nodeType==3)?event.target.parentNode:event.target};AW.toElement=function(event){return(event.relatedTarget && event.relatedTarget.nodeType==3)?event.relatedTarget.parentNode:event.relatedTarget};AW.setReturnValue=function(event,value){if(!value){event.preventDefault()}};AW.setCapture=function(element){capture=element};AW.releaseCapture=function(element){capture=null};AW.addRule=function(stylesheet,selector,rule){var i=stylesheet.cssRules.length;stylesheet.insertRule(selector+"{"+rule+"}",i);stylesheet.cssRules[i].style.cssText=rule};AW.getRules=function(stylesheet){return stylesheet.cssRules};AW.setOuterHTML=function(element,html){element.outerHTML=html};AW.createXMLHttpRequest=function(){return new XMLHttpRequest};AW.getLeft=function(element){return getRectangle(element).left};AW.getTop=function(element){return getRectangle(element).top};function getRectangle(e){var t=e,x=0,y=0;function getPos(el){if(!el){return{x:0,y:0}}if(el==document.body.parentNode){return{x:0,y:0}}if(el==document.body){return{x:el.offsetLeft,y:el.offsetTop}}var p=el.offsetParent;var pp=getPos(p);return{x:el.offsetLeft+pp.x,y:el.offsetTop+pp.y}}var pp=getPos(e);return{left:pp.x,right:pp.x+e.offsetWidth,top:pp.y,bottom:pp.y+e.offsetHeight}}}})();
(function(){if(AW.opera){AW.attachEvent=function(target,name,handler){return target.addEventListener(name.replace(/^on/,""),handler,false)};AW.detachEvent=function(target,name,handler){return target.removeEventListener(name.replace(/^on/,""),handler,false)};AW.srcElement=function(event){return(event.target && event.target.nodeType==3)?event.target.parentNode:event.target};AW.toElement=function(event){return(event.relatedTarget && event.relatedTarget.nodeType==3)?event.relatedTarget.parentNode:event.relatedTarget};AW.setReturnValue=function(event,value){event.preventDefault()};AW.setCapture=function(element){return};AW.releaseCapture=function(element){return};AW.addRule=function(stylesheet,selector,rule){var i=stylesheet.cssRules.length;stylesheet.insertRule(selector+"{"+rule+"}",i);stylesheet.cssRules[i].style.cssText=rule};AW.getRules=function(stylesheet){return stylesheet.cssRules};AW.setOuterHTML=function(element,html){element.outerHTML=html};AW.createXMLHttpRequest=function(){return new XMLHttpRequest};AW.getLeft=function(element){return getRectangle(element).left};AW.getTop=function(element){return getRectangle(element).top};function getRectangle(e){var t=e,x=0,y=0;function getPos(el){if(!el){return{x:0,y:0}}if(el==document.body.parentNode){return{x:0,y:0}}if(el==document.body){return{x:el.offsetLeft,y:el.offsetTop}}var p=el.offsetParent;var pp=getPos(p);return{x:el.offsetLeft+pp.x,y:el.offsetTop+pp.y}}var pp=getPos(e);return{left:pp.x,right:pp.x+parseInt(getComputedStyle(e,null).width),top:pp.y,bottom:pp.y+parseInt(getComputedStyle(e,null).height)}}}})();
 AW.System.Object=function(){};AW.System.Object.subclass=function(){var create=function(cls){cls.created=true;if(cls.superclass && !cls.superclass.created){create(cls.superclass)}cls.create()};var constructor=function(a,b,c){if(constructor.defer){return}if(!constructor.created){create(constructor)}if(this.init){this.init(a,b,c)}};for(var i in this){constructor[i]=this[i]}this.defer=true;constructor.prototype=new this();this.defer=false;constructor.prototype.constructor=constructor;constructor.superclass=this;constructor.created=false;return constructor};AW.System.Object.handle=function(error){throw(error);};AW.System.Object.create=function(){var obj=this.prototype;obj.clone=function(){if(this._clone.prototype!==this){this._clone=function(){this.init()};this._clone.prototype=this}return new this._clone()};obj._clone=function(){};obj.init=function(){};obj.handle=function(error){throw(error);};obj.setTimeout=function(handler,delay){var self=this;var wrapper=function(){handler.call(self)};return window.setTimeout(wrapper,delay?delay:0)};obj.timeout=obj.setTimeout;obj.toString=function(){return ""}};AW.System.Object.create();
 AW.System.Model=AW.System.Object.subclass();AW.System.Model.create=function(){var obj=this.prototype;var join=function(){var i,s=arguments[0];for(i=1;i<arguments.length;i++){s+=arguments[i].substr(0,1).toUpperCase()+arguments[i].substr(1)}return s};obj.defineProperty=function(name,value){var _getProperty=join("get",name);var _setProperty=join("set",name);var _property="_"+name;var getProperty=function(){return this[_property]};this[_setProperty]=function(value){if(typeof value=="function"){this[_getProperty]=value}else{this[_getProperty]=getProperty;this[_property]=value}};this[_setProperty](value)};var get={};var set={};obj.getProperty=function(name,a,b,c){if(!get[name]){get[name]=join("get",name)}return this[get[name]](a,b,c)};obj.setProperty=function(name,value,a,b,c){if(!set[name]){set[name]=join("set",name)}return this[set[name]](value,a,b,c)};obj.isReady=function(){return true}};
 AW.System.Format=AW.System.Object.subclass();AW.System.Format.create=function(){var obj=this.prototype;obj.valueToText=function(value){return value};obj.dataToValue=function(data){return data};obj.dataToText=function(data){var value=this.dataToValue(data);return this.valueToText(value)};obj.setErrorText=function(text){this._textError=text};obj.setErrorValue=function(value){this._valueError=value};obj.setErrorText("#ERR");obj.setErrorValue(NaN);obj.textToValue=function(text){return text};obj.textToData=function(text){return text};obj.valueToData=function(value){return value};obj.comparator=function(values,greater,less,equal,error){return function(i,j){try{var a=values[i];var b=values[j];if(a > b){return greater}if(a < b){return less}return equal(i,j)}catch(e){return error(i,j,e)}}}};
 AW.System.HTML=AW.System.Object.subclass();AW.System.HTML.create=function(){var obj=this.prototype;obj.setTag=function(tag){this._tag=tag;this._outerHTML=""};obj.getTag=function(){return this._tag};obj._tag="span";obj.init=function(){if(this.$owner){return}if(this._parent){return}this._id="aw"+AW.all.id++;AW.all[this._id]=this};obj.getId=function(){return this._id};obj._id="";obj.setId=function(id){this._id=id;AW.all[this._id]=this};obj.element=function(){var i,docs=AW.docs,id=this.getId(),e;for(i=0;i<docs.length;i++){e=docs[i].getElementById(id);if(e){return e}}};obj.getClass=function(name){var param="_"+name+"Class";var value=this[param];return typeof(value)=="function"?value.call(this):value};obj.setClass=function(name,value){var element=this.element();if(element){var v=(typeof(value)=="function")?value.call(this):value;element.className=element.className.replace(new RegExp("(active-"+name+"-\\w+|$)")," active-"+name+"-"+v+" ")}var param="_"+name+"Class";if(this[param]==null){this._classes+=" "+name}this[param]=value;this._outerHTML="";if(this.lock){this.lock()}};obj.refreshClasses=function(){var element=this.element();if(!element){return}var s="",classes=this._classes.split(" ");for(var i=1;i<classes.length;i++){var name=classes[i];var value=this["_"+name+"Class"];if(typeof(value)=="function"){value=value.call(this)}s+="aw-"+name+"-"+value+" "}element.className=s};obj._classes="";obj.getStyle=function(name){var param="_"+name+"Style";var value=this[param];return typeof(value)=="function"?value.call(this):value};obj.setStyle=function(name,value){var element=this.element();if(element){element.style[name]=value}var param="_"+name+"Style";if(this[param]==null){this._styles+=" "+name}this[param]=value;this._outerHTML="";if(this.lock){this.lock()}};obj._styles="";obj.getAttribute=function(name){try{var param="_"+name+"Attribute";var value=this[param];return typeof(value)=="function"?value.call(this):value}catch(error){this.handle(error)}};obj.setAttribute=function(name,value){try{var param="_"+name+"Attribute";if(typeof this[param]=="undefined"){this._attributes+=" "+name}if(specialAttributes[name] &&(typeof value=="function")){this[param]=function(){return value.call(this)?true:null}}else{this[param]=value}this._outerHTML="";if(this.lock){this.lock()}}catch(error){this.handle(error)}};obj._attributes="";var specialAttributes={checked:true,disabled:true,hidefocus:true,readonly:true};obj.getEvent=function(name){try{var param="_"+name+"Event";var value=this[param];return value}catch(error){this.handle(error)}};obj.setEvent=function(name,value){try{var param="_"+name+"Event";if(this[param]==null){this._events+=" "+name}this[param]=value;this._outerHTML="";if(this.lock){this.lock()}}catch(error){this.handle(error)}};obj._events="";obj.getContent=function(name){try{var split=name.match(/^(\w+)\W(.+)$/);if(split){var ref=this.getContent(split[1]);return ref.getContent(split[2])}else{var param="_"+name+"Content";var value=this[param];if((typeof value=="object")&&(value._parent !=this)){value=value.clone();value._parent=this;this[param]=value}if(value && typeof value=="object" && !value.defineModel){value._id=this._id+"-"+name}return value}}catch(error){this.handle(error)}};obj.setContent=function(name,value){try{if(arguments.length==1){this._content="";if(typeof name=="object"){for(var i in name){if(typeof(i)=="string"){this.setContent(i,name[i])}}}else{this.setContent("html",name)}}else{var split=name.match(/^(\w+)\W(.+)$/);if(split){var ref=this.getContent(split[1]);ref.setContent(split[2],value);this._innerHTML="";this._outerHTML=""}else{var param="_"+name+"Content";if(this[param]==null){this._content+=" "+name}if(value && typeof value=="object"){value._parent=this;if(!value.defineModel){value._id=this._id+"-"+name}}this[param]=value;this._innerHTML="";this._outerHTML=""}}if(this.lock){this.lock()}}catch(error){this.handle(error)}};obj._content="";var getParamStr=function(i){return "{#"+i+"}"};var getControlFunc=function(v){return function(){return v}};obj.innerHTML=function(){try{if(this._innerHTML){return this._innerHTML}this._innerParamLength=0;var i,j,name,value,param1,param2,html,item,s="";var content=this._content.split(" ");for(i=1;i<content.length;i++){name=content[i];value=this["_"+name+"Content"];if(typeof(value)=="function"){param=getParamStr(this._innerParamLength++);this[param]=value;s+=param}else if(typeof(value)=="object" && value.defineModel){param=getParamStr(this._innerParamLength++);this[param]=getControlFunc(value);s+=param}else if(typeof(value)=="object"){item=value;html=item.outerHTML().replace(/\{id\}/g,"{id}-"+name);for(j=item._outerParamLength-1;j>=0;j--){param1=getParamStr(j);param2=getParamStr(this._innerParamLength+j);if(param1 !=param2){html=html.replace(param1,param2)}this[param2]=item[param1]}this._innerParamLength+=item._outerParamLength;s+=html}else{s+=value}}this._innerHTML=s;return s}catch(error){this.handle(error)}};obj.outerHTML=function(){try{if(this._outerHTML){return this._outerHTML}var innerHTML=this.innerHTML();this._outerParamLength=this._innerParamLength;if(!this._tag){return innerHTML}var i,tmp,name,value,param;var html="<"+this._tag+" id=\"{id}\"";tmp="";var classes=this._classes.split(" ");for(i=1;i<classes.length;i++){name=classes[i];value=this["_"+name+"Class"];if(typeof(value)=="function"){param=getParamStr(this._outerParamLength++);this[param]=value;value=param}tmp+="aw-"+name+"-"+value+" "}if(tmp){html+=" class=\""+tmp+"\""}tmp="";var styles=this._styles.split(" ");for(i=1;i<styles.length;i++){name=styles[i];value=this["_"+name+"Style"];if(typeof(value)=="function"){param=getParamStr(this._outerParamLength++);this[param]=value;value=param}tmp+=name+":"+value+";"}if(tmp){html+=" style=\""+tmp+"\""}tmp="";var attributes=this._attributes.split(" ");for(i=1;i<attributes.length;i++){name=attributes[i];value=this["_"+name+"Attribute"];if(typeof(value)=="function"){param=getParamStr(this._outerParamLength++);this[param]=value;value=param}else if(specialAttributes[name] && !value){value=null}if(value !==null){tmp+=" "+name+"=\""+value+"\""}}html+=tmp;tmp="";var events=this._events.split(" ");for(i=1;i<events.length;i++){name=events[i];value=this["_"+name+"Event"];if(typeof(value)=="function"){value="AW(this,event)"}tmp+=" "+name+"=\""+value+"\""}html+=tmp;html+=">"+innerHTML+"</"+this._tag+">";this._outerHTML=html;return html}catch(error){this.handle(error)}};obj.toString=function(){try{var i,s=this._outerHTML;if(!s){s=this.outerHTML()}s=s.replace(id_pattern,this._id);var max=this._outerParamLength;if(param_cache.length < max){for(i=param_cache.length;i<max;i++){param_cache[i]=getParamStr(i)}}for(i=0;i<max;i++){var param=param_cache[i];var value=this[param]();if(value===null){value="";param=specialParams[i];if(!param){param=getSpecialParamStr(i)}}s=s.replace(param,value)}return s}catch(error){this.handle(error)}};var id_pattern=/\{id\}/g;var param_cache=[];var specialParams=[];function getSpecialParamStr(i){return(specialParams[i]=new RegExp("[\\w\\x2D]*=?:?\\x22?\\{#"+i+"\\}[;\\x22]?"))}obj.refresh=function(){try{var element=this.element();if(element){AW.setOuterHTML(element,this.toString())}}catch(error){this.handle(error)}};obj.setSize=function(width,height){if(typeof(width)!="undefined"){this.setStyle("width",width - AW.dx+"px")}if(typeof(height)!="undefined"){this.setStyle("height",height - AW.dy+"px")}};obj.setPosition=function(left,top){this.setStyle("position","absolute");if(typeof(left)!="undefined"){this.setStyle("left",left+"px")}if(typeof(top)!="undefined"){this.setStyle("top",top+"px")}}};
 AW.System.Template=AW.System.HTML.subclass();AW.System.Template.create=function(){var obj=this.prototype;obj.lock=function(){if(!this.$owner){return}this.$owner[AW.camelCase("set",this.$name,"template")](this,this.$0,this.$1,this.$2)};obj.getTemplate=function(name){var i,args=[],get=AW.camelCase("get",name,"template");for(i=1;i<arguments.length;i++){args[i-1]=arguments[i]}return this[get].apply(this,args)};obj.setTemplate=function(name,template,index){var set=AW.camelCase("set",name,"template");this[set](template,index)};obj.raiseEvent=function(name,source,a,b,c){if(typeof source=="undefined"){source=this;a=this.$0;b=this.$1;c=this.$2}var handler=this[name];if(typeof(handler)=="function"){var r=handler.call(this,source,a,b,c);if(r){return r}}if(this.$owner && this.$owner.raiseEvent){return this.$owner.raiseEvent(name,source,a,b,c)}};obj.action=function(name,source,a,b,c){this.raiseEvent(AW.camelCase("on",name),source,a,b,c)};obj.mapTemplate=function(source,target){var get=AW.camelCase("get",source,"template");if(typeof(target)=="function"){this[get]=target}else{var u,m=AW.camelCase("get",target,"template");this[get]=function(a,b,c){if(a===u){return this.$owner[m](this.$0,this.$1,this.$2)}if(b===u){return this.$owner[m](a,this.$0,this.$1)}if(c===u){return this.$owner[m](a,b,this.$0)}return this.$owner[m](a,b,c)}}this.lock()};obj.mapModel=function(source,target,target2){var get=AW.camelCase("get",source,"property");var set=AW.camelCase("set",source,"property");if(typeof(target)=="function"){this[get]=target;if(typeof(target2)=="function"){this[set]=target2}else{this[set]=function(){}}}else{var _get=AW.camelCase("get",target,"property");var _set=AW.camelCase("set",target,"property");var u;this[get]=function(p,a,b,c){if(a===u){return this.$owner[_get](p,this.$0,this.$1,this.$2)}if(b===u){return this.$owner[_get](p,a,this.$0,this.$1)}if(c===u){return this.$owner[_get](p,a,b,this.$0)}return this.$owner[_get](p,a,b,c)};this[set]=function(p,v,a,b,c){if(a===u){return this.$owner[_set](p,v,this.$0,this.$1,this.$2)}if(b===u){return this.$owner[_set](p,v,a,this.$0,this.$1)}if(c===u){return this.$owner[_set](p,v,a,b,this.$0)}return this.$owner[_set](p,v,a,b,c)}}this.lock()}};
 AW.System.Control=AW.System.HTML.subclass();AW.System.Control.create=function(){AW.System.Template.create.call(this);var obj=this.prototype;var templates=AW.System.Template.prototype;obj.setTag("span");obj.setClass("system","control");obj.setAttribute("aw","control");obj.setEvent("oncontextmenu","return false");obj.setEvent("onselectstart","return false");obj.clear=function(){};obj.getModel=function(name){var getModel=AW.camelCase("get",name,"model");return this[getModel]()};obj.setModel=function(name,model){var setModel=AW.camelCase("set",name,"model");return this[setModel](model)};obj.defineModel=function(m,z){var ext="_"+m+"Model";var defineProperty=AW.camelCase("define",m,"property");var getProperty=AW.camelCase("get",m,"property");var setProperty=AW.camelCase("set",m,"property");var getModel=AW.camelCase("get",m,"model");var setModel=AW.camelCase("set",m,"model");var clearModel=AW.camelCase("clear",m,"model");var getInt={};var setInt={};var getExt={};var setExt={};var changing={};var changed={};var error={};var undef;this[defineProperty]=function(p,v,arrayValue){var _p="_"+AW.camelCase(m,p);var _p1=_p+"1";var _p2=_p+"2";var _p3=_p+"3";var get=(getInt[p]=AW.camelCase("get",m,p));var set=(setInt[p]=AW.camelCase("set",m,p));var $get=(getExt[p]=AW.camelCase("get",p));var $set=(setExt[p]=AW.camelCase("set",p));var _changing=(changing[p]=AW.camelCase("on",m,p,"changing"));var _changed=(changed[p]=AW.camelCase("on",m,p,"changed"));var _error=(error[p]=AW.camelCase("on",m,p,"error"));this[get]=function(a,b,c){if(this[ext] && this[ext][$get]){return this[ext][$get](a,b,c)}var r;if(c !==undef && this[_p3] && this[_p3][c] && this[_p3][c][b] && this[_p3][c][b][a] !==undef){r=this[_p3][c][b][a]}else if(b !==undef && this[_p2] && this[_p2][b] && this[_p2][b][a] !==undef){r=this[_p2][b][a]}else if(a !==undef && this[_p1] && this[_p1][a] !==undef){r=this[_p1][a]}else{r=this[_p]}return(typeof(r)=="function")?r.call(this,a,b,c):r};function isArray(a){return a && typeof(a)=="object" && !a.constructor.subclass && !arrayValue}var setProp=function(v,a,b,c){var i;if(isArray(v)){for(i in v){if(isArray(v[i])){this[_p2]=v;delete this[_p3];return}break}if(a !==undef){if(!this[_p2]){this[_p2]={}}this[_p2][a]=v;delete this[_p3]}else{this[_p1]=v;delete this[_p2];delete this[_p3]}return}if(c !==undef){if(!this[_p3]){this[_p3]={}}if(!this[_p3][c]){this[_p3][c]={}}if(!this[_p3][c][b]){this[_p3][c][b]={}}this[_p3][c][b][a]=v}else if(b !==undef){if(!this[_p2]){this[_p2]={}}if(!this[_p2][b]){this[_p2][b]={}}this[_p2][b][a]=v}else if(a !==undef){if(!this[_p1]){this[_p1]={$owner:this}}else if(this[_p1].$owner !=this){var r=this[_p1];this[_p1]={};for(i in r){this[_p1][i]=r[i]}this[_p1].$owner=this}this[_p1][a]=v}else{this[_p]=v;delete this[_p1];delete this[_p2];delete this[_p3]}};this[set]=function(v,a,b,c){if(this[ext] && this[ext][$set]){return this[ext][$set](v,a,b,c)}var r=this.raiseEvent(_changing,v,a,b,c);if(r){this.raiseEvent(_error,r,a,b,c);return false}setProp.call(this,v,a,b,c);this.raiseEvent(_changed,v,a,b,c);return true};setProp.call(this,v);var clearPrevious=this[clearModel];this[clearModel]=function(){delete this[_p3];delete this[_p2];delete this[_p1];delete this[_p];clearPrevious.call(this);setProp.call(this,v)}};this[getProperty]=function(p,a,b,c){try{if(this[ext] && this[ext][getExt[p]]){return this[ext][getExt[p]](a,b,c)}return this[getInt[p]](a,b,c)}catch(error){return this.handle(error)}};this[setProperty]=function(p,v,a,b,c){try{if(this[ext] && this[ext][setExt[p]]){return this[ext][setExt[p]](v,a,b,c)}return this[setInt[p]](v,a,b,c)}catch(error){return this.handle(error)}};templates[getProperty]=function(p,a,b,c){if(a===undef){return this.$owner[getProperty](p,this.$0,this.$1,this.$2)}if(b===undef){return this.$owner[getProperty](p,a,this.$0,this.$1)}if(c===undef){return this.$owner[getProperty](p,a,b,this.$0)}return this.$owner[getProperty](p,a,b,c)};templates[setProperty]=function(p,v,a,b,c){if(a===undef){return this.$owner[setProperty](p,v,this.$0,this.$1,this.$2)}if(b===undef){return this.$owner[setProperty](p,v,a,this.$0,this.$1)}if(c===undef){return this.$owner[setProperty](p,v,a,b,this.$0)}return this.$owner[setProperty](p,v,a,b,c)};this[getModel]=function(){return this[ext]};this[setModel]=function(model){this[ext]=model;if(model){model.$owner=this}};this[clearModel]=function(){if(this[ext] && this[ext].$owner){delete this[ext].$owner}delete this[ext]};var clear=this.clear;this.clear=function(){clear.call(this);this[clearModel]()};var i,zz={};for(i in z){if(!zz[i]){this[defineProperty](i,z[i])}}};obj.defineTemplate=function(name,template){var ref="_"+name+"Template";var ref1=ref+"1",ref2=ref+"2",ref3=ref+"3";var get=AW.camelCase("get",name,"template");var set=AW.camelCase("set",name,"template");var clone=AW.camelCase("_",name,"template","clone");var name1="-"+name;var name2="-"+name+"-";var undef;this[get]=function(a,b,c){if(typeof(this[ref])=="function"){return this[ref](a,b,c)}var r,id,useClone=false;if(a===undef){id=this._id+name1;r=this[ref]}else if(b===undef){id=this._id+name2+a;if(this[ref1] && this[ref1][a]){r=this[ref1][a]}else{r=this[ref];useClone=true}}else if(c===undef){id=this._id+name2+a+"-"+b;if(this[ref2] && this[ref2][a] && this[ref2][a][b]){r=this[ref2][a][b]}else if(this[ref1] && this[ref1][a]){r=this[ref1][a];useClone=true}else{r=this[ref];useClone=true}}else{id=this._id+name2+a+"-"+b+"-"+c;if(this[ref3] && this[ref3][a] && this[ref3][a][b] && this[ref3][a][b][c]){r=this[ref2][a][b][c]}else if(this[ref2] && this[ref2][a] && this[ref2][a][b]){r=this[ref2][a][b];useClone=true}else if(this[ref1] && this[ref1][a]){r=this[ref1][a];useClone=true}else{r=this[ref];useClone=true}}if(useClone || r.$owner !=this){if(!r.$clone){r.$clone=r.clone();r.$clone.$clone=null}r=r.$clone}r.$owner=this;r.$0=a;r.$1=b;r.$2=c;r._id=id;return r};templates[get]=function(a,b,c){if(a===undef){return this.$owner[get](this.$0,this.$1,this.$2)}if(b===undef){return this.$owner[get](a,this.$0,this.$1)}if(c===undef){return this.$owner[get](a,b,this.$0)}return this.$owner[get](a,b,c)};this[set]=function(template,a,b,c){if(a===undef){if(this[ref]==template){return}if(this[ref]){this[ref].$clone=""}this[ref]=template;if(template){template.$clone="";template.$name=name;if(template.$owner !=this){template.$owner=this;this.raiseEvent(AW.camelCase("on",name,"templateChanged"),template)}}return}if(b===undef){if(!this[ref1]){this[ref1]={}}if(this[ref1][a]==template){return}this[ref1][a]=template;template.$clone="";template.$name=name;template.$0=a;this[ref].$clone="";if(template.$owner !=this){template.$owner=this;this.raiseEvent(AW.camelCase("on",name,"templateChanged"),template,a)}return}if(c===undef){if(!this[ref2]){this[ref2]={}}if(!this[ref2][a]){this[ref2][a]={}}this[ref2][a][b]=template;template.$clone="";template.$name=name;this[ref].$clone="";if(this[ref1] && this[ref1][a]){this[ref1][a].$clone=""}template.$0=a;template.$1=b;if(template.$owner !=this){template.$owner=this;this.raiseEvent(AW.camelCase("on",name,"templateChanged"),template,a,b)}return}};this[set](template)};function controlValue(){var text=this.getControlText();var format=this.getControlFormat();return format?format.textToValue(text):text}obj.defineModel("tab",{index:1});obj.defineModel("control",{text:"",image:"",link:"",value:controlValue,format:"",tooltip:"",state:"",visible:true});obj.setControlSize=obj.setSize;obj.setControlPosition=obj.setPosition;obj.setController=function(name,controller){var i,n="_"+name+"Controller";this[n]=controller;for(i=0;i<this._controllers.length;i++){if(this._controllers[i]==n){return}}this._controllers=this._controllers.concat();this._controllers.push(n)};obj._controllers=[];obj.raiseEvent=function(name,source,a,b,c){var i,r;var handler=this[name];if(typeof(handler)=="function"){r=handler.call(this,source,a,b,c);if(r){return r}}for(i=0;i<this._controllers.length;i++){handler=this[this._controllers[i]]?this[this._controllers[i]][name]:null;if(typeof(handler)=="function"){r=handler.call(this,source,a,b,c);if(r){return r}}else if(typeof(handler)=="string" && handler !=name){r=this.raiseEvent(handler,source,a,b,c);if(r){return r}}}};obj.action=function(name,source,a,b,c){this.raiseEvent(AW.camelCase("on",name),source,a,b,c)};var keyNames={8:"Backspace",9:"Tab",13:"Enter",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12"};obj.setEvent("onkeydown",function(event){var key=keyNames[event.keyCode];if(event.keyCode >=48 && event.keyCode <=90){key=String.fromCharCode(event.keyCode)}if(key){if(event.shiftKey){key="Shift"+key}if(event.altKey){key="Alt"+key}if(event.ctrlKey){key="Ctrl"+key}this.raiseEvent("onKey"+key,event);event.cancelBubble=true}});var targets={};function raiseControlEvent(name,element,event){var a=((element.id.match(/-*\d*-*\d*-*\d+$/)|| ["-"])+"").split("-");var target=AW.object(element.id);if(target && target.raiseEvent){target.raiseEvent(name,event,a[1],a[2],a[3])}}function handleMouse(e,event){try{var i,t={};while(e){if(e.getAttribute &&(e.getAttribute("aw")||e.getAttribute("awx"))){t[e.id]=true}e=e.parentNode}for(i in targets){if(!t[i]){e=AW.element(i);if(e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),"mouseOut"),e,event);if(e.getAttribute("aw")!="control"){e.className=e.className.replace(/ aw-mouseover-\w+/g,"")}}if(e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),"mouseOut"),e,event);e.className=e.className.replace(/ aw-mouseover-\w+/g,"")}}}for(i in t){if(!targets[i]){e=AW.element(i);if(e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),"mouseOver"),e,event);if(e.getAttribute("aw")!="control"){e.className+=" aw-mouseover-"+e.getAttribute("aw").toLowerCase()}}if(e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),"mouseOver"),e,event);e.className+=" aw-mouseover-"+e.getAttribute("awx").toLowerCase()}}}targets=t}catch(error){}}var empty={};var handlers={onmousemove:function(event){handleMouse(AW.srcElement(event),event)},onmouseover:function(event){handleMouse(AW.srcElement(event),event)},onmouseout:function(event){handleMouse(AW.toElement(event),event)},onmousedown:function(event){try{var e=AW.srcElement(event);while(e){if(e.getAttribute && e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),"mouseDown"),e,event);if(e.getAttribute("aw")!="control"){e.className+=" aw-mousedown-"+e.getAttribute("aw").toLowerCase()}}if(e.getAttribute && e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),"mouseDown"),e,event);e.className+=" aw-mousedown-"+e.getAttribute("awx").toLowerCase()}e=e.parentNode}}catch(x){}},onmouseup:function(event){try{var e=AW.srcElement(event);while(e){if(e.getAttribute && e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),"mouseUp"),e,event);if(e.getAttribute("aw")!="control"){e.className=e.className.replace(/ aw-mousedown-\w+/g,"")}}if(e.getAttribute && e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),"mouseUp"),e,event);e.className=e.className.replace(/ aw-mousedown-\w+/g,"")}e=e.parentNode}}catch(x){}},onclick:function(event){try{var e=AW.srcElement(event);var s="Clicked";if(event.shiftKey){s="Shift"+s}if(event.altKey){s="Alt"+s}if(event.ctrlKey){s="Ctrl"+s}while(e){if(e.getAttribute && e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),s),e,event)}if(e.getAttribute && e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),s),e,event)}e=e.parentNode}}catch(x){}},ondblclick:function(event){try{var e=AW.srcElement(event);var s="DoubleClicked";if(event.shiftKey){s="Shift"+s}if(event.altKey){s="Alt"+s}if(event.ctrlKey){s="Ctrl"+s}while(e){if(e.getAttribute && e.getAttribute("aw")){raiseControlEvent(AW.camelCase("on",e.getAttribute("aw"),s),e,event)}if(e.getAttribute && e.getAttribute("awx")){raiseControlEvent(AW.camelCase("on",e.getAttribute("awx"),s),e,event)}e=e.parentNode}}catch(x){}}};AW.register=function(win){if(win !=window){win.AW=AW;AW.docs.push(win.document)}AW.forEach(handlers,function(name,handler){AW.attachEvent(win.document,name,handler)});function unregister(){AW.unregister(win);AW.detachEvent(win,"onunload",unregister);win=null}AW.attachEvent(win,"onunload",unregister)};AW.unregister=function(win){AW.forEach(handlers,function(name,handler){AW.detachEvent(win.document,name,handler)});if(win !=window){var i,docs=AW.docs;for(i=0;i<docs.length;i++){if(docs[i]==win.document){docs.splice(i,1);return}}win.AW=null}};AW.register(window)};
 AW.Formats.String=AW.System.Format.subclass();AW.Formats.String.create=function(){var obj=this.prototype;obj.valueToText=function(data){return data?String(data).replace(AW.textPattern,AW.textReplace):""};obj.textToValue=function(text){return text?String(text).replace(AW.htmlPattern,AW.htmlReplace):""};obj.dataToText=obj.valueToText;obj.textToData=obj.textToValue;if("".localeCompare){obj.comparator=function(values,greater,less,equal,error){return function(i,j){try{return greater *(""+values[i]).localeCompare(values[j])|| equal(i,j)}catch(e){return error(i,j,e)}}}}};
 AW.Formats.Number=AW.System.Format.subclass();AW.Formats.Number.create=function(){var obj=this.prototype;obj.dataToValue=function(v){return Number((""+v).replace(numPattern,""))};obj.textToValue=function(v){return Number((""+v).replace(numPattern,""))};var numPattern=/[^0-9.\-+]+/gm;var noFormat=function(value){return ""+value};var doFormat=function(value){var multiplier=this._multiplier;var abs=(value<0)?-value:value;var delta=(value<0)?-0.5:+0.5;var rounded=(Math.round(value * multiplier)+delta)/multiplier+"";if(abs<1000){return rounded.replace(this.p1,this.r1)}if(abs<1000000){return rounded.replace(this.p2,this.r2)}if(abs<1000000000){return rounded.replace(this.p3,this.r3)}return rounded.replace(this.p4,this.r4)};obj.setTextFormat=function(format){var pattern=/^([^0#]*)([0#]*)([ .,]?)([0#]|[0#]{3})([.,])([0#]*)([^0#]*)$/;var f=format.match(pattern);if(!f){this.valueToText=function(value){return ""+value};this.dataToText=function(value){return ""+value};return}this.valueToText=doFormat;this.dataToText=function(v){return doFormat.call(this,Number((""+v).replace(numPattern,"")))};var rs=f[1];var rg=f[3];var rd=f[5];var re=f[7];var decimals=f[6].length;this._multiplier=Math.pow(10,decimals);var ps="^(-?\\d+)",pm="(\\d{3})",pe="\\.(\\d{"+decimals+"})\\d$";this.p1=new RegExp(ps+pe);this.p2=new RegExp(ps+pm+pe);this.p3=new RegExp(ps+pm+pm+pe);this.p4=new RegExp(ps+pm+pm+pm+pe);this.r1=rs+"$1"+rd+"$2"+re;this.r2=rs+"$1"+rg+"$2"+rd+"$3"+re;this.r3=rs+"$1"+rg+"$2"+rg+"$3"+rd+"$4"+re;this.r4=rs+"$1"+rg+"$2"+rg+"$3"+rg+"$4"+rd+"$5"+re};obj.setTextFormat("")};
 AW.Formats.Date=AW.System.Format.subclass();AW.Formats.Date.create=function(){var obj=this.prototype;obj.date=new Date();obj.digits=[];obj.shortMonths=obj.shortMonths?obj.shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];obj.longMonths=obj.longMonths?obj.longMonths:["January","February","March","April","May","June","July","August","September","October","November","December"];obj.shortWeekdays=obj.shortWeekdays?obj.shortWeekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];obj.longWeekdays=obj.longWeekdays?obj.longWeekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(var i=0;i<100;i++){obj.digits[i]=i<10?"0"+i:""+i}var tokens={"hh":"this.digits[this.date.getUTCHours()]",":mm":"':'+this.digits[this.date.getUTCMinutes()]","mm:":"this.digits[this.date.getUTCMinutes()]+':'","ss":"this.digits[this.date.getUTCSeconds()]","dddd":"this.longWeekdays[this.date.getUTCDay()]","ddd":"this.shortWeekdays[this.date.getUTCDay()]","dd":"this.digits[this.date.getUTCDate()]","d":"this.date.getUTCDate()","mmmm":"this.longMonths[this.date.getUTCMonth()]","mmm":"this.shortMonths[this.date.getUTCMonth()]","mm":"this.digits[this.date.getUTCMonth()+1]","m":"(this.date.getUTCMonth()+1)","yyyy":"this.date.getUTCFullYear()","yy":"this.digits[this.date.getUTCFullYear()%100]"};var match="";for(i in tokens){if(typeof(i)=="string"){match+="|"+i}}var re=new RegExp(match.replace("|","(")+")","gi");obj.setTextFormat=function(format){format=format.replace(re,function(i){return "'+"+tokens[i.toLowerCase()]+"+'"});format="if(isNaN(value)||(value===this._valueError))return this._textError;"+"this.date.setTime(value+this._textTimezoneOffset);"+("return '"+format+"'").replace(/(''\+|\+'')/g,"");this.valueToText=new Function("value",format)};var xmlExpr=/^(....).(..).(..).(..).(..).(..)........(...).(..)/;var xmlOut="$1/$2/$3 $4:$5:$6 GMT$7$8";var auto=function(data){var value=Date.parse(data+this._dataTimezoneCode);return isNaN(value)?this._valueError:value};var RFC822=function(data){var value=Date.parse(data);return isNaN(value)?this._valueError:value};var ISO8601=function(data){var value=Date.parse(data.replace(xmlExpr,xmlOut));return isNaN(value)?this._valueError:value};obj.setDataFormat=function(format){if(format=="RFC822"){this.dataToValue=RFC822}else if(format=="ISO8601" || format=="ISO8061"){this.dataToValue=ISO8601}else{this.dataToValue=auto}};obj.setTextTimezone=function(value){this._textTimezoneOffset=value};obj.setDataTimezone=function(value){if(!value){this._dataTimezoneCode=" GMT"}else{this._dataTimezoneCode=" GMT"+(value>0?"+":"-")+this.digits[Math.floor(Math.abs(value/3600000))]+this.digits[Math.abs(value/60000)%60]}};var localTimezone=- obj.date.getTimezoneOffset()* 60000;obj.setTextTimezone(localTimezone);obj.setDataTimezone(localTimezone);obj.setTextFormat("d mmm yy");obj.setDataFormat("default");obj.textToValue=RFC822};
 AW.Formats.HTML=AW.System.Format.subclass();AW.Formats.HTML.create=function(){var obj=this.prototype;obj.dataToValue=function(data){return data?data.replace(AW.htmlPattern,AW.htmlReplace):""};obj.dataToText=function(data){return data};obj.textToValue=obj.dataToValue;if("".localeCompare){obj.comparator=function(values,greater,less,equal,error){return function(i,j){try{return greater *(""+values[i]).localeCompare(values[j])|| equal(i,j)}catch(e){return error(i,j,e)}}}}};
 AW.HTML.define=function(name,tag,type){if(!tag){tag=name.toLowerCase()}AW.HTML[name]=AW.System.HTML.subclass();AW.HTML[name].create=function(){this.prototype.setTag(tag)}};(function(){var i,tags=["DIV","SPAN","IMG","INPUT","BUTTON","TEXTAREA","TABLE","TR","TD"];for(i=0;i<tags.length;i++){AW.HTML.define(tags[i])}})();
 AW.Templates.ImageText=AW.System.Template.subclass();AW.Templates.ImageText.create=function(){var obj=this.prototype;function _image(){return this.getControlProperty("image")|| "none"}function _text(){return this.getControlProperty("text")}function _tooltip(){return this.getControlProperty("tooltip")}var span=AW.HTML.SPAN;var image=new span;image.setClass("item","image");image.setClass("image",_image);var ruler=new span;ruler.setClass("item","ruler");var text=new span;text.setClass("item","text");text.setContent("html",_text);var box=new span;box.setClass("item","box");box.setContent("sign","");box.setContent("marker","");box.setContent("image",image);box.setContent("ruler",ruler);box.setContent("text",text);obj.setTag("span");obj.setClass("item","template");obj.setClass("templates","imagetext");obj.setAttribute("title",_tooltip);obj.setContent("box",box)};AW.Templates.TextImage=AW.Templates.ImageText;
 AW.Templates.Image=AW.Templates.ImageText.subclass();AW.Templates.Image.create=function(){var obj=this.prototype;obj.setClass("templates","image");var box=obj.getContent("box");box.setTag("");box.setContent("text","")};
 AW.Templates.Text=AW.Templates.ImageText.subclass();AW.Templates.Text.create=function(){var obj=this.prototype;obj.setClass("templates","text");var box=obj.getContent("box");box.setTag("");box.setContent("image","")};
 AW.Templates.Link=AW.Templates.ImageText.subclass();AW.Templates.Link.create=function(){var obj=this.prototype;obj.setTag("a");obj.setClass("templates","link");obj.setAttribute("tabIndex","-1");obj.setAttribute("href",function(){return this.getControlProperty("link")|| null});var box=obj.getContent("box");box.setTag("")};
 AW.Templates.CheckBox=AW.Templates.ImageText.subclass();AW.Templates.CheckBox.create=function(){var obj=this.prototype;obj.setClass("value",function(){return this.getControlProperty("value")|| false});obj.setClass("toggle","checkbox");obj.setClass("templates","checkbox");obj.setAttribute("awx","toggle");var marker=new AW.HTML.SPAN;marker.setClass("item","marker");obj.setContent("box/marker",marker);obj.onToggleClicked=function(){var value=this.getControlProperty("value");this.setControlProperty("value",!value)}};AW.Templates.Checkbox=AW.Templates.CheckBox;
 AW.Templates.CheckedItem=AW.Templates.CheckBox.subclass();AW.Templates.CheckedItem.create=function(){var obj=this.prototype;obj.setClass("templates","checkeditem");obj.setClass("value",function(){return this.getStateProperty("selected")|| false});obj.onToggleClicked=function(){var selected=this.getStateProperty("selected");this.setStateProperty("selected",!selected)}};
 AW.Templates.Radio=AW.Templates.CheckedItem.subclass();AW.Templates.Radio.create=function(){var obj=this.prototype;obj.setClass("toggle","radio");obj.setClass("templates","radio");obj.onItemClicked=""};
 AW.Templates.Popup=AW.System.Template.subclass();AW.Templates.Popup.create=function(){var obj=this.prototype;obj.setClass("popup","normal");obj.showPopup=function(){var popup=window.createPopup();this.$popup=popup;var doc=popup.document;doc.open();AW.register(doc.parentWindow);if(AW.strict){doc.write("<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\" \"http:\/\/www.w3.org/TR/html4/strict.dtd\">")}var cls=document.getElementsByTagName("html")[0].className;doc.write("<html class=\"aw-popup-window aw-system-control "+cls+"\"><head>");for(var i=0;i<document.styleSheets.length;i++){doc.write(document.styleSheets[i].owningElement.outerHTML)}doc.write("</head><body onselectstart=\"return false\" oncontextmenu=\"return false\">");doc.write(this.getPopupTemplate().toString());doc.write("</body></html>");doc.close();var ref=this.element();var left=0;var top=ref.offsetHeight;var width=ref.offsetWidth;var height=1;popup.show(left,top,width,height,ref);width=Math.max(doc.body.scrollWidth,width);height=Math.max(doc.body.scrollHeight+1,20);popup.show(left,top,width,height,ref);ref=null};obj.hidePopup=function(){if(this.$popup && this.$popup.isOpen){this.$popup.hide()}if(this.$popup){this.$popup=null}};if(!AW.ie){obj.showPopup=function(){if(this.$popup){document.body.removeChild(this.$popup);this.$popup=null}var ref=this.element()?this.element():document.body;var left=AW.getLeft(ref);var top=AW.getTop(ref)+ref.offsetHeight;var popup=document.createElement("div");this.$popup=popup;document.body.appendChild(popup);popup.className="aw-popup-window aw-system-control";popup.style.left=left+"px";popup.style.top=top+"px";popup.innerHTML=this.getPopupTemplate().toString();var self=this;AW.attachEvent(popup,"onmousedown",function(){self.$target=true})};obj.hidePopup=function(){if(this.$popup){this.$popup.style.visibility="hidden";var popup=this.$popup;this.setTimeout(function(){if(this.$popup==popup){document.body.removeChild(this.$popup);this.$popup=null;popup=null}},5000)}}}};
 AW.Templates.Frame=AW.System.Template.subclass();AW.Templates.Frame.create=function(){var obj=this.prototype;obj.setClass("frame","template");obj.setClass("flow","vertical");obj.setClass("text","normal");var box=new AW.HTML.SPAN;box.setClass("frame","box");box.setClass("list","box");box.setContent("html",function(){return this.getLayoutTemplate()});obj.setContent("box",box)};
 AW.Templates.List=AW.System.Template.subclass();AW.Templates.List.create=function(){var obj=this.prototype;obj.setTag("span");obj.setClass("templates","list");obj.setContent("start","");obj.setContent("items",function(){var i,ii,a=[];var count=this.getViewProperty("count");var offset=this.getViewProperty("offset");var indices=this.getViewProperty("indices");for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItemTemplate(ii).toString()}return a.join("")});obj.setContent("end","")};
 AW.Templates.Input=AW.Templates.ImageText.subclass();AW.Templates.Input.create=function(){var obj=this.prototype;obj.setClass("templates","input");obj.setClass("input","box");obj.setClass("text","");var text=new AW.HTML.INPUT;text.setClass("item","text");text.setAttribute("type","text");text.setAttribute("tabindex","-1");text.setAttribute("value",function(){return this.getControlProperty("text")});if(AW.safari){obj.setEvent("onselectstart","");text=new AW.HTML.DIV;text.setClass("item","text");text.setAttribute("contentEditable","true");text.setContent("html",function(){return this.getControlProperty("text")})}text.setEvent("onfocus",function(){var self=this;var e=this.getContent("box/text").element();function cancelBubble(event){event.cancelBubble=true}function updateText(event){var text=AW.safari?e.innerText:e.value;var old=self.getControlProperty("text");if(text !=old){self.setControlProperty("text",text)}}this.$target="";function mark(event){if(AW.srcElement(event)!=e){self.$target=true}}e.parentNode.scrollTop=0;if(AW.ie){AW.attachEvent(e,"onselectstart",cancelBubble);AW.attachEvent(e,"oncontextmenu",cancelBubble);AW.attachEvent(e,"onpropertychange",updateText);e.setExpression("test","this.value")}if(AW.gecko){AW.attachEvent(e,"oninput",updateText)}if(AW.safari){AW.attachEvent(e,"onDOMCharacterDataModified",updateText)}AW.attachEvent(e,"onblur",blur);AW.attachEvent(window,"onunload",blur);AW.attachEvent(self.element(),"onmousedown",mark);function blur(){if(AW.ie){AW.detachEvent(e,"onselectstart",cancelBubble);AW.detachEvent(e,"oncontextmenu",cancelBubble);AW.detachEvent(e,"onpropertychange",updateText);e.removeExpression("test")}if(AW.gecko){AW.detachEvent(e,"oninput",updateText)}if(AW.safari){AW.detachEvent(e,"onDOMCharacterDataModified",updateText)}AW.detachEvent(e,"onblur",blur);AW.detachEvent(window,"onunload",blur);AW.detachEvent(self.element(),"onmousedown",mark);if(self.$target){self.$target=false;self.setTimeout(function(){e.focus();e=null})}else{self.$target=false;e=null;self.raiseEvent("update");if(self.hidePopup){self.hidePopup()}}}});obj.setContent("box/text",text)};
 AW.Templates.Combo=AW.Templates.Input.subclass();AW.Templates.Combo.create=function(){AW.Templates.Popup.create.call(this);var obj=this.prototype;obj.setAttribute("awx","combo");obj.setClass("templates","combo");obj.setClass("combo","box");obj.setClass("input","");obj.setClass("text","");var button=new AW.HTML.TABLE;button.setClass("combo","button");button.setAttribute("cellspacing","0");button.setEvent("onclick",function(){this.showPopup();this.getContent("box/text").element().focus();this.getContent("box/text").element().parentNode.scrollTop=0});obj.setContent("box/sign",button);obj.setContent("box/sign/html","<tr class=\"aw-cb-1\"><td></td></tr><tr class=\"aw-cb-2\"><td>&nbsp;</td></tr><tr class=\"aw-cb-3\"><td></td></tr>")};
 AW.Templates.HTML=AW.Templates.ImageText.subclass();AW.Templates.HTML.create=function(){var obj=this.prototype;obj.setClass("templates","html");var box=obj.getContent("box");box.setTag("");box.setContent("image","");box.setContent("ruler","");box.getContent("text").setTag("")};
 AW.Scroll.Bars=AW.System.Template.subclass();AW.Scroll.Bars.create=function(){var obj=this.prototype;obj.setClass("scroll","bars");obj.setClass("scrollbars",function(){return this.getScrollProperty("bars")});var span=AW.HTML.SPAN;var box=new span;var spacer=new span;var content=new span;box.setClass("bars","box");spacer.setClass("bars","spacer");content.setClass("bars","content");spacer.setStyle("width",function(){return this.getScrollProperty("width")+"px"});spacer.setStyle("height",function(){return this.getScrollProperty("height")+"px"});if(AW.ie && AW.strict){content.setStyle("width","expression(this.parentElement.clientWidth-20)");content.setStyle("height","expression(this.parentElement.clientHeight-20)")}obj.setContent("box",box);obj.setContent("box/spacer",spacer);obj.setContent("content",content);obj.setContent("content/html",function(){return this.getContentTemplate()});obj.setEvent("onresize",function(){this.raiseEvent("adjustScrollBars")});box.setEvent("onscroll",function(){var e=this.getContent("box").element();var left=this.getScrollProperty("left");var top=this.getScrollProperty("top");if(e.scrollLeft !=left){this.setScrollProperty("left",e.scrollLeft)}if(e.scrollTop !=top){this.setScrollProperty("top",e.scrollTop)}e=null});obj.setEvent("onmousewheel",function(event){var top=this.getScrollProperty("top");top -=event.wheelDelta/2;var e=this.element();if(e){var max=this.getScrollProperty("height")- e.offsetHeight;var bars=this.getScrollProperty("bars");max+=(bars=="horizontal" || bars=="both")?16:0;top=top > max?max:top}top=top < 0?0:top;this.setScrollProperty("top",top);AW.setReturnValue(event,false)})};
 AW.Panels.Horizontal=AW.System.Template.subclass();AW.Panels.Horizontal.create=function(){var obj=this.prototype;obj.setClass("hpanel","template");var span=AW.HTML.SPAN;var box=new span;var top=new span;var middle=new span;var bottom=new span;box.setClass("hpanel","box");top.setClass("hpanel","top");middle.setClass("hpanel","middle");bottom.setClass("hpanel","bottom");function height(i){return function(){return this.getPanelProperty("height",i)+"px"}}function visibility(i){return function(){return this.getPanelProperty("height",i)?"visible":"hidden"}}top.setStyle("visibility",visibility(0));top.setStyle("height",height(0));bottom.setStyle("display",function(){return this.getPanelProperty("height",2)?null:"none"});bottom.setStyle("height",height(2));if(AW.ie){box.setStyle("padding-top",height(0));box.setStyle("padding-bottom",height(2))}else{middle.setStyle("top",height(0));middle.setStyle("bottom",height(2))}if(AW.ie && AW.strict){box.setStyle("height","expression(this.parentElement.clientHeight-this.firstChild.offsetHeight-this.lastChild.offsetHeight)")}function panel(i){return function(){return this.getPanelTemplate(i)}}top.setContent("html",panel(0));middle.setContent("html",panel(1));bottom.setContent("html",panel(2));box.setContent("top",top);box.setContent("middle",middle);box.setContent("bottom",bottom);obj.setContent("box",box)};
 AW.Panels.Vertical=AW.System.Template.subclass();AW.Panels.Vertical.create=function(){var obj=this.prototype;obj.setClass("vpanel","template");var span=AW.HTML.SPAN;var box=new span;var left=new span;var center=new span;var right=new span;box.setClass("vpanel","box");left.setClass("vpanel","left");center.setClass("vpanel","center");right.setClass("vpanel","right");left.setContent("html",function(){return this.getPanelTemplate(0)});center.setContent("html",function(){return this.getPanelTemplate(1)});right.setContent("html",function(){return this.getPanelTemplate(2)});box.setContent("left",left);box.setContent("center",center);box.setContent("right",right);obj.setContent("box",box)};
 AW.Panels.Grid=AW.System.Template.subclass();AW.Panels.Grid.create=function(){var obj=this.prototype;obj.setClass("gpanel","template");var span=AW.HTML.SPAN;var box=new span;var top=new span;var middle=new span;var bottom=new span;box.setClass("gpanel","box");top.setClass("gpanel","top");middle.setClass("gpanel","middle");bottom.setClass("gpanel","bottom");function height(i){return function(){return this.getPanelProperty("height",i)+"px"}}function width(i){return function(){return this.getPanelProperty("width",i)+"px"}}function visibility(i){return function(){return this.getPanelProperty("height",i)?"visible":"hidden"}}top.setStyle("visibility",visibility(0));top.setStyle("height",height(0));bottom.setStyle("display",function(){return this.getPanelProperty("height",2)?null:"none"});bottom.setStyle("height",height(2));if(AW.ie){box.setStyle("padding-top",height(0));box.setStyle("padding-bottom",height(2))}else{middle.setStyle("top",height(0));middle.setStyle("bottom",height(2))}if(AW.ie && AW.strict){box.setStyle("height","expression(this.parentElement.clientHeight-this.firstChild.offsetHeight-this.lastChild.offsetHeight)")}function panel(i,j){return function(){return this.getPanelTemplate(i,j)}}var i,rows=[top,middle,bottom];for(i=0;i<3;i++){var left=new span;var center=new span;var right=new span;left.setClass("gpanel","left");center.setClass("gpanel","center");right.setClass("gpanel","right");left.setContent("html",panel(i,0));center.setContent("html",panel(i,1));right.setContent("html",panel(i,2));if(AW.ie && AW.strict){rows[i].setStyle("width","expression(this.parentElement.clientWidth-this.firstChild.offsetWidth-this.lastChild.offsetWidth)")}rows[i].setContent("left",left);rows[i].setContent("center",center);rows[i].setContent("right",right)}box.setContent("top",top);box.setContent("middle",middle);box.setContent("bottom",bottom);obj.setContent("box",box)};
 AW.UI.ImageText=AW.System.Control.subclass();AW.UI.ImageText.create=function(){AW.Templates.ImageText.create.call(this);var obj=this.prototype;obj.setClass("templates","");obj.setClass("ui","imagetext");obj.setClass("item","control");obj.setClass("text","expand");function _tabIndex(){return this.getTabProperty("index")}obj.getContent("box/text").setAttribute("tabIndex",_tabIndex);var _refresh=function(){this.refresh()};var itemController={onControlTextChanged:_refresh,onControlImageChanged:_refresh,onControlValueChanged:_refresh,onControlLinkChanged:_refresh,onControlTooltipChanged:_refresh,onControlStateChanged:_refresh};obj.setController("item",itemController)};
 AW.UI.Label=AW.UI.ImageText.subclass();AW.UI.Label.create=function(){var obj=this.prototype;obj.setClass("ui","label")};
 AW.UI.Group=AW.UI.ImageText.subclass();AW.UI.Group.create=function(){var obj=this.prototype;obj.setTag("fieldset");obj.setClass("ui","group");obj.setClass("text","normal");var box=obj.getContent("box");box.setTag("legend");box.setClass("item","legend")};
 AW.UI.Button=AW.UI.ImageText.subclass();AW.UI.Button.create=function(){var obj=this.prototype;obj.setClass("ui","button");obj.setAttribute("awx","button");obj.setController("button",{onControlClicked:"onClick",onKeySpace:"onClick",onKeyEnter:"onClick"})};
 AW.UI.Link=AW.UI.ImageText.subclass();AW.UI.Link.create=function(){AW.Templates.Link.create.call(this);var obj=this.prototype;obj.setClass("ui","link")};
 AW.UI.Input=AW.UI.ImageText.subclass();AW.UI.Input.create=function(){AW.Templates.Input.create.call(this);var obj=this.prototype;obj.setClass("ui","input");obj.onKeyEnter=function(){try{if(this.$owner){this.$owner.element().focus();this.setTimeout(function(){this.$owner.element().focus()})}else{this.raiseEvent("update")}}catch(e){}};var _update=function(){var text=this.getControlProperty("text");var format=this.getControlProperty("format");var value=format?format.textToValue(text):text;this.setControlProperty("value",value);if(this.$owner){this.$owner.raiseEvent("update","",this.$0,this.$1)}};var _refresh=function(){this.refresh()};var _text=function(){var e=this.getContent("box/text").element();var text=this.getControlProperty("text");if(AW.safari && e && e.innerText !=text){e.innerHTML=text}if(!AW.safari && e && e.value !=text){e.value=text}};var itemController={update:_update,onControlTextChanged:_text,onControlImageChanged:_refresh,onControlValueChanged:_text,onControlLinkChanged:_refresh,onControlTooltipChanged:_refresh,onControlStateChanged:_refresh};obj.setController("item",itemController)};
 AW.UI.List=AW.System.Control.subclass();AW.UI.List.create=function(){var obj=this.prototype;var box=new AW.HTML.SPAN;obj.setAttribute("tabIndex",1);obj.setAttribute("hideFocus","true");obj.setClass("ui","list");obj.setClass("list","control");obj.setClass("flow","vertical");obj.setClass("text","normal");box.setClass("list","box");box.setContent("html",function(){return this.getLayoutTemplate()});obj.setContent("box",box);obj.onItemTemplateChanged=function(item){item.setClass("list","item");item.setClass("items",function(){return this.getControlProperty("state")|| "normal"});item.setAttribute("aw","item");item.mapModel("control","item");item.mapModel("state","item")};obj.onContentTemplateChanged=function(view){view.setClass("list","template")};obj.defineTemplate("layout",function(){return this.getScrollTemplate()});obj.defineTemplate("scroll",function(){return this.getContentTemplate()});obj.defineTemplate("content",new AW.Templates.List);obj.defineTemplate("item",new AW.Templates.ImageText);function viewNext(i){var p=Math.min(this.getViewPosition(i)+1,this.getViewOffset()+this.getViewCount()- 1);var a=this.getViewIndices();return a?a[p]:p}function viewPrevious(i){var p=Math.max(this.getViewPosition(i)- 1,this.getViewOffset());var a=this.getViewIndices();return a?a[p]:p}function viewFirst(){var p=this.getViewOffset();var a=this.getViewIndices();return a?a[p]:p}function viewLast(){var p=this.getViewOffset()+this.getViewCount()- 1;var a=this.getViewIndices();return a?a[p]:p}function itemValue(i){var text=this.getItemText(i);var format=this.getItemFormat(i);return format?format.textToValue(text):text}var itemModel={count:0,text:"",image:"",link:"",value:itemValue,format:"",tooltip:"",state:"",selected:false};var viewModel={offset:0,count:function(){return this.getItemCount()},position:function(i){return Number(i)},next:viewNext,previous:viewPrevious,first:viewFirst,last:viewLast,expanded:false};var selectionModel={mode:"single"};var selectedModel={};var currentModel={item:0};obj.defineModel("item",itemModel);obj.defineModel("state",{});obj.defineModel("view",viewModel);obj.defineModel("selection",selectionModel);obj.defineModel("selected",selectedModel);obj.defineModel("current",currentModel);obj.defineViewProperty("indices","",true);obj.defineSelectedProperty("items",[],true);function refresh(v,i){this.getItemTemplate(i).refresh()}var itemController={onItemTextChanged:refresh,onItemImageChanged:refresh,onItemValueChanged:refresh,onItemLinkChanged:refresh,onItemTooltipChanged:refresh,onItemStateChanged:refresh};obj.setController("item",itemController);obj.setController("view",{onViewIndicesChanged:function(indices){var positions=[];for(var i=0;i<indices.length;i++){positions[indices[i]]=i}this.setViewPosition(positions);this.refresh()}});function go(dir,select){return function(event,index){var i=(dir=="this")?index:this.getCurrentItem();switch(dir){case "next":i=this.getViewNext(i);break;case "previous":i=this.getViewPrevious(i);break;case "first":i=this.getViewFirst();break;case "last":i=this.getViewLast();break}if(select){this.setSelectedItems([i])}this.setCurrentItem(i);event.returnValue=false}}function toggleThis(event,i){this.setItemSelected(!this.getItemSelected(i),i);this.setCurrentItem(i)}function toggleCurrent(){var i=this.getCurrentItem();this.setItemSelected(!this.getItemSelected(i),i)}var kb1={onKeyHome:"selectFirstItem",onKeyEnd:"selectLastItem",onKeyUp:"selectPreviousItem",onKeyDown:"selectNextItem",onKeyLeft:"selectPreviousItem",onKeyRight:"selectNextItem",onKeyPageUp:"selectPreviousPage",onKeyPageDown:"selectNextPage"};var kb2={onKeyHome:"selectFirstItem",onKeyEnd:"selectLastItem",onKeyUp:"selectPreviousItem",onKeyDown:"selectNextItem",onKeyPageUp:"selectPreviousPage",onKeyPageDown:"selectNextPage",onKeyCtrlHome:"gotoFirstItem",onKeyCtrlEnd:"gotoLastItem",onKeyCtrlUp:"gotoPreviousItem",onKeyCtrlDown:"gotoNextItem",onKeyCtrlPageUp:"gotoPreviousPage",onKeyCtrlPageDown:"gotoNextPage",onKeyCtrlSpace:"toggleCurrent",onKeySpace:"toggleCurrent"};var ms1={onItemClicked:"selectThisItem"};var ms2={onItemClicked:"toggleThisItem"};var cur1={gotoThisItem:go("this"),gotoPreviousItem:go("previous"),gotoNextItem:go("next"),gotoPreviousPage:go("pageup"),gotoNextPage:go("pagedown"),gotoFirstItem:go("first"),gotoLastItem:go("last"),selectThisItem:go("this",true),selectPreviousItem:go("previous",true),selectNextItem:go("next",true),selectPreviousPage:go("pageup",true),selectNextPage:go("pagedown",true),selectFirstItem:go("first",true),selectLastItem:go("last",true),toggleThisItem:toggleThis,toggleCurrent:toggleCurrent};obj.setController("keyboard",kb1);obj.setController("mouse",ms1);obj.setController("navigation",cur1);obj.setController("selection",{onSelectionModeChanged:function(mode){switch(mode){case "single":this.setController("keyboard",kb1);this.setController("mouse",ms1);break;case "multi":this.setController("keyboard",kb2);this.setController("mouse",ms2);break}}});function calcSelected(value,index){var i,a=this.getSelectedItems();for(i=0;i<a.length;i++){if(a[i]==index){if(!value){a=a.concat();a.splice(i,1);this.setSelectedItems(a)}return}}if(value){a=a.concat(index);this.setSelectedItems(a)}}obj.setController("selected",{onItemSelectedChanged:calcSelected});function syncState(items2){var items1=this.getSelectedItems();this.setTimeout(function(){var i,r1={},r2={};for(i=0;i<items1.length;i++){r1[items1[i]]=true}for(i=0;i<items2.length;i++){r2[items2[i]]=true}for(i=0;i<items1.length;i++){if(!r2[items1[i]] && this.getItemSelected(items1[i])){this.setItemSelected(false,items1[i])}}for(i=0;i<items2.length;i++){if(!r1[items2[i]] && !this.getItemSelected(items2[i])){this.setItemSelected(true,items2[i])}}},0)}obj.setController("state",{onCurrentItemChanging:updateCurrent,onSelectedItemsChanging:syncState,onItemSelectedChanged:"calculateItemState"});function updateCurrent(i2){var i1=this.getCurrentItem();this.setTimeout(function(){this.raiseEvent("calculateItemState",0,i2);var e2=this.getItemTemplate(i2).getContent("box/text").element();if(e2 && e2.focus){e2.tabIndex=this.getTabIndex();e2.focus()}e2=null;this.raiseEvent("calculateItemState",0,i1);var e1=this.getItemTemplate(i1).getContent("box/text").element();if(e1 && i1 !=i2){e1.tabIndex=-1}e1=null},0)}obj.calculateItemState=function(v,i){var state="";if(this.getCurrentItem()==i){state="current"}if(this.getItemSelected(i)){state="selected"}this.setItemState(state,i)}};
 AW.UI.Tabs=AW.UI.List.subclass();AW.UI.Tabs.create=function(){var obj=this.prototype;obj.setClass("ui","tabs");obj.setClass("text","expand");obj.setClass("flow","horizontal")};
 AW.UI.Combo=AW.UI.List.subclass();AW.UI.Combo.create=function(){AW.UI.ImageText.create.call(this);AW.UI.Input.create.call(this);AW.Templates.Combo.create.call(this);var obj=this.prototype;obj.setClass("ui","combo");obj.defineTemplate("popup",new AW.Templates.Frame);obj.onCurrentItemChanged=function(i){var text=this.getItemText(i);this.setControlText(text);this.hidePopup();var e=this.getContent("box/text").element();if(AW.safari){e.innerHTML=text}else{e.value=text}e=null};var kb={onKeyUp:"selectPreviousItem",onKeyDown:"selectNextItem"};obj.setController("keyboard",kb)};
 AW.UI.CheckBox=AW.UI.ImageText.subclass();AW.UI.CheckBox.create=function(){AW.Templates.CheckBox.create.call(this);var obj=this.prototype;obj.setClass("ui","checkbox");obj.setControlProperty("value",false)};AW.UI.Checkbox=AW.UI.CheckBox;
 AW.UI.CheckedList=AW.UI.List.subclass();AW.UI.CheckedList.create=function(){var obj=this.prototype;obj.setClass("ui","checkedlist");obj.setItemTemplate(new AW.Templates.CheckedItem);var kb={onKeyHome:"gotoFirstItem",onKeyEnd:"gotoLastItem",onKeyUp:"gotoPreviousItem",onKeyDown:"gotoNextItem",onKeyPageUp:"gotoPreviousPage",onKeyPageDown:"gotoNextPage",onKeySpace:"toggleCurrent"};var ms={onItemClicked:"gotoThisItem"};obj.setController("keyboard",kb);obj.setController("mouse",ms)};
 AW.UI.Radio=AW.UI.CheckedList.subclass();AW.UI.Radio.create=function(){var obj=this.prototype;obj.setClass("ui","radio");obj.setItemTemplate(new AW.Templates.Radio);obj.setSelectionMode("single")};
 AW.Grid.Controllers.Size=(function(){function init(){this._rowHeight=this.getContent("sample").element().offsetHeight;if(!this._columnWidth1){this._columnWidth1=[]}var i,ii,n=this.getColumnCount(),a=this.getColumnIndices();for(i=0;i<n;i++){ii=a?a[i]:i;this._columnWidth1[ii]=this.getHeaderTemplate(ii).element().offsetWidth}var lw=0,lc=this.$extended?this.getFixedLeft():0;var mw=0,c=this.getColumnCount();var rw=0,rc=this.$extended?this.getFixedRight():0;lw=this.getSelectorVisible()?this.getSelectorWidth():lw;if(!this.$extended){mw=lw;lw=0}for(i=0;i<lc;i++){lw+=this.getColumnWidth(a?a[i]:i)}for(i=c-rc;i<c;i++){rw+=this.getColumnWidth(a?a[i]:i)}this.setContentWidth(lw,0);this.setContentWidth(rw,2)}function footer(){var i,h=0,count=this.$extended?this.getFooterCount():1,a=this.getFooterIndices();if(this.getFooterVisible()){for(i=0;i<count;i++){h+=this.getFooterHeight(a?a[i]:i)}}this.setContentHeight(h,2)}function header(){var i,h=0,count=this.$extended?this.getHeaderCount():1,a=this.getHeaderIndices();if(this.getHeaderVisible()){for(i=0;i<count;i++){h+=this.getHeaderHeight(a?a[i]:i)}}this.setContentHeight(h,0)}return{onHeaderVisibleChanged:header,onHeaderHeightChanged:header,onHeaderCountChanged:header,onFooterVisibleChanged:footer,onFooterHeightChanged:footer,onFooterCountChanged:footer,paint:init}})();
 AW.Grid.Controllers.Cell=(function(){function refresh(value,col,row){this.getCellTemplate(col,row).refresh()}function refreshClasses(value,col,row){this.getCellTemplate(col,row).refreshClasses()}function edit(){var i=this.getCurrentColumn();var j=this.getCurrentRow();if(!this.getCellEditable(i,j)){return}var editor=this.getEditorTemplate(i,j);var cell=this.getCellTemplate(i,j);if(cell.element()){AW.setOuterHTML(cell.element(),editor);this.$edit=true;this.setTimeout(function(){var text=editor.element().getElementsByTagName("input")[0];text.focus();text.select();text=null})}}function update(text,i,j){var cell=this.getCellTemplate(i,j);var editor=this.getEditorTemplate(i,j);if(editor.element()){AW.setOuterHTML(editor.element(),cell)}this.$edit=false}function checkUpdate(v,i,j){if(this.$edit){update.call(this,v,i,j)}}function cellData(val,col,row){function dataToText(i,j){var data=this.getCellData(i,j);var format=this.getCellFormat(i,j);return format?format.dataToText(data):data}function dataToValue(i,j){var data=this.getCellData(i,j);var format=this.getCellFormat(i,j);return format?format.dataToValue(data):data}this.setCellText(dataToText,col,row);this.setCellValue(dataToValue,col,row)}function tooltip(event,col,row){var e=this.getCellTemplate(col,row).element();var s=this.getCellTooltip(col,row);if(e){e.setAttribute("title",s)}e=null}return{onCellMouseOver:tooltip,editCurrentCell:edit,update:update,onCellSelectedChanging:checkUpdate,onCellSelectedChanged:"calculateCellState",onCellDataChanged:cellData,onCellTextChanged:refresh,onCellImageChanged:refresh,onCellValueChanged:refresh,onCellStateChanged:refreshClasses}})();
 AW.Grid.Controllers.Row=(function(){function refresh(value,row){this.getRowTemplate(row).refreshClasses()}function addRow(row){var count=this.getRowCount();var a=this.getRowIndices();if(count<2){this.refresh();return}var prev=a[count-2];if(!this.$extended){e=this.getRowTemplate(prev).element();if(e){AW.setOuterHTML(e,this.getRowTemplate(prev).toString()+this.getRowTemplate(row).toString())}e=null}else{for(i=0;i<3;i++){e=this.getRowTemplate(prev,i).element();if(e){AW.setOuterHTML(e,this.getRowTemplate(prev,i).toString()+this.getRowTemplate(row,i).toString())}e=null}}this.raiseEvent("adjustScrollHeight")}function removeRow(row){var i,e;if(!this.$extended){e=this.getRowTemplate(row).element();if(e){AW.setOuterHTML(e,"")}e=null}else{for(i=0;i<3;i++){e=this.getRowTemplate(row,i).element();if(e){AW.setOuterHTML(e,"")}e=null}}this.raiseEvent("adjustScrollHeight")}return{onRowAdded:addRow,onRowDeleted:removeRow,onRowSelectedChanged:"calculateRowState",onRowStateChanged:refresh}})();
 AW.Grid.Controllers.View={onRowIndicesChanged:function(indices){var positions=[];for(var i=0;i<indices.length;i++){positions[indices[i]]=i}this.setRowPosition(positions);this.refresh()},onColumnIndicesChanged:function(indices){var positions=[];for(var i=0;i<indices.length;i++){positions[indices[i]]=i}this.setColumnPosition(positions);this.setColumnCount(indices.length);this.refresh()}};
 AW.Grid.Controllers.Navigation=(function(){function sync(){var mode=this.getCurrentSelection();var c1=this.getSelectedColumns();var r1=this.getSelectedRows();if(mode=="cell"){this.setTimeout(function(){var c2=this.getSelectedColumns();var r2=this.getSelectedRows();var i,j,x1={},x2={};for(i=0;i<c1.length;i++){x1[c1[i]]={};for(j=0;j<r1.length;j++){x1[c1[i]][r1[j]]=true}}for(i=0;i<c2.length;i++){x2[c2[i]]={};for(j=0;j<r2.length;j++){x2[c2[i]][r2[j]]=true}}for(i=0;i<c1.length;i++){for(j=0;j<r1.length;j++){if((!x2[c1[i]] || !x2[c1[i]][r1[j]])&& this.getCellSelected(c1[i],r1[j])){this.setCellSelected(false,c1[i],r1[j])}}}for(i=0;i<c2.length;i++){for(j=0;j<r2.length;j++){if((!x1[c2[i]] || !x1[c2[i]][r2[j]])&& !this.getCellSelected(c2[i],r2[j])){this.setCellSelected(true,c2[i],r2[j])}}}},0)}else if(mode=="row"){this.setTimeout(function(){var r2=this.getSelectedRows();var i,x1={},x2={};for(i=0;i<r1.length;i++){x1[r1[i]]=true}for(i=0;i<r2.length;i++){x2[r2[i]]=true}for(i=0;i<r1.length;i++){if(!x2[r1[i]] && this.getRowSelected(r1[i])){this.setRowSelected(false,r1[i])}}for(i=0;i<r2.length;i++){if(!x1[r2[i]] && !this.getRowSelected(r2[i])){this.setRowSelected(true,r2[i])}}},0)}}function syncRows(value,index){var i,a=this.getSelectedRows();for(i=0;i<a.length;i++){if(a[i]==index){if(!value){a=a.concat();a.splice(i,1);this.setSelectedRows(a)}return}}if(value){a=a.concat(index);this.setSelectedRows(a)}}function row(dir,select){return function(event,i){i=(dir=="this")?i:this.getCurrentRow();var k;switch(dir){case "previous":i=this.getRowPrevious(i);break;case "next":i=this.getRowNext(i);break;case "first":i=this.getRowFirst();break;case "last":i=this.getRowLast();break;case "pageup":for(k=0;k<10;k++){i=this.getRowPrevious(i)}break;case "pagedown":for(k=0;k<10;k++){i=this.getRowNext(i)}break}this.setCurrentRow(i);if(select){this.setSelectedRows([i])}AW.setReturnValue(event,false)}}function cell(dir,select){return function(event,i,j){i=(dir=="this")?i:this.getCurrentColumn();j=(dir=="this")?j:this.getCurrentRow();var k;switch(dir){case "next":i=this.getColumnNext(i);break;case "previous":i=this.getColumnPrevious(i);break;case "first":i=this.getColumnFirst();break;case "last":i=this.getColumnLast();break;case "up":j=this.getRowPrevious(j);break;case "down":j=this.getRowNext(j);break;case "top":j=this.getRowFirst();break;case "bottom":j=this.getRowLast();break;case "pageup":for(k=0;k<10;k++){j=this.getRowPrevious(j)}break;case "pagedown":for(k=0;k<10;k++){j=this.getRowNext(j)}break;case "home":i=this.getColumnFirst();j=this.getRowFirst();break;case "end":i=this.getColumnLast();j=this.getRowLast();break}this.setCurrentColumn(i);this.setCurrentRow(j);if(select){this.setSelectedColumns([i]);this.setSelectedRows([j])}AW.setReturnValue(event,false)}}function toggleThisRow(event,i){var v=this.getRowSelected(i);this.setRowSelected(!v,i);AW.setReturnValue(event,false)}return{toggleThisRow:toggleThisRow,gotoThisRow:row("this"),gotoPreviousRow:row("previous"),gotoNextRow:row("next"),gotoFirstRow:row("first"),gotoLastRow:row("last"),gotoPageUpRow:row("pageup"),gotoPageDownRow:row("pagedown"),selectThisRow:row("this",true),selectPreviousRow:row("previous",true),selectNextRow:row("next",true),selectFirstRow:row("first",true),selectLastRow:row("last",true),selectPageUpRow:row("pageup",true),selectPageDownRow:row("pagedown",true),selectThisCell:cell("this",true),selectUpperCell:cell("up",true),selectLowerCell:cell("down",true),selectTopCell:cell("top",true),selectBottomCell:cell("bottom",true),selectPreviousCell:cell("previous",true),selectNextCell:cell("next",true),selectFirstCell:cell("first",true),selectLastCell:cell("last",true),selectTopLeftCell:cell("home",true),selectBottomRightCell:cell("end",true),selectPageUpCell:cell("pageup",true),selectPageDownCell:cell("pagedown",true),onSelectedColumnsChanging:sync,onSelectedRowsChanging:sync,onRowSelectedChanged:syncRows,onSelectionModeChanged:function(mode){switch(mode){case "single-cell":this.setController("selection",AW.Grid.Controllers.SingleCell);this.setCurrentSelection("cell");break;case "single-row":this.setController("selection",AW.Grid.Controllers.SingleRow);this.setCurrentSelection("row");break;case "multi-row":this.setController("selection",AW.Grid.Controllers.MultiRow);this.setCurrentSelection("row");break;case "multi-row-marker":this.setController("selection",AW.Grid.Controllers.MultiRowMarker);this.setCurrentSelection("row");var checkbox=new AW.Templates.CheckedItem;this.setCellTemplate(checkbox,0);break}}}})();
 AW.Grid.Controllers.Sort={doSort:function(src,index,header){if(!(header=="0" || typeof(header)=="undefined")){return}var format=this.getCellFormat(index);function compare(values,pos,dir){var greater=1,less=-1;if(dir=="descending"){greater=-1;less=1}var equal=function(i,j){var a=pos[i];var b=pos[j];if(a > b){return 1}if(a < b){return -1}return 0};var error=function(){return 0};var types={"undefined":0,"boolean":1,"number":2,"string":3,"object":4,"function":5};if(format){return format.comparator(values,greater,less,equal,error)}else if("".localeCompare){return function(i,j){try{var a=values[i],b=values[j],x,y;if(typeof(a)!=typeof(b)){x=types[typeof(a)];y=types[typeof(b)];if(x > y){return greater}if(x < y){return less}}else if(typeof(a)=="number"){if(a > b){return greater}if(a < b){return less}}else{return(greater *((""+a).localeCompare(b)))|| equal(i,j)}}catch(e){return error(i,j,e)}}}else{return function(i,j){try{var a=values[i],b=values[j],x,y;if(typeof(a)!=typeof(b)){x=types[typeof(a)];y=types[typeof(b)];if(x > y){return greater}if(x < y){return less}}else{if(a > b){return greater}if(a < b){return less}}return equal(i,j)}catch(e){return error(i,j,e)}}}}var direction=this.getSortDirection(index);if(direction !="ascending"){direction="ascending"}else{direction="descending"}if(src=="ascending" || src=="descending"){direction=src}var i,value={},pos={};var offset=this.getRowOffset();var count=this.getRowCount();var rows=this.getRowIndices();if(offset){}if(!rows){rows=[];for(i=0;i<count;i++){rows[i]=i+offset}}else{rows=rows.slice(offset,offset+count)}for(i=0;i<rows.length;i++){value[rows[i]]=this.getCellValue(index,rows[i]);pos[rows[i]]=i}rows.sort(compare(value,pos,direction));var a=[];for(i=0;i<offset;i++){a[i]=i}rows=a.concat(rows);var old=this.getSortColumn();if(old !=-1){this.setSortDirection("",old)}this.setSortColumn(index);this.setSortDirection(direction,index);this.setRowIndices(rows)},onHeaderClicked:"doSort"};
 AW.Grid.Controllers.Overflow={onScrollLeftChanged:function(x){var e=this.getScrollTemplate().element();if(e){e.firstChild.scrollLeft=x}},onScrollTopChanged:function(y){var e=this.getScrollTemplate().element();if(e){e.firstChild.scrollTop=y}},onScrollWidthChanged:function(w){var e=this.getScrollTemplate().element();if(e){e.firstChild.firstChild.style.width=w+"px"}},onScrollHeightChanged:function(h){var e=this.getScrollTemplate().element();if(e){e.firstChild.firstChild.style.height=h+"px"}},onScrollBarsChanged:function(x){this.getScrollTemplate().refreshClasses()},adjustScrollBars:function(){var e=this.getScrollTemplate().element();if(!e){return}var s,x,y;var l=this.getScrollLeft();var t=this.getScrollTop();var w=this.getScrollWidth();var h=this.getScrollHeight();var ww=e.offsetWidth;var hh=e.offsetHeight;if(w < ww && h < hh){s="none";x=0;y=0}else if(w < ww - 16){s="vertical";x=20;y=0}else if(h < hh - 16){s="horizontal";x=0;y=20}else{s="both";x=20;y=20}if(this.getScrollBars()!=s){this.setScrollBars(s)}if(w - l < ww - x){var ll=Math.max(0,w - ww+x);if(ll !=l){this.setScrollLeft(ll)}}if(h - t < hh - y){var tt=Math.max(0,h - hh+y);if(tt !=t){this.setScrollTop(tt)}}this.setContentHeight(hh - y - this.getContentHeight(0)- this.getContentHeight(2),1);this.setContentWidth(ww - x - this.getContentWidth(0)- this.getContentWidth(2),1)},onColumnWidthChanged:function(){var i,a=this.getColumnIndices();var lw=0,lc=this.$extended?this.getFixedLeft():0;var mw=0,c=this.getColumnCount();var rw=0,rc=this.$extended?this.getFixedRight():0;lw=this.getSelectorVisible()?this.getSelectorWidth():lw;if(!this.$extended){mw=lw;lw=0}for(i=0;i<lc;i++){lw+=this.getColumnWidth(a?a[i]:i)}for(i=c-rc;i<c;i++){rw+=this.getColumnWidth(a?a[i]:i)}this.setContentWidth(lw,0);this.setContentWidth(rw,2)},paint:function(){var x=this.getScrollLeft();var y=this.getScrollTop();this.raiseEvent("adjustScrollWidth");this.raiseEvent("adjustScrollHeight");if(x){this.raiseEvent("onScrollLeftChanged",x)}if(y){this.raiseEvent("onScrollTopChanged",y)}this.raiseEvent("adjustScrollBars");if(x){this.setTimeout(function(){this.raiseEvent("onScrollLeftChanged",x)})}if(y){this.setTimeout(function(){this.raiseEvent("onScrollTopChanged",y)})}}};
 AW.Grid.Controllers.Scroll={onScrollLeftChanged:function(x){var e1=this.getRowsTemplate().element();var e2=this.getHeadersTemplate().element();var e3=this.getFootersTemplate().element();if(e1){e1.parentNode.scrollLeft=x}if(e2){e2.parentNode.scrollLeft=x}if(e3){e3.parentNode.scrollLeft=x}},onScrollTopChanged:function(y){var e=this.getRowsTemplate().element();if(e){e.parentNode.scrollTop=y}},adjustScrollWidth:function(){var a=this.getColumnIndices();var c=this.getColumnCount();var w=this.getSelectorVisible()?this.getSelectorWidth():0;for(var i=0;i<c;i++){w+=this.getColumnWidth(a?a[i]:i)}this.setScrollWidth(w+3)},adjustScrollHeight:function(){var h=this.getRowCount()* this.getRowHeight();h+=this.getContentHeight(0);h+=this.getContentHeight(2);this.setScrollHeight(h+3)}};
 AW.Grid.Controllers.Width={onColumnWidthChanged:function(width,column){try{if(this.element()){this.setTimeout(function(){this.raiseEvent("adjustScrollWidth");this.raiseEvent("adjustScrollBars")})}var w=(width - AW.dx)+"px",c=column;var i,ss=document.styleSheets[document.styleSheets.length-1];var selector="#"+this.getId()+" .aw-column-"+c;var rules=AW.getRules(ss);for(i=0;i<rules.length;i++){if(rules[i].selectorText==selector){rules[i].style.width=w;return}}AW.addRule(ss,selector,"width:"+w)}catch(r){}},onSelectorWidthChanged:function(width){try{if(this.element()){this.setTimeout(function(){this.raiseEvent("adjustScrollWidth");this.raiseEvent("adjustScrollBars")})}var w=(width - AW.dx)+"px";var i,ss=document.styleSheets[document.styleSheets.length-1];var selector="#"+this.getId()+" .aw-row-selector";var rules=AW.getRules(ss);for(i=0;i<rules.length;i++){if(rules[i].selectorText==selector){rules[i].style.width=w;return}}AW.addRule(ss,selector,"width:"+w)}catch(r){}},onRowHeightChanged:function(height){try{if(this.element()){this.setTimeout(function(){this.raiseEvent("adjustScrollHeight");this.raiseEvent("adjustScrollBars")})}var h=(height - AW.dy)+"px";var i,ss=document.styleSheets[document.styleSheets.length-1];var selector="#"+this.getId()+" .aw-grid-row";var rules=AW.getRules(ss);for(i=0;i<rules.length;i++){if(rules[i].selectorText==selector){rules[i].style.height=h;return}}AW.addRule(ss,selector,"height:"+h)}catch(r){}}};
 AW.Grid.Controllers.Virtual=(function(){var serial=0;function virtual(){var s=++serial;this.setTimeout(function(){var i=0,ii,a=[];var count=this.getRowProperty("count");var offset=this.getRowProperty("offset");var indices=this.getRowProperty("indices");var scroll=this.getScrollProperty("top");var row=this.getRowProperty("height");var top=Math.floor(scroll/row);var dir=this.getVirtualTop()> top?"back":"forward";this.setVirtualTop(top);var client=Math.floor(this.getContentHeight(1)/row);if(!client){client=40}var x1=Math.min(count,Math.max(0,top - 20));var x2=Math.min(count,top);var x3=Math.min(count,top+client);var x4=Math.min(count,top+client+20);function r1(){if(s !=serial){return}if(i1 < x4){ii=indices?indices[i1+offset]:i1+offset;this.getRowTemplate(ii).refresh();i1++;this.setTimeout(r1)}else if(dir=="forward"){this.setTimeout(r2)}}function r2(){if(s !=serial){return}if(i2 >=x1){ii=indices?indices[i2+offset]:i2+offset;this.getRowTemplate(ii).refresh();i2--;this.setTimeout(r2)}else if(dir=="back"){this.setTimeout(r1)}}i1=x3;i2=x2-1;if(dir=="forward"){r1.call(this)}else{r2.call(this)}})}return{onCurrentRowChanged:function(i){var scroll=this.getScrollProperty("top");var height=this.getRowProperty("height");var top=(this.getRowPosition(i)-this.getRowOffset())* height;if(top < scroll){this.setTimeout(function(){this.setScrollTop(top)})}var max=this.getContentHeight(1);var bottom=top+height;if(max+scroll < bottom){this.setTimeout(function(){this.setScrollTop(bottom - max)})}},onCurrentColumnChanged:function(index){var scroll=this.getScrollProperty("left");var col=this.getColumnPosition(index);var i,a=this.getColumnIndices();var lw=0,lc=this.$extended?this.getFixedLeft():0;var mw=0,c=this.getColumnCount();var rw=0,rc=this.$extended?this.getFixedRight():0;lw=this.getSelectorVisible()?this.getSelectorWidth():lw;if(!this.$extended){mw=lw;lw=0}for(i=0;i<lc;i++){lw+=this.getColumnWidth(a?a[i]:i)}for(i=lc;i<Math.min(col,c-rc-1);i++){mw+=this.getColumnWidth(a?a[i]:i)}for(i=c-rc;i<c;i++){rw+=this.getColumnWidth(a?a[i]:i)}if(!col){mw=0}if(mw < scroll){this.setTimeout(function(){this.setScrollLeft(mw)});return}var max=this.getContentWidth(1);var right=mw+this.getColumnWidth(index);if(max+scroll < right){this.setTimeout(function(){this.setScrollLeft(right - max)})}},onScrollTopChanging:function(scroll){if(!this.getVirtualMode()|| this.getScrollTop()==scroll){return}var s=++serial;var row=this.getRowHeight();var top=Math.floor(scroll/row);if(Math.abs(top - this.getVirtualTop())< 6){this.setTimeout(refreshRows,1000);return}function refreshRows(){if(s !=serial){return}this.getRowsTemplate().refresh();virtual.call(this)}this.setTimeout(refreshRows,200)},paint:function(){if(!this.getVirtualMode()){return}virtual.call(this)}}})();
 AW.Grid.Controllers.Grid={onRowsTemplateChanged:function(rows){rows.mapTemplate("item","row");rows.mapModel("view","row")},onRowTemplateChanged:function(row){row.setAttribute("aw","row");row.setClass("grid","row");row.setClass("row",function(){return this.$0});row.setClass("rows",function(){return this.getRowProperty("state")|| "normal"});row.setClass("alternate",function(){return this.getRowProperty("position")% 2?"odd":"even"});row.mapTemplate("item",function(i){return this.$owner.getCellTemplate(i,this.$0)});row.mapTemplate("selector",function(){return this.$owner.getSelectorTemplate(this.$0)});row.mapModel("view","column")},onCellTemplateChanged:function(cell){cell.setAttribute("aw","cell");cell.setAttribute("title","");cell.setClass("grid","cell");cell.setClass("column",function(){return this.$0});cell.setClass("cells",function(){return this.getControlProperty("state")|| "normal"});cell.mapModel("control","cell");cell.getStateProperty=function(p){return this.$owner.getRowProperty(p,this.$1)};cell.setStateProperty=function(p,v){this.$owner.setRowProperty(p,v,this.$1)}},onEditorTemplateChanged:function(editor){editor.setClass("grid","cell");editor.setClass("column",function(){return this.$0});editor.mapModel("control","cell")},onHeadersTemplateChanged:function(headers){headers.setClass("grid","headers");headers.setClass("header",function(){return this.$0 || "0"});headers.setStyle("height",function(){return this.getHeaderProperty("height")- AW.dy+"px"});headers.getContent("end").setClass("grid","header");headers.mapTemplate("item",function(i){return this.$owner.getHeaderTemplate(i,this.$0)+this.$owner.getSeparatorTemplate(i,this.$0)});headers.mapTemplate("selector",function(){return this.$owner.getTopSelectorTemplate(this.$0)+(this.$owner.getSelectorResizable()&& !this.$0?this.$owner.getSeparatorTemplate():"")});headers.mapModel("view","column")},onFootersTemplateChanged:function(footers){footers.setClass("grid","footers");footers.setClass("footer",function(){return this.$0 || "0"});footers.setStyle("height",function(){return this.getFooterProperty("height")- AW.dy+"px"});footers.mapTemplate("item",function(i){return this.$owner.getFooterTemplate(i,this.$0)});footers.mapTemplate("selector","bottomSelector");footers.mapModel("view","column")},onHeaderTemplateChanged:function(header){header.setAttribute("aw","header");header.setClass("grid","header");header.setClass("column",function(){return this.$0});header.mapModel("control","header");header.getStateProperty=function(p){return this.$owner.getColumnProperty(p,this.$0)};header.setStateProperty=function(p,v){this.$owner.setColumnProperty(p,v,this.$0)}},onFooterTemplateChanged:function(footer){footer.setAttribute("aw","footer");footer.setClass("grid","footer");footer.setClass("column",function(){return this.$0});footer.mapModel("control","footer")},onSelectorTemplateChanged:function(selector){selector.setAttribute("aw","selector");selector.setClass("row","selector");selector.mapModel("control","selector");selector.mapModel("state","row")},onTopSelectorTemplateChanged:function(selector){selector.setAttribute("aw","topSelector");selector.setClass("grid","header");selector.setClass("row","selector");selector.mapModel("control","top")},onBottomSelectorTemplateChanged:function(selector){selector.setAttribute("aw","bottomSelector");selector.setClass("row","selector");selector.mapModel("control","bottom")},onContentTemplateChanged:function(content){content.mapModel("panel","content");content.mapTemplate("panel",function(i){switch(i){case 0:return this.getHeadersTemplate();case 1:return this.getRowsTemplate();case 2:return this.getFootersTemplate()}})}};
 AW.Grid.Controllers.Extended={onContentTemplateChanged:function(content){content.mapModel("panel","content");content.mapTemplate("panel",function(i,j){switch(i){case 0:return this.$owner.getTopTemplate(j);case 1:return this.$owner.getRowsTemplate(j);case 2:return this.$owner.getBottomTemplate(j)}})},onTopTemplateChanged:function(top){top.mapTemplate("item","headers");top.mapModel("view","header")},onBottomTemplateChanged:function(bottom){bottom.mapTemplate("item","footers");bottom.mapModel("view","footer")}};
 AW.Grid.Controllers.SingleCell={onKeyUp:"selectUpperCell",onKeyDown:"selectLowerCell",onKeyCtrlUp:"selectTopCell",onKeyCtrlDown:"selectBottomCell",onKeyLeft:"selectPreviousCell",onKeyRight:"selectNextCell",onKeyCtrlLeft:"selectFirstCell",onKeyCtrlRight:"selectLastCell",onKeyHome:"selectFirstCell",onKeyEnd:"selectLastCell",onKeyCtrlHome:"selectTopLeftCell",onKeyCtrlEnd:"selectBottomRightCell",onKeyPageUp:"selectPageUpCell",onKeyPageDown:"selectPageDownCell",onKeyF2:"editCurrentCell",onKeyEnter:"editCurrentCell",onCellMouseDown:"selectThisCell",onCellDoubleClicked:"editCurrentCell"};
 AW.Grid.Controllers.SingleRow={onKeyUp:"selectPreviousRow",onKeyDown:"selectNextRow",onKeyHome:"selectFirstRow",onKeyEnd:"selectLastRow",onKeyCtrlHome:"selectFirstRow",onKeyCtrlEnd:"selectLastRow",onKeyPageUp:"selectPageUpRow",onKeyPageDown:"selectPageDownRow",onRowMouseDown:"selectThisRow"};
 AW.Grid.Controllers.MultiRow={onKeyUp:"selectPreviousRow",onKeyDown:"selectNextRow",onKeyHome:"selectFirstRow",onKeyEnd:"selectLastRow",onKeyCtrlHome:"selectFirstRow",onKeyCtrlEnd:"selectLastRow",onKeyPageUp:"selectPageUpRow",onKeyPageDown:"selectPageDownRow",onRowClicked:"selectThisRow",onRowCtrlClicked:"toggleThisRow"};
 AW.Grid.Controllers.MultiRowMarker={onKeyUp:"gotoPreviousRow",onKeyDown:"gotoNextRow",onKeyHome:"gotoFirstRow",onKeyEnd:"gotoLastRow",onKeyPageUp:"gotoPageUpRow",onKeyPageDown:"gotoPageDownRow",onRowSelectedChanged:function(v,i){this.getRowTemplate(i).refresh()}};
 AW.Grid.Separator=AW.System.Template.subclass();AW.Grid.Separator.create=function(){var obj=this.prototype;obj.setClass("grid","separator");obj.setEvent("onmousedown",function(event){var start=event.screenX;var self=this;var width=self.element().previousSibling.offsetWidth;var scroll=self.element().parentNode.parentNode.scrollLeft;function doResize(event){var w=width+event.screenX - start;w=w > 9?w:9;self.element().previousSibling.style.width=(w - AW.dx)+"px"}function endResize(event){var w=width+event.screenX - start;w=w > 9?w:9;var e=self.element();AW.detachEvent(e,"onmousemove",doResize);AW.detachEvent(e,"onmouseup",endResize);AW.detachEvent(e,"onlosecapture",endResize);AW.releaseCapture(e);if(AW.gecko){try{e.parentNode.parentNode.scrollLeft=scroll;self.$owner.element().focus()}catch(err){}}var id=e.previousSibling.id;if(id.match("header")){self.$owner.setColumnProperty("width",w,self.$0)}else if(id.match("topSelector")){self.$owner.setSelectorProperty("width",w)}e.previousSibling.style.width="";e=null}var e=AW.srcElement(event);AW.setCapture(e);AW.attachEvent(e,"onmousemove",doResize);AW.attachEvent(e,"onmouseup",endResize);AW.attachEvent(e,"onlosecapture",endResize);e=null;event.cancelBubble=true})};
 AW.Grid.Header=AW.Templates.ImageText.subclass();AW.Grid.Header.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;function _direction(){return this.getSortProperty("direction")|| "none"}obj.setClass("sort",_direction);var sort=new AW.HTML.SPAN;sort.setClass("grid","sort");obj.setContent("box/text/sort",sort);obj.element=function(){if(typeof(this.$1)=="undefined" && this.$owner.$extended){return _super.element.call(this.$owner.getHeaderTemplate(this.$0,0))}else{return _super.element.call(this)}}};
 AW.Grid.Row=AW.Templates.List.subclass();AW.Grid.Row.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setClass("text","normal");var span=AW.HTML.SPAN;var space=new span;var box=new span;space.setClass("item","template");space.setClass("grid","cell");space.setClass("column","space");box.setClass("item","box");space.setContent("box",box);obj.setContent("end",space);obj.setContent("start",function(){return this.getSelectorProperty("visible")&& !this.$1?this.getSelectorTemplate():""});var items=obj.getContent("items");obj.setContent("items",function(){return this.$name=="row" && this.$owner._fast?"":items.call(this)});var refresh=obj.refresh;obj.refresh=function(){if(typeof(this.$1)=="undefined" && this.$owner.$extended){for(var i=0;i<3;i++){refresh.call(this.$owner.getRowTemplate(this.$0,i))}}else{refresh.call(this)}};var refreshClasses=obj.refreshClasses;obj.refreshClasses=function(){if(typeof(this.$1)=="undefined" && this.$owner.$extended){for(var i=0;i<3;i++){refreshClasses.call(this.$owner.getRowTemplate(this.$0,i))}}else{refreshClasses.call(this)}}};
 AW.Grid.Rows=AW.Templates.List.subclass();AW.Grid.Rows.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setClass("grid","view");obj.setContent("items",function(){var i,ii,a=[];var count=this.getViewProperty("count");var offset=this.getViewProperty("offset");var indices=this.getViewProperty("indices");var virtual=this.getVirtualProperty("mode");if(!virtual){for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItemTemplate(ii).toString()}}else{var scroll=this.getScrollProperty("top");var height=this.getRowProperty("height");var top=Math.floor(scroll/height);var e=this.$owner.element();var client;if(e){client=Math.floor(e.offsetHeight/height)}e=null;if(!client){client=40}var x1=Math.min(count,Math.max(0,top - 50));var x2=Math.min(count,top);var x3=Math.min(count,top+client);var x4=Math.min(count,top+client+50);this.$owner._fast=true;for(i=x1;i<x2;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItemTemplate(ii).toString()}this.$owner._fast=false;for(i=x2;i<x3;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItemTemplate(ii).toString()}this.$owner._fast=true;for(i=x3;i<x4;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItemTemplate(ii).toString()}this.$owner._fast=false}return a.join("")});var span=AW.HTML.SPAN;var top=new span;top.setClass("view","top");top.setStyle("height",function(){var virtual=this.getVirtualProperty("mode");if(!virtual){return 0}var scroll=this.getScrollProperty("top");var height=this.getRowProperty("height");var offset=Math.max(0,Math.floor(scroll/height)-50)* height;return offset+"px"});obj.setContent("start",top);var space=new span;var box=new span;space.setClass("item","template");space.setClass("row","selector");space.setClass("selector","space");box.setClass("item","box");space.setContent("box",box);obj.setContent("end",space);obj.refresh=function(){if(typeof(this.$0)=="undefined" && this.$owner.$extended){for(var i=0;i<3;i++){_super.refresh.call(this.$owner.getRowsTemplate(i))}}else{_super.refresh.call(this)}}};
 AW.Grid.Control=AW.System.Control.subclass();AW.Grid.Control.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setClass("grid","control");obj.setClass("selectors",function(){return this.getSelectorVisible()?"visible":"hidden"});obj.setAttribute("tabIndex",-1);var sample=new AW.HTML.SPAN;sample.setClass("row","sample");sample.setClass("grid","row");obj.setContent("sample",sample);var box=new AW.HTML.SPAN;box.setClass("grid","box");box.setContent("html",function(){return this.getLayoutTemplate()});obj.setContent("box",box);var GC=AW.Grid.Controllers;obj.setController("size",GC.Size);obj.setController("cell",GC.Cell);obj.setController("row",GC.Row);obj.setController("view",GC.View);obj.setController("navigation",GC.Navigation);obj.setController("selection",GC.SingleCell);obj.setController("sort",GC.Sort);obj.setController("overflow",GC.Overflow);obj.setController("scroll",GC.Scroll);obj.setController("width",GC.Width);obj.setController("virtual",GC.Virtual);obj.setController("grid",GC.Grid);obj.defineTemplate("layout",function(){return this.getScrollTemplate()});obj.defineTemplate("scroll",new AW.Scroll.Bars);obj.defineTemplate("content",new AW.Panels.Horizontal);obj.defineTemplate("panel",function(){return ""});obj.defineTemplate("rows",new AW.Grid.Rows);obj.defineTemplate("row",new AW.Grid.Row);obj.defineTemplate("cell",new AW.Templates.Text);obj.defineTemplate("headers",new AW.Grid.Row);obj.defineTemplate("footers",new AW.Grid.Row);obj.defineTemplate("header",new AW.Grid.Header);obj.defineTemplate("footer",new AW.Templates.ImageText);obj.defineTemplate("separator",new AW.Grid.Separator);obj.defineTemplate("editor",new AW.UI.Input);obj.defineTemplate("selector",new AW.Templates.ImageText);obj.defineTemplate("topSelector",new AW.Templates.ImageText);obj.defineTemplate("bottomSelector",new AW.Templates.ImageText);obj.defineTemplate("popup",new AW.System.Template);function rowNext(i){var p=Math.min(this.getRowPosition(i)+1,this.getRowOffset()+this.getRowCount()- 1);var a=this.getRowIndices();return a?a[p]:p}function rowPrevious(i){var p=Math.max(this.getRowPosition(i)- 1,this.getRowOffset());var a=this.getRowIndices();return a?a[p]:p}function rowFirst(){var p=this.getRowOffset();var a=this.getRowIndices();return a?a[p]:p}function rowLast(){var p=this.getRowOffset()+this.getRowCount()- 1;var a=this.getRowIndices();return a?a[p]:p}function columnNext(i){var p=Math.min(this.getColumnPosition(i)+1,this.getColumnOffset()+this.getColumnCount()- 1);var a=this.getColumnIndices();return a?a[p]:p}function columnPrevious(i){var p=Math.max(this.getColumnPosition(i)- 1,this.getColumnOffset());var a=this.getColumnIndices();return a?a[p]:p}function columnFirst(){var p=this.getColumnOffset();var a=this.getColumnIndices();return a?a[p]:p}function columnLast(){var p=this.getColumnOffset()+this.getColumnCount()- 1;var a=this.getColumnIndices();return a?a[p]:p}function cellValue(i,j){var text=this.getCellText(i,j);var format=this.getCellFormat(i,j);return format?format.textToValue(text):AW.textToValue(text)}var scrollModel={left:0,top:0,width:0,height:0,bars:"both"};var cellModel={text:"",image:"",link:"",value:cellValue,data:"",format:"",tooltip:"",state:"",selected:false,editable:true};var columnModel={offset:0,count:0,position:function(i){return Number(i)},next:columnNext,previous:columnPrevious,first:columnFirst,last:columnLast,state:"",selected:false,resizable:true,width:100};var rowModel={offset:0,count:0,position:function(i){return Number(i)},next:rowNext,previous:rowPrevious,first:rowFirst,last:rowLast,state:"",selected:false,height:18};var currentModel={row:0,column:0,selection:"cell"};var selectedModel={};var selectionModel={mode:"rows",multiple:false};var sortModel={column:-1,direction:""};var headerModel={count:0,text:"",image:"",value:"",tooltip:"",state:"",count:1,offset:0,height:20,visible:true};var selectorModel={text:"",image:"",value:"",tooltip:"",state:"",width:20,resizable:false,visible:false};var topModel={text:"",image:"",value:"",tooltip:"",state:""};var fixedModel={left:1,right:0};var virtualModel={mode:true,top:0};var contentModel={width:0,height:0};obj.defineModel("scroll",scrollModel);obj.defineModel("cell",cellModel);obj.defineModel("header",headerModel);obj.defineModel("footer",headerModel);obj.defineModel("selector",selectorModel);obj.defineModel("top",topModel);obj.defineModel("bottom",topModel);obj.defineModel("column",columnModel);obj.defineModel("row",rowModel);obj.defineModel("current",currentModel);obj.defineModel("selected",selectedModel);obj.defineModel("selection",selectionModel);obj.defineModel("sort",sortModel);obj.defineModel("virtual",virtualModel);obj.defineModel("content",contentModel);obj.defineModel("panel",contentModel);obj.defineModel("fixed",fixedModel);obj.defineColumnProperty("indices","",true);obj.defineRowProperty("indices","",true);obj.defineHeaderProperty("indices","",true);obj.defineFooterProperty("indices","",true);obj.defineSelectedProperty("rows",[],true);obj.defineSelectedProperty("columns",[],true);obj.setFooterVisible(false);obj.setContentWidth(100,0);obj.setContentHeight(20,0);obj.getCellEditor=obj.getEditorTemplate;obj.setCellEditor=obj.setEditorTemplate;obj.calculateRowState=function(v,i){var state="";if(this.getCurrentRow()==i){state="current"}if(this.getRowSelected(i)){state="selected"}this.setRowState(state,i)};obj.calculateCellState=function(v,i,j){var state="";if(this.getCurrentColumn()==i && this.getCurrentRow()==j){state="current"}if(this.getCellSelected(i,j)){state="selected"}this.setCellState(state,i,j)};if(AW.ie){var paint=new AW.HTML.SPAN;paint.setStyle("visibility","expression(AW.paint(this))");obj.setContent("paint",paint)}if(AW.safari || AW.opera){obj.toString=function(){this.setTimeout(function(){this.raiseEvent("paint")},3000);return _super.toString.call(this)}}obj.addRow=function(row){if(this.raiseEvent("onRowAdding",row)){return}var i,count=this.getRowCount();var a=this.getRowIndices();if(typeof(row)=="undefined"){row=count}if(this._cellModel && this._cellModel.addRow){this._cellModel.addRow(row)}if(!a){a=[];for(i=0;i<count;i++){a[i]=i}}a.push(row);var refresh=this.refresh;this.refresh=function(){};this.setRowIndices(a);this.setRowCount(count+1);this.setCurrentRow(row);this.setSelectedRows([row]);this.refresh=refresh;this.raiseEvent("onRowAdded",row)};obj.deleteRow=function(row){if(this.raiseEvent("onRowDeleting",row)){return}if(this._cellModel && this._cellModel.deleteRow){this._cellModel.deleteRow(row)}var i,count=this.getRowCount();var a=this.getRowIndices();if(!a){a=[];for(i=0;i<count;i++){a[i]=i}i=row}else{i=this.getRowPosition(row)}a.splice(i,1);var refresh=this.refresh;this.refresh=function(){};this.setRowIndices(a);this.setRowCount(count-1);this.setCurrentRow(i>0?a[i-1]:-1);this.setSelectedRows(i>0?[a[i-1]]:[]);this.refresh=refresh;this.raiseEvent("onRowDeleted",row)};obj.sort=function(column,direction){this.raiseEvent("doSort",direction,column)}};AW.UI.Grid=AW.Grid.Control;
 AW.Grid.Extended=AW.Grid.Control.subclass();AW.Grid.Extended.create=function(){var obj=this.prototype;obj.$extended=true;obj.setController("extended",AW.Grid.Controllers.Extended);obj.setContentTemplate(new AW.Panels.Grid);obj.defineTemplate("top",new AW.Templates.List);obj.defineTemplate("bottom",new AW.Templates.List);var splitColumns=function(p,j){var left=this.$owner._fixedLeft,right=this.$owner._fixedRight;var i=this.$1;switch(p){case "count":if(i===0){return left}if(i==1){return this.$owner.getColumnProperty("count")- left - right}if(i==2){return right}return 0;case "offset":if(i===0){return 0}if(i==1){return left}if(i==2){return this.$owner.getColumnProperty("count")- right}return 0;default:return this.$owner.getColumnProperty(p,j)}};obj.getHeadersTemplate().mapModel("view",splitColumns);obj.getFootersTemplate().mapModel("view",splitColumns);obj.getRowTemplate().mapModel("view",splitColumns);var scrollController={onScrollLeftChanged:function(x){var e1=this.getRowsTemplate(1).element();var e2=this.getTopTemplate(1).element();var e3=this.getBottomTemplate(1).element();if(e1){e1.parentNode.scrollLeft=x}if(e2){e2.parentNode.scrollLeft=x}if(e3){e3.parentNode.scrollLeft=x}},onScrollTopChanged:function(y){var e1=this.getRowsTemplate(1).element();var e2=this.getRowsTemplate(0).element();var e3=this.getRowsTemplate(2).element();if(e1){e1.parentNode.scrollTop=y}if(e2){e2.parentNode.scrollTop=y}if(e3){e3.parentNode.scrollTop=y}},adjustScrollWidth:function(){var i,a=this.getColumnIndices();var lw=0,lc=this.getFixedLeft();var mw=0,c=this.getColumnCount();var rw=0,rc=this.getFixedRight();lw=this.getSelectorVisible()?this.getSelectorWidth():lw;for(i=0;i<lc;i++){lw+=this.getColumnWidth(a?a[i]:i)}for(i=lc;i<c-rc;i++){mw+=this.getColumnWidth(a?a[i]:i)}for(i=c-rc;i<c;i++){rw+=this.getColumnWidth(a?a[i]:i)}this.setScrollWidth(lw+mw+rw+3);lw=lw+"px";rw=rw+"px";var e1=this.getRowsTemplate(0).element();var e2=this.getTopTemplate(0).element();var e3=this.getBottomTemplate(0).element();if(e1){e1.parentNode.style.width=lw}if(e2){e2.parentNode.style.width=lw}if(e3){e3.parentNode.style.width=lw}if(AW.ie){if(e1){e1.parentNode.parentNode.style.paddingLeft=lw}if(e2){e2.parentNode.parentNode.style.paddingLeft=lw}if(e3){e3.parentNode.parentNode.style.paddingLeft=lw}}if(!AW.ie){if(e1){e1.parentNode.nextSibling.style.left=lw;e1.parentNode.nextSibling.style.right=rw}if(e2){e2.parentNode.nextSibling.style.left=lw;e2.parentNode.nextSibling.style.right=rw}if(e3){e3.parentNode.nextSibling.style.left=lw;e3.parentNode.nextSibling.style.right=rw}}e1=this.getRowsTemplate(2).element();e2=this.getTopTemplate(2).element();e3=this.getBottomTemplate(2).element();if(e1){e1.parentNode.style.width=rw}if(e2){e2.parentNode.style.width=rw}if(e3){e3.parentNode.style.width=rw}if(AW.ie){if(e1){e1.parentNode.parentNode.style.paddingRight=rw}if(e2){e2.parentNode.parentNode.style.paddingRight=rw}if(e3){e3.parentNode.parentNode.style.paddingRight=rw}}},adjustScrollHeight:function(){var h=this.getRowCount()* this.getRowHeight();h+=this.getContentHeight(0);h+=this.getContentHeight(2);this.setScrollHeight(h+3)}};obj.setController("scroll",scrollController)};
 AW.Tree.Item=AW.Templates.ImageText.subclass();AW.Tree.Item.create=function(){var obj=this.prototype;obj.setClass("tree",function(){return this.getViewProperty("count")?"folder":"leaf"});obj.setClass("expanded",function(){return this.getViewProperty("expanded")?"true":"false"});var sign=new AW.HTML.SPAN;sign.setClass("tree","sign");sign.setEvent("onclick",function(){this.raiseEvent("onTreeSignClicked")});obj.setContent("box/sign",sign)};
 AW.Tree.View=AW.System.Template.subclass();AW.Tree.View.create=function(){var obj=this.prototype;obj.setTag("span");obj.setClass("tree","view");obj.setContent("start",function(){return this.$0?this.getItemTemplate():""});obj.setContent("items",function(){if(this.$0 && !this.getViewProperty("expanded")){return ""}var i,ii,a=[];var count=this.getViewProperty("count");var offset=this.getViewProperty("offset");var indices=this.getViewProperty("indices");for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getContentTemplate(ii).toString()}return a.join("")});obj.setContent("end","")};
 AW.Tree.Group=AW.System.Template.subclass();AW.Tree.Group.create=function(){var obj=this.prototype;obj.setTag("span");obj.setClass("tree","view");obj.setContent("start",function(){return this.$0?this.getItemTemplate():""});obj.setContent("items",function(){if(this.$0 && !this.getViewProperty("expanded")){return ""}else{return this.getContentTemplate()}});obj.setContent("end","")};
 AW.Tree.Control=AW.UI.List.subclass();AW.Tree.Control.create=function(){var obj=this.prototype;obj.defineTemplate("group",new AW.Tree.Group);obj.setItemTemplate(new AW.Tree.Item);obj.setScrollTemplate(function(){return this.getGroupTemplate(0)});obj.getContentTemplate().mapTemplate("item",function(i){return this.$owner.getGroupTemplate(i)});obj.defineViewProperty("expanded",false);obj.onTreeSignClicked=function(src,i){if(this.getViewIndices(i)){this.setViewExpanded(!this.getViewExpanded(i),i)}};obj.onViewExpandedChanged=function(e,i){this.getGroupTemplate(i).refresh()}};AW.UI.Tree=AW.Tree.Control;
 AW.HTTP.Request=AW.System.Model.subclass();AW.HTTP.Request.create=function(){var obj=this.prototype;obj.defineProperty("URL");obj.defineProperty("async",true);obj.defineProperty("requestMethod","GET");obj.defineProperty("requestData","");obj.defineProperty("responseText",function(){return this._http?this._http.responseText:""});obj.defineProperty("responseXML",function(){return this._http?this._http.responseXML:""});obj.defineProperty("username",null);obj.defineProperty("password",null);obj.setNamespace=function(name,value){this._namespaces+=" xmlns:"+name+"=\""+value+"\""};obj._namespaces="";obj.setParameter=function(name,value){this["_"+name+"Parameter"]=value;if(!this._parameters.match(new RegExp(" "+name+"(|$)"))){this._parameters+=" "+name}};obj._parameters="";obj.setRequestHeader=function(name,value){this["_"+name+"Header"]=value;if(!this._headers.match(new RegExp(" "+name+"(|$)"))){this._headers+=" "+name}};obj._headers="";obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");obj.getResponseHeader=function(name){return this._http?this._http.getResponseHeader(name):""};obj.request=function(){var self=this;this._ready=false;var i,j,name,value,data="",params=this._parameters.split(" ");for(i=1;i<params.length;i++){name=params[i];value=this["_"+name+"Parameter"];if(typeof value=="function"){value=value()}if(typeof value=="object" && value.constructor==Array){for(j=0;j<value.length;j++){data+=name+"="+encodeURIComponent(value[j])+"&"}}else{data+=name+"="+encodeURIComponent(value)+"&"}}var URL=this._URL;if((this._requestMethod !="POST")&& data){URL+="?"+data;data=null}this._http=AW.createXMLHttpRequest();this._http.open(this._requestMethod,URL,this._async,this._username,this._password);var headers=this._headers.split(" ");for(i=1;i<headers.length;i++){name=headers[i];value=this["_"+name+"Header"];if(typeof value=="function"){value=value()}this._http.setRequestHeader(name,value)}this._http.send(data);if(this._async){this.setTimeout(wait,200)}else{returnResult()}function wait(){if(self._http.readyState==4){self._ready=true;returnResult()}else{self.setTimeout(wait,200)}}function returnResult(){var xml=self._http.responseXML;if(xml && xml.firstChild && xml.hasChildNodes()&& !(xml.firstChild && xml.firstChild.firstChild && xml.firstChild.firstChild.firstChild && xml.firstChild.firstChild.firstChild.nodeName=="parsererror")){self.response(xml);xml=null;return}xml=null;self.response(self._http.responseText)}};obj.response=function(result){if(this.$owner){this.$owner.refresh()}};obj.isReady=function(){return this._ready}};
 AW.CSV.Table=AW.HTTP.Request.subclass();AW.CSV.Table.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.response=function(text){var i,s,table=[];this._rows=text.split(/\r*\n/);if(this.$owner){this.$owner.clearSelectionModel();this.$owner.clearSortModel();this.$owner.clearRowModel();this.$owner.setRowCount(this.getCount());this.$owner.refresh()}};obj._rows=[];obj._data=[];obj._formats=[];obj.setFormat=function(format,index){this._formats=this._formats.concat();this._formats[index]=format};obj.setFormats=function(formats){this._formats=formats};obj.getCount=function(){return this._rows.length};var pattern=new RegExp("(^|\\t|,)(\"*|'*)(.*?)\\2(?=,|\\t|$)","g");obj.getData=function(c,r){if(!this._data[r]){var s=this._rows[r].replace(/""/g,"'");s=s.replace(pattern,"$3\t");s=s.replace(/\t$/,"");this._data[r]=s?s.split(/\t/):[]}return this._data[r][c]};obj.getText=function(i,j){var data=this.getData(i,j)|| "";var format=this._formats[i];return format?format.dataToText(data):data.replace(AW.textPattern,AW.textReplace)};obj.getImage=function(){return ""};obj.getLink=function(){return ""};obj.getValue=function(i,j){var data=this.getData(i,j)|| "";var format=this._formats[i];return format?format.dataToValue(data):data};obj.getFormat=function(i){return this._formats[i]}};
 AW.XML.Table=AW.HTTP.Request.subclass();AW.XML.Table.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;if(AW.gecko){var xpath=new XPathEvaluator()}obj.response=function(xml){this.setXML(xml);if(this.$owner){this.$owner.clearSelectionModel();this.$owner.clearSortModel();this.$owner.clearRowModel();this.$owner.setRowCount(this.getCount());this.$owner.refresh()}};obj.defineProperty("XML");obj.setXML=function(xml){if(!xml.nodeType){var s=""+xml;xml=new ActiveXObject("MSXML2.DOMDocument");xml.loadXML(s)}xml.setProperty("SelectionLanguage","XPath");if(this._namespaces){xml.setProperty("SelectionNamespaces",this._namespaces)}this._xml=xml;this._data=this._xml.selectSingleNode(this._dataPath);this._items=this._data?this._data.selectNodes(this._itemPath):null;this._ready=true};if(AW.gecko){obj.setXML=function(xml){if(!xml.nodeType){var parser=new DOMParser;xml=parser.parseFromString(""+xml,"text/xml")}else if(xml.nodeName=="XML" && xml.ownerDocument==document){var node=xpath.evaluate("*",xml,null,9,null).singleNodeValue;xml=document.implementation.createDocument("","",null);xml.appendChild(node)}namespaces={};var a=this._namespaces.split(" xmlns:");for(var i=1;i<a.length;i++){var s=a[i].split("=");namespaces[s[0]]=s[1].replace(/\"/g,"")}this._ns={lookupNamespaceURI:function(prefix){return namespaces[prefix]}};this._xml=xml;this._data=xpath.evaluate(this._dataPath,this._xml,this._ns,9,null).singleNodeValue;this._items=this._data?xpath.evaluate(this._itemPath,this._data,this._ns,7,null):null;this._ready=true}}obj.getXML=function(){return this._xml};obj._dataPath="*";obj._itemPath="*";obj._valuePath="*";obj._valuesPath=[];obj._formats=[];obj.setColumns=function(array){this._valuesPath=array};obj.setRows=function(xpath){this._itemPath=xpath};obj.setTable=function(xpath){this._dataPath=xpath};obj.setFormat=function(format,index){this._formats=this._formats.concat();this._formats[index]=format};obj.setFormats=function(formats){this._formats=formats};obj.getCount=function(){if(!this._items){return 0}return AW.gecko?this._items.snapshotLength:this._items.length};obj.getText=function(i,j){var node=this.getNode(i,j);var data=node?(AW.ie?node.text:node.textContent):"";var format=this._formats[i];return format?format.dataToText(data):data.replace(AW.textPattern,AW.textReplace)};obj.getImage=function(){return "none"};obj.getLink=function(){return ""};obj.getValue=function(i,j){var node=this.getNode(i,j);var data=node?(AW.ie?node.text:node.textContent):"";var format=this._formats[i];return format?format.dataToValue(data):data};obj.getNode=function(j,i){if(!this._items || !this._items[i]){return null}if(this._valuesPath[j]){return this._items[i].selectSingleNode(this._valuesPath[j])}else{return this._items[i].selectNodes(this._valuePath)[j]}};if(AW.gecko){obj.getNode=function(c,r){if(!this._items){return null}var row=this._items.snapshotItem(r);if(!row){return null}if(this._valuesPath[c]){return xpath.evaluate(this._valuesPath[c],row,this._ns,9,null).singleNodeValue}else{return xpath.evaluate(this._valuePath,row,this._ns,7,null).snapshotItem(c)}}}obj.getFormat=function(i){return this._formats[i]}};

