/****
 ** JStrap Engine v.0.9b build 100822010813
 ** Component of JScore Web 2.0 Platform
 ** http://www.commercebyte.com/JScore.html
 ** (C) 2010 CommerceByte
 ** All Rights Reserved
 ***/

JStrap=function(parent,name) { this._seqID=JStrap._seqID++;this._parent=parent;this._name=name!=null?name:'[]';if (parent) { this._context=parent._context;
parent._children[this._seqID]=this;this._trace = parent._trace;} this._links={};this._stateLinks={};this._listen={};this._notify={};this._children={};
this._pending = true;};JStrap._seqID=0;JStrap.prototype._set=function(val,links,optns) { if (typeof(val)=='function') this._evalFn=val;else {
this._evalFn = JStrap.prototype._evalFn;this._const = val;} if (!links) links={};this._links=links;this._setLinks(links);if (optns) {
if (optns.ref!=null) this._ref = optns.ref;if (optns.snap!=null) this._snap = optns.snap;} this._refresh();return this;};JStrap.prototype._unset=function() {
if (this._trace) this._debug('_unset()');this._set(undefined);return this;};JStrap.prototype._var=function(evalFn,links) { if (this._trace) this._debug('_var');
if (this._ref && this._ptr) return this._ptr._var(evalFn,links);else return this._set(evalFn,links);};JStrap.prototype._slt=function(idx,ctnt) {
var sl = this._block.getSlot(idx).JStrap();if (ctnt) sl._content = ctnt;else sl._('_content')._set(undefined);return sl;};
JStrap.prototype._sctn=function(id,initFn) { var m = this._master || this;var info = m._block.blockInfo.section(id);info.initFn = initFn;
if (!info.jst) info.jst = new JStrap()._set(info);var sc = this._();sc._t = this;sc._master = m;return info.blockVar(sc);};
JStrap.prototype._idx=function(evalFn,links) { return new JStrap.Index(this,evalFn,links);};JStrap.prototype._dyn=function(evalFn,links,optns) {
var dyn = new JStrap(this,'_dynamic')._set(evalFn,links,optns);new JStrap.Dynamic(this,dyn);return this;};JStrap.prototype._new=function() {
return new JStrap(this,'_new')._set(function(l,t) { if (l.p._ptr) return l.p._ptr._new();return t._()._unset();},{p:this},{snap:1});};
JStrap.prototype._ins=function(v) { if (this._ptr) this._assign(this._ptr._ins(v));else this._set(v._tack());return this;};JStrap.prototype._tack=function() {
return new JStack(this);};JStrap.prototype._setLinks=function(links) { var listen={};var lnk;for (var l in links) { lnk=links[l];
if (!(lnk instanceof JStrap)) alert(this._getName()+'._setLinks(): '+lnk+' is not JStrap!');listen[lnk._seqID]=lnk;
if (!this._listen[lnk._seqID]) this._addLink(lnk,true);} for (var id in this._listen) if (!listen[id]) this._delLink(this._listen[id]);};
JStrap.prototype._getName=function() { if (this._parent) return this._parent._getName()+'.'+this._name;return this._name;};JStrap.prototype._=function(n) {
if (n==null) return new JStrap();if (n.match(/\./)) { var rs=this;var l=n.split(/\./);for (var i=0;l[i]!=null;i++) rs=rs._(l[i]);return rs;}
if (this[n]==null) this[n]=this._spawn(n);return this[n];};JStrap.prototype._call=function(func,args) { return new JStrap.CallPtr(this,func,args);} 
JStrap.prototype._spawn=function(v) { var t=new JStrap.Var(this,v);t._trace = this._trace;return t;};JStrap.prototype._delete=function() { this._setLinks({});
for (var l in this._children) this._children[l]._delete();delete this._parent._children[this._seqID];delete this._parent[this._name];delete this._links;
delete this._orig;delete this._value;};JStrap.prototype._addLink=function(lnk,stf) { if (!this._listen[lnk._seqID]) { this._listen[lnk._seqID]=lnk;
if (stf) this._stateLinks[lnk._seqID] = lnk;lnk._notify[this._seqID]=this;if (this._awake) lnk._chkLinks(1);} };JStrap.prototype._delLink=function(lnk) {
if (!this._listen[lnk._seqID]) return null;delete(this._listen[lnk._seqID]);delete(this._stateLinks[lnk._seqID]);delete(lnk._notify[this._seqID]);
if (this._awake) lnk._chkLinks(-1);};JStrap.prototype._awake=false;JStrap.prototype._chklock=false;JStrap.prototype._chkLinks=function(inc) {
if (this._chklock) return alert(this+': recursive _chkLinks(): '+inc);this._nLinks += inc;if (this._trace) { this._debug('nLinks = '+this._nLinks);var a=[];
for (var k in this._notify) a.push(this._notify[k]);this._debug('notify: '+a);} if (this._awake) { if (this._nLinks>0) return;this._awake = false;
this._chklock = true;for (var k in this._listen) { this._listen[k]._chkLinks(-1);} if (this._ptr) this._ptr._chkLinks(-1);this._chklock = false;
if (this._trace) this._debug('sleep');} else { if (this._nLinks==0) return;if (this._nLinks<0) return alert(this+': _nLinks = '+this._nLinks);
this._awake = true;this._chklock = true;var rf = true;if (this._trace) this._debug('wakeup: st='+this._state);
if (this._ptr && this._ptr._chkLinks(1)) rf = false;for (var k in this._listen) { if (this._listen[k]._chkLinks(1)) rf = false;}
if (this._pending) this._context.notify(this);else this._ptrRefresh();this._pending = false;this._chklock = false;return true;} };
JStrap.prototype._getState=function() { for (var l in this._stateLinks) { var s=this._stateLinks[l]._state;if (s==null) { return null;} else if (!s) {
if (this._trace) this._debug(this._stateLinks[l]._seqID+' st='+s);return false;} } return true;};JStrap.prototype._refresh=function() { if (!this._awake) {
this._pending = true;if (this._trace) this._debug('_refresh(): pending');return;} var st=this._getState();if (this._trace) this._debug('_refresh(): st='+st);
if (st==null) return this._standby();if (st) { if (this._snap) this._setLinks({});var v = this._evalFn(this._links,this);
if (this._trace) this._debug('_refresh(): v='+v);if (v instanceof JStrap) return this._ptrAssign(v);else { if (this._ptr) this._ptrAssign(null);
if (v!==undefined) return this._assign(v);} } };JStrap.prototype._ptrRefresh=function() { if (this._awake && this._ptr) this._ptrAssign(this._ptr);};
JStrap.prototype._assign=function(v) { if (this._trace) this._debug('_assign(): v='+v);if (!this._state || v!=this._value) this._updated(true,v);};
JStrap.prototype._ptrAssign=function(ptr) { if (this._trace) this._debug('_ptrAssign(): =>'+ptr);if (ptr!=this._ptr) { if (ptr) {
(ptr._ptrNotify || (ptr._ptrNotify={}))[this._seqID] = this;ptr._chkLinks(1);} if (this._ptr) { delete this._ptr._ptrNotify[this._seqID];
this._ptr._chkLinks(-1);} this._ptr = ptr;if (!ptr) return;} if (this._trace) this._debug('_ptrAssign(): st='+ptr._state);
if (!ptr._state) return ptr._state==false?this._unload():this._standby();if (this._trace) this._debug('_ptrAssign(): _assign(): '+ptr._value);
this._assign(ptr._value);};JStrap.prototype._backflow=function(ptr) {
if (this._trace) this._debug('backflow '+ptr+', _ptr='+this._ptr+', _backPtr='+this._backPtr);if (this._ptr==ptr) return null;
if (this._ptr && this._ptr!=this._backPtr) { var f = this._ptr._backflow(ptr);if (f) this._backPtr=ptr;return f;} else { this._backPtr=null;
this._ptrAssign(ptr);this._backPtr=ptr;return true;} };JStrap.prototype._backOff=function(ptr) { if (this._trace) this._debug('backOff '+ptr);
if (this._backPtr==ptr) { this._backPtr=null;if (this._ptr) { if (this._ptr==ptr) this._refresh();else return this._ptr._backOff(ptr);} } };
JStrap.prototype._feedback=function(v) { if (!this._fdbk) this._fdbk = new JStrap(this,'_fdbk');this._backflow(this._fdbk._var(v));this._context.schedule();
return this;};JStrap.prototype._unload=function() { if (this._state!=false) this._updated(false);};JStrap.prototype._standby=function() { };
JStrap.prototype._commit=function() { };JStrap.prototype._later=function() { this._context.later(this);};JStrap.prototype._optns=function(optns) {
this._options = optns;return this;};JStrap.prototype._updated=function(st,val) { if (this._trace) this._debug('_updated: '+st+' '+val);this._state=st;
this._value=val;this._onchange();};JStrap.prototype._onchange=function() { if (this._trace) this._debug('onchange()');
if (this._ptrNotify) for (var l in this._ptrNotify) { this._ptrNotify[l]._ptrRefresh();} for (var l in this._notify) { this._context.notify(this._notify[l]);} };
JStrap.prototype._S=function() { return String(this._value);};JStrap.prototype._N=function() { return Number(this._value);};JStrap.prototype._B=function() {
if (this._value=='0') return false;if (this._value instanceof Array) return Boolean(this._value.length);return Boolean(this._value);};
JStrap.prototype._A = function() { if (this._ptr) return this._ptr._A();var r={};if (this._value) for (var k in this._value) r[k] = this._(k);return r;};
JStrap.prototype._O=function() { return this._value;};JStrap.prototype._V=function() { if (!this._state) return undefined;
if (this._value instanceof JSobj) return this._value._JSview();if (this._value instanceof Object) return [ this._value ];return this._value;};
JStrap.prototype.toString=function() { return this._getName();};JStrap.prototype._evalFn=function(l,t) { return t._const;};
JStrap.prototype._debug = function(msg) { JStrap.debug((this.constructor._class || '')+'['+this._seqID+']: '+this._getName()+': '+msg);};
JStrap.prototype._const=null;JStrap.prototype._nLinks=0;JStrap._class = 'JStrap';JStrap.t=function(e,fn) {
if (JStrap.href && e && e.tagName=='A' && e.href) JStrap.href(e.href,e);var t=JStrap.Block.find(e);if (t && fn) { fn(t);t._context.schedule();} return t;};
JStrap.init=function(objData,slotMap,pageFn,reqUrl,proj,sessID) { JStrap.obj = new JStrap.DataRoot(reqUrl);JStrap.prototype._o = JStrap.obj;
JStrap.root = new JStrap(null,'Root');JStrap.Block.setup(proj,sessID);JStrap.root._set(pageFn,{});
JStrap.Block.prototype.Global._('Args')._set(JStrap.root._('Args'));JStrap.obj._update(objData);JStrap.Slot.root = new JStrap.Slot.Root(JStrap.root,slotMap);
JStrap.root._context.schedule();return JStrap.root;};JStrap.debug = function(msg) { var dbg=document.getElementById('JSdebug');dbg.style.display='';
var e=document.createElement('p');e.innerHTML=msg;dbg.insertBefore(e,null);window.setTimeout(function() { dbg.scrollTop=dbg.scrollHeight; },0);};
JStrap.Context=function() { this.wave={};this.commit={};this.maxRecurse=10;};JStrap.Context.prototype.notify=function(jst) { this.wave[jst._seqID] = jst;};
JStrap.Context.prototype.schedule=function() { return this.refresh();};JStrap.Context.prototype.later=function(jst) { this.commit[jst._seqID] = jst;
return this.refresh();};JStrap.Context.prototype.refresh=function(maxRecurse) { if (this.inProgress) return false;
if (maxRecurse==null) maxRecurse=this.maxRecurse;this.inProgress=true;var updated={};var recurse={};var ct;var steps=0;var total=0;var rct=0;while (true) { ct=0;
for (var l in this.wave) { if (updated[l]) { if (!recurse[l]) recurse[l]=1; else recurse[l]++;if (!maxRecurse || maxRecurse<recurse[l]) continue;rct++;}
var w=this.wave[l];delete this.wave[l];w._refresh();updated[l]=w;ct++;total++;} if (!ct) { var comct=0;for (var l in this.commit) { var jst=this.commit[l];
delete this.commit[l];jst._commit();comct++;} if (!comct) { this.inProgress=false;var me=this;if (rct) window.setTimeout(function() { me.refresh(); },100);
return rct;} } steps++;} };JStrap.prototype._context = new JStrap.Context();JSobj=function() { };JSobj.prototype.update = function(val) {
for (var k in val) this[k] = val[k];};JSobj.prototype._JSview = function() { if (this._key) return [ this._key, this._class ];return [ this._key, this._class ];
};JSobj.prototype._load = function(lnks,jst) { var cls = lnks.object._parent;if (lnks.args['0'] || lnks.args._value['0']) {
return new JStrap(jst,'_tmp')._set(function(l,t) { return l.cls._(l.id._S()); },{cls:cls,id:lnks.args._('0')});} else return cls._('*'+jst._seqID);};
JSobj.prototype.toString=function() { var r = 'JSobj';if (this.constructor._class) { r += '.' + this.constructor._class;if (this.id) r += '('+this.id+')';}
return r;};JSobj.define=function(val,proto) { if (!proto) proto=JSobj;var cls=function() { proto.call(this);};cls.prototype = new proto();
cls.prototype.constructor = cls;cls.prototype.update(val);return cls;};JStrap.Scope=function(parent,name) { JStrap.call(this,parent,name);if (!parent) return;};
JStrap.Scope.prototype = new JStrap();JStrap.Scope.prototype.constructor = JStrap.Scope;JStrap.Scope.prototype._spawn = function(name) {
return new JStrap(this,name);};JStrap.Var=function(parent,name) { JStrap.call(this,parent,name);if (!parent) return;this._set(this._evalFn,{p:parent});};
JStrap.Var.prototype = new JStrap();JStrap.Var.prototype.constructor = JStrap.Var;JStrap.Var.prototype._evalFn = function(l,t) {
if (l.p._ptr) return l.p._ptr._(t._name);if (!l.p._value) return null;return l.p._value[t._name];};JStrap.Var.prototype._call=function(func,args) {
return new JStrap.CallPtr(this,func,args);};JStrap.Var.prototype._ref = true;JStrap.Var._class = 'Var';JStrap.Dynamic=function(parent,val) {
JStrap.call(this,parent,'_dynamic');if (!parent) return;this._set(this._evalFn,{p:parent});this._dynValue = val;this._chkLinks(1);};
JStrap.Dynamic.prototype = new JStrap();JStrap.Dynamic.prototype.constructor = JStrap.Dynamic;JStrap.Dynamic.prototype._evalFn = function(l,t) {
l.p._var(t._dynValue);t._unset();};JStrap.CallPtr=function(parent,func,args) { JStrap.call(this,parent,func);if (!parent) return;
if (!(args instanceof JStrap)) args=new JStrap(null,'args')._set(args || null);this._set(this._evalFn,{p:parent,args:args});};
JStrap.CallPtr.prototype = new JStrap();JStrap.CallPtr.prototype.constructor = JStrap.CallPtr;JStrap.CallPtr.prototype._evalFn = function(l,t) {
if (l.p._ptr) return l.p._ptr._call(t._name,l.args);return t._()._unset();};JStrap.CallPtr._class = 'CallPtr';JStrap.Index=function(parent,evalFn,links) {
JStrap.call(this,parent,'[index]');this._i = new JStrap(this,'_i')._set(evalFn,links);this._set(this._evalFn,{p:parent,i:this._i});};
JStrap.Index.prototype = new JStrap.Var();JStrap.Index.prototype.constructor = JStrap.Index;JStrap.Index.prototype._evalFn=function(l,t) {
return l.p._(l.i._S());};JStrap.Index._class = 'Index';JStrap.Call = function(jst,evalFn,lnks) { JStrap.call(this,null,jst+':call');if (!lnks) lnks={};
lnks.object = jst;this._set(evalFn,lnks);};JStrap.Call.prototype = new JStrap();JStrap.Call.prototype.constructor = JStrap.Call;JStrap.Call._class = 'Call';
JStrap.Text = function(parent,args) { JStrap.call(this,parent,'[text]');this.args = args;var lnks = {};
for (var i=0;i<args.length;i++) if (args[i] instanceof JStrap) lnks[i]=args[i];this._set(this._evalFn,lnks);};JStrap.Text.prototype = new JStrap();
JStrap.Text.prototype.constructor = JStrap.Text;JStrap.Text.prototype._evalFn=function(l,t) { var r='';
for (var i=0;i<t.args.length;i++) r+=(t.args[i] instanceof JStrap)?t.args[i]._S():t.args[i];return r;};JStrap.Text._class = 'Text';
JStrap.Collection=function(parent,name) { JStrap.Var.call(this,parent,name);};JStrap.Collection.prototype = new JStrap.Var();
JStrap.Collection.prototype.constructor = JStrap.Collection;JStrap.Data=function(parent,name) { JStrap.call(this,parent,name);if (parent) {
this._json = parent._json;this._root = parent._root;} };JStrap.Data.prototype = new JStrap();JStrap.Data.prototype.constructor = JStrap.Data;
JStrap.Data.prototype._spawn=function(name) { return new JStrap.Var(this,name);};JStrap.Data.prototype._evalFn=function(lnk,jst) {
if (this._rValue!==undefined) { var v = this._rValue;if (v==null) return this._unload();return v;} this._json.request(this);
if (this._trace) this._debug('request');this._rValue=null;return undefined;};JStrap.Data.prototype._update=function(val) {
if (this._trace) this._debug('_update: '+val);if (val instanceof Array) { if (val[0] instanceof Array) { this._rValue = new JStrap.DataCollection(this);
for (var i=0;i<val[0].length;i++) this._rValue._(String(i))._update(val[0][i]);this._rValue._set(val[0]);} else if (!val[1]) this._rValue = val[0];
else if (val[0] instanceof Object) { } else if (!val[0]) { this._rValue=this._root._(val[1])._call('_load');} else this._rValue=this._root._(val[1])._(val[0]);
} else this._rValue = val;this._context.notify(this);};JStrap.Data.prototype._addReq=function(req) { if (!this._parent) return req;
var r = this._parent._addReq(req);if (!r[this._name]) r[this._name]={};return r[this._name];};JStrap.Data.prototype._getProto=function() {
var p = this._parent._getProto();if (p) return p[this._name];return null;};JStrap.Data.prototype._var=function(jst) { alert(this+' = '+jst);};
JStrap.Data._class = 'Data';JStrap.DataRoot=function(url) { JStrap.Data.call(this,null,'Obj');this._json = new JSobj.JSON(url);this._root = this;};
JStrap.DataRoot.prototype = new JStrap.Data();JStrap.DataRoot.prototype.constructor = JStrap.DataRoot;JStrap.DataRoot.prototype._spawn=function(name) {
return new JStrap.DataClass(this,name);};JStrap.DataRoot.prototype._update=function(val) { if (val) { for (var k in val) this._(k)._update(val[k]);
this._value = null;this._state=true;} };JStrap.DataRoot.prototype._evalFn=function(lnk,jst) { return this._value;};JStrap.DataClass=function(parent,name) {
JStrap.Data.call(this,parent,name);this._set(this._evalFn,{p:parent});};JStrap.DataClass.prototype = new JStrap.Data();
JStrap.DataClass.prototype.constructor = JStrap.DataClass;JStrap.DataClass.prototype._spawn=function(name) { return new JStrap.JSobj(this,name);};
JStrap.DataClass.prototype._update=function(val) { if (val) { if (val._proto) { this._assign(val._proto);delete val._proto;}
if (!this._('*')._value) this._('*')._update({});for (var k in val) this._(k)._update(val[k]);} };JStrap.DataClass.prototype._call=function(func,args) {
return this._('*')._call(func,args);};JStrap.DataClass.prototype._evalFn=function(lnk,jst) { if (jst._value) return jst._value;this._json.request(this);
return null;return undefined;};JStrap.JSobj=function(parent,name) { JStrap.Data.call(this,parent,name);this._set(this._evalFn,{p:parent});};
JStrap.JSobj.prototype = new JStrap.Data();JStrap.JSobj.prototype.constructor = JStrap.JSobj;JStrap.JSobj.prototype._spawn=function(name) {
return new JStrap.Data(this,name);};JStrap.JSobj.prototype._update=function(val) { if (this._trace) this._debug('_update: '+val);if (!this._value) {
if (!this._parent._value) alert(this);if (this._parent._value.prototype._init) this._value = this._parent._value.prototype._init(val,this);
else this._value = new this._parent._value() } if (val) for (var k in val) if (this[k]) this[k]._update(val[k]);this._state=true;this._onchange();};
JStrap.JSobj.prototype._evalFn=function(lnk,jst) { if (jst._value) return jst._value;this._json.request(this);return undefined;};
JStrap.JSobj.prototype._getProto=function() { return this._value;};JStrap.JSobj.prototype._call=function(func,args) { return new JStrap.RCall(this,func,args);};
JStrap.RCall=function(obj,func,args) { JStrap.Data.call(this,obj,func);this._set(this._evalFn,{obj:obj,args:new JStrap(this)._set(args || {})});};
JStrap.RCall.prototype = new JStrap.Data();JStrap.RCall.prototype.constructor = JStrap.RCall;JStrap.RCall.prototype._evalFn=function(lnk,jst) {
if (this._rValue!==undefined) { var v = this._rValue;delete this._rValue;if (v==null) return undefined;return v;} var p = lnk.obj._getProto();
if (lnk.obj._value && p && p[jst._name]) { return new JStrap.Call(lnk.obj,function(l,t) { return p[jst._name](l,t);},lnk);} var al = lnk.args._A();
return new JStrap(this,'[req_args]')._set(function(l,t) { jst._json.request(jst);return null;},al);};JStrap.RCall.prototype._addReq=function(req) {
var r = this._parent._addReq(req);var k = '*' + this._seqID;this._parent[k] = this;var al = this._links.args._A();var cargs = {};
for (var i in al) cargs[i] = al[i]._V();if (!r[k]) r[k] = [this._name, cargs, {}];return r[k][2];};JStrap.RCall._class = 'RCall';
JStrap.DataCollection=function(parent) { JStrap.Collection.call(this,parent);};JStrap.DataCollection.prototype = new JStrap.Collection();
JStrap.DataCollection.prototype.constructor = JStrap.DataCollection;JStrap.DataCollection.prototype._spawn=function(name) {
return new JStrap.Data(this._parent,name);};JStrap.DataCollection.prototype._new=function() { return new JStrap(this,'_new')._set(function(l,t) {
var idx = l.p._value.length;var t = l.p._(String(idx));var p = l.p._parent._getProto();if (p && p._new) t._set(new JStrap.Call(l.p,p._new));var v=[];
for (var i=0;i<idx;i++) v[i]=l.p._value[i];v[idx] = t;l.p._set(v);return t;},{p:this},{snap:1});};JStrap.DataCollection.prototype._call=function(func,args) {
if (func=='_new') { var idx = this._value.length;var t = this._(String(idx));var p = this._parent._getProto();
if (p && p[func]) t._set(new JStrap.Call(this,p[func]));var v=[];for (var i=0;i<idx;i++) v[i]=this._value[i];v[idx] = t;this._set(v);return t;}
return new JStrap(this)._unset();};JStrap.ObjTree=function(parent,name) { JStrap.call(this,parent,name);this._set(null);};
JStrap.ObjTree.prototype = new JStrap();JStrap.ObjTree.prototype.constructor = JStrap.ObjTree;JStrap.ObjTree.prototype._call = function(func,args) {
var path=[func];for (var j=this;j;j=j._parent) { path.unshift(j._name);} return JStrap.obj._(path.join('_'))._call('_load',args);};
JStrap.ObjTree.prototype._spawn = function(name) { return new JStrap.ObjTree(this,name);};JSobj.JSON=function(url) { JSobj.call(this);this.url = url;};
JSobj.JSON.prototype = new JSobj();JSobj.JSON.prototype.constructor = JSobj.JSON;JSobj.JSON.prototype.request=function(jst) {
if (!this.json || this.json._requestSent) this.json = new JStrap.JSON(this.url);jst._addLink(this.json);};JStrap.JSON=function(url) {
JStrap.call(this,null,'JSON');this.url = url;this.req = {};};JStrap.JSON.prototype = new JStrap();JStrap.JSON.prototype.constructor = JStrap.JSON;
JStrap.JSON.prototype._refresh=function() { if (!this._awake) return this._pending=true;this.buildReq();this.sendReq();};
JStrap.JSON.prototype.buildReq=function() { for (var k in this._notify) this._notify[k]._addReq(this.req);};JStrap.JSON.prototype.var2json=function(arr) {
if (arr instanceof Array) { var parts = [];for(var i=0;i<arr.length;i++) { parts.push(this.var2json(arr[i]));} return '['+parts.join(',')+']';
} else if (arr instanceof Object) { var parts = [];for(var key in arr) { parts.push('"' + key + '":'+this.var2json(arr[key]));} return '{'+parts.join(',')+'}';
} else if (arr==null) { return "null";} else { return '"'+String(arr).replace(/([^\w\. -\@])/g,'\\$1')+'"';} };JStrap.JSON.prototype.sendReq=function(jst) {
var me = this;var req = this.var2json(this.req);this._requestSent = true;jQuery.ajax({ type: 'POST', url: this.url, data: 'req='+escape(req)
+'&page='+escape(document.location.href) +'&prefix=jst'+String(++JStrap.JSON.reqNo)+'x', success: function(data) { var junk = document.createElement('div');
junk.style.display='none';junk.innerHTML = '--'+data;var sc = junk.getElementsByTagName('script');var s=[];for (var i=0;sc[i];i++) {
if (sc[i].src) document.getElementsByTagName('head')[0].appendChild(sc[i]);else s.push(sc[i]);} for (var i=0;s[i];i++) s[i].parentNode.removeChild(s[i]);
document.getElementsByTagName('body')[0].appendChild(junk);for (var i=0;s[i];i++) try { eval(s[i].innerHTML); } catch(e) { alert(s[i].innerHTML);
me._debug(e.name+': '+e.message);};me._assign(null);JStrap.root._context.schedule();} });};JStrap.JSON.reqNo = 0;JSobj.Dom = function(id,dom,info,inst) {
JSobj.call(this);if (info) { this.blockInfo = info;if (!info.proto) info.proto = this;if (!id) id = info.id + '_' + info.getInst(inst);} this.htmlID = id;
if (dom) { this.dom = dom;if (id) dom.id = id;} else if (id) this.dom = document.getElementById(id);this.parentNode = this.dom ? this.dom.parentNode : null;};
JSobj.Dom.prototype=new JSobj();JSobj.Dom.prototype.constructor=JSobj.Dom;JSobj.Dom.prototype.linkTo=function(anchor) { if (anchor==this.prev) return;
if (this.next) { this.next.prev = this.prev;if (this.next.dom) this.next.prevDom(this.prev && this.prev.dom ? this.prev : null);} if (this.prev) {
this.prev.next = this.next;if (this.prev.dom) this.prev.nextDom(this.next && this.next.dom ? this.next : null);} this.prev = anchor;if (anchor) {
this.next = anchor.next;anchor.next = this;this.parentNode = anchor.parentNode;var dflg = true;
if (anchor.dom) dflg = anchor.nextDom(this.dom ? this : null,true);if (this.dom) this.prevDom(anchor.dom ? anchor : null,dflg!=false);} else { this.next = null;
this.parentNode = null;this.domFunc = null;if (this.dom) this.prevDom(null,true);} if (this.next) { this.next.prev = this;
if (this.dom) this.nextDom(this.next.dom ? this.next : null);this.next.prevDom(this.dom ? this : null);} else if (this.dom) this.nextDom(null);};
JSobj.Dom.prototype.nextDom=function(next,join) { };JSobj.Dom.prototype.prevDom=function(prev,join) { if (!join) return;
if (prev && this.parentNode) (prev.dom.nextSibling || this).parentNode.insertBefore(this.dom,prev.dom.nextSibling);
else if (this.dom.parentNode) this.dom.parentNode.removeChild(this.dom);};JSobj.Dom.prototype.truncate=function() { while (this.next) {
if (this.next.container) this.next.container.linkTo(null);else this.next.linkTo(null);} };JSobj.Dom.prototype.mkAnchor=function(anchor) { if (!this.prev) {
if (this.parentNode) { this.prev = new JSobj.Dom(null,this.parentNode.insertBefore(document.createTextNode(''),this.dom));} else this.prev = new JSobj.Dom();}
this.prev.dummyNode = this.dom;this.prev.next = this;return this.prev;};JSobj.Dom.prototype.anchor=function(idx,slot) { if (!this.anchors) this.anchors = {};
if (!this.anchors[idx]) { if (!slot) slot = this.dummy(idx);this.anchors[idx] = slot.mkAnchor();} return this.anchors[idx];};
JSobj.Dom.prototype.dummy=function(idx,dom) { if (!this.dummies) this.dummies = {};if (!this.dummies[idx]) { var id = this.htmlID+'_'+idx;
if (!dom && this.anchors && this.anchors[idx] && this.anchors[idx].dummyNode) { dom = this.anchors[idx].dummyNode.cloneNode(false);
this.anchors[idx].dummyNode = dom;} this.dummies[idx] = new JSobj.Dom.Field(id,dom);
if (this.blockInfo) this.dummies[idx].slotID = this.blockInfo.id + '.' + idx;} return this.dummies[idx];};JSobj.Dom.prototype.build=function(init,blkid) {
for (var slt in init) { var last = null;for (var i=0;init[slt][i];i+=2) { var s=init[slt][i].match(/(.*)_(\d+)/);var info = JSobj.Block.get(s[1]);
var b = new JSobj.Dom(null,null,info,s[2]);if (blkid) b.slotID = blkid + '.' + slt;b.build(init[slt][i+1],s[1]);
if (!last) this.anchor(slt,b); else b.linkTo(last);last = b;} } };JSobj.Dom.prototype.putDummies=function() { if (!this.anchors) return;
for (var slt in this.anchors) { if (this.anchors[slt].next) this.anchors[slt].next.putDummies();else { var d = this.dummy(slt);d.setValue(null);
d.linkTo(this.anchors[slt]);} } if (this.next) this.next.putDummies();};JSobj.Dom.prototype.scanIDs=function(map,dom) { if (dom.id) map[dom.id]=dom;
for (var e=dom.firstChild;e;e=e.nextSibling) this.scanIDs(map,e);};JSobj.Dom.prototype.clone=function(map,cmap,scont,sidx) { if (!map) { if (!this.container) { }
map = {};cmap = {};this.putDummies();if (this.dom) this.scanIDs(map,this.dom.cloneNode(true));return this.clone(map,cmap).fixSlots(map,cmap);} var cl;
if (this.blockInfo) cl = new JSobj.Dom(null,map[this.htmlID],this.blockInfo);else if (scont) { cl = scont.dummy(sidx,map[this.htmlID]);} else {
alert('clone(): no ID for '+this.htmlID);cl = new JSobj.Dom();} if (this.htmlID) { cmap[this.htmlID] = cl;delete map[this.htmlID];} cl.slotID = this.slotID;
if (this.anchors) for (var slt in this.anchors) { var lastc = null;for (var p=this.anchors[slt].next;p;p=p.next) { var c = p.clone(map,cmap,cl,slt);
if (lastc) c.linkTo(lastc);else cl.anchor(slt,c);lastc = c;} } return cl;};JSobj.Dom.prototype.fixSlots=function(map,cmap) { for (var id in map) {
var p = id.match(/^(.*)_(\d+)$/);if (p && cmap[p[1]]) { cmap[p[1]].dummy(p[2],map[id]);delete map[id];} } return this;};JSobj.Dom.prototype.newID=function() {
if (!this.blockInfo) alert(this.htmlID);return this.blockInfo.id + '_' + this.blockInfo.getInst();};JSobj.Dom.prototype.swapContainer=function(contDom) {
this.linkTo(null);if (!this.dom || !contDom.dom) return;var cont = contDom.dom.cloneNode(false);cont.id = this.htmlID;for (var ch=this.dom.firstChild;ch;) {
var next = ch.nextSibling;cont.appendChild(ch);ch = next;} this.dom = cont;if (cont.style.display=='none') cont.style.display='';this.slotID = contDom.slotID;};
JSobj.Dom.prototype.callDomFunc=function(anchor) { if (!this.domFunc || !this.dom) return false;var rs = false;if (!this.domFuncObj) this.domFuncObj = {};try {
rs = this.domFunc.call(this.domFuncObj,this.dom,anchor?anchor.dom:null);} catch(e) { this._debug('callDomFunc(): '+e.message);} return rs===false;};
JSobj.Dom.prototype.setEffect=function(func) { func(this);this.nextDom(this.next && this.next.dom ? this.next : null);};
JSobj.Dom.prototype.toString=function() { var r = 'JSobj.Dom';if (this.blockInfo) r += ':'+this.blockInfo.id;if (this.dom) {
r += '('+this.dom.tagName+' '+this.dom.id;if (this.dom.parentNode) r += ' &laquo; '+this.dom.parentNode.tagName+' '+this.dom.parentNode.id;
if (this.parentNode) r += ' || '+this.parentNode.tagName+' '+this.parentNode.id;r += ')';if (this.prev) r += ' &laquo; ' + this.prev;} return r;};
JSobj.Dom.prototype._debug=function(msg) { JStrap.debug(this+': '+msg);};JSobj.Dom._class='Dom';JSobj.Dom.Field=function(id,dom) { JSobj.Dom.call(this,id,dom);
if (!this.dom || !this.dom.tagName) return;var f='initTag_'+this.dom.tagName;if (this[f]) this[f]();};JSobj.Dom.Field.prototype=new JSobj.Dom();
JSobj.Dom.Field.prototype.constructor=JSobj.Dom.Field;JSobj.Dom.Field.prototype.initTag_INPUT=function() { switch (this.dom.type) { case 'select-one':
this.setValue = this.setValue_Select;this.getValue = this.getValue_Input;this.initEvents('onchange');break;case 'checkbox': case 'radio':
this.setValue = this.setValue_Checkbox;this.getValue = this.getValue_Checkbox;this.initEvents('onclick');break;default: this.setValue = this.setValue_Input;
this.getValue = this.getValue_Input;this.initEvents('onchange');break;} };JSobj.Dom.Field.prototype.initTag_TEXTAREA=JSobj.Dom.Field.prototype.initTag_INPUT;
JSobj.Dom.Field.prototype.initTag_SELECT=JSobj.Dom.Field.prototype.initTag_INPUT;JSobj.Dom.Field.prototype.initTag_TITLE=function() {
this.setValue = this.setValue_Input;this.getValue = this.getValue_Input;};JSobj.Dom.Field.prototype.setValue_Input=function(val) {
this.dom.value = val!=null?val:'';this.dom.disabled = val===undefined;return val;};JSobj.Dom.Field.prototype.setValue_Select=function(val) {
if (val===undefined) { this.dom.disabled = true;return null;} this.dom.disabled = false;var optns=this.dom.options;
for (var i=0;optns[i];i++) if (optns[i].value==String(val)) { optns[i].selected = true;break;} return this.dom.value;};
JSobj.Dom.Field.prototype.setValue_Checkbox=function(val) { this.dom.checked = this.dom.value==String(val);this.dom.disabled = val===undefined;return val;};
JSobj.Dom.Field.prototype.initEvents=function(ev) { var me = this;var evnt = this.dom[ev];this.dom[ev]=function(event) {
if (me.slot) me.slot._feedback(me.getValue());if (evnt) evnt.call(this,event);};};JSobj.Dom.Field.prototype.setValue=function(val) { if (this.dom) {
if (val!=null) this.dom.innerHTML = val;this.dom.style.display=val==null?'none':'';} };JSobj.Dom.Field.prototype.getValue=function(val) {
if (this.dom) return this.dom.innerHTML;};JSobj.Dom.Field.prototype.getValue_Input=function(val) { return this.dom.value;};
JSobj.Dom.Field.prototype.getValue_Checkbox=function(val) { return this.dom.checked ? this.dom.value : null;};
JSobj.Dom.Field.prototype.setAttr=function(attr,val) { if (this.dom) { this.dom.setAttribute(attr,val);} return this.getAttr(attr);};
JSobj.Dom.Field.prototype.getAttr=function(attr) { return this.dom?this.dom.getAttribute(attr):null;};JSobj.Dom.Field._class='Dom.Field';
JSobj.Block=function() { JSobj.call(this);this.nextInst = 1;};JSobj.Block.prototype = new JSobj();JSobj.Block.prototype.constructor = new JSobj.Block;
JSobj.Block.prototype._init = function(val,jst) { var obj = JSobj.Block.get(this.id);obj.update({id:this.id,_initFn:this._initFn});return obj;};
JSobj.Block.prototype._load = function(lnks,jst) { return new JStrap.BlockVar(lnks.object,lnks.args);};JSobj.Block.prototype.getInst=function(inst) {
if (!inst) inst = this.nextInst++;else if (Number(inst)>=this.nextInst) this.nextInst = Number(inst) + 1;return inst;};JSobj.Block.get=function(id) {
if (!JSobj.Block[id]) { JSobj.Block[id] = new JSobj.Block();JSobj.Block[id].id = id;} return JSobj.Block[id];};JSobj.Block.define=function(val) {
return JSobj.define(val,JSobj.Block);};JSobj.Block._class='Block';JSobj.BlockVar=function(info,args) { if (!info) return;this.blockInfo = info;
this.block = new info.blockProto(this,args);this.container = new info.containerProto(info,this.block);};JSobj.BlockVar.prototype = new JSobj();
JSobj.BlockVar.prototype.constructor = JSobj.BlockVar;JSobj.BlockVar.prototype.getContainer = function(dom) { if (dom && !dom.container) {
if (!this.container.domObj && dom.blockInfo==this.blockInfo) this.container.setDOM(dom);} return this.container;};
JSobj.BlockVar.prototype.section=function(idx,initFn) { var info=JSobj.Block.get(this.blockInfo.id+'s'+idx);if (!info._initFn) info._initFn = initFn;
if (!info.jstInfo) { info.jstInfo = new JStrap(null,'Section:'+info.id)._set(info);} return info.jstInfo;};JSobj.BlockVar._class='BlockVar';
JStrap.Slot = function(container,idx) { JStrap.call(this,container,idx);this._ref = true;this._pending = false;this.idx = idx;this.link = container;};
JStrap.Slot.prototype=new JStrap();JStrap.Slot.prototype.constructor=JStrap.Slot;JStrap.Slot.prototype._spawn=function(name) {
alert(this+':_spawn('+name+') called on slot');};JStrap.Slot.prototype.showDummy=function(val) { var d = this.dummy();if (d) { d.setValue(val);
d.linkTo(this.anchor());d.truncate();} };JStrap.Slot.prototype.hideDummy=function(remove) { if (this._dummy) this._dummy.linkTo(null);
if (remove) this.anchor().truncate();};JStrap.Slot.prototype.anchor=function() { if (!this._anchor) { this._anchor = this._parent.domObj.anchor(this.idx);
if (this._options && this._options.effect) try { this._anchor.setEffect(eval(this._options.effect));} catch (e) { this._debug('effect: '+e.message,1);} }
return this._anchor;};JStrap.Slot.prototype.dummy=function() { if (!this._dummy) { this._dummy = this._parent.domObj.dummy(this.idx);this._dummy.slot = this;}
return this._dummy;};JStrap.Slot.prototype.slotID=function() { if (!this._parent) return null;return this._parent.blockInfo.id + '.' + this.idx;}
JStrap.Slot.prototype._updated=function(st,val) { var block=null;if (this._trace) this._debug('updated: '+st+' '+val);if (!st) { this.hideDummy(true);
} else if (val instanceof JSobj.BlockVar) { block = val.getContainer(this.anchor().next);this.hideDummy();} else { this.showDummy(val);} this._state = st;
this._value = val;if (block!=this.block) { if (block) block.linkTo(this);this.block = block;} this._onchange();};JStrap.Slot.prototype._attr=function(attr) {
if (!this.attr) this.attr = {};if (!this.attr[attr]) this.link._addLink(this.attr[attr] = new JStrap.Slot.Attr(this,attr));return this.attr[attr];};
JStrap.Slot.Root = function(jstRoot,slotMap) { JStrap.Slot.call(this,null,'root');var root = new JSobj.Dom();root.build({0:slotMap});
this._anchor = root.anchor(0);this.link = new JStrap(this,'link');this.link._awake = true;this.link._addLink(this);this._set(jstRoot);};
JStrap.Slot.Root.prototype=new JStrap.Slot();JStrap.Slot.Root.prototype.constructor=JStrap.Slot.Root;JStrap.Container=function(info,block) { if (!info) return;
JStrap.call(this,null,'Container:'+info.id+'_?');this.blockInfo = info;this.Content = block._('Content');this.block = block;this._addLink(block);};
JStrap.Container.prototype = new JStrap;JStrap.Container.prototype.constructor = JStrap.Container;JStrap.Container.prototype._spawn = function(name) {
if (isNaN(name)) return alert(this+':_spawn('+name+') called on Container');var slt = new JStrap.Slot(this,name);this._addLink(slt);return slt;};
JStrap.Container.prototype.loadDOM=function(slt) { if (!this.domObj) { var proto = this.blockInfo.proto;if (proto) this.setDOM(proto.clone());else {
this.domObj = new JSobj.Dom();this.domObj.container = this;} if (this._trace) this._debug('loadDOM(): '+this.domObj);}
if (slt && slt.Content && (this.domObj.slotID != slt.slotID())) this.domObj.swapContainer(slt.dummy());return this.domObj;};
JStrap.Container.prototype.setDOM=function(dom) { this.domObj = dom;this._name = 'Container:'+dom.htmlID;dom.container = this;
JStrap.Block[dom.htmlID] = this.block;};JStrap.Container.prototype.linkTo=function(slt) { if (this._trace) this._debug('linkTo: '+slt);
if (this.linked === slt) return true;var addl = null;if (this.linked && this.linked.block==this) { if (this._trace) this._debug(this.linked+': unlink');
this.linked.block=null;} if (slt)  { this.loadDOM(slt).linkTo(slt.anchor());if (!this._s) this.domObj.truncate();this.Content._set(slt.Content);
(addl = slt.link)._addLink(this);} else { if (this.domObj) this.domObj.linkTo(null);if (this._s) { this._s._state=null;this._s.block=null;}
this.Content._unset();} if (this.linked) { if (this._trace && slt) this._debug('double link: '+slt+' '+this.linked,1);
if (addl!=this.linked.link) this.linked.link._delLink(this);} this.linked = slt;};JStrap.Container.prototype.initDone=function() { };
JStrap.BlockVar=function(info,args,parent) { JStrap.call(this,info,'instance');var lnks = {info:info,args:args};if (parent) lnks.parent = parent;
this._set(this._evalFn,lnks);};JStrap.BlockVar.prototype = new JStrap();JStrap.BlockVar.prototype.constructor = JStrap.BlockVar;
JStrap.BlockVar.prototype._evalFn = function(lnk,jst) { var bv = new JSobj.BlockVar(lnk.info._value,lnk.args);if (lnk.parent) { bv.block._t = lnk.parent;
bv.block._master = lnk.parent._master || lnk.parent;} return bv;};JStrap.BlockVar.prototype._spawn = function(name) {
return new JStrap.Var(this,name)._set(this._evalFnChild,{b:this});};JStrap.BlockVar.prototype._evalFnChild = function(lnk,jst) { var b = lnk.b._value.block;
return b._tmp(function(l,t) { return l.b._(jst._name); },{b:b});};JStrap.Block=function(blockvar,args) { JStrap.Scope.call(this,null,blockvar.blockInfo.id);
this._blockVar = blockvar;this._('Args')._var(args);this._p=this;this._set(this._evalFn,{});};JStrap.Block.prototype = new JStrap.Scope();
JStrap.Block.prototype.constructor = JStrap.Block;JStrap.Block.prototype._evalFn = function(lnk,jst) { if (this._trace) this._debug('_initFn()');
this._blockVar.blockInfo._initFn(this);this._blockVar.getContainer().initDone();return this._blockVar;};JStrap.Block.prototype._slt = function(idx,content) {
var slt = this._blockVar.getContainer()._(String(idx));if (!slt.Content) slt.Content = content;return slt;};JStrap.Block.prototype._sctn=function(id,initFn) {
var m = this._master || this;var sc = m._blockVar.section(id,initFn);var bv = new JStrap.BlockVar(sc,new JStrap(),this);return bv;};
JStrap.Block.prototype._tmp=function(evalFn,links) { return this._()._set(evalFn,links,{ref:1});};JStrap.Block.prototype._text=function() {
if (arguments.length<=1) return arguments[0];return new JStrap.Text(this,arguments);};JStrap.Block.prototype._foreach=function(evalFn,links,entryMap,body) {
var loop=new JStrap.ForEach(this,evalFn,links,entryMap,body);return loop;};JStrap.Block.prototype._if=function(evalFn,links,v_then,v_else) {
var cond = new JStrap()._set(evalFn,links);var jst = new JStrap.If(this,cond,v_then,v_else);return jst;};JStrap.Block.prototype._out=function(id,evalFn,links) {
return this._slt(id)._set(evalFn,links);};JStrap.Block.prototype._fld=function(idx,evalFn,links) { return this._slt(idx)._set(evalFn,links);};
JStrap.Block.find=function(e) { var r;while (e) { if (e.id) { if (r=JStrap.Block[e.id]) return r;if (r=JStrap.Block[e.id.replace(/_\d+$/,'')]) return r;}
e=e.parentNode;} return null;};JStrap.Block.setup=function(proj,sessid) { JStrap.Block.prototype.Block = new JStrap.ObjTree(null,proj+'_Block');
JStrap.Block.prototype.Object = new JStrap.ObjTree(null,proj+'_View');
JStrap.Block.prototype.Session = new JStrap(null,'Session')._set(JStrap.obj._(proj+'_View_Session')._(sessid));
JStrap.Block.prototype.Global = new JStrap.Scope(null,'Global');};JSobj.Block.prototype.blockProto = JStrap.Block;
JSobj.Block.prototype.containerProto = JStrap.Container;JStrap.ForEach=function(parent,evalFn,links,entryMap,body) { JStrap.call(this,parent,'[ForEach]');
this._list=new JStrap(this,'_list')._set(evalFn,links);this._p = new JStrap(this,'_p');this._p._s = new JStrap(this._p,'_s');for (var k in entryMap) {
this._p._(k)._var(entryMap[k]);} this._members = new JStrap.ForEach.Members(this,this._list,this._p,body);
this._set(this._evalFn,{s:this._p._s,m:this._members});};JStrap.ForEach.prototype=new JStrap();JStrap.ForEach.prototype.constructor=JStrap.ForEach;
JStrap.ForEach.prototype._evalFn=function(l,t) { return l.s;};JStrap.ForEach.prototype._spawn = function(name) {
return new JStrap(this,name)._var(this._evalFnChild,{m:this._members});};JStrap.ForEach.prototype._evalFnChild = function(lnk,jst) {
return lnk.m._ptr._(jst._name);};JStrap.ForEach.Members=function(parent,list,p,body) { JStrap.call(this,parent,'_members');
this._set(this._evalFn,{list:list,p:p,body:body});};JStrap.ForEach.Members.prototype=new JStrap();
JStrap.ForEach.Members.prototype.constructor=JStrap.ForEach.Members;JStrap.ForEach.Members.prototype._spawn=function(name) { var t = this._spawnFn(this);
t._p = new JStrap(t,'_p');t._v = new JStrap(t,'_v');t._k = new JStrap(t,'_k');return t;};JStrap.ForEach.Members.prototype._evalFn=function(l,t) {
this._blockVar = l.body;l.body._value.blockInfo.containerProto = JStrap.ForEach.Container;var p = l.p;for (var k in l.list._value) {
var idx = String(l.list._value[k]._seqID);var m = t._(idx);m._p._set(p);m._v._set(l.list._value[k]);m._k._set(k);p._s._set(m);p = m;} p._s._unset();return p;};
JStrap.ForEach.Members.prototype._spawnFn=function(members) { var bv = members._blockVar._evalFn(members._blockVar._links,members._blockVar);return bv.block;};
JStrap.ForEach.Container=function(info,block) { JStrap.Container.call(this,info,block);this._s = new JStrap.ForEach.Slot(this)._set(block._('_s'));
this._addLink(this._s);};JStrap.ForEach.Container.prototype = new JStrap.Container();JStrap.ForEach.Container.prototype.constructor = JStrap.ForEach.Container;
JStrap.ForEach.Slot=function(container) { JStrap.Slot.call(this,container,'_s');};JStrap.ForEach.Slot.prototype = new JStrap.Slot();
JStrap.ForEach.Slot.prototype.constructor = JStrap.ForEach.Slot;JStrap.ForEach.Slot.prototype.anchor=function() { return this._parent.loadDOM();};
JStrap.If=function(parent,cond,v_then,v_else) { JStrap.call(this,parent,'[if]');this._Then = new JStrap(this,'_Then')._set(v_then);
this._Else = new JStrap(this,'_Else')._set(v_else || '');cond._refresh();this._set(this._evalFn,{cond:cond});};JStrap.If.prototype=new JStrap();
JStrap.If.prototype.constructor=JStrap.If;JStrap.If.prototype._evalFn=function(l,t) { return l.cond._value ? t._Then : t._Else;};
JStrap.Slot.Attr = function(slot,attr) { JStrap.call(this,slot,attr);};JStrap.Slot.Attr.prototype=new JStrap();
JStrap.Slot.Attr.prototype.constructor=JStrap.Slot.Attr;JStrap.Slot.Attr.prototype._spawn=function(name) { alert(this+':_spawn('+name+') called on slot');};
JStrap.Slot.Attr.prototype.loadDOM=function() { if (!this.dom) this.dom = this._parent.dummy();if (this._trace) this._debug('dom: '+this.dom);return this.dom;};
JStrap.Slot.Attr.prototype._assign=function(val) { var v = this.loadDOM().setAttr(this._name,val);if (!this._state || v!=this._value) this._updated(true,v);};
JStrap.Slot.Attr.prototype._unload=function() { if (this._state==false) return;this.loadDOM().setAttr(this._name,null);this._updated(false);};
JStrap.Slot.Attr.prototype._attr=function(attr) { return this._parent._attr(attr);};function JScast(obj,stepFn) { obj.step = stepFn;
if (!obj._seqID) obj._seqID = ++JScast.seqID;JScast.objs[obj._seqID] = obj;if (!JScast._intrvl) JScast._intrvl = window.setInterval(function() {
JScast._step.call(JScast);},50);};JScast.objs={};JScast.seqID=0;JScast._step=function() { for (var k in this.objs) { var r =this.objs[k].step();
if (r===false) delete this.objs[k];} };JScast.Fade=function(domObj) { if (domObj.Fade) return;domObj.Fade = { opacity: 1, speed: 0.1 };
domObj.prevDom = function(prev,join) { if (!join) return;this.Fade.fade = true;this.done = false;JScast(this,function() { if (this.Fade.fade) {
this.Fade.opacity -= this.Fade.speed;if (this.Fade.opacity<=0) { this.Fade.opacity=0;this.Fade.fade=false;if (prev) {
(prev.dom.nextSibling || this).parentNode.insertBefore(this.dom,prev.dom.nextSibling);} else {
if (this.dom.parentNode) this.dom.parentNode.removeChild(this.dom);this.done = true;} } } else { this.Fade.opacity += this.Fade.speed;
if (this.Fade.opacity>=1) { this.Fade.opacity=1;this.done=true;} } this.dom.style.opacity=this.Fade.opacity;
this.dom.style.filter=this.Fade.opacity<1?'alpha(opacity='+(this.Fade.opacity*100).toFixed(0)+')':'';if (this.done) return false;});};
domObj.nextDom = function(next,join) { if (join) JScast.Fade(next);};};JScast.Slide=function(domObj) { if (domObj.Slide) return;domObj.Slide = {
div: document.createElement('div'), speed: 50 };domObj.Slide.div.style.position = 'relative';domObj.Slide.div.style.top = '0px';
domObj.Slide.div.style.left = '0px';domObj.Slide.div.style.height = '100px';domObj.Slide.div.style.overflow = 'hidden';
domObj.parentNode.insertBefore(domObj.Slide.div,domObj.dom.nextSibling);domObj.prevDom = function(prev,join) { };domObj.nextDom = function(next,join) {
if (next) next.prevDom = this.prevDom;if (!join && this.Slide.last) return;this.done = false;var dst = next ? next.dom : this.Slide.empty;
if (dst.parentNode!=this.Slide.div) { dst.style.left = (this.Slide.last?this.Slide.last.offsetLeft+this.Slide.last.offsetWidth:0)+'px';dst.style.top = '0px';
dst.style.position = 'absolute';this.Slide.div.appendChild(dst);if (!this.Slide.last) { this.Slide.div.style.width = dst.offsetWidth + 'px';
this.Slide.div.style.height = dst.offsetHeight + 'px';} this.Slide.last = dst;} this.Slide.targetX = dst.offsetLeft;JScast(this,function() {
if (this.Slide.targetX > this.Slide.div.scrollLeft) { this.Slide.div.scrollLeft += this.Slide.speed;
if (this.Slide.targetX <= this.Slide.div.scrollLeft) this.done = true;} else { this.Slide.div.scrollLeft -= this.Slide.speed;
if (this.Slide.targetX >= this.Slide.div.scrollLeft) this.done = true;} if (this.done) { this.Slide.div.scrollLeft = this.Slide.targetX;return false;} });
return false;};};

