
/******** Symtales V1a **********/
/******** Nathanaël DEBIENASSIS *****/
/******** Tout droits reservés*/
{function bugtales(e){this.type="bugtales";if(console&&console.groupCollapsed){console.groupCollapsed(e+" / "+e.fileName+" : Ligne "+e.lineNumber);var txt="";console.error(e+" / "+e.fileName+" : "+e.lineNumber);console.groupCollapsed("trace");console.trace();console.groupEnd();}else alerts.msg(e+" / "+e.fileName+" : Ligne "+e.lineNumber+" \n"+e.description);this.propag=function(txt,obj){if(console&&console.groupCollapsed){if(obj){console.groupCollapsed(txt);console.dir(obj);console.groupEnd();}else
console.info(txt);}else alerts.msg(txt);throw(this);};this.finalize=function(txt,obj){if(console&&console.groupCollapsed){if(obj){console.groupCollapsed(txt);console.dir(obj);console.groupEnd();console.groupEnd();}else{console.info(txt);console.groupEnd();}}else alerts.msg(txt);};};function is_defined(v){try{if(!v)return false;return true;}catch(e){return false;}};if(!is_defined(console))
var console={"log":function(){return true;},"groupCollapsed":function(){return true;},"groupEnd":function(){return true;},"info":function(){return true;},"dir":function(){return true;}};var alerts={"msg":function(w){if(this.open)this.stack.push([w,0]);else console.log(w);},"anod":document.createElement('div'),"stack":[],"show":function(txt,obj){if(obj){if(this.open)this.stack.push([txt,obj]);this.open=true;console.groupCollapsed(txt);console.dir(obj);console.groupEnd();this.open=false;if(this.stack.length){var r=this.stack.shift();this.show(r[0],r[1]);}}else{console.info(txt);}},"add":function(nod){if(!this.anod.parentNode)
document.body.appendChild(this.anod);this.anod.appendChild(nod);return{"del":function(){nod.parentNode.removeChild(nod);}};}};alerts.anod.style.position="absolute";alerts.anod.style.left="0";alerts.anod.style.top="0";var gtrack={'stack':[],'plot':function(p,v){if(!pageTracker)return;try{try{if(!v)this.purge();pageTracker._trackPageview("/"+p);}catch(e){this.stack.push(p);}}catch(e2){return;}},'purge':function(){if(!pageTracker)return;var s=this.stack;this.stack=[];var t;while(t=s.shift())this.plot(t,true);}};document.onload=gtrack.purge;}
{window.µ={isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},extend:function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,µ$o;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!µ.isFunction(target))
target={};if(length==i){target=this;--i;}
for(;i<length;i++)
if((µ$o=arguments[i])!=null)
for(var name in µ$o){var src=target[name],copy=µ$o[name];if(target===copy)
continue;if(deep&&copy&&typeof copy==="object"&&!copy.nodeType)
target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)
target[name]=copy;}
return target;}};function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?";expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"")+"&";};function getCook(nom){var deb=document.cookie.indexOf(nom+"=");if(deb>=0){deb+=nom.length+1;fin=document.cookie.indexOf(";",deb);if(fin<0)fin=document.cookie.length;return unescape(document.cookie.substring(deb,fin));}
return"";};function insertAfter(parent,node,referenceNode){if(referenceNode.nextSibling)parent.insertBefore(node,referenceNode.nextSibling);else referenceNode.parentNode.appendChild(node);};function lt(x,y){return x<y;};function gt(x,y){return x>y;};function hideNode(n){var tmp=document.createElement('div');tmp.style.visibility="hidden";tmp.style.overflow="hidden";tmp.style.width="0";tmp.style.height="0";var tmp2=document.createElement('div');if(!n.parentNode)return;with(tmp2.style){position="absolute";top="-9999";left="-9999";width=(n.parentNode.offsetWidth)?n.parentNode.offsetWidth:"auto";height=(n.parentNode.offsetHeight)?n.parentNode.offsetHeight:"auto";}
tmp.replaced=true;n.parentNode.replaceChild(tmp,n);tmp2.appendChild(n);};function showNode(n){if(!n.parentNode||!n.parentNode.replaced)return;n.parentNode.parentNode.parentNode.replaceChild(n,n.parentNode.parentNode);};var getNodIndex=function(nod){var c=-1;if(!nod.parentNode)return-1;while(++c<nod.parentNode.childNodes.length)if(nod.parentNode.childNodes.item(c)==nod)return c;return-1;};var getUniqueId=(function(){var lastId=0;return function(){return lastId++;}})();var listOf=function(d){var i="";for(var o in d)i+=", "+o;return i;};var sizeOf=function(d){var i=0;for(var o in d)i++;return i;};function inherit(child,parent){for(var c in parent)
child[c]=parent[c];};var nodeUtils={"hasClass":function(n,c){var cs=(''+n.className).split(',');for(var i in cs)if(cs[i].lrtrim()==c)return true;return false;}};function each(t,f,h){if(t.constructor.toString().indexOf("Array")==-1&&t.length)
for(var o=0;o<t.length;o++)
f.apply(h||t[o],[t[o],o]);else if(t.item&&t.length)
for(var o=0;o<t.length;o++)
f.apply(h||t.item(o),[t.item(o),o]);else if(t.length)
for(var o=0;o<t.length;o++)
f.apply(h||t[o],[t[o],o]);else
for(var o in t)
f.apply(h||t[o],[t[o],o]);};var jsonParse=(function(){var number='(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';var oneChar='(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
+'|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var string='(?:\"'+oneChar+'*\")';var jsonToken=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]'
+'|'+number
+'|'+string
+')','g');var escapeSequence=new RegExp('\\\\(?:([^u])|u(.{4}))','g');var escapes={'"':'"','/':'/','\\':'\\','b':'\b','f':'\f','n':'\n','r':'\r','t':'\t'};function unescapeOne(_,ch,hex){return ch?escapes[ch]:String.fromCharCode(parseInt(hex,16));}
var EMPTY_STRING=new String('');var SLASH='\\';var firstTokenCtors={'{':Object,'[':Array};return function(json){var toks=json.match(jsonToken);var result;var tok=toks[0];if('{'===tok){result={};}else if('['===tok){result=[];}else{throw new Error(tok);}
var key;var stack=[result];for(var i=1,n=toks.length;i<n;++i){tok=toks[i];var cont;switch(tok.charCodeAt(0)){default:cont=stack[0];cont[key||cont.length]=+(tok);key=void 0;break;case 0x22:tok=tok.substring(1,tok.length-1);if(tok.indexOf(SLASH)!==-1){tok=tok.replace(escapeSequence,unescapeOne);}
cont=stack[0];if(!key){if(cont instanceof Array){key=cont.length;}else{key=tok||EMPTY_STRING;break;}}
cont[key]=tok;key=void 0;break;case 0x5b:cont=stack[0];stack.unshift(cont[key||cont.length]=[]);key=void 0;break;case 0x5d:stack.shift();break;case 0x66:cont=stack[0];cont[key||cont.length]=false;key=void 0;break;case 0x6e:cont=stack[0];cont[key||cont.length]=null;key=void 0;break;case 0x74:cont=stack[0];cont[key||cont.length]=true;key=void 0;break;case 0x7b:cont=stack[0];stack.unshift(cont[key||cont.length]={});key=void 0;break;case 0x7d:stack.shift();break;}}
if(stack.length){throw new Error();}
return result;};})();var jsonEval=function(json_string,µ,db,here){var e=eval("("+json_string+");");return e;}}
function createCSSClass(selector,style)
{if(!document.styleSheets)return;if(document.getElementsByTagName("head").length==0)return;var stylesheet;var mediaType;if(document.styleSheets.length>0)
{for(i=0;i<document.styleSheets.length;i++)
{if(document.styleSheets[i].disabled)continue;var media=document.styleSheets[i].media;mediaType=typeof media;if(mediaType=="string")
{if(media==""||media.indexOf("screen")!=-1)
{styleSheet=document.styleSheets[i];}}
else if(mediaType=="object")
{if(media.mediaText==""||media.mediaText.indexOf("screen")!=-1)
{styleSheet=document.styleSheets[i];}}
if(typeof styleSheet!="undefined")break;}}
if(typeof styleSheet=="undefined")
{var styleSheetElement=document.createElement("style");styleSheetElement.type="text/css";document.getElementsByTagName("head")[0].appendChild(styleSheetElement);for(i=0;i<document.styleSheets.length;i++)
{if(document.styleSheets[i].disabled)continue;styleSheet=document.styleSheets[i];}
var media=styleSheet.media;mediaType=typeof media;}
if(mediaType=="string")
{for(i=0;i<styleSheet.rules.length;i++)
{if(styleSheet.rules[i].selectorText.toLowerCase()==selector.toLowerCase())
{styleSheet.rules[i].style.cssText=style;return;}}
styleSheet.addRule(selector,style);}
else if(mediaType=="object")
{for(i=0;i<styleSheet.cssRules.length;i++)
{if(styleSheet.cssRules[i].selectorText.toLowerCase()==selector.toLowerCase())
{styleSheet.cssRules[i].style.cssText=style;return;}}
styleSheet.insertRule(selector+"{"+style+"}",styleSheet.cssRules.length);}}
{if(!window.Element){Element=function(){this._selectNodes=function(w){alert("working !!!"+w);};};}
String.prototype.rmNamespace=function(){return this.replace(/^(?:[^:]*\:)/,'');};String.prototype.er_test=function(er){return er.test(this);};var getSize=function(dicc){var i=0;var z;for(z in dicc)i++;return i;};String.prototype.genEncode=function(){return this.replace(new RegExp('([^\\w\-])',"gm"),function(s0,index,input){var a=(s0.charCodeAt(0));return'&#'+a+";";});};String.prototype.mEncode=function(){return this.replace(/[\»\«]/gm,'"').replace(/[\’]/gm,"'").replace(/([^\w\€])/gm,function(s0,index,input){return'|'+(s0.charCodeAt(0))+';';});};String.prototype.mUnEncode=function(){return this.replace(/\|(\d{1,3});/gm,function(s0,chop){return String.fromCharCode(parseInt(chop));});};String.prototype.type="string";String.prototype.shift=function(){var c=this.charAt(0);var here=this;here=this.replace(/^./,'');return c;};String.prototype.unshift=function(c){var here=this;here=this.replace(/^(.)/,c+"$1");};String.prototype.lrtrim=function(){return this.replace(/^\ *(.*[^\ ])\ *$/g,"$1");};String.prototype.indexof=function(txt){var x;if((x=this.split(txt))[1])return x[0].length;else return-1;};String.prototype.removeHTML=function(){return this.replace(/\<[^\>;]*\>/g,"")};String.prototype.unComment=function(){if(/^\ *\<\!\[\C\D\A\T\A\[/.test(this)&&/\]\]\>\ *$/.test(this))
return this.replace(/^\ *\<\!\[\C\D\A\T\A\[/,'').replace(/\]\]\>\ *$/,'');else if(/^\ *\<\!\-\-\!\[\C\D\A\T\A\[/.test(this)&&/\]\]\>\ *$/.test(this))
return this.replace(/^\ *\<\!\-\-\!\[\C\D\A\T\A\[/,'').replace(/\]\]\-\-\>\ *$/,'');else if(/^\ *\<\!\-\-/.test(this)&&/\-\-\>\ *$/.test(this))
return this.replace(/^\ *\<\!\-\-/,'').replace(/\-\-\>\ *$/,'');return this;};String.prototype.htmlEntsToxmlEnts=function(){return this.replace(/\&nbsp\;/g,'&#160;');};if(document.implementation.createDocument)Element.prototype.selectNodes=function(sXPath){var oEvaluator=new XPathEvaluator();var oResult=oEvaluator.evaluate(sXPath,this,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var aNodes=new Array;if(oResult!=null){var oElement=oResult.iterateNext();while(oElement){aNodes.push(oElement);oElement=oResult.iterateNext();}}
return aNodes;};{var regEvent;var CurrentWheelListener=0;function wheel(event){var delta=0;if(!event)event=window.event;if(event.wheelDelta){delta=event.wheelDelta/120;if(window.opera)delta=-delta;}else if(event.detail){delta=-event.detail/3;}
if(delta)if(CurrentWheelListener.onmousescroll)CurrentWheelListener.onmousescroll(delta);event.returnValue=true;};if(window.addEventListener)window.addEventListener('DOMMouseScroll',wheel,false);if(!window.addEventListener)Array.prototype.shift=function shift(str){var val=this[0];for(var i=1;i<this.length;++i){this[i-1]=this[i];}
try{this.length--;}catch(e){}
return val;};}
function sourceCheck(e){var el=(typeof event!=='undefined')?event.srcElement:e.target
alert(el.id)};regEvent=new(function(){var µdd={};µdd.onDrag=0;µdd.dragManager=function(){var dropZonesID=1,x=0,y=0,dx=0,dy=0;var dropZones=[0];var freeZones=[];var testz=[];var dropMother=document.createElement('div');var actList=document.createElement('div');var origin_dims={};with(dropMother.style){position='absolute';top=0;left=0;height="100%";width="100%";}
with(actList.style){position='absolute';background="white";top=0;left=0;}
var dropNod=document.createElement('div');with(dropNod.style){position='absolute';top=0;left=0;height="100%";width="100%";cursor="pointer";}
µdd.dragStart=function(e){if(!document.body.dropZones)document.body.dropZones=dropZones;if(!e)var e=window.event;y=(!e.pageY)?e.clientY:e.pageY;x=(!e.pageX)?e.clientX:e.pageX;var tmp,ttmp;origin_dims=$majax.GlobalPosOf(µdd.onDrag.nodOrigin);dx=x-origin_dims.x;dy=y-origin_dims.y;if(µdd.onDrag.nod)
µdd.onDrag.nod.style.left=(x-dx)+"px";if(µdd.onDrag.nod)
µdd.onDrag.nod.style.top=(y-dy)+"px";document.body.appendChild(µdd.onDrag.nod);document.body.appendChild(actList);document.body.appendChild(dropMother);if(µdd.onDrag.dragValue.hideOrigin){µdd.onDrag.nodOrigin.parentNode.insertBefore(µdd.onDrag.jumpNode=document.createElement("span"),µdd.onDrag.nodOrigin);document.getElementById("nowhereNode").appendChild(µdd.onDrag.nodOrigin);}
for(var o in dropZones)
if(dropZones[o]!=0){dropZones[o].p=$majax.GlobalPosOf(dropZones[o].obj);if(!dropZones[o].p)continue;dropZones[o].acts=0;dropZones[o].p.chemin=[];tmp=dropZones[o].obj;while(tmp!=document.body){if(!tmp)break;dropZones[o].p.chemin.unshift(getNodIndex(tmp));tmp=tmp.parentNode;}};dropZones.sort(function(a,b){if(a==0&&b==0)return 0;if(!a.p)return 1;if(!b.p)return-1;if(a==0)return-1;if(b==0)return 1;var r=false;var o=0;while(o<Math.min(a.p.chemin.length,b.p.chemin.length)){if(!b.p.chemin[o]&&a.p.chemin[o])return 1;if(!a.p.chemin[o]&&b.p.chemin[o])return-1;if(a.p.chemin[o]<b.p.chemin[o])return-1;if(a.p.chemin[o]>b.p.chemin[o])return 1;o++;}
return 0;});for(var o in dropZones)
if(dropZones[o]!=0){if(!dropZones[o].p)continue;if(dropZones[o].doctype!=µdd.onDrag.doctype)continue;dropMother.appendChild(dropZones[o].dropland);with(dropZones[o].dropland.style){position="absolute";top=dropZones[o].p.y;left=dropZones[o].p.x;width=dropZones[o].obj.offsetWidth;height=dropZones[o].obj.offsetHeight;border="1px green dotted";}}
while(dropZones[0]==0)dropZones.shift();for(var o in dropZones)dropZones[o].id=o;dropZonesID=dropZones.length;freeZones=[];};var cActs=[],curdz=0;var majActs=function(e){var act=[],tact=[];curdz=0;for(var o=dropZones.length-1;o>=0;o--)if(dropZones[o]!=0){if(dropZones[o].p.x<x&&(dropZones[o].p.x+dropZones[o].p.w)>x&&dropZones[o].p.y<y&&(dropZones[o].p.y+dropZones[o].p.h)>y){dropZones[o].acts=dropZones[o].event(dropZones[o].evt={'dropDim':dropZones[o].p,'dragValue':µdd.onDrag.dragValue,'x':x,'y':y,'rx':(x-dropZones[o].p.x),'ry':(y-dropZones[o].p.y),'dropped':(µdd.onDrag.drop)?µdd.onDrag.drop():µdd.onDrag},dropZones[o].param);for(var u=0;u<dropZones[o].acts.length;u++)
act.push(dropZones[o].acts[u]);if(!curdz&&dropZones[o].acts.length)curdz=dropZones[o];}}
cActs=act;};var drop=function(e){for(var o in testz)document.body.removeChild(testz[o]);while(dropMother.firstChild)dropMother.removeChild(dropMother.firstChild);document.body.removeChild(dropMother);if(µdd.onDrag.dragValue&&µdd.onDrag.dragValue.hideOrigin){µdd.onDrag.jumpNode.parentNode.replaceChild(µdd.onDrag.nodOrigin,µdd.onDrag.jumpNode);}
testz=[];if(µdd.onDrag.onDrop)return µdd.onDrag.onDrop({"opos":origin_dims,'x':x,'y':y,'dx':dx,'dy':dy});if(curdz&&curdz.obj.ondrop)
curdz.obj.ondrop(curdz.evt);return cActs;};µdd.regDropZone=function(nod,f,p,t){var lid=(freeZones.length!=0)?freeZones.pop():dropZonesID++;return dropZones[lid]={'id':lid,'doctype':((!t||t=="")?"undefined":t),'dropland':document.createElement('div'),'obj':nod,'event':f,'param':p,'path':"",'p':{'x':0,'y':0,'h':0,'w':0},"free":function(){freeZones.push(this.id);dropZones[this.id]=0;}};};dropMother.onmouseup=function(e){if(µdd.onDrag){if(dropNod.parentNode)dropNod.parentNode.removeChild(dropNod);if(actList.parentNode)actList.parentNode.removeChild(actList);if(µdd.onDrag.type!="listener")
µdd.onDrag.nod.parentNode.removeChild(µdd.onDrag.nod);var where=drop(e);if(µdd.onDrag.nodOrigin.ondragend)
µdd.onDrag.nodOrigin.ondragend({"opos":origin_dims,'x':x,'y':y,'dx':dx,'dy':dy});if(µdd.onDrag.dropListener)
µdd.onDrag.dropListener({"event":e,"where":where,"x":x,"y":y});x=0;y=0;µdd.onDrag=0;if(!e)if(window.event)e=window.event;else e={};if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;}};regEvent(dropMother,"mousemove",function(e){if(µdd.onDrag){if(!e)e=window.event;y=(!e.pageY)?e.clientY:e.pageY;x=(!e.pageX)?e.clientX:e.pageX;majActs(e);if(µdd.onDrag.nod&&cActs.length!=0){actList.innerHTML=cActs[0].label;actList.style.left=(x+10)+"px";actList.style.top=(y-actList.offsetHeight-10)+"px";}else actList.innerHTML="";if(µdd.onDrag.dragListener)
µdd.onDrag.dragListener({"event":e,"x":x,"y":y});if(µdd.onDrag.nodOrigin.ondrag)
µdd.onDrag.nodOrigin.ondrag({"opos":origin_dims,'x':x,'y':y,'dx':dx,'dy':dy});if(µdd.onDrag.nod)
µdd.onDrag.nod.style.left=(x-dx)+"px";if(µdd.onDrag.nod)
µdd.onDrag.nod.style.top=(y-dy)+"px";}
return false;});};return(function regEvent(){var a=arguments;if(a[1]=="dragstart"){if(µdd.dragManager){µdd.dragger=new µdd.dragManager();µdd.dragManager=0;}
var witch=1;var useDrag=false;var z=regEvent(a[0],"mouseup",function(e){useDrag=false;});var b=regEvent(a[0],"onselectstart",function(e){return false;});a[0].unselectable="on";a[0].style.MozUserSelect="none";var fct=function(e){useDrag=true;if(!e)var e=window.event;y=(!e.pageY)?e.clientY:e.pageY;x=(!e.pageX)?e.clientX:e.pageX;if((e.which!=witch)&&(e.button!=witch))return true;setTimeout(function(){if(!useDrag)return;datas={};µdd.onDrag=datas;datas.dragValue=a[2](e);if(datas.dragValue.ghost)datas.nod=datas.dragValue.ghost;if(!datas.nod)datas.nod=a[0].cloneNode(true);datas.nodOrigin=a[0];datas.nod.id+="dragging";datas.nod.style.position="absolute";datas.nod.style.left=null;datas.nod.style.right=null;datas.nod.style.top=null;datas.nod.style.bottom=null;datas.nod.style.width=a[0].offsetWidth+"px";datas.nod.style.height=a[0].offsetHeight+"px";datas.origin=a[0];if(datas.dragValue&&datas.dragValue.disableGhost)
datas.nod.style.display="none";if(µdd.onDrag.nod)
with(µdd.onDrag.nod.style){position="absolute";}
µdd.dragStart(e);try{e.cancelBubble=true;}catch(e){}
if(e.stopPropagation)e.stopPropagation();},250);return false;};var c=regEvent(a[0],"mousedown",function(e){fct(e);if(!e)if(window.event)e=window.event;else e={};if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;e.cancelBubble=true;if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();return false;});return{'free':function(){z.free();b.free();c.free();}};}
else if(a[1]=="dragover"){if(µdd.dragManager){µdd.dragger=new µdd.dragManager();µdd.dragManager=0;}
var dz=µdd.regDropZone(a[0],a[2]);return{'free':function(){dz.free();}};}
else if(a[1]=="drag"){a[0].ondrag=a[2];}
else if(a[1]=="dragend"){a[0].ondragend=a[2];}
else if(a[1]=="drop"){a[0].ondrop=a[2];}
document.addEventListener?a[0].addEventListener(a[1],a[2],a[3]||false):a[0].attachEvent?a[0].attachEvent('on'+a[1],a[2]):false;return{'free':function(){document.addEventListener?a[0].removeEventListener(a[1],a[2],a[3]||false):a[0].detachEvent?a[0].detachEvent('on'+a[1],a[2]):false;}};})})();window.$cursor={"x":0,"y":0};regEvent(document,"mousemove",function(e){if(!e)if(window.event)e=window.event;else e={};if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;$cursor.x=e.pageX;$cursor.y=e.pageY;});function rgb(red,green,blue)
{var decColor=red+256*green+65536*blue;return decColor.toString(16);};if(!window.getComputedStyle){window.getComputedStyle=function(el,pseudo){this.el=el;this.getPropertyValue=function(prop){var re=/(\-([a-z]){1})/g;if(prop=='float')prop='styleFloat';if(re.test(prop)){prop=prop.replace(re,function(){return arguments[2].toUpperCase();});}
return el.currentStyle[prop]?el.currentStyle[prop]:null;};return this;};}}
{window.$nav={'png':false,'httpReqs':true,'type':'ie'};if(document.all){if(/MSIE [6\.0|5\.5]/.test(navigator.appVersion)){window.$nav.png=false;}
else if(/MSIE 7/.test(navigator.appVersion))window.$nav.png=false;}else{window.$nav.type="mozz";window.$nav.png=true;}
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();}
var $majax={"fontReady":function(fontName){var width,height;var element=document.createElement('span');element.style.visibility='hidden';element.style.position='absolute';element.style.fontFamily='__FAKEFONT__';element.style.top='-10000px';element.style.left='-10000px';element.innerHTML='abcdefghijklmnopqrstuvwxyz';document.body.appendChild(element);width=element.offsetWidth;height=element.offsetHeight;element.style.fontFamily=fontName;var r=(width!==element.offsetWidth||height!==element.offsetHeight);document.body.removeChild(element);return r;},"getfocus":(function getfocus(){var focusListeners=function(){};return function(onlost){focusListeners();focusListeners=(onlost)?onlost:function(){};};})(),"alert":(function getfocus(){var focusListeners=function(){};return function(onlost){focusListeners();focusListeners=(onlost)?onlost:function(){};};})(),"dyphTab":function(frag){var tab=[];var cb=[];this.done=false;var hereuh=0;this.getHere=function(){return hereuh;};this.setHere=function(h){hereuh=h;};this.add=function(fct){tab.push(fct);};this.cbORexec=function(fct){if(!this.done)cb.push(fct);else fct();};this.ready=function(){this.done=true;while(cb[0])cb.shift().build();};this.exec=function(here){while(tab[0])tab.shift()(here.newChild,(frag)?frag:here.flags,here.context.dynaStyle,frag);};},"isInBlock":function(d,x,y){var p=$majax.GlobalPosOf(d);if(p.x<x&&x<(p.x+p.w)&&p.y<y&&y<(p.y+p.h))return true;return false;},"GlobalPosOf":function(nod,p,cut){var gp=(p)?p:{};if(!nod)return false;gp.x=0;gp.y=0;var tmp=nod,tmp2;gp.h=nod.offsetHeight;gp.w=nod.offsetWidth;do{gp.x+=tmp.offsetLeft-tmp.scrollLeft;gp.y+=tmp.offsetTop-tmp.scrollTop;if(cut&&gp.w>tmp.offsetWidth)gp.w=tmp.offsetWidth;if(cut&&gp.h>tmp.offsetHeight)gp.h=tmp.offsetHeight;tmp2=tmp;}while((tmp=tmp.offsetParent));if(tmp2!=document.body)return false;return gp;},"autoScale":function(nod,r){var ratio;if((ratio=r.replace(/([0-9]+\.?[0-9]*)\/([0-9]+\.?[0-9]*)\ */,"$1!$2").split('!')).length!=2)return false;if(!nod.dstyle)nod.dstyle={scale:{"r":parseInt(ratio[0])/parseInt(ratio[1])}};else nod.dstyle.scale={"r":parseInt(ratio[0])/parseInt(ratio[1])};},"css2js":function(v){var v2=v.split('-');var r=v2[0];var z;for(z=1;z<v2.length;z++){r+=v2[z].charAt(0).toUpperCase()+v2[z].substring(1,v2[z].length);}
return r;},"setStyle":function($kt,stl){style=stl.split(";");for(s in style){if(style[s]=="")continue;style[s]=style[s].split(":");if(!$nav.png&&$nav.type=="ie"&&style[s][1].er_test(/url[\ |\'|\"|\(]+[a-z|A-Z|0-9|\_|\-|\ |\/]+\.png[\ |\'|\"|\)]+/)){$kt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='"+style[s][1].replace("'",'').replace('"','').replace(')','').replace('url(','').replace('url (','')+"')";continue;}
try{$kt.style[this.css2js(style[s][0].lrtrim())]=style[s][1];}catch(e){alerts.msg("style invalide: "+style[s][0]+"/"+style[s][1]);}}},"loadScript":(function(){var loadedScripts={};var cbScripts={};return function(uri,cb){if(loadedScripts[uri]){if(cbScripts[uri]&&cb)
return cbScripts[uri].push(cb);else return(cb)?cb():0;};var oHead=document.getElementsByTagName('head')[0];var oScript=document.createElement('script');oScript.type='text/javascript';oScript.src=uri;loadedScripts[uri]=oScript;cbScripts[uri]=[];if(cb)cbScripts[uri].push(cb);oScript.onload=function(){while(cbScripts[uri].length)(cbScripts[uri].shift())();cbScripts[uri]=0;};oScript.onreadystatechange=function(){if(this.readyState=='complete'){while(cbScripts[uri].length)(cbScripts[uri].shift())();cbScripts[uri]=0;}}
oHead.appendChild(oScript);};})(),"replaceSelection":function(area,baliseOn,baliseOff){if(document.selection){var str=document.selection.createRange().text;area.focus();sel=document.selection.createRange();sel.text=baliseOn+str+baliseOff;}else if(area.selectionStart||area.selectionStart=="0"){var startPos=area.selectionStart;var endPos=area.selectionEnd;var chaine=area.value;var str=chaine.substring(area.selectionStart,area.selectionEnd);area.value=chaine.substring(0,startPos)+baliseOn+str+baliseOff+chaine.substring(endPos,chaine.length);area.selectionStart=startPos;area.selectionEnd=endPos+baliseOff.length+baliseOn.length;area.focus();}else{area.value+=instext;area.focus();}
if(area.onkeyup)area.onkeyup();},"slasheThat":function(str){return this.str_r(this.str_r(this.str_r(this.str_r(str,"\\","\\\\"),"\"","\\\""),"'","\\'"),"\n","\\n");},"fileUploader":{"count":0,"frames":{},"newUp":function(here,cb){var mifrm;console.log("mk new up");var fid="upfrm"+(this.count+=1);if(!window.frames)window.frames={};if(!window.framesList)window.framesList={};window.framesList[fid]=(mifrm={"block":document.createElement('table'),"ifram":document.createElement('iframe'),"state":0,"subWin":0,"callBack":cb});with(mifrm.ifram.style){height='100%';width='100%';border="none";}
var tmp;mifrm.block.appendChild(mifrm.block.tb=document.createElement("tbody"));mifrm.block.tb.appendChild(mifrm.block.tr=document.createElement("tr"));mifrm.block.tr.appendChild(mifrm.block.td1=document.createElement("td"));mifrm.ifram.src="?upload=now#"+fid;mifrm.block.td1.appendChild(mifrm.ifram);with(mifrm.block.style){height='1.2em';visibility='hidden';border="none";display="inline";overflow="hidden";}
with(mifrm.block.td1.style){height='1.2em';}
mifrm.ifram.id=mifrm.ifram.name=fid;here.UpNow=mifrm.block.UpNow=function(WhenDone){window.framesList[fid].callBack=WhenDone;return window.framesList[fid].frame.upThat();};here.setVal=mifrm.block.setVal=function(id,val){return window.frames[mifrm.ifram.id].setVal(id,val);};here.appendChild(mifrm.block);return{"id":fid,"UpNow":here.UpNow};},"regDldFrame":function(ctrlr,ifrmId){if(window.framesList[ifrmId]){window.framesList[ifrmId].frame=ctrlr;window.framesList[ifrmId].block.td1.style.width=ctrlr.uperWidth+'px';window.framesList[ifrmId].block.td1.style.height=ctrlr.uperHeight+'px';window.framesList[ifrmId].block.style.visibility='visible';}},"isLoaded":function(ifrmId,done){if(!done&&!window.framesList[ifrmId].frame){setTimeout("$majax.fileUploader.isLoaded('"+ifrmId+"', false);",100);return;}else if(!done){setTimeout("$majax.fileUploader.isLoaded('"+ifrmId+"', true);",100);return;}
if(!window.framesList[ifrmId].frame.imHere){setTimeout("$majax.fileUploader.isLoaded('"+ifrmId+"', "+done+");",100);}else{window.framesList[ifrmId].block.td1.style.width=window.framesList[ifrmId].frame.uperWidth+'px';window.framesList[ifrmId].block.td1.style.height=window.framesList[ifrmId].frame.uperHeight+'px';window.framesList[ifrmId].block.style.visibility='visible';}},"isUploaded":function(ifrmId){if(!window.framesList[ifrmId].ifram.contentWindow.datas)
setTimeout("$majax.fileUploader.isUploaded('"+ifrmId+"');",100);else{window.framesList[ifrmId].callBack(window.framesList[ifrmId].ifram.contentWindow.datas);}}}};var $xml=new(function xmlBox(){var db={};window.db=db;var xmlUnit=this;var AjaxSession=function(){var stuff=[{id:"sessionInfos",evar:{"id":"_majaxSessionInfos"}}];var onSync=[];var onError=[];this.sessions={};var freeAS=function(){onSync=0;onError=0;stuff=0;this.datas=0;};var finish=function(r){for(var i=0;i<onSync.length;i++){try{onSync[i](r);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).finalize("cb on reception bug ..."+err,onSync[i]);}}
freeAS();};var error=function(e){while(onError[0])onError.shift()(e);};this.NumSess=0;this.GetPostReq=function(uri,datas,cb){if(!this.sessions)this.sessions={};var session={'id':this._NumSess++,'ReqObj':null,'requetes':this.requetes,'log':[],'etat':0,'cb':cb,'files':[]};var here=this;this.sessions[session.id]=session;session.init=function(){try{this.ReqObj=new XMLHttpRequest();}catch(e){try{this.ReqObj=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){this.ReqObj=new ActiveXObject("Microsoft.XMLHTTP");}}
if(this.ReqObj==null){alert("Your stupid browser does not support AJAX. :(");return;}
this.ReqObj.onreadystatechange=function(){try{if(here.sessions[session.id].ReqObj.readyState==4){if(here.sessions[session.id].ReqObj.status==200){cb(here.sessions[session.id]);}else{error('Error code '+here.sessions[session.id].ReqObj.status+' ('+uri+') !!');}
here.sessions[session.id]=undefined;}}catch(e){error('Error code '+here.sessions[session.id].ReqObj.status+' ('+uri+') !!');}};this.ReqObj.open('POST',uri,true);};try{session.addFiles=function(f){this.files=f;return session;};if(/[F|f]irefox/.test(BrowserDetect.browser)){session.send=function(){try{this.etat=1;var boundary='------'+(new Date).getTime();var dashdash='--';var crlf='\r\n';var builder='';builder+=dashdash+boundary+crlf;builder+='Content-Disposition: form-data; name="todo"'+crlf+'content-type: text/plain;charset=utf-8'+crlf+crlf;builder+=datas+crlf;builder+=dashdash+boundary+crlf;for(var i=0;i<this.files.length;i++){var file=this.files[i];builder+='Content-Disposition: form-data; name="user_file[]"';if(file.fileName){builder+='; filename="'+file.fileName+'"';}
builder+=crlf;builder+='Content-Type: application/octet-stream';builder+=crlf;builder+=crlf;if(!file.getAsBinary)console.dir(file);builder+=file.getAsBinary();builder+=crlf;builder+=dashdash;builder+=boundary;builder+=crlf;}
builder+=dashdash;builder+=boundary;builder+=dashdash;builder+=crlf;this.ReqObj.setRequestHeader('content-type','multipart/form-data; boundary='
+boundary);this.ReqObj.setRequestHeader("charset","utf-8");if(this.ReqObj.sendAsBinary)
this.ReqObj.sendAsBinary(builder);else this.ReqObj.send(builder);this.etat=1;}catch(e){alert("Erreur de comunication..."+e);}};}else{session.send=function(){try{this.ReqObj.open('POST',uri,true);this.ReqObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.ReqObj.setRequestHeader("Content-length",('todo='+datas).length);this.ReqObj.setRequestHeader("Charset","utf-8");this.ReqObj.setRequestHeader("Connection","close");this.ReqObj.send(('todo='+datas));this.etat=1;}catch(e){console.log("Erreur de comunication...");}};}}catch(e){console.log(e.description+'\n');}
session.init();return session;};this.GetPostReq_ex=function(uri,datas,cb){var session={'id':this.NumSess++,'ReqObj':null,'requetes':this.requetes,'log':[],'etat':0,'cb':cb};var here=this;this.sessions[session.id]=session;session.init=function init(){try{this.ReqObj=new XMLHttpRequest();}catch(e){try{this.ReqObj=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){this.ReqObj=new ActiveXObject("Microsoft.XMLHTTP");}}
if(this.ReqObj==null){alert("Your stupid browser does not support AJAX. :(");return;}
this.ReqObj.onreadystatechange=function(){if(here.sessions[session.id].ReqObj.readyState==4){if(here.sessions[session.id].ReqObj.status==200){cb(here.sessions[session.id]);}else{error('Error code '+here.sessions[session.id].ReqObj.status+' ('+uri+') !!');}
here.sessions[session.id]=undefined;}};};try{session.send=function(){try{this.ReqObj.open('POST',uri,true);this.ReqObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.ReqObj.setRequestHeader("Content-length",datas.length);this.ReqObj.setRequestHeader("Charset","utf-8");this.ReqObj.setRequestHeader("Connection","close");this.ReqObj.send(datas);this.etat=1;}catch(e){error("Erreur de comunication...");}};}catch(e){error(e.description+'\\n');}
session.init();return session;};var filesToSend=[];this.addFiles=function(files){for(var o=0;o<files.length;o++)filesToSend.push(files[o]);};this.add=function(task){stuff.push(task);};this.onSync=function(cb){onSync.push(cb);};this.onError=function(cb){onError.push(cb);};this.sync=function(){var data="";var tmp;var i;var infos="";if(!stuff[0])return finish({});each(stuff,function(i,o){tmp="";tmp="id="+stuff[o].id.mEncode()+"&evar=";infos+=stuff[o].id+", ";for(i in stuff[o].evar)
if(stuff[o].evar){tmp+=(i+"="+(stuff[o].evar[i]+"").mEncode()+"&").mEncode();}else alert('_._');data+="todo[]="+tmp.mEncode()+"&";});try{var sendI=0,done=false;var here=this;var send=(function(curi){return function send(){here.GetPostReq("index.php",data.mEncode(),function(R){try{if(done)return;sendI++;done=true;var k;var c=-1;var rez={};var nod=R.ReqObj.responseXML.documentElement;while(++c<nod.childNodes.length){if(nod.childNodes.item(c).nodeName=="#text")continue;if($xml.getAttr(nod.childNodes[c],"id")=="_majaxSessionInfos"){db["local://session"].majDoc($xml.newDOM($xml.getInnerXML(nod.childNodes.item(c))));rez._SessionInfo=db["local://session"];}else rez[$xml.getAttr(nod.childNodes[c],"id")]=nod.childNodes[c].cloneNode(true);}
finish(rez);R.ReqObj=0;R=0;}catch(err){console.log(R.ReqObj.responseText);}}).addFiles(filesToSend).send();data=0;};})(sendI);var autoRetry;autoRetry=function(){if(!done){sendI++;send(sendI);}
else setTimeout(autoRetry,1000);};autoRetry();}catch(e){console.log("Erreur reception1 :"+e+"\n"+e.description+'\n');}};this.sessionInfos=function(){PVs.todo.add({id:"sessionInfos",evar:{"id":"infos"}});PVs.todo.send(function(rez){if(rez.infos)cb(rez.infos);else alerts.msg("Erreur dld infos de sessions!!");},cberr);PVs.todo.sync();}};this.session=AjaxSession;var modlib={"forumPost":"","forumList":"","newsList":'<title type="inline-text" encoded="true"/><description type="html" encoded="true"/>',"imList":""};this.wreg=function(xml,path,baseuser){if(xml.type!="xmldoc"){if(db[path])db[path].majDoc(this.newDOM(xml));else{db[path]=new this.doc(xml,baseuser,path);}}else{if(db[path])db[path].set(xml);else db[path]=xml;}
return path;};this.dbGet=function(url){return db[url];};this.newDOM=function(xml){var myDocument;if(document.implementation.createDocument){var parser=new DOMParser();myDocument=parser.parseFromString(xml,"text/xml");}else if(window.ActiveXObject){myDocument=new ActiveXObject("Microsoft.XMLDOM");myDocument.async="false";myDocument.loadXML(xml);}
return myDocument;};this.mkUri=function mkuri(uri){var ret=uri;if(/db:\/\/.*/.test(uri))
ret=ret.replace(/^db:\/(.*)$/,"$1").replace(/^\/cuser(.*)/g,"/root/users/user[@nom='"+db["local://session"].getText("./login")+"']$1").replace(/^\/users\/([\w\_\-]+)\/(.*)/g,"/root/users/user[@nom='$1']/$2");else if(/home:\/\/.*/.test(uri))
ret=ret.replace(/^home:\/\/cuser\/(.*)$/,"home://cuser/$1").replace(/^home:\/\/users\/([\w\_\-]+)\/(.*)/g,"home://users/$1/$2");else if(/majax:\/\/.*/.test(uri))
ret=ret.replace(/^majax:\/\/users\.([^\.]+)/g,"home://users/$1").replace(/^majax:\/\/cuser\.(.*)/g,"home://cuser/$1").replace(/^majax:\/\/(.*)$/,"home://$1").replace(/\./g,"/").replace(/\/$/g,"");return ret;};this.mkLocalUri=function mkLocalUri(uri){var ret=uri;if(/home:\/\/.*/.test(uri))
ret=ret.replace(/^home:\/\/cuser\/(.*)$/,"home://users/"+db["local://session"].getText("./login")+"/$1").replace(/^home:\/\/users\/([\w\_\-]+)\/(.*)/g,"home://users/$1/$2");return ret;};var tmpimg=new Image();tmpimg.src="medias/icon/loadingErr.gif";var streamRoot,streamDB={};this.doc=function doc_builder(xml,oowner,path){var here=this,src=path,listener=[],fragments=[],µnbl=0,µfl=[],µse={};var doc,nod;var dblist=0,origin=0;this.fragment=false;var curstate="stand";this.getState=function(){return curstate;};this.saveUnit={'load':function(){if(!this.icon){this.d=document.createElement('img');this.icon=alerts.add(this.d);}
this.d.title=src;this.d.src="medias/icon/loading.gif";curstate="loading";},'loadError':function(e){if(!this.d)
this.d=document.createElement('img');this.d.src="medias/icon/loadingErr.gif";this.d.title="Serveur error ("+src+") : '"+e+"' Réessayer ?";curstate="loadfail";this.d.onclick=function(){this.onclick=function(){};here.load(src,baseuser);};},'loadDone':function(){if(this.icon)this.icon.del();this.icon=0;curstate="stand";},'change':function(){if(/^tamp/.test(src))return;if(!db[src])alerts.msg(here+"!!!"+src);if(db[src]!=here)return db[src].saveUnit.change();if(!this.icon){this.d=document.createElement('img');this.icon=alerts.add(this.d);}
this.d.title=src;this.d.src="medias/icon/save.png";this.d.onclick=function(){this.src="medias/icon/saving.gif";this.onclick=function(){};here.save();};this.icon=alerts.add(this.d);},'savError':function(e){if(db[src]!=here)return db[src].saveUnit.save();alert("Erreur lors de la sauveguarde, le serveur à répondu : "+e);this.d.src="about:blank";this.d.title=e+" Réessayer ?";this.d.onclick=function(){this.src="medias/icon/saving.gif";this.onclick=function(){};here.save();};},'save':function(){if(db[src]!=here)return db[src].saveUnit.save();if(this.icon)this.icon.del();this.icon=false;}};this.id=getUniqueId();this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse){l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);}
return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.mkSema=function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(done){if(is_defined(this.list))this.list.free();return;}
if(e==evt){done=true;if(is_defined(this.list))this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;};this.save=function(){if(db[src]!=here)return db[src].save();if(src){if(!confirm("Cette opération enregistrera '"+src+"' sur le serveur de façon definitive; êtes vous sur ?"))return this.saveUnit.change();var nav=new AjaxSession();nav.add({id:"select",evar:{"uri":src}});nav.add({id:"saveDoc",evar:{"id":"val","datas":this+""}});nav.onSync(function(rez){if(tmp=$xml.checkError(rez.val)){return here.saveUnit.savError(tmp);}
if(dblist)dblist.free();here.saveUnit.save();here.propag("change","init",here);});nav.onError(function(rez){alerts.msg("Erreur axx "+src+".");});nav.sync();}else alerts.msg("no adress !!! ");};this.listen=this.propag=function(evt,c,datas,µem){if(""==datas+'')return;var d;try{if(db[src]!=this&&db[src]==datas&&evt=="change"){if(!this.fragment){return this.clone(origin.clone(),true);}}
if(datas.fragment||this.fragment)d=this;else d=this;}catch(e){d=this;}
if(!/^\!.*/.test(evt))µse[evt]=[evt,c,this,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,here,(µem)?µem:this);});};if(!xml||xml=="")doc=nod=0;else{doc=xmlUnit.newDOM(xml);this.documentElement=nod=doc.documentElement;here.propag("change","init",here,here);}
this.documentElement=nod;this.type="xmldoc";var owner=oowner;var reloading=false;this.getOrigin=function(){if(db[src]&&db[src]!=this)return db[src].getOrigin();return here;};this.setOwner=function(d){owner=d;};this.majDoc=function(d){doc=d;this.documentElement=nod=doc.documentElement;this.propag("change","init",this);};this.clone=function(d,donotlisten){if(d){doc=d.doc;this.documentElement=nod=d.nod;src=d.src;owner=d.owner;origin=d.origin;if(!donotlisten)dblist=d.origin.addListener(this);here.propag("change","init",here,here);}
return{'src':src,'doc':doc,'owner':owner,'nod':nod,'origin':this};};this.build=this.load=function(srcuri,bu){if(!bu)baseuser=$majax._SessionInfos.getText("/session_infos/login");else baseuser=bu;this.src=srcuri+"";src=srcuri+"";var plain_uri=$xml.mkUri(srcuri+"");src=plain_uri;src=srcuri+"";if(db[plain_uri]&&here.getState()!="loadfail"){this.clone(db[plain_uri].clone());return this;}else if(!db[plain_uri]){db[plain_uri]=new $xml.doc("<root/>",bu);}
var nav=new AjaxSession();here.saveUnit.load();nav.add({id:"select",evar:{"uri":plain_uri,"baseuser":baseuser}});nav.add({id:"getXML",evar:{"id":"mod","addIncludes":"true"}});nav.onSync(function(rez){if(tmp=$xml.checkError(rez.mod)){return here.saveUnit.loadError(tmp);}
if(rez.modInclude){var tmp=rez.modInclude.selectNodes("include");if(tmp[0]){document.cache=this;for(var i=0;i<tmp.length;i++){db[$xml.getAttr(tmp[i],"uri")]=new $xml.doc($xml.getInnerXML(tmp[i]),$xml.getAttr(tmp[i],'owner'));}}}
doc=$xml.newDOM($xml.getInnerXML(rez.mod));here.documentElement=nod=doc.documentElement;owner=$xml.getAttr(rez.mod,'owner');gtrack.plot(plain_uri);(db[plain_uri]).clone(here.clone(),true);if(!reloading&&dblist)dblist.free();if(!reloading)dblist=db[plain_uri].addListener(here);if(/^home\:\/\/cuser/.test(plain_uri)&&!reloading){reloading=true;db["local://session"].addListener({"listen":function(e,c,d){if(e=="change"&&owner!=db["local://session"].getText("./login")){curstate="loadfail";owner=db["local://session"].getText("./login");here.load(plain_uri,db["local://session"].getText("./login"));}}});}
here.saveUnit.loadDone();});nav.onError(function(rez){here.saveUnit.loadError("Pas de reponsse du serveur "+src+".\n"+rez);});nav.sync();return this;};this.getOwner=function(){return(owner)?owner:db["local://session"].getText("./login");};this.pokeOrigin=function(){if(db[src]&&db[src]!=this)return db[src].pokeOrigin();this.propag("change","init",here);this.saveUnit.change();};this.getSrc=function(){return src;};this.getLocalPath=function(){var p="",i=0,n=nod;if(nod==doc.documentElement)return"/";while(1){if(n.previousSibling){n=n.previousSibling;i++;}
else if(n==n.ownerDocument.documentElement)break;else{n=n.parentNode;p+="/*["+i+"]";i=0;}};return p;};this.reload=function(){db[$xml.mkUri(this.src)]=0;this.load(this.src);};this.toString=function(){return(doc)?xmlUnit.getXML(nod):"null doc";};this.del=function(){};this.appendAt=function(w,n){var tmp=nod.selectNodes(w);if(tmp[0])return tmp[0].appendChild(n);else return false;};this.getText=function(w,unenc){var tmp=(w=='.')?[nod]:this.select(w);if(!tmp[0])return false;if(!unenc)return $xml.getInnerXML(tmp[0]).mUnEncode();else return $xml.getInnerXML(tmp[0]);};this.getInnerXML=function(w){var tmp=this.select(w);if(!tmp[0])return false;return $xml.getInnerXML(tmp[0]);};this.setXml=function(w,txt){var tmp=this.select(w);if(!tmp[0])return false;var tdoc;try{tdoc=$xml.newDOM("<root>"+txt+"</root>");while(tmp[0].firstChild)tmp[0].removeChild(tmp[0].firstChild);while(tdoc.documentElement.firstChild){tmp[0].appendChild(tdoc.documentElement.firstChild.cloneNode(true));tdoc.documentElement.removeChild(tdoc.documentElement.firstChild);}}catch(e){alert(":"+txt);}
return true;};this.setText=function(w,txt){var tmp=(w=='.')?[nod]:this.select(w),r;if(!tmp[0])return false;if(tmp[0].nodeType==2&&w=='.')tmp[0].nodeValue=txt.mEncode();else{while(tmp[0].firstChild)tmp[0].removeChild(tmp[0].firstChild);tmp[0].appendChild(tmp[0].ownerDocument.createTextNode(txt.mEncode()));}
here.saveUnit.change();return true;};this.createElement=function(t,attr){var n=doc.createElement(t);for(var y in attr)n.setAttribute(y,attr[y]);return n;};this.createTextNode=function(t){var n=doc.createTextNode(t);return n;};this.mkFragment=function(cnod){if(cnod.ownerDocument!=doc)return false;var odoc=(new $xml.doc());odoc.fragment=true;odoc.clone({'src':src,'doc':doc,'owner':owner,'nod':cnod,'origin':this});odoc.remove=function(){var t;if((t=this.select(".")[0]).parentNode)
t.parentNode.removeChild(t);this.pokeOrigin();return t;};return odoc;};this.remove=function(){if(db[src])if(db[src].remove)return db[src].remove();return false;};this.eval=function(w){try{if(window.$nav.type!='ie'){return doc.evaluate(w,nod,null,XPathResult.ANY_TYPE,null);}else{var expr=xpathParse(w);var result=expr.evaluate(new ExprContext(nod));resultAsString=result.stringValue();return resultAsString;}}catch(e){alerts.msg("Xpath error t1 die : "+w+" / "+e.description);return false;}};this.test=function(w){try{if(window.$nav.type=='ie'){var expr=xpathParse(w);var result=expr.evaluate(new ExprContext(nod));return result.booleanValue();}else{return doc.evaluate(w,nod,null,XPathResult.BOOLEAN_TYPE,null).booleanValue||false;}
return false;}catch(e){alerts.msg("Xpath error t1 die : "+w+" / "+e);return false;}};this.loadSelect=function(w){var plain_uri=$xml.mkUri(w+"");if(db[plain_uri]){document.dbcache=db;this.clone(db[plain_uri].clone());return this;}
var nav=new AjaxSession();nav.add({id:"select",evar:{"uri":plain_uri}});nav.add({id:"listXML",evar:{"id":"val"}});nav.onSync(function(rez){doc=$xml.newDOM($xml.getInnerXML(rez.val));here.documentElement=nod=doc.documentElement;if(tmp=$xml.checkError(rez.val)){return here.propag("!notfound","init",here);}
(db[src]=new $xml.doc()).clone(here.clone(),true);here.propag("ready","init",here);});nav.onError(function(rez){alerts.msg("Erreur axx "+src+".");});nav.sync();return this;};this.select=function(w){if(/^\//.test(w))w="."+w;if(nod)
return nod.selectNodes(w);else return[];};this.set=function(w,v){var tmp=nod.selectNodes(w);if(tmp[0])tmp[0].value=v;else return false;return true;};this.get=function(w){var tmp=nod.selectNodes(w);if(tmp[0])return tmp[0].value;else return false;};};var listeners={};this.deleteStream=function(path,cb){var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"delStream",evar:{"id":"mynewstream"}});s.onSync(function(rez){if($xml.checkError(rez.mynewstream)){return alert("N'a pas pu supprimmer le stream!!\n"+$xml.checkError(rez.maj));}
if(cb)cb();});s.sync();};this.createStream=function(path,name,desc,model,right,cb){var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"mkStream",evar:{"id":"mynewstream","name":name,"desc":desc,"model":(modlib[model])?modlib[model]:model}});s.onSync(function(rez){if($xml.checkError(rez.mynewstream)){return alert("N'a pas pu créer le stream!!\n"+$xml.checkError(rez.maj));}
if(cb)cb();});s.sync();};this.createDoc=function(name,content,cb){var modlib={"forumPost":"","forumList":"","newsList":"","imList":""};var s=new AjaxSession();s.add({id:"createDocNoType",evar:{"id":"mynewdoc","name":name,"content":content}});s.onSync(function(rez){if($xml.checkError(rez.mynewdoc)){return alert("N'a pas pu créer le document!!\n"+$xml.checkError(rez.maj));}
if(cb)cb(rez.mynewdoc);});s.sync();};this.mkStream=function(path){var channel;if(path&&streamDB[path])return streamDB[path];window.aaaStreams=streamDB;var count=0,revision=0,model="",chanInfos={};return new(function(){var here=this,channel=0;this.type="rssStream";if(path){streamDB[path]=this;streamRoot.appendAt("/streams",channel=streamRoot.createElement("channel",{"uri":path,"title":":o","from":0,"to":0,"rev":0,"count":0}));channel=streamRoot.mkFragment(channel);var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":"oui"}});s.onSync(function(rez){majInfos(rez.myNewzListInfos);gtrack.plot($xml.mkUri(path));here.propag("ready","init",here,here);});s.sync();}
this.chan=chanInfos;var µnbl=0,µfl=[],µse={},listener=[];this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};};this.purge=function(){return listener;};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};return listener[lid];};this.listen=function(evt,c,datas,µem){if(evt=="change"){}
this.propag(evt,c,datas,µem);};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};var chanDocs={};this.getOwner=function(){return chanInfos.owner;};var beReady=function(selection,cb){var sel=[],tmp;var o=0,p;for(o=0;o<selection.length;o++){p=$xml.mkUri(path)+"#"+$xml.getAttr(selection[o],"mid");$xml.wreg($xml.getXML(selection[o]),p,chanInfos.owner);sel.push((new $xml.doc()).load(p));db[p].save=function(){var t=this;here.updateItem(this,function(){t.saveUnit.save();});};db[p].getOrigin=function(){return here;};db[p].remove=function(){var t=this.select(".")[0];here.del(this);return t;};}
lastSelection=sel;var ttmp,ttmp2;try{if(sel.length==0){ttmp=ttmp2=0;}else if(!(ttmp=sel[0].get("@id"))||!(ttmp2=sel[sel.length-1].get("@id")))return alerts.msg("Item sans ID select interrompu...");}catch(e){(new bugtales(e)).finalize("hop",{"s":sel});alerts.msg(":error beready @"+path+" :"+e);};lastSelectionBounds={"count":channel.get("./@count"),"smin":ttmp,"smax":parseInt(ttmp2)+1};cb({"bounds":lastSelectionBounds,"datas":lastSelection,"toString":function(){return this.bounds.smin+":"+this.bounds.smax+" ["+this.bounds.count+"]";}});};var majMe=function(nod){var nd=nod.firstChild;var cnd=channel.select('./item');while(nd){for(var o in cnd){if(parseInt($xml.getAttr(cnd[o],"id"))>parseInt($xml.getAttr(nd,"id"))){}}
nd=nd.nextSibling;}};var importItems=function(nod){var list=[],chanroot=channel.select('.')[0];while(chanroot.firstChild)
chanroot.removeChild(chanroot.firstChild);if(!nod)return;while(nod.firstChild)
chanroot.appendChild(nod.firstChild);var tmp=chanroot.firstChild;if(!tmp)return;list.push(tmp);while(tmp=tmp.nextSibling)list.push(tmp);list.sort(function(a,b){if(parseInt($xml.getAttr(a,"rev"))>parseInt(chanInfos.rev))
chanInfos.rev=parseInt($xml.getAttr(a,"rev"));if(parseInt($xml.getAttr(b,"rev"))>parseInt(chanInfos.rev))
chanInfos.rev=parseInt($xml.getAttr(b,"rev"));if(parseInt($xml.getAttr(a,"mid"))==parseInt($xml.getAttr(b,"mid"))){if(parseInt($xml.getAttr(a,"rev"))>parseInt($xml.getAttr(b,"rev")))
if(b.parentNode)chanroot.removeChild(b);else if(a.parentNode)chanroot.removeChild(a);return 0;}
if(parseInt($xml.getAttr(a,"id"))<parseInt($xml.getAttr(b,"id"))){return-1;}
if(parseInt($xml.getAttr(a,"id"))>parseInt($xml.getAttr(b,"id"))){return 1;}
alerts.msg('euuuuh...');return 0;});while(list.length)
chanroot.appendChild(list.shift());var sel=channel.select('./item');channel.set("./@from",$xml.getAttr(chanroot.firstChild,"id"));channel.set("./@to",parseInt($xml.getAttr(chanroot.lastChild,"id"))+1);var o=0;for(o=0;o<sel.length;o++)
if(chanDocs[parseInt($xml.getAttr(sel[o],"id"))]){chanDocs[parseInt($xml.getAttr(sel[o],"id"))].majDoc($xml.getXML(sel[o]));}};var majInfos=function(nod){var c=false;channel.set("./@rev",$xml.getAttr(nod.firstChild,"rev"));channel.set("./@count",parseInt($xml.getAttr(nod.firstChild,"count")));channel.set("./@title",$xml.getAttr(nod.firstChild,"title"));channel.set("./@owner",$xml.getAttr(nod.firstChild,"owner"));var tmp=nod.selectNodes("./model")[0];chanInfos.model=$xml.getXML(nod.firstChild);if(tmp)model=$xml.getInnerXML(tmp);chanInfos.model=model;chanInfos.owner=$xml.getAttr(nod.firstChild,"owner");chanInfos.count=parseInt($xml.getAttr(nod.firstChild,"count"));if(parseInt(chanInfos.rev)!=parseInt($xml.getAttr(nod.firstChild,"rev")))c=true;chanInfos.rev=$xml.getAttr(nod.firstChild,"rev");chanInfos.title=$xml.getAttr(nod.firstChild,"title");chanInfos.description=$xml.getAttr(nod.firstChild,"description");if(c)here.propag("maj","init",here,here);};var dldItems=function(f,t,cb){var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"get",evar:{"id":"myNewzList","from":f,"to":t}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":(model=="")?"oui":"non"}});s.onSync(function(rez){var txt;if(!rez.myNewzList||(txt=$xml.checkError(rez.myNewzList))){alerts.msg(path+"\nNe peux mettre a jour le stream!!\n"+listOf(rez));return;}
majInfos(rez.myNewzListInfos);importItems(rez.myNewzList);here.select(f,t,cb,true);});s.sync();};var HIDcodex=[];var codex=[];var baseSelect={'f':0,'t':0};this.select=function(ft,tt,cb,done){var f=parseInt(ft);var t=parseInt(tt);if(baseSelect.f>f)baseSelect.f=f;if(baseSelect.t<t)baseSelect.t=t;var c=parseInt(channel.get("./@count"));f=Math.max(f,0);f=Math.min(f,c);t=Math.min(t,c);var list=channel.select("./item[@id >= "+f+"][@id < "+t+"]");if(list.length==(t-f)&&t>=f){beReady(list,cb);}else{if(!done){dldItems(f,t,cb);}else{alerts.msg("Le serveur n'a pas envoyé tout les items ou une erreur est survenue\nChan :"+path+"\nSelect :"+c+" : "+f+" -> "+t);beReady(list,cb);}}};this.size=function(){return count;};this.updateItem=function(datas,cb){try{var mid=datas.get("./@mid");}catch(e){return alerts.msg("Item corrompus; ne peut sauver l'item..");}
var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listEd",evar:{"id":"pushEd","item":datas.getText('.',true),"mid":mid}});s.add({id:"get",evar:{"id":"maj","from":channel.get("./@from"),"to":channel.get("./@to")}});s.onSync(function(rez){if($xml.checkError(rez.pushEd)){return alerts.msg("Ne peux editer le stream!!\n"+$xml.checkError(rez.maj));}
importItems(rez.maj);if(cb)cb();here.propag("maj","init",this);});s.sync();};this.unshift=function(nnod){};this.insertAfter=function(onod,nnod){try{var mid=onod.select("./@mid")[0].nodeValue;}catch(e){return alerts.msg("Item corrompus; ne peut sauver l'item..\n"+onod);}
var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listInsertAfter",evar:{"id":"pushEd","item":nnod.getText('.',true),"mid":mid}});s.add({id:"get",evar:{"id":"maj","rev":channel.get("./@rev"),"from":baseSelect.f,"to":baseSelect.t}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":"oui"}});s.onSync(function(rez){if($xml.checkError(rez.pushEd)){return alerts.msg("Serveur :"+$xml.checkError(rez.pushEd));}
majInfos(rez.myNewzListInfos);importItems(rez.maj);here.propag("maj","init",here);});s.sync();};this.insertBefore=function(onod,nnod){try{var mid=onod.select("./@mid")[0].nodeValue;}catch(e){return alerts.msg("Item corrompus; ne peut sauver l'item..\n"+onod);}
var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listInsertBefore",evar:{"id":"pushEd","item":nnod.getText('.',true),"mid":mid}});s.add({id:"get",evar:{"id":"maj","rev":channel.get("./@rev"),"from":baseSelect.f,"to":baseSelect.t}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":"oui"}});s.onSync(function(rez){if($xml.checkError(rez.pushEd)){return alerts.msg("Serveur :"+$xml.checkError(rez.pushEd));}
majInfos(rez.myNewzListInfos);importItems(rez.maj);here.propag("maj","init",here);});s.sync();};this.del=function(nnod){var mid=nnod.get("./@mid");var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listDelete",evar:{"id":"del","mid":mid}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":"oui"}});s.add({id:"get",evar:{"id":"maj","rev":channel.get("./@rev"),"from":baseSelect.f,"to":baseSelect.t}});s.onSync(function(rez){if($xml.checkError(rez.del)){return alerts.msg("Ne peux editer le stream!!\n"+$xml.checkError(rez.maj));}
majInfos(rez.myNewzListInfos);importItems(rez.maj);here.propag("maj","init",here);});s.sync();};this.unshift=function(nnod){};this.push=function(datas,cb){autoUpdateIgnore=true;var txt=datas;var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listPush",evar:{"id":"pushItem","item":datas.getText('.',true)}});s.add({id:"get",evar:{"id":"maj","rev":channel.get("./@rev"),"from":baseSelect.f,"to":baseSelect.t}});s.add({id:"listInfo",evar:{"id":"myNewzListInfos","model":"oui"}});s.onSync(function(rez){if($xml.checkError(rez.maj)){return alerts.msg("Ne peux update (update) le stream!!\n"+$xml.checkError(rez.maj));}
majInfos(rez.myNewzListInfos);importItems(rez.maj);if(cb)cb();here.propag("ready","init",here);});s.sync();};this.getModel=function(){var tmp;tmp=new $xml.doc("<item>"+model+"</item>");tmp.save=function(){var t=this;here.push(this,function(){t.saveUnit.save();});};tmp.del=function(){};return tmp;};this.updateNow=function(){try{autoUpdateIgnoreNext=true;this.update();}catch(e){alerts.msg("Fail at update : "+path+"\n"+e);}};this.update=function(){var here=this;var s=new AjaxSession();s.add({id:"select",evar:{"uri":$xml.mkUri(path)}});s.add({id:"listMaj",evar:{"id":"maj","rev":channel.get("./@rev")}});s.onSync(function(rez){if($xml.checkError(rez.maj)){return alerts.msg("Ne peux mettre a jour le stream!!\n"+$xml.checkError(rez.maj));}
majMe(rez.maj);});s.sync();};})();};this.checkError=function(nod){if(!nod)return"Checking error on null doc node";var tmp,txt="";if((tmp=nod.selectNodes("//error")).length!=0){var o;for(o=0;o<tmp.length;o++)txt+=this.getInnerXML(tmp[o])+"\n";return txt;}
return false;};this.clean=function(d){var bal=d.getElementsByTagName('*');for(i=0;i<bal.length;i++){a=bal[i].previousSibling;if(a&&a.nodeType==3)this.go(a);b=bal[i].nextSibling;if(b&&b.nodeType==3)this.go(b);}
return d;};this.getNamedChild=function(node,name){try{var c=-1;while(++c<node.childNodes.length)if($xml.localNName(node.childNodes.item(c)).toLowerCase()==name.toLowerCase())return node.childNodes.item(c);return false;}catch(e){alerts.msg("getNamedChild : '"+name+"' est introuvable parmis les enfants de node ("+node+" / "+node.nodeName+") \n -D"+e);return false;}};this.localNName=function(node){var lnn;if(!(lnn=node.nodeName.rmNamespace()))lnn=(node.nodeName.split(':')[1])?node.nodeName.split(':')[1]:node.nodeName;return lnn;};this.getAttr=function(node,id){try{var t=node.selectNodes("./@"+id);if(t[0])return t[0].value;return"";}catch(e){return"";}};this.getXML=function(node){try{if(!(xml=node.xml))xml=(new XMLSerializer()).serializeToString(node);}catch(err){return"<error>xml error : "+err+"</error>";}
return xml;};this.getInnerXML=function(node){try{var c=-1;var txt="";while(++c<node.childNodes.length)if(!(xml=node.childNodes.item(c).xml))txt+=(xml=(new XMLSerializer()).serializeToString(node.childNodes.item(c)));else txt+=xml;return txt;}catch(e){alerts.msg("Error innerxml/xml "+node+" / "+e.description+" \n");return"<error/>";}};this.getInnerText=function(nod){try{var s=nod.selectNodes("child::text()");var txt="";var o=-1;while(++o<s.length)txt+=s[o].data;return txt.mUnEncode();}catch(e){alerts.msg("Error innertext/xml "+nod+" / "+e+e.description+" \n");return"error";}};streamRoot=new this.doc("<streams/>");db["local://session"]=$majax._SessionInfos=new this.doc("<session><login>anonyme</login></session>","anonyme","local://session");})();var idctx=0;var µ$µ=function context(){var cPV={};var here=this;var myidctx=idctx++,first=true;var listener=[],µnbl=0,µfl=[],µse={},events_enabled=false,sleeping_events={},sleeping_newlisteners=[];var inited=false;this.sleep=function(){events_enabled=false;};this.init=function(){if(inited)return;events_enabled=true;this.listen("init");inited=true;events_enabled=false;this.wakeup();};this.wakeup=function(){if(events_enabled||!inited)return;events_enabled=true;var l;while(l=sleeping_newlisteners.shift())
for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);for(var evt in sleeping_events){this.listen(sleeping_events[evt][0],sleeping_events[evt][1],sleeping_events[evt][2],sleeping_events[evt][3]);sleeping_events[evt]=0}
sleeping_events={};};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;if(!events_enabled)sleeping_newlisteners.push(l);else{setTimeout(function(){for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);},1);}
return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.listen=function(evt,c,datas,µem,keepLinked){try{if(!events_enabled)return sleeping_events[evt]=[evt,c,datas,(µem)?µem:this];try{if(1||keepLinked)
each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this,keepLinked);});else setTimeout(function(){each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this,keepLinked);});},1);}catch(e){console.dir(listener);}
if(!/^\!.*/.test(evt)&&!/^init/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("VarBox "+id+" (listen)!!",this);}};this.mkSema=function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(done){if(is_defined(this.list))this.list.free();return;}
if((new RegExp("^("+evt.replace(/\./g,"\\.").replace(/\*/g,"\\w+").replace(/\ *\,\ */g,")|(")+")")).test(e)){done=true;if(is_defined(this.list))this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;};cPV.contextDatas={};var hiredb=this.db={};this.db.includes=[];this.db.jsvar={};this.db.evar={};this.db.widget={};this.db.rss={};this.db.xml={};this.db.streams={};this.db.array={};this.db.get=function(id){var p=id.split('.');if(!p[0]||!p[1]||!this[p[0]]||!this[p[0]][p[1]]){this.set(p[0]+"."+p[1]+".init","");return this[p[0]][p[1]];}
return this[p[0]][p[1]];};var $vu=this.db.vars={µvb:function(id,v,flags){return new(function(id,v,flags){var value=0,litem=0;this.id=id;this.type="varbox";var uno=this;this.getVal=function(){return value;};this.setVal=function(vl){if(value.setVal)return value.setVal(vl);};var listener=[];var µnbl=0;var µfl=[];var µse={};this.l=listener;this.sync=function(o){var lst;var lid,emit=false;var v0=o.getVal();if(value.addListener){lst=value.purge();for(var i in lst)v0.importListener(lst[i]);value=v0;if(litem)litem.free();litem=value.addListener(this);}else if(v0.addListener){value=v0;if(litem)litem.free();litem=value.addListener(this);}else value=v0;this.val=value;};this.addModListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;lst=listener[lid]={'id':lid,'obj':{'docid':id,'listen':function(evt,c,datas,µem){l.listen("db."+this.docid+"."+evt.replace(/^\!/,""),c,datas);}},"free":function(){µfl.push(this.id);listener[this.id]=0;}};for(var evt in µse)lst.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return lst;};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.listen=function(evt,c,datas,µem){try{if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("VarBox "+id+" (listen)!!",this);}};this.getOrigin=function(){if(value.getOrigin)return value.getOrigin();};this.getVarOrigin=function(){if(value.getVarOrigin)return value.getVarOrigin();};this.pokeOrigin=function(){if(value.pokeOrigin)return value.pokeOrigin();};this.mkSema=function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(done){if(is_defined(this.list))this.list.free();return;}
if(e==evt){done=true;if(is_defined(this.list))this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;};this.listActs=function(){if(value.listActs)return value.listActs();};this.select=function(v,tt,done){if(value.select)return value.select(v,tt,done);else return false;};this.ignit=function(path,name,desc,model,right){if(value.ignit)return value.ignit(path,name,desc,model,right);};this.insertAfter=function(onod,nnod){if(value.insertAfter)return value.insertAfter(onod,nnod);};this.insertBefore=function(onod,nnod){if(value.insertBefore)return value.insertBefore(onod,nnod);};this.push=function(nnod){if(value.push)return value.push(nnod);};this.mkFragment=function(nnod){if(value.mkFragment)return value.mkFragment(nnod);};this.unshift=function(nnod){if(value.unshift)return value.unshift(nnod);};this.setParam=function(v,p){if(value.setParam)return value.setParam(v,p);};this.createElement=function(v,p){if(value.createElement)return value.createElement(v,p);};this.reload=function(){if(value.reload)return value.reload();};this.mkGhost=function(nod,uid,mo,bm){if(value.mkGhost)return value.mkGhost(nod,uid,mo,bm);};this.getOwner=function(){if(value.getOwner)return value.getOwner();};this.getParams=function(){if(value.getParams)return value.getParams();};this.$sfs=function(v,d){if(value.$sfs)return value.$sfs(v,d);};this.createSelection=function(v,d){if(value.createSelection)return value.createSelection(v,d);};this.setWindow=function(v){if(value.setWindow)return value.setWindow(v);};this.getModel=function(){if(value.getModel)return value.getModel();};this.getContext=function(){if(value.getContext)return value.getContext();};this.setStyle=function(s){if(value.setStyle)return value.setStyle(s);};this.getText=function(s){if(value.getText)return value.getText(s);};this.print=function(nod,sweetid,b){if(value.addListener)return value.print(nod,sweetid,b);else{if((value+"").lrtrim()!="")nod.parentNode.replaceChild(document.createTextNode((value+"")),nod);else nod.parentNode.removeChild(nod);}};this.free=function(){alert("free:"+id);};this.propag=function(evt,c,datas,µem){if(value.propag)return value.propag(evt,c,datas,(µem)?µem:this);};this.save=function(){if(value.save)return value.save();};this.remove=function(){if(value.remove)return value.remove();};this.exec=function(p){if(value.exec)return value.exec(p);else return"notdef";};this.src=function(){if(value.src)return value.src();else return"notdef";};this.set=function(v,ev){try{var emit=false;if(value.set){value.set(v,ev);emit=false;}else if(v.addListener){value=v;if(litem)litem.free();litem=value.addListener(this);}
this.val=value;if(emit)this.propag("change","init",0,this);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("varbox "+id+" (set)!!",this);}};this.get=function(){return(value.get)?value.get():value;};this.toString=function(){return value+"";};this.set(v);this.addModListener(here);})(id,v,flags);},mkJSVar:function(v,origin,db){return new(function(v){var e=0,value=0,litem=[];var hnum=num;var num;this.type="jsvar";this.getVal=function(){return value;};var listener=[];var µnbl=0;var µfl=[];var µse={};this.l=listener;this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.purge=function(){return listener;};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};for(var evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.listen=function(evt,c,datas,µem){try{this.propag(evt,c,value,µem);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("listen svar !!",this);}};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};this.free=function(){alert("free:"+id);};this.save=function(){alert("save:"+id);};this.select=function(v){return false;};this.set=function(v,µem){try{var t;if(!(t=jsonEval(v,origin.NamedParentNode().µ,db,origin.NamedParentNode().getMajaxNode())))return alerts.msg("error setting jsvar !! ("+v+")");;this.propag("change","init",value=t,µem);}catch(err){alerts.msg("error setting jsvar !! ("+v+")\n"+err);}};this.get=function(){return value;};this.toString=function(){return value;};this.set(v);})(v);},mkEVar:function(v,db){return new(function(v,db){var e=0,value=0,litem=[],donoteval=false;var hnum=num;this.db=db;var num;this.type="evar";this.setVal=function(vl){if(value!=vl){value=vl;this.val=value;this.propag("change","init",value+"");}};this.getVal=function(){return e.exp;};this.checkdb=function(d){return d==db;};var listener=[];var µnbl=0;var µfl=[];var µse={};this.l=listener;this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.purge=function(){return listener;};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};for(var evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.listen=function(evt,c,datas,µem){try{if(evt=="resize"){if((/^(?:.*[\ \;\:])top(\ *\:)/.test(value)&&/^(?:.*[\ \;\:])bottom(\ *\:)/.test(value))||(/^(?:.*[\ \;\:])left(\ *\:)/.test(value)&&/^(?:.*[\ \;\:])right(\ *\:)/.test(value))||(/^(?:.*[\ \;\:])xalign(\ *\:)/.test(value)||/^(?:.*[\ \;\:])yalign(\ *\:)/.test(value))){if(datas.parentNode&&datas.oldParentDim&&datas.oldParentDim.w==datas.parentNode.offsetWidth&&datas.oldParentDim.h==datas.parentNode.offsetHeight)return;if(datas.parentNode)
datas.oldParentDim={"w":datas.parentNode.offsetWidth,"h":datas.parentNode.offsetHeight};this.propag(evt,c,value,(µem)?µem:this);}
return;}
if(!donoteval)if(/(.*\.)?(change|ready)/.test(evt)){var v=e.getVal(db);if(value!=v){value=v;this.propag("change",c,value,(µem)?µem:this);}}}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("evar (listen) !!",this);}};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};this.free=function(){alert("free:"+id);};this.save=function(){alert("save:"+id);};this.select=function(v){return false;};this.set=function(v,donotev){try{var emit=false;donoteval=donotev;if(value+""!=v+"")emit=true;if(v.type=="evar"){e=new cPV.parse(v.get()+"");}else if(!donoteval){e=new cPV.parse(v+"");emit=true;}
if(v.type=="evar"||!donoteval){var u;this.e=e;this.vars=e.vars;u=e.getVal(db);if(/^[0-9]+(\.[0-9]+)?$/.test(u))u=parseInt(u);if(u==value)emit=false;value=u;this.vars2=[];while(litem.length!=0)litem.pop().free();var tmpr={};for(var o in e.vars){u=db.get(o);this.vars2.push(u);if(!u){alerts.msg(e.vars[o].id+" not found!");continue;}
litem.push(u.addListener(this));}
this.val=value;}else{value=v;emit=true;}
if(emit)this.propag("change","init",value+"");}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("set evar !!",this);}};this.get=function(){return value;};this.toString=function(){return value;};this.set(v);})(v,db);},mkArrayVar:function(sv,dbi){var db=dbi;return new(function(sv){var doc="",nod,src=0,docListener=false,srcListener=false;this.type="ArrayVar";this.length=0;var listener=[];var µnbl=0;var µfl=[];var µse={};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};for(var evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.purge=function(){return listener;};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.listen=function(evt,c,datas,µem){try{this.propag(evt,c,datas,µem);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("ArrayVar !!",this);}};this.mkSema=function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(done){if(is_defined(this.list))this.list.free();return;}
if(e==evt){done=true;if(is_defined(this.list))this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))
if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};this.select=function(v){return(doc)?doc.select(v):[];};this.remove=function(){if(doc.remove){doc.remove();}};var thelist=[];this.getArray=function(){return thelist;};this.each=function(f){return each(thelist,f);};this.item=this.get=function(i){return thelist[i];};this.set=function(a){thelist=[];for(var o=0;o<a.length;o++)
thelist.push(a[o]);this.length=thelist.length;this.propag("change","init",this,this);};this.push=function(a){var emit=false;if(emit)this.propag("change","init",doc,this);};this.toString=function(){return"Array("+thelist.length+")";};this.set(sv);})(sv);},µxv:function(sv,xmlv,dbi){var db=dbi;return new(function(sv,xmlv){var doc="",nod,src=0,debugging=false,docListener=false,srcListener=false;this.type="xmlvar";var selectBased=false,selectListener=0,selectXmlListener=0,selectXmlVar=0,selectSelection=".",listener=[],µnbl=0,µfl=[],µse={};this.getOrigin=function(){if(doc.getOrigin)return doc.getOrigin();};this.getVarOrigin=function(){if(doc)return doc;};this.pokeOrigin=function(){if(doc.pokeOrigin)return doc.pokeOrigin();};this.setDb=function(dbimp){db=dbimp;};this.getVal=function(){return doc;};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};for(var evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.purge=function(){return listener;};this.addListener=function(l,d){var lid=(µfl.length!=0)?µfl.pop():µnbl++;if(d)debugging=true;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.listen=function(evt,c,datas,µem){try{if(selectBased){if(datas.type=="string"){var thevar=datas.replace(/^(\w+\.\w+).*/,"$1");selectSelection=datas.replace(/^\w+\.\w+\((.*)\)$/,"$1");if(selectListener){selectListener.free();selectListener=0;}
if(db.get(thevar)){if(selectXmlListener)selectXmlListener.free();selectXmlListener=(selectXmlVar=db.get(thevar)).addListener(this);}
return;}else if(datas.type=="evar"){var thevar=datas.get().replace(/^(\w+\.\w+).*/,"$1");selectSelection=datas.get().replace(/^\w+\.\w+\((.*)\)$/,"$1");if(db.get(thevar)){if(selectXmlListener)selectXmlListener.free();selectXmlListener=(selectXmlVar=db.get(thevar)).addListener(this);}
return;}else if(selectXmlVar&&datas.id==selectXmlVar.getVarOrigin().id){var mysel;if((mysel=datas.select(selectSelection)).length!=0){doc=datas.mkFragment(mysel[0]);if(doc.addListener&&docListener)docListener.free();if(doc.addListener)docListener=doc.addListener(this);}else return this.propag("undefined");}
if(datas!=doc)return;}else if(/^(change|ready)$/.test(evt)&&datas&&(datas.type=="string"||datas.type=="evar")){if(docListener)docListener.free();doc=new $xml.doc();µse={};docListener=doc.addListener(this);if(datas.type=="string"){if(docListener)docListener.free();doc.load(datas);µse={};docListener=doc.addListener(this);}else doc.load(datas.get());return;}
this.propag(evt,c,datas,µem);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("xmlvar !!",this);}};this.mkSema=function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(done){if(is_defined(this.list))this.list.free();return;}
if(e==evt){done=true;if(is_defined(this.list))this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;};this.getOwner=function(){if(doc.getOwner)return doc.getOwner();};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))
if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};this.select=function(v){return(doc)?doc.select(v):[];};this.createElement=function(v,p){return(doc)?doc.createElement(v,p):false;};this.exec=function(p){var txt="",s;if(!doc)return;s=doc.eval(p);if(window.$nav.type!='ie'){switch(s.resultType){case XPathResult.STRING_TYPE:txt+=s.stringValue.mUnEncode();break;case XPathResult.NUMBER_TYPE:txt+=s.numberValue+'';break;case XPathResult.BOOLEAN_TYPE:txt+=s.booleanValue+'';break;default:try{var thisNode=s.iterateNext();while(thisNode){txt+=($xml.getAttr(thisNode,"encoded")=="true")?$xml.getInnerXML(thisNode).mUnEncode():$xml.getInnerXML(thisNode);thisNode=s.iterateNext();}}catch(e){txt="err:"+s;}}}else{txt=s.mUnEncode();}
return txt;};this.reload=function(){if(doc.reload)return doc.reload();};this.src=function(){if(doc)return doc.getSrc();else return"notready";};this.mkFragment=function(nnod){if(nnod.type=="string"){var tmplist=[];var frag={"getOwner":function(){return"operator";},"addListener":function(n){tmplist.push(n);}};frag.varcontroler={'listen':function(e){if(e!="ready")return;var s=doc.select(nnod);if(s.length!=0){var d=doc.mkFragment(s[0]);if(frag.purge)d.importListeners(frag.purge());inherit(frag,d);var t;while(t=tmplist.pop())
frag.addListener(t);}}};this.addListener(frag.varcontroler);return frag;}else if(doc.mkFragment)return doc.mkFragment(nnod);};this.save=function(){if(doc.save){doc.propag("!save",'init');doc.save();doc.propag("change",'init',this,this);}};this.remove=function(){if(doc.remove){doc.remove();}};this.getText=function(w,e){return(doc)?doc.getText(w,e):"";};this.setText=function(w,e){return(doc)?doc.setText(w,e):"";};this.get=function(){return doc;};this.$sfs=function(v1,mdb){if(mdb)db=mdb;if(v1.type=="varbox")this.$sfs(v1.getVal());if(v1.type=="evar"){selectBased=true;if(selectListener)selectListener.free();selectListener=v1.addListener(this);};if(v1.type=="string"){selectBased=true;if(selectListener)selectListener.free();selectListener=0;this.listen("change","",v1,this);};};this.createSelection=function(w,t){var a=$vu.mkArrayVar([]);var l;l=this.addListener({"listen":function(e){if(e=="change"){var s=doc.select(w),s2=[];for(var o=0;o<s.length;o++){s2.push(doc.mkFragment(s[o]));}
a.set(s2);}}});return a;};this.set=function(sv,xmlv){var emit=false;selectBased=false;if(selectXmlListener)selectXmlListener.free();if(selectListener)selectListener.free();selectXmlListener=0;selectListener=0;try{if(!sv&&!xmlv){return;}else if(sv.type=="xmlvar"){return this.set(sv.getVal(),xmlv);}else if(sv.type=="varbox"){return this.set(sv.getVal(),xmlv);}else if(sv.type=="xmldoc"){if(srcListener)srcListener.free();if(docListener)docListener.free();doc=sv;µse={};src="";docListener=doc.addListener(this);}else if(sv.type=="evar"){if(srcListener)srcListener.free();µse={};src=sv;srcListener=src.addListener(this);emit=false;}else if(sv.type=="string"){if(src.type=="evar"){if(src.getVal()==sv)return;µse={};src.set(sv);}else if(src!=sv){src=sv;if(srcListener)srcListener.free();this.listen("change","init",src,this);}}else if(xmlv!=""){if(srcListener)srcListener.free();if(docListener)docListener.free();doc=new $xml.doc(xmlv);srcListener=0;src=0;docListener=doc.addListener(this);emit=true;}}catch(e){return alerts.msg("Cant load XML:"+e+"\n"+xmlv);}
if(emit)this.propag("change","init",doc,this);};this.toString=function(){return doc+"";};this.set(sv,xmlv);})(((db)?this.mkEVar(sv,db):sv),xmlv);},mkRssVar:function(sv,db){return new(function(sv){var doc=0,nod,src="",docListener,srcListener;this.type="rssvar";if(!document.body.k)document.body.k=[this];else document.body.k.push(this);var stackedAct={};var listener=[],µnbl=0,µfl=[],µse={};var here=this;var selection={'start':0,'length':0};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};for(var evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.purge=function(){return listener;};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.exec=function(p){if(!/^\@.*/.test(p))return"bad parameter : "+p;var txt=p.replace(/^\@(.*)$/,"$1");if(txt=="path"){return src+"";}else if(txt=="stream_id"){}else if(txt=="title"){if(!doc||!doc.chan)return"";return doc.chan.title;}else if(txt=="description"){if(!doc||!doc.chan)return"";return doc.chan.description;}else if(txt=="owner"){}else if(txt=="count"){if(!doc||!doc.chan)return 0;return doc.chan.count;}
return"bad parameter : "+txt;};this.listen=function(evt,c,datas,µem){try{if(datas.type=="evar"||datas.type=="string"){var tmp=(src+"").replace(/^.+\(([^\)]*)\)$/,"$1");var rsrc=(src+"").replace(/^\ *(.+)\([^\)]*\)$/,"$1");var tmp;if(tmp){tmp=tmp.split(",");for(var o=0;o<tmp.length;o++)
selection
[tmp[o].replace(/^\ *([^\:=]+)\:.*$/,"$1")]=unescape(tmp[o].replace(/^\ *[^\:]+\:\ *(.*)\ *$/,"$1")).replace(/^(?:\')(.*)(?:\')$/,"$1");}
if(!selection.start)selection.start=0;if(!selection.length)selection.length=5;if(rsrc+""!=doc.uri){if(docListener){docListener.free();docListener=0;}
doc=$xml.mkStream(rsrc+"");if(!docListener)docListener=doc.addListener(this);return;}
return;}else if(datas.type=="rssStream"){doc.select(selection.start,selection.start+selection.length,function(d){here.propag("change","init",$vu.mkArrayVar(d.datas));});}
this.propag(evt,"init",datas,µem);}catch(e){return alerts.msg("listen rss !! : "+e+"\n"+src);}};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});};this.getOwner=function(){if(doc.getOwner)return doc.getOwner();};this.getModel=function(){if(doc.getModel)return doc.getModel();};this.insertAfter=function(onod,nnod){if(doc.insertAfter)return doc.insertAfter(onod,nnod);};this.insertBefore=function(onod,nnod){if(doc.insertBefore)return doc.insertBefore(onod,nnod);};this.push=function(nnod){if(doc.push)return doc.push(nnod);};this.unshift=function(nnod){if(doc.unshift)return doc.unshift(nnod);};this.get=function(){return src;};this.set=function(v,µem){var emit=false;try{if(v.type=="varbox"){return this.set(v.getVal());}else if(v.type=="rssvar"){return this.set(v.get());}else if(v.type=="evar"){if(src+""!=v+"")emit=true;if(srcListener){srcListener.free();srcListener=0;}
src=v;srcListener=src.addListener(this);}else if(v.type=="string"){if(src+""!=v+"")emit=true;if(srcListener){srcListener.free();srcListener=0;}
src=v;}else if(v.type=="doc"){}else{}
if(emit)this.propag("change","init",0,µem);}catch(e){return alerts.msg("Error setting rssvar !! : "+e+"\n"+v);}};this.toString=function(){return src+"";};this.set(sv);})((db)?this.mkEVar(sv,db):sv);},mkWidgetVar:function(urio,dbo,param){return new(function(def_uri,pdb){var val=0;var $u='';var vlist=0,srclist=0;var db=pdb;this.type="widgetvar";var listener=[],µnbl=0,µfl=[],µse={};this.importListener=function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};var evt;for(evt in µse)i.obj.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);};this.purge=function(){return listener;};this.addListener=function(l){var lid=(µfl.length!=0)?µfl.pop():µnbl++;var evt;for(evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);return listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};};this.listen=function(evt,c,datas,µem){try{this.propag(evt,c,datas,µem);}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("listen nodvar !!",this);}};this.propag=function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];var o;for(o in listener)if(listener[o])listener[o].obj.listen(evt,c,datas,(µem)?µem:this);};this.exec=function(p){if(!/^\@.*/.test(p))return"bad parameter : "+p;var txt=p.replace(/^\@(.*)$/,"$1");if(!val)return"doc mod not def";if(txt=="path"){return $u+"";}else if(txt=="stream_id"){}else if(txt=="title"){return val.get("@id");}
return"bad parameter : "+txt;};var toprint=0,tooid=0;var defaultStyle=0;var built=false;this.instances=[];var params={};this.regInstance=function(w){this.instances.push(w);};this.setStyle=function(stl){defaultStyle=stl;for(var o in ghosts)
ghosts[o].cmod.setStyle(defaultStyle);};this.src=function(){return $u;};this.getContext=function(){return db;};this.setParam=function(id,val){params[id]=val;for(var o in this.instances){this.instances[o].context.db.set(id,val);}};this.getParams=function(){return params;};this.get=function(){return(val)?val.select('.'):0;}
this.set=function(uri,ndb){if(uri.type=="varbox")return this.set(uri.getVal(),ndb);if(uri.type=="widgetvar"){try{vlist.free();}catch(e){vlist=0;};val=uri;vlist=uri.addListener(this);return;}
$u=uri;var emit=false;try{vlist.free();}catch(e){vlist=0;};val=$vu.µxv(uri,"",db);vlist=val.addListener(this);return;if(emit)this.propag("change","init",this);};if(def_uri+""!='')this.set(def_uri,pdb);this.toString=function(){return""+val;};})(urio,dbo);}};var $ds={};this.db.include=function(incdb){try{if(!incdb)return;for(var vt in{"rss":"rss","evar":"evar","jsvar":"jsvar","widget":"widget","xml":"xml"}){for(var vid in incdb[vt]){if(!this[vt][vid]){this[vt][vid]=$vu.µvb(vt+'.'+vid,incdb[vt][vid].getVal(),here.flags);}
if(!this[vt][vid])alert("inc:"+vid);}}
incdb.includes.push(this);}catch(e){if(e.type=="bugtales")
e.propag("Sync include : "+vt+" / "+vid+" : "+e);else(new bugtales(e)).propag("Sync include : "+vt+" / "+vid+" : "+e);}};this.db.sync=function(id,v1,d){var i=id.split('.');if(i.length<=1)return false;if(this[i[0]][i[1]]){this[i[0]][i[1]].sync(v1);}else{$ds[i[0]+"*"+i[1]]=v1;}
return this[i[0]][i[1]];};this.db.set=function(id,v1,v2,db,donotsharedb){var i=id.split('.');if(i.length<=1)return false;if(i[i.length-1].lrtrim()=="init"&&this[i[0]][i[1]])return this[i[0]][i[1]];var hidb=this;if(this[i[0].lrtrim()]){if(this[i[0]][i[1]]){if(i[i.length-1].lrtrim()=="select"){this[i[0]][i[1]].getVal().setDb(db);this[i[0]][i[1]].getVal().$sfs(v1,db);}else this[i[0]][i[1]].set(v1,db);}else{if(i[0]=="array"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkArrayVar(v1,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1=="")this[i[0]][i[1]].set(v1);}else if(i[0]=="jsvar"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkJSVar(v1,v2,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1=="")this[i[0]][i[1]].set(v1);}else if(i[0]=="svar"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkSVar(v1,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1=="")this[i[0]][i[1]].set(v1);}else if(i[0]=="evar"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkEVar(v1,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1=="")this[i[0]][i[1]].set(v1);}else if(i[0]=="file"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkFileVar(v1,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1!='')this[i[0]][i[1]].set(v1);}else if(i[0]=="rss"){if(!this[i[0]][i[1]]){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkRssVar(v1,db),here.flags);}else if(!(i[2]&&i[2]=="init")||v1!='')this[i[0]][i[1]].set(v1);}else if(i[0]=="xml"){if(!this[i[0]][i[1]]){if(i[i.length-1].lrtrim()=="select"){var thexmlvar=$vu.µxv("","",db);thexmlvar.$sfs(v1);this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],thexmlvar,here.flags);}else if(v1.type=="varbox"){this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.µxv("","",db),here.flags);this[i[0]][i[1]].set(v1);}else{this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.µxv(v1,v2,db),here.flags);}}else if(!(i[2]&&i[2]=="init"))this[i[0]][i[1]].set(v1);}else if(i[0]=="widget"){if(!this[i[0]][i[1]])this[i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],$vu.mkWidgetVar(((db)?$vu.mkEVar(v1,db):v1),(donotsharedb)?0:db));else this[i[0]][i[1]].set(((db)?$vu.mkEVar(v1,db):v1),(donotsharedb)?0:db);}}
if($ds[i[0]+"*"+i[1]]){this.sync(i[0]+"."+i[1],$ds[i[0]+"*"+i[1]]);}
for(var p in this.includes){this.includes[p][i[0]][i[1]]=$vu.µvb(i[0]+"."+i[1],this[i[0]][i[1]].getVal(),here.flags);}
return this[i[0]][i[1]];}};cPV.parse=function(txt){this.exp=txt;this.vars=[];this.sync=false;var exec=[];try{var tmp=txt.match(/\{([^\{\}]*)\}/g);var ttmp,t1,t2,t3,t4;if(tmp)for(var o=0;o<tmp.length;o++){tmp[o]={"org":tmp[o],"c":[],"p":[]};ttmp=tmp[o].org;while(t1=ttmp.length){if(/^([\{\}\+\-\*\(\)\/])/.test(ttmp))ttmp=ttmp.replace(/^[\{\}\+\-\*\(\)\/](.*)/,"$1");else alerts.msg('bad eval :( : '+ttmp);if(/^(?:svar|evar|widget|xml|streams)\.\w+.*/.test(ttmp)){t2=ttmp.replace(/^\w+\.\w+((?:\([^\)]+\))?.*)/,"$1");t3=0;t4=0;if(t2.charAt(0)=='(')
while(1){if(t2.charAt(t3)=='(')t4++;else if(t2.charAt(t3)==')')t4--;if(t4==0)break;if(t3>t2.length)return"EVar syntax error";t3++;}
t4=t2.substr(t3);if(t3!=0){t2=t2.substr(1,t3-1);t3+=ttmp.replace(/^(\w+\.\w+)(?:\([^\)]+\))?.*/,"$1").length;tmp[o].c.push({'exp':ttmp.substr(0,t3+1),'varid':ttmp.replace(/^(\w+\.\w+)(?:\([^\)]+\))?.*/,"$1"),'p':t2});}else{t2="";tmp[o].c.push({'exp':ttmp.replace(/^(\w+\.\w+(?:\([^\)]+\))?).*/,"$1"),'varid':ttmp.replace(/^(\w+\.\w+)(?:\([^\)]+\))?.*/,"$1"),'p':ttmp.replace(/^\w+\.\w+(?:\((.+)\))?.*/,"$1")});t4=ttmp.replace(/^\w+\.\w+(?:\(.+\))?(.*)/,"$1")}
if(this.vars[tmp[o].c[0].varid])this.vars[tmp[o].c[0].varid].push(tmp[o].c[0]);else this.vars[tmp[o].c[0].varid]=[tmp[o].c[0]];ttmp=t4;}else if(/^\d+(?:[\,|\.]\d+)?/.test(ttmp)){ttmp=ttmp.replace(/^\d+(?:[\,|\.]\d+)?(.*)/,"$1");}
if(t1==ttmp.length)return alerts.msg('!!!:'+ttmp);}}
exec=tmp;}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("eval err !!",this);}
var db=here.db;getVal=this.getVal=function(datas,µem){try{var txt=this.exp;var tmp,tmp2,val,num,rtab;if(datas)db=datas;if(!exec)return this.exp;var o;for(o=0;o<exec.length;o++){num=true;for(var c in exec[o].c){tmp=exec[o].c[c].varid.split('.');if(db[tmp[0]]&&db[tmp[0]][tmp[1]]){if(exec[o].c[c].p&&exec[o].c[c].length!=0){try{exec[o].c[c].v=db[tmp[0]][tmp[1]].exec(exec[o].c[c].p);}catch(e){alerts.msg("eval errr :"+e+'\n'+e.description);}}else exec[o].c[c].v=db[tmp[0]][tmp[1]].get();if(parseInt(exec[o].c[c].v)+""!=exec[o].c[c].v)num=false;}}
if(num){tmp=exec[o].org;for(var c in exec[o].c)tmp=tmp.replace(exec[o].c[c].exp,exec[o].c[c].v);}else{tmp=exec[o].org;for(var c in exec[o].c)tmp=tmp.replace(exec[o].c[c].exp,'"'+((exec[o].c[c].v)?exec[o].c[c].v:"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n")+'"');}
try{eval(tmp2="tmp = "+tmp.replace(/\{(.*)\}/g,"$1")+";");}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("eval err (add evar)!!",[tmp2]);}
txt=txt.replace(exec[o].org,tmp);}
return txt;}catch(err){((err.type=="bugtales")?err:new bugtales(err)).propag("eval err !!",this);}};};cPV.datas={};};var main_onload=function(desk_uri){var $$=new µ$µ();var $session;var root_node=document.getElementById('ROOT');var background_nod=document.createElement('div'),popup_nod=document.createElement('div'),hidden_nod=document.createElement('div');$majax.setStyle(hidden_nod,"position:absolute;left:-10000px;top:-10000px;width:100%;height:100%;overflow:hidden");$majax.setStyle(background_nod,"position:absolute;left:0;top:0;width:100%;height:100%");$majax.setStyle(popup_nod,"position:absolute;left:0;top:0;width:100%;height:100%");hidden_nod.id="nowhereNode";var $root,globalInited=false;var µUtils={"isDomElement":function(obj){if(obj.nodeType&&obj.nodeType===1){try{obj.nodeType=obj.nodeType;if(obj instanceof Node)return true;}catch(e){return true;}}
return false;}};var models={};models["$file"]=function(){var
value="",id="fileup_"+getUniqueId(),lnode,myfile,dragList,state="new",hookNode;var lrtrimRE=new RegExp("^[\\n|\\r|\\s]+");var pub,tests,l,innerText="",here={"listen":function(event,c,datas){if(tests.on.test(event)){try{var db=pub.µ$o.context.db,here=pub.parentNode().getMajaxNode();(eval("(function(){"+$xml.getInnerXML(pub.µ$o.origin).unHTMLents()+"})()"));}catch(err){console.dir([{"trigger fail ":event,'here':[here],'src':[$xml.getInnerXML(pub.µ$o.origin)],"e":err}]);}}}};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;},"connectEvent":function(){if(hookNode||state=="done"||state=="redraw"||(lnode&&lnode!=document.getElementById(id))){var t=document.getElementById(id);t.parentNode.replaceChild(lnode||hookNode,t);}else{lnode=document.getElementById(id);myfile=$majax.fileUploader.newUp(lnode.firstChild);state="redraw";lnode.lastChild.onclick=function(){myfile.UpNow(function(e){state="done";document.getElementById(id).innerHTML='<div style="background:url('+e.thumb+') no-repeat;width:200px;height:200px;overflow:hidden">&nbsp;</div>';dragList=regEvent(document.getElementById(id),"dragstart",function(){return new $xml.doc("<image doctype='image' "+"src=\""+e.urifichier+"\" thumb=\""+e.thumb+"\" label=\""+e.label+"\" />");});});};}},"draw":function(){if(lnode)document.body.appendChild(hookNode=lnode);lnode=0;return'<div id="'+id+'"><span style="float:left"></span><button style="float:left">Send</button></div>';},"toString":function(){return value;}};};models["$css"]=function(){var
value="<!--css-->";var lrtrimRE=new RegExp("^[\\n|\\r|\\s]+");var parseRules=function(text){var r=[],tamp=text.replace(new RegExp("\\/\\*.*\\*\\/"),""),i,itamp;while((i=tamp.indexOf('{'))!=-1){itamp={};itamp.selector=tamp.substring(0,i).replace(lrtrimRE,"");tamp=tamp.substring(i+1);if((i=tamp.indexOf('}'))==-1)throw new bugtales("bad css text");itamp.styles=tamp.substring(0,i);tamp=tamp.substring(i+1);r.push(itamp);}
return r;};var addStyleSheetWithSrc=function(src){var styleTag=document.createElement('link');styleTag.setAttribute('rel','stylesheet');styleTag.setAttribute('type','text/css');styleTag.setAttribute('media','screen');styleTag.setAttribute('href',src);document.getElementsByTagName('HEAD').item(0).appendChild(styleTag);};var addStyleSheet=function(styles){var styleTag=document.createElement('style');styleTag.setAttribute('type','text/css');styleTag.setAttribute('media','screen');if(document.all&&!window.opera){styleTag.styleSheet.cssText=styles;}
else{styleTag.appendChild(document.createTextNode(styles));}
document.getElementsByTagName('HEAD').item(0).appendChild(styleTag);};var pub,tests,l,innerText="",here={"listen":function(event,c,datas){if(tests.on.test(event)){try{var db=pub.µ$o.context.db,here=pub.parentNode().getMajaxNode();(eval("(function(){"+$xml.getInnerXML(pub.µ$o.origin).unHTMLents()+"})()"));}catch(err){console.dir([{"trigger fail ":event,'here':[here],'src':[$xml.getInnerXML(pub.µ$o.origin)],"e":err}]);}}}};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;var src;if(src=$xml.getAttr(this.µ$o.origin,"src"))
addStyleSheetWithSrc(src);innerText=$xml.getInnerXML(pub.µ$o.origin);addStyleSheet(innerText);},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return value;}};};models["$trigger"]=function(){var
value="<!--trigger-->";var pub,tests,l,here={"listen":function(event,c,datas){var µnode=pub.NamedParentNode().getµNode();if(tests.on.test(event)){try{var db=pub.µ$o.context.db,here=pub.parentNode().getMajaxNode(),µ=pub.parentNode().NamedParentNode().µ;(eval("(function(){"+$xml.getInnerXML(pub.µ$o.origin).unHTMLents()+"}).apply(µ('.'),arguments)"));}catch(err){console.dir([{"trigger fail ":event,'here':[here],'src':[$xml.getInnerXML(pub.µ$o.origin)],"e":err}]);}}}};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;tests={'on':$xml.getAttr(this.µ$o.origin,"when"),'off':$xml.getAttr(this.µ$o.origin,"sleep"),'fire':$xml.getAttr(this.µ$o.origin,"wakeup")};for(var o in tests)
tests[o]=(tests[o]!="")?new RegExp("(^"+tests[o].replace(/\./g,"\\.").replace(/\*/g,"\\w+").replace(/\ *\,\ */g,")|(")+")"):{'test':function(t){return false;}};if(l&&l.free())l.free();l=this.µ$o.context.addListener(here);},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return value;}};};models["$event"]=function(){var
value="<!--event-->";var root,here={},pub,evt;return pub={"init":function(){pub=this;this.µ$o.__wsync=0;},"connectEvent":function(){if(root=this.parentNode().getHtmlNode()){var $$$local=this;if(evt&&evt.free)evt.free();evt=regEvent(root,$xml.getAttr(this.µ$o.origin,"id").replace(/^on/,''),function(e){if(!e){if(window.event)e=window.event;else e={};}
var keyCode=0;try{keyCode=e.keyCode;}catch(e){try{keyCode=e.which;}catch(e2){}}
var propagEvent=true;var db=$$$local.µ$o.context.db,here=$$$local.parentNode().getMajaxNode(),$return=0,µ=$$$local.NamedParentNode().µ;try{(eval("$return = (function(){"+$xml.getInnerXML($$$local.µ$o.origin).unHTMLents()+"})()"));}catch(err){console.dir([{"event fail ":$xml.getAttr(pub.µ$o.origin,"id"),'here':[here],'src':[$xml.getInnerXML(pub.µ$o.origin)],"err":err,"e":e}]);}
if(!propagEvent){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault();return false;}
return $return;},false);}},"draw":function(){return"";},"toString":function(){return value;}};};models["$function"]=function(){var
value="<!--function-->";var pub,here={};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;},"buildMajaxPath":function(){var tmp={};var $$$local=this;var µnode=this.NamedParentNode().getµNode();var db=$$$local.µ$o.context.db,here=$$$local.NamedParentNode().getMajaxNode(),µ=$$$local.NamedParentNode().µ;var myfunc;(eval("myfunc=function("+$xml.getAttr($$$local.µ$o.origin,"param")+"){"+$xml.getInnerXML($$$local.µ$o.origin).unHTMLents()+"};"));µnode[$xml.getAttr(this.µ$o.origin,"id")]=tmp[$xml.getAttr(this.µ$o.origin,"id")]=function(){try{myfunc.apply(µ('.'),arguments);}catch(err){console.dir([{"function fail ":$xml.getAttr(pub.µ$o.origin,"id"),'here':[here],'src':[$xml.getInnerXML(pub.µ$o.origin)],"e":err}]);}};return tmp;},"draw":function(){return value;},"toString":function(){return value;}};};models["$sync"]=function(){var
lvar=0,oparam="",use="text",lastvar=0,docUser="operator",id="sync_"+getUniqueId(),evt=false,root,origin=0,empty=true,lvar_list=0,needToCreate=false;var $d=false;var edit=function(){};var killedit=function(){};var saveedit=function(){};var ckeditor;var pub,here={"listen":function(evt,c,d){if(evt==="undefined"){needToCreate=true;if(pub.setWriterKeys)pub.setWriterKeys(lvar.getOwner());pub.resize();pub.redraw();return;}else if(evt!="change")return;needToCreate=false;if($d&&d==lastvar)return;if($d)
if(!/^tamp\:\/\/.*/.test(d.src())&&!confirm("Sauveguarder en local les changements?")){killedit();}else{saveedit();killedit();}
lastvar=d;if(pub.setWriterKeys)pub.setWriterKeys(lvar.getOwner());empty=false;pub.resize();pub.redraw();}};var start_edit=function edit(){var edit,nod=pub.getHtmlNode();switch(use){case'html':killedit=function(){if($xml.getAttr(pub.µ$o.origin,"$d")=="true")return;ckeditor.destroy();$d=false;ckeditor=0;};saveedit=function(evt){if(!$d)return;lastvar.setText(".",ckeditor.getData());};edit=function(){$d=true;CKEDITOR.plugins.registered['save']={init:function(editor)
{var command=editor.addCommand('save',{modes:{wysiwyg:1,source:1},exec:function(editor){try{editor.fire('save',editor.getData());}catch(e){alert(':o'+e);}}});editor.ui.addButton('Save',{label:'Sauveguarder',command:'save'});}};nod.innerHTML="";nod.style.overflow="hidden";ckeditor=CKEDITOR.appendTo(nod,{on:{'instanceReady':function(evt){ckeditor.config.height=pub.getHtmlNode().offsetHeight;ckeditor.resize(pub.getHtmlNode().offsetWidth-10,pub.getHtmlNode().offsetHeight,false,false);}}});ckeditor.setData(lvar.getText('.'));var cksave=function(evt)
{ckeditor.destroy();ckeditor=null;pub.redraw();};ckeditor.on('save',function(evt)
{setTimeout(function(){saveedit(evt);killedit();pub.redraw();},1);});};break;case'text':break;case'xml':break;case'inline-html':break;case'inline-text':var enod=document.createElement("span");killedit=function(){if(!$d)return;if($xml.getAttr(pub.µ$o.origin,"$d")=="true")return;$d=false;root.parentNode.replaceChild(nod,root);nod.innerHTML=root.value;root=nod;};saveedit=function(){if(!$d)return;lastvar.setText(".",root.value);};edit=function(){$d=true;enod.innerHTML="<input type='text' value=\"\" style=\""+pub.getCurrentStyle()+"\"/>";enod.firstChild.value=nod.innerHTML;with(enod.firstChild.style){background="transparent";textAlign=getComputedStyle(nod,null).getPropertyValue("text-align");fontSize=getComputedStyle(nod,null).getPropertyValue("font-size");fontWeight=getComputedStyle(nod,null).getPropertyValue("font-weight");};enod.firstChild.id=id;root=enod.firstChild;nod.parentNode.replaceChild(enod.firstChild,nod);pub.applyCSS();regEvent(root,"mousedown",function(e){this.focus();if(e.preventDefault)e.preventDefault();e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;});regEvent(root,"click",function(e){if(!e)if(window.event)e=window.event;if(e.preventDefault)e.preventDefault();e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;},false);root.onkeypress=function(e){if(!e)if(window.event)e=window.event;if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;if(keyCode==13){saveedit();killedit();}else if(keyCode==27){killedit();}
e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();};};break;default:};if(edit)edit();};var passnod=0,passdta,directshow=false,rswitch;return pub={"init":function(){pub=this;this.addAspect("majax_styleUnit");this.µ$o.__wsync=0;if($xml.getAttr(this.µ$o.origin,"$d")=="true")directshow=true;if($xml.getAttr(this.µ$o.origin,"use"))
use=$xml.getAttr(this.µ$o.origin,"use");var select=$xml.getAttr(this.µ$o.origin,"select");var ovar=select.replace(/^(.*\..*)(?:\(.*\))$/,"$1");oparam=(/^.*\..*\(.*\)$/.test(select))?select.replace(/^.*\..*(?:\((.*)\))$/,"$1"):"";origin=this.µ$o.context.db.get(ovar);if(/^xml\./.test(ovar)&&oparam!=""){lvar=this.µ$o.context.db.vars.µxv("","",this.µ$o.context.db);lvar.setDb(this.µ$o.context.db);lvar.$sfs(select);}else if(/^xml\./.test(select)&&oparam==""){lvar=this.µ$o.context.db.get(select);}
if(lvar_list)lvar_list.free();lvar_list=lvar.addListener(here,true);if(is_defined(this.µ$o.origin)&&$xml.getAttr(this.µ$o.origin,'id')!=""){this.MajaxReg($xml.getAttr(this.µ$o.origin,'id'),this);}
pub.addMajaxMethods({"save":function(){if($d)saveedit();},"getValue":function(){}});},"getHtmlNode":function(){return document.getElementById(id);},"free":function(){if($d)
if(!/^tamp\:\/\/.*/.test(origin.src())&&confirm("Sauver "+lvar.src()+" ?"))saveedit();else killedit();},"getNodeID":function(){return id;},"listActs":function(){return{"acts":[{"html":"<img src='medias/icon/write.png'/>","label":"Editer !","dothat":function(){$majax.loadScript("scripts/ckeditor/ckeditor.js",start_edit);}},{"html":"$","label":"Changer type !","dothat":function(){}},{"html":"$","label":"Supprimer !","dothat":function(){}}],"merge":function(){},"color":'blue',"getDom":function(){var tmp=document.createElement('div'),tmp2;for(var o=0;o<this.acts.length;o++){tmp.appendChild(tmp2=document.createElement('span'));tmp2.innerHTML=this.acts[o].html;tmp2.onclick=this.acts[o].dothat;tmp2.title=this.acts[o].label;}
tmp.appendChild(tmp2=document.createTextNode("Doc :"+lvar.src()+"("+oparam+")"));return tmp;}};},"resize":function(){if(ckeditor){ckeditor.config.height=pub.getHtmlNode().offsetHeight;try{ckeditor.resize(pub.getHtmlNode().offsetWidth-10,pub.getHtmlNode().offsetHeight,false,false);}catch(e){}}else if($d){if(rswitch=!rswitch)pub.applyCSS();}},"setWriterKeys":function(u){docUser=u;pub.connectEvent();},"connectEvent":function(){if(passnod){pub.getHtmlNode().parentNode.replaceChild(passnod,pub.getHtmlNode());if(ckeditor)ckeditor.setData(passdta);passnod=0;}
var $$$local=this;try{if(docUser==$session.xml.getText("./login")){if(evt&&evt.free)evt.free();evt=regEvent(this.getHtmlNode(),"contextmenu",function(e){if(!e)if(window.event)e=window.event;else e={};if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;if(!$d){$d=true;$majax.loadScript("scripts/ckeditor/ckeditor.js",start_edit);e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault();}else return true;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;},false);}else if(evt&&evt.free)evt.free();}catch(e){}
try{if(directshow&&pub.getHtmlNode()){directshow=false;$majax.loadScript("scripts/ckeditor/ckeditor.js",start_edit);}}catch(e){alerts.msg(pub.getHtmlNode()+""+e);}},"draw":function(){if($d){passnod=pub.getHtmlNode();if(ckeditor)passdta=ckeditor.getData();}
root=0;var val="";try{var tmp="<span id=\""+id+"\" style=\""+this.getCurrentStyle()+"\">";if(lvar){if((needToCreate||/^\s*$/.test(lvar.getText(".")))&&docUser==$session.xml.getText("./login"))
val+="Empty... Right click to edit !";else val+=lvar.getText(".")+"";if(use.indexOf("nbsp")!=-1)val=val.replace(" ","&nbsp;")+" ";tmp+=val;}else tmp+="&nbsp;";tmp+="</span>";return tmp;}catch(e){return"<span id=\""+id+"\" style=\""+this.getCurrentStyle()+"\">"+e+"&nbsp;</span>";}},"redraw":function(){var nd,val="";if(!(nd=this.getHtmlNode()))return false;if(lvar){if((needToCreate||/^\s*$/.test(lvar.getText(".")))&&docUser==$session.xml.getText("./login"))
val="Empty... Right click to edit !";else val=lvar.getText(".")+"";if(use.indexOf("nbsp")!=-1)val=val.replace(" ","&nbsp;")+" ";nd.innerHTML=val;}else nd.innerHTML="&nbsp;";this.applyCSS();},"toString":function(){return value;}};};models["$value-of"]=function(){var
evar=0,id="valueof_"+getUniqueId();var pub,here={"listen":function(evt,c,d){if(evt!="change")return;pub.redraw();}};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;this.µ$o.tagName="span";$xml.getAttr(this.µ$o.origin,"select")
evar=this.µ$o.context.db.vars.mkEVar($xml.getAttr(this.µ$o.origin,"select"),this.µ$o.context.db);evar.addListener(here);},"getHtmlNode":function(){return(document.getElementById(id));},"draw":function(){var tmp="<span id=\""+id+"\" style=\""+this.µ$o.style+"\">";tmp+=evar+" ";tmp+="</span>";return tmp;},"redraw":function(){var nd;if(!(nd=this.getHtmlNode()))return false;nd.innerHTML=evar+"";},"toString":function(){return value;}};};models["$each"]=function(){var
value="[each]",local_id="";ovar="",oparam="",originvar=0,instvar=0,selvar=0,src="",list=0;var wpath="";var pub,here={"listen":function(evt,c,d){if(evt!="change")return;var $kt,µ$c,cchild=0;for(var o=0;o<d.length;o++){if(pub.childs[cchild]){if(pub.childs[cchild].µ$o.context.db.get(instvar).select('.')[0]===d.get(o).select('.')[0]){pub.childs[cchild].wakeUp();cchild++;pub.childs[cchild-1].applyCSS();continue;}
pub.childs[cchild].µ$o.context.db.set(instvar,d.get(o));pub.childs[cchild].wakeUp();cchild++;}else{pub.appendChild($kt=new majax_node({"use":["majax_htmlNode","majax_events","majax_widget"],"openNode":true,"parent":pub,"baseNode":pub.µ$o.origin,"tagName":"div","baseMod":(new $xml.doc()).load(wpath),"context":µ$c=new µ$µ(),"parent_context":pub.µ$o.context}));µ$c.db.include(pub.µ$o.context.db);µ$c.db.set(instvar,d.get(o));$kt.pushTask(function(){this.µs();});if(is_defined(pub.µ$o.origin)&&(local_id=$xml.getAttr(pub.µ$o.origin,'id'))!=""){$kt.MajaxReg(local_id+"_"+cchild);}else $kt.MajaxReg(pub.id+"_"+cchild);$kt.$pt();cchild++;}
pub.childs[cchild-1].applyCSS();}
while(cchild!=pub.childs.length){pub.childs[cchild].disable();cchild++;}
var nod=pub;while(nod=nod.parentNode())
if(nod.redraw)
break;if(!nod||nod==this)return false;nod.redraw();pub.µ$e(function µ$e(){if(this.connectEvent)
this.connectEvent();return true;},function implode(){if(this.haz("majax_widget")){this.µ$o.context.init();}
return true;});}};var root;var drawwidget=function(){};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;instvar=$xml.getAttr(this.µ$o.origin,"as");var db=pub.µ$o.context.db;var evar=$xml.getAttr(this.µ$o.origin,"select");ovar=evar.replace(/^([^\(\.]*\.[^\(\.]*)(?:\(.*\))$/,"$1");oparam=(/^.*\..*\(.*\)$/.test(evar))?evar.replace(/^.*\..*(?:\((.*)\))$/,"$1"):"";originvar=db.get(ovar);var lvar=0;if(/^xml\./.test(ovar)&&oparam!=""){selvar=db.get(ovar).createSelection(oparam);}else if(/^xml\./.test(ovar)&&oparam==""){selvar=db.get(ovar);}else if(/^rss\./.test(ovar)&&oparam==""){selvar=db.get(ovar);}
wpath=$xml.wreg(this.µ$o.cwidget.mkFragment(this.µ$o.origin),"tamp://each_"+getUniqueId());list=selvar.addListener(here);},"free":function(){if(list&&list.free)list.free();},"getHtmlNode":function(){var nod=pub;while(nod=nod.parentNode())
if(nod.getHtmlNode)
break;if(!nod||nod==this)return false;return(nod.getHtmlNode());},"draw":function(){root=false;var tmp="";each(this.childs,function(c){tmp+=c.draw();});tmp+="";return tmp;},"setCurNode":function(){},"listActs":function(){return{"acts":[{"html":"$","label":"Editer !","dothat":function(){alert('edit');}},{"html":"$","label":"Changer de mod !","dothat":function(){}},{"html":"$","label":"Supprimer !","dothat":function(){}}],"merge":function(){},"color":'red',"getDom":function(){var tmp=document.createElement('div'),tmp2;tmp.innerHTML="Each ";for(var o=0;o<this.acts.length;o++){tmp.appendChild(tmp2=document.createElement('span'));tmp2.innerHTML=this.acts[o].html;tmp2.onclick=this.acts[o].dothat;tmp2.title=this.acts[o].label;}
return tmp;}};},"toString":function(){return"[xmltemplate]";}};};models["$when"]=function(){var
value="[when]",widget=[],src="",widget=0,ovar="",oparam="",wlist;var drawwidget=function(){};var pub,here={"listen":function(evt,c,d){if(evt!="change")return;if(d.test(oparam)){if(!widget){pub.appendChild(widget=new majax_node({"use":["majax_htmlNode","majax_events","majax_widget"],"openNode":true,"parent":pub,"tagName":"div","origin":pub.µ$o.origin,"baseMod":pub.µ$o.cwidget.mkFragment(pub.µ$o.origin),"style":$xml.getAttr(pub.µ$o.origin,"style"),"context":µ$c=new µ$µ(),"parent_context":pub.µ$o.context}));widget.pushTask(function(){this.µs();});widget.pushTask(function(){this.µ$o.context.wakeup();µ$c.db.include(pub.µ$o.context.db);});widget.$pt();}else{widget.wakeUp();}}else if(widget)widget.disable();}};return pub={"init":function(){pub=this;this.µ$o.__wsync=0;try{var evar=$xml.getAttr(this.µ$o.origin,"test");ovar=evar.replace(/^([^\(\.]*\.[^\(\.]*)(?:\(.*\))$/,"$1");oparam=(/^[^\(\.]*\.[^\(]*\(.*\)$/.test(evar))?evar.replace(/^[^\(\.]*\.[^\(\.]*(?:\((.*)\))$/,"$1"):"";if(wlist)wlist.free();wlist=this.µ$o.context.db.get(ovar).addListener(here);}catch(e){alerts.msg(e);}},"draw":function(){root=false;var tmp="";each(this.childs,function(c){tmp+=c.draw();});tmp+="";return tmp;},"toString":function(){return"[xmltemplate]";}};};models["$title"]=function(){var
value="<!--title-->";var pub,here={};return pub={"init":function(){this.µ$o.__wsync=0;},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return value;}};};models["$description"]=function(){var
value="<!--description-->";var pub,here={};return pub={"init":function(){this.µ$o.__wsync=0;},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return value;}};};models["$keywords"]=function(){var
value="<!--keywords-->";var pub,here={};return pub={"init":function(){this.µ$o.__wsync=0;},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return value;}};};models["$popup"]=function(){var
value="<!--xmltemplate-->";var pub,here={},root=document.createElement('div');return pub={"init":function(){this.addAspect("majax_styleUnit");root_node.appendChild(root);this.applyCSS();},"free":function(){if(root&&root.parentNode)root.parentNode.removeChild(root);},"setCurNode":function(){},"getHtmlNode":function(){return root;},"redraw":function(){if(!this.getHtmlNode())return false;var tmp="";each(this.childs,function(c){tmp+=c.draw();});this.getHtmlNode().innerHTML=tmp;this.applyCSS();this.buildMajaxPath();if(this.haz("majax_widget")){this.µ$e(function µ$e(){if(this.connectEvent)
this.connectEvent();return true;},function implode(){if(this.haz("majax_widget")){this.µ$o.context.init();}
return true;});if(this.connectEvent)
this.connectEvent();pub.µ$o.context.init();}
return tmp;},"draw":function(){root_node.appendChild(root);tmp="";each(this.childs,function(c){tmp+=c.draw();});root.innerHTML=tmp;this.applyCSS();return"<!--popup-->";},"toString":function(){return value;}};};var imgLib={};models["$img"]=function(){var
value="<!--img-->",id="img_"+getUniqueId(),pub,src=0,root,evt,slist,lsrc="medias/loading4.gif";var autosize=function(img){var w=img.img.width;var h=img.img.height;if($xml.getAttr(pub.µ$o.origin,"autosize")&&$xml.getAttr(pub.µ$o.origin,"autosize").indexOf("screen")!=-1){w=w*((document.body.offsetHeight-30)/h);h=document.body.offsetHeight-30;if(w>document.body.offsetWidth){h=img.img.height*((document.body.offsetWidth-30)/img.img.width);w=document.body.offsetWidth-30;}
pub.setCustomCSS("width:"+w+"px;height:"+h+"px");}
if(pub.getHtmlNode())pub.getHtmlNode().src=lsrc=img.src+"";else lsrc=img.src+"";};var here={"listen":function(evt,c,d){if(evt!="change")return;if(!imgLib[src+'']){var msrc=src+'';lsrc="medias/loading4.gif";if (pub.getHtmlNode())pub.getHtmlNode().src = lsrc;imgLib[msrc]={'img':new Image(),'src':msrc,'listeners':[function(){autosize(imgLib[msrc]);pub.applyCSS();}]};imgLib[msrc].img.onload=function(){imgLib[msrc].done=true;for(var o=0;o<imgLib[msrc].listeners.length;o++)
imgLib[msrc].listeners[o]();};imgLib[msrc].img.src=msrc;}else if(!imgLib[src+''].done)
imgLib[src+''].listeners.push(function(){autosize(imgLib[src+'']);pub.applyCSS();});else{autosize(imgLib[src+'']);pub.applyCSS();}}};return pub={"init":function(){pub=this;this.addAspect("majax_styleUnit");this.addMajaxMethods({"setSrc":function(s){if(slist)src.set(s);else{src=pub.µ$o.context.db.vars.mkEVar(src,pub.µ$o.context.db);slist=src.addListener(here);}}});if(this.µ$o.imgSrc){}else if(/\{[^\}]+\}/.test($xml.getAttr(this.µ$o.origin,"src"))){src=this.µ$o.context.db.vars.mkEVar($xml.getAttr(this.µ$o.origin,"src"),this.µ$o.context.db);slist=src.addListener(here);}else{src=$xml.getAttr(this.µ$o.origin,"src");if(!imgLib[src+'']){imgLib[src+'']={'img':new Image(),'src':src+'','listeners':[function(){autosize(imgLib[src+'']);pub.applyCSS();}]};imgLib[src+''].img.onload=function(){imgLib[src+''].done=true;for(var o=0;o<imgLib[src+''].listeners.length;o++)
imgLib[src+''].listeners[o]();};imgLib[src].img.src=src+'';}else if(!imgLib[src+''].done)imgLib[src].listeners.push(function(){autosize(imgLib[src+'']);pub.applyCSS();});else{autosize(imgLib[src+'']);pub.applyCSS();}}
if(is_defined(this.µ$o.origin)&&$xml.getAttr(this.µ$o.origin,'id')!=""){this.MajaxReg($xml.getAttr(this.µ$o.origin,'id'),this);}},"setCurNode":function(){},"draw":function(){root=false;tmp="<img id=\""+id+"\" src=\""+lsrc+"\" style=\""+this.getCurrentStyle()+"\" ";if(is_defined(this.µ$o.origin))
for(var i=0;i<this.µ$o.origin.attributes.length;i++)
if(!/^(db|sync|majax)/.test(this.µ$o.origin.attributes[i].prefix)&&!/(id|style|src|autosize)/.test(this.µ$o.origin.attributes[i].nodeName))
tmp+=" "+this.µ$o.origin.attributes[i].nodeName+"=\""+this.µ$o.origin.attributes[i].nodeValue+"\"";return tmp+"/>";},"getNodeID":function(){return id;},"connectEvent":function(){if(root=this.getHtmlNode()){if(evt&&evt.free)evt.free();evt=regEvent(root,"mousedown",function(e){if(!e)if(window.event)e=window.event;else e={};if(e.preventDefault)e.preventDefault();},false);}},"getNodeID":function(){return id;},"getHtmlNode":function(){return(document.getElementById(id));},"toString":function(){return value;}};};var majax_writer_uno=0;var $editor=new(function(){this.enableDocView=function(){};this.disableDocView=function(){};this.enableModView=function(){};this.disableModView=function(){};this.enableTouchView=function(){};this.disableTouchView=function(){};})();models["majax_writer"]=function(){var enabled=true,m,pub,evt=false,root,acts=[],list,docUser="operator";var mkCadre=function(p,color,tnod){tnod.style.position='absolute';tnod.style.top=p.y;tnod.style.left=p.x;tnod.innerHTML='\
    <div style="overflow:hidden;line-height:0;position:absolute;width:'+p.w+';height:2;left:0;top:0;background:'+color+'"></div>\
    <div style="overflow:hidden;line-height:0;position:absolute;width:'+p.w+';height:2;left:0;top:'+(p.h)+';background:'+color+'"></div>\
    <div style="position:absolute;width:2;height:'+(p.h)+';left:0;top:0;background:'+color+'"></div>\
    <div style="position:absolute;width:2;height:'+p.h+';left:'+(p.w)+';top:0;background:'+color+'"></div>\
    ';};var selNod=0;return{"init":function(){pub=this;if(list)list.free();list=$session.xml.addListener({"listen":function(e,c,d){pub.setWriterKeys(docUser);}});},"free":function(){if(list.free)list.free();if(evt&&evt.free)evt.free();},"setWriterKeys":function(u){},"connectEvent":function(){if(this.getHtmlNode()){if(docUser==$session.xml.getText("./login")){var $$$local=this;if(evt&&evt.free)evt.free();evt=regEvent(this.getHtmlNode(),"contextmenu",function(e){if(!e)if(window.event)e=window.event;else e={};if(e.keyCode)keyCode=e.keyCode;else if(e.which)keyCode=e.which;pub.ActivateEditor(true);e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;},false);}else if(evt&&evt.free)evt.free();}},"disableEditor":function(scroll){if(majax_writer_uno==pub){majax_writer_uno=0;if(selNod&&selNod.parentNode)selNod.parentNode.removeChild(selNod);}},"ActivateEditor":function(scroll){if(docUser!=$session.xml.getText("./login"))return;if(majax_writer_uno)
majax_writer_uno.disableEditor();majax_writer_uno=pub;var nod;if(!(nod=this.getHtmlNode()))return false;var p=$majax.GlobalPosOf(nod,0,true);var tnod=document.createElement('div');selNod=tnod;var acts=pub.listActs();mkCadre(p,acts.color,tnod);tnod.appendChild(acts.getDom());document.body.appendChild(tnod);}};};models["majax_sync"]=function(){var enabled=true,m,pub,evt,evt2,evt3,evt4,root,acts={},docUser="operator",canBeDrag="yes";var type=0,innertype=0,node=0;var selNod=0;var accept=0;var abilities={"parentNode":{"append":{'label':"Append",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(node.select("@doctype").length)
accept=node.select("@doctype")[0].nodeValue;else accept=false;if(e.dragValue.type!="xmldoc"||(accept&&accept.indexOf(e.dragValue.select("@doctype")[0].nodeValue)==-1))return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;return true;},'act':function(e){if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();var n=node.select(".")[0],impn;n.appendChild((impn=e.dragValue.select(".")[0]).cloneNode(true));impn.parentNode.removeChild(impn);e.dragValue.remove();e.dragValue.pokeOrigin();node.pokeOrigin();}},"ref":{'label':"Réferencer",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.type!="xmldoc"||!e.dragValue.select("@doctype")[0])return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;return true;},'act':function(e){if(!this.test(e))return;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();node.select(".")[0].appendChild((e.dragValue.select(".")[0]).cloneNode(true));node.pokeOrigin();}}},"rssContainer":{"append":{'label':"Ajouter en premier",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.type!="xmldoc"||!e.dragValue.select("@doctype")[0]||e.dragValue.select("@doctype")[0].nodeValue!="rss.item")return false;return true;},'act':function(e){if(!this.test(e))return;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();node.push(e.dragValue);e.dragValue.remove();}}},"childNode":{"insertBefore":{'label':"Inserer avant",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(node.select("@doctype").length)
accept=node.select("@doctype")[0].nodeValue;else accept=false;if(e.dragValue.type!="xmldoc"||(accept&&accept.indexOf(e.dragValue.select("@doctype")[0].nodeValue)==-1))return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;var ppos=(e.ry/e.dropDim.h)*100;if(ppos<50)return true;return false;},'act':function(e){if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.select(".")[0]==node.select(".")[0])return;var n=node.select(".")[0],impn;n.parentNode.insertBefore((impn=e.dragValue.select(".")[0]).cloneNode(true),n);impn.parentNode.removeChild(impn);e.dragValue.remove();e.dragValue.pokeOrigin();node.pokeOrigin();}},"insertAfter":{'label':"Inserer aprés",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(node.select("@doctype").length)
accept=node.select("@doctype")[0].nodeValue;else accept=false;if(e.dragValue.type!="xmldoc"||(accept&&accept.indexOf(e.dragValue.select("@doctype")[0].nodeValue)==-1))return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;var ppos=(e.ry/e.dropDim.h)*100;if(ppos>50)return true;return false;},'act':function(e){if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.select(".")[0]==node.select(".")[0])return;var n=node.select(".")[0],impn;insertAfter(n.parentNode,(impn=e.dragValue.select(".")[0]).cloneNode(true),n);impn.parentNode.removeChild(impn);node.pokeOrigin();e.dragValue.pokeOrigin();}}},"rssItem":{"insertBefore":{'label':"Inserer avant",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.type!="xmldoc"||!e.dragValue.select("@doctype")[0]||e.dragValue.select("@doctype")[0].nodeValue!="rss.item")return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;var ppos=(e.ry/e.dropDim.h)*100;if(ppos<50)return true;return false;},'act':function(e){if(!this.test(e))return;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();node.getOrigin().insertBefore(node,e.dragValue);e.dragValue.remove();}},"insertAfter":{'label':"Inserer aprés",'icon':"",'test':function(e){if(!e.dragValue)return false;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();if(e.dragValue.type!="xmldoc"||!e.dragValue.select("@doctype")[0]||e.dragValue.select("@doctype")[0].nodeValue!="rss.item")return false;if(e.dragValue.select(".")[0]==node.select(".")[0])return false;var ppos=(e.ry/e.dropDim.h)*100;if(ppos>50)return true;return false;},'act':function(e){if(!this.test(e))return;if(e.dragValue.type=="varbox")e.dragValue=e.dragValue.getVal();if(e.dragValue.type=="xmlvar")e.dragValue=e.dragValue.getVal();node.getOrigin().insertAfter(node,e.dragValue);e.dragValue.remove();}}}};return{"init":function(){pub=this;this.µ$o.context.mkSema("init").whenDone(function(){});if(!this.µ$o.dropActs)
this.µ$o.dropActs=[];$session.xml.addListener({"listen":function(e,c,d){pub.connectEvent();}});},"free":function(){if(evt&&evt.free)evt.free();if(evt2&&evt2.free)evt2.free();if(evt3&&evt3.free)evt3.free();if(evt4&&evt4.free)evt4.free();},"connectEvent":function(){if(this.getHtmlNode()){if(docUser==$session.xml.getText("./login")){var $$$local=this;if(evt&&evt.free)evt.free();if(canBeDrag=="yes")evt=regEvent(this.getHtmlNode(),"dragstart",function(e){return node;});if(evt2&&evt2.free)evt2.free();evt2=regEvent(this.getHtmlNode(),"dragover",function(e){for(var o in acts)
if(acts[o].test(e))
return[acts[o]];return[];});if(evt3&&evt3.free)evt3.free();evt3=regEvent(this.getHtmlNode(),"dragend",function(e){});if(evt4&&evt4.free)evt4.free();evt4=regEvent(this.getHtmlNode(),"drop",function(e){for(var o in acts)
if(acts[o].test(e))
return acts[o].act(e);});}else if(evt&&evt.free)evt.free();}},"setSyncNode":function(evar,ctx){var ovar=evar.replace(/^([^\(\.]*\.[^\(\.]*)(?:\(.*\))$/,"$1");var oparam=(/^.*\..*\(.*\)$/.test(evar))?evar.replace(/^.*\..*(?:\((.*)\))$/,"$1"):"";var origin=ctx.db.get(ovar);if(/^xml\./.test(ovar)&&oparam!=""){node=ctx.db.get(ovar).createSelection(oparam);}else if(/^xml\./.test(ovar)&&oparam==""){node=ctx.db.get(ovar);}else if(/^rss\./.test(ovar)&&oparam==""){node=ctx.db.get(ovar);}
node.addListener({"listen":function(e,c,d){docUser=origin.getOwner();pub.connectEvent();}});},"canBeDrag":function(t){canBeDrag=t;},"setAbilities":function(t){var ab=t.split(',');acts={};for(var i=0;i<ab.length;i++){if(abilities[ab[i].lrtrim()])
for(var o in abilities[ab[i].lrtrim()])
acts[o]=abilities[ab[i].lrtrim()][o];else alert("unknow abilitie : "+ab[i].lrtrim());}
pub.connectEvent();},"setActs":function(a){type=t;},"setSyncInnertype":function(it){innertype=it;}};};models["majax_events"]=function(){var µes=[];var EvtLog={};var enabled=true;var emiting=false;var µnbl=0,µfl=[],µse={},listener=[],semas={};return{"mkSema":function(evt){var s=new(function(){var whenDone=[],done=false;this.listen=function(e){if(e==evt){done=true;this.list.free();while(whenDone.length)
(whenDone.shift())();}};this.whenDone=function(f){if(done)f();else whenDone.push(f);};})();s.list=this.addListener(s);return s;},"importListener":function(i){var lid=(µfl.length!=0)?µfl.pop():µnbl++;listener[lid]=i;listener[lid].id=lid;listener[lid].free=function(){µfl.push(this.id);listener[this.id]=0;};},"purge":function(){return listener;},"addListener":function(l,dnd){if(!dnd){var here;}
var lid=(µfl.length!=0)?µfl.pop():µnbl++;setTimeout(function(){for(var evt in µse)l.listen(µse[evt][0],µse[evt][1],µse[evt][2],µse[evt][3]);},1);listener[lid]={'id':lid,'obj':l,"free":function(){µfl.push(this.id);listener[this.id]=0;}};return listener[lid];},"listen":function(evt,c,datas,µem){this.propag(evt,c,datas,µem);},"propag":function(evt,c,datas,µem){if(!/^\!.*/.test(evt))µse[evt]=[evt,c,datas,(µem)?µem:this];each(listener,function(o){if(o)o.obj.listen(evt,c,datas,(µem)?µem:this);});}};};models["majax_styleUnit"]=function(){var enabled=true;var curstyle="",cevar="",dvar="",pub,lists=[];var curdim={'width':0,'height':0,'top':0,'left':0,'bottom':0,'right':0,'outerwidth':0,'outerheight':0};var cdic={},css={},custcss={},css2={},fstyle="",needresize=false;;var drawStep=0;var show=function(){curstyle=cevar+";"+dvar+";";for(var s in custcss)curstyle+=s+":"+custcss[s]+";";var tmpcss={};cdic.display=function(n,css){css.display=n;needresize=true;};cdic.yalign=function(n,css){css.position='absolute';needresize=true;if(pub.getHtmlNode()){css.top=((pub.getHtmlNode().parentNode.offsetHeight-pub.getHtmlNode().offsetHeight)/2)+"px";}};cdic.xalign=function(n,css){css.position='absolute';needresize=true;if(pub.getHtmlNode()){css.left=((pub.getHtmlNode().parentNode.offsetWidth-pub.getHtmlNode().offsetWidth)/2)+"px";}};if($nav.type=="ie"){var h={top:false,bottom:false};cdic.bottom=function(v,css){if(!h.top){css.bottom=v;h.bottom=true;delete(css.top);return;}
if(pub.getHtmlNode())
css.height=(pub.getHtmlNode().parentNode.offsetHeight-parseInt(v)-parseInt(css.top))+"px";};cdic.top=function(v,css){if(!h.bottom){css.top=v;h.top=true;delete(css.bottom);return;}
if(pub.getHtmlNode())css.height=(pub.getHtmlNode().parentNode.offsetHeight-parseInt(css.bottom)-parseInt(v))+"px";};var w={left:false,right:false};cdic.left=function(v,css){if(!w.right){css.left=v;w.left=true;delete(css.right);return;}
if(pub.getHtmlNode())css.width=(pub.getHtmlNode().parentNode.offsetWidth-parseInt(css.right)-parseInt(v))+"px";delete(css.left);};cdic.right=function(v,css){if(!w.left){css.right=v;w.right=true;delete(css.left);return;}
if(pub.getHtmlNode())
css.width=(pub.getHtmlNode().parentNode.offsetWidth
-parseInt(v)-parseInt(css.left))+"px";delete(css.right);};}
style=curstyle.split(";");for(var s in css)css[s]=null;for(var s=0;s<style.length;s++){if(style[s]=="")continue;style[s]=style[s].split(":");try{css[style[s][0].lrtrim()]=style[s][1];}catch(e){alerts.msg("style invalide: "+style[s][0]+"/"+style[s][1]);}}
return true;};var majme=function(){show();var tmp={};for(var s in css)
if(cdic[s]&&css[s]){try{if(css[s]){cdic[s](css[s],tmp);delete(css[s]);}}catch(e){}}
for(var s in tmp)css[s]=tmp[s];for(var s in custcss)css[s]=custcss[s];fstyle="";for(var s in css)fstyle+=s+":"+css[s]+";";if(pub.getHtmlNode()){for(var s in css){try{if(css2[s]!=css[s]){pub.getHtmlNode().style[$majax.css2js(s)]=css[s];css2[s]=css[s];}}catch(e){alerts.msg(e+" ! style invalide: "+s+":"+css[s]);}}
if(curdim.width!=pub.getHtmlNode().offsetWidth||curdim.height!=pub.getHtmlNode().offsetHeight)needresize=true;curdim.width=pub.getHtmlNode().offsetWidth;curdim.height=pub.getHtmlNode().offsetHeight;if(pub.getHtmlNode().parentNode){if(curdim.outerwidth!=pub.getHtmlNode().parentNode.offsetWidth||curdim.outerheight!=pub.getHtmlNode().parentNode.offsetWidth)needresize=true;curdim.outerwidth=pub.getHtmlNode().parentNode.offsetWidth;curdim.outerheight=pub.getHtmlNode().parentNode.offsetHeight;}}};return{"init":function(){pub=this;pub.µ$o.cssonload=false;pub.addMajaxMethods({"css":pub.setCustomCSS,"animate":function(from){var e=$fx(pub.getHtmlNode());each(from,function(v,i){e.fxAdd({type:i,from:v.from,to:v.to,step:v.step||-15,delay:v.timeout||25});});return{run:function(f){e.fxRun(f)}};}});if(this.µ$o.origin){cevar=this.µ$o.context.db.vars.mkEVar($xml.getAttr(this.µ$o.origin,"style"),this.µ$o.context.db);}else if(this.µ$o.style){cevar=this.µ$o.context.db.vars.mkEVar(this.µ$o.style,this.µ$o.context.db);}else cevar=this.µ$o.context.db.vars.mkEVar("",this.µ$o.context.db);var here=this;lists.push(cevar.addListener({"listen":function(e,c,d){if(e=="change"){majme();pub.resize();}}}));},"free":function(){while(lists[0])lists.pop().free();},"addStyle":function(s){dvar=s;var here=this;lists.push(dvar.addListener({"listen":function(e,c,d){if(e=="change")majme();}}));},"getDims":function(){return curdim;},"getCurrentStyle":function(){return fstyle;},"setCustomCSS":function(p,v){var style=p.split(";");for(var s=0;s<style.length;s++)
if(style[s]=="")continue;else{style[s]=style[s].split(":");custcss[style[s][0].lrtrim()]=style[s][1];}
pub.applyCSS();},"applyCSS":function(){majme();this.resize();},"resetStyle":function(){css2={};},"resize":function(dnp){if(pub.getHtmlNode()&&pub.getHtmlNode().parentNode&&(needresize||curdim.width!=pub.getHtmlNode().offsetWidth||curdim.outerwidth!=pub.getHtmlNode().parentNode.offsetWidth||curdim.height!=pub.getHtmlNode().offsetHeight||curdim.outerheight!=pub.getHtmlNode().parentNode.offsetHeight)){needresize=false;majme();if(!dnp)this.µ$e_ex(function µ$e(){if(this.haz("majax_styleUnit")){this.resize(true);}
return true;});var nod=this;while(nod=nod.parentNode())
if(nod.haz("majax_styleUnit"))
break;if(!nod||nod==this)return;else nod.resize(true);}}};};models["majax_callStack"]=function(){var fnStack=[],processing=false,done=false,sema=0;return{"free":function(){fnStack=[];},"pushTask":function(fn,d){fnStack.push({'f':fn,'d':d});if(done)this.$pt();},"$pt":function(){if(processing)return;else processing=true;var process,here=this;process=function(){if(!fnStack.length)return;var tmp;if(!(tmp=fnStack.shift()))return;here._______curTask=tmp.f;if(sema=here._______curTask(tmp.d)){sema.whenDone(function(){process();});return;}else process();};processing=false;done=true;process();}};};models["majax_arbo"]=function(here){var childs=[],parent=false,id=0,path={},pub,list,mxmeth={},mxmeth_pub={},µNode={};return{"init":function(){pub=this;pub.addMajaxMethods({"detach":function(){},"open":function(uri,params,open){var $kt,d=(new $xml.doc()).load(uri);var mycontext=new µ$µ();var $ret={"context":mycontext};each(params,function(v,i){mycontext.db.set(i,this);});pub.appendChild($kt=new majax_node({"use":["majax_htmlNode","majax_events","majax_widget"],"openNode":open,"parent":pub,"tagName":"div","baseMod":d,"context":mycontext}));$kt.pushTask(function(){this.µs();});$kt.pushTask(function(){$ret._=$kt.getMajaxMethods();while(this.childs.length!=0)pub.appendChild(this.childs.shift());mycontext.wakeup();});$kt.pushTask(function(){pub.redraw();});$kt.$pt();return $ret;}});},"free":function(pp){each(childs,function(c){if(c.free)c.free(true);});if(!pp){this.parentNode().removeChild(this);if(this.parentNode().redraw){this.parentNode().redraw();this.parentNode().µ$eFunc("connectEvent");}else{$root.redraw();$root.connectEvent();}}},"removeChild":function(c){var c2=[];var m=childs.length;while(m!=0){if(childs[0]!=c)childs.push(childs.shift());else{childs.shift();}
m--;}},"getµNode":function(){return µNode;},"µ":function(sel,trace){var selector=sel;if(µUtils.isDomElement(sel))
return(function(node){return{"css":function(array){each(array,function(o,i){node.style[i]=this;});return this;},"addClass":function(c){if(node.className.indexOf(c)==-1)
node.className+=c;return this;},"animate":function(array){var e=$fx(node);each(array,function(v,i){e.fxAdd({type:i,from:v.from,to:v.to,step:v.step||-15,delay:v.timeout||25});});return{run:function(f){e.fxRun(f)}};}};})(sel);if(selector.type==="varbox"||selector.type==="ArrayVar"){var r=µJoin(selector);return r;}
var query=selector.split('/'),c,cpos=path;while(query.length){c=query.shift();if(c==""){while(cpos.up)cpos=cpos.up;continue;}else if(c=="."){continue;}else if(c==".."){if(cpos.up)cpos=cpos.up;else return false;continue;}
if(cpos[c])
cpos=cpos[c];else return false;}
var r=cpos._µNode.getµNode();return r;},"buildMajaxPath":function(){var tmp,tmpstak=[];µNode.id=id;if(is_defined(this.getHtmlNode))path._nod=this.getHtmlNode;path._µNode=this;µ.extend(path["_"]||(path["_"]={}),mxmeth);path["_setCss"]=function(p,v){if(pub.setCustomCSS)pub.setCustomCSS(p,v);};for(var o in this.childs){if(tmp=this.childs[o].buildMajaxPath()){do{for(var i in tmp){if(/^(\_pub)$/.test(i)){path["_"]=µ.extend(path["_"],tmp[i]);continue;}
if(/^(\_)/.test(i)){continue;}
if(/^(\_µass)/.test(i))continue;if(/^(\_nod)/.test(i))continue;if(/^(\?noname)/.test(i)){if(!path['?noname'])path['?noname']={};for(var z in tmp["?noname"]){path["?noname"][z]=tmp["?noname"][z];path["?noname"][z].up=path;tmpstak.push(path["?noname"][z]);}
continue;}
if(/^(up)$/.test(i)){tmp.up=path;continue;}
path[i]=tmp[i];path[i].up=path;}
if(tmpstak.length>0)tmp=tmpstak.shift();else break;}while(1);}}
if(this.haz("majax_widget")&&!pub.µ$o.openNode){tmp={};tmp[id||"?noname"]={"_µNode":{getµNode:function(){return mxmeth_pub;},getHtmlNode:this.getHtmlNode}};return tmp;}
if(id!=0){tmp={};tmp[id]=path;return tmp;}
tmp={};if(!tmp['?noname'])tmp['?noname']={};tmp['?noname'][this.getNodeID()]=path;return tmp;},"MajaxReg":function(i){id=i;},"addMajaxMethods":function(m,isPub){for(var o in m){µNode[o]=m[o];mxmeth[o]=m[o];if(isPub)mxmeth_pub[o]=m[o];}},"getMajaxMethods":function(){return mxmeth;},"MajaxId":function(){return id;},"getMajaxNode":function(i){return path;},"appendChild":function(c){this.childs.push(c);c.setParent(this);},"appendCode":function(c){var d,$kt;if(c.type!="xmldoc")d=new $xml.doc("<wobj \
     xmlns:db='http://www.majax.org/db'\
     xmlns:majax='http://www.majax.org/majax' \
     xmlns:sync='http://www.majax.org/sync'>"+c+"</wobj>","operator");else d=c;pub.appendChild($kt=new majax_node({"use":["majax_htmlNode","majax_events","majax_widget"],"openNode":true,"parent":pub,"tagName":"div","baseMod":d,"context":pub.µ$o.context}));$kt.pushTask(function(){this.µs();});$kt.pushTask(function(){while(this.childs.length!=0)pub.appendChild(this.childs.shift());});$kt.pushTask(function(){pub.redraw();});$kt.$pt();},"setParent":function(c){parent=c;},"parentNode":function(){return parent;},"NamedParentNode":function(){if(id||!this.parentNode()||(this.haz('majax_widget')&&!this.µ$o.openNode))return this;else return this.parentNode().NamedParentNode();},"childs":childs,"µ$e":function(µ$e,implode,p){var tmp="",tmp2;if(!p)p={};try{if(tmp2=µ$e.apply(here,[p])){tmp+=tmp2;each(childs,function(v){if(v.µ$e)
try{tmp+=v.µ$e(µ$e,implode,p);}catch(e){alerts.show("Error exploding !\n",{"what":µ$e+"","on":v,"e":e});}});}}catch(e){alerts.show("Error exploding !\n",{"what":µ$e+"","on":here,"e":e});}
try{if(implode)
tmp+=implode.apply(here,[p]);}catch(e){alerts.show("Error imploding !\n",{"what":implode+"","on":here,"e":e});}
return tmp;},"µ$eFunc":function(µ$e,implode,p){var tmp="",tmp2;if(!p)p={};try{if(this[µ$e]&&(tmp2=this[µ$e](p))){tmp+=tmp2;}
each(childs,function(v){if(v.µ$eFunc)
try{tmp+=v.µ$eFunc(µ$e,implode,p);}catch(e){alerts.show("Error exploding !\n",{"what":µ$e+"","on":v,"e":e});}});}catch(e){alerts.show("Error exploding !\n",{"what":µ$e+"","on":here,"e":e});}
try{if(this[implode])
tmp+=this[implode](p);}catch(e){alerts.show("Error imploding !\n",{"what":implode+"","on":here,"e":e});}
return tmp;},"µ$e_ex":function(µ$e,implode,p,notfirst){here._____________µ$e=µ$e;here._____________implode=implode;var tmp="",tmp2="";if(!p)p={};if(!notfirst||(tmp2=here._____________µ$e(p))){tmp+=tmp2;each(childs,function(v){if(v.haz("majax_arbo"))
tmp+=v.µ$e(µ$e,implode,p,true);});}
if(here._____________implode)
tmp+=here._____________implode(p);here._____________µ$e=null;here._____________implode=null;return tmp;}};};models["majax_widget"]=function(){var xmldoc,id="widget_"+getUniqueId(),root=0,disabled=false;isExpanded=false;var cwidget=0,curi='',built=false,alterver={},mlist;var pub,here={"listen":function(e,c,d){if(e=="change"){try{if(built){var old;if(alterver[$xml.mkLocalUri(d.getSrc())+d.getLocalPath()]){old=pub.pushAspect("majax_arbo",alterver[$xml.mkLocalUri(d.getSrc())+d.getLocalPath()]);alterver[curi+cwidget.getLocalPath()]=old;cwidget=d;curi=$xml.mkLocalUri(d.getSrc());pub.redraw();return;}else{old=pub.pushAspect("majax_arbo");alterver[curi+cwidget.getLocalPath()]=old;}}}catch(e){alerts.show(e,d);}
cwidget=d;curi=$xml.mkLocalUri(cwidget.getSrc());root=0;if(pub.setWriterKeys)pub.setWriterKeys(cwidget.getOwner());if(!pub.µ$o.disableStyle&&cwidget.get('@style'))pub.addStyle(pub.µ$o.context.db.vars.mkEVar(cwidget.get('@style'),pub.µ$o.context.db));var inclist=d.select("includes/*");for(var n=0;n<inclist.length;n++)
$xml.wreg($xml.getXML(inclist[n].firstChild),$xml.getAttr(inclist[n],"path"),$xml.getAttr(inclist[n],"owner"));inclist=d.select("includes");if(inclist.length)inclist[0].parentNode.removeChild(inclist[0]);pub.pushTask(function(){burnWidget();built=true;});pub.$pt();}}};var burnWidget=function burnWidget(){pub.µ$o.__wsync=cwidget.select('.')[0].firstChild;pub.µ$e(function e(){var cnod=this.µ$o.__wsync;if(!cnod){this.$pt();return false;}
var tmp;this.µ$o.__wsync=0;var µ$c=this.µ$o.context;do{if(cnod.nodeType==8){}else if(cnod.nodeType==3&&!/^[\t\ \n\r]*$/.test(cnod.nodeValue)){var $kt;this.appendChild($kt=new majax_node({"use":["majax_callStack","majax_arbo","majax_textNode"],"parent":this,"value":cnod.nodeValue,"context":pub.µ$o.context,"__wsync":cnod.firstChild}));$kt.pushTask(function(){this.µs();});}else if(is_defined(models["$"+cnod.nodeName])){try{var $kt;this.appendChild($kt=new majax_node({"use":[],"parent":this,"origin":cnod,"cwidget":cwidget,"context":pub.µ$o.context,"__wsync":cnod.firstChild}));$kt.addAspect("$"+cnod.nodeName);$kt.pushTask(function(){this.µs();});}catch(e){alerts.show("Error mking "+cnod.nodeName+" nod !\n"+e,e);}}else if(cnod.prefix=="db"){try{if(/sync$/.test(cnod.nodeName.rmNamespace())){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),"","");this.µ$o.context.db.sync(cnod.nodeName.rmNamespace(),this.µ$o.context.db.get($xml.getAttr(cnod,"with")));}else if($xml.getAttr(cnod,"value")!=""){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),$xml.getAttr(cnod,"value"),0,pub.µ$o.context.db);}else if($xml.getAttr(cnod,"use")!=""){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),this.µ$o.context.db.get($xml.getAttr(cnod,"use")),0,pub.µ$o.context.db);}else if($xml.getAttr(cnod,"src")!=""){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),$xml.getAttr(cnod,"src"),0,pub.µ$o.context.db);}else if(cnod.childNodes.length&&/^jsvar/.test(cnod.nodeName.rmNamespace())){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),$xml.getInnerXML(cnod),pub,pub.µ$o.context.db);}else if(cnod.childNodes.length&&/^xml/.test(cnod.nodeName.rmNamespace())){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),$xml.wreg($xml.getXML(cnod.firstElementChild),"tamp://var_"+getUniqueId(),($xml.getAttr(cnod,"keyfree")=="true")?0:cwidget.getOwner()),0,pub.µ$o.context.db);}else if(cnod.childNodes.length){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),$xml.wreg(cwidget.mkFragment(cnod),"tamp://var_"+getUniqueId(),($xml.getAttr(cnod,"keyfree")=="true")?0:cwidget.getOwner()),0,pub.µ$o.context.db);}else this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),"",0,pub.µ$o.context.db);}catch(e){alerts.show("Error defining var!\n"+e,cnod);}}else if(cnod.prefix=="majax"){var $kt;try{this.appendChild($kt=new majax_node({"use":["majax_htmlNode","majax_events","majax_widget"],"parent":this,"tagName":"div","origin":cnod,"style":$xml.getAttr(cnod,"style"),"context":µ$c=new µ$µ(),"parent_context":pub.µ$o.context}));var varlist=cnod.selectNodes("*");for(var i=0;i<varlist.length;i++){if(varlist[i].prefix!="db"){alert("unknow prefix :"+varlist[i]);continue;}
if(/sync$/.test(varlist[i].nodeName.rmNamespace())){µ$c.db.set(varlist[i].nodeName.rmNamespace(),"","");µ$c.db.sync(varlist[i].nodeName.rmNamespace(),pub.µ$o.context.db.get($xml.getAttr(varlist[i],"value")));}else if($xml.getAttr(varlist[i],"value")!=""){µ$c.db.set(varlist[i].nodeName.rmNamespace(),$xml.getAttr(varlist[i],"value"),0,pub.µ$o.context.db);}else if($xml.getAttr(cnod,"use")!=""){this.µ$o.context.db.set(cnod.nodeName.rmNamespace(),this.µ$o.context.db.get($xml.getAttr(cnod,"use")),0,pub.µ$o.context.db);}else if($xml.getAttr(varlist[i],"src")!=""){µ$c.db.set(varlist[i].nodeName.rmNamespace(),$xml.getAttr(varlist[i],"src"),0,pub.µ$o.context.db);}else if(varlist[i].childNodes.length){µ$c.db.set(varlist[i].nodeName.rmNamespace(),$xml.wreg(cwidget.mkFragment(varlist[i]),"tamp://var_"+getUniqueId(),cwidget.getOwner()),0,pub.µ$o.context.db);}else µ$c.db.set(varlist[i].nodeName.rmNamespace(),"",0,pub.µ$o.context.db);}
if(/^db.inline\./.test(cnod.nodeName.rmNamespace())){}else if(/^db\./.test(cnod.nodeName.rmNamespace())){var myuri=pub.µ$o.context.db.get(cnod.nodeName.rmNamespace().replace(/^db\./,'')).src();$kt.pushTask(function(d){return d.datas.mkSema('ready');},{'datas':pub.µ$o.context.db.get(cnod.nodeName.rmNamespace().replace(/^db\./,''))});$kt.pushTask(function(d){this.µ$o.baseMod=d.datas;var params=d.datas.getParams();for(var o in params)
{µ$c.db.set(o,params[o]);};},{'datas':pub.µ$o.context.db.get(cnod.nodeName.rmNamespace().replace(/^db\./,''))});var instaxx={"context":µ$c};$kt.pushTask(function(){this.µs();});$kt.pushTask(function(d){d.datas._=d.onod.getMajaxMethods();},{'datas':instaxx,'onod':$kt});pub.µ$o.context.db.get(cnod.nodeName.rmNamespace().replace(/^db\./,'')).getVal().regInstance(instaxx);µ$c.db.include(pub.µ$o.context.db.get(cnod.nodeName.rmNamespace().replace(/^db\./,'')).getContext());}else{$kt.pushTask(function(d){this.µ$o.baseMod=(new $xml.doc()).load(d.uri);},{'uri':(/^users\./.test(cnod.nodeName.rmNamespace()))?$xml.mkUri("majax://"+cnod.nodeName.rmNamespace()):$xml.mkUri("majax://users."+cwidget.getOwner()+"."+cnod.nodeName.rmNamespace())});$kt.pushTask(function(){this.µs();});}}catch(e){alerts.show("Error mking majax nod !\n"+e);}}else if(cnod.nodeType==1){var $kt;this.appendChild($kt=new majax_node({"use":["majax_htmlNode"],"parent":this,"tagName":cnod.nodeName,"origin":cnod,"style":$xml.getAttr(cnod,"style"),"context":pub.µ$o.context,"__wsync":cnod.firstChild}));$kt.pushTask(function(){this.µs();});$kt.$pt();}
if(cnod.nodeType==1){var varlist=cnod.selectNodes("@*");for(var i=0;i<varlist.length;i++){if(varlist[i].prefix=="db"){if(/sync$/.test(varlist[i].nodeName.rmNamespace())){µ$c.db.set(varlist[i].nodeName.rmNamespace(),"","");µ$c.db.sync(varlist[i].nodeName.rmNamespace(),pub.µ$o.context.db.get(varlist[i].nodeValue));}else{µ$c.db.set(varlist[i].nodeName.rmNamespace(),varlist[i].nodeValue,0,pub.µ$o.context.db);}}else if(varlist[i].prefix=="sync"){$kt.addAspect("majax_sync");if(varlist[i].nodeName.rmNamespace()=="node"){$kt.setSyncNode(varlist[i].nodeValue,pub.µ$o.context);}else if(varlist[i].nodeName.rmNamespace()=="abilities"){$kt.setAbilities(varlist[i].nodeValue);}else if(varlist[i].nodeName.rmNamespace()=="draggable"){$kt.canBeDrag(varlist[i].nodeValue);}}}}
if(cnod==cnod.parentNode.lastChild)break;}while(cnod=cnod.nextSibling);if(this.childs.length)
return true;this.$pt();return false;},function i(){this.$pt();});pub.redraw();if(globalInited)pub.µ$o.context.init();};return pub={"free":function(){if(mlist.free)mlist.free();if(root&&root.parentNode)root.parentNode.removeChild(root);},"init":function(){this.addAspect("majax_htmlNode");this.addAspect("majax_styleUnit");pub=this;pub.addMajaxMethods({"free":pub.free,"dom":function(trace){return pub.getHtmlNode();},"spread":function(e,c,d,k){pub.µ$o.context.listen(e,c,d,k);},"mkSema":function(){return pub.µ$o.context.mkSema.apply(pub.µ$o.context,arguments);},"focus":function(){var node;if((node=pub.getHtmlNode())&&node.parentNode)
node.parentNode.appendChild(node);}},true,true);this.addListener(here);if(is_defined(this.µ$o.baseMod)){mlist=this.µ$o.baseMod.addListener(here)}else if(is_defined(this.µ$o.ModUri)){}},"disable":function(){disabled=true;this.µ$o.context.sleep();if(this.getHtmlNode())
hideNode(root);},"wakeUp":function(){disabled=false;if(root)
showNode(root);},"listActs":function(){return{"acts":[{"html":"$","label":"Editer !","dothat":function(){alert('edit');}},{"html":"$","label":"Changer de mod !","dothat":function(){}},{"html":"$","label":"Supprimer !","dothat":function(){}}],"merge":function(){},"color":'red',"getDom":function(){var tmp=document.createElement('div'),tmp2;tmp.innerHTML="Widget "+((cwidget.getSrc)?cwidget.getSrc():"error reading source :(");for(var o=0;o<this.acts.length;o++){tmp.appendChild(tmp2=document.createElement('span'));if(this.acts[o].html)tmp2.innerHTML=this.acts[o].html;else this.acts[o].html="";tmp2.onclick=this.acts[o].dothat;tmp2.title=this.acts[o].label;}
return tmp;}};},"toString":function(){return xmldoc+"";},"setCurNode":function(){},"getNodeID":function(){return id;},"getHtmlNode":function(){return(root=document.getElementById(id));},"draw":function(){root=false;this.resetStyle();root=0;if(disabled)return"";var tmp="<div id=\""+id+"\" style=\""+this.getCurrentStyle()+"\" class=\""+$xml.getAttr(this.µ$o.origin||this.µ$o.baseNode,'class')+" "+id+"\">";each(this.childs,function(c){tmp+=c.draw();});tmp+="</div>";return tmp;},"toString":function(){return"[widget : "+id+"]";}};};models["majax_htmlNode"]=function(){var tagName="div",local_id="",id="html_"+getUniqueId(),root=0,curNode=0,persistant=false,pNode=0,deb=false;var pub,here={"listen":function(e,c,d){if(e=="change"){}}};return pub={"init":function(){pub=this;this.addAspect("majax_styleUnit");this.addMajaxMethods({"addClass":function(c){if(pub.getHtmlNode().className.indexOf(c)==-1){pub.getHtmlNode().className.className+=c;}
return this;},"getNodeID":pub.getNodeID,"dom":function(trace){if(trace){console.log('breakhere');}
return pub.getHtmlNode();},"bePersistant":function(v,d){persistant=!v;deb=d;},"free":function(){pub.free();}});if(!this.µ$o.tagName)
this.µ$o.tagName="div";if(is_defined(this.µ$o.origin)&&(local_id=$xml.getAttr(this.µ$o.origin,'id'))!="")
this.MajaxReg(local_id,this);},"free":function(){if(root&&root.parentNode)root.parentNode.removeChild(root);},"setCurNode":function(){},"getNodeID":function(){return id;},"connectEvent":function(){if(pNode){var nod,t;if(!(nod=document.getElementById(id)))console.log("c w/ node");nod.parentNode.replaceChild(pNode,nod);t=pNode.innerHTML
pNode=0;}},"getHtmlNode":function(){return pNode||(root=document.getElementById(id))||pub.µ$o.baseHtmlNode;},"draw":function(){root=false;if(persistant&&(pNode||document.getElementById(id))){if(pNode)return"<div id=\""+id+"\">$nbsp;</div>";pNode=document.getElementById(id);hidden_nod.appendChild(pNode);return"<div id=\""+id+"\">$nbsp;</div>";}
this.resetStyle();var tmp="<"+this.µ$o.tagName+" id=\""+id+"\" style=\""+this.getCurrentStyle()+"\" ";if(is_defined(this.µ$o.origin))
for(var i=0;i<this.µ$o.origin.attributes.length;i++)
if(!/^(db|sync|majax)/.test(this.µ$o.origin.attributes[i].prefix)&&!/(id|style)/.test(this.µ$o.origin.attributes[i].nodeName))
tmp+=" "+this.µ$o.origin.attributes[i].nodeName+"=\""+this.µ$o.origin.attributes[i].nodeValue+"\"";tmp+=">";each(this.childs,function(c){tmp+=c.draw();});tmp+="</"+this.µ$o.tagName+">";return tmp;},"redraw":function(){if(!this.getHtmlNode())return false;var tmp="";each(this.childs,function(c){tmp+=c.draw();});this.getHtmlNode().innerHTML=tmp;this.applyCSS();this.buildMajaxPath();if(this.haz("majax_widget")){this.µ$e(function µ$e(){if(this.connectEvent)
this.connectEvent();return true;},function implode(){if(this.haz("majax_widget")){this.µ$o.context.init();}
return true;});if(this.connectEvent)
this.connectEvent();pub.µ$o.context.init();}
return tmp;},"toString":function(){return"["+this.µ$o.tagName+"]";}};};models["majax_textNode"]=function(){var
value="";var pub,here={"listen":function(e,c,d){if(e=="change"){}}};return pub={"init":function(){value=this.µ$o.value;},"setCurNode":function(){},"draw":function(){return value;},"toString":function(){return"#text";}};};var majax_node=function majax_node_builder(opts){this.µ$o=(opts)?opts:{};this.id="base_"+getUniqueId();this.µass={};this.µassList={};var methmult={};this.µsd=false;this.fail=false;this.pushAspect=function(id,µas){var o=id;var old;if(!this.haz(id))return this.addAspect(id);if(!models[o])return console.log("Not found "+o);old=this.µass[o];var here=this;if(µas)this.µass[o]=µas;else this.µass[o]=models[o](this);if(this.µass[o].init){this["______init"]=this.µass[o].init;delete(this.µass[o].init);}
for(var z in this.µass[o]){(function(fname,µas){try{if((typeof(here.µass[µas][fname]))!="function"){here[fname]=here.µass[µas][fname];return;}
if(!methmult[fname])
methmult[fname]={};methmult[fname][µas]=here.µass[µas][fname];var innerfunc;var innerfunc=here[fname]=function(a,b,c,d,e,f,g,h){var ret;for(var w in methmult[fname]){here[fname]=here.µass[w][fname];try{ret=here[fname](a,b,c,d,e,f,g,h);}catch(e){alerts.msg("method "+fname+" of "+w+" fail !\n"+e);}}
here[fname]=innerfunc;return ret;};}catch(err){((err.type=="bugtales")?err:new bugtales(err)).finalize("err executing µas method "+fname+" on :"+listOf(methmult[fname])+"\n"+err,onSync[i]);}})(z,o);}
if(this["______init"]){this["______init"]();delete(this["______init"]);}
return old;};this.getAspectList=function(){var r=[];for(var o in this.µass)r.push(o);return r;};this.addAspect=function(id){var o=id;if(this.haz(id))return true;if(!models[o])return console.log("Not found "+o);var here=this;this.µass[o]=models[o](this);if(this.µass[o].init){this["______init"]=this.µass[o].init;delete(this.µass[o].init);}
for(var z in this.µass[o]){if(z=="toString")continue;(function(fname,µas){if((typeof(here.µass[µas][fname]))!="function"){here[fname]=here.µass[µas][fname];return;}
if(!methmult[fname])
methmult[fname]={};methmult[fname][µas]=here.µass[µas][fname];var innerfunc;here[fname]=innerfunc=function(){var ret;for(var w in methmult[fname]){if(w)
ret=here.µass[w][fname].apply(here,arguments);try{}catch(e){alerts.show("method "+fname+" of "+w+" fail !\n"+e,here.µass);}}
return ret;};})(z,o);}
if(this["______init"]){this["______init"]();delete(this["______init"]);}};this.µs=function(){var e=0;var here=this;each(this.µ$o.use,function(o){this.addAspect(o);},this);if(!e)this.µsd=true;else this.fail=true;};this.haz=function(a){return true&&this.µass[a]&&!this.fail;};this.draw=function(){var tmp="<div style=\""+this.µ$o.style+"\">[not µsd !! :s ]</div>";return tmp;};this.print=function(txt){alert(txt);};this.getHtmlNode=function(){return false;};this.getNodeID=function(){return this.id;};this.toString=function(){return"[souche]";};this.addAspect("majax_callStack");this.addAspect("majax_arbo");};$session=new(function(){var sessionxml=$$.db.vars.µxv("local://session");this.xml=sessionxml;this.register=function(log,psw,cb){var expire=new Date();expire.setTime(expire.getTime()+24*60*60*31*1000);setCookie("LogID",log,expire);setCookie("pH",MD5(psw),expire);var s;(s=new $xml.session()).onSync(function(rez){if(cb)cb(sessionxml.getText("./login")==log);});s.sync();};this.unregister=function(cb){var expire=new Date();setCookie("LogID",0,expire);setCookie("pH",0,expire);var s;(s=new $xml.session()).onSync(function(rez){if(cb)cb();});s.sync();};});$root=new majax_node({"use":["majax_events","majax_widget"],"id":"root","style":"position:absolute;width:100%;height:100%;left:0;top:0","baseMod":(new $xml.doc()).load(desk_uri),"context":new µ$µ(),"baseHtmlNode":background_nod});var ooo;root_node.appendChild(popup_nod);root_node.appendChild(background_nod);root_node.appendChild(hidden_nod);$root.pushTask(function(){this.µs();});$root.pushTask(function(){});$root.$pt();window.$root={"open":$root.open=function(uri,type,style){if(type=="widget"){var rootNode=document.createElement('div'),nodCtx=new µ$µ();var widget=nodCtx.db.set("widget.main",uri);var $kt=new majax_node({"use":["majax_events","majax_widget"],"id":"run","style":"position:absolute;width:450px;height:250px;left:20px;top:20px","baseMod":(new $xml.doc()).load("home://win"),"context":nodCtx,"baseHtmlNode":rootNode});$kt.pushTask(function(){this.µs();});$kt.pushTask(function(){$root.appendChild($kt);$root.getHtmlNode().appendChild(rootNode);});$kt.$pt();return widget;}else if(type=="item")
$root.appendCode("<majax:win style='"+((style)?style:"position:absolute;top:100;left:100;width:900;height:600")+"' db:evar.fader='true'>"+"<db:widget.main>"+"<db:xml.mydoc value=\""+uri+"\"/>"+"<sync select=\"xml.mydoc(./description)\" use=\"html\"/>"+"</db:widget.main>"+"</majax:win>");}};document.onkeydown=function(e){if(!e){if(window.event)e=window.event;else e={};}
var keyCode=0;try{keyCode=e.keyCode;}catch(e){try{keyCode=e.which;}catch(e2){}}
if(e.ctrlKey&&keyCode==76&&!window.$taskbar){$root.appendCode("<majax:taskbar/>");}};$root.wakeUp();$root.applyCSS();window.onresize=function(){$root.redraw();};};
