Class("linb.Profile","linb.absProfile",{Constructor:function(host,key,alias,box,properties,events,options){arguments.callee.upper.apply(this,arguments);var self=this;_.merge(self,options);self.key=key||self.key||"";self.alias=alias||self.alias||"",self.properties=properties||self.properties||{};self.events=events||self.events||{};self.host=host||self.host||self;self.box=box||self.box||self.constructor;if(self.events){self.setEvents(self.events);delete self.events}self._links={}},Instance:{setEvents:function(events){var evs=this.box.$EventHandlers;return _.merge(this,events,"all",function(o,i){return evs[i]})},getEvents:function(){var self=this,t,hash={};_.each(self.box.$EventHandlers,function(o,i){if(self[i]){hash[i]=self[i]}});return hash},_applySetAction:function(fun,value){return fun.call(this,value)},__gc:function(){var ns=this;ns.unLinkAll();_.tryF(ns.clearCache,[],ns);var o=_.get(ns,["box","_namePool"]);if(o){delete o[self.alias]}_.breakO([ns.properties,ns.events,ns],2)},boxing:function(){var self=this,t;if(!((t=self.object)&&t.get(0)==self&&t._nodes.length==1)){t=self.object=self.box.pack([self],false)}return t},serialize:function(rtnString,keepHost){var t,self=this,o=(t=self.box._beforeSerialized)?t(self):self,r={alias:o.alias,key:o.key,host:o.host};if(r.host===self){delete r.host}else{if(o.host&&!keepHost){if(rtnString!==false){r.host="@this"}else{delete r.host}}}var c={},p=o.box.$DataStruct,map=linb.absObj.$specialChars;_.merge(c,o.properties,function(o,i){return(i in p)&&p[i]!==o&&!map[i.charAt(0)]});if(!_.isEmpty(c)){r.properties=c}if(!_.isEmpty(t=this.getEvents())){r.events=t}var eh=o.box.$EventHandlers;_.filter(r.events,function(o,i){return o!=eh[i]});if(_.isEmpty(r.events)){delete r.events}return rtnString===false?r:_.serialize(r)}}});Class("linb.absObj","linb.absBox",{Constructor:function(){arguments.callee.upper.apply(this,arguments);if(arguments[0]!==false&&typeof this._ini=="function"){return this._ini.apply(this,arguments)}},Before:function(key,parent_key,o){linb.absBox.$type[key]=key;return true},After:function(){var self=this,me=arguments.callee,temp,t,k,u,m,i,j,l,v,n,b;self._nameId=0;self._namePool={};self._nameTag=(t=self.KEY.split("."))[t.length-1].toLowerCase();self._cache=[];if(self===linb.absObj||self===linb.absObj){return }m=me.a1||(me.a1=_.toArr("$Keys,$DataStruct,$EventHandlers,$DataModel"));for(j=0;v=m[j++];){k={};if((t=self.$parent)&&(i=t.length)){while(i--){_.merge(k,t[i][v])}}self[v]=k}self.setDataModel(self.DataModel);delete self.DataModel;self.setEventHandlers(self.EventHandlers);delete self.EventHandlers;m=me.a5||(me.a5=_.toArr("RenderTrigger,LayoutTrigger"));for(j=0;v=m[j++];){temp=[];if((t=self.$parent)&&(l=t.length)){for(i=0;i<l;i++){u=t[i];if(u=u["$"+v]){temp.push.apply(temp,u)}}}if(self[v]){temp.push(self[v])}self["$"+v]=temp;delete self[v]}},Static:{$abstract:true,$specialChars:{_:1,$:1},getAll:function(){return this.pack(this._cache)},pickAlias:function(){var t,p=this._namePool,a=this._nameTag;while(p[t=(a+(++this._nameId))]){}return t},setDataModel:function(hash){var self=this,sc=linb.absObj.$specialChars,ds=self.$DataStruct,properties=self.$DataModel,ps=self.prototype,i,j,t,o,n,m,r;for(i in hash){if(!properties[i]){properties[i]={}}o=hash[i];if(null===o||undefined===o){r=_.str.initial(i);delete ds[i];delete properties[i];delete ps["get"+r];delete ps["set"+r]}else{t=typeof o;if(t!="object"||o.constructor!=Object){o={ini:o}}ds[i]=("ini" in o)?o.ini:(i in ds)?ds[i]:"";t=properties[i];for(j in t){if(!(j in o)){o[j]=t[j]}}properties[i]=o}}_.each(hash,function(o,i){if(null===o||undefined===o||sc[i.charAt(0)]){return }r=_.str.initial(i);n="set"+r;if(!(o&&(o.readonly||o.inner))){var $set=o.set;m=ps[n];ps[n]=typeof m=="function"?m:Class._fun(function(value,force){return this.each(function(v){if(!v.properties){return }if(v.properties[i]===value&&!force){return }var ovalue=v.properties[i];if(v.beforePropertyChanged&&false===v.boxing().beforePropertyChanged(v,i,value,ovalue)){return }if(typeof $set=="function"){$set.call(v,value,ovalue)}else{var m=_.get(v.box.$DataModel,[i,"action"]);v.properties[i]=value;if(typeof m=="function"&&v._applySetAction(m,value,ovalue)===false){v.properties[i]=ovalue}}if(v.afterPropertyChanged){v.boxing().afterPropertyChanged(v,i,value,ovalue)}})},n,self.KEY);delete o.set;if(ps[n]!==m){ps[n].$auto$=1}}else{delete ps[n]}n="get"+r;if(!(o&&o.inner)){var $get=o.get;m=ps[n];ps[n]=typeof t=="function"?Class._fun(t,n,self.KEY):typeof m=="function"?m:Class._fun(function(){if(typeof $get=="function"){return $get.call(v)}else{return this.get(0).properties[i]}},n,self.KEY);delete o.get;if(ps[n]!==m){ps[n].$auto$=1}}else{delete ps[n]}});return self},setEventHandlers:function(hash){var self=this;_.each(hash,function(o,i){if(null===o){delete self.$EventHandlers[i];delete self.prototype[i]}else{self.$EventHandlers[i]=o;var f=function(fun){var l=arguments.length;if(l==1&&(typeof fun=="function"||typeof fun=="string")){return this.each(function(v){if(v.renderId){v.clearCache()}v[i]=fun})}else{if(l==1&&null===fun){return this.each(function(v){v.clearCache();delete v[i]})}else{var args=[],v=this.get(0),t=v[i],k=v.host||v,j;if(v.$inDesign){return }if(arguments[0]!=v){args[0]=v}for(j=0;j<l;j++){args[args.length]=arguments[j]}v.$lastEvent=i;if(typeof t=="string"){t=k[t]}if(typeof t=="function"){return _.tryF(t,args,k)}}}};f.$event$=1;f.$original$=o.$original$||self.KEY;self.plugIn(i,f)}});return self}},Instance:{alias:function(str){var self=this,pro=this.get(0),old;if(str){if(old=pro.alias){if(pro.host){try{delete pro.host[old]}catch(e){pro.host[old]=undefined}}delete self.constructor._namePool[old]}self.constructor._namePool[pro.alias=str]=1;if(pro.host){pro.host[str]=self}return self}else{return pro.alias}},host:function(value,alias){var self=this;if(value){self.get(0).host=value;if(alias){self.alias(alias);value[alias]=self}return self}else{return self.get(0).host}}}});Class("linb.DataBinder","linb.absObj",{Instance:{_ini:function(properties,events,host){var self=this,c=self.constructor,profile,options,np=c._namePool,alias;if(properties&&properties["linb.Profile"]){profile=properties;alias=profile.alias||c.pickAlias()}else{if(properties&&properties.key&&linb.absBox.$type[properties.key]){options=properties;properties=null;alias=options.alias;alias=(alias&&!np[alias])?alias:c.pickAlias()}else{alias=c.pickAlias()}profile=new linb.Profile(host,self.$key,alias,c,properties,events,options)}np[alias]=1;profile._n=profile._n||[];profile.link(c._cache,"self").link(linb._pool,"linb");if(!profile.name){profile.boxing().setName(alias)}self._nodes.push(profile);return self},destroy:function(){this.each(function(profile){var box=profile.box,name=profile.properties.name;_.arr.each(profile._n,function(v){box._unBind(name,v)});delete box._pool[name];profile.__gc()})},resetValue:function(hash){return this.each(function(o,i){_.arr.each(o._n,function(profile){var p=profile.properties;profile.boxing().resetValue((hash&&p.dataField in hash)?hash[p.dataField]:"")})})},getUI:function(){return linb.UI.pack(this.get(0)._n,false)},checkValid:function(){return linb.absValue.pack(this.get(0)._n,false).checkValid()},getValue:function(){var o=this.get(0);if(this.checkValid()){var hash={};_.arr.each(o._n,function(profile){var p=profile.properties,b=profile.boxing(),v;if(profile.renderId){b.updateValue()}v=b.getValue();hash[p.dataField]=v});return hash}else{return null}},host:function(value,alias){var self=this;if(value&&alias){self.setName(alias)}return arguments.callee.upper.apply(self,arguments)}},Static:{_pool:{},destroyAll:function(){this.pack(this._pool,false).destroy();this._pool={}},getFromName:function(name){var o=this._pool[name];return o&&o.boxing()},_bind:function(name,pro){var o=this._pool[name];if(!o){o=new linb.DataBinder();o.setName(name);o=o.get(0)}if(pro&&_.arr.indexOf(o._n,pro)==-1){pro.link(o._n,"databinder."+name)}},_unBind:function(name,pro){if(this._pool[name]){pro.unLink("databinder."+name)}},DataModel:{name:{set:function(value,ovalue){var o=this,c=linb.DataBinder,_p=c._pool,to=_p[ovalue],t=_p[value];_p[o.properties.name=value]=o;if(to&&!t){linb.absValue.pack(o._n).setDataBinder(value);_.arr.each(o._n,function(v){c._unBind(ovalue,v)})}if(t&&!to){o._n=t._n}if(to){delete _p[ovalue]}}}}}});Class("linb.UIProfile","linb.Profile",{Instance:{renderId:null,_render:function(){var ns=this,t,map=linb.$cache.profileMap;if(!ns.renderId){var ele=linb.Dom.byId(ns.$domId);if(!ele){return }if(ns.domId!=ns.$domId){ele.id=ns.domId}map[ns.domId]=map[ns.$domId]=ns;if(!ele.$linbid){linb.UI.$addEventsHanlder(ele,true)}ns.renderId=ele.$linbid;ele=null}if(t=ns.RenderTrigger){for(var i=0,l=t.length;i<l;i++){t[i].call(ns)}delete ns.RenderTrigger;if(ns.onRender){ns.boxing().onRender(ns)}}if(arguments[0]===true&&(t=ns.LayoutTrigger)){for(var i=0,l=t.length;i<l;i++){t[i].call(ns)}if(ns.onLayout){ns.boxing().onLayout(ns)}}if(!ns.box._dynamicRender){if(ns.children){for(var i=0,v;v=ns.children[i++];){v[0]._render(true)}}if(ns.$attached){for(var i=0,v;v=ns.$attached[i++];){v._render(true)}delete ns.$attached}}},__gc:function(){var ns=this,t;_.tryF(ns.$ondestory,[],ns);if(ns.onDestroy){ns.boxing().onDestroy()}if(ns.destroyTrigger){ns.destroyTrigger()}if(!ns.serialId){return }if(t=ns._$composed){_.each(t,function(v){v.__gc()})}ns.clearCache();if(t=ns.$dockParent){if(t=ns.constructor.getFromDom(t)){_.tryF(t.clearCache,[],t)}}if(!ns.$noReclaim){t=linb.$cache.reclaimId;(t[ns.key]||(t[ns.key]=[])).push(ns.serialId)}else{delete ns.$noReclaim}delete linb.$cache.profileMap[ns.domId];delete linb.$cache.profileMap[ns.$domId];if(ns.box){delete ns.box._namePool[ns.alias]}ns.unLinkAll();if(ns.LayoutTrigger){ns.LayoutTrigger.length=0}if(ns.RenderTrigger){ns.RenderTrigger.length=0}if((t=ns.children).length){t=_.copy(t);for(var i=0;i<t.length;i++){t[i][0].__gc();t[i].length=0}t.length=0}_.breakO([ns.properties,ns.events,ns.CF,ns.CB,ns.CC,ns.CS,ns],2)},unlinkParent:function(){var profile=this;delete profile.parent;delete profile.childrenId;profile.unLink("$parent");return profile},getRootNode:function(){return linb.getNodeData(this.renderId,"element")},getRoot:function(){return linb([this.renderId],false)},linkParent:function(parentProfile,linkId){var profile=this;profile.unlinkParent();profile.parent=parentProfile;profile.childrenId=linkId;profile.link(parentProfile.children,"$parent",[profile,linkId]);return profile},_cacheR1:/^\w[\w_-]*$/,setDomId:function(id){var t=this,c=linb.$cache.profileMap;if(typeof id=="string"&&(t._cacheR1.test(id)||id==t.$domId)&&!linb.Dom.byId(id)){if(t.domId!=t.$domId){delete c[t.domId]}t.domId=id;if(t.renderId){t.getRootNode().id=id}if(c[t.$domId]){c[id]=t}}return t},getDomId:function(){return this.domId},clearCache:function(){var ns=this,t=ns.$_egetter;for(var i in t){t[i].length=0;delete t[i]}t=ns.$_domid;for(var i in t){t[i].__gc();delete t[i]}return ns},_getEV:function(funs,id,name){var self=this,$k=id+"+"+name,g=self.$_egetter||(self.$_egetter={}),cache;if(g[$k]){Array.prototype.push.apply(funs,g[$k]);return }else{cache=g[$k]=[]}var dom=linb.$cache.profileMap,t,key;if((t=dom[id])&&(t=t.events)&&(t=t[name])){for(var i=0,l=t.length;i<l;i++){if(typeof t[t[i]]=="function"){cache.push(funs[funs.length]=t[t[i]])}}}key=id.split(":")[0].split("-")[1];if(typeof (((t=self._CB)&&(key?(t=t[key]):1))&&(t=t[name]))=="function"){cache.push(funs[funs.length]=t)}else{if(typeof (((t=self.CB)&&(key?(t=t[key]):1))&&(t=t[name]))=="function"){cache.push(funs[funs.length]=t)}else{if(typeof (((t=self.behavior)&&(key?(t=t[key]):1))&&(t=t[name]))=="function"){cache.push(funs[funs.length]=t)}}}},_cacheR2:/<!--([^>^\s]*)-->/g,toHtml:function(force){var self=this,c=self.box,h={},str,k1="linb.UIProfile",k2="linb.Profile",id,i,o,m,a,b,data;data=c._prepareData(self);if(c._dynamicTemplate){c._dynamicTemplate(self)}str=c._build(self,data);if((!c._dynamicRender||force)&&(m=self.children)){for(i=0;o=m[i++];){if(o[0][k1]){id=o[1]||"";a=h[id]||(h[id]=[]);a[a.length]=o[0].toHtml(force)}else{if(!o[0][k2]){b.ini.call(b,o[0]);o[0]=b.get(0)}}}}return str.replace(self._cacheR2,function(a,b){return h[b]?h[b].join(""):""})},_buildItems:function(key,items){var self=this,box=self.box,str=box._rpt(self,linb.UI.$doTemplate(self,_.get(linb.$cache.template,[box.KEY,self._hash]),items,key));return linb.UI.$toDom(str.replace(self._cacheR2,""))},serialize:function(rtnString,keepHost){var t,m,self=this,o=(t=self.box._beforeSerialized)?t(self):self,r={alias:o.alias,key:o.key,host:o.host};if(r.host===self){delete r.host}else{if(o.host&&!keepHost){if(rtnString!==false){r.host="@this"}else{delete r.host}}}if(o.$domId!=o.domId){r.domId=o.domId}var c={},p=o.box.$DataStruct,map=linb.absObj.$specialChars;_.merge(c,o.properties,function(o,i){return(i in p)&&p[i]!==o&&!map[i.charAt(0)]});if(!_.isEmpty(c)){r.properties=c}if(!_.isEmpty(t=this.getEvents())){r.events=t}var eh=o.box.$EventHandlers;_.filter(r.events,function(o,i){return o!=eh[i]});if(_.isEmpty(r.events)){delete r.events}if(!_.isEmpty(o.CS)){r.CS=_.copy(o.CS)}if(!_.isEmpty(o.CB)){r.CB=_.copy(o.CB)}if(!_.isEmpty(o.CC)){r.CC=_.copy(o.CC)}if(!_.isEmpty(o.CF)){r.CF=_.copy(o.CF)}if(o.children&&o.children.length){o.children.sort(function(x,y){x=parseInt(x[0].properties.tabindex);y=parseInt(y[0].properties.tabindex);return x>y?1:x==y?0:-1});t=r.children=[];_.arr.each(o.children,function(v){m=[v[0].serialize(false,keepHost)];if(v[1]){m[1]=v[1]}t[t.length]=m})}return rtnString===false?r:_.serialize(r)},_applySetAction:function(fun,value,ovalue){if(this.renderId){return fun.call(this,value,ovalue)}},getKey:function(id){var t;if(id.charAt(0)=="!"){id=linb.use(id).id()}if(id.indexOf(":")==-1){id=(t=linb.$cache.profileMap[id])&&(t.$domId)}return id?id.split(":")[0]:""},getSubId:function(id){var t;if(id.charAt(0)=="!"){id=linb.use(id).id()}if(id.indexOf(":")==-1){id=(t=linb.$cache.profileMap[id])&&(t.$domId)}return id?id.split(":")[2]:""},pickSubId:function(key){var self=this,r,o=self.cache_subid||(self.cache_subid={});if((o[key]||(o[key]=[]))[0]){return o[key].shift()}o=self.subId||(self.subId={});r=(o[key]||(o[key]=new _.id)).next();return r},reclaimSubId:function(id,key){var o=this.cache_subid||(this.cache_subid={});(o[key]||(o[key]=[])).push(id)},_cacheR3:/\./g,_cacheH1:{},getClass:function(key,tag){key=this.keys[key]||key;var self=this,hash=key+":"+(tag||"");return self._cacheH1[hash]||(self._cacheH1[hash]=key.replace(self._cacheR3,"-").toLowerCase().replace("linb-ui","linb")+(tag||""))},_getSubNodeId:function(key,subId){var arr=this.$domId.split(":");arr[0]=key;arr[2]=subId||"";key=arr.join(":");return key==this.$domId?linb.$cache.profileMap[key].domId:key},getSubNode:function(key,subId){var self=this;key=self.keys[key]||key;var r,t,s,h=self.$_domid||(self.$_domid={});if(subId===true){r=linb([self.renderId]).query("*","id",key==self.keys.KEY?self.domId:new RegExp("^"+key+":"+self.serialId))}else{if(!subId&&h[key]&&h[key]._nodes.length==1){return h[key]}r=(t=linb.Dom.byId(s=self._getSubNodeId(key,subId)))?linb([t]):((t=self.renderId)&&linb.use(t).query("*","id",s));if(!subId){h[key]=r}}return r},getSubNodes:function(arr,subId){var i=0,a=[],o;for(;o=arr[i++];){Array.prototype.push.apply(a,this.getSubNode(o,subId).get())}return linb(a)},getSubNodeByItemId:function(key,itemId){return(itemId=this.getSubIdByItemId(itemId))?this.getSubNode(key,itemId):linb()},getItemByItemId:function(itemId){var t;if((t=this.ItemIdMapSubSerialId)&&(t=t[itemId])){return this.SubSerialIdMapItem[t]}},getItemByDom:function(src){return this.SubSerialIdMapItem&&this.SubSerialIdMapItem[this.getSubId(typeof src=="string"?src.charAt(0)=="!"?((src=linb.use(src).get(0))&&src.id):src:src.id)]},getItemIdByDom:function(src){var t;return(t=this.getItemByDom(src))&&t.id},getSubIdByItemId:function(itemId){var t;return(t=this.ItemIdMapSubSerialId)&&t[itemId]},queryItems:function(items,fun,deep,single,flag){var r=[],me=arguments.callee,f=me.f||(me.f=function(items,fun,deep,single,r){_.arr.each(items,function(o,i){if(fun===true||fun.call(null,o,i,items)){r.push(flag?[o,i,items]:o);if(single){return false}}if(deep&&o.sub&&o.sub.length){f(o.sub,fun,deep,single,r)}})});f(items,fun,deep,single,r);return r}},Static:{getFromDom:function(id){if((id=typeof id=="string"?id.charAt(0)=="!"?((id=linb.use(id).get(0))&&id.id):id:(id&&id.id))&&(id=linb.Event._getProfile(id))&&id["linb.UIProfile"]){return id}}}});Class("linb.UI","linb.absObj",{Before:function(key,parent_key,o){linb.absBox.$type[key.replace("linb.UI.","").replace("linb.","")]=linb.absBox.$type[key]=key;return true},After:function(){linb.absObj.After.apply(this,arguments);var self=this,me=arguments.callee,temp,t,k,u,c,i,j,e,w,v,b,d;self._ctrlId=new _.id();self._idCache=[];self.$cssKeys={};t=self.$Keys;t.KEY=t.$key=self.KEY;self.addTemplateKeys(_.toArr(t,true));v="$Behaviors";k={};if((t=self.$parent)&&(e=t.length)){while(e--){b=t[e][v];for(i in b){if(typeof b[i]=="object"){if(_.isArr(b[i])){u=k[i]||(k[i]=[]);u.push.apply(u,b[i])}else{u=k[i]||(k[i]={});_.merge(u,b[i])}}else{k[i]=b[i]}}}}self[v]=k;v="$Templates";k={};if((t=self.$parent)&&(e=t[0])){for(i in e[v]){if(i.charAt(0)!="$"){k[i]=e[v][i]}}}self[v]=_.clone(k);v="$Appearances";k={};if((t=self.$parent)&&(e=t.length)){while(e--){b=t[e];for(i in b[v]){t=b[v][i];u=k[i]||(k[i]={});_.merge(u,t)}}}self[v]=k;self.setTemplate(self.Templates);delete self.Templates;self.setBehavior(self.Behaviors||{});delete self.Behaviors;self.setAppearance(self.Appearances);delete self.Appearances;if(t=self.PublicAppearance){linb.UI.$cache_css+=self.buildCSSText(t);delete self.PublicAppearance}},Instance:{destroy:function(){this.each(function(o){_.tryF(o.$beforeDestroy,[],o);if(o.beforeDestroy&&false===o.boxing().beforeDestroy()){return }if(o.renderId){o.getRoot().remove()}else{o.__gc()}});this._nodes.length=0},serialize:function(rtnString,keepHost){var a=[];this.each(function(o){a[a.length]=o.serialize(false,keepHost)});return rtnString===false?a:a.length==1?" new "+a[0].key+"("+_.serialize(a[0])+")":"linb.UI.unserialize("+_.serialize(a)+")"},_toDomElems:function(){var arr=[];_.arr.each(this._nodes,function(o){if(!o.renderId){arr.push(o)}});if(arr.length){linb.UI.pack(arr,false).render()}arr.length=0;_.arr.each(this._nodes,function(o){arr.push(o.renderId)});return arr},_ini:function(properties,events,host,CS,CC,CB,CF){var self=this,c=self.constructor,profile,t="default",options,np=c._namePool,alias,temp;if(properties&&properties["linb.Profile"]){profile=properties;alias=profile.alias||c.pickAlias();linb.UIProfile.apply(profile,[host,self.$key,alias,c,null,events])}else{if(properties&&properties.key&&linb.absBox.$type[properties.key]){options=properties;properties=null;alias=options.alias;alias=(alias&&!np[alias])?alias:c.pickAlias()}else{alias=c.pickAlias()}profile=new linb.UIProfile(host,self.$key,alias,c,properties,events,options)}np[alias]=1;for(var i in (temp=c.$DataStruct)){if(!(i in profile.properties)){profile.properties[i]=typeof temp[i]=="object"?_.copy(temp[i]):temp[i]}}profile.keys=c.$Keys;profile.CS=CS||profile.CS||{};profile.CB=CB||profile.CB||{};profile.CC=CC||profile.CC||{};profile.CF=CF||profile.CF||{};profile.template=c.getTemplate();profile.behavior=c.$Behaviors;if(!profile.serialId){profile.serialId=c._pickSerialId()}profile.$domId=profile.key+":"+profile.serialId+":";profile.domId=profile.domId||profile.$domId;profile.RenderTrigger=_.copy(c.$RenderTrigger);profile.LayoutTrigger=_.copy(c.$LayoutTrigger);profile.link(linb.UI._cache,"UI").link(c._cache,"self").link(linb._pool,"linb");temp=profile.children;profile.children=[];if(temp&&temp.length){for(var i=0,v;v=temp[i++];){if(!v[0]["linb.UIProfile"]){v[0]=new (linb.SC(v[0].key))(v[0]).get(0)}v[0].linkParent(profile,v[1])}}self._nodes.push(profile);return self},busy:function(message,html,key){message=typeof message=="string"?message:"Loading...";html=typeof html=="string"?html:'<span style="background:'+linb.UI.$bg("busy.gif","no-repeat left center")("linb.UI.Public")+';padding-left:16px;">'+message+"</span>";return this.each(function(profile){_.resetRun(profile.$linbid+":busy",function(){var keys=profile.keys;key=keys[key]||keys.BORDER||keys.PANEL||keys.KEY;var parentNode=profile.getSubNode(key),size=parentNode.cssSize(),node;if(!(node=profile.$busy)){node=profile.$busy=linb.create('<div style="left:0;top:0;z-index:10;position:absolute;background-color:#DDD;"></div><div style="left:0;top:0;z-index:20;text-align:center;position:absolute;"><div>'+html+"</div></div>");linb([node.get(0)]).css({opacity:0.5});linb(parentNode).append(node)}node.css({display:"",width:size.width+"px",height:size.height+"px"});linb([node.get(1).firstChild]).html(html,false).css("paddingTop",size.height/2+"px")},50)})},free:function(){return this.each(function(profile){_.resetRun(profile.$linbid+":busy");if(profile.$busy){profile.$busy.css("display","none")}})},reLayout:function(force){return this.each(function(o){if(!o.renderId){return }var p=o.properties;if((!o.$noB)&&p.border&&o.boxing()._border){o.boxing()._border(null,false)}if(p.dock&&p.dock!="none"){o.getRootNode().style.width=0;o.getRootNode().style.height=0;linb.UI.$dock(o,true,true)}else{linb.UI.$tryResize(o,p.width,p.height,force)}})},toHtml:function(force){var a=[];_.arr.each(this._nodes,function(o){a[a.length]=o.toHtml(force)});return a.join("")},render:function(triggerLayOut){var ns=this,arr=[],i,l,o,n=ns._nodes,matrix,a=[],byId=linb.Dom.byId;linb.UI.$applyCSS();for(i=0;o=n[i++];){if(!o.renderId&&!linb.Dom.byId(o.domId)&&!linb.Dom.byId(o.$domId)){arr[arr.length]=o}}if(l=arr.length){for(i=0;i<l;i++){a[a.length]=arr[i].toHtml()}linb.UI.$toDom(a.join(""))}for(i=0;o=n[i++];){o._render(triggerLayOut)}a.length=arr.length=0;return ns},renderOnto:function(node,host){node=linb(node);if(node.isEmpty()){return this}var self=this,pro=self.get(0),me=arguments.callee,para=me.para||(me.para=function(node){var r=node.cssRegion();r.tabindex=node.attr("tabIndex");if(r.tabindex<=0){delete r.tabindex}r.zIndex=node.css("zIndex");r.position=node.css("position");return r}),id=node.id();_.merge(pro.properties,para(node),"all");pro.properties.dock="none";if(!pro.alias&&id){pro.alias=id}if(pro.alias){self.host(host||window,pro.alias)}self.render(true);node.replace(self.getRoot());if(id){self.setDomId(id)}return self},setDomId:function(id){this.get(0).setDomId(id);return this},hide:function(){return this.each(function(o){if(o.renderId){o.getRoot().hide();o.properties.top=o.properties.left=-10000;o.properties.dockIgnore=true}})},show:function(parent,subId,left,top){return this.each(function(o){var t=o.properties,b;left=(left||left===0)?(parseInt(left)||0):null;top=(top||top===0)?(parseInt(top)||0):null;if(left!==null){t.left=left}if(top!==null){t.top=top}if(linb.getNodeData(o.renderId,"_linbhide")){b=1;t.dockIgnore=false;o.getRoot().show(left&&(left+"px"),top&&(top+"px"));if(t.dock&&t.dock!="none"){linb.UI.$dock(o,false,true)}}else{if(!parent&&(!o.renderId||(o.getRootNode().id||"").indexOf(linb.Dom._emptyDivId)===0)){parent=linb("body")}}var p=parent,n;if(p){if(p["linb.UIProfile"]){n=p.renderId;p=p.boxing()}else{if(p["linb.UI"]){n=(n=p.get(0))&&n.renderId}else{n=(p=linb(p))&&p._nodes[0]}}if(n){p.append(o.boxing(),subId);if(!b){o.getRoot().show(left&&(left+"px"),top&&(top+"px"))}}}})},clone:function(){var arr=[],f=function(p){delete p.alias;delete p.domId;if(p.children){for(var i=0,c;c=p.children[i];i++){f(c)}}};this.each(function(o){o=o.serialize(false,true);f(o);arr.push(o)});return this.constructor.unserialize(arr)},refresh:function(){var para,node,b,p,s,$linbid,serialId,fun,box,children;return this.each(function(o){if(!o.renderId){return }box=o.box;$linbid=o.$linbid;serialId=o.serialId;if(b=!!o.parent){p=o.parent.boxing();para=o.childrenId}else{p=o.getRoot().parent()}node=linb.$getGhostDiv();o.boxing().getChildren().reBoxing().each(function(v){node.appendChild(v)});node=null;children=_.copy(o.children);o.boxing().removeChildren();s=o.serialize(false,true);fun=o.$addOns;var replace=linb.create("span");o.getRoot().replace(replace);o.$noReclaim=1;o.boxing().destroy();_.merge(o,s,"all");o.$linbid=$linbid;o.serialId=serialId;o=new box(o).render();if(fun){fun.call(fun.target,o.get(0))}if(b){p.append(o,para)}else{p.append(o)}_.arr.each(children,function(v){delete v[0].$dockParent;o.append.apply(o,v)});replace.replace(o.get(0).getRoot());replace.remove();replace=null})},append:function(target,subId){if(_.isHash(target)||_.isStr(target)){target=linb.create(target)}if(target["linb.UIProfile"]){target=target.boxing()}var pro=this.get(0),parentNode;if(pro.beforeAppend&&false===this.beforeAppend(pro,target)){return }if(subId!==false&&target["linb.UI"]){target.each(function(profile){profile.linkParent(pro,subId)})}if(pro.renderId){if(subId=typeof subId=="string"?subId:null){subId=pro.getSubIdByItemId(subId)}parentNode=pro.keys.PANEL?pro.getSubNode(pro.keys.PANEL,subId):pro.getRoot();if(!parentNode.isEmpty()){parentNode.append(target)}}if(pro.afterAppend){this.afterAppend(pro,target)}return this},getChildren:function(subId){var a=[];_.arr.each(this.get(0).children,function(v){if(subId?v[1]==subId:1){a.push(v[0])}});return linb.UI.pack(a)},removeChildren:function(subId,bDestroy){return this.each(function(o){var c=_.copy(o.children);_.arr.each(c,function(v){if(subId?typeof subId=="string"?(v[1]==subId):(v[0]==(subId["linb.UI"]?subId.get(0):subId)):1){if(o.beforeRemove&&false===o.boxing().beforeRemove(o,v[0],v[1],bDestroy)){return }v[0].unlinkParent();if(o.afterRemove){o.boxing().afterRemove(o,v[0],v[1],bDestroy)}if(bDestroy){v[0].boxing().destroy()}}})})},dragable:function(dragKey,dragData,key,options){return this.each(function(o){o.getSubNode(o.keys[key]||"KEY",true).beforeMousedown(dragKey?function(pro,e,src){if(pro.properties.disabled){return }options=options||{};options.dragKey=dragKey;options.dragData=typeof dragData=="function"?dragData():dragData;_.merge(options,{dragCursor:"pointer",dragType:"icon",dragDefer:1});linb.use(src).startDrag(e,options)}:null,"_d",-1).beforeDragbegin(dragKey?function(profile,e,src){linb.use(src).onMouseout(true,{$force:true}).onMouseup(true)}:null,"_d",-1);if(!dragKey){o.clearCache()}})},setCustomFunction:function(key,value){return this.each(function(o){if(typeof key=="string"){if(value){o.CF[key]=value}else{delete o.CF[key]}}else{o.CF=key||{}}})},setCustomClass:function(key,value){var me=arguments.callee,fun=(me.fun||(me.fun=function(pro,i,h,flag){if(!h[i]){return }var node=pro.getSubNode(i,true),b;if(!node.isEmpty()){_.arr.each(h[i].split(/\s+/),function(o){node[flag?"removeClass":"addClass"](o)})}}));return this.each(function(o){var bak=_.copy(o.CC);if(typeof key=="string"){if(o.renderId){if(key in bak){fun(o,key,bak,true)}}if(!value){delete o.CC[key]}else{o.CC[key]=value;if(o.renderId){fun(o,key,o.CC)}}}else{if(!!key&&typeof key=="object"){if(o.renderId){for(var i in key){fun(o,i,bak,true)}for(var i in key){fun(o,i,key)}}o.CC=key}else{if(o.renderId){for(var i in bak){fun(o,i,bak,true)}}o.CC={}}}})},setCustomStyle:function(key,value){var me=arguments.callee,fun=(me.fun||(me.fun=function(pro,i,h,flag){if(!h[i]){return }var node=pro.getSubNode(i,true),b;if(!node.isEmpty()){_.arr.each(h[i].split(";"),function(o,i){if((b=o.split(":")).length==2){b[0]=b[0].replace(/\-(\w)/g,function(a,b){return b.toUpperCase()});try{node.css(b[0],flag?"":b[1])}catch(e){}}})}}));return this.each(function(o){var bak=_.copy(o.CS);if(typeof key=="string"){if(o.renderId){if(key in bak){fun(o,key,bak,true)}}if(!value){delete o.CS[key]}else{o.CS[key]=value;if(o.renderId){fun(o,key,o.CS)}}}else{if(!!key&&typeof key=="object"){if(o.renderId){for(var i in key){fun(o,i,bak,true)}for(var i in key){fun(o,i,key)}}o.CS=key}else{if(o.renderId){for(var i in bak){fun(o,i,bak,true)}}o.CS={}}}})},setCustomBehavior:function(key,value){return this.each(function(o){if(typeof key=="string"){if(o.keys[key]){o.CB[key]=value||{}}}else{o.CB=key||{}}if(o.CB.KEY){_.merge(o.CB,o.CB.KEY,"all");delete o.CB.KEY}o.clearCache()})}},Initialize:function(){var ns=this.prototype;_.arr.each("getSubNode,getDomId,getRootNode,getRoot".split(","),function(o){if(!ns[o]){ns[o]=function(){var p=this.get(0);return p[o].apply(p,arguments)}}ns[o].$original$="linb.UI"});var self=this,hash={};_.each(linb.UI.$ps,function(i,o){hash[o]={ini:"auto",action:function(value){var self=this,p=self.properties,b=false,args={$type:p.dock};switch(p.dock){case"top":if(o!="height"&&o!="top"){return }args.width=args.height=1;break;case"bottom":if(o!="height"&&o!="bottom"){return }args.width=args.height=1;break;case"left":if(o!="width"&&o!="left"){return }args.width=args.height=1;break;case"right":if(o!="width"&&o!="right"){return }args.width=args.height=1;break;case"width":if("width"==o){return }args.width=1;break;case"height":if("height"==o){return }args.height=1;break;case"fill":case"cover":if(o=="width"&&o=="height"){return }args.width=args.height=1;break}self.getRoot()[o]?self.getRoot()[o](value):linb.Dom._setPxStyle(self.getRootNode(),o,value);if(p.dock!="none"){_.tryF(self.$dock,[self,args],self)}if(o=="width"||o=="height"){if(self.onResize){self.boxing().onResize(self,o=="width"?value:null,o=="height"?value:null)}}else{if(self.onMove){self.boxing().onMove(self,o=="left"?value:null,o=="top"?value:null,o=="right"?value:null,o=="bottom"?value:null)}}}}});_.merge(hash,{renderer:{ini:null},zIndex:{ini:1,action:function(value){this.getRoot().css("zIndex",value)}},tabindex:{ini:1,action:function(value){var ns=this,reg=new RegExp("^"+ns.key+"[-\\w]*:"+ns.serialId+":");ns.getRoot().query("*",function(n){return n.id&&reg.test(n.id)&&n.getAttribute("tabIndex")}).attr("tabIndex",value)}},position:{ini:"absolute",listbox:["","static","relative","absolute"],action:function(value){this.getRoot().css("position",value)}},visibility:{listbox:["","visible","hidden"],action:function(value){this.getRoot().css("visibility",value)}},display:{listbox:["","none","block","inline","inline-block"],action:function(value){if(value=="inline-block"){this.getRoot().setInlineBlock()}else{this.getRoot().css("display",value)}}}});self.setDataModel(hash);linb.UI.$cache_css+=linb.UI.buildCSSText({".linb-html, .linb-html BODY":{overflow:"hidden",height:"100%",border:"0 none",margin:"0",padding:"0"},".ui-ctr":{},".ui-dragable":{},".ui-btn, .ui-btni, .ui-btnc":{height:"22px",background:linb.UI.$bg("button.gif","no-repeat",true)},".ui-btn":{$order:1,"white-space":"nowrap","vertical-align":"top",overflow:"hidden","background-position":"right top","padding-right":"4px","font-size":"12px"},".ui-btn *":{cursor:"pointer"},".ui-btnc button, .ui-btnc a":{display:linb.$inlineBlock,zoom:linb.browser.ie?1:null,background:"transparent",border:0,margin:0,padding:0},".ui-btnc a":{padding:"0 4px"},".ui-btni":{$order:1,"background-position":"left -60px","padding-left":"4px","vertical-align":"top"},".ui-btnc":{$order:1,"background-position":"left -30px","background-repeat":"repeat-x","padding-top":"3px","vertical-align":"top"},".ui-btn-mouseover, .ui-btn-focus":{$order:2,"background-position":"right -90px"},".ui-btn-mouseover .ui-btni, .ui-btn-focus .ui-btni":{$order:2,"background-position":"left -150px"},".ui-btn-mouseover .ui-btnc, .ui-btn-focus .ui-btnc":{$order:2,"background-position":"left -120px"},".ui-btn-mousedown, .ui-btn-checked":{$order:3,"background-position":"right -180px"},".ui-btn-mousedown .ui-btni, .ui-btn-checked .ui-btni":{$order:3,"background-position":"left -240px"},".ui-btn-mousedown .ui-btnc, .ui-btn-checked .ui-btnc":{$order:3,"background-position":"left -210px"},".ui-icon":{"vertical-align":"middle",width:"16px",height:"16px",margin:"0 4px 0 2px"},".uicmd-close, .uicmd-opt, .uicmd-land, .uicmd-toggle, .uicmd-toggle2, .uicmd-min, .uicmd-max,.uicmd-restore,.uicmd-pin, .uicmd-check, .uicmd-radio, .uicmd-add":{background:linb.UI.$bg("icons.gif","no-repeat 0 0",true),width:"16px",height:"16px","margin-right":"2px",cursor:"default","vertical-align":"middle"},".uicmd-empty":{width:"16px",height:"16px","margin-right":"2px",cursor:"default","vertical-align":"middle"},".uicmd-opt":{$order:1,"background-position":"0 0"},".uicmd-opt-mouseover":{$order:2,"background-position":"0 -20px"},".uicmd-opt-mousedown":{$order:3,"background-position":"0 -40px"},".uicmd-land":{$order:1,"background-position":"-40px 0"},".uicmd-land-mouseover":{$order:2,"background-position":"-40px -20px"},".uicmd-land-mousedown":{$order:3,"background-position":"-40px -40px"},".uicmd-pin":{$order:1,"background-position":"-80px 0"},".uicmd-pin-mouseover":{$order:2,"background-position":"-80px -20px"},".uicmd-pin-mousedown":{$order:3,"background-position":"-80px -40px"},".uicmd-pin-checked, .uicmd-pin-checked-mouseover, .uicmd-pin-checked-mousedown":{$order:4,"background-position":"-80px -40px"},".uicmd-min":{$order:1,"background-position":"-120px 0"},".uicmd-min-mouseover":{$order:2,"background-position":" -120px -20px"},".uicmd-min-mousedown":{$order:3,"background-position":"-120px -40px"},".uicmd-restore":{$order:1,"background-position":"-160px 0"},".uicmd-restore-mouseover":{$order:2,"background-position":"-160px -20px"},".uicmd-restore-mousedown":{$order:3,"background-position":"-160px -40px"},".uicmd-max":{$order:1,"background-position":"-200px 0"},".uicmd-max-mouseover":{$order:2,"background-position":"-200px -20px"},".uicmd-max-mousedown":{$order:3,"background-position":"-200px -40px"},".uicmd-close":{$order:1,"background-position":"-240px 0"},".uicmd-close-mouseover":{$order:2,"background-position":"-240px -20px"},".uicmd-close-mousedown":{$order:3,"background-position":"-240px -40px"},".uicmd-check":{$order:1,margin:"0 4px 0 2px","background-position":"-20px -70px"},".uicmd-check-mouseover":{$order:2,"background-position":"-20px -90px"},".uicmd-check-mousedown":{$order:3,"background-position":"-20px -110px"},".uicmd-check-checked":{$order:4,"background-position":"0 -70px"},".uicmd-check-checked-mouseover":{$order:5,"background-position":"0 -90px"},".uicmd-check-checked-mousedown":{$order:6,"background-position":"0 -110px"},".uicmd-radio":{$order:1,margin:"0 4px 0 2px","background-position":"-60px -70px"},".uicmd-radio-mouseover":{$order:2,"background-position":"-60px -90px"},".uicmd-radio-mousedown":{$order:3,"background-position":"-60px -110px"},".uicmd-radio-checked":{$order:4,"background-position":"-40px -70px"},".uicmd-radio-checked-mouseover":{$order:5,"background-position":"-40px -90px"},".uicmd-radio-checked-mousedown":{$order:6,"background-position":"-40px -110px"},".uicmd-add":{$order:1,"background-position":"-56px -222px"},".uicmd-add-mouseover":{$order:2,"background-position":"-56px -222px"},".uicmd-add-mousedown":{$order:3,"background-position":"-56px -222px"},".uicmd-toggle":{$order:1,"margin-left":"3px","background-position":"-160px -70px"},".uicmd-toggle-mouseover":{$order:2,"background-position":"-160px -90px"},".uicmd-toggle-mousedown":{$order:3,"background-position":"-160px -110px"},".uicmd-toggle-checked":{$order:4,"background-position":"-180px -70px"},".uicmd-toggle-checked-mouseover":{$order:5,"background-position":"-180px -90px"},".uicmd-toggle-checked-mousedown":{$order:6,"background-position":"-180px -110px"},".uicmd-toggle-busy":{$order:7,background:linb.UI.$bg("busy.gif","no-repeat center center",true)},".uicmd-toggle2":{$order:1,"background-position":"-200px -70px"},".uicmd-toggle2-mouseover":{$order:2,"background-position":"-200px -90px"},".uicmd-toggle2-mousedown":{$order:3,"background-position":"-200px -110px"},".uicmd-toggle2-checked":{$order:4,"background-position":"-220px -70px"},".uicmd-toggle2-checked-mouseover":{$order:5,"background-position":"-220px -90px"},".uicmd-toggle2-checked-mousedown":{$order:6,"background-position":"-220px -110px"},".uibar-top, .uibar-bottom, .uibar-top-s, .uibar-bottom-s":{position:"relative","vertical-align":"baseline","font-size":0,"line-height":0},".uibar-top td, .uibar-top-s td, .uibar-bottom td, .uibar-bottom-s td":{$order:1,background:linb.UI.$bg("bar_vertical.gif","no-repeat 0 0",true)},".uibar-top, .uibar-top .uibar-t":{height:"29px"},".uibar-top .uibar-tdl":{$order:1,"padding-left":"4px",height:"100%","background-position":"0 0"},".uibar-top .uibar-tdm":{$order:1,"background-position":"0 -30px","background-repeat":"repeat-x"},".uibar-top .uibar-tdr":{$order:1,"padding-left":"4px","background-position":"right -60px"},".uibar-top-focus .uibar-tdl":{$order:2,"padding-left":"4px",height:"100%","background-position":"left -90px"},".uibar-top-focus .uibar-tdm":{$order:2,"background-position":"left -120px","background-repeat":"repeat-x"},".uibar-top-focus .uibar-tdr":{$order:2,"padding-left":"4px","background-position":"right -150px"},".uibar-top .uibar-cmdl":{"-moz-user-select":"none",overflow:"hidden",position:"absolute",left:0,top:"6px",width:"92%",height:"22px","padding-left":"8px","white-space":"nowrap"},".uibar-top .uibar-cmdr":{"-moz-user-select":"none",position:"absolute",top:"6px",right:"8px","text-align":"right"},".uicon-main":{position:"relative","padding-left":"5px","font-size":0,"line-height":0,"z-index":1,overflow:"visible",background:linb.UI.$bg("bar_horizontal.gif","repeat-y -595px top",true)},".uicon-maini":{"padding-right":"5px","font-size":0,"line-height":0,background:linb.UI.$bg("container_right.gif","#AAD2FA repeat-y right top",true)},".uibar-bottom, .uibar-bottom .uibar-t":{height:"12px"},".uibar-bottom .uibar-tdl":{$order:1,"padding-left":"5px",height:"100%","background-position":"left -189px"},".uibar-bottom .uibar-tdm":{$order:1,"background-position":"left -211px","background-repeat":"repeat-x"},".uibar-bottom .uibar-tdr":{$order:1,"padding-left":"5px","background-position":"right -233px"},".uibar-top-s, .uibar-top-s .uibar-t":{$order:3,height:"7px"},".uibar-top-s .uibar-tdl":{$order:3,height:"100%","padding-left":"5px","background-position":"left -261px"},".uibar-top-s .uibar-tdm":{$order:3,"background-position":"left -283px","background-repeat":"repeat-x"},".uibar-top-s .uibar-tdr":{$order:3,"padding-left":"5px","background-position":"right -305px"},".uibar-top-s .uibar-cmdl":{$order:3,display:"none"},".uibar-top-s .uibar-cmdr":{$order:3,display:"none"},".uibar-bottom-s, .uibar-bottom-s .uibar-t":{$order:3,height:"6px"},".uibar-bottom-s .uibar-tdl":{$order:3,height:"100%","padding-left":"5px","background-position":"left -327px"},".uibar-bottom-s .uibar-tdm":{$order:3,"background-position":"left -349px","background-repeat":"repeat-x"},".uibar-bottom-s .uibar-tdr":{$order:3,"padding-left":"5px","background-position":"right -371px"}})+linb.UI.buildCSSText({".ui-ctrl":{"vertical-align":"middle"},".uiw-shell":{background:"transparent",display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,border:0,padding:0,margin:0},".uiw-frame":{$order:1,display:"block",position:"relative",border:0,padding:0,margin:0,width:"100%",height:"100%","-moz-box-flex":"1"},".uiw-border":{$order:2,display:"block",position:"absolute",border:0,padding:0,margin:0,left:0,top:0,width:"100%",height:"100%"},".ui-dirty":{$order:1,background:linb.UI.$bg("icons.gif","no-repeat",true),"background-position":"-390px -290px"},".ui-disabled, .ui-disabled *":{color:"#808080"},".ui-invalid, .ui-invalid *":{"background-color":"#FFEBCD"},"#linblangkey":{"vertical-align":"baseline"}})+linb.UI.buildCSSText({".uibg-base":{"background-color":"#fff"},".uibg-bar":{"background-color":"#aad2fa"},".uiborder-inset":{border:"solid 1px","border-color":"#648cb4 #c8e1fa #c8e1fa #648cb4"},".uiborder-outset":{border:"solid 1px","border-color":"#c8e1fa #648cb4 #648cb4 #c8e1fa"}})},$End:function(){linb.UI.$cache_css+=this.buildCSSText(this.$Appearances)},Static:{$cache_css:"",$css_tag_dirty:"ui-dirty",$css_tag_invalid:"ui-invalid",$tag_left:"{",$tag_right:"}",$tag_special:"#",$ID:"#id#",$DOMID:"#domid#",$CLS:"#cls#",$tag_subId:"_serialId",$childTag:"<!--{id}-->",$onSize:function(profile,e){var style=profile.getRootNode().style;if(e.width||e.height){linb.UI.$tryResize(profile,style.width,style.height)}style=null},$theme:"default",$ps:{left:1,top:1,width:1,height:1,right:1,bottom:1},$toDom:function(str){var matrix=linb.Dom.getEmptyDiv().get(0),r=[];matrix.innerHTML=str;this.$addEventsHanlder(matrix);for(var i=0,t=matrix.childNodes,l=t.length;i<l;i++){linb.$registerNode(t[i]);r[r.length]=t[i].$linbid}matrix=null;return linb(r,false)},$addEventsHanlder:function(node,includeSelf){var ch=linb.$cache.UIKeyMapEvents,eh=linb.Event._eventHandler,children=_.toArr(node.getElementsByTagName("*")),i,l,j,k,id,t,v;if(includeSelf){children.push(node)}if(l=children.length){for(i=0;i<l;i++){if((node=children[i]).nodeType!=1){continue}if(id=node.id){if(t=ch[id]||ch[id.substr(0,id.indexOf(":"))]){v=linb.$registerNode(node);v=v.eHandlers||(v.eHandlers={});for(j in t){v[j]=t[j];if(k=eh[j]){v[k]=node[k]=t[j]}}}}}}children.length=0;node=null},getFromDom:function(id){if(id=linb.UIProfile.getFromDom(id)){return id.boxing()}},unserialize:function(target,keepSerialId){if(typeof target=="string"){target=_.unserialize(str)}var f=function(o){if(_.isArr(o)){o=o[0]}delete o.serialId;if(o.children){_.arr.each(o.children,f)}},a=[];_.arr.each(target,function(o){if(!keepSerialId){f(o)}a.push((new (linb.SC(o.key))(o)).get(0))});return this.pack(a,false)},_ensureValues:function(arr){var a=[],i=0,k=0,o,key=this.KEY,cache=linb.$cache.profileMap,getData=linb.getNodeData;if(arr["linb.absBox"]){arr=arr._nodes}for(;o=arr[i++];){if((o.box&&o.box[key])||((o=cache[getData(o.renderId?o.renderId:o,["element","id"])])&&o.box&&o.box[key])){a[k++]=o}}return a.length<=1?a:this._unique(a)},__gc:function(){var self=this,k=self.$key,cache=linb.$cache;_.breakO([cache.template[k],cache.reclaimId[k],self._cache,self._idCache,self.$DataModel,self.$Templates,self.$Behaviors,self],2);delete linb.absBox.$type[k.replace("linb.UI.","")];delete linb.absBox.$type[k];_.filter(linb.$cache.UIKeyMapEvents,function(o,i){return !(i==k||i.indexOf(k+"-")==0)});Class.__gc(k)},_pickSerialId:function(){var arr=linb.$cache.reclaimId[this.$key];if(arr&&arr[0]){return arr.pop()}return this._ctrlId.next()},$bg:function(path,para,forceKey){return function(key){var p=linb.ini.path+"appearance/default/"+(typeof forceKey=="string"?forceKey:forceKey?"Public":(p=key.split("."))[p.length-1])+"/"+path;return"url("+p+") "+(para||"")}},$ieBg:function(path,forceKey){return function(key){var p=linb.ini.path+"appearance/default/"+(typeof forceKey=="string"?forceKey:forceKey?"Public":(p=key.split("."))[p.length-1])+"/"+path;return'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+p+'",sizingMethod="crop")'}},$doTemplate:function(profile,template,properties,tag,result){var self=arguments.callee,s,t,n,isA=properties.constructor==Array,temp=template[tag||""],r=!result,result=result||[];if(isA){if(typeof temp!="function"){temp=self}for(var i=0;t=properties[i++];){temp(profile,template,t,tag,result)}}else{if(t=properties.object){result[result.length]=t.toHtml()}else{if(typeof temp=="function"){temp(profile,template,properties,tag,result)}else{tag=tag?tag+".":"";var a0=temp[0],a1=temp[1];for(var i=0,l=a0.length;i<l;i++){if(n=a1[i]){if(n in properties){t=properties[n];if(template[s=tag+n]&&t){self(profile,template,t,s,result)}else{result[result.length]=t}}}else{result[result.length]=a0[i]}}}}}if(r){return result.join("")}},$buildTemplate:function(profile,template,key,obj,arr){if(template&&String(template.tagName).toLowerCase()=="text"){arr[arr.length]=template.text;return }var self=arguments.callee,behavior=profile.behavior?key?profile.behavior[key]:profile.behavior:null,map1=self.map1||(self.map1={tagName:1,text:1}),map2=self.map2||(self.map2={image:1,input:1,br:1,meta:1,hr:1,abbr:1,embed:1}),r2=self.r2||(self.r2=/[a-z]/),r3=self.r3||(self.r3=/^(on|before|after)/),r7=self.r7||(self.r7=/([^{}]*)\{([\w]+)\}([^{}]*)/g),first=false,u=linb.UI,t,o,bak,lkey;if(!template){template=profile.template}lkey=key?profile.keys[key]:profile.key;if(!template.tagName){template.tagName="span"}if(template.id!==null){template.id=key?lkey+":"+u.$ID+":"+u.$tag_left+u.$tag_subId+u.$tag_right:u.$DOMID}else{delete template.id}if(template.className!==null){t=u.$CLS+(key?"-"+key.toLowerCase():"");bak=template.className||"";template["class"]=t+" "+bak+" "+(lkey==profile.key?" ui-ctrl ":"")+u.$tag_special+(key||"KEY")+"_CC"+u.$tag_special}delete template.className;template.style=(template.style||"")+";"+u.$tag_special+(key||"KEY")+"_CS"+u.$tag_special;var a=[],b={},tagName=template.tagName,text=template.text,sc=linb.absObj.$specialChars;for(var i in template){if(!template[i]){continue}if(!sc[i.charAt(0)]&&!map1[i]){o=template[i];if(!r2.test(i)){if(typeof o=="object"){if(!o.$order){o.$order=0}o.$key=i;a[a.length]=o}}else{b[i]=o}}}a.sort(function(x,y){x=x.$order;y=y.$order;return x>y?1:x==y?0:-1});if(!arr){first=true;arr=[]}arr[arr.length]="<"+tagName+" ";for(var i in b){if(b[i]){arr[arr.length]=i+'="'+b[i]+'" '}}if(template.className!==null){template.className=bak}delete template["class"];arr[arr.length]="{attributes}>";if(!map2[tagName]&&text){arr[arr.length]=text}for(var i=0,l=a.length;i<l;){o=a[i++];self(profile,o,o.$key,obj,arr)}if(!map2[tagName]){arr[arr.length]="</"+tagName+">"}if(first){var a0=obj[0],a1=obj[1];arr.join("").replace(r7,function(a,b,c,d){if(b){a0[a0.length]=b}a1[a0.length]=a0[a0.length]=c;if(d){a0[a0.length]=d}return""})}},_rpt:function(profile,temp){var me=arguments.callee,tag=linb.UI.$tag_special,r=me._r||(me._r=new RegExp(tag+"([0-9A-Z_]+)_C([SC])"+tag+"|"+tag+"([\\w_\\-\\.]*)"+tag,"img")),h1={id:profile.serialId,cls:profile.getClass("KEY"),domid:profile.$domId},h2={S:profile.CS,C:profile.CC};return temp.replace(r,function(a,b,c,d){return h1[d]||h2[c][b]||""})},_build:function(profile,data){var template,t,m,u=linb.UI,temp=[[],[]],self=this,key=self.KEY,cache=linb.$cache.template,hash=profile._hash="b:"+(profile.template._subid||"")+";!"+(profile._exhash||"");if(!(template=_.get(cache,[key,hash]))){u.$buildTemplate(profile,null,null,temp);_.set(cache,[key,hash,""],temp);if(t=profile.template.$submap){for(var i in t){if(typeof (m=t[i])!="function"){var temp=[[],[]];for(var j in m){if(typeof m[j]=="object"){u.$buildTemplate(profile,m[j],j,temp)}}m=temp}_.set(cache,[key,hash,i],m)}}template=_.get(cache,[key,hash])}if(!template){return""}return self._rpt(profile,u.$doTemplate(profile,template,data))},_setDefaultBehavior:function(hash){var self=this,me=arguments.callee,map=me._m||(me._m={"":1,KEY:1,$key:1}),f=me._f1||(me._f1=function(arr,type,mode){var fun=function(profile,e,src){var t,id=linb.use(src).id(),item,cid=profile.getSubId(id),prop=profile.properties,nodes,funs,box;if(prop.disabled){return }item=profile.SubSerialIdMapItem&&profile.SubSerialIdMapItem[cid];if(item&&item.disabled){return }switch(typeof arr){case"string":nodes=profile.getSubNode(arr,cid)._get();break;case"function":funs=[arr];break;case"object":nodes=[];funs=[];for(var o,i=0,l=arr.length;i<l;i++){o=arr[i];if(typeof o=="string"){nodes.push.apply(nodes,profile.getSubNode(o,cid)._get())}else{funs.push(o)}}}if(nodes&&nodes.length){nodes=linb(nodes);box=profile.boxing();if(mode==1){if(type=="mouseover"&&profile.beforeHoverEffect){if(false==box.beforeHoverEffect(profile,item,e,src,"mouseover")){return }}if(type=="mousedown"&&profile.beforeClickEffect){if(false==box.beforeClickEffect(profile,item,e,src,"mousedown")){return }}nodes.tagClass("-"+type)}else{if(type=="mouseup"){if(profile.beforeClickEffect&&false==box.beforeClickEffect(profile,item,e,src,"mouseup")){return }nodes.tagClass("-mousedown",false)}else{if(profile.beforeHoverEffect&&false==box.beforeHoverEffect(profile,item,e,src,"mouseout")){return }nodes.tagClass("(-mouseover|-mousedown)",false)}}}if(funs&&funs.length){_.arr.each(funs,function(o){_.tryF(o,[profile],profile)});funs.length=0}};return fun}),hls={},t;if(!linb.SC.get("linb.absComposed")){Class("linb.absComposed","linb.absObj",{Instance:{addPanel:function(para,children,item){var pro=_.copy(linb.UI.Panel.$DataStruct);_.merge(pro,para,"with");_.merge(pro,{dock:"fill",tag:para.tag||para.id},"all");var pb=new linb.UI.Panel(pro),arr=[];this.append(pb,item&&item.id);_.arr.each(children,function(o){arr.push(o[0])});pb.append(linb.UI.pack(arr,false));return this},removePanel:function(){this.destroy()},getPanelPara:function(){return _.copy(this.get(0).properties)},getPanelChildren:function(){return this.get(0).children},_e1:function(profile,item,e,src,type){},_e2:function(profile,key,control,shift,alt,e,src){},_e3:function(profile,e,shift,src){},_e4:function(profile,e,src,key,data,item){},_e5:function(profile,e,src){}},Static:{DataModel:{dragKey:"",dropKeys:""},$abstract:true}})}var src=linb.absComposed.prototype;if(hash.HoverEffected){_.each(hash.HoverEffected,function(o,i){t=map[i]?hash:(hash[i]||(hash[i]={}));if(!o){t.afterMouseover=t.afterMouseout=null}else{t.afterMouseover=f(o,"mouseover",1);t.afterMouseout=f(o,"mouseout",2)}});hls.beforeHoverEffect=src._e1}if(hash.ClickEffected){_.each(hash.ClickEffected,function(o,i){t=map[i]?hash:(hash[i]||(hash[i]={}));if(!o){t.afterMousedown=t.afterMouseup=null}else{t.afterMousedown=f(o,"mousedown",1);t.afterMouseup=f(o,"mouseup",2)}});hls.beforeClickEffect=src._e1}if(hash.KeyHook){_.merge(hash,{afterKeydown:function(profile,e,src){if(profile.onHotKeydown){var key=linb.Event.getKey(e);return false!==profile.boxing().onHotKeydown(profile,key[0],!!key[1],!!key[2],!!key[3],e,src)}},afterKeypress:function(profile,e,src){if(profile.onHotKeypress){var key=linb.Event.getKey(e);return false!==profile.boxing().onHotKeypress(profile,key[0],!!key[1],!!key[2],!!key[3],e,src)}},afterKeyup:function(profile,e,src){if(profile.onHotKeyup){var key=linb.Event.getKey(e);return false!==profile.boxing().onHotKeyup(profile,key[0],!!key[1],!!key[2],!!key[3],e,src)}}},"all");hls.onHotKeydown=hls.onHotKeypress=hls.onHotKeyup=src._e2}if(hash.NavKeys){_.each(hash.NavKeys,function(o,i){var map=arguments.callee,k,m1=map.m1||(map.m1={KEY:1,$key:1});if(m1[i]){return }var m2=map.m2||(map.m2={input:1,textarea:1}),m3=map.m3||(map.m3={tab:1,enter:1,up:1,down:1,left:1,right:1}),m4=map.m4||(map.m4={tab:1,up:1,down:1,left:1,right:1}),t=hash[i]||(hash[i]={});if(null===o){t.afterKeydown=null}else{t.afterKeydown=function(profile,e,src){var k=linb.Event.getKey(e),key=k[0],ctrl=k[1],shift=k[2],alt=k[3],b=false;if(m2[k=linb.use(src).get(0).tagName.toLowerCase()]){if(m3[key]){var reg=linb.use(src).caret(),txt=linb.use(src).get(0).value;switch(key){case"up":if(!/[\n\r]/.test(txt.substr(0,reg[0]))){b=true}break;case"left":if((ctrl&&!shift)||(reg[0]===0&&(reg[1]!==txt.length||reg[1]===0))){b=true}break;case"down":if(!/[\n\r]/.test(txt.substr(reg[1],txt.length))){b=true}break;case"right":if((ctrl&&!shift)||(reg[1]===txt.length&&(reg[0]!==0||reg[1]===0))){b=true}break;case"enter":if(k=="input"||alt){b=true}break;case"tab":b=true;break}}}else{if(m4[key]){b=true}}if(b){if(profile.beforeNextFocus&&false===profile.boxing().beforeNextFocus(profile,key,!!shift,e)){return false}if(key!="tab"){linb.use(src).nextFocus(("up"==key||"left"==key)?false:true)}}}}});hls.beforeNextFocus=src._e3}if((t=hash.DropableKeys)&&t.length){_.arr.each(t,function(o){self._dropable(o)});t=self.prototype;_.arr.each("addPanel,removePanel,getPanelPara,getPanelChildren,getDropKeys,setDropKeys".split(","),function(o){if(!t[o]){t[o]=src[o]}});self.$DataModel.dropKeys=self.$DataStruct.dropKeys="";hls.onDragEnter=hls.onDragLeave=hls.onDrop=hls.onDropTest=hls.onDropMarkShow=hls.onDropMarkClear=src._e4}if((t=hash.DragableKeys)&&t.length){_.arr.each(t,function(o){self._dragable(o)});t=self.prototype;_.arr.each("getDragKey,setDragKey".split(","),function(o){if(!t[o]){t[o]=src[o]}});self.$DataModel.dragKey=self.$DataStruct.dragKey="";hls.onGetDragData=hls.onStartDrag=hls.onDragStop=src._e5}self.setEventHandlers(hls)},addTemplateKeys:function(arr){var self=this,key=self.KEY,me=arguments.callee,reg=me._reg||(me._reg=/\./g);_.arr.each(arr,function(i){self.$cssKeys[i]=(self.$Keys[i]=i=="KEY"?key:key+"-"+i).replace(reg,"-").toLowerCase().replace("linb-ui","linb")});return self},$CSSCACHE:{},$getCSSValue:function(cls,key){var cache=this.$CSSCACHE,ck=cls+"->"+key,me=arguments.callee;if(ck in cache){return cache[ck]}var c=linb.Dom.getEmptyDiv().get(0),r;c.className=cls;r=cache[ck]=parseInt(linb.Dom.getStyle(c,key))||0;c.className="";return r},getTheme:function(){return this.$theme},setTheme:function(key){key=key||"default";var ns=this;if(key!=ns.$theme){if(key!="default"){linb.CSS.includeLink(linb.getPath("linb.appearance."+key,"/theme.css"),"theme:"+key)}var o=linb.CSS.get("id","theme:"+ns.$theme);if(o){o.disabled=true;linb(o).remove(false)}ns.$theme=key;ns.$CSSCACHE={};var count=0;_.asyRun(function(){if(count>5){throw new Error("errLoadTheme:"+key)}count++;var s=linb.CSS.$getCSSValue(".setting-uikey","fontFamily");if(s==key||key=="default"){linb.UI.getAll().reLayout(true);count=null}else{_.asyRun(arguments.callee,200*count)}},100)}return this},setAppearance:function(hash){_.merge(this.$Appearances,hash,"all");return this},getAppearance:function(){return this.$Appearances},setTemplate:function(hash,cacheId){if(hash){var self=this,me=arguments.callee,r2=me.r2||(me.r2=/[a-z]/),sc=linb.absObj.$specialChars,_ks=["KEY"],fun=me._fun||(me._fun=function(hash,arr){var o,i;for(i in hash){if(!sc[i.charAt(0)]){if(!r2.test(i)){arr[arr.length]=i;o=hash[i];if(typeof o=="object"){arguments.callee(o,arr)}}}}}),t;fun(hash,_ks);self.addTemplateKeys(_ks);t=self.$Templates;if(typeof cacheId=="string"){hash._subid=cacheId;t[cacheId]=hash}else{t._=hash}if(t=hash.$submap){for(var i in t){for(var j in t[i]){me.call(self,t[i],j)}}}}return this},getTemplate:function(cacheId){return this.$Templates[cacheId||"_"]},setBehavior:function(hash){if(hash){var self=this,ch=linb.$cache.UIKeyMapEvents,skey=self.$key,check=linb.absObj.$specialChars,handler=linb.Event.$eventhandler,eventType=linb.Event._eventMap,me=arguments.callee,r1=me.r1||(me.r1=/[a-z]/),r2=me.r2||(me.r2=/^(on|before|after)/),t=self.$Behaviors,m,i,j,k,o,v,type;self._setDefaultBehavior(hash);if(hash.KEY){_.merge(hash,hash.KEY,"all");delete hash.KEY}for(i in hash){o=hash[i];if(!check[i.charAt(0)]){if(!r1.test(i)){m=t[i]||(t[i]={});for(j in o){v=o[j];if(!check[j.charAt(0)]){if(v){m[j]=v}else{delete m[j]}}}}else{if(r2.test(i)){if(o){t[i]=o}else{delete t[i]}}else{t[i]=o}}}}_.filter(ch,function(o,i){return !(i==skey||i.indexOf(skey+"-")==0)});for(i in t){o=t[i];if(!check[i.charAt(0)]){if(!r1.test(i)){for(j in o){if(!check[j.charAt(0)]&&o[j]){k=skey+"-"+i;(ch[k]||(ch[k]={}))["on"+eventType[j]]=handler}}}else{if(r2.test(i)&&o){k=skey;(ch[k]||(ch[k]={}))["on"+eventType[i]]=handler}}}}}return self},getBehavior:function(){return this.$Behaviors},$applyCSS:function(){var self=linb.UI,cache=self.$cache_css;if(cache){if(!self.$cssNo){self.$cssNo=1}linb.CSS.addStyleSheet(cache,"linb.UI-CSS"+(self.$cssNo++));linb.UI.$cache_css=""}},buildCSSText:function(hash){var self=this,me=arguments.callee,r1=me._r1||(me._r1=/(^|\s|,)([0-9A-Z_]+)/g),h=[],r=[],browser=linb.browser,ie6=browser.ie6,ie=browser.ie,gek=browser.gek,ks=self.$cssKeys,t,v,o;for(var i in hash){o=hash[i];t=i.replace(r1,function(a,b,c){return b+"."+(ks[c]||c)}).toLowerCase();o.$order=parseInt(o.$order)||0;o.$=t;h[h.length]=o}h.sort(function(x,y){x=x.$order;y=y.$order;return x>y?1:x==y?0:-1});for(var i=0,l=h.length;i<l;){o=h[i++];r[r.length]=o.$+"{";if(t=o.$before){r[r.length]=t}if(t=o.$text){r[r.length]=t}for(var j in o){switch(j.charAt(0)){case"$":continue;break;case"_":if(!ie6){continue}break;case"*":if(!ie){continue}break;case"-":if(!gek){continue}break}if((v=o[j])||o[j]===0){switch(typeof v){case"string":case"number":r[r.length]=j+":"+v+";";break;case"function":r[r.length]=j+":"+v(self.KEY)+";";break;default:_.arr.each(v,function(k){if(k){r[r.length]=j+":"+k+";"}})}}}if(v=o.$after){r[r.length]=v}r[r.length]="}"}return r.join("")},_dropable:function(key){var self=this,h2=linb.Event.$eventhandler2,o=self.$Behaviors,v=key=="KEY"?o:(o[key]||(o[key]={})),handler=linb.$cache.UIKeyMapEvents,k2=key=="KEY"?self.KEY:(self.KEY+"-"+key),ch=handler[k2]||(handler[k2]={});_.merge(v,{beforeMouseover:function(profile,e,src){if(profile.properties.disabled||profile.properties.readonly){return }var ns=src,dd=linb.DragDrop,pp=dd.getProfile(),key=pp.dragKey,data=pp.dragData,item,box,t,args;if(!key||!data||!(new RegExp("\\b"+key+"\\b")).test(profile.box.getDropKeys(profile,ns))){return }box=profile.boxing();if(box.getItemByDom){item=box.getItemByDom(src)}args=[profile,e,ns,key,data,item];if((t=profile.onDropTest)&&(false===box.onDropTest.apply(box,args))){return }if((t=profile.box._onDropTest)&&(false===t.apply(profile.host||profile,args))){return }dd.setDropElement(src);if(profile.onDropMarkShow&&(false===box.onDropMarkShow.apply(box,args))){}else{if((t=profile.box._onDropMarkShow)&&(false===t.apply(profile.host||profile,args))){}else{_.resetRun("setDropFace",dd.setDropFace,0,[ns],dd)}}if(t=profile.box._onDragEnter){t.apply(profile.host||profile,args)}if(profile.onDragEnter){box.onDragEnter.apply(box,args)}},beforeMouseout:function(profile,e,src){if(profile.properties.disabled||profile.properties.readonly){return }var dd=linb.DragDrop,pp=dd.getProfile(),key=pp.dragKey,data=pp.dragData,item,box,args;if(pp.dropElement==src){box=profile.boxing();if(box.getItemByDom){item=box.getItemByDom(src)}args=[profile,e,src,key,data,item];if(profile.onDropMarkClear&&(false===box.onDropMarkClear.apply(box,args))){}else{if((t=profile.box._onDropMarkClear)&&(false===t.apply(profile.host||profile,args))){}else{_.resetRun("setDropFace",dd.setDropFace,0,[null],linb.DragDrop)}}if(t=profile.box._onDragLeave){t.apply(profile.host||profile,args)}if(profile.onDragLeave){box.onDragLeave.apply(box,args)}dd.setDropElement(null)}},beforeDrop:function(profile,e,src){var dd=linb.DragDrop,pp=dd.getProfile(),key=pp.dragKey,data=pp.dragData,item,t,args,box=profile.boxing();if(box.getItemByDom){item=box.getItemByDom(src)}args=[profile,e,src,key,data,item];if(profile.onDropMarkClear&&(false===box.onDropMarkClear.apply(box,args))){}else{if((t=profile.box._onDropMarkClear)&&(false===t.apply(profile.host||profile,args))){}}if(profile.onDrop&&(false===box.onDrop.apply(box,args))){}else{if((t=profile.box._onDrop)&&(false===t.apply(profile.host||profile,args))){}}}},"all");_.merge(ch,{onmouseover:h2,onmouseout:h2,ondrop:h2});return self},_dragable:function(key){var self=this,h2=linb.Event.$eventhandler2,o=self.$Behaviors,v=key=="KEY"?o:(o[key]||(o[key]={})),handler=linb.$cache.UIKeyMapEvents,k2=key=="KEY"?self.KEY:(self.KEY+"-"+key),ch=handler[k2]||(handler[k2]={});_.merge(v,{beforeMousedown:function(profile,e,src){if(profile.properties.disabled){return }if(!profile.properties.dragKey){return }var pos=linb.Event.getPos(e),box=profile.boxing(),args=[profile,e,src],t;if(profile.onStartDrag&&(false===box.onStartDrag.apply(box,args))){}else{if((t=profile.box._onStartDrag)&&(false===t.apply(profile.host||profile,args))){}else{var con=profile.box;linb.use(src).startDrag(e,{dragType:"icon",targetLeft:pos.left+12,targetTop:pos.top+12,dragCursor:"pointer",dragDefer:1,dragKey:con.getDragKey(profile,src),dragData:con.getDragData(profile,e,src)})}}},beforeDragbegin:function(profile,e,src){linb.use(src).onMouseout(true,{$force:true}).onMouseup(true)},beforeDragstop:function(profile,e,src){var t;if(profile.onDragStop){profile.boxing().onDragStop(profile.e,src)}if(t=profile.box._onDragStop){t.apply(profile.host||profile,arguments)}}},"all");_.merge(ch,{onmousedown:h2,ondragbegin:h2});return self},adjustData:function(profile,hashIn,hashOut){if(!hashOut){hashOut={}}var i,o,w=linb.wrapRes,me=arguments.callee,r=me._r||(me._r=/\B\$([\w]+[\.][\w\.]+[\w])/g);for(i in hashIn){if(i.charAt(0)=="$"){continue}if(hashIn.hasOwnProperty(i)&&!hashOut.hasOwnProperty(i)){hashOut[i]=typeof (o=hashIn[i])=="string"?(((o.indexOf("$")!=-1)?(o=o.replace(r,function(a,b){return w(b)})):o)&&((o.charAt(0)=="@")?(linb.SC.get(o.substr(1,o.length))||o):o)):o}}if("disabled" in hashOut){hashOut.disabled=hashOut.disabled?"ui-disabled":""}hashOut.imageDisplay=(hashOut.imageClass||hashOut.image)?"":"display:none";if(hashOut.image){hashOut.backgroundImage="background-image:url("+hashOut.image+");"}if(hashOut.imagePos){hashOut.backgroundPosition="background-position:"+hashOut.imagePos+";"}if((typeof (o=hashOut.renderer)=="function")||(typeof (o=hashIn.renderer)=="function")){hashOut.caption=o.call(profile,hashIn,hashOut)}return hashOut},cacheData:function(key,obj){_.set(linb.$cache,["UIDATA",key],obj);return this},getCachedData:function(key){var r=_.get(linb.$cache,["UIDATA",key]);if(typeof r=="function"){r=r()}return _.clone(r)},Behaviors:{onContextmenu:function(profile,e,src){return profile.boxing().onContextmenu(profile,e,src)!==false}},DataModel:{tag:"",tagVar:{ini:{}},disabled:{ini:false,action:function(v){this.getRoot().css("opacity",v?0.5:1)}},dock:{ini:"none",listbox:["none","top","bottom","left","right","center","middle","origin","width","height","fill","cover"],action:function(v){linb.UI.$dock(this,true,true)}},dockIgnore:{ini:false,action:function(v){var self=this;if(self.properties.dock!="none"){linb.UI.$dock(self,true,true)}}},dockOrder:{ini:1,action:function(v){var self=this;if(self.properties.dock!="none"){linb.UI.$dock(self,true,true)}}},dockMargin:{ini:{left:0,top:0,right:0,bottom:0},action:function(v){var self=this;if(self.properties.dock!="none"){linb.UI.$dock(self,true,true)}}},dockFloat:{ini:false,action:function(v){var self=this;if(self.properties.dock!="none"){linb.UI.$dock(self,true,true)}}},dockMinW:0,dockMinH:0,tips:""},EventHandlers:{onRender:function(profile){},onLayout:function(profile){},onResize:function(profile,width,height){},onMove:function(profile,left,top,right,bottom){},onDock:function(profile,region){},beforePropertyChanged:function(profile,name,value,ovalue){},afterPropertyChanged:function(profile,name,value,ovalue){},beforeAppend:function(profile,child){},afterAppend:function(profile,child){},beforeRemove:function(profile,child,subId,bdestroy){},afterRemove:function(profile,child,subId,bdestroy){},onDestroy:function(profile){},beforeDestroy:function(profile){},onShowTips:function(profile,node,pos){},onContextmenu:function(profile,e,node){}},RenderTrigger:function(){var self=this,b=self.boxing(),p=self.properties;if(self.box._onresize){var style=self.getRootNode().style,t;if((t=style.visibility)!="hidden"){self._$v=t;style.visibility="hidden"}linb.UI.$tryResize(self,p.width,p.height);style=null}if(p.disabled){b.setDisabled(true,true)}self.inValid=1},$doResize:function(profile,w,h,force,key){if(force||((w||h)&&(profile._resize_w!=w||profile._resize_h!=h))){if(!profile.getRootNode()){return false}profile._resize_w=w;profile._resize_h=h;_.tryF(profile.box._onresize,[profile,w,h,force,key],profile.box)}if(profile._$resizetimer){clearTimeout(profile._$resizetimer);delete profile._$resizetimer}},$tryResize:function(profile,w,h,force,key){var s=profile.box,t=s._onresize;if(t&&(force||w||h)){w=parseInt(w)||null;h=((h===""||h=="auto")?"auto":parseInt(h))||null;if("_$v" in profile){var args=profile.$rs_args;if(!args){args=profile.$rs_args=[profile,null,null];profile._$resizetimer=_.asyRun(function(){if(profile&&profile.$rs_args){if(false!==linb.UI.$doResize.apply(null,profile.$rs_args)){var style=profile.getRootNode().style;if(style.visibility!="visible"){style.visibility=profile._$v}delete profile.$rs_args;delete profile._$v;style=null}}})}args[1]=w;args[2]=h;args[3]=force;args[4]=key}else{linb.UI.$doResize(profile,w,h,force,key)}}},LayoutTrigger:function(){var self=this,b=self.boxing(),p=self.properties;if(p.dock&&p.dock!="none"){if(!self.$laidout){self.$laidout=1;var stl=self.getRootNode().style;switch(p.dock){case"top":case"bottom":case"width":stl.width=0;break;case"left":case"right":case"height":stl.height=0;break;default:stl.width=stl.height=0}}linb.UI.$dock(this,false,true)}},$dock_args:["top","bottom","left","right","center","middle","width","height"],$dock_map:{middle:1,center:1},$dock:function(profile,force,trigger){var prop=profile.properties,margin=prop.dockMargin,node=profile.getRoot(),value=prop.dock||"none",p=node.parent(),auto="auto",pid=linb.Event.getId(p.get(0)),order=function(x,y){x=parseInt(x.properties.dockOrder)||0;y=parseInt(y.properties.dockOrder)||0;return x>y?1:x==y?0:-1},region,inMatrix="$inMatrix",f,t,isWin,_adjust=function(v){return linb.browser.ie6?v-v%2:v};if(p.get(0)===document.body){pid="!document";isWin=true}if(pid&&(pid==linb.Dom._ghostDivId||_.str.startWith(pid,linb.Dom._emptyDivId))){return }if(profile.$dockParent!=pid||profile.$dockType!=value||force){profile.$dockParent=pid;profile.$dockType=value;profile.unLink("$dock");profile.unLink("$dock1");profile.unLink("$dock2");switch(value){case"middle":region={right:auto,bottom:auto,left:prop.left||"",width:prop.width||"",height:prop.height||""};break;case"center":region={right:auto,bottom:auto,top:prop.top||"",width:prop.width||"",height:prop.height||""};break;case"origin":region={right:auto,bottom:auto,width:prop.width||"",height:prop.height||""};break;case"top":region={left:margin.left,right:margin.right,bottom:auto,height:prop.height||""};break;case"bottom":region={left:margin.left,right:margin.right,top:auto,height:prop.height||""};break;case"left":region={right:auto,width:prop.width||""};break;case"right":region={left:auto,width:prop.width||""};break;case"width":region={bottom:auto,height:prop.height||"",top:prop.top||""};break;case"height":region={right:auto,width:prop.width||"",left:prop.left||""};break;case"fill":case"cover":region={right:auto,bottom:auto};break;case"none":region={left:prop.left,top:prop.top,width:prop.width||"",height:prop.height||""};break}node.cssRegion(region,true);if(isWin){p=linb.win;if(!linb.$cache._resizeTime){linb.$cache._resizeTime=1}}if(value!="none"){f=p.$getEvent("onSize","dock");if(!f){f=function(arg){var me=arguments.callee,map=linb.UI.$dock_map,arr=linb.UI.$dock_args,rePos=me.rePos,win=me.pid=="!window"||me.pid=="!document",node=win?linb.win:linb(me.pid),style=node.get(0).style,obj,i,k,o,key,target;if(arg.$dockid||!win||(_()-linb.$cache._resizeTime>100)){obj={left:0,top:0,right:0,bottom:0,width:parseInt(style&&style.width)||node.width(),height:parseInt(style&&style.height)||node.height()};for(k=0;key=arr[k++];){target=me[key];if(target.length){if(!map[key]){arg.width=arg.height=1}for(i=0;o=target[i++];){if(!o.properties.dockIgnore){rePos(o,obj,key,arg.$dockid,win||arg.width,win||arg.height)}}}}if(obj.later){_.each(obj.later,function(o){var profile;try{o.node.cssRegion(o,true);if((profile=linb.UIProfile.getFromDom(o.node.get(0)))&&profile.onDock){delete o.node;profile.boxing().onDock(profile,o)}}catch(e){_.asyRun(function(){o.width+=1;o.height+=1;o.node.cssRegion(o);o.width-=1;o.height-=1;o.node.cssRegion(o,true);if((profile=linb.UIProfile.getFromDom(o.node.get(0)))&&profile.onDock){delete o.node;profile.boxing().onDock(profile,o)}})}})}if(win){linb.$cache._resizeTime=_()}}me=node=style=null};f.pid=pid;_.arr.each(linb.UI.$dock_args,function(key){f[key]=[]});f.rePos=function(profile,obj,value,id,w,h){var flag=false;if(id&&profile.$linbid!=id){flag=true}var prop=profile.properties,flt=prop.dockFloat,margin=prop.dockMargin,node=profile.getRoot(),style=profile.getRootNode().style,left,top,right,bottom,temp,other,x=parseInt(prop._dockBorderWidth)||0,y=parseInt(prop._dockBorderHeight)||0,region={};switch(value){case"middle":node.top((obj.height-node.height())/2);break;case"center":node.left((obj.width-node.width())/2);break;case"top":if(!flag){left=margin.left;right=margin.right;top=(flt?0:obj.top)+margin.top;if(parseFloat(style.top)!=top){region.top=top}temp=obj.width-left-right-x;if(parseFloat(style.width)!=temp){region.width=_adjust(temp)}if(!_.isEmpty(region)){node.cssRegion(region,true)}}if(!flt){obj.top+=(node.offsetHeight()+margin.top+margin.bottom)}break;case"bottom":if(!flag){left=margin.left;right=margin.right;bottom=(flt?0:obj.bottom)+margin.bottom;if(parseFloat(style.bottom)!=bottom){region.bottom=bottom}temp=obj.width-left-right-x;if(parseFloat(style.width)!=temp){region.width=_adjust(temp)}if(!_.isEmpty(region)){node.cssRegion(region,true)}}if(!flt){obj.bottom+=(node.offsetHeight()+margin.top+margin.bottom)}break;case"left":if(!flag){left=(flt?0:obj.left)+margin.left;top=(flt?0:obj.top)+margin.top;bottom=(flt?0:obj.bottom)+margin.bottom;if(parseFloat(style.left)!=left){region.left=left}if(parseFloat(style.top)!=top){region.top=top}temp=obj.height-top-bottom-y;if(parseFloat(style.height)!=temp){region.height=_adjust(temp)}if(!_.isEmpty(region)){node.cssRegion(region,true)}}if(!flt){obj.left+=(node.offsetWidth()+margin.left+margin.right)}break;case"right":if(!flag){right=(flt?0:obj.right)+margin.right;top=(flt?0:obj.top)+margin.top;bottom=(flt?0:obj.bottom)+margin.bottom;if(parseFloat(style.right)!=right){region.right=right}if(parseFloat(style.top)!=top){region.top=top}temp=obj.height-top-bottom-y;if(parseFloat(style.height)!=temp){region.height=_adjust(temp)}if(!_.isEmpty(region)){node.cssRegion(region,true)}}if(!flt){obj.right+=(node.offsetWidth()+margin.left+margin.right)}break;case"width":if(!w){return }left=(prop.dock=="cover"?0:(flt?0:obj.left))+margin.left;right=(prop.dock=="cover"?0:(flt?0:obj.right))+margin.right;top=prop.dock=="width"?(parseInt(prop.top)||0):((prop.dock=="cover"?0:(flt?0:obj.top))+margin.top);temp=obj.width-left-right-x;obj.later=obj.later||{};obj.later[profile.$linbid]=obj.later[profile.$linbid]||{};_.merge(obj.later[profile.$linbid],{node:node,width:_adjust(prop.dockMinW?Math.max(prop.dockMinW,temp):temp),left:left,top:top},"all");break;case"height":if(!h){return }top=(prop.dock=="cover"?0:(flt?0:obj.top))+margin.top;bottom=(prop.dock=="cover"?0:(flt?0:obj.bottom))+margin.bottom;left=prop.dock=="height"?(parseInt(prop.left)||0):((prop.dock=="cover"?0:(flt?0:obj.left))+margin.left);temp=obj.height-top-bottom-y;obj.later=obj.later||{};obj.later[profile.$linbid]=obj.later[profile.$linbid]||{};_.merge(obj.later[profile.$linbid],{node:node,height:_adjust(prop.dockMinH?Math.max(prop.dockMinH,temp):temp),left:left,top:top},"all");break}};p.onSize(f,"dock")}if(value=="fill"||value=="cover"){profile.link(f.height,"$dock1");profile.link(f.width,"$dock2");f.height.sort(order);f.width.sort(order)}else{if(value=="origin"){profile.link(f.center,"$dock1");profile.link(f.middle,"$dock2")}else{profile.link(f[value],"$dock");f[value].sort(order)}}linb.$cache._resizeTime=1;profile.$dockFun=f;if(isWin){linb("html").addClass("linb-html");if(t=linb("body").get(0)){t.scroll="no"}}}}if(value!="none"&&trigger){profile.$dockFun({width:1,height:1,$dockid:_.arr.indexOf(["width","height","fill","cover"],value)!=-1?profile.$linbid:null,$type:value})}},_beforeSerialized:function(profile){var r=profile.boxing(),b,t,o={};_.merge(o,profile,"all");var p=o.properties=_.copy(profile.properties);switch(p.dock){case"top":case"bottom":delete p.width;delete p.left;delete p.top;delete p.right;delete p.bottom;break;case"left":case"right":delete p.height;delete p.left;delete p.top;delete p.right;delete p.bottom;break;case"width":delete p.width;delete p.left;delete p.right;break;case"height":delete p.height;delete p.top;delete p.bottom;break;case"fill":case"cover":delete p.width;delete p.height;delete p.left;delete p.top;delete p.right;delete p.bottom;break}for(var i in linb.UI.$ps){if((i in p)&&typeof p[i]!="number"&&p[i]!=""&&p[i]!="auto"){p[i]=isNaN(p[i]=parseFloat(p[i]))?"auto":p[i]}}if(p.items&&p.items.length){t=linb.absObj.$specialChars;p.items=_.clone(p.items,function(o,i){return !t[(i+"").charAt(0)]&&o!=undefined})}if(_.isEmpty(p.tagVar)){delete p.tagVar}if((t=p.dockMargin)&&!t.left&&!t.top&&!t.right&&!t.bottom){delete p.dockMargin}if(p.items&&(p.items.length==0||p.listKey)){delete p.items}return o},getDropKeys:function(profile,node){return profile.properties.dropKeys},getDragKey:function(profile,node){return profile.properties.dragKey},getDragData:function(profile,event,node){return{profile:profile,domId:linb.use(node).id(),data:profile.onGetDragData?profile.boxing().onGetDragData(profile,event,node):null}},_prepareData:function(profile,data){var prop=profile.properties,dm=this.$DataModel,me=arguments.callee,map=me.map||(me.map=_.toArr("left,top,bottom,right,width,height")),a=[],ajd=linb.UI.adjustData,t;data=data||{};if(prop.id){delete prop.id}if("caption" in dm&&prop.caption!==null){prop.caption=prop.caption===undefined?profile.alias:prop.caption}if("$hborder" in dm){data.bWidth=prop.width-(prop.$hborder||0)*2}if("$vborder" in dm){data.bHeight=prop.height-(prop.$vborder||0)*2}for(var j=0,i;i=map[j];j++){if(prop[i]||prop[i]===0){if(String(parseFloat(prop[i]))==String(prop[i])){a[a.length]=i+":"+(parseInt(prop[i])||0)+"px"}else{if(prop[i]!="auto"&&prop[i]){a[a.length]=i+":"+prop[i]}}}}if(prop.position){a[a.length]="position:"+prop.position}if(prop.visibility){a[a.length]="visibility:"+prop.visibility}if(prop.zIndex){a[a.length]="z-index:"+prop.zIndex}if(prop.display){a[a.length]="display:"+(prop.display=="inline-block"?linb.browser.gek?"-moz-inline-block;display:-moz-inline-box;display:inline-block;":"inline-block":prop.display)}data._style=";"+a.join(";")+";";if("href" in dm){data.href=prop.href||linb.$href}if("tabindex" in dm){data.tabindex=prop.tabindex||"-1"}if("items" in dm){profile.ItemIdMapSubSerialId={};profile.SubSerialIdMapItem={};prop.items=profile.box._adjustItems(prop.items);data.items=this._prepareItems(profile,prop.items)}data=ajd(profile,prop,data);profile.prepared=true;return data},_prepareItems:function(profile,items,pid,mapCache,serialId){var result=[],item,dataItem,t,SubID=linb.UI.$tag_subId,id,tabindex=profile.properties.tabindex,ajd=linb.UI.adjustData;for(var i=0,l=items.length;i<l;i++){if(typeof items[i]!="object"){items[i]={id:items[i]}}item=items[i];if(!item.hasOwnProperty("caption")){item.caption=item.id}dataItem={id:item.id};if(pid){dataItem._pid=pid}id=dataItem[SubID]=typeof serialId=="string"?serialId:profile.pickSubId("items");if(false!==mapCache){profile.ItemIdMapSubSerialId[item.id]=id;profile.SubSerialIdMapItem[id]=item}if(t=item.object){t=dataItem.object=t["linb.absBox"]?t.get(0):t;if(t["linb.UIProfile"]){t.properties.position="relative"}item.$linbid=t.$linbid;t.$item=item;t.$holder=profile;if(!profile.$attached){profile.$attached=[]}profile.$attached.push(t)}else{dataItem._tabindex=tabindex;ajd(profile,item,dataItem);if(this._prepareItem){this._prepareItem(profile,dataItem,item,pid,mapCache,serialId)}}result.push(dataItem)}return result},_showTips:function(profile,node,pos){if(profile.onShowTips){return profile.boxing().onShowTips(profile,node,pos)}}}});Class("linb.absList","linb.absObj",{Instance:{activate:function(){var profile=this.get(0),items=profile.getSubNode("ITEM",true);if(!items.isEmpty()){items.focus()}return this},insertItems:function(arr,base,before){var node,arr2,items,index,r,data,box,b=this._afterInsertItems;return this.each(function(profile){box=profile.box;arr2=box._adjustItems(arr);items=profile.properties.items;index=_.arr.subIndexOf(items,"id",base);if(profile.renderId){data=box._prepareItems(profile,arr2,base);r=profile._buildItems("items",data);if(index==-1){node=profile.getSubNode(box._ITEMSKEY||profile.keys.ITEMS||profile.keys.KEY);if(before){node.prepend(r)}else{node.append(r)}}else{node=profile.getSubNodeByItemId(box._ITEMKEY||"ITEM",base);if(before){node.addPrev(r)}else{node.addNext(r)}}}if(index==-1){items.push.apply(items,arr2)}else{_.arr.insertAny(items,arr2,before?index:index+1)}if(b){profile.boxing()._afterInsertItems(profile,data,base,before)}})},removeItems:function(arr,key){if(!(arr instanceof Array)){arr=[arr]}var obj,v,b=this._afterRemoveItems;remove=function(profile,arr,target,ns,force){var self=arguments.callee;if(!ns){ns=linb()}_.filter(arr,function(o){var serialId,b;if(force||(b=(_.arr.indexOf(target,o.id)!=-1))){if(profile.renderId){if(serialId=profile.ItemIdMapSubSerialId[o.id]){delete profile.SubSerialIdMapItem[serialId];delete profile.ItemIdMapSubSerialId[o.id];profile.reclaimSubId(serialId,"items");if(!force){if(!(obj=profile.getSubNode(profile.keys[key]?key:(profile.box._ITEMKEY||"ITEM"),serialId)).isEmpty()){ns.merge(obj)}if(o.$linbid){ns.get().push(linb.getObject(o.$linbid).getRootNode())}}}}}if(o.sub){self(profile,o.sub,target,ns,force||b)}if(b){for(var i in o){o[i]=null}return false}});ns.remove()};return this.each(function(profile){var p=profile.properties;remove(profile,p.items,arr);if(v=p.$UIvalue){if((v=v.split(";")).length>1){_.filter(v,function(o){return _.arr.indexOf(arr,o)==-1});p.$UIvalue=v.join(";")}else{if(_.arr.indexOf(arr,p.$UIvalue)!=-1){p.$UIvalue=null}}}if(b&&profile.renderId){profile.boxing()._afterRemoveItems(profile,arr)}})},clearItems:function(key){return this.each(function(profile){if(!profile.SubSerialIdMapItem){return }profile.getSubNode(profile.keys[profile.box._ITEMKEY||"ITEM"],true).remove();_.each(profile.SubSerialIdMapItem,function(o,serialId){profile.reclaimSubId(serialId,"items")});profile.properties.items.length=0;profile.SubSerialIdMapItem={};profile.ItemIdMapSubSerialId={}})},updateItem:function(subId,options){var self=this,profile=self.get(0),box=profile.box,items=profile.properties.items,rst=profile.queryItems(items,function(o){return typeof o=="object"?o.id===subId:o==subId},true,true,true),item,serialId,node,sub,t;if(typeof options!="object"){options={caption:options+""}}delete options.id;if(rst.length){rst=rst[0];if(typeof rst[0]!="object"){item=rst[2][rst[1]]={id:rst[0]}}else{item=rst[0]}_.merge(item,options,"all");serialId=_.get(profile,["ItemIdMapSubSerialId",subId]);arr=box._prepareItems(profile,[item],item._pid,false,serialId);node=profile.getSubNodeByItemId("ITEM",subId);if(!node.isEmpty()){if(options.sub){delete item._created;delete item._checked}else{if(item.sub){sub=profile.getSubNodeByItemId("SUB",subId)}}node.replace(profile._buildItems(arguments[2]||"items",arr),false);if(sub&&!sub.isEmpty()){if(!(t=profile.getSubNodeByItemId("SUB",subId)).isEmpty()){t.replace(sub)}}}}return self},getItems:function(type){var v=this.get(0).properties.items;if(type=="data"){return _.clone(v,true)}else{if(type=="min"){var a=_.clone(v,true),b;_.arr.each(a,function(o,i){a[i]=o.id});return a}else{return v}}},fireItemClickEvent:function(subId){this.getSubNodeByItemId("ITEM",subId).onClick();return this}},Initialize:function(){var o=this.prototype;_.arr.each(_.toArr("getItemByItemId,getItemByDom,getSubIdByItemId,getSubNodeByItemId"),function(s){o[s]=function(){var t=this.get(0);return t[s].apply(t,arguments)};Class._fun(o[s],s,o.KEY)})},Static:{$abstract:true,DataModel:{listKey:{set:function(value){var o=this,t=o.box.getCachedData(value);if(t){o.boxing().setItems(t)}else{o.boxing().setItems(o.properties.items)}o.properties.listKey=value}},items:{ini:[],set:function(value){var o=this;if(o.renderId){o.boxing().clearItems().insertItems(value)}else{o.properties.items=_.copy(value)}}}},RenderTrigger:function(){this.destroyTrigger=function(){_.each(this.SubSerialIdMapItem,function(o){_.breakO(o)});this.properties.items.length=0}},_adjustItems:function(arr){if(!arr){arr=[_()+""]}if(_.isStr(arr)){arr=[arr]}var a=_.copy(arr),m;_.arr.each(a,function(o,i){if(typeof o!="object"){a[i]={id:o+""}}else{a[i]=_.copy(o);a[i].id=a[i].id?(a[i].id+""):_.id()}});return a},_showTips:function(profile,node,pos){if(profile.onShowTips){return profile.boxing().onShowTips(profile,node,pos)}if(!linb.Tips){return }var t=profile.properties,id=node.id,sid=profile.getSubId(id),map=profile.SubSerialIdMapItem,item=map&&map[sid];if(t.disabled){return }if(item&&item.disabled){return }if(item&&item.tips){linb.Tips.show(pos,item);return true}else{return false}}}});Class("linb.absValue","linb.absObj",{Instance:{_getCtrlValue:function(){return this.get(0).properties.$UIvalue},_setCtrlValue:function(value){return this},_setDirtyMark:function(){return this},getValue:function(){return this.get(0).properties.value},getUIValue:function(){return this.get(0).properties.$UIvalue=this._getCtrlValue()},resetValue:function(value){var self=this;self.each(function(profile){var r;if(typeof (r=profile.box._ensureValue)=="function"){value=r.call(profile.box,profile,value)}profile.boxing()._setCtrlValue(profile.properties.$UIvalue=profile.properties.value=value);if(typeof (r=profile.$onValueSet)=="function"){r.call(profile,value)}profile.inValid=1});self._setDirtyMark();return self},setUIValue:function(value,force){var self=this;this.each(function(profile){var prop=profile.properties,r,ovalue=prop.$UIvalue,box=profile.boxing();if(ovalue!==value||force){if(false===profile.box._checkValid(profile,value)||(profile.beforeUIValueSet&&false===(r=box.beforeUIValueSet(profile,ovalue,value)))){return }if(r!==undefined){value=r}if(typeof (r=profile.box._ensureValue)=="function"){value=r.call(profile.box,profile,value)}if(typeof (r=profile.$onValueUpdated)=="function"){r.call(profile,value)}if(profile.renderId){box._setCtrlValue(value)}prop.$UIvalue=value;if(profile.renderId){box._setDirtyMark()}if(profile.afterUIValueSet){box.afterUIValueSet(profile,ovalue,value)}}});return this},updateValue:function(){this.each(function(profile){var prop=profile.properties,ins=profile.boxing();if(ins.checkValid()){prop.value=ins.getUIValue()}});return this._setDirtyMark()},isDirtied:function(){var p=this.get(0).properties;return p.value!==p.$UIvalue},checkValid:function(){var r=true;this.each(function(profile){var prop=profile.properties;r=profile.box._checkValid(profile,prop.$UIvalue)&&r;if(profile.renderId){profile.boxing()._setDirtyMark()}});return r}},Static:{$abstract:true,DataModel:{dataBinder:{combobox:function(){return _.toArr(linb.DataBinder._pool,true)},set:function(value,ovalue){var profile=this,p=profile.properties;if(ovalue){linb.DataBinder._unBind(ovalue,profile)}p.dataBinder=value;linb.DataBinder._bind(value,profile)}},dataField:"",value:{ini:null,set:function(value){var profile=this,p=profile.properties,r,ovalue=p.value,box=profile.boxing(),nv=value;if(profile.box._checkValid(profile,nv)===false){return }if(profile.beforeValueSet&&false===(r=box.beforeValueSet(profile,ovalue,nv))){return }if(r!==undefined){nv=r}if(typeof (r=profile.box._ensureValue)=="function"){nv=r.call(profile.box,profile,nv)}if(typeof (r=profile.$onValueSet)=="function"){r.call(profile,nv)}if(profile.renderId){box._setCtrlValue(nv)}p.value=p.$UIvalue=nv;profile.inValid=1;if(profile.renderId){box._setDirtyMark()}if(profile.afterValueSet){box.afterValueSet(profile,ovalue,nv)}}},dirtyMark:true},EventHandlers:{beforeValueSet:function(profile,oldValue,newValue){},afterValueSet:function(profile,oldValue,newValue){},beforeUIValueSet:function(profile,oldValue,newValue){},afterUIValueSet:function(profile,oldValue,newValue){},beforeDirtyMark:function(profile,dirty){}},RenderTrigger:function(){var self=this,b=self.boxing(),p=self.properties,t,value;p.$UIvalue=p.value;if(p.value!==undefined){value=p.value;if(typeof (t=self.box._ensureValue)=="function"){value=t.call(self.box,self,value)}b._setCtrlValue(value)}if(t=p.dataBinder){b.setDataBinder(t,true)}if(t=p.dataField){b.setDataField(t)}},_checkValid:function(profile,value){return true}}});new function(){var u="linb.UI";Class(u+".Widget",u,{Static:{Appearances:{KEY:{"font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null}},Templates:{className:"uiw-shell ",style:"{_style}",FRAME:{className:"uiw-frame ",BORDER:{style:"width:{bWidth}px;height:{bHeight}px;",className:"uiw-border"}}},Behaviors:{KeyHook:true,onSize:linb.UI.$onSize},DataModel:{width:100,height:100,$hborder:0,$vborder:0},RenderTrigger:function(){var self=this,p=self.properties,o=self.boxing();if(self.renderId){if((!self.$noB)&&p.border&&o._border){o._border()}}if((!self.$noR)&&p.resizer&&o.setResizer){o.setResizer(p.resizer,true)}if((!self.$noS)&&p.shadow&&o._shadow){o._shadow()}},_onresize:function(profile,width,height){var t=profile.properties,o=profile.getSubNode("BORDER"),region,ww=width,hh=height,left=Math.max(0,(t.$b_lw||0)-(t.$hborder||0)),top=Math.max(0,(t.$b_tw||0)-(t.$vborder||0));if(ww&&"auto"!==ww){ww-=Math.max((t.$hborder||0)*2,(t.$b_lw||0)+(t.$b_rw||0));if(linb.browser.ie6){ww=(parseInt(ww/2))*2}}if(hh&&"auto"!==hh){hh-=Math.max((t.$vborder||0)*2,(t.$b_lw||0)+(t.$b_rw||0));if(linb.browser.ie6){hh=(parseInt(hh/2))*2}if(linb.browser.ie6&&null===width){o.ieRemedy()}}region={left:left,top:top,width:ww,height:hh};o.cssRegion(region);if((profile.$border||profile.$shadow||profile.$resizer)&&linb.browser.ie){o.ieRemedy()}return region}}});Class(u+".Link",u,{Static:{Appearances:{KEY:{"font-size":linb.browser.ie?"12px":null,"line-height":linb.browser.ie?"14px":null}},Templates:{tagName:"a",style:"{_style}",href:"{href}",target:"{target}",tabindex:"{tabindex}",text:"{caption}"},Behaviors:{onClick:function(profile,e,src){var r;if(!profile.properties.disabled&&profile.onClick){r=profile.boxing().onClick(profile,e,src)}var href=linb.use(src).attr("href");return typeof r=="boolean"?r:(href.indexOf("javascript:")===0||href.indexOf("#")===0)?false:true}},DataModel:{caption:{ini:undefined,action:function(v){this.getRoot().html(v)}},href:{ini:linb.$href,action:function(v){this.getRoot().attr("href",v)}},target:{action:function(v){this.getRoot().attr("target",v)}}},EventHandlers:{onClick:function(profile,e){}}}});Class(u+".SLabel",u,{Static:{Templates:{style:"{_style}text-align:{hAlign}",text:"{caption}"},Appearances:{KEY:{"padding-right":"6px"}},DataModel:{tabindex:null,caption:{ini:undefined,action:function(value){this.getRoot().html(value)}},hAlign:{ini:"right",listbox:["left","center","right"],action:function(v){this.getRoot().css("textAlign",v)}}}}});Class(u+".SButton",u,{Instance:{activate:function(){this.getSubNode("FOCUS").focus();return this}},Static:{Templates:{className:"{_clsName}",style:"{_style}",BTN:{className:"ui-btn",BTNI:{className:"ui-btni",BTNC:{className:"ui-btnc",FOCUS:{tagName:"a",tabindex:"{tabindex}",href:linb.$href,style:"{_align}",text:"{caption}"}}}}},Appearances:{BTN:{overflow:"hidden"},"KEY-auto BTN, KEY-auto BTNI, KEY-auto BTNC, KEY-auto FOCUS":{$order:1,display:linb.$inlineBlock},"BTN,BTNI,BTNC":{display:"block"},"KEY FOCUS":{cursor:"default","font-size":"12px","line-height":"14px","text-align":"center",display:"block"}},Behaviors:{HoverEffected:{BTN:["BTN"]},ClickEffected:{BTN:["BTN"]},NavKeys:{FOCUS:1},onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return false}profile.getSubNode("FOCUS").focus();if(profile.onClick){profile.boxing().onClick(profile,e,src)}}},DataModel:{caption:{ini:undefined,action:function(value){this.getSubNode("FOCUS").html(value)}},hAlign:{ini:"center",listbox:["left","center","right"],action:function(v){this.getSubNode("FOCUS").css("textAlign",v)}},width:{ini:"auto",action:function(value){if(value=="auto"){this.getRoot().width("auto").tagClass("-auto")}else{this.getRoot().width(value).tagClass("-auto",false)}}},height:{readonly:true}},EventHandlers:{onClick:function(profile,e,src,value){}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data._align="text-align:"+data.hAlign+";";data._clsName=parseInt(data.width)?"":profile.getClass("KEY","-auto");return data}}});Class(u+".SCheckBox",[u,"linb.absValue"],{Instance:{activate:function(){this.getSubNode("FOCUS").focus();return this},_setCtrlValue:function(value){return this.each(function(profile){profile.getSubNode("MARK").tagClass("-checked",!!value)})},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }if(!profile.renderId){return }var properties=profile.properties,o=profile.getSubNode("CAPTION"),flag=properties.value!==properties.$UIvalue,d=linb.UI.$css_tag_dirty;if(o.beforeDirtyMark&&false===o.boxing().beforeDirtyMark(profile,flag)){return }if(flag){o.addClass(d)}else{o.removeClass(d)}})}},Static:{Templates:{className:"{_clsName}",style:"{_style}",FOCUS:{tagName:"a",tabindex:"{tabindex}",href:linb.$href,MARK:{className:"uicmd-check"},CAPTION:{$order:1,text:"{caption}"}}},Appearances:{KEY:{overflow:"visible"},FOCUS:{cursor:"default","vertical-align":"middle",padding:"2px 0","font-size":"12px","line-height":"14px"},CAPTION:{"vertical-align":"middle"}},Behaviors:{HoverEffected:{KEY:"MARK"},ClickEffected:{KEY:"MARK"},NavKeys:{FOCUS:1},onClick:function(profile,e,src){var p=profile.properties,b=profile.boxing();if(p.disabled){return false}b.setUIValue(!p.$UIvalue);if(profile.onChecked){b.onChecked(profile,e,p.$UIvalue)}profile.getSubNode("FOCUS").focus()},FOCUS:{onKeydown:function(profile,e,src){var key=linb.Event.getKey(e)[0];if(key==" "||key=="enter"){profile.getRoot().onClick(true);return false}}}},DataModel:{value:false,caption:{ini:undefined,action:function(value){this.getSubNode("CAPTION").html(value)}}},EventHandlers:{onChecked:function(profile,e,value){}},_ensureValue:function(profile,value){return !!value}}});Class(u+".Div",u,{Static:{Appearances:{KEY:{outline:linb.browser.gek?"none":null,zoom:linb.browser.ie6?"1":null,background:linb.browser.ie?"url("+linb.ini.file_bg+") no-repeat left top":null}},Templates:{tagName:"div",style:"{_style}",tabindex:"-1",text:"{html}"+linb.UI.$childTag},DataModel:{disabled:null,width:"100",height:"100",html:{action:function(v){this.getRoot().html(v)}}}}});Class(u+".Tag",u+".Div",{Static:{Templates:{tagName:"div",style:"overflow:auto;border:dashed blue 1px;text-align:center;background:#EBEADB;{_style}",text:"{tagKey}"+linb.UI.$childTag},DataModel:{html:null,tagKey:{action:function(v){this.getRoot().html(v)}}},_l:_.toArr("left,top,bottom,right,width,height,zIndex,tabindex,position,dock,dockFloat,dockMinW,dockMinH,dockOrder,dockMargin"),replace:function(tagProfile,profile,com){_.arr.each(this._l,function(s){if(s in tagProfile.properties){profile.properties[s]=tagProfile.properties[s]}});_.merge(profile.CS,tagProfile.CS,"all");_.merge(profile.CC,tagProfile.CC,"all");if(tagProfile.parent){var clink=tagProfile.parent.children,linkObj=clink["$"+tagProfile.$linbid],index=_.arr.indexOf(clink,linkObj);tagProfile.parent.boxing().append(profile,linkObj[1]);clink[index]=clink.pop();tagProfile.unLink("$parent");delete tagProfile.parent}else{if(com){_.arr.each(com._nodes,function(o,i){if(o===tagProfile){com._nodes[i]=profile;return false}})}}if(tagProfile.renderId){profile.boxing().renderOnto(tagProfile.getRootNode())}}}});Class(u+".Pane",u+".Div",{Static:{Behaviors:{DropableKeys:["KEY"]}}})};Class("linb.Coder",null,{Initialize:function(){linb.CSS.addStyleSheet('.sh {font-family: "Courier New" , Courier, mono;font-size: 12px;border: 1px solid #92D1E4;background:#fff;}.sh .sh-con{padding-bottom:3px;background-color: #fff;}.sh .sh-cmd{padding: 3px 8px 3px 8px;font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;color: silver;border-bottom: 1px solid #EBEADB;}.sh .sh-cmd a{font-size: 12px;color: blue;text-decoration: none;margin-right: 10px;}.sh .sh-cmd a:hover{color: red;}.sh .cmd-ruler{width:25px;}.sh .sh-toggle{width:16px;cursor:pointer;font-size:14px;color:blue;vertical-align:baseline;}.sh ol{color: #FF97A9; margin: 0px 0px 0px 45px; padding: 0; border-bottom: 1px solid #EBEADB; }.sh ol li{color: #000157;border-left: 3px solid #6CE26C;padding-left: 10px;line-height: 14px;list-style: decimal none;margin:0;border-bottom: 1px dashed #E2E2E2;}.sh-con span{vertical-align:inherit;'+(linb.browser.ie?"zoom:0;":"")+"}.sh .js .comment, .sh .php .comment{ color: green; }.sh .js .string, .sh .php .string{ color: #ff1493; }.sh .js .reg, .sh .php .reg{ color: #ff1493; }.sh .js .number,.sh .php .number { color: darkred; }.sh .js .keyword, .sh .php .keyword{ color: blue; }.sh .js .keyword2, .sh .php .keyword2 { font-weight: bold; color: red; }.sh .js .special, .sh .php .special{ font-weight: bold; color: navy; }.sh .php .vars{color:#079BFA}.sh .css .comment { color: green; }.sh .css .string { color: red; }.sh .css .colors { color: darkred; }.sh .css .vars { color: #d00; }.sh .css .number { color: blue; }.sh .css .keyword {color:teal;}.sh .css .selector {font-weight: bold; color: navy;}.sh .html .comment { color: green; }.sh .html .string{ color: #ff1493; }.sh .html .script{ color: #ff1493; }.sh .html .attr { color: blue; }.sh .html .speical{color:#079BFA}.sh .html .tag { font-weight: bold; color: navy; }",this.KEY);this._profiles={js:{multicomment:this.$COM_REG.BLOCK_COMMENT,comment:this.$COM_REG.LINE_COMMENT,reg:this.$COM_REG.REG,string1:this.$COM_REG.DQ_STRING,string2:this.$COM_REG.SQ_STRING,number:this.$COM_REG.NUMBER,keyword:"try|throw|catch|finally|arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with|toString|valueOf|window|prototype|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity|Error",keyword2:"exists|isNull|isObj|isEmpty|isArr|isBool|isDate|isFun|isHash|isNumb|isStr|_.arr|_.bool|_.cls|_.date|_.fun|_.hash|_.numb|_.str|_.id|_|alias|host|append|toArr|breakO|tryF|each|copy|clone|filter|asyRun|resetRun|merge|each|swap|removeFrom|filter|indexOf|clean|insertAny|serialize|unserialize|Class|Instance|Initialize|Before|After|Static|Constructor|reBoxing|copy|clone|left|top|right|bottom|startWith|endWith|initial|trim|ltrim|rtrim|blen|toDom|create",special:/linb[\w\.]*|(\bon|before|after|set|get)[A-Z]\w*/},css:{multicomment:this.$COM_REG.BLOCK_COMMENT,string:[this.$COM_REG.DQ_STRING,this.$COM_REG.SQ_STRING],IGNORE:/\([^'")]*\)/,keyword:[/@\w[\w.\s]*/,/attr|rect|rgb|url/],selector:/[\w-:\[.#][^{};]*\{/,colors:/\#[a-zA-Z0-9]{3,6}/,number:[/(\d*\.?\d+|\d+\.?\d*)(cm|em|ex|pt|px|%|\:)?/],vars:[/(-[\w-]+)\s*[ ]*:/,/([\w-]+)\s*[ ]*:/]},php:{multicomment:this.$COM_REG.BLOCK_COMMENT,comment:this.$COM_REG.LINE_COMMENT,reg:this.$COM_REG.REG,string:[this.$COM_REG.DQ_STRING,this.$COM_REG.SQ_STRING],number:this.$COM_REG.NUMBER,keyword:"abs|acos|acosh|addcslashes|addslashes|array_change_key_case|array_chunk|array_combine|array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_filter|array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|array_reduce|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|array_values|array_walk|array_walk_recursive|atan|atan2|atanh|base64_decode|base64_encode|base_convert|basename|bcadd|bccomp|bcdiv|bcmod|bcmul|bindec|bindtextdomain|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|ceil|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_exists|closedir|closelog|copy|cos|cosh|count|count_chars|date|decbin|dechex|decoct|deg2rad|delete|ebcdic2ascii|echo|empty|end|ereg|ereg_replace|eregi|eregi_replace|error_log|error_reporting|escapeshellarg|escapeshellcmd|eval|exec|exit|exp|explode|extension_loaded|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filesize|filetype|floatval|flock|floor|flush|fmod|fnmatch|fopen|fpassthru|fprintf|fputcsv|fputs|fread|fscanf|fseek|fsockopen|fstat|ftell|ftok|getallheaders|getcwd|getdate|getenv|gethostbyaddr|gethostbyname|gethostbynamel|getimagesize|getlastmod|getmxrr|getmygid|getmyinode|getmypid|getmyuid|getopt|getprotobyname|getprotobynumber|getrandmax|getrusage|getservbyname|getservbyport|gettext|gettimeofday|gettype|glob|gmdate|gmmktime|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|interface_exists|intval|ip2long|is_a|is_array|is_bool|is_callable|is_dir|is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|mkdir|mktime|nl2br|parse_ini_file|parse_str|parse_url|passthru|pathinfo|readlink|realpath|rewind|rewinddir|rmdir|round|str_ireplace|str_pad|str_repeat|str_replace|str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|strftime|strip_tags|stripcslashes|stripos|stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpbrk|strpos|strptime|strrchr|strrev|strripos|strrpos|strspn|strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare",keyword2:"and|or|xor|__FILE__|__LINE__|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|old_function|return|static|switch|use|require|require_once|var|while|__FUNCTION__|__CLASS__|__METHOD__|abstract|interface|public|implements|extends|private|protected|throw",vars:/\$\w+/},html:{multicomment:this.$COM_REG.HTML_COMMENT,tag:/\x02\/?\w+/,attr:/\w+=/,script:/(>([^<][^\/]*<+)*\/)(script|style)>/,special:/<!DOCTYPE[^>]+>/,string:[this.$COM_REG.DQ_STRING,this.$COM_REG.SQ_STRING]}}},Static:{$COM_REG:{HTML_COMMENT:/<!\s*(--([^-]|[\r\n]|-[^-])*--\s*)>/,BLOCK_COMMENT:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//,LINE_COMMENT:/\/\/[^\n]*/,REG:/\/(\\[\/\\]|[^*\/])(\\.|[^\/\n\\])*\/[gim]*/,DQ_STRING:/"(\\.|[^"\\])*"/,SQ_STRING:/'(\\.|[^'\\])*'/,NUMBER:/-?(\d*\.?\d+|\d+\.?\d*)([eE][+-]?\d+|%)?\b/},replace:function(str,reg,replace,ignore_case){var i,len,_t,m,n,flag,a1=[],a2=[],me=arguments.callee,reg1=me.reg1||(me.reg1=/\\./g),reg2=me.reg2||(me.reg2=/\(/g),reg3=me.reg3||(me.reg3=/\$\d/),reg4=me.reg4||(me.reg4=/^\$\d+$/),reg5=me.reg5||(me.reg5=/'/),reg6=me.reg6||(me.reg6=/\\./g),reg11=me.reg11||(me.reg11=/(['"])\1\+(.*)\+\1\1$/);if(!_.isArr(reg)){reg=[reg,replace]}else{ignore_case=replace}if(!_.isArr(reg[0])){reg=[reg]}_.arr.each(reg,function(o){m=typeof o[0]=="string"?o[0]:o[0].source;n=o[1]||"";len=((m).replace(reg1,"").match(reg2)||"").length;if(typeof n!="function"){if(reg3.test(n)){if(reg4.test(n)){_t=parseInt(n.slice(1));if(_t<=len){n=_t}}else{flag=reg5.test(n.replace(reg6,""))?'"':"'";i=len;while(i+1){n=n.split("$"+i).join(flag+"+a[o+"+i--+"]+"+flag)}n=new Function("a,o","return"+flag+n.replace(reg11,"$1")+flag)}}}a1.push(m||"^$");a2.push([n,len,typeof n])});return str.replace(new RegExp("("+a1.join(")|(")+")",ignore_case?"gim":"gm"),function(){var i=1,j=0,args=arguments,p,t;if(!args[0]){return""}while(p=a2[j++]){if(t=args[i]){switch(p[2]){case"function":return p[0](args,i,j-1);case"number":return args[p[0]+i];default:return p[0]}}else{i+=p[1]+1}}})},formatText:function(code,type,reverse){var reg,pre_arr,add_arr,arr=[];var deep=0,i,l=20,sf=function(i){var r="";while(i--){r+=" "}return r},space=[""];for(i=1;i<l;i++){space.push(sf(i*4))}code=code.replace(/(\r\n|\r)/g,"\n");if(type=="html"){arr.push([/[\s]*(<[\w]+[^>]+>)[\s]*/,"$1"]);arr.push([/[\s]*(<\/[\w]+>)[\s]*/,"$1"]);code=this.replace(code,arr);arr.length=0;arr.push([this.$COM_REG.HTML_COMMENT,"$0\\n"]);arr.push([/<!\[CDATA\[(([^\]])|(\][^\]])|(\]\][^>]))*\]\]>/,function(a,i){return space[deep]+a[i]+"\n"}]);arr.push([/<input[^>]+>/,function(a,i){return space[deep]+a[i]+"\n"}]);arr.push([/<img[^>]+>/,function(a,i){return space[deep]+a[i]+"\n"}]);arr.push([/<[\w]+[^>]*\/>/,function(a,i){return space[deep]+a[i]+"\n"}]);arr.push([/[^<]+/,function(a,i){return space[deep]+a[i]+"\n"}]);arr.push([/<[\w]+[^>]*>/,function(a,i){return space[deep++]+a[i]+"\n"}]);arr.push([/<\/[\w]+>/,function(a,i){return space[--deep]+a[i]+"\n"}]);code=this.replace(code,arr,true)}else{var arr=[],index1=1,index2=1,index3=1,index4=1,index5=1,index6=1,index7=1,cache={a:{},b:{},c:{},d:{},e:{},f:{},g:{}};reg=this.$COM_REG;code=code.replace(/\\\r?\n/g,"");code=code.replace(/([\x01\x02\x03\x04])/g,"$1-");code=linb.Coder.replace(code,[[reg.BLOCK_COMMENT.source,reverse?"":function(s,i){var ret="\x01d"+index4+++"\x02";cache.d[ret]=s[i];return ret}],[reg.LINE_COMMENT.source,reverse?"":function(s,i){var ret="\x01e"+index5+++"\x02";cache.e[ret]=s[i];return ret}],[/\/\*@|@\*\/|\/\/@[^\n]*\n/.source,function(s,i){var ret="\x01c"+index3+++"\x02";cache.c[ret]=s[i];return ret}],[reg.SQ_STRING.source,function(s,i){var ret="\x03a"+index1+++"\x04";cache.a[ret]=s[i];return ret}],[reg.DQ_STRING.source,function(s,i){var ret="\x03b"+index2+++"\x04";cache.b[ret]=s[i];return ret}],[reg.REG.source,function(s,i){var ret="\x03f"+index6+++"\x04";cache.f[ret]=s[i];return ret}],[/function\s*\([^)]*\)/.source,function(s,i){var ret="\x03g"+index7+++"\x04";cache.g[ret]=s[i];return ret}]]);arr=[["([+-])\\s+([+-])","$1 $2"],["\\b[\\s]+\\b"," "],["[\\s]+",""]];if(type=="css"){_.arr.insertAny(arr,[/\s+(\.)/.source," $1"],2,true);_.arr.insertAny(arr,[/(\d*\.?\d+|\d+\.?\d*)(cm|em|ex|pt|px|%|\:)?/," $0 "],-1,true)}code=linb.Coder.replace(code,arr);if(!reverse){arr=[[/[\{]/.source,function(a,i){return a[i]+"\n"+space[++deep]}],[/[\x02\;]/.source,function(a,i){return a[i]+"\n"+space[deep]}],[/(\,)([\x03\x04\w_\-]+\:)/.source,function(a,i){return a[i+1]+"\n"+space[deep]+a[i+2]}],[/\x01/.source,function(a,i){return"\n"+space[deep]+a[i]}],[/[\}]\s*[\,\;]*/.source,function(a,i){return"\n"+space[--deep]+a[i]+"\n"+space[deep]}]];if(type!="css"){arr.push([/for\s*\([\w ]+\sin\s/.source,"$0"],[/for\s*\(([^;]*);([^;]*);([^)]*)\)/.source,"for($1; $2; $3)"],[/(,)(("[^"\n\r]*"|'[^'\n\r]*'|\w+)?(:|=>))/.source,function(a,i){return a[i+1]+"\n"+space[deep]+a[i+2]}],[/\b(case|default)\b[^:]+:/.source,function(a,i){return a[i]+"\n"+space[deep]}])}code=linb.Coder.replace(code,arr);code=linb.Coder.replace(code,[[/ *[\n\r]/.source,"\n"],[/\{\s+\}/.source,"{}"],[/\}\n *(else|catch|finnally)/.source,"}$1"],[reg.NUMBER,"$0"],[/(\/\/)|(\/\*)|(\*\/)/.source,"$0"],[/\s*((\+\+|\-\-|\&\&|\|\||!!)|([=!]==)|((<<|>>>|>>)=?)|([\+\-\*\/\%\&|^<>!=~]=?)|([?:]))\s*/.source," $1 "]])}code=linb.Coder.replace(code,[[/[\n\r]+/.source,"\n"],[/( *)(\x01[d]\d+\x02)/.source,function(s,i){s[i+1]=s[i+1]||"";return s[i+1]+cache.d[s[i+2]].replace(/(\n)(\s*)/g,"$1"+s[i+1])}],[/\x03[g]\d+\x04/.source,function(s,i){return cache.g[s[i]].replace(/\s*,\s*/g,","+(reverse?"":" "))}],[/[\x01\x03]([\w])\d+[\x02\x04]/.source,function(s,i){return cache[s[i+1]][s[i]]}],[/\}\s*([\)\]])/.source,"}$1"]]);code=code.replace(/([\x01\x02\x03\x04])-/g,"$1")}return code},$linbid:1,formatHTML:function(code,type,arrActions,id,height){if(!id){id=""+this.$linbid++}var _key=this.$key,_str=code,_this=this,_encode=function(str){return str.replace(/\x02|\x03/g,function(a){return a=="\x02"?"&lt;":"&amp;"})},_decode=function(str){return str.replace(/<|\&/g,function(a){return a=="<"?"\x02":"\x03"})};code=code.replace(/^\s*(.*)\s*$/g,"$1");code=_decode(code);var a,_t;if(!this._profiles[type]){type="js"}a=_.copy(this._profiles[type]);code=this.replace(code,[[/(\r\n|\r)/g,"\n"],[/( +)(\n)/g,"$2"],[/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;"],[/ /g,"&nbsp;"]]);var arr=[];var f=function(o,s,r){if(o){if(!_.isArr(o)){o=[o]}_.arr.each(o,function(o){if(typeof o=="string"){o="\\b("+o+")\\b"}arr.push([o,r?r:"<span class='"+s+"'>$0</span>"])})}};if(_t=a.multicomment){f(_t,"multicomment",function(a,i){return"<span class='comment'>"+a[i].split("\n").join("</span>\n<span class='comment'>")+"</span>"});delete a.multicomment}if(_t=a.comment){f(_t,"comment",function(a,i){return"<span class='comment'>"+a[i].replace("\n","")+"</span>"});delete a.comment}if(_t=a.IGNORE){f(_t,"IGNORE","$0");delete a.IGNORE}if(a.reg){(function(o,s){if(o){if(!_.isArr(o)){o=[o]}_.arr.each(o,function(o){if(typeof o=="string"){o="\\b("+o+")\\b"}arr.push([o,"<span class='"+s+"'>$0</span>"])})}})(a.reg,"reg");delete a.reg}_.arr.each(["string1","string2","number"],function(s){if(a[s]){f(a[s],s);delete a[s]}});_.each(a,function(o,i){f(o,i)});code=this.replace(code,arr);code=_encode(code);var strR="";var alist=code.split("\n");if(alist[0]==""){alist.shift()}if(alist[alist.length-1]==""){alist.pop()}var aa=[];aa.push("<div id='"+_key+":"+id+":' class='sh'>");if(arrActions&&arrActions[0]){aa.push("<div id='"+_key+"-sh-cmd:"+id+":' class='sh-cmd'>");aa.push("<span class='sh-toggle' href='javascript:;' onclick='linb.Coder._toggle(this);'>-</span> <span class='cmd-ruler'></span>");_.arr.each(arrActions,function(s){aa.push("<a id='"+_key+"-"+s+":"+id+":' href='javascript:;' onclick='linb.Coder._action(this,\""+s+"\",arguments[0]);'>"+s+"</a>")});aa.push("<span>"+type+" source code viewer, powered by <a href='http://www.linb.net' target='_blank' style='font-size:9px;color:#000157;'>LINB</a></span>");aa.push("</div>")}aa.push("<pre style='display:none'>");aa.push(_str.replace(/<([\w\/])/g,"&lt;$1"));aa.push("</pre>");aa.push("<div id='"+_key+"-sh-con:"+id+":'class='sh-con' "+(height?"style='overflow:auto;height:"+height+"px;'":"")+"><ol id='"+_key+"-ol:"+id+":' start='1' class='"+type+"'><li>");aa.push(alist.join("&nbsp;</li><li>"));aa.push("</li></ol></div>");aa.push("</div>");_encode=_decode=null;_.asyRun(function(){linb.Coder._remedy(id)});return aa.join("")},formatAll:function(code,type,arrActions,id,height){var arr=_.toArr(arguments);arr[0]=this.formatText.call(this,code,type);return this.formatHTML.apply(this,arr)},applyById:function(id,formatAll){var i=0,self=this,fun=function(){if(linb.Dom.byId(id)){var _t,o,cls;i++;_t=linb(id);cls=(_t.get(0).className||"").split(/\s+/g);o=_.str.toDom(linb.Coder[formatAll?"formatAll":"formatHTML"](_t.text(),cls[0],cls[1]&&cls[1].split("-"),id+":"+i));_t.replace(o)}else{return false}};linb.Thread.repeat(fun)},_remedy:function(id){var _t=this.$key+":"+id+":";if(!(_t=linb(_t)).isEmpty()){var p=_t.parent(),w=p.scrollWidth(),w2=p.width();p.css("positoin","relative");if(w>w2){_t.width(w)}}},$action:{run:function(o,e){var code=linb(o).parent().next().text(),fun=new Function([],code);fun.call(linb(o).parent(2),e)},plain:function(o){var code=linb(o).parent().next().text();var code=code.replace(/</g,"&lt;");var wnd=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1");wnd.document.write('<pre style="width:100%;height:100%;border:none;">'+code+"</pre>");wnd.document.close();wnd=null}},_action:function(o,key,e){if(this.$action[key]){this.$action[key](o,e||window.event)}},_toggle:function(node){var s=node.parentNode.nextSibling.nextSibling.style;if(s.display=="none"){s.display="";node.innerHTML="-"}else{s.display="none";node.innerHTML="+"}}}});Class("linb.Tips",null,{Constructor:function(){return null},Initialize:function(){var dd=linb.DragDrop,tips=this;if(dd){dd.$reset=function(){tips._pos={left:dd._profile.x,top:dd._profile.y}}}linb.CSS.addStyleSheet(".linb-tips{font-size:0;line-height:0;position:absolute;overflow:visible;} .linb-tips-i{font-size:12px;overflow:hidden;}.linb-tips-i span{display:inline;}",this.KEY);linb.doc.afterMousedown(function(){tips._cancel()},"$Tips",-1).afterMousemove(function(obj,e){if(dd.isWorking){return }var event=linb.Event,p,n;if((p=_.resetRun.$cache)&&p["$Tips3"]){tips._pos=event.getPos(e)}if(tips._from){_.resetRun("$Tips3",null);tips._showF()}else{if(tips._showed&&tips.MOVABLE){p=event.getPos(e);n=tips._Node.style;n.left=(parseInt(n.left)||0)+(p.left-tips._pos.left)+"px";n.top=(parseInt(n.top)||0)+(p.top-tips._pos.top)+"px";tips._pos=p;n=null}}},"$Tips",-1).afterMouseover(function(obj,e){var event=linb.Event,rt=event.$FALSE,node=event.getSrc(e),id,_from,tempid,evid,index=0,pass;if(!node){return rt}try{while((!node.id||node.id==linb.$langId)&&node.parentNode!==document&&index++<10){node=node.parentNode}if(!(id=node.id)){node=null;return rt}}catch(e){}if((_from=event._getProfile(id))&&_from.box&&_from.KEY=="linb.UIProfile"){tempid=_from.onShowTips?id:id.replace(tips._reg,":");if(tips._markId&&tempid==tips._markId){return rt}tips._markId=tempid;tips._pos=event.getPos(e);if(tips._showed){tips._from=_from;tips._enode=id;tips._showF()}else{_.resetRun("$Tips",function(){tips._from=_from;tips._enode=id;_.resetRun("$Tips3",function(){if(tips._from){tips._showF()}},100)},tips.DELAYTIME)}}else{tips._cancel()}node=null;return rt},"$Tips",-1).afterMouseout(function(obj,e){if(tips._markId){var event=linb.Event,id,tempid,evid,_from=tips._from,clear,index=0,node=e.toElement||e.relatedTarget;if(!node){clear=1}else{try{while((!node.id||node.id==linb.$langId)&&node.parentNode!==document&&index++<10){node=node.parentNode}if(!(id=node.id)){node=null;clear=1}}catch(e){clear=1}}if(clear){tips._cancel()}else{tempid=(_from&&_from.onShowTips)?id:id.replace(tips._reg,":")}node=null;return event.$FALSE}},"$Tips",-1);this._Types={"default":new function(){this._r=/(\$)([\w\.]+)/g;this.show=function(item,pos,key){if(!pos){return }var self=this,node,_ruler,s,w,h;if(!(node=self.node)||!node.get(0)){node=self.node=linb.create('<div class="linb-tips"><div class="linb-tips-i"></div></div>');_ruler=self._ruler=linb.create('<div class="linb-tips" style="position:absolute;visibility:hidden;left:-10000px;"><div class="linb-tips-i" style="position:relative;"></div></div>');self.n=node.first();self._n=_ruler.first();if(typeof node.addShadow=="function"){node.addShadow();_ruler.addShadow()}linb("body").append(_ruler)}_ruler=self._ruler;if(document.body.lastChild!=node.get(0)){linb("body").append(node)}s=typeof item=="object"?item[key||linb.Tips.TIPSKEY]:item;if(typeof s=="function"){s=s()}if(s+=""){var html=/^\s*\</.test(s);s=s.replace(self._r,function(a,b,c){return linb.getRes(c)});linb.Tips._curTips=s;if(!item.transTips||!html){s='<div style="border:solid gray 1px;background-color:#FFF8DC;padding:1px 2px 2px 2px;">'+s+"</div>"}self._n.get(0).innerHTML=s;w=_ruler.get(0).offsetWidth;if(!html){w=Math.min(tips.MAXWIDTH,w)}var style=node.get(0).style,t1=self.n.get(0),styleI=t1.style;style.visibility="hidden";t1.innerHTML=s;if(linb.browser.ie){style.width=styleI.width=w+(w%2)+"px";h=t1.offsetHeight;style.height=h-(h%2)+"px"}else{styleI.width=w+"px"}node.popToTop({left:pos.left,top:pos.top,region:{left:pos.left,top:pos.top-12,width:24,height:32}},1);style=styleI=t1=null}else{node.css("zIndex",0).hide()}};this.hide=function(){this.node.css("zIndex",0).hide()}}}},Static:{_reg:/-[\w]+:/,TIPSKEY:"tips",MAXWIDTH:300,MOVABLE:true,DELAYTIME:200,AUTOHIDETIME:5000,_showF:function(){var self=this,_from=self._from,node=linb.Dom.byId(self._enode),pos=self._pos,id,o,t,b=false;self._from=self._enode=null;if(!node||!_from||!pos||!(o=_from.box)){return }self._pos=pos;b=((t=_from.CF)&&(t=t.showTips)&&t(_from,node,pos));if(!b){b=(o._showTips&&o._showTips(_from,node,pos))}if(!b&&((t=_from)&&t.tips)||(t&&(t=t.properties)&&(t.tips))){self.show(pos,t);b=true}if(!b){self.hide()}else{if(!self.MOVABLE){_.resetRun("$Tips2",self.hide,self.AUTOHIDETIME,null,self)}}node=pos=_from=null},getTips:function(){return this._curTips},show:function(pos,item,key){var self=this,t;self._pos=pos;if(self._item===item){return }if(typeof item=="string"||(item&&(item[key||linb.Tips.TIPSKEY]))){t=self._tpl=self._Types[item.tipsTemplate]||self._Types["default"];t.show(item,pos,key);self._Node=t.node.get(0);self._item=item;self._showed=true}else{self._cancel()}},hide:function(){var self=this;if(self._showed){if(self._tpl){self._tpl.hide()}self._clear()}},_cancel:function(){var self=this;if(self._markId){if(self._showed){self.hide()}else{_.resetRun("$Tips",null);_.resetRun("$Tips3",null);self._clear()}}},_clear:function(){var self=this;self._Node=self._curTips=self._markId=self._from=self._tpl=self._item=self._showed=null}}});Class("linb.UI.Border","linb.UI",{Instance:{_attachTo:function(target,eventTrigger){var self=this,v=self.get(0),t;target.append(self);v.$edgeId=linb(target).id();v.$tieId=eventTrigger;v.$attached=true;if(t=v.properties){if(v.properties.borderActive){var tag="tag",n=v.domId;if(linb(eventTrigger).get(0)){linb(eventTrigger).afterMouseover(function(p,e){if(p.properties.disabled){return }var profile=linb.$cache.profileMap[n];_.tryF(profile.behavior.TAG.afterMouseover,[profile,e,profile.getRootNode()],this)},tag).afterMouseout(function(p,e){if(p.properties.disabled){return }var profile=linb.$cache.profileMap[n];_.tryF(profile.behavior.TAG.afterMouseout,[profile,e,profile.getRootNode()],this)},tag).afterMousedown(function(p,e){if(p.properties.disabled){return }var profile=linb.$cache.profileMap[n];_.tryF(profile.behavior.TAG.afterMousedown,[profile,e,profile.getRootNode()],this)},tag).afterMouseup(function(p,e){if(p.properties.disabled){return }var profile=linb.$cache.profileMap[n];_.tryF(profile.behavior.TAG.afterMouseup,[profile,e,profile.getRootNode()],this)},tag)}}}return target},_detach:function(){var self=this,v=self.get(0),n,t,nl=null,tag="tag";delete v.$attached;if(n=v.$tieId){if(n=linb.Dom.byId(n)){linb(n).afterMouseover(nl,tag).afterMouseout(nl,tag).afterMousedown(nl,tag).afterMouseup(nl,tag)}}return self}},Initialize:function(){_.each({addBorder:function(properties){var target=linb([this.get(0)]),eventTrigger=arguments[1]||target.id();return new linb.UI.Border(properties)._attachTo(target,eventTrigger)},$getBorder:function(){var s=this.id(),b;_.arr.each(linb.UI.Border._cache,function(o){if(o.$edgeId==s){b=o;return false}});return b&&b.boxing()},removeBorder:function(){var s=this.id();_.arr.each(linb.UI.Border._cache,function(o){if(o.$edgeId==s){o.boxing()._detach().destroy()}});return this}},function(o,i){linb.Dom.plugIn(i,o)});_.each({_border:function(properties,flag){return this.each(function(o){var t=o.properties,target=o.getSubNode(t._customBorder||"BORDER"),k;if(!properties){properties={}}if(t._customBorder){k=(properties._bkey=o.getClass("KEY"))}else{k="linb-border"}var key="setting-"+k,sk;sk="borderLeftWidth";t.$b_lw=linb.UI.$getCSSValue(key,sk);sk="borderRightWidth";t.$b_rw=linb.UI.$getCSSValue(key,sk);sk="borderTopWidth";t.$b_tw=linb.UI.$getCSSValue(key,sk);sk="borderBottomWidth";t.$b_bw=linb.UI.$getCSSValue(key,sk);if(flag!==false){if(target.$getBorder()){return }o.$border=target.addBorder(properties);o.clearCache().boxing().reLayout()}})},_unBorder:function(){return this.each(function(o){var target=o.getSubNode("BORDER"),t=o.properties;if(!target.$getBorder()){return }target.removeBorder();delete o.$border;delete t.$b_lw;delete t.$b_rw;delete t.$b_tw;delete t.$b_bw;o.clearCache().boxing().reLayout()})}},function(o,i){linb.UI.Widget.plugIn(i,o)});linb.UI.Widget.setDataModel({border:{ini:false,action:function(v){var b=this.boxing();if(v){b._border()}else{b._unBorder()}}}})},Static:{Templates:{tagName:"div",TAG:{},T:{className:"{cls_t}"},RT:{className:"{cls_rt}",$order:1},R:{className:"{cls_r}"},RB:{className:"{cls_rb}",$order:1},B:{className:"{cls_b}"},LB:{className:"{cls_lb}",$order:1},L:{className:"{cls_l}"},LT:{className:"{cls_lt}",$order:1}},Appearances:{KEY:{width:0,height:0,_display:"inline","font-size":0,"line-height":0},"TAG,T, RT, R, RB, B, LB, L, LT":{position:"absolute",display:"block","font-size":0,"line-height":0},".setting-linb-border":{"border-style":"solid","border-top-width":"1px","border-bottom-width":"1px","border-left-width":"1px","border-right-width":"1px"},T:{width:"100%",left:0,top:"-1px",height:"3px",background:linb.UI.$bg("vertical.gif","repeat-x left top")},B:{width:"100%",left:0,bottom:"-1px",height:"3px",background:linb.UI.$bg("vertical.gif","repeat-x left bottom")},L:{height:"100%",top:0,left:"-1px",width:"3px",background:linb.UI.$bg("horizontal.gif","repeat-y left top")},R:{height:"100%",top:0,right:"-1px",width:"3px",background:linb.UI.$bg("horizontal.gif","repeat-y right top")},LT:{top:"-1px",left:"-1px",width:"3px",height:"3px",background:linb.UI.$bg("corner.gif","no-repeat left top")},RT:{top:"-1px",right:"-1px",width:"3px",height:"3px",background:linb.UI.$bg("corner.gif","no-repeat right top")},RB:{right:"-1px",bottom:"-1px",width:"3px",height:"3px",background:linb.UI.$bg("corner.gif","no-repeat right bottom")},LB:{left:"-1px",bottom:"-1px",width:"3px",height:"3px",background:linb.UI.$bg("corner.gif","no-repeat left bottom")}},Behaviors:{HoverEffected:{TAG:"KEY"},ClickEffected:{TAG:"KEY"}},DataModel:{_bkey:"",borderActive:false},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),pk=profile.properties._bkey;data.cls_t=pk?pk+"-b-t":"";data.cls_rt=pk?pk+"-b-rt":"";data.cls_r=pk?pk+"-b-r":"";data.cls_rb=pk?pk+"-b-rb":"";data.cls_b=pk?pk+"-b-b":"";data.cls_lb=pk?pk+"-b-lb":"";data.cls_l=pk?pk+"-b-l":"";data.cls_lt=pk?pk+"-b-lt":"";return data}}});Class("linb.UI.Shadow","linb.UI",{Instance:{_attachTo:function(obj){obj=obj.reBoxing();var self=this;self.get(0)._target=obj.get(0);obj.append(self);return obj}},Initialize:function(){_.each({addShadow:function(properties){return new linb.UI.Shadow(properties)._attachTo(linb([this.get(0)]))},$getShadow:function(){var s=this.get(0),b;_.arr.each(linb.UI.Shadow._cache,function(o){if(o._target==s){b=o;return false}});return b&&b.boxing()},removeShadow:function(){var s=this.get();_.arr.each(linb.UI.Shadow._cache,function(o){if(_.arr.indexOf(s,linb(o._target).get(0))!=-1){o.boxing().destroy()}});return this}},function(o,i){linb.Dom.plugIn(i,o)});_.each({_shadow:function(key){return this.each(function(o){var target=o.getSubNode("BORDER");if(target.$getShadow()){return }var d=o.properties;o.$shadow=target.addShadow({shadowSize:d._shadowSize})})},_unShadow:function(){return this.each(function(o){var target=o.getSubNode("BORDER");if(!target.$getShadow()){return }target.removeShadow();delete o.$shadow})}},function(o,i){linb.UI.Widget.plugIn(i,o)});linb.UI.Widget.setDataModel({shadow:{ini:false,action:function(v){var b=this.boxing();if(v){b._shadow()}else{b._unShadow()}}},_shadowSize:this.SIZE})},Static:{SIZE:8,Templates:{tagName:"div",R:{tagName:"div",style:"top:{shadowOffset}px;width:{shadowSize}px;right:-{pos}px;"},RB:{tagName:"div",style:"height:{rbsize}px;width:{rbsize}px;right:-{pos}px;bottom:-{pos}px;"},B:{tagName:"div",style:"left:{shadowOffset}px;height:{shadowSize}px;bottom:-{pos}px;"}},Appearances:{KEY:{width:0,height:0,_display:"inline","_font-size":0,"_line-height":0},"B, RB, R":{position:"absolute",display:"block","*font-size":0,"*line-height":0,"z-index":"-1"},B:{left:0,width:"100%",background:linb.browser.ie6?"":linb.UI.$bg("bottom.png","repeat-x left bottom"),_filter:linb.UI.$ieBg("bottom.png")},RB:{background:linb.browser.ie6?"":linb.UI.$bg("right_bottom.png","left top"),_filter:linb.UI.$ieBg("right_bottom.png")},R:{top:0,height:"100%",background:linb.browser.ie6?"":linb.UI.$bg("right.png","repeat-y right top"),_filter:linb.UI.$ieBg("right.png")}},DataModel:{shadowSize:{ini:8,action:function(value){var self=this,shadowOffset=self.properties.shadowOffset;self.getSubNode("R").cssRegion({width:value,top:shadowOffset,right:-value-shadowOffset});self.getSubNode("RB").cssRegion({width:value,height:value,right:-value-shadowOffset+1,bottom:-value-shadowOffset+1});self.getSubNode("B").cssRegion({height:value,left:shadowOffset,bottom:-value-shadowOffset})}},shadowOffset:{ini:0,action:function(value){this.boxing().setShadowSize(this.properties.shadowSize,true)}}},_prepareData:function(profile){var t=arguments.callee.upper.call(this,profile);t.pos=(parseInt(t.shadowSize)||0)+(parseInt(t.shadowOffset)||0);t.rbsize=t.shadowSize+4;return t},LayoutTrigger:function(){if(linb.browser.ie){this.getRoot().ieRemedy()}}}});Class("linb.UI.Resizer","linb.UI",{Instance:{_attachTo:function(target,parent){var self=this,v=self.get(0);v._target=linb(target);v._parent=parent||linb("body");v._parent.append(self);v.$resizeId=linb(target).id();return self},show:function(){var self=this;self.each(function(o){o.getRoot().css("display",o.$display||"block")});if(linb.browser.ie){self.reBoxing().ieRemedy()}return self},hide:function(){var self=this;self.each(function(o){o.$display=o.getRoot().css("display")});self.reBoxing().css("display","none");return self}},Initialize:function(){this.addTemplateKeys(["HANDLER","HIDDEN","MOVE","L","R","T","B","LT","RT","LB","RB"]);_.each({addResizer:function(properties,onUpdate){var target=linb([this.get(0)]);properties=properties||{};_.merge(properties,{_attached:true});var r=new linb.UI.Resizer(properties)._attachTo(target,target);if(onUpdate){r.onUpdate(onUpdate)}return r},removeResizer:function(){var s=this.id();_.arr.each(linb.UI.Resizer._cache,function(o){if(o.$resizeId==s){o.boxing().destroy()}});return this},$getResizer:function(){var s=this.id(),b;_.arr.each(linb.UI.Resizer._cache,function(o){if(o.$resizeId==s){b=o;return false}});return b&&b.boxing()}},function(o,i){linb.Dom.plugIn(i,o)});_.each({_resizer:function(key,args){return this.each(function(o){var target=o.getSubNode("BORDER"),d=o.properties;if(target.$getResizer()){return }args=args||{};var update=function(pro,target,size,cssPos){var profile=arguments.callee.profile,node=profile.getRoot(),prop=profile.properties,t;if(size){var w=null,h=null;if(t=size.width){node.widthBy(t);prop.width=w=node.width()}if(t=size.height){node.heightBy(t);prop.height=h=node.height()}linb.UI.$tryResize(profile,w,h,true)}if(cssPos){if((t=cssPos.left)&&!(prop.left=="auto"&&parseInt(prop.right)>=0)){node.leftBy(t);prop.left=node.left()}if((t=cssPos.top)&&!(prop.top=="auto"&&parseInt(prop.bottom)>=0)){node.topBy(t);prop.top=node.top()}}};update.profile=o;o.$resizer=target.addResizer(args,update);o.$resizer.get(0).$parentUIProfile=o})},_unResizer:function(){return this.each(function(o){var target=o.getSubNode("BORDER");if(!target.$getResizer()){return }target.removeResizer();delete o.$resizer.get(0).$parentUIProfile;delete o.$resizer})}},function(o,i){linb.UI.Widget.plugIn(i,o)});linb.UI.Widget.setDataModel({resizer:{ini:false,action:function(v){var b=this.boxing();if(v){var t=this.properties,arg={};_.each("minHeight,minWidth,maxHeight,maxWidth".split(","),function(i){if(i in t){arg[i]=t[i]}});b._resizer(v,arg)}else{b._unResizer()}}}})},Static:{Templates:{tagName:"div",style:"{_style};"},Appearances:{KEY:{position:"absolute",margin:"0 -1px -1px 0",visibility:"visible","font-size":0,"line-height":0,"*background":"url("+linb.ini.path+"bg.gif)","z-index":60,cursor:"move"},MOVE:{position:"absolute",display:"block","z-index":100,visibility:"visible",background:linb.UI.$bg("icons.gif","no-repeat -17px -244px",true),"font-size":0,"line-height":0},HANDLER:{$order:0,position:"absolute",display:"block",border:"solid 1px","background-color":"#fff","z-index":100,visibility:"visible","font-size":0,"line-height":0},T:{$order:1,left:"50%",cursor:"n-resize"},RT:{$order:1,cursor:"ne-resize","z-index":110},R:{$order:1,top:"50%",cursor:"e-resize"},RB:{$order:1,cursor:"se-resize","z-index":110},B:{$order:1,left:"50%",cursor:"s-resize"},LB:{$order:1,cursor:"sw-resize","z-index":110},L:{$order:1,top:"50%",cursor:"w-resize"},LT:{$order:1,cursor:"nw-resize","z-index":110},HIDDEN:{$order:10,"background-color":"transparent","border-width":0}},Behaviors:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{move:true})},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{move:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{move:true})},LT:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{left:true,top:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{left:true,top:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{left:true,top:true})}},RT:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{right:true,top:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{right:true,top:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{right:true,top:true})}},LB:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{left:true,bottom:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{left:true,bottom:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{left:true,bottom:true})}},RB:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{right:true,bottom:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{right:true,bottom:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{right:true,bottom:true})}},L:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{left:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{left:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{left:true})}},T:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{top:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{top:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{top:true})}},R:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{right:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{right:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{right:true})}},B:{onMousedown:function(profile,e,src){profile.box._onMousedown(profile,e,src,{bottom:true});return false},onDragbegin:function(profile,e,src){profile.box._onDragbegin(profile,e,src)},onDrag:function(profile,e,src){profile.box._onDrag(profile,e,src,{bottom:true})},onDragstop:function(profile,e,src){profile.box._onDragstop(profile,e,src,{bottom:true})}}},DataModel:{_attached:false,forceVisible:false,forceMovable:false,singleDir:false,vertical:true,horizontal:true,minHeight:12,minWidth:12,maxHeight:5000,maxWidth:5000,handlerSize:4,handlerOffset:0,left:100,top:100,height:100,width:100,position:"absolute",display:"block"},EventHandlers:{onUpdate:function(profile,target,size,cssPos){}},_dynamicTemplate:function(profile){var pro=profile.properties,size,pos,temp,hash=profile._exhash="$_attached:"+pro._attached+";forceVisible:"+pro.forceVisible+";singleDir:"+pro.singleDir+";vertical:"+pro.vertical+";horizontal:"+pro.horizontal+";forceMovable:"+pro.forceMovable+";";var map=arguments.callee.map||(arguments.callee.map={MOVE:{tagName:"div",style:"top:50%;left:50%;margin-left:-6px;margin-top:-6px;width:13px;height:13px;"},T:{tagName:"div",style:"top:-{extend}px;margin-left:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},RT:{tagName:"div",style:"top:-{extend}px;right:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},R:{tagName:"div",style:"right:-{extend}px;margin-top:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},RB:{tagName:"div",style:"bottom:-{extend}px;right:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},B:{tagName:"div",style:"bottom:-{extend}px;margin-left:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},LB:{tagName:"div",style:"bottom:-{extend}px;left:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},L:{tagName:"div",style:"left:-{extend}px;margin-top:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},LT:{tagName:"div",style:"left:-{extend}px;top:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},cover:{T:{tagName:"div",style:"width:100%;left:0;top:-{extend}px;height:{handlerSize}px;"},RT:{tagName:"div",style:"top:-{extend}px;right:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},R:{tagName:"div",style:"height:100%;top:0;right:-{extend}px;width:{handlerSize}px;"},RB:{tagName:"div",style:"right:-{extend}px;bottom:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},B:{tagName:"div",style:"width:100%;left:0;bottom:-{extend}px;height:{handlerSize}px;"},LB:{tagName:"div",style:"left:-{extend}px;bottom:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"},L:{tagName:"div",style:"height:100%;top:0;left:-{extend}px;width:{handlerSize}px;"},LT:{tagName:"div",style:"top:-{extend}px;left:-{extend}px;width:{handlerSize}px;height:{handlerSize}px;"}}});var template=profile.box.getTemplate(hash);if(!template){var t,n;template=_.clone(profile.box.getTemplate());t=pro._cover?map.cover:map;if(pro._move){template.MOVE=map.MOVE}if(pro.vertical){if(!pro.singleDir){template.T=t.T}template.B=t.B}if(pro.horizontal){if(!pro.singleDir){template.L=t.L}template.R=t.R;if(pro.vertical){if(!pro.singleDir){template.LB=t.LB;template.RT=t.RT;template.LT=t.LT}template.RB=t.RB}}n=profile.getClass("KEY","-handler")+" ";if(t=template.T){t.className=n}if(t=template.RT){t.className=n}if(t=template.R){t.className=n}if(t=template.RB){t.className=n}if(t=template.B){t.className=n}if(t=template.LB){t.className=n}if(t=template.L){t.className=n}if(t=template.LT){t.className=n}if(!pro._visible){n=profile.getClass("KEY","-hidden")+" ";if(t=template.T){t.className+=n}if(t=template.RT){t.className+=n}if(t=template.R){t.className+=n}if(t=template.RB){t.className+=n}if(t=template.B){t.className+=n}if(t=template.LB){t.className+=n}if(t=template.L){t.className+=n}if(t=template.LT){t.className+=n}}profile.box.setTemplate(template,hash)}profile.template=template},_prepareData:function(profile){var t=profile.properties;t._visible=true;t._cover=false;t._move=true;if(t._attached){t._visible=false;t._cover=true;t._move=false;t.position="static";t.display="inline";t.left=t.top=t.width=t.height=0}if(t.forceVisible){t._visible=true;t._cover=false}if(t.forceMovable){t._move=true}t.extend=(parseInt(t.handlerSize)||0)/2+(parseInt(t.handlerOffset)||0);return arguments.callee.upper.call(this,profile)},RenderTrigger:function(){var self=this;linb.setNodeData(self.renderId,"zIndexIgnore",1);if(!self.onUpdate){self.onUpdate=self.box.onUpdate}},onUpdate:function(profile,target,size,cssPos){if(target){if(size){target.widthBy(size.width,true).heightBy(size.height,true)}if(cssPos){var t=target.get(0).style;if(t.left=="auto"&&(parseInt(t.right)>=0)){}else{target.leftBy(cssPos.left)}if(t.top=="auto"&&(parseInt(t.bottom)>=0)){}else{target.topBy(cssPos.top)}}}},_onMousedown:function(profile,e,src,ddparas){var puip=profile.$parentUIProfile;if(puip&&puip["linb.UIProfile"]&&puip.beforeResizerDrag&&false===_.tryF(puip.beforeResizerDrag,[puip,profile,ddparas],puip.boxing())){return }var pos=linb.Event.getPos(e);linb.use(src).startDrag(e,{dragDefer:1,targetReposition:false,dragType:"blank",dragCursor:true,targetLeft:pos.left,targetTop:pos.top})},_onDragbegin:function(profile,e){var o=profile.properties._attached?profile._target:linb([profile.renderId]),w=o.width(),h=o.height();if(profile.properties._attached){var pos=o.offset();profile.proxy=linb.Dom.getEmptyDiv();profile.proxy.html(" ",false).css({border:"1px dashed",visibility:"visible"}).offset(pos).width(w).height(h).css("zIndex",linb.Dom.TOP_ZINDEX+20)}else{profile.proxy=o}profile.o_pos=profile.proxy.cssPos();profile.o_w2=profile.o_w=w;profile.o_h2=profile.o_h=h;profile.$onDrag=true},_onDrag:function(profile,e,src,ddparas){var o=ddparas;profile.oos=profile.oos||{};var os=linb.DragDrop.getProfile().offset;if(os.x==profile.oos.width&&os.y==profile.oos.height){return }profile.oos=os;var x,y,w,h,t=profile.properties;if(o.left){w=profile.o_w-os.x;x=profile.o_pos.left+os.x;if(w<t.minWidth){w=t.minWidth;x=profile.o_w+profile.o_pos.left-w}else{if(w>t.maxWidth){w=t.maxWidth;x=profile.o_w+profile.o_pos.left-w}}profile.proxy.width(w).left(x)}else{if(o.right){w=profile.o_w+os.x;if(w<t.minWidth){w=t.minWidth}else{if(w>t.maxWidth){w=t.maxWidth}}profile.proxy.width(w)}}if(o.left||o.right){var byw=w-profile.o_w2;if(profile.regions&&byw!==0){profile.regions.widthBy(byw);profile.o_w2=w}}if(o.top){h=profile.o_h-os.y;y=profile.o_pos.top+os.y;if(h<t.minHeight){h=t.minHeight;y=profile.o_h+profile.o_pos.top-h}else{if(h>t.maxHeight){h=t.maxHeight;y=profile.o_h+profile.o_pos.top-h}}profile.proxy.height(h).top(y)}else{if(o.bottom){h=profile.o_h+os.y;if(h<t.minHeight){h=t.minHeight}else{if(h>t.maxHeight){h=t.maxHeight}}profile.proxy.height(h)}}if(o.top||o.bottom){var byh=h-profile.o_h2;if(profile.regions&&byh!==0){profile.regions.heightBy(byh);profile.o_h2=h}}if(o.move){x=profile.o_pos.left+os.x;y=profile.o_pos.top+os.y;profile.proxy.top(y).left(x)}},_onDragstop:function(profile,e,src,args){var cssPos,size,pos,o=profile.proxy;if(!args.move){size={width:o.width()-profile.o_w,height:o.height()-profile.o_h}}if(args.left||args.top||args.move){cssPos=o.cssPos();pos={left:cssPos.left-profile.o_pos.left,top:cssPos.top-profile.o_pos.top}}profile.boxing().onUpdate(profile,profile._target,size,pos);if(profile.properties._attached){if(linb.browser.ie6){profile._target.ieRemedy()}profile.proxy.html("",false).css({visibility:"hidden",border:"none",zIndex:"0",width:"0",height:"0"})}profile.$onDrag=false}}});Class("linb.UI.Image","linb.UI",{Instance:{getRate:function(){return parseFloat(this.get(0)._rate)||1}},Static:{Templates:{tagName:"image",style:"{_style}",border:"0",width:"{width}",height:"{height}"},Behaviors:{HoverEffected:{KEY:"KEY"},ClickEffected:{KEY:"KEY"},DragableKeys:["KEY"],onError:function(profile,e,src){profile.boxing().onError(profile)},onLoad:function(profile,e,src){var i=new Image(),path=i.src=linb.use(src).get(0).src,size=profile.box._adjust(profile,i.width,i.height);profile.boxing().afterLoad(profile,path,size[0],size[1])}},RenderTrigger:function(){var self=this,pro=self.properties,v=pro.src;if(v){pro.value=pro.$UIvalue="";self.boxing().setSrc(v,true)}},EventHandlers:{onError:function(profile){},beforeLoad:function(profile){},afterLoad:function(profile,path,width,height){}},_adjust:function(profile,width,height){var pro=profile.properties,src=profile.getRootNode();if(width>0&&height>0){var r1=pro.maxWidth/width,r2=pro.maxHeight/height,r=r1<r2?r1:r2;if(r>=1){r=1}profile._rate=r;src.width=width*r;src.height=height*r;return[width*r,height*r]}return[0,0]},DataModel:{maxWidth:{ini:800,action:function(v){var src=this.getRootNode();this.box._adjust(this,src.width,src.height)}},maxHeight:{ini:600,action:function(v){var src=this.getRootNode();this.box._adjust(this,src.width,src.height)}},width:{ini:"",action:function(v){var src=this.getRootNode();src.width=v}},height:{ini:"",action:function(v){var src=this.getRootNode();src.height=v}},src:{action:function(v){var self=this;if(false!==self.boxing().beforeLoad(this)){_.asyRun(function(){self.getRoot().attr({width:"0",height:"0",src:v})})}}}}}});Class("linb.UI.Block","linb.UI.Widget",{Initialize:function(){var self=this,t=self.getTemplate();_.merge(t.FRAME.BORDER,{className:"uiw-border {clsBorderType1}",PANEL:{tagName:"div",className:"{clsBorderType2} uibg-bar",style:"{background}",text:"{html}"+linb.UI.$childTag}},"all");self.setTemplate(t);t=self.getAppearance();_.merge(t,{PANEL:{position:"relative",overflow:"hidden"}});self.setAppearance(t)},Static:{Behaviors:{DropableKeys:["PANEL"]},DataModel:{disabled:null,tips:null,html:{action:function(v){this.getSubNode("PANEL").html(v)}},borderType:{ini:"outset",listbox:["none","inset","outset","groove","ridge"],action:function(v){var ns=this,p=ns.properties,n1=ns.getSubNode("BORDER"),n2=ns.getSubNode("PANEL"),reg=/^uiborder-/,ins="uiborder-inset",outs="uiborder-outset",root=ns.getRoot();n1.removeClass(reg);n2.removeClass(reg);switch(v){case"inset":n1.addClass(ins);break;case"outset":n1.addClass(outs);break;case"groove":n1.addClass(ins);n2.addClass(outs);break;case"ridge":n1.addClass(outs);n2.addClass(ins);break}ns.box._setB(ns);linb.UI.$tryResize(ns,root.get(0).style.width,root.get(0).style.height,true)}},background:{ini:"",action:function(v){this.getSubNode("PANEL").css("background",v)}},width:100,height:100},_setB:function(profile){var p=profile.properties,type=p.borderType;p.$hborder=p.$vborder=p.$iborder=0;if(type=="inset"||type=="outset"){p.$hborder=p.$vborder=1;p.$iborder=0}else{if(type=="groove"||type=="ridge"){p.$hborder=p.$vborder=p.$iborder=1}}},LayoutTrigger:function(){var v=this.properties.borderType;if(v!="none"){this.boxing().setBorderType(v,true)}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data.background=data.background?"background:"+data.background:"";return data},_onresize:function(profile,width,height){var size=arguments.callee.upper.apply(this,arguments),p=profile.properties,b=(p.$iborder||0)*2;if(size.width){size.width-=b}if(size.height&&"auto"!==size.height){size.height-=b}profile.getSubNode("PANEL").cssSize(size,true)}}});Class("linb.UI.Label","linb.UI.Widget",{Instance:{_shadowText:function(key){return this.each(function(o){o.getSubNode("SHADOW").css("display","block")})},_unShadowText:function(key){return this.each(function(o){o.getSubNode("SHADOW").css("display","none")})}},Initialize:function(){var t=this.getTemplate();_.merge(t.FRAME.BORDER,{SHADOW:{$order:1,style:"display:none;",SICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},SCAPTION:{text:"{caption}",style:"color:#cdcdcd;",$order:1}},BOX:{$order:2,ICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{text:"{caption}",$order:1}}},"all");this.setTemplate(t)},Static:{Appearances:{KEY:{"font-size":"12px","line-height":"14px"},BOX:{position:"absolute"},SHADOW:{position:"absolute",top:"4px"}},DataModel:{tabindex:null,caption:{ini:undefined,action:function(value){var self=this,p=self.properties,b=self.boxing(),k=self.keys;self.getSubNodes(["CAPTION","SCAPTION"]).html(value,false);if(p.hAlign!="left"){b.setHAlign(p.hAlign,true)}if(p.vAlign!="top"){b.setVAlign(p.vAlign,true)}}},image:{action:function(value){var self=this,k=self.keys;self.getSubNodes(["ICON","SICON"]).css("display",value?"":"none").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){var self=this,k=self.keys;self.getSubNodes(["ICON","SICON"]).css("backgroundPosition",value)}},shadowText:{ini:false,action:function(v){var b=this.boxing();v=String(v).toLowerCase()!="false";if(v){b._shadowText(v)}else{b._unShadowText()}}},hAlign:{ini:"right",listbox:["left","center","right"],action:function(v){var self=this,c=self.getSubNode("BOX"),d=self.getSubNode("SHADOW"),t=self.properties;switch(v){case"left":c.css({left:0,right:"auto",marginLeft:"auto"});d.css({left:t._textSshadowSize+"px",right:"auto",marginLeft:"auto"});break;case"right":c.css({left:"auto",right:t._textSshadowSize+"px",marginLeft:"auto"});d.css({left:"auto",right:0,marginLeft:"auto"});break;case"center":c.css({left:"50%",right:"auto",marginLeft:-1*c.get(0).offsetWidth/2+"px"});d.css({left:"50%",right:"auto",marginLeft:-1*c.get(0).offsetWidth/2+t._textSshadowSize+"px"});break}}},vAlign:{ini:"top",listbox:["top","middle","bottom"],action:function(v){var self=this,c=self.getSubNode("BOX"),d=self.getSubNode("SHADOW"),t=self.properties;switch(v){case"top":c.css({top:0,bottom:"auto",marginTop:"auto"});d.css({top:t._textSshadowSize+"px",bottom:"auto",marginTop:"auto"});break;case"bottom":c.css({top:"auto",bottom:t._textSshadowSize+"px",marginTop:"auto"});d.css({top:"auto",bottom:0,marginTop:"auto"});break;case"middle":c.css({top:"50%",bottom:"auto",marginTop:-1*c.get(0).offsetHeight/2+"px"});d.css({top:"50%",bottom:"auto",marginTop:-1*c.get(0).offsetHeight/2+t._textSshadowSize+"px"});break}}},fontSize:{action:function(value){var self=this;self.getSubNodes(["CAPTION","SCAPTION"]).css("fontSize",value)}},fontWeight:{action:function(value){var self=this;self.getSubNodes(["CAPTION","SCAPTION"]).css("fontWeight",value)}},width:120,height:20,_textSshadowSize:4},RenderTrigger:function(){var p=this.properties,o=this.boxing();if(p.fontSize){o.setFontSize(p.fontSize,true)}if(p.fontWeight){o.setFontWeight(p.fontWeight,true)}if(p.shadowText){o.setShadowText(true,true)}},LayoutTrigger:function(){var p=this.properties,o=this.boxing(),s=p.shadowText;if(p.hAlign!="left"||s){o.setHAlign(p.hAlign,true)}if(p.vAlign!="top"||s){o.setVAlign(p.vAlign,true)}}}});Class("linb.UI.ProgressBar",["linb.UI.Widget","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){profile.getSubNode("FILL").width(value+"%");profile.getSubNode("CAP").text(profile.properties.captionTpl.replace(/\{value\}/g,value))})}},Initialize:function(){var self=this,t=self.getTemplate();_.merge(t.FRAME.BORDER,{FILL:{tagName:"div",style:"width:{value}%;{fillBG}",text:"{html}"+linb.UI.$childTag},INN:{$order:2,tagName:"div",CAP:{tagName:"div"}}},"all");self.setTemplate(t);t=self.getAppearance();_.merge(t,{BORDER:{border:"1px solid #95B611","font-size":0,"line-height":0},INN:{display:"table",position:"absolute",left:0,top:0,width:"100%",height:"100%"},CAP:{"text-align":"center"},FILL:{position:"absolute",width:"1px",left:0,top:0,height:"100%",background:linb.UI.$bg("bar.gif","#96E115 repeat-x left top"),width:0}});self.setAppearance(t)},Static:{DataModel:{value:0,width:300,height:22,captionTpl:{ini:"{value}%",action:function(){this.boxing()._setCtrlValue(this.properties.$UIvalue)}},fillBG:{ini:"",action:function(v){this.getSubNode("FILL").css("background",v)}},$hborder:1,$vborder:1},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data.fillBG=data.fillBG?"background:"+data.fillBG:"";return data},_ensureValue:function(profile,value){return parseInt(value)||0},_onresize:function(profile,width,height){var size=arguments.callee.upper.apply(this,arguments),h;if(size.height){h=size.height+"px";profile.getSubNodes(["INN","CAP","FILL"]).css({height:h,"line-height":h})}}}});Class("linb.UI.Button",["linb.UI.Widget","linb.absValue"],{Instance:{activate:function(){this.getSubNode("FOCUS").focus();return this},_setCtrlValue:function(value){if(_.isNull(value)||!_.isDefined(value)){value=false}return this.each(function(profile){var pp=profile.properties;if(pp.type!="status"){return }profile.getSubNode("BORDER").tagClass("-checked",value);if(pp.border){var b=profile.getSubNode("BORDER").$getBorder();if(b){b.get(0).getRoot().tagClass("-checked",value)}}})}},Initialize:function(){this.addTemplateKeys(["DROP"]);var t=this.getTemplate();_.merge(t.FRAME,{FOCUS:{$order:2,tagName:"a",href:"{href}",tabindex:"{tabindex}",TB:{cellpadding:"0",cellspacing:"0",width:"100%",height:"100%",border:"0",tagName:"table",TR:{tagName:"tr",TDL:{tagName:"td"},TD:{$order:1,align:"{hAlign}",valign:"{vAlign}",tagName:"td",width:"100%",height:"100%",BOX:{ICON:{$order:1,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{$order:2,text:"{caption}"}}},TDR:{$order:2,tagName:"td",className:"{dropCls}",TDRI:{}}}}}},"all");this.setTemplate(t)},Static:{Appearances:{KEY:{"font-size":"12px","line-height":"14px"},BORDER:{"font-size":0,"line-height":0,"background-color":"#D2D7DF"},"BORDER-mouseover":{$order:2,"background-color":"#F7D928"},"BORDER-mousedown, BORDER-checked":{$order:2,"background-color":"#F9E56A"},DROP:{$order:10,background:linb.UI.$bg("drop.gif","no-repeat left bottom","Button"),"padding-left":"16px"},"DROP-mouseover":{$order:11,"background-position":"-16px bottom"},"DROP-mousedown":{$order:12,"background-position":"right bottom"},"TDR,TDL":{"padding-left":"6px"},".setting-linb-button":{"border-top-width":"1px","border-bottom-width":"1px","border-left-width":"1px","border-right-width":"1px"},"KEY-b-t":{top:"-1px",height:"10px",background:linb.UI.$bg("vertical.gif","repeat-x left top","Button")},"KEY-b-b":{bottom:"-1px",height:"10px",background:linb.UI.$bg("vertical.gif","repeat-x left bottom","Button")},"BORDER-mouseover KEY-b-t, BORDER-mouseover KEY-b-b":{$order:1,"background-image":linb.UI.$bg("vertical_mouseover.gif","","Button")},"BORDER-checked KEY-b-t, BORDER-checked KEY-b-b, BORDER-mousedown KEY-b-t, BORDER-mousedown KEY-b-b":{$order:2,"background-image":linb.UI.$bg("vertical_mousedown.gif","","Button")},"KEY-b-l":{left:"-1px",width:"4px",background:linb.UI.$bg("horizontal.gif","repeat-y left top","Button")},"KEY-b-r":{right:"-1px",width:"4px",background:linb.UI.$bg("horizontal.gif","repeat-y right top","Button")},"BORDER-mouseover KEY-b-l, BORDER-mouseover KEY-b-r":{$order:1,"background-image":linb.UI.$bg("horizontal_mouseover.gif","","Button")},"BORDER-checked KEY-b-l, BORDER-checked KEY-b-r, BORDER-mousedown KEY-b-l, BORDER-mousedown KEY-b-r":{$order:2,"background-image":linb.UI.$bg("horizontal_mousedown.gif","","Button")},"KEY-b-lt":{top:"-1px",left:"-1px",width:"4px",height:"10px",background:linb.UI.$bg("corner.gif","no-repeat left top","Button")},"KEY-b-rt":{top:"-1px",right:"-1px",width:"4px",height:"10px",background:linb.UI.$bg("corner.gif","no-repeat right top","Button")},"KEY-b-rb":{right:"-1px",bottom:"-1px",width:"4px",height:"10px",background:linb.UI.$bg("corner.gif","no-repeat right bottom","Button")},"KEY-b-lb":{left:"-1px",bottom:"-1px",width:"4px",height:"10px",background:linb.UI.$bg("corner.gif","no-repeat left bottom","Button")},"BORDER-mouseover KEY-b-lt, BORDER-mouseover KEY-b-rt, BORDER-mouseover KEY-b-rb, BORDER-mouseover KEY-b-lb":{$order:1,"background-image":linb.UI.$bg("corner_mouseover.gif","","Button")},"BORDER-checked KEY-b-lt, BORDER-checked KEY-b-rt, BORDER-checked KEY-b-rb, BORDER-checked KEY-b-lb, BORDER-mousedown KEY-b-lt, BORDER-mousedown KEY-b-rt, BORDER-mousedown KEY-b-rb, BORDER-mousedown KEY-b-lb":{$order:2,"background-image":linb.UI.$bg("corner_mousedown.gif","","Button")},FOCUS:{overflow:"hidden",display:"block",left:0,top:0,"z-index":"20",width:"100%",height:"100%",position:"absolute","-moz-outline-offset":"-1px !important"},BOX:{display:"inline","white-space":"nowrap"},CAPTION:{cursor:"pointer","vertical-align":"middle",display:"inline","font-size":"12px","line-height":"14px"}},Behaviors:{HoverEffected:{KEY:["BORDER"]},ClickEffected:{KEY:["BORDER"]},NavKeys:{FOCUS:1},onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return false}profile.getSubNode("FOCUS").focus();var b=profile.boxing();if(p.type=="status"){b.setUIValue(!p.$UIvalue);if(profile.onChecked){b.onChecked(profile,e,p.$UIvalue)}}if(profile.onClick){b.onClick(profile,e,src,p.$UIvalue)}},TDR:{onMousedown:function(profile,e,src){if(profile.properties.type!="drop"){return }linb.use(src).addClass(profile.getClass("DROP","-mousedown"));return false},onMouseup:function(profile,e,src){if(profile.properties.type!="drop"){return }linb.use(src).removeClass(profile.getClass("DROP","-mousedown"));return false},onMouseover:function(profile,e,src){if(profile.properties.type!="drop"){return }linb.use(src).addClass(profile.getClass("DROP","-mouseover"))},onMouseout:function(profile,e,src){if(profile.properties.type!="drop"){return }linb.use(src).removeClass(profile.getClass("DROP","-mouseover")).removeClass(profile.getClass("DROP","-mousedown"))},onClick:function(profile,e,src){if(profile.properties.type!="drop"){return }profile.boxing().onClickDrop(profile,e,src);return false}}},DataModel:{caption:{ini:undefined,action:function(value){this.getSubNode("CAPTION").get(0).innerHTML=value}},image:{action:function(value){this.getSubNode("ICON").css("display",value?"":"none").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){this.getSubNode("ICON").css("backgroundPosition",value)}},hAlign:{ini:"center",listbox:["left","center","right"],action:function(v){this.getSubNode("TD").attr("align",v)}},vAlign:{ini:"middle",listbox:["top","middle","bottom"],action:function(v){this.getSubNode("TD").attr("valign",v)}},href:linb.$href,value:false,type:{ini:"normal",listbox:["normal","status","drop"],action:function(value){var self=this,root=self.getRoot(),tdr=self.getSubNode("TDR"),drop=self.getClass("DROP");if(value=="drop"){tdr.addClass(drop)}else{tdr.removeClass(drop)}self.box._onresize(self)}},width:120,height:22,_customBorder:"BORDER",border:true},_ensureValue:function(profile,value){return !!value},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data.dropCls=data.type=="drop"?profile.getClass("DROP"):"";return data},RenderTrigger:function(){var self=this,p=self.properties,o=self.boxing();if(p.type=="status"&&p.value){o.setValue(true,true)}},EventHandlers:{onClick:function(profile,e,src,value){},onClickDrop:function(profile,e,src){},onChecked:function(profile,e,value){}}}});Class("linb.UI.CheckBox","linb.UI.Button",{Instance:{_setCtrlValue:function(value){return this.each(function(profile){profile.getSubNode("MARK").tagClass("-checked",!!value)})},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }if(!profile.renderId){return }var properties=profile.properties,o=profile.getSubNode("CAPTION"),flag=properties.value!==properties.$UIvalue,d=linb.UI.$css_tag_dirty;if(o.beforeDirtyMark&&false===o.boxing().beforeDirtyMark(profile,flag)){return }if(flag){o.addClass(d)}else{o.removeClass(d)}})}},Initialize:function(){var t=this.getTemplate();_.merge(t.FRAME.FOCUS.TB.TR.TD.BOX,{MARK:{$order:0,className:"uicmd-check"}},"all");this.setTemplate(t)},Static:{Appearances:{KEY:{"font-size":"12px","line-height":"14px",border:0,cursor:"pointer"},BORDER:{},FOCUS:{overflow:"hidden",display:"block",position:"absolute",left:0,top:0,"z-index":"200",width:"100%",height:"100%","-moz-outline-offset":"-1px !important"},BOX:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,"font-size":"12px","line-height":"14px",overflow:"hidden","vertical-align":"middle","white-space":"nowrap"},TD:{background:"transparent"},TDR:{background:"transparent"},TDL:{background:"transparent"},CAPTION:{display:"inline","white-space":"normal","vertical-align":"middle",cursor:"pointer",zoom:linb.browser.ie?0:null}},Behaviors:{HoverEffected:{KEY:"MARK"},ClickEffected:{KEY:"MARK"},onClick:function(profile,e,src){var p=profile.properties,b=profile.boxing();if(p.disabled){return false}b.setUIValue(!p.$UIvalue);if(profile.onChecked){b.onChecked(profile,p.$UIvalue)}profile.getSubNode("FOCUS").focus()},FOCUS:{onKeydown:function(profile,e,src){var key=linb.Event.getKey(e)[0];if(key==" "||key=="enter"){profile.getRoot().onClick(true);return false}}}},DataModel:{type:null,value:false,hAlign:"left",_customBorder:false,border:false},EventHandlers:{onClick:null},_ensureValue:function(profile,value){return !!value}}});Class("linb.UI.Input",["linb.UI.Widget","linb.absValue"],{Instance:{_setTB:function(type){var profile=this.get(0),p=profile.properties,o,t;if(!profile.host||!p.tipsBinder){return }t=profile.tips=profile.tips||p.tips||"";o=linb.getObject(p.tipsBinder)||((o=profile.host[p.tipsBinder])&&o.get(0));if(o&&(o.key=="linb.UI.Div"||o.key=="linb.UI.SLabel")){if(o.renderId){o.getRootNode().innerHTML=t.charAt(0)=="$"?linb.wrapRes(t):t;o.getRoot().css("color",type==1?"gray":type==2?"red":"#000")}}},activate:function(){var profile=this.get(0);if(profile.renderId){var node=profile.getSubNode("INPUT").get(0);node.focus();if(!node.readOnly&&node.select){node.select()}}return this},_setCtrlValue:function(value){if(_.isNull(value)||!_.isDefined(value)){value=""}return this.each(function(profile){profile.getSubNode("INPUT").attr("value",value+"")})},_getCtrlValue:function(){return this.getSubNode("INPUT").attr("value")},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }var properties=profile.properties,o=profile.getSubNode("INPUT"),cls=profile.box,box=profile.boxing(),d=linb.UI.$css_tag_dirty,v=linb.UI.$css_tag_invalid,flag=properties.value!==properties.$UIvalue;if(profile.beforeDirtyMark&&false===box.beforeDirtyMark(profile,flag)){}else{if(flag){o.addClass(d)}else{o.removeClass(d)}}if(profile.beforeFormatMark&&false===box.beforeFormatMark(profile,profile.inValid==2)){}else{var err=profile.getSubNode("ERROR");if(profile.inValid==2){o.addClass(v);err.css("display","block")}else{o.removeClass(v);err.css("display","none")}}if(profile.inValid==2){profile.tips=properties.tipsErr||properties.tips;if(properties.mask){_.asyRun(function(){box.setUIValue(o.get(0).value=profile.$Mask)})}}else{if(profile.inValid==1){profile.tips=properties.tips}else{profile.tips=properties.tipsOK||properties.tips}}box._setTB(profile.inValid)})}},Initialize:function(){var t=this.getTemplate();_.merge(t.FRAME.BORDER,{style:"",BOX:{WRAP:{tagName:"div",INPUT:{tagName:"input",type:"{_type}",tabindex:"{tabindex}",cursor:"{cursor}",style:"{_css}"}}}},"all");t.FRAME.ERROR={};this.setTemplate(t)},Static:{_maskMap:{"~":"[+-]","1":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},_maskSpace:"_",Appearances:{KEY:{"font-family":'"Verdana", "Helvetica", "sans-serif"',position:"relative"},BORDER:{"line-height":"0px","font-size":"0px"},WRAP:{left:0,position:"absolute",overflow:linb.browser.gek?"auto":"hidden"},BOX:{left:0,top:0,position:"absolute","background-color":"#fff",border:"solid 1px #648CB4","z-index":10},"BOX-focus, BOX-mouseover":{"border-color":"#FAE100"},INPUT:{"padding-top":"2px","padding-left":"2px","background-color":"#fff",border:0,margin:0,"margin-top":linb.browser.ie?"-1px":null,"font-size":"12px",position:"relative",width:"102px",overflow:"auto","overflow-y":"auto","overflow-x":"hidden"},ERROR:{width:"16px",height:"16px",position:"absolute",right:"2px",top:"2px",display:"none","font-size":0,background:linb.UI.$bg("icons.gif","no-repeat left -244px",true),"z-index":"50"},".setting-linb-input":{"border-style":"solid","border-top-width":"1px","border-bottom-width":"1px","border-left-width":"1px","border-right-width":"1px"},"KEY-b-t":{height:"2px",top:"-1px",background:linb.UI.$bg("vertical.gif","repeat-x left top","Input")},"KEY-b-b":{height:"2px",bottom:"-1px",background:linb.UI.$bg("vertical.gif","repeat-x left bottom","Input")},"BOX-focus KEY-b-t, BOX-focus KEY-b-b, BOX-mouseover KEY-b-t, BOX-mouseover KEY-b-b":{$order:1,"background-image":linb.UI.$bg("vertical_mouseover.gif","","Input")},"KEY-b-l":{width:"2px",left:"-1px",background:linb.UI.$bg("horizontal.gif","repeat-y left top","Input")},"KEY-b-r":{width:"2px",right:"-1px",background:linb.UI.$bg("horizontal.gif","repeat-y right top","Input")},"BOX-focus KEY-b-l, BOX-focus KEY-b-r, BOX-mouseover KEY-b-l, BOX-mouseover KEY-b-r":{$order:1,"background-image":linb.UI.$bg("horizontal_mouseover.gif","","Input")},"KEY-b-lt":{width:"2px",height:"2px",left:"-1px",top:"-1px",background:linb.UI.$bg("corner.gif","no-repeat left top","Input")},"KEY-b-rt":{width:"2px",height:"2px",right:"-1px",top:"-1px",background:linb.UI.$bg("corner.gif","no-repeat right top","Input")},"KEY-b-rb":{width:"2px",height:"2px",right:"-1px",bottom:"-1px",background:linb.UI.$bg("corner.gif","no-repeat right bottom","Input")},"KEY-b-lb":{width:"2px",height:"2px",left:"-1px",bottom:"-1px",background:linb.UI.$bg("corner.gif","no-repeat left bottom","Input")},"BOX-focus KEY-b-lt, BOX-focus KEY-b-rt, BOX-focus KEY-b-rb, BOX-focus KEY-b-lb, BOX-mouseover KEY-b-lt, BOX-mouseover KEY-b-rt, BOX-mouseover KEY-b-rb, BOX-mouseover KEY-b-lb":{$order:1,"background-image":linb.UI.$bg("corner_mouseover.gif","","Input")}},Behaviors:{HoverEffected:{BOX:["BOX"]},NavKeys:{INPUT:1},INPUT:{onChange:function(profile,e,src){var p=profile.properties,b=profile.box,o=profile.inValid,value=linb.use(src).get(0).value;profile.boxing().setUIValue(value);p.$UIvalue=value;if(o!==profile.inValid){if(profile.renderId){profile.boxing()._setDirtyMark()}}b._asyCheck(profile)},onKeydown:function(profile,e,src){var p=profile.properties,b=profile.box,m=p.multiLines,evt=linb.Event,k=evt.getKey(e);if(k[0]=="enter"&&(!m||k[3])){linb.use(src).onChange()}b._asyCheck(profile);if(p.mask){if(k[0].length>1){profile.$ignore=true}else{delete profile.$ignore}switch(k[0]){case"backspace":b._changeMask(profile,linb.use(src).get(0),"",false);return false;case"delete":b._changeMask(profile,linb.use(src).get(0),"");return false}}},onKeypress:function(profile,e,src){var p=profile.properties,b=profile.box,cls=profile.box,map=cls._maskMap;b._asyCheck(profile);if(p.mask){if(profile.$ignore){delete profile.$ignore;return true}var evt=linb.Event,k=evt.getKey(e);if(k[1]||k[3]){return true}cls._changeMask(profile,linb.use(src).get(0),k[0],true);return false}},onKeyup:function(profile,e,src){var p=profile.properties,b=profile.box;if(p.dynCheck){profile.box._checkValid(profile,linb.use(src).get(0).value);profile.boxing()._setDirtyMark()}b._asyCheck(profile)},onFocus:function(profile,e,src){var p=profile.properties,b=profile.box;if(p.disabled){return false}if(profile.onFocus){profile.boxing().onFocus(profile)}profile.getSubNode("BORDER").tagClass("-focus");if(p.mask){var value=linb.use(src).get(0).value;if(!value){_.asyRun(function(){profile.boxing().setUIValue(value=profile.$Mask);b._setCaret(profile,linb.use(src).get(0))})}}profile.boxing()._setTB(3);b._asyCheck(profile)},onBlur:function(profile,e,src){var p=profile.properties,b=profile.box;if(p.disabled){return false}if(profile.onBlur){profile.boxing().onBlur(profile)}profile.getSubNode("BORDER").tagClass("-focus",false);var value=linb.use(src).get(0).value;if(p.$UIvalue==value){profile.box._checkValid(profile,value)}profile.boxing()._setDirtyMark();b._asyCheck(profile)}}},DataModel:{_customBorder:"BOX",tipsErr:"",tipsOK:"",border:true,dynCheck:false,valueFormat:{helpinput:[{caption:"required",id:"[^.*]"},{caption:"email",id:"^[\\w\\.=-]+@[\\w\\.-]+\\.[\\w\\.-]{2,4}$"},{caption:"charOnly",id:"^[a-zA-Z]*$"},{caption:"words",id:"^[\\w ]*$"},{caption:"integer",id:"^-?\\d\\d*$"},{caption:"positiveInteger",id:"^\\d\\d*$"},{caption:"number",id:"^-?(\\d\\d*\\.\\d*$)|(^-?\\d\\d*$)|(^-?\\.\\d\\d*$)"},{caption:"filepath",id:"([\\/]?[\\w_]+)+\\.\\w{1,9}$"},{caption:"URL",id:"^(http|https|ftp)\\:\\/\\/[\\w\\-\\_\\.]+[\\w\\-\\_](:[\\w]*)?\\/?([\\w\\-\\._\\?\\,\\'\\/\\\\\\+&amp;%\\$#\\=~])*$"},{caption:"color",id:"^\\#[0-9A-Fa-f]{6}$"},{caption:"HH:MM",id:"^(([0-1][0-9])|([2][0-3])):([0-5][0-9])$"},{caption:"HH:MM:SS",id:"^(([0-1][0-9])|([2][0-3])):([0-5][0-9])\\:([0-5][0-9])$"},{caption:"YYYY-MM-DD",id:"^([0-9]{4})\\-(([0][0-9])|([1][0-2]))\\-([0-3][0-9])$"},{caption:"DD/MM/YYYY",id:"^(([0-2][0-9])|([3][0-1]))/(([0][0-9])|([1][0-2]))/([0-9]{4})$"}]},mask:{action:function(value){var ns=this,b=ns.box;if(value){ns.$MaskFormat=function(ns,v){var m=ns._maskMap,a=[],r=/[A-Za-z0-9]/;_.arr.each(v.split(""),function(o,i){a.push(m[o]||(r.test(o)?"":"\\")+o)});return"^"+a.join("")+"$"}(b,value);ns.$Mask=function(ns,v){var m=ns._maskMap,a=[],s=ns._maskSpace;_.arr.each(v.split(""),function(o,i){a.push(m[o]?s:o)});return a.join("")}(b,value);ns.boxing()._setCtrlValue(ns.$Mask)}else{delete ns.$MaskFormat;delete ns.$Mask}}},value:"",width:120,height:22,disabled:{ini:false,action:function(v){this.getRoot().css("opacity",v?0.5:1);this.getSubNode("INPUT").attr("disabled",v)}},readonly:{ini:false,action:function(v){this.getSubNode("INPUT").attr("readonly",v).css("cursor",v?"default":"")}},type:{ini:"text",listbox:["text","password"],action:function(value){this.getSubNode("INPUT").attr("type",value)}},multiLines:{ini:false,action:function(value){this.boxing().refresh()}},tipsBinder:{ini:"",set:function(value){if(value["linb.UIProfile"]){value=value.$linbid}if(value["linb.UI"]&&(value=value.get(0))){value=value.$linbid}this.properties.tipsBinder=value+""}}},EventHandlers:{onFocus:function(profile){},onBlur:function(profile){},onChange:function(profile,value){},beforeFormatCheck:function(profile,value){},beforeFormatMark:function(profile,formatErr){}},_prepareData:function(profile){var d=arguments.callee.upper.call(this,profile);d.cursor=d.readonly?"default":"";d._type=d.type||"";if(linb.browser.kde){d._css="resize:none;"}return d},_dynamicTemplate:function(profile){var properties=profile.properties,t,hash=profile._exhash="$multiLines:"+properties.multiLines,template=profile.box.getTemplate(hash);properties.$UIvalue=properties.value;if(!template){template=_.clone(profile.box.getTemplate());if(properties.multiLines){t=template.FRAME.BORDER.BOX.WRAP.INPUT;t.tagName="textarea";delete t.type}profile.box.setTemplate(template,hash)}profile.template=template},RenderTrigger:function(){var ns=this,p=ns.properties;_.asyRun(function(){ns.boxing()._setTB(1)});ns.getSubNode("WRAP").$firfox2();if(p.readonly){ns.boxing().setReadonly(true,true)}if(p.tipsBinder){ns.boxing().setTipsBinder(p.tipsBinder,true)}var ie=linb.browser.ie,src=ns.getSubNode("INPUT").get(0),b=ns.box,f=function(o){if(ie&&("propertyName" in o)&&o.propertyName!="value"){return }b._asyCheck(ns)};if(ie){src.attachEvent("onpropertychange",f);src.attachEvent("ondrop",f);ns.$ondestory=function(){var ns=this,src=ns.getSubNode("INPUT").get(0);src.detachEvent("onpropertychange",f);src.detachEvent("ondrop",f);src=null}}else{src.addEventListener("input",f,false);if(linb.browser.gek){src.addEventListener("dragdrop",f,false)}ns.$ondestory=function(){var ns=this,src=ns.getSubNode("INPUT").get(0);src.removeEventListener("input",f,false);if(linb.browser.gek){src.removeEventListener("dragdrop",f,false)}src=null}}src=null},LayoutTrigger:function(){var p=this.properties;if(p.mask){this.boxing().setMask(p.mask,true)}},_changeMask:function(profile,src,v,dir){var ns=this,p=profile.properties,map=ns._maskMap,ms=ns._maskSpace,maskTxt=p.mask,maskStr=profile.$Mask,input=linb(src),caret=input.caret();if(dir===false&&caret[0]==caret[1]&&caret[0]>0){input.caret(caret[0]-1,caret[0])}if(dir===undefined&&caret[0]==caret[1]){input.caret(caret[0],caret[0]+1)}if(dir===true){if(maskStr.charAt(caret[0])!=ms){var from=caret[0]+maskStr.substr(caret[0],maskStr.length).indexOf(ms);input.caret(from,Math.max(caret[1],from))}}var caret=input.caret(),value=src.value,reg=ns._maskMap[p.mask.charAt(caret[0])],i,t;if(reg&&new RegExp("^"+reg+"$").test(v)||v==""){t=value;if(caret[0]!=caret[1]){t=t.substr(0,caret[0])+maskStr.substr(caret[0],caret[1]-caret[0])+t.substr(caret[1],t.length-caret[1])}if(v){t=t.substr(0,caret[0])+v+t.substr(caret[0]+1,t.length-caret[0]-1)}var a=[];_.arr.each(maskTxt.split(""),function(o,i){a.push((new RegExp("^"+(map[o]?map[o]:"\\"+o)+"$").test(t.charAt(i)))?t.charAt(i):maskStr.charAt(i))});if(dir===true){v=maskStr.substr(caret[0]+1,value.length-caret[0]-1);i=v.indexOf(ms);i=caret[0]+(i==-1?0:i)+1}else{i=caret[0]}if(linb.browser.opr){if(dir===undefined){_.arr.insertAny(a,ms,i)}if(dir===false){_.arr.insertAny(a,ms,i++)}}profile.boxing().setUIValue(src.value=a.join(""));ns._setCaret(profile,src,i)}},_setCaret:function(profile,src,pos){if(profile.properties.mask){if(typeof pos!="number"){pos=src.value.indexOf(this._maskSpace)}linb(src).caret(pos,pos)}},_checkValid:function(profile,value){var p=profile.properties,vf1=(p.mask&&profile.$MaskFormat),vf2=p.valueFormat||profile.$valueFormat;if((profile.beforeFormatCheck&&(profile.boxing().beforeFormatCheck(profile,value)===false))||(vf1&&typeof vf1=="string"&&!(new RegExp(vf1)).test((value===0?"0":value)||""))||(vf2&&typeof vf2=="string"&&!(new RegExp(vf2)).test((value===0?"0":value)||""))){profile.inValid=2;return false}profile.inValid=3;return true},_asyCheck:function(profile){_.resetRun(profile.$linbid+":asycheck",function(){var src=profile.getSubNode("INPUT").get(0);if(!src){return }if(profile.onChange){if(profile.$$$v!==src.value){profile.boxing().onChange(profile,profile.$$$v=src.value)}}if(profile.properties.mask){if(src.value.length!=profile.$Mask.length){profile.box._changeMask(profile,src,"",true)}}})},_onresize:function(profile,width,height){var $hborder=1,$vborder=1,toff=linb.UI.$getCSSValue("linb-input-input","paddingTop"),loff=linb.UI.$getCSSValue("linb-input-input","paddingTop");var t=profile.properties,o=profile.getSubNode("BOX"),v1=profile.getSubNode("INPUT"),region,ww=width,hh=height,left=Math.max(0,(t.$b_lw||0)-$hborder),top=Math.max(0,(t.$b_tw||0)-$vborder);if(null!==ww){ww-=Math.max($hborder*2,(t.$b_lw||0)+(t.$b_rw||0));if(linb.browser.ie6){ww=(parseInt(ww/2))*2}}if(null!==hh){hh-=Math.max($vborder*2,(t.$b_lw||0)+(t.$b_rw||0));if(linb.browser.ie6){hh=(parseInt(hh/2))*2}if(linb.browser.ie6&&null===width){o.ieRemedy()}}region={left:left,top:top,width:ww,height:hh};o.cssRegion(region);if(ww||hh){v1.cssSize({width:ww?(ww-loff):null,height:hh?(hh-toff):null})}if((profile.$border||profile.$shadow||profile.$resizer)&&linb.browser.ie){o.ieRemedy()}}}});Class("linb.UI.ComboInput","linb.UI.Input",{Instance:{_getCtrlValue:function(){return this.get(0).properties.$UIvalue},_setCtrlValue:function(value,flag){var me=arguments.callee,r1=me._r1||(me._r1=/\</),r2=me._r2||(me._r2=/\<\/?[^>]+\>/g);return this.each(function(profile){if(!profile.$typeOK){profile.box._iniType(profile)}var o=profile.getSubNode("INPUT"),type=profile.properties.type;value=flag?value:profile.boxing().getShowValue(value);if(type!=="none"&&!profile.properties.multiLines&&typeof value=="string"&&r1.test(value)){value=value.replace(r2,"")}o.attr("value",value||"");if(type=="colorpicker"){o.css({backgroundColor:value,color:linb.UI.ColorPicker.getTextColor(value)})}})},_compareValue:function(v1,v2){var profile=this.get(0),t;if(t=profile.CF.compareValue||profile.$compareValue){return t(profile,v1,v2)}return v1===v2},getShowValue:function(value){var profile=this.get(0),pro=profile.properties,v,t;if(!_.isDefined(value)){value=pro.$UIvalue}if(t=profile.CF.getShowValue||profile.$getShowValue){v=t(profile,value)}else{if("listbox"==pro.type){if((v=_.arr.subIndexOf(pro.items,"id",value))!=-1){v=pro.items[v].caption;v=v.charAt(0)=="$"?linb.getRes(v.slice(1)):v}else{v=""}}else{v=profile.$showValue}}v=v||((value||value===0)?String(value):"");if(v!==value){profile.$caption=v}else{delete profile.$caption}return v},_getEditValue:function(value){var profile=this.get(0),pro=profile.properties,t;if(t=profile.CF.getEditValue||profile.$getEditValue){return t(profile,value)}return value},_fromEditValue:function(value){var profile=this.get(0),pro=profile.properties,t;if(t=profile.CF.fromEditValue||profile.$fromEditValue){return t(profile,value)}return value},_cache:function(){var profile=this.get(0),drop=profile.$drop;if(drop){if(linb.browser.opr){drop.getRoot().css("display","none")}_.asyRun(function(){profile.getSubNode("POOL").append(drop.getRoot())})}delete profile.$poplink},clearPopCache:function(){var profile=this.get(0);if(profile.renderId){profile.getSubNode("POOL").empty()}delete profile.$drop;return this},getUploadObj:function(){var profile=this.get(0);if(profile.renderId&&profile.properties.type=="upload"){var o=profile.getSubNode("UPLOAD").get(0);if(!o.value){return null}var c=o.cloneNode(false);linb.setNodeData(c.$linbid=o.$linbid,"element",c);c.onclick=o.onclick;c.onchange=o.onchange;if(linb.browser.ie){o.removeAttribute("$linbid")}else{delete o.$linbid}o.id=o.onclick=o.onchange=null;delete profile.$_domid[profile.keys.UPLOAD];linb([o]).addPrev(c).remove(false);c=null;this.setUIValue(this.getValue());return o}},resetValue:function(value){this.each(function(p){if(p.properties.type=="upload"){p.getSubNode("UPLOAD").attr("value","")}});return arguments.callee.upper.apply(this,arguments)},_drop:function(e,src){return this.each(function(profile){var pro=profile.properties,type=pro.type;if(pro.disabled){return }if(type=="upload"||type=="none"||type=="spin"){return }if(profile.$poplink){return }var o,v,box=profile.boxing(),main=profile.getRoot(),pos=main.offset(),size=main.cssSize();size.width+=2;pos.top+=main.offsetHeight();if((profile.beoforeComboPop&&false===box.beoforeComboPop(profile,pos,e,src))||type=="getter"||type=="cmdbox"||type=="popbox"){return }var cachekey;switch(type){case"timepicker":case"datepicker":case"colorpicker":cachekey=type;break;default:if(pro.listKey){if(typeof _.get(linb.$cache,["UIDATA",pro.listKey])=="function"){profile.$drop=cachekey=null}else{cachekey=pro.listKey}}else{cachekey=profile.$linbid}}if(cachekey){_.filter(profile.box.$drop,function(o){return !!o.renderId});profile.$drop=profile.box.$drop[cachekey]}if(!profile.$drop){switch(type){case"combobox":case"listbox":case"helpinput":linb.SC("linb.UI.List");o=linb.create("List").render();o.host(profile).setItems(_.copy(pro.items)).setListKey(pro.listKey||"").adjustSize();o.beforeUIValueSet(function(p,ovalue,value){var b2=this.boxing();if(type=="combobox"){var item=p.queryItems(p.properties.items,function(o){return o.id==value},false,true);if(item.length){value=item[0].caption}}b2.setUIValue(value).activate()._cache()});break;case"timepicker":linb.SC("linb.UI.TimePicker");o=linb.create("TimePicker").render();o.host(profile);o.beforeClose(function(){this.boxing().activate()._cache();return false});o.beforeUIValueSet(function(p,o,v){this.boxing().setUIValue(v).activate()._cache()});break;case"datepicker":linb.SC("linb.UI.DatePicker");o=linb.create("DatePicker").render();o.host(profile);o.beforeClose(function(){this.boxing().activate()._cache();return false});o.beforeUIValueSet(function(p,o,v){this.boxing().setUIValue(String(v.getTime())).activate()._cache()});break;case"colorpicker":linb.SC("linb.UI.ColorPicker");o=linb.create("ColorPicker").render();o.host(profile);o.beforeClose(function(){this.boxing().activate()._cache();return false});o.beforeUIValueSet(function(p,o,v){this.boxing().setUIValue("#"+v).activate()._cache()});break}profile.$drop=o.get(0);if(cachekey){profile.box.$drop[cachekey]=profile.$drop}}o=profile.$drop.boxing();o.host(profile);switch(type){case"combobox":case"listbox":case"helpinput":o.setWidth(profile.getRoot().width());case"timepicker":o.setValue(profile.properties.$UIvalue,true);break;case"datepicker":var t=profile.$drop.properties;t.WEEK_FIRST=pro.WEEK_FIRST;if(t=profile.properties.$UIvalue){o.setValue(new Date(parseInt(t)),true)}break;case"colorpicker":o.setValue(profile.properties.$UIvalue.replace("#",""),true);break}profile.$poplink=o.get(0);var node=o.reBoxing();node.popToTop(profile.getRoot());_.tryF(o.activate,[],o);node.setBlurTrigger(profile.key+":"+profile.$linbid,function(){box._cache()},null,profile.$linbid);linb.Event.keyboardHook("esc",0,0,0,function(){box._cache();box.activate();linb.Event.keyboardHook("esc")})})}},Initialize:function(){this.addTemplateKeys(["UPLOAD","BTN","TOP","MID","RBTN","R1","R1T","R1B","R2","R2T","R2B"]);var t=this.getTemplate();_.merge(t.FRAME.BORDER,{SBTN:{$order:5,style:"{_saveDisplay}",STOP:{},SMID:{}}},"all");t.FRAME.POOL={};t.className+=" {uploadClass}";this.setTemplate(t);this._adjustItems=linb.absList._adjustItems},Static:{_iniType:function(profile){var pro=profile.properties,value=pro.type;if(value=="listbox"||value=="upload"){profile.boxing().setReadonly(true)}if(value!="listbox"&&value!="combobox"&&value!="helpinput"){pro.items=[]}if(value=="timepicker"){var o=linb.SC("linb.UI.TimePicker");_.merge(profile,{$compareValue:null,$getShowValue:function(profile,value){return value?o._ensureValue(profile,value):""},$getEditValue:null,$fromEditValue:function(profile,value){return o._ensureValue(profile,value)}},"all");if(pro.value){pro.$UIvalue=pro.value=o._ensureValue(profile,pro.value)}}else{if(value=="datepicker"){var date=linb.Date;_.merge(profile,{$compareValue:function(p,a,b){return String(a)==String(b)},$getShowValue:function(profile,value){return value?date.getText(new Date(parseInt(value)),"ymd"):""},$getEditValue:function(profile,value){var v=new Date(parseInt(value));return value?(date.get(v,"m")+1)+"/"+date.get(v,"d")+"/"+date.get(v,"y"):""},$fromEditValue:function(profile,value){var v=linb.Date.parse(value);if(v){v=linb.Date.getTimSpanStart(v,"d",1)}return v?String(v.getTime()):"0"}},"all");var d=new Date(parseInt(pro.value)||0);pro.$UIvalue=pro.value=String(date.getTimSpanStart(d,"d",1).getTime())}else{delete profile.$compareValue;delete profile.$getShowValue;delete profile.$getEditValue;delete profile.$fromEditValue;if(_.isDate(pro.value)){pro.$UIvalue=pro.value=String(pro.value)}}}profile.$typeOK=true},$drop:{},Appearances:{POOL:{position:"absolute",left:0,top:0,width:0,height:0,display:"none",visibility:"hidden"},UPLOAD:{opacity:0,"*filter":"alpha(opacity=0)","z-index":"3",border:0,height:"100%",position:"absolute",top:0,right:0,cursor:"pointer","font-size":"12px",overflow:"hidden"},"UPLOAD-show INPUT":{color:"#777"},"RBTN,SBTN,BTN":{display:"block","z-index":"1",cursor:"pointer",width:"16px",height:"20px","font-size":0,"line-height":0,position:"relative","float":"right"},"SBTN,BTN,R1,R2":{"margin-top":"2px"},"R1, R2, BTN, SBTN, STOP, TOP, R1T, R2T, R1B, R2B, SMID,MID":{background:linb.UI.$bg("bg.gif")},"SBTN,BTN":{$order:1,"background-position":"left bottom"},"R1,R2":{$order:1,display:"block","font-size":0,"line-height":0,cursor:"pointer",width:"16px",position:"absolute",height:"50%","background-position":"left bottom","margin-top":"2px"},R1:{top:0},R2:{bottom:"-2px"},"BTN-mouseover, SBTN-mouseover, R1-mouseover, R2-mouseover":{$order:2,"background-position":"-16px bottom"},"BTN-mousedown, SBTN-mousedown, R1-mousedown, R2-mousedown":{$order:3,"background-position":"-32px bottom"},"STOP, TOP, R1T, R2T":{$order:1,cursor:"pointer",width:"16px","font-size":0,"line-height":0,position:"absolute",top:"-2px",left:0,height:"4px","background-position":"left -104px"},"BTN-mouseover TOP,SBTN-mouseover STOP, R1-mouseover R1T, R2-mouseover R2T":{$order:2,"background-position":"-16px -104px"},"BTN-mousedown TOP,SBTN-mousedown STOP, R1-mousedown R1T, R2-mousedown R2T":{$order:3,"background-position":"-32px -104px"},"R1B,R2B":{cursor:"pointer",width:"16px","font-size":0,"line-height":0,position:"absolute",left:0,top:"50%","margin-top":"-4px",height:"6px","z-index":2},R1B:{$order:1,"background-position":"-14px -36px"},R2B:{$order:1,"background-position":"left -5px"},"SMID,MID":{$order:2,cursor:"pointer",width:"16px","font-size":0,"line-height":0,position:"absolute",bottom:"0",left:0,height:"16px","background-position":"0 0"},SMID:{$order:3,"background-position":"-14px -16px"},".setting-linb-comboinput":{"border-style":"solid","border-top-width":"1px","border-bottom-width":"1px","border-left-width":"1px","border-right-width":"1px"}},Behaviors:{HoverEffected:{BOX:"BOX",BTN:"BTN",SBTN:"SBTN",R1:"R1",R2:"R2"},ClickEffected:{BTN:"BTN",SBTN:"SBTN",R1:"R1",R2:"R2"},UPLOAD:{onClick:function(profile,e,src){if(profile.onFileDlgOpen){profile.boxing().onFileDlgOpen(profile,src)}},onChange:function(profile,e,src){profile.boxing().setUIValue(linb.use(src).get(0).value+"")}},BTN:{onClick:function(profile,e,src){profile.boxing()._drop(e,src)}},SBTN:{onClick:function(profile,e,src){if(profile.onSave){profile.boxing().onSave(profile,src)}}},INPUT:{onChange:function(profile,e,src){if(profile.$_onedit||profile.$_inner){return }var o=profile.inValid,instance=profile.boxing(),v=instance._fromEditValue(linb.use(src).get(0).value),uiv=profile.properties.$UIvalue;if(!instance._compareValue(uiv,v)){profile.$_inner=1;delete profile.$_inner;if(v===null){instance._setCtrlValue(uiv)}else{instance.setUIValue(v);profile.properties.$UIvalue=v;if(o!==profile.inValid){if(profile.renderId){instance._setDirtyMark()}}}}},onKeyup:function(profile,e,src){var p=profile.properties;if(p.dynCheck){var value=linb.use(src).get(0).value;if(p.$UIvalue!=value){profile.box._checkValid(profile,value)}profile.boxing()._setDirtyMark()}},onFocus:function(profile,e,src){var p=profile.properties,uiv=p.$UIvalue;if(p.disabled){return false}var instance=profile.boxing(),v=instance._getEditValue(uiv);if(v!==uiv){profile.$_onedit=true;linb.use(src).get(0).value=v;delete profile.$_onedit}if(profile.onFocus){profile.boxing().onFocus(profile)}profile.getSubNode("BORDER").tagClass("-focus");profile.boxing()._setTB(3)},onBlur:function(profile,e,src){var p=profile.properties,instance=profile.boxing(),uiv=p.$UIvalue,v=instance._fromEditValue(linb.use(src).get(0).value);if(p.disabled){return false}if(profile.onFocus){instance.onFocus(profile)}profile.getSubNode("BORDER").tagClass("-focus",false);if(instance._compareValue(p.$UIvalue,v)){profile.box._checkValid(profile,v);instance._setCtrlValue(uiv)}instance._setDirtyMark()},onKeydown:function(profile,e,src){var prop=profile.properties,m=prop.multiLines,key=linb.Event.getKey(e);if(key[0]=="enter"&&(!m||key[3])){linb.use(src).onChange()}if(key[0]=="down"||key[0]=="up"){if(prop.type=="spin"){profile.box._spin(profile,key[0]=="up");return false}if(key[1]&&prop.type){profile.boxing()._drop(e,src);return false}}},onKeyup:function(profile,e,src){var prop=profile.properties,key=linb.Event.getKey(e);if(key[0]=="down"||key[0]=="up"){if(prop.type=="spin"){linb.Thread.abort(profile.$linbid+":spin");return false}}},onClick:function(profile,e,src){if(src.readOnly){profile.boxing()._drop(e,src)}}},R1:{onMousedown:function(profile){profile.box._spin(profile,true)},onMouseout:function(profile){linb.Thread.abort(profile.$linbid+":spin")},onMouseup:function(profile){linb.Thread.abort(profile.$linbid+":spin")}},R2:{onMousedown:function(profile){profile.box._spin(profile,false)},onMouseout:function(profile){linb.Thread.abort(profile.$linbid+":spin")},onMouseup:function(profile){linb.Thread.abort(profile.$linbid+":spin")}}},EventHandlers:{onFileDlgOpen:function(profile,node){},onSave:function(profile,node){},beoforeComboPop:function(profile,pos,e,src){}},_posMap:{none:"",combobox:"left top",listbox:"left top",upload:"-16px top",getter:"left -31px",helpinput:"-16px -46px",cmdbox:"left -16px",popbox:"left -46px",timepicker:"left -60px",datepicker:"left -75px",colorpicker:"-16px -60px"},DataModel:{listKey:{set:function(value){var t=linb.UI.getCachedData(value),o=this;o.boxing().setItems(t?t:o.properties.items);o.properties.listKey=value}},items:{ini:[],set:function(value){var o=this;o.properties.items=_.copy(value);if(o.renderId){o.boxing().setValue(null,true);o.SubSerialIdMapItem={};o.ItemIdMapSubSerialId={};value=o.box._adjustItems(value);o.box._prepareItems(o,value);o.boxing().clearPopCache()}}},image:{action:function(value){this.getSubNode("MID").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){this.getSubNode("MID").css("backgroundPosition",value)}},readonly:{ini:false,action:function(v){if(!v&&this.properties.type=="listbox"){return }this.getSubNode("INPUT").css("cursor",v?"pointer":"default").attr("readonly",v)}},type:{ini:"combobox",listbox:_.toArr("none,combobox,listbox,upload,getter,helpinput,cmdbox,popbox,timepicker,datepicker,colorpicker,spin"),set:function(value){var pro=this;pro.properties.type=value;pro.box._iniType(pro);if(pro.renderId){pro.boxing().refresh()}}},scale:2,increment:0.01,min:0,max:1,saveBtn:{ini:false,action:function(v){this.boxing().refresh()}}},RenderTrigger:function(){var self=this,instance=self.boxing(),p=self.properties;self.box._iniType(self);if(p.readonly){instance.setReadonly(true,true)}},_spin:function(profile,flag){var id=profile.$linbid+":spin";if(linb.Thread.isAlive(id)){return }var prop=profile.properties,off=prop.increment*(flag?1:-1),task={delay:300},fun=function(){profile.boxing().setUIValue(String((+prop.$UIvalue||0)+off));task.delay*=0.9};task.task=fun;linb.Thread(id,[task],500,null,fun,null,true).start()},_dynamicTemplate:function(profile){var properties=profile.properties,hash=profile._exhash="$multiLines:"+properties.multiLines+";type:"+properties.type+";",template=profile.box.getTemplate(hash);properties.$UIvalue=properties.value;if(!template){template=_.clone(profile.box.getTemplate());var t=template.FRAME.BORDER;if(properties.multiLines){t.BOX.WRAP.INPUT.tagName="textarea";delete t.BOX.WRAP.INPUT.type}switch(properties.type){case"spin":t.RBTN={$order:5,style:"{rDisplay}",R1:{R1T:{},R1B:{}},R2:{R2T:{},R2B:{}}};break;case"none":break;case"upload":t.UPLOAD={$order:2,tagName:"input",type:"file",size:"1"};default:t.BTN={$order:4,style:"{_popbtnDisplay}",TOP:{},MID:{style:"{_btnStyle}"}}}profile.box.setTemplate(template,hash)}profile.template=template},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),map=profile.box._posMap;if(map[data.type]){data._btnStyle=data.image?("background: url("+data.image+")"+(data.imagePos||"")):("background-position:"+map[data.type])}if(data.type=="upload"){data.uploadClass=profile.getClass("UPLOAD","-show")}data._type="text";data._saveDisplay=data.saveBtn?"":"display:none";data._popbtnDisplay=data.type!="none"?"":"display:none";return data},_ensureValue:function(profile,value){var me=arguments.callee,reg=me._reg||(me._reg=/^#[\w]{6}$/),prop=profile.properties;switch(profile.properties.type){case"datepicker":return(value.constructor==Date?value.getTime():value)+"";case"colorpicker":return"#"+linb.UI.ColorPicker._ensureValue(null,value);case"timepicker":return linb.UI.TimePicker._ensureValue(null,value);case"spin":var n=Math.pow(10,prop.scale);value=+value||0;value=Math.ceil((value-3e-13)*n)/n;return String(value>prop.max?prop.max:value<prop.min?prop.min:value);default:return typeof value=="string"?value:(value||value===0)?String(value):""}},_onresize:function(profile,width,height){var $hborder=1,$vborder=1,toff=linb.UI.$getCSSValue("linb-comboinput-input","paddingTop"),loff=linb.UI.$getCSSValue("linb-comboinput-input","paddingLeft");var t=profile.properties,o=profile.getSubNode("BOX"),px="px",f=function(k){return k?profile.getSubNode(k).get(0):null},v1=f("INPUT"),save=f(t.saveBtn?"SBTN":null),btn=f(t.type=="spin"?"RBTN":t.type=="none"?null:"BTN"),ww=width,hh=height,left=Math.max(0,(t.$b_lw||0)-$hborder),top=Math.max(0,(t.$b_tw||0)-$vborder);if(null!==ww){ww-=Math.max($hborder*2,(t.$b_lw||0)+(t.$b_rw||0));ww-=((save?save.offsetWidth:0)+(btn?btn.offsetWidth:0));if(linb.browser.ie6){ww=(parseInt(ww/2))*2}}if(null!==hh){hh-=Math.max($vborder*2,(t.$b_lw||0)+(t.$b_rw||0));if(linb.browser.ie6){hh=(parseInt(hh/2))*2}if(linb.browser.ie6&&null===width){o.ieRemedy()}}if(null!==ww){v1.style.width=(ww-loff)+px}if(null!==hh){v1.style.height=(hh-toff)+px}if(height-2>0){if(save){save.style.height=(height-2)+px}if(btn){btn.style.height=(height-2)+px}}if(t.type=="spin"){if(height/2-2>0){height=(height/2-2)+px;f("R1").style.height=height;f("R2").style.height=height}}o.cssRegion({left:left,top:top,width:ww,height:hh});if((profile.$border||profile.$shadow||profile.$resizer)&&linb.browser.ie){o.ieRemedy()}}}});Class("linb.UI.RichEditor",["linb.UI","linb.absValue"],{Initialize:function(){this.addTemplateKeys(["TOOLBARBTN"])},Instance:{_setCtrlValue:function(value){if(_.isNull(value)||!_.isDefined(value)){value=""}return this.each(function(profile){var doc=profile.$doc,body=doc&&(doc.body||doc.documentElement);if(body){body.innerHTML=value}})},_getCtrlValue:function(){var profile=this.get(0),doc=profile.$doc,body=doc&&(doc.body||doc.documentElement);if(body){return body.innerHTML}return""}},Static:{Templates:{tagName:"div",style:"{_style}",EDITOR:{tagName:"div"},POOL:{}},DataModel:{value:"",width:400,height:300,cmdList:{ini:"font1;font2;align;list;font4;font3;insert;clear;html",action:function(v){var ns=this;ns.box._iniToolBar(ns)}},disabled:{ini:false,action:function(v){var ns=this;if(ns.$toolbar){ns.$toolbar.boxing().setDisabled(v)}if(ns.$doc){ns.$doc.designMode=v?"off":"on"}}}},Appearances:{POOL:{position:"absolute",display:"none"},TOOLBARBTN:{background:linb.UI.$bg("toolbar.gif","no-repeat")},EDITOR:{position:"absolute",display:"block",left:0,top:0,width:"100%",height:"100%",padding:0,margin:0,border:"1px solid #648CB4","border-top":"none","background-color":"#fff","z-index":"0"}},Behaviors:{onSize:linb.UI.$onSize},$cmds:{font1:[{id:"bold",command:"Bold",statusButton:true,imagePos:"-36px 0"},{id:"italic",command:"Italic",statusButton:true,imagePos:"-108px 0"},{id:"underline",command:"Underline",statusButton:true,imagePos:"-324px 0"},{id:"strikethrough",command:"strikeThrough",statusButton:true,imagePos:"-252px 0"}],font2:[{id:"subscript",command:"subscript",statusButton:true,imagePos:"-270px 0"},{id:"superscript",command:"superscript",statusButton:true,imagePos:"-288px 0"}],font3:[{id:"forecolor",command:"custom",imagePos:"0 0"},{id:"bgcolor",command:"custom",imagePos:"-18px 0"}],font4:[{id:"fontsize",command:"custom",caption:"$editor.fontsize",dropButton:true},{id:"fontname",command:"custom",caption:"$editor.fontname",dropButton:true},{id:"formatblock",command:"custom",caption:"$editor.formatblock",dropButton:true}],align:[{id:"left",command:"justifyleft",imagePos:"-144px 0"},{id:"center",command:"justifycenter",imagePos:"-54px 0"},{id:"right",command:"justifyright",imagePos:"-216px 0"},{id:"justify",command:"justifyfull",imagePos:"-126px 0"}],list:[{id:"indent",command:"indent",imagePos:"-90px 0"},{id:"outdent",command:"outdent",imagePos:"-180px 0"},{id:"ol",command:"insertorderedlist",imagePos:"-162px 0"},{id:"ul",command:"insertunorderedlist",imagePos:"-306px 0"}],insert:[{id:"hr",command:"insertHorizontalRule",imagePos:"-72px 0"},{id:"insertimage",command:"custom",imagePos:"-342px 0"},{id:"createlink",command:"custom",imagePos:"-360px 0"},{id:"unlink",command:"unlink",imagePos:"-378px 0"}],clear:[{id:"removeformat",command:"removeformat",imagePos:"-198px 0"}],html:[{id:"html",command:"custom",imagePos:"-234px 0"}]},_updateToolbar:function(domId,clear){var profile=linb.$cache.profileMap[domId],toolbar;if(profile&&(toolbar=profile.$toolbar)){var doc=profile.$doc,bold=clear?false:doc.queryCommandState("bold"),italic=clear?false:doc.queryCommandState("italic"),underline=clear?false:doc.queryCommandState("underline"),strikethrough=clear?false:doc.queryCommandState("strikethrough"),subscript=clear?false:doc.queryCommandState("subscript"),superscript=clear?false:doc.queryCommandState("superscript"),tb=toolbar.boxing();tb.updateItem("bold",{value:bold});tb.updateItem("italic",{value:italic});tb.updateItem("underline",{value:underline});tb.updateItem("strikethrough",{value:strikethrough});tb.updateItem("subscript",{value:subscript});tb.updateItem("superscript",{value:superscript});doc=null}},RenderTrigger:function(){var self=this;self.box._iniToolBar(self);if(!self.$inDesign){var div=self.getSubNode("EDITOR").get(0),domId=self.$domId,id=div.id,iframe=document.createElement("iframe"),event=self._event=function(e){_.resetRun("RichEditor:"+domId,function(){linb.UI.RichEditor._updateToolbar(domId)},100);if(e.type=="mousedown"){linb.doc.onMousedown(true)}},doc,checkF=function(){if(frames[id].document!=doc||doc.readyState=="complete"){self.$win=frames[id];self.$doc=doc=frames[id].document;doc.open();doc.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css">body{border:0;margin:0;padding:0;margin:0;cursor:text;background:#fff;color:#000;padding:3px;}p{margin:0;padding:0;} div{margin:0;padding:0;}</style></head><body>'+self.properties.value+"</body></html>");doc.close();doc.designMode=self.properties.disabled?"off":"on";try{doc.execCommand("styleWithCSS",0,false)}catch(e){try{doc.execCommand("useCSS",0,true)}catch(e){}}if(linb.browser.ie){doc.attachEvent("onmousedown",event);doc.attachEvent("ondblclick",event);doc.attachEvent("onclick",event);doc.attachEvent("onkeyup",event);doc.attachEvent("onkeydown",event);self.$beforeDestroy=function(){var doc=this.$doc,event=this._event;doc.detachEvent("onmousedown",event);doc.detachEvent("ondblclick",event);doc.detachEvent("onclick",event);doc.detachEvent("onkeyup",event);doc.detachEvent("onkeydown",event);doc=null}}else{doc.addEventListener("mousedown",event,false);doc.addEventListener("dblclick",event,false);doc.addEventListener("click",event,false);doc.addEventListener("keyup",event,false);if(linb.browser.gek){doc.addEventListener("keypress",event,false)}else{doc.addEventListener("keydown",event,false)}self.$beforeDestroy=function(){var doc=this.$doc,event=this._event;if(linb.browser.gek){delete frames[this.$frameId]}doc.removeEventListener("mousedown",event,false);doc.removeEventListener("dblclick",event,false);doc.removeEventListener("click",event,false);doc.removeEventListener("keyup",event,false);if(linb.browser.gek){doc.removeEventListener("keypress",event,false)}else{doc.removeEventListener("keydown",event,false)}doc=null}}iframe.style.visibility="";if(self.properties.disabled){self.boxing().setDisabled(true,true)}event=self=checkF=doc=null;return false}};self.$frameId=id;iframe.id=iframe.name=id;iframe.className=div.className;iframe.src="javascript:false;";iframe.frameBorder=0;iframe.border=0;iframe.marginWidth=0;iframe.marginHeight=0;iframe.tabIndex=-1;iframe.allowTransparency="allowtransparency";iframe.style.visibility="hidden";linb.$cache.domPurgeData[iframe.$linbid=div.$linbid].element=iframe;div.parentNode.replaceChild(iframe,div);doc=frames[frames.length-1].document;linb.Thread.repeat(checkF,50);div=null}},_clearPool:function(profile){profile.getSubNode("POOL").empty();profile.$colorPicker=profile.$fontsizeList=profile.$fontnameList=profile.$formatblockList=profile.$htmlEditor=null},_iniToolBar:function(profile){var self=profile,pro=self.properties;if(self.$toolbar){self.$toolbar.boxing().destroy()}var t,v,o,items=[],imageClass=self.getClass("TOOLBARBTN"),arr=pro.cmdList.split(";"),h={};_.arr.each(arr,function(i){if((o=self.box.$cmds[i])&&!h[i]){h[i]=1;items.push({id:i,sub:o});_.arr.each(o,function(v){if(v.imagePos){v.imageClass=imageClass}v.tips=linb.wrapRes("editor."+v.id)})}});self.getRoot().prepend(t=new linb.UI.ToolBar({handler:false,items:items,disabled:pro.disabled}));t.render(true);t=self._$tb=t.get(0);t.onClick=self.box._toolbarclick;v=self._$composed={};v[t.$linbid]=t;self.$toolbar=t;t.$hostage=self;linb.UI.$tryResize(profile,pro.width,pro.height,true)},_toolbarclick:function(profile,item,group,e,src){var editor=profile.$hostage;if(!editor.$doc){return }var pro=editor.properties;editor.$win.focus();if(item.command=="custom"){var cmd=item.id,o,_clear,node,items,items2;switch(cmd){case"forecolor":case"bgcolor":if(!editor.$colorPicker){editor.$colorPicker=(new linb.UI.ColorPicker({barDisplay:false})).render(true)}o=editor.$colorPicker;break;case"fontsize":case"fontname":case"formatblock":if(editor.$lang!=linb.getLang()){editor.box._clearPool(editor)}editor.$lang=linb.getLang();if(cmd=="fontsize"){if(!editor.$fontsizeList){items=linb.getRes("editor.fontsizeList");items=items.split(";");items2=[];var t;_.arr.each(items,function(o){o=o.split(",");t=o[0]=="..."?"1":o[0];items2.push({id:o[0],caption:'<font size="'+o[0]+'">'+o[1]+"</font>"})});editor.$fontsizeList=(new linb.UI.List({height:"auto",items:items2,width:150})).render(true)}o=editor.$fontsizeList}else{if(cmd=="fontname"){if(!editor.$fontnameList){items=linb.getRes("editor.fontnameList");items=items.split(";");items2=[];var t;_.arr.each(items,function(o){t=o=="..."?"":o;items2.push({id:o,caption:'<span style="font-family:'+o+'">'+o+"</span>"})});editor.$fontnameList=(new linb.UI.List({height:"auto",items:items2})).render(true)}o=editor.$fontnameList}else{if(cmd=="formatblock"){if(!editor.$formatblockList){items=linb.getRes("editor.formatblockList");items=items.split(";");items2=[];var t;_.arr.each(items,function(o){o=o.split(",");t=o[0]=="..."?"span":o[0];items2.push({id:o[0],caption:"<"+t+' style="display:inline;padding:0;margin:0">'+o[1]+"</"+t+">"})});editor.$formatblockList=(new linb.UI.List({height:"auto",items:items2})).render(true)}o=editor.$formatblockList}}}break;case"html":if(!editor.$htmlEditor){editor.$htmlEditor=new linb.UI.Input({multiLines:true,width:400,height:300,resizer:true})}o=editor.$htmlEditor;break}if(o){_clear=function(){o.beforeUIValueSet(null);editor.getSubNode("POOL").append(o.getRoot());node.setBlurTrigger(editor.$linbid);linb.Event.keyboardHook("esc");_.asyRun(function(){editor.$win.focus()})};o.setValue("",true);node=o.reBoxing();node.popToTop(src);_.tryF(o.activate,[],o);node.setBlurTrigger(editor.$linbid,function(){if(o==editor.$htmlEditor){o.setUIValue(o._getCtrlValue())}_clear()});linb.Event.keyboardHook("esc",0,0,0,function(){_clear()})}switch(cmd){case"forecolor":case"bgcolor":o.beforeUIValueSet(function(p,o,v){_clear();var doc=editor.$doc;if(cmd=="bgcolor"&&linb.browser.gek){doc.execCommand("useCSS",0,false);doc.execCommand("hilitecolor",false,"#"+v);doc.execCommand("useCSS",0,true)}else{if(cmd=="bgcolor"){cmd=linb.browser.opr?"hilitecolor":"backcolor"}doc.execCommand(cmd,false,linb.browser.kde?("#"+v):v)}doc=null;return false});break;case"fontsize":case"fontname":case"formatblock":o.beforeUIValueSet(function(p,o,v){_clear();if(linb.browser.ie&&(v=="..."||cmd=="formatblock")){var selection=editor.$doc.selection,range=selection?selection.createRange():null;if(range&&range.parentElement().ownerDocument!=editor.$doc){range=selection=null}}var f=function(cmd,v){var doc=editor.$doc;if(range){editor.$win.focus();if(cmd=="formatblock"&&v){var p=range.parentElement(),html;if(p.ownerDocument==doc){if(/^\s*</.test(range.htmlText)){range.collapse(true);p=range.parentElement();if(p.tagName=="BODY"){html=p.innerHTML;p.innerHTML="<"+v+">"+html+"</"+v+">"}else{html=p.outerHTML;html=html.replace(/\<[\w]+/,"<"+v).replace(/[\w]+\>$/,v+">");p.outerHTML=html}}else{range.pasteHTML("<"+v+">"+range.htmlText+"</"+v+">")}}p=null}range.select();selection=range=null}doc.execCommand(cmd,false,v);doc=null};if(v=="..."){var str=linb.getRes("editor."+cmd);linb.UI.Dialog.prompt(str,str,"",function(v){if(v){f(cmd,v)}},function(){if(linb.browser.ie){if(range){editor.$win.focus();range.select()}selection=range=null}})}else{f(cmd,v)}});break;case"insertimage":case"createlink":var str=linb.getRes("editor."+cmd),str2=linb.getRes("editor."+cmd+"2");if(linb.browser.ie){var selection=editor.$doc.selection,range=selection?selection.createRange():null;if(range&&range.parentElement().ownerDocument!=editor.$doc){range=selection=null}}linb.UI.Dialog.prompt(str,str2,"http://",function(v){if(linb.browser.ie){if(range){editor.$win.focus();range.select()}selection=range=null}if(v){var doc=editor.$doc;doc.execCommand(cmd,false,v);doc=null}},function(){if(linb.browser.ie){if(range){editor.$win.focus();range.select()}selection=range=null}});break;case"html":o.setValue(editor.boxing().getUIValue(),true);o.beforeUIValueSet(function(p,o,v){_clear();editor.boxing().setUIValue(v)});break}}else{editor.$doc.execCommand(item.command,false,item.commandArgs);if(item.id=="removeformat"){linb.UI.RichEditor._updateToolbar(editor.$domId,true)}}},_onresize:function(profile,width,height){var size={};if(width){size.width=width-2}if(size.width<0){size.width=0}if(width||height){var itb=profile._$tb,_top=(itb?itb.getRoot().offsetHeight():0);if(!height){height=this.properties.height}size.height=height-_top-1;if(size.height<0){size.height=0}}profile.getSubNode("EDITOR").top(_top).cssSize(size,true)}}});Class("linb.UI.Group","linb.UI.Div",{Instance:{activate:function(){var profile=this.get(0);profile.getSubNode("HANDLE").focus();return this}},Static:{Behaviors:{NavKeys:{CAPTION:1},HoverEffected:{TOGGLE:"TOGGLE"},ClickEffected:{TOGGLE:"TOGGLE"},DropableKeys:["PANEL"],DragableKeys:["HANDLE"],onSize:linb.UI.$onSize,HANDLE:{onClick:function(profile,e,src){if(profile.properties.toggleBtn){profile.box._toggle(profile,!profile.properties.toggle);return false}}}},Templates:{tagName:"div",style:"{_style}",FIELDSET:{tagName:"fieldset",className:" {toggleCls}",LEGEND:{tagName:"legend",HANDLE:{tagName:"a",href:linb.$href,tabindex:"{tabindex}",TOGGLE:{className:"uicmd-toggle2 {toggleCls}",style:"{toggleDispplay}"},ICON:{$order:1,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{text:"{caption}",$order:2}}},PANEL:{$order:1,tagName:"div",style:"{panelDisplay}",text:"{html}"+linb.UI.$childTag}}},Appearances:{KEY:{zoom:linb.browser.ie6?"1":null},FIELDSET:{border:"1px solid #7ba3cb",position:"relative",overflow:"hidden",zoom:linb.browser.ie6?"1":null},"FIELDSET-checked":{$order:2,"padding-left":"2px","border-left":"0","border-right":"0","border-bottom":"0"},LEGEND:{"margin-left":"3px"},HANDLE:{cursor:"default",padding:"0 3px 0 6px",display:linb.$inlineBlock},PANEL:{position:"relative",overflow:"auto",background:linb.browser.ie?"url("+linb.ini.file_bg+") no-repeat left top":null},"FIELDSET-checked PANEL":{$order:4,display:"none"},CAPTION:{"vertical-align":"middle","font-family":'"Verdana", "Helvetica", "sans-serif"',"font-size":"12px","line-height":"18px"}},DataModel:{caption:{ini:undefined,action:function(value){this.getSubNode("CAPTION").get(0).innerHTML=value}},html:{action:function(v){this.getSubNode("PANEL").html(v)}},toggleBtn:{ini:true,action:function(v){this.getSubNode("TOGGLE").css("display",v?"":"none")}},toggle:{ini:true,action:function(v){this.box._toggle(this,v)}},image:{action:function(value){this.getSubNode("ICON").css("display",value?"":"none").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){this.getSubNode("ICON").css("backgroundPosition",value)}}},LayoutTrigger:function(){var self=this,t=self.properties,b=self.box;if(t.toggle){b._toggle(self,t.toggle)}},EventHandlers:{onIniPanelView:function(profile){},onFold:function(profile){},onExpend:function(profile){}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),nodisplay="display:none";data.toggleDispplay=data.toggleBtn?"":nodisplay;data.panelDisplay=data.toggleBtn&&!data.toggle?nodisplay:"";data.toggleCls=data.toggleBtn&&!data.toggle?profile.getClass("FIELDSET","-checked"):"";data.toggleCls2=data.toggleBtn&&!data.toggle?profile.getClass("TOGGLE","-checked"):"";return data},_onresize:function(profile,width,height){if(height&&height!="auto"){profile.getSubNode("FIELDSET").height(height);profile.getSubNode("PANEL").height(height-(profile.getSubNode("LEGEND").height()||18))}if(width&&width!="auto"){profile.getSubNode("PANEL").width(width-2)}},_toggle:function(profile,value){var p=profile.properties,b=profile.boxing();p.toggle=value;if(value&&!profile.$ini){if(b.onIniPanelView){if(b.onIniPanelView(profile)!==false){profile.$ini=true}}}if(value){if(false===b.onExpend(profile)){return }}else{if(false===b.onFold(profile)){return }}profile.getSubNode("PANEL").css("display",value?"":"none");profile.getSubNodes(["TOGGLE","FIELDSET"]).tagClass("-checked",!value)}}});Class("linb.UI.ColorPicker",["linb.UI","linb.absValue"],{Instance:{activate:function(){this.getSubNode("TOGGLEA").focus();return this},_setCtrlValue:function(value,inner){return this.each(function(profile){if(!profile.renderId){return }var cls=profile.box,p=profile.properties,hex=profile.$hex=cls._to3(value),hexs=profile.$hex.join(""),rgb=profile.$rgb=cls.hex2rgb(value),hsv=profile.$hsv=cls.rgb2hsv(rgb),f=function(s,v){profile.getSubNode(s).get(0).firstChild.nodeValue=String(v)},ff=function(v){return parseInt(v*100)};f("R",rgb[0]);f("G",rgb[1]);f("B",rgb[2]);f("H",hex[0]);f("E",hex[1]);f("X",hex[2]);if(profile.$hexinhsv!=hexs){f("HH",hsv[0]);f("S",ff(hsv[1]));f("V",ff(hsv[2]));delete profile.$hexinhsv}cls._setClrName(profile,hexs);cls._updateDftTip(profile);if(p.advance&&profile.$hexinadv!=hexs){cls._updateMarks(profile,value,true,hsv[0]);delete profile.$hexinadv}if(inner!=false){profile.getSubNode("CAPTION").html("#"+value,false)}})},getColorName:function(){return this.get(0).$clrN||""}},Initialize:function(){var ns=this,id=linb.UI.$ID,cls=linb.UI.$CLS,key=ns.KEY,list=ns._slist,l=list.length,i,data,arr=[],evs=' unselectable="on" ';ns.addTemplateKeys(["TXT","DD1","DD2","DD3","R","G","B","HH","S","V","H","E","X"]);for(i=0;i<l;i++){arr.push('<a  id="'+key+"-SC:"+id+":"+list[i]+'" href='+linb.$href+'  style="background-color:#'+list[i]+'">'+list[i]+"</a>")}data='<div><span class="'+cls+'-txt">R: </span><span id="'+key+"-R:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#" '+evs+'>R</span><span style="width:8px;height:8px"  unselectable="on" ></span><span class="'+cls+'-txt">H: </span><span id="'+key+"-HH:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#" '+evs+'>H</span><span>\xB0</span></div><div><span class="'+cls+'-txt">G: </span><span id="'+key+"-G:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#" '+evs+'>G</span><span style="width:8px;height:8px"  unselectable="on" ></span><span class="'+cls+'-txt">S: </span><span id="'+key+"-S:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#"  '+evs+'>S</span><span>%</span></div><div><span class="'+cls+'-txt">B: </span><span id="'+key+"-B:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#" '+evs+'>B</span><span style="width:8px;height:8px"  unselectable="on" ></span><span class="'+cls+'-txt">V: </span><span id="'+key+"-V:"+id+':" class="'+cls+'-dd2 ui-dragable #DD2_CC#" '+evs+'>V</span><span>%</span></div><div><span style="width:38px">HEX: #</span><span id="'+key+"-H:"+id+':" class="'+cls+'-dd3 ui-dragable #DD3_CC#" '+evs+'>H</span><span id="'+key+"-E:"+id+':" class="'+cls+'-dd3 ui-dragable #DD3_CC#" '+evs+'>E</span><span id="'+key+"-X:"+id+':" class="'+cls+'-dd1 ui-dragable #DD1_CC#" '+evs+">X</span></div>";ns.setTemplate({style:"{_style};height:auto;width:{_width}px;",tagName:"div",onselectstart:"return false",BORDER:{tagName:"div",BAR:{tagName:"div",className:"{classBar}",BART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",className:"uibar-t",tagName:"table",BARTR:{tagName:"tr",BARTDL:{tagName:"td",className:"uibar-tdl"},BARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl"},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",CLOSE:{className:"uicmd-close ",style:"{closeDisplay}"}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",CON:{$order:1,tagName:"div",SIMPLE:{tagName:"div",TOP:{$order:1,tagName:"div",DATA:{$order:0,tagName:"div",onselectstart:"return false",text:data},EXAM:{$order:1,tagName:"div",EXAMI:{tagName:"div"}}},LIST:{$order:2,tagName:"div",text:arr.join("")}},ADV:{$order:2,style:"{advDispay}",tagName:"div",ADVWHEEL:{$order:0,tagName:"div"},ADVCLR:{$order:1,tagName:"div"},ADVMARK1:{$order:3,tagName:"div"},ADVMARK2:{$order:4,tagName:"div"}}}}},TAIL:{$order:3,tagName:"div",className:"uicon-main",TAILI:{tagName:"div",className:"uicon-maini",CAPTION:{text:"{caption}"},SET:{className:"ui-btn",SETI:{className:"ui-btni",SETC:{className:"ui-btnc",SETA:{tagName:"a",href:linb.$href,text:linb.wrapRes("inline.set")}}}},TOGGLE:{className:"ui-btn",TOGGLEI:{className:"ui-btni",TOGGLEC:{className:"ui-btnc",TOGGLEA:{tagName:"a",href:linb.$href,tabindex:"{tabindex}",text:">>"}}}}}},BBAR:{$order:4,tagName:"div",className:"uibar-bottom-s",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}}})},Static:{_radius:84,_square:100,_bigRadius:97,DataModel:{height:{ini:"auto",readonly:true},width:{ini:"auto",readonly:true},value:"FFFFFF",barDisplay:{ini:true,action:function(v){if(v){this.getSubNode("BAR").replaceClass("uibar-top-s","uibar-top")}else{this.getSubNode("BAR").replaceClass("uibar-top","uibar-top-s")}}},closeBtn:{ini:true,action:function(v){this.getSubNode("CLOSE").css("display",v?"":"none")}},advance:{ini:false,action:function(v){var ns=this;ns.getSubNode("ADV").css("display",v?"":"none");ns.getSubNode("TOGGLEA").text(v?"<<":">>");ns.getRoot().width(v?410:210);if(v){ns.box._updateMarks(ns,ns.properties.$UIvalue,true,ns.$hsv[0])}}}},Appearances:{KEY:{"-moz-user-select":"none"},MAINI:{padding:"4px 5px 4px 0"},CON:{height:"196px",padding:"3px",position:"relative",border:"solid 1px #648CB4"},DATA:{"float":"left",width:"112px",height:"86px"},"DATA span":{"float":"left"},"DATA div":{"padding-top":"3px",clear:"both"},TXT:{width:"16px"},CAPTION:{"font-size":"12px","vertical-align":"middle"},EXAM:{"float":"left","margin-top":"2px",padding:"3px",border:"solid 1px #648CB4","background-color":"#E5EBFB"},EXAMI:{height:"70px",width:"70px","white-space":"normal","text-align":"center",border:"solid 1px #648CB4"},"DD1, DD2, DD3":{display:"block",height:"16px",border:"1px solid #779EBF","padding-right":"2px",cursor:"e-resize","text-align":"right",background:"#F8FBFF"},DD1:{width:"16px"},DD2:{width:"24px"},DD3:{$order:2,width:"16px","border-right":"none"},TOP:{height:"90px",position:"relative"},LIST:{height:"106px",position:"relative",overflow:"hidden",margin:"0 2px","line-height":linb.browser.ie6?"0":null,clear:"both"},TAILI:{position:"relative","padding-top":"4px",height:"22px","text-align":"center"},SIMPLE:{"float":"left",width:"192px",position:"relative"},ADV:{"float":"right",width:"195px",height:"195px",position:"relative"},"ADV div":{cursor:"crosshair",position:"absolute"},ADVCLR:{background:linb.browser.ie6?null:linb.UI.$bg("bg.png","no-repeat left top"),_filter:linb.UI.$ieBg("bg.png"),height:"101px",left:"47px",top:"47px",width:"101px"},ADVWHEEL:{background:linb.browser.ie6?null:linb.UI.$bg("clr.png","no-repeat left top"),_filter:linb.UI.$ieBg("clr.png"),height:"195px",width:"195px"},"ADVMARK1, ADVMARK2":{background:linb.browser.ie6?null:linb.UI.$bg("picker.png","no-repeat left top"),_filter:linb.UI.$ieBg("picker.png"),height:"17px",margin:"-8px 0pt 0pt -8px",overflow:"hidden",width:"17px"},"LIST a":{height:"12px",width:"10px","font-size":linb.browser.ie6?"0":null,"float":"left",display:"block",overflow:"hidden","text-indent":"100px",margin:"0",cursor:"pointer",border:"1px solid #000",margin:"0 -1px -1px 0"},"LIST a:hover":{border:"1px solid black"},SET:{position:"absolute",display:"none",top:"0",right:"38px"},TOGGLE:{position:"absolute",right:"5px",top:"0"}},Behaviors:{HoverEffected:{CLOSE:"CLOSE",SET:"SET",TOGGLE:"TOGGLE"},ClickEffected:{CLOSE:"CLOSE",SET:"SET",TOGGLE:"TOGGLE"},KEY:{onClick:function(){return false}},SC:{onMouseover:function(p,e,s){p.box._setTempUI(p,p.getSubId(s))},onClick:function(p,e,s){var sid=p.getSubId(s);p.boxing()._setCtrlValue(p.$tempValue=sid,false);if(!p.properties.advance){p.boxing().setUIValue(sid)}p.box._vC(p);return false}},LIST:{onMouseout:function(p,e,s){p.box._updateDftTip(p)}},SET:{onClick:function(p,e,src){p.boxing().setUIValue(p.$tempValue,true);p.box._vC(p)}},CANCEL:{onClick:function(p,e,src){p.getSubNode("CLOSE").onClick(true)}},TOGGLE:{onClick:function(p,e,src){p.boxing().setAdvance(!p.properties.advance)}},R:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,0)},onDragstop:function(p,e,src){p.box._dd3(p,e,src,0)}},G:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,1)},onDragstop:function(p,e,src){p.box._dd3(p,e,src,1)}},B:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,2)},onDragstop:function(p,e,src){p.box._dd3(p,e,src,2)}},HH:{onMousedown:function(p,e,src){p.box._dd1(p,e,src,true)},onDrag:function(p,e,src){p.box._dd2(p,e,src,0,"hsv1")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,0,true,"hsv1")}},S:{onMousedown:function(p,e,src){p.box._dd1(p,e,src,true)},onDrag:function(p,e,src){p.box._dd2(p,e,src,1,"hsv2")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,1,true,"hsv2")}},V:{onMousedown:function(p,e,src){p.box._dd1(p,e,src,true)},onDrag:function(p,e,src){p.box._dd2(p,e,src,2,"hsv2")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,2,true,"hsv2")}},H:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,0,"hex")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,0)}},E:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,1,"hex")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,1)}},X:{onMousedown:function(p,e,src){p.box._dd1(p,e,src)},onDrag:function(p,e,src){p.box._dd2(p,e,src,2,"hex")},onDragstop:function(p,e,src){p.box._dd3(p,e,src,2)}},CLOSE:{onClick:function(profile,e,src){var properties=profile.properties,instance=profile.boxing();if(properties.disabled){return }if(false===instance.beforeClose(profile)){return }instance.destroy();return false}},ADVWHEEL:{onMousedown:function(p,e,src){var cls=p.box;cls._prepareAdv(p,e);cls._updateClrByPos(p,e,true);p.getSubNode("ADVMARK1").startDrag(e,{dragType:"none"})}},ADVMARK1:{onMousedown:function(p,e,src){var cls=p.box;cls._prepareAdv(p,e);cls._updateClrByPos(p,e,true);p.getSubNode("ADVMARK1").startDrag(e,{dragType:"none"})},onDrag:function(p,e,src){var cls=p.box;cls._updateClrByPos(p,e,true)},onDragstop:function(p,e,src){p.box._updateValueByPos(p,e)}},ADVCLR:{onMousedown:function(p,e,src){var cls=p.box;cls._prepareAdv(p,e);cls._updateClrByPos(p,e);p.getSubNode("ADVMARK2").startDrag(e,{dragType:"none"});return false}},ADVMARK2:{onMousedown:function(p,e,src){var cls=p.box;cls._prepareAdv(p,e);cls._updateClrByPos(p,e);p.getSubNode("ADVMARK2").startDrag(e,{dragType:"none"});return false},onDrag:function(p,e,src){var cls=p.box;cls._updateClrByPos(p,e)},onDragstop:function(p,e,src){p.box._updateValueByPos(p,e)}}},_vC:function(profile){var pro=profile.properties,v=pro.$UIvalue,d=v==profile.$tempValue;profile.getSubNode("SET").css("display",d?"none":"block");profile.getSubNode("CAPTION").css("color",d?"#000":"#ff0000")},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);var nodisplay="display:none";data.classBar=data.barDisplay?"uibar-top":"uibar-top-s";data.closeDisplay=data.closeBtn?"":nodisplay;data._width=data.advance?"410":"210";data.advDispay=data.advance?"":"display:none;";return data},EventHandlers:{beforeClose:function(profile,src){}},RenderTrigger:function(){this.$onValueSet=this.$onValueUpdated=function(v){this.box._setClrName(this,v)}},_setClrName:function(profile,v){var p=profile,k="color.LIST.",vv=linb.getRes(k+v);if(vv==v){p.$clrN2=p.$clrN="#"+v}else{p.$clrN=vv;p.$clrN2=linb.wrapRes(k+v)}},_slist:"FFFFFF,FFFFF0,FFFFE0,FFFF00,FFFAFA,FFFAF0,FFFACD,FFF8DC,FFF5EE,FFF0F5,FFEFD5,FFEBCD,FFE4E1,FFE4C4,FFE4B5,FFDEAD,FFDAB9,FFD700,FFC0CB,FFB6C1,FFA500,FFA07A,FF8C00,FF7F50,FF69B4,FF6347,FF4500,FF1493,FF00FF,FF00FF,FF0000,FDF5E6,FAFAD2,FAF0E6,FAEBD7,FA8072,F8F8FF,F5FFFA,F5F5F5,F5DEB3,F4A460,F0FFFF,F0FFF0,F0F8FF,F0E68C,F08080,EEE8AA,EE82EE,E9967A,E6E6FA,E1FFFF,DEB887,DDA0DD,DCDCDC,DC143C,DB7093,DAA520,DA70D6,D8BFD8,D3D3D3,D2B48C,D2691E,CD853F,CD5C5C,C71585,C0C0C0,BDB76B,BC8F8F,BA55D3,B22222,B0E0E6,B0C4DE,AFEEEE,ADFF2F,ADD8E6,A9A9A9,A52A2A,A0522D,9932CC,98FB98,9400D3,9370DB,90EE90,8FBC8F,8B4513,8B008B,8B0000,8A2BE2,87CEFA,87CEEB,808080,808000,800080,800000,7FFFAA,7FFF00,7CFC00,7B68EE,778899,708090,6B8E23,6A5ACD,696969,6495ED,5F9EA0,556B2F,4B0082,48D1CC,483D8B,4682B4,4169E1,40E0D0,3CB371,32CD32,2F4F4F,2E8B57,228B22,20B2AA,1E90FF,191970,00FFFF,00FFFF,00FF7F,00FF00,00FA9A,00CED1,00BFFF,008B8B,008080,008000,006400,0000FF,0000CD,00008B,000080,000000".split(","),_C16:"0123456789ABCDEF",_dd1:function(profile,e,src,hsv){var p=profile.properties,cls=profile.box,f=function(){var rgb=cls.hex2rgb(profile.$tempValue||p.$UIvalue);return hsv?cls.rgb2hsv(rgb):rgb};linb.use(src).css("backgroundColor","red").startDrag(e,{dragType:"blank",targetReposition:false,widthIncrement:2,dragCursor:true});profile.$temp=0;profile.$start=f();profile.$temp2=f()},_dd2:function(profile,e,src,i,type){var count,off=linb.DragDrop.getProfile().offset,p=profile.properties,old=profile.$temp2,cls=profile.box,rate=type=="hsv1"?361:type=="hsv2"?101:256,v;count=(type=="hsv2"?parseInt(profile.$start[i]*100):parseInt(profile.$start[i]))+parseInt(off.x/2);count=(count%rate+rate)%rate;if(profile.$temp!=count){old[i]=profile.$temp=type=="hsv2"?count/100:count;v=(type=="hsv1"||type=="hsv2")?cls.hsv2rgb(old):old;v=cls.rgb2hex(v);cls._setTempUI(profile,v);linb.use(src).text(type=="hex"?cls._toFF(count):count)}},_dd3:function(profile,e,src,i,hsv){if(profile.$start[i]!==profile.$temp){var p=profile.properties,cls=profile.box,old=profile.$start,v;old[i]=profile.$temp;v=hsv?cls.hsv2rgb(old):old;v=cls.rgb2hex(v);if(hsv){profile.$hexinhsv=v}profile.boxing()._setCtrlValue(profile.$tempValue=v,false);delete profile.$hexinhsv;profile.box._vC(profile)}linb.use(src).css("backgroundColor","");profile.$temp=profile.$start=0},_setTempUI:function(p,v){var cls=this,rgb=cls.hex2rgb(v),b=p.boxing(),ex=b.getSubNode("EXAMI"),hsv=cls.rgb2hsv(rgb),vv=linb.getRes("color.LIST."+v);ex.css({backgroundColor:"#"+v,color:hsv[2]>0.6?"#000":"#FFF"});ex.text(p.show_color=vv==v?"#"+v:vv)},_updateDftTip:function(p){var cls=p.box,ex=p.boxing().getSubNode("EXAMI");ex.css({backgroundColor:"#"+p.$hex.join(""),color:p.$hsv[2]>0.6?"#000":"#FFF"});ex.html(p.$clrN2||"",false)},_to3:function(s){if(!s){s="FFFFFF"}return[s.substr(0,2),s.substr(2,2),s.substr(4,2)]},_toFF:function(n){var C16=this._C16;n=parseInt(n)||0;n=(n>255||n<0)?0:n;return C16.charAt((n-n%16)/16)+C16.charAt(n%16)},_to255:function(str){var C16=this._C16,s=str.split("");return C16.indexOf(s[0].toUpperCase())*16+C16.indexOf(s[1].toUpperCase())},_webSafe:function(r,g,b){var me=arguments.callee,f=me.f||(me.f=function(n){return parseInt(n/51)*51});if(typeof r=="object"){g=r[1];b=r[2];r=r[0]}return[f(r),f(g),f(b)]},_updateMarks:function(profile,hex,forcePos,hsv0){var cls=this,rgb=cls.hex2rgb(hex),hsv=cls.rgb2hsv(rgb),angle=(hsv[0]/360)*6.28,clr=profile.getSubNode("ADVCLR");if(forcePos){var m1=profile.getSubNode("ADVMARK1"),m2=profile.getSubNode("ADVMARK2");m1.cssPos({left:Math.round(Math.sin(angle)*cls._radius+cls._bigRadius),top:Math.round(-Math.cos(angle)*cls._radius+cls._bigRadius)});m2.cssPos({left:Math.round(cls._square*(hsv[1]-0.5)+cls._bigRadius),top:Math.round(cls._square*(0.5-hsv[2])+cls._bigRadius)})}if(hsv0!==undefined){clr.css("backgroundColor","#"+cls.rgb2hex(cls.hsv2rgb([hsv0,1,1])))}cls._setTempUI(profile,hex)},_updateClrByPos:function(profile,e,flag){var cls=this,mPos=linb.Event.getPos(e),pos=profile.$tpos,left=mPos.left-pos.left,top=mPos.top-pos.top,angle,m1,m2,h,s,v,hsv,rgb,hex;if(flag){m1=profile.getSubNode("ADVMARK1");angle=Math.atan2(left,-top);m1.cssPos({left:Math.round(Math.sin(angle)*cls._radius+cls._bigRadius),top:Math.round(-Math.cos(angle)*cls._radius+cls._bigRadius)});h=Math.floor((angle/6.28)*360);if(h<0){h+=360}hsv=[h,profile.$hsv[1],profile.$hsv[2]];rgb=cls.hsv2rgb(hsv);hex=cls.rgb2hex(rgb);cls._updateMarks(profile,profile.$t_hex=hex,false,h)}else{m2=profile.getSubNode("ADVMARK2");s=Math.max(0,Math.min(1,(left/cls._square)+0.5));v=Math.max(0,Math.min(1,0.5-(top/cls._square)));m2.cssPos({left:Math.round(cls._square*(s-0.5)+cls._bigRadius),top:Math.round(cls._square*(0.5-v)+cls._bigRadius)});hsv=[profile.$hsv[0],s,v];rgb=cls.hsv2rgb(hsv);hex=cls.rgb2hex(rgb);cls._updateMarks(profile,profile.$t_hex=hex)}},_updateValueByPos:function(profile,e){profile.$hexinadv=profile.$t_hex;profile.boxing()._setCtrlValue(profile.$tempValue=profile.$t_hex,false);delete profile.$hexinadv;profile.box._vC(profile)},_prepareAdv:function(profile,e){var cls=this,pos=profile.getSubNode("ADVWHEEL").offset();profile.$tpos={left:pos.left+cls._bigRadius,top:pos.top+cls._bigRadius}},_ensureValue:function(profile,v){var ns=this,me=arguments.callee,map=me.map||(me.map=(function(){var h={};_.arr.each(ns._C16.split(""),function(o,i){h[o]=1});return h}())),reg=me._r||(me._r=/rgb\(([^)]*)\)/);if(!v||typeof v!="string"){return"FFFFFF"}if(reg.test(v)){v=v.replace(reg,"$1");v=v.split(",");v[0]=parseInt(v[0])||0;v[1]=parseInt(v[1])||0;v[2]=parseInt(v[2])||0;v=ns.rgb2hex(v)}if(v.charAt(0)=="#"){v=v.substr(1,v.length)}var a="",k;for(var i=0;i<6;i++){k=v.charAt(i).toUpperCase();a+=(map[k]?k:"F")}return a},hsv2rgb:function(h,s,v){if(h instanceof Array){s=h[1];v=h[2];h=h[0]}var me=arguments.callee,f=me.f||(me.f=function(n){return Math.min(255,Math.round(n*256))}),r,g,b,i,k,p,q,t;if(s==0){return[v=f(v),v,v]}else{i=Math.floor((h/60)%6);k=(h/60)-i;p=v*(1-s);q=v*(1-k*s);t=v*(1-(1-k)*s);switch(i){case 0:r=v;g=t;b=p;break;case 1:r=q;g=v;b=p;break;case 2:r=p;g=v;b=t;break;case 3:r=p;g=q;b=v;break;case 4:r=t;g=p;b=v;break;case 5:r=v;g=p;b=q;break}return s==0?[v=f(v),v,v]:[f(r),f(g),f(b)]}},rgb2hsv:function(r,g,b){if(r instanceof Array){g=r[1];b=r[2];r=r[0]}r=r/255;g=g/255;b=b/255;var min=Math.min(r,g,b),max=Math.max(r,g,b),delta=max-min,s=(max===0)?0:1-(min/max),v=max,h;switch(max){case min:h=0;break;case r:h=60*(g-b)/delta;if(g<b){h+=360}break;case g:h=(60*(b-r)/delta)+120;break;case b:h=(60*(r-g)/delta)+240;break}return[Math.round(h),s,v]},rgb2hex:function(r,g,b){var ns=this;if(r instanceof Array){g=r[1];b=r[2];r=r[0]}return ns._toFF(r)+ns._toFF(g)+ns._toFF(b)},hex2rgb:function(hex){var ns=this;if(!hex){hex="FFFFFF"}if(hex.charAt(0)=="#"){hex=hex.slice(1)}return[ns._to255(hex.substr(0,2)),ns._to255(hex.substr(2,2)),ns._to255(hex.substr(4,2))]},getTextColor:function(value){var ns=this;value=ns._ensureValue(0,value);value=ns.hex2rgb(value);value=ns.rgb2hsv(value);return(value&&value[2])>0.6?"#000000":"#FFFFFF"},_onresize:function(){}}});Class("linb.UI.DatePicker",["linb.UI","linb.absValue"],{Dependency:["linb.Date"],Instance:{activate:function(){this.getSubNode("PRE").focus();return this},_setCtrlValue:function(value){return this.each(function(profile){if(!profile.renderId){return }var cls=profile.box,p=profile.properties,date=linb.Date,mfirst=date.getTimSpanStart(value,"m");cls._to(profile,mfirst,value);if(profile.keys.CAPTION){profile.getSubNode("CAPTION").html(date.getText(value,"ymd",p.WEEK_FIRST),false)}})},getDateFrom:function(){return this.get(0)._realstart}},Initialize:function(){var self=this,id=linb.UI.$ID,cls=linb.UI.$CLS,cls2=cls+"-td-free",key=self.KEY;self.addTemplateKeys(["H","W","TBODY","TD"]);var colgroup='<colgroup><col width="2%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/></colgroup>',thead1='<thead><tr height="1%"><th id="'+key+"-H:"+id+':7" class="'+cls+'-h #H_CC#"></th>',thead2="</tr></thead>",th='<th id="'+key+"-H:"+id+':@" class="'+cls+'-h #H_CC#">@</th>',tbody1='<tbody id="'+key+"-TBODY:"+id+':" >',tbody2="</tbody>",tr1="<tr>",tr2="</tr>",td1='<th id="'+key+"-W:"+id+':@"  class="'+cls+'-w #W_CC#">@</th>',td2='<td id="'+key+"-TD:"+id+':@" class="'+cls+'-td ! #TD_CC#"  unselectable="on" ></td>',body,i,j,k,l,a=[],b=[];for(i=0;i<7;i++){b[b.length]=th.replace(/@/g,i)}k=l=0;for(i=0;i<48;i++){j=i%8;a[a.length]=(j==0?tr1:"")+(j==0?td1:td2).replace(/@/g,j==0?l:k).replace("!",(j==1||j==7)?cls2:"")+(j==7?tr2:"");if(j!==0){k++}else{l++}}body=colgroup+thead1+b.join("")+thead2+tbody1+a.join("")+tbody2;self.setTemplate({tagName:"div",style:"{_style};height:auto;",onselectstart:"return false",BORDER:{tagName:"div",BAR:{tagName:"div",className:"uibar-top",style:"{barDisplay};",BART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",className:"uibar-t",tagName:"table",BARTR:{tagName:"tr",BARTDL:{tagName:"td",className:"uibar-tdl"},BARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl",PRE2:{$order:0,tagName:"a",href:linb.$href,tabindex:"{tabindex}"},PRE:{$order:1,tagName:"a",href:linb.$href,tabindex:"{tabindex}"},YEAR:{$order:2,unselectable:"on",className:"ui-dragable"},MONTH:{$order:4,unselectable:"on",className:"ui-dragable"},MTXT:{$order:5,style:"display:inline"},NEXT:{$order:6,tagName:"a",href:linb.$href,tabindex:"{tabindex}"},NEXT2:{$order:7,tagName:"a",href:linb.$href,tabindex:"{tabindex}"}},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",CLOSE:{className:"uicmd-close ",style:"{closeDisplay}"}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",CON:{tagName:"div",BODY:{tagName:"table",cellpadding:"0",cellspacing:"0",width:"100%",text:body}}}},TAIL:{$order:3,tagName:"div",className:"uicon-main",TAILI:{tagName:"div",className:"uicon-maini",CAPTION:{text:"{caption}",$order:1},TODAY:{className:"ui-btn",TODAYI:{className:"ui-btni",TODAYC:{className:"ui-btnc",TODAYA:{tagName:"a",href:linb.$href,tabindex:"{tabindex}",text:linb.wrapRes("inline.today")}}}}}},BBAR:{$order:4,tagName:"div",className:"uibar-bottom-s",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}}})},Static:{Appearances:{KEY:{overflow:"visible","-moz-user-select":"none"},BORDER:{overflow:"visible",position:"relative"},BODY:{position:"relative"},BARCMDL:{top:"3px"},TAILI:{position:"relative","padding-top":"4px",height:"22px","text-align":"center"},TODAY:{position:"absolute",top:"0",right:"5px"},"PRE,PRE2,NEXT,NEXT2":{$order:0,display:linb.$inlineBlock,position:"relative",margin:"0 2px",width:"15px",height:"15px","vertical-align":"middle",cursor:"default",background:linb.UI.$bg("icons.gif","no-repeat",true),_zoom:1},PRE:{$order:1,"background-position":"-260px -70px"},"PRE-mouseover":{$order:2,"background-position":"-260px -90px"},"PRE-mousedown":{$order:3,"background-position":"-260px -110px"},PRE2:{$order:1,"background-position":"-240px -70px"},"PRE2-mouseover":{$order:2,"background-position":"-240px -90px"},"PRE2-mousedown":{$order:3,"background-position":"-240px -110px"},NEXT:{$order:1,"background-position":"-280px -70px"},"NEXT-mouseover":{$order:2,"background-position":"-280px -90px"},"NEXT-mousedown":{$order:3,"background-position":"-280px -110px"},NEXT2:{$order:1,"background-position":"-300px -70px"},"NEXT2-mouseover":{$order:2,"background-position":"-300px -90px"},"NEXT2-mousedown":{$order:3,"background-position":"-300px -110px"},"YEAR,MONTH":{$order:4,margin:"0 2px",height:"15px","font-weight":"bold","vertical-align":"middle",border:"1px solid #779EBF","background-color":"#F8FBFF","padding-left":"2px",cursor:"e-resize"},YEAR:{width:"32px"},MONTH:{width:"16px"},CAPTION:{"font-size":"12px","vertical-align":"middle"},MAINI:{"padding-top":"4px","padding-bottom":"4px"},CON:{"border-left":"solid 1px #648CB4","border-top":"solid 1px #648CB4"},BODY:{overflow:"visible"},"BODY td,BODY th":{$order:1,border:0,"border-right":"solid 1px #648CB4","border-bottom":"solid 1px #648CB4"},"TD .exday":{color:"#C1C1C1"},TD:{"text-align":"center","background-color":"#EFF8FF"},"TD-free":{$order:1,"text-align":"center","background-color":"#F9F7D1"},"TD-mouseover":{$order:3,"background-color":"#d9e8fb"},"TD-checked":{$order:4,"background-color":"#316AC5","font-weight":"bold",color:"#fff"},"W,H":{$order:3,color:"#333333","background-color":"#E8EEF7","vertical-align":"middle","text-align":"center"}},Behaviors:{HoverEffected:{CLOSE:"CLOSE",TD:"TD",PRE:"PRE",PRE2:"PRE2",NEXT:"NEXT",NEXT2:"NEXT2",TODAY:"TODAY"},ClickEffected:{CLOSE:"CLOSE",TD:"TD",PRE:"PRE",PRE2:"PRE2",NEXT:"NEXT",NEXT2:"NEXT2",TODAY:"TODAY"},KEY:{onClick:function(){return false}},TD:{onClick:function(profile,e,src){var p=profile.properties,id=profile.getSubId(src),map=profile.$daymap,v=map[id];if(p.disabled){return false}linb.use(src).onMouseout(true,{$force:true});profile.boxing().setUIValue(v)}},TODAY:{onClick:function(profile){profile.boxing().setUIValue(new Date,true)}},CLOSE:{onClick:function(profile,e,src){var properties=profile.properties,instance=profile.boxing();if(properties.disabled){return }if(false===instance.beforeClose(profile,src)){return }instance.destroy();return false}},PRE:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }profile.box._to(profile,linb.Date.add(profile.$mfirst,"m",-1,p.WEEK_FIRST))}},NEXT:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }profile.box._to(profile,linb.Date.add(profile.$mfirst,"m",1,p.WEEK_FIRST))}},PRE2:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }profile.box._to(profile,linb.Date.add(profile.$mfirst,"y",-1,p.WEEK_FIRST))}},NEXT2:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }profile.box._to(profile,linb.Date.add(profile.$mfirst,"y",1,p.WEEK_FIRST))}},YEAR:{onMousedown:function(profile,e,src){linb.use(src).startDrag(e,{dragType:"blank",targetReposition:false,widthIncrement:20,dragCursor:true});profile.$temp=profile.$temp2=0},onDrag:function(profile,e,src){var count,off=linb.DragDrop.getProfile().offset;count=parseInt(profile.$year)+(profile.$temp2=parseInt(off.x/20));if(profile.$temp!=count){profile.$temp=count;profile.getSubNode("YEAR").html(count,false)}},onDragstop:function(profile,e,src){if(profile.$temp2){var p=profile.properties,v=linb.Date.add(profile.$mfirst,"y",profile.$temp2,p.WEEK_FIRST);profile.box._to(profile,linb.Date.getTimSpanStart(v,"m"))}profile.$temp=profile.$temp2=0}},MONTH:{onMousedown:function(profile,e,src){linb.use(src).startDrag(e,{dragType:"blank",targetReposition:false,widthIncrement:20,dragCursor:true});profile.$temp=profile.$temp2=0},onDrag:function(profile,e,src){var count,off=linb.DragDrop.getProfile().offset;count=parseInt(profile.$month)+(parseInt(off.x/20)%12);count=(count%12+12)%12;if(profile.$temp!=count){profile.$temp=count;profile.$temp2=count-profile.$month+1;profile.getSubNode("MONTH").html(count+1,false)}},onDragstop:function(profile,e,src){if(profile.$temp2){var p=profile.properties,v=linb.Date.add(profile.$mfirst,"m",profile.$temp2,p.WEEK_FIRST);profile.box._to(profile,linb.Date.getTimSpanStart(v,"m"))}profile.$temp=profile.$temp2=0}}},DataModel:{height:{ini:"auto",readonly:true},width:{ini:210,readonly:true},value:new Date,closeBtn:{ini:true,action:function(v){this.getSubNode("CLOSE").css("display",v?"":"none")}}},EventHandlers:{beforeClose:function(profile,src){}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);var nodisplay="display:none";data.closeDisplay=data.closeBtn?"":nodisplay;return data},RenderTrigger:function(){var self=this,p=self.properties,o=self.boxing(),b=self.box;b._setWeekLabel(self)},_getWeekNodes:function(profile){return profile.$week||(profile.$week=profile.getSubNode("W",true))},_getTDNodes:function(profile){return profile.$tds||(profile.$tds=profile.getSubNode("TD",true))},_getLabelNodes:function(profile){return profile.$day||(profile.$day=profile.getSubNode("TD",true))},_getHeaderNodes:function(profile){return profile.$header||(profile.$header=profile.getSubNode("H",true))},_setWeekLabel:function(profile){var o=linb.Date,f=profile.getSubId;profile.box._getHeaderNodes(profile).each(function(node,i){node.innerHTML=linb.wrapRes("date.WEEKS."+f(node.id))})},_setBGV:function(profile,v,m){var date=linb.Date,p=profile.properties,daymap=profile.$daymap||(profile.$daymap=[]),t,n,fd=p.WEEK_FIRST;profile.box._getLabelNodes(profile).each(function(node,i){n=date.add(v,"d",i,fd);daymap[i]=n;t=date.get(n,"m",fd)==m?"#":'<p class="exday">#</p>';n=date.get(n,"d",fd);node.innerHTML=t.replace("#",n)});profile.box._getWeekNodes(profile).each(function(node,i){node.innerHTML=date.get(date.add(v,"ww",i,fd),"ww",fd)})},_to:function(profile,mfirst,value){var p=profile.properties,fd=p.WEEK_FIRST,date=linb.Date,keys=profile.keys,uiv=value||p.$UIvalue,md=date.get(uiv,"m",fd)+"-"+date.get(uiv,"d",fd),ym1=date.get(uiv,"y",fd)+"-"+date.get(uiv,"m",fd),ym2=date.get(mfirst,"y",fd)+"-"+date.get(mfirst,"m",fd),index=-1,node,temp,_realstart=date.getTimSpanStart(date.getTimSpanStart(mfirst,"m"),"ww",1,fd),m=date.get(mfirst,"m",fd);profile.$mfirst=mfirst;this._setBGV(profile,profile._realstart=_realstart,m);if(profile.$selnode){profile.$selnode.tagClass("-checked",false)}if(ym1==ym2){_.arr.each(profile.$daymap,function(o,i){if(date.get(o,"m",fd)+"-"+date.get(o,"d",fd)==md){index=i;return false}});node=this._getTDNodes(profile).get()[index];(profile.$selnode=linb([node]).tagClass("-checked"))}if(keys.YEAR){temp=date.get(mfirst,"y",fd);if(profile.$year!=temp){profile.$year=temp;profile.getSubNode("YEAR").html(temp,false)}}if(keys.MONTH){temp=date.get(mfirst,"m",fd)+1;if(profile.$month!=temp){profile.$month=temp;profile.getSubNode("MONTH").html(temp,false)}}},_onresize:function(){}}});Class("linb.UI.TimePicker",["linb.UI","linb.absValue"],{Dependency:["linb.Date"],Instance:{activate:function(){this.getSubNode("PRE").focus();return this},_setCtrlValue:function(value){return this.each(function(profile){if(!profile.renderId){return }var instance=profile.boxing(),cls=profile.box,p=profile.properties,uiv=p.$UIvalue,arr1=cls._v2a(uiv),arr2=cls._v2a(value);profile.$hour=arr2[0];if(arr1[1]){cls._uncheck(profile.getSubNode("MI",arr1[1]).get(0))}cls._check(profile.getSubNode("MI",arr2[1]).get(0));profile.getSubNode("HOUR").html(arr2[0],false);profile.getSubNode("CAPTION").html(profile.box._showV(profile,profile.box._v2a(arr2)),false)})}},Initialize:function(){this.addTemplateKeys(["MI"]);var a=[],cls=this._excls,cls2=this._excls2,id=linb.UI.$ID,t='<span id="'+this.KEY+"-MI:"+id+':@" class="'+cls+' !" unselectable="on" >@</span>',i,m;for(i=0;i<60;i++){a[a.length]=t.replace(/@/g,i<10?"0"+i:i).replace("!",(i%5===0)?cls2:"")}m=a.join("");a.length=0;this.setTemplate({tagName:"div",onselectstart:"return false",style:"{_style};height:auto;",BORDER:{tagName:"div",BAR:{tagName:"div",className:"uibar-top",style:"{barDisplay};",BART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BARTR:{tagName:"tr",BARTDL:{tagName:"td",className:"uibar-tdl"},BARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl",PRE:{$order:0,tagName:"a",href:linb.$href,tabindex:"{tabindex}"},HOUR:{$order:1,unselectable:"on",className:"ui-dragable"},NEXT:{$order:3,tagName:"a",href:linb.$href,tabindex:"{tabindex}"}},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",CLOSE:{className:"uicmd-close ",style:"{closeDisplay}"}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",CON:{tagName:"div",text:m}}},TAIL:{$order:3,tagName:"div",className:"uicon-main",TAILI:{tagName:"div",className:"uicon-maini",CAPTION:{text:"{caption}"},SET:{className:"ui-btn",SETI:{className:"ui-btni",SETC:{className:"ui-btnc",SETA:{tagName:"a",href:linb.$href,tabindex:"{tabindex}",text:linb.wrapRes("inline.set")}}}}}},BBAR:{$order:4,tagName:"div",className:"uibar-bottom-s",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}}})},Static:{_excls:"linbex-timepicker",_excls2:"linbex-timepicker2",_excls_mo:"linbex-timepicker-mouseover",_excls_c:"linbex-timepicker-checked",_mover:function(src){var b=this,cn=src.className;if(cn.indexOf(b._excls_mo)==-1){src.className=cn+" "+b._excls_mo}src=null},_mout:function(src){var b=this,cn=src.className;if(cn.indexOf(b._excls_mo)!=-1){src.className=cn.replace(b._excls_mo,"")}src=null},_check:function(src){var b=this,cn=src.className;if(cn.indexOf(b._excls_c)==-1){src.className=cn+" "+b._excls_c}b._mout(src);src=null},_uncheck:function(src){var b=this,cn=src.className;if(cn.indexOf(b._excls_c)!=-1){src.className=cn.replace(b._excls_c,"")}src=null},Appearances:{KEY:{"-moz-user-select":"none"},MAINI:{"padding-top":"4px"},CON:{width:"220px","border-left":"solid 1px #648CB4","border-top":"solid 1px #648CB4"},BARCMDL:{top:"3px"},"PRE,NEXT":{position:"relative",margin:"0 2px",width:"15px",height:"15px","vertical-align":"middle",cursor:"default",background:linb.UI.$bg("icons.gif","no-repeat",true),_zoom:1},PRE:{$order:1,display:linb.$inlineBlock,"background-position":"-260px -70px"},"PRE-mouseover":{$order:2,"background-position":"-260px -90px"},"PRE-mousedown":{$order:3,"background-position":"-260px -110px"},NEXT:{$order:1,display:linb.$inlineBlock,"background-position":"-280px -70px"},"NEXT-mouseover":{$order:2,"background-position":"-280px -90px"},"NEXT-mousedown":{$order:3,"background-position":"-280px -110px"},HOUR:{$order:3,margin:"0 2px",height:"15px",width:"16px","font-weight":"bold","vertical-align":"middle",border:"1px solid #779EBF","background-color":"#F8FBFF",cursor:"e-resize","padding-left":"2px"},SET:{position:"absolute",display:"none",color:"#ff0000",top:"1px",right:"5px"},TAILI:{position:"relative","padding-top":"4px",height:"20px","text-align":"center"},CAPTION:{"font-size":"12px","vertical-align":"middle"},".linbex-timepicker2":{$order:1,"background-color":"#FDF8D2"},".linbex-timepicker":{"font-size":"12px","padding-left":"3px",width:"18px",height:"16px","border-right":"1px solid #648CB4","border-bottom":"1px solid #648CB4","background-color":"#F9F9FB"},".linbex-timepicker-mouseover":{$order:2,"background-color":"#d9e8fb"},".linbex-timepicker-checked":{$order:2,"background-color":"#316AC5",color:"#fff"}},Behaviors:{HoverEffected:{CLOSE:"CLOSE",PRE:"PRE",NEXT:"NEXT",SET:"SET"},ClickEffected:{CLOSE:"CLOSE",PRE:"PRE",NEXT:"NEXT",SET:"SET"},KEY:{onClick:function(){return false}},HOUR:{onMousedown:function(profile,e,src){linb(src).startDrag(e,{dragType:"blank",targetReposition:false,widthIncrement:5,dragCursor:true});profile.$temp2=0},onDrag:function(profile,e,src){var count,off=linb.DragDrop.getProfile().offset,v=profile.properties.$UIvalue,a=v.split(":");a[0]=(parseFloat(a[0])||0)+parseInt(off.x/10);a[0]=(a[0]%24+24)%24;profile.$temp2=(a[0]<=9?"0":"")+a[0];if(v[0]!=profile.$temp2){profile.getSubNode("HOUR").html(profile.$temp2,false)}},onDragstop:function(profile,e,src){if(profile.$temp2){profile.$hour=profile.$temp2}profile.$temp2=0;profile.box._hourC(profile)}},SET:{onClick:function(profile){var pro=profile.properties,v=pro.$UIvalue,a=v.split(":");a[0]=profile.$hour;profile.boxing().setUIValue(a.join(":"),true);profile.box._hourC(profile)}},MI:{onMouseover:function(profile,e,src){profile.box._mover(linb.use(src).get(0))},onMouseout:function(profile,e,src){profile.box._mout(linb.use(src).get(0))},onClick:function(profile,e,src){var a=[];a[0]=profile.$hour;a[1]=profile.getSubId(src);profile.boxing().setUIValue(a.join(":"),true);profile.box._hourC(profile)}},PRE:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var v=profile.$hour;v=(parseFloat(v)||0)-1;v=(v%24+24)%24;profile.$hour=v=(v<=9?"0":"")+v;profile.getSubNode("HOUR").html(v,false);profile.box._hourC(profile)}},NEXT:{onClick:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var v=profile.$hour;v=(parseFloat(v)||0)+1;v=(v%24+24)%24;profile.$hour=v=(v<=9?"0":"")+v;profile.getSubNode("HOUR").html(v,false);profile.box._hourC(profile)}},CLOSE:{onClick:function(profile,e,src){var properties=profile.properties,instance=profile.boxing();if(properties.disabled){return }if(false===instance.beforeClose(profile,src)){return }instance.destroy();return false}}},DataModel:{height:{ini:"auto",readonly:true},width:{ini:231,readonly:true},value:"00:00",closeBtn:{ini:true,action:function(v){this.getSubNode("CLOSE").css("display",v?"":"none")}}},EventHandlers:{beforeClose:function(profile,src){}},_hourC:function(profile){var pro=profile.properties,v=pro.$UIvalue,a=v.split(":"),d=a[0]==profile.$hour;profile.getSubNode("SET").css("display",d?"none":"block");profile.getSubNode("CAPTION").css("color",d?"":"#ff0000")},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);var nodisplay="display:none";data.closeDisplay=data.closeBtn?"":nodisplay;return data},_ensureValue:function(profile,value){var a,b=[];if(value&&typeof value=="string"){a=value.split(":")}else{if(value&&typeof value=="object"&&_.isArr(value)){a=value}else{a=[]}}b[0]=parseFloat(a[0])||0;b[1]=parseFloat(a[1])||0;if(b[0]<0){b[0]=0}if(b[0]>23){b[0]=23}if(b[1]<0){b[1]=0}if(b[1]>59){b[1]=59}b[0]=(b[0]<=9?"0":"")+b[0];b[1]=(b[1]<=9?"0":"")+b[1];return b.join(":")},formatValue:function(value){return value.join(":")},_v2a:function(v){return typeof v=="string"?v.split(":"):v},_showV:function(profile,a){var f=profile.CF;if(typeof f.formatCaption=="function"){return f.formatCaption(a)}else{return a.join(":")}},_onresize:function(){}}});Class("linb.UI.TimeLine",["linb.UI","linb.absList","linb.absValue"],{Dependency:["linb.Date"],Instance:{_setCtrlValue:function(value){if(!value){return }if(value.indexOf(":")==-1){return }var profile=this.get(0),p=profile.properties,box=this.constructor,a=value.split(":"),from=new Date(parseInt(a[0])),to=new Date(parseInt(a[1])),pxStart=box._getX(profile,from),pxEnd=box._getX(profile,to),task;if(p.items.length===0){this.insertItems([{id:"$",caption:p.dftTaskName,from:from,to:to}],null,true)}else{box._resetItem(profile,{left:pxStart,width:pxEnd-pxStart},profile.getSubNodeByItemId("ITEM",p.items[0].id)._get(0))}},visibleTask:function(){var profile=this.get(0),p=profile.properties,date=linb.Date,items=p.items;if(items.length&&!p.multiTasks){target=new Date(items[0].from);if(target<p.dateStart||target>date.add(p.dateStart,"ms",p.width*p._rate)){p.dateStart=target;var k=p.$UIvalue;this.refresh().setUIValue(k)}}return this},_afterInsertItems:function(profile){if(!profile.renderId){return }profile.box._reArrage(profile)},_afterRemoveItems:function(profile){profile.box._reArrage(profile)},_cache:function(){var profile=this.get(0),cls=this.constructor,picker=cls._picker;if(picker&&picker.renderId){profile.getSubNode("POOL").append(picker.getRoot().css("display","none"))}},getTimeRange:function(){var profile=this.get(0),p=profile.properties;return[p._smallLabelStart,p._smallLabelEnd]},iniContent:function(){return this.each(function(profile){var p=profile.properties;profile.boxing()._getContent(p._smallLabelStart,p._smallLabelEnd,p._rate,"ini")})},addTasks:function(arr){return this.insertItems(arr,null,true)},removeTasks:function(ids){this.removeItems(ids);return this},_getContent:function(from,to,rate,type){return this.each(function(profile){if(profile.onGetContent){var ins=profile.boxing(),callback=function(arr){ins.addTasks(arr)};if(profile.onGetContent){var r=ins.onGetContent(profile,from,to,rate,type,callback);if(r){callback(r)}}}})}},Static:{Templates:{tagName:"div",style:"{_style}",BORDER:{tagName:"div",style:"height:{_bHeight}px;width:{_bWidth}px;",POOL:{tagName:"div",style:"position:absolute;left:0;top:0;width:0;height:0;display:none;"},TBAR:{tagName:"div",className:"uibar-top",style:"{_bardisplay};",TBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",TBARTR:{tagName:"tr",TBARTDL:{tagName:"td",className:"uibar-tdl"},TBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},TBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl",DATE:{$order:0,style:"{dateDisplay}"},PRE:{$order:2},ZOOMIN:{$order:3,style:"{zoomDisplay}"},ZOOMOUT:{$order:4,style:"{zoomDisplay}"},NEXT:{$order:5}},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",OPT:{className:"uicmd-opt",style:"{optDisplay}",$order:0},CLOSE:{$order:4,className:"uicmd-close ",style:"{closeDisplay}"}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",MAINC:{tagName:"div",MAINP:{tagName:"div",BAND:{$order:2,tagName:"div",style:"left:{_band_left}px;width:{_band_width}px;",BIGLABEL:{tagName:"div",style:"{_showBigLabel}",text:"{_bigMarks}"},SMALLLABEL:{$order:1,tagName:"div",text:"{_smallMarks}"}},VIEW:{$order:3,tagName:"div",style:"height:{_viewHeight}px;",ITEMS:{tagName:"div",style:"left:{_band_left}px;width:{_band_width}px;",text:"{items}",ACTIVE:{$order:3,tagName:"div"}},SCROLL:{tagName:"div",SCROLLI:{tagName:"div"}}}}}}},TAIL:{$order:4,tagName:"div",className:"uicon-main",TIPS:{className:"uicon-maini",style:"z-index:2;{_tipsdisplay};",tagName:"div"}},BBAR:{$order:5,tagName:"div",style:"{_bardisplay};",className:"uibar-bottom-s",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}},$submap:{_bigMarks:{LABELT:{id:null,className:null,tagName:"div",onselectstart:"return false",unselectable:"on",style:"width:{width}px;left:{left}px;",text:"{text}"}},_smallMarks:{LABELB:{id:null,className:null,tagName:"div",onselectstart:"return false",unselectable:"on",style:"width:{width}px;left:{left}px;",text:"{text}"}},items:{ITEM:{tagName:"div",className:"{itemClass} {disabled}",style:"left:{_left}px;width:{_width}px;{_top};{_height};{itemStyle}",MIN:{$order:0,tagName:"div",style:"{_minDisplay}"},NORMAL:{$order:1,tagName:"div",style:"{_normalDisplay};{_height};{_border}{_background}",LEFT:{$order:1,tagName:"div"},HEAD:{$order:2,tagName:"div"},CON:{$order:3,tagName:"div",text:"{caption}"},RIGHT:{$order:4,tagName:"div"}}}}}},Behaviors:{DropableKeys:["ITEMS"],HoverEffected:{PRE:"PRE",NEXT:"NEXT",ZOOMIN:"ZOOMIN",ZOOMOUT:"ZOOMOUT",DATE:"DATE",OPT:"OPT",CLOSE:"CLOSE",MIN:"MIN",NORMAL:"NORMAL"},ClickEffected:{PRE:"PRE",NEXT:"NEXT",ZOOMIN:"ZOOMIN",ZOOMOUT:"ZOOMOUT",DATE:"DATE",OPT:"OPT",CLOSE:"CLOSE",MIN:"MIN"},onSize:linb.UI.$onSize,onKeydown:function(profile,e,src){if(profile.pauseA||profile.pause){return }profile.pause=true;var t=profile.properties,date=linb.Date,rate=t._rate,maxOffset=30,o=profile.box._getMoveNodes(profile),x=o.left(),xx=t._band_left,off=t._scroll_offset;off=t._scroll_offset=off>maxOffset?off:off*1.05;switch(linb.Event.getKey(e)[0]){case"left":case"up":if(t.minDate&&date.add(t.dateStart,"ms",(xx-x-off)*rate)<t.minDate){off=date.diff(t.minDate,t.dateStart,"ms")/rate+(xx-x)}if(off<0){off=0}o.left(x+off);break;case"right":case"down":if(t.maxDate&&date.add(t.dateStart,"ms",(xx-x+off+t.width)*rate)>t.maxDate){off=date.diff(t.dateStart,t.maxDate,"ms")/rate-(xx-x+t.width)}if(off<0){off=0}o.left(x-off);break}if((x+maxOffset>0)||(x+o.width()-t.width-maxOffset<0)){profile.box._rePosition(profile)}profile.pause=false;return false},onKeyup:function(profile,e){var p=profile.properties;p._scroll_offset=p._scrollRate;profile.box._rePosition(profile)},CLOSE:{onClick:function(profile,e,src){if(profile.properties.disabled){return }var instance=profile.boxing();if(false===instance.beforeClose(profile,src)){return }instance.destroy();return false}},OPT:{onClick:function(profile,e,src){if(profile.properties.disabled){return }profile.boxing().onShowOptions(profile,e,src)}},BAND:{onMousedown:function(profile,e,src){if(profile.pauseA||profile.pause){return }var t=profile.properties,r=-t._band_left,date=linb.Date,rate=t._rate,ep=linb.Event.getPos(e),l=t._band_width-r-t.width;if(t.minDate&&t._smallLabelStart<t.minDate){r-=date.diff(t._smallLabelStart,t.minDate,"ms")/rate}if(t.maxDate&&t._smallLabelEnd>t.maxDate){l-=date.diff(t.maxDate,t._smallLabelEnd,"ms")/rate}if(r<0){r=0}if(l<0){l=0}linb.use(src).startDrag(e,{targetReposition:false,dragType:"blank",horizontalOnly:true,targetLeft:ep.left,targetTop:ep.top,maxLeftOffset:l,maxRightOffset:r})},onDragstop:function(profile,e,src){profile.box._rePosition(profile)},onDrag:function(profile,e,src){var ns=profile.box._getMoveNodes(profile),dd=linb.DragDrop.getProfile();ns.left(profile.properties._band_left+dd.offset.x)}},SCROLL:{onScroll:function(profile,e,src){profile.getSubNode("ITEMS").top(-linb.use(src).scrollTop())}},ITEMS:{onMouseover:function(profile,e,src){if(linb.DragDrop.getProfile().isWorking){return }profile.$itemspos=linb.use(src).offset()},onMousemove:function(profile,e){var ddd=linb.DragDrop.getProfile();if(ddd.isWorking){if(profile.$$ondrag){profile.box._moveActive(profile,profile.$active,ddd.x-profile.$dd_ox,profile.properties._unitPixs)}}else{var t=profile.properties,date=linb.Date,s=t._smallLabelStart,r=t._rate,u=t._timeFormat,p2=profile.$itemspos;if(p2&&t.showTips){var p1=linb.Event.getPos(e);profile.box._setTips(profile,date.getText(date.add(s,"ms",(p1.left-p2.left)*r),u))}}},onMouseout:function(profile,e,src){if(linb.DragDrop.getProfile().isWorking){return }if(profile.properties.showTips){profile.box._setTips(profile,"")}},onMousedown:function(profile,e,src){var pro=profile.properties;if(pro.disabled||pro.readonly){return }if(profile.pauseA||profile.pause){return }if(linb.Event.getSrc(e)!=linb.use(src).get(0)){return }var o=profile.getSubNode("ACTIVE"),x=linb.Event.getPos(e).left;o.css({display:"block",width:"0"}).offset({left:x,top:null});o.startDrag(e,{dragType:"none"})}},ACTIVE:{onDragbegin:function(profile,e,src){profile.$dd_ox=linb.DragDrop.getProfile().x;profile.$dd_oleft=parseInt(linb.use(src).get(0).style.left)||0;linb.use(src).css("cursor","e-resize").parent().css("cursor","e-resize")},onDrag:function(profile,e,src){var x=profile.$dd_oleft,ddx=linb.DragDrop.getProfile().x,w,offset;if((offset=ddx-profile.$dd_ox)>=0){w=offset}else{x=x+offset;w=-offset}profile.box._moveActive(profile,linb.use(src).get(0),x,w)},onDragstop:function(profile,e,src){var r=profile.box._deActive(profile);linb.use(src).css("cursor","").parent().css("cursor","");var box=profile.box,from=box._getTime(profile,r.left),to=box._getTime(profile,r.left+r.width),p=profile.properties,task,t,b=profile.boxing();if(profile.properties.multiTasks){task={id:_.id(),caption:p.dftTaskName,from:from,to:to};if(profile.beforeNewTasks&&false===b.beforeNewTasks(profile,[task])){}else{b.addTasks([task])}}else{b.setUIValue(from+":"+to)}profile.$dd_ox=profile.$dd_oleft=null}},PRE:{onClick:function(profile,e){if(profile.pauseA||profile.pause){return }var t=profile.properties,date=linb.Date,rate=t._rate,o=profile.box._getMoveNodes(profile),x1=t._band_left,x2=0;if(t.minDate&&t._smallLabelStart<t.minDate){x2-=date.diff(t._smallLabelStart,t.minDate,"ms")/rate}profile.pause=true;o.animate({left:[x1,x2]},null,function(){profile.box._rePosition(profile);profile.pause=false},200,Math.max(5,(x2-x1)/100),"sineInOut").start()}},NEXT:{onClick:function(profile,e){if(profile.pauseA||profile.pause){return }var t=profile.properties,date=linb.Date,rate=t._rate,o=profile.box._getMoveNodes(profile),x1=t._band_left,x2=t.width-t._band_width;if(t.maxDate&&t._smallLabelEnd>t.maxDate){x2+=date.diff(t.maxDate,t._smallLabelEnd,"ms")/rate}if(x1>x2){profile.pause=true;o.animate({left:[x1,x2]},null,function(){profile.box._rePosition(profile);profile.pause=false},200,Math.max(5,(x1-x2)/100),"sineInOut").start()}}},ZOOMIN:{onClick:function(profile,e){if(profile.pauseA||profile.pause){return }var p=profile.properties,box=profile.box,z=box.$zoom,index=_.arr.indexOf(z,p._unitParas),o;if(index>0){p.timeSpanKey=z[index-1][0];o=profile.getSubNodes(["VIEW","BAND"])}}},ZOOMOUT:{onClick:function(profile,e){if(profile.pauseA||profile.pause){return }var p=profile.properties,box=profile.box,z=box.$zoom,index=_.arr.indexOf(z,p._unitParas),o;if(index<z.length-1){p.timeSpanKey=z[index+1][0];o=profile.getSubNodes(["VIEW","BAND"])}}},DATE:{onClick:function(profile,e,src){if(profile.pauseA||profile.pause){return }var cls=profile.box,box=profile.boxing(),from=profile.properties.dateStart,o,node;if(cls._picker&&cls._picker.renderId){o=cls._picker.boxing()}else{o=linb.create("DatePicker");cls._picker=o.get(0);o.beforeClose(function(){this.boxing()._cache();return false}).beforeUIValueSet(function(p,ov,v){var profile=this,obj=profile.getSubNodes(["VIEW","BAND"]),box=profile.boxing(),p=profile.properties;p.dateStart=v;box._cache()})}o.setValue(from,true).host(profile);node=o.reBoxing();node.popToTop(src);node.setBlurTrigger(profile.key+" - "+profile.$linbid,function(){box._cache()});linb.Event.keyboardHook("esc",0,0,0,function(){box._cache();linb.Event.keyboardHook("esc")})}},ITEM:{onClick:function(profile,e,src){if(profile.onClickTask){profile.boxing().onClickTask(profile,profile.getItemByDom(src),e,src)}},onDragbegin:function(profile,e,src){var t=profile.getItemByDom(src),type=profile.$dd_type,cursor=type?"e-resize":"move",ac=profile.$active;profile.$dd_ox=linb.DragDrop.getProfile().x;profile.$dd_oleft=parseInt(linb.use(src).get(0).style.left);profile.$dd_owidth=parseInt(linb.use(src).get(0).style.width);linb([ac]).css("display","block").cssPos({left:profile.$dd_oleft,top:null}).width(profile.$dd_owidth-2);linb([ac,ac.parentNode]).css("cursor",cursor)},onDrag:function(profile,e,src){var x,w,offset=linb.DragDrop.getProfile().x-profile.$dd_ox,ddl=profile.$dd_oleft,ddw=profile.$dd_owidth,type=profile.$dd_type;if(type=="left"){if(offset<ddw){x=ddl+offset;w=ddl+ddw-x}else{x=ddl+ddw;w=offset-ddw}}else{if(type=="right"){if(-offset<ddw){x=ddl;w=ddw+offset}else{x=ddl+offset+ddw;w=-offset-ddw}}else{x=ddl+offset;w=ddw}}profile.box._moveActive(profile,profile.$active,x,w)},onDragstop:function(profile,e,src){var box=profile.box,r=profile.box._deActive(profile),ac=profile.$active;var from=box._getTime(profile,r.left),to=box._getTime(profile,r.left+r.width);if(profile.properties.multiTasks){if(profile.beforeTaskUpdated&&false===profile.boxing().beforeTaskUpdated(profile,profile.getItemByDom(src),from,to)){}else{box._resetItem(profile,r,src)}}else{profile.boxing().setUIValue(from+":"+to)}profile.$dd_type=null;linb([ac,ac.parentNode]).css("cursor","")}},HEAD:{onMousedown:function(profile,e,src){var ps=profile.properties,item=profile.getItemByDom(src);if(ps.disabled||item.disabled){return }if(profile.beforeDragTask&&false===profile.boxing().beforeDragTask(profile,item,e,src)){return }if(ps.readonly||item.readonly){return }linb.use(src).parent(2).startDrag(e,{dragDefer:1,dragType:"none"})}},LEFT:{onMousedown:function(profile,e,src){var ps=profile.properties,item=profile.getItemByDom(src);if(ps.disabled||ps.readonly||item.readonly||item.disabled){return }profile.$dd_type="left";linb.use(src).parent(2).startDrag(e,{dragDefer:1,dragType:"none"})}},RIGHT:{onMousedown:function(profile,e,src){var ps=profile.properties,item=profile.getItemByDom(src);if(ps.disabled||ps.readonly||item.readonly||item.disabled){return }profile.$dd_type="right";linb.use(src).parent(2).startDrag(e,{dragDefer:1,dragType:"none"})}}},DataModel:{readonly:false,width:400,height:200,leftSpanCount:{ini:0,inner:1},rightSpanCount:{ini:0,inner:1},increment:0,zoomable:{ini:true,action:function(v){if(this.properties.timeSpanKey){this.getSubNodes(["ZOOMIN","ZOOMOUT"]).css("display",v?"":"none")}}},dftTaskName:"task",taskHeight:{ini:16,action:function(v){this.getSubNode("ITEM",true).height(v)}},timeSpanKey:{ini:"1 d",action:function(){this.box._refresh(this)}},unitPixs:{action:function(){this.box._refresh(this)}},smallLabelCount:{inner:1},smallLabelUnit:{inner:1,listbox:_.toArr(linb.Date.$TIMEUNIT,true)},smallLabelFormat:{inner:1,listbox:_.toArr(linb.Date.$TEXTFORMAT,true)},bigLabelCount:{inner:1},bigLabelUnit:{inner:1,listbox:_.toArr(linb.Date.$TIMEUNIT,true)},bigLabelFormat:{inner:1,listbox:_.toArr(linb.Date.$TEXTFORMAT,true)},timeFormat:{inner:1,listbox:_.toArr(linb.Date.$TEXTFORMAT,true)},showBar:{ini:true,action:function(v){this.getSubNode("TBAR").css("display",v?"":"none");var p=this.properties,w=p.width,h=p.height;p.width=p.height=0;linb.UI.$tryResize(this,w,h,true);p.width=w,p.height=h}},showTips:{ini:true,action:function(v){this.getSubNode("TIPS").css("display",v?"":"none");var p=this.properties,w=p.width,h=p.height;p.width=p.height=0;linb.UI.$tryResize(this,w,h,true);p.width=w,p.height=h}},showBigLabel:{ini:true,action:function(v){this.getSubNode("BIGLABEL").css("display",v?"":"none");var p=this.properties,w=p.width,h=p.height;p.width=p.height=0;linb.UI.$tryResize(this,w,h,true);p.width=w,p.height=h}},_scrollRate:5,multiTasks:{ini:false,action:function(){this.box._refresh(this)}},minDate:{ini:null,action:function(value){if(value>this.properties.dateStart){this.box._refresh(this)}}},maxDate:{ini:null,action:function(value){var p=this.properties;if(value<linb.Date.add(p.dateStart,"ms",p.width*p._rate)){this.box._refresh(this)}}},dateBtn:{ini:true,action:function(v){this.getSubNode("DATE").css("display",v?"":"none")}},closeBtn:{ini:false,action:function(v){this.getSubNode("CLOSE").css("display",v?"":"none")}},optBtn:{ini:false,action:function(v){this.getSubNode("OPT").css("display",v?"":"none")}},fixWidth:true,dateStart:{ini:new Date,action:function(){this.box._refresh(this)}}},EventHandlers:{beforeClose:function(profile,src){},onShowOptions:function(profile,e,src){},onGetContent:function(profile,from,to,minMs,type,callback){},beforeTaskUpdated:function(profile,task,from,to){},beforeNewTasks:function(profile,tasks){},beforeDelTasks:function(profile,arr){},beforeDragTask:function(profile,task,e,src){},onClickTask:function(profile,task,e,src){}},Appearances:{MAINI:{"padding-top":"4px"},MAINC:{border:"solid 1px #648CB4",background:"#fff"},"BARCMDL span":{$order:0,position:"relative",width:"15px",height:"15px",margin:"2px","vertical-align":"middle",cursor:"default"},"MAINP, BAND, VIEW, BIGLABEL, SMALLLABEL":{position:"relative"},"VIEW, MAINP":{width:linb.browser.ie6?"100%":null,overflow:"hidden"},SCROLL:{"z-index":500,position:"absolute","font-size":"0","line-height":"0",right:0,top:0,height:"100%",width:"18px",overflow:"auto","overflow-x":linb.browser.opr?null:"hidden"},SCROLLI:{height:"1000px",width:"1px"},BIGLABEL:{"z-index":3,height:"16px","background-color":"#C8E2FC",cursor:"move","border-bottom":"solid 1px #7BA3CB"},SMALLLABEL:{"z-index":4,height:"14px","background-color":"#C8E2FC",cursor:"move","border-bottom":"solid 1px #648CB4"},ITEMS:{position:"relative",background:linb.UI.$bg("bars.gif"," left top")},"BIGLABEL div, SMALLLABEL div":{"border-left":"solid 1px #7BA3CB","text-align":"center",position:"absolute",cursor:"move","-moz-user-select":linb.browser.gek?"none":"",top:0,overflow:"visible",height:"100%"},"BIGLABEL div":{$order:2,"text-align":"left","padding-left":"4px"},TIPS:{position:"relative",height:"14px","font-size":"12px","line-height":"14px","text-align":"center"},ACTIVE:{"z-index":300,position:"relative","border-left":"1px dashed","border-right":"1px dashed",left:"-100px",width:"0",background:0,height:"100%"},"ZOOMIN, ZOOMOUT, DATE, PRE, NEXT, MIN":{background:linb.UI.$bg("icons.gif","no-repeat",true)},ZOOMIN:{$order:1,"background-position":"-360px -70px"},"ZOOMIN-mouseover":{$order:2,"background-position":"-360px -90px"},"ZOOMIN-mousedown":{$order:3,"background-position":"-360px -110px"},ZOOMOUT:{$order:1,"background-position":"-380px -70px"},"ZOOMOUT-mouseover":{$order:2,"background-position":"-380px -90px"},"ZOOMOUT-mousedown":{$order:3,"background-position":"-380px -110px"},DATE:{$order:1,"background-position":"-340px -70px"},"DATE-mouseover":{$order:2,"background-position":" -340px -90px"},"DATE-mousedown":{$order:3,"background-position":" -340px -110px"},PRE:{$order:1,"background-position":"-260px -70px",top:"0"},"PRE-mouseover":{$order:2,"background-position":"-260px -90px"},"PRE-mousedown":{$order:3,"background-position":"-260px -110px"},NEXT:{$order:1,position:"absolute","background-position":"-280px -70px",top:"0"},"NEXT-mouseover":{$order:2,"background-position":"-280px -90px"},"NEXT-mousedown":{$order:3,"background-position":"-280px -110px"},ITEM:{position:"absolute",overflow:"visible"},"MIN, NORMAL":{position:"relative",height:"16px",overflow:"hidden","z-index":"1"},MIN:{width:"16px","background-position":"-320px -70px",cursor:"pointer"},"MIN-mouseover":{"background-position":"-320px -90px"},"MIN-mousedown":{"background-position":"-320px -110px"},NORMAL:{cursor:"pointer","background-color":"#B3D7FB",border:"solid 1px #648CB4"},"NORMAL-mouseover":{$order:2,"border-color":"red"},"LEFT, HEAD, RIGHT":{position:"absolute",top:0,height:"100%"},HEAD:{background:linb.UI.$bg("handler.gif"," left top",true),width:"6px",left:"3px",cursor:"move","z-index":5},"LEFT, RIGHT":{width:"2px","z-index":10},LEFT:{cursor:"e-resize",left:0},RIGHT:{cursor:"w-resize",right:0},CON:{"padding-left":"12px",position:"relative",height:"100%",overflow:"hidden"}},RenderTrigger:function(){var self=this,p=self.properties,cls=self.box;self.$active=self.getSubNode("ACTIVE").get(0);cls._ajustHeight(self);self.boxing().iniContent()},_onDropMarkShow:function(){linb.DragDrop.setDragIcon("add");return false},_onDropMarkClear:function(){linb.DragDrop.setDragIcon("none");return false},_onDragEnter:function(profile,e,src){var t=profile.properties,ep=linb.Event.getPos(e),_left=t._unitPixs/2;linb(profile.$active).css("display","block");profile.$dd_ox=linb.use(src).offset().left+_left;profile.$$ondrag=true},_onDragLeave:function(profile){profile.$$ondrag=profile.$dd_ox=null;profile.box._deActive(profile)},_onDrop:function(profile){profile.$$ondrag=profile.$dd_ox=null;var r=profile.box._deActive(profile),task={id:_.id(),caption:profile.properties.dftTaskName},box=profile.box,b=profile.boxing();task.from=box._getTime(profile,r.left);task.to=box._getTime(profile,r.left+r.width);task._dropData=linb.DragDrop.getProfile().dragData;if(profile.beforeNewTasks&&false===b.beforeNewTasks(profile,[task])){}else{b.addTasks([task])}},_prepareData:function(profile){var p=profile.properties,d={},date=linb.Date,us=date.$TIMEUNIT,nodisplay="display:none",zoom=profile.box.$zoom,m=0,u,i,t,label,temp,_date,width,rate,_unitParas,_dateStart,_barCount,_leftBarCount,_rightBarCount,_barCountall,smallMarks,smallLabelStart,smallLabelEnd,smallLabelUnit,smallLabelCount,smallLabelFormat;d.dateDisplay=p.dateBtn?"":nodisplay;d.closeDisplay=p.closeBtn?"":nodisplay;d.optDisplay=p.optBtn?"":nodisplay;d._showBigLabel=p.showBigLabel?"":nodisplay;p._scroll_offset=p._scrollRate;p._lines=[{}];d._bWidth=p.width;d._bHeight=p.height;p._viewHeight=d._bHeight;d._tipsdisplay=p.showTips?"":nodisplay;d._bardisplay=p.showBar?"":nodisplay;if(p.timeSpanKey){_.arr.each(zoom,function(o){if(o[0]===p.timeSpanKey){_unitParas=p._unitParas=o;return false}});if(!_unitParas){_unitParas=p._unitParas=zoom[p.timeSpanKey="1 d"]}}d.zoomDisplay=(p.zoomable&&_unitParas)?"":nodisplay;if(_unitParas){p._unitPixs=p.unitPixs||_unitParas[1];p._smallLabelCount=p.smallLabelCount||_unitParas[2];p._smallLabelUnit=p.smallLabelUnit||_unitParas[3];p._smallLabelFormat=p.smallLabelFormat||_unitParas[4];p._bigLabelCount=p.bigLabelCount||_unitParas[5];p._bigLabelUnit=p.bigLabelUnit||_unitParas[6];p._bigLabelFormat=p.bigLabelFormat||_unitParas[7];p._timeFormat=p.timeFormat||_unitParas[8]}u=p._unitPixs;smallLabelCount=p._smallLabelCount;smallLabelUnit=p._smallLabelUnit;smallLabelFormat=p._smallLabelFormat;_barCount=(Math.ceil(p.width/u)||0);_leftBarCount=p.leftSpanCount?p.leftSpanCount:_barCount;_rightBarCount=p.rightSpanCount?p.rightSpanCount:_barCount;_barCountall=_barCount+_leftBarCount+_rightBarCount;rate=p._rate=us[smallLabelUnit]*smallLabelCount/u;if(p.maxDate&&date.add(p.dateStart,"ms",p.width*rate)>p.maxDate){p.dateStart=date.add(p.maxDate,"ms",-p.width*rate)}if(p.minDate&&p.dateStart<p.minDate){p.dateStart=p.minDate}_dateStart=date.getTimSpanStart(p.dateStart,smallLabelUnit,smallLabelCount);smallLabelStart=p._smallLabelStart=date.add(_dateStart,smallLabelUnit,-_leftBarCount*smallLabelCount);smallLabelEnd=p._smallLabelEnd=date.add(smallLabelStart,smallLabelUnit,_barCountall*smallLabelCount);p._band_width=Math.ceil(date.diff(smallLabelStart,smallLabelEnd,"ms")/rate);p._band_left_fix=p._band_left=-Math.ceil(date.diff(smallLabelStart,p.dateStart,"ms")/rate);smallMarks=p._smallMarks=[];temp=0;label=date.get(smallLabelStart,smallLabelFormat);for(i=0;i<_barCountall;i++){_date=date.add(smallLabelStart,smallLabelUnit,smallLabelCount*(i+1));width=Math.ceil(date.diff(smallLabelStart,_date,"ms")/rate);smallMarks.push({left:temp,width:width-temp,text:label});temp=width;label=date.getText(_date,smallLabelFormat)}if(p.showBigLabel){var _barCount2,off,bigMarks,bigLabelStart,bigLabelEnd,bigLabelCount=p._bigLabelCount,bigLabelUnit=p._bigLabelUnit,bigLabelFormat=p._bigLabelFormat;bigMarks=p._bigMarks=[];bigLabelStart=p._bigLabelStart=date.getTimSpanStart(smallLabelStart,bigLabelUnit,bigLabelCount);bigLabelEnd=p._bigLabelEnd=date.getTimSpanEnd(smallLabelEnd,bigLabelUnit,bigLabelCount);_barCount2=date.diff(bigLabelStart,bigLabelEnd,bigLabelUnit)/bigLabelCount;off=date.diff(smallLabelStart,bigLabelStart,"ms")/rate;label=date.getText(bigLabelStart,bigLabelFormat);temp=0;for(i=0;i<_barCount2;i++){_date=date.add(bigLabelStart,bigLabelUnit,bigLabelCount*(i+1));width=date.diff(bigLabelStart,_date,"ms")/rate;bigMarks.push({left:Math.ceil(temp+off),width:Math.ceil(width-temp),text:label});temp=width;label=date.getText(_date,bigLabelFormat)}}return arguments.callee.upper.call(this,profile,d)},_prepareItem:function(profile,item,oitem,pid){var self=this,t=profile.properties,index;if(!item.id){item.id=_.id()}if(!item.caption){item.caption=t.dftTaskName}item._min=false;item._left=self._getX(profile,item.from);item._width=Math.max(self._getX(profile,item.to)-item._left,0);if(t.multiTasks){if(item._width<=16){item._width=16;item._min=true}}item._minDisplay=item._min?"":"display:none";item._normalDisplay=item._min?"display:none":"";index=self._getLinePos(profile,item);item._top=t.multiTasks?"top:"+(item._min?0:((t.taskHeight+3)*(index-1)+16+3))+"px":"";item._height="height:"+(t.multiTasks?item._min?"16px":t.taskHeight+"px":"100%");item._border=t.multiTasks?"":"border-top:0;border-bottom:0";item._background=item.background?"background:"+item.background+";":"";t._lines=t._lines||[{}];t._lines[index][item.id]=item;item._line=index;oitem._left=item._left;oitem._width=item._width;oitem._min=item._min;oitem._line=item._line},$zoom:[["10 ms",54,10,"ms","ms",100,"ms","hnsms","hnsms"],["100 ms",54,100,"ms","ms",1,"s","hns","hnsms"],["1 s",30,1,"s","s",10,"s","hns","hnsms"],["10 s",30,10,"s","s",60,"s","hns","hnsms"],["1 n",30,1,"n","n",10,"n","dhn","hns"],["5 n",30,5,"n","n",30,"n","mdhn","hns"],["10 n",30,10,"n","n",60,"n","mdhn","hns"],["30 n",30,30,"n","n",4,"h","ymdh","mdhn"],["1 h",30,1,"h","h",6,"h","ymdh","mdhn"],["2 h",30,2,"h","h",12,"h","ymdh","mdhn"],["6 h",30,6,"h","h",24,"h","ymd","mdhn"],["1 d",24,1,"d","w",1,"ww","ymd","ymdh"],["1 w",30,1,"ww","ww",4,"ww","ymd","ymd"],["15 d",30,15,"d","d",2,"m","ymd","ymd"],["1 m",30,1,"m","m",1,"q","yq","ymd"],["1 q",30,1,"q","q",1,"y","y","ymd"],["1 y",48,1,"y","y",10,"y","y","ym"],["1 de",48,1,"de","de",100,"y","y","ym"],["1 c",48,1,"c","c",1000,"y","y","y"]],_getTips:function(profile){var t,s="$dd_tooltip";if(t=profile[s]||(profile[s]=profile.getSubNode("TIPS").get(0).childNodes[0])){return t.nodeValue}else{return profile.getSubNode("TIPS").get(0).innerHTML}},_rr:/\<[^>]*\>/g,_setTips:function(profile,text,force){if(!force&&profile.pauseA){return }var t,s="$dd_tooltip";text=text.replace(this._rr,"");if(t=profile[s]||(profile[s]=profile.getSubNode("TIPS").get(0).childNodes[0])){if(t.nodeValue!=text){t.nodeValue=text}}else{profile.getSubNode("TIPS").get(0).innerHTML=text}},_getX:function(profile,time){var t=profile.properties,d=new Date;d.setTime(time);return(Math.ceil(linb.Date.diff(t._smallLabelStart,d,"ms")||0)/t._rate)},_getTime:function(profile,x,flag){var t=profile.properties;t=linb.Date.add(t._smallLabelStart,"ms",x*t._rate);return flag?t:t.getTime()},_moveActive:function(profile,src,x,w){var p=Math.ceil,t=profile.properties,d=linb.Date,s=t._smallLabelStart,r=t._rate,u=t._timeFormat,ms="ms",y=src.style,z="px",m,n,increment;if(increment=t.increment){m=Math.floor((w+increment-1)/increment);x=Math.floor(x/increment)*increment;w=m*increment}m=(p(x)||0);n=((p(w)||0)-2);if(n>0){y.left=m+z;y.width=n+z;if(t.showTips){profile.box._setTips(profile,d.getText(d.add(s,ms,x*r),u)+" - "+d.getText(d.add(s,ms,(x+w)*r),u))}}},_deActive:function(profile){var t=profile.$active.style,x=parseInt(t.left)||0,w=(parseInt(t.width)||0)+2;t.left="-1000px";if(profile.properties.showTips){profile.box._setTips(profile,"")}return{left:x,width:w}},_minusLeft:function(profile,marks,node,offsetCount){var t=profile.properties;while((offsetCount--)>0){node.first().remove();temp=marks.shift()}},_minusRight:function(profile,marks,node,offsetCount){var t=profile.properties;while((offsetCount--)>0){node.last().remove();temp=marks.pop()}},_addLeft:function(profile,tag,node,offsetCount,offset){var t=profile.properties,date=linb.Date,key=tag+"Marks",marks=t[key],labelStart=t[tag+"LabelStart"],labelUnit=t[tag+"LabelUnit"],labelCount=t[tag+"LabelCount"],labelFormat=t[tag+"LabelFormat"],rate=t._rate,addLb=[],temp,label,_date,i;temp=0;label=date.getText(labelStart,labelFormat);for(i=0;i<offsetCount;i++){_date=date.add(labelStart,labelUnit,labelCount*(i+1));width=date.diff(labelStart,_date,"ms")/rate;addLb.push({left:Math.ceil(temp+(offset||0)-3e-13),width:Math.ceil(width-temp),text:label});temp=width;label=date.getText(_date,labelFormat)}addLb.reverse();node.prepend(profile._buildItems(key,addLb));_.arr.insertAny(marks,addLb.reverse(),0)},_addRight:function(profile,labelEnd,tag,node,offsetCount,offset){var t=profile.properties,date=linb.Date,key=tag+"Marks",marks=t[key],labelStart=t[tag+"LabelStart"],labelUnit=t[tag+"LabelUnit"],labelCount=t[tag+"LabelCount"],labelFormat=t[tag+"LabelFormat"],rate=t._rate,addLb=[],_d1,_date,i;_d1=labelEnd;for(i=0;i<offsetCount;i++){_date=date.add(labelEnd,labelUnit,labelCount*(i+1));addLb.push({left:Math.ceil(date.diff(labelStart,_d1,"ms")/rate+(offset||0)-3e-13),width:Math.ceil(date.diff(_d1,_date,"ms")/rate),text:date.getText(_d1,labelFormat)});_d1=_date}node.append(profile._buildItems(key,addLb));_.arr.insertAny(marks,addLb,-1)},_getMoveNodes:function(profile){return profile.$moveban=profile.$moveban||profile.getSubNodes(["BAND","ITEMS"])},_rePosition:function(profile,left){profile.pause=true;var self=this,date=linb.Date,t=profile.properties,rate=t._rate,label,m,n,labelsBottom=profile.getSubNode("SMALLLABEL"),band=self._getMoveNodes(profile),x=left||band.left(),offset=x-t._band_left_fix;if(Math.abs(offset)/t._unitPixs>=1||left){var offsetCount=parseInt(offset/t._unitPixs),bak_s=t._smallLabelStart,bak_e=t._smallLabelEnd,_c=-offsetCount*t._smallLabelCount,offsetPxs,_smallLabelStart,_smallLabelEnd;_smallLabelStart=t._smallLabelStart=date.add(t._smallLabelStart,t._smallLabelUnit,_c);_smallLabelEnd=t._smallLabelEnd=date.add(t._smallLabelEnd,t._smallLabelUnit,_c);offsetPxs=Math.ceil(date.diff(_smallLabelStart,bak_s,"ms")/rate);band.left(x-offsetPxs);t._band_width=Math.ceil(date.diff(_smallLabelStart,_smallLabelEnd,"ms")/rate);_.arr.each(t.items,function(o){o._left+=offsetPxs;profile.box._trimTask(profile,o)});labelsBottom.children().each(function(o){o.style.left=(parseFloat(o.style.left)||0)+offsetPxs+"px"});_.arr.each(t._smallMarks,function(o){o.left+=offsetPxs});if(offsetCount>0){self._minusRight(profile,t._smallMarks,labelsBottom,offsetCount);self._addLeft(profile,"_small",labelsBottom,offsetCount)}else{self._minusLeft(profile,t._smallMarks,labelsBottom,-offsetCount);self._addRight(profile,bak_e,"_small",labelsBottom,-offsetCount)}if(t.multiTasks){var arr=[];_.arr.each(t.items,function(o){if(o._left>=t._band_width||(o._left+o._width)<=0){delete t._lines[o._line][o.id];arr.push(o.id)}});profile.boxing().removeItems(arr);profile.boxing()._getContent(offsetCount>0?_smallLabelStart:bak_e,offsetCount>0?bak_s:_smallLabelEnd,t._rate,offsetCount>0?"left":"right");self._reArrage(profile)}if(t.showBigLabel){var labelsTop=profile.getSubNode("BIGLABEL"),bigLabelUnit=t._bigLabelUnit,bigLabelCount=t._bigLabelCount,off,offsetCount2,offsetCount3,bigLabelStart,bigLabelEnd;bak_e=t._bigLabelEnd;labelsTop.children().each(function(o){o.style.left=(parseFloat(o.style.left)||0)+offsetPxs+"px"});_.arr.each(t._bigMarks,function(o){o.left+=offsetPxs});bigLabelStart=date.getTimSpanStart(_smallLabelStart,bigLabelUnit,bigLabelCount);offsetCount2=Math.ceil(date.diff(_smallLabelStart,t._bigLabelStart,bigLabelUnit)/bigLabelCount);offsetCount3=Math.ceil(date.diff(t._bigLabelEnd,_smallLabelEnd,bigLabelUnit)/bigLabelCount);if(offsetCount2){off=date.diff(_smallLabelStart,bigLabelStart,"ms")/rate;t._bigLabelStart=bigLabelStart;if(offsetCount2>0){self._addLeft(profile,"_big",labelsTop,offsetCount2,off)}else{self._minusLeft(profile,t._bigMarks,labelsTop,-offsetCount2)}}if(offsetCount3){off=date.diff(_smallLabelStart,bigLabelStart,"ms")/rate;t._bigLabelEnd=date.add(t._bigLabelEnd,bigLabelUnit,offsetCount3*bigLabelCount);if(offsetCount3<0){self._minusRight(profile,t._bigMarks,labelsTop,-offsetCount3)}else{self._addRight(profile,bak_e,"_big",labelsTop,offsetCount3,off)}}}}t._band_left=band.left();t.dateStart=self._getTime(profile,-t._band_left,1);profile.pause=false},_trimTask:function(profile,o){var l=-12,x=o._left,w=o._width,bw=profile.properties._band_width;if(x<l){if(x+w<l){w=0}else{w=w+x-l}x=l}if(x>bw+12){x=bw+12}this._setItemNode(profile,o,"left",x+"px");if(x+w>bw-l){w=bw-l-x}if(w>=0){this._setItemNode(profile,o,"width",w+"px")}},_setItemNode:function(profile,item,key,value){var t=profile.getSubNodeByItemId("ITEM",item.id).get(0);t.style[key]=value},_getLinePos:function(profile,o){if(o._min){return 0}var t=profile.properties,b=false,index=0;_.arr.each(t._lines,function(v,i){if(i===0){return }b=true;_.each(v,function(v){if(o.id!==v.id){if(((o._left+o._width)>=v._left)&&((v._left+v._width)>=o._left)){return b=false}}});if(b){index=i;return false}});if(!b){index=t._lines.push({})-1}return index},_reArrage:function(profile){var self=this,o,h,t=profile.properties;t._lines.length=1;t.items.sort(function(x,y){return x.from>y.from?1:x.from==y.from?0:-1});_.arr.each(t.items,function(v){if(v._line===0){return }index=self._getLinePos(profile,v);t._lines[index][v.id]=v;if(v._line!==index){v._line=index;if(t.multiTasks){self._setItemNode(profile,v,"top",((t.taskHeight+3)*(index-1)+16+3)+"px")}}});h=t._linesHeight=t._lines.length*(t.taskHeight+3);self._ajustHeight(profile)},_resetItem:function(profile,o,src){var p=profile.properties,t=profile.getItemByDom(src),bandW=p._band_width+12,f=function(k,i){return profile.getSubNodeByItemId(k,i)},timeline=profile.box,max=Math.max;if(o.left){t._left=o.left;t.from=timeline._getTime(profile,o.left);linb.use(src).get(0).style.left=o.left+"px"}if(o.width){t._width=max(o.width,0);t.to=timeline._getTime(profile,o.left+o.width);if(p.multiTasks){if(t._width<=16){t._width=o.width=16;if(!t._min){t._min=true;f("NORMAL",t.id).css("display","none");f("MIN",t.id).css("display","block")}}else{if(t._min){delete t._line;t._min=false;f("NORMAL",t.id).css("display","block");f("MIN",t.id).css("display","none")}if(o.left+o.width>bandW){o.width=bandW-o.left}}}linb.use(src).get(0).style.width=o.width+"px";if(linb.browser.ie&&!p.multiTasks){linb.use(src).parent().ieRemedy()}}timeline._reArrage(profile)},_ajustHeight:function(profile){var p=profile.properties,f=function(p){return profile.getSubNode(p)},view=f("VIEW"),items=f("ITEMS"),scroll=f("SCROLL"),scrolli=f("SCROLLI"),h,b,ih=p._linesHeight||0,vh=view.height();h=Math.max(ih,vh);items.height(h);scrolli.height(h);b=ih>vh;scroll.css("display",b?"block":"none");items.top(b?-scroll.scrollTop():0)},_showTips:function(profile,node,pos){if(profile.onShowTips){return profile.boxing().onShowTips(profile,node,pos)}if(!linb.Tips){return }var t=profile.properties,id=node.id,format=t._timeFormat,sid=profile.getSubId(id),map=profile.SubSerialIdMapItem,item=map&&map[sid],date=linb.Date;if(t.disabled){return }if(item&&item.disabled){return }if(item){item.tips='<p style="font-weight:bold">'+item.caption+"</p>"+date.getText(new Date(item.from),format)+" - "+date.getText(new Date(item.to),format);linb.Tips.show(pos,item);return true}else{return false}},_beforeSerialized:function(profile){var w=profile.properties.width,o=arguments.callee.upper.call(this,profile);o.properties.width=w;return o},_onresize:function(profile,width,height){var p=profile.properties,f=function(k){return profile.getSubNode(k)},_bbarH=f("BBAR").height(),_tipsH=f("TAIL").height(),off2=f("VIEW").offset(null,profile.getRoot()),off3=2,t;if(height){f("BORDER").height(t=height);f("VIEW").height(t=t-(p.showTips?_tipsH:0)-off2.top-(p.showBar?_bbarH:0)-off3);this._ajustHeight(profile)}if(width&&width!=p.width){f("BORDER").width(width);if(!p.fixWidth){_.resetRun(profile.$linbid+":refresh",function(){profile.box._refresh(profile)})}}},_refresh:function(profile){var pro=profile.properties,ins=profile.boxing(),nodes;ins.clearItems();this._prepareData(profile);nodes=profile._buildItems("_smallMarks",pro._smallMarks);profile.getSubNode("SMALLLABEL").empty().append(nodes);if(pro.showBigLabel){nodes=profile._buildItems("_bigMarks",pro._bigMarks);profile.getSubNode("BIGLABEL").empty().append(nodes)}profile.getSubNodes(["BAND","ITEMS"]).left(pro._band_left).width(pro._band_width);if(!pro.multiTasks){ins.setUIValue(pro.$UIvalue)}else{ins.iniContent()}return this}}});Class("linb.UI.List",["linb.UI","linb.absList","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){if(!profile.renderId){return }var box=profile.box,uiv=profile.boxing().getUIValue(),p=profile.properties,item=box._ITEMKEY||"ITEM",k=box._DIRTYKEY||"ITEM",getN=function(k,i){return profile.getSubNode(k,i)},getI=function(i){return profile.getSubIdByItemId(i)};if(p.selMode=="single"){var itemId=getI(uiv);if(uiv!==null&&itemId){getN(k,itemId).tagClass("-mouseover",false).tagClass("-checked",false)}itemId=getI(value);if(itemId){getN(k,itemId).tagClass("-mouseover",false).tagClass("-checked")}if(itemId){var o=getN(item,itemId);if(o){var top=o.offsetTop(),items=getN("ITEMS"),sh=items.scrollHeight(),st=items.scrollTop(),hh=items.height();if(sh>hh){if(top<st||top>st+hh){items.scrollTop(top)}}}}}else{if(p.selMode=="multi"){uiv=uiv?uiv.split(";"):[];value=value?value.split(";"):[];_.arr.each(uiv,function(o){if(_.arr.indexOf(value,o)==-1){getN(k,getI(o)).tagClass("-mouseover",false).tagClass("-checked",false)}});_.arr.each(value,function(o){if(_.arr.indexOf(uiv,o)==-1){getN(k,getI(o)).tagClass("-mouseover",false).tagClass("-checked")}})}}})},adjustSize:function(){return this.each(function(profile){var items=profile.getSubNode("ITEMS"),pp=profile.properties;items.height("auto");var h=Math.min(pp.maxHeight,items.offsetHeight());pp.height=h;items.height(h);profile.getRoot().height(h)})},activate:function(){return linb.absList.prototype.activate.call(this)},getShowValue:function(value){var profile=this.get(0),pro=profile.properties,v,t;if(!_.isDefined(value)){value=pro.$UIvalue}if((v=_.arr.subIndexOf(pro.items,"id",value))!=-1){v=pro.items[v].caption;v=v.charAt(0)=="$"?linb.getRes(v.slice(1)):v}else{v=""}return v},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }var id=profile.domId,p=profile.properties,flag=p.value!==p.$UIvalue,d=linb.UI.$css_tag_dirty;if(profile.beforeDirtyMark&&false===profile.boxing().beforeDirtyMark(profile,flag)){}else{var o=profile.getSubNode("ITEMS");if(flag){o.addClass(d)}else{o.removeClass(d)}}})}},Static:{_DIRTYKEY:"ITEM",Templates:{tagName:"div",style:"{_style}",className:"uibg-base",ITEMS:{$order:10,tagName:"div",className:"uiborder-inset",text:"{items}"},$submap:{items:{ITEM:{className:"{itemClass} {disabled}",style:"{itemStyle}",tagName:"a",href:linb.$href,tabindex:"{_tabindex}",ICON:{$order:10,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{tagName:"text",text:"{caption}&nbsp;",$order:20}}}}},Appearances:{KEY:{"font-size":"12px"},ITEMS:{position:"relative",overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":""},ITEM:{display:"block",zoom:linb.browser.ie?1:null,"font-family":'"Verdana", "Helvetica", "sans-serif"',border:0,cursor:"pointer","font-size":"12px",padding:"4px 2px",position:"relative"},"ITEM-mouseover, ITEM-mousedown, ITEM-checked":{background:linb.UI.$bg("item.gif","repeat-x")},"ITEM-mouseover":{$order:1,"background-color":"#FAD200","background-position":"left -51px"},"ITEM-mousedown":{$order:2,"background-color":"#F5D22D","background-position":"left -101px"},"ITEM-checked":{$order:2,"background-color":"#AAD2FA","background-position":"left top"}},Behaviors:{HoverEffected:{ITEM:"ITEM"},ClickEffected:{ITEM:"ITEM"},DragableKeys:["ITEM"],DropableKeys:["ITEM","ITEMS"],onSize:linb.UI.$onSize,ITEM:{onDblclick:function(profile,e,src){var properties=profile.properties,item=profile.getItemByDom(src);profile.boxing().onDblclick(profile,item,src)},onClick:function(profile,e,src){var properties=profile.properties,item=profile.getItemByDom(src),itemId=profile.getSubId(src),box=profile.boxing(),ks=linb.Event.getKey(e),rt,rt2;if(properties.disabled||item.disabled){return false}linb.use(src).focus();switch(properties.selMode){case"none":rt=box.onItemSelected(profile,item,src);break;case"multi":var value=box.getUIValue(),arr=value?value.split(";"):[];if(arr.length&&(ks[1]||ks[2]||properties.noCtrlKey||properties.$checkbox)){rt2=false;if(ks[2]){var items=properties.items,i1=_.arr.subIndexOf(items,"id",profile.$firstV.id),i2=_.arr.subIndexOf(items,"id",item.id),i;arr.length=0;for(i=Math.min(i1,i2);i<=Math.max(i1,i2);i++){arr.push(items[i].id)}}else{if(_.arr.indexOf(arr,item.id)!=-1){_.arr.removeValue(arr,item.id)}else{arr.push(item.id)}}arr.sort();value=arr.join(";");if(box.getUIValue()==value){rt=false}else{box.setUIValue(value);if(box.getUIValue()==value){rt=box.onItemSelected(profile,item,src)||rt2}}break}case"single":if(box.getUIValue()==item.id){rt=false}else{profile.$firstV=item;box.setUIValue(item.id);if(box.getUIValue()==item.id){rt=box.onItemSelected(profile,item,src)}}break}return rt},onKeydown:function(profile,e,src){var keys=linb.Event.getKey(e),key=keys[0],shift=keys[2],cur=linb(src),first=profile.getRoot().nextFocus(true,true,false),last=profile.getRoot().nextFocus(false,true,false);switch(linb.Event.getKey(e)[0]){case"tab":if(shift){if(cur.get(0)!=first.get(0)){first.focus();return false}}else{if(cur.get(0)!=last.get(0)){last.focus();return false}}break;case"left":case"up":var next=cur.nextFocus(false,true,false);if(cur.get(0)==first.get(0)){last.focus()}else{cur.nextFocus(false)}return false;break;case"right":case"down":var next=cur.nextFocus(true,false,false);if(cur.get(0)==last.get(0)){first.focus()}else{cur.nextFocus()}return false;break;case"enter":cur.onClick();return false;break}}}},DataModel:({selMode:{ini:"single",listbox:["single","none","multi"]},noCtrlKey:true,width:120,height:150,maxHeight:300}),EventHandlers:{onDblclick:function(profile,item,src){},onItemSelected:function(profile,item,src){}},_ensureValue:function(profile,value){if(profile.properties.selMode=="multi"){var arr=(value||"").split(";");arr.sort();return arr.join(";")}else{return value}},_onStartDrag:function(profile,e,src,pos){var pos=linb.Event.getPos(e);linb.use(src).startDrag(e,{dragType:"icon",shadowFrom:src,targetLeft:pos.left+12,targetTop:pos.top+12,dragCursor:"pointer",dragDefer:1,dragKey:profile.box.getDragKey(profile,src),dragData:profile.box.getDragData(profile,e,src)});return false},_onDropTest:function(profile,e,src,key,data,item){var fid=data&&data.domId,tid=linb.use(src).id();if(fid){if(fid==tid){return false}if(_.get(linb.use(src).get(0),["previousSibling","id"])==fid){return false}}},_onDrop:function(profile,e,src,key,data,item){linb.DragDrop.setDragIcon("none");var k=profile.getKey(linb.use(src).id()),po=data.profile,ps=data.domId,oitem,t=linb.absObj.$specialChars;oitem=_.clone(po.getItemByDom(ps),function(o,i){return !t[(i+"").charAt(0)]});po.boxing().removeItems([oitem.id]);if(k==profile.keys.ITEM){profile.boxing().insertItems([oitem],item.id,true)}else{profile.boxing().insertItems([oitem])}return false},_onresize:function(profile,width,height){if(height){profile.getSubNode("ITEMS").height(height=="auto"?height:(height-2))}}}});Class("linb.UI.LinkList",["linb.UI.List"],{Initialize:function(){var t=this.getTemplate();t.$submap={items:{ITEM:{className:"{itemClass} {disabled}",style:"margin:{itemMargin}px;{itemStyle}",LINK:{$order:1,tagName:"a",href:"{href1}",tabindex:"{_tabindex}",text:"{caption}"}}}};this.setTemplate(t)},Static:{Appearances:{ITEMS:{position:"relative",overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":""},ITEM:{"vertical-align":"middle",position:"relative",background:linb.UI.$bg("icons.gif","no-repeat left -130px",true),"border-right":"solid 1px #7C9CBC",height:"16px",padding:"3px","font-size":0,"line-height":0,"white-space":"nowrap"},"ITEM-mouseover, ITEM-mousedown, ITEM-checked":{},"ITEM-mouseover":{$order:1,"background-position":"left -153px"},"ITEM-mousedown":{$order:2,"background-position":"left -176px"},"ITEM-checked":{$order:2,"background-position":"left -176px"},LINK:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,"vertical-align":"middle",padding:"1pt 4px 1pt 12px","font-size":"12px","line-height":"14px"}},DataModel:({itemMargin:{ini:0,action:function(value){this.getSubNode("ITEM",true).css("margin",value+"px")}}}),Behaviors:{ITEM:{onClick:null,onKeydown:null},LINK:{onClick:function(profile,e){return !!linb.Event.getKey(e)[2]},onMousedown:function(profile,e,src){if(linb.Event.getBtn(e)!="left"){return }var properties=profile.properties,item=profile.getItemByDom(src),box=profile.boxing();if(properties.disabled||item.disabled){return false}box.onItemClick(profile,item,src)}}},EventHandlers:{onItemSelected:null,onItemClick:function(profile,item,src){}},_prepareItem:function(profile,item){var p=profile.properties;item._tabindex=p.tabindex;item.itemMargin=p.itemMargin}}});Class("linb.UI.Gallery","linb.UI.List",{Instance:{getStatus:function(id){var item=this.get(0).getItemByItemId(id);return(item&&item._status)||"ini"}},Initialize:function(){var t=this.getTemplate();t.$submap={items:{ITEM:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",className:"{itemClass} {disabled}",style:"padding:{itemPadding}px;margin:{itemMargin}px;{itemStyle}",ITEMFRAME:{style:"width:{itemWidth}px;height:{itemHeight}px;",CAPTION:{tagName:"div",text:"{caption}",$order:0},CONTENT:{tagName:"div",$order:1,IBWRAP:{tagName:"div",IMAGE:{tagName:"img",src:"{image}",width:"{imgWidth}",height:"{imgHeight}",style:"{imgStyle}"}}},COMMENT:{tagName:"div",text:"{comment}",$order:2}}}}};this.setTemplate(t)},Static:{Appearances:{KEY:{overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":""},ITEMS:{position:"relative",overflow:"visible",zoom:linb.browser.ie6?1:null},ITEM:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,position:"relative",cursor:"pointer","vertical-align":"top",border:"solid 1px #C2E4FC",margin:0},ITEMFRAME:{display:linb.browser.ie?"inline-block":"block",position:"relative",overflow:"hidden",border:0,padding:0,margin:0,width:"100%",height:"100%","-moz-box-flex":"1","-moz-user-select":"none"},IBWRAP:{"font-size":0,"line-height":0},"ITEM-mouseover":{$order:1,padding:0,border:"solid 1px #a0c8f0","background-color":"#e1f0ff"},"ITEM-mousedown":{$order:2,padding:0,border:"solid 1px #dcdcdc","background-color":"#bbcef1"},"ITEM-checked":{$order:2,padding:0,border:"solid 1px #bbcef1","background-color":"#bbcef1"},IMAGE:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,"vertical-align":"middle"},"CONTENT, CAPTION":{"text-align":"center",overflow:"hidden","white-space":"nowrap"},CAPTION:{"font-weight":"bold"},COMMENT:{display:"block","font-size":"12px",margin:"0 2px 0 2px","text-align":"center"}},Behaviors:{IMAGE:{onLoad:function(profile,e,src){var item=profile.getItemByDom(src);item._status="loaded"},onError:function(profile,e,src){var item=profile.getItemByDom(src);item._status="error"}}},DataModel:({itemMargin:{ini:6,action:function(v){if(typeof v!="object"){this.getSubNode("ITEM",true).css("margin",(""+parseFloat(v))==(""+v)?v+"px":v)}else{this.getSubNode("ITEM",true).css(v)}}},itemPadding:{ini:2,action:function(v){if(typeof v!="object"){this.getSubNode("ITEM",true).css("padding",(""+parseFloat(v))==(""+v)?v+"px":v)}else{this.getSubNode("ITEM",true).css(v)}}},itemWidth:{ini:32,action:function(v){this.getSubNode("ITEMFRAME",true).width(v)}},itemHeight:{ini:32,action:function(v){this.getSubNode("ITEMFRAME",true).height(v)}},imgWidth:{ini:16,action:function(v){this.getSubNode("IMAGE",true).width(v)}},imgHeight:{ini:16,action:function(v){this.getSubNode("IMAGE",true).height(v)}},width:200,height:200}),_prepareItem:function(profile,item){var p=profile.properties;_.arr.each(_.toArr("itemWidth,itemHeight,imgWidth,imgHeight,itemPadding,itemMargin"),function(i){item[i]=item[i]||p[i]});item.href=item.href||linb.$href;item.capition=item.capition||"";item.comment=item.comment||"";item._tabindex=p.tabindex}}});Class("linb.UI.IconList","linb.UI.List",{Instance:{getStatus:function(id){var item=this.get(0).getItemByItemId(id);return(item&&item._status)||"ini"}},Initialize:function(){var t=this.getTemplate();t.$submap={items:{ITEM:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",className:"{itemClass} {disabled}",style:"padding:{itemPadding}px;margin:{itemMargin}px;{itemStyle}",IBWRAP:{tagName:"div",IMAGE:{tagName:"img",src:"{image}",width:"{itemWidth}",height:"{itemHeight}",style:"{imgStyle}"}}}}};this.setTemplate(t)},Static:{Appearances:{KEY:{overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":""},ITEMS:{overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":"",position:"relative","line-height":"14px",zoom:linb.browser.ie6?1:null},ITEM:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,position:"relative",cursor:"pointer",border:"solid 1px #C2E4FC","vertical-align":"top"},IBWRAP:{"font-size":0,"line-height":0},"ITEM-mouseover":{$order:1,padding:0,border:"solid 1px #a0c8f0","background-color":"#e1f0ff"},"ITEM-mousedown":{$order:2,padding:0,border:"solid 1px #dcdcdc","background-color":"#bbcef1"},"ITEM-checked":{$order:2,padding:0,border:"solid 1px #bbcef1","background-color":"#bbcef1"}},Behaviors:{IMAGE:{onLoad:function(profile,e,src){var item=profile.getItemByDom(src);item._status="loaded"},onError:function(profile,e,src){var item=profile.getItemByDom(src);item._status="error"}}},DataModel:({itemMargin:{ini:6,action:function(v){if(typeof v!="object"){this.getSubNode("ITEM",true).css("margin",(""+parseFloat(v))==(""+v)?v+"px":v)}else{this.getSubNode("ITEM",true).css(v)}}},itemPadding:{ini:2,action:function(v){if(typeof v!="object"){this.getSubNode("ITEM",true).css("padding",(""+parseFloat(v))==(""+v)?v+"px":v)}else{this.getSubNode("ITEM",true).css(v)}}},itemWidth:{ini:16,action:function(v){this.getSubNode("IMAGE",true).width(v)}},itemHeight:{ini:16,action:function(v){this.getSubNode("IMAGE",true).height(v)}},width:200,height:200}),_prepareItem:function(profile,item){var p=profile.properties;_.arr.each(_.toArr("itemWidth,itemHeight,itemPadding,itemMargin"),function(i){item[i]=item[i]||p[i]});item._tabindex=p.tabindex}}});Class("linb.UI.Poll","linb.UI.List",{Instance:{fillContent:function(id,obj){var profile=this.get(0),t,item;if(profile.renderId){if(item=profile.getItemByItemId(id)){t=profile.getSubNodeByItemId("BODY",id).html("");if(obj){item._obj=obj;item._fill=true;if(typeof obj=="string"){t.html(obj)}else{t.append(obj.render(true))}}else{item._obj=item._fill=null}}}return this},_setOptCap:function(item,value){return this.each(function(pro){var items=pro.properties.items,i=pro.queryItems(pro.properties.items,function(o){return o.id==item.id},false,true);if(i&&(i=i[0])){i.caption=value;if(pro.renderId){pro.getSubNodeByItemId("CAPTION",i.id).html(value)}}})},getBindEditor:function(){return this.get(0)._bind},_insertOpt:function(opt){if(!opt.id){opt.id="$"+_()}this.insertItems([opt]);return this},_removeOpt:function(id){this.removeItems([id],"OUTER");return this},_setDirtyMark:function(){return this}},Initialize:function(){var self=this;self.addTemplateKeys(["EDIT"]);var t=self.getTemplate();t.TITLE={$order:2,tagName:"DIV",style:"{titleDisplay}",text:"{title}",className:"uibg-bar uiborder-outset {disabled} {_cls}"};t.TAIL={$order:20,tagName:"DIV",className:"uibg-bar uiborder-outset {disabled}",text:"{cmds}"};t.$submap={items:{OUTER:{tagName:"div",className:"uibg-bar uiborder-outset",TOGGLE:{className:"uicmd-toggle",style:"{_togdisplay}"},ITEM:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",className:"{itemClass} {disabled}",style:"{itemStyle}",OPTION:{$order:0,tagName:"DIV",MARK:{$order:1,className:"{_optclass}"}},CAPTION:{$order:1,tagName:"DIV",text:"{caption}",className:"{disabled} {_itemcls}"},CHART:{$order:2,tagName:"DIV",style:"{_display}",CAST:{$order:0,text:"{message}"},PROGRESS:{$order:1,style:"background-position: -{_per}px -200px;",PROGRESSI:{}},DEL:{$order:2,className:"ui-btn",style:"{_del}",DELI:{className:"ui-btni",DELC:{className:"ui-btnc",DELA:{tagName:"button",text:"{removeText}"}}}}},CLEAR:{$order:3,tagName:"DIV"}},BODY:{$order:1,tagName:"DIV",text:"{_body}"}}},cmds:{CMD:{className:"ui-btn",CMDI:{className:"ui-btni",CMDC:{className:"ui-btnc",CMDA:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",text:"{caption}"}}}}}};t.ITEMS.className="";self.setTemplate(t);var inlineEdit=function(profile,node,flag,value,item){var o,useC,prop=profile.properties,callback=function(v){var b=profile.boxing();switch(flag){case"1":if(b.beforeOptionChanged(profile,item,v)!==false){b._setOptCap(item,v)}break;case"2":if(b.beforeOptionAdded(profile,v)!==false){var id="["+v.replace(/[^\w_]*/g,"")+"]";b._insertOpt({caption:v,id:id});if(!profile.properties.editable){profile.boxing().fireItemClickEvent(id)}}break;default:if(b.beforeTitleChanged(profile,v)!==false){b.setTitle(v)}}};if(profile.onCustomEdit){if(o=profile._bind=profile.boxing().onCustomEdit(profile,node,flag,value,item,callback)){useC=true}}if(!useC){o=profile._bind;if(!o){var pp={type:prop.editorType,saveBtn:true,left:-10000,top:-10000};profile._bind=o=linb.create("ComboInput",pp);o.onHotKeydown(function(p,key){if(key=="enter"){p.boxing().onSave(p);return false}else{if(key=="esc"){o.hide();return false}}});profile.getRoot().append(o)}var r=node.cssRegion(true,profile.getRoot());if(r.height>o.getHeight()){o.setHeight(r.height)}else{r.top-=3}if(r.top<0){r.top=0}o.setValue(value||"",true).setWidth(r.width+(parseInt(node.css("paddingLeft"))||0)+(parseInt(node.css("paddingRight"))||0)).onSave(function(p){var pro=p.properties,v=pro.$UIvalue,ov=pro.value;if(v!=ov){callback(v)}_.asyRun(function(){o.hide()})}).reBoxing().setBlurTrigger(o.KEY+":"+o.$linbid,function(){o.hide()}).show(r.left+"px",r.top+"px");_.asyRun(function(){o.activate()})}};t=self.getBehavior();var old=t.ITEM.onClick;t.ITEM.onClick=function(profile,e,src){var p=profile.properties,item=profile.getItemByDom(src),editable=item.id=="$custom"||item.editable;if(p.disabled){return }if(p.editable){inlineEdit(profile,profile.getSubNodeByItemId("CAPTION",item.id),editable?"2":"1",editable?"":item.caption,item)}else{if(editable){inlineEdit(profile,profile.getSubNodeByItemId("CAPTION",item.id),"2")}else{old.apply(this,arguments)}}};t.TITLE={onClick:function(profile,e,src){var p=profile.properties,item=profile.getItemByDom(src);if(p.disabled){return }if(p.editable){inlineEdit(profile,profile.getSubNode("TITLE"),"3",p.title)}}};t.DEL={onClick:function(profile,e,src){var p=profile.properties,b=profile.boxing(),item=profile.getItemByDom(src);if(p.disabled){return }if(b.beforeOptionRemoved(profile,item)!==false){b._removeOpt(item.id)}return false}};t.CMD={onClick:function(profile,e,src){var p=profile.properties,key=profile.getSubId(src);if(p.disabled){return }profile.boxing().onClickButton(profile,key,src)}};t.TOGGLE={onClick:function(profile,e,src){var properties=profile.properties,items=properties.items,item=profile.getItemByDom(src),itemId=profile.getSubId(src),node=linb.use(src),body=profile.getSubNode("BODY",itemId),t;if(item._show){node.tagClass("-checked",false);body.css("display","none")}else{node.tagClass("-checked");body.css("display","block");if(!item._fill){item._fill=true;var callback=function(o){profile.boxing().fillContent(item.id,item._body=o)};if(profile.onGetContent){var r=profile.boxing().onGetContent(profile,item,callback);if(r){callback(r)}}else{callback(profile.box._buildBody(profile,item))}}}item._show=!item._show}};self.setBehavior(t)},Static:{_DIRTYKEY:"MARK",_ITEMKEY:"OUTER",Appearances:{KEY:{"font-size":"12px",zoom:linb.browser.ie?1:null},"TITLE, ITEMS, TAIL":{position:"relative",overflow:"auto","line-height":"14px"},TAIL:{zoom:linb.browser.ie?1:null,padding:"5px 0 5px 40px"},CMD:{margin:"3px","white-space":"nowrap","vertical-align":"middle"},TITLE:{"font-weight":"bold",padding:"4px"},ITEMS:{"overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":"",zoom:linb.browser.ie?1:null},OUTER:{position:"relative",zoom:linb.browser.ie?1:null,"padding-left":"15px"},TOGGLE:{position:"absolute",left:0,top:"4px"},BODY:{display:"none","padding-left":"27px"},ITEM:{display:"block",position:"relative",zoom:linb.browser.ie?1:null,padding:"4px 2px 4px 2px"},OPTION:{position:"absolute",left:"2px",top:"4px"},CAPTION:{"float":"left",zoom:linb.browser.ie?1:null,"margin-left":"24px",display:linb.browser.ie6?"inline":null},"EDIT, EDITS":{$order:2,"float":"none","background-color":"#EBEADB",cursor:"pointer",display:linb.browser.ie6?"block":null},CHART:{"float":"right"},CLEAR:{clear:"both","text-align":"right"},"PROGRESS, PROGRESSI":{background:linb.UI.$bg("icons.gif","no-repeat",true),width:"200px",height:"14px",border:0,"vertical-align":"middle","line-height":0,"font-size":0},PROGRESS:{$order:1,"margin-left":"2px","background-position":"-180px -200px"},PROGRESSI:{$order:1,"background-position":"-200px -216px"},DEL:{margin:"0 0 0 4px"}},DataModel:{$checkbox:1,noCtrlKey:null,title:{action:function(v){this.getSubNode("TITLE").html(v)}},selMode:{ini:"single",listbox:["single","multi"],action:function(){this.boxing().refresh()}},cmds:{ini:[]},noTitle:{ini:false,action:function(v){this.getSubNode("TITLE").css("display",v?"none":"")}},toggle:{ini:false,action:function(v){this.getSubNode("TOGGLE",true).css("display",v?"":"none")}},removeText:{ini:"remove",action:function(v){this.getSubNode("DEL",true).text(v)}},editable:{ini:false,action:function(v){var self=this,t,cls;self.getSubNode("DEL",true).css("display",v?"":"none");t=self.getSubNode("CAPTION",true).merge(self.getSubNode("TITLE"));cls=self.getClass("EDIT");if(v){t.addClass(cls)}else{t.removeClass(cls)}}},newOption:{ini:"",action:function(v){var self=this,id="$custom",sid="_special",t,cs=self._cs;if(!v){if(cs){cs.remove()}}else{if(!cs){t={id:id,caption:v};t[linb.UI.$tag_subId]=sid;cs=self._buildItems("items",self.box._prepareItems(self,[t]));self.getSubNode("ITEMS").addNext(self._cs=cs)}else{self.getSubNodeByItemId("CAPTION",sid).html(v)}}}},editorType:"none"},Behaviors:{HoverEffected:{DEL:"DEL",CMD:"CMD",ITEM:"MARK"},ClickEffected:{DEL:"DEL",CMD:"CMD",ITEM:"MARK"}},EventHandlers:{beforeTitleChanged:function(profile,value){},beforeOptionAdded:function(profile,value){},beforeOptionRemoved:function(profile,item){},beforeOptionChanged:function(profile,item,value){},onCustomEdit:function(profile,node,flag,value,item,callback){},onClickButton:function(profile,key,src){},onGetContent:function(profile,item,callback){}},RenderTrigger:function(){var self=this,t=self.properties.newOption;if(t){self.boxing().setNewOption(t,true)}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),p=profile.properties;if(p.editable){data._cls=profile.getClass("EDIT")}data.titleDisplay=p.noTitle?"display:none":"";var cmds=p.cmds,o;if(cmds&&cmds.length){var sid=linb.UI.$tag_subId,a;a=data.cmds=[];for(var i=0,t=cmds,l=t.length;i<l;i++){if(typeof t[i]=="string"){t[i]={id:t[i]}}if(!t[i].caption){t[i].caption=t[i].id}t[i].id=t[i].id.replace(/[^\w]/g,"_");o=linb.UI.adjustData(profile,t[i]);a.push(o);o._tabindex=p.tabindex;o[sid]=o.id}}return data},_prepareItem:function(profile,item){var p=profile.properties,f=profile.CF;item._tabindex=p.tabindex;if(typeof f.formatCaption=="function"){item.caption=f.formatCaption(item.caption)}item._body=item._body||"Loading...";if(item.id!="$custom"){item._togdisplay=((p.toggle&&item.toggle!==false)||item.toggle)?"":"display:none;";item._optclass=p.selMode=="multi"?"uicmd-check":"uicmd-radio";item._display="";item.percent=parseFloat(item.percent)||0;if(item.percent<0){item.percent=0}if(item.percent>1){item.percent=1}item._per=200*(1-item.percent)}else{item._optclass="uicmd-add";item._togdisplay=item._display="display:none;";item._per=0;item._itemcls=profile.getClass("EDITS")}item.removeText=p.removeText;item._del="display:none;";if((("editable" in item)&&item.editable)||p.editable){item._itemcls=profile.getClass("EDIT");item._del=""}},_buildBody:function(profile,item){return item.text?"<pre>"+item.text.replace(/</g,"&lt;")+"</pre>":""},_onresize:function(){}}});Class("linb.UI.Panel","linb.UI.Div",{Instance:{activate:function(flag){var profile,cls=this.constructor;if(profile=linb.UI._cache["$"+cls.activeWndId]){profile.getSubNode("TBAR").tagClass("-focus",false)}delete cls.activeWndId;if(flag!==false){profile=this.get(0);profile.getSubNode("TBAR").tagClass("-focus");profile.getSubNode("CAPTION").focus();cls.activeWndId=profile.$linbid}}},Static:{Templates:{tagName:"div",style:"{_style}",BORDER:{tagName:"div",TBAR:{tagName:"div",className:"uibar-top",BART:{cellpadding:"0",cellspacing:"0",width:"100%",height:"100%",border:"0",tagName:"table",className:"uibar-t",BARTR:{tagName:"tr",BARTDL:{tagName:"td",className:"uibar-tdl"},BARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl",TOGGLE:{className:"uicmd-toggle {toggleCls}",style:"{toggleDisplay}",$order:0},ICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{tagName:"a",href:"{href}",tabindex:"{tabindex}",text:"{caption}",$order:1}},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",OPT:{className:"uicmd-opt",style:"{optDisplay}",$order:1},LAND:{className:"uicmd-land",style:"{landDisplay}",$order:1},CLOSE:{className:"uicmd-close ",style:"{closeDisplay}",$order:2}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",PANEL:{tagName:"div",style:"{panelDisplay}",text:"{html}"+linb.UI.$childTag}}},BBAR:{$order:3,tagName:"div",className:"uibar-bottom-s",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}}},Appearances:{KEY:{overflow:"hidden",background:"transparent"},"KEY BORDER":{zoom:linb.browser.ie6?1:null},PANEL:{position:"relative",left:0,top:0,overflow:"hidden",zoom:linb.browser.ie6?1:null},CAPTION:{"font-size":"12px",display:"inline","vertical-align":"middle"}},Behaviors:{DropableKeys:["PANEL"],DragableKeys:["TBAR"],HoverEffected:{OPT:"OPT",CLOSE:"CLOSE",LAND:"LAND",TOGGLE:"TOGGLE"},ClickEffected:{CLOSE:"CLOSE",OPT:"OPT",LAND:"LAND",TOGGLE:"TOGGLE"},onSize:linb.UI.$onSize,OPT:{onClick:function(profile,e,src){profile.boxing().onShowOptions(profile,e,src)}},TOGGLE:{onClick:function(profile,e,src){profile.box._toggle(profile,!profile.properties.toggle);return false}},CAPTION:{onClick:function(profile,e,src){if(!profile.onClickBar||false===profile.boxing().onClickBar(profile,src)){return !!linb.Event.getKey(e)[2]}}},CLOSE:{onClick:function(profile,e,src){var properties=profile.properties;if(properties.disabled){return }var instance=profile.boxing();if(false===instance.beforeClose(profile)){return }instance.destroy();return false}},LAND:{onClick:function(profile,e,src){var properties=profile.properties;if(properties.disabled){return }var pos=profile.getRoot().offset(),size=profile.getRoot().cssSize();var pro=_.copy(linb.UI.Dialog.$DataStruct);_.merge(pro,properties,"with");_.merge(pro,{dock:"none",width:Math.max(size.width,200),height:Math.max(size.height,100),left:pos.left,top:pos.top},"all");var dialog=new linb.UI.Dialog(pro),arr=[];linb("body").append(dialog);_.arr.each(profile.children,function(o){arr.push(o[0])});dialog.append(linb.UI.pack(arr,false));profile.boxing().destroy();return false}}},DataModel:{position:"absolute",zIndex:0,dock:"fill",caption:{ini:undefined,action:function(value){this.getSubNode("CAPTION").get(0).innerHTML=value}},image:{action:function(value){this.getSubNode("ICON").css("display",value?"":"none").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){this.getSubNode("ICON").css("backgroundPosition",value)}},href:{ini:linb.$href,action:function(v){this.getSubNode("CAPTION").attr("href",v)}},html:{action:function(v){this.getSubNode("PANEL").html(v)}},toggle:{ini:true,action:function(v){this.box._toggle(this,v)}},optBtn:{ini:false,action:function(v){this.getSubNode("OPT").css("display",v?"":"none")}},toggleBtn:{ini:false,action:function(v){this.getSubNode("TOGGLE").css("display",v?"":"none")}},closeBtn:{ini:false,action:function(v){this.getSubNode("CLOSE").css("display",v?"":"none")}},landBtn:{ini:false,action:function(v){this.getSubNode("LAND").css("display",v?"":"none")}}},EventHandlers:{beforeClose:function(profile,src){},onIniPanelView:function(profile){},onFold:function(profile){},onExpend:function(profile){},onShowOptions:function(profile,e,src){},onClickBar:function(profile,src){}},LayoutTrigger:function(){var self=this,t=self.properties,b=self.box;if(t.toggle){b._toggle(self,t.toggle)}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);var nodisplay="display:none";data.panelDisplay=data.toggle?"":nodisplay;data.toggleCls=data.toggle?"":profile.getClass("TOGGLE","-checked");data.toggleDisplay=data.toggleBtn?"":nodisplay;data.optDisplay=data.optBtn?"":nodisplay;data.closeDisplay=data.closeBtn?"":nodisplay;data.landDisplay=data.landBtn?"":nodisplay;return data},_onresize:function(profile,width,height){var isize={},v1=profile.getSubNode("TBAR"),v2=profile.getSubNode("PANEL"),v4=profile.getSubNode("BBAR"),v5=profile.getSubNode("MAIN"),v6=profile.getSubNode("MAINI"),h1,h4,t;if(height){if(height=="auto"){isize.height=height}else{h1=v1.height(),h4=v4.height();if((t=height-h1-h4)>0){isize.height=t}}}if(width){isize.width=width-(parseInt(v6.css("paddingRight"))||0)-(parseInt(v5.css("paddingLeft"))||0)}v2.cssSize(isize,true)},_toggle:function(profile,value){var p=profile.properties,b=profile.boxing();p.toggle=value;if(value&&!profile.$ini){if(b.onIniPanelView){if(b.onIniPanelView(profile)!==false){profile.$ini=true}}}if(value){if(false===b.onExpend(profile)){return }}else{if(false===b.onFold(profile)){return }}profile.getSubNode("PANEL").css("display",value?"":"none");if(p.toggleBtn){profile.getSubNode("TOGGLE").tagClass("-checked",!value)}}}});Class("linb.UI.PageBar",["linb.UI","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){if(!profile.renderId){return }var t,prop=profile.properties,arr=profile.box._v2a(value),min=arr[0],cur=arr[1],max=arr[2],keys=profile.keys,fun=function(p,k){return p.getSubNode(k)},first=fun(profile,"FIRST"),prev=fun(profile,"PREV"),prehide=fun(profile,"PREM"),current=fun(profile,"CUR"),next=fun(profile,"NEXT"),nexthide=fun(profile,"NEXTM"),last=fun(profile,"LAST"),change=function(n,i,j){if(i){n.first(3).attr("href",prop.uriTpl.replace("*",i))}if(j){n.first(3).text(prop.textTpl.replace("*",j))}},display=function(n,f){n.css("display",f?"":"none")};change(first,min,min);change(prehide,"",".."+_.str.repeat(".",String(cur-1-min).length));change(prev,cur-1);change(current,cur,cur);change(next,cur+1);change(nexthide,"",".."+_.str.repeat(".",String(max-cur-1).length));change(last,max,max);if((t=cur-min)<=0){display(first,0);display(prehide,0);display(prev,0)}else{if(t==1){display(first,1);display(prehide,0);display(prev,0)}else{if(t==2){display(first,1);display(prehide,0);display(prev,1)}else{display(first,1);display(prehide,1);display(prev,1)}}}if((t=max-cur)<=0){display(last,0);display(nexthide,0);display(next,0)}else{if(t==1){display(last,1);display(nexthide,0);display(next,0)}else{if(t==2){display(last,1);display(nexthide,0);display(next,1)}else{display(last,1);display(nexthide,1);display(next,1)}}}})},setPage:function(value){return this.each(function(o){var v=o.properties.value,a=v.split(":");a[1]=parseInt(value)||a[0];o.boxing().setValue(a.join(":"))})}},Static:{Templates:{style:"{_style}",POOL:{style:"position:absolute;display:none;",POP:{tagName:"div",className:"uibg-base"}},LABEL:{text:"{caption}"},FIRST:{$order:1,className:"ui-btn",FIRSTI:{className:"ui-btni",FIRSTC:{className:"ui-btnc",FIRSTA:{tagName:"a",href:"#",tabindex:"{tabindex}"}}}},PREM:{$order:2,className:"ui-btn",PREMI:{className:"ui-btni",PREMC:{className:"ui-btnc",PREMA:{tagName:"a",href:"#",tabindex:"{tabindex}"}}}},PREV:{$order:3,className:"ui-btn",PREVI:{className:"ui-btni",PREVC:{className:"ui-btnc",PREVA:{tagName:"a",href:"#",tabindex:"{tabindex}",text:"{prevMark}"}}}},CUR:{$order:4,className:"ui-btn ui-btn-focus",CURI:{className:"ui-btni",CURC:{className:"ui-btnc",CURA:{tagName:"a",href:"#",tabindex:"{tabindex}"}}}},NEXT:{$order:5,className:"ui-btn",NEXTI:{className:"ui-btni",NEXTC:{className:"ui-btnc",NEXTA:{tagName:"a",href:"#",tabindex:"{tabindex}",text:"{nextMark}"}}}},NEXTM:{$order:6,className:"ui-btn",NEXTMI:{className:"ui-btni",NEXTMC:{className:"ui-btnc",NEXTMA:{tagName:"a",href:"#",tabindex:"{tabindex}"}}}},LAST:{$order:6,className:"ui-btn",LASTI:{className:"ui-btni",LASTC:{className:"ui-btnc",LASTA:{tagName:"a",href:"#",tabindex:"{tabindex}"}}}}},Appearances:{LABEL:{"font-size":"12px",padding:"3px 6px 0 6px","vertical-align":"top","white-space":"nowrap"},KEY:{display:"inline",overflow:"visible"},"KEY a:focus, POP a:focus":{"-moz-outline-offset":""},"KEY .ui-btn, POP .ui-btn":{"margin-right":"3px"},"KEY .ui-btn a, POP .ui-btn a":{padding:"0 3px 0 3px"},"PREV,CUR,NEXT":{"font-weight":"bold"},POP:{border:"dotted 1px gray",background:"#fff",position:"absolute",padding:"3px","line-height":"26px"}},Behaviors:{HoverEffected:{FIRST:"FIRST",PREM:"PREM",PREV:"PREV",NEXT:"NEXT",NEXTM:"NEXTM",LAST:"LAST",POPI:"POPI",CUR:"CUR"},ClickEffected:{FIRST:"FIRST",PREM:"PREM",PREV:"PREV",NEXT:"NEXT",NEXTM:"NEXTM",LAST:"LAST",POPI:"POPI",CUR:"CUR"},POP:{onClick:function(profile,e,src){var o=linb(src),r=linb.Event.getSrc(e);o.setBlurTrigger(profile.key+":"+profile.$linbid,null);profile.getSubNode("POOL").append(o);if(r.tagName.toLowerCase()=="a"||((r=r.firstChild)&&(r.tagName.toLowerCase()=="a"))||((r=r.firstChild)&&(r.tagName.toLowerCase()=="a"))||((r=r.firstChild)&&(r.tagName.toLowerCase()=="a"))){return profile.box._click(profile,r.parentNode.parentNode.parentNode)}}},FIRST:{onClick:function(profile,e,src){return profile.box._click(profile,src)}},PREM:{onClick:function(profile,e){return !!linb.Event.getKey(e)[2]},onMousedown:function(profile,e,src){profile.box._show(profile,e,src,0);return false}},PREV:{onClick:function(profile,e,src){return profile.box._click(profile,src)}},CUR:{onClick:function(profile,e,src){return profile.box._click(profile,src)}},NEXT:{onClick:function(profile,e,src){return profile.box._click(profile,src)}},NEXTM:{onClick:function(profile,e){return !!linb.Event.getKey(e)[2]},onMousedown:function(profile,e,src){profile.box._show(profile,e,src,1);return false}},LAST:{onClick:function(profile,e,src){return profile.box._click(profile,src)}}},DataModel:{dataField:null,dataBinder:null,caption:" Page: ",value:"1:1:1",uriTpl:"#*",textTpl:"*",prevMark:"&lt;",nextMark:"&gt;",_moreStep:100},EventHandlers:{onClick:function(profile,page){}},_ensureValue:function(profile,value){var a=value.split(":"),b=[],fun=function(a){return parseInt(a)||1};b[0]=fun(a[0]);b[1]=fun(a[1]);b[2]=fun(a[2]);b[0]=Math.max(b[0],1);b[0]=Math.min(b[0],b[1]);b[2]=Math.max(b[1],b[2]);return b.join(":")},_v2a:function(v){v=typeof v=="string"?v.split(":"):v;v[0]=parseInt(v[0]);v[1]=parseInt(v[1]);v[2]=parseInt(v[2]);return v},_click:function(profile,src){var b=profile.boxing(),v=b.getValue(),a=v.split(":");var r=b.onClick(profile,parseInt(linb(src).first(3).attr("href").split("#")[1])||a[0]);return typeof r=="boolean"?r:false},_show:function(profile,e,src,flag){var prop=profile.properties,arr=profile.box._v2a(prop.value),min=arr[0],cur=arr[1],max=arr[2],keys=profile.keys,fun=function(p,k){return p.getSubNode(k)},pool=fun(profile,"POOL"),pop=fun(profile,"POP"),ceil=function(n){return Math.ceil((n+1)/10)*10},a=[],t,m,n,i,l;if(flag){if((t=max-1-cur)<=0){return }n=cur+1;l=max}else{if((t=cur-1-min)<=0){return }n=1;l=cur-1}m=Math.ceil(t/prop._moreStep);if(m>10){n=ceil(n);l=ceil(l)-1;m=ceil(m)}else{n=n+m}var _id=profile.keys.POPI+":"+profile.serialId+":";while(n<l){a.push('<span style="margin-top:3px;" id="'+_id+n+'" class="ui-btn"><span class="ui-btni"><span class="ui-btnc"><a href="'+prop.uriTpl.replace("*",n)+'">'+prop.textTpl.replace("*",n)+"</a></span></span></span>");n=n+m}pop.width("auto");pop.html(a.join(" "));linb("body").append(pop);if(pop.width()>300){pop.width(300)}pop.popToTop(src);pop.setBlurTrigger(profile.key+":"+profile.$linbid,function(){pool.append(pop)})}},Initialize:function(){this.addTemplateKeys(["POPI"])}});Class("linb.UI.Tabs",["linb.UI","linb.absList","linb.absValue"],{Instance:{_setCtrlValue:function(value){this.each(function(profile){var id=profile.domId,box=profile.boxing(),uiv=box.getUIValue(),properties=profile.properties,itemId=profile.getSubIdByItemId(uiv),item,temp,t;if(uiv&&profile.getSubIdByItemId(uiv)){profile.getSubNodes(["ITEM","BOX"],itemId).tagClass("-checked",false);if(!properties.noPanel){box.getPanel(uiv).css("display","none")}}itemId=profile.getSubIdByItemId(value);item=profile.getItemByItemId(value);if(itemId){profile.getSubNodes(["ITEM","BOX"],itemId).tagClass("-checked");if(!properties.noPanel){box.getPanel(value).css("display","block");t=profile.getRootNode().style;linb.UI.$tryResize(profile,t.width,t.height,true,value);t=null;var arr=profile.children,a=[];_.arr.each(arr,function(o){if(o[1]==value&&!o[0]["parent:"+profile.$linbid]){a.push(o[0]);o[0]["parent:"+profile.$linbid]=1}});if(a.length){box.append(linb.UI.pack(a),value)}if(!item._$ini){if(box.onIniPanelView){if(box.onIniPanelView(profile,item)!==false){item._$ini=true}}}}}})},append:function(target,subId){var p=this.get(0).properties;if(subId=subId||p.$UIvalue||p.value){arguments.callee.upper.call(this,target,subId)}return this},getCurPanel:function(){var profile=this.get(0);return this.getPanel(profile.properties.$UIvalue)},getPanel:function(subId){var profile=this.get(0);return profile.getSubNodeByItemId("PANEL",subId)},addPanel:function(para,children,item){var i={},id=item&&item.id,items=this.getItems(),id2=para.id||para.tag;if(items.length){if(-1!=_.arr.subIndexOf(items,"id",id2)){return false}if(!id){id=items[items.length-1].id}}_.merge(i,{caption:para.caption,image:para.image,closeBtn:para.closeBtn||false,landBtn:para.landBtn||false,optBtn:para.optBtn||false,imagePos:para.imagePos,dragKey:para.dragKey,dropKeys:para.dropKeys,id:para.id||para.tag||_.id()});this.insertItems([i],id);var arr=[];_.arr.each(children,function(o){arr.push(o[0])});this.append(linb.UI.pack(arr,false),i.id);return this},removePanel:function(domId){var self=this,item=self.getItemByDom(domId);return self.removeItems([item.id])},getPanelPara:function(domId){var profile=this.get(0),pp=profile.properties,item=profile.getItemByDom(domId),para=_.clone(item);if(!para.dragKey){para.dragKey=pp.dragKey}if(!para.dropKeys){para.dropKeys=pp.dropKeys}return para},getPanelChildren:function(domId){var profile=this.get(0),id=profile.getItemIdByDom(domId),arr=[];if(id){_.arr.each(profile.children,function(o){if(o[1]==id){arr.push(o)}})}return arr},fireItemClickEvent:function(subId){this.getSubNodeByItemId("ITEM",subId).onMousedown();return this},_afterInsertItems:function(profile,data){if(!profile.renderId){return }var box=profile.box,obj,v,pp=profile.properties;if(obj=profile.getSubNode(profile.keys.BOX||profile.keys.KEY)){obj.append(profile._buildItems("panels",data));if(!pp.noPanel){if(!(v=this.getUIValue())){this.fireItemClickEvent((v=pp.items[0])&&(v=v.id))}var t=profile.getRootNode().style;linb.UI.$tryResize(profile,t.width,t.height,true,v);t=null}}},removeItems:function(arr){var self=this,obj,serialId;if(!_.isArr(arr)){arr=[arr]}self.each(function(profile){if(!profile.properties.noPanel){_.arr.each(arr,function(o){serialId=profile.getSubIdByItemId(o);if(serialId&&!(obj=profile.getSubNode("PANEL",serialId)).isEmpty()){obj.remove()}})}});arguments.callee.upper.apply(self,arguments);self.each(function(profile){if(!profile.boxing().getUIValue()){var i;profile.boxing().fireItemClickEvent((i=profile.properties.items[0])&&i.id)}if(!profile.properties.noPanel){var t=profile.getRootNode().style;linb.UI.$tryResize(profile,t.width,t.height,true,profile.boxing().getUIValue());t=null}});return self},clearItems:function(){var self=this;self.each(function(profile){if(!profile.properties.noPanel){profile.getSubNode("PANEL",true).remove()}});self.setValue(null,true);arguments.callee.upper.apply(self,arguments);return self},markItemCaption:function(subId,mark,force){var profile=this.get(0);subId=profile.getItemByItemId(subId);if((subId._dirty!=mark)||force){var id=subId.id,caption=profile.getItemByItemId(id).caption;profile.getSubNodeByItemId("CAPTION",id).html(profile.getItemByItemId(id).caption=mark?("*"+caption):caption.replace(/^\*/,"")).css("fontStyle",mark?"italic":"normal");subId._dirty=mark}return this}},Static:{_dynamicRender:true,Templates:{tagName:"div",style:"{_style};",LIST:{$order:0,tagName:"div",ITEMS:{tagName:"div",text:"{items}",style:"{HAlign}"}},PNAELS:{$order:1,tagName:"text",text:"{panels}"},$submap:{items:{ITEM:{className:"{itemClass} {disabled}",style:"{itemStyle}",ITEMI:{ITEMC:{HANDLE:{tagName:"a",href:"{href}",tabindex:"{_tabindex}",IBWRAP:{tagName:"div",style:"white-space:nowrap;",RULER:{},ICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{text:"{caption}",$order:1},CMDS:{$order:2,OPT:{$order:1,className:"uicmd-opt",style:"{_opt}"},LAND:{className:"uicmd-land",style:"{landDisplay}",$order:1},CLOSE:{className:"uicmd-close ",style:"{closeDisplay}",$order:2}}}}}}}},panels:{PANEL:{tagName:"div",className:"uibg-base",text:linb.UI.$childTag}}}},Appearances:{KEY:{position:"absolute",overflow:"hidden"},LIST:{position:"relative"},ITEMS:{padding:"0 4px 2px 0",position:"relative",background:linb.UI.$bg("line.gif","repeat-x center bottom")},ITEM:{$order:0,"font-family":'"Verdana", "Helvetica", "sans-serif"',cursor:"pointer","padding-right":"6px","vertical-align":"top",background:linb.UI.$bg("button.gif","no-repeat right -540px",true)},"ITEM-mouseover":{$order:1,"background-position":"right -690px"},"ITEM-mousedown, ITEM-checked":{$order:2,"background-position":"right -840px","border-bottom":"solid 1px #FAD600;"},ITEMI:{$order:0,"padding-left":"6px","vertical-align":"top",background:linb.UI.$bg("button.gif","no-repeat left -640px",true)},"ITEM-mouseover ITEMI":{$order:1,"background-position":"left -790px"},"ITEM-mousedown ITEMI, ITEM-checked ITEMI":{$order:2,"background-position":"left -940px"},ITEMC:{$order:0,padding:"5px 0 3px 0","vertical-align":"top","text-align":"center",background:linb.UI.$bg("button.gif","repeat-x left -590px",true)},"ITEM-mouseover ITEMC":{$order:1,"background-position":"left -740px"},"ITEM-mousedown ITEMC, ITEM-checked ITEMC":{$order:2,"background-position":"left -890px"},HANDLE:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,cursor:"pointer","vertical-align":"middle","font-size":"12px"},RULER:{height:"18px",width:"1px","vertical-align":"middle"},PANEL:{position:"relative",display:"none",width:"100%",overflow:"auto"},CAPTION:{"vertical-align":"middle"},CMDS:{"vertical-align":"middle","margin-left":"4px"}},Behaviors:{DropableKeys:["PANEL","KEY","ITEM"],DragableKeys:["ITEM"],HoverEffected:{ITEM:"ITEM",OPT:"OPT",CLOSE:"CLOSE",LAND:"LAND"},ClickEffected:{ITEM:"ITEM",OPT:"OPT",CLOSE:"CLOSE",LAND:"LAND"},onSize:linb.UI.$onSize,OPT:{onMousedown:function(){return false},onClick:function(profile,e,src){profile.boxing().onShowOptions(profile,profile.getItemByDom(src),e,src);return false}},CAPTION:{onMousedown:function(profile,e,src){if(linb.Event.getBtn(e)!="left"){return }var properties=profile.properties,item=profile.getItemByDom(src),box=profile.boxing();if(properties.disabled||item.disabled){return false}if(box.getUIValue()==item.id){if(profile.onCaptionActive){profile.boxing().onCaptionActive(profile,profile.getItemByDom(src),src)}}}},ITEM:{onClick:function(profile,e,src){return false},onMousedown:function(profile,e,src){if(linb.Event.getBtn(e)!="left"){return false}if(profile.getKey(linb.Event.getSrc(e).parentNode.id)==profile.keys.CMDS){return false}var properties=profile.properties,itemId=profile.getSubId(src),item=profile.getItemByDom(src),box=profile.boxing();if(properties.disabled||item.disabled){return false}if(box.getUIValue()==item.id){return }profile.getSubNode("HANDLE",itemId).focus();box.setUIValue(item.id);if(box.getUIValue()==item.id){box.onItemSelected(profile,item,src);return false}}},HANDLE:{onClick:function(profile,e,src){return !!linb.Event.getKey(e)[2]},onKeydown:function(profile,e,src){var keys=linb.Event.getKey(e),key=keys[0],shift=keys[2];if(key==" "||key=="enter"){profile.getSubNode("ITEM",profile.getSubId(src)).onMousedown();return false}var cur=linb(src),target=profile.getSubNode("ITEMS"),first=target.nextFocus(true,true,false),last=target.nextFocus(false,true,false);switch(key){case"tab":if(shift){if(cur.get(0)!=first.get(0)){first.focus();return false}}else{if(cur.get(0)!=last.get(0)){last.focus();return false}}break;case"left":case"up":var next=cur.nextFocus(false,true,false);if(cur.get(0)==first.get(0)){last.focus()}else{cur.nextFocus(false)}return false;break;case"right":case"down":var next=cur.nextFocus(true,false,false);if(cur.get(0)==last.get(0)){first.focus()}else{cur.nextFocus()}return false;break}}},CLOSE:{onMousedown:function(){return false},onClick:function(profile,e,src){var properties=profile.properties,item=profile.getItemByDom(src),bak;if(properties.disabled||item.disabled){return }var instance=profile.boxing();if(false===instance.beforePageClose(profile,item,src)){return }bak=_.copy(item);instance.removeItems(item.id);instance.afterPageClose(profile,bak);var t=profile.getRootNode().style;linb.UI.$tryResize(profile,t.width,t.height,true);t=null;return false}},LAND:{onMousedown:function(){return false},onClick:function(profile,e,src){var properties=profile.properties,item=profile.getItemByDom(src),id=item.id;if(properties.disabled||item.disabled){return }var panel=profile.boxing().getPanel(id),pos=profile.getRoot().offset(),size=profile.getRoot().cssSize(),pro=_.copy(linb.UI.Dialog.$DataStruct);_.merge(pro,item,"with");_.merge(pro,{dragKey:item.dragkey||properties.dragKey,dock:"none",tag:item.tag||item.id,width:Math.max(size.width,200),height:Math.max(size.height,100),left:pos.left,top:pos.top},"all");var dialog=new linb.UI.Dialog(pro);linb("body").append(dialog);var arr=[];_.arr.each(profile.children,function(o){if(o[1]==id){arr.push(o[0])}},null,true);if(arr.length){dialog.append(linb.UI.pack(arr,false))}profile.boxing().removeItems(id);return false}}},DataModel:{dataBinder:null,dataField:null,dock:"fill",noPanel:false,width:200,height:200,position:"absolute",HAlign:{ini:"left",listbox:["left","center","right"],action:function(value){this.getSubNode("ITEMS").css("textAlign",value)}},dropKeysPanel:"",value:{ini:""},items:{set:function(value){var o=this;if(o.renderId){var box=o.boxing(),p,temp=linb.$getGhostDiv(),children=_.copy(o.children);o.children.length=0;_.arr.each(children,function(o){delete o[0].$dockParent;temp.appendChild(o[0].getRootNode())});var bv=o.properties.value;box.clearItems();box.insertItems(value);_.arr.each(children,function(v){box.append.apply(box,v)});temp.innerHTML="";box.setValue(bv,true);var t=o.getRootNode().style;linb.UI.$tryResize(o,t.width,t.height,true);t=null}else{o.properties.items=_.copy(value)}}}},EventHandlers:{onIniPanelView:function(profile,item){},beforePageClose:function(profile,item,src){},afterPageClose:function(profile,item){},onShowOptions:function(profile,item,e,src){},onItemSelected:function(profile,item,src){},onCaptionActive:function(profile,item,src){}},RenderTrigger:function(){var self=this,v,i,ins;if(v=self.properties.value){(ins=self.boxing()).setUIValue(v);if(i=self.getItemByItemId(v)){ins.onItemSelected(self,i)}}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data.panels=data.items;data.HAlign="text-align:"+data.HAlign+";";return data},_prepareItem:function(profile,item){var dpn="display:none";item.closeDisplay=item.closeBtn?"":dpn;item.landDisplay=item.landBtn?"":dpn;item._opt=item.optBtn?"":dpn;item.href=item.href||linb.$href},getDropKeys:function(profile,node){return profile.properties[profile.getKey(linb.use(node).id())==profile.keys.PANEL?"dropKeys":"dropKeysPanel"]},_showTips:function(profile,node,pos){var id=node.id,p=profile.properties,keys=profile.keys,key=profile.getKey(id);if(!id){return false}if(profile.onShowTips){return profile.boxing().onShowTips(profile,node,pos)}else{return arguments.callee.upper.apply(this,arguments)}},_onresize:function(profile,width,height,force,key){var t=profile.properties,item=profile.getItemByItemId(key);if(!item){key=t.$UIvalue}item=profile.getItemByItemId(key);var o=profile.boxing().getPanel(key),l=profile.getSubNode("LIST"),forceH=0,listH;if(!o||o.isEmpty()){return }var wc=null,hc=null;if(force){item._w=item._h=null}if(width&&item._w!=width){if(height!="auto"){height=profile.getRootNode().offsetHeight||profile.getRoot().offsetHeight()}forceH=1}if((height&&item._h!=height)||forceH){item._h=height;if(height&&height!="auto"){listH=l.get(0).offsetHeight||l.offsetHeight();height=height-listH+(linb.browser.ie6?2:1);if(height>0){hc=height}}else{hc=height}}if(hc){o.height(hc).onSize()}}}});Class("linb.UI.Stacks","linb.UI.Tabs",{Initialize:function(){var t=this.getTemplate();t.BOX={tagName:"div",LIST:t.LIST,PNAELS:t.PNAELS};delete t.LIST;delete t.PNAELS;this.setTemplate(t)},Static:{Appearances:{BOX:{border:"solid 1px #648CB4",position:"absolute",left:0,top:0},LIST:{position:"static"},ITEMS:{position:"static"},ITEM:{$order:0,display:"block",position:"absolute",cursor:"pointer",background:linb.UI.$bg("bar_vertical.gif","repeat-x left -380px",true),width:"100%",left:0},ITEMC:{display:"block"},ITEMI:{display:"block"},"ITEM-mouseover":{$order:1,"background-position":"right -410px"},"ITEM-mousedown, ITEM-checked":{$order:2,"background-position":"right -440px"},HANDLE:{cursor:"pointer",display:"block","font-size":"12px",height:"100%",height:"18px",padding:"5px 0 5px 8px","white-space":"nowrap"},PANEL:{position:"absolute",display:"none",overflow:"auto"},CMDS:{position:"absolute",top:"6px",right:"8px","text-align":"right","vertical-align":"middle"}},DataModel:{$border:1,NoPanel:null},_onresize:function(profile,width,height,force,key){var t=profile.properties,item=profile.getItemByItemId(key),bw=t.$border*2;if(!item){key=t.$UIvalue}var temp,t1,t2,obj,top,wc=null,hc=null,bx=profile.getSubNode("BOX"),o=profile.boxing().getPanel(key);if(!o||o.isEmpty()){return }if(height){height-=bw;t2=t1=0;_.arr.each(t.items,function(o){obj=profile.getSubNodeByItemId("ITEM",o.id);obj.cssRegion({bottom:"auto",top:t1});t1+=obj.height();if(o.id==key){return false}});_.arr.each(t.items,function(o){if(o.id==key){return false}obj=profile.getSubNodeByItemId("ITEM",o.id);obj.cssRegion({top:"auto",bottom:t2});t2+=obj.height()},null,true);temp=height-t1-t2;if(temp>0){top=t1;hc=temp}bx.height(height)}if(width){width-=bw;wc=width;bx.width(width)}o.cssRegion({width:wc?wc:null,height:hc?hc:null,top:top,left:0},true);if(wc){profile.getSubNode("LIST").width(wc)}}}});Class("linb.UI.ButtonViews","linb.UI.Tabs",{Initialize:function(){var t=this.getTemplate();t.LIST.className="uibg-bar uiborder-outset";this.setTemplate(t)},Static:{Appearances:{LIST:{"z-index":"2",position:"absolute"},ITEMS:{"z-index":"2",position:"absolute",left:0,top:0},ITEM:{$order:0,margin:"2px",position:"relative","font-family":'"Verdana", "Helvetica", "sans-serif"',cursor:"pointer","padding-right":"4px","vertical-align":"top",background:linb.UI.$bg("button.gif","no-repeat right -270px",true)},"ITEM-mouseover":{$order:1,"background-position":"right -360px"},"ITEM-mousedown, ITEM-checked":{$order:2,"background-position":"right -450px"},ITEMI:{$order:0,"padding-left":"4px","vertical-align":"top","text-align":"center",background:linb.UI.$bg("button.gif","no-repeat left -330px",true)},"ITEM-mouseover ITEMI":{$order:1,"background-position":"left -420px"},"ITEM-mousedown ITEMI, ITEM-checked ITEMI":{$order:2,"background-position":"left -510px"},ITEMC:{$order:0,"vertical-align":"top","text-align":"center",height:"20px",padding:"2px 0",background:linb.UI.$bg("button.gif","repeat-x left -300px",true)},"ITEM-mouseover ITEMC":{$order:1,"background-position":"left -390px"},"ITEM-mousedown ITEMC, ITEM-checked ITEMC":{$order:2,"background-position":"left -480px"},LEFT:{"border-right":"1px solid #A7A6AA"},RIGHT:{"border-left":"1px solid #A7A6AA"},TOP:{"border-bottom":"1px solid #A7A6AA"},BOTTOM:{"border-top":"1px solid #A7A6AA"},HANDLE:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,cursor:"pointer","vertical-align":"middle","font-size":"12px",margin:"1px"}},DataModel:{barLocation:{ini:"top",listbox:["top","bottom","left","right"],action:function(v){var self=this,hs=self.getSubNode("LIST"),h=self.getSubNodes(["ITEM","ITEMI","ITEMC"],true);switch(v){case"left":hs.cssRegion({left:0,top:0,right:"auto",bottom:0});break;case"top":hs.cssRegion({left:0,top:0,right:0,bottom:"auto"});break;case"right":hs.cssRegion({left:"auto",top:0,right:0,bottom:0});break;case"bottom":hs.cssRegion({left:0,top:"auto",right:0,bottom:0});break}switch(v){case"left":case"right":h.css("display","block");break;case"top":case"bottom":h.setInlineBlock();hs.height("auto");break}self.boxing().setBarSize(self.properties.barSize,true)}},barHAlign:{ini:"left",listbox:["left","center","right"],action:function(v){var hl=this.getSubNode("ITEMS");hl.css("textAlign",v)}},barVAlign:{ini:"top",listbox:["top","bottom"],action:function(v){var hl=this.getSubNode("ITEMS");if(v=="top"){hl.cssRegion({top:0,bottom:"auto"})}else{hl.cssRegion({bottom:0,top:"auto"})}}},barSize:{ini:50,action:function(v){var self=this,t=self.properties,hs=self.getSubNode("LIST"),hl=self.getSubNode("ITEMS");if(t.barLocation=="left"||t.barLocation=="right"){hs.merge(hl).width(v)}else{hs.height(v)}var t=self.getRootNode().style;linb.UI.$tryResize(self,t.width,t.height,true)}}},LayoutTrigger:function(){var pro=this.properties;this.boxing().setBarLocation(pro.barLocation,true).setBarHAlign(pro.barHAlign,true).setBarVAlign(pro.barVAlign,true)},_onresize:function(profile,width,height,force,key){var t=profile.properties,item=profile.getItemByItemId(key);if(!item){key=t.$UIvalue}var o=profile.boxing().getPanel(key),top,left,hs=profile.getSubNode("LIST"),hl=profile.getSubNode("ITEMS"),wc=null,hc=null;if(t.barLocation=="top"||t.barLocation=="bottom"){if(width){hs.width(width);hl.width(width);left=0;wc=width}if(height-t.barSize>0){hc=height-t.barSize-2}top=t.barLocation=="top"?2- -t.barSize:0}else{if(height){hs.height(height);top=0;hc=height}if(width){left=t.barLocation=="left"?2- -t.barSize:0;wc=width-t.barSize-2}}if(o&&!o.isEmpty()){o.cssRegion({width:wc?wc:null,height:hc?hc:null,left:left,top:top},true)}}}});Class("linb.UI.RadioBox","linb.UI.List",{Initialize:function(){var t=this.getTemplate();t.ITEMS.className="";t.$submap={items:{ITEM:{className:"{itemClass}  {disabled}",style:"{itemStyle}",tagName:"a",href:linb.$href,tabindex:"{_tabindex}",MARK:{$order:0,className:"uicmd-radio"},ICON:{$order:1,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{text:"{caption}",$order:2}}}};this.setTemplate(t)},Static:{_DIRTYKEY:"MARK",Appearances:{ITEM:{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,"font-family":' "Verdana", "Helvetica", "sans-serif"',border:0,padding:"4px",position:"relative",zoom:linb.browser.ie?1:null,cursor:"pointer",overflow:"hidden","vertical-align":"middle","font-size":"12px"},CAPTION:{"vertical-align":"middle"},ITEMS:{overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":"",position:"relative","line-height":"14px"}},Behaviors:{HoverEffected:{ITEM:"MARK"},ClickEffected:{ITEM:"MARK"}},_onresize:function(){}}});Class("linb.UI.FoldingList",["linb.UI.List"],{Instance:{fillContent:function(id,obj){var profile=this.get(0),t,item;if(profile.renderId){if(item=profile.getItemByItemId(id)){t=profile.getSubNodeByItemId("BODYI",id).html("");if(obj){item._obj=obj;item._fill=true;if(typeof obj=="string"){t.html(obj)}else{t.append(obj.render(true))}}else{item._obj=item._fill=null}}}return this},toggle:function(id){var profile=this.get(0);if(profile.renderId){var properties=profile.properties,items=properties.items,item=profile.getItemByItemId(id),subId=profile.getSubIdByItemId(id),node=profile.getSubNode("ITEM",subId),toggle=profile.getSubNode("TOGGLE",subId),nodenext=node.next(),t;if(item._show){if(properties.activeLast&&items.length){if(items[items.length-1].id==item.id){return false}}node.tagClass("-checked",false);toggle.tagClass("-checked",false);if(nodenext){nodenext.tagClass("-prechecked",false)}}else{node.tagClass("-checked");toggle.tagClass("-checked");if(nodenext){nodenext.tagClass("-prechecked")}if(!item._fill){var callback=function(o){profile.boxing().fillContent(item.id,item._body=o)};if(profile.onGetContent){var r=profile.boxing().onGetContent(profile,item,callback);if(r){callback(r)}}else{callback(profile.box._buildBody(profile,item))}}}item._show=!item._show}return this}},Initialize:function(){var t=this.getTemplate();t.$submap={items:{ITEM:{tagName:"div",className:"{_checked} {_precheked} {itemClass} {disabled}",style:"{itemStyle}",HEAD:{tagName:"div",HL:{tagName:"div"},HR:{tagName:"div"},TITLE:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",TLEFT:{$order:0,tagName:"div",TOGGLE:{$order:0,className:"uicmd-toggle {_tlgchecked}"},CAP1:{$order:1,text:"{title}"}},TRIGHT:{$order:1,tagName:"div",style:"{_capDisplay}",CAP2:{$order:0,text:"{caption}"},OPT:{$order:1,className:"uicmd-opt",style:"{_opt}"}}}},BODY:{$order:1,tagName:"div",className:"uibg-base",BODYI:{$order:0,tagName:"div",text:"{_body}"},CMDS:{$order:1,tagName:"div",text:"{cmds}"}},TAIL:{$order:4,tagName:"div",TL:{tagName:"div"},TR:{tagName:"div"}}}},"items.cmds":{$order:2,CMD:{className:"ui-btn",CMDI:{className:"ui-btni",CMDC:{className:"ui-btnc",CMDA:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",text:"{caption}"}}}}}};this.setTemplate(t)},Static:{Appearances:{KEY:{padding:"2px"},ITEMS:{border:0,position:"relative",zoom:linb.browser.ie?1:null,"padding-top":"8px"},ITEM:{border:0,zoom:linb.browser.ie?1:null,"margin-top":"-9px",padding:0,"font-family":'"Verdana", "Helvetica", "sans-serif"',position:"relative",overflow:"hidden"},"HEAD, BODY, BODYI, TAIL":{position:"relative"},CMDS:{padding:"4px 8px 2px 18px",position:"relative",background:linb.UI.$bg("border_left.gif","repeat-y left top #EEE"),zoom:linb.browser.ie?1:null},CMD:{margin:"2px 4px 2px 4px"},BODY:{display:"none","border-right":"solid 1px #CCC",zoom:linb.browser.ie?1:null,position:"relative",overflow:"auto",background:linb.UI.$bg("border_left.gif","repeat-y left top")},BODYI:{padding:"2px 8px 0 8px",background:linb.UI.$bg("border_left.gif","repeat-y left top"),position:"relative"},"ITEM-checked":{$order:2,"margin-bottom":"12px"},"ITEM-checked BODY":{$order:2,display:"block"},"HL, HR, TL, TR":{position:"absolute","_font-size":0,"_line-height":0,width:"8px",background:linb.UI.$bg("corner.gif","no-repeat")},"HL, HR":{height:"30px"},"ITEM-prechecked HL":{$order:1,"background-position":"left top"},"ITEM-prechecked HR":{$order:1,"background-position":"right top"},"TL, TR":{height:"20px"},HL:{$order:1,top:0,left:0,"background-position":"left -37px"},HR:{$order:1,top:0,right:0,"background-position":"right -37px"},TL:{$order:1,bottom:0,left:0,"background-position":"left bottom"},TR:{$order:1,bottom:0,right:0,"background-position":"right bottom"},HEAD:{position:"relative",zoom:linb.browser.ie?1:null,background:linb.UI.$bg("border_top.gif","#fff repeat-x left top"),overflow:"hidden"},TITLE:{$order:1,height:"26px",display:"block",position:"relative","white-space":"nowrap",overflow:"hidden"},TAIL:{"_font-size":0,"_line-height":0,position:"relative",height:"5px",background:linb.UI.$bg("border_bottom.gif","repeat-x left bottom #EEE")},"CAP1, CAP2":{padding:"3px","vertical-align":"middle"},CAP1:{color:"#666",cursor:"pointer","white-space":"nowrap",font:"bold 12px arial,sans-serif",color:"#00681C"},"ITEM-checked CAP1":{$order:2,"font-weight":"normal"},TLEFT:{position:"absolute",left:"4px",top:"2px","white-space":"nowrap",overflow:"hidden"},TRIGHT:{position:"absolute",right:"4px",top:"2px","white-space":"nowrap",overflow:"hidden"}},Behaviors:{HoverEffected:{ITEM:null,HEAD:"HEAD",OPT:"OPT",CMD:"CMD"},ClickEffected:{ITEM:null,HEAD:"HEAD",CMD:"CMD"},ITEM:{onClick:null,onKeydown:null},HEAD:{onClick:function(profile,e,src){profile.boxing().toggle(profile.getItemIdByDom(src));return false}},CMD:{onClick:function(profile,e,src){if(profile.onClickButton){profile.boxing().onClickButton(profile,profile.getItemByDom(linb.use(src).parent().get(0)),linb.use(src).id().split("_")[1],src)}return false}},OPT:{onMousedown:function(){return false},onClick:function(profile,e,src){profile.boxing().onShowOptions(profile,profile.getItemByDom(src),e,src);return false}}},DataModel:({value:null,cmds:{ini:[]},activeLast:false}),EventHandlers:{onGetContent:function(profile,item,onEnd){},onClickButton:function(profile,item,cmdkey,src){},onShowOptions:function(profile,item,e,src){}},RenderTrigger:function(){var self=this,pro=self.properties,items=pro.items,item;if(pro.activeLast&&items.length>0){item=items[items.length-1];self.boxing().fillContent(item.id,item._body)}},_prepareItems:function(profile,arr,pid){if(arr.length){arr[0]._precheked=profile.getClass("ITEM","-prechecked");if(profile.properties.activeLast){var item=arr[arr.length-1];item._show=true;item._fill=true;item._body=profile.onGetContent?profile.boxing().onGetContent(profile,item):profile.box._buildBody(profile,item)}}return arguments.callee.upper.apply(this,arguments)},_prepareItem:function(profile,item){var p=profile.properties,o,dpn="display:none";item._tabindex=p.tabindex;if(!item.caption){item._capDisplay=dpn}else{item.caption=item.caption.replace(/</g,"&lt;")}item._opt=item.optBtn?"":dpn;item._body=item._body||"Loading...";if(item._show){item._checked=profile.getClass("ITEM","-checked");item._tlgchecked=profile.getClass("TOGGLE","-checked")}var cmds=item.cmds||p.cmds;if(cmds&&cmds.length){var sid=linb.UI.$tag_subId,a;a=item.cmds=[];for(var i=0,t=cmds,l=t.length;i<l;i++){if(typeof t[i]=="string"){t[i]={id:t[i]}}if(!t[i].caption){t[i].caption=t[i].id}t[i].id=t[i].id.replace(/[^\w]/g,"_");o=linb.UI.adjustData(profile,t[i]);a.push(o);o[sid]=item[sid]+"_"+o.id}}},_buildBody:function(profile,item){return item.text?"<pre>"+item.text.replace(/</g,"&lt;")+"</pre>":""}}});Class("linb.UI.TreeBar",["linb.UI","linb.absList","linb.absValue"],{Instance:{_setCtrlValue:function(value,flag){return this.each(function(profile){if(!profile.renderId){return }var box=profile.boxing(),uiv=box.getUIValue(),properties=profile.properties,fun=function(key,o,b){profile.getSubNodeByItemId(key,o).tagClass("-checked",b)},selmode=properties.selMode;if(selmode=="single"){var itemId=profile.getSubIdByItemId(uiv);if(uiv&&itemId){profile.getSubNode("BAR",itemId).tagClass("-checked",false)}itemId=profile.getSubIdByItemId(value);if(itemId){profile.getSubNode("BAR",itemId).tagClass("-checked")}}else{if(selmode=="multi"){uiv=uiv?uiv.split(";"):[];value=value?value.split(";"):[];if(flag){_.arr.each(value,function(o){fun("BAR",o)})}else{_.arr.each(uiv,function(o){if(_.arr.indexOf(value,o)==-1){fun("BAR",o,false)}});_.arr.each(value,function(o){if(_.arr.indexOf(uiv,o)==-1){fun("BAR",o)}})}}}})},insertItems:function(arr,pid,base,before){var node,arr2;return this.each(function(profile){var tar,r,k;arr2=profile.box._adjustItems(arr);if(!pid){k=profile.properties;tar=k.items||(k.items=[])}else{k=profile.getItemByItemId(pid);tar=k.sub||(k.sub=[])}if(profile.renderId){if(!base){if(!pid){node=profile.getSubNode("ITEMS")}else{if(pid&&k._created){node=profile.getSubNodeByItemId("SUB",pid)}}if(node){r=profile._buildItems("items",profile.box._prepareItems(profile,arr2,pid));if(before){node.prepend(r)}else{node.append(r)}}}else{node=profile.getSubNodeByItemId("ITEM",base);if(node){r=profile._buildItems("items",profile.box._prepareItems(profile,arr2,pid));if(before){node.addPrev(r)}else{node.addNext(r)}}}}if(!base){_.arr.insertAny(tar,arr2,before?0:-1)}else{var index=_.arr.subIndexOf(tar,"id",base);_.arr.insertAny(tar,arr2,before?index:(index+1))}var obj;if(pid){if((obj=profile.getSubNodeByItemId("TOGGLE",pid)).css("display")=="none"){obj.setInlineBlock()}}if(!(("iniFold" in k)?k.iniFold:profile.properties.iniFold)){if(!pid||profile.getItemByItemId(pid)._created){profile.boxing()._toggleNodes(arr2,true)}}})},_toggleNodes:function(items,expend,recursive){var self=this;_.arr.each(items,function(o){self.toggleNode(o.id,expend,recursive)});return self},toggleNode:function(id,expend,recursive){var profile=this.get(0),o=profile.getItemByItemId(id);if(o&&o.sub){profile.box._setSub(profile,o,typeof expend=="boolean"?expend:!o._checked,recursive)}return self},openToNode:function(id){return this.each(function(profile){var res=false,a=[],fun=function(arr,catId,layer){layer=layer||0;var me=arguments.callee;_.arr.each(arr,function(o){if(o.id==catId){a.push(o);res=true;return false}if(o.sub){res=me.call(me,o.sub,catId,++layer);if(res){a.push(o);return false}}});return res};fun(profile.properties.items,id);if(res){a.reverse();_.arr.each(a,function(o){if(o.sub){profile.boxing().toggleNode(o.id,true)}else{profile.boxing().fireItemClickEvent(o.id)}})}})},fireItemClickEvent:function(subId){this.getSubNodeByItemId("BAR",subId).onClick();return this}},Initialize:function(){this.addTemplateKeys(["DISABLED"])},Static:{Templates:{tagName:"div",style:"{_style}",ondrag:"return false",onselectstart:"return false",BORDER:{tagName:"div",BOX:{tagName:"div",onselectstart:"return false",ITEMS:{tagName:"div",text:"{items}"}}},$submap:{items:{ITEM:{className:"{itemClass} {disabled}",style:"{itemStyle}",tagName:"div",onselectstart:"return false",unselectable:"on",BAR:{$order:0,tagName:"a",href:"{href}",tabindex:"{_tabindex}",className:"{cls_group} ",onselectstart:"return false",unselectable:"on",MARK2:{$order:0,style:"{mark2Display}"},TOGGLE:{$order:1,className:"uicmd-toggle",style:"{mark}"},ITEMICON:{$order:2,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},ITEMCAPTION:{text:"&nbsp;{caption}",className:"{disabled} ",$order:3}},SUB:{$order:1,tagName:"div",text:linb.UI.$childTag}}}}},Appearances:{KEY:{"font-family":"Verdana, Helvetica, sans-serif",border:0},BOX:{left:0,overflow:"auto","overflow-x":(linb.browser.ie||linb.browser.gek)?"hidden":"",position:"relative"},ITEMS:{overflow:"hidden"},ITEM:{"white-space":"nowrap",position:"relative",overflow:"hidden"},BAR:{cursor:"pointer",zoom:linb.browser.ie?1:null,position:"relative",display:"block",overflow:"hidden","font-size":"12px",padding:"2px 4px",border:"1px solid","border-color":"#EDF4FC #698AB3 #698AB3 #698AB3","background-color":"#CCE4FC"},DISABLED:{color:"#808080"},"BAR-mouseover":{$order:1,"background-color":"#fffa9f"},"BAR-checked":{$order:2,"background-color":"#fffa9f"},"BAR-GROUP":{$order:2,"border-top":"none","border-bottom":"none",padding:"5px 4px",height:"18px",background:linb.UI.$bg("bar_vertical.gif","repeat-x left -380px",true)},"BAR-GROUP-mouseover":{$order:3,"background-position":"left -410px"},"BAR-GROUP-checked":{$order:4,"background-position":"left -440px"},SUB:{overflow:"hidden","*zoom":1,height:0,"font-size":"1px","line-height":"1px",position:"relative","margin-left":"12px"},MARK2:{cursor:"pointer",width:"16px",height:"16px","vertical-align":"middle",background:linb.UI.$bg("icons.gif","no-repeat -20px -70px",true)},"BAR-checked MARK2":{$order:3,"background-position":"0 -70px"},ITEMCAPTION:{"vertical-align":"middle",padding:"2px"}},Behaviors:{HoverEffected:{TOGGLE:"TOGGLE",BAR:"BAR"},ClickEffected:{TOGGLE:"TOGGLE",BAR:"BAR"},DragableKeys:["BAR"],DropableKeys:["BAR","TOGGLE","BOX"],onSize:linb.UI.$onSize,TOGGLE:{onClick:function(profile,e,src){var properties=profile.properties,domId=linb.use(src).id(),item=profile.getItemByDom(domId);if(properties.disabled||item.disabled){return false}if(!("sub" in item)){return false}profile.box._setSub(profile,item,!item._checked);return false}},BAR:{onClick:function(profile,e,src){var properties=profile.properties,domId=linb.use(src).id(),item=profile.getItemByDom(domId),itemId=profile.getSubId(domId),box=profile.boxing(),ks=linb.Event.getKey(e),rt,rt2;if(properties.disabled||item.disabled){return false}if(item.sub&&(item.hasOwnProperty("group")?item.group:properties.group)){profile.getSubNode("TOGGLE",itemId).onClick();return false}switch(properties.selMode){case"none":rt=box.onItemSelected(profile,item,src);break;case"multi":var value=box.getUIValue(),arr=value?value.split(";"):[];if(arr.length&&(ks[1]||ks[2]||properties.noCtrlKey)){rt2=false;if(ks[2]){if(profile.$firstV._pid!=item._pid){return false}var items=properties.items;if(item._pid){var pitem=profile.getItemByItemId(item._pid);if(pitem){items=pitem.sub}}var i1=_.arr.subIndexOf(items,"id",profile.$firstV.id),i2=_.arr.subIndexOf(items,"id",item.id),i;arr.length=0;for(i=Math.min(i1,i2);i<=Math.max(i1,i2);i++){arr.push(items[i].id)}}else{if(_.arr.indexOf(arr,item.id)!=-1){_.arr.removeValue(arr,item.id)}else{arr.push(item.id)}}arr.sort();value=arr.join(";");if(box.getUIValue()==value){rt=false}else{box.setUIValue(value);if(box.getUIValue()==value){rt=box.onItemSelected(profile,item,src)||rt2}}break}case"single":if(box.getUIValue()==item.id){rt=false}else{profile.$firstV=item;box.setUIValue(item.id);if(box.getUIValue()==item.id){rt=box.onItemSelected(profile,item,src)}}break}profile.getSubNode("BAR",itemId).focus();return rt},onKeydown:function(profile,e,src){var keys=linb.Event.getKey(e),key=keys[0],shift=keys[2],cur=linb(src),root=profile.getRoot(),first=root.nextFocus(true,true,false),last=root.nextFocus(false,true,false);switch(linb.Event.getKey(e)[0]){case"tab":if(shift){if(cur.get(0)!=first.get(0)){first.focus();return false}}else{if(cur.get(0)!=last.get(0)){last.focus();return false}}break;case"up":var next=cur.nextFocus(false,true,false);if(cur.get(0)==first.get(0)){last.focus()}else{cur.nextFocus(false)}return false;break;case"down":var next=cur.nextFocus(true,false,false);if(cur.get(0)==last.get(0)){first.focus()}else{cur.nextFocus()}return false;break;case"right":case"left":profile.getSubNode("TOGGLE",profile.getSubId(src)).onClick();return false}}},BOX:{onScroll:function(profile,e,src){if((e=linb.use(src)).scrollLeft()!==0){e.scrollLeft(0)}}}},EventHandlers:{onGetContent:function(profile,item,callback){},onItemSelected:function(profile,item,src){}},DataModel:{listKey:null,width:200,height:200,iniFold:true,animCollapse:false,dock:"fill",group:{ini:false,action:function(v){var self=this,items=self.properties.items,results=self.queryItems(items,function(o){return o.sub&&o.group===undefined}),nodes=linb();_.arr.each(results,function(o){nodes.merge(self.getSubNodeByItemId("BAR",o.id))});var cls1=self.getClass("BAR"),cls2=self.getClass("BAR","-group");if(v){nodes.replaceClass(new RegExp("(\\b)"+cls1+"([^b]*\\b)","g"),"$1"+cls2+"$2")}else{nodes.replaceClass(new RegExp("(\\b)"+cls2+"([^b]*\\b)","g"),"$1"+cls1+"$2")}}},selMode:{ini:"single",listbox:["single","none","multi"],action:function(value){var ns=this,p=this.properties,sels=[];_.each(this.SubSerialIdMapItem,function(o){if(!(o.sub&&(o.hasOwnProperty("group")?o.group:p.group))){sels.push(ns.getSubNodeByItemId("MARK2",o.id).get(0))}});linb(sels).css("display",value=="multi"?"":"none")}},noCtrlKey:true,singleOpen:false,dynDestory:false,position:"absolute"},RenderTrigger:function(){var self=this,pro=self.properties;if(!pro.iniFold){self.boxing()._toggleNodes(pro.items,true)}},_onStartDrag:function(profile,e,src,pos){var pos=linb.Event.getPos(e);linb.use(src).startDrag(e,{dragType:"icon",shadowFrom:src,targetLeft:pos.left+12,targetTop:pos.top+12,dragCursor:"pointer",dragDefer:1,dragKey:profile.box.getDragKey(profile,src),dragData:profile.box.getDragData(profile,e,src)});return false},_onDropTest:function(profile,e,src,key,data,item){var fid=data&&data.domId,tid=linb.use(src).id();if(fid){if(fid==tid){return false}if(_.get(linb.use(src).get(0),["parentNode","previousSibling","firstChild","id"])==fid){return false}}},_onDrop:function(profile,e,src,key,data,item){linb.DragDrop.setDragIcon("none");var k=profile.getKey(linb.use(src).id()),po=data.profile,ps=data.domId,oitem,ks=profile.keys,t=linb.absObj.$specialChars,b=profile.boxing();oitem=_.clone(po.getItemByDom(ps),function(o,i){return !t[(i+"").charAt(0)]});po.boxing().removeItems([oitem.id]);if(k==ks.BOX){b.insertItems([oitem],null,null,false)}else{if(k==ks.BAR){b.insertItems([oitem],item._pid,item.id,true)}else{if(k==ks.TOGGLE){b.insertItems([oitem],item.id,null,false)}}}return false},_ensureValue:function(profile,value){if(profile.properties.selMode=="multi"){var arr=(value||"").split(";");arr.sort();return arr.join(";")}else{return value}},_prepareItem:function(profile,item,oitem,pid){var p=profile.properties;if(pid){oitem._pid=pid}item.mark=item.sub?"":"display:none";item.disabled=item.disabled?profile.getClass("KEY","-disabled"):"";item.mark2Display=(p.selMode=="multi")?"":"display:none";item._tabindex=p.tabindex;item.href=item.href||linb.$href;if(item.sub&&(item.hasOwnProperty("group")?item.group:p.group)){item.cls_group=profile.getClass("BAR","-group");item.mark2Display="display:none"}},_setSub:function(profile,item,flag,recursive){var id=profile.domId,itemId=profile.getSubIdByItemId(item.id),properties=profile.properties,barNode=profile.getSubNode("BAR",itemId),markNode=profile.getSubNode("TOGGLE",itemId),subNs=profile.getSubNode("SUB",itemId);if(linb.Thread.isAlive(profile.key+profile.id)){return }if(item._checked){if(!flag){var h=subNs.height();if(properties.animCollapse){subNs.animate({height:[h,0]},null,null,100,5,"expoIn",profile.key+profile.id).start()}else{subNs.height(0)}markNode.tagClass("-checked",false);item._checked=false;if(item.group||properties.group){barNode.tagClass("-checked",false)}if(properties.dynDestory){var s=item.sub,arr=[];for(var i=0,l=s.length;i<l;i++){arr.push(s[i].id)}profile.boxing().removeItems(arr);item.sub=true;delete item._created}}if(recursive&&item.sub&&!properties.dynDestory){_.arr.each(item.sub,function(o){if(o.sub&&o.sub.length){profile.box._setSub(profile,o,false,true)}})}}else{if(flag){var openSub=function(profile,item,id,markNode,subNs,barNode,sub,recursive){var b=profile.boxing(),p=profile.properties;if(!item._created){delete item.sub;item._created=true;if(typeof sub=="string"){subNs.html(item.sub=sub,false)}else{if(_.isArr(sub)){b.insertItems(sub,item.id)}else{if(sub["linb.Template"]||sub["linb.UI"]){subNs.append(item.sub=sub.render(true))}}}b._setCtrlValue(b.getUIValue(),true)}if(p.singleOpen){b._toggleNodes(item._pid?profile.getItemByItemId(item._pid).sub:p.items,false)}if(!recursive){var h=subNs.height(true);if(p.animCollapse){subNs.animate({height:[0,h]},null,function(){subNs.height("auto")},100,5,"expoOut",profile.key+profile.id).start()}else{subNs.height("auto")}}else{subNs.height("auto")}markNode.tagClass("-checked");if(item.group||properties.group){barNode.tagClass("-checked")}item._checked=true},sub=item.sub,callback=function(sub){openSub(profile,item,id,markNode,subNs,barNode,sub,recursive)},t;if((t=typeof sub)=="string"||t=="object"){callback(sub)}else{if(profile.onGetContent){var r=profile.boxing().onGetContent(profile,item,callback);if(r){callback(r)}}}}if(recursive&&item.sub){_.arr.each(item.sub,function(o){if(o.sub&&o.sub.length&&!o._checked){profile.box._setSub(profile,o,true,true)}})}}},_onresize:function(profile,width,height){profile.getSubNode("BORDER").cssSize({width:width?width:null,height:height?height:null});profile.getSubNode("BOX").cssSize({width:width?width:null,height:height?height:null})}}});Class("linb.UI.PopMenu",["linb.UI.Widget","linb.absList"],{Instance:{_adjustSize:function(){this.each(function(profile){var root=profile.getRoot(),items=profile.getSubNode("ITEMS"),border=profile.getSubNode("BORDER"),size1=root.cssSize(),size2=border.cssSize(),pro=profile.properties,h=Math.min(pro._maxHeight,items.height()+size1.height-size2.height+1),w=Math.min(pro._maxWidth,items.width()+size1.width-size2.width+1);pro.width=w;pro.height=h;root.cssSize({width:w,height:h});linb.UI.$doResize(profile,w,h,true)});return this._setScroll()},_setScroll:function(){return this.each(function(profile){var o=profile.getSubNode("ITEMS"),t=o.offsetTop(),h=o.offsetHeight(),b=profile.getSubNode("BORDER"),hh=b.offsetHeight();profile.getSubNode("TOP").css("display",t===0?"none":"block");profile.getSubNode("BOTTOM").css("display",(hh>h+t)?"none":"block")})},_scrollToBottom:function(){return this.each(function(profile){var o=profile.getSubNode("ITEMS"),border=profile.getSubNode("BORDER"),y=o.offsetTop(),offset,h=o.offsetHeight(),b=false,bh=border.height();if(bh<h+y){if(!profile.$scrollStep){profile.$scrollStep=1}if(profile.$scrollStep<30){profile.$scrollStep=profile.$scrollStep*1.1}y-=profile.$scrollStep;if(bh>h+y){y=bh-h;b=true}o.top(y);if(b){profile.getSubNode("BOTTOM").css("display","none");profile.$scrollTobottom=false;profile.$scrollStep=null}else{profile.getSubNode("TOP").css("display","block");if(profile.$scrollTobottom){_.asyRun(arguments.callee,0,[profile],this)}}}})},_scrollToTop:function(){return this.each(function(profile){var o=profile.getSubNode("ITEMS"),y=o.offsetTop(),b=false;if(y<0){if(!profile.$scrollStep){profile.$scrollStep=1}if(profile.$scrollStep<10){profile.$scrollStep=profile.$scrollStep*1.03}y+=profile.$scrollStep;if(y>=-1){y=0;b=true}o.top(y);if(b){profile.getSubNode("TOP").css("display","none");profile.$scrollToTop=false;profile.$scrollStep=null}else{profile.getSubNode("BOTTOM").css("display","block");if(profile.$scrollToTop){_.asyRun(arguments.callee,0,[profile],this)}}}})},pop:function(obj,type,parent){var profile=this.get(0);if(!profile.renderId){var o=profile.boxing().render(true);linb.Dom.getEmptyDiv().append(o)}var root=profile.getRoot();if(profile.$highLight){linb([profile.$highLight]).tagClass("-mouseover",false)}profile._conainer=parent;root.popToTop(obj,type,parent);var f=function(){var p=arguments.callee.profile;p.boxing().hide();p.$popGrp.length=0};f.profile=profile;if(!profile.$popGrp||!profile.$popGrp.length){profile.$popGrp=[root._get(0)];root.setBlurTrigger(profile.$linbid,null);root.setBlurTrigger(profile.$linbid,f,profile.$popGrp)}return this},hide:function(triggerEvent){var t,profile=this.get(0),root=profile.getRoot(),sms="$subPopMenuShowed",cm="$childPopMenu";if(false!==triggerEvent){if(false===profile.boxing().beforeHide(profile)){return this}}if(!root||root.css("display")=="none"){return }root.setBlurTrigger(profile.$linbid,null);if(profile.$hideMenuPool){profile.$hideMenuPool.append(root)}else{root.css("display","none")}var p=profile[cm],q;if(t=profile[sms]){t.hide()}while(p){p.boxing().hide();p=(q=p)[cm];q[cm]=q[sms]=null}profile[cm]=profile[sms]=null;if(t=profile.$parentPopMenu){t[sms]=null}_.arr.removeValue(profile.$popGrp,root._get(0));if(false!==triggerEvent){profile.boxing().onHide(profile)}return this}},Initialize:function(){var t=this.getTemplate();_.merge(t.FRAME.BORDER,{TOP:{},BOTTOM:{},BOX:{tagName:"div",ITEMS:{tagName:"div",text:"{items}"}},POOL:{tagName:"div",style:"display:none;"}},"all");t.$submap={items:function(profile,template,v,tag,result){var t;tag=tag+"."+v.type;if(t=v.object){result[result.length]=t.build(v)}else{if(template[tag]){linb.UI.$doTemplate(profile,template,v,tag,result)}}},"items.split":{ITEMSPLIT:{tagName:"a"}},"items.button":{ITEM:{tagName:"a",href:linb.$href,tabindex:1,className:"{itemClass} {disabled}",style:"{itemStyle}",ICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{text:"{caption}",$order:1},RULER:{style:"{displayAdd}",$order:2},ADD:{tagName:"div",style:"{displayAdd}",text:"{add}",$order:2},SUB:{style:"{tagClass}"}}},"items.checkbox":{ITEM:{tagName:"a",href:linb.$href,tabindex:1,className:"{itemClass} {disabled}",style:"{itemStyle}",CHECKBOX:{$order:0,className:"ui-icon {checkboxCls}"},CAPTION:{text:"{caption}",$order:1},RULER:{style:"{displayAdd}",$order:2},ADD:{tagName:"div",style:"{displayAdd}",text:"{add}",$order:2}}}};this.setTemplate(t)},Static:{$noDomRoot:true,Appearances:{KEY:{"font-size":"12px",visibility:"hidden"},BORDER:{border:"1px solid","border-color":"#FFF #ACA899 #ACA899 #FFF"},BOX:{"background-color":"#EEF7FF",overflow:"hidden",position:"absolute",left:0,top:0,"font-size":"12px","z-index":"3"},ITEMS:{position:"absolute",top:0,left:0,overflow:"visible",background:linb.UI.$bg("bg.gif","repeat-y left top")},ITEM:{display:"block",position:"relative",overflow:"visible","white-space":"nowrap",color:"#000","font-family":'"Verdana", "Helvetica", "sans-serif"',cursor:"pointer",padding:"2px 20px 2px 2px"},ITEMSPLIT:{display:"block",position:"relative",overflow:"visible","white-space":"nowrap","font-size":"1px","line-height":"1px",padding:"1px",margin:"2px 2px 2px 26px",background:linb.UI.$bg("split_horizontal.gif","repeat-x left top",true)},"ITEM-mouseover":{$order:1,"background-color":"#FFFA9F",border:"solid 1px #94A3A8",padding:"1px 19px 1px 1px"},"ITEM-checked":{$order:2,"background-color":"#FFFA9F",border:"solid 1px #94A3A8",padding:"1px 19px 1px 1px"},CHECKBOX:{background:linb.UI.$bg("icons.gif","no-repeat -20px -70px",true),margin:0},ICON:{margin:0},"CHECKBOX-checked":{$order:1,background:linb.UI.$bg("icons.gif","no-repeat -0px -70px",true)},TOP:{cursor:"pointer",display:"none",position:"absolute","margin-left":"-8px",right:0,height:"16px",width:"16px","z-index":"10",top:0,background:linb.UI.$bg("icons.gif","no-repeat -48px -244px",true)},BOTTOM:{cursor:"pointer",display:"none",position:"absolute","margin-left":"-8px",right:0,height:"16px",width:"16px","z-index":"10",bottom:0,background:linb.UI.$bg("icons.gif","no-repeat -66px -244px",true)},"CHECKBOX, CHECKBOX-checked":{cursor:"pointer","vertical-align":"middle",width:"16px",height:"16px"},CAPTION:{"vertical-align":"middle","padding-left":"6px"},RULER:{width:"100px","font-size":0,"line-height":0},ADD:{position:"absolute",top:"3px",right:0,width:"80px","padding-right":"20px","text-align":"right","z-index":"10"},SUB:{position:"absolute",top:"2px",right:"2px",width:"8px",height:"16px",background:linb.UI.$bg("icons.gif","no-repeat -200px -70px",true)}},Behaviors:{ITEM:{onMouseover:function(profile,e,src){var sms="$subPopMenuShowed",all="$allPops",hl="$highLight",showp="$showpops",popgrp="$popGrp";if(profile[hl]==src){return }var properties=profile.properties,item=profile.getItemByDom(src),itemId=item.id,Cancel=false,pop,popp,t;if(t=profile[sms]){if(t==_.get(profile,[all,itemId])){Cancel=true}else{t.hide();profile[sms]=null}}if(!Cancel){if(t=profile[hl]){linb([t]).tagClass("-mouseover",false)}profile[hl]=src;linb.use(src).tagClass("-mouseover");try{linb.use(src).get(0).focus()}catch(e){}}if(!Cancel&&item.sub){if(_.isArr(item.sub)&&item.sub.length){profile[all]=profile[all]||{};if(!(pop=profile[all][itemId])){pop=(new linb.UI.PopMenu({position:"absolute",items:item.sub,autoHide:profile.properties.autoHide})).render(true);pop.onMenuSelected(function(pro,item,src){profile.boxing().onMenuSelected(profile,item,src)});popp=pop.get(0);popp.$hideMenuPool=profile.$hideMenuPool||profile.getSubNode("POOL");profile[all][itemId]=pop;profile[showp]=profile[showp]||[profile];popp[showp]=profile[showp];profile[showp].push(popp)}else{popp=pop.get(0)}profile[popgrp].push(popp.getRoot()._get(0));popp[popgrp]=profile[popgrp];popp.$parentPopMenu=profile;profile.$childPopMenu=popp;pop.pop(src,2);profile[sms]=pop}else{if(profile.onShowSubMenu){var r=profile["$sub:"+item.id];if(r&&r["linb.UI"]&&!r.isEmpty()){}else{r=profile.boxing().onShowSubMenu(profile,item,src)}if(r&&r["linb.UI"]&&!r.isEmpty()){profile[sms]=r;r=r.reBoxing();r.onMouseout(function(p,e,src){profile.box._mouseout(profile,e,src)},null,-1);profile[popgrp].push(r._get(0));r.popToTop(src,2,profile._conainer)}}}}},onMouseout:function(profile,e,src){var properties=profile.properties,item=profile.getItemByDom(src),itemId=item.id,action=true,t;if(t=profile.$subPopMenuShowed){var node=e.toElement||e.relatedTarget,target=t.get(0).getRootNode();try{do{if(node==target){return }}while((node&&(node=node.parentNode)))}catch(a){}}linb.use(src).tagClass("-mouseover",false);profile.$highLight=null},onClick:function(profile,e,src){var prop=profile.properties,item=profile.getItemByDom(src),itemId=item.id;if(prop.disabled||item.disabled){return false}if(!item.sub){if(item.type=="checkbox"){profile.getSubNodeByItemId("CHECKBOX",item.id).tagClass("-checked",item.value=!item.value)}if(profile.onMenuSelected){profile.boxing().onMenuSelected(profile,item,src)}if(prop.hideAfterClick){linb.use(src).tagClass("-mouseover",false);_.asyRun(function(){var p=profile,q;while(p){p.boxing().hide();p=(q=p).$parentPopMenu;q.$parentPopMenu=q.$subPopMenuShowed=null}profile.$subPopMenuShowed=null;profile.$popGrp.length=0},100)}}return false},onFocus:function(profile,e,src){var box=profile.getSubNode("BOX"),top=box.scrollTop(),h=box.scrollHeight(),n=linb.use(src).offsetTop();if(n<top||n>top+h){linb.use(src).offsetTop(top)}linb.use(src).onMouseover()},onKeydown:function(profile,e,src){var item=profile.getItemByDom(src),items=profile.properties.items,key=linb.Event.getKey(e)[0],itemId=item.id,flag,r,tid,node,t;switch(key){case"up":r=true;flag=false;_.arr.each(items,function(o,i){if(o.type=="split"){return }if(flag){tid=o.id;return r=false}if(o.id==itemId){flag=true}},null,true);if(r){tid=items[items.length-1].id}node=profile.getSubNodeByItemId("ITEM",tid).get(0);break;case"down":r=true;flag=false;_.arr.each(items,function(o,i){if(o.type=="split"){return }if(flag){tid=o.id;return r=false}if(o.id==itemId){flag=true}});if(r){tid=items[0].id}node=profile.getSubNodeByItemId("ITEM",tid).get(0);break;case"left":if(t=profile.$parentPopMenu){if(t=profile.$parentPopMenu.$highLight){node=t}}break;case"right":if((t=profile.$subPopMenuShowed)&&t==profile.$allPops[itemId]){t.activate()}break}if(node&&node.tagName){try{node.focus()}catch(e){}}}},TOP:{onMouseover:function(profile){profile.$scrollToTop=true;profile.boxing()._scrollToTop()},onMouseout:function(profile){profile.$scrollToTop=false;profile.$scrollStep=null},onClick:function(profile){profile.$scrollStep=1000}},BOTTOM:{onMouseover:function(profile){profile.$scrollTobottom=true;profile.boxing()._scrollToBottom()},onMouseout:function(profile){profile.$scrollTobottom=false;profile.$scrollStep=null},onClick:function(profile){profile.$scrollStep=1000}},ITEMS:{beforeKeydown:function(profile,e){var key=linb.Event.getKey(e)[0];if(key=="tab"||key=="enter"){return true}else{if(key=="esc"){do{profile.boxing().hide()}while(profile=profile.$parentPopMenu);return false}else{return false}}}},BORDER:{onMouseout:function(profile,e,src){profile.box._mouseout(profile,e,src)}}},DataModel:({dock:null,tabindex:null,tips:null,border:null,resizer:null,shadow:true,_maxHeight:260,_maxWidth:300,left:-10000,hideAfterClick:true,autoHide:false,height:100,width:300,position:"absolute",$hborder:1,$vborder:1}),EventHandlers:{onShowSubMenu:function(profile,item,src){},beforeHide:function(profile){},onHide:function(profile){},onMenuSelected:function(profile,item,src){}},RenderTrigger:function(){this.boxing()._adjustSize()},_mouseout:function(profile,e){if(profile.properties.autoHide){var p1=linb.Event.getPos(e),size,p2,b;_.arr.each(profile.$popGrp,function(o){o=linb([o]);p2=o.offset();size=o.cssSize();if(p1.left>p2.left&&p1.top>p2.top&&p1.left<p2.left+size.width&&p1.top<p2.top+size.height){return b=1}});if(!b){while(b=profile.$parentPopMenu){profile=b}profile.boxing().hide();profile.$popGrp.length=0}}},_prepareItem:function(profile,item){item.add=item.add||"";item.displayAdd=item.add?"":"display:none";item.tagClass=item.sub?"":"display:none";item.imageDisplay=true;item.type=item.type||"button";if(item.type=="checkbox"){item.checkboxCls=profile.getClass("CHECKBOX",item.value?"-checked":"")}},_onresize:function(profile,width,height){var size=arguments.callee.upper.apply(this,arguments);profile.getSubNode("BOX").cssSize(size)}}});Class("linb.UI.MenuBar",["linb.UI","linb.absList"],{Instance:{updateItem:function(subId,options){var self=this,profile=self.get(0),box=profile.box,items=profile.properties.items,rst=profile.queryItems(items,function(o){return typeof o=="object"?o.id===subId:o==subId},true,true,true),item;if(typeof options=="string"){options={caption:options}}if(rst.length){rst=rst[0];if(typeof rst[0]!="object"){item=rst[2][rst[1]]={id:rst[0]}}else{item=rst[0]}_.merge(item,options,"all");item.id=subId;if(items.indexOf(item)!=-1){arguments.callee.upper.apply(this,arguments)}else{_.each(profile.$allPops,function(o){o.updateItem(subId,options)})}}return self},_pop:function(id,src){var menu,self=this,profile=self.get(0),pro=profile.properties,all="$allPops";if(profile.$curPop){self.hide()}linb.use(src).tagClass("-mousedown");profile[all]=profile[all]||{};if(!(menu=profile[all][id])){var item=profile.getItemByItemId(id),sub=item.sub;sub=sub||[];menu=linb.create("PopMenu",{position:"absolute",items:sub,autoHide:!!pro.autoShowTime});profile.getSubNode("POOL").append(menu);menu.onHide(function(pro){self.hide(false)}).onMenuSelected(function(pro,item,src){return profile.boxing().onMenuSelected(profile,pro,item,src)}).onShowSubMenu(function(pro,item,src){return profile.boxing().onShowSubMenu(profile,pro,item,src)});menu.get(0).$hideMenuPool=profile.getSubNode("POOL");menu.get(0)[all]=profile[all];profile[all][id]=menu}var target=linb(src);menu.pop(target,1,linb(pro.parentID));profile.$curPop=id;profile.$curElem=src},_afterInsertItems:function(){this.clearPopCache()},hide:function(){var profile=this.get(0),menu,id=profile.$curPop,node=profile.$curElem;if(menu=profile.$allPops[id]){if(false!==arguments[0]){menu.hide(false)}profile.getSubNode("POOL").append(menu.reBoxing());linb([node]).tagClass("-mousedown",false)}profile.$menuPop=profile.$curPop=profile.$curElem=null},clearPopCache:function(){var profile=this.get(0);if(profile.renderId){profile.getSubNode("POOL").empty();profile.$allPops=profile.$curPop=profile.$curElem=null}}},Initialize:function(){linb.SC("linb.UI.PopMenu")},Static:{Templates:{tagName:"div",POOL:{tagName:"div"},BORDER:{className:"uibg-bar uiborder-outset",tagName:"div",LIST:{tagName:"div",HANDLER:{style:"{handler}"},ITEMS:{$order:1,text:"{items}"}}},$submap:{items:{ITEM:{ITEMI:{ITEMC:{ITEMA:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",className:" {typeCls} {disabled}",ICON:{$order:1,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{$order:2,text:"{caption}",style:"{captionDisplay}"}}}}}}}},Appearances:{KEY:{"font-size":0,"line-height":0,position:"absolute",left:0,top:0},POOL:{width:0,height:0,visibility:"hidden",position:"absolute",left:"-10000px"},BORDER:{left:0,top:0,"font-size":0,"line-height":0},HANDLER:{height:"22px",width:"7px",background:linb.UI.$bg("handler.gif"," left top",true),cursor:"move","vertical-align":"middle"},LIST:{padding:"2px"},ITEMS:{"vertical-align":"middle"},"LIST-disabled":{"background-color":"#E4E4E4"},"ITEM-mouseover, ITEM-mouseover ITEMI, ITEM-mouseover ITEMC, ITEM-mousedown, ITEM-mousedown ITEMI, ITEM-mousedown ITEMC":{background:linb.UI.$bg("button.gif","no-repeat",true)},ITEM:{height:"22px","white-space":"nowrap","vertical-align":"top",overflow:"hidden",margin:"0  3px 0 3px","padding-right":"6px","font-size":0,"line-height":0},"ITEM *":{cursor:"pointer"},ITEMI:{height:"22px","padding-left":"6px","vertical-align":"top"},ITEMC:{height:"22px","padding-top":"3px","vertical-align":"top"},ITEMA:{display:linb.$inlineBlock},"ITEM-mouseover":{$order:2,"background-position":"right -90px"},"ITEM-mousedown":{$order:3,"background-position":"right -180px"},"ITEM-mouseover ITEMI":{$order:2,"background-position":"left -150px"},"ITEM-mousedown ITEMI":{$order:3,"background-position":"left -240px"},"ITEM-mouseover ITEMC":{$order:2,"background-position":"left -120px","background-repeat":"repeat-x"},"ITEM-mousedown ITEMC":{$order:3,"background-position":"left -210px","background-repeat":"repeat-x"},CAPTION:{"font-size":"12px","line-height":"14px","vertical-align":"middle"}},Behaviors:{ITEM:{onMouseover:function(profile,e,src){var p=profile.properties,ns=src;if(p.disabled){return }var item=profile.getItemByDom(src),itemId=item.id;if(item.disabled){return }if(profile.$menuPop){if(profile.$menuPop!=itemId){linb.use(ns).tagClass("-mousedown");profile.boxing()._pop(itemId,ns);profile.$menuPop=itemId}}else{linb.use(ns).tagClass("-mouseover");if(p.autoShowTime){_.resetRun(profile.$linbid+":autoShowTime",function(){profile.boxing()._pop(itemId,ns)},p.autoShowTime)}}},onMouseout:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var item=profile.getItemByDom(src);if(item.disabled){return }linb.use(src).tagClass("-mouseover",false);if(p.autoShowTime){var pop=profile.$allPops;if(pop=pop&&pop[profile.$curPop]){var node=pop.get(0).getRoot(),p1=linb.Event.getPos(e),size=node.cssSize(),add=3,p2=node.offset();if(p1.left>p2.left&&p1.top>p2.top-add&&p1.left<p2.left+size.width&&p1.top<p2.top+size.height){}else{pop.hide()}}_.resetRun(profile.$linbid+":autoShowTime",null)}},onMousedown:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var item=profile.getItemByDom(src),itemId=item.id;if(item.disabled){return }if(profile.$menuPop){profile.$menuPop=null;profile.boxing().hide(itemId)}else{profile.$menuPop=itemId;profile.boxing()._pop(itemId,src);return false}},onKeydown:function(profile,e,src){var keys=linb.Event.getKey(e),key=keys[0],shift=keys[2],cur=linb(src),first=profile.getRoot().nextFocus(true,true,false),last=profile.getRoot().nextFocus(false,true,false);switch(linb.Event.getKey(e)[0]){case"tab":if(shift){if(cur.get(0)!=first.get(0)){first.focus();return false}}else{if(cur.get(0)!=last.get(0)){last.focus();return false}}break;case"left":case"up":var next=cur.nextFocus(false,true,false);if(cur.get(0)==first.get(0)){last.focus()}else{cur.nextFocus(false)}return false;break;case"right":case"down":var next=cur.nextFocus(true,false,false);if(cur.get(0)==last.get(0)){first.focus()}else{cur.nextFocus()}return false;break;case"enter":cur.onMousedown();return false;break}},onClick:function(){return false}}},DataModel:{listKey:null,height:{ini:"auto",readonly:true},width:"auto",parentID:"",$hborder:1,$vborder:1,left:0,top:0,autoShowTime:200,handler:{ini:true,action:function(v){this.getSubNode("HANDLER").css("display",v?"":"none")}},position:"absolute",dock:{ini:"top",listbox:["top","bottom"]}},EventHandlers:{onShowSubMenu:function(profile,popProfile,item,src){},onMenuSelected:function(profile,popProfile,item,src){}},RenderTrigger:function(){if(this.properties.disabled){this.boxing().setDisabled(true,true)}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile);data.handler=data.handler?"":"display:none";return data}}});Class("linb.UI.ToolBar",["linb.UI","linb.absList"],{Instance:{updateItem:function(subId,options){if(options.type){return arguments.callee.upper.apply(this,[subId,options,"items.sub"])}else{var self=this,profile=self.get(0),box=profile.box,items=profile.properties.items,rst=profile.queryItems(items,function(o){return typeof o=="object"?o.id===subId:o==subId},true,true,true),item,n1,n2,t;if(_.isStr(options)){options={caption:options}}delete options.id;delete options._pid;if(rst.length){rst=rst[0];if(item=rst[0]){n1=profile.getSubNodeByItemId("ICON",subId);n2=profile.getSubNodeByItemId("CAPTION",subId);if("value" in options&&options.value!=item.value){profile.getSubNodeByItemId("BTN",subId).tagClass("-checked",!!options.value)}if("caption" in options&&options.caption!=item.caption){n2.html(options.caption)}if("image" in options&&options.image!=item.image){n1.css("background-image",options.image)}if("imagePos" in options&&options.imagePos!=item.imagePos){n1.css("background-position",options.imagePos)}if("imageClass" in options&&options.imageClass!=item.imageClass){if(item.imageClass){n1.removeClass(item.imageClass)}if(options.imageClass){n1.addClass(options.imageClass)}}_.merge(item,options,"all")}}return self}},showItem:function(itemId,value){return this.each(function(profile){profile.getItemByItemId(itemId).visible=value!==false;profile.getSubNodeByItemId("ITEM",itemId).css("display",value===false?"none":"")})},showGroup:function(grpId,value){return this.each(function(profile){_.arr.each(profile.properties.items,function(o){if(o.id==grpId){o.visible=value!==false;return false}});profile.getSubNodeByItemId("GROUP",grpId).css("display",value===false?"none":"");linb.UI.$dock(profile,true,true)})}},Static:{_ITEMKEY:"GROUP",Templates:{tagName:"div",ITEMS:{className:"uibg-bar uiborder-outset",tagName:"div",style:"{mode}",text:"{items}"},$submap:{items:{GROUP:{className:"{groupClass}",style:"{grpDisplay} {groupStyle}",HANDLER:{style:"{mode2}"},LIST:{$order:1,tagName:"text",text:"{sub}"}}},"items.sub":{ITEM:{style:"{itemDisplay}",IBWRAP:{tagName:"div",SPLIT:{style:"{splitDisplay}"},LABEL:{className:" {disabled}",style:"{labelDisplay}",text:"{label}"},BTN:{className:"ui-btn {itemClass}",style:"{itemStyle} {boxDisplay}",BTNI:{className:"ui-btni",BTNC:{className:"ui-btnc",BOX:{tagName:"a",href:linb.$href,tabindex:"{_tabindex}",BOXWRAP:{tagName:"div",ICON:{$order:1,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{$order:2,text:"{caption}",className:" {disabled}",style:"{captionDisplay}"},DROP:{$order:3,style:"{dropDisplay}"}}}}}}}}}}},Appearances:{KEY:{"font-size":0,"line-height":0,position:"absolute",left:0,top:0},ICON:{margin:0,"vertical-align":"top"},ITEMS:{display:"block","padding-bottom":"1px","font-size":0,"line-height":0},HANDLER:{height:"22px",width:"7px",background:linb.UI.$bg("handler.gif"," left top",true),cursor:"move","vertical-align":"middle"},GROUP:{"font-size":0,"line-height":0,position:"relative",padding:"2px 4px 0px 2px","vertical-align":"middle"},ITEM:{"vertical-align":"middle",padding:"1px"},"BTNC a":{padding:0},SPLIT:{$order:1,width:"6px",height:"19px","vertical-align":"middle",background:linb.UI.$bg("split_vertical.gif","repeat-y left top",true)},BTN:{"padding-right":"3px"},BTNI:{"padding-left":"3px"},DROP:{width:"14px",height:"16px","vertical-align":"top",background:linb.UI.$bg("drop.gif","no-repeat left center","Button")},"BTN-mouseover DROP":{$order:2,"background-position":"-16px center"},"BTN-mousedown DROP, BTN-checked DROP":{$order:2,"background-position":"-32px center"},"LABEL, CAPTION":{height:"16px","vertical-align":"middle","margin-left":"2px","margin-right":"2px",cursor:"default","font-size":"12px"},LABEL:{"padding-top":"3px"}},Behaviors:{HoverEffected:{BTN:["BTN"]},ClickEffected:{BTN:["BTN"]},BTN:{onClick:function(profile,e,src){if(profile.properties.disabled){return }var id2=linb.use(src).parent(3).id(),item2=profile.getItemByDom(id2);if(item2.disabled){return }var item=profile.getItemByDom(src);if(item.disabled){return }linb.use(src).focus();if(item.statusButton){linb.use(src).tagClass("-checked",item.value=!item.value)}profile.boxing().onClick(profile,item,item2,e,src);return false}}},DataModel:{listKey:null,height:{ini:"auto",readonly:true},width:"auto",left:0,top:0,handler:{ini:true,action:function(v){this.getSubNode("HANDLER",true).css("display",v?"":"none")}},position:"absolute",hAlign:{ini:"left",listbox:["left","center","right"],action:function(v){this.getSubNode("ITEMS",true).css("textAlign",v)}},dock:{ini:"top",listbox:["top","bottom"]}},EventHandlers:{onClick:function(profile,item,group,e,src){}},_adjustItems:function(arr){if(!arr){arr=[_()+""]}if(_.isStr(arr)){arr=[arr]}var a=_.copy(arr),m;_.arr.each(a,function(o,i){if(typeof o=="object"){a[i]=_.copy(o);a[i].sub=[];if(o.sub){_.arr.each(o.sub,function(v){a[i].sub.push(_.copy(v))})}}});return a},_prepareData:function(profile){var d=arguments.callee.upper.call(this,profile);var p=profile.properties;d.mode=p.hAlign=="right"?"text-align:right;":"";return d},_prepareItem:function(profile,oitem,sitem,pid,mapCache,serialId){var dn="display:none",fun=function(profile,dataItem,item,pid,mapCache,serialId){var id=dataItem[linb.UI.$tag_subId]=typeof serialId=="string"?serialId:("a_"+profile.pickSubId("aitem")),t;if(typeof item=="string"){item={caption:item}}if(false!==mapCache){profile.ItemIdMapSubSerialId[item.id]=id;profile.SubSerialIdMapItem[id]=item}if(t=item.object){t=dataItem.object=t["linb.absBox"]?t.get(0):t;if(t["linb.UIProfile"]){t.properties.position="relative";if(!t.CS.KEY){t.CS.KEY=""}t.CS.KEY="vertical-align:middle;margin-left:4px;"+t.CS.KEY}item.$linbid=t.$linbid;t.$item=item;t.$holder=profile;if(!profile.$attached){profile.$attached=[]}profile.$attached.push(t)}else{if(item.type=="split"){item.split=true}linb.UI.adjustData(profile,item,dataItem);if(!item.caption){item.caption=""}dataItem.splitDisplay=dataItem.split?"":dn;dataItem.labelDisplay=dataItem.label?"":dn;dataItem.captionDisplay=dataItem.caption?"":dn;dataItem.dropDisplay=item.dropButton?"":dn;dataItem.boxDisplay=(!dataItem.split&&(dataItem.caption||dataItem.image||dataItem.imageClass))?"":dn}dataItem.itemDisplay=item.visible===false?dn:"";item._pid=pid};if(pid){fun(profile,oitem,sitem,pid,mapCache,serialId)}else{var arr=[],dataItem,a=sitem.sub||[];pid=sitem.id;oitem.mode2=profile.properties.handler?"":dn;oitem.grpDisplay=sitem.visible===false?dn:"";oitem.sub=arr;_.arr.each(a,function(item){dataItem={id:item.id};fun(profile,dataItem,item,pid,mapCache,serialId);arr.push(dataItem)})}}}});Class("linb.UI.Range",["linb.UI","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){var p=profile.properties,tpl=p.captionTpl,fun=function(k){return profile.getSubNode(k)},fun1=function(a,i){a.cssPos({left:profile[i],top:box._x2y(profile[i])})},fun2=function(o,v){o.get(0).style.width=v+"px"},title=fun("CAPTION"),a=fun("IND1"),b=fun("IND2"),r1=fun("RULER1"),r3=fun("RULER3"),box=profile.box,arr=box._v2a(value);profile._rate=300/(p.max-p.min);profile._v1=Math.round((arr[0]-p.min)/(p.max-p.min)*300);profile._v2=Math.round((1-(p.max-arr[1])/(p.max-p.min))*300);title.html(box._buildTpl(p.singleValue,tpl,arr,p.unit),false);fun1(a,"_v1");fun1(b,"_v2");fun2(r1,profile._v1+8);fun2(r3,profile._v2+8)})},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }if(!profile.renderId){return }var properties=profile.properties,o=profile.getSubNode("BOX"),flag=properties.value!==properties.$UIvalue,cls=linb.UI.$css_tag_dirty;if(profile.beforeDirtyMark&&false===profile.boxing().beforeDirtyMark(profile,flag)){return }if(flag){o.addClass(cls)}else{o.removeClass(cls)}})}},Static:{Templates:{style:"{_style}",BOX:{tagName:"div",RULER:{tagName:"div",IND1:{tagName:"a",href:linb.$href,tabindex:"{tabIndex}",style:"{_single}"},IND2:{tagName:"a",href:linb.$href,tabindex:"{tabIndex}"},RULER1:{$order:2,style:"{_single}"},RULER3:{}},TAIL:{tagName:"div",CAPTION:{tagName:"div"},MIN:{text:"{min}"},MAX:{text:"{max}"}}}},Appearances:{"KEY, RULER, IND1, IND1":{"font-size":0,"line-height":0,position:"relative"},BOX:{position:"absolute",left:0,top:0,width:"316px"},"CAPTION, IND1, TAIL, MIN":{"font-size":"12px","line-height":"14px"},RULER:{$order:1,position:"relative",height:"30px",overflow:"visible","margin-bottom":"3px",background:linb.UI.$bg("bg.png"),_background:"none",_filter:linb.UI.$ieBg("bg.png")},"RULER1, RULER3":{position:"absolute",left:0,top:0,height:"30px",width:"300px"},RULER1:{background:linb.UI.$bg("bg.png"),_background:"none",_filter:linb.UI.$ieBg("bg.png")},RULER3:{background:linb.UI.$bg("front.png"),_background:"none",_filter:linb.UI.$ieBg("front.png")},"IND1,IND2":{display:linb.$inlineBlock,zoom:linb.browser.ie6?1:null,"z-index":"2",width:"15px",height:"14px",position:"absolute"},IND1:{background:linb.UI.$bg("icons.gif","no-repeat left -225px",true),left:"0px",top:"11px"},IND2:{background:linb.UI.$bg("icons.gif","no-repeat -15px -225px",true),left:"300px",top:"1px"},TAIL:{$order:2,width:"300px",position:"relative"},CAPTION:{position:"relative","text-align":"center"},MIN:{position:"absolute",left:0,top:0},MAX:{position:"absolute",right:0,top:0}},Behaviors:{IND1:{onKeydown:function(profile,e,src){profile.box._keydown.apply(profile.box,[profile,e,src,0])},onMousedown:function(profile,e,src){var p=profile.properties,box=profile.box,arr=box._v2a(p.$UIvalue);linb.use(src).startDrag(e,{widthIncrement:p.steps?p.width/p.steps:null,dragType:"move",targetReposition:true,horizontalOnly:true,maxLeftOffset:Math.floor(profile._v1),maxRightOffset:Math.floor(profile._v2-profile._v1),dragCursor:"default"});linb.use(src).css("zIndex",10).focus();profile.getSubNode("IND2").css("zIndex",5)},onDrag:function(profile,e,src){var d=linb.DragDrop.getProfile();profile.box._ondrag.apply(profile.box,[profile,d.curPos.left,src,0])},onDragstop:function(profile,e,src){var p=profile.properties,box=profile.boxing(),rate=profile._rate,d=linb.DragDrop.getProfile(),f,arr=p.$UIvalue.split(":");profile._v1=d.curPos.left;arr[0]=Math.floor((profile._v1)/rate+p.min);box.setUIValue(arr.join(":"));if(profile._v1==profile._v2){linb.use(src).css("zIndex",10);profile.getSubNode("IND2").css("zIndex",5)}}},IND2:{onKeydown:function(profile,e,src){profile.box._keydown.apply(profile.box,[profile,e,src,1])},onMousedown:function(profile,e,src){var p=profile.properties,box=profile.box,arr=box._v2a(p.$UIvalue);linb.use(src).startDrag(e,{widthIncrement:p.steps?p.width/p.steps:null,dragType:"move",targetReposition:true,horizontalOnly:true,maxLeftOffset:Math.floor(profile._v2-profile._v1),maxRightOffset:Math.floor(300-profile._v2),dragCursor:"default"});linb.use(src).css("zIndex",10).focus();profile.getSubNode("IND1").css("zIndex",5)},onDrag:function(profile,e,src){var d=linb.DragDrop.getProfile();profile.box._ondrag.apply(profile.box,[profile,d.curPos.left,src,1])},onDragstop:function(profile,e,src){var p=profile.properties,box=profile.boxing(),rate=profile._rate,d=linb.DragDrop.getProfile(),f,arr=p.$UIvalue.split(":");profile._v2=d.curPos.left;arr[1]=Math.floor((profile._v2)/rate+p.min);box.setUIValue(arr.join(":"))}}},DataModel:{position:"absolute",width:{ini:300,readonly:true},height:{ini:46,readonly:true},min:{ini:0,action:function(){var self=this,t,pro=self.properties,b=self.boxing();b.refresh();if(pro.$UIvalue!=(t=this.box._ensureValue(self,pro.$UIvalue))){b.setValue(t)}}},max:{ini:100,action:function(){var self=this,t,pro=self.properties,b=self.boxing();b.refresh();if(pro.$UIvalue!=(t=this.box._ensureValue(self,pro.$UIvalue))){b.setValue(t)}}},unit:{ini:"",action:function(){this.boxing()._setCtrlValue(this.properties.$UIvalue)}},steps:0,captionTpl:{ini:"{fromvalue}{unit} - {tovalue}{unit}",action:function(){this.boxing()._setCtrlValue(this.properties.$UIvalue)}},value:"0:100",singleValue:{ini:false,action:function(v){this.boxing().refresh()}}},_prepareData:function(profile){var d=arguments.callee.upper.call(this,profile);var p=profile.properties,arr=profile.box._v2a(p.value);d._single=p.singleValue?"display:none":"";p.min=parseFloat(p.min);p.max=parseFloat(p.max);d.min=d.min+p.unit;d.max=d.max+p.unit;return d},_ensureValue:function(profile,value){if(!value){value=""}var p=profile.properties,a=value.split(":"),min=p.min,max=p.max,b=[],f1=function(a){return parseFloat(a)},f2=function(a){return Math.min(max,Math.max(min,a))};b[0]=f1(a[0]);b[1]=f1(a[1]);b[0]=Math.min(b[0],b[1]);if(!min){min=b[0]}if(!max){max=b[1]}b[0]=f2(b[0]);b[1]=f2(b[1]);return b.join(":")},_v2a:function(value){return typeof value=="string"?value.split(":"):value},_buildTpl:function(single,tpl,arr,unit){return single?arr[1]+unit:tpl.replace(/\{fromvalue\}/g,arr[0]).replace(/\{tovalue\}/g,arr[1]).replace(/\{unit\}/g,unit)},_x2y:function(x){return Math.floor(15+1-(x)*(15/300))},_keydown:function(profile,e,src,type){var key=linb.Event.getKey(e);if(key[0]=="left"||key[0]=="right"){var s=src.style,left=parseInt(s.left),pro=profile.properties,steps=pro.steps,span=300/steps,v,f=function(key){return parseInt(profile.getSubNode(key).get(0).style.left)};left+=key[0]=="left"?-1:1;if(steps){left=left-left%span;if(key[0]=="right"){left+=span}}if(!pro.singleValue){if(type===0){v=f("IND2");if(left>v){left=v}}else{v=f("IND1");if(left<v){left=v}}}if(left<0){left=0}if(left>300){left=300}s.left=left+"px";profile.box._ondrag.apply(profile.box,[profile,left,src,1]);var rate=profile._rate,arr=pro.$UIvalue.split(":");if(type===0){profile._v1=left;arr[0]=Math.floor((profile._v1)/rate+pro.min)}else{profile._v2=left;arr[1]=Math.floor((profile._v2)/rate+pro.min)}profile.boxing().setUIValue(arr.join(":"))}},_ondrag:function(profile,left,src,tag){var p=profile.properties,d=linb.DragDrop.getProfile(),box=profile.box,fun=function(k){return profile.getSubNode(k)},fun2=function(o,v){o.get(0).style.width=v+"px"},cap=fun("CAPTION"),r1=fun("RULER1"),r3=fun("RULER3"),t,f,arr=this._v2a(p.$UIvalue);linb.use(src).get(0).style.top=this._x2y(left)+"px";t=Math.floor((left)/profile._rate+p.min);if(tag){arr[1]=t;fun2(r3,left+8)}else{arr[0]=t;fun2(r1,left+8)}cap.html(box._buildTpl(p.singleValue,p.captionTpl,arr,p.unit),false)},_onresize:function(){}}});Class("linb.UI.Layout",["linb.UI","linb.absList"],{Instance:{getPanel:function(subId){return this.get(0).getSubNodeByItemId("PANEL",subId)},append:function(target,subId){var pro=this.get(0);return arguments.callee.upper.call(this,target,subId||"main")},fireCmdClickEvent:function(subId){this.getSubNodeByItemId("CMD",subId).onMousedown();return this}},Static:{Templates:{tagName:"div",style:"{_style}",text:"{items}",$submap:{items:{ITEM:{tagName:"div",className:"{cls1} {itemClass}",style:"{size};{itemStyle}",MOVE:{$order:0,tagName:"div",className:"uibg-bar {cls2} ",style:"{display}"},CMD:{$order:1,tagName:"div",style:"{cmdDisplay}",className:"{cls3} "},PANEL:{tagName:"div",className:"uibg-base",style:"position:absolute;left:0;top:0;",text:linb.UI.$childTag}}}}},Appearances:{".setting-linb-layout":{width:"9px"},KEY:{position:"absolute",overflow:"hidden",left:0,top:0,"font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null},MOVE:{$order:0,position:"absolute","z-index":"10","font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null},"MOVE-mouseover":{$order:1,"background-color":"#C8E1FA"},CMD:{position:"absolute",cursor:"pointer","z-index":"20","font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null},ITEM:{position:"absolute","z-index":1,overflow:"hidden","border-width":linb.browser.opr?"0px":null,"font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null},PANEL:{position:"absolute",overflow:"hidden","border-width":linb.browser.opr?"0px":null,"font-size":linb.browser.ie?0:null,"line-height":linb.browser.ie?0:null},"ITEM-MAIN":{left:0,right:0,top:0,bottom:0},"ITEM-TOP, ITEM-BOTTOM":{left:0,right:0},"ITEM-LEFT, ITEM-RIGHT":{top:0,bottom:0},"MOVE-TOP, MOVE-BOTTOM":{width:"100%",height:"7px",cursor:"n-resize","border-top":"solid 1px #c8e1fa","border-bottom":"solid 1px #648cb4"},"MOVE-LEFT, MOVE-RIGHT":{height:"100%",width:"7px",cursor:"w-resize","border-left":"solid 1px #c8e1fa","border-right":"solid 1px #648cb4"},"MOVE-TOP":{bottom:0},"MOVE-BOTTOM":{top:0},"MOVE-LEFT":{right:0},"MOVE-RIGHT":{left:0},"CMD-TOP, CMD-BOTTOM, CMD-LEFT, CMD-RIGHT":{background:linb.UI.$bg("icons.gif","no-repeat",true)},"CMD-TOP":{$order:1,left:"50%","margin-left":"-20px",bottom:0,width:"40px",height:"9px","background-position":"-360px -232px"},"CMD-BOTTOM":{$order:1,left:"50%","margin-left":"-20px",top:0,width:"40px",height:"9px","background-position":"-360px -258px"},"CMD-LEFT":{$order:1,top:"50%","margin-top":"-20px",right:0,height:"40px",width:"9px","background-position":"-310px -240px"},"CMD-RIGHT":{$order:1,top:"50%","margin-top":"-20px",left:0,height:"40px",width:"9px","background-position":"-336px -240px"},"CMD-TOP-mouseover":{$order:2,"background-position":"-360px -245px"},"CMD-BOTTOM-mouseover":{$order:2,"background-position":"-360px -271px"},"CMD-LEFT-mouseover":{$order:2,"background-position":"-323px -240px"},"CMD-RIGHT-mouseover":{$order:2,"background-position":"-349px -240px"},"MOVE-MAIN":{$order:5,display:"none"},"CMD-MAIN":{$order:5,display:"none"}},Behaviors:{DropableKeys:["PANEL"],HoverEffected:{MOVE:"MOVE",CMD:"CMD"},onSize:linb.UI.$onSize,MOVE:{onMousedown:function(profile,e,src){var itemId=profile.getSubId(src),item=profile.getItemByDom(src);if(item.hide){return }var main=profile.getItemByItemId("main"),o=profile.getSubNode("ITEM",itemId),m=profile.getSubNodeByItemId("ITEM","main"),cursor=linb.use(src).css("cursor"),t=profile.properties,h,w,mh,mw,offset1,offset2;profile.pos=item.pos;if(t.type=="vertical"){h=profile._cur=o.height();mh=m.height();if(item.pos=="before"){offset1=h-item.min;offset2=item.max?Math.min(parseInt(item.max)-h,(mh-main.min)):(mh-main.min)}else{offset1=item.max?Math.min(parseInt(item.max)-h,(mh-main.min)):(mh-main.min);offset2=h-item.min}linb.use(src).startDrag(e,{dragType:"copy",targetReposition:false,verticalOnly:true,maxTopOffset:offset1,maxBottomOffset:offset2,dragCursor:cursor})}else{w=profile._cur=o.width();mw=m.width();if(item.pos=="before"){offset1=w-item.min;offset2=item.max?Math.min(parseInt(item.max)-w,(mw-main.min)):(mw-main.min)}else{offset1=item.max?Math.min(parseInt(item.max)-w,(mw-main.min)):(mw-main.min);offset2=w-item.min}linb.use(src).startDrag(e,{dragType:"copy",targetReposition:false,horizontalOnly:true,maxLeftOffset:offset1,maxRightOffset:offset2,dragCursor:cursor})}profile._limited=0},onDrag:function(profile,e,src){var t=profile.properties,d=linb.DragDrop,p=linb.DragDrop._profile,b=0;if(t.type=="vertical"){if((p.y<=p.restrictedTop)||(p.y>=p.restrictedBottom)){b=true}}else{if(p.x<=p.restrictedLeft||p.x>=p.restrictedRight){b=true}}if(b){if(!profile._limited){profile._bg=p.proxyNode.css("backgroundColor");p.proxyNode.css("backgroundColor","#ff6600");profile._limited=true}}else{if(profile._limited){p.proxyNode.css("backgroundColor",profile._bg);profile._limited=0}}},onDragstop:function(profile,e,src){var t=profile.properties,o=linb.use(src).parent(),r=profile.getRoot(),item=profile.getItemByDom(src);if(t.type=="vertical"){o.height(item.size=profile._cur+(profile.pos=="before"?1:-1)*linb.DragDrop.getProfile().offset.y);linb.UI.$tryResize(profile,null,r.height(),true)}else{o.width(item.size=profile._cur+(profile.pos=="before"?1:-1)*linb.DragDrop.getProfile().offset.x);linb.UI.$tryResize(profile,r.width(),null,true)}profile._limited=0}},CMD:{onMousedown:function(profile,e,src){var t=profile.properties,itemId=profile.getSubId(src),item=profile.getItemByDom(src),r=profile.getRoot(),main=profile.getItemByItemId("main"),m=profile.getSubNodeByItemId("ITEM","main"),o=profile.getSubNode("ITEM",itemId),panel=profile.getSubNode("PANEL",itemId),move=profile.getSubNode("MOVE",itemId),_handlerSize=linb.UI.$getCSSValue("setting-linb-layout","width");if(t.type=="vertical"){if(item.hide){if(item.size<=m.height()-main.min+_handlerSize){o.height(item.size);panel.show();item.hide=false;if(item.pos=="before"){linb.use(src).replaceClass(/bottom/g,"top")}else{linb.use(src).replaceClass(/top/g,"bottom")}if(!item.locked){move.css("cursor","n-resize")}profile.getSubNode("MOVE").tagClass("-checked",false)}else{linb.message("no enough space!")}}else{o.height(_handlerSize);panel.hide();item.hide=true;if(item.pos=="before"){linb.use(src).replaceClass(/top/g,"bottom")}else{linb.use(src).replaceClass(/bottom/g,"top")}if(!item.locked){move.css("cursor","default")}profile.getSubNode("MOVE").tagClass("-checked")}linb.UI.$tryResize(profile,null,r.height(),true)}else{if(item.hide){if(item.size<=m.width()-main.min+_handlerSize){o.width(item.size);panel.show();item.hide=false;if(item.pos=="before"){linb.use(src).replaceClass(/right/g,"left")}else{linb.use(src).replaceClass(/left/g,"right")}if(!item.locked){move.css("cursor","w-resize")}profile.getSubNode("MOVE").tagClass("-checked",false)}else{linb.message("no enough space!")}}else{o.width(_handlerSize);panel.hide();item.hide=true;if(item.pos=="before"){linb.use(src).replaceClass(/left/g,"right")}else{linb.use(src).replaceClass(/right/g,"left")}if(!item.locked){move.css("cursor","default")}profile.getSubNode("MOVE").tagClass("-checked")}linb.UI.$tryResize(profile,r.width(),null,true)}return false}}},DataModel:{disabled:null,position:"absolute",type:{listbox:["vertical","horizontal"],ini:"vertical",action:function(value,ovalue){if(value!=ovalue){var self=this,auto="auto",nodes2=self.getSubNode("ITEM",true),nodes1=self.getSubNode("MOVE",true),nodes3=self.getSubNode("CMD",true);nodes1.merge(nodes2).merge(nodes3);if(value=="vertical"){nodes1.replaceClass(/(-left)(\b)/ig,"-top$2");nodes1.replaceClass(/(-right)(\b)/ig,"-bottom$2");nodes2.each(function(o){linb(o).height(linb(o).width())}).cssRegion({left:0,top:auto,right:auto,bottom:auto})}else{nodes1.replaceClass(/(-top)(\b)/ig,"-left$2");nodes1.replaceClass(/(-bottom)(\b)/ig,"-right$2");nodes2.each(function(o){linb(o).width(linb(o).height())}).cssRegion({left:auto,top:0,right:auto,bottom:auto})}var size=self.getRoot().cssSize();linb.UI.$tryResize(self,size.width,size.height,true)}}},dock:"fill",listKey:null,width:200,height:200,items:{ini:[],set:function(value){var o=this;if(o.renderId){var box=o.boxing(),temp=linb.$getGhostDiv(),children=_.copy(o.children),p,vv;o.children.length=0;_.arr.each(children,function(o){delete o[0].$dockParent;temp.appendChild(o[0].getRootNode())});box.clearItems();vv=o.box._prepareV(o,value);box.insertItems(vv);_.arr.each(children,function(v){box.append.apply(box,v)});temp.innerHTML="";var size=o.getRoot().cssSize();linb.UI.$tryResize(o,size.width,size.height,true)}else{o.properties.items=_.copy(value)}}}},_prepareV:function(profile,items){var main,before=[],after=[];_.arr.each(items,function(o){if(o.id=="main"){main=o}else{if(o.pos=="before"){before.push(o)}else{o.pos="after";after.push(o)}}});main=main||{};main.id="main";main.min=main.min||10;items.length=0;_.arr.insertAny(items,before,0);_.arr.insertAny(items,main);_.arr.insertAny(items,after);_.arr.each(items,function(o){o.id=_.isStr(o.id)?o.id:profile.$linbid+":"+_.id();o.min=o.min||10;if(o.id!="main"){o.size=parseInt(o.size)||20;o.locked=typeof o.locked=="boolean"?o.locked:false;o.hide=typeof o.hide=="boolean"?o.hide:false;o.cmd=typeof o.cmd=="boolean"?o.cmd:false}});return items},_prepareData:function(profile){var prop=profile.properties;if(!prop.items||prop.items.constructor!=Array){prop.items=_.clone([{id:"before",pos:"before",locked:false,size:60,min:50,max:200},{id:"after",pos:"after",locked:false,size:60,min:50,max:200}])}prop.items=this._prepareV(profile,prop.items);return arguments.callee.upper.call(this,profile)},_prepareItem:function(profile,item){var pp=profile.properties;if(item.id=="main"){item.cls1=profile.getClass("ITEM","-main");item.cls2=profile.getClass("MOVE","-main");item.cls3=profile.getClass("CMD","-main");return }if(pp.type=="vertical"){item.size="height:"+item.size+"px"}else{item.size="width:"+item.size+"px"}var pos;if(pp.type=="vertical"){if(item.pos=="before"){pos="top"}else{pos="bottom"}}else{if(item.pos=="before"){pos="left"}else{pos="right"}}item.cls1=profile.getClass("ITEM","-"+pos);item.cls2=profile.getClass("MOVE","-"+pos);item.cls3=profile.getClass("CMD","-"+pos);item.display=item.locked?"display:none":"";item.cmdDisplay=item.cmd?"":"display:none"},RenderTrigger:function(){var t,profile=this;_.arr.each(profile.properties.items,function(item){if(item.id!="main"){if(item.hide&&(t=profile.getSubIdByItemId(item.id))){item.hide=false;profile.getSubNode("CMD",t).onMousedown()}}})},_onresize:function(profile,width,height){var _t,t=profile.properties,m,n,itemId,temp1,temp2,temp,key=profile.keys.ITEM,panel=profile.keys.PANEL,move=profile.getSubNode("MOVE",true),_handlerSize=linb.UI.$getCSSValue("setting-linb-layout","width");var obj={},obj2={};_.arr.each(t.items,function(o){itemId=profile.getSubIdByItemId(o.id);obj[itemId]={};obj2[itemId]={}});if(t.type!="vertical"){if(!_.isNull(width)){temp=temp1=temp2=0;_.arr.each(t.items,function(o){if(o.id=="main"){return }itemId=profile.getSubIdByItemId(o.id);if(o.pos=="before"){n=profile.getSubNode("ITEM",itemId);if(o.hide){m=obj2[itemId].width=_handlerSize}else{m=n.width()}obj2[itemId].left=temp1;temp1+=m;obj2[itemId].right="auto";obj[itemId].right="auto";obj[itemId].left=0;obj[itemId].width=m-(o.locked?0:_handlerSize)}});_.arr.each(t.items,function(o){if(o.id=="main"){return }itemId=profile.getSubIdByItemId(o.id);if(o.pos=="after"){n=profile.getSubNode("ITEM",itemId);if(o.hide){m=obj2[itemId].width=_handlerSize}else{m=n.width()}obj2[itemId].right=temp2;temp2+=m;obj2[itemId].left="auto";obj[itemId].right=0;obj[itemId].left="auto";obj[itemId].width=m-(o.locked?0:_handlerSize)}},null,true);temp=temp1+temp2;if(width-temp>=0){_t=profile.getSubIdByItemId("main");obj[_t].width=width-temp;obj2[_t].width=width-temp;obj2[_t].left=temp1}}if(!_.isNull(height)){_.each(obj,function(o,id){o.height=height;obj2[id].height=height})}}else{if(!_.isNull(height)){temp=temp1=temp2=0;_.arr.each(t.items,function(o){if(o.id=="main"){return }itemId=profile.getSubIdByItemId(o.id);if(o.pos=="before"){n=profile.getSubNode("ITEM",itemId);if(o.hide){m=obj2[itemId].height=_handlerSize}else{m=n.height()}obj2[itemId].top=temp1;temp1+=m;obj2[itemId].bottom="auto";obj[itemId].top=0;obj[itemId].bottom="auto";obj[itemId].height=m-(o.locked?0:_handlerSize)}});_.arr.each(t.items,function(o){if(o.id=="main"){return }itemId=profile.getSubIdByItemId(o.id);if(o.pos=="after"){n=profile.getSubNode("ITEM",itemId);m=n.height();if(o.hide){m=obj2[itemId].height=_handlerSize}else{m=n.height()}obj2[itemId].bottom=temp2;temp2+=m;obj2[itemId].top="auto";obj[itemId].bottom=0;obj[itemId].top="auto";obj[itemId].height=m-(o.locked?0:_handlerSize)}},null,true);temp=temp1+temp2;if(height-temp>=0){_t=profile.getSubIdByItemId("main");obj[_t].height=height-temp;obj2[_t].height=height-temp;obj2[_t].top=temp1}}if(!_.isNull(width)){_.each(obj,function(o,id){o.width=width;obj2[id].width=width})}}_.each(obj2,function(o,id){profile.getSubNode("PANEL",id).cssRegion(obj[id],true);profile.getSubNode("ITEM",id).cssRegion(obj2[id])})}}});Class("linb.UI.TreeGrid",["linb.UI","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){if(!profile.renderId){return }if(profile.properties.activeMode=="none"){return }var box=profile.boxing(),uiv=box.getUIValue(),p=profile.properties,k=p.activeMode=="row"?"CELLS":"CELL",getN=function(k,i){return profile.getSubNode(k,i)},getI=function(i){var map1=profile.rowMap2;if(p.activeMode=="row"){return map1[i]}else{if(!i){return }var r=i.split("|");return _.get(profile.rowMap,[map1[r[0]],"_cells",r[1]])}};if(p.selMode=="single"){var itemId=getI(uiv);if(uiv&&itemId){getN(k,itemId).tagClass("-checked",false)}itemId=getI(value);if(itemId){getN(k,itemId).tagClass("-checked")}if(itemId){var o=getN(k,itemId);if(o){var top=o.offsetTop(),items=getN("SCROLL"),sh=items.scrollHeight(),st=items.scrollTop(),hh=items.height();if(sh>hh){if(top<st||top>st+hh){items.scrollTop(top)}}}}}else{if(p.selMode=="multi"){uiv=uiv?uiv.split(";"):[];value=value?value.split(";"):[];_.arr.each(uiv,function(o){if(_.arr.indexOf(value,o)==-1){getN(k,getI(o)).tagClass("-checked",false)}});_.arr.each(value,function(o){if(_.arr.indexOf(uiv,o)==-1){getN(k,getI(o)).tagClass("-checked")}})}}})},_insertRowsToDom:function(profile,arr,pid,base,before){if(pid){var parent=profile.rowMap[pid];if(parent&&!parent._created){return }}var obj,hw,hw=profile.getSubNode("HFCELL").width();_.arr.each(arr,function(o){o._row0DfW=hw?("width:"+hw+"px"):"";_.arr.each(o.cells,function(v,i){v.width=v._col.width})});var nodes=profile._buildItems("rows",arr);if(!base){if(pid){obj=profile.getSubNode("SUB",pid)}else{obj=profile.getSubNode("BODY")}if(before){obj.prepend(nodes)}else{obj.append(nodes)}}else{obj=profile.getSubNode("ROW",base);if(before){obj.addPrev(nodes)}else{obj.addNext(nodes)}}_.arr.each(arr,function(o){o.open=false});delete profile.$allrowscache},_refreshHeader:function(header){var profile=this.get(0),pro=profile.properties,rows=this.getRows("data");_.breakO(profile.colMap,2);header=profile.box._adjustHeader(header);var arr=profile.box._prepareHeader(profile,header);var ol=pro.header.length;pro.header=header;this.removeAllRows();profile.getSubNode("HCELL",true).remove();if(arr.length){profile.getSubNode("HCELLS").append(profile._buildItems("header",arr))}if(ol==arr.length&&rows.length){this.insertRows(rows)}profile.box._ajdustBody(profile)},_expendRows:function(rows){var self=this;if(rows&&rows.length){_.arr.each(rows,function(o){if(o.sub&&o.sub.length&&!o.iniFold&&!o._checked){self.toggleRow(o.id,true)}})}},getRows:function(type){var v=this.get(0).properties.rows;if(type=="data"){return _.clone(v,true)}else{if(type=="min"){var a=_.clone(v,true),b;_.arr.each(a,function(o,i){_.each(b=a[i]=a[i].cells,function(v,j){b[j]=v.value})});return a}else{return v}}},toggleRow:function(id,expend){var profile=this.get(0),row=profile.rowMap[profile.rowMap2[id]];if(row&&row.sub){profile.box._setSub(profile,row,typeof expend=="boolean"?expend:!row._checked)}},getRowbyRowId:function(rowId){var profile=this.get(0),v=profile.rowMap2[rowId];return v?profile.rowMap[v]:null},getRowbyCell:function(cell){return cell._row},updateRow:function(rowId,options){var ns=this,orow=ns.getRowbyRowId(rowId);if(orow){var rid=orow._serialId,t,tt;if(!orow){return ns}if(typeof options!="object"){options={caption:options}}else{_.filter(options,true)}options.id=rowId;if(("group" in options&&options.group!=orow.group)||"cells" in options||("sub" in options&&!((!options.sub&&orow.sub&&orow.sub.length==0)||(options.sub&&options.sub.length==0&&!orow.sub)))){var id="__special",pid=orow._pid,profile=ns.get(0);orow.id=id;profile.rowMap2[id]=profile.rowMap2[rowId];delete profile.rowMap2[rowId];_.each(profile.colMap,function(o){if(o._cells){delete o._cells[rowId]}});orow=_.clone(orow,true);_.merge(orow,options,"all");if("sub" in options&&!options.sub){delete orow.sub}ns.insertRows([orow],pid,id,true);ns.removeRows([id])}else{if("sub" in options){t=ns.getSubNode("FCELLCMD",rid);if(options.sub){t.removeClass("uicmd-empty").addClass("uicmd-toggle2")}else{t.removeClass("uicmd-toggle2").addClass("uicmd-empty")}}if(t=options.height){ns.getSubNode("CELLS",rid).height(t)}if(t=options.rowStyle){(tt=ns.getSubNode("CELLS",rid)).attr("style",tt.attr("style")+";"+t)}if(t=options.rowClass){ns.getSubNode("CELLS",rid).addClass(t)}if(t=options.firstCellStyle){(tt=ns.getSubNode("FCELL",rid)).attr("style",tt.attr("style")+";"+t)}if(t=options.firstCellClass){ns.getSubNode("FCELL",rid).addClass(t)}if(options.hasOwnProperty("caption")){ns.getSubNode("FCELLCAPTION",rid).get(0).innerHTML=options.caption}if(options.hasOwnProperty("preview")){if(options.preview){ns.getSubNode("PREVIEW",rid).css("display","block").html(options.preview)}else{ns.getSubNode("PREVIEW",rid).css("display","none")}}if(options.hasOwnProperty("summary")){if(options.summary){ns.getSubNode("SUMMARY",rid).css("display","block").html(options.summary)}else{ns.getSubNode("SUMMARY",rid).css("display","none")}}if(options.hasOwnProperty("rowResizer")){t=!!options.rowResizer;ns.getSubNode("FHANDLER",rid).css("display",(options.rowResizer=t)?"block":"none")}_.merge(orow,options,"all")}}return ns},insertRows:function(arr,pid,base,before){var c=this.constructor,profile=this.get(0),pro=profile.properties,row_m=profile.rowMap2,t;base=row_m[base];if(base){t=profile.rowMap[base];if(t){pid=t._pid}}arr=c._adjustRows(arr);var rows=c._prepareItems(profile,arr,pid),tar,b=profile.rowMap;pid=row_m[pid];if(!pid){tar=(pro.rows||(pro.rows=[]))}else{tar=(b[pid].sub||(b[pid].sub=[]))}if(!base){_.arr.insertAny(tar,arr,before?0:-1)}else{var index=_.arr.subIndexOf(tar,"_serialId",base);_.arr.insertAny(tar,arr,before?index:(index+1))}if(rows.length){this._insertRowsToDom(profile,rows,pid,base,before)}if(!pro.iniFold){profile.boxing()._expendRows(rows)}profile.box._asy(profile);return this},removeRows:function(ids){var self=this,profile=self.get(0),p=profile.properties,cell=profile.cellMap,nodes=[],v;ids=_.isArr(ids)?ids:[ids];_.arr.each(ids,function(id){if(!(id=profile.rowMap2[id])){return }var row;if(row=profile.rowMap[id]){var tdids=row._cells,rowid=row.id,temp;if(row.sub&&_.isArr(row.sub)){var arr=[];_.arr.each(row.sub,function(o){arr.push(o.id)});self.removeRows(arr)}_.each(tdids,function(o,i){delete cell[o]._col._cells[rowid];_.breakO(cell[o]);delete cell[o];profile.reclaimSubId(o.slice(2),"cell")});if(temp=row._pid?(temp=profile.rowMap[profile.rowMap2[row._pid]])?temp.sub:null:profile.properties.rows){if(_.isArr(temp)){_.filter(temp,function(o){return o._serialId!=id})}}delete profile.rowMap2[rowid];_.breakO(profile.rowMap[id]);delete profile.rowMap[id];nodes.push(profile.getSubNode("ROW",id).get(0))}profile.reclaimSubId(id.slice(2),"row")});if(v=p.value){if((v=v.split(";")).length>1){_.filter(v,function(o){return _.arr.indexOf(arr,o)==-1});p.value=v.join(";")}else{if(_.arr.indexOf(arr,p.value)!=-1){p.value=null}}}linb(nodes).remove();profile.box._asy(profile);return self},removeAllRows:function(){var profile=this.get(0);for(var i in profile.cellMap){profile.reclaimSubId(i.slice(2),"cell")}for(var i in profile.rowMap){profile.reclaimSubId(i.slice(2),"row")}_.each(profile.colMap,function(o){o._cells={}});_.breakO([profile.rowMap,profile.cellMap],3);profile.rowMap={};profile.cellMap={};profile.rowMap2={};profile.properties.rows.length=0;if(profile.renderId){profile.getSubNode("BODY").empty();profile.getSubNode("SCROLL").scrollTop(0).scrollLeft(0)}return this},resetRowValue:function(rowId){var profile=this.get(0),row=this.getRowbyRowId(rowId),arr=[];_.each(row.cells,function(o){if(o._$value!==o.value){o._$value=o.value;arr.push(profile.getSubNode("CELLA",o._serialId).get(0))}});linb(arr).removeClass("ui-dirty")},getActiveRow:function(){var ar,profile=this.get(0);if(profile.properties.activeMode!="row"){return }if(!(ar=profile.$activeRow)){return }return profile.rowMap[profile.getSubId(ar)]},setActiveRow:function(rowId){var dr,row,profile=this.get(0);if(profile.properties.activeMode!="row"){return }if(!(row=this.getRowbyRowId(rowId))){return }if(!(dr=profile.getSubNode("CELLS",row._serialId)).isEmpty()){profile.box._activeRow(profile,dr.get(0).id)}return this},getHeader:function(type){var v=this.get(0).properties.header;if(type=="data"){return _.clone(v,true)}else{if(type=="min"){var a=_.clone(v,true),b;_.arr.each(a,function(o,i){a[i]=o.id});return a}else{return v}}},updateHeader:function(colId,options){var ns=this,colh=ns.getHeaderByColId(colId);if(colh){var hid=colh._serialId,t;if(typeof options!="object"){options={caption:options+""}}else{_.filter(options,true)}delete options.id;if(t=options.width){var n=[];n.push(ns.getSubNode("HCELL",hid).get(0));_.each(colh._cells,function(o){n.push(ns.getSubNode("CELL",o).get(0))});linb(n).width(t);ns.constructor._ajdustBody(ns.get(0))}if(t=options.headerStyle){(tt=ns.getSubNode("HCELL",hid)).attr("style",tt.attr("style")+";"+t)}if(t=options.headerClass){ns.getSubNode("HCELL",hid).addClass(t)}if(options.hasOwnProperty("caption")){ns.getSubNode("HCELLCAPTION",hid).get(0).innerHTML=options.caption}if("colResizer" in options){t=!!options.colResizer;ns.getSubNode("HHANDLER",hid).css("display",(options.colResizer=t)?"block":"none")}_.merge(colh,options,"all")}return ns},getHeaderByColId:function(colId){var v=this.get(0).properties.header,i=_.arr.subIndexOf(v,"id",colId);return v[i]},getHeaderByCell:function(cell){return cell._col},showColumn:function(colId,flag){return this.each(function(profile){var map=profile.colMap2,cols=profile.colMap,col,sid,cells,n=[];if(col=cols[sid=map[colId]]){n.push(profile.getSubNode("HCELL",sid).get(0));_.each(col._cells,function(id){n.push(profile.getSubNode("CELL",id).get(0))});linb(n).css("display",(col.visibility=(flag===false?false:true))?"":"none")}profile.box._ajdustBody(profile)})},getCellbyRowCol:function(rowId,colId){var profile=this.get(0),v;v=_.get(profile.rowMap,[profile.rowMap2[rowId],"_cells",colId]);return v?profile.cellMap[v]:null},updateCellByRowCol:function(rowId,colId,options,dirtyMark){var t,self=this,con=self.constructor;if(t=con._getCellId(self.get(0),rowId,colId)){con._updCell(self.get(0),t,options,dirtyMark)}return self},updateCell:function(cellId,options,dirtyMark){var self=this;self.constructor._updCell(self.get(0),cellId,options,dirtyMark);return self},editCellbyRowCol:function(rowId,colId){var profile=this.get(0),con=profile.box;return con._editCell(profile,con._getCellId(profile,rowId,colId))},getActiveCell:function(){var ar,profile=this.get(0);if(profile.properties.activeMode!="cell"){return }if(!(ar=profile.$activeCell)){return }return profile.cellMap[profile.getSubId(ar)]},setActiveCell:function(rowId,colId){var dr,cell,profile=this.get(0);if(profile.properties.activeMode!="cell"){return }if(!(cell=this.getCellbyRowCol(rowId,colId))){return }if(!(dr=profile.getSubNode("CELL",cell._serialId)).isEmpty()){profile.box._activeCell(profile,dr.get(0).id)}return this},resetGridValue:function(){return this.each(function(profile){_.each(profile.cellMap,function(v){v._$value=v.value});profile.getSubNode("CELLA",true).removeClass("ui-dirty")})},getSubNodeInGrid:function(key,rowId,colId){var ns=this,t=(rowId&&colId)?ns.getCellbyRowCol(rowId,colId):colId?ns.getHeaderByColId(colId):rowId?ns.getRowbyRowId(rowId):null;return ns.getSubNode(key,(t&&t._serialId)||true)}},Initialize:function(){this.addTemplateKeys(["ALT","PROGRESS"])},Static:{Templates:{tagName:"div",style:"{_style}",BORDER:{tagName:"div",BOX:{tagName:"div",HEADER:{$order:0,tagName:"div",style:"{showHeader}",HI:{tagName:"div",HCELLS:{tagName:"div",style:"{headerHeight};",HFCELL:{$order:0,style:"{rowHandlerDisplay};{_row0DfW};",HFCELLA:{HHANDLER:{tagName:"div",style:"{colDDDisplay}"},FHANDLER:{tagName:"div",style:"{rowDDDisplay}"},HFMARK:{className:"uicmd-check",style:"{_rowMarkDisplay}"},GRIDCAPTION:{$order:2,text:"{gridHandlerCaption}"}}},OTHERHCELLS:{$order:1,tagName:"text",text:"{header}"}}}},SCROLL:{$order:1,tagName:"div",className:"uibg-base ",BODY:{tagName:"div",text:"{rows}"}},FOOTER:{$order:2},COLLIST:{tagName:"div"}}},$submap:{header:{HCELL:{style:"width:{width}px;",HCELLA:{className:"{headerClass}",style:"{headerStyle}",HCELLCAPTION:{text:"{caption}"},SORT:{style:"{sortDisplay}"},HHANDLER:{$order:2,tagName:"div",style:"{colDDDisplay}"}}}},rows:{ROW:{tagName:"div",PREVIEW:{$order:1,tagName:"div",style:"{previewDisplay}",text:"{preview}"},CELLS:{$order:2,tagName:"div",className:"{rowCls} {rowClass}",style:"height:{rowHeight}px;{rowStyle}",FCELL:{$order:0,style:"{rowHandlerDisplay};{_row0DfW};{cellStyle}{firstCellStyle}",className:"{cellClass}{firstCellClass}",FCELLA:{FCELLRULER:{style:"width:{_rulerW}px"},FCELLCMD:{$order:2,className:"{subClass}"},FHANDLER:{tagName:"div",style:"{rowDDDisplay}"},FCELLINN:{$order:3,ROWNUM:{},FCELLCAPTION:{$order:1,text:"{caption}"}},MARK:{$order:1,style:"{_rowMarkDisplay}"}}},OTHERCELLS:{tagName:"text",$order:1,text:"{cells}"}},SUB:{$order:3,tagName:"div"},SUMMARY:{$order:4,tagName:"div",style:"{summaryDisplay}",text:"{summary}"}}},"rows.cells":function(profile,template,v,tag,result){var me=arguments.callee,map=me._m||(me._m={checkbox:".checkbox",button:".button",progress:".progress"});linb.UI.$doTemplate(profile,template,v,tag+(map[v.type]||".input"),result)},"rows.cells.input":{CELL:{style:"width:{width}px;{cellDisplay};",className:"{cellCls}",CELLA:{tagName:"a",className:"{cellClass}",style:"{bgcolor};{color};{cellStyle}",href:linb.$href,tabindex:"{_tabindex}",text:"{caption}"}}},"rows.cells.button":{CELL:{style:"width:{width}px;{cellDisplay};",className:"{cellCls}",CELLA:{tagName:"button",className:"{cellClass}",style:"{cellStyle}",tabindex:"{_tabindex}",text:"{caption}"}}},"rows.cells.checkbox":{CELL:{style:"width:{width}px;{cellDisplay}",className:"{cellCls}",CELLA:{tagName:"a",className:"{cellClass}",style:"{cellStyle}",href:linb.$href,tabindex:"{_tabindex}",CHECKBOX:{className:"{checkboxCls}"}}}},"rows.cells.progress":{CELL:{style:"width:{width}px;{cellDisplay}",className:"{cellCls}",CELLA:{tagName:"a",className:"{cellClass}",style:"{cellStyle}",href:linb.$href,tabindex:"{_tabindex}",PROGRESS:{tagName:"div",style:"width:{progress};",text:"{caption}"}}}}}},Appearances:{KEY:{display:"block",position:"absolute",overflow:"hidden"},BOX:{display:"block",position:"relative",overflow:"hidden"},HEADER:{background:linb.UI.$bg("head.gif","#CAE3FF repeat-x left top"),position:"relative",overflow:"hidden"},HI:{position:"relative"},SCROLL:{overflow:"auto",position:"relative"},COLLIST:{position:"absolute","z-index":"10",left:0,top:0,cursor:"pointer",visibility:"hidden",background:linb.UI.$bg("collist.gif","#FFF1A0 no-repeat center bottom"),border:"1px solid","border-color":"#fff #ACA899 #ACA899 #fff"},BODY:{overflow:"visible",position:"absolute","background-color":"#fff",left:0,top:"0","font-size":0,"line-height":0,"border-bottom":"1px solid #ACA899"},"SORT, SORT-checked":{width:"16px",height:"16px"},SORT:{background:linb.UI.$bg("icons.gif","no-repeat -110px -220px",true),position:"absolute",right:"2px",bottom:"2px"},"HCELL-mouseover SORT":{$order:1,"background-position":"-110px -240px"},"HCELL-mousedown SORT":{$order:2,"background-position":"-110px -260px"},"SORT-checked":{$order:3,"background-position":"-130px -220px"},"HCELL-mouseover SORT-checked":{$order:4,"background-position":"-130px -240px"},"HCELL-mousedown SORT-checked":{$order:5,"background-position":"-130px -260px"},HHANDLER:{position:"absolute",background:linb.browser.ie?"url("+linb.ini.file_bg+")":null,width:"4px",top:"0",right:"0",height:"100%",cursor:"e-resize","font-size":0,"line-height":0},"HCELLS, CELLS":{"overflow-y":linb.browser.ie?"hidden":"",position:"relative","white-space":"nowrap","font-size":"12px","line-height":"18px"},HCELLS:{"padding-bottom":"2px"},"CELLS-group":{$order:1,"border-right":"1px solid #ACA899"},"CELLS-group FCELL":{"border-right":0,"padding-right":"1px"},"CELLS-group FCELLCAPTION, CELLS-group FCELLA":{"font-weight":"bold",color:"#3764A0",overflow:"visible"},"PREVIEW,SUMMARY":{position:"relative",display:"none","padding-left":"16px","border-right":"1px solid #ACA899"},PREVIEW:{"border-bottom":"1px dashed #ACA899"},SUMMARY:{"border-top":"1px dashed #ACA899"},"CELLS-mouseover":{$order:4,"background-color":"#DFE8F6"},"CELL-disabled":{$order:8,"background-color":"#EBEADB"},"CELL-disabled CELLA":{$order:8,color:"#999"},"CELLS-active, CELL-active":{$order:5,"background-color":"#A3BAE9"},"CELLS-checked, CELL-checked, CELLS-checked CELLA, CELL-checked CELLA":{$order:6,"background-color":"#7199E8",color:"#fff"},"HFCELLA, FCELLA":{"-moz-box-flex":"1","-moz-user-select":"none",display:"block",position:"relative",overflow:"hidden",height:"100%"},FCELLA:{"text-align":"left","padding-left":"4px"},HFCELLA:{"text-align":"center","padding-left":"2px"},FHANDLER:{position:"absolute",height:"4px",left:"0px",width:"100%",bottom:"0px",cursor:"n-resize","z-index":10,"font-size":0,"line-height":0},FCELLINN:{"vertical-align":"middle"},"HFCELL, HCELL":{height:"100%","border-left":"1px solid #fff","border-top":"1px solid #fff","border-right":"1px solid #A2BBD9",padding:0,"vertical-align":"top","font-size":"12px","line-height":"14px"},"HCELL-mouseover":{background:linb.UI.$bg("head-mouseover.gif","#FFF1A0 repeat-x left top")},ROW:{position:"relative",zoom:linb.browser.ie?1:null,width:linb.browser.ie?"100%":null,"border-top":"1px solid #A2BBD9","font-size":0,"line-height":0},ROWNUM:{"padding-right":"6px",color:"#808080"},"FCELL, CELL":{"padding-left":"1px","border-right":"1px solid #A2BBD9",height:"100%",position:"relative",overflow:linb.browser.ie6?"hidden":"","font-size":"12px","line-height":"20px","vertical-align":"top"},ALT:{"background-color":"#EFF8FF"},"CELL-label a":{color:"#000"},"CELL-input":{},"CELL-number":{"text-align":"right"},"CELL-checkbox":{"text-align":"center"},"CELL-button CELLA":{width:"100%"},"CELL-mouseover":{$order:5,"background-color":"#DFE8F6"},HCELLA:{position:"relative","text-align":"center"},"HCELLA, CELLA":{display:"block",overflow:"hidden","-moz-box-flex":"1","-moz-user-select":"none",height:"100%",color:"#000",width:linb.browser.ie?"100%":""},"CELLA-inline":{$order:5,display:"inline","-moz-box-flex":0},PROGRESS:{height:"100%","background-color":"#00ffff","text-align":"center",overflow:"visible",opacity:0.7,"*filter":"alpha(opacity=70)"},"CHECKBOX, MARK":{cursor:"pointer",width:"16px",height:"16px","vertical-align":"middle",background:linb.UI.$bg("icons.gif","no-repeat -20px -70px",true)},"CELL-mouseover CHECKBOX":{$order:1,"background-position":"-20px -90px"},"CELL-mousedown CHECKBOX":{$order:2,"background-position":"-20px -110px"},"CHECKBOX-checked, CELLS-checked MARK":{$order:3,"background-position":"0 -70px"},"CELL-mouseover CHECKBOX-checked":{$order:4,"background-position":"0 -90px"},"CELL-mousedown CHECKBOX-checked":{$order:5,"background-position":"0 -110px"},SUB:{"*zoom":1,height:0,position:"relative",overflow:"hidden","font-size":"1px","line-height":"1px"}},Behaviors:{HoverEffected:{FCELLCMD:"FCELLCMD",HCELL:"HCELL"},ClickEffected:{FCELLCMD:"FCELLCMD",CELL:"CELL",HCELL:"HCELL"},DropableKeys:["SCROLL","CELLS","FCELLCMD"],DragableKeys:["FCELL"],onSize:linb.UI.$onSize,HFCELLA:{onClick:function(profile,e,src){if(profile.onClickGridHandler){profile.boxing().onClickGridHandler(profile,e,src)}}},HFMARK:{onClick:function(profile,e,src){if(profile.properties.selMode!="multi"){return }var rows=[];_.each(profile.rowMap,function(o){rows.push(o.id)});if(profile._$checkAll){delete profile._$checkAll;profile.boxing().setUIValue("");linb.use(src).tagClass("-checked",false)}else{profile._$checkAll=true;linb.use(src).tagClass("-checked");profile.boxing().setUIValue(rows.join(";"))}return false}},SCROLL:{onScroll:function(profile,e,src){var l=linb.use(src).get(0).scrollLeft||0;if(profile.$sl!=l){profile.getSubNode("HEADER").get(0).scrollLeft=profile.$sl=l}}},HHANDLER:{onMousedown:function(profile,e,src){var p=profile.properties,o=linb(src),minW=o.parent(2).width()-p._minColW,scroll=profile.getSubNode("SCROLL"),maxW=scroll.offset().left+scroll.width()-linb.Event.getPos(e).left-4,id=profile.getSubId(src),col=profile.colMap[id];if(p.disabled){return false}if(col&&col.disabled){return false}o.startDrag(e,{horizontalOnly:true,dragType:"blank",dragDefer:2,maxLeftOffset:minW,maxRightOffset:maxW,targetReposition:false});linb.use(src).parent(2).onMouseout(true,{$force:true}).onMouseup(true)},onDragbegin:function(profile,e,src){linb.DragDrop.getProfile().proxyNode.css({height:profile.getRoot().height()+"px",width:"4px",backgroundColor:"#ddd",cursor:"e-resize"})},onDrag:function(profile,e,src){var d=linb.DragDrop,p=d.getProfile(),b=0;if(p.x<=p.restrictedLeft||p.x>=p.restrictedRight){b=true}if(b){if(!profile._limited){p.proxyNode.css("backgroundColor","#ff6600");profile._limited=true}}else{if(profile._limited){p.proxyNode.css("backgroundColor","#ddd");profile._limited=0}}},onDragstop:function(profile,e,src){var o=linb(src).parent(2),w=o.width()+linb.DragDrop.getProfile().offset.x,col=profile.colMap[profile.getSubId(src)];o.width(w);if(col){col.width=w}var ids=[],ws=[];if(_.str.startWith(linb.use(src).parent().id(),profile.keys.HFCELLA)){profile.box._setRowHanderW(profile,w)}else{var cells=profile.colMap[profile.getSubId(src)]._cells;_.each(cells,function(o){ids.push(profile.getSubNode(profile.keys.CELL,o).id())});linb(ids).width(w)}profile.getSubNode("SCROLL").onScroll();profile.box._ajdustBody(profile);profile._limited=0},onClick:function(){return false},onDblclick:function(profile,e,src){if(profile.getKey(linb.use(src).parent().id())==profile.keys.HFCELLA){profile.box._setRowHanderW(profile,true);return }var p=profile.properties,sid=profile.getSubId(src),header=profile.colMap[sid],cells=header._cells,cls=profile.getClass("CELLA","-inline"),n,ns=[],ws=[],w;_.each(cells,function(o){n=profile.getSubNode("CELLA",o);if(n._nodes.length){ns.push(n.get(0));ws.push(n.addClass(cls).width())}});ws.push(p._minColW);w=parseInt(Math.max.apply(null,ws));if(w>p._maxColW){w=p._maxColW}linb(ns).parent().width(w);linb.use(src).parent(2).width(header.width=w);linb(ns).removeClass(cls);profile.box._ajdustBody(profile);return false}},FHANDLER:{onMousedown:function(profile,e,src){var p=profile.properties,row=profile.rowMap[profile.getSubId(src)],o=linb(src),minH=o.parent(3).height()-p._minRowH,scroll=profile.getSubNode("SCROLL"),maxH=scroll.offset().top+scroll.height()-linb.Event.getPos(e).top-4;if(p.disabled||(row&&row.disabled)){return false}o.startDrag(e,{verticalOnly:true,dragType:"blank",dragDefer:2,maxTopOffset:minH,maxBottomOffset:maxH,targetReposition:false});linb.use(src).parent(2).onMouseout(true,{$force:true}).onMouseup(true)},onDragbegin:function(profile,e,src){linb.DragDrop.getProfile().proxyNode.css({width:profile.getRoot().width()+"px",height:"4px",backgroundColor:"#ddd",cursor:"n-resize"})},onDrag:function(profile,e,src){var d=linb.DragDrop,p=d.getProfile(),b=0;if(p.y<=p.restrictedTop||p.y>=p.restrictedBottom){b=true}if(b){if(!profile._limited){p.proxyNode.css("backgroundColor","#ff6600");profile._limited=true}}else{if(profile._limited){p.proxyNode.css("backgroundColor","#ddd");profile._limited=0}}},onDragstop:function(profile,e,src){var o=linb(src).parent(3),h=o.height()+linb.DragDrop.getProfile().offset.y,row=profile.rowMap[profile.getSubId(src)];if(linb.browser.ie&&h%2==1){h+=1}o.height(h);if(_.str.startWith(linb.use(src).parent().id(),profile.keys.HFCELLA)){profile.properties.headerHeight=h;linb.UI.$tryResize(profile,null,profile.getRoot().height(),true)}else{row.height=h}profile._limited=0},onDblclick:function(profile,e,src){var p=profile.properties,sid=profile.getSubId(src),row,cells;if(sid){row=profile.rowMap[sid];cells=profile.getSubNode("CELLS",sid);cells.height(row.height=cells.height("auto").height())}else{cells=profile.getSubNode("HCELLS");cells.height(profile.properties.headerHeight=cells.height("auto").height());linb.UI.$tryResize(profile,null,profile.getRoot().height(),true)}return false},onClick:function(){return false}},FCELLCMD:{onClick:function(profile,e,src){var p=profile.properties,row=profile.rowMap[profile.getSubId(src)];if(p.disabled||row.disabled){return false}if(!row.sub){return }profile.box._setSub(profile,row,!row._checked);return false}},HCELL:{onClick:function(profile,e,src){var p=profile.properties,id=profile.getSubId(src),col=profile.colMap[id];linb(src).first().focus();if(p.disabled||col.disabled){return false}if(!(col.hasOwnProperty("colSortable")?col.colSortable:p.colSortable)){return }var order=col._order||false,type=col.type||"input",sortby=col.sortby,index=_.arr.indexOf(p.header,col),me=arguments.callee,fun=me.fun||(me.fun=function(profile,root,index,type,sortby,order){var rows,parent,self=arguments.callee;if(root){rows=root.sub;parent=profile.getSubNode("SUB",root._serialId).get(0)}else{root={_created:true};rows=profile.properties.rows;parent=profile.getSubNode("BODY").get(0)}var a1=[],a2=[],a3=[],t,ff;_.arr.each(rows,function(row){if(row.sub&&row.sub.length>1){self(profile,row,index,type,sortby,order)}a1[a1.length]=(t=row.cells)?(t=t[index])?t.value:"":row[index];a2[a2.length]=a2.length});if(typeof sortby!="function"){switch(type){case"number":ff=function(n){return parseFloat(n)||0};break;case"date":ff=function(n){return new Date(n).getTime()||0};break;default:ff=function(n){return n||""}}sortby=function(x,y){x=ff(a1[x]);y=ff(a1[y]);return(x>y?1:x==y?0:-1)*(order?1:-1)}}a2.sort(sortby);var b=root._created,bak=_.copy(rows),c;if(b){a1=parent.childNodes}_.arr.each(a2,function(o,i){rows[i]=bak[o];if(b){a3[i]=a1[o]}});if(b){var fragment=document.createDocumentFragment();for(var i=0;t=a3[i];i++){fragment.appendChild(t)}parent.appendChild(fragment)}});fun(profile,"",index,type,sortby,order);profile.getSubNode("SORT",true).css("display","none");var node=profile.getSubNode("SORT",col._serialId).css("display","");node.tagClass("-checked",!(col._order=!col._order));profile.box._asy(profile);delete profile.$allrowscache;return false},onMousedown:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var col=profile.colMap[profile.getSubId(src)];if(!(col.hasOwnProperty("colMovable")?col.colMovable:p.colMovable)){return }if(false===profile.boxing().beforeColDrag(profile,col.id)){return }var pos=linb.Event.getPos(e),o=linb(src),itemId=profile.getSubId(src);o.startDrag(e,{dragType:"icon",shadowFrom:src,dragCursor:"pointer",targetLeft:pos.left+12,targetTop:pos.top+12,targetReposition:false,dragDefer:2,dragKey:profile.$linbid+":col",dragData:o.id()})},onDragbegin:function(profile,e,src){linb(src).onMouseout(true,{$force:true}).onMouseup(true)},beforeMouseover:function(profile,e,src){if(false===profile.box._colDragCheck(profile,src)){return }linb.DragDrop.setDropElement(src).setDropFace(src,"move")},beforeMouseout:function(profile,e,src){linb.DragDrop.setDropElement(null).setDropFace(null,"none");if(false===profile.box._colDragCheck(profile,src)){return }},onDrop:function(profile,e,src){if(false===profile.box._colDragCheck(profile,src)){return }var p=profile.properties,data=linb.DragDrop.getProfile().dragData,fromId=data&&profile.getSubId(data),toId=profile.getSubId(src);var map=profile.colMap,fromTh=map[fromId],toTh=map[toId];if(false===profile.boxing().beforeColMoved(profile,fromTh.id,toTh.id)){return }linb.DragDrop.setDropFace(src,"none");var fromIndex=_.arr.subIndexOf(p.header,"_serialId",fromId),toIndex=_.arr.subIndexOf(p.header,"_serialId",toId);if(fromIndex===toIndex||fromIndex===toIndex-1){return }profile.getSubNode("HCELL",toId).addPrev(linb(linb.DragDrop.getProfile().dragData));_.each(toTh._cells,function(o,i){profile.getSubNode("CELL",o).addPrev(profile.getSubNode("CELL",fromTh._cells[i]))});var temp=p.header[fromIndex];_.arr.removeFrom(p.header,fromIndex);_.arr.insertAny(p.header,temp,toIndex);var allitems=profile.queryItems(p.rows,true,true);_.arr.each(allitems,function(o){o=o.cells?o.cells:o;if(!o||o.constructor!=Array){return }temp=o[fromIndex];_.arr.removeFrom(o,fromIndex);_.arr.insertAny(o,temp,toIndex)});profile.boxing().afterColMoved(profile,fromTh.id,toTh.id);delete profile.$allrowscache},onMouseover:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var col=profile.colMap[profile.getSubId(src)];if(!(col.hasOwnProperty("colHidable")?col.colHidable:p.colHidable)){return }_.resetRun(profile.$linbid+":collist",null);var region={},pos=linb.use(src).offset(null,profile.getSubNode("BOX")),size=linb.use(src).cssSize();if(size.width<16){return }region.height=size.height;var col=profile.colMap[profile.getSubId(src)];region.width=14;region.left=pos.left;region.top=pos.top;profile.getSubNode("COLLIST").cssRegion(region).css("visibility","visible")},onMouseout:function(profile,e,src){var p=profile.properties;if(p.disabled){return }var col=profile.colMap[profile.getSubId(src)];if(!(col.hasOwnProperty("colHidable")?col.colHidable:p.colHidable)){return }_.resetRun(profile.$linbid+":collist",function(){profile.getSubNode("COLLIST").css({visibility:"hidden",left:0,top:0})})}},COLLIST:{onMouseover:function(profile,e,src){_.resetRun(profile.$linbid+":collist",null)},onMouseout:function(profile,e,src){_.resetRun(profile.$linbid+":collist",function(){linb.use(src).css("visibility","hidden")})},onClick:function(profile,e,src){var p=profile.properties;if(!profile.$col_pop){var items=[],pop;_.arr.each(profile.properties.header,function(o){if(o.hasOwnProperty("colHidable")?o.colHidable:p.colHidable){items.push({id:o.id,caption:o.caption,type:"checkbox",value:true})}});if(items.length){pop=profile.$col_pop=new linb.UI.PopMenu({hideAfterClick:false,items:items}).render(true);pop.onMenuSelected(function(p,i,s){var b=1;_.arr.each(p.properties.items,function(o){if(o.value!==false){return b=false}});if(!b){profile.boxing().showColumn(i.id,i.value)}else{p.getSubNodeByItemId("CHECKBOX",i.id).tagClass("-checked");i.value=true}})}}if(profile.$col_pop){profile.$col_pop.pop(src)}}},CELLS:{afterMouseover:function(profile,e,src){if(profile.properties.activeMode=="row"){linb.use(src).tagClass("-mouseover")}},afterMouseout:function(profile,e,src){if(profile.properties.activeMode=="row"){linb.use(src).tagClass("-mouseover",false)}},onDblclick:function(profile,e,src){var p=profile.properties,row=profile.rowMap[profile.getSubId(src)];if(p.disabled||row.disabled){return false}if(profile.onDblClickRow){profile.boxing().onDblClickRow(profile,row,e,src)}return false},onClick:function(profile,e,src){var p=profile.properties,row=profile.rowMap[profile.getSubId(src)];if(row.group){profile.getSubNode("FCELLCMD",row._serialId).onClick()}}},CELL:{afterMouseover:function(profile,e,src){if(profile.properties.activeMode=="cell"){linb.use(src).tagClass("-mouseover")}},afterMouseout:function(profile,e,src){if(profile.properties.activeMode=="cell"){linb.use(src).tagClass("-mouseover",false)}}},CELLA:{onDblclick:function(profile,e,src){var cell=profile.cellMap[profile.getSubId(src)];if(!cell){return }var box=profile.box,getPro=box.getCellPro,type=getPro(profile,cell,"type"),disabled=getPro(profile,cell,"disabled"),editable=getPro(profile,cell,"editable");if(!disabled&&(!editable||(type=="button"||type=="label"))){profile.boxing().onDblClickCell(profile,cell,e,src)}},onClick:function(profile,e,src){var cell=profile.cellMap[profile.getSubId(src)];if(!cell){return }var p=profile.properties,box=profile.box,getPro=box.getCellPro,type=getPro(profile,cell,"type"),disabled=getPro(profile,cell,"disabled"),event=getPro(profile,cell,"event"),mode=p.activeMode,editable=getPro(profile,cell,"editable"),id;if(!disabled&&(!editable||(type=="button"||type=="label"))){if(typeof event=="function"&&false===event.call(profile._host||profile,profile,cell,null,null,e,src)){}else{profile.boxing().onClickCell(profile,cell,e,src)}if(type=="button"){return false}}if(!disabled&&type=="checkbox"){if(editable){box._updCell(profile,cell,!cell.value)}}if(!p.editable){if(mode=="cell"){if(getPro(profile,cell,"disabled")){return false}id=linb(src).parent().id();box._sel(profile,"cell",src,id,e)}else{if(mode=="row"){if(p.disabled||cell._row.disabled){return false}id=linb(src).parent(2).id();box._sel(profile,"row",src,id,e)}}}linb.use(src).focus();return false},onFocus:function(profile,e,src){var p=profile.properties,box=profile.box,getPro=box.getCellPro,cell=profile.cellMap[profile.getSubId(src)],mode=p.activeMode,id;if(getPro(profile,cell,"editable")){if(getPro(profile,cell,"disabled")){return false}box._editCell(profile,cell._serialId);_.asyRun(function(){linb.use(src).parent().onMouseout(true,{$force:true}).parent().onMouseout(true,{$force:true})})}if(!p.editable){if(mode=="cell"){id=linb.use(src).parent().id();box._activeCell(profile,id)}else{if(mode=="row"){id=linb.use(src).parent(2).id();box._activeRow(profile,id)}}}},onKeydown:function(profile,e,src){var keys=linb.Event.getKey(e),key=keys[0],shift=keys[2],cur=linb(src),body=profile.getSubNode("BODY"),first=body.nextFocus(true,true,false),last=body.nextFocus(false,true,false);switch(key){case"tab":if(shift){if(src!=first.get(0)){first.focus();return false}}else{if(src!=last.get(0)){last.focus();return false}}break;case"left":if(cur.get(0)==first.get(0)){last.focus()}else{cur.nextFocus(false)}return false;break;case"right":if(cur.get(0)==last.get(0)){first.focus()}else{cur.nextFocus()}return false;break;case"up":if(cur.get(0)==first.get(0)){last.focus();return }case"down":var count=1,fkey=profile.keys.FCELL,temp=cur.parent().get(0),max=temp.parentNode.childNodes.length;while(temp=temp.previousSibling){count++}temp=cur.parent(2).get(0);if(!profile.$allrowscache){var all=profile.getSubNode("CELLS",true).get();_.filter(all,function(o){return !!o.offsetWidth&&profile.getKey(o.lastChild.id)!=fkey});profile.$allrowscache=all}var index=_.arr.indexOf(profile.$allrowscache,temp),rowLen=profile.$allrowscache.length;if(key=="up"){index--;if(index==-1){index=rowLen-1;count--;if(count==0){count=max}}}else{index++;if(index==rowLen){index=0;count++;if(count==max+1){count=1}}}node=linb(profile.$allrowscache[index]).first().next(count-1).first();if(!node.isEmpty()){node.focus()}return false;break}}},FCELL:{onClick:function(profile,e,src){var p=profile.properties,row=profile.rowMap[profile.getSubId(src)],b=profile.box;if(!row.group){if(p.disabled||row.disabled){return false}if(p.activeMode=="row"){b._sel(profile,"row",src,src,e)}if(row.cells[0]){linb.use(src).next().first().focus()}}}}},DataModel:{directInput:true,listKey:null,selMode:{ini:"none",listbox:["single","none","multi"],action:function(value){this.getSubNodes(["HFMARK","MARK"],true).css("display",value=="multi"?"":"none")}},dock:"fill",altRowsBg:{ini:false,action:function(value){var ns=this;var altCls=ns.getClass("ALT"),nodes=ns.getSubNode("CELLS",true),alt,j;nodes.removeClass(altCls);if(value){alt=[];j=0;nodes.each(function(o,i){if(o.offsetHeight){o=linb([o]);if((j++)%2==1){if(!o.hasClass(altCls)){o.addClass(altCls)}}else{if(o.hasClass(altCls)){o.removeClass(altCls)}}}});linb(alt).addClass(altCls)}}},rowNumbered:{ini:false,action:function(value){var ns=this,f=ns.CF.getNumberedStr||function(a){return a},nodes=ns.getSubNode("ROWNUM",true),i=0,map=ns.rowMap,row,ol=0,l=0,a1=[],a2=[],tag="",temp,t;if(value){nodes.each(function(o){if(o.parentNode.offsetWidth){row=map[ns.getSubId(o.id)];l=row._layer;if(l>ol){a1.push(i);a2.push(tag);tag=tag+i+".";i=0}else{if(l<ol){while(l<ol--){i=a1.pop();tag=a2.pop()}}}i++;ol=l;temp=f(tag+i);if(t=o.firstChild){if(t.nodeValue!=temp){t.nodeValue=temp}}else{o.appendChild(document.createTextNode(temp))}}})}else{nodes.text("")}}},editable:false,$subMargin:16,iniFold:true,animCollapse:false,position:"absolute",width:300,height:200,_minColW:5,_maxColW:300,_minRowH:20,gridHandlerCaption:{ini:"",action:function(v){this.getSubNode("GRIDCAPTION").get(0).innerHTML=v}},rowHandlerWidth:{ini:50,set:function(value){var o=this;if(o.renderId){o.box._setRowHanderW(o,value)}else{o.properties.rowHandlerWidth=value}}},showHeader:{ini:true,action:function(value){this.getSubNode("HEADER").css("display",value?"":"none")}},headerHeight:{ini:18,action:function(v){this.getSubNode("HCELLS").height(v);linb.UI.$tryResize(this,this.getRoot().width(),this.getRoot().height(),true)}},rowHeight:{ini:20,action:function(v){this.getSubNode("CELLS",true).height(v)}},_colDfWidth:80,rowHandler:{ini:true,action:function(value){this.getSubNode("HFCELL").css("display",value?"":"none");this.getSubNode("FCELL",true).css("display",value?"":"none");this.box._ajdustBody(this)}},rowResizer:{ini:false,action:function(value){this.getSubNode("FHANDLER",true).css("display",value?"":"none")}},colHidable:false,colResizer:{ini:true,action:function(value){this.getSubNode("HHANDLER",true).css("display",value?"":"none")}},colSortable:{ini:true,action:function(value){if(!value){this.getSubNode("SORT",true).css("display","none")}}},colMovable:false,header:{ini:{},set:function(value){var o=this;if(o.renderId){o.boxing()._refreshHeader(value)}else{o.properties.header=_.copy(value)}}},rows:{ini:{},set:function(value){var o=this;if(o.renderId){o.boxing().removeAllRows().insertRows(value)}else{o.properties.rows=_.copy(value)}}},activeMode:{ini:"row",listbox:["row","cell","none"],action:function(value){var profile=this;if(value!="cell"&&profile.$activeCell){linb(profile.$activeCell).tagClass("-active",false);delete profile.$activeCell}if(value!="row"&&profile.$activeRow){linb(profile.$activeRow).tagClass("-active",false);delete profile.$activeRow}}},noCtrlKey:true},EventHandlers:{onGetContent:function(profile,row,callback){},onRowSelected:function(profile,row,src){},beforeColDrag:function(profile,colId){},beforeColMoved:function(profile,colId,toId){},afterColMoved:function(profile,colId,toId){},beforeRowActive:function(profile,row){},afterRowActive:function(profile,row){},beforeCellActive:function(profile,cell){},afterCellActive:function(profile,cell){},beforeIniEditor:function(profile,cell,cellNode){},beforeCellUpdated:function(profile,cell,options){},afterCellUpdated:function(profile,cell,options){},onDblClickRow:function(profile,row,e,src){},beoforeComboPop:function(profile,cell,proEditor,pos,e,src){},onClickCell:function(profile,cell,e,src){},onDblClickCell:function(profile,cell,e,src){},onClickGridHandler:function(profile,e,src){}},RenderTrigger:function(){var ns=this,pro=ns.properties,ins=ns.boxing();ns.destroyTrigger=function(){var ns=this,pro=ns.properties;_.breakO([ns.colMap,ns.rowMap,ns.cellMap],3);pro.header.length=0;pro.rows.length=0};ns.$cache_editor={};if(!pro.iniFold){ins._expendRows(pro.rows)}ns.box._asy(ns);ns.box._ajdustBody(ns)},_asy:function(profile){var pro=profile.properties,b=profile.boxing(),id=profile.$linbid;if(pro.altRowsBg){_.resetRun(id+"1",function(){b.setAltRowsBg(true,true)})}if(pro.rowNumbered){_.resetRun(id+"2",function(){b.setRowNumbered(true,true)})}},_setRowHanderW:function(profile,flag){var pro=profile.properties,ww=pro.$subMargin,map=profile.rowMap,hcell=profile.getSubNode("HFCELL"),n,w;if(typeof flag=="number"){w=flag}else{if(flag===true){var ws=[],t;profile.getSubNode("FCELLINN",true).each(function(o){if((t=o.parentNode).parentNode.offsetWidth>0&&linb.Dom.getStyle(t,"overflow")!="visible"){if(n=map[profile.getSubId(o.id)]){ws.push(linb([o]).width()+n._layer*ww)}}});ws.push(pro._minColW);w=parseInt(Math.max.apply(null,ws))+ww*2}else{w=hcell.width()}}if(w){if(w<pro._minColW){w=pro._minColW}if(pro.rowHandlerWidth!=w){hcell.width(pro.rowHandlerWidth=w);profile.getSubNode("FCELL",true).width(w);profile.getSubNode("FCELLRULER",true).each(function(o){n=map[profile.getSubId(o.id)];o.style.width=n._layer*ww+"px"});profile.box._ajdustBody(profile)}}},_onStartDrag:function(profile,e,src){var pos=linb.Event.getPos(e);profile.$_ond=src;linb.use(src).startDrag(e,{dragType:"icon",shadowFrom:linb.use(src).parent()._get(0),targetLeft:pos.left+12,targetTop:pos.top+12,dragCursor:"pointer",dragDefer:2,dragKey:profile.box.getDragKey(profile,src),dragData:profile.box.getDragData(profile,e,src)});return false},_onDropTest:function(profile,e,src,key,data,item){var fid=data&&data.domId,tid=src,fp=data&&data.profile,t;if(tid){var k=profile.getKey(tid),ks=profile.keys,row=profile.rowMap[profile.getSubId(tid)];if(k==ks.FCELLCMD&&!row.sub){return false}}if(fp&&fp.$linbid==profile.$linbid){if(fid&&profile.getSubId(fid)==profile.getSubId(tid)){return false}t=profile.$_ond;src=linb(src).get(0);if(_.get(src,["parentNode","previousSibling"])==t){return false}do{if(src==t){src=t=null;return false}}while(src&&(src=src.parentNode)&&src!==document&&src!==window);src=t=null}},_onDragstop:function(profile,e,src,key,data,item){delete profile.$_ond},_onDrop:function(profile,e,src,key,data,item){linb.DragDrop.setDragIcon("none");if(!data.profile||!data.profile[profile.KEY]){return }var k=profile.getKey(src),po=data.profile,ps=data.domId,oitem,ks=profile.keys,t=linb.absObj.$specialChars,b=profile.boxing(),orow=po.rowMap[po.getSubId(ps)],row=profile.rowMap[profile.getSubId(src)];orow=_.clone(orow,function(o,i){return !t[(i+"").charAt(0)]});po.boxing().removeRows([orow.id]);if(k==ks.SCROLL){b.insertRows([orow],null,null,false)}else{if((k==ks.FCELLCMD)&&row.sub){b.insertRows([orow],row.id,null,false)}else{if(k==ks.CELLS){b.insertRows([orow],row._pid,row.id,true)}}}return false},_beforeSerialized:function(profile){var o=arguments.callee.upper.call(this,profile),pp=profile.properties,map=linb.absObj.$specialChars,t;o.properties.header=_.clone(pp.header,function(o,i){return !map[(i+"").charAt(0)]});o.properties.rows=_.clone(pp.rows,function(o,i){return !map[(i+"").charAt(0)]});if(o.properties.header.length===0){delete o.properties.header}if(o.properties.rows.length===0){delete o.properties.rows}return o},_clsCache:{},_colDragCheck:function(profile,src){var dd=linb.DragDrop.getProfile(),key=dd.dragKey,data=dd.dragData,col=profile.colMap[profile.getSubId(src)];if(!(col.hasOwnProperty("colMovable")?col.colMovable:profile.properties.colMovable)){return }if(!key||!data||key!=(profile.$linbid+":col")){return false}if(data==linb.use(src).id()||data==linb.use(src).prev().id()){return false}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),NONE="display:none";profile.rowMap2={};profile.rowMap={};profile.cellMap={};var pro=profile.properties;data.showHeader=pro.showHeader?"":NONE;data.colDDDisplay=pro.colResizer?"":NONE;data.rowDDDisplay=pro.rowResizer?"":NONE;data.rowHandlerDisplay=pro.rowHandler?"":NONE;data.headerHeight=data.headerHeight?("height:"+data.headerHeight+"px;"):"";data._rowMarkDisplay=pro.selMode=="multi"?"":"display:none;";if(pro.header&&pro.header.constructor!=Array){pro.header=[]}if(pro.rows&&pro.rows.constructor!=Array){pro.rows=[]}pro.header=this._adjustHeader(pro.header);data.header=this._prepareHeader(profile,pro.header);data._row0DfW=data.rowHandlerWidth?("width:"+data.rowHandlerWidth+"px"):"";arguments.callee.upper.call(this,profile);pro.rows=this._adjustRows(pro.rows);data.rows=this._prepareItems(profile,pro.rows);return data},_prepareHeader:function(profile,arr){var a=profile.colMap2={},b=profile.colMap={},SubID=linb.UI.$tag_subId,pro=profile.properties,header=[],temp,t,NONE="display:none";_.arr.each(arr,function(o,i){temp="h_"+profile.pickSubId("header");if(typeof o=="string"){o=arr[i]={id:o}}if(typeof o.id!="string"){o.id=o.caption||(_()+"")}o._cells={};o[SubID]=temp;b[temp]=o;o.width=o.width||pro._colDfWidth;t={sortDisplay:NONE,rowHandlerDisplay:pro.rowHandler?"":NONE};t[SubID]=temp;t._tabindex=pro.tabindex;t.colDDDisplay=(("colResizer" in o)?o.colResizer:pro.colResizer)?"":"display:none";if(!o.type){o.type="label"}if(!o.caption){o.caption=o.id}linb.UI.adjustData(profile,o,t);a[o.id]=temp;header.push(t)});return header},_renderCell:function(profile,cell,node,options){var getPro=profile.box.getCellPro,dom=node["linb.Dom"],ncell=dom?cell:node,type=getPro(profile,cell,"type"),t1="",t2="",caption,capOut=(!dom)&&node.caption,reg1=/</g,me=arguments.callee,dcls=me._dcls||(me._dcls=profile.getClass("CELL","-disabled")),ren=me._ren||(me._ren=function(profile,cell,ncell,fun){return typeof cell.$caption=="string"?cell.$caption:typeof ncell.caption=="string"?ncell.caption:typeof cell.renderer=="function"?cell.renderer(cell):typeof fun=="function"?fun(cell.value):String(cell.value)||""}),f1=me._f1=(me._f1=function(v){return linb.Date.getText(new Date(parseInt(v)),"ymd")}),f2=me._f2=(me._f2=function(v){return(v.split("\n")[0]||"").replace(/ /g,"&nbsp;").replace(reg1,"&lt;")}),f3=me._f3=(me._f3=function(v){return v*1000/10+"%"});switch(type){case"number":cell.value=parseFloat(cell.value)||0;caption=capOut||ren(profile,cell,ncell);if(dom){node.html(caption||cell.value,false)}break;case"datepicker":cell.value=(parseInt(cell.value)?new Date(parseInt(cell.value)):new Date()).getTime();caption=capOut||ren(profile,cell,ncell,f1);if(dom){node.html(caption,false)}break;case"textarea":cell.value=cell.value||"";caption=capOut||ren(profile,cell,ncell,f2);if(dom){node.html(caption,false)}break;case"colorpicker":cell.value="#"+linb.UI.ColorPicker._ensureValue(0,cell.value);caption=capOut||ren(profile,cell,ncell);t1=linb.UI.ColorPicker.getTextColor(cell.value);if(dom){node.html(caption,false);node.css("color",t1).css("backgroundColor",cell.value)}else{node.color="color:"+t1+";";node.bgcolor="background-color:"+cell.value+";"}break;case"checkbox":cell.value=!!cell.value;caption=cell.value+"";if(dom){node.first().tagClass("-checked",cell.value)}else{node.checkboxCls=profile.getClass("CHECKBOX",cell.value?"-checked":"")}break;case"progress":cell.value=parseFloat(cell.value)||0;cell.value=Math.min(Math.max(cell.value,0),1);caption=capOut||ren(profile,cell,ncell,f3);if(dom){node.first().html(caption,false).width(caption)}else{node.progress=caption}break;default:cell.value=cell.hasOwnProperty("value")?cell.value:"";caption=capOut||ren(profile,cell,ncell);if(dom){node.html(caption||cell.value,false)}}cell._$tips=caption;var t2=getPro(profile,cell,"disabled");if(!dom){node.cellCls=profile.getClass("CELL","-"+type)+(t2?(" "+dcls):"");node.type=type;node.value=cell.value;node.caption=caption;node.cellStyle=getPro(profile,cell,"cellStyle");node.cellClass=getPro(profile,cell,"cellClass")}else{if(t2){node.addClass(dcls)}else{node.removeClass(dcls)}if(t2=options.cellStyle){node.attr("style",node.attr("style")+";"+t2)}if(t2=options.cellClass){node.addClass(t2)}}},_prepareItems:function(profile,arr,pid){var self=this,pro=profile.properties,mm=pro.$subMargin,a=profile.rowMap2,b=profile.rowMap,d=profile.cellMap,_layer=pid?b[a[pid]]?(b[a[pid]]._layer+1):0:0,SubID=linb.UI.$tag_subId,me=arguments.callee,ider=me._id||(me._id=new _.id()),rows=[],temp,cells,t,row,g,j,v,NONE="display:none";for(var i=0,l=arr.length;i<l;i++){temp="r_"+profile.pickSubId("row");if(!arr[i].id||a[arr[i].id]){while(a[t=ider.next()]){}arr[i].id=t}row=arr[i];row._pid=pid;row._cells={};row._layer=_layer;row[SubID]=temp;row._tabindex=pro.tabindex;row._rowMarkDisplay=pro.selMode=="multi"?"":NONE;b[temp]=row;t={id:row.id};if(row.group){t.rowCls=profile.getClass("CELLS","-group")}if(row.summary){t.summaryDisplay="display:block;"}if(row.preview){t.previewDisplay="display:block;"}t._row0DfW=pro.rowHandlerWidth?("width:"+pro.rowHandlerWidth+"px"):"";t._rulerW=_layer*mm;t.rowHeight=row.height||pro.rowHeight;t.rowHandlerDisplay=pro.rowHandler?"":NONE;t.rowDDDisplay=(("rowResizer" in row)?row.rowResizer:pro.rowResizer)?"":NONE;cells=t.cells=[];t[SubID]=temp;t.subClass=row.sub?"uicmd-toggle2":"uicmd-empty";a[row.id]=temp;if(row.group){row.cells=null}if(!row.hasOwnProperty("caption")&&row.hasOwnProperty("value")){row.caption=""+row.value}if(row.caption&&!row.tips){row._$tips=row.caption}if(v=row.cells){_.arr.each(pro.header,function(headCell,j){g=v[j]||(v[j]={});var n={};g._row=row;g._col=headCell;g[SubID]="c_"+profile.pickSubId("cell");self._adjustCell(profile,g,n);cells.push(n);d[n[SubID]]=g;row._cells[headCell.id]=n[SubID];headCell._cells[row.id]=n[SubID]})}linb.UI.adjustData(profile,row,t);rows.push(t)}return rows},_adjustCell:function(profile,cell,uicell){var self=this,pro=profile.properties,col=cell._col,renderer;if(renderer=self.getCellPro(profile,cell,"cellRenderer")){cell.renderer=renderer}linb.UI.adjustData(profile,cell,uicell);cell._$value=cell.value;if(!uicell.width){uicell.width=col.width}uicell._tabindex=pro.tabindex;uicell.cellDisplay=col.visibility===false?"display:none;":"";self._renderCell(profile,cell,uicell)},_setSub:function(profile,item,flag){var id=profile.domId,pro=profile.properties,serialId=profile.rowMap2[item.id],markNode=profile.getSubNode("FCELLCMD",serialId),subNs=profile.getSubNode("SUB",serialId);if(linb.Thread.isAlive(profile.key+profile.id)){return }if(item._checked){if(!flag){var h=subNs.height();if(pro.animCollapse){subNs.animate({height:[h,0]},null,null,100,5,"expoIn",profile.key+profile.id).start()}else{subNs.height(0)}markNode.tagClass("-checked",false);item._checked=false;profile.box._asy(profile)}}else{if(flag){var openSub=function(profile,item,id,markNode,subNs,sub){var b=profile.boxing(),p=profile.properties;if(!item._created){delete item.sub;item._created=true;if(typeof sub=="string"){subNs.html(item.sub=sub,false)}else{if(_.isArr(sub)){b.insertRows(sub,item.id)}else{if(sub["linb.Template"]||sub["linb.UI"]){subNs.append(item.sub=sub.render(true))}}}b._setCtrlValue(b.getUIValue(),true)}var h=subNs.height(true);if(p.animCollapse){subNs.animate({height:[0,h]},null,function(){subNs.css({height:"auto"})},100,5,"expoOut",profile.key+profile.id).start()}else{subNs.css({height:"auto"})}markNode.tagClass("-checked");item._checked=true;profile.box._asy(profile)};var sub=item.sub,callback=function(sub){openSub(profile,item,id,markNode,subNs,sub)},t;if((t=typeof sub)=="string"||t=="object"){callback(sub)}else{if(profile.onGetContent){var r=profile.boxing().onGetContent(profile,item,callback);if(r){callback(r)}}}}}delete profile.$allrowscache},_getCellId:function(profile,rowId,colId){return _.get(profile.rowMap,[profile.rowMap2[rowId],"_cells",colId])},_updCell:function(profile,cellId,options,dirtyMark){var box=profile.box,sc=linb.absObj.$specialChars,cell,node;if(typeof cellId=="string"){cell=profile.cellMap[cellId]}else{cell=cellId;cellId=cell._serialId}if(!cell){return }if(!_.isObj(options)){options={value:options}}options=_.filter(options,function(o,i){return !sc[i.charAt(0)]||i=="$caption"});if(false===profile.boxing().beforeCellUpdated(profile,cell,options)){return }delete cell.caption;if(cell.hasOwnProperty("caption")){options.caption=options.caption;delete options.caption}_.merge(cell,options,"all");node=profile.getSubNode("CELLA",cellId);if("type" in options){var uicell={};box._adjustCell(profile,cell,uicell);node.parent().replace(profile._buildItems("rows.cells",[uicell]))}else{box._renderCell(profile,cell,node,options)}profile.boxing().afterCellUpdated(profile,cell,options);if("value" in options){if(dirtyMark===false){cell._$value=cell.value}else{if(cell.value===cell._$value){node.removeClass("ui-dirty")}else{node.addClass("ui-dirty")}}}},_ensureValue:function(profile,value){if(profile.properties.selMode=="multi"){var arr=(value||"").split(";");arr.sort();return arr.join(";")}else{return value}},_sel:function(profile,type,src,id,e){var properties=profile.properties;if(properties.activeMode!=type){return }var targetId=profile.getSubId(id),map=type=="cell"?profile.cellMap:profile.rowMap,box=profile.boxing(),targetItem=map[targetId],ks=linb.Event.getKey(e),sid=type=="cell"?(targetItem._row.id+"|"+targetItem._col.id):targetItem.id,mode=properties.selMode,rt,rt2;switch(mode){case"none":rt=box.onRowSelected(profile,targetItem,src);break;case"multi":var value=box.getUIValue(),arr=value?value.split(";"):[];if(arr.length&&(ks[1]||ks[2]||properties.noCtrlKey)){rt2=false;if(ks[2]&&type=="row"){if(profile.$firstV._pid!=targetItem._pid){return false}var items=properties.rows;if(targetItem._pid){var pitem=map[targetItem._pid];if(pitem){items=pitem.sub}}var i1=_.arr.subIndexOf(items,"id",profile.$firstV.id),i2=_.arr.subIndexOf(items,"id",targetItem.id),i;arr.length=0;for(i=Math.min(i1,i2);i<=Math.max(i1,i2);i++){arr.push(items[i].id)}}else{if(_.arr.indexOf(arr,sid)!=-1){_.arr.removeValue(arr,sid)}else{arr.push(sid)}}arr.sort();value=arr.join(";");if(box.getUIValue()==value){rt=false}else{box.setUIValue(value);if(box.getUIValue()==value){rt=box.onRowSelected(profile,targetItem,src)}}break}case"single":if(box.getUIValue()==sid){rt=false}else{profile.$firstV=targetItem;box.setUIValue(sid);if(box.getUIValue()==sid){rt=box.onRowSelected(profile,targetItem,src)||rt2}}break}return rt},_activeCell:function(profile,id){if(profile.properties.activeMode!="cell"){return }var targetId=profile.getSubId(id),map=profile.cellMap,targetCell=map[targetId];if(profile.beforeCellActive&&(false===profile.boxing().beforeCellActive(profile,targetCell))){return }if(profile.$activeCell){linb(profile.$activeCell).tagClass("-active",false)}linb(profile.$activeCell=id).tagClass("-active");profile.boxing().afterCellActive(profile,targetCell)},_activeRow:function(profile,id){if(profile.properties.activeMode!="row"){return }var targetId=profile.getSubId(id),map=profile.rowMap,targetRow=map[targetId];if(profile.beforeRowActive&&(false===profile.boxing().beforeRowActive(profile,targetRow))){return }if(profile.$activeRow){linb(profile.$activeRow).tagClass("-active",false)}linb(profile.$activeRow=id).tagClass("-active");profile.boxing().afterRowActive(profile,targetRow)},getCellPro:function(profile,cell,key){var t=cell;return(key in t)?t[key]:((t=cell._row)&&(key in t))?t[key]:((t=cell._col)&&(key in t))?t[key]:((t=profile.properties)&&(key in t))?t[key]:null},_editCell:function(profile,cellId){var cell=typeof cellId=="string"?profile.cellMap[cellId]:cellId;if(!cell){return }var cellNode=profile.getSubNode("CELL",cellId),editor=profile.$curEditor;if(editor){_.tryF(editor.undo,[],editor)}editor=null;var grid=this,baseNode=profile.getSubNode("SCROLL"),box=profile.box,getPro=function(key){return box.getCellPro(profile,cell,key)},type=getPro("type"),t;if(type=="checkbox"){cellNode.first().focus();return }else{if(type=="button"||type=="label"){return }}if(profile.$cache_editor[type]){editor=profile.$cache_editor[type]}else{if(profile.beforeIniEditor){editor=profile.boxing().beforeIniEditor(profile,cell,cellNode);if(editor===false){return }}if(!editor||!editor["linb.UI"]){editor=new linb.UI.ComboInput({left:-1000,top:-1000,position:"absolute",visibility:"hidden",zIndex:100})}switch(type){case"number":editor.setType("none").setCustomStyle("INPUT","text-align:right;").setValueFormat("^-?(\\d\\d*\\.\\d*$)|(^-?\\d\\d*$)|(^-?\\.\\d\\d*$)");break;case"progress":editor.setType("none").setValueFormat("^(0([\\.]\\d*[0-9]+)|0|1)$").setCustomStyle("INPUT","text-align:right;");break;case"input":editor.setType("none");break;case"textarea":editor.setType("none").setMultiLines(true).setSaveBtn(true).onSave(function(p){p.boxing().hide()});_.tryF(editor.setResizer,[true],editor);break;case"listbox":case"combobox":case"helpinput":case"timepicker":case"datepicker":case"colorpicker":case"getter":case"popbox":case"cmdbox":editor.setType(type).beoforeComboPop(function(pro,pos,e,src){var cell=pro.$cell,event=profile.box.getCellPro(profile,cell,"event");if(profile.box.getCellPro(profile,cell,"disabled")){return false}if(typeof event=="function"){return event.call(profile._host||profile,profile,cell,pro,pos,e,src)}else{return profile.boxing().beoforeComboPop(profile,cell,pro,pos,e,src)}});break}baseNode.append(editor);profile.$cache_editor[type]=editor}switch(type){case"listbox":case"combobox":case"helpinput":if(t=getPro("editorListKey")){editor.setListKey(t)}else{if(t=getPro("editorListItems")){editor.setItems(t)}}break}editor.setValue(cell.$editorValue||cell.value,true);delete cell.$editorValue;var editorFormat=getPro("editorFormat"),editorMask=getPro("editorMask"),editorReadonly=getPro("editorReadonly");if(cell.$tag){if(editor.setCaption){editor.setCaption(cell.$tag)}else{if(editor.setValue){editor.setValue(cell.$tag)}}}if(editor.setReadonly){editor.setReadonly(!!editorReadonly)}if(editorFormat){if(typeof editorFormat=="function"&&editor.beforeFormatCheck){editor.beforeFormatCheck(editorFormat)}else{if(typeof editorFormat=="string"&&editor.setValueFormat){editor.setValueFormat(editorFormat)}}}if(editorMask&&editor.setMask){editor.setMask(editorMask)}editor.get(0).$cell=cell;editor.undo=function(){var editor=this;profile.$curEditor=null;editor.getRoot().setBlurTrigger(profile.$linbid);if(!profile.properties.directInput){editor.afterUIValueSet(null).beforeNextFocus(null);if(editor.beforeFormatCheck){editor.beforeFormatCheck(null)}if(editor.setValueFormat){editor.setValueFormat("")}if(editor.setMask){editor.setMask("")}editor.setValue("",true)}delete editor.get(0).$cell;editor.reBoxing().hide()};editor.afterUIValueSet(function(pro,oV,nV){if(getPro("type")=="number"){nV=parseFloat(nV)}grid._updCell(profile,cellId,{value:nV,$caption:pro.$caption})}).beforeNextFocus(function(pro,key,shift,e){if(editor){_.tryF(editor.undo,[],editor);var hash=linb.Event.getEventPara(e);if(hash.keyCode=="enter"){hash.keyCode="down"}profile.getSubNode("CELLA",cell._serialId).onKeydown(true,hash)}return false}).getRoot().setBlurTrigger(profile.$linbid,function(){if(editor){_.tryF(editor.undo,[],editor)}return false});var absPos=cellNode.offset(null,baseNode),size=cellNode.cssSize();if(type=="textarea"){editor.setWidth(Math.max(200,size.width+3)).setHeight(Math.max(100,size.height+2)).reLayout(true,true).reBoxing().popToTop(cellNode,4,baseNode)}else{editor.setWidth(size.width+3).setHeight(size.height+2).reLayout(true);editor.reBoxing().show((absPos.left-1)+"px",(absPos.top-1)+"px")}profile.$curEditor=editor;_.asyRun(function(){_.tryF(editor&&editor.activate,[],editor)})},_ajdustBody:function(profile){_.resetRun(profile.$linbid+"4",function(){var body=profile.getSubNode("BODY"),header=profile.getSubNode("HCELLS"),t,l,last,keys=profile.keys;if(body.get(0).offsetHeight){if(header.get(0).offsetHeight){if(t=header.get(0).childNodes){l=t.length;while(l){if(t[l-1].offsetHeight){last=t[l-1];break}--l}}header.parent().width(last.offsetWidth+last.offsetLeft+100)}else{if(t=body.get(0).childNodes){l=t.length;while(l){if(t[l-1].offsetHeight){last=t[l-1];break}--l}if(last){var sid=profile.getSubId(last.id);t=profile.getSubNode("CELLS",sid);if(t=t.get(0).childNodes){l=t.length;while(l){if(t[l-1].offsetHeight){last=t[l-1];break}--l}}}}}}body.width(last?(last.offsetWidth+last.offsetLeft):0);t=last=null})},_adjustHeader:function(arr){var a=_.copy(arr),m;_.arr.each(a,function(o,i){a[i]=_.copy(o)});return a},_adjustRows:function(arr){var a,m;if(_.isArr(arr)&&arr.length&&typeof arr[0]!="object"){a=[arr]}else{a=_.copy(arr)}_.arr.each(a,function(o,i){if(_.isArr(o)){a[i]={cells:o}}else{a[i]=_.copy(o)}m=a[i].cells=_.copy(a[i].cells);_.arr.each(m,function(o,i){if(typeof o!="object"){m[i]={value:o}}else{m[i]=_.copy(o)}})});return a},_showTips:function(profile,node,pos){if(profile.onShowTips){return profile.boxing().onShowTips(profile,node,pos)}if(!linb.Tips){return }var ks=profile.keys,item,hcell=ks.HCELL+":",sid,id,pid;if(profile.properties.disabled){return }id=node.id;pid=node.parentNode.id;sid=profile.getSubId(id);if(id.indexOf(ks.FCELL)==0||pid.indexOf(ks.FCELL)==0){item=profile.rowMap[sid]}else{if(id.indexOf(ks.HCELL)==0||pid.indexOf(ks.HCELL)==0){item=profile.colMap[sid]}else{if(id.indexOf(ks.CELL)==0||pid.indexOf(ks.CELL)==0){item=profile.cellMap[sid]}}}if(item){linb.Tips.show(pos,("tips" in item)?item.tips:(item._$tips||item.caption))}else{linb.Tips.hide()}return true},_onresize:function(profile,width,height){profile.getSubNode("BORDER").cssSize({width:width,height:height});var t1=profile.getSubNode("HEADER"),t2=profile.getSubNode("SCROLL"),rh=0;profile.getSubNode("BOX").cssSize({width:width,height:height});if(width){t1.width(width)}if(height){rh=t1.offsetHeight()}t2.cssSize({width:width,height:height?(height-rh):null});_.asyRun(function(){t2.onScroll()})}}});Class("linb.UI.Slider",["linb.UI","linb.absValue"],{Instance:{_setCtrlValue:function(value){return this.each(function(profile){var p=profile.properties,steps=p.steps,fun=function(k){return profile.getSubNode(k)},a=fun("IND1"),b=fun("IND2"),arr=profile.box._v2a(profile,value),ori=p.type=="vertical"?"top":"left";a[ori](arr[0]+"%");if(p.isRange){b[ori](arr[1]+"%")}})},_setDirtyMark:function(){return this.each(function(profile){if(!profile.properties.dirtyMark){return }if(!profile.renderId){return }var properties=profile.properties,flag=properties.value!==properties.$UIvalue;if(profile._dirtyFlag==flag){return }profile._dirtyFlag=flag;var o=profile.getSubNode("BOX"),cls=linb.UI.$css_tag_dirty;if(profile.beforeDirtyMark&&false===profile.boxing().beforeDirtyMark(profile,flag)){return }if(flag){o.addClass(cls)}else{o.removeClass(cls)}})}},Static:{Templates:{style:"{_style}",BOX:{tagName:"div",className:"{_cls}",BG:{tagName:"div"},RULER:{$order:1,tagName:"div",RULERLEFT:{},RULERRIGHT:{}},IND:{$order:2,IND1:{tagName:"a",style:"{_showD}",href:linb.$href,tabindex:"{tabIndex}"},IND2:{tagName:"a",href:linb.$href,tabindex:"{tabIndex}",style:"{_showD2}"}},DECREASE:{tagName:"a",style:"{_showDes}",href:linb.$href,tabindex:"{tabIndex}"},INCREASE:{tagName:"a",style:"{_showIns}",href:linb.$href,tabindex:"{tabIndex}"}}},Appearances:{"IND, BT, RULER, RULERLEFT, RULERRIGHT, IND1, IND2, DECREASE, INCREASE":{"font-size":0,"line-height":0,position:"absolute"},BOX:{position:"relative",left:0,top:0,width:"100%",height:"100%"},"BOX-h DECREASE, BOX-h INCREASE":{top:"50%",width:"17px",height:"17px","margin-top":"-8px"},"BOX-v DECREASE, BOX-v INCREASE, BOX-h DECREASE, BOX-h INCREASE, BOX-h IND1,BOX-h IND2, BOX-v IND1,BOX-v IND2":{background:linb.UI.$bg("icons.gif","no-repeat",true)},"BOX-h DECREASE":{$order:1,left:0,"background-position":"-80px -70px"},"BOX-h INCREASE":{$order:1,right:0,"background-position":"-100px -70px"},"BOX-h DECREASE-mouseover":{$order:2,"background-position":"-80px -90px"},"BOX-h DECREASE-mousedown":{$order:3,"background-position":"-80px -110px"},"BOX-h INCREASE-mouseover":{$order:2,"background-position":"-100px -90px"},"BOX-h INCREASE-mousedown":{$order:3,"background-position":"-100px -110px"},"BOX-h BG":{top:"50%"},"BOX-h IND, BOX-h RULER":{"z-index":1,top:"50%",height:"6px","margin-top":"-3px"},"BOX-h RULER, BOX-h RULERLEFT, BOX-h RULERRIGHT":{background:linb.UI.$bg("bar_vertical.gif","repeat-x",true)},"BOX-h RULER":{$order:2,"background-position":"left -482px"},"BOX-h RULERLEFT, BOX-h RULERRIGHT":{"z-index":1,height:"6px",width:"5px"},"BOX-h RULERLEFT":{$order:2,"background-position":"left -474px",left:"-4px",top:0},"BOX-h RULERRIGHT":{$order:2,"background-position":"left -490px",right:"-4px",top:0},"BOX-h IND1,BOX-h IND2":{$order:1,"z-index":2,"background-position":"-21px -282px",height:"18px",width:"8px",left:0,top:0,"margin-top":"-6px"},"BOX-h IND1-mouseover,BOX-h IND2-mouseover":{$order:2,"background-position":"-31px -282px"},"BOX-h IND1-mousedown,BOX-h IND2-mousedown":{$order:3,"background-position":"-41px -282px"},"BOX-v DECREASE, BOX-v INCREASE":{$order:10,left:"50%",width:"17px",height:"17px","margin-left":"-8px"},"BOX-v DECREASE":{$order:10,top:0,"background-position":"-120px -70px"},"BOX-v INCREASE":{$order:10,bottom:0,"background-position":"-140px -70px"},"BOX-v DECREASE-mouseover":{$order:11,"background-position":"-120px -90px"},"BOX-v DECREASE-mousedown":{$order:12,"background-position":"-120px -110px"},"BOX-v INCREASE-mouseover":{$order:11,"background-position":"-140px -90px"},"BOX-v INCREASE-mousedown":{$order:12,"background-position":"-140px -110px"},"BOX-v BG":{$order:10,left:"50%"},"BOX-v IND, BOX-v RULER":{$order:10,"z-index":1,left:"50%",width:"6px","margin-left":"-3px"},"BOX-v RULER, BOX-v RULERLEFT, BOX-v RULERRIGHT":{background:linb.UI.$bg("bar_horizontal.gif","repeat-y",true)},"BOX-v RULER":{$order:10,"background-position":"-482px top"},"BOX-v RULERLEFT, BOX-v RULERRIGHT":{$order:10,"z-index":1,width:"6px",height:"5px"},"BOX-v RULERLEFT":{$order:12,"background-position":"-490px top",top:"-4px",left:0},"BOX-v RULERRIGHT":{$order:12,"background-position":"-474px top",bottom:"-4px",left:0},"BOX-v IND1,BOX-v IND2":{$order:10,"z-index":2,"background-position":"left -272px",width:"18px",height:"8px",left:0,top:0,"margin-left":"-6px"},"BOX-v IND1-mouseover,BOX-v IND2-mouseover":{$order:11,"background-position":"left -282px"},"BOX-v IND1-mousedown,BOX-v IND2-mousedown":{$order:12,"background-position":"left -292px"}},Behaviors:{HoverEffected:{IND1:"IND1",IND2:"IND2",DECREASE:"DECREASE",INCREASE:"INCREASE"},ClickEffected:{IND1:"IND1",IND2:"IND2",DECREASE:"DECREASE",INCREASE:"INCREASE"},onSize:linb.UI.$onSize,IND:{onClick:function(profile,e,src){var p=profile.properties,p1=linb.use(src).offset(),p2=linb.Event.getPos(e),arr=profile.box._v2a(profile,profile.properties.$UIvalue),i1,i2,type=p.type=="vertical",k1=type?"top":"left",k2=type?"offsetTop":"offsetLeft",k3=type?"offsetHeight":"offsetWidth",cur=p2[k1]-p1[k1],v=(cur/linb.use(src).get(0)[k3])*100;if(!p.isRange){arr[0]=v}else{i1=profile.getSubNode("IND1")[k2](),i2=profile.getSubNode("IND2")[k2]();if(Math.abs(i1-cur)<Math.abs(i2-cur)){arr[0]=v}else{arr[1]=v}}profile.boxing().setUIValue(profile.box._adjustValue(profile,arr))}},IND1:{onKeydown:function(profile,e,src){var p=profile.properties,type=p.type=="vertical",key=linb.Event.getKey(e)[0];if(key==(type?"up":"left")){profile.box._auto(profile,false)}if(key==(type?"down":"right")){profile.box._auto(profile,true)}},onKeyout:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onKeyup:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onMousedown:function(profile,e,src){var p=profile.properties,type=p.type=="vertical",k2=type?"offsetTop":"offsetLeft",k3=type?"offsetHeight":"offsetWidth",box=profile.box;linb.use(src).startDrag(e,{widthIncrement:p.steps?profile._size/p.steps:null,dragType:"none",targetReposition:true,horizontalOnly:type?true:null,verticalOnly:type?null:true,maxLeftOffset:linb.use(src).get(0)[k2],maxRightOffset:linb.use(src).parent().get(0)[k3]-linb.use(src).get(0)[k2],dragCursor:"default"});linb.use(src).css("zIndex",10).focus();profile.getSubNode("IND2").css("zIndex",5)},beforeDragbegin:function(profile,e,src){var type=profile.properties.type=="vertical";linb(src)[type?"top":"left"](profile.__x=linb.use(src).get(0)[type?"offsetTop":"offsetLeft"])},onDrag:function(profile,e,src){var offset=linb.DragDrop.getProfile().offset,type=profile.properties.type=="vertical",arr=profile.box._v2a(profile,profile.properties.$UIvalue);arr[0]=((profile.__x+offset[type?"y":"x"])/linb.use(src).parent().get(0)[type?"offsetHeight":"offsetWidth"])*100;profile.boxing().setUIValue(profile.box._adjustValue(profile,arr))},onDragstop:function(profile,e,src){linb(src).onMouseout(true,{$force:true}).onMouseup(true)},onClick:function(){return false}},IND2:{onKeydown:function(profile,e,src){var p=profile.properties,type=p.type=="vertical",key=linb.Event.getKey(e)[0];if(key==(type?"up":"left")){profile.box._auto(profile,false)}if(key==(type?"down":"right")){profile.box._auto(profile,true)}},onKeyout:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onKeyup:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onMousedown:function(profile,e,src){var p=profile.properties,type=p.type=="vertical",k2=type?"offsetTop":"offsetLeft",k3=type?"offsetHeight":"offsetWidth",box=profile.box;linb.use(src).startDrag(e,{widthIncrement:p.steps?profile._size/p.steps:null,dragType:"none",targetReposition:true,horizontalOnly:type?true:null,verticalOnly:type?null:true,maxLeftOffset:linb.use(src).get(0)[k2],maxRightOffset:linb.use(src).parent().get(0)[k3]-linb.use(src).get(0)[k2],dragCursor:"default"});linb.use(src).css("zIndex",10).focus();profile.getSubNode("IND1").css("zIndex",5)},beforeDragbegin:function(profile,e,src){var type=profile.properties.type=="vertical";linb(src)[type?"top":"left"](profile.__x=linb.use(src).get(0)[type?"offsetTop":"offsetLeft"])},onDrag:function(profile,e,src){var offset=linb.DragDrop.getProfile().offset,type=profile.properties.type=="vertical",arr=profile.box._v2a(profile,profile.properties.$UIvalue);arr[1]=((profile.__x+offset[type?"y":"x"])/linb.use(src).parent().get(0)[type?"offsetHeight":"offsetWidth"])*100;profile.boxing().setUIValue(profile.box._adjustValue(profile,arr))},onDragstop:function(profile,e,src){linb(src).onMouseout(true,{$force:true}).onMouseup(true)},onClick:function(){return false}},RULERRIGHT:{onClick:function(profile,e,src){var p=profile.properties,b=profile.boxing(),c=profile.box,arr=c._v2a(profile,p.$UIvalue);if(!p.isRange){arr[0]=100}else{arr[1]=100}b.setUIValue(profile.box._adjustValue(profile,arr))}},DECREASE:{onMousedown:function(profile){profile.box._auto(profile,false)},onMouseout:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onMouseup:function(profile){linb.Thread.abort(profile.$linbid+":auto")}},INCREASE:{onMousedown:function(profile){profile.box._auto(profile,true)},onMouseout:function(profile){linb.Thread.abort(profile.$linbid+":auto")},onMouseup:function(profile){linb.Thread.abort(profile.$linbid+":auto")}}},DataModel:{position:"absolute",width:{ini:200},height:{ini:50},steps:0,value:"0:0",type:{listbox:["vertical","horizontal"],ini:"horizontal",action:function(v){this.boxing().refresh()}},isRange:{ini:true,action:function(v){this.boxing().refresh()}},showIncreaseHandle:{ini:true,action:function(v){this.boxing().refresh()}},showDecreaseHandle:{ini:true,action:function(v){this.boxing().refresh()}}},_prepareData:function(profile){var d=arguments.callee.upper.call(this,profile),N="display:none";d._showDes=d.showDecreaseHandle?"":N,d._showIns=d.showIncreaseHandle?"":N,d._showD2=d.isRange?"":N;d._cls=profile.getClass("BOX",d.type=="vertical"?"-v":"-h");return d},_adjustValue:function(profile,value){var p=profile.properties,b=[];b[0]=parseFloat(value[0])||0;b[1]=parseFloat(value[1])||0;if(p.steps){value=100/p.steps;b[0]=Math.ceil(b[0]/value);if(p.isRange){b[1]=Math.ceil(b[1]/value)}}return b.join(":")},_ensureValue:function(profile,value){var p=profile.properties,a=String(value).split(":"),min=0,max=p.steps?p.steps:100,b=[],f1=function(a){return parseFloat(a)||0},f2=function(a){return Math.min(max,Math.max(min,a))};b[0]=f1(a[0]);if(p.isRange){b[1]=f1(a[1]);if(b[0]>b[1]){a=b[1];b[1]=b[0];b[0]=a}}b[0]=f2(b[0]);if(p.isRange){b[1]=f2(b[1])}return p.isRange?b.join(":"):(b[0]+"")},_v2a:function(profile,v){var steps=profile.properties.steps,t;v=typeof v=="string"?v.split(":"):v;v[0]=parseFloat(v[0])||0;v[1]=parseFloat(v[1])||0;if(steps){v[0]=v[0]*100/steps}if(steps){v[1]=v[1]*100/steps}if(v[0]>v[1]){t=v[0];v[1]=v[0];v[0]=t}return v},_auto:function(profile,flag){var id=profile.$linbid+":auto";if(linb.Thread.isAlive(id)){return }var p=profile.properties,t,off=(p.steps?100/p.steps:1)*(flag?1:-1),task={delay:300},arr=profile.box._v2a(profile,p.$UIvalue),fun=function(){arr[0]+=off;if(p.isRange){arr[1]+=off}profile.boxing().setUIValue(profile.box._adjustValue(profile,arr));task.delay*=0.8};task.task=fun;linb.Thread(id,[task],500,null,fun,null,true).start()},_onresize:function(profile,width,height){var p=profile.properties,type=p.type,f=function(k){return profile.getSubNode(k)},ruler=f("RULER"),ind=f("IND"),ru1=f("RULERLEFT");if(type=="vertical"){var w=ru1.height(),w1=p.showDecreaseHandle?f("DECREASE").height():0,w2=p.showIncreaseHandle?f("INCREASE").height():0,w3=f("IND1").height();if(height){ruler.top(w1+w).height(height-w1-w2-2*w);ind.top(w1).height(profile._size=height-w1-w2-w3)}}else{var w=ru1.width(),w1=p.showDecreaseHandle?f("DECREASE").width():0,w2=p.showIncreaseHandle?f("INCREASE").width():0,w3=f("IND1").width();if(width){ruler.left(w1+w).width(width-w1-w2-2*w);ind.left(w1).width(profile._size=width-w1-w2-w3)}}}}});Class("linb.UI.Dialog","linb.UI.Widget",{Instance:{show:function(parent,modal,left,top){parent=parent||linb("body");return this.each(function(profile){var t,pro=profile.properties,instance=profile.boxing(),fun=function(){var ins=profile.boxing();if(left||left===0){ins.setLeft(left)}if(top||top===0){ins.setTop(top)}parent.append(ins);var box=profile.box,root=profile.getRoot();root.show(left?(parseInt(left)||0)+"px":null,top?(parseInt(top)||0)+"px":null);if(modal&&!profile.$inModal){box._modal(profile)}ins.activate();if(profile.onShow){profile.boxing().onShow(profile)}if(profile.properties.status=="normal"){box._refreshRegion(profile)}delete profile.inShowing};if(profile.inShowing){return }profile.inShowing=1;if(t=pro.fromRegion){linb.Dom.animate({border:"dashed 1px #ff0000"},{left:[t.left,pro.left],top:[t.top,pro.top],width:[t.width,pro.width],height:[t.height,pro.height]},null,fun,360,12,"expoIn").start()}else{fun()}})},hide:function(){this.each(function(profile){var pro=profile.properties,box=profile.box,root=profile.getRoot();if(profile.inHiding){return }profile.inHiding=1;if(profile.$inModal){box._unModal(profile)}if(pro.status=="max"||pro.status=="min"){box._restore(profile)}root.hide();var t=pro.fromRegion,fun=function(){delete profile.inHiding};if(t){linb.Dom.animate({border:"dashed 1px #ff0000"},{left:[pro.left,t.left],top:[pro.top,t.top],width:[pro.width,t.width],height:[pro.height,t.height]},null,fun,360,12,"expoOut").start()}else{fun()}});return this},close:function(){return this.each(function(profile){if(profile.beforeClose&&false===profile.boxing().beforeClose(profile)){return }if(profile.inClosing){return }profile.inClosing=1;var pro=profile.properties,t=pro.fromRegion,fun=function(){profile.boxing().destroy();delete profile.inClosing};if(t){linb.Dom.animate({border:"dashed 1px #ff0000"},{left:[pro.left,t.left],top:[pro.top,t.top],width:[pro.width,t.width],height:[pro.height,t.height]},null,fun,360,12,"expoOut").start()}else{fun()}})},activate:function(flag){var profile=this.get(0);profile.box._active(profile,flag);if(flag!==false){_.resetRun("dlg_focus:"+profile.$linbid,function(){profile.getRoot().nextFocus()})}}},Initialize:function(){var ns=this,t=ns.getTemplate();_.merge(t.FRAME.BORDER,{TBAR:{tagName:"div",className:"uibar-top",TBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",TBARTR:{tagName:"tr",TBARTDL:{tagName:"td",className:"uibar-tdl"},TBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},TBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}},BARCMDL:{tagName:"div",className:"uibar-cmdl",ICON:{$order:0,className:"ui-icon {imageClass}",style:"{backgroundImage} {backgroundPosition} {imageDisplay}"},CAPTION:{$order:1,text:"{caption}"}},BARCMDR:{tagName:"div",className:"uibar-cmdr",onselectstart:"return false",unselectable:"on",OPT:{className:"uicmd-opt",style:"{optDisplay}",$order:1},PIN:{$order:2,className:"uicmd-pin",style:"{pinDisplay}"},LAND:{$order:3,className:"uicmd-land",style:"{landDisplay}"},MIN:{$order:4,className:"uicmd-min",style:"{minDisplay}"},RESTORE:{$order:5,className:"uicmd-restore",style:"display:none;"},MAX:{$order:6,className:"uicmd-max",style:"{maxDisplay}"},CLOSE:{$order:7,className:"uicmd-close ",style:"{closeDisplay}"}}},MAIN:{$order:2,tagName:"div",className:"uicon-main",MAINI:{tagName:"div",className:"uicon-maini",PANEL:{tagName:"div",text:"{html}"+linb.UI.$childTag}}},BBAR:{$order:3,tagName:"div",className:"uibar-bottom",BBART:{cellpadding:"0",cellspacing:"0",width:"100%",border:"0",tagName:"table",className:"uibar-t",BBARTR:{tagName:"tr",BBARTDL:{tagName:"td",className:"uibar-tdl"},BBARTDM:{$order:1,width:"100%",tagName:"td",className:"uibar-tdm"},BBARTDR:{$order:2,tagName:"td",className:"uibar-tdr"}}}}},"all");ns.setTemplate(t);linb.alert=ns.alert;linb.confirm=ns.confirm;linb.pop=ns.pop;linb.prompt=ns.prompt},Static:{Appearances:{KEY:{overflow:"visible"},PANEL:{position:"relative",overflow:"auto","font-size":"12px","line-height":"14px"},CAPTION:{"font-size":"12px",display:"inline","vertical-align":"middle"},BORDER:{position:"relative","font-size":0,"line-height":0}},Behaviors:{DropableKeys:["PANEL"],DragableKeys:["LAND"],HoverEffected:{OPT:"OPT",PIN:"PIN",MIN:"MIN",MAX:"MAX",RESTORE:"RESTORE",CLOSE:"CLOSE",LAND:"LAND"},ClickEffected:{OPT:"OPT",PIN:"PIN",MIN:"MIN",MAX:"MAX",RESTORE:"RESTORE",CLOSE:"CLOSE",LAND:"LAND"},onMousedown:function(profile,e){profile.box._active(profile)},onDragstop:function(profile){var pos=profile.getRoot().cssPos(),p=profile.properties;p.left=pos.left;p.top=pos.top},TBAR:{onMousedown:function(profile,e,src){if(profile.getKey(linb.Event.getSrc(e).parentNode.id)==profile.keys.BARCMDR){return }if(profile.properties.movable&&!profile._locked){profile.box._active(profile);profile.getRoot().startDrag(e,{dragDefer:1,maxTopOffset:profile.getRoot().top(),maxLeftOffset:profile.getRoot().left(),targetOffsetParent:profile.getRoot().parent()})}},onDblclick:function(profile,e,src){if(profile.getKey(linb.Event.getSrc(e).parentNode.id)==profile.keys.BARCMDR){return }if(!profile.properties.maxBtn){return }if(profile.properties.status=="max"){profile.box._restore(profile)}else{profile.box._max(profile)}}},PIN:{onClick:function(profile,e,src){var key=profile.keys.PIN,t=profile.properties;t.pinned=!t.pinned;profile.getSubNode("PIN").tagClass("-checked",t.pinned);profile._locked=t.pinned;if(t.resizer){if(!t.pinned){if(t.status!="min"&&profile.$resizer){profile.$resizer.show()}}else{if(profile.$resizer){profile.$resizer.hide()}}}}},MIN:{onClick:function(profile,e,src){profile.box._min(profile)}},MAX:{onClick:function(profile,e,src){profile.box._max(profile)}},RESTORE:{onClick:function(profile,e,src){profile.box._restore(profile)}},OPT:{onClick:function(profile,e,src){profile.boxing().onShowOptions(profile,e,src)}},CLOSE:{onClick:function(profile,e,src){profile.boxing().close()}}},DataModel:{tips:null,border:null,disabled:null,dock:{hidden:true},html:{action:function(v){this.getSubNode("PANEL").html(v)}},caption:{ini:undefined,action:function(value){this.getSubNode("CAPTION").get(0).innerHTML=value}},image:{action:function(value){this.getSubNode("ICON").css("display",value?"":"none").css("backgroundImage","url("+(value||"")+")")}},imagePos:{action:function(value){this.getSubNode("ICON").css("backgroundPosition",value)}},shadow:true,resizer:true,movable:true,minBtn:{ini:true,action:function(v){var o=this.getSubNode("MIN");if(v){o.setInlineBlock()}else{o.css("display","none")}}},maxBtn:{ini:true,action:function(v){var o=this.getSubNode("MAX");if(v){o.setInlineBlock()}else{o.css("display","none")}}},optBtn:{ini:false,action:function(v){this.getSubNode("OPT").css("display",v?"":"none")}},closeBtn:{ini:true,action:function(v){var o=this.getSubNode("CLOSE");if(v){o.setInlineBlock()}else{o.css("display","none")}}},pinBtn:{ini:true,action:function(v){var o=this.getSubNode("PIN");if(v){o.setInlineBlock()}else{o.css("display","none")}}},landBtn:{ini:false,action:function(v){var o=this.getSubNode("LAND");if(v){o.setInlineBlock()}else{o.css("display","none")}}},width:300,height:300,minWidth:200,minHeight:100,position:"absolute",fromRegion:{hidden:true,ini:null},status:{ini:"normal",listbox:["normal","min","max"],action:function(v,o){var self=this,b=self.box;if(v=="min"){b._min(self,o)}else{if(v=="max"){b._max(self,o)}else{b._restore(self,o)}}}}},EventHandlers:{onShow:function(profile){},beforeClose:function(profile){},onShowOptions:function(profile,e,src){}},RenderTrigger:function(){this.destroyTrigger=function(){var s=this;if(s.$inModal){s.box._unModal(s)}}},LayoutTrigger:function(){var self=this,t=self.properties,b=self.box;if(t.status=="min"){b._min(self)}else{if(t.status=="max"){b._max(self)}else{linb.UI.$tryResize(self,t.width,t.height)}}},_prepareData:function(profile){var data=arguments.callee.upper.call(this,profile),nodisplay="display:none";data.minDisplay=data.minBtn?"":nodisplay;data.maxDisplay=data.maxBtn?"":nodisplay;data.optDisplay=data.optBtn?"":nodisplay;data.closeDisplay=data.closeBtn?"":nodisplay;data.pinDisplay=data.pinBtn?"":nodisplay;data.landDisplay=data.landBtn?"":nodisplay;data.statusDisplay=data.statusDisplay?"":nodisplay;data.statusHeight="height:"+data.statusHeight+"px";var status=profile.properties.status;if(status=="min"||status=="max"){profile.$noR=profile.$noS=1}return data},_min:function(profile,status){var o=profile.getRoot(),box=profile.box,p=o.parent(),t=profile.properties;if(!status){status=t.status}if(status=="max"){box._unMax(profile)}else{box._refreshRegion(profile)}profile.getSubNodes(["PANEL","STATUS"]).css("display","none");if(t.minBtn){profile.getSubNode("RESTORE").setInlineBlock();profile.getSubNode("MIN").css("display","none")}if(t.resizer&&profile.$resizer){profile.$resizer.hide()}if(t.shadow){profile.boxing()._unShadow(false)}t.status="min";var h1=o.height(),h2=profile.getSubNode("BORDER").height(),h=profile.getSubNode("TBAR").height();o.cssSize({width:t.minWidth,height:h+h1-h2},true)},_max:function(profile,status){var o=profile.getRoot(),box=profile.box,ins=profile.boxing(),p=o.parent(),t=profile.properties;if(!status){status=t.status}if(status=="min"){box._unMin(profile)}else{box._refreshRegion(profile)}if(t.pinBtn){profile.getSubNode("PIN").css("display","none")}if(t.maxBtn){profile.getSubNode("MAX").css("display","none");profile.getSubNode("RESTORE").setInlineBlock()}profile.old_m=t.movable;t.movable=false;if(t.resizer&&profile.$resizer){profile.$resizer.hide()}if(t.shadow){ins._unShadow(false)}t.status="max";ins.setDock("fill")},_restore:function(profile,status){var o=profile.getRoot(),box=profile.box,t=profile.properties;if(!status){status=t.status}if(status=="max"){box._unMax(profile)}if(status=="min"){box._unMin(profile)}profile.getSubNode("RESTORE").css("display","none");t.status="normal"},_unMax:function(profile){var t=profile.properties,ins=profile.boxing();profile.getSubNode("MAX").setInlineBlock();if(t.pinBtn){profile.getSubNode("PIN").setInlineBlock()}t.movable=profile.old_m;if(t.shadow){ins._shadow()}if(t.resizer&&!t.pinned){if(profile.$resizer){profile.$resizer.show()}else{ins._resizer()}}ins.setDock("none");linb.UI.$tryResize(profile,t.width,t.height,true)},_unMin:function(profile){var t=profile.properties,ins=profile.boxing();profile.getSubNodes(["PANEL","STATUS"]).css("display","block");profile.getSubNode("MIN").setInlineBlock();if(t.shadow){ins._shadow()}if(t.resizer&&!t.pinned){if(profile.$resizer){profile.$resizer.show()}else{ins._resizer()}}profile.getRoot().cssSize({width:t.width,height:t.height});linb.UI.$tryResize(profile,t.width,t.height,true)},_active:function(profile,flag){var self=this;if(flag!==false&&self.activeWndId==profile.$linbid){return }self._deActive();if(flag!==false){var o=linb(profile.domId),t1=o.topZindex(),t2=o.css("zIndex");o.css("zIndex",t1>t2?t1:t2);profile.getSubNode("TBAR").tagClass("-focus");self.activeWndId=profile.$linbid}},_deActive:function(){var profile;if(profile=linb.UI._cache["$"+this.activeWndId]){profile.getSubNode("TBAR").tagClass("-focus",false)}delete this.activeWndId},_modal:function(profile){var s=profile.getRoot(),temp,p=s.parent(),cover;if(!p.isEmpty()){if(!profile.$inModal){if(!profile.$modalDiv){profile.$modalDiv=new linb.UI.Div({position:"absolute"}).setCustomStyle({KEY:"overflow:hidden;display:block;z-index:0;cursor:wait;background-image:url("+linb.ini.path+"bg.gif)"})}cover=profile.$modalDiv;p.append(cover);cover.setDock("cover",true);cover=cover.reBoxing();cover.css("display","block").onMousedown(function(){return false}).topZindex(true);s.css("zIndex",(parseInt(cover.css("zIndex"))||0)+1);linb.Event.pushTabOutTrigger(profile.renderId,function(){linb([profile.renderId]).nextFocus()});profile.$inModal=true}}},_unModal:function(profile){if(profile.$inModal){profile.$modalDiv.setDock("none");profile.getRoot().css("zIndex",0);profile.getSubNode("BORDER").append(profile.$modalDiv.reBoxing().css("display","none"));profile.$inModal=false;linb.Event.popTabOutTrigger()}},_refreshRegion:function(profile){if(!profile.renderId){return }var pro=profile.properties;return _.merge(pro,profile.getRoot().cssRegion(),function(o,i){return pro[i]!="auto"})},_adjust:function(dialog,caption,content,left,top){caption=caption||"";if(!content){content=caption;caption=""}var node=dialog.$div.reBoxing(),ID="linb:temp:dialog",me=arguments.callee,w,h;if(!linb.Dom.byId(ID)){n2=me._cache=node.clone(false);linb("body").append(n2);n2.css({width:"auto",height:"auto",overflow:"visible",position:"absolute",visibility:"visible",left:linb.Dom.HIDE_VALUE}).id(ID,true)}var n2=me._cache;n2.html(content,false);var size=n2.cssSize();node.html(content);if(size.width>500){size.width=500;n2.width(500);size.height=n2.offsetHeight()+10;n2.width("auto")}if(size.height>400){size.height=400}if(size.width<150){size.width=150}if(size.height<30){size.height=30}node.cssSize(size).css("overflow","auto").show();w=size.width+30;h=size.height+90;dialog.setCaption(caption).setWidth(w).setHeight(h);dialog.$cmd.reBoxing().left((size.width+30-dialog.$cmd.reBoxing().width())/2);linb.UI.$doResize(dialog.get(0),w,h)},alert:function(title,content,onClose,left,top){var me=arguments.callee,dialog;if(!(dialog=me.dialog)||(!dialog.get(0).renderId)){dialog=me.dialog=new linb.UI.Dialog({minBtn:false,maxBtn:false,pinBtn:false,resizer:false,left:200,top:200},{beforeClose:function(){dialog.hide();_.tryF(me.onClose);me.onClose=null;return false}});var cmd=dialog.$cmd=new linb.UI.Div({bottom:10,width:60,height:24}),btn=dialog.$btn=new linb.UI.SButton({caption:"$inline.ok",width:60,tabindex:1},{onClick:function(){dialog.hide();_.tryF(me.onClose);me.onClose=null}});cmd.append(btn);var div=dialog.$div=new linb.UI.Div({left:10,top:10});dialog.append(cmd).append(div).render()}me.onClose=onClose;linb.UI.Dialog._adjust(dialog,title,content);dialog.show(linb("body"),true,left,top);_.resetRun("dlg_focus:"+dialog.get(0).$linbid,function(){dialog.$btn.activate()});return dialog},confirm:function(title,caption,onYes,onNo,left,top){var me=arguments.callee,dialog;if(!(dialog=me.dialog)||(!dialog.get(0).renderId)){dialog=me.dialog=new linb.UI.Dialog({minBtn:false,maxBtn:false,pinBtn:false,resizer:false,left:200,top:200},{beforeClose:function(){dialog.hide();_.tryF(me.onNo);me.onYest=me.onNo=null;return false}});var cmd=dialog.$cmd=new linb.UI.Div({bottom:10,width:140,height:24}),btn=new linb.UI.SButton({caption:"$inline.yes",width:60,tabindex:1,left:0},{onClick:function(){dialog.hide();_.tryF(me.onYes);me.onYest=me.onNo=null}});cmd.append(btn);btn=dialog.$btn=new linb.UI.SButton({caption:"$inline.no",tabindex:1,width:60,left:80},{onClick:function(){dialog.hide();_.tryF(me.onNo);me.onYest=me.onNo=null}});cmd.append(btn);var div=dialog.$div=new linb.UI.Div({left:10,top:10});dialog.append(cmd).append(div).render()}me.onYes=onYes;me.onNo=onNo;linb.UI.Dialog._adjust(dialog,title,caption);dialog.show(linb("body"),true,left,top);_.resetRun("dlg_focus:"+dialog.get(0).$linbid,function(){dialog.$btn.activate()});return dialog},pop:function(title,content,cmdStr,left,top){var dialog=new linb.UI.Dialog({minBtn:false,maxBtn:false,pinBtn:false,resizer:false,left:200||left,top:200||top}),cmd=dialog.$cmd=new linb.UI.Div({bottom:10,width:"auto",height:24,CS:"text-align:center;"}).append(dialog.$btn=new linb.UI.SButton({caption:cmdStr||"$inline.ok",tabindex:1,position:"relative"},{onClick:function(){dialog.destroy()}})),div=dialog.$div=new linb.UI.Div({left:10,top:10,width:80}).setCustomStyle({KEY:"overflow:visible"});dialog.append(cmd).append(div).render();linb.UI.Dialog._adjust(dialog,title,content);dialog.show(linb("body"),false,left,top);_.resetRun("dlg_focus:"+dialog.get(0).$linbid,function(){dialog.$btn.activate()});return dialog},prompt:function(title,caption,content,onYes,onNo,left,top){var dialog,me=arguments.callee;if(!(dialog=me.dialog)||(!dialog.get(0).renderId)){var close=function(){me.$inp.setValue("");me.onYes=me.onNo=null;me.dialog.hide();return false};dialog=me.dialog=new linb.UI.Dialog({minBtn:false,maxBtn:false,pinBtn:false,resizer:false,left:200,top:200,width:300,height:130},{beforeClose:function(){_.tryF(me.onNo);return close()}});var con=me.$con=new linb.UI.Div({top:4,left:10,width:270,height:18}),cmd=new linb.UI.Div({top:65,width:270,height:24}).setCustomStyle("KEY","text-align:center;").append(new linb.UI.SButton({caption:"$inline.ok",width:60,left:70,tabindex:1},{onClick:function(){_.tryF(me.onYes,[me.$inp.getUIValue()]);return close()}}));cmd.append(new linb.UI.SButton({caption:"$inline.cancel",tabindex:1,left:140,width:60},{onClick:function(){_.tryF(me.onNo);return close()}}));var inp=me.$inp=new linb.UI.Input({left:10,top:22,width:270,height:36,multiLines:true});dialog.append(con).append(cmd).append(inp).render()}dialog.setCaption(title||"Prompt");me.$con.setHtml(caption||"");me.$inp.setValue(content||"",true);me.onYes=onYes;me.onNo=onNo;dialog.show(linb("body"),true,left,top);_.resetRun("dlg_focus:"+dialog.get(0).$linbid,function(){me.$inp.activate()});return dialog},_onresize:function(profile,width,height,force){var size=arguments.callee.upper.apply(this,arguments),isize={},v1=profile.getSubNode("TBAR"),v2=profile.getSubNode("PANEL"),v4=profile.getSubNode("BBAR"),v5=profile.getSubNode("MAIN"),v6=profile.getSubNode("MAINI"),h1,h4,t;if(height){if(height=="auto"){isize.height=height}else{h1=v1.height(),h4=v4.height();if((t=size.height-h1-h4)>0){isize.height=t}}}if(width){isize.width=size.width-(parseInt(v6.css("paddingRight"))||0)-(parseInt(v5.css("paddingLeft"))||0)}v2.cssSize(isize,true)}}});Class("linb.UI.TextEditor",["linb.UI.Widget","linb.absValue"],{Instance:{activate:function(){var profile=this.get(0);profile.getSubNode("INPUT").focus();return this},_setCtrlValue:function(value){if(_.isNull(value)||!_.isDefined(value)){value=""}return this.each(function(profile){var node=profile.getSubNode("INPUT").get(0);if(node.value.replace(/(\r\n|\r)/g,"\n")!=value.replace(/(\r\n|\r)/g,"\n")){var st=node.scrollTop;node.value=value;node.scrollTop=st}})},_getCtrlValue:function(value){var profile=this.get(0);return profile.getSubNode("INPUT").attr("value").replace(/(\r\n|\r)/g,"\n").replace(/( +)(\n)/g,"$2").replace(/\t/g,"    ")}},Initialize:function(){var t=this.getTemplate();_.merge(t.FRAME.BORDER,{BOX:{tagName:"div",INPUT:{tagName:"textarea",tabindex:"{tabindex}",style:"{_css}"}},BAK1:{},BAK2:{tagName:"div"}},"all");this.setTemplate(t)},Static:{Appearances:{BOX:{width:"100%",height:"100%",left:0,top:0,position:"absolute",overflow:linb.browser.gek?"auto":"","z-index":"10"},INPUT:{"font-family":"Courier New, Courier, monospace","font-size":"12px","line-height":"14px",position:"absolute","background-color":"#fff",left:0,top:0,border:0,margin:0,padding:0,overflow:"auto","overflow-y":"auto","overflow-x":"hidden"},"BAK1, BAK2":{"font-family":"Courier New, Courier, monospace","font-size":"12px",position:"absolute",visibility:"hidden",left:"-10000px",top:"-10000px"}},Behaviors:{INPUT:{onFocus:function(profile,e,src){profile.box._onchange(profile,linb.use(src).get(0))},onChange:function(profile,e,src){profile.boxing().setUIValue(linb.use(src).get(0).value);profile.box._onchange(profile,linb.use(src).get(0))},afterKeydown:function(profile,e,src){var pro=profile.properties,str,t;if(pro.disabled||pro.readonly){return }if(profile.$change){delete profile.$change}var key=linb.Event.getKey(e),node=linb.use(src).get(0),k=key[0];switch(k){case"tab":var r=linb.use(src).caret(),sel=node.value.slice(r[0],r[1]);if(/(\n|\r)/.test(sel)){str=node.value.slice(0,r[0]);if(sel.charAt(0)!="\n"&&sel.charAt(0)!="\r"){sel=str.slice(r[0]=str.lastIndexOf("\n"))+sel}if(linb.browser.ie){t=(t=str.match(/\r/g))?t.length:0;r[0]-=t;t=(t=(node.value.slice(0,r[1])).match(/\r/g))?t.length:0;r[1]-=t}linb.use(src).caret(r[0],r[1]);if(key[2]){sel=sel.replace(/(\n|\n\r)    /g,"$1")}else{sel=sel.replace(/(\n|\n\r)/g,"$1    ")}profile.box.insertAtCaret(profile,sel);r[1]=r[0]+sel.length;if(linb.browser.ie){t=(t=sel.match(/\r/g))?t.length:0;r[1]-=t}linb.use(src).caret(r[0],r[1])}else{if(key[2]){linb.use(src).caret(r[0]-4,r[0]-4);r[0]-=4;r[1]-=4}else{profile.box.insertAtCaret(profile,"    ");r[0]+=4;r[1]+=4}}profile.$pos=r;return false;case"enter":var paras=profile.box.getParas(profile);str=paras[1];var len=str.length-_.str.ltrim(str).length;if(str.charAt(str.length-1)=="{"){len+=4}if(len){profile.box.insertAtCaret(profile,"\n"+_.str.repeat(" ",len));profile.$enter=true;return false}break;default:if(profile.tips){profile.tips.destroy();profile.tips=null}}node=null},afterKeypress:function(profile,e,src){if(profile.properties.disabled||profile.properties.readonly){return }var key=linb.Event.getKey(e),k=key[0];var me=arguments.callee,map=me.map||(me.map={space:1,enter:1,backspace:1,tab:1,"delete":1});if(k.length==1||map[k]){profile.$change=true}switch(k){case"tab":if(linb.browser.opr){_.asyRun(function(){linb.use(src).caret(profile.$pos[0],profile.$pos[1])})}return false;case"enter":if(profile.$enter){delete profile.$enter;return false}case"}":if(key[2]){var paras=profile.box.getParas(profile);var loc=paras[0],str=paras[1],pos=paras[2],input=paras[3];if(/ {4}$/.test(str)){var st=linb(src).scrollTop();input.value=input.value.substr(0,loc).replace(/ {4}$/,"}")+input.value.substr(loc,input.value.length);linb(input).onChange();profile.box.setCaretTo(input,loc-4+1,st);return false}}break}},afterKeyup:function(profile,e,src){var key=linb.Event.getKey(e),k=key[0];var me=arguments.callee,map=me.map||(me.map={space:1,enter:1,backspace:1,tab:1,"delete":1});if(k.length==1||map[k]){profile.$change=true}if(profile.$change){delete profile.$change;profile.box._onchange(profile,linb.use(src).get(0))}}}},DataModel:{left:0,top:0,width:200,height:200,position:"absolute",disabled:{ini:false,action:function(v){b.boxing().setReadonly(v)}},readonly:{ini:false,action:function(v){this.getSubNode("INPUT").attr("readonly",v).css("background",v?"#EBEADB":"")}}},EventHandlers:{onChange:function(profile,oV,nV){}},RenderTrigger:function(){var ns=this;if(ns.properties.readonly){ns.boxing().setReadonly(true,true)}var ie=linb.browser.ie,src=ns.getSubNode("INPUT").get(0),f=function(o){if(ie&&o.propertyName!="value"){return true}var src=ie?o.srcElement:this;ns.box._onchange(ns,src)};if(ie){src.attachEvent("onpropertychange",f);src.attachEvent("ondrop",f);ns.$ondestory=function(){src.detachEvent("onpropertychange",f);src.detachEvent("ondrop",f)}}else{src.addEventListener("input",f,false);src.addEventListener("dragdrop",f,false);ns.$ondestory=function(){src.removeEventListener("input",f,false);src.addEventListener("dragdrop",f,false)};ns.getSubNode("BOX").$firfox2()}},_onchange:function(profile,src){if(profile.onChange){var v=src.id;_.resetRun(profile.$linbid+"_drop",function(){v=linb.Dom.byId(v).value||"";profile.$prevV=profile.$prevV||"";if(v!=profile.$prevV){profile.boxing().onChange(profile,profile.$prevV,v);profile.$prevV=v}})}},_prepareData:function(profile){var d=arguments.callee.upper.call(this,profile);if(linb.browser.kde){d._css="resize:none;"}return d},_onresize:function(profile,width,height){var size=arguments.callee.upper.apply(this,arguments);profile.getSubNode("BOX").cssSize(size);profile.getSubNode("INPUT").cssSize(size)},insertAtCaret:function(profile,text){var input=profile.getSubNode("INPUT"),scrollTop=input.scrollTop()||null,ret;input.onChange();ret=input.caret(text);this.setCaretTo(input.get(0),ret||0,scrollTop)},setCaretTo:function(input,pos,scrollTop){input.focus();var s,c,h,o=linb([input]);if(_.isNumb(scrollTop)){o.scrollTop(scrollTop)}if(scrollTop===true){if(o.get(0).tagName.toLowerCase()=="textarea"&&o.scrollHeight()!==o.offsetHeight()){s=o.attr("value").substr(0,pos);c=o.clone().id("").css({visibility:"hidden",position:"absolute",left:5000+"px"}).attr("value",s);linb("body").append(c);h=Math.max((c.scrollHeight()>c.offsetHeight())?c.scrollHeight()-30:0,0);o.scrollTop(h);c.remove()}}o.caret(pos,pos)},getParas:function(profile){var o=profile.getSubNode("INPUT"),me=arguments.callee,reg=me.reg||(me.reg=/\r\n/g),v=o.get(0).value,loc=o.caret();if(loc[0]<0){loc[0]=0}var l=0,m=v.substr(0,loc[0]).match(reg);if(m){l=m.length}v=v.replace(reg,"\n");var txt=v.substr(0,loc[0]-l);var li=txt.lastIndexOf("\n"),line=txt.substr(li+1,loc[0]-li),w=o.innerWidth(),bak1=profile.getSubNode("BAK1"),bak2=profile.getSubNode("BAK2");if(txt.charAt(txt.length-1)=="\n"){txt+="*"}bak2.width(w);var x=bak1.html(line.replace(/ /g,"&nbsp;"),false).width(),y=bak2.html(txt.replace(/\n/g,"<br />"),false).height()-o.scrollTop();if(x>w){bak2.html(line,false);var lbak=line;var bl=bak2.height();while(lbak){lbak=lbak.replace(/ [^ ]*$/,"");bak2.html(lbak,false);if(bak2.height()!=bl){break}}lbak=line.substr(lbak.length,line.length-lbak.length);x=bak1.html(lbak,true).width()}bak1.html("",false);bak2.html("",false);var pos=profile.getRoot().offset();pos.left+=x;pos.top+=y;return[loc[0],line,pos,o.get(0),txt]}}});Class("linb.UI.Calendar","linb.UI.DatePicker",{Initialize:function(){var self=this,id=linb.UI.$ID,cls=linb.UI.$CLS,cls2=cls+"-td-free",key=self.KEY;self.addTemplateKeys(["H","W","DH","DAY","DC","TBODY","TD"]);var colgroup='<colgroup><col width="2%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/><col width="14%"/></colgroup>',thead1='<thead><tr height="1%"><th id="'+key+"-H:"+id+':7" class="'+cls+'-h #H_CC#"></th>',thead2="</tr></thead>",th='<th id="'+key+"-H:"+id+':@" class="'+cls+'-h #H_CC#">@</th>',tbody1='<tbody id="'+key+"-TBODY:"+id+':" >',tbody2="</tbody>",tr1="<tr>",tr2="</tr>",td1='<th id="'+key+"-W:"+id+':@"  class="'+cls+'-w #W_CC#">@</th>',td2='<td id="'+key+"-TD:"+id+':@" class="'+cls+'-td ! #TD_CC#"  unselectable="on"  ><div id="'+key+"-DAY:"+id+':@" class="'+cls+'-day #DAY_CC#" unselectable="on" ><div id="'+key+"-DH:"+id+':@" class="'+cls+'-dh #DH_CC#" ></div><div id="'+key+"-DC:"+id+':@" class="'+cls+'-dc #DC_CC#" ></div></div></td>',body,i,j,k,l,a=[],b=[];for(i=0;i<7;i++){b[b.length]=th.replace(/@/g,i)}k=l=0;for(i=0;i<48;i++){j=i%8;a[a.length]=(j==0?tr1:"")+(j==0?td1:td2).replace(/@/g,j==0?l:k).replace("!",(j==1||j==7)?cls2:"")+(j==7?tr2:"");if(j!==0){k++}else{l++}}body=colgroup+thead1+b.join("")+thead2+tbody1+a.join("")+tbody2;self.setTemplate({tagName:"div",style:"{_style}",onselectstart:"return false",BORDER:{tagName:"div",BODY:{$order:1,tagName:"table",cellpadding:"0",cellspacing:"0",width:"100%",text:body}}})},Static:{Behaviors:{DropableKeys:["DAY"],HoverEffected:{},ClickEffected:{},onSize:linb.UI.$onSize,TD:{onClick:null}},DataModel:{handleHeight:null,tipsHeight:null,closeBtn:null,value:null,dataBinder:null,dateField:null,dock:"fill",width:200,height:200},_getLabelNodes:function(profile){return profile.$day1||(profile.$day1=profile.getSubNode("DH",true))},_getDayNodes:function(profile){return profile.$day2||(profile.$day2=profile.getSubNode("DAY",true))},Appearances:{"DAY, DC":{position:"relative"},DAY:{overflow:"hidden"},DC:{"text-align":"left"},"TD-checked":{}},_onresize:function(profile,width,height){var p=profile.properties,f=function(k){return profile.getSubNode(k)},t;if(height){f("BORDER").height(t=height);f("BODY").height(t);t=(t-16)/6-1;profile.box._getDayNodes(profile).height(t)}}}});Class("linb.UI.AdvResizer","linb.UI.Resizer",{Instance:{cssRegion:function(){var profile=this.get(0),target=profile._target,l,t,b,r,ll,tt,ww,hh,c=[];if(target){var purge=linb.$cache.domPurgeData;target._nodes.sort(function(x,y){x=parseInt(purge[x].element.style.zIndex)||0;y=parseInt(purge[y].element.style.zIndex)||0;return x>y?1:x==y?0:-1});target.each(function(o,i){var o=linb([o]);if(i===0){l=o.offsetLeft();t=o.offsetTop();r=l+(ww=o.offsetWidth());b=t+(hh=o.offsetHeight());c.push([{left:l,top:t},{width:ww,height:hh},o.id()])}else{l=Math.min(l,ll=o.offsetLeft());t=Math.min(t,tt=o.offsetTop());r=Math.max(r,ll+(ww=o.offsetWidth()));b=Math.max(b,tt+(hh=o.offsetHeight()));c.push([{left:ll,top:tt},{width:ww,height:hh},o.id()])}})}profile.regionBlocks=c;_.arr.each(c,function(o){o[0].left-=l;o[0].top-=t;o[1].width-=2;o[1].height-=2});return{l:l,t:t,b:b,r:r}},rePosSize:function(){var self=this;self.each(function(o){var t,t1=o.getRoot(),t2=o._target;if(!t2||t2.isEmpty()){return }if(!o.properties._attached){t=o.region=o.boxing().cssRegion();t1.cssPos({left:t.l,top:t.t}).offsetWidth(t.r-t.l).offsetHeight(t.b-t.t)}if(!o.regPool){o.regPool=linb()}if(t=o.regions){o.regPool.merge(t);t.css("display","none")}o.regions=linb();if(o.regionBlocks){var t,fun=function(p,e,src){var b=o.boxing(),t=b.getTarget(),key=linb.Event.$keyboard;if(o.onRegionClick&&false!==b.onRegionClick(o,e)){if(t._nodes.length>1){var tid=linb.getNodeData(src,"_tid");if(key&&key[2]){t._nodes.removeValue(tid);b.resetTarget(t)}else{b.focus(tid)}}}};_.arr.each(o.regionBlocks,function(v){if(!o.regPool.isEmpty()){t=o.regPool._nodes.pop();linb(t).cssPos(v[0]).cssSize(v[1])}else{t=_.str.toDom('<div style="position:absolute;border:dashed 1px blue;left:{l}px;top:{t}px;width:{w}px;height:{h}px;"></div>'.replace("{l}",v[0].left).replace("{t}",v[0].top).replace("{w}",v[1].width).replace("{h}",v[1].height));t.onClick(fun);t=t.get(0).$linbid}o.regions._nodes.push(t);linb.setNodeData(t,"_tid",v[2])});o.getRoot().append(o.regions.css("display","block"))}});self.focus();return self},getTarget:function(){return this.get(0)._target},resetTarget:function(target,flag){var self=this,profile=self.get(0),rb=self.reBoxing(),ids;if(profile.properties._attached){return }delete profile.$focus;if(target&&!target.isEmpty()){profile._target=target;self.rePosSize();rb.css({zIndex:linb.Dom.TOP_ZINDEX,display:"block"})}else{profile._target=linb();rb.css({zIndex:0,display:"none"})}if(target&&!target.isEmpty()){ids=[];target.reBoxing("UI").each(function(o,i){ids.push(o.$linbid)})}else{ids=null}if(flag!==false){profile.boxing().onItemsSelected(profile,ids,profile.$linbid)}return self},focus:function(id){var profile=this.get(0),index=-1;if(!profile.regions){return }profile.regions.css("border","dashed 1px blue");var arr=profile._target.get();if(id){index=_.arr.subIndexOf(arr,"id",id)}if(index==-1&&profile.$focus!==undefined){index=profile.$focus}if(index==-1&&arr.length>1){index=arr.length-1}if(index!=-1){profile.regions.css("border","dashed 1px blue");linb([profile.regions.get(index)]).css("border","solid 1px red");profile.$focus=index;if(profile.onFocusChange){profile.boxing().onFocusChange(profile,index)}}return this},getFocus:function(){return this.get(0).$focus},active:function(flag){return this.each(function(profile){profile.getSubNode("MOVE").css("backgroundPosition","-17px -244px");profile.getSubNodes(["LT","T","RT","R","RB","B","LB","L"]).css("background",linb.browser.ie?"url("+linb.ini.path+"bg.gif)":"#fff");if(flag!==false){profile.boxing().onActive(profile)}})},inActive:function(){return this.each(function(profile){if(profile.$onDrag){return }profile.getSubNode("MOVE").css("backgroundPosition","-34px -244px");profile.getSubNodes(["LT","T","RT","R","RB","B","LB","L"]).css("background","#808080")})}},Static:{DataModel:{dragArgs:null},EventHandlers:{onActive:function(profile){},onFocusChange:function(profile,index){},onItemsSelected:function(profile,ids){},onRegionClick:function(profile,e){}},_onMousedown:function(profile,e,src,ddparas){var ck=linb.Event.$keyboard;if(ck&&(ck[1]||(linb.browser.kde&&ck[0]==" "))){profile.boxing().resetTarget(null);var pos=linb.Event.getPos(e);var hash={dragDefer:1,dragType:"icon",targetLeft:pos.left+12,targetTop:pos.top+12,dragCursor:"pointer"};_.merge(hash,profile.properties.dragArgs,"all");hash.widthIncrement=hash.heightIncrement=0;hash.dragData.pos=profile.getRoot().cssPos();linb().startDrag(e,hash)}else{var hash,o,absPos,pos,posbak,size;if(profile.properties._attached){pos=linb.Event.getPos(e);linb.use(src).startDrag(e,{dragDefer:1,targetReposition:false,dragType:"blank",dragCursor:true,targetLeft:pos.left,targetTop:pos.top})}else{o=profile.getRoot();absPos=o.offset();pos=o.cssPos();posbak=_.copy(pos);if(ddparas.move){absPos=linb.Event.getPos(e)}else{size=o.cssSize();if(ddparas.left){if(ddparas.top){}else{if(ddparas.bottom){pos.top=pos.top+size.height}else{pos.top=pos.top+size.height/2}}}if(ddparas.right){pos.left=pos.left+size.width;if(ddparas.top){}else{if(ddparas.bottom){pos.top=pos.top+size.height}else{pos.top=pos.top+size.height/2}}}if(ddparas.top&&!ddparas.left&&!ddparas.right){pos.left=pos.left+size.width/2}if(ddparas.bottom&&!ddparas.left&&!ddparas.right){pos.left=pos.left+size.width/2;pos.top=pos.top+size.height}}if((t=profile.properties.dragArgs)&&(t=t.widthIncrement)){var offx=linb.DragDrop.$proxySize%t;if(ddparas.left){pos.left+=offx}else{if(ddparas.right){pos.left+=offx}else{if(ddparas.move){pos.left+=offx}}}pos.left+=parseInt((absPos.left-posbak.left)/t)*t}if((t=profile.properties.dragArgs)&&(t=t.heightIncrement)){var offy=linb.DragDrop.$proxySize%t;if(ddparas.top){pos.top+=offy}else{if(ddparas.bottom){pos.top+=offy}else{if(ddparas.move){pos.top+=offy}}}pos.top+=parseInt((absPos.top-posbak.top)/t)*t}var hash={dragDefer:1,targetReposition:false,dragType:"blank",dragCursor:true,targetLeft:pos.left,targetTop:pos.top};_.merge(hash,profile.properties.dragArgs,"all");hash.targetOffsetParent=profile._parent;hash.dragKey=null;linb.use(src).startDrag(e,hash)}}profile.boxing().active()},LayoutTrigger:function(){this.boxing().rePosSize()}}});Class("VisualJS","linb.Com",{Constructor:function(){var self=this,o=linb.message;arguments.callee.upper.apply(self,arguments);SPA=this;self.curProject=null;self.Message=[];linb.message=function(content){if(self.Message.length>20){self.Message.pop()}if(typeof content!="string"){content=String(content)}if(/</.test(content)){while(content!=(content=content.replace(/<[^<>]*>/g,""))){}}self.Message.unshift({id:_.id(),caption:content.length>50?content.substr(0,50)+"...":content,tips:content,image:CONF.img_app,imagePos:"-64px -64px"});self.toolbar.updateItem("info",{caption:"",label:content.length>50?content.substr(0,50)+"...":content});o.apply(null,arguments)};linb("body").css({height:"100%",overflow:"hidden"})},Instance:{events:{beforeCreated:function(){linb.Dom.setCover('<img src="'+linb.getPath("img/","loading.gif")+'" border="0"/><div>Created</div>')},onLoadBaseClass:function(com,threadid,key){linb.Dom.setCover('<img src="'+linb.getPath("img/","loading.gif")+'" border="0"/><div>Load Base Class: '+key+"</div>")},onIniResource:function(){linb.Dom.setCover('<img src="'+linb.getPath("img/","loading.gif")+'" border="0"/><div>Load Resource</div>')},onLoadReqiredClass:function(com,threadid,key){linb.Dom.setCover('<img src="'+linb.getPath("img/","loading.gif")+'" border="0"/><div>Load widgets: '+com.KEY+key+"</div>")},onReady:function(page){linb.ComFactory.setProfile(CONF.ComFactoryProfile);this.menubar.setItems([{id:"file",caption:"$VisualJS.menu.file",sub:[{id:"newproject",caption:"$VisualJS.menu.newproject",image:CONF.img_app,imagePos:"-32px top"},{id:"openproject",caption:"$VisualJS.menu.openproject",add:"Ctrl+Alt+O",image:CONF.img_app,imagePos:"-48px top"},{id:"closeproject",caption:"$VisualJS.menu.closeproject"},{type:"split"},{id:"saveall",caption:"$VisualJS.menu.saveall",add:"Ctrl+Alt+S",image:CONF.img_app,imagePos:"-96px top"}]},{id:"build",caption:"$VisualJS.menu.build",sub:[{id:"debug",caption:"$VisualJS.menu.debug",image:CONF.img_app,imagePos:"-239px -64px",add:"F9"},{id:"release",caption:"$VisualJS.menu.release",image:CONF.img_app,imagePos:"-144px top",add:"Ctrl+F9"}]},{id:"help",caption:"$VisualJS.menu.help",sub:[{id:"simple",caption:"$VisualJS.menu.simple"},{type:"split"},{id:"forum",caption:"$VisualJS.menu.forum"},{type:"split"},{id:"license",caption:"$VisualJS.menu.license",sub:[{id:"gpllicense",caption:"$VisualJS.menu.gpllicense"},{id:"clicense",caption:"$VisualJS.menu.clicense"},{id:"purchase",caption:"$VisualJS.menu.purchase"}]},{type:"split"},{id:"about",caption:"$VisualJS.menu.about"}]}]);this.toolbar.setItems([{id:"only",sub:[{id:"newproject",image:CONF.img_app,imagePos:"-32px top",tips:"$VisualJS.tool.newp"},{id:"openproject",image:CONF.img_app,imagePos:"-48px top",tips:"$VisualJS.tool.open"},{split:true},{id:"saveall",image:CONF.img_app,imagePos:"-96px top",tips:"$VisualJS.tool.saveall"},{split:true},{id:"debug",image:CONF.img_app,imagePos:"-239px -64px",tips:"$VisualJS.tool.debug"},{id:"release",image:CONF.img_app,imagePos:"-144px top",tips:"$VisualJS.tool.release"},{split:true},{id:"ec",dropButton:true,image:CONF.img_app,imagePos:"-98px -16px",tips:"$VisualJS.tool.ec"},{split:true},{id:"info",label:"$VisualJS.noMessage",tips:"$VisualJS.message"}]}]);this.floatLogo.setCustomStyle({KEY:"background-image:url("+linb.getPath("img/","logo.gif")+");position:absolute;top:0px;right:0px;width:120px;height:60px;z-index:100;cursor:pointer;"})},onRender:function(page){var key="prj",r="([&|?|#]|\\b)("+key+"=)([^&]*)([&]?)",a=location.href.match(new RegExp(r)),prj=_.isNull(a)?"":decodeURIComponent(a[3]);if(prj){prj=CONF.prjPath+prj;linb.request(CONF.phpPath,({key:CONF.requestKey,para:{action:"open",hashCode:_.id(),path:prj}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj&&!obj.error){page._openproject(prj,obj.data)}else{linb.message(obj.error.message)}})}page.$infoList=new linb.UI.List({width:400}).setCustomStyle("ITEM","border-bottom:dashed 1px gray").render();page.toolbar.updateItem("ec",{caption:linb.getRes("VisualJS."+linb.getLang())})}},_addfile:function(id,path,name,type){var tb=this.treebarPrj,pathadd;if(type!="/"){name=name+type;pathadd=path+"/"+name}else{pathadd=path=path+"/"+name}linb.request(CONF.phpPath,({key:CONF.requestKey,para:{action:"add",hashCode:_.id(),type:type=="/"?"dir":"file",path:path,filename:name}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj&&!obj.error&&obj.data&&obj.data.OK){var imagePos;if(type=="/"){imagePos="-48px top"}else{var a=name.split(".");switch(a[1].toLowerCase()){case"html":imagePos="-112px -48px";break;case"css":imagePos="-208px -48px";break;case"js":imagePos="-16px -48px";break;default:imagePos="-96px -48px"}}tb.insertItems([{id:pathadd,caption:name,image:CONF.img_app,imagePos:imagePos,value:pathadd,sub:type=="/"?[]:null}],id)}else{linb.message(obj.error.message)}})},_delfile:function(id){var tb=this.treebarPrj,tab=this.tabsMain,arr=id.split(";"),a=[];_.arr.each(arr,function(o,i){a[i]=o});linb.request(CONF.phpPath,{key:CONF.requestKey,para:{action:"del",hashCode:_.id(),path:a}},function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj&&!obj.error&&obj.data&&obj.data.OK){tb.removeItems(arr);var items=tab.getItems(),b=[];_.arr.each(items,function(o){if(!tb.getSubIdByItemId(o.id)){b.push(o.id)}},null,true);tab.removeItems(b)}else{linb.message(obj.error.message)}})},_projecttool_onclick:function(profile,item,group,e,src){var self=this;switch(item.id){case"new":linb.ComFactory.getCom("addFile",function(){this.host=self;this.setProperties({onOK:self._addfile,fromRegion:linb(src).cssRegion(true),items:self.curPrjFiles});this.show(linb("body"))});break;case"delete":linb.ComFactory.getCom("delFile",function(){this.host=self;this.setProperties({fromRegion:linb(src).cssRegion(true),items:self.curPrjFiles,onOK:self._delfile});this.show(linb("body"))});break;case"refresh":linb.request(CONF.phpPath,{key:CONF.requestKey,para:{action:"open",hashCode:_.id(),path:self.curProject}},function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(!obj||obj.error){linb.message(_.get(obj,["error","message"])||"on response!")}else{_.tryF(self._openproject,[self.curProject,obj.data],self);linb.message(linb.getRes("VisualJS.tool2.refreshOK"))}});break}},_dirtyWarn:function(callback){var self=this,dirty,tb=this.tabsMain,items=tb.getItems(),tree=this.treebarPrj;_.arr.each(items,function(o){if(o._dirty){return !(dirty=true)}});if(dirty){linb.UI.Dialog.confirm(linb.getRes("VisualJS.notsave"),linb.getRes("VisualJS.notsave3"),callback)}else{callback()}},_closeproject:function(callback){var self=this,dirty,tb=this.tabsMain,items=tb.getItems(),tree=this.treebarPrj;_.arr.each(items,function(o){if(o&&o._dirty){return !(dirty=true)}});var fun=function(){tb.clearItems();tree.clearItems();self.curProject=null;this.curPrjFiles=[];self.projecttool.setDisabled(true);if(typeof callback=="function"){callback()}};if(dirty){linb.UI.Dialog.confirm(linb.getRes("VisualJS.notsave"),linb.getRes("VisualJS.notsave2"),fun)}else{fun()}},_tabsmain_beforepageclose:function(profile,item,src){if(item._dirty){linb.UI.Dialog.confirm(linb.getRes("VisualJS.notsave"),linb.getRes("VisualJS.notsave2"),function(){profile.boxing().removeItems(item.id)});return false}},_tabsmain_afterpageclose:function(profile,item,src){if(item.$obj){item.$obj.destroy()}},_tabsmain_beforeValueUpdated:function(profile,ov,nv){var item=this.tabsMain.getItemByItemId(ov);if(!item){return }if(t=item.$obj){if(t.getValue()===false){return false}}},_tabmain_onitemselected:function(profile,item,src){_.tryF(function(){if(item.$obj){item.$obj.activate()}})},_treebarprj_onitemselected:function(profile,item,src){if(!item.id){return }var page=this,arr=item.caption.split("."),type=arr[arr.length-1];if(type!="js"&&type!="html"&&type!="css"&&type!="php"){linb.Dom.submit(item.id);return }var value=item.value,arr=value.split("/"),filename=arr[arr.length-1],filetype=filename.split(".")[1],imagePos=filetype=="js"?"-16px -48px":"-128px -48px";filetype=filetype=="js"?"class":filetype;var tb=page.tabsMain,t=linb(src).cssRegion(true),pro=tb.reBoxing().cssRegion(true);if(tb.getItemByItemId(value)){tb.fireItemClickEvent(value)}else{linb.Dom.animate({border:"dashed 1px #ff0000"},{left:[t.left,pro.left],top:[t.top,pro.top],width:[t.width,pro.width],height:[t.height,pro.height]},null,function(){},240,8,"expoIn").start();var filecon;_.observableRun([function(threadid){var funOK=function(txt){txt=typeof txt=="string"?_.unserialize(txt):txt;if(txt.error){linb.message(txt.error.message);return }filecon=txt.data.file},funFail=function(msg){linb.message(msg)};linb.request(CONF.phpPath,{key:CONF.requestKey,para:{action:"getfile",hashCode:_.id(),path:value}},funOK,funFail,threadid)},function(threadid){if(filecon){var item={id:value,tips:value,caption:filename,closeBtn:true,image:CONF.img_app,imagePos:imagePos,newText:filecon,text:filecon},items=tb.getItems(),itemid=item.id,callback=function(pagprofile,pro,b){tb.markItemCaption(pagprofile.properties.keyId,b)};tb.insertItems([item],items.length?items[items.length-1].id:null);tb.fireItemClickEvent(value);if(filetype!="class"){linb.ComFactory.newCom("VisualJS.PageEditor",function(){var tabPage=tb.getPanel(item.id);if(tabPage.isEmpty()){return }var inn=this;inn.host=page;inn.setProperties({keyId:itemid});inn.$checkType=filetype;inn.setEvents("onValueChanged",callback);inn.show(function(com){com.setValue(filecon)},tabPage);tb.getItemByItemId(itemid).$obj=inn},threadid)}else{linb.ComFactory.newCom("VisualJS.ClassEditor",function(){var tabPage=tb.getPanel(item.id);if(tabPage.isEmpty()){return }var inn=this;inn.host=page;inn.setProperties({keyId:itemid});inn.setEvents("onValueChanged",callback);inn.show(function(com){com.setValue(filecon);com.showPage("normal")},tabPage);tb.getItemByItemId(itemid).$obj=inn},threadid)}}}])}},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.ToolBar).host(t,"toolbar").setDockOrder("2").setItems([]).onClick("_toolbar_onclick"));f((new u.MenuBar).host(t,"menubar").setDockOrder("1").setItems([]).onMenuSelected("_menubar_onclick"));f((new u.Div).host(t,"floatLogo").onRender(function(pro){pro.getRoot().onClick(function(){linb.Dom.submit(CONF.path_link)})}));f((new u.Layout).host(t,"layout").setLeft(0).setTop(0).setItems([{id:"before",pos:"before",locked:false,size:150,min:50,max:300,cmd:true,hide:false},{id:"main",min:10}]).setType("horizontal"));t.layout.append((new u.Panel).host(t,"panelbar2").setCaption("$VisualJS.pm.title").setImage("@CONF.img_app").setImagePos("-128px -48px").setCustomStyle({PANEL:"overflow:auto"}),"before");t.panelbar2.append((new u.TreeBar).host(t,"treebarPrj").setSelMode("none").setPosition("relative").setDock("none").setWidth("auto").setHeight("auto").setItems([]).setIniFold(false).setGroup(true).onItemSelected("_treebarprj_onitemselected"));t.layout.append((new u.Tabs).host(t,"tabsMain").setLeft(0).setTop(0).setItems([]).beforeUIValueSet("_tabsmain_beforeValueUpdated").beforePageClose("_tabsmain_beforepageclose").afterPageClose("_tabsmain_afterpageclose").onItemSelected("_tabmain_onitemselected").setCustomStyle({PANEL:"overflow:hidden;"}),"main");t.layout.append((new u.ToolBar).host(t,"projecttool").setDock("bottom").setHandler(false).setHAlign("right").setDisabled(true).setItems([{id:"only",sub:[{id:"refresh",image:"@CONF.img_app",imagePos:"-113px -16px",tips:"$VisualJS.tool2.refresh"},{type:"split"},{id:"new",image:"@CONF.img_app",imagePos:"-0px -16px",tips:"$VisualJS.tool2.new"},{id:"delete",image:"@CONF.img_app",imagePos:"-80px -16px",tips:"$VisualJS.tool2.del"}]}]).onRender(function(profile){profile.getSubNode("ITEMS").css({borderLeftWidth:0,borderRightWidth:0,borderBottomWidth:0})}).onClick("_projecttool_onclick"),"before");return n},_toolbar_onclick:function(profile,item,group,e,src){this._menubar_onclick(this.menubar.get(0),null,item,src)},_openproject:function(pm,obj){this.curProject=pm;var tb=this.treebarPrj;obj.sort(function(x,y){return x.layer<y.layer?1:x.layer==y.layer?(x.type>y.type?1:x.type==y.type?(x.location>y.location?1:-1):-1):-1});var names=pm.split("/"),name=names[names.length-1],imagePos,hash={"*":{id:pm,caption:name,image:CONF.img_app,imagePos:"-128px -48px",value:pm,sub:[]}},arr=[hash["*"]];_.arr.each(obj,function(o){if(!o.type){imagePos="-48px top"}else{var a=o.name.split(".");switch(a[1].toLowerCase()){case"html":imagePos="-112px -48px";break;case"css":imagePos="-208px -48px";break;case"js":imagePos="-16px -48px";break;default:imagePos="-96px -48px"}}hash[o.id]={id:o.location,caption:o.name,image:CONF.img_app,imagePos:imagePos,value:o.location};if(!o.type){hash[o.id].sub=[]}hash[o.pid].sub.push(hash[o.id])});tb.clearItems();tb.insertItems(arr);this.curPrjFiles=tb.getItems();this.projecttool.setDisabled(false)},_menubar_onclick:function(profile,popPro,item,src){var self=this;switch(item.id){case"newproject":var callback=function(){linb.ComFactory.getCom("prjPro",function(){this.host=self;this.setProperties({projectName:"SPA_"+parseInt(Math.random()*10000000000),jsLINBPath:"",className:"App",readonly:false,fromRegion:linb(src).cssRegion(true),onOK:self._openproject});this.show(linb("body"))})};if(this.curProject){this._closeproject(callback)}else{callback()}break;case"closeproject":if(!this.curProject){linb.message(linb.getRes("VisualJS.ps.noprj"));return }this._closeproject();break;case"openproject":var callback=function(){linb.ComFactory.getCom("prjSel",function(){this.host=self;this.setProperties({fromRegion:linb(src).cssRegion(true),onOK:self._openproject});this.show(linb("body"))})};if(this.curProject){this._closeproject(callback)}else{callback()}break;case"saveall":if(!this.curProject){linb.message(linb.getRes("VisualJS.ps.noprj"));return }var tb=this.tabsMain,count=0,items=tb.getItems(),hash={};_.arr.each(items,function(o){if(o._dirty){var newText=o.$obj.getValue();if(false===newText){return false}hash[o.id]=linb.IAjax(CONF.phpPath,{key:CONF.requestKey,para:{action:"save",hashCode:_.id(),path:o.id,content:newText}},function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj&&!obj.error&&obj.data&&obj.data.OK){o.$obj.setValue(newText);tb.markItemCaption(o.id,false,true);count++}else{linb.message(obj.error.message)}},function(txt){linb.message(txt)})}});if(!_.isEmpty(hash)){_.observableRun(function(threadid){linb.absIO.groupCall(hash,null,null,function(){linb.message(linb.getRes("VisualJS.ps.saved",count))},threadid)})}break;case"ec":if(!this.$dropmenulang){this.$dropmenulang=new linb.UI.PopMenu({items:[{id:"en",caption:linb.getRes("VisualJS.en")},{id:"cn",caption:linb.getRes("VisualJS.cn")},{id:"ja",caption:linb.getRes("VisualJS.ja")}]},{onMenuSelected:function(p,item){if(linb.getLang()!=item.id){linb.setLang(item.id,function(){self.menubar.clearPopCache();self.$dropmenulang.destroy();delete self.$dropmenulang;self.toolbar.updateItem("ec",{caption:linb.getRes("VisualJS."+item.id)})})}}})}this.$dropmenulang.pop(src);break;case"info":if(!this.Message.length){return }var list=this.$infoList,node=list.reBoxing();list.setItems(_.copy(this.Message));node.popToTop(src,4);var unFun=function(){node.hide();linb.Event.keyboardHook("esc")};node.setBlurTrigger(list.get(0).$linbid,unFun);linb.Event.keyboardHook("esc",0,0,0,unFun);break;case"debug":if(!self.curProject){linb.message(linb.getRes("VisualJS.ps.noprj"));return }self._dirtyWarn(function(){linb.Dom.submit(linb.ini.appPath+self.curProject)});break;case"release":if(!self.curProject){linb.message(linb.getRes("VisualJS.ps.noprj"));return }self._dirtyWarn(function(){linb.IAjax(CONF.phpPath,{key:CONF.requestKey,para:{path:self.curProject,action:"release"}},null,{method:"POST"}).start()});break;case"simple":linb.Dom.submit(CONF.path_simple);break;case"forum":linb.Dom.submit(CONF.path_forum);break;case"download":linb.Dom.submit(CONF.path_download);break;case"gpllicense":linb.Dom.submit(CONF.path_gpllicence);break;case"clicense":linb.Dom.submit(CONF.path_licence);break;case"purchase":linb.Dom.submit(CONF.path_purchase);break;case"about":linb.ComFactory.getCom("about",function(){this.dialog.show(null,true)});break;default:linb.message(linb.getRes("VisualJS.soon"))}}}});Class("VisualJS.PageEditor","linb.Com",{Instance:{events:{onReady:function(page){page.setValue(page.properties.text)},onRender:function(page){if(page.$checkType!="js"){page.toolbar.showItem("check",false)}}},eval2:function(txt){if(typeof txt!="string"||!txt){alert("No conent!");return false}var r=true,iframe=document.createElement("iframe");iframe.style.display="none";document.body.appendChild(iframe);frames[frames.length-1].document.write("<script>var Class=parent._.fun.clone(parent.Class,null,10), _=parent._.clone(parent._,null,10), linb=parent._.clone(parent.linb,null,10);var MSIE/*@cc_on =1@*/;parent.sandbox=MSIE?this:{eval:function(s){return eval(s)}}<\/script>");txt=txt.replace(/^\s*/,"").replace(/\s*$/,"");if((txt.charAt(0)=="{"||txt.slice(0,8)=="function")&&txt.charAt(txt.length-1)=="}"){txt="("+txt+")"}try{sandbox.eval(txt)}catch(e){var line=e.line||e.lineNumber;alert((e.name?e.name+" : ":"")+(e.description||e.message||"")+(line?"\n line : "+line:""));if(_.isNumb(line=parseInt(line))){var inp=this.texteditor.getSubNode("INPUT").get(0),str=inp.value,l=str.length,count=0,from=0,to=l;for(var i=0;i<l;i++){if(str.charAt(i)=="\n"){count++}if(count==line-1){count++;from=i}if(count==line+1){to=i;break}}_.asyRun(function(){linb([inp]).caret(from+1,to);inp.scrollTop=from*14-inp.offsetHeight})}r=false}finally{document.body.removeChild(iframe)}return r},check:function(txt){switch(this.$checkType){case"js":return this.eval2(txt);break}return true},getValue:function(resetBak,forceCheck){var self=this,txt=self.texteditor.getUIValue().replace(/\r\n/g,"\n");if(self.$bakValue!=txt||forceCheck){if(self.check(txt)===false){return false}if(resetBak){self.$bakValue=txt}return txt}else{return self.$bakValue}},activate:function(){this.texteditor.activate()},setReadonly:function(b){this.texteditor.setReadonly(b)},setValue:function(txt){var self=this;txt=(txt||"").replace(/\r\n/g,"\n");self.$bakValue=txt;self.texteditor.setValue(txt,true);return self},refreshView:function(txt){var self=this;if(self.$data.text!=self.getValue()){self.setValue(self.$data.text)}return self},_texteditor_onChange:function(profile,oV,nV){var self=this;_.tryF(self.events.onValueChanged,[self,profile,self.$bakValue!==nV,nV],self.host)},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.Pane).host(t,"panel").setDock("fill"));t.panel.append((new u.ToolBar).host(t,"toolbar").setItems([{id:"only",sub:[{id:"format",caption:"$VisualJS.pageEditor.format",image:"@CONF.img_app",imagePos:"-32px -48px",type:"button",tips:"$VisualJS.pageEditor.formattips"},{id:"check",caption:"$VisualJS.pageEditor.check",image:"@CONF.img_app",imagePos:"0 -48px",type:"button",tips:"$VisualJS.pageEditor.checktips"}]}]).onClick("_toolbar_onclick"));t.panel.append((new u.TextEditor).host(t,"texteditor").setDock("fill").onChange("_texteditor_onChange"));return n},_toolbar_onclick:function(profile,item){var self=this;switch(item.id){case"format":var code=linb.Coder.formatHTML(self.texteditor.getUIValue(),self.$checkType,["plain"]),dialog=self.$codeDlg||(self.$codeDlg=new linb.UI.Dialog({left:100,top:100,width:600,height:400,minBtn:false,caption:"$VisualJS.pageEditor.formatted"},{beforeClose:function(p){p.boxing().hide();return false}}));dialog.setHtml(code);dialog.show(linb("body"),true);break;case"check":var txt=self.getValue();if(txt!==false){linb.message(linb.getRes("VisualJS.checkOK"))}break}}}});Class("VisualJS.ClassTool",null,{Static:{getClassName:function(str){var reg=new RegExp("^(\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/\\s*)|^(\\s*\\/\\/[^\\n]*\\s*)");while(reg.test(str)){str=str.replace(reg,"")}var match=/^\s*Class\s*\(\s*[\'\"]([^\'\"]+)[\'\"]\s*\,/.exec(str);return(match&&match[1])},getClassObject:function(str){str=str.slice(str.indexOf("{")+1,str.lastIndexOf("}"));var obj=eval("({"+str+"})");return obj},getCodeFromStruct:function(o){try{var self=arguments.callee,arr=[];if(o){if(o.sub){if(o.frame){_.each(o.sub,function(o,i){if(!_.isNull(o.comments)){arr.push((o.comments||"")+i+":"+(o.code?o.code:o.sub?self.call(this,o):""))}},this);return o.frame.replace("*1",o.name||"").replace("*2",o.pname||"").replace("*3",arr.join(", ").replace(/\$/g,"\x01")).replace(/\x01/g,"$")}else{return""}}else{return(o.code||"").replace(/^[\r\n]*/,"")}}else{return""}}catch(e){linb.message(linb.getRes("VisualJS.classtool.err2"))+":"+String(e);return false}},parseSingleBlock:function(txt){try{var reg1=new RegExp("^(\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/\\s*)|^(\\s*\\/\\/[^\\n]*\\s*)"),reg2=new RegExp("(\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/\\s*)|^(\\s*\\/\\/[^\\n]*\\s*)$"),str,comments,code;while(reg2.test(txt)){txt=txt.replace(reg2,"")}str=txt;while(reg1.test(str)){str=str.replace(reg1,"")}str=str.replace(/\s*/,"");if(!str){return{comments:null,code:null}}comments="\n"+txt.replace(str,"");code=str.replace(/\s*$/,"");str=linb.Coder.replace(str,[["(^|\\n)\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/\\s*",""],["\\n\\s*\\/\\/[^\\n]*\\s*",""],[/([^\w\x24\/\'\"*)\]\?:]\s*)(\/(\\[\/\\]|[^*\/])(\\.|[^\/\n\\])*\/[gim]*)\s*([\)\}\]:,;\r\n])/.source,function(arg,i){return str[i+1]+str[i+5]}]]);code=code.replace(/([}\]])[^}\]]*$/,"$1");str=linb.Coder.replace(code,[["'(\\\\.|[^'\\\\])*'",""],['"(\\\\.|[^"\\\\])*"',""]]);while(/(\{([^\{\}]*)\})|(\[([^\[\]]*)\])/.test(str)){str=str.replace(/\s*(((function\s*([\w$]+\s*)?\(\s*([\w$\s,]*)\s*\)\s*)?(\{([^\{\}]*)\}))|(\[([^\[\]]*)\]))/g,"")}if(_.str.trim(str)!=""){return false}return{comments:comments,code:code}}catch(e){linb.message(linb.getRes("VisualJS.classtool.err3")+":"+String(e));return false}},getClassStruct:function(str){str=str.replace(/(\r\n|\r)/g,"\n").replace(/( +)(\n)/g,"$2").replace(/\t/g,"    ");var t,index=1,index1=1,cache={},cache1={},result,result2,code=function(str,i){var ret="#"+(index++)+"#";cache[ret]=str[0];return ret},_code=function(str,i){var ret="#"+(index++)+"#";cache[ret]=str[i+2];return str[i+1]+ret+str[i+5]},code1=function(str){var ret="`"+(index1++);cache1[ret]=str[0];return ret},restore=function(str){return str.replace(/#(\d+)#/g,function(m){return cache[m]})},restore1=function(str){return str.replace(/`(\d+)/g,function(m){return cache1[m]})};str=linb.Coder.replace(str,[["(^|\\n)\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/[^\\n]*",code],["(^|\\n)\\s*\\/\\/[^\\n]*",code],[/([^\w\x24\/\'\"*)\]\?:]\s*)(\/(\\[\/\\]|[^*\/])(\\.|[^\/\n\\])*\/[gim]*)\s*([\)\}\]:,;\r\n])/g.source,_code]]);str=linb.Coder.replace(str,[["'(\\\\.|[^'\\\\])*'",code1],['"(\\\\.|[^"\\\\])*"',code1]]);var frame=str.replace(/(^[^{]*\{)\s*((.|[\r\n])*)([^\s])(\s*}[^}]*$)/,"$1*3$5").replace(/(#\d+#)+/g,""),o={sub:{}};if(t=str.match(/^((#\d+#)+)/)){o.comments=restore(t[0])}else{o.comments=""}t=str.split(",");o.name=restore1(cache1["`1"].replace(/[\'\" ]*/g,""));o.pname=restore(restore1(t[1]).replace(/[\'\" ]*/g,""));o.frame=restore1(frame.replace(o.name,"*1").replace(o.pname,"*2"));str=str.slice(str.indexOf("{")+1,str.lastIndexOf("}"));result=o.sub;var index2=1,cache2={},code2=function(str){var ret="'~"+index2+++"'";cache2[ret]=str;return ret},code3=function(a,b,str){if(a.indexOf("~")!=-1){return a}var ret="'~"+index2+++"'";cache2[ret]=str;return b+ret},restore2=function(str){if(str.indexOf("~")==-1){return str}str=cache2["'"+str+"'"];while(/'~\d+'/.test(str)){str=str.replace(/'~\d+'/g,function(m){return cache2[m]})}return str};while(/(\{([^\{\}]*)\})|(\[([^\[\]]*)\])/.test(str)){str=str.replace(/\s*(((function\s*([\w$]+\s*)?\(\s*([\w$\s,]*)\s*\)\s*)?(\{([^\{\}\[\]]*)\}))|(\[([^\[\]\{\}]*)\]))/g,code2)}str=linb.Coder.replace(str,["\\s+",code]);str=str.replace(/((#\d+#)+)([\w]+)((#\d+#)*):/g,function(z,a,b,c){result[c]={comments:restore(a)};return c+":"});str=str.replace(/(#\d+#)/g,"");var obj=eval("({"+str+"})");_.arr.each(["Constructor","Initialize","Before","After"],function(i){if(obj[i]){result[i]=result[i]||{};result[i].code=restore(restore1(restore2(obj[i])))}else{result[i]={}}_.arr.each(_.toArr("code,comments"),function(j){result[i][j]=_.isDefined(result[i][j])?result[i][j]:null})});var obj2;_.arr.each(["Instance","Static"],function(i){if(obj[i]){var temp=cache2["'"+obj[i]+"'"];var frame=temp.replace(/(^[^{]*\{)\s*((.|[\r\n])*)([^\s])(\s*}[^}]*$)/,"$1*3$5");temp=temp.replace(/(#\d+#)*\s*(\})$/g,"$2");temp="("+temp+")";temp=linb.Coder.replace(temp,["\\s+",code]);result[i]=result[i]||{};result2=result[i].sub={};result[i].frame=frame;temp=temp.replace(/(:)([^,\}]+)/g,code3);temp=restore1(temp);temp=temp.replace(/((#\d+#)+)([\w]+)((#\d+#)*):/g,function(z,a,b,c){result2[c]={comments:restore(a)};return c+":"});temp=temp.replace(/(#\d+#)/g,"");obj2=eval(temp);_.each(obj2,function(o,j){result2[j]=result2[j]||{};result2[j].code=restore(restore1(restore2(o)))})}else{result[i]={}}_.arr.each(_.toArr("code,comments,sub,frame"),function(j){result[i][j]=_.isDefined(result[i][j])?result[i][j]:null})});return o}}});Class("VisualJS.ClassEditor","linb.Com",{Constructor:function(){arguments.callee.upper.apply(this,arguments);this.$data={};this.views={}},Instance:{$pageviewType:"linb.UI.ButtonViews",activate:function(){var self=this,t;var view=self.buttonview.getUIValue();if(t=self.views[view]){t.activate()}},onDestroy:function(){_.each(this.views,function(o){o.destroy()})},getValue:function(resetBak){var view=this.buttonview.getUIValue();return this.views[view].getValue(resetBak)},showPage:function(key){this.buttonview.setUIValue(key,true)},setValue:function(txt){var self=this,data=self.$data,$ov;txt=(txt||"").replace(/\r\n/g,"\n");var view=self.buttonview.getUIValue();if(self.views[view]){$ov=self.getValue()}self.$bakValue=data.text=txt;if(false==self._adjustData(txt,false)){view="normal"}if(self.views[view]){if($ov!=txt){self.views[view].refreshView()}}},_beforeValueUpdated:function(profile,ov,nv){var self=this,data=self.$data,t,str=data.text;if(t=self.views[ov]){var r=t.getValue(true);if(r===false){return false}if(r!==data.text){if(ov=="normal"){if(!VisualJS.ClassTool.getClassName(r)){linb.message(linb.getRes("VisualJS.classtool.noClass"));return false}}if(false===r){return false}data.text=r}}if(nv=="struct"||nv=="design"){if(false==self._adjustData(data.text)){return false}}if(!self.views[nv].renderId){self.views[nv].render()}self.views[nv].refreshView()},_adjustData:function(str,showErr){var self=this,data=self.$data;showErr=showErr!==false;try{if(!VisualJS.ClassTool.getClassName(str)){throw Error(linb.getRes("VisualJS.classtool.noClass"))}data.clsStruct=VisualJS.ClassTool.getClassStruct(str);data.clsObject=VisualJS.ClassTool.getClassObject(str);data.text=str}catch(e){data.clsStruct=data.clsObject=null;if(showErr){linb.message(linb.getRes("VisualJS.classEditor.codeerr",String(e)))}return false}},iniExComs:function(com,threadid){var self=this,data=self.$data,children=self._nodes,pageview=(new (linb.SC.get(self.$pageviewType))).host(self,"buttonview").setItems([{id:"normal",caption:"$VisualJS.classEditor.nv",image:"@CONF.img_app",imagePos:"-80px -48px",tips:"$VisualJS.classEditor.nvtips"},{id:"struct",caption:"$VisualJS.classEditor.sv",image:"@CONF.img_app",imagePos:"-32px -48px",tips:"$VisualJS.classEditor.svtips"},{id:"design",caption:"$VisualJS.classEditor.dv",image:"@CONF.img_app",imagePos:"-192px -48px",tips:"$VisualJS.classEditor.dvtips"}]).setCustomStyle({PANEL:"overflow:hidden;"}).beforeUIValueSet("_beforeValueUpdated");if(self.$pageviewType=="linb.UI.ButtonViews"){pageview.setBarSize(28)}children.push(pageview.get(0));linb.ComFactory.newCom("VisualJS.PageEditor",function(threadid){var inn=this;inn.host=self;inn.$data=data;inn.$checkType="js";inn.setEvents("onValueChanged",function(ipage,profile,b){_.tryF(self.events.onValueChanged,[self,ipage,(self.$bakValue!=data.text)||b],self.host)});inn.create(function(o,threadid){self.buttonview.append(inn.getUIComponents(),"normal")},threadid);self.views.normal=inn},threadid);linb.ComFactory.newCom("VisualJS.ClassStruct",function(threadid){var inn=this;inn.host=self;inn.$data=data;inn.setEvents("onValueChanged",function(ipage,profile,b,r){_.tryF(self.events.onValueChanged,[self,ipage,(self.$bakValue!=data.text)||b],self.host)});inn.create(function(o,threadid){self.buttonview.append(inn.getUIComponents(),"struct")},threadid);self.views.struct=inn},threadid);linb.ComFactory.newCom("VisualJS.Designer",function(){var inn=this;inn.host=self;inn.$data=data;inn.setEvents("onValueChanged",function(ipage,profile,b,r){_.tryF(self.events.onValueChanged,[self,ipage,(self.$bakValue!=data.text)||b],self.host)});inn.create(function(o,threadid){self.buttonview.append(inn.getUIComponents(),"design")},threadid);self.views.design=inn},threadid)}}});Class("VisualJS.ClassStruct","linb.Com",{Instance:{$PageEditor:null,$curBlock:null,$bakValue:null,$bakCurCode:null,iniExComs:function(com,threadid){var self=this;linb.ComFactory.newCom("VisualJS.PageEditor",function(){var inn=this;inn.host=self;inn.$data={text:""};inn.$checkType="js";inn.setEvents("onValueChanged",function(ipagprofile,e,b){_.tryF(self.events.onValueChanged,[ipagprofile,e,b],self.host)});inn.create(function(o,threadid){self.layoutFill.append(inn.getUIComponents(),"main")},threadid);self.$PageEditor=inn},threadid)},activate:function(){this.$PageEditor.activate()},check:function(txt){return this.$PageEditor.check(txt)},getValue:function(resetBak){var self=this,data=self.$data,r=self.$curBlock,txt=self.$PageEditor.getValue();if(txt===false){return false}if(data.$bakCurCode!=txt){if(!self.$readonly){if(false===self.check(txt)){return false}var result=VisualJS.ClassTool.parseSingleBlock(txt);if(false===result){linb.message(linb.getRes("VisualJS.classtool.err1"));return false}data.$bakCurCode=txt;r.comments=result.comments;r.code=result.code}txt=VisualJS.ClassTool.getCodeFromStruct(data.clsStruct);txt=data.clsStruct.comments.replace(/^[\r\n]*/,"")+txt;if(resetBak){self.$bakValue=txt}return txt}return data.text},refreshView:function(){var self=this,data=self.$data,clsStruct=data.clsStruct,clsObject=data.clsObject;value=self.treebarClass.getUIValue();if(self.$bakValue!=data.text){self.treebarClass.setValue(null,true);var items=[{id:"Class",caption:"Class",caption:clsStruct.name,image:"img/App.gif",imagePos:"-16px -48px",group:true,sub:[{id:"Constructor",caption:"Constructor",image:"img/App.gif",imagePos:"-32px -32px"},{id:"Instance",caption:"Instance",image:"img/App.gif",imagePos:"-16px -32px",sub:[]},{id:"Static",caption:"Static",image:"img/App.gif",imagePos:"-16px -32px",sub:[]},{id:"Initialize",caption:"Initialize",image:"img/App.gif",imagePos:"-32px -32px"},{id:"Before",caption:"Before",image:"img/App.gif",imagePos:"-32px -32px"},{id:"After",caption:"After",image:"img/App.gif",imagePos:"-32px -32px"}]}];var t=clsStruct.sub,j=items[0].sub,m,icon;if(t){m=t.Instance;if(m&&(m=m.sub)){_.each(m,function(o,i){icon="img/App.gif";iconPos=(typeof clsObject.Instance[i]=="function")?"-32px -32px":"0 -32px";if(_.isHash(clsObject.Instance[i])){icon="block.gif"}j[1].sub.push({id:"Instance."+i,caption:i,image:icon,imagePos:iconPos})})}m=t.Static;if(m&&(m=m.sub)){_.each(m,function(o,i){icon=(typeof clsObject.Static[i]=="function")?"function.gif":"property.gif";if(_.isHash(clsObject.Static[i])){icon="block.gif"}j[2].sub.push({id:"Static."+i,caption:i,image:"img/"+icon})})}}delete self.$curBlock;self.treebarClass.setItems(items);if(value&&self.treebarClass.getItemByItemId(value)){self.treebarClass.selectItem(value);self.$readonly=false}else{self.$PageEditor.setValue(data.text).setReadonly(true);self.$readonly=true}}return self},_treebarclass_beforevalueupdated:function(profile,ov,nv){var self=this,p=self.$PageEditor;if(!self.$curBlock){return }var txt=p.getValue();if(txt===false){return false}if(self.$bakCurCode!=txt){if(false===self.check(txt)){return false}var result=VisualJS.ClassTool.parseSingleBlock(txt);if(false===result){linb.message(linb.getRes("VisualJS.classtool.err1"));return false}self.$curBlock.comments=result.comments;self.$curBlock.code=result.code}},_treebarclass_onitemselected:function(profile,item,node){if(!item.id){return }var self=this,data=self.$data,p=self.$PageEditor,value=item.id;_.observableRun(function(threadid){var o=data.clsStruct,t,m,arr;var comments,code;switch(value){case"Class":code=VisualJS.ClassTool.getCodeFromStruct(o);break;case"Static":case"Instance":case"Constructor":case"Initialize":case"Before":case"After":o=o.sub;if(o=o[value]){if(o.sub){code=VisualJS.ClassTool.getCodeFromStruct(o)}}break;default:o=o.sub;arr=value.split(".");o=o[arr[0]];o=o.sub;o=o[arr[1]]}comments=(o?(o.comments||""):"");if(comments){comments=comments.replace(/^[\r\n]*/,"")}code=code||(o&&o.code)||"";linb.Thread.suspend(threadid);var t=linb([node]).cssRegion(true),pro=p.texteditor.reBoxing().cssRegion(true);linb.Dom.animate({border:"dashed 1px #ff0000"},{left:[t.left,pro.left],top:[t.top,pro.top],width:[t.width,pro.width],height:[t.height,pro.height]},null,function(){p.setValue(self.$bakCurCode=comments+code).activate();p.setReadonly(self.$readonly=value=="Class"||value=="Instance"||value=="Static")},240,8,"expoIn").start();self.$curBlock=o;linb.Thread.resume(threadid)})},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.Layout).host(t,"layoutFill").setLeft(0).setTop(0).setItems([{id:"before",pos:"before",locked:false,size:150,min:50,max:200,cmd:false}]).setType("horizontal"));t.layoutFill.append((new u.TreeBar).host(t,"treebarClass").setLeft(0).setTop(0).setGroup(false).setItems([]).setIniFold(false).onItemSelected("_treebarclass_onitemselected").beforeUIValueSet("_treebarclass_beforevalueupdated"),"before");return n}}});Class("VisualJS.ObjectEditor","linb.Com",{Instance:{$PageEditor:null,$bakValue:null,iniExComs:function(com,threadid){var self=this;linb.ComFactory.newCom("VisualJS.PageEditor",function(){var inn=this;inn.host=self;inn.$checkType="js";inn.create(function(o,threadid){self.dialog.append(inn.getUIComponents())},threadid);self.$PageEditor=inn},threadid)},activate:function(){this.$PageEditor.activate()},check:function(txt){return this.$PageEditor.check(txt)},setValue:function(text){this.$PageEditor.setValue(text)},_dialog_beforeclose:function(profile){this.dialog.hide();return false},_btncancel_onclick:function(){this.dialog.close()},_btnok_onclick:function(){var self=this,prop=self.properties,txt=self.$PageEditor.getValue();if(txt===false){return false}if(prop.text!=txt){if(false===self.check(txt)){return false}prop.result=VisualJS.ClassTool.parseSingleBlock(txt);if(false===prop.result){linb.message(linb.getRes("VisualJS.classtool.err1"));return false}prop.text=txt;prop.object=_.unserialize(prop.text)||null;_.tryF(prop.onOK,[self],self.host)}self.dialog.close()},customAppend:function(parent){var page=this,prop=page.properties,dlg=page.dialog;dlg.setCaption(prop.caption).setImage(prop.image).setImagePos(prop.imagePos);page.$PageEditor.setValue(prop.text);if(prop.fromRegion){dlg.setFromRegion(prop.fromRegion)}if(!dlg.get(0).renderId){dlg.render(true)}dlg.show(parent,true);return false},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.Dialog).host(t,"dialog").setLeft(216).setTop(80).setWidth(500).setMaxBtn(false).setMinBtn(false).setCaption("dialog").beforeClose("_dialog_beforeclose"));t.dialog.append((new u.Pane).host(t,"panelB").setDock("bottom").setHeight(35));t.panelB.append((new u.Pane).host(t,"panelR").setDock("right").setWidth(284));t.panelR.append((new u.Button).host(t,"btnCancel").setLeft(64).setTop(8).setWidth("100").setCaption("Cancel").setImage("@CONF.img_app").setImagePos("-16px -16px").onClick("_btncancel_onclick"));t.panelR.append((new u.Button).host(t,"btnOK").setLeft(176).setTop(8).setWidth("100").setCaption("OK").setImage("@CONF.img_app").setImagePos("-64px -16px").onClick("_btnok_onclick"));return n}}});Class("VisualJS.ProjectPro","linb.Com",{Instance:{_template:"blank",events:{onReady:"_onReady"},customAppend:function(){var self=this,prop=self.properties;self.inputName.setValue(prop.projectName,true);self.inputClassName.setValue(prop.className,true);self._refreshLabel(prop.projectName);if(prop.fromRegion){self.dialog.setFromRegion(prop.fromRegion)}self.inputName.setDisabled(prop.readonly);self.inputClassName.setDisabled(prop.readonly);self._template="blank";self.listType.setValue("blank",true);self.listTemplate.clearItems();self.dialog.show(self.parent,true)},iniComponents:function(){var host=this,children=[],append=function(child){children.push(child.get(0))};append((new linb.UI.Dialog).host(host,"dialog").setLeft(100).setTop(100).setWidth(520).setHeight(450).setResizer(false).setCaption("$VisualJS.dialog.newone").setImage("@CONF.img_app").setImagePos("-32px top").setMinBtn(false).setMaxBtn(false).onHotKeydown("_dialog_onhotkey").beforeClose("_dialog_beforeclose"));host.dialog.append((new linb.UI.Input).host(host,"inputName").setLeft(100).setTop(277).setWidth(150).setTipsErr("$VisualJS.projectPro.onlyword").setValueFormat("^\\w{3,15}$").afterUIValueSet("_inputname_aftervalueupdated"));host.dialog.append((new linb.UI.SLabel).host(host,"label1").setLeft(10).setTop(279).setWidth(88).setCaption("$VisualJS.projectPro.name"));host.dialog.append((new linb.UI.SLabel).host(host,"label3").setLeft(10).setTop(310).setWidth(88).setCaption("$VisualJS.projectPro.classfile"));host.dialog.append((new linb.UI.SLabel).host(host,"label5").setLeft(260).setTop(279).setWidth(80).setCaption("$VisualJS.projectPro.class"));host.dialog.append((new linb.UI.Button).host(host,"btnCancel").setLeft(262).setTop(380).setWidth(90).setTabindex("0").setCaption("$VisualJS.cancel").setImage("@CONF.img_app").setImagePos("-16px -16px").onClick("_btncancel_onclick"));host.dialog.append((new linb.UI.Input).host(host,"inputClassName").setLeft(342).setTop(277).setWidth(148).setTipsErr("$VisualJS.projectPro.onlyword").setValueFormat("^\\w{3,15}$"));host.dialog.append((new linb.UI.SLabel).host(host,"label7").setLeft(100).setTop(346).setWidth(388).setCaption("label7").setHAlign("left").setCustomClass({KEY:"uiborder-inset"}));host.dialog.append((new linb.UI.SLabel).host(host,"label2").setLeft(10).setTop(346).setWidth(88).setCaption("$VisualJS.projectPro.pagefile"));host.dialog.append((new linb.UI.SLabel).host(host,"label8").setLeft(100).setTop(310).setWidth(388).setCaption("label8").setHAlign("left").setCustomClass({KEY:"uiborder-inset"}));host.dialog.append((new linb.UI.Button).host(host,"btnOK").setLeft(374).setTop(380).setWidth(90).setCaption("$VisualJS.ok").setImage("@CONF.img_app").setImagePos("-64px -16px").onClick("_btnok_onclick"));host.dialog.append((new linb.UI.SLabel).host(host,"slabel12").setLeft(20).setTop(10).setWidth(104).setCaption("$VisualJS.projectPro.type").setHAlign("left"));host.dialog.append((new linb.UI.SLabel).host(host,"slabel13").setLeft(180).setTop(10).setWidth(104).setCaption("$VisualJS.projectPro.template").setHAlign("left"));host.dialog.append((new linb.UI.List).host(host,"listType").setDirtyMark(false).setLeft(20).setTop(30).setWidth(150).setHeight(240).setItems([{id:"blank",caption:"Blank Application"}]).onItemSelected("_listtype_onitemsel"));host.dialog.append((new linb.UI.Gallery).host(host,"listTemplate").setLeft(180).setTop(30).setDirtyMark(false).setWidth(310).setHeight(240).setItemWidth(80).setItemHeight(80).setImgWidth(64).setImgHeight(64).onItemSelected("_listtempl_onitemsel").onDblclick("_listtempl_ondblclick"));return children},_dialog_beforeclose:function(profile){this.dialog.hide();return false},_btncancel_onclick:function(){this.dialog.close()},_btnok_onclick:function(){var self=this;if(self.inputName.checkValid()===false||self.inputClassName.checkValid()===false){linb.message(linb.getRes("VisualJS.projectPro.invalid"));return }self.projectName=self.inputName.updateValue().getValue();self.className=self.inputClassName.updateValue().getValue();if(self._template==="blank"){self._buildApp()}else{linb.UI.Dialog.alert("You selected the template '"+self._template+"'! This function is in construction")}self.dialog.setFromRegion(null).close()},_buildApp:function(){var self=this;linb.request(CONF.phpPath,({key:CONF.requestKey2,para:{action:"buildWizard",hashCode:_.id(),path:self._template=="blank"?"":self._template,paras:{pathName:self.projectName,className:self.className}}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj.error){linb.message(obj.error.message)}else{_.tryF(self.properties.onOK,["projects/"+self.projectName,obj.data],self.host)}self.dialog.setFromRegion(null).close()},function(txt){linb.message(txt)})},_inputname_aftervalueupdated:function(profile,oldValue,newValue){this._refreshLabel(newValue)},_refreshLabel:function(prjname,filename){var self=this;filename=filename||"index";self.label7.setCaption(linb.ini.appPath+"projects/"+prjname+"/"+filename+".html");self.label8.setCaption(linb.ini.appPath+"projects/"+prjname+"/VisualJS/js/"+filename+".js")},_dialog_onhotkey:function(profile,key,control,shift,alt){if(key=="esc"){profile.boxing().close()}},_onReady:function(){var self=this;linb.request(CONF.phpPath,({key:CONF.requestKey2,para:{action:"getWizardTypeList",hashCode:_.id()}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(!obj||obj.error){linb.message(_.get(obj,["error","message"])||"on response!")}else{obj=obj.data;var arr=[];if(obj&&obj.length){_.arr.each(obj,function(i){arr.push({id:i.name,caption:i.name})})}self.listType.insertItems(arr)}},function(msg){linb.message(msg)})},_listtype_onitemsel:function(profile,item,src){var ns=this,id=item.id;ns._template="blank";if(id=="blank"){if(ns._curAjax&&ns._curAjax.isAlive()){ns._curAjax.abort()}ns.listTemplate.free();ns.listTemplate.clearItems()}else{ns.listTemplate.busy();ns._curAjax=linb.request(CONF.phpPath,({key:CONF.requestKey2,para:{action:"getWizardList",path:id,hashCode:_()}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(!obj||obj.error){linb.message(_.get(obj,["error","message"])||"on response!")}else{obj=obj.data;var arr=[];if(obj&&obj.length){_.arr.each(obj,function(i){arr.push({id:i.name,caption:i.name,image:i.location+"/icon.jpg",tips:"Double click for description!",tag:i.location+"/description.html"})})}ns.listTemplate.setItems(arr).setValue("",true)}ns.listTemplate.free()},function(msg){linb.message(msg);ns.listTemplate.free()})}},_listtempl_onitemsel:function(profile,item){var ns=this,id=item.id;ns._template=id},_listtempl_ondblclick:function(profile,item){linb.Dom.submit(item.tag)}}});Class("VisualJS.ProjectSelector","linb.Com",{Instance:{customAppend:function(){var self=this,dlg=self.dialog,prop=self.properties;self.listName.setItems([]).setUIValue("",true);if(prop.fromRegion){dlg.setFromRegion(prop.fromRegion)}dlg.show(self.parent,true);_.observableRun(function(threadid){linb.request(CONF.phpPath,({key:CONF.requestKey,para:{action:"open",hashCode:_.id(),path:"projects",deep:"0"}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(!obj||obj.error){linb.message(_.get(obj,["error","message"])||"on response!")}else{obj=obj.data;self.properties.projectList=[];if(obj&&obj.length){_.arr.each(obj,function(i){if(i.type===0){self.properties.projectList.push({id:i.location,caption:i.name})}})}self.listName.setItems(prop.projectList)}},function(msg){linb.message(msg)},threadid)})},iniComponents:function(){var host=this,children=[],append=function(child){children.push(child.get(0))};append((new linb.UI.Dialog).host(host,"dialog").setLeft(140).setTop(100).setWidth(340).setHeight(190).setResizer(false).setCaption("$VisualJS.dialog.select").setImage("@CONF.img_app").setImagePos("-48px top").setMinBtn(false).setMaxBtn(false).onHotKeydown("_dialog_onhotkey").beforeClose("_dialog_beforeclose"));host.dialog.append((new linb.UI.List).host(host,"listName").setDock("top").setHeight(112).setDirtyMark(false).onDblclick("_listname_ondblclick"));host.dialog.append((new linb.UI.Button).host(host,"btnCancel").setLeft(121).setTop(120).setWidth(90).setZIndex("1").setCaption("$VisualJS.cancel").setImage("@CONF.img_app").setImagePos("-16px -16px").onClick("_btncancel_onclick"));host.dialog.append((new linb.UI.Button).host(host,"btnOK").setLeft(221).setTop(120).setWidth(90).setZIndex("1").setCaption("$VisualJS.ok").setImage("@CONF.img_app").setImagePos("-64px -16px").onClick("_btnok_onclick"));return children},_btncancel_onclick:function(){this.dialog.close()},_btnok_onclick:function(){var self=this,pm=self.projectName=self.listName.getUIValue();if(!self.projectName){linb.message(linb.getRes("VisualJS.ps.noselected"));return }linb.request(CONF.phpPath,({key:CONF.requestKey,para:{action:"open",hashCode:_.id(),path:this.projectName}}),function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(!obj||obj.error){linb.message(_.get(obj,["error","message"])||"on response!")}else{_.tryF(self.properties.onOK,[pm,obj.data],self.host)}self.dialog.close()})},_dialog_beforeclose:function(profile){this.dialog.hide();return false},_dialog_onhotkey:function(profile,key,control,shift,alt){if(key=="esc"){profile.boxing().close()}},_listname_ondblclick:function(profile,item,src){this.btnOK.onClick()}}});Class("VisualJS.Designer","linb.Com",{Constructor:function(){arguments.callee.upper.apply(this,arguments);this.$host={}},Instance:{$bakCurCode:null,$viewSize:{"800":{width:800,height:600},"1024":{width:1024,height:768},"1280":{width:1280,height:1024}},dropPosition:"absolute",dropOffset:10,_setItems:function(target){var profile=target.get(0),pro=profile.properties,items=profile.box.$DataStruct.items,key=profile.key,ap=profile.boxing();if(key=="linb.UI.TreeGrid"){ap.setHeader(["col1","col2","col3","col4"]).setRows([["row1 col1","row1 col2","row1 col3","row1 col4"],["row2 col1","row2 col2","row2 col3","row2 col4"],{cells:["row3 col1","row3 col2","row3 col3","row3 col4"],sub:[["sub1","sub2","sub3","sub4"]]}])}else{if(key=="linb.UI.ToolBar"||key=="linb.UI.MenuBar"||key=="linb.UI.TreeBar"){ap.setItems([{id:"item a",sub:["sub a1","sub a2","sub a3","sub a4"]},{id:"item b",sub:["sub b1","sub b2","sub b3","sub b4"]}])}else{if(key=="linb.UI.Layout"){ap.setItems([{id:"before",pos:"before"},{id:"main"},{id:"after",pos:"after"}])}else{if(key=="linb.UI.ComboInput"){if(pro.type=="combobox"||pro.type=="listbox"||pro.type=="helpinput"){ap.setItems([{id:"a",caption:"item a",image:"img/demo.gif"},{id:"b",caption:"item b",image:"img/demo.gif"},{id:"c",caption:"item c",image:"img/demo.gif"},{id:"d",caption:"item d",image:"img/demo.gif"}]).setValue("a")}}else{if(key=="linb.UI.TimeLine"){return }if(!items){return }ap.setItems([{id:"a",caption:"item a",image:"img/demo.gif"},{id:"b",caption:"item b",image:"img/demo.gif"},{id:"c",caption:"item c",image:"img/demo.gif"},{id:"d",caption:"item d",image:"img/demo.gif"}]).setValue("a")}}}}},events:{onSelected:function(page,profile,ids){var v=null,id=ids&&ids[ids.length-1];if(id){var o=linb.getObject(id);if(o){v=o}}page.listObject.setUIValue(v?v.alias:"com",true);_.resetRun("$profilegrid$",page._refreshProfileGrid,0,[ids],page)},onReady:function(page){page.setViewSize(page.$viewSize["800"]);page.$curViewSize="800";var tbpath=linb.ini.appPath+"img/designer/toolbar.gif",tbk="$VisualJS.designer.tool.";page.toolbar.setItems([{id:"code",sub:[{id:"viewsize",type:"button",dropButton:true,caption:"800 &#215 600",tips:tbk+"viewsize"},{id:"format",image:CONF.img_app,imagePos:"-32px -48px",type:"button",tips:tbk+"tocode"},{id:"json",image:CONF.img_app,imagePos:"-128px -64px",type:"button",tips:tbk+"tojson"}]},{id:"align",sub:[{id:"left",caption:"",image:tbpath,imagePos:"0 top",tips:tbk+"left"},{id:"center",caption:"",image:tbpath,imagePos:"-16px top",tips:tbk+"center"},{id:"right",caption:"",image:tbpath,imagePos:"-32px top",tips:tbk+"right"},{id:"s1",type:"split"},{id:"top",caption:"",image:tbpath,imagePos:"-48px top",tips:tbk+"top"},{id:"middle",caption:"",image:tbpath,imagePos:"-64px top",tips:tbk+"middle"},{id:"bottom",caption:"",image:tbpath,imagePos:"-80px top",tips:tbk+"bottom"},{id:"s2",type:"split"},{id:"w",caption:"",image:tbpath,imagePos:"-96px top",tips:tbk+"width"},{id:"wh",caption:"",image:tbpath,imagePos:"-112px top",tips:tbk+"wh"},{id:"h",caption:"",image:tbpath,imagePos:"-128px top",tips:tbk+"height"}]},{id:"pos",sub:[{id:"zindex1",caption:"",image:tbpath,imagePos:"-144px top",tips:tbk+"toplayer"},{id:"zindex2",caption:"",image:tbpath,imagePos:"-160px top",tips:tbk+"bottomlayer"},{id:"s1",type:"split"},{id:"repos",caption:"",image:tbpath,imagePos:"-176px top",tips:tbk+"gridxy"},{id:"resize",caption:"",image:tbpath,imagePos:"-192px top",tips:tbk+"gridwh"},{id:"s2",type:"split"},{id:"clone",caption:"",image:tbpath,imagePos:"-240px top",tips:tbk+"clone"}]},{id:"del",sub:[{id:"delete",caption:"",image:tbpath,imagePos:"-256px top",tips:tbk+"delete"}]}])},onRender:function(page){var _refresh=page._refresh=function(obj,key,region){var profile=obj.get(0),fn="set"+_.str.initial(key),t;if(_.isFun(obj[fn])){if(profile.renderId){if(region&&region[key]){obj.getRoot()[key+"By"](region[key],true)}var t=parseInt(profile.getRoot().css(key))||0}else{t=profile.properties[key]}obj[fn](t)}return obj["get"+_.str.initial(key)]()};page.proxy=linb.create('<div style="position:absolute;border:dashed 1px blue;overflow:visible;left:-100px;top:-100px;z-index:1000"></div>');page.resizer=linb.create("AdvResizer",{dragArgs:{widthIncrement:this.dropOffset,heightIncrement:this.dropOffset},zIndex:linb.Dom.TOP_ZINDEX});page.resizer.host(page).onItemsSelected(function(profile,ids){this.pProfile.setSelectFromResizer.call(this.pProfile,ids)}).onActive(function(profile){this._focus()}).onUpdate(function(profile,target,size,cssPos){page._change();var self=this;if(target){var b=false;target.each(function(target){target=linb([target]);var profile=linb.UIProfile.getFromDom(target.get(0).id),widget=profile.boxing(),p=profile.properties,m=profile.box.$DataModel;if(size){var w=null,h=null;if(size.width){if(p&&!m.width){b=true}else{switch(p.dock){case"top":case"bottom":case"fill":case"cover":case"width":b=true;break;case"left":case"right":case"height":b=true;default:w=_refresh(widget,"width",size)}}}if(size.height){if(p&&!m.height){b=true}else{switch(p.dock){case"left":case"right":case"fill":case"cover":case"height":b=true;break;case"top":case"bottom":case"width":b=true;default:h=_refresh(widget,"height",size)}}}self._sizeUpdated(target,{width:w,height:h});linb.UI.$tryResize(profile,w,h,null,true)}if(cssPos){var x=null,y=null;if(cssPos.left){if(p&&!m.left){b=true}else{switch(p.dock){case"top":case"bottom":case"left":case"right":case"fill":case"cover":case"width":b=true;break;case"height":b=true;default:x=_refresh(widget,"left",cssPos)}}}if(cssPos.top){if(p&&!m.top){b=true}else{switch(p.dock){case"left":case"right":case"top":case"bottom":case"fill":case"cover":case"height":b=true;break;case"width":b=true;default:y=_refresh(widget,"top",cssPos)}}}self._posUpdated(target,{left:x,top:y})}});if(b){profile.boxing().rePosSize()}}}).onFocusChange(function(profile,index){if(this.tempSelected){this.SelectedFocus=index;_.resetRun("$profilegrid$",this._refreshProfileGrid,0,[this.tempSelected],this)}}).onRegionClick(function(profile,e){var ep=linb.Event.getPos(e),arr,t,m,ret;var fun=function(arr,ep,parent){var me=arguments.callee,m,rt,pos,w,h,epoff={},ppos=parent.offset(),rgw=parent.offsetWidth(),rgh=parent.offsetHeight();epoff.left=ep.left-ppos.left;epoff.top=ep.top-ppos.top;_.arr.each(arr,function(o){if(m=o[0].getRoot()){if(o[0].children.length){if(rt=me(o[0].children,ep,m)){return false}}pos=m.offset(null,parent);w=m.offsetWidth();h=m.offsetHeight();if(epoff.left>pos.left&&epoff.top>pos.top&&epoff.left<pos.left+w&&epoff.top<pos.top+h&&epoff.left<rgw&&epoff.top<rgh){rt=o[0].$linbid;return false}}});return rt};if(!(arr=this.tempSelected)||!arr.length){return }_.arr.each(arr,function(o){t=linb.getObject(o);ret=fun(t.children,ep,t.getRoot());if(ret){return false}});if(ret){this.selectWidget([ret]);return false}});page.holder=linb.create('<div style="display:none;"></div>');page.panelDiv.reBoxing().append(page.holder);page.holder.append(page.resizer);page.holder.append(page.proxy);page.proxy.get(0).zIndexIgnore=true;page.treebarCom.setItems(_.clone(CONF.widgets)).setCustomBehavior({BAR:{beforeMousedown:function(profile,e,src){var id=linb.use(src).id(),itemId=profile.getSubId(id),properties=profile.properties,item=profile.getItemByDom(id),pos=linb.Event.getPos(e);if(item.dragable){profile.getSubNode("ITEMICON",itemId).startDrag(e,{dragType:"icon",shadowFrom:src,dragCursor:"pointer",targetLeft:pos.left+12,targetTop:pos.top+12,dragKey:item.dragKey||profile.properties.dragKey,dragData:{type:item.id,imagePos:item.imagePos}});linb.use(src).tagClass("-mouseover",false);page._clearSelect();page._setSelected([],true)}}}}).toggleNode("linb.UI.absForm",true);page.focusBtn=linb.create('<a href="javascript;" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;">o</a>');page.focusBtn.onKeydown(function(pro,e){if(!page.resizer){return }var key=linb.Event.getKey(e),k=key[0],ctrl=key[1],shift=key[2],step=1,o=page.resizer.reBoxing(),profile=page.resizer.get(0),cssPos=o.cssPos(),cssSize=o.cssSize(),gridh=profile.properties.dragArgs.heightIncrement,gridw=profile.properties.dragArgs.widthIncrement;var t,b=false,size=null,pos=null;switch(k){case"up":b=true;if(ctrl){step=-1}else{if(shift){step=(t=(cssPos.top+cssSize.height)%gridh)?-t:-gridh}else{step=(t=cssPos.top%gridh)?-t:-gridh}}if(shift){o.heightBy(step);profile.regions.heightBy(step);size={width:0,height:step}}else{o.topBy(step);pos={left:0,top:step}}break;case"down":b=true;if(ctrl){step=1}else{if(shift){step=(t=(cssPos.top+cssSize.height)%gridh)?gridh-t:gridh}else{step=(t=cssPos.top%gridh)?gridh-t:gridh}}if(shift){o.heightBy(step);profile.regions.heightBy(step);size={width:0,height:step}}else{o.topBy(step);pos={left:0,top:step}}break;case"left":b=true;if(ctrl){step=-1}else{if(shift){step=(t=(cssPos.left+cssSize.width)%gridw)?-t:-gridw}else{step=(t=cssPos.left%gridw)?-t:-gridw}}if(shift){profile.regions.widthBy(step);o.widthBy(step);size={width:step,height:null}}else{o.leftBy(step);pos={left:step,top:0}}break;case"right":b=true;if(ctrl){step=1}else{if(shift){step=(t=(cssPos.left+cssSize.width)%gridw)?gridw-t:gridw}else{step=(t=cssPos.left%gridw)?gridw-t:gridw}}if(shift){o.widthBy(step);profile.regions.widthBy(step);size={width:step,height:null}}else{o.leftBy(step);pos={left:step,top:0}}break;case"delete":page._deleteSelected();page._focus();break;case"esc":page._clearSelect();page._setSelected([],true);break}if(b){profile.boxing().onUpdate(profile,profile._target,size,pos);return false}}).onFocus(function(pro,e){clearTimeout(page.timer);page.resizer.active(false)}).onBlur(function(pro,e){page.timer=_.asyRun(function(){if(page.resizer){page.resizer.inActive()}},200)});page.layoutBase.reBoxing().prepend(page.focusBtn);page._enablePanelDesign(page.canvas.get(0))}},_detatchResizer:function(){var self=this;self.holder.append(self.resizer);self.holder.append(self.proxy);self.pProfile=self.pNode=null},_attachResizer:function(profile,node){var self=this;self.proxy.css("display","none");self.resizer.resetTarget(null,false);linb(node).append(self.resizer).append(self.proxy);self.pProfile=profile;self.pNode=node;_.merge(self.resizer.get(0).properties.dragArgs,{widthIncrement:self.dropOffset,heightIncrement:self.dropOffset},"all")},_focus:function(){this.focusBtn.focus()},_setSelected:function(ids,flag){var self=this,tb=self.toolbar,t;ids=_.isArr(ids)?ids:[];self.tempSelected=ids;self.SelectedFocus=ids.length-1;tb.showGroup("align",ids.length>1?true:false);if(ids.length>0&&(t=linb.getObject(ids[0]))){tb.showGroup("pos",(t.box["linb.UI"]&&!t.box.$noDomRoot))}else{tb.showGroup("pos",false)}tb.showGroup("del",ids.length>0?true:false);if(flag){self.events.onSelected.apply(self.parent,[self,self.pProfile,ids])}self._focus();return self},_sizeUpdated:function(pro,size){var t,self=this;if(!(t=self.profileGrid.get(0).$widget)){return }if(linb.UIProfile.getFromDom(pro.get(0).id)==t.get(t._nodes.length-1)){if(size.width!==null){self.profileGrid.updateCellByRowCol("properties:width","value",{value:size.width})}if(size.height!==null){self.profileGrid.updateCellByRowCol("properties:height","value",{value:size.height})}}},_posUpdated:function(pro,cssPos){var t,self=this;if(!(t=self.profileGrid.get(0).$widget)){return }if(linb.UIProfile.getFromDom(pro.get(0).id)==t.get(t._nodes.length-1)){if(cssPos.left!==null){self.profileGrid.updateCellByRowCol("properties:left","value",{value:cssPos.left})}if(cssPos.top!==null){self.profileGrid.updateCellByRowCol("properties:top","value",{value:cssPos.top})}}},parseFun:function(txt){var str=txt;var reg=new RegExp("^(\\s*\\/\\*[^*@]*\\*+([^\\/][^*]*\\*+)*\\/\\s*)|^(\\s*\\/\\/[^\\n]*\\s*)");while(reg.test(str)){str=str.replace(reg,"")}str=str.replace(/\s*/,"");if(!str){return{comments:null,code:null}}if(false===this.check(str.replace(/\s*$/,""))){return false}return{comments:"\n"+txt.replace(str,""),code:str.replace(/\s*$/,"")}},_designable:function(profile){var me=arguments.callee,self=this;self._giveHandler(profile);var t=profile.behavior.DropableKeys;if(t&&t.length){self._enablePanelDesign(profile)}if(profile.children&&profile.children.length){_.arr.each(profile.children,function(o){me.call(self,o[0])})}profile.$refreshTrigger=function(profile){me.call(self,profile)}},_WidgetsSelected:function(ids){var self=this;self._setSelected(ids,true);self.iconlist.setUIValue(null)},_clearSelect:function(profile){var self=this;self.resizer.resetTarget(null,false);self._detatchResizer();self.iconlist.setUIValue(null)},getByCacheId:function(idArr){var arr=[],t,n=linb.UI._cache;idArr=idArr instanceof Array?idArr:[idArr];_.arr.each(idArr,function(id){if(t=n["$"+id]){arr[arr.length]=t}});return linb.UI.pack(arr,false)},_deleteSelected:function(){var page=this;if(!page.tempSelected||!page.tempSelected.length){return }linb.UI.Dialog.confirm(linb.getRes("VisualJS.designer.confirmdel"),linb.getRes("VisualJS.designer.confirmdel2",page.tempSelected.length),function(){var sel=page.getByCacheId(page.tempSelected);if(!sel.isEmpty()){var ids=[];var ws=page.getByCacheId(page.tempSelected);ws.each(function(o){if(!(o.box["linb.UI"]&&!o.box.$noDomRoot)){page.iconlist.removeItems(o.$linbid)}else{if(o.properties&&o.properties.dock&&o.properties.dock!="none"){o.boxing().setDockIgnore(true)}}});ws.destroy()}else{var o=linb.getObject(page.tempSelected[0]);page.iconlist.removeItems(page.tempSelected);o.boxing().destroy()}page._clearSelect(page.pProfile);page._setSelected(null,true)})},_giveHandler:function(target){var prevent=function(){return },page=this;target.getRoot().beforeClick(prevent).afterClick(prevent).onClick(function(pro,e,src){var esrc=linb.Event.getSrc(e),id,profile;while((!esrc.id||esrc.id==linb.$langId)&&esrc.parentNode!==document&&esrc.parentNode!==window){esrc=esrc.parentNode}id=esrc.id;esrc=null;if(!id){return }if(linb.UIProfile.getFromDom(id)!==(profile=linb.UIProfile.getFromDom(linb.use(src).id()))){return }if(!profile){return }var t,key=linb.Event.$keyboard;if(page.pProfile&&(page.pProfile!=profile.parent)){page.pProfile.selected=[]}if(t=profile.parent){if(key&&key[2]){t.reSelectObject.call(t,profile,profile.getRoot().parent())}else{t.selectObject.call(t,profile,profile.getRoot().parent())}}return false})},_enablePanelDesignFace:function(profile,key){profile.getSubNode(key).addClass("panel").$addEventHandler("drop").$addEventHandler("mousedown").$addEventHandler("click").$addEventHandler("drag").$addEventHandler("dragstop").$addEventHandler("mouseup")},_enablePanelDesign:function(profile){var t,key=profile.box.KEY,pool=profile.behavior.DropableKeys,page=this,h,k,self=this,cb={beforeMouseover:function(profile,e,src){var dd=linb.DragDrop,pp=dd.getProfile(),key=pp.dragKey,data=pp.dragData;if(!key||!data||!(new RegExp("\\b"+key+"\\b")).test(profile.box.getDropKeys(profile,src)+":___iDesign")||data.parentId==profile.$linbid||(data.data&&_.arr.indexOf(data.data,profile.$linbid)!=-1)||(profile.onDropTest&&(false===profile.boxing().onDropTest(profile,key,data)))){return }dd.setDropElement(src);_.resetRun("setDropFace",dd.setDropFace,0,[src],dd);if(profile.onDragEnter){profile.boxing().onDragEnter(profile,e,this,key,data,profile.getItemByDom(linb.use(src).id()))}},beforeDrop:function(profile,e,src){self._change();var target,dd=linb.DragDrop.getProfile(),dropx=dd.x,dropy=dd.y,dragKey=dd.dragKey,dragData=dd.dragData,type=dragData.type,imagePos=dragData.imagePos,data=dragData.data,pos=dragData.pos,ids,offset=self.dropOffset,fun=function(){var page=arguments.callee.page,t=linb.SC(type);if(!(t["linb.UI"]&&!t.$noDomRoot)){var o=linb.create(type).get(0);o.$inDesign=true;page.iconlist.insertItems([{id:o.$linbid,image:linb.ini.file_bg,tips:o.key,imgStyle:"background:url(img/widgets.gif) "+imagePos}],null,false);page.iconlist.setUIValue(o.$linbid);if(t["linb.UI"]){page._setItems(o.boxing())}}else{if(self.dropPosition=="absolute"){var basePos=linb.use(src).offset(),cssPos={left:parseInt((dropx-basePos.left)/offset)*offset,top:parseInt((dropy-basePos.top)/offset)*offset};target=new (linb.SC(linb.absBox.$type[type]));target.get(0).$inDesign=true;page._setItems(target);var p=target.get(0).properties;target.setLeft(_.arr.indexOf(["top","bottom","width","fill","cover"],p.dock)!=-1?0:cssPos.left);target.setTop(_.arr.indexOf(["left","right","height","fill","cover"],p.dock)!=-1?0:cssPos.top);target.setPosition("absolute");target.setZIndex(1);target.render()}else{target=new (linb.SC(linb.absBox.$type[type]));target.get(0).$inDesign=true;page._setItems(target);target.render()}var pro=target.get(0);page._designable(pro);pro._host=page;ids=[target["linb.absBox"]?pro.$linbid:target.$linbid];if(target["linb.UI"]){profile.boxing().append(target,profile.getItemIdByDom(linb.use(src).id()))}profile.setSelectFromPanel.call(profile,src,ids)}};fun.page=page;if(type){if(linb.SC.get(type)){fun()}else{_.observableRun(function(){linb.Dom.setCover(linb.getRes("VisualJS.designer.loading")+type);linb.SC(type,fun,true)})}}else{var basePos=linb.use(src).offset(),cssPos={left:parseInt((dropx-basePos.left)/offset)*offset,top:parseInt((dropy-basePos.top)/offset)*offset};var t;ids=data;target=self.getByCacheId(ids);var minx,miny;target.each(function(o,i){if(i===0){minx=o.properties.left;miny=o.properties.top}else{minx=Math.min(o.properties.left,minx);miny=Math.min(o.properties.top,miny)}});target.each(function(o){if(o.properties.dock!="none"){linb.UI.$dock(o,true)}else{o.boxing().setLeft(o.properties.left-minx+cssPos.left).setTop(o.properties.top-miny+cssPos.top)}});profile.boxing().append(target,profile.getItemIdByDom(src));profile.setSelectFromPanel.call(profile,src,ids)}},onMousedown:function(profile,e,src){if(linb.Event.getSrc(e).$linbid!==src){return }var o=linb(src),pos=linb.Event.getPos(e),absPos=o.offset(),w=o.innerWidth(),h=o.innerHeight();if(pos.left-absPos.left>w){return }if(pos.top-absPos.top>h){return }profile._offsetPos=absPos;profile._scrollTop=o.scrollTop();profile._scrollLeft=o.scrollLeft();page._attachResizer(profile,src);profile._selregion={};var pos=linb.Event.getPos(e);linb(src).startDrag(e,{targetReposition:false,dragType:"blank",dragCursor:"crosshair",targetLeft:pos.left,targetTop:pos.top,dragDefer:1});profile.$dragging=false},onClick:function(profile,e,src){if(linb.Event.getSrc(e)!==linb.use(src).get(0)){return }self._clearSelect(profile);profile.setSelectFromPanel.call(profile,src,[])},beforeDrag:function(profile,e,src){var t,dd=linb.DragDrop.getProfile(),pos=dd.offset,proxy=page.proxy;var region=profile._selregion;if((t=pos.x)<0){pos.x=-t}if((t=pos.y)<0){pos.y=-t}region.left=Math.min(dd.ox,dd.x)-profile._offsetPos.left+profile._scrollLeft;region.top=Math.min(dd.oy,dd.y)-profile._offsetPos.top+profile._scrollTop;region.width=pos.x;region.height=pos.y;proxy.cssRegion(region);if(!profile.$dragging){proxy.css("display","block");profile.$dragging=true}},beforeDragstop:function(profile,e,src){var region=profile._selregion,proxy=page.proxy,selected=[],t,m,o,x1,y1,x2,y2,xx1,yy1,xx2,yy2,self=linb.use(src).get(0);xx1=region.left;yy1=region.top;xx2=xx1+region.width;yy2=yy1+region.height;if(m=profile.children){_.arr.each(m,function(v,i){v=v[0];if(v.getRootNode().parentNode===self&&v.getRootNode().style.display!="none"&&v.getRootNode().style.visibility!="hidden"){o=v.getRoot();x1=o.offsetLeft();y1=o.offsetTop();x2=x1+o.width();y2=y1+o.height();if(xx2>x1&&x2>xx1&&yy2>y1&&y2>yy1){selected.push(v.$linbid)}}});profile.setSelectFromPanel.call(profile,src,selected)}_.asyRun(function(){proxy.css("display","none")})},onMouseup:function(profile,e,src){_.asyRun(function(){page.proxy.css("display","none")})}};if(t=pool){var i=_.arr.indexOf(t,"PANEL");if(i==-1){i=_.arr.indexOf(t,"KEY")}if(i!=-1){i=t[i];if(profile.keys.KEY==profile.keys[i]){h=cb}else{h={};h[i]=cb}profile._CB=h;profile.clearCache();page._enablePanelDesignFace(profile,i)}}_.merge(profile,{selectObject:function(obj,node){var profile=this,id=obj.$linbid;return this.setSelectFromPanel(node,[id])},reSelectObject:function(obj,node){var profile=this;id=obj.$linbid;if(profile.selected&&_.arr.indexOf(profile.selected,id)!=-1){_.arr.removeValue(profile.selected,id)}else{(profile.selected||(profile.selected=[])).push(id)}return this.setSelectFromPanel(node,profile.selected)},setSelectFromResizer:function(ids){var profile=this;profile.selected=ids;return this.resetSelectRel()},setSelectFromPanel:function(node,ids){var profile=this;if(self.pProfile!==profile||self.pNode!==node){self._clearSelect(profile);self._attachResizer(profile,node)}profile.selected=ids;self.resizer.resetTarget(self.getByCacheId(profile.selected).reBoxing(),false);return this.resetSelectRel()},resetSelectRel:function(){var profile=this;if(profile.selected&&profile.selected.length){var t=self.resizer.get(0).properties;t.dragArgs={dragKey:"___iDesign",widthIncrement:self.dropOffset,heightIncrement:self.dropOffset,dragData:{parentId:profile.$linbid,data:profile.selected}}}else{self._clearSelect(profile)}_.tryF(self._WidgetsSelected,[profile.selected],self);self._focus()}},"all")},_refreshProfileGrid:function(ids){var page=this,data=page.$data;page.profileGrid.removeAllRows();if(!ids||!ids.length){var pro=this.canvas.get(0),arr=[],eh=_.get(data.clsObject,["Static","EventHandlers"]),em=_.get(data.clsObject,["Instance","events"]);if(!eh){eh=linb.Com.$EventHandlers}var getCode=function(o){var code,em=_.get(o.clsStruct,["sub","Instance","sub","events","code"]);if(em){em=_.unserialize(em)}else{em={}}var funName=em[o.funName]||("_"+o.funName.toLowerCase()),item=_.get(o.clsStruct,["sub","Instance","sub",funName]);comments=(item?(item.comments||""):"");if(comments){comments=comments.replace(/^[\r\n]*/,"")}if(item&&item.code){code=item&&item.code;o.mapName=em[o.funName]}else{if(!o.ini){return""}code=_.str.repeat(" ",8)+o.ini.toString().replace(/\n/g,"\n"+_.str.repeat(" ",8));o.mapName="_"+o.funName.toLowerCase();var pool=_.get(o.clsStruct,["sub","Instance","sub"]);if(pool[o.mapName]){var i=1,t;while(pool[t=o.mapName+"_"+(++i)]){}o.mapName=t}}return comments+code};_.each(eh,function(o,i){var $fun=function(profile,cell){var o=cell.$tagVar;if(!o){return }var node=profile.getSubNode("CELL",cell._serialId);linb.ComFactory.getCom("objEditor",function(){this.host=page;this.setProperties({image:CONF.img_app,imagePos:"-32px -32px",text:getCode(o),caption:o.widgetName+" => "+o.funName,fromRegion:node.cssRegion(true),tagVar:o,onOK:function(page){this._change();var tagVar=page.properties.tagVar;if(page.properties.result.code!==null){_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"code"],page.properties.result.code);_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"comments"],page.properties.result.comments);profile.boxing().updateCell(cell,{value:tagVar.mapName})}else{_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"code"],null);_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"comments"],null);var em=_.get(tagVar.clsStruct,["sub","Instance","sub","events","code"]);if(em){em=_.unserialize(em);delete em[tagVar.funName];_.set(tagVar.clsStruct,["sub","Instance","sub","events","code"],_.serialize(em))}profile.boxing().updateCell(cell,{value:""})}node.focus()}});this.show()})},$tagVar={widgetName:"com",obj:data.clsObject,clsStruct:data.clsStruct,clsObject:data.clsObject,funName:i,mapName:(em&&em[i])||"",ini:o};arr.push({id:"event:"+i,tipk:"event",tipv:i,value:i,caption:i,cells:[{value:(em&&em[i])||"",type:"popbox",$tagVar:$tagVar,event:$fun}]})});var rows=[{id:"properties:width",caption:"width",tips:"Canvas width",cells:[{value:pro.properties.width}]},{id:"properties:height",caption:"label",tips:"Canvas height",cells:[{value:pro.properties.height}]},{id:"UIE",group:true,caption:"events",sub:arr}];var list=[];page.profileGrid.insertRows(rows);page.profileGrid.get(0).$widget=page.canvas}else{var t,len,uis=page.getByCacheId(ids);if(len=uis._nodes.length){var pro=uis.get(this.SelectedFocus),cache=[0,0,0,0,0,0,0,0],cache2=0,$fun=function(profile,cell){var o=cell.$tagVar;if(!o){return }var node=profile.getSubNode("CELL",cell._serialId),obj=o.profile[o.name];linb.ComFactory.getCom("objEditor",function(){this.host=page;this.setProperties({caption:o.widgetName+" => "+o.name,image:CONF.img_app,imagePos:obj.constructor==Array?"-128px -32px":"-16px -32px",text:linb.Coder.formatText(_.serialize(_.clone(obj,function(o,i){return(i+"").charAt(0)!="_"}))),fromRegion:node.cssRegion(true),tagVar:o,onOK:function(page){this._change();var tagVar=page.properties.tagVar;tagVar.profile.boxing()[tagVar.funName](page.properties.object);node.focus()}});this.show()})};var rows=[{id:"key",tipk:"class",caption:"class",tips:linb.getRes("VisualJS.designer.openapi"),cells:[{disabled:true,value:"<strong>"+pro.key+"</strong>",type:"label",tips:linb.getRes("VisualJS.designer.openapi")}]},{id:"alias",tipk:"fun",tipv:"alias",caption:"alias",cells:[{value:pro.alias,type:uis._nodes.length===1?"input":"label"}]},{id:"domId",tipk:"fun",tipv:"setDomId",value:"setDomId",caption:"domId",cells:[{value:pro.domId,type:uis._nodes.length===1?"input":"label"}]},{id:"properties",group:true,caption:"properties",sub:true},{id:"UIE",group:true,caption:"events",sub:true},{id:"CS",tipk:"fun",tipv:"setCustomStyle",value:"setCustomStyle",caption:"Custom Style",cells:[{value:"[<strong> key/value pairs</strong>]",event:$fun,$tagVar:{widgetName:pro.alias,name:"CS",funName:"setCustomStyle",profile:pro},type:"popbox",editorReadonly:true}]},{id:"CC",tipk:"fun",tipv:"setCustomClass",value:"setCustomClass",caption:"Custom Class",cells:[{value:"[<strong> key/value pairs</strong>]",event:$fun,$tagVar:{widgetName:pro.alias,name:"CC",funName:"setCustomClass",profile:pro},type:"popbox",editorReadonly:true}]},{id:"CB",tipk:"fun",tipv:"setCustomBehavior",value:"setCustomBehavior",caption:"Custom Behaviors",cells:[{value:"[<strong> key/value pairs</strong>]",event:$fun,$tagVar:{widgetName:pro.alias,name:"CB",funName:"setCustomBehavior",profile:pro},type:"popbox",editorReadonly:true}]},{id:"CF",tipk:"fun",tipv:"setCustomFunction",value:"setCustomFunction",caption:"Custom Functions",cells:[{value:"[<strong> key/value pairs</strong>]",event:$fun,$tagVar:{widgetName:pro.alias,name:"CF",funName:"setCustomFunction",profile:pro},type:"popbox",editorReadonly:true}]}];if(uis._nodes.length>1){rows=rows.slice(0,4)}else{var arr=page.__buildSubRows(uis,"special",true);_.arr.each(arr,function(o){o.cells[0].caption="<strong>"+o.cells[0].value+"</strong>"});_.arr.insertAny(rows,arr,3)}this.profileGrid.insertRows(rows);this.profileGrid.get(0).$widget=uis}else{pro=linb.getObject(ids[0]);uis=pro.boxing();var rows=[{id:"key",caption:"class",cells:[{value:pro.key,type:"label"}]},{id:"alias",tipk:"fun",tipv:"alias",caption:"alias",cells:[{value:pro.alias,type:"input"}]},{id:"properties",group:true,caption:"properties",sub:true},{id:"UIE",group:true,caption:"events",sub:true}];if(pro.domId){_.arr.insertAny(rows,{id:"domId",cells:[{value:"domId",type:"label"},{value:pro.domId,type:"label"}]},1)}this.profileGrid.insertRows(rows);this.profileGrid.get(0).$widget=uis}}},_change:function(){this._dirty=true;_.tryF(this.events.onValueChanged,[this,null,this._dirty],this.host)},$toolbar_onclick:function(profile,item,group,e,src){var page=this,id=item.id;switch(group.id){case"code":switch(id){case"viewsize":page.popViewSize.pop(src);break;case"format":case"json":_.observableRun(function(){var dialog=page.$codeDlg||(page.$codeDlg=new linb.UI.Dialog({left:100,top:100,width:600,height:400,minBtn:false,caption:"$VisualJS.pageEditor.formatted"},{beforeClose:function(p){p.boxing().hide();return false}})),t,nodes,code;if(page.tempSelected&&page.tempSelected.length){nodes=[];_.arr.each(page.tempSelected,function(i){nodes.push(linb.getObject(i))})}else{nodes=page.getWidgets()}switch(id){case"format":code=linb.Coder.formatHTML(page.getJSCode(nodes),"js",["plain"]);break;case"json":code=linb.Coder.formatAll(page.getJSONCode(nodes),"js",["plain"]);break}dialog.setHtml(code);dialog.show(linb("body"),true)});break}break;case"align":this._change();var sel=page.getByCacheId(this.tempSelected);var p=sel.get(this.SelectedFocus),o=p.getRoot(),size=o.cssSize(),pos=o.cssPos();sel.each(function(o){if(o.locked){return }var node=o.getRoot();switch(id){case"left":node.left(pos.left);page._refresh(o.boxing(),"left");break;case"center":node.left(pos.left+size.width/2-node.width()/2);page._refresh(o.boxing(),"left");break;case"right":node.left(pos.left+size.width-node.width());page._refresh(o.boxing(),"left");break;case"top":node.top(pos.top);page._refresh(o.boxing(),"top");break;case"middle":node.top(pos.top+size.height/2-node.height()/2);page._refresh(o.boxing(),"top");break;case"bottom":node.top(pos.top+size.height-node.height());page._refresh(o.boxing(),"top");break;case"w":node.width(size.width);page._refresh(o.boxing(),"width");break;case"wh":node.width(size.width).height(size.height);page._refresh(o.boxing(),"width");page._refresh(o.boxing(),"height");break;case"h":node.height(size.height);page._refresh(o.boxing(),"height");break}});this.resizer.rePosSize();this._focus();break;case"pos":this._change();var page=this;var sel=page.getByCacheId(this.tempSelected);if("clone"==id){var ids=[];var t,ids=[],pid;var src=page.getByCacheId(this.tempSelected);var tar=src.clone();tar.each(function(o){o.$inDesign=true;o=o.properties;if(parseInt(o.left)||o.left===0){o.left+=10}if(parseInt(o.top)||o.top===0){o.top+=10}});src.get(0).parent.boxing().append(tar);pid=src.get(0).parent.$linbid;tar.each(function(o){ids.push(o.$linbid)});tar.each(function(o){page._designable(o)});this.resizer.resetTarget(linb(tar));linb.message(linb.getRes("VisualJS.designer.colneOK",ids.length));return }var zIndex=0;sel.each(function(o){var ins=o.boxing();var node=ins.reBoxing();switch(id){case"zindex1":if(o.locked){return }if(!zIndex){zIndex=node.topZindex()}node.css("zIndex",zIndex+1);page._refresh(ins,"zIndex");break;case"zindex2":if(o.locked){return }node.css("zIndex",0);page._refresh(ins,"zIndex");break;case"repos":case"resize":if(o.locked){return }var l=node.left(),t=node.top(),offset=page.dropOffset;node.left(parseInt(l/offset)*offset).top(parseInt(t/offset)*offset);if(id=="resize"){var w=node.width(),h=node.height();node.width((parseInt((w+offset-1)/offset))*offset).height((parseInt((h+offset-1)/offset))*offset)}page.resizer.rePosSize();page._refresh(ins,"left");page._refresh(ins,"top");page._refresh(ins,"width");page._refresh(ins,"height");break}});this._focus();break;case"del":this._change();if("delete"==id){this._deleteSelected()}break}},$profilegrid_afterrowactive:function(profile,row){profile.boxing().editCellbyRowCol(profile,row.id,"value");return false},_map1:{left:1,top:1,width:1,height:1,right:1,bottom:1},_map2:{left:1,top:1,width:1,height:1,right:1,position:1,bottom:1,dock:1,dockOrder:1,dockMargin:1,dockFloat:1,dockIgnore:1,dockMinH:1,dockMinW:1},$profilegrid_beforecellvalueset:function(profile,cell,hash){this._change();var page=this,data=page.$data;try{var attr,t,type,funName,property,value,target=profile.$widget;value=hash.value;if((attr=cell._row.id.split(":")).length>1){type=attr[0];property=attr[1]}else{property=cell._row.id}switch(type){case"properties":funName="set"+_.str.initial(property);if(target.get(0)==this.canvas.get(0)){var temp={};temp[property]=value;page.setViewSize(temp)}else{var b;if(page._map1[property]){value=String((value=="auto")?value:(parseFloat(value)===0?0:(parseFloat(value)||"auto")));if(value!==hash.value){profile.boxing().updateCell(cell,{value:value});b=1}}target.each(function(o){if(value!==o.properties[property]){if(_.isFun(o.boxing()[funName])){o.boxing()[funName](value)}}});if(page._map2[property]){this.resizer.rePosSize()}if(b){return false}}break;case"event":if(target.get(0)==this.canvas.get(0)){if(hash.value){var em=_.get(page.$data.clsStruct,["sub","Instance","sub","events","code"]);if(em){em=_.unserialize(em)}else{em={}}em[property]=hash.value;_.set(page.$data.clsStruct,["sub","Instance","sub","events","code"],_.serialize(em));_.set(page.$data.clsStruct,["sub","Instance","sub","events","comments"],_.get(page.$data.clsStruct,["sub","Instance","sub","events","comments"])||("\n"+_.str.repeat(" ",8)));_.set(data.clsObject,["Instance","events",property],hash.value)}}else{target.each(function(o){if(hash.value){o[property]=hash.value;_.set(data.clsObject,["Instance",property],hash.value)}else{delete o[property]}})}break;default:if(property=="domId"){if(value==target.domId){return false}if(target.get(0).$domId!=value&&!/^[\w_-]*$/.test(value)){linb.message(linb.getRes("VisualJS.designer.domIdValid",value));return false}if(target.get(0).$domId!=value&&linb.Dom.byId(value)){linb.message(linb.getRes("VisualJS.designer.domIdExists",value));return false}var b;if(_.str.trim(String(value))==""){value=target.get(0).$domId}if(value!==hash.value){profile.boxing().updateCell(cell,{value:value});b=1}target.setDomId(value);if(b){return false}}else{if(property=="alias"){if(value==target.alias){return false}var hash=this.getNames();if(!value){return false}if(hash[value]){linb.message(linb.getRes("VisualJS.designer.nameExists",value));return false}this.listObject.setUIValue(value,true)}target[property](value)}}}catch(e){throw (e);return false}},$tg_click:function(profile,row,e,src){if(row.group){return }var page=this,i=row.tipv,name=(row.tipk=="property"?"get"+_.str.initial(i):i)||"",widget,key,fun;if(!(widget=profile.$widget)){return }if(widget==page.canvas){key="linb.Com"}else{if(!(key=widget.get(0)&&widget.get(0).key)){return }}if(row.tipk=="class"){window.open("../API/#"+key)}else{window.open("../API/#"+key+(key=="linb.Com"?(name?".":""):".prototype"+(name?".":""))+name)}},$tg_tips:function(profile,node,pos){var page=this,ks=profile.keys,cell,sid,id,pid,o,widget,key,row,str="";if(profile.properties.disabled){return }if(!(widget=profile.$widget)){return }if(widget==page.canvas){key="linb.Com"}else{if(!(key=widget.get(0)&&widget.get(0).key)){return }}id=node.id;pid=node.parentNode&&node.parentNode.id;if(!id||!pid){return }sid=profile.getSubId(id);if(id.indexOf(ks.FCELL)==0||pid.indexOf(ks.FCELL)==0){cell=row=profile.rowMap[sid];if(!cell){return true}}else{if(id.indexOf(ks.CELL)==0||pid.indexOf(ks.CELL)==0){cell=profile.cellMap[sid];if(!cell){return true}row=cell._row}}if(row){if(row.tipk){if(row.tipk=="class"){str+="<div>"+key+" [Class]</div>"}else{if(row.tipk=="fun"){str+="<div>"+key+" [function] : <b>"+row.tipv+"</b></div> "}else{if(row.tipk=="property"){str+="<div>"+key+" [property] : <b>"+row.tipv+"</b></div> "}else{if(row.tipk=="event"){str+="<div>"+key+" [event] : <b>"+row.tipv+"</b> </div>"}}}}if(row.tipk=="class"||cell.value==row.tipv){str+='<div><em style="background-color:#EBEADB;">'+linb.getRes("VisualJS.designer.openapi")+"</em></div>"}linb.Tips.show(pos,str)}else{if(cell.tips){linb.Tips.show(pos,cell.tips)}}}else{linb.Tips.hide()}return true},$profilegrid_onrequestdata:function(profile,item,callback){return this.__buildSubRows(profile.$widget,item.id)},__buildSubRows:function(uis,id,specailFlag){var cv,arr=[],t,page=this,deeppage=this,type,len=uis._nodes.length;var target=uis.get(len-1),dm=target.box.$DataModel,format,listKey,list,$tag,$fun,$tagVar,value,editorReadonly,editorDisabled;var specailItems=len===1?(CONF.widgets_xprops[target.key]||[]):[];if(id=="properties"||id=="special"){_.each(target.box.$DataStruct,function(o,i){$tagVar=null;if(i.charAt(0)=="_"||i.charAt(0)=="$"){return }if(dm[i].hidden){return }var inSpecial=_.arr.indexOf(specailItems,i)!=-1;if(specailFlag===true?!inSpecial:inSpecial){return }list=null;editorReadonly=false;editorDisabled=false;listKey=null;$tag="";cv="";if(dm[i].inner){return }else{if(i=="renderer"){type="popbox";editorReadonly=true;$tag=null;$fun=function(profile,cell){var o=cell.$tagVar;if(!o){return }var node=profile.getSubNode("CELL",cell._serialId);linb.ComFactory.getCom("objEditor",function(){this.host=page;this.setProperties({image:CONF.img_app,imagePos:"-32px -32px",caption:o.widgetName+" => renderer ",text:typeof o.ini=="function"?String(o.ini):"function(){\n}",fromRegion:node.cssRegion(true),tagVar:o,onOK:function(page){this._change();var tagVar=page.properties.tagVar,code=page.properties.result.code;tagVar.profile.properties.renderer=code!==null?new Function(_.fun.args(code),_.fun.body(code)):null;node.focus()}});this.show()})};$tagVar={widgetName:target.alias,profile:target,ini:target.properties[i]};cv="[<strong> Function </strong>]"}else{if(dm[i].readonly){type="label";editorDisabled=true}else{if(dm[i].custom){type="cmdbox";editorReadonly=true;$tag=null;$fun=function(profile,cell){var tagVar=cell.$tagVar;if(!tagVar){return }var node=profile.getSubNode("CELL",cell._serialId),submit=function(newValue){var b=tagVar.profile.boxing(),fn="set"+_.str.initial(tagVar.key);if(!_.isFun(b[fn])){return }page._change();b[fn](newValue);node.focus()};dm[i].custom(tagVar.profile,tagVar.key,tagVar.profile.properties[tagVar.key],submit,page,profile,cell,node)};$tagVar={profile:target,alias:target.alias,key:i};cv="[<strong> custom </strong>]"}else{if(dm[i].listbox){type="listbox";list=[];listKey=target.key+":properties:"+i;if(_.isFun(dm[i].listbox)){var d=dm[i].listbox;list=function(){var a=d.call(target),list=[];_.arr.each(a,function(o){list.push({id:o,caption:o,value:o})});return list}}else{if(_.isObj(dm[i].listbox[0])){list=_.copy(dm[i].listbox)}else{_.arr.each(dm[i].listbox,function(o,i){list.push({id:o,caption:o})})}}linb.UI.cacheData(listKey,list)}else{if(dm[i].combobox){type="combobox";list=[];if(_.isFun(dm[i].combobox)){var d=dm[i].combobox;list=function(){var a=d.call(target),list=[];_.arr.each(a,function(o){list.push({id:o,caption:o})});return list}}else{if(_.isObj(dm[i].combobox[0])){list=_.copy(dm[i].combobox)}else{_.arr.each(dm[i].combobox,function(o,i){list.push({id:o,caption:o})})}}listKey=target.key+":properties:"+i;linb.UI.cacheData(listKey,list)}else{if(dm[i].helpinput){listKey=target.key+":properties:"+i;type="helpinput";list=_.copy(dm[i].helpinput);linb.UI.cacheData(listKey,list)}else{if(dm[i].trigger){type="getter";value=i;$fun=function(profile,cell,pro){var o=cell.$tagVar;if(!o){return }var f=o.profile.boxing()["trigger"+_.str.initial(o.name)];_.tryF(f,null,o.profile.boxing());var v="try again";pro.boxing().setUIValue(v);profile.boxing().updateCell(cell,{value:v})};$tagVar={profile:target,name:i}}else{if(_.isBool(o)){type="checkbox";$tag=i}else{if(page._map1[i]){type="input"}else{if(_.isNumb(o)){type="number"}else{if(_.isObj(o)){type="popbox";editorReadonly=true;$tag=null;$fun=function(profile,cell){var o=cell.$tagVar;if(!o){return }var node=profile.getSubNode("CELL",cell._serialId);var obj=o.profile.boxing()["get"+_.str.initial(o.name)]();linb.ComFactory.getCom("objEditor",function(){this.host=page;this.setProperties({caption:o.widgetName+" => "+o.name,image:CONF.img_app,imagePos:obj.constructor==Array?"-128px -32px":"-16px -32px",text:linb.Coder.formatText(_.serialize(_.clone(obj,function(o,i){return(i+"").charAt(0)!="_"}))),fromRegion:node.cssRegion(true),tagVar:o,onOK:function(page){var t,tagVar=page.properties.tagVar,b=tagVar.profile.boxing(),fn="set"+_.str.initial(o.name);if(!_.isFun(b[fn])){return }this._change();b[fn](page.properties.object);if("dockMargin"==o.name){deeppage.resizer.rePosSize()}node.focus();if(o.name=="items"){if(null===page.properties.object){b.setItems([])}if(t=tagVar.profile.behavior.DropableKeys){var i=t[0];deeppage._enablePanelDesignFace(tagVar.profile,i)}}}});this.show()})};$tagVar={widgetName:target.alias,profile:target,name:i};cv="[<strong> key/value pairs</strong>]"}else{type="input"}}}}}}}}}}}}cv=cv||target.properties[i];if(_.isStr(cv)){}arr.push({id:"properties:"+i,tipk:"property",tipv:i,value:i,caption:i,cells:[{value:cv,type:type,disabled:editorDisabled,editorReadonly:editorReadonly,$tag:$tag,event:$fun,$tagVar:$tagVar,editorListKey:listKey}]})})}if(id!="special"){arr.sort(function(x,y){x=x.value||"";y=y.value||"";return x>y?1:x==y?0:-1})}if(id=="UIE"||id=="special"){var getCode=function(o){var code;var funName=typeof o.profile[o.funName]=="string"?o.profile[o.funName]:("_"+o.widgetName.toLowerCase()+"_"+o.funName.toLowerCase());var item=_.get(o.clsStruct,["sub","Instance","sub",funName]);var comments=(item?(item.comments||""):"");if(comments){comments=comments.replace(/^[\r\n]*/,"")}if(item&&item.code){code=item&&item.code;o.mapName=funName}else{code=_.str.repeat(" ",8)+o.ini.toString().replace(/\n/g,"\n"+_.str.repeat(" ",8));o.mapName="_"+o.widgetName.toLowerCase()+"_"+o.funName.toLowerCase();var pool=_.get(o.clsStruct,["sub","Instance","sub"]);if(pool[o.mapName]){var i=1,t;while(pool[t=o.mapName+"_"+(++i)]){}o.mapName=t}}return comments+code};$fun=function(profile,cell){var o=cell.$tagVar;if(!o){return }var node=profile.getSubNode("CELL",cell._serialId);linb.ComFactory.getCom("objEditor",function(){this.host=page;this.setProperties({image:CONF.img_app,imagePos:"-32px -32px",caption:o.widgetName+" => "+o.funName,text:getCode(o),fromRegion:node.cssRegion(true),tagVar:o,onOK:function(page){this._change();var tagVar=page.properties.tagVar;if(page.properties.result.code!==null){_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"code"],page.properties.result.code);_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"comments"],page.properties.result.comments);tagVar.profile[tagVar.funName]=tagVar.mapName;profile.boxing().updateCell(cell,{value:tagVar.mapName})}else{_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"code"],null);_.set(tagVar.clsStruct,["sub","Instance","sub",tagVar.mapName,"comments"],null);tagVar.profile[tagVar.funName]=tagVar.profile.box.$EventHandlers[tagVar.funName];profile.boxing().updateCell(cell,{value:""})}node.focus()}});this.show()})};_.each(target.box.$EventHandlers,function(o,i){if(specailItems){var inSpecial=_.arr.indexOf(specailItems,i)!=-1;if(specailFlag===true?!inSpecial:inSpecial){return }}$tagVar={profile:target,clsStruct:page.$data.clsStruct,widgetName:target.alias,funName:i,ini:o};arr.push({id:"event:"+i,tipk:"event",tipv:i,value:i,caption:i,cells:[{value:typeof target[i]=="string"?target[i]:"",type:"popbox",$tagVar:$tagVar,event:$fun}]})})}_.filter(arr,function(o,i){var ns=uis._nodes,key=o.value,value=o.cells[0].value,prop;for(var i=0;i<ns.length-1;i++){prop=ns[i].properties;if(!(key in prop)){return false}if(prop[key]!==value){return false}}});return arr},$iconlist_aftervalueupdated:function(profile,ov,nv){if(nv){this.resizer.resetTarget(null,false);this._setSelected([nv],true)}},$listobject_onlistshow:function(profile,pos){var page=this;if(!page.objlistBlock){page.objlistBlock=new linb.UI.Block({width:200,height:200,borderType:"ridge",background:"#fff",shadow:true});page.frame=linb.create('<div style="z-index:2000;background-color:red;position:absolute;font-size:0;line-height:0;display:none;">').css("opacity",0.3);linb("body").append(page.frame);page.treebarObj=new linb.UI.TreeBar({group:false,selMode:"none",caption:null},{onItemSelected:function(profile,item,src){page.selectWidget(item.id);profile.parent.getRoot().css("display","none");page.frame.css("display","none");profile.boxing().clearItems();_.asyRun(function(){page._focus()});return false},beforeHoverEffect:function(profile,item,e,src,type){if(!item){return }if(item.id==this.canvas.get(0).$linbid){return }if(type=="mouseover"){_.resetRun("",function(){var v=linb.getObject(item.id);if(v&&(v=v.getRoot())){page.frame.cssRegion(v.cssRegion(true)).css("display","block")}},100)}else{_.resetRun("",function(){page.frame.css("display","none")},100)}}},page);page.objlistBlock.append(page.treebarObj).render(true)}var items=[];var fun=function(profile,items,map){var self=arguments.callee,t,item={id:profile.$linbid,caption:profile.alias,image:(t=map[profile.box.KEY])?t.image:"",imagePos:(t=map[profile.box.KEY])?t.imagePos:""};items.push(item);if(profile.children&&profile.children.length){var sub=[];item.sub=sub;_.arr.each(profile.children,function(o){self.call(null,o[0],sub,map)})}};fun(page.canvas.get(0),items,CONF.mapWidgets);page.treebarObj.setItems(items).toggleNode(page.canvas.get(0).$linbid,true);var node=page.objlistBlock.reBoxing();node.popToTop(profile.getRoot());var unFun=function(){node.css("display","none");page.treebarObj.clearItems();page.frame.css("display","none");linb.Event.keyboardHook("esc")};node.setBlurTrigger("design:pop:objecttree",unFun);linb.Event.keyboardHook("esc",0,0,0,unFun)},$unique:function(arr){var i,l,a=_.copy(arr);arr.length=0;for(i=0,l=a.length;i<l;i++){if(_.arr.indexOf(arr,a[i])==-1){arr[arr.length]=a[i]}}return arr},getWidgets:function(flag){if(!flag){this._clearSelect(this.canvas.get(0))}var arr=[],c=this.canvas.get(0).children;_.arr.each(c,function(o){arr.push(o[0])});var items=this.iconlist.getItems();if(items&&items.length){_.arr.each(items,function(o,i){arr.push(linb.getObject(o.id))})}return this.$unique(arr)},getJSONCode:function(nodes){var f=function(x,y){x=parseInt((x[0]||x).properties.tabindex)||0;y=parseInt((y[0]||y).properties.tabindex)||0;return x>y?1:x==y?0:-1},fun=function(arr){arr.sort(f);for(var i=0;i<arr.length;i++){if((arr[i][0]||arr[i]).children.length){(arr[i][0]||arr[i]).children.sort(f)}}};fun(nodes);return"return linb.create("+_.serialize(nodes)+").get();"},getJSCode:function(nodes){nodes.sort(function(x,y){x=parseInt(x.properties.tabindex)||0;y=parseInt(y.properties.tabindex)||0;return x>y?1:x==y?0:-1});var page=this,t,arr=[];arr.push("// [[code created by jsLinb UI Builder\n");arr.push("var host=this, children=[], append=function(child){children.push(child.get(0))};");fun=function(v,pName,argsStr,arr){var self=arguments.callee,ui=v.box["linb.UI"],o=v.serialize(false),name=o.alias,b,t,ins=v.boxing();delete o.id;if(o.properties&&o.properties.dropKeys){if(o.properties.dropKeys==v.box.$DataStruct.dropKeys){delete o.properties.dropKeys}}if(_.isEmpty(o.properties)){delete o.properties}if(_.isEmpty(o.events)){delete o.events}if(_.isEmpty(o.CS)){delete o.CS}if(_.isEmpty(o.CC)){delete o.CC}if(_.isEmpty(o.CB)){delete o.CB}if(_.isEmpty(o.CF)){delete o.CF}arr.push("\n\n");if(pName){arr.push(pName+".append(")}else{arr.push("append(")}arr.push("(new "+o.key+")");arr.push('\n    .host(host,"'+name+'")');if(o.domId!=o.$domId){arr.push('\n    .setDomId("'+o.domId+'")')}if(o.properties){_.each(o.properties,function(o,i){if(i=="value"){return }t="set"+_.str.initial(i);if(typeof ins[t]=="function"){arr.push("\n    ."+t+"("+_.serialize(o)+")")}});if(typeof ins.setValue=="function"&&"value" in o.properties){arr.push("\n    .setValue("+_.serialize(o.properties.value)+")")}}if(o.events){_.each(o.events,function(o,i){arr.push("\n    ."+i+"("+_.serialize(o)+")")})}if(o.CS){arr.push("\n    .setCustomStyle("+_.serialize(o.CS)+")")}if(o.CC){arr.push("\n    .setCustomClass("+_.serialize(o.CC)+")")}if(o.CB){arr.push("\n    .setCustomBehavior("+_.serialize(o.CB)+")")}if(o.CF){arr.push("\n    .setCustomFunction("+_.serialize(o.CF)+")")}if(pName){arr.push("\n"+(argsStr?(", "+argsStr):"")+");")}else{arr.push("\n);")}if(v.children&&v.children.length){_.arr.each(v.children,function(o){var j=o[0],sa=[],s;for(var i=1;i<o.length;i++){switch(typeof o[i]){case"number":sa.push(o[i]);break;case"string":sa.push("'"+o[i]+"'");break}}if(sa.length){s=sa.join(",")}else{s=null}self.call(this,j,"host."+name,s,arr)},this)}};_.arr.each(nodes,function(v){fun(v,null,null,arr)});arr.push("\n\n");arr.push("return children;\n");arr.push("// ]]code created by jsLinb UI Builder");return arr.join("")},getClassList:function(nodes){var page=this,t,hash={};var fun=function(target){var self=arguments.callee;hash[target.box.KEY]=1;if(target.children&&target.children.length){_.arr.each(target.children,function(o){self.call(null,o[0])})}};_.arr.each(nodes,function(o){fun(o)});return _.toArr(hash,true)},getNames:function(){var nodes=this.getWidgets(true);var page=this,t,hash={};var fun=function(target){var self=arguments.callee;hash[target.alias]=1;if(target.children&&target.children.length){_.arr.each(target.children,function(o){self.call(null,o[0])})}};_.arr.each(nodes,function(o){fun(o)});return hash},selectWidget:function(id){var profile=linb.getObject(id);var p=profile.parent;if(p.setSelectFromPanel){p.setSelectFromPanel.call(p,profile.getRoot().parent(),id);this._setSelected([id],true)}else{this._clearSelect();this._setSelected(null,true)}},activate:function(){},refreshView:function(){var self=this,data=self.$data,clsStruct=data.clsStruct,clsObject=data.clsObject,comCode;if(!clsObject.Instance){clsObject.Instance={};_.set(clsStruct,["sub","Instance"],{comments:"",frame:"{*3}",sub:{}})}if(!clsObject.Instance.iniComponents){_.set(clsStruct,["sub","Instance","sub","iniComponents"],{code:"function(){}",comments:""});clsObject.Instance.iniComponents=_.fun()}comCode=_.get(clsStruct,["sub","Instance","sub","iniComponents","code"]);if(comCode==self.$bakCurCode){return self}var ns=self.getWidgets();_.arr.each(ns,function(o){o.boxing().destroy()});linb.Dom.setCover(linb.getRes("VisualJS.designer.prepare"));self.$bakCurCode=comCode;self._dirty=false;self._clearSelect();self._setSelected([],true);linb.SC.groupCall(clsObject.Instance.required,function(key){linb.Dom.setCover(linb.getRes("VisualJS.designer.loading")+" "+key+"...")},function(){linb.Dom.setCover(linb.getRes("VisualJS.designer.createContent"));try{self.iconlist.clearItems();self.$host={};var nodes=clsObject.Instance.iniComponents.call(self.$host)||[],n2=[];_.filter(nodes,function(target){if(!(target.box["linb.UI"]&&!target.box.$noDomRoot)){n2.push(target);return false}});self.canvas.append(linb.UI.pack(nodes,false));_.arr.each(nodes,function(o){self._designable(o)});_.arr.each(n2,function(target){self.iconlist.insertItems([{id:target.$linbid,image:"img/widgets.gif",iconPos:CONF.mapWidgets[target.box.KEY].iconPos}],null,false)});var t=self.layoutBase.reBoxing();if(t.css("display")=="none"){t.css("display","block");t.parent().css("background","")}}catch(e){self.iconlist.clearItems();self.canvas.reBoxing().empty();self.layoutBase.reBoxing().css("display","none").parent().css("background","url(img/error.gif)");linb.message(linb.getRes("VisualJS.designer.comCodeErr"));linb.message(String(e))}linb.Dom.setCover(false)});return self},getValue:function(){var self=this,data=self.$data;if(self._dirty){var nodes=self.getWidgets(),ins=data.clsStruct.sub.Instance;if(!nodes.length){if(_.get(ins,["sub","iniComponents","comments"])){_.set(ins,["sub","iniComponents","comments"],null)}}else{if(!_.get(ins,["sub","iniComponents","comments"])){_.set(ins,["sub","iniComponents","comments"],"\n"+_.str.repeat(" ",8))}ins.sub.iniComponents.code=("function(){\n"+self.getJSCode(nodes)).replace(/\n/g,"\n"+_.str.repeat(" ",12))+"\n"+_.str.repeat(" ",8)+"}"}var arr=data.clsObject.Instance.required||[],arr2=self.getClassList(nodes),base=data.clsObject.Instance.base||[];for(var i=0;i<arr2.length;i++){if(_.arr.indexOf(arr,arr2[i])==-1){arr.push(arr2[i])}}_.arr.each(arr,function(o){o=linb.SC(o);if(o.Dependency){for(var i=0;i<o.Dependency.length;i++){if(_.arr.indexOf(base,o.Dependency[i])==-1){base.push(o.Dependency[i])}}}});if(_.get(ins,["sub","base"])){_.set(ins,["sub","base","code"],_.serialize(base));if(!_.get(ins,["sub","base","comments"])){_.set(ins,["sub","base","comments"],"\n"+_.str.repeat(" ",8))}}if(_.get(ins,["sub","required"])){_.set(ins,["sub","required","code"],_.serialize(arr));if(!_.get(ins,["sub","required","comments"])){_.set(ins,["sub","required","comments"],"\n"+_.str.repeat(" ",8))}}return VisualJS.ClassTool.getCodeFromStruct(data.clsStruct)}return data.text},_popvs_onmenusel:function(p,item){var page=this;page.setViewSize(page.$viewSize[item.id])},setViewSize:function(size){var page=this,w=page.canvas.getWidth(),h=page.canvas.getHeight(),b;if(size.width&&String(size.width)!=String(w)){page.canvas.setWidth(size.width);page.panelBG.setWidth(size.width);b=1}if(size.height&&String(size.height)!=String(h)){page.canvas.setHeight(size.height);page.panelBG.setHeight(size.height);b=1}if(b){w=size.width||w;h=size.height||h;page.toolbar.updateItem("viewsize",{caption:w+" &#215 "+h});var t=page.profileGrid;if(t&&(t=t.get(0).$widget)&&(t.get(0)==page.canvas.get(0))){page.profileGrid.updateCellByRowCol("properties:width","value",{value:w});page.profileGrid.updateCellByRowCol("properties:height","value",{value:h})}}},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.PopMenu).host(t,"popViewSize").setItems([{id:"800",caption:"800 &#215 600"},{id:"1024",caption:"1024 &#215 768"},{id:"1280",caption:"1280 &#215 1024"}]).onMenuSelected("_popvs_onmenusel"));f((new u.Layout).host(t,"layoutBase").setLeft(0).setTop(0).setItems([{id:"before",pos:"before",locked:false,cmd:true,size:170,min:100,max:300,hide:false},{id:"main",min:10},{id:"after",pos:"after",locked:false,cmd:false,size:265,min:100,max:350,hide:false}]).setType("horizontal"));t.layoutBase.append((new u.IconList).host(t,"iconlist").setDock("bottom").setHeight(40).setItemWidth(16).setItemHeight(16).setZIndex(10).setItems([]).setCustomStyle({KEY:"border-top:solid 1px #CDCDCD;"}).afterUIValueSet("$iconlist_aftervalueupdated"),"main");t.layoutBase.append((new u.ToolBar).host(t,"toolbar").onClick("$toolbar_onclick"),"main");t.layoutBase.append((new u.Panel).host(t,"panelRigth").setCaption("$VisualJS.designer.configwnd").setCustomStyle({PANEL:"overflow:hidden"}),"after");t.panelRigth.append((new u.ComboInput).host(t,"listObject").setDock("top").setType("popbox").setReadonly(true).setDirtyMark(false).beoforeComboPop("$listobject_onlistshow"));t.panelRigth.append((new u.TreeGrid).host(t,"profileGrid").setRowHandlerWidth(100).setGridHandlerCaption("$VisualJS.designer.gridcol1").setHeader([{id:"value",caption:"$VisualJS.designer.gridcol2",width:120,type:"input"}]).setAltRowsBg(false).setColSortable(false).setEditable(true).beforeCellUpdated("$profilegrid_beforecellvalueset").onGetContent("$profilegrid_onrequestdata").afterRowActive("$profilegrid_afterrowactive").onShowTips("$tg_tips").onDblClickRow("$tg_click"));t.layoutBase.append((new u.Panel).host(t,"panelLeft").setCaption("$VisualJS.designer.toolsbox").setCustomStyle({PANEL:"overflow:hidden"}),"before");t.panelLeft.append((new u.TreeBar).host(t,"treebarCom").setGroup(true).setSelMode("none").setDragKey("___iDesign"));t.layoutBase.append((new u.Div).host(t,"panelDiv").setDomId("panelDiv").setDock("fill").setCustomClass({KEY:"linbdesign"}).setCustomStyle({KEY:"overflow:auto;"}),"main");t.panelDiv.append((new u.Div).host(t,"panelBG").setTop(5).setLeft(5).setCustomStyle({KEY:"background-color:#FFFEF6;"}));t.panelBG.append((new u.Div).host(t,"panelBGl").setCustomStyle({KEY:"font-size:0;line-height:0;position:absolute;left:0;top:0;width:10px;height:100%;background:url(img/designer/left.gif) left top"}));t.panelBG.append((new u.Div).host(t,"panelBGb").setCustomStyle({KEY:"font-size:0;line-height:0;position:absolute;left:0;bottom:0;height:10px;width:100%;background:url(img/designer/top.gif) left bottom"}));t.panelBG.append((new u.Div).host(t,"panelBGt").setCustomStyle({KEY:"font-size:0;line-height:0;position:absolute;left:0;top:0;height:10px;width:100%;background:url(img/designer/top.gif) left top"}));t.panelBG.append((new u.Div).host(t,"panelBGr").setCustomStyle({KEY:"font-size:0;line-height:0;position:absolute;right:0;top:0;width:10px;height:100%;background:url(img/designer/left.gif) top right"}));t.panelDiv.append((new u.Pane).host(t,"canvas").setTop(5).setLeft(5).setZIndex(10).setCustomStyle({KEY:"overflow:hidden"}));return n}},Static:{destroy:function(){this.objlistBlock.destroy();arguments.callee.upper.apply(this,arguments)}},Initialize:function(){linb.CSS.addStyleSheet(linb.UI.buildCSSText({".linbdesign .panel":{"background-image":"url(img/designer/bg.gif)","background-position":"left top","background-repeat":"repeat"}}),"linb.UI.design");var preLoad=new Image();preLoad.src=linb.ini.path+"ondrag.gif";preLoad=null;var recover=function(obj){var me=arguments.callee;_.arr.each(obj.$children,function(o){var o=linb.SC.get(o);o._getChildren=linb.UI._getChildren;if(o.$children){me(o)}})};recover(linb.UI);window.onbeforeunload=function(e){if(linb.browser.ie){window.event.returnValue=" "}else{return" "}}}});Class("VisualJS.AddFile","linb.Com",{Instance:{customAppend:function(parent){var self=this,dlg=self.dialog,prop=self.properties;if(prop.fromRegion){dlg.setFromRegion(prop.fromRegion)}if(!dlg.get(0).renderId){dlg.render()}self.treebar.resetValue();self.input.resetValue();self.inputTarget.resetValue();self.comboinput.setValue(".js",true);dlg.show(parent,true);var arr=_.clone(prop.items||[],function(o,i){return(i+"").charAt(0)!="_"}),f=function(o){var self=arguments.callee;_.filter(o,function(o,i){var k=o.sub;if(k){self(o.sub)}if(k&&!k.length){delete o.sub}return !!k})};f(arr);self.treebar.clearItems().insertItems(arr)},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.Dialog).host(t,"dialog").setLeft(240).setTop(80).setWidth(430).setHeight(280).setResizer(false).setMinBtn(false).setMaxBtn(false).setPinBtn(false).setCaption("$VisualJS.tool2.new").setImage("@CONF.img_app").setImagePos("-0px -16px").onHotKeydown("_dialog_onhotkey").beforeClose("_dialog_beforeclose"));t.dialog.append((new u.Button).host(t,"btnCancel").setLeft(80).setTop(210).setWidth(90).setCaption("$VisualJS.cancel").setImage("@CONF.img_app").setImagePos("-16px -16px").onClick("_btncancel_onclick"));t.dialog.append((new u.Label).host(t,"label4").setLeft(10).setTop(180).setWidth(70).setCaption("$VisualJS.addfile.target"));t.dialog.append((new u.ComboInput).host(t,"comboinput").setValue(".js").setLeft(300).setTop(150).setWidth(110).setReadonly(true).setType("listbox").setItems([{id:"/",caption:"$VisualJS.addfile.iDir"},{id:".html",caption:"$VisualJS.addfile.iHtml"},{id:".css",caption:"$VisualJS.addfile.iCSS"},{id:".js",caption:"$VisualJS.addfile.iJs"},{id:".php",caption:"$VisualJS.addfile.iPhp"}]).afterUIValueSet("_refresh"));t.dialog.append((new u.Panel).host(t,"panelbar2").setDock("top").setHeight(140).setZIndex(1).setCustomStyle({PANEL:"overflow:auto"}).setCaption("$VisualJS.addfile.sel"));t.panelbar2.append((new u.TreeBar).host(t,"treebar").setDock("none").setWidth("auto").setHeight("auto").setPosition("relative").setItems([]).setIniFold(false).onItemSelected("_refresh"));t.dialog.append((new u.Label).host(t,"label1").setLeft(10).setTop(150).setWidth(70).setCaption("$VisualJS.addfile.filename"));t.dialog.append((new u.Button).host(t,"btnOK").setLeft(250).setTop(210).setWidth(90).setCaption("$VisualJS.ok").setImage("@CONF.img_app").setImagePos("-64px -16px").onClick("_btnok_onclick"));t.dialog.append((new u.Label).host(t,"label3").setLeft(230).setTop(150).setWidth(70).setCaption("$VisualJS.addfile.filetype"));t.dialog.append((new u.Input).host(t,"input").setLeft(80).setTop(150).setWidth(140).setValueFormat("^[\\w_]{2,18}$").setTipsErr("$VisualJS.addfile.filenameformat").afterUIValueSet("_refresh"));t.dialog.append((new u.Input).host(t,"inputTarget").setLeft(80).setTop(180).setWidth(330).setReadonly(true));return n},_dialog_beforeclose:function(profile){this.dialog.hide();return false},_btncancel_onclick:function(profile,e,value){this.dialog.close()},_refresh:function(){var self=this,s1=self.treebar.getUIValue(),s2=self.input.getUIValue(),s3=self.comboinput.getUIValue();if(s1&&s2&&s3){self.inputTarget.setValue(s1+"/"+s2+s3,true)}return false},_btnok_onclick:function(profile,e,value){var self=this,s=self.inputTarget.getValue();if(!s){linb.message(linb.getRes("VisualJS.addfile.notarget"))}else{_.tryF(self.properties.onOK,[self.treebar.getUIValue(),self.treebar.getUIValue(),self.input.getUIValue(),self.comboinput.getUIValue()],self.host);self.dialog.close()}},_dialog_onhotkey:function(profile,key,control,shift,alt){if(key=="esc"){profile.boxing().close()}}}});Class("VisualJS.DelFile","linb.Com",{Instance:{customAppend:function(parent){var self=this,prop=self.properties,dlg=self.dialog;if(prop.fromRegion){dlg.setFromRegion(prop.fromRegion)}if(!dlg.get(0).renderId){dlg.render()}self.treebar.resetValue();dlg.show(parent,true);var arr=_.clone(prop.items,function(o,i){return(i+"").charAt(0)!="_"}),f=function(o){var self=arguments.callee;_.filter(o,function(o,i){delete o.group;if(o.sub&&o.sub.length){self(o.sub)}})};f(arr);self.treebar.clearItems().insertItems(arr)},_dialog_beforeclose:function(profile){this.dialog.hide();return false},iniComponents:function(){var t=this,n=[],u=linb.UI,f=function(c){n.push(c.get(0))};f((new u.Dialog).host(t,"dialog").setLeft(247).setTop(120).setWidth(433).setHeight(220).setResizer(false).setMinBtn(false).setMaxBtn(false).setPinBtn(false).setCaption("$VisualJS.tool2.del").setImage("@CONF.img_app").setImagePos("-80px -16px").onHotKeydown("_dialog_onhotkey").beforeClose("_dialog_beforeclose"));t.dialog.append((new u.Button).host(t,"btnCancel").setLeft(80).setTop(150).setWidth(90).setCaption("$VisualJS.cancel").setImage("@CONF.img_app").setImagePos("-16px -16px").onClick("_btncancel_onclick"));t.dialog.append((new u.Button).host(t,"btnOK").setLeft(250).setTop(150).setWidth(90).setCaption("$VisualJS.ok").setImage("@CONF.img_app").setImagePos("-64px -16px").onClick("_btnok_onclick"));t.dialog.append((new u.Panel).host(t,"panelbar2").setDock("top").setHeight(140).setZIndex(1).setCaption("$VisualJS.delfile.sel").setCustomStyle({PANEL:"overflow:auto"}).setCloseBtn(false).setLandBtn(false));t.panelbar2.append((new u.TreeBar).host(t,"treebar").setDock("none").setPosition("relative").setWidth("auto").setHeight("auto").setItems([]).setIniFold(false).setSelMode("multi").beforeUIValueSet("_treebar_beforevalueupdated").onItemSelected("_treebar_onitemselected"));return n},_btncancel_onclick:function(profile,e,value){this.dialog.close()},_btnok_onclick:function(profile,e,value){var s=this.treebar.getUIValue(),self=this;if(!s){linb.message(linb.getRes("VisualJS.delfile.notarget"))}else{linb.UI.Dialog.confirm(linb.getRes("VisualJS.delfile.confirmdel"),linb.getRes("VisualJS.delfile.confirmdel2",s.split(";").length),function(){_.tryF(self.properties.onOK,[s],self.host);self.dialog.close()})}},_treebar_beforevalueupdated:function(profile,oldValue,newValue){var arr=newValue.split(";");arr.sort();_.filter(arr,function(o,j){for(var i=0,l=this.length;i<l;i++){if(i==j){break}if(_.str.startWith(this[j],this[i])){return false}}});return arr.join(";")},_dialog_onhotkey:function(profile,key,control,shift,alt){if(key=="esc"){profile.boxing().close()}}}});Class("VisualJS.About","linb.Com",{Instance:{iniComponents:function(){var host=this,children=[],append=function(child){children.push(child.get(0))};append((new linb.UI.Dialog).host(host,"dialog").setLeft(250).setTop(150).setHeight(170).setResizer(false).setCaption("$VisualJS.menu.about").setMinBtn(false).setMaxBtn(false).setPinBtn(false).onHotKeydown("_dialog_onhotkey").beforeClose("_dialog2_beforeclose"));host.dialog.append((new linb.UI.Div).host(host,"div12").setLeft(10).setTop(10).setWidth(260).setHeight(80).setHtml('Powered by jsLinb and phpLINB <br /> <br />&copy;2006-2009 <a href="mailto:&#108;&#105;&#110;&#98;&#46;&#110;&#101;&#116;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">Jack Y.B. Lee</a> All rights reserved'));host.dialog.append((new linb.UI.Button).host(host,"button3").setLeft(120).setTop(100).setWidth(50).setZIndex("10").setCaption("$inline.ok").onClick("_button3_onclick"));host.dialog.append((new linb.UI.Div).host(host,"div9").setLeft(90).setTop(65).setWidth("120").setHeight("60").setZIndex("8").onRender("_div9_aftercreated").setCustomStyle({KEY:"background:url(img/logo.gif);cursor:pointer;"}));return children},_div9_aftercreated:function(profile){profile.getRoot().onClick(function(){linb.Dom.submit("http://www.linb.net/VisualJS/")})},_dialog2_beforeclose:function(profile){profile.boxing().hide();return false},_dialog_onhotkey:function(profile,key,control,shift,alt){if(key=="esc"){profile.boxing().close()}},_button3_onclick:function(profile,e,value){this.dialog.close()}}});Class("UIDesigner","linb.Com",{Instance:{$classEditor:null,$pageviewType:"linb.UI.Tabs",$firstView:"design",$dftCodePath:"template/index.js",$fetchedCode:"",$iniCode:"",$url:"",$dirty:false,onDestroy:function(){this.$classEditor.destroy()},events:{onReady:function(){SPA=this;linb.ComFactory.setProfile(CONF.ComFactoryProfile)},onRender:function(com,threadid){com.setValue(com.$fetchedCode||com.$iniCode,com.$fetchedurl);com.$classEditor.showPage(com.$firstView)},afterIniComponents:function(){var self=this;self.popLang.setItems(CONF.localeItems);self.appRoot.append(new linb.UI.Button({caption:linb.wrapRes("VisualJS.builder.open"),tips:linb.getRes("VisualJS.builder.openTips"),zIndex:100,left:"auto",top:6,right:130,width:68,height:54,type:"custom",border:true,renderer:function(item){return"<img src=img/open.gif /><br />"+item.caption}},{onClick:function(){if(self.$dirty){if(false===confirm(linb.getRes("VisualJS.builder.nosavefirst"))){return }}if(self.$openFile){self.$openFile.dlg.show(null,true,100,100)}else{linb.ComFactory.newCom("VisualJS.OpenFile",function(threadid){self.$openFile=this;this.onOpenFile=function(url){linb.Thread.observableRun(function(threadid){linb.Ajax(CONF.phpPath,{key:CONF.requestKey,para:{action:"fetchwebfile",path:url}},function(txt){var obj=_.unserialize(txt);if(!obj.error){self.setValue(obj.data,url)}else{linb.message(obj.error.message)}self.$openFile.dlg.hide()},function(){alert(linb.getRes("VisualJS.builder.noexist",url))},threadid).start()})};this.create(function(){this.dlg.show(null,true,100,100)})})}}})).append(new linb.UI.Button({caption:linb.wrapRes("VisualJS.builder.save"),tips:linb.getRes("VisualJS.builder.saveTips"),zIndex:100,left:"auto",top:6,right:210,width:68,height:54,type:"custom",border:true,renderer:function(item){return"<img src=img/save.gif /><br />"+item.caption}},{onClick:function(p,e,src){self.popSave.updateItem("savetoserver",{disabled:!self.$url||linb.absIO.isCrossDomain(self.$url)});if(self.popSave.$lang!=linb.getLang()){self.popSave.$lang=linb.getLang();self.popSave.refresh()}self.popSave.pop(src)}})).append(self.$btnRun=new linb.UI.Button({caption:linb.wrapRes("VisualJS.builder.run"),tips:linb.getRes("VisualJS.builder.runTips"),zIndex:100,left:"auto",top:6,right:290,width:68,height:54,type:"custom",border:true,renderer:function(item){return"<img src=img/run.gif /><br />"+item.caption}},{onClick:function(){var content=self.getValue(),clsName=VisualJS.ClassTool.getClassName(content);if(false===content){return }if(!clsName){linb.message(linb.getRes("VisualJS.classtool.noClass"));return false}linb.Dom.submit(CONF.testphpPath,{clsName:clsName,content:content,theme:linb.UI.getTheme(),lang:linb.getLang()},"post")}}));self.$btnTheme=new linb.UI.Button({type:"drop",caption:linb.wrapRes("VisualJS.builder.dftTheme"),tips:linb.getRes("VisualJS.builder.dftThemeTips"),position:"absolute",top:38,right:4,left:"auto",width:110,zIndex:100},{onClick:function(profile,e,src){if(SPA.popMenu.$lang!=linb.getLang()){SPA.popMenu.$lang=linb.getLang();SPA.popMenu.refresh()}SPA.popMenu.pop(src)},onClickDrop:function(profile,e,src){if(SPA.popMenu.$lang!=linb.getLang()){SPA.popMenu.$lang=linb.getLang();SPA.popMenu.refresh()}SPA.popMenu.pop(src)}});self.appRoot.append(self.$btnTheme);self.$btnLang=new linb.UI.Button({type:"drop",caption:linb.wrapRes("VisualJS."+linb.getLang()),tips:"$VisualJS.langTips",position:"absolute",top:6,right:4,left:"auto",width:110,zIndex:100},{onClick:function(profile,e,src){if(SPA.popLang.$lang!=linb.getLang()){SPA.popLang.$lang=linb.getLang();SPA.popLang.refresh()}SPA.popLang.pop(src)},onClickDrop:function(profile,e,src){if(SPA.popLang.$lang!=linb.getLang()){SPA.popLang.$lang=linb.getLang();SPA.popLang.refresh()}SPA.popLang.pop(src)}});self.appRoot.append(self.$btnLang)}},iniResource:function(com,threadid){var com=this,url=_.urlDecode(location.href.split("#")[1],"url"),hash={};hash.ajax1=linb.Ajax(com.$dftCodePath,"",function(code){com.$iniCode=code.replace("{className}","App")},function(){alert(linb.getRes("VisualJS.builder.noexist",com.$dftCodePath))});if(url){com.$url=url;hash.ajax2=linb.Ajax(CONF.phpPath,{key:CONF.requestKey,para:{action:"fetchwebfile",path:url}},function(txt){var obj=_.unserialize(txt);if(!obj.error){com.$fetchedCode=obj.data;com.$fetchedurl=url}else{linb.message(obj.error.message)}},function(){alert(linb.getRes("VisualJS.builder.noexist",url))})}linb.absIO.groupCall(hash,null,null,null,threadid)},iniExComs:function(com,threadid){var com=this;linb.ComFactory.newCom("VisualJS.ClassEditor",function(threadid){var inn=this;inn.host=com;inn.$pageviewType=com.$pageviewType;inn.setEvents("onValueChanged",function(ipage,profile,b,nV){com.imgEdit.setDisplay(b?"":"none");com.$dirty=b});inn.create(function(o,threadid){linb.UI.Tag.replace(com.container.get(0),inn.buttonview.get(0),com)},threadid);com.$classEditor=inn},threadid)},getValue:function(){return this.$classEditor.getValue()},setValue:function(str,url){var self=this;if(str){self.$classEditor.setValue(str)}if(url){self.$url=url}var dis=self.$url?!linb.absIO.isCrossDomain(self.$url)?"":"none":"none";self.urlLink.setDisplay(dis);self.divFileInfo.setDisplay(dis);if(self.$url){self.urlLink.setHref(self.$url).setCaption(self.$url)}self.imgEdit.setDisplay("none");self.$dirty=false},_pop_onmenuselected:function(profile,item,src){if(linb.getLang()==item.id){return }SPA.$btnLang.setCaption(linb.wrapRes("VisualJS."+item.id));linb.setLang(item.id)},iniComponents:function(){var host=this,children=[],append=function(child){children.push(child.get(0))};append((new linb.UI.PopMenu).host(host,"popLang").onMenuSelected("_pop_onmenuselected"));append((new linb.UI.PopMenu).host(host,"popSave").setItems([{id:"savetoserver",caption:"$VisualJS.builder.savetoserver"},{id:"savetolocal",caption:"$VisualJS.builder.savetolocal"},{id:"saveashtml",caption:"$VisualJS.builder.saveashtml"},{id:"saveaszip",caption:"$VisualJS.builder.saveaszip"}]).onMenuSelected("_popsave_onmenusel"));append((new linb.UI.PopMenu).host(host,"popMenu").setItems([{id:"default",caption:"$VisualJS.builder.themeDft"},{id:"aqua",caption:"$VisualJS.builder.themeAqua"},{id:"vista",caption:"$VisualJS.builder.themeVista"}]).onMenuSelected("_onmenusel"));append((new linb.UI.Pane).host(host,"appRoot").setDock("fill").setDockMinW(800).setDockMinH(600));host.appRoot.append((new linb.UI.Image).host(host,"image1").setTop(6).setRight(370).setLeft("auto").setSrc("img/builder.gif"));host.appRoot.append((new linb.UI.Link).host(host,"btnAdv").setCaption("$VisualJS.builder.advancedBuilder").setTop(6).setRight(370).setLeft("auto").setZIndex(100).setTarget("_blank").setHref("index.html"));host.appRoot.append((new linb.UI.Tag).host(host,"container").setDock("fill").setDockMargin({left:0,top:40,right:0,bottom:0}));host.appRoot.append((new linb.UI.Pane).host(host,"paneTop").setTop(10).setWidth("auto").setHeight(20).setPosition("relative"));host.paneTop.append((new linb.UI.Image).host(host,"imgEdit").setLeft(20).setTop(0).setSrc("img/inedit.gif").setDisplay("none"));host.paneTop.append((new linb.UI.Div).host(host,"divFileInfo").setLeft(40).setTop(0).setWidth(90).setHeight(20).setHtml("$VisualJS.builder.originalFile"));host.paneTop.append((new linb.UI.Link).host(host,"urlLink").setLeft(106).setTop(1).setTarget("_blank").setCaption("").onClick(function(){return true}));return children},_onmenusel:function(profile,item){var id=item.id;if((SPA.$curTheme||"default")==id){return }linb.UI.setTheme(SPA.$curTheme=id);SPA.$btnTheme.setCaption(linb.wrapRes(item.caption))},_popsave_onmenusel:function(profile,item){var self=this,id=item.id;ifrid="ifr_for_download",content=self.getValue(),clsName=VisualJS.ClassTool.getClassName(content);if(false===content){return }if(!clsName){linb.message(linb.getRes("VisualJS.classtool.noClass"));return false}if(id=="savetolocal"){if(!linb.Dom.byId(ifrid)){linb("body").append(linb.create('<iframe id="'+ifrid+'" name="'+ifrid+'" style="display:none;"/>'))}var hash={key:CONF.requestKey,para:{action:"downloadjs",content:content}};linb.Dom.submit(CONF.phpPath,hash,"post",ifrid)}else{if(id=="saveashtml"){if(!linb.Dom.byId(ifrid)){linb("body").append(linb.create('<iframe id="'+ifrid+'" name="'+ifrid+'" style="display:none;"/>'))}var hash={key:CONF.requestKey,para:{action:"downloadhtml",content:content,clsName:clsName,theme:linb.UI.getTheme(),lang:linb.getLang()}};linb.Dom.submit(CONF.phpPath,hash,"post",ifrid)}else{if(id=="saveaszip"){if(!linb.Dom.byId(ifrid)){linb("body").append(linb.create('<iframe id="'+ifrid+'" name="'+ifrid+'" style="display:none;"/>'))}var hash={key:CONF.requestKey,para:{action:"downloadzip2",content:content,clsName:clsName,theme:linb.UI.getTheme(),lang:linb.getLang()}};linb.Dom.submit(CONF.phpPath,hash,"post",ifrid)}else{if(id=="savetoserver"){var path=self.$url;if(!path){return }if(self.$dirty){if(false===confirm(linb.getRes("VisualJS.builder.issave2server"))){return }}else{return }if(/^(http|https)\:\/\//.test(self.$url)){var s1=self.$url.replace(/^.+\:\/\/[^/]+\//,""),s2=linb.ini.appPath.replace(/^.+\:\/\/[^/]+\//,"").replace(/\/$/,""),a1=s1.split("/"),a2=s2.split("/"),count=0,as="";_.arr.each(a2,function(o,i){if(a1[i]!=o){return false}else{count++}});as+=_.str.repeat("../",(a2.length-count));path=as+a1.slice(count,a1.length).join("/")}linb.IAjax(CONF.phpPath,{key:CONF.requestKey,para:{action:"savetoserver",hashCode:_(),path:path,content:content}},function(txt){var obj=typeof txt=="string"?_.unserialize(txt):txt;if(obj&&!obj.error&&obj.data&&obj.data.OK){linb.message(linb.getRes("VisualJS.builder.save2serverOK"));self.imgEdit.setDisplay("none");self.$dirty=false}else{linb.message(obj.error.message)}},function(txt){linb.message(txt)}).start()}}}}}}});Class("VisualJS.OpenFile","linb.Com",{Instance:{iniComponents:function(){var host=this,children=[],append=function(child){children.push(child.get(0))};append((new linb.UI.Dialog).host(host,"dlg").setWidth(690).setHeight(100).setResizer(false).setCaption("Open jsLinb Class File").setMinBtn(false).setMaxBtn(false).setPinBtn(false).beforeClose("_beforeClose"));host.dlg.append((new linb.UI.Pane).host(host,"pane6").setWidth("auto").setHeight("40").setPosition("relative"));host.pane6.append((new linb.UI.ComboInput).host(host,"combo").setLeft(50).setTop(10).setWidth(517).setDirtyMark(false).setValueFormat("^(http|https)\\:\\/\\/[\\w\\-\\_\\.]+[\\w\\-\\_](:[\\w]*)?\\/?([\\w\\-\\._\\?\\,\\'\\/\\\\\\+&amp;%\\$#\\=~])*$").setType("none"));host.pane6.append((new linb.UI.Div).host(host,"div19").setLeft(20).setTop(10).setWidth("40").setHeight(20).setHtml("URL:"));host.pane6.append((new linb.UI.Button).host(host,"button5").setLeft(570).setTop(9).setWidth(90).setCaption("Open it").onClick("_open"));host.dlg.append((new linb.UI.Pane).host(host,"pane7").setWidth("auto").setHeight("auto").setPosition("relative"));host.pane7.append((new linb.UI.Group).host(host,"group1").setLeft("20").setWidth(640).setHeight("auto").setPosition("relative").setCaption("Open from samples").setToggle(false).onIniPanelView("_grp_iniview").onFold("_grp_onfold").onExpend("_grp_onexpend"));host.group1.append((new linb.UI.TreeBar).host(host,"treebar").setDock("none").setLeft(10).setWidth(620).setHeight(140).setPosition("relative").setSelMode("none").onItemSelected("_tb_onsel"));return children},_open:function(profile,item,group,e,src){if(!this.combo.checkValid()){return false}var url=this.combo.getUIValue();if(!/\.js/.test(url)){linb.message("Not a js file.");return }_.tryF(this.onOpenFile,[url],this)},_beforeClose:function(profile){profile.boxing().hide();return false},_grp_onexpend:function(profile){this.dlg.setHeight(240)},_grp_onfold:function(profile){this.dlg.setHeight(100)},_grp_iniview:function(profile){var ins=profile.boxing(),self=this;ins.busy();linb.Thread.observableRun(function(threadid){linb.Ajax("js/ClsSamples.js","",function(txt){var items=_.unserialize(txt);if(false===items){linb.message("Data source format error!")}else{self.treebar.setItems(items)}ins.free()},function(msg){linb.message(msg);ins.free()},threadid).start()})},_tb_onsel:function(profile,item){_.tryF(this.onOpenFile,[item.value],this)}}});