
/*** client/inc/rsa/rsa.js ***/

var dbits;var canary=0xdeadbeefcafe;var j_lm=((canary&0xffffff)==0xefcafe);function BigInteger(a,b,c){if(a!=null)
if("number"==typeof a)this.fromNumber(a,b,c);else if(b==null&&"string"!=typeof a)this.fromString(a,256);else this.fromString(a,b);}
_me=BigInteger.prototype;_me.toString=function(b){if(this.s<0)return"-"+this.negate().toString(b);var k;if(b==16)k=4;else if(b==8)k=3;else if(b==2)k=1;else if(b==32)k=5;else if(b==4)k=2;else return this.toRadix(b);var km=(1<<k)-1,d,m=false,r="",i=this.t;var p=this.DB-(i*this.DB)%k;if(i-->0){if(p<this.DB&&(d=this[i]>>p)>0){m=true;r=this.int2char(d);}
while(i>=0){if(p<k){d=(this[i]&((1<<p)-1))<<(k-p);d|=this[--i]>>(p+=this.DB-k);}
else{d=(this[i]>>(p-=k))&km;if(p<=0){p+=this.DB;--i;}}
if(d>0)m=true;if(m)r+=this.int2char(d);}}
return m?r:"0";}
_me.negate=function(){var r=nbi();BigInteger.ZERO.subTo(this,r);return r;}
_me.abs=function(){return(this.s<0)?this.negate():this;}
_me.compareTo=function(a){var r=this.s-a.s;if(r!=0)return r;var i=this.t;r=i-a.t;if(r!=0)return r;while(--i>=0)if((r=this[i]-a[i])!=0)return r;return 0;}
_me.bitLength=function(){if(this.t<=0)return 0;return this.DB*(this.t-1)+this.nbits(this[this.t-1]^(this.s&this.DM));}
_me.mod=function(a){var r=nbi();this.abs().divRemTo(a,null,r);if(this.s<0&&r.compareTo(BigInteger.ZERO)>0)a.subTo(r,r);return r;}
_me.modPowInt=function(e,m){var z;if(e<256||m.isEven())z=new Classic(m);else z=new Montgomery(m);return this.exp(e,z);}
function nbi(){return new BigInteger(null);}
function am1(i,x,w,j,c,n){while(--n>=0){var v=x*this[i++]+w[j]+c;c=Math.floor(v/0x4000000);w[j++]=v&0x3ffffff;}
return c;}
function am2(i,x,w,j,c,n){var xl=x&0x7fff,xh=x>>15;while(--n>=0){var l=this[i]&0x7fff;var h=this[i++]>>15;var m=xh*l+h*xl;l=xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);c=(l>>>30)+(m>>>15)+xh*h+(c>>>30);w[j++]=l&0x3fffffff;}
return c;}
function am3(i,x,w,j,c,n){var xl=x&0x3fff,xh=x>>14;while(--n>=0){var l=this[i]&0x3fff;var h=this[i++]>>14;var m=xh*l+h*xl;l=xl*l+((m&0x3fff)<<14)+w[j]+c;c=(l>>28)+(m>>14)+xh*h;w[j++]=l&0xfffffff;}
return c;}
if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30;}
else if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26;}
else{BigInteger.prototype.am=am3;dbits=28;}
BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<<dbits)-1);BigInteger.prototype.DV=(1<<dbits);var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array();var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv)BI_RC[rr++]=vv;rr="a".charCodeAt(0);for(vv=10;vv<36;++vv)BI_RC[rr++]=vv;rr="A".charCodeAt(0);for(vv=10;vv<36;++vv)BI_RC[rr++]=vv;_me.int2char=function(n){return BI_RM.charAt(n);}
_me.intAt=function(s,i){var c=BI_RC[s.charCodeAt(i)];return(c==null)?-1:c;}
_me.copyTo=function(r){for(var i=this.t-1;i>=0;--i)r[i]=this[i];r.t=this.t;r.s=this.s;}
_me.fromInt=function(x){this.t=1;this.s=(x<0)?-1:0;if(x>0)this[0]=x;else if(x<-1)this[0]=x+DV;else this.t=0;}
function nbv(i){var r=nbi();r.fromInt(i);return r;}
_me.fromString=function(s,b){var k;if(b==16)k=4;else if(b==8)k=3;else if(b==256)k=8;else if(b==2)k=1;else if(b==32)k=5;else if(b==4)k=2;else{this.fromRadix(s,b);return;}
this.t=0;this.s=0;var i=s.length,mi=false,sh=0;while(--i>=0){var x=(k==8)?s[i]&0xff:this.intAt(s,i);if(x<0){if(s.charAt(i)=="-")mi=true;continue;}
mi=false;if(sh==0)
this[this.t++]=x;else if(sh+k>this.DB){this[this.t-1]|=(x&((1<<(this.DB-sh))-1))<<sh;this[this.t++]=(x>>(this.DB-sh));}
else
this[this.t-1]|=x<<sh;sh+=k;if(sh>=this.DB)sh-=this.DB;}
if(k==8&&(s[0]&0x80)!=0){this.s=-1;if(sh>0)this[this.t-1]|=((1<<(this.DB-sh))-1)<<sh;}
this.clamp();if(mi)BigInteger.ZERO.subTo(this,this);}
_me.clamp=function(){var c=this.s&this.DM;while(this.t>0&&this[this.t-1]==c)--this.t;}
_me.nbits=function(x){var r=1,t;if((t=x>>>16)!=0){x=t;r+=16;}
if((t=x>>8)!=0){x=t;r+=8;}
if((t=x>>4)!=0){x=t;r+=4;}
if((t=x>>2)!=0){x=t;r+=2;}
if((t=x>>1)!=0){x=t;r+=1;}
return r;}
_me.dlShiftTo=function(n,r){var i;for(i=this.t-1;i>=0;--i)r[i+n]=this[i];for(i=n-1;i>=0;--i)r[i]=0;r.t=this.t+n;r.s=this.s;}
_me.drShiftTo=function(n,r){for(var i=n;i<this.t;++i)r[i-n]=this[i];r.t=Math.max(this.t-n,0);r.s=this.s;}
_me.lShiftTo=function(n,r){var bs=n%this.DB;var cbs=this.DB-bs;var bm=(1<<cbs)-1;var ds=Math.floor(n/this.DB),c=(this.s<<bs)&this.DM,i;for(i=this.t-1;i>=0;--i){r[i+ds+1]=(this[i]>>cbs)|c;c=(this[i]&bm)<<bs;}
for(i=ds-1;i>=0;--i)r[i]=0;r[ds]=c;r.t=this.t+ds+1;r.s=this.s;r.clamp();}
_me.rShiftTo=function(n,r){r.s=this.s;var ds=Math.floor(n/this.DB);if(ds>=this.t){r.t=0;return;}
var bs=n%this.DB;var cbs=this.DB-bs;var bm=(1<<bs)-1;r[0]=this[ds]>>bs;for(var i=ds+1;i<this.t;++i){r[i-ds-1]|=(this[i]&bm)<<cbs;r[i-ds]=this[i]>>bs;}
if(bs>0)r[this.t-ds-1]|=(this.s&bm)<<cbs;r.t=this.t-ds;r.clamp();}
_me.subTo=function(a,r){var i=0,c=0,m=Math.min(a.t,this.t);while(i<m){c+=this[i]-a[i];r[i++]=c&this.DM;c>>=this.DB;}
if(a.t<this.t){c-=a.s;while(i<this.t){c+=this[i];r[i++]=c&this.DM;c>>=this.DB;}
c+=this.s;}
else{c+=this.s;while(i<a.t){c-=a[i];r[i++]=c&this.DM;c>>=this.DB;}
c-=a.s;}
r.s=(c<0)?-1:0;if(c<-1)r[i++]=this.DV+c;else if(c>0)r[i++]=c;r.t=i;r.clamp();}
_me.multiplyTo=function(a,r){var x=this.abs(),y=a.abs();var i=x.t;r.t=i+y.t;while(--i>=0)r[i]=0;for(i=0;i<y.t;++i)r[i+x.t]=x.am(0,y[i],r,i,0,x.t);r.s=0;r.clamp();if(this.s!=a.s)BigInteger.ZERO.subTo(r,r);}
_me.squareTo=function(r){var x=this.abs();var i=r.t=2*x.t;while(--i>=0)r[i]=0;for(i=0;i<x.t-1;++i){var c=x.am(i,x[i],r,2*i,0,1);if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1))>=x.DV){r[i+x.t]-=x.DV;r[i+x.t+1]=1;}}
if(r.t>0)r[r.t-1]+=x.am(i,x[i],r,2*i,0,1);r.s=0;r.clamp();}
_me.divRemTo=function(m,q,r){var pm=m.abs();if(pm.t<=0)return;var pt=this.abs();if(pt.t<pm.t){if(q!=null)q.fromInt(0);if(r!=null)this.copyTo(r);return;}
if(r==null)r=nbi();var y=nbi(),ts=this.s,ms=m.s;var nsh=this.DB-this.nbits(pm[pm.t-1]);if(nsh>0){pm.lShiftTo(nsh,y);pt.lShiftTo(nsh,r);}
else{pm.copyTo(y);pt.copyTo(r);}
var ys=y.t;var y0=y[ys-1];if(y0==0)return;var yt=y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0);var d1=this.FV/yt,d2=(1<<this.F1)/yt,e=1<<this.F2;var i=r.t,j=i-ys,t=(q==null)?nbi():q;y.dlShiftTo(j,t);if(r.compareTo(t)>=0){r[r.t++]=1;r.subTo(t,r);}
BigInteger.ONE.dlShiftTo(ys,t);t.subTo(y,y);while(y.t<ys)y[y.t++]=0;while(--j>=0){var qd=(r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);if((r[i]+=y.am(0,qd,r,j,0,ys))<qd){y.dlShiftTo(j,t);r.subTo(t,r);while(r[i]<--qd)r.subTo(t,r);}}
if(q!=null){r.drShiftTo(ys,q);if(ts!=ms)BigInteger.ZERO.subTo(q,q);}
r.t=ys;r.clamp();if(nsh>0)r.rShiftTo(nsh,r);if(ts<0)BigInteger.ZERO.subTo(r,r);}
_me.invDigit=function(){if(this.t<1)return 0;var x=this[0];if((x&1)==0)return 0;var y=x&3;y=(y*(2-(x&0xf)*y))&0xf;y=(y*(2-(x&0xff)*y))&0xff;y=(y*(2-(((x&0xffff)*y)&0xffff)))&0xffff;y=(y*(2-x*y%this.DV))%this.DV;return(y>0)?this.DV-y:-y;}
_me.isEven=function(){return((this.t>0)?(this[0]&1):this.s)==0;}
_me.exp=function(e,z){if(e>0xffffffff||e<1)return BigInteger.ONE;var r=nbi(),r2=nbi(),g=z.convert(this),i=this.nbits(e)-1;g.copyTo(r);while(--i>=0){z.sqrTo(r,r2);if((e&(1<<i))>0)z.mulTo(r2,g,r);else{var t=r;r=r2;r2=t;}}
return z.revert(r);}
function Classic(m){this.m=m;}
_me=Classic.prototype;_me.convert=function(x){if(x.s<0||x.compareTo(this.m)>=0)return x.mod(this.m);else return x;}
_me.revert=function(x){return x;}
_me.reduce=function(x){x.divRemTo(this.m,null,x);}
_me.mulTo=function(x,y,r){x.multiplyTo(y,r);this.reduce(r);}
_me.sqrTo=function(x,r){x.squareTo(r);this.reduce(r);}
function Montgomery(m){this.m=m;this.mp=m.invDigit();this.mpl=this.mp&0x7fff;this.mph=this.mp>>15;this.um=(1<<(m.DB-15))-1;this.mt2=2*m.t;}
_me=Montgomery.prototype;_me.convert=function(x){var r=nbi();x.abs().dlShiftTo(this.m.t,r);r.divRemTo(this.m,null,r);if(x.s<0&&r.compareTo(BigInteger.ZERO)>0)this.m.subTo(r,r);return r;}
_me.revert=function(x){var r=nbi();x.copyTo(r);this.reduce(r);return r;}
_me.reduce=function(x){while(x.t<=this.mt2)
x[x.t++]=0;for(var i=0;i<this.m.t;++i){var j=x[i]&0x7fff;var u0=(j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;j=i+this.m.t;x[j]+=this.m.am(0,u0,x,i,0,this.m.t);while(x[j]>=x.DV){x[j]-=x.DV;x[++j]++;}}
x.clamp();x.drShiftTo(this.m.t,x);if(x.compareTo(this.m)>=0)x.subTo(this.m,x);}
_me.sqrTo=function(x,r){x.squareTo(r);this.reduce(r);}
_me.mulTo=function(x,y,r){x.multiplyTo(y,r);this.reduce(r);}
BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function Arcfour(){this.i=0;this.j=0;this.S=new Array();}
_me=Arcfour.prototype;_me.init=function(key){var i,j,t;for(i=0;i<256;++i)
this.S[i]=i;j=0;for(i=0;i<256;++i){j=(j+this.S[i]+key[i%key.length])&255;t=this.S[i];this.S[i]=this.S[j];this.S[j]=t;}
this.i=0;this.j=0;}
_me.next=function(){var t;this.i=(this.i+1)&255;this.j=(this.j+this.S[this.i])&255;t=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=t;return this.S[(t+this.S[this.i])&255];}
function prng_newstate(){return new Arcfour();}
var rng_psize=256;var rng_state;var rng_pool;var rng_pptr;function SecureRandom(){}
_me=SecureRandom.prototype;_me.nextBytes=function rng_get_bytes(ba){var i;for(i=0;i<ba.length;++i)ba[i]=this.rng_get_byte();}
function rng_seed_int(x){rng_pool[rng_pptr++]^=x&255;rng_pool[rng_pptr++]^=(x>>8)&255;rng_pool[rng_pptr++]^=(x>>16)&255;rng_pool[rng_pptr++]^=(x>>24)&255;if(rng_pptr>=rng_psize)rng_pptr-=rng_psize;}
function rng_seed_time(){rng_seed_int(new Date().getTime());}
if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t<z.length;++t)
rng_pool[rng_pptr++]=z.charCodeAt(t)&255;}
while(rng_pptr<rng_psize){t=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=t>>>8;rng_pool[rng_pptr++]=t&255;}
rng_pptr=0;rng_seed_time();}
_me.rng_get_byte=function(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)
rng_pool[rng_pptr]=0;rng_pptr=0;}
return rng_state.next();}
function RSAKey(){this.n=null;this.e=0;this.d=null;this.p=null;this.q=null;this.dmp1=null;this.dmq1=null;this.coeff=null;}
_me=RSAKey.prototype;_me.setPublic=function(N,E){if(N!=null&&E!=null&&N.length>0&&E.length>0){this.n=this.parseBigInt(N,16);this.e=parseInt(E,16);}
else
alert("Invalid RSA public key");}
_me.encrypt=function(text){var m=this.pkcs1pad2(text,(this.n.bitLength()+7)>>3);if(m==null)return null;var c=this.doPublic(m);if(c==null)return null;var h=c.toString(16);if((h.length&1)==0)return h;else return"0"+h;}
_me.parseBigInt=function(str,r){return new BigInteger(str,r);}
_me.linebrk=function(s,n){var ret="";var i=0;while(i+n<s.length){ret+=s.substring(i,i+n)+"\n";i+=n;}
return ret+s.substring(i,s.length);}
_me.byte2Hex=function(b){if(b<0x10)
return"0"+b.toString(16);else
return b.toString(16);}
_me.pkcs1pad2=function(s,n){if(n<s.length+11){alert("Message too long for RSA");return null;}
var ba=new Array();var i=s.length-1;while(i>=0&&n>0)ba[--n]=s.charCodeAt(i--);ba[--n]=0;var rng=new SecureRandom();var x=new Array();while(n>2){x[0]=0;while(x[0]==0)rng.nextBytes(x);ba[--n]=x[0];}
ba[--n]=2;ba[--n]=0;return new BigInteger(ba);}
_me.doPublic=function(x){return x.modPowInt(this.e,this.n);}

/*** client/inc/debug.js ***/

function inspect(obj,win){var str="";for(var prop in obj)
try{str+="obj."+prop+" = "+obj[prop]+(win?"<br>":"\r\n");}
catch(er){str+='obj.'+prop+" = NO ACCESS"+(win?"<br>":"\r\n");};if(win){var kokos=window.open("","");kokos.document.writeln(str);}
else
alert(str);};function inspect2(arr,win){if(win){var kokos=window.open("","");kokos.document.writeln(var_dump(arr).replace(/\>/g,"&gt;").replace(/\</g,"&lt;").replace(/\n/g,"<br>"));}
else
alert(var_dump(arr));};function var_dump(arr,fce,num){var ap="",out="",tstr="";num=num||0;if(Is.String(arr))return arr;for(var ii=0;ii<num;ii++)ap+=".";for(var i in arr){if(typeof arr[i]=='object')
out+=ap+" ["+i+"]\r\n"+var_dump(arr[i],fce,num+2);else{if(typeof arr[i]=='undefined')
tstr='undefined';else
tstr=arr[i].toString();out+=ap+" ["+i+"]("+typeof arr[i]+") = "+tstr+"\r\n";}}
return out;};var IWAPI_DEBUG=false;_me=cAPI_debug.prototype;function cAPI_debug(){window.IWAPI_DEBUG=true;};_me.add=function(title,data){if(!this.win||this.win.closed)this.open();data=data||'no data';var e0=mkElement('div');var e1=mkElement('div');e1.innerHTML='<span>[+]</span> '+title;e1.onclick=function(){var s,t,ns=this.nextSibling.style;if(ns.display=='none'){ns.display="block";t='[-]';}else{ns.display="none";t='[+]';}
this.getElementsByTagName('span')[0].innerHTML=t;};var e2=mkElement('pre');e2.style.display='none';if(typeof data=='object')
e2.innerHTML=var_dump(data);else
e2.innerHTML=data;this.win.document.body.appendChild(e0);e0.appendChild(e1);e0.appendChild(e2);e0=null;e1=null;e2=null;};_me.open=function(){this.win=window.open('','debug',"resizable=yes,scrollbars=1,status=0,width=400,height=600");this.win.document.body.innerHTML='';this.win.focus();this.win.stop(true);};

/*** client/inc/object_ext.js ***/

function objConcat(obj1,obj2){for(var i in obj2){switch(typeof obj2[i]){case'object':break;case'function':break;default:obj1[i]=obj2[i];}}
for(var i in obj2.prototype)
obj1.prototype[i]=obj2.prototype[i];return obj1;};Function.prototype.swiss=function(parent){if(arguments.length==1){for(var i in parent.prototype)
this.prototype[i]=parent.prototype[i]}
for(var i=1;i<arguments.length;i+=1){var name=arguments[i];this.prototype[name]=parent.prototype[name];}
return this;};Function.prototype.inherit=function(parent){var d=0,p=(this.prototype=new parent());this.prototype.__uber=function(name){var f,r,t=d,v=parent.prototype;if(t){while(t){v=v.constructor.prototype;t-=1;}
f=v[name];}
else{f=p[name];if(f==this[name]){f=v[name];}}
d+=1;r=f.apply(this,Array.prototype.slice.apply(arguments,[1]));d-=1;return r;};return this;};function cloneClass(obj){var x=obj.toString();var args=x.slice(x.indexOf('(')+1,x.indexOf(')')),body=x.slice(x.indexOf('{')+1,x.lastIndexOf('}'));pubEval('clon = function('+args+'){'+body+'};');for(var i in obj){switch(typeof obj[i]){case'object':break;case'function':break;default:clon[i]=obj[i];}}
for(var i in obj.prototype)
clon.prototype[i]=obj.prototype[i];return clon;};function inherits(main){for(var ii=1;ii<arguments.length;ii++){obj=arguments[ii];for(var i in obj){switch(typeof obj[i]){case'object':break;case'function':break;default:main[i]=obj[i];}}
for(var i in obj.prototype)
main[i]=obj.prototype[i];}};function clone(obj,deep){if(typeof(obj)!='object')return obj;var objectClone=new obj.constructor();for(var property in obj){if(!deep)
objectClone[property]=obj[property];else
if(typeof obj[property]=='object')
objectClone[property]=clone(obj[property],deep);else
objectClone[property]=obj[property];}
return objectClone;};function compareObj(aold,anew,keepOld){var a2=anew;var a1=keepOld?clone(aold,true):aold;if(typeof a1=='undefined')
if(typeof a2=='undefined')
return true;else
return false;if(typeof a2=='undefined'||a1.constructor!==a2.constructor)return false;if(typeof a1!='object')
if(a1==a2)
return true;else
return false;var t;for(var i in a2){if(typeof a1[i]=='undefined')
if(typeof a2[i]=='undefined')
return true;else
return false;t=typeof a2[i];if(t!=typeof a1[i])return false;if(t=='object'){if(!compareObj(a1[i],a2[i],keepOld))return false;}
else
if(a1[i]!=a2[i])return false;delete a1[i];}
for(var i in a1)return false;return true;};function compareObj(aold,anew,keepOld){var a1=keepOld?clone(aold,true):aold;var a2=anew;if(typeof a1=='undefined')
if(typeof a2=='undefined')
return true;else
return false;if(typeof a2=='undefined'||a1.constructor!==a2.constructor)return false;if(typeof a1!='object')
if(a1==a2)
return true;else
return false;var t;for(var i in a2){if(typeof a1[i]=='undefined')
if(typeof a2[i]=='undefined')
return true;else
return false;t=typeof a2[i];if(t!=typeof a1[i])return false;if(t=='object'){if(!compareObj(a1[i],a2[i],keepOld))return false;}
else
if(a1[i]!=a2[i])return false;delete a1[i];}
for(var i in a1)return false;return true;};

/*** client/inc/browser_ext.js ***/

function emulateEventHandlers(eventNames){for(var i=0;i<eventNames.length;i++){document.addEventListener(eventNames[i],function(e){window.event=e;},true);}};typeof(window.event)=="object"?"":emulateEventHandlers(["mousemove","mousedown","mouseover"]);function downloadItem(path){if(currentBrowser().indexOf('MSIE')==0){var win=window.open('server/download.php?'+path,"file","directories=no,location=yes,toolbar=yes,status=yes,menubar=yes,resizable=yes,width=200,height=200");win.document.onload=function(){window.close();};return;}
var id='ifrm_download_'+unique_id(),frm=mkElement('iframe',{id:id,src:'server/download.php?'+path});frm.style.position='absolute';frm.style.width='1';frm.style.height='1';frm.style.top='0';frm.style.left='-1000';document.getElementsByTagName('body')[0].appendChild(frm);setTimeout("try{ var elm; if ((elm = document.getElementById('"+id+"'))) elm.parentNode.removeChild(elm); }catch(r){}",5000);frm=null;};function unique_id(){return(Math.random()*1000000000000000000)+''+(new Date).getTime();};Math.ceilFloat=function(num,n){n=this.pow(10,parseInt(n))||1;return this.ceil(parseFloat(num)*n)/n;};Math.rand=function(n){n=n||10000000000000000;return(this.floor(this.random()*n+1));};_me=cMaxZIndex.prototype;function cMaxZIndex(){this.zindex=[500];};_me.get=function(b){var z=this.zindex[this.zindex.length-1]+1;if(!b)this.zindex.push(z);return z;};_me.remove=function(z){var pos=inArray(this.zindex,z);if(pos>-1)this.zindex.splice(pos,1);};maxZIndex=new cMaxZIndex();function setSelectAll(eElement){try{eElement.style.setProperty('MozUserSelect','all','');eElement.style.setProperty('-moz-user-select','all','');}
catch(e){}
try{eElement.unselectable="off";}catch(e){};try{eElement.style.KhtmlUserSelect="";}catch(e){}
try{eElement.style.WebkitUserSelect="auto";}catch(e){}};function setSelectNone(eElement){try{eElement.style.setProperty('MozUserSelect','none','');eElement.style.setProperty('-moz-user-select','none','');}
catch(e){}
try{eElement.unselectable="on";}catch(e){};try{eElement.style.KhtmlUserSelect="none";}catch(e){}
try{eElement.style.WebkitUserSelect="none";}catch(e){}};function pubEval(val){if(!val)return false;var nav=navigator.userAgent.toLowerCase();try{if(typeof window.execScript=='object')
window.execScript(val);else{var tmp;if(currentBrowser()=='Safari'||currentBrowser()=='KHTML'){window.tmp_codeEval=val;var script_tag=document.createElement('script');script_tag.type='text/javascript';script_tag.innerHTML='eval(window.tmp_codeEval); window.tmp_codeEval = "";';document.getElementsByTagName('head')[0].appendChild(script_tag);script_tag.parentNode.removeChild(script_tag);}
else{window.eval(val);}}}
catch(e){throw new Error("pubEval() - unable to Eval: \r\n"+val);return false;}};function searchParent(me,eParent){if(Is.String(eParent)){eParent=eParent.toUpperCase();for(;;){me=me.parentNode;switch(me.tagName){case eParent:return me;case'BODY':return false;}}}
else{for(;;){try{me=me.parentNode;if(me.tagName=='BODY')return false;if(me==eParent)return eParent;}
catch(e){return false;}}}};function mkElement(tElm,eatt){var elm=document.createElement(tElm);if(typeof eatt=='object'){for(var i in eatt){try{if(i.indexOf('on')==0){elm[i]=function(){eval(eatt[i]);};}else{switch(i){case'href':elm[i]=eatt[i]?eatt[i]:'javascript: void(0);';break;case'for':elm.setAttribute(i,eatt[i]);break;default:elm[i]=eatt[i];}}}catch(e){}}}
return elm;};function isDescendent(x,y){while((y=y.parentNode))if(y==x)return true;return false;};function addcss(elm){var out=0,css=elm.className,r;for(var a=1;a<arguments.length;a++){r=new RegExp("\\b"+arguments[a]+"\\b",'gi');css=elm.className.replace(r,'');r=null;if(css==elm.className)
out++;css+=' '+arguments[a];elm.className=css;}
return out;};function removecss(elm){if(arguments.length<2)elm.className='';var r,css=elm.className;for(var a=1;a<arguments.length;a++){if(!css||css==arguments[a]){css='';break;}
else{r=new RegExp("\\b"+arguments[a]+"\\b",'gi');css=css.replace(r,'');r=null;}}
elm.className=css;};function getSize(elm,doc){var doc=(doc||document),r={x:0,y:0,h:elm.offsetHeight,w:elm.offsetWidth};if(currentBrowser=='Mozilla'&&elm.getBoundingClientRect){var box=elm.getBoundingClientRect(),bod=doc.getElementsByTagName('body')[0];r.x=box.left+bod.scrollLeft;r.y=box.top+bod.scrollTop;}
else
if(doc.getBoxObjectFor){var box=doc.getBoxObjectFor(elm);r.x=box.x;r.y=box.y;}
else{r.x=elm.offsetLeft;r.y=elm.offsetTop;while((elm=elm.offsetParent)){if(elm.tagName=='BODY')break;r.x+=elm.offsetLeft;r.y+=elm.offsetTop;}}
return r;};_me=_Is.prototype;function _Is(){};_me.Boolean=function(a){return typeof a=='boolean';};_me.Array=function(a){return this.Object(a)&&a.constructor==Array;};_me.Empty=function(o){var i,v;if(this.Object(o)){for(i in o){v=o[i];if(!this.Undefined(v))return false;}}
return true;};_me.Function=function(a){return typeof a=='function';};_me.Null=function(a){return typeof a=='object'&&!a;};_me.Number=function(a){return typeof a=='number'&&isFinite(a);};_me.Object=function(a){return(a&&typeof a=='object')||this.Function(a);};_me.String=function(a){return typeof a=='string';};_me.Email=function(a){if(!this.String(a))return false;return/^([a-z0-9][\\-\\_\\.]?)*[a-z0-9]+\\@[a-z0-9]+([\\.\\-\\_]?[a-z0-9])*\\.[a-z]{2,4}$/gim.test(a);};_me.Domain=function(a){if(!this.String(a))return false;return/^([a-z0-9][\\-\\_\\.]?)*\\.[a-z]{2,4}$/gim.test(a);};_me.Undefined=function(a){return typeof a=='undefined';};_me.Defined=function(x){return typeof(x)!="undefined";};_me.Date=function(nYear,nMonth,nDay){var arMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);var intMaxDay=0;var nnYear=parseInt(nYear);var nnMonth=parseInt(nMonth);var nnDay=parseInt(nDay);if(!this.Number(nnYear)||!this.Number(nnMonth)||!this.Number(nnDay))return false;if((nnYear%4==0&&nnYear%100!=0)||nnYear%400==0)
arMonth[1]=29;else
arMonth[1]=28;intMaxDay=arMonth[nnMonth-1];if(nnYear<0)return false;if(nnMonth>12||nnMonth<1)return false;if(nnDay>intMaxDay||nnDay<1)return false;return true;};Is=new _Is();String.prototype.entityify=function(){return this.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/\'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};String.prototype.unentityify=function(){return this.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&#039;/g,"\'").replace(/&quot;/g,"\"").replace(/&amp;/g,"&");};String.prototype.escapeHTML=function(){var div=document.createElement('div');div.appendChild(document.createTextNode(this));if(currentBrowser()=='Safari'||currentBrowser()=='KHTML')
return div.innerHTML.replace(/>/gm,'&gt;');else
return div.innerHTML;};String.prototype.unescapeHTML=function(){if(this.indexOf('&')<0)return this.toString();var div=document.createElement('div');div.innerHTML=this.toString();return div.childNodes[0].nodeValue;};String.prototype.quote=function(){var c,i,l=this.length,o='"';for(i=0;i<l;i+=1){c=this.charAt(i);if(c>=' '){if(c=='\\'||c=='"')o+='\\';o+=c;}
else{switch(c){case'\b':o+='\\b';break;case'\f':o+='\\f';break;case'\n':o+='\\n';break;case'\r':o+='\\r';break;case'\t':o+='\\t';break;default:c=c.charCodeAt().toString(16);if(c.length==1){o+='\\u000'+c;}else{o+='\\u00'+c;}}}}
return o+'"';};String.prototype.trim=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");};String.prototype.remove=function(sRegExp,sOption){var regEx;if(Is.String(sRegExp))
regEx=new RegExp(sRegExp,(typeof sOption!="undefined")?sOption:"g");else
regEx=sRegExp;return this.replace(regEx,"");};String.prototype.removeTags=function(str){return this.replace(/<[\/]?([a-zA-Z0-9]+)[^>^<]*>/gm,str||'');};String.prototype.quoteSQL=function(){return this.replace(/([\'\\])/g,"$1$1").replace(/([%])/g,"\\$1");};String.prototype.quoteMeta=function(){return this.replace(/([\!\#\$\%\^\@\.\&\*\(\)\-\_\=\+\:\;\"\'\\\/\?\<\>\~\[\]\{\}\`])/g,"\\$1");};Date.prototype.toWMString=function(bDateOnly,bTimeOnly){var regEx=/^(\d{1})$/g;with(this){var full='';if(!bTimeOnly){var year=getFullYear().toString();var month=(getMonth()+1).toString().replace(regEx,'0$1');var day=getDate().toString().replace(regEx,'0$1');storage.library('gw_others');switch(parseInt(GWOthers.getItem('LAYOUT_SETTINGS','date_format'))){default:case 0:full=month+'/'+day+'/'+year.substr(2);break;case 1:full=month+'/'+day+'/'+year;break;case 2:full=day+'-'+month+'-'+year;break;case 3:full=day+'/'+month+'/'+year;break;case 4:full=year+'-'+month+'-'+day;break;}}
if(bDateOnly)
return full;else
return full+' '+getHours().toString().replace(regEx,'0$1')
+':'+
getMinutes().toString().replace(regEx,'0$1');}};Date.prototype.getUNIX=function(){return Math.floor(this.getTime()/1000);};Date.prototype.setUNIX=function(iSec){return this.setTime(iSec*1000);};Date.prototype.setGWTime=function(iDate,iTime){this.setQTime(iDate,iTime?iTime*60:0);};Date.prototype.setQTime=function(iDate,iTime){if(typeof iTime=='undefined'||isNaN(iTime)||iTime==-1)
iTime=0;var hours,mins,secs;with(Math){hours=floor(iTime/3600);mins=floor((iTime%3600)/60);secs=(iTime%3600)%60;}
var oDate=parseJulianDate(iDate);this.setFullYear(oDate.year,oDate.month-1,oDate.day);this.setHours(hours,mins,secs,0);};Date.prototype.setVersit=function(iDate){var x=/([0-9]{4})([0-9]{2})([0-9]{2})(T([0-9]{2})([0-9]{2})([0-9]{2})(Z)?)?/g;var r=x.exec(iDate);if(!r)
r=x.exec(iDate);x=null;if(r){this[r[8]?'setUTCFullYear':'setFullYear'](r[1]*1,(r[2]*1)-1,r[3]*1);r[5]=r[5]||0;r[6]=r[6]||0;r[7]=r[7]||0;this[r[8]?'setUTCHours':'setHours'](r[5]*1,r[6]*1,r[7]*1);}};Date.prototype.getJulianDate=function(){return getJulianDate(this.getDate(),this.getMonth()+1,this.getFullYear());};Date.prototype.getWeekOfYear=function(){var juldate=this.getJulianDate();var new_year=new Date(this.getFullYear(),0,1);var diff=juldate-new_year.getJulianDate();diff+=new_year.getDay();return Math.floor(diff/7)+1;};function getJulianDate(day,month,year){var greg,julian,sign,absm,jul;with(Math){if(year<=1585)
greg=0;else
greg=1;if((month-9)<0)
sign=-1;else
sign=1;julian=-1*floor(7*(floor((month+9)/12)+year)/4);absm=abs(month-9);jul=floor(year+sign*floor(absm/7));jul=-1*floor((floor(jul/100)+1)*3/4);julian=julian+floor(275*month/9)+day+(greg*jul);julian=julian+1721027+2*greg+367*year;}
return julian;};function parseJulianDate(julian){var juli,base1,base2,year,month,day;var date=new Object();with(Math){juli=floor(julian);base1=floor(juli+68569);base2=floor(4*base1/146097);base1=base1-floor((146097*base2+3)/4);year=floor(4000*(base1+1)/1461001);base1=base1-floor(1461*year/4)+31;month=floor(80*base1/2447);day=base1-floor(2447*month/80);base1=floor(month/11);month=month+2-12*base1;year=100*(base2-49)+year+base1;}
date.day=day;date.month=month;date.year=year;return date;};function parseJulianTime(iTime){var minute=Math.ceil(iTime%3600/60);minute=minute<10?'0'+minute:minute;return(iTime-iTime%3600)/3600+':'+minute;};var dateFormat=function(){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTtn])\1?|[LloZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(value,length){value=String(value);length=parseInt(length)||2;while(value.length<length)
value="0"+value;return value;};return function(date,mask){if(arguments.length==1&&(typeof date=="string"||date instanceof String)&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date();if(isNaN(date))
throw"invalid date";var dF=dateFormat;mask=String(dF.masks[mask]||mask||dF.masks["default"]);var d=date.getDate(),D=date.getDay(),m=date.getMonth(),y=date.getFullYear(),H=date.getHours(),M=date.getMinutes(),s=date.getSeconds(),L=date.getMilliseconds(),o=date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),n:M,nn:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4)};return mask.replace(token,function($0){return($0 in flags)?flags[$0]:$0.slice(1,$0.length-1);});};}();dateFormat.masks={"default":"ddd mmm d yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoFullDateTime:"yyyy-mm-dd'T'HH:MM:ss.lo"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thr","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(mask){return dateFormat(this,mask);}
function arrayKeys(arr){var keys=new Array();for(var i in arr)
if(arr[i]!=null)
keys.push(i);return keys;};function inArray(aArray,sElm)
{for(var i in aArray)
if(aArray[i]==sElm)return i;return-1;};function reverse(oObj){if(oObj.constructor==Array)
return oObj.reverse();var key=[],oOut={};for(var i in oObj)
key.push(i);key.reverse();for(var i in key)
oOut[key[i]]=oObj[key[i]];return oOut;};function arrConcat(){main={};for(var a=0;a<arguments.length;a++)
for(var i in arguments[a])main[i]=arguments[a][i];return main;};function arrConcatValues(){main=clone(arguments[0]);for(var a=1;a<arguments.length;a++)
for(var i in arguments[a])
if(inArray(main,arguments[a][i])<0)
main.push(arguments[a][i]);return main;};function mkArrayPath(keys,arr){var logic;if(typeof arr!='object')arr=[];var out=arr;for(var i in keys){if(typeof arr[keys[i]]!='object')arr[keys[i]]=[];arr=arr[keys[i]];}
return out;};function arraySearch(aArray,sNeedle,bCase){var sFlag='g',aOut=[];if(bCase)sFlag='gi';if(!Is.Array(aArray)||!Is.String(sNeedle))return aOut;var rRe=new RegExp(sNeedle.quoteMeta(),sFlag);for(var i in aArray)
if(aArray[i].match&&aArray[i].match(rRe))aOut.push(aArray[i]);return aOut;};function substract(main){if(arguments.length<2)return main;var a,n;for(var ii=1;ii<arguments.length;ii++){a=arguments[ii];for(var i in a)
if((n=inArray(main,a[i]))!=-1)delete main[n];}
return main;};function getFreeKey(arr){for(var i=0;i<=arr.length;i++)
if(typeof arr[i]=='undefined')
return i;};function arrKeySlice(arr1,arr2){var k,isa=false,out=[];if(arr2.constructor==Array)isa=true;if(!arr1||!arr2)return isa?out:compact(arr2);for(var i in arr2){if(isa)
k=arr2[i]
else
k=i;if(!isa&&!arr1[k]&&arr2[k])
out[k]=arr2[k];else if(typeof arr1[k]!='undefined')
out[k]=arr1[k];}
return out;};function compact(a){var b;if(Is.Array(a)){b=[];for(var i in a)
if(a[i])b.push(a[i]);}
else{b={};for(var i in a)
if(a[i])b[i]=a[i];}
return b;};function count(arr){var i=0;if(typeof arr=='object'){for(var v in arr)i++;return i;}
return-1;};function arrayCompare(arr1,arr2){var length=0;for(var key in arr1){if(arr1[key]!=arr2[key]){return false;}
length++;}
if(count(arr2)==length)
return true;else
return false;};function buildURL(varList){var separator='';var url='';for(var name in varList){url+=separator+encodeURIComponent(name)
+'='+encodeURIComponent(varList[name]);separator='&';}
return url;};function parseURL(url){var p,r,output=[];if(!url)url=self.location.href;if((p=url.indexOf('?'))>-1&&(p<url.indexOf('=')))url=url.substr(p+1);argList=url.split('&');for(var i=0;i<argList.length;i++){newArg=argList[i].split('=');output[unescape(newArg[0])]=unescape(newArg[1]);}
return output;};_me=cCookieManager.prototype;function cCookieManager(){}
_me.set=function(sName,aValue,iDays){var sExpires="";var dDate=new Date();var storage=null;try{if(window.localStorage)
storage=window.localStorage;else
if(window.globalStorage)
storage=window.globalStorage[document.location.hostname];}
catch(r){}
if(storage){var aData={};if(storage['cookie'])
try{aData=JSON.parse(storage['cookie'].toString());}
catch(r){}
if(aValue)
aData[sName]=aValue;else
delete aData[sName];storage['cookie']=JSON.stringify(aData);return true;}
else
if(!Is.Defined(document.cookie))
return false;if(iDays){if(iDays>0){dDate.setTime(dDate.getTime()+(iDays*86400000));sExpires="; expires="+dDate.toGMTString();}
else
sExpires="; expires=-1";}
if(typeof aValue=='string'||typeof aValue=='number')aValue=[aValue];document.cookie=sName+"="+buildURL(aValue)+sExpires+";";return true;};_me.get=function(sName){try{if(window.localStorage)
return JSON.parse(window.localStorage['cookie'].toString())[sName];else
if(window.globalStorage)
return JSON.parse(window.globalStorage[document.location.hostname]['cookie'].toString())[sName];else
if(!document.cookie)
return[];}
catch(r){return[];}
var sSeek=sName+"=";var sCookie="";var aCookie=document.cookie.split(";");var sCookieValue;for(var i in aCookie){sCookie=aCookie[i].trim();if(sCookie.indexOf(sSeek)!=0)continue;sCookieValue=sCookie.substring(sSeek.length);if(sCookieValue)
return parseURL(sCookie.substring(sSeek.length));else
return[];}
return null;};var cookieManager=new cCookieManager();function pushParameterToCallback(aResponse,arg){if(Is.Function(aResponse[0])){if(Is.Array(aResponse[1]))
aResponse[1].push(arg);else
aResponse[1]=[arg];}
else
if(Is.Object(aResponse[0])){if(Is.Array(aResponse[2]))
aResponse[2].push(arg);else
aResponse[2]=[arg];}
else
throw Exception('Invalid argument');};function getCallbackFunction(aResponse){if(Is.Function(aResponse[0]))
return aResponse[0];else
if(Is.Function(aResponse[1]))
return aResponse[1];else
return aResponse[0][aResponse[1]];};function executeCallbackFunction(aResponse)
{if(Is.Array(aResponse)&&((Is.Object(aResponse[0])&&(Is.String(aResponse[1])||Is.Function(aResponse[1])))||Is.Function(aResponse[0])))
try
{var nIndex;if(Is.Function(aResponse[0]))
nIndex=1;else
nIndex=2;var args=[];for(var i=1;i<arguments.length;i++)
args.push(arguments[i]);if(Is.Array(aResponse[nIndex]))
args=args.concat(aResponse[nIndex]);if(nIndex==1)
aResponse[0].apply(null,args);else
if(Is.Function(aResponse[1]))
aResponse[1].apply(aResponse[0],args);else{aResponse[0][aResponse[1]].apply(aResponse[0],args);if(aResponse[0]._destructed==true)
return false;}
return true;}
catch(e){inspect2(e);if(Is.String(aResponse[0]))
throw new Error("Error while executing "+aResponse[0]+"() in browser_ext:executeCallbackFunction()");else
throw new Error("Error while executing oObject."+aResponse[1]+"() in browser_ext:executeCallbackFunction()");return false;}
else
return false;};function getPrimaryAccountFromAddress(){var aAccInfo=dataSet.get('accounts',[sPrimaryAccount]);if(aAccInfo['FULLNAME'])
return'"'+aAccInfo['FULLNAME']+'" <'+sPrimaryAccount+'>';else
return sPrimaryAccount;}
function getSubobjects(oObject){function _getSubobjects(oObject,aObjects){for(var i in oObject){if(i.charAt(0)!='_'&&i.substr(0,2)!='X_'&&i.substr(0,2)!='x_'){if(oObject[i]._type=='obj_tabs'||oObject[i]._type=='obj_tab'){_getSubobjects(oObject[i],aObjects);}else{aObjects[i]=oObject[i];}}}}
var aObjects={};_getSubobjects(oObject,aObjects);return aObjects;};function getAuxiliarySubobjects(oObject){function _getAuxiliarySubobjects(oObject,aObjects){for(var i in oObject){if(i.charAt(0)!='_'){if(i.substr(0,2)=='X_'||i.substr(0,2)=='x_'){aObjects[i]=oObject[i];}else if(oObject[i]._type=='obj_tabs'||oObject[i]._type=='obj_tab'){_getAuxiliarySubobjects(oObject[i],aObjects);}}}}
var aObjects={};_getAuxiliarySubobjects(oObject,aObjects);return aObjects;};function loadDataIntoForm(oObject,aValues){var aObjects=getSubobjects(oObject);for(var i in aObjects){if(Is.Defined(aValues[i])&&aValues[i]!='undefined'){aObjects[i]._value(aValues[i]);}}}
function loadDataIntoFormOnAccess(oObject,aValues,bIgnoreDomain){var aObjects=getSubobjects(oObject,aObjects);if(aValues['USERACCESS']||aValues['DOMAINADMINACCESS'])
var aAuxiliaryObjects=getAuxiliarySubobjects(oObject);for(var i in aObjects){if(aValues['ACCESS'][i]){switch(aValues['ACCESS'][i]){case'full':aObjects[i]._value(aValues['VALUES'][i]);break;case'view':aObjects[i]._value(aValues['VALUES'][i]);aObjects[i]._disabled(true);break;case'none':aObjects[i]._main.parentNode.style.display="none";}}
if(aValues['DOMAINADMINACCESS']&&!bIgnoreDomain){if(aAuxiliaryObjects['x_'+i+'_set']){aAuxiliaryObjects['x_'+i+'_set'].domadmin._value((aValues['DOMAINADMINACCESS'][i]=='view')?true:false);if(aValues['ACCESS'][i]=='view')
aAuxiliaryObjects['x_'+i+'_set'].domadmin._disabled(true);}}
if(aValues['USERACCESS']){if(aAuxiliaryObjects['x_'+i+'_set']){aAuxiliaryObjects['x_'+i+'_set'].user._value((aValues['USERACCESS'][i]=='view')?true:false);if(aValues['ACCESS'][i]=='view')
aAuxiliaryObjects['x_'+i+'_set'].user._disabled(true);}}}};function storeDataFromFormWithAccess(oObject,aValues,aAccess){var aObjects=getSubobjects(oObject);var aAuxiliaryObjects=getAuxiliarySubobjects(oObject);var value;for(var i in aObjects){if(Is.Defined((value=aObjects[i]._value())))
aValues[i]=value;else
aValues[i]='';if(aAuxiliaryObjects['x_'+i+'_set']&&aAuxiliaryObjects['x_'+i+'_set'].domadmin){if(!aAccess['DOMAINADMINACCESS'])aAccess['DOMAINADMINACCESS']={};aAccess['DOMAINADMINACCESS'][i]=aAuxiliaryObjects['x_'+i+'_set'].domadmin._value()?'view':'full';}
if(aAuxiliaryObjects['x_'+i+'_set']){if(!aAccess['USERACCESS'])aAccess['USERACCESS']={};aAccess['USERACCESS'][i]=aAuxiliaryObjects['x_'+i+'_set'].user._value()?'view':'full';}}};function storeDataFromForm(oObject,aValues){var aObjects=getSubobjects(oObject);var value;for(var i in aObjects){if(Is.Defined((value=aObjects[i]._value())))
aValues[i]=value;else
aValues[i]='';}};function firstIndex(oObject){if(Is.Object(oObject)){for(var i in oObject)
return i;return null;}
else
return null;}
function firstValue(oObject){if(Is.Object(oObject)){for(var i in oObject)
return oObject[i];return null;}
else
return null;}
function shiftObject(oObject){if(Is.Object(oObject)){for(var i in oObject){var result=oObject[i];delete oObject[i];return result;}
return null;}
else
return null;}
function isFormEmpty(aValues){for(var i in aValues){if(Is.Object(aValues[i])){if(!isFormEmpty(aValues[i]))return false;}
else
if(aValues[i]!='')return false;}
return true;}
function translateFolder(sFolder){var sSpecialName;if((sSpecialName=getSpecialFolderName(sFolder)))
return getLang(sSpecialName);else
return sFolder;}
function getSpecialFolderName(sFolder){if(inArray(['Drafts','INBOX','Sent','Trash','SPAM_QUEUE','Spam','Events','Tasks','Notes','Contacts','Files','Journal'],sFolder)>=0)
return'COMMON_FOLDERS::'+sFolder.toUpperCase();else
return'';}
_me=cColors.prototype;function cColors(){this.hexchars="0123456789ABCDEF";};_me.rgb2hsv=function(r,g,b){var R=r/255;var G=g/255;var B=b/255;var iMin=Math.min(R,G,B);var iMax=Math.max(R,G,B);var dMax=iMax-iMin;var H,S,V=iMax;if(dMax==0){H=0;S=0;}
else{S=dMax/iMax;var dR=(((iMax-R)/6)+(dMax/2))/dMax;var dG=(((iMax-G)/6)+(dMax/2))/dMax;var dB=(((iMax-B)/6)+(dMax/2))/dMax;if(R==iMax)H=dB-dG;else
if(G==iMax)H=(1/3)+dR-dB;else
if(B==iMax)H=(2/3)+dG-dR;if(H<0)H+=1;if(H>1)H-=1;}
return[H*255,S*255,V*255];};_me.rgb2hsl=function(r,g,b){var R=r/255;var G=g/255;var B=b/255;var iMin=Math.min(R,G,B);var iMax=Math.max(R,G,B);var dMax=iMax-iMin;var H,S,L=(iMax+iMin)/2;if(dMax==0){H=0;S=0;}
else{if(L<0.5)
S=dMax/(iMax+iMin);else
S=dMax/(2-iMax-iMin);var dR=(((iMax-R)/6)+(dMax/2))/dMax;var dG=(((iMax-G)/6)+(dMax/2))/dMax;var dB=(((iMax-B)/6)+(dMax/2))/dMax;if(R==iMax)
H=dB-dG;else
if(G==iMax)
H=(1/3)+dR-dB;else
if(B==iMax)
H=(2/3)+dG-dR;if(H<0)H+=1;if(H>1)H-=1;}
return[Math.ceil(H*255),Math.ceil(S*255),Math.ceil(L*255)];};_me.isValidRGB=function(aRGB){if((!aRGB[0]&&aRGB[0]!=0)||isNaN(aRGB[0])||aRGB[0]<0||aRGB[0]>255||(!aRGB[1]&&aRGB[1]!=0)||isNaN(aRGB[1])||aRGB[1]<0||aRGB[1]>255||(!aRGB[2]&&aRGB[2]!=0)||isNaN(aRGB[2])||aRGB[2]<0||aRGB[2]>255)return false;return true;};_me.hex2rgb=function(str){str=str.replace('#','');return[(this.toDec(str.substr(0,1))*16)+this.toDec(str.substr(1,1)),(this.toDec(str.substr(2,1))*16)+this.toDec(str.substr(3,1)),(this.toDec(str.substr(4,1))*16)+this.toDec(str.substr(5,1))];return rgb;};_me.toDec=function(hexchar){return this.hexchars.indexOf(hexchar.toUpperCase());};_me.rgb2hex=function(r,g,b){return this.toHex(r)+this.toHex(g)+this.toHex(b);};_me.toHex=function(n){n=n||0;n=parseInt(n,10);if(isNaN(n))n=0;n=Math.round(Math.min(Math.max(0,n),255));return this.hexchars.charAt((n-n%16)/16)+this.hexchars.charAt(n%16);};colors=new cColors();function getActualEventTime(){var now=new Date();var julian=now.getJulianDate();var time=now.getHours()*60+now.getMinutes();time-=time%30;return{'EVNSTARTDATE':julian,'EVNSTARTTIME':time,'EVNENDDATE':julian,'EVNENDTIME':time+30};};function arrToString(arr){if(arr===null)
return'null';switch(typeof arr){case'string':return"'"+arr+"'";case'number':return arr;case'object':var aResult=['{'],bEnd;for(var sKey in arr){if(bEnd)
aResult.push(',');aResult.push("'"+sKey+"'",':',arrToString(arr[sKey]));bEnd=true;}
aResult.push('}');return aResult.join('');case'undefined':return'undefined';}};function valuesToString(arr){var sResult='';for(var n in arr)
sResult+=arr[n]+'|';return sResult.substr(0,sResult.length-1);};function MailAddress(){}
MailAddress.createEmail=function(name,email){var out='';if(name){name=name.replace('"','\\"').trim();out=(name.indexOf(' ')>-1||name.indexOf(',')>-1?'"'+name+'"':name);}
if(email){if(out)out+=' ';out+='<'+email+'>';}
return out;};MailAddress.splitEmails=function(sMails){if(!sMails)return[];return MailAddress.parseMail(sMails,'address_array');};MailAddress.splitEmailsAndNames=function(sMails){if(!sMails)return[];return MailAddress.parseMail(sMails,'name_and_email');};MailAddress.parseMail=function(sMails,sFormat){if(!sMails)return'';function getAddresses(sMails,sFormat){function nextDelimiter(sString,nIndex,items){var result=[];if(!items)
items=new Array('\\','"',',',';','<');result[0]=-1;for(var i in items){ind=sString.indexOf(items[i],nIndex);if(ind!=-1&&(result[0]==-1||ind<result[0])){result[0]=ind;result[1]=items[i];}}
return result;}
function getString(sString,nIndex,cDelimiter,bStripDelimiter){var str='';var ind=nIndex+1;var result=[];var aInd;while(1){aInd=nextDelimiter(sString,ind);if(aInd[0]==-1){str+=sString.substr(ind);ind=-1;break;}
if(aInd[1]==cDelimiter){str+=sString.substring(ind,aInd[0]);ind=aInd[0]+1;break;}
else
if(aInd[1]=='\\'){str+=sString.substring(ind,aInd[0])+(bStripDelimiter?'':'\\')+sString.charAt(aInd[0]+1);ind=aInd[0]+2;}
else{str+=sString.substring(ind,aInd[0])+aInd[1];ind=aInd[0]+1;}}
result[0]=ind;result[1]=str.trim();return result;}
function getStringTillDelimiter(sString,nIndex,bStripDelimiter)
{var str='';var ind=nIndex;var result=[];var aInd;while(1){aInd=nextDelimiter(sString,ind);if(aInd[0]==-1){str+=sString.substr(ind);ind=-1;break;}
if(aInd[1]==','||aInd[1]==';'){str+=sString.substring(ind,aInd[0]);ind=aInd[0]+1;break;}
else if(aInd[1]=='\\'){str+=sString.substring(ind,aInd[0])+(bStripDelimiter?'':'\\')+sString.charAt(aInd[0]+1);ind=aInd[0]+2;}
else if(aInd[1]=='\''||aInd[1]=='"'){var aString=getString(sString,aInd[0],aInd[1],bStripDelimiter);if(aString[0]==-1){str+=aInd[1]+aString[1];ind=-1;break;}
else{str+=aInd[1]+aString[1]+aInd[1];ind=aString[0];}}
else{str+=sString.substring(ind,aInd[0])+aInd[1];ind=aInd[0]+1;}}
result[0]=ind;result[1]=str.trim();return result;}
function stripEmailBrackets(sEmail){var nStart=0;var nEnd=sEmail.length;if(sEmail.charAt(0)=='<')
nStart++;if(sEmail.charAt(nEnd-1)=='>')
nEnd--;return sEmail.substring(nStart,nEnd);}
function parseNameAndEmail(sMails){var sTmp='';var aResult=[];var aItem=[];var nIndex=0;var aDelimiter=nextDelimiter(sMails,0);var aString;while(1){if(aDelimiter[0]==-1){sTmp+=sMails.substr(nIndex);aItem['name']='';aItem['email']=sTmp.trim();aResult.push(aItem);break;}
if(aDelimiter[1]=='\''||aDelimiter[1]=='"'){aString=getString(sMails,aDelimiter[0],aDelimiter[1],true);if(aString[0]==-1){aItem['name']='';aItem['email']=aString[1];aResult.push(aItem);break;}
else{aItem['name']=aString[1];aString=getStringTillDelimiter(sMails,aString[0],true);aItem['email']=aString[1];aResult.push(aItem);aItem=[];if(aString[0]==-1)
break;else
nIndex=aString[0];}}
else
if(aDelimiter[1]=='\\'){sTmp+=sMails.substring(nIndex,aDelimiter[0])+sMails.charAt(aDelimiter[0]+1);nIndex=aDelimiter[0]+2;}
else
if(aDelimiter[1]=='<'){aString=getStringTillDelimiter(sMails,aDelimiter[0],true);sTmp+=sMails.substring(nIndex,aDelimiter[0]);aItem['name']=sTmp.trim();aItem['email']=aString[1];aResult.push(aItem);if(aString[0]==-1)
break;aItem=[];sTmp='';nIndex=aString[0];}
else
if(aDelimiter[1]==','||aDelimiter[1]==';'){sTmp+=sMails.substring(nIndex,aDelimiter[0]);aItem['name']='';aItem['email']=sTmp.trim();aResult.push(aItem);aItem=[];nIndex=aDelimiter[0]+1;sTmp='';}
else{str+=sMails.substring(nIndex,aDelimiter[0]);ind=aDelimiter[0]+1;}
aDelimiter=nextDelimiter(sMails,nIndex);}
return aResult;}
function parseAddresses(sMails){var aResult=[];var nIndex=0;var aString;while(1){aString=getStringTillDelimiter(sMails,nIndex,false);if(aString[1])aResult.push(aString[1]);if(aString[0]==-1)
break;else
nIndex=aString[0];}
return aResult;}
var aMails;switch(sFormat){case'name_list':aMails=parseNameAndEmail(sMails);for(var n in aMails)
if(aMails[n]['name'])
aMails[n]=aMails[n]['name'].entityify();else
aMails[n]=aMails[n]['email'].entityify();return aMails.join(', ');case'name_and_email':aMails=parseNameAndEmail(sMails);for(var n in aMails){if(aMails[n]['name'])
aMails[n]['name']=aMails[n]['name'];if(aMails[n]['email'])
aMails[n]['email']=stripEmailBrackets(aMails[n]['email']);}
return aMails;case'address_array':return parseAddresses(sMails);}}
return getAddresses(sMails,sFormat);};MailAddress.findDistribList=function(aType)
{var aEmails,sEmail,sDistribList,aDistribList,sAccId,sFolId,aName,sName;var aResult={};var aDistrib={};for(var sType in aType)
{aResult[sType]='';if(!aType[sType])
continue;aEmails=MailAddress.splitEmails(aType[sType])
for(var n in aEmails)
{sEmail=aEmails[n];if(sEmail.charAt(0)=='['&&sEmail.charAt(sEmail.length-1)==']')
{sDistribList=sEmail.substr(1,sEmail.length-2);aDistribList=sDistribList.split('::');sAccId='';sFolId='';aName=[];switch(aDistribList.length<=3?aDistribList.length:3)
{case 3:sAccId=aDistribList.shift();case 2:sFolId=aDistribList.shift();case 1:for(var m in aDistribList)
aName.push(aDistribList[m]);sName=aName.join('::');}
if(!sAccId)
sAccId=sPrimaryAccount;if(!sFolId)
sFolId=Mapping.getDefaultFolderForGWType('C');if(!aDistrib[sAccId])
aDistrib[sAccId]={};if(!aDistrib[sAccId][sFolId])
aDistrib[sAccId][sFolId]={'to':[],'cc':[],'bcc':[]};aDistrib[sAccId][sFolId][sType].push(sName);}
else
aResult[sType]+=sEmail+',';}
aResult[sType]=aResult[sType].substr(0,aResult[sType].length-1);}
aResult['distrib']=aDistrib;return aResult;};function Path(){}
Path.split=function(sFolderPath){var aRet=[];if(!Is.String(sFolderPath)){aRet[0]='';aRet[1]='';}
else{var nIndex;if((nIndex=sFolderPath.indexOf('/'))>=0){aRet[0]=sFolderPath.substring(0,nIndex);aRet[1]=sFolderPath.substring(nIndex+1);}
else{aRet[0]=sFolderPath;aRet[1]='';}}
return aRet;};Path.basename=function(sPath){if(!Is.String(sPath))return false;return sPath.split('/').pop();};function Mapping(){}
Mapping.getDefaultFolderForGWType=function(sType){switch(sType){case'C':return'Contacts';case'L':return'Contacts';case'E':return'Events';case'J':return'Journal';case'N':return'Notes';case'T':return'Tasks';case'F':return'Files';default:throw new Error('Not implemented');return false;}};Mapping.getFormNameByGWType=function(sType){switch(sType){case'C':return'frm_contact';case'E':return'frm_event';case'N':return'frm_note';case'T':return'frm_task';case'J':return'frm_journal';case'L':return'frm_distrib';case'F':return'frm_file';default:throw new Error('Not implemented');return false;}};function toString(o){return(o==undefined||o==null)?'':o.toString();};function makeIDFromIDS(ids,i){return[ids[0],ids[1],ids[2][i]];};function makeIDSFromID(id){return[id[0],id[1],[id[2]]];};function getPathFromDataset(sDataset){var items=dataSet.get(sDataset);for(var sAccId in items)
for(var sFolId in items[sAccId])
return[sAccId,sFolId];};window.currentBrowser=function(){var out='',v='',str=navigator.userAgent.toUpperCase();if(str.indexOf('WEBKIT')>-1){out='Safari';v=parseInt(str.substr(str.indexOf('SAFARI/')+7));}
else
if(str.indexOf('KHTML')>-1)
out='KHTML';else
if(str.indexOf('GECKO')>-1)
out='Mozilla';else
if(str.indexOf('OPERA')>-1)
out='Opera';else
if(str.indexOf('MSIE 6.0')>-1)
out='MSIE6';else
if(str.indexOf('MSIE 7')>-1||str.indexOf('MSIE 8')>-1)
out='MSIE7';return function(bV){return bV?v:out;}}();

/*** client/inc/template.js ***/

_me=cTemplate.prototype;function cTemplate(){this.strict=true;};_me.tmp=function(sData,aData){return this.exe(storage.template(sData),aData);};_me.exe=function(sTpl,aData,aObj){this.sTpl=sTpl;this.aData=[];if(typeof aData=='object')
this.aData=arrConcat(storage.aStorage.language,aData);else
this.aData=storage.aStorage.language;if(typeof aData=='object')
for(var i in aData)this.aData[i]=aData[i];this.sBuffer='';if(sTpl)this.parser(sTpl);return this.sBuffer;};_me.variable=function(elm10,strict){var result='';try{if(elm10.indexOf('::')>-1){elm10=elm10.replace(/\:\:/,"['").replace(/\:\:/g,"']['");elm10+="']";}
result=eval('this.aData.'+elm10);if(typeof result=='undefined')throw true;}
catch(e){if(strict)
result='{'+elm10+'}';else
result='';}
return result;};_me.parser=function(s){var sBuffer='',i,result,part,elm10,elm11;for(;;){if((i=this.sTpl.indexOf('{'))<0)break;this.sBuffer+=this.sTpl.substring(0,i);this.sTpl=this.sTpl.substring(i);if((i=this.sTpl.indexOf('}'))==1){this.sTpl=this.sTpl.substring(2);continue;}
elm10=this.sTpl.substring(1,i);if((part=elm10.indexOf(" "))>-1){elm11=elm10.substring(part+1);elm10=elm10.substring(0,part);}
else
elm11=null;this.sTpl=this.sTpl.substring(i+1);switch(elm10){case'noptional':this.option(elm11,1);break;case'optional':this.option(elm11);break;case'dynamic':this.loop(elm11);break;case'rdynamic':this.option(elm11,1);break;case'lang':elm10=this.variable(elm11);default:this.sBuffer+=this.variable(elm10,this.strict);}}
this.sBuffer+=this.sTpl;};_me.option=function(elm11,bInvert){var b=false,p=this.part((bInvert?'n':'')+'optional');if(elm11.indexOf(' ')>-1){var a=elm11.split(' ');for(var i in a)
if(this.variable(a[i])){b=true;break;}}
else
if(this.variable(elm11))
b=true;if((!b&&!bInvert)||(b&&bInvert))
this.sTpl=this.sTpl.substr(p);};_me.loop=function(elm11,bInvert){var p=this.part((bInvert?'r':'')+'dynamic');var v=this.variable(elm11);if(typeof v!='object'){this.sTpl=this.sTpl.substr(p);return;}
if(bInvert)v=reverse(v);var segment=this.sTpl.substr(0,p);var sBuffer='',temp='';var exp1=eval("/\{"+elm11+"\:\:\\*/g"),exp2=eval("/\[ ]"+elm11+"\:\:\\*/g"),exp3=eval("/\:\:"+elm11+"\:\:\\*/g");for(var val in v){temp=segment;if(temp.indexOf('{'+elm11+'::*')>-1)temp=temp.replace(exp1,'{'+elm11+'::'+val);if(temp.indexOf(' '+elm11+'::*')>-1)temp=temp.replace(exp2,' '+elm11+'::'+val);if(temp.indexOf('::'+elm11+'::*')>-1)temp=temp.replace(exp3,'::'+elm11+'::'+val);sBuffer+=temp;}
exp1=exp2=exp3=null;this.sTpl=sBuffer+this.sTpl.substr(p);};_me.part=function(part){var tag1='{'+part;var tag2='{/'+part+'}';var i,j,skip=0,start=0;for(;;){if((i=this.sTpl.indexOf(tag2,start))<1)return;j=this.sTpl.indexOf(tag1,start);if(j>-1&&j<i){skip++;start=this.sTpl.indexOf('}',j+1);continue;}
if(skip>0){skip--;start=i+tag2.length;continue;}
this.sTpl=this.sTpl.substr(0,i)+this.sTpl.substr(i+tag2.length);return i;}};template=new cTemplate();

/*** client/inc/xmltools.js ***/

function cXMLTools(){};cXMLTools.prototype.XMLDoc=function(){try{if(document.implementation&&document.implementation.createDocument)
return document.implementation.createDocument("","",null);else
if(window.ActiveXObject){if(!this.prefix){var o,prefixes=['Msxml2.DOMDocument.3.0','MSXML.DomDocument'];for(var i=0;i<prefixes.length;i++){try{o=new ActiveXObject(prefixes[i]);this.prefix=prefixes[i];break;}
catch(ex){};}
if(!this.prefix)
throw new Error("cXMLTools.XMLDoc() - Could not find an installed XML parser");else
return o;}
else
return new ActiveXObject(this.prefix);}}
catch(ex){throw new Error("Your browser does not support XmlDocument objects");}};cXMLTools.prototype.XML2Arr=function(xInput){var aOutput=new Array();var iKey;for(var i=0;;i++){if(i==0)
var xTag=xInput.firstChild;else
if(xTag.nextSibling)
var xTag=xTag.nextSibling;else{return aOutput;}
if(!i&&!xTag.tagName)continue;var sTagname=xTag.tagName.toUpperCase();if(aOutput[sTagname]){iKey=aOutput[sTagname].length;aOutput[sTagname][iKey]=[];}
else{iKey=0;aOutput[sTagname]=[];aOutput[sTagname][iKey]=[];}
if(xTag.hasChildNodes()){if(xTag.firstChild.nodeValue)
aOutput[sTagname][iKey]['VALUE']=xTag.firstChild.nodeValue;else
aOutput[sTagname][iKey]=this.XML2Arr(xTag);}
if(xTag.attributes.length){aOutput[sTagname][iKey]['ATTRIBUTES']=[];for(var i=0;i<xTag.attributes.length;i++)
aOutput[sTagname][iKey]['ATTRIBUTES'][xTag.attributes.item(i).nodeName.toUpperCase()]=xTag.attributes.item(i).nodeValue;}}};cXMLTools.prototype.Arr2XML=function(aIn,xElm,bPreserveCase){var aInput=(xElm?aIn:clone(aIn,1));if(!xElm){this.xDoc=null;this.xDoc=this.XMLDoc();}
for(var i in aInput){for(var ii in aInput[i]){if(currentBrowser()!='Safari'&&aInput[i][ii]['ATTRIBUTES']&&aInput[i][ii]['ATTRIBUTES'].XMLNS&&this.xDoc.createElementNS){var elm=this.xDoc.createElementNS(aInput[i][ii]['ATTRIBUTES'].XMLNS,(bPreserveCase)?i:i.toLowerCase());delete aInput[i][ii]['ATTRIBUTES'].XMLNS;}
else
if(xElm&&xElm.namespaceURI&&this.xDoc.createElementNS)
var elm=this.xDoc.createElementNS(xElm.namespaceURI,(bPreserveCase)?i:i.toLowerCase());else
var elm=this.xDoc.createElement((bPreserveCase)?i:i.toLowerCase());if(aInput[i][ii]['ATTRIBUTES']){for(ai in aInput[i][ii]['ATTRIBUTES'])
elm.setAttribute((bPreserveCase)?ai:ai.toLowerCase(),aInput[i][ii]['ATTRIBUTES'][ai]);delete aInput[i][ii]['ATTRIBUTES'];}
if(typeof aInput[i][ii]['VALUE']!='undefined'){if(typeof aInput[i][ii]['VALUE']=='string'&&currentBrowser()=='Safari'&&currentBrowser(true)<526)
elm.appendChild(this.xDoc.createTextNode(aInput[i][ii]['VALUE'].escapeHTML()));else
elm.appendChild(this.xDoc.createTextNode(aInput[i][ii]['VALUE']));}
else
this.Arr2XML(aInput[i][ii],elm,bPreserveCase);if(!xElm){if(currentBrowser()=='Opera')return elm;this.xDoc.appendChild(elm);return this.xDoc;}
else
xElm.appendChild(elm);}}};cXMLTools.prototype.Str2XML=function(sInput){var xOutput=null;try{xOutput=this.XMLDoc();xOutput.async=false;xOutput.validateOnParse=false;xOutput.loadXML(sInput);if(xOutput.parseError.errorCode)
alert("Error code: "+xOutput.parseError.errorCode+"\nLine: "+xOutput.parseError.line+':'+xOutput.parseError.linePos+"\nReason: "+xOutput.parseError.reason+"\n"+xOutput.parseError.srcText);return xOutput;}
catch(e){var xParser=new DOMParser();xOutput=xParser.parseFromString(sInput,'text/xml');this.stripWhiteSpace(xOutput);return xOutput;}};cXMLTools.prototype.XML2Str=function(xInput){try{var sOut;if(xInput.xml)
sOut=xInput.xml;else
sOut=(new XMLSerializer()).serializeToString(xInput);return sOut.replace(/\&amp;/g,'&');}
catch(e){return'';}};cXMLTools.prototype.Str2Arr=function(sInput){try{return this.XML2Arr(this.Str2XML(sInput));}
catch(e){alert(e);}};cXMLTools.prototype.Arr2Str=function(aInput,bPreserveCase){try{return this.XML2Str(this.Arr2XML(aInput,null,bPreserveCase));}
catch(e){alert(e);}};cXMLTools.prototype.stripWhiteSpace=function(node){nodesToDelete=Array();this.findWhiteSpace(node,0);for(var i=nodesToDelete.length-1;i>=0;i--){nodeRef=nodesToDelete[i];nodeRef.parentNode.removeChild(nodeRef);}};cXMLTools.prototype.is_ws=function(nod){return!(/[^\t\n\r ]/.test(nod.data));};cXMLTools.prototype.findWhiteSpace=function(node,nodeNo){for(var i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeType==3&&this.is_ws(node.childNodes[i]))
nodesToDelete[nodesToDelete.length]=node.childNodes[i];if(node.childNodes[i].hasChildNodes())
this.findWhiteSpace(node.childNodes[i],i);}
node=node.parentNode;i=nodeNo;};var XMLTools=new cXMLTools();

/*** client/inc/httprequest.js ***/

function cHttpRequest(){this.sURL='server/webmail.php';this.bIE=false;this.oXMLHttp=null;if(!this.oXMLHttp){if(window.XMLHttpRequest){this.oXMLHttp=new XMLHttpRequest();this.bIE=currentBrowser().indexOf('MSIE')>-1;}
else
if(!navigator.__ice_version&&window.ActiveXObject){this.oXMLHttp=new ActiveXObject('Microsoft.XMLHTTP');this.bIE=true;}
else
throw new Error("cHTTPRequest() - Your browser does not support XMLHttpRequest objects");}};cHttpRequest.prototype.sendXML=function(xData,oResponse){var oXMLHttp=this.oXMLHttp;var bSync=(typeof oResponse=='object')?false:true;var bGET=xData?false:true;if(!bSync&&!bGET){gui._loading(true);}
oXMLHttp.open((bGET?'GET':'POST'),this.sURL,!bSync);oXMLHttp.send(xData?xData:null);xData=null;if(bSync){if(oXMLHttp.status&&oXMLHttp.status!=200&&oXMLHttp.status!=304)
throw new Error("cHTTPRequest.send() - sync - URL "+this.sURL+"\n returned: "+oXMLHttp.statusText+" ["+oXMLHttp.status+"]");return;}
var me=this;oXMLHttp.onreadystatechange=function(){try{if(oXMLHttp.readyState==4){if(oXMLHttp.status&&oXMLHttp.status!=200&&oXMLHttp.status!=304){throw"cHTTPRequest.send() - async - URL "+this.sURL+"\n returned "+oXMLHttp.statusText+" ["+oXMLHttp.status+"]";return;}
if(Is.Array(oResponse)){try{switch(oResponse[3]){case'XML':var oRData={"XML":me.responseXML()};break;case'Text':var oRData={"Text":me.responseText()};break;default:var oRData={"Array":me.responseArray()};if(oRData.Array.PARSERERROR){if(oRData.Array.PARSERERROR[0])
alert("oResponse Error: \n"+oRData.Array.PARSERERROR[0].VALUE+"\n"+me.responseText());}}}
catch(err){alert("oResponse Error: \n"+me.responseText());}
executeCallbackFunction(oResponse,oRData);}
else{try{var oRData={"Text":me.responseText(),"Array":me.responseArray()};}
catch(err){alert("Can't convert into Array: \n"+me.responseText());}
try{oResponse.prototype.responseData=oRData;oResponse.response();}
catch(e){alert("cHTTPRequest.send() -  URL "+this.sURL+"\n erron in "+oResponse.toString());}}
oRData=null;oResponse=null;if(!bGET)gui._loading();}}
catch(e){if(!bGET)gui._loading();if(Is.Array(oResponse)){executeCallbackFunction(oResponse,{"Array":{IQ:[{ATTRIBUTES:{TYPE:'error'},ERROR:[{ATTRIBUTES:{UID:'offline'},VALUE:'Connection Lost'}]}]}});oResponse=null;}}};};cHttpRequest.prototype.stripWhiteSpace=function(node){nodesToDelete=Array();this.findWhiteSpace(node,0);for(var i=nodesToDelete.length-1;i>=0;i--){nodeRef=nodesToDelete[i];nodeRef.parentNode.removeChild(nodeRef);}};cHttpRequest.prototype.is_ws=function(nod){return!(/[^\t\n\r ]/.test(nod.data));};cHttpRequest.prototype.findWhiteSpace=function(node,nodeNo){for(var i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeType==3&&this.is_ws(node.childNodes[i]))
nodesToDelete[nodesToDelete.length]=node.childNodes[i];if(node.childNodes[i].hasChildNodes())
this.findWhiteSpace(node.childNodes[i],i);}
node=node.parentNode;i=nodeNo;};cHttpRequest.prototype.sendArray=function(aData,oResponse){if(IWAPI_DEBUG)api_debug.add('send Array',aData);this.sendXML(XMLTools.Arr2XML(aData),oResponse);};cHttpRequest.prototype.sendString=function(sData,oResponse){if(IWAPI_DEBUG)api_debug.add('send String',sData);this.sendXML(XMLTools.Str2XML(sData),oResponse);};cHttpRequest.prototype.responseText=function(){var s=this.oXMLHttp.responseText;if(IWAPI_DEBUG)api_debug.add('response String',s);return s;};cHttpRequest.prototype.responseXML=function(){var xml=this.oXMLHttp.responseXML;if(!this.bIE){var child=xml.childNodes[0];if(child&&child.hasChildNodes&&child.childNodes[0].nodeType==3&&this.is_ws(child.childNodes[0]))
this.stripWhiteSpace(xml);}
return xml;};cHttpRequest.prototype.responseArray=function(){var a;try{if(this.oXMLHttp.getResponseHeader("Content-Type")=='text/json')
a=new Function("return "+this.responseText())();else
a=XMLTools.XML2Arr(this.responseXML());}
catch(e){inspect2({"ERROR XML->ARRAY":this.responseText()},1);}
if(IWAPI_DEBUG)api_debug.add('response Array',a);return a;};

/*** client/inc/dataset.js ***/

function cDataSet(){this.aDataSets={};this.aListeners={};};cDataSet.prototype.add=function(sDName,aDPath,Data,bNoUpdate,sUpdater){var bDiffer=!compareObj(this.get(sDName,aDPath),Data,true);if(Is.Array(aDPath)){this.aDataSets[sDName]=mkArrayPath(aDPath,this.aDataSets[sDName]);try{var sStr='this.aDataSets["'+sDName+'"]["'+aDPath.join('"]["')+'"]';eval(sStr+'= Data;');}
catch(e){return false;}}
else
this.aDataSets[sDName]=Data;if(bDiffer){if(!bNoUpdate)this.update(sDName,aDPath,sUpdater);return true;}
else
return false;};cDataSet.prototype.remove=function(sDName,aDPath,bNoUpdate,sUpdater){if(!aDPath)
delete this.aDataSets[sDName];else
if(Is.Array(aDPath))
try{eval('delete this.aDataSets["'+sDName+'"]["'+aDPath.join('"]["')+'"]');}
catch(e){return false;}
if(!bNoUpdate)
this.update(sDName,aDPath,sUpdater);return true;};cDataSet.prototype.get=function(sDName,aDPath){if(!sDName)return'';if(Is.Array(aDPath)){try{var sStr='this.aDataSets["'+sDName+'"]["'+aDPath.join('"]["')+'"]';var aData=eval(sStr);return aData;}
catch(e){return'';}}
else{return this.aDataSets[sDName];}};cDataSet.prototype.obey=function(oListener,sObjMethod,sDName,bNoUpdate){if(typeof oListener!='object'||!sDName)
return false;oListener[sObjMethod||'_listener']=sDName;if(!this.aListeners[sDName])this.aListeners[sDName]=[];this.aListeners[sDName].push(oListener);if(typeof this.aDataSets[sDName]!='undefined'&&!bNoUpdate)
oListener.__update(sDName);return true;};cDataSet.prototype.disobey=function(oListener,sProperty){if(!sProperty)sProperty='_listener';if(typeof oListener!='object'||!oListener[sProperty]||!this.aListeners[oListener[sProperty]])return false;var i;if((i=inArray(this.aListeners[oListener[sProperty]],oListener))!=-1)
delete this.aListeners[oListener[sProperty]][i];return true;};cDataSet.prototype.update=function(sName,aDPath,sUpdater){if(!sName||!this.aListeners[sName])return;for(var i in this.aListeners[sName]){try{var o=this.aListeners[sName][i];if(sUpdater)continue;this.aListeners[sName][i].__update(sName,aDPath);}
catch(e){}}};dataSet=new cDataSet();

/*** client/inc/storage.js ***/

function cStorage(){this.aStorage={"css":{},"library":{},"language":{},"template":{},"object":{}};this.aStorage.library={'client/inc/debug':true,'client/inc/object_ext':true,'client/inc/browser_ext':true,'client/inc/template':true,'client/inc/xmltools':true,'client/inc/httprequest':true,'client/inc/dataset':true,'client/inc/storage':true,'client/inc/gui':true,'client/inc/wm_generic':true,'client/inc/wm_auth':true,'client/inc/wm_accounts':true,'client/inc/wm_folders':true,'client/inc/wm_items':true,'client/inc/wm_settings':true,'client/inc/wm_storage':true,'client/inc/init':true,'client/inc/gw_others':true,'client/inc/obj_container_generic':true,'client/inc/obj_form_generic':true,'client/inc/obj_form_restrict':true,'client/inc/obj_label':true,'client/inc/obj_tabs':true,'client/inc/obj_tab':true,'client/inc/obj_input':true,'client/inc/obj_button':true,'client/inc/obj_select':true,'client/inc/obj_loader':true,'client/inc/frm_login':true};this.bCheckNames=false;this.request=new cHttpRequest();};cStorage.prototype.css=function(sName){var aAllowed=[];if(this.bCheckNames&&inArray(aAllowed,sName)<0)
throw new Error("cStorage.css() - disallowed filename: "+sName);if(typeof this.aStorage.css['style']!='undefined')return true;if(typeof this.aStorage.css[sName]!='undefined'){if(this.aStorage.css[sName]=='disabled'){document.getElementById('css_'+sName).disabled=false;this.aStorage.css[sName]='enabled';}
return true;}
var cssobj=mkElement('link',{"rel":'stylesheet',"type":'text/css',"href":'client/skins/'+GWOthers.getItem('LAYOUT_SETTINGS','skin')+'/css/'+sName+'.css'});cssobj.id='css_'+sName;document.getElementsByTagName('head')[0].appendChild(cssobj);cssobj=null;this.aStorage.css[sName]='enabled';return true;};cStorage.prototype.library=function(sName,sPath,bASync){var sFile;switch(sPath){case'skin':sFile='client/skins/'+GWOthers.getItem('LAYOUT_SETTINGS','skin')+'/inc/'+sName;break;default:sFile='client/inc/'+sName;if(this.aStorage.library['client/inc/javascript'])return true;}
var aAllowed=[];if(this.bCheckNames&&inArray(aAllowed,sFile)<0)
throw new Error("cStorage.library() - disallowed filename: "+sName);if(this.aStorage.library[sFile])return true;if(bASync){var ASrequest=new cHttpRequest();ASrequest.sURL=sFile+'.js';ASrequest.sendXML('',[this,'preloadLib',['library',sFile,sName],'Text']);return true;}
this.request.sURL=sFile+'.js';this.request.sendXML();var str=this.request.responseText();if(str.length<1)return false;pubEval(str);this.aStorage.library[sFile]='enabled';return true;};cStorage.prototype.preloadObj=function(){aObjects=['obj_checkbox','obj_text','frm_compose','obj_attach_edit','obj_rich','obj_categories','obj_sharing','obj_timeinterval','obj_input_calendar','obj_time','obj_select_input','obj_phone','obj_labeled_select_colors'];for(var i in aObjects){document.title=document.title;setTimeout(storage.object(aObjects[i]),0);document.title=document.title;}};cStorage.prototype.preloadTpl=function(aResponseData,sName){if(aResponseData&&sName)
this.aStorage.template[sName]=aResponseData.Text||'';var aTemplates=['obj_popup','frm_confirm','frm_compose','obj_attach_edit','obj_rich','frm_addaddress','obj_categories','obj_labeled_select','obj_select_input','frm_contact','frm_contact_tab1','obj_phone','frm_event','frm_event_tab1','obj_timeinterval','obj_input_calendar','frm_task','frm_task_tab1'];var no;if(!sName)
no=0;else
if((no=inArray(aTemplates,sName))<0)
return;else
no++;if(!aTemplates[no])return;if(typeof this.aStorage.template[aTemplates[no]]=='undefined')
setTimeout("storage.template('"+aTemplates[no]+"',true);",!sName?3000:500);else
if(aTemplates[no+1])
this.preloadTpl('',aTemplates[no+1]);};cStorage.prototype.language=function(sName){var aAllowed=['en'];if(this.bCheckNames&&!inArray(aAllowed,sName))
throw new Error("cStorage.language() - disallowed filename: "+sName);if(typeof this.aStorage.language["_ACTIVE_LANG"]!='undefined'&&this.aStorage.language["_ACTIVE_LANG"]==sName)
return sName;if(!sName)
sName='en';try{this.request.sURL='client/languages/'+sName+'/data.xml';this.request.sendXML();var lang=this.request.responseArray();}
catch(e){var lang=null;}
if(!Is.Array(lang)){this.request.sURL='client/languages/en/data.xml';this.request.sendXML();lang=this.request.responseArray();if(!Is.Array(lang))
throw new Error("cStorage.language() - bad language file syntax: "+sName);}
lang=lang['LANGUAGE'][0];var tmp={};for(var i in lang){this.aStorage.language[i]={};for(var j in lang[i][0]){if(j=='VALUE')continue;var value=lang[i][0][j][0]['VALUE'];this.aStorage.language[i][j]=(Is.Defined(value))?value:'';}}
return this.aStorage.language["_ACTIVE_LANG"]=sName;};cStorage.prototype.template=function(sName,bASync){var aAllowed=[];if(this.bCheckNames&&inArray(aAllowed,sName)<0)
throw new Error("cStorage.template() - disallowed filename: "+sName);var skin=GWOthers.getItem('LAYOUT_SETTINGS','skin');if(typeof this.aStorage.template[skin+'/'+sName]!='undefined')
return this.aStorage.template[skin+'/'+sName];if(bASync){var ASrequest=new cHttpRequest();ASrequest.sURL='client/skins/'+skin+'/templates/'+sName+'.tpl';ASrequest.sendXML('',[this,'preloadTpl',[sName],'Text']);return true;}
this.request.sURL='client/skins/'+skin+'/templates/'+sName+'.tpl';this.request.sendXML();var str=this.request.responseText();if(!str)
throw new Error("cStorage.template() - blank template file: "+skin+'/'+sName);return this.aStorage.template[skin+'/'+sName]=str;};cStorage.prototype.object=function(sName){var aAllowed=[];if(this.bCheckNames&&inArray(aAllowed,sName)<0)
throw new Error("cStorage.object() - disallowed filename: "+sName);if(typeof this.aStorage.object[sName]!='undefined')
return this.aStorage.object[sName];this.request.sURL='client/objects/'+sName+'.xml';this.request.sendXML();var aObject=this.request.responseArray();try{aObject=aObject['OBJECT'][0];}
catch(e){throw new Error("cStorage.object() - blank xml: "+sName);}
if(aObject['CSS'])
for(var i in aObject['CSS'])
this.css(aObject['CSS'][i]['VALUE']);if(aObject['LIBRARY'])
for(var i in aObject['LIBRARY']){if(aObject['LIBRARY'][i]['ATTRIBUTES']&&aObject['LIBRARY'][i]['ATTRIBUTES']['PATH'])
this.library(aObject['LIBRARY'][i]['VALUE'],aObject['LIBRARY'][i]['ATTRIBUTES']['PATH']);else
this.library(aObject['LIBRARY'][i]['VALUE']);}
return this.aStorage.object[sName]=aObject;};storage=new cStorage();function getLang(str,aSubstitute,nobr){if(typeof str!='string'||!str)return'';var out='',a=str.toUpperCase().split('::');try{if(typeof a[1]=='undefined')
out=storage.aStorage.language[a[0]];else
out=storage.aStorage.language[a[0]][a[1]];if(typeof out=='string'){var parts=out.split('%s');out=parts.shift();for(var i in parts){if(Is.Array(aSubstitute))
out+=aSubstitute.shift();out+=parts[i];}}
return out;}
catch(e){}
return(nobr?str:'{'+str+'}');};

/*** client/inc/gui.js ***/

_me=cObject.prototype;function cObject(sName,sType,oParent){this._name=sName;this._type=sType||'document';this._parent=oParent;this._pathName=this.__genPathName();if(!sType&&!oParent){var home=mkElement('div',{id:sName});home.style.width="100%";home.style.height="100%";home.style.overflow="hidden";document.getElementsByTagName('body')[0].appendChild(home);home=null;var me=this;function evn(e){var e=e||window.event;me.__exeEvent(e.type,e);if((e.type=='keydown')&&e.keyCode==116){e.cancelBubble=true;e.preventDefault();try{e.stopPropagation();}catch(r){}
return false;}};document.onclick=evn;document.onmousedown=evn;document.onmouseup=evn;document.onmousemove=evn;document.onkeydown=evn;document.onkeyup=evn;this.__loading_obj;this.__loading_counter=0;this._loading=function(b){if(this.__loading_obj){if(b)
this.__loading_counter++;else
if(this.__loading_counter>0)
this.__loading_counter--;try{this.__loading_obj._loading(this.__loading_counter);}
catch(r){}}
else
this.__loading_counter=0;};}
this._anchor;this._anchors={'main':this._pathName};this._template='';this._destructors=[];this._listener;this._listenerPath;this._saver=null;this._saverPath=null;this._skipsaving=false;this._noupdate=false;this._norefresh=false;this._updateBuffer=false;this._events={};};_me._getScrollPosition=function(){var x=0,y=0,tmp,obj=this._parent;var sAnchor=this._anchor;do{if(obj.__scrolloffset){tmp=obj.__scrolloffset(sAnchor);x+=tmp.x;y+=tmp.y;}
sAnchor=obj._anchor;}
while((obj=obj._parent));return{x:x,y:y};};_me._create=function(sName,sType,sTarget,sClass){var aObj=storage.object(sType);if(aObj['PARENTS']){var str,er=true,pt=this._type;for(var i in aObj['PARENTS'][0]['OBJ']){str=aObj['PARENTS'][0]['OBJ'][i]['VALUE'];if(pt==str){er=false;break;}}
if(er){throw new Error("gui._create() -  OBJ "+sType+"\n disallowed parent "+pt);return false;}}
if(aObj['UNIQUE']&&typeof(aObj['UNIQUE'][0]['VALUE'])!='undefined'){if(typeof this[sName]!='undefined'){this[sName]._destruct();delete this[sName];}}
else
sName=this.__genName(sName);var oNew=this[sName]=new cObject(sName,sType,this);if(aObj['ANCHORS']&&typeof(aObj['ANCHORS'][0]['ELM'])!='undefined'){var sAnchor='',aAnchors={};for(var i in aObj['ANCHORS'][0]['ELM']){sAnchor=aObj['ANCHORS'][0]['ELM'][i]['VALUE'];aAnchors[sAnchor]=this._pathName+"."+sName+sAnchor;}
oNew['_anchors']=aAnchors;}
if(!sTarget||!this._anchors[sTarget])sTarget='main';try{var main=this._getAnchor(sTarget);}
catch(e){throw Exception('Anchor "'+sTarget+'" doesn\'t exists in "'+this._type+'" object');}
oNew['_anchor']=sTarget;var chld;if(!aObj['TYPE'])aObj['TYPE']=[{'VALUE':'block'}];switch(aObj['TYPE'][0]['VALUE']){case'inline':chld=mkElement('span');break;case'tr':chld=mkElement('tr');break;case'td':chld=mkElement('td');break;case'form':chld=mkElement('form');chld.onsubmit=function(){return false;}
chld.name=oNew._pathName;chld.style.margin=0;chld.style.padding=0;break;default:chld=mkElement('div');}
chld.id=oNew._pathName;oNew['_main']=chld;oNew['_css']=sClass;main.appendChild(chld);chld.className=(aObj['ATTRIBUTES']&&aObj['ATTRIBUTES']['CSS']?aObj['ATTRIBUTES']['CSS']+' ':'')+sType+(sClass?' '+sClass:'');main=chld=null;if(aObj['TEMPLATE']&&typeof(aObj['TEMPLATE'][0]['VALUE'])!='undefined'){oNew['_template']=aObj['TEMPLATE'][0]['VALUE'];if(Is.Defined(this._parent)&&Is.Defined(this._parent._aTemplateData))
oNew._draw(null,null,this._parent._aTemplateData);else if(Is.Defined(this._aTemplateData))
oNew._draw(null,null,this._aTemplateData);else
oNew._draw();}
if(arguments.length>4){var sArg=[],n=0,aArg=[];for(var i=4;i<arguments.length;i++){aArg.push(arguments[i]);sArg.push('aArg['+n+']');n++;}
sArg=sArg.join(',');}
else{var aArg=null;var sArg='';}
if(aObj['LIBRARY']){var obj,sobj;for(var i in aObj['LIBRARY']){if(aObj['LIBRARY'][i]['ATTRIBUTES']&&aObj['LIBRARY'][i]['ATTRIBUTES']['CLASS'])
sobj=aObj['LIBRARY'][i]['ATTRIBUTES']['CLASS'];else
sobj=aObj['LIBRARY'][i]['VALUE'];obj=eval(sobj);if(typeof obj=='function'){inherits(oNew,obj);if(typeof obj.prototype.__constructor!='undefined')
eval("oNew.__constructor("+sArg+")");}
obj=null;}}
if(aObj['ONUNLOAD']){for(var i in aObj['ONUNLOAD'])
oNew._add_destructor(aObj['ONUNLOAD'][i]['VALUE'],aObj['ONUNLOAD'][i]['ATTRIBUTES']);}
if(aObj['ONLOAD']){for(var i in aObj['ONLOAD']){try{eval(aObj['ONLOAD'][i]['VALUE']);}
catch(e){throw Exception("Cant execute onload event:\r\n"+aObj['ONLOAD'][i]['VALUE']);}}}
return oNew;};_me.__genName=function(name){var sApx='';for(var i=0;;i++){if(typeof this[name+sApx]=='undefined')return name+sApx;sApx="_"+i;}};_me.__genPathName=function(){var sPN=this._name;if(this._parent&&this._parent._pathName)
sPN=this._parent._pathName+'.'+sPN;return sPN;};_me._draw=function(sTmpName,Anchor,aData){if(typeof aData!='object')
aData={"_ins":this._pathName};else
aData._ins=this._pathName;var sHtml=template.tmp((sTmpName?sTmpName:this._template),aData);var id,obj=[],tmpObj=[],MSIE,xTpl;if(sHtml.indexOf('<obj ')>-1){if(typeof ActiveXObject!='undefined'){MSIE=true;xTpl=XMLTools.Str2XML('<root>'+sHtml.replace(/\&/g,'&amp;')+'</root>');}
else{MSIE=false;xTpl=mkElement('backquote');if(currentBrowser()=='Safari'&&sHtml.indexOf('<title')>-1)
sHtml=sHtml.replace(/\<title/ig,'<safari_title');xTpl.innerHTML=sHtml;}
var aList=xTpl.getElementsByTagName("obj");if(MSIE&&!aList.length)throw Exception("Syntax error in template: "+(sTmpName?sTmpName:this._template));var ep,etmp,sType,sName,sCSS,sWidth,sHeight,iTabindex,oid=0;function parseitem(etmp,bDebug){var etmp2,key,out=[],n=etmp.getElementsByTagName("item");if(!n.length){n=null;return etmp.textContent||(typeof etmp.text=='string'?etmp.text.unescapeHTML():'');}
for(var i=0,l=n.length;i<l;i++){if((key=n[i].getAttribute('key')))
out[key]=parseitem(n[i]);else
out.push(parseitem(n[i]));}
n=null;return out;};var prevObj=[];for(var i=0;i<aList.length;i++){ep=aList[i].parentNode;sType=aList[i].getAttribute('type');sName=aList[i].getAttribute('name');if(!sName||!sType)continue;if(ep.tagName.toLowerCase()=='obj'){sAnchor=aList[i].getAttribute('anchor');sAnchor=sAnchor||'main';}
else{if((id=ep.getAttribute('id'))){sAnchor=inArray(this._anchors,id);if(sAnchor==-1){sAnchor=Math.rand();this._anchors[sAnchor]=id;}}
else{id=(this._pathName||'')+Math.rand();ep.setAttribute('id',id);sAnchor=Math.rand();this._anchors[sAnchor]=id;}}
tmpObj={"type":sType,"name":sName,"anchor":sAnchor};if((sCSS=aList[i].getAttribute('css')))tmpObj['css']=sCSS;if((sWidth=aList[i].getAttribute('width')))tmpObj['width']=sWidth;if((sHeight=aList[i].getAttribute('height')))tmpObj['height']=sHeight;if((iTabindex=aList[i].getAttribute('tabindex')))tmpObj['tabindex']=iTabindex;if(aList[i].getAttribute('focus'))tmpObj['focus']=true;if(aList[i].getAttribute('ondemand'))tmpObj['ondemand']=true;for(var nlen=aList[i].childNodes.length-1;nlen>=0;nlen--){etmp=aList[i].childNodes[nlen];switch((etmp.tagName?etmp.tagName.toLowerCase():'')){case'init':tmpObj['init']=parseitem(etmp);break;case'disabled':var tval=etmp.textContent||(typeof etmp.text=='string'?etmp.text.unescapeHTML():'');if(tval&&(tval!='false'||tval!='0'))
tmpObj['disabled']=true;break;case'safari_title':case'title':tmpObj['title']=parseitem(etmp);break;case'draw':tmpObj['draw']=[etmp.getAttribute('form'),etmp.getAttribute('anchor')||'main',parseitem(etmp)];break;case'fill':tmpObj['fill']=parseitem(etmp);break;case'value':tmpObj['value']=parseitem(etmp);break;case'restrictions':tmpObj['restrictions']=parseitem(etmp,1);break;}}
etmp=null;if((ep.tagName).toLowerCase()=='obj'){for(var iLPos=aList.length-1;iLPos>=0;iLPos--)
if(aList[iLPos]===ep)break;if(prevObj[iLPos]['objects'])
prevObj[iLPos]['objects'].push(tmpObj);else
prevObj[iLPos]['objects']=[tmpObj];}
else
obj[++oid]=tmpObj;prevObj.push(tmpObj);tmpObj=null;}
prevObj=null;for(var j=aList.length-1;j>=0;j--){var oTextNode=aList[0].ownerDocument.createTextNode("");aList[j].parentNode.appendChild(oTextNode);aList[j].parentNode.removeChild(aList[j]);oTextNode=null;}
if(MSIE){sHtml=XMLTools.XML2Str(xTpl);sHtml=sHtml.substring(6,sHtml.lastIndexOf('</root>'));}
else
sHtml=xTpl.innerHTML;ep=null;xTpl=null;}
else
var sAnchor=Anchor;if(sTmpName&&sAnchor){if(typeof sAnchor!='object')
Anchor=this._getAnchor(Anchor);Anchor.innerHTML=sHtml;}
else
this._main.innerHTML=sHtml;delete aData['_ins'];if(count(aData)>0)
this.__addObjects(obj,null,aData);else
this.__addObjects(obj);};_me.__addObjects=function(obj,str,aData){str=str||this._pathName;var newObj,sInit;for(var i in obj){sInit='';if(obj[i]['init']){if(typeof obj[i]['init']=='object'){for(var j in obj[i]['init'])
sInit+=",obj[i]['init']['"+j.replace('"','\\"')+"']";}
else
sInit=',"'+obj[i]['init'].replace('"','\\"')+'"';}
if(count(aData)>0){this._aTemplateData=aData;eval(str+'._aTemplateData = aData');}
newObj=eval(str+'._create(obj[i]["name"],obj[i]["type"],obj[i]["anchor"],"'+(obj[i]['css']||'')+'"'+sInit+')');if(obj[i]['title']&&Is.Function(newObj._title))
newObj._title(obj[i]['title']);if(obj[i]['fill']&&Is.Function(newObj._fill))
newObj._fill(obj[i]['fill']);if(obj[i]['value']&&Is.Function(newObj._value))
newObj._value(obj[i]['value']);if(obj[i]['focus']&&Is.Function(newObj._focus))
newObj._focus(obj[i]['focus']);if(obj[i]['disabled']&&Is.Function(newObj._disabled))
newObj._disabled(obj[i]['disabled']);if(obj[i]['tabindex']&&Is.Function(newObj._tabindex))
newObj._tabindex(obj[i]['focus']);if((obj[i]['width']||obj[i]['height'])&&Is.Function(newObj._size))
newObj._size(obj[i]['width'],obj[i]['height']);if((obj[i]['restrictions'])&&Is.Function(newObj._restrict)){var j,stmp='';if(typeof obj[i]['restrictions']=='object'){for(j in obj[i]['restrictions'])
stmp+=(stmp?',':'')+'"'+obj[i]['restrictions'][j].trim()+'","'+j+'"';}
else
if(typeof obj[i]['restrictions']=='string')
stmp='"'+obj[i]['restrictions'].trim()+'"';try{if(stmp)
eval('newObj._restrict('+stmp+');');}
catch(er){throw"invalid input array for restrictions:\n"+stmp;}}
if(obj[i]['draw']&&Is.Function(newObj._draw)){if(typeof newObj.__drawTpl!='undefined'&&!newObj._isActive&&obj[i]['ondemand']){newObj.__drawTpl=obj[i]['draw'];newObj.__drawData=aData;}
else{aData=arrConcat(aData,obj[i]['draw'][2]);newObj._draw(obj[i]['draw'][0],obj[i]['draw'][1],aData);if(newObj._isActive&&newObj._active)newObj._active(true);}}
if(obj[i]['objects']&&obj[i]['objects'].length){if(typeof newObj.__drawObj!='undefined'&&!newObj._isActive&&obj[i]['ondemand']){newObj.__drawObj=obj[i]['objects'];newObj.__drawData=aData;}
else{this.__addObjects(obj[i]['objects'],newObj._pathName,aData);if(newObj._isActive&&newObj._active)newObj._active(true);}}}};_me._obeyEvent=function(sType,oEvn){if(this._events[sType]){this._disobeyEvent(sType,oEvn);}
else
this._events[sType]=[];this._events[sType].push(oEvn);};_me._disobeyEvent=function(sType,oEvn){var obj=getCallbackFunction(oEvn);for(var i in this._events[sType])
if(getCallbackFunction(this._events[sType][i])===obj)
this._events[sType].splice(i,1);};_me.__exeEvent=function(sType,e,arg){for(var j in this._events[sType]){if(Is.Array(this._events[sType][j])){if(!executeCallbackFunction(this._events[sType][j],e,arg))
this._events[sType].splice(j,1);}
else
this._events[sType].splice(j,1);}};_me._debugTree=function(){var a={};for(var i in this){if(i.indexOf('_')==0)continue;a[i+" ("+this[i]._type+")"]=this[i]._debugTree();}
return a;};_me._getChildObjects=function(sAnchor,sType){var aOut=[];for(var i in this){if(i.indexOf('_')==0||(sAnchor&&this[i]._anchor!=sAnchor)||(sType&&this[i]._type!=sType))continue;aOut.push(this[i]);}
return aOut;};_me._clean=function(sAnchor){var sAnchor=sAnchor||'main';if(!this._anchors[sAnchor])return false;var aObj=this._getChildObjects(sAnchor);for(var i in aObj)
aObj[i]._destruct();return true;};_me._getAnchor=function(sAnchor){return document.getElementById(this._anchors[sAnchor])||(sAnchor=='main'?this._main:null);};_me._listen=function(sDataSet,aDataPath){this._listener=sDataSet;if(typeof aDataPath=='object')this._listenerPath=aDataPath;dataSet.obey(this,'_listener',sDataSet);};_me._save=function(sDataSet,aDataPath){this._saver=sDataSet;if(typeof aDataPath=='object')this._saverPath=aDataPath;dataSet.obey(this,'_saver',sDataSet);};_me._saveme=function(noupd){if(this._skipsaving)return'';if(this._noupdate)noupd=this._noupdate;if(this._saver){dataSet.add(this._saver,this._saverPath,this._value(),noupd,this._pathName);return this._saver;}
else
if(this._listener){dataSet.add(this._listener,this._listenerPath,this._value(),noupd,this._pathName);return this._listener;}};_me._add_destructor=function(sMethod,aProperties){if(!sMethod)return false;this._destructors[sMethod]=aProperties;};_me._remove_destructor=function(sMethod){delete this._destructors[sMethod];};_me._destruct=function(){this._destructed=true;if(!this._parent[this._name])return false;for(var val in this._destructors){if(Is.Function(this[val]))
eval('this.'+val+"("+(Is.Array(this._destructors[val])?this._destructors[val].join(','):'')+");");}
for(var i in this){if(i.indexOf('_')==0||typeof this[i]!='object'||this[i]==null||typeof this[i]._destruct!='function')continue;this[i]._destruct();delete this[i];}
if(this._listener)
dataSet.disobey(this);if(this._listener_data)
dataSet.disobey(this,'_listener_data');try{this._main.parentNode.removeChild(this._main);}
catch(er){}
this._parent[this._name]=null;delete this._parent[this._name];};gui=new cObject('gui');

/*** client/inc/wm_generic.js ***/

function wm_generic(){this.xmlns;this.error;}
var _me=wm_generic.prototype;_me.create_iq=function(aData,oResponse,sType,sId,sNs,bJSON){delete this.error;var xmlns={"auth":1,"accounts":1,"folders":1,"items":1,"freebusy":1,"spellchecker":1,"public":1,"private":1,"domain":1,"message":1,"import":1,"export":1};sNs=sNs||this.xmlns;if(!xmlns[sNs]){throw new Error('create_iq: unsupported xmlns "'+sNs+'"');}
sNs='webmail:iq:'+sNs;var request={"IQ":[{"ATTRIBUTES":{},"QUERY":[{"ATTRIBUTES":{}}]}]};if((sSID=dataSet.get('main',['sid'])))
request['IQ'][0]['ATTRIBUTES']['SID']=sSID;if(sId)request['IQ'][0]['ATTRIBUTES']['UID']=sId;request['IQ'][0]['ATTRIBUTES']['TYPE']=(sType!='set'?'get':'set');request['IQ'][0]['QUERY'][0]['ATTRIBUTES']['XMLNS']=sNs;if(sType!='set'||bJSON)
request['IQ'][0]['ATTRIBUTES']['FORMAT']='json';if(aData&&typeof aData=='object')
request['IQ'][0]['QUERY'][0]=arrConcat(request['IQ'][0]['QUERY'][0],aData);var http=new cHttpRequest();if(oResponse){http.sendArray(request,[this,'response_check',[oResponse]]);return true;}
else{http.sendArray(request);var aOut=http.responseArray();if(aOut['IQ'][0]['ATTRIBUTES']['TYPE']=="error"){var aErr=aOut['IQ'][0]['ERROR'][0];this.error={};this.error["text"]=aErr['VALUE'];if(aErr['ATTRIBUTES']&&aErr['ATTRIBUTES']['UID']){this.error["id"]=aErr['ATTRIBUTES']['UID'];this.error["lang"]=getLang("ERR_"+aErr['ATTRIBUTES']['ID']);}}
return aOut;}};_me.response_check=function(aData,oResponse){var aXMLResponse=aData['Array'];var aIQAttribute=aXMLResponse['IQ'][0]['ATTRIBUTES'];if(aIQAttribute['TYPE']=='error'){try{switch(aXMLResponse.IQ[0].ERROR[0].ATTRIBUTES.UID){case'session_expired':case'session_no_user':dataSet.add('main',['sid'],'');if(gui&&gui.frm_main)
gui.frm_main.__logout();return;}}
catch(er){}}
executeCallbackFunction(oResponse,aData);};_me.response=function(){};

/*** client/inc/wm_auth.js ***/

function wm_auth(){this.xmlns='auth';};wm_auth.inherit(wm_generic);var _me=wm_auth.prototype;_me.login=function(auth_array,sDataSet,sDataPath){if(!auth_array['username']||(!auth_array['password']&&!auth_array['digest']))return false;if(!auth_array.digest)
auth_array.digest=this.digest(auth_array['username'],auth_array['password']);this.logout();var request={"USERNAME":[{"VALUE":auth_array.username}],"DIGEST":[{"VALUE":auth_array.digest}],"METHOD":[{"VALUE":'RSA'}]};if(!sDataSet){var aData=this.create_iq(request,'','set');if(this.error)return false;aData=aData["IQ"][0]["ATTRIBUTES"]["SID"];dataSet.add('main',['sid'],aData);return aData;}
else
this.create_iq(request,[this,'response',['login',sDataSet,sDataPath]],'set');return true;};_me.logout=function(bIgnoreResponse){if(!dataSet.get("main",['sid']))return true;if(cookieManager.get('LoginState')=='3')
cookieManager.set('LoginState','2');if(bIgnoreResponse){this.create_iq(null,[this,'_void'],'set');return true;}
else
this.create_iq(null,'','set');dataSet.remove("main",['sid'],true);return true;};_me._forgot=function(email,csid,captcha){var aRequest={"FORGOT":[{"VALUE":email}],"CAPTCHA":[{'ATTRIBUTES':{'UID':csid},"VALUE":captcha}],"SUBJECT":[{"VALUE":GWOthers.getItem('FORGOT_SETTINGS','subject')||getLang('FORGOT_PASS::SUBJECT')}],"MESSAGE":[{"VALUE":GWOthers.getItem('FORGOT_SETTINGS','mail')||getLang('FORGOT_PASS::EMAIL')}]};var aResponse=(this.create_iq(aRequest,'','set')).IQ[0];if(aResponse.ATTRIBUTES.TYPE=='result'){var emails=[];for(var i in aResponse.QUERY[0].EMAIL)
emails.push(aResponse.QUERY[0].EMAIL[i].VALUE);return emails;}
else
if(aResponse.ATTRIBUTES.TYPE=='error')
return aResponse.ERROR[0].ATTRIBUTES.UID;else
return false;};_me._void=function(){};_me.digest=function(user,pass){var rsa=new RSAKey();rsa.setPublic(this.hashid({"username":user}),'10001');return rsa.encrypt(pass);};_me.hashid=function(auth_array)
{var request={"USERNAME":[{"VALUE":auth_array['username']}],"METHOD":[{"VALUE":'RSA'}]};var response=this.create_iq(request);return response["IQ"][0]["QUERY"][0]["HASHID"][0]["VALUE"];};_me.response=function(aData,sMethodName,sDataSet,sDataPath)
{if(sDataSet=='main')
sDataPath=['sid'];else
sDataPath=sDataPath||['sid'];switch(sMethodName){case'login':dataSet.add(sDataSet,sDataPath,aData['Array']["IQ"][0]["ATTRIBUTES"]["SID"]);break;case'logout':dataSet.add(sDataSet,sDataPath,'');}};var auth=new wm_auth();

/*** client/inc/wm_accounts.js ***/

function wm_accounts(){this.xmlns='accounts';};wm_accounts.inherit(wm_generic);var _me=wm_accounts.prototype;_me.add=function(aAccountInfo,sDataSet,aDataPath,aHandler){var aRequest,uid;if(aAccountInfo['aid']){aRequest={"ACCOUNT":[{"ATTRIBUTES":{"ACTION":"edit","UID":aAccountInfo['aid']}}]};var aFrame=aRequest["ACCOUNT"][0];for(var sTag in aAccountInfo)
if(sTag!='aid')
aFrame[sTag]=[{"VALUE":aAccountInfo[sTag]}];uid=aAccountInfo['aid'];}
else
if(aAccountInfo['SERVER']&&aAccountInfo['USERNAME']&&aAccountInfo['PASSWORD']&&aAccountInfo['EMAIL']){switch(aAccountInfo['PROTOCOL']){case'imap':case'pop3':case'local':break;default:aAccountInfo['PROTOCOL']='pop3';}
if(!aAccountInfo['PORT'])
if(aAccountInfo['PROTOCOL']=='imap')
aAccountInfo['PORT']=143;else
aAccountInfo['PORT']=110;uid=aAccountInfo['EMAIL'];aRequest={"ACCOUNT":[{"ATTRIBUTES":{"ACTION":"add"},"PROTOCOL":[{"VALUE":aAccountInfo['PROTOCOL']}],"SERVER":[{"VALUE":aAccountInfo['SERVER']}],"USERNAME":[{"VALUE":aAccountInfo['USERNAME']}],"PASSWORD":[{"VALUE":aAccountInfo['PASSWORD']}],"PORT":[{"VALUE":aAccountInfo['PORT']}],"EMAIL":[{"VALUE":aAccountInfo['EMAIL']}],"DESCRIPTION":[{"VALUE":aAccountInfo['DESCRIPTION']}]}]};}
else
return false;if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['add',sDataSet,aDataPath,aHandler]],'set',uid);return true;}};_me.test=function(aAccountInfo,aHandler){var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"ACTION":"test"}}]};var aAccount=aRequest.ACCOUNT[0];aAccount.EMAIL=[{VALUE:aAccountInfo.EMAIL}];aAccount.USERNAME=[{VALUE:aAccountInfo.USERNAME}];if(aAccountInfo.PASSWORD)
aAccount.PASSWORD=[{VALUE:aAccountInfo.PASSWORD}];aAccount.SERVER=[{VALUE:aAccountInfo.SERVER}];aAccount.PORT=[{VALUE:aAccountInfo.PORT}];aAccount.PROTOCOL=[{VALUE:aAccountInfo.PROTOCOL}];if(!aHandler){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq('',[this,'response',['test',sDataSet,aDataPath,aHandler]],'set');return true;}};_me._signup=function(sUser,sPass,sFull,sDomain,sAlt,csid,captcha){aRequest={"ACCOUNT":[{ATTRIBUTES:{ACTION:'signup'},USERNAME:[{VALUE:sUser}],PASSWORD:[{VALUE:sPass}],FULLNAME:[{VALUE:sFull}],ALTERNATIVE:[{VALUE:sAlt}],EMAIL:[{VALUE:sUser+'@'+sDomain}],CAPTCHA:[{ATTRIBUTES:{UID:csid},VALUE:captcha}]}]};var aResponse=(this.create_iq(aRequest,'','set')).IQ[0];if(aResponse.ATTRIBUTES.TYPE=='result')
return{'uid':true};else
if(aResponse.ATTRIBUTES.TYPE=='error')
return{'uid':aResponse.ERROR[0].ATTRIBUTES.UID,'value':aResponse.ERROR[0].VALUE};else
return false;};_me.list=function(sDataSet,aDataPath,sParam){if(!sDataSet)
return this.account_sort(this.parse(this.create_iq()));else{this.create_iq('',[this,'response',['list',sDataSet,aDataPath]],'get',sParam);return true;}};_me.account_sort=function(arr){var main={},rss={};for(var i in arr){if(arr[i].PRIMARY){main[i]=arr[i];delete arr[i];}
else
if(arr[i].TYPE=='rss'){rss[i]=arr[i];delete arr[i];}}
for(i in arr)
main[i]=arr[i];for(i in rss)
main[i]=rss[i];return main;}
_me.refresh=function(aAccountInfo,sDataSet,aDataPath,aHandler){if(!aAccountInfo['aid'])return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"ACTION":"refresh","UID":aAccountInfo['aid']}}]};if(!sDataSet){var folders=new wm_folders;var result=folders.sort(folders.parse(this.create_iq(aRequest,'','set')),true);if(result[sPrimaryAccount])
this.__mapfolders(result[sPrimaryAccount]);return result;}
else{this.create_iq(aRequest,[this,'response',['refresh',sDataSet,aDataPath,aHandler]],'set',aAccountInfo['aid'],'',true);return true;}};_me.remove=function(aAccountInfo,sDataSet,aDataPath,sParam){if(!aAccountInfo['aid'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"ACTION":"delete","UID":aAccountInfo['aid']}}]};if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['remove',sDataSet,aDataPath]],'set',sParam);return true;}};_me.synchronize=function(aFoldersInfo,sDataSet,aDataPath){if(!aFoldersInfo['aid'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFoldersInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"ACTION":"sync"}}]}]};if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['Array']['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['synchronize',sDataSet,aDataPath]],'set');return true;}};_me.synclist=function(aFoldersInfo,sDataSet,aDataPath){if(!aFoldersInfo['aid'])return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFoldersInfo['aid'],"ACTION":"sync"}}]};if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result'){var folders=new wm_folders;return folders.list({'aid':aFoldersInfo['aid']});}}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['synclist',sDataSet,aDataPath]],'set',aFoldersInfo['aid']);return true;}};_me.response=function(aResponse,sMethodName,sDataSet,aDataPath,aHandler){var aXMLResponse=aResponse['Array'];var aIQAttribute=aXMLResponse['IQ'][0]['ATTRIBUTES'];switch(sMethodName){case'test':var out=false;try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
out=true;}
catch(e){}
executeCallbackFunction(aHandler,out);return;case'list':dataSet.add(sDataSet,aDataPath,this.account_sort(this.parse(aXMLResponse)));if(aIQAttribute['TYPE']=='result'&&aIQAttribute['UID']){var aAccounts=dataSet.get(sDataSet,aDataPath);var folders=new wm_folders;dataSet.remove(aIQAttribute['UID'],'',true);for(sAccId in aAccounts)
folders.list({'aid':sAccId},aIQAttribute['UID']);}
return true;case'refresh':if(aIQAttribute['TYPE']=='error'){var str,att;try{att=aXMLResponse.IQ[0].ERROR[0].ATTRIBUTES.UID;str=aXMLResponse.IQ[0].ERROR[0].VALUE;}
catch(e){str=att='';}
if(att.toLowerCase()=='imap_internal')
alert(aIQAttribute['UID']+"\n"+str.unescapeHTML());}
case'synchronize':if(aIQAttribute['TYPE']=='result'&&aIQAttribute['UID']){var iRecent_old=null;storage.library('gw_others');if(parseInt(GWOthers.getItem('MAIL_SETTINGS_GENERAL','sound_notify'))>0)
iRecent_old=dataSet.get(sDataSet,[aIQAttribute['UID'],'INBOX','RECENT']);var aParsedData=WMFolders.parse(aXMLResponse);if(sPrimaryAccount==aIQAttribute['UID'])
this.__mapfolders(aParsedData[aIQAttribute['UID']]);dataSet.add(sDataSet,[aIQAttribute['UID']],WMFolders.sort(aParsedData,true)[aIQAttribute['UID']]);if(iRecent_old!=null&&parseInt(iRecent_old)<dataSet.get(sDataSet,[aIQAttribute['UID'],'INBOX','RECENT']))
gui.sound._play('mail');if(typeof aHandler=='object')
executeCallbackFunction(aHandler);}
break;case'remove':try{if(aIQAttribute['TYPE']!='result'&&aIQAttribute['UID'])
this.list(sDataSet,aDataPath,aIQAttribute['UID']);return true;}
catch(e){}
return false;case'add':case'synclist':try{if(aIQAttribute['TYPE']=='result'&&aIQAttribute['UID']){var folders=new wm_folders;folders.list({'aid':aIQAttribute['UID']},sDataSet,aDataPath,aHandler);return true;}
else
if(aIQAttribute['TYPE']=='result'&&typeof aHandler=='object'){executeCallbackFunction(aHandler);return true;}
else
if(aIQAttribute['TYPE']=='error'&&typeof aHandler=='object')
executeCallbackFunction(aHandler,aXMLResponse['IQ'][0]['ERROR'][0]['ATTRIBUTES']['UID']);}
catch(e){}
return false;}};_me.__mapfolders=function(aFolders){var test={},out={};storage.library('gw_others');var sTrashFolder=GWOthers.getItem('DEFAULT_FOLDERS','trash').split('/')[1];if(!aFolders[sTrashFolder])
test['trash']=new RegExp('^'+sTrashFolder+'$',"i");var sDraftFolder=GWOthers.getItem('DEFAULT_FOLDERS','drafts').split('/')[1];if(!aFolders[sDraftFolder])
test['drafts']=new RegExp('^'+sDraftFolder+'$',"i");var sSentFolder=GWOthers.getItem('DEFAULT_FOLDERS','sent').split('/')[1];if(!aFolders[sSentFolder])
test['sent']=new RegExp('^'+sSentFolder+'$',"i");var sSpamFolder=GWOthers.getItem('DEFAULT_FOLDERS','spam').split('/')[1];if(!aFolders[sSpamFolder])
test['spam']=new RegExp('^'+sSpamFolder+'$',"i");if(!count(test))return;for(var itm in aFolders){for(var itm2 in test){if(itm.match(test[itm2])){out[itm2]=sPrimaryAccount+'/'+itm;test[itm2]=null;delete test[itm2];}}}
if(count(out))
GWOthers.set('DEFAULT_FOLDERS',out,'storage');};_me.parse=function(aData){try{var aFrame=aData['IQ'][0]['QUERY'][0]['ACCOUNT'];var aResult={};var aResultFrame;for(var nAccNum in aFrame){aResultFrame={};for(var sTag in aFrame[nAccNum])
if(sTag!='ATTRIBUTES')
aResultFrame[sTag]=aFrame[nAccNum][sTag][0]['VALUE'];aResultFrame['GW']=(aFrame[nAccNum]['ATTRIBUTES']&&aFrame[nAccNum]['ATTRIBUTES']['GW']=='true'?1:0);aResultFrame['SIP_SUPPORT']=(aFrame[nAccNum]['ATTRIBUTES']&&aFrame[nAccNum]['ATTRIBUTES']['SIP_SUPPORT']=='true'?1:0);aResultFrame['PRIMARY']=(aFrame[nAccNum]['ATTRIBUTES']&&aFrame[nAccNum]['ATTRIBUTES']['PRIMARY']=='true'?1:0);aResultFrame['EXPIRED']=(aFrame[nAccNum]['ATTRIBUTES']&&aFrame[nAccNum]['ATTRIBUTES']['PASSEXPIRED']=='true'?1:0);aResultFrame['TYPE']=(aFrame[nAccNum]['ATTRIBUTES']&&aFrame[nAccNum]['ATTRIBUTES']['TYPE']?aFrame[nAccNum]['ATTRIBUTES']['TYPE']:'user');if(aResultFrame['PRIMARY']){window.sPrimaryAccount=aFrame[nAccNum]['ATTRIBUTES']['UID'];window.sPrimaryAccountType=aResultFrame['TYPE'];window.sPrimaryAccountGW=aResultFrame['GW'];window.sPrimaryAccountSIP=aResultFrame['SIP_SUPPORT'];}
aResult[aFrame[nAccNum]['ATTRIBUTES']['UID']]=aResultFrame;}
return aResult;}
catch(e){return false;}};var accounts=new wm_accounts();var WMAccounts=accounts;

/*** client/inc/wm_folders.js ***/

function wm_folders(){this.xmlns='folders';};wm_folders.inherit(wm_generic);var _me=wm_folders.prototype;_me.add=function(aFolderInfo,sDataSet,aDataPath)
{if(!aFolderInfo['aid'])
return false;var sUpdDataSet=sDataSet||'folders';var aRequest;if(aFolderInfo['fid']){if(!aFolderInfo['name']&&typeof aFolderInfo['channel']=='undefined')
return false;aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":"edit"}}]}]};}
else{if(!aFolderInfo['name'])
return false;if(aFolderInfo['type']){if(inArray(['mail','contact','event','journal','note','task','file','m','r','c','e','j','n','t','f'],aFolderInfo['type'].toLowerCase())<0)
return false;if(aFolderInfo['type']=='R'&&!dataSet.get('accounts',[sPrimaryAccount+'_rss']))
dataSet.add('accounts',[sPrimaryAccount+'_rss'],{DESCRIPTION:'RSS',TYPE:'rss'});}
else
aFolderInfo['type']='mail';aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"ACTION":"add"},"TYPE":[{"VALUE":aFolderInfo['type']}]}]}]};}
if(aFolderInfo['name'])
aRequest.ACCOUNT[0].FOLDER[0].NAME=[{"VALUE":aFolderInfo['name']}];if(typeof aFolderInfo['channel']!='undefined')
aRequest.ACCOUNT[0].FOLDER[0].CHANNEL=[{"VALUE":aFolderInfo['channel']}];if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['add',sDataSet,aDataPath,aFolderInfo]],'set',aFolderInfo['aid']);return true;}};_me.list=function(aFoldersInfo,sDataSet,aDataPath,aHandler)
{if(!aFoldersInfo['aid'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFoldersInfo['aid']}}]};if(!sDataSet){return this.parse(this.create_iq(aRequest));}
else{this.create_iq(aRequest,[this,'response',['list',sDataSet,aDataPath,'',aHandler]],'',aFoldersInfo['aid']);return true;}};_me.getType=function(aFolderInfo){var aid=aFolderInfo.aid||aFolderInfo[0];var fid=aFolderInfo.fid||aFolderInfo[1];return dataSet.get('folders',[aid,fid,'TYPE'])||false;};_me.getRights=function(aFolderInfo,isRight){var aRights={read:false,write:false,modify:false,remove:false};if(!aFolderInfo.aid||!aFolderInfo.fid)return isRight?false:aRights;var sRights=dataSet.get('folders',[aFolderInfo.aid,aFolderInfo.fid,'RIGHTS']);if(sRights){if(sRights.indexOf('r')>-1)aRights['read']=true;if(sRights.indexOf('w')>-1)aRights['write']=true;if(sRights.indexOf('m')>-1)aRights['modify']=true;if(sRights.indexOf('d')>-1)aRights['remove']=true;}
if(isRight)return aRights[isRight]||false;return aRights;};_me.getAccess=function(aFolderInfo,isRight){var aRights={read:false,write:false,modify:false,remove:false};if(!aFolderInfo.aid||!aFolderInfo.fid)return isRight?false:aRights;var sRights=dataSet.get('folders',[aFolderInfo.aid,aFolderInfo.fid,'ACCESS']);if(sRights){if(sRights.indexOf('r')>-1)aRights['read']=true;if(sRights.indexOf('w')>-1)aRights['write']=true;if(sRights.indexOf('m')>-1)aRights['modify']=true;if(sRights.indexOf('d')>-1)aRights['remove']=true;}
else
return this.getRights(aFolderInfo,isRight);if(isRight)
return aRights[isRight]||false;return aRights;};_me._getDefaultFolders=function(sDataSet){var aFolders=dataSet.get(sDataSet||'folders');var aFolder=['trash','drafts','sent','spam'];if(!aFolders)return aFolder;var sItem='',test={},out={};storage.library('gw_others');for(var i in aFolder){sItem=GWOthers.getItem('DEFAULT_FOLDERS',aFolder[i]);sItem=sItem.substr(sItem.indexOf('/')+1);if(!aFolders[sPrimaryAccount][sItem])
test[aFolder[i]]=[new RegExp('^'+sItem.quoteMeta()+'$',"i"),sPrimaryAccount+'/'+sItem];else
out[aFolder[i]]=sPrimaryAccount+'/'+sItem;}
if(!count(test))return out;for(var itm in aFolders){for(var itm2 in test){if(itm.match(test[itm2][0])){out[itm2]=sPrimaryAccount+'/'+itm;test[itm2]=null;delete test[itm2];}}}
for(var itm2 in test)
out[itm2]=test[itm2][1];storage.library('gw_others');GWOthers.set('DEFAULT_FOLDERS',out,'storage');return out;};_me.remove=function(aFolderInfo,sDataSet,aDataPath)
{if(!aFolderInfo['aid']||!aFolderInfo['fid'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":"delete"}}]}]};if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['remove',sDataSet,aDataPath,aFolderInfo]],'set',aFolderInfo['aid']);return true;}};_me.empty=function(aFolderInfo,sDataSet,aDataPath,aDestination)
{if(!aFolderInfo['aid']||!aFolderInfo['fid'])
return false;var aRequest;if(Is.Defined(aDestination))
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":"empty"},"ACCOUNT":[{"VALUE":aDestination['aid']}],"FOLDER":[{"VALUE":aDestination['fid']}]}]}]};else
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":"empty"}}]}]};if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result'){dataSet.add('items',[aFolderInfo['aid'],aFolderInfo['fid']],{});return true;}}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['empty',sDataSet,aDataPath,aFolderInfo]],'set',aFolderInfo['aid']+'/'+aFolderInfo['fid']);return true;}};_me.subscribe=function(aFolderInfo,sDataSet,aDataPath,bSync){var sDataSet=sDataSet||'folders';var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":"edit"},"SUBSCRIBED":[{"VALUE":bSync?1:0}]}]}]};this.create_iq(aRequest,[this,'response',[bSync?'subscribe':'unsubscribe',sDataSet,aDataPath,aFolderInfo,bSync]],'set',aFolderInfo['aid']+'/'+aFolderInfo['fid']);return true;};_me.markItemsRead=function(aFolderInfo,sDataSet,aDataPath,bRead)
{if(!aFolderInfo['aid']||!aFolderInfo['fid'])
return false;var sType=bRead?'markasread':'markasunread';var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aFolderInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aFolderInfo['fid'],"ACTION":sType}}]}]};aFolderInfo['bRead']=bRead;if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['markread',sDataSet,aDataPath,aFolderInfo]],'set',aFolderInfo['aid']);return true;}};_me.response=function(aResponse,sMethodName,sDataSet,aDataPath,aFolderInfo,aHandler)
{var aXMLResponse=aResponse['Array'];var aIQAttribute=aXMLResponse['IQ'][0]['ATTRIBUTES'];try{if(aIQAttribute['TYPE']=='error'){var str,att;try{att=aXMLResponse.IQ[0].ERROR[0].ATTRIBUTES.UID;str=aXMLResponse.IQ[0].ERROR[0].VALUE;}
catch(e){str=att='';}
if(att.toLowerCase()=='imap_internal')
alert(aIQAttribute['UID']+"\n"+str.unescapeHTML());}}
catch(e){}
switch(sMethodName){case'unsubscribe':case'subscribe':if(aIQAttribute['TYPE']=='result')
dataSet.add('folders',[aFolderInfo['aid'],aFolderInfo['fid'],'SYNC'],sMethodName=='subscribe'?1:0,true);break;case'add':try{if(aIQAttribute['TYPE']=='error'){this.list({'aid':aIQAttribute['UID']},sDataSet,aDataPath);return true;}}
catch(e){}
if(aFolderInfo['fid']&&((aFolderInfo['name']&&aFolderInfo['fid']!=aFolderInfo['name'])||typeof aFolderInfo['channel']!='undefined')){var tmp,sName=aFolderInfo['name']||aFolderInfo['fid'];var aDataSet=dataSet.get(sDataSet,[aFolderInfo['aid']]);for(var i in aDataSet){if(i==aFolderInfo['fid']){tmp=aDataSet[i];if(typeof aFolderInfo['channel']!='undefined')
tmp.CHANNEL=aFolderInfo['channel'];delete aDataSet[i];aDataSet[sName]=tmp;}
else
if(i.indexOf(aFolderInfo['fid']+'/')===0){tmp=aDataSet[i];delete aDataSet[i];aDataSet[sName+i.substr(aFolderInfo['fid'].length)]=tmp;}}
dataSet.add(sDataSet,[aFolderInfo['aid']],aDataSet,true);dataSet.update(sDataSet,[aFolderInfo['aid']]);}
else
if(!aFolderInfo['fid']&&aFolderInfo['name']){out={RIGHTS:'rwmd',TYPE:aFolderInfo['type']};if(typeof aFolderInfo['channel']!='undefined')
out.CHANNEL=aFolderInfo['channel'];dataSet.add(sDataSet,[aFolderInfo['aid'],aFolderInfo['name']],out);}
return false;case'list':try{if(aIQAttribute['UID']){var aData=this.parse(aXMLResponse,true);dataSet.add(sDataSet,[aIQAttribute['UID']],aData[aIQAttribute['UID']]);if(typeof aHandler=='object')
executeCallbackFunction(aHandler);return true;}}
catch(e){}
return false;case'remove':try{if(aIQAttribute['TYPE']!='result'&&aIQAttribute['UID']){this.list({'aid':aIQAttribute['UID']},sDataSet,aDataPath);return true;}}
catch(e){}
var blank=true;var bPerfm=false;var aDataSet=dataSet.get(sDataSet,[aFolderInfo['aid']]);for(var i in aDataSet){if(i==aFolderInfo['fid']||i.indexOf(aFolderInfo['fid']+'/')===0){bPerfm=true;delete aDataSet[i];}
else
blank=false;}
if(blank&&aFolderInfo['aid']==sPrimaryAccount+'_rss'){dataSet.remove('accounts',[aFolderInfo['aid']],true);dataSet.remove(sDataSet,[aFolderInfo['aid']]);}
else
if(bPerfm){dataSet.add(sDataSet,[aFolderInfo['aid']],aDataSet,true);dataSet.update(sDataSet,[aFolderInfo['aid']]);}
return false;case'empty':try{if(aIQAttribute['TYPE']!='result'&&aIQAttribute['UID']){var aFolder=Path.split(aIQAttribute['UID']);this.list({'aid':aFolder[0]},sDataSet,aDataPath);var aItems=dataSet.get('items');for(var sAccId in aItems)
for(var sFolId in aItems[sAccId]);if(sAccId==aFolder[0]&&sFolId==aFolder[1])
WMItems.list({'aid':sAccId,'fid':sFolId,'values':items.default_values('M')},'items');return true;}
else
if(aIQAttribute['UID']){var aFolder=Path.split(aIQAttribute['UID']);var aItems=dataSet.get('items');for(var sAccId in aItems)
for(var sFolId in aItems[sAccId]);if(sAccId==aFolder[0]&&sFolId==aFolder[1])
dataSet.add('items',[aFolder[0],aFolder[1]],{});}}
catch(e){}
if(dataSet.get(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT'])>0)
dataSet.add(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT'],'0');return false;case'markread':if(aIQAttribute['TYPE']=='error')
return true;if(aFolderInfo.bRead){if(dataSet.get(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT'])>0)
dataSet.add(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT'],'0');}
else{var nCount=0;if(Is.Defined(aXMLResponse['IQ'][0]['QUERY'][0]['RECENT'])){nCount=parseInt(aXMLResponse['IQ'][0]['QUERY'][0]['RECENT']);if(!Is.Number(nCount))
nCount=0;}
var i=dataSet.get(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT']);i=i>0?i:0;if(i!=nCount)
dataSet.add(sDataSet,[aFolderInfo['aid'],aFolderInfo['fid'],'RECENT'],nCount.toString());}
var aItems=dataSet.get('items');for(var sAccId in aItems)
for(var sFolId in aItems[sAccId]);if(sAccId==aFolderInfo['aid']&&sFolId==aFolderInfo['fid'])
gui.frm_main.main.list._serverSort();return true;}};_me.sort=function(aFolders,bRights)
{function sort(a,b){var sA;var sB;if(Is.String(a['TITLE']))
sA=a['TITLE'].toLowerCase();else
sA=a['TITLE'];if(Is.String(b['TITLE']))
sB=b['TITLE'].toLowerCase();else
sB=b['TITLE'];if(sA>sB)return 1;if(sA<sB)return-1;return 0};var aResult={};var aResultFolFrame,aFolder,aFolderSplit;var aSortInbox,aSortOthers,aSortShared,aSortPublic,tmpPublic;var sTitle;var bSpamFolders=false;var sRights;var aCommon=getLang('COMMON_FOLDERS');storage.library('gw_groups');var groups=new gw_groups;var aGroupsProps=groups.get('storage');var aGroups=[];for(var n in aGroupsProps)
if(aGroupsProps[n]['SUBSCRIBED']=='true')
aGroups.push(aGroupsProps[n]['GRPTITLE']);for(var sAccId in aFolders){aSortInbox=[];aSortOthers=[];aSortShared=[];aSortPublic=[];tmpPublic={};for(var sFolId in aFolders[sAccId]){aFolderSplit=sFolId.split('/');if(aFolderSplit[0]=='INBOX'){if(aFolderSplit[0]==sFolId)
aFolders[sAccId][sFolId]['NAME']=aCommon['INBOX'];aFolderSplit[0]=aCommon['INBOX'];sTitle=aFolderSplit.join('/');aSortInbox.push({'FOLDER':sFolId,'TITLE':sTitle});}
else
if((sTitle=aCommon[aFolderSplit[0].toUpperCase()]))
{if(aFolderSplit[0]==sFolId){aFolders[sAccId][sFolId]['NAME']=sTitle;if(bRights&&(sRights=aFolders[sAccId][sFolId].RIGHTS)){aFolders[sAccId][sFolId].ACCESS=sRights;switch(sFolId.toUpperCase()){case'TRASH':case'SENT':case'DRAFTS':aFolders[sAccId][sFolId].RIGHTS=sRights.replace(/[m]/gi,'');break;default:aFolders[sAccId][sFolId].RIGHTS=sRights.replace(/[md]/gi,'');}}}
else
if(aFolderSplit[0]=='SPAM_QUEUE')
aFolders[sAccId][sFolId]['NAME']=aCommon[(aFolderSplit[0]+'-'+aFolderSplit[1]).toUpperCase()];aFolderSplit[0]=sTitle;sTitle=aFolderSplit.join('/');aSortOthers.push({'FOLDER':sFolId,'TITLE':sTitle});}
else{var fld=false;if(aFolders[sAccId][sFolId]['TYPE']=='A')
fld=true;else
for(var i in aGroups){if(sFolId==aGroups[i]){fld=true;delete aGroups[i];tmpPublic[sFolId]=true;break;}}
if(aFolders[sAccId][aFolderSplit[0]]&&aFolders[sAccId][aFolderSplit[0]].TYPE=='A')
aSortShared.push({'FOLDER':sFolId,'TITLE':sFolId});else
if(tmpPublic[aFolderSplit[0]])
aSortPublic.push({'FOLDER':sFolId,'TITLE':sFolId});else
aSortOthers.push({'FOLDER':sFolId,'TITLE':sFolId});if(fld){if(aFolders[sAccId][sFolId+'/Events']&&aFolders[sAccId][sFolId+'/Events'].TYPE=='E'){aFolders[sAccId][sFolId+'/Events'].NAME=aCommon.EVENTS;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Events'].RIGHTS)){aFolders[sAccId][sFolId+'/Events'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Events'].RIGHTS=sRights.replace(/[md]/gi,'');}}
if(aFolders[sAccId][sFolId+'/Contacts']&&aFolders[sAccId][sFolId+'/Contacts'].TYPE=='C'){aFolders[sAccId][sFolId+'/Contacts'].NAME=aCommon.CONTACTS;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Contacts'].RIGHTS)){aFolders[sAccId][sFolId+'/Contacts'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Contacts'].RIGHTS=sRights.replace(/[md]/gi,'');}}
if(aFolders[sAccId][sFolId+'/Notes']&&aFolders[sAccId][sFolId+'/Notes'].TYPE=='N'){aFolders[sAccId][sFolId+'/Notes'].NAME=aCommon.NOTES;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Notes'].RIGHTS)){aFolders[sAccId][sFolId+'/Notes'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Notes'].RIGHTS=sRights.replace(/[md]/gi,'');}}
if(aFolders[sAccId][sFolId+'/Files']&&aFolders[sAccId][sFolId+'/Files'].TYPE=='F'){aFolders[sAccId][sFolId+'/Files'].NAME=aCommon.FILES;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Files'].RIGHTS)){aFolders[sAccId][sFolId+'/Files'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Files'].RIGHTS=sRights.replace(/[md]/gi,'');}}
if(aFolders[sAccId][sFolId+'/Tasks']&&aFolders[sAccId][sFolId+'/Tasks'].TYPE=='T'){aFolders[sAccId][sFolId+'/Tasks'].NAME=aCommon.TASKS;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Tasks'].RIGHTS)){aFolders[sAccId][sFolId+'/Tasks'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Tasks'].RIGHTS=sRights.replace(/[md]/gi,'');}}
if(aFolders[sAccId][sFolId+'/Journal']&&aFolders[sAccId][sFolId+'/Journal'].TYPE=='J'){aFolders[sAccId][sFolId+'/Journal'].NAME=aCommon.JOURNAL;if(bRights&&(sRights=aFolders[sAccId][sFolId+'/Journal'].RIGHTS)){aFolders[sAccId][sFolId+'/Journal'].ACCESS=sRights;aFolders[sAccId][sFolId+'/Journal'].RIGHTS=sRights.replace(/[md]/gi,'');}}}}}
aSortInbox.sort(sort);aSortOthers.sort(sort);aSortPublic.sort(sort);aSortShared.sort(sort);aResultFolFrame={};for(var n in aSortInbox){aFolder=aFolders[sAccId][aSortInbox[n]['FOLDER']];aResultFolFrame[aSortInbox[n]['FOLDER']]={};for(var sItem in aFolder)
aResultFolFrame[aSortInbox[n]['FOLDER']][sItem]=aFolder[sItem];}
for(var n in aSortOthers){aFolder=aFolders[sAccId][aSortOthers[n]['FOLDER']];aResultFolFrame[aSortOthers[n]['FOLDER']]={};for(var sItem in aFolder)
aResultFolFrame[aSortOthers[n]['FOLDER']][sItem]=aFolder[sItem];}
for(var n in aSortPublic){aFolder=aFolders[sAccId][aSortPublic[n]['FOLDER']];aResultFolFrame[aSortPublic[n]['FOLDER']]={};for(var sItem in aFolder)
aResultFolFrame[aSortPublic[n]['FOLDER']][sItem]=aFolder[sItem];}
for(var n in aSortShared){aFolder=aFolders[sAccId][aSortShared[n]['FOLDER']];aResultFolFrame[aSortShared[n]['FOLDER']]={};for(var sItem in aFolder)
aResultFolFrame[aSortShared[n]['FOLDER']][sItem]=aFolder[sItem];}
aResult[sAccId]=aResultFolFrame;}
return aResult;};_me.parse=function(aData,bRights)
{try
{var aAccFrame=aData['IQ'][0]['QUERY'][0]['ACCOUNT'][0];var sAccId=aAccFrame['ATTRIBUTES']['UID'];var aFolFrame=aAccFrame['FOLDER'];var sFolId;var aResult={};var aResultAccFrame={};var aResultFolFrame;for(var nFolNum in aFolFrame){aResultFolFrame={};for(var sItem in aFolFrame[nFolNum])
if(sItem!='ATTRIBUTES')
aResultFolFrame[sItem]=aFolFrame[nFolNum][sItem][0]['VALUE'];sFolId=aFolFrame[nFolNum]['ATTRIBUTES']['UID'];aResultAccFrame[sFolId]=aResultFolFrame;}
aResult[sAccId]=aResultAccFrame;return this.sort(aResult,bRights);}
catch(e){return false;}};_me.__emptyFolder=function(sAccId,sFolId,bMoveToTrash)
{var aTrashFolder;if(bMoveToTrash){var aFolData=clone(dataSet.get('folders',[sAccId,sFolId]),true);if(aFolData.TYPE=='M'){storage.library('gw_others');aTrashFolder=Path.split(GWOthers.getItem('DEFAULT_FOLDERS','trash'));var sDestAccount=aTrashFolder[0];var sDestFolder=aTrashFolder[1];var aDestData=clone(dataSet.get('folders',[sDestAccount,sDestFolder]),true);if(Is.Defined(aDestData)&&Is.Defined(aFolData)){var iRec=parseInt(aFolData['RECENT']||0)+parseInt(aDestData['RECENT']||0);var iOld=parseInt(dataSet.get('folders',[sDestAccount,sDestFolder,'RECENT'])||0);if(iRec!=iOld)
dataSet.add('folders',[sDestAccount,sDestFolder,'RECENT'],iRec.toString());}
aTrashFolder={'aid':sDestAccount,'fid':sDestFolder};}}
if(dataSet.get('folders',[sAccId,sFolId,'RECENT'])>0)
dataSet.add('folders',[sAccId,sFolId,'RECENT'],'0');var aMView=dataSet.get('mailview');if(typeof aMView=='object'){for(var mwa in aMView)
for(var mwf in aMView[mwa]);if(mwa==sAccId&&mwf==sFolId)
dataSet.remove('mailview');}
this.empty({'aid':sAccId,'fid':sFolId},'folders','',aTrashFolder);};folders=new wm_folders();var WMFolders=folders;

/*** client/inc/wm_items.js ***/

function wm_items(){this.xmlns='items';};wm_items.inherit(wm_generic);var _me=wm_items.prototype;_me.add=function(id,aItemInfo,sDataSet,aDataPath,sFolderDataSet,aHandler)
{function parse_addons(sAddOns,aFrom,aTo){if(typeof aFrom=='object'){var aFrame=aTo[sAddOns]=[{}];var sAddOn=sAddOns.substr(0,sAddOns.length-1);aFrame=aFrame[0][sAddOn]=[{}];var aValues,n;}
n=0;for(var sId in aFrom){aFrame[n]={};for(var sValues in aFrom[sId]){aValues=aFrom[sId][sValues];if(sValues=='uid')
aFrame[n]['ATTRIBUTES']={'UID':aValues};else
if(sValues=='values'){aValuesFrame=aFrame[n]['VALUES']=[{}];parse_values(aValues,aValuesFrame[0]);}
else
parse_addons(sValues,aValues,aFrame[n]);}
n++;}};function parse_values(aFrom,aTo){for(var sValue in aFrom)
if(typeof aFrom[sValue]=='object')
aTo[sValue]=[{'VALUE':aFrom[sValue].pop()}];else
aTo[sValue]=[{'VALUE':aFrom[sValue]}];};if(!id[0]||!id[1])
return false;if(id[2]&&aItemInfo['values']&&(typeof aItemInfo['values']['flags']!='undefined')&&sDataSet){var nFlag=aItemInfo['values']['flags'];dataSet.add(sDataSet,id.concat(['FLAGS']),nFlag);if(sFolderDataSet){var nRecent=dataSet.get(sFolderDataSet,[id[0],id[1],'RECENT']);if(typeof nRecent=='undefined')
nRecent=0;if(this.hasFlag(nFlag,'SEEN')){if(nRecent)
nRecent--;}
else
nRecent++;if(parseInt(dataSet.get(sFolderDataSet,[id[0],id[1],'RECENT'])||0)!=nRecent)
dataSet.add(sFolderDataSet,[id[0],id[1],'RECENT'],nRecent.toString());}}
var aRequest;if(id[2])
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":id[0]},"FOLDER":[{"ATTRIBUTES":{"UID":id[1]},"ITEM":[{"ATTRIBUTES":{"UID":id[2],"ACTION":"edit"}}]}]}]};else
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":id[0]},"FOLDER":[{"ATTRIBUTES":{"UID":id[1]},"ITEM":[{"ATTRIBUTES":{"ACTION":"add"}}]}]}]};var aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"][0];for(var sValues in aItemInfo)
if(sValues!='aid'&&sValues!='fid'&&sValues!='iid')
if(sValues=='values'){aFrame['VALUES']=[{}];parse_values(aItemInfo['values'],aFrame['VALUES'][0]);}
else
parse_addons(sValues,aItemInfo[sValues],aFrame);if(!aFrame['VALUES'])aFrame['VALUES']=[];aFrame['VALUES'][0]['CTZ']=[{VALUE:(new Date).getTimezoneOffset()*-1}];if(!sDataSet)
return this.parse(this.create_iq(aRequest,'','set'));else{this.create_iq(aRequest,[this,'response',['add',sDataSet,aDataPath,sFolderDataSet,{'aid':id[0]},aHandler]],'set');return true;}};_me.copy=function(aItemsInfo,sDataSet,aDataPath,sFolderDataSet,aHandler)
{if(!aItemsInfo['aid']||!aItemsInfo['fid']||!aItemsInfo['folder'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[]}]}]};var aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"];var bItems;for(var nItem in aItemsInfo['iid']){if(aItemsInfo['account'])
aFrame[nItem]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][nItem],"ACTION":"copy"},"ACCOUNT":[{"VALUE":aItemsInfo['account']}],"FOLDER":[{"VALUE":aItemsInfo['folder']}]};else
aFrame[nItem]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][nItem],"ACTION":"copy"},"FOLDER":[{"VALUE":aItemsInfo['folder']}]};bItems=1;}
if(!bItems)return false;if(!sDataSet){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',['copy',sDataSet,aDataPath,sFolderDataSet,{'aid':aItemsInfo['aid'],'fid':aItemsInfo['fid'],'account':aItemsInfo['account']},aHandler]],'set');return true;}};_me.getFlag=function(id,sFlagName,sDataSet){var nFlag=this._getFlagValue(id,sDataSet,'FLAGS');if(!Is.Defined(nFlag))return false;return this.hasFlag(nFlag,sFlagName);};_me.hasFlag=function(nFlag,sFlagName)
{switch(sFlagName){case'ANSWERED':nFlag&=1;break;case'DELETED':nFlag&=2;break;case'DRAFT':nFlag&=4;break;case'FLAGGED':nFlag&=8;break;case'RECENT':nFlag&=16;break;case'SEEN':nFlag&=32;break;case'FORWARDED':nFlag&=64;break;default:return false;}
return(nFlag)?true:false;};_me.setFlag=function(aItemsInfo,aFlagsSet,sDataSet,sFolderDataSet)
{function _setFlag(nFlag,sFlagName,bValue){switch(sFlagName){case'ANSWERED':return(bValue?nFlag|33:nFlag&~1);case'DELETED':return(bValue?nFlag|2:nFlag&~2);case'DRAFT':return(bValue?nFlag|4:nFlag&~4);case'FLAGGED':return(bValue?nFlag|8:nFlag&~8);case'RECENT':return(bValue?nFlag|16:nFlag&~16);case'SEEN':return(bValue?nFlag|32:nFlag&~32);case'FORWARDED':return(bValue?nFlag|96:nFlag&~64);}
return nFlag;}
if(!aItemsInfo['aid']||!aItemsInfo['fid']||!aItemsInfo['iid']||typeof aItemsInfo['iid']!='object'||!count(aItemsInfo['iid']))
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[]}]}]};var aItemFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"];var nFlag,nNewFlag;var nCounter=0;var bUpdate=false;for(var n in aItemsInfo['iid'])
{nFlag=this._getFlagValue([aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid'][n]],sDataSet,'FLAGS');if(typeof nFlag=='undefined')
nFlag=0;nNewFlag=nFlag;for(var sFlagName in aFlagsSet)
nNewFlag=_setFlag(nNewFlag,sFlagName,aFlagsSet[sFlagName]);if(nNewFlag!=nFlag)
{dataSet.add(sDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid'][n],'FLAGS'],nNewFlag,true);aItemFrame.push({"ATTRIBUTES":{"UID":aItemsInfo['iid'][n],"ACTION":"edit"},"VALUES":[{"FLAGS":[{"VALUE":nNewFlag}]}]});nCounter++;bUpdate=true;}}
if(bUpdate){if(aItemsInfo['iid'].length==1)
dataSet.update(sDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid'][0],'FLAGS']);else
dataSet.update(sDataSet);}
if(sFolderDataSet&&nCounter>0)
{var nRecent=parseInt(dataSet.get(sFolderDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],'RECENT'])||0);if(this.hasFlag(nNewFlag,'SEEN'))
dataSet.add(sFolderDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],'RECENT'],(nRecent-nCounter>0?nRecent-nCounter:0).toString());else
dataSet.add(sFolderDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],'RECENT'],(nRecent+nCounter).toString());}
if(!nCounter)
return false;if(!sDataSet)
return this.parse(this.create_iq(aRequest,'','set'));else
{this.create_iq(aRequest,[this,'response',['edit',sDataSet,'',sFolderDataSet,{'aid':aItemsInfo['aid']}]],'set');return true;}};_me.getStaticFlag=function(id,sFlagName,sDataSet)
{var nFlag=this._getFlagValue(id,sDataSet,'STATIC_FLAGS');if(typeof nFlag!='undefined')
return false;switch(sFlagName)
{case'HTMLBODY':return nFlag&1;case'CACHED':return nFlag&2;}
return false;};_me._getFlagValue=function(id,sDataSet,sFlagType)
{if(!sDataSet||!sFlagType)
return false;return dataSet.get(sDataSet,id.concat([sFlagType]));}
_me.move=function(aItemsInfo,sDataSet,aDataPath,sFolderDataSet,aHandler)
{if(!aItemsInfo['aid']||!aItemsInfo['fid']||!aItemsInfo['folder'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[]}]}]};var aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"];var bItems;for(var n in aItemsInfo['iid'])
{if(aItemsInfo['account'])
aFrame[n]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][n],"ACTION":"move"},"ACCOUNT":[{"VALUE":aItemsInfo['account']}],"FOLDER":[{"VALUE":aItemsInfo['folder']}]};else
aFrame[n]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][n],"ACTION":"move"},"FOLDER":[{"VALUE":aItemsInfo['folder']}]};bItems=1;}
if(!bItems)return false;var aResponse=this.create_iq(aRequest,'','set');try{if(sDataSet)
this.response({"Array":aResponse},'move',sDataSet,aDataPath,sFolderDataSet,{'aid':aItemsInfo['aid'],'fid':aItemsInfo['fid'],'account':aItemsInfo['account']},aHandler);else
if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')return true;}
catch(e){}
return false;};_me.quarantine=function(aItemsInfo,sDataSet,aDataPath,sFolderDataSet)
{if(!aItemsInfo['aid']||!aItemsInfo['fid']||!aItemsInfo['action'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[]}]}]};var aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"];var bItems;for(var n in aItemsInfo['iid'])
{aFrame[n]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][n],"ACTION":aItemsInfo['action']}};bItems=1;}
if(!bItems)
return false;var aResponse=this.create_iq(aRequest,'','set');try{if(sDataSet)
this.response({"Array":aResponse},'quarantine',sDataSet,aDataPath,sFolderDataSet,{'aid':aItemsInfo['aid'],'fid':aItemsInfo['fid']});else
if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')return true;}
catch(e){}
return false;};_me.imip=function(aItemInfo,sAction,aHandler)
{if(!aItemInfo['aid']||!aItemInfo['fid']||!aItemInfo['iid'])
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemInfo['fid']},"ITEM":[{"ATTRIBUTES":{"UID":aItemInfo['iid'],"ACTION":sAction}}]}]}]};var aItemRequest=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"][0];if(!aItemInfo['destination'])
switch(aItemInfo['imip_type']){case'VEVENT':aItemInfo['destination']='Events';break;case'VTODO':aItemInfo['destination']='Tasks';break;case'VJOURNAL':aItemInfo['destination']='Journal';break;}
aItemRequest["FOLDER"]=[{"VALUE":aItemInfo['destination']}];if(aItemInfo['partid'])
aItemRequest["PARTID"]=[{"VALUE":aItemInfo['partid']}];if(!aHandler){var aResponse=this.create_iq(aRequest,'','set');try{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else{this.create_iq(aRequest,[this,'response',[sAction,'','','',{'aid':aItemInfo['aid'],'fid':aItemInfo['fid']},aHandler]],'set');return true;}};_me.redirect=function(aItemInfo,sDataSet,aDataPath,aHandler)
{if(!aItemInfo['aid']||!aItemInfo['fid']||!aItemInfo['iid']||(!aItemInfo['to']&&!aItemInfo['distrib']))
return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemInfo['fid']},"ITEM":[{"ATTRIBUTES":{"UID":aItemInfo['iid'],"ACTION":"redirect"}}]}]}]};var aItemRequest=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"][0];if(aItemInfo['to'])
aItemRequest["TO"]=[{"VALUE":aItemInfo['to']}];if(aItemInfo['distrib'])
{aItemRequest["ACCOUNT"]=[];var aAccRequest=aItemRequest["ACCOUNT"];var aFolRequest,aToRequest;var aDistribFrame=aItemInfo['distrib'];var aAccFrame,FolFrame;for(var sAccId in aDistribFrame)
{aAccFrame=aDistribFrame[sAccId];aFolRequest=[];for(var sFolId in aAccFrame)
{aFolFrame=aAccFrame[sFolId];aToRequest=[];for(var n in aFolFrame)
aToRequest.push({"VALUE":aFolFrame[n]});aFolRequest.push({"ATTRIBUTES":{"UID":sFolId},"TO":aToRequest});}
aAccRequest.push({"ATTRIBUTES":{"UID":sAccId},"FOLDER":aFolRequest});}}
if(!sDataSet)
{var aResponse=this.create_iq(aRequest,'','set');try
{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else
{this.create_iq(aRequest,[this,'response',['redirect',sDataSet,aDataPath,'',{'aid':aItemInfo['aid'],'fid':aItemInfo['fid']},aHandler]],'set');return true;}};_me.remove=function(aItemsInfo,sDataSet,aDataPath,sFolderDataSet,aHandler){function parse_values(aFrom,aTo){for(var sValue in aFrom)
if(typeof aFrom[sValue]=='object')
aTo[sValue]=[{'VALUE':aFrom[sValue].pop()}];else
aTo[sValue]=[{'VALUE':aFrom[sValue]}];};if(!aItemsInfo['aid']||!aItemsInfo['fid'])return false;var aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[]}]}]};var aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"];var bItems=0;var bValue=Is.Object(aItemsInfo['values']);for(var n in aItemsInfo['iid']){aFrame[n]={"ATTRIBUTES":{"UID":aItemsInfo['iid'][n],"ACTION":"delete"}};bItems++;if(bValue&&Is.Object(aItemsInfo['values'][n])){aFrame[n]['VALUES']=[{}];parse_values(aItemsInfo['values'][n],aFrame[n]['VALUES'][0]);}}
if(!bItems)
return false;var aResponse=this.create_iq(aRequest,'','set');try{if(sDataSet)
this.response({'Array':aResponse},'remove',sDataSet,aDataPath,sFolderDataSet,{'aid':aItemsInfo['aid'],'fid':aItemsInfo['fid']},aHandler);else
if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')return true;}
catch(e){}
return false;};_me.list=function(aItemsInfo,sDataSet,aDataPath,sFolderDataSet,aHandler)
{if(!aItemsInfo['aid']||!aItemsInfo['fid'])
return false;var aRequest;if(aItemsInfo['iid']){if(aItemsInfo['atid'])
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[{"ATTRIBUTES":{"UID":aItemsInfo['iid'],"ATID":aItemsInfo['atid']}}]}]}]};else
aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']},"ITEM":[{"ATTRIBUTES":{"UID":aItemsInfo['iid']}}]}]}]};}
else{aRequest={"ACCOUNT":[{"ATTRIBUTES":{"UID":aItemsInfo['aid']},"FOLDER":[{"ATTRIBUTES":{"UID":aItemsInfo['fid']}}]}]};if(!window.gui.frm_main.__trash_cleaned){var aTrashFolder=Path.split(GWOthers.getItem('DEFAULT_FOLDERS','trash'));if(typeof aTrashFolder=='object'&&aItemsInfo['aid']==aTrashFolder[0]&&aItemsInfo['fid']==aTrashFolder[1]){var iDay=0;if(GWOthers.getItem('MAIL_SETTINGS_GENERAL','autoclear_trash')>0&&(iDay=GWOthers.getItem('MAIL_SETTINGS_GENERAL','autoclear_trash_days'))>0){aRequest.ACCOUNT[0].FOLDER[0].CLEANUP=[{VALUE:parseInt(iDay)}];window.gui.frm_main.__trash_cleaned=true;}}}}
var aFrame;var bValues;var bSort,bBody;if(aItemsInfo['values'])
{var aValFrame={};for(var nIndex in aItemsInfo['values'])
{aValFrame[aItemsInfo['values'][nIndex]]=[{"VALUE":' '}];if(aItemsInfo['values'][nIndex]=='HTML'||aItemsInfo['values'][nIndex]=='TEXT')
bBody=true;bValues=true;}
if(bBody&&aItemsInfo['iid']&&sDataSet&&aItemsInfo['iid'].indexOf('|')<0){if(this.getFlag([aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid']],'SEEN','items')==false)
{var nFlags=dataSet.get('items',[aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid'],'FLAGS']);if(typeof nFlags!='undefined')
{dataSet.add(sDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],aItemsInfo['iid'],'FLAGS'],nFlags|32);if(sFolderDataSet){var nRecent=parseInt(dataSet.get(sFolderDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],'RECENT'])||0);if(nRecent>0)
dataSet.add(sFolderDataSet,[aItemsInfo['aid'],aItemsInfo['fid'],'RECENT'],(--nRecent).toString());}}}}
if(bValues)
{if(!aItemsInfo['iid'])
aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"]=[{}];aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"][0];aValFrame['CTZ']=[{VALUE:(new Date).getTimezoneOffset()*-1}];aFrame["VALUES"]=[aValFrame];}}
var bFilter=0;if(aItemsInfo['filter']&&!aItemsInfo['iid']){var aFilFrame={};for(var sFilter in aItemsInfo['filter']){aFilFrame[sFilter]=[{"VALUE":aItemsInfo['filter'][sFilter]}];if(sFilter=='order_by'||sFilter=='limit')
bSort=true;bFilter=1;}
if(bFilter){if(!bValues){aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"]=[{}];aFrame=aRequest["ACCOUNT"][0]["FOLDER"][0]["ITEM"][0];}
aFrame["FILTER"]=[aFilFrame];}}
if(!sDataSet){return this.parse(this.create_iq(aRequest),(typeof aItemsInfo.iid=='undefined'?true:false));}
else{this.__lastListId=(new Date()).getTime();this.create_iq(aRequest,[this,'response',['list',sDataSet,aDataPath,sFolderDataSet,{'aid':aItemsInfo['aid'],'fid':aItemsInfo['fid'],'iid':aItemsInfo['iid'],'filter':bFilter},aHandler,bSort]],'',this.__lastListId);return true;}};_me.response=function(aData,sMethodName,sDataSet,aDataPath,sFolderDataSet,aArgs,aHandler,bSort)
{var aXMLResponse=aData['Array'];var aIQAttribute=aXMLResponse['IQ'][0]['ATTRIBUTES'];switch(sMethodName){case'accept':case'decline':if(aIQAttribute['TYPE']=='result')
executeCallbackFunction(aHandler);break;case'edit':if(aIQAttribute['TYPE']!='result'){return;}
case'add':case'list':var bOk=false;if(aIQAttribute['TYPE']!='result'){var str,att;try{att=aXMLResponse.IQ[0].ERROR[0].ATTRIBUTES.UID;str=aXMLResponse.IQ[0].ERROR[0].VALUE;}
catch(e){str=att='';}
switch(att.toLowerCase()){case'smtp_recipients_failed':alert(getLang('ALERTS::SMTP_RECIPIENTS_FAILED')+(str?"\n"+str.unescapeHTML():''));bOk=true;break;case'imap_internal':alert(str.unescapeHTML());default:if(sFolderDataSet){var folders=new wm_folders;folders.list({'aid':aArgs['aid']},sFolderDataSet);}
else{dataSet.remove(sDataSet,aDataPath);}
return false;}}
else
{if(sMethodName=='list'){if(bSort)
dataSet.remove(sDataSet,aDataPath,true);var parsedXMLResponse=this.parse(aXMLResponse,(typeof aArgs['iid']=='undefined'?true:false));dataSet.add(sDataSet,aDataPath,parsedXMLResponse,true);dataSet.update(sDataSet);}
bOk=true;}
if(typeof aHandler=='object')
if(sMethodName=='list'){pushParameterToCallback(aHandler,parsedXMLResponse);executeCallbackFunction(aHandler);}
else
executeCallbackFunction(aHandler,[bOk]);return true;case'copy':case'move':case'remove':try{if(sFolderDataSet)
if(aIQAttribute['TYPE']=='result'){if(sMethodName=='remove'){var aItems=dataSet.get(sDataSet);for(var sAccId in aItems)
for(var sFolId in aItems[sAccId]);var oType=dataSet.get(sFolderDataSet,[sAccId,sFolId,'TYPE']);if(oType=='E'||oType=='0')dataSet.update(sDataSet);}}
else{if(sMethodName!='copy'){var aItems=dataSet.get(sDataSet);for(var sAccId in aItems)
for(var sFolId in aItems[sAccId]);if(sAccId==aArgs['aid']&&sFolId==aArgs['fid']){var aValues=this.default_values(dataSet.get(sFolderDataSet,[sAccId,sFolId,'TYPE']));if(aValues)
this.list({'aid':sAccId,'fid':sFolId,'values':aValues},sDataSet,aDataPath);}}
var folders=new wm_folders;if(aArgs['account']&&aArgs['account']!=aArgs['aid'])
folders.list({'aid':aArgs['account']},sFolderDataSet);folders.list({'aid':aArgs['aid']},sFolderDataSet);}
if(typeof aHandler=='object')
executeCallbackFunction(aHandler);return true;}
catch(e)
{return false;}
case'quarantine':try{if(aIQAttribute['TYPE']=='result'){if(sFolderDataSet){var folders=new wm_folders;folders.list({'aid':aArgs['aid']},sFolderDataSet);}
return true;}}
catch(e){}
return false;case'redirect':if(typeof aHandler=='object'){if(aIQAttribute['TYPE']!='result'){var str,att;try{str=aXMLResponse.IQ[0].ERROR[0].VALUE;att=aXMLResponse.IQ[0].ERROR[0].ATTRIBUTES.UID;}
catch(e){att='';str='unknown error';}
pushParameterToCallback(aHandler,[att,str.unescapeHTML()]);}
executeCallbackFunction(aHandler);}}};_me.default_values=function(sFolType)
{var aValues;switch(sFolType){case'C':aValues=['ITMCLASSIFYAS','ITMTITLE','ITMFIRSTNAME','ITMMIDDLENAME','ITMSURNAME','ITMCLASS','ITMSUFFIX','ITMCOMPANY','ITMDEPARTMENT','LCTEMAIL1','LCTEMAIL2','LCTEMAIL3','ITMCATEGORY'];break;case'E':aValues=['EVNTITLE','EVNLOCATION','EVNSTARTDATE','EVNSTARTTIME','EVNENDDATE','EVNENDTIME','EVNRCR_ID','EVNTYPE','EVNCLASS','EVNCOLOR'];break;case'EI':aValues=['EVNTITLE','EVNLOCATION','EVNSTARTDATE','EVNSTARTTIME','EVNENDDATE','EVNENDTIME','OSD','OED','EVNRCR_ID','EVNTYPE','EVNCLASS','EVNCOLOR'];break;case'J':aValues=['EVNTITLE','EVNLOCATION','EVNSTARTDATE','EVNSTARTTIME','EVNENDDATE','EVNENDTIME','EVNCONTACT','EVNTYPE','EVNCOLOR'];break;case'F':aValues=['EVNTITLE','EVNNOTE','EVNLOCATION','EVNSTARTDATE','EVNSTARTTIME','EVNTYPE','EVNCOLOR','EVNCOMPLETE'];break;case'R':case'M':aValues=['SUBJECT','TO','FROM','DATE','SIZE','FLAGS','HAS_ATTACHMENT','COLOR','PRIORITY','SMIME_STATUS'];break;case'N':aValues=['EVNTITLE','EVNTYPE','EVNCOLOR'];break;case'T':aValues=['EVNTITLE','EVNSTATUS','EVNSTARTDATE','EVNRCR_ID','EVNTYPE','EVNCOLOR'];break;}
return aValues;};_me.parse=function(aData,bCount)
{try{function parse_addons(sAddOns,aAddOns)
{var sAddOnId,aAddOnFrame,aValuesFrame;var aResult={};var aResultValueFrame;var sAddOn=sAddOns.substr(0,sAddOns.length-1);for(var n in aAddOns[sAddOn])
{aAddOnFrame=aAddOns[sAddOn][n]
if(aAddOnFrame['ATTRIBUTES']&&aAddOnFrame['ATTRIBUTES']['UID'])
{sAddOnId=aAddOnFrame['ATTRIBUTES']['UID'];aResult[sAddOnId]={};}
else{sAddOnId='';aResult[n]={};}
for(var sValues in aAddOnFrame)
if(sValues=='VALUES'){aValuesFrame=aAddOnFrame['VALUES'][0];if(sAddOnId)
aResultValueFrame=aResult[sAddOnId]['values']={};else
aResultValueFrame=aResult[n]['values']={};for(var sValue in aValuesFrame)
aResultValueFrame[sValue]=aValuesFrame[sValue][0]['VALUE'];}
else
if(sValues!='ATTRIBUTES')
if(sAddOnId)
aResult[sAddOnId][sValues]=parse_addons(sValues,aAddOnFrame[sValues][0]);else
aResult[n][sValues]=parse_addons(sValues,aAddOnFrame[sValues][0]);}
return aResult;};var aAccFrame=aData['IQ'][0]['QUERY'][0]['ACCOUNT'][0];var sAccId=aAccFrame['ATTRIBUTES']['UID'];var aFolFrame=aAccFrame['FOLDER'][0];var sFolId=aFolFrame['ATTRIBUTES']['UID'];if(typeof aFolFrame['ATTRIBUTES']['RECENT']!='undefined'&&parseInt(dataSet.get("folders",[sAccId,sFolId,'RECENT'])||0)!=parseInt(aFolFrame['ATTRIBUTES']['RECENT']||0))
dataSet.add("folders",[sAccId,sFolId,'RECENT'],(aFolFrame['ATTRIBUTES']['RECENT']).toString());var aItmFrame,sItemId,aValFrame;var aResult={};var aResultFrame=aResult[sAccId]={};aResultFrame=aResultFrame[sFolId]={};if(bCount&&typeof aFolFrame['ATTRIBUTES']['COUNT']!='undefined'&&aFolFrame['ATTRIBUTES']['COUNT']){aResultFrame['/']=aFolFrame['ATTRIBUTES']['COUNT'];aResultFrame['#']=aFolFrame.ITEM?aFolFrame.ITEM.length:0;}
if(typeof aFolFrame['ATTRIBUTES']['OFFSET']!='undefined'&&aFolFrame['ATTRIBUTES']['OFFSET'])
aResultFrame['$']=aFolFrame['ATTRIBUTES']['OFFSET'];var aItemIds={};for(var n in aFolFrame['ITEM'])
{aItmFrame=aFolFrame['ITEM'][n];sItemId=aItmFrame['ATTRIBUTES']['UID'];if(typeof aItemIds[sItemId]=='undefined')
aItemIds[sItemId]=0;else
aItemIds[sItemId]++;if(aItemIds[sItemId])
sItemId+='|'+aItemIds[sItemId];aResultFrame[sItemId]={'aid':sAccId,'fid':sFolId};for(sAddOns in aItmFrame)
if(sAddOns=='VALUES'){aValFrame=aItmFrame['VALUES'][0];for(var sValue in aValFrame)
aResultFrame[sItemId][sValue]=aValFrame[sValue][0]['VALUE'];}
else
if(sAddOns=='NOTE'||sAddOns=='CERIFICATE')
aResultFrame[sItemId][sAddOns]=aItmFrame[sAddOns][0]['VALUE'];else
if(sAddOns!='ATTRIBUTES')
aResultFrame[sItemId][sAddOns]=parse_addons(sAddOns,aItmFrame[sAddOns][0],aResultFrame[sItemId][sAddOns]);}
return aResult;}
catch(e){return false;}};_me.getColorTag=function(sType){switch(sType){case'M':case'R':return'COLOR';case'E':case'J':case'N':case'T':case'F':return'EVNCOLOR';default:return;}};var WMItems=new wm_items;

/*** client/inc/wm_settings.js ***/


/*** client/inc/wm_storage.js ***/

function wm_storage(){};wm_storage.inherit(wm_generic);var _me=wm_storage.prototype;_me.set=function(aStorageInfo,sDataSet,aDataPath,aHandler)
{function parse_attr(aAttrFrame)
{var aAttributes={};for(var sAttr in aAttrFrame)
if(sAttr!='DEFAULT'&&sAttr!='DONT_SEND'&&sAttr!='ACCESS')
aAttributes[sAttr]=aAttrFrame[sAttr];return aAttributes;}
if(typeof aStorageInfo['resources']!='object')
return false;if(aStorageInfo['xmlns']=='public')
this.xmlns='public';else if(aStorageInfo['xmlns']=='domain')
this.xmlns='domain';else
this.xmlns='private';var aRequest={"RESOURCES":[]};if(typeof aStorageInfo['domain']=='string')
aRequest.DOMAIN=[{"VALUE":aStorageInfo['domain']}];var aResourcesFrame=aStorageInfo['resources'];var aAttrFrame,aItemsFrame,aValuesFrame;var aResourcesRequest=aRequest['RESOURCES'][0]={};var aResourceRequest,aAttrRequest,aItemsRequest,aItemRequest;var m,aAttributes;var bResource=false;var bItem=false;var bValue=false;for(var sResource in aResourcesFrame)
{aAttrFrame=aResourcesFrame[sResource]['ATTRIBUTES'];if(!aAttrFrame['DONT_SEND']&&(!aAttrFrame['ACCESS']||aAttrFrame['ACCESS']=='full'))
{aAttrFrame['DONT_SEND']=true;aItemsFrame=aResourcesFrame[sResource]['ITEMS'];aResourceRequest=aResourcesRequest[sResource]=[];aResourceRequest=aResourceRequest[0]={};aItemsRequest=aResourceRequest['ITEM']=[];aAttributes=parse_attr(aAttrFrame);if(count(aAttributes))
aResourceRequest['ATTRIBUTES']=aAttributes;m=0;if(!aItemsFrame.length)
bResource=true;else
for(var n in aItemsFrame)
{aAttrFrame=aItemsFrame[n]['ATTRIBUTES'];if(!aAttrFrame['DONT_SEND']&&(!aAttrFrame['ACCESS']||aAttrFrame['ACCESS']=='full'))
{aAttrFrame['DONT_SEND']=true;aValuesFrame=aItemsFrame[n]['VALUES'];aItemRequest=aItemsRequest[m]={};aAttributes=parse_attr(aAttrFrame);if(count(aAttributes))
aItemRequest['ATTRIBUTES']=aAttributes;for(var sValue in aValuesFrame)
{aAttrFrame=aValuesFrame[sValue]['ATTRIBUTES'];if(!aAttrFrame['DEFAULT']&&(!aAttrFrame['ACCESS']||aAttrFrame['ACCESS']=='full'))
{aValueRequest=aItemRequest[sValue]=[];aValueRequest=aValueRequest[0]={};aAttributes=parse_attr(aAttrFrame);if(count(aAttributes))
aValueRequest['ATTRIBUTES']=aAttributes;aValueRequest['VALUE']=aValuesFrame[sValue]['VALUE'];bValue=true;}}
if(aItemRequest['ATTRIBUTES']||bValue)
{m++;bValue=false;bItem=true;}}}
if(aResourceRequest['ATTRIBUTES']||bItem)
{bItem=false;bResource=true;}}}
if(!bResource)
return 2;if(!sDataSet)
{var aResponse=this.create_iq(aRequest,'','set');try
{if(aResponse['IQ'][0]['ATTRIBUTES']['TYPE']=='result')
return true;}
catch(e){}
return false;}
else
{this.create_iq(aRequest,[this,'response',['set',sDataSet,aDataPath,aHandler]],'set');return true;}};_me.get=function(aStorageInfo,sDataSet,aDataPath,aHandler){if(typeof aStorageInfo['resources']!='object')
return false;if(aStorageInfo['xmlns']=='public')
this.xmlns='public';else if(aStorageInfo['xmlns']=='domain')
this.xmlns='domain';else
this.xmlns='private';var aResources=aStorageInfo['resources'];var bAnything=false;var aRequest={"RESOURCES":[{}]};if(typeof aStorageInfo['domain']=='string')
aRequest.DOMAIN=[{"VALUE":aStorageInfo['domain']}];var aFrame=aRequest['RESOURCES'][0];for(var n in aResources)
if(!sDataSet||aResources[n]!='gw_groups'||aResources[n]!='gw_friends'||!dataSet.get(sDataSet,[aResources[n].toUpperCase()])){aFrame[aStorageInfo['resources'][n]]=[{}];bAnything=true;}
if(!bAnything)
return true;if(!sDataSet)
return this.parse(this.create_iq(aRequest));else{this.create_iq(aRequest,[this,'response',['get',sDataSet,aDataPath,aHandler]]);return true;}};_me.response=function(aResponse,sMethodName,sDataSet,aDataPath,aHandler)
{var aXMLResponse=aResponse['Array'];var aIQAttribute=aXMLResponse['IQ'][0]['ATTRIBUTES'];switch(sMethodName)
{case'set':try{var bOK=aIQAttribute['TYPE']=='result';if(typeof aHandler=='object')
executeCallbackFunction(aHandler,[bOK]);if(bOK)
return true;}
catch(e){}
return false;case'get':try{if(aIQAttribute['TYPE']=='result'){var aResult=this.parse(aXMLResponse);for(var sResource in aResult)
dataSet.add(sDataSet,[sResource],aResult[sResource]);if(typeof aHandler=='object')
executeCallbackFunction(aHandler);return true;}}
catch(e){}
return false;}};_me.parse=function(aData)
{try
{function parse_attr(aAttrFrame,bDontSend)
{var aAttributes={};for(var sAttr in aAttrFrame)
aAttributes[sAttr]=aAttrFrame[sAttr];if(!aAttributes['ACCESS'])
aAttributes['ACCESS']='full';if(bDontSend)
aAttributes['DONT_SEND']=true;return aAttributes;};var aResourcesFrame=aData['IQ'][0]['QUERY'][0]['RESOURCES'][0];var aResourceFrame,aItemFrame,aValueFrame;var aResult={};var aResourceResult,aItemsResult,aItemResult,aValuesResult,aValueResult;for(var sResource in aResourcesFrame)
{aResourceFrame=aResourcesFrame[sResource][0];aResourceResult=aResult[sResource]={};aResourceResult['ATTRIBUTES']=parse_attr(aResourceFrame['ATTRIBUTES'],true);aItemsResult=aResourceResult['ITEMS']=[];for(var n in aResourceFrame['ITEM'])
{aItemFrame=aResourceFrame['ITEM'][n];aItemResult={};aItemResult['ATTRIBUTES']=parse_attr(aItemFrame['ATTRIBUTES'],true);aValuesResult=aItemResult['VALUES']={};for(var sTag in aItemFrame)
if(sTag!='ATTRIBUTES')
{aValueFrame=aItemFrame[sTag][0];aValueResult=aValuesResult[sTag]={};aValueResult['ATTRIBUTES']=parse_attr(aValueFrame['ATTRIBUTES'],false);if(typeof aValueFrame['VALUE']=='undefined')
aValueResult['VALUE']='';else
aValueResult['VALUE']=aValueFrame['VALUE'];}
aItemsResult.push(aItemResult);}}
return aResult;}
catch(e){return false;}};WMStorage=new wm_storage();

/*** client/inc/init.js ***/

function cInit(){window.oWM_INIT=this;var eCopyright=document.getElementById('wm_copyright');if(eCopyright){eCopyright.style.display='none';eCopyright=null;}
this.allowed_cookie={"sid":'',"frm":''};this.allowed_get={"page":'index',"debug":null,"frm":null,"sid":null,"ref":null,"user":"admin","pass":"asd"};this.wm_cookie='wm_cookie';this._vars=this.parse_vars();if(this._vars['debug'])window.api_debug=new cAPI_debug();storage.library('gw_others');GWOthers.load(['skins','login_settings','layout_settings','forgot_settings','restrictions','signup_domains']);storage.language(GWOthers.getItem('LAYOUT_SETTINGS','language'));this.page();};cInit.prototype.parse_vars=function(){var tmp,tmp2;tmp=arrKeySlice(cookieManager.get(this.wm_cookie),this.allowed_cookie);tmp2=arrKeySlice(parseURL(),this.allowed_get);return arrConcat(tmp,tmp2);};cInit.prototype.page=function(){if(this._vars['sid']){dataSet.add('main',['sid'],this._vars['sid']);if(this._vars['ref'])
dataSet.add('main',['referrer_url'],this._vars['ref']);else
if(document.referrer&&document.referrer!=document.location.href)
dataSet.add('main',['referrer_url'],document.referrer);this._checkBrowserVersion()
return;}
switch(this._vars['frm']){case'test':var a=auth.login({"username":this._vars['user'],"password":this._vars['pass']});gui._create('frm_login','login');break;case'main':var a=auth.login({"username":this._vars['user'],"password":this._vars['pass']});gui._create('frm_main','frm_main');break;default:gui._create('frm_login','frm_login','','',1);}};cInit.prototype._checkBrowserVersion=function(){switch(currentBrowser()){case'Mozilla':case'MSIE7':case'Safari':this._continueLogin();break;case'MSIE6':storage.library('wm_storage');storage.library('gw_others');if(GWOthers.getItem('RESTRICTIONS','disable_ie6warning')){this._continueLogin();break;}
dataSet.add('storage','',WMStorage.get({'resources':['login_data']}));var iLastShow=parseInt(GWOthers.getItem('LOGIN_DATA','ie_6_warning_show_on'));var iNow=parseInt((new Date()).getTime());if(!Is.Number(iLastShow)||iLastShow<=iNow-(this._showIEWarningFrequency*86400000)){GWOthers.set('LOGIN_DATA',{'ie_6_warning_show_on':iNow},'storage');WMStorage.set({'resources':dataSet.get('storage')},'storage');gui._create('frm_confirm','frm_confirm','','',[this,'_continueLogin'],'CONFIRMATION::BROWSER_WARNING_TITLE','CONFIRMATION::BROWSER_WARNING_TEXT_IE6');}
else
this._continueLogin();break;default:if(window.confirm(getLang('CONFIRMATION::BROWSER_WARNING_TEXT_UNSUPPORTED')))
this._continueLogin();break;}};cInit.prototype._continueLogin=function(){var me=this;if(!gui.preloader){gui._create("preloader","obj_loader");gui.preloader._value(getLang('PRELOADER::LOADING_DATA'));}
storage.library('javascript');GWOthers.load(['skins','gw_groups','mail_settings_default','mail_settings_general','layout_settings','calendar_settings','default_calendar_settings','cookie_settings','default_reminder_settings','default_folders','signature','restrictions','personalities','read_confirmation']);storage.language(GWOthers.getItem('LAYOUT_SETTINGS','language'));var aAccounts=WMAccounts.list();dataSet.add('accounts','',aAccounts);gui.preloader._value(getLang('PRELOADER::INDEXING'));for(var sAccId in aAccounts)
if(aAccounts[sAccId]&&aAccounts[sAccId]['PRIMARY']){setTimeout(function(){accounts.refresh({'aid':sAccId},'folders',[sAccId],[me,'_updatePreloader']);},0);break;}};cInit.prototype._updatePreloader=function(sError){if(sError){var state=cookieManager.get('LoginState');if(state==='3')
cookieManager.set('LoginState','2',30);alert(sError);window.location.href=window.location.href;return;}
if(gui.preloader)
gui.preloader._value(getLang('PRELOADER::LOADING_DATA'));var me=this;setTimeout(function(){me._startMain();},0);}
cInit.prototype._startMain=function(){storage.css('style');storage.preloadObj();if(gui.preloader)
gui.preloader._destruct();gui._create("frm_main","frm_main","","",true);storage.preloadTpl();};function initgui(){new cInit();};

/*** client/inc/gw_others.js ***/

function gw_others(){};var _me=gw_others.prototype;_me.load=function(aResources,sDataSet,sDataPath){storage.library('wm_storage');sDataSet=sDataSet||'storage';dataSet.add(sDataSet,sDataPath,WMStorage.get({'resources':aResources}));this.checkLayoutSettings(sDataSet,sDataPath);};_me.get=function(sResourceName,sDataSet,bAdmin,bTryGet)
{if(!sResourceName||!sDataSet)
return false;var aResource=dataSet.get(sDataSet,[sResourceName]);var bEmpty=false;if(bTryGet&&typeof aResource!='object'){storage.library('wm_storage');var aRsc=WMStorage.get({'resources':[sResourceName]});if(aRsc[sResourceName]&&typeof aRsc[sResourceName]=='object'&&count(aRsc[sResourceName]['ITEMS'])){aResource=aRsc[sResourceName];dataSet.add(sDataSet,[sResourceName],aResource,true);bEmpty=false;}
aRsc=null;}
if(typeof aResource!='object'||!count(aResource['ITEMS'])){var aResource={'ITEMS':[{'VALUES':{},'ATTRIBUTES':{'DONT_SEND':true}}],'ATTRIBUTES':{'DONT_SEND':true}};bEmpty=true;}
if(!(aResource=this.setDefault(sResourceName,aResource,sDataSet,bEmpty)))
return false;var aAccess2Num={'full':0,'view':1,'none':2};var sAccess=(aResource['ATTRIBUTES']['ACCESS']?aResource['ATTRIBUTES']['ACCESS']:'full');if(bAdmin){var sUserAccess=(aResource['ATTRIBUTES']['USERACCESS']?aResource['ATTRIBUTES']['USERACCESS']:'full');var sDomainAdminAccess=(aResource['ATTRIBUTES']['DOMAINADMINACCESS']?aResource['ATTRIBUTES']['DOMAINADMINACCESS']:'full');}
var aResourceFrame=aResource['ITEMS'][0];var sSubAccess=(aResourceFrame['ATTRIBUTES']['ACCESS']?aResourceFrame['ATTRIBUTES']['ACCESS']:'full');sAccess=(aAccess2Num[sAccess]>=aAccess2Num[sSubAccess]?sAccess:sSubAccess);if(bAdmin){var sUserSubAccess=(aResourceFrame['ATTRIBUTES']['USERACCESS']?aResourceFrame['ATTRIBUTES']['USERACCESS']:'full');var sDomainAdminSubAccess=(aResourceFrame['ATTRIBUTES']['DOMAINADMINACCESS']?aResourceFrame['ATTRIBUTES']['DOMAINADMINACCESS']:'full');sUserAccess=(aAccess2Num[sUserAccess]>=aAccess2Num[sUserSubAccess]?sUserAccess:sUserSubAccess);sDomainAdminAccess=(aAccess2Num[sDomainAdminAccess]>=aAccess2Num[sDomainAdminSubAccess]?sDomainAdminAccess:sDomainAdminSubAccess);}
var aValues=aResourceFrame['VALUES'];var aResult={'VALUES':{},'ACCESS':{}};var aValuesResult=aResult['VALUES'];var aAccessResult=aResult['ACCESS'];if(bAdmin){var aUserAccessResult=aResult['USERACCESS']=[];var aDomainAdminAccessResult=aResult['DOMAINADMINACCESS']=[];}
var sLCValue;for(var sValue in aValues)
{sLCValue=sValue.toLowerCase();aValuesResult[sLCValue]=aValues[sValue]['VALUE'];sSubAccess=(aValues[sValue]['ATTRIBUTES']['ACCESS']?aValues[sValue]['ATTRIBUTES']['ACCESS']:'full');aAccessResult[sLCValue]=(aAccess2Num[sAccess]>=aAccess2Num[sSubAccess]?sAccess:sSubAccess);if(bAdmin){sUserSubAccess=(aValues[sValue]['ATTRIBUTES']['USERACCESS']?aValues[sValue]['ATTRIBUTES']['USERACCESS']:'full');aUserAccessResult[sLCValue]=(aAccess2Num[sUserAccess]>=aAccess2Num[sUserSubAccess]?sUserAccess:sUserSubAccess);sDomainAdminSubAccess=(aValues[sValue]['ATTRIBUTES']['DOMAINADMINACCESS']?aValues[sValue]['ATTRIBUTES']['DOMAINADMINACCESS']:'full');aDomainAdminAccessResult[sLCValue]=(aAccess2Num[sDomainAdminAccess]>=aAccess2Num[sDomainAdminSubAccess]?sDomainAdminAccess:sDomainAdminSubAccess);}}
return aResult;};_me.set=function(sResourceName,aResourceInfo,sDataSet,aAccess)
{if(!sResourceName||typeof aResourceInfo!='object'||!sDataSet)
return false;var aResource=dataSet.get(sDataSet,[sResourceName]);if(typeof aResource=='object'&&count(aResource['ITEMS']))
{var aResourceFrame=aResource['ITEMS'][0];var aValues=aResourceFrame['VALUES'];var bChange=false;var bLocalChange=false;var sUCValue;for(var sValue in aResourceInfo)
{bLocalChange=false;sUCValue=sValue.toUpperCase();if(typeof aValues[sUCValue]!='object')
aValues[sUCValue]={'ATTRIBUTES':{}};if(aValues[sUCValue]['VALUE']!=aResourceInfo[sValue]){aValues[sUCValue]['VALUE']=aResourceInfo[sValue];bLocalChange=true;}
if(aAccess){if(aAccess['USERACCESS']){var sUserAccess=(aValues[sUCValue]['ATTRIBUTES']['USERACCESS'])?aValues[sUCValue]['ATTRIBUTES']['USERACCESS']:'full';var sNewUserAccess=(aAccess['USERACCESS'][sValue])?aAccess['USERACCESS'][sValue]:'full';if(sUserAccess!=sNewUserAccess){aValues[sUCValue]['ATTRIBUTES']['USERACCESS']=sNewUserAccess;bLocalChange=true;}}
if(aAccess['DOMAINADMINACCESS']){var sDomainAdminAccess=(aValues[sUCValue]['ATTRIBUTES']['DOMAINADMINACCESS'])?aValues[sUCValue]['ATTRIBUTES']['DOMAINADMINACCESS']:'full';var sNewDomainAdminAccess=(aAccess['DOMAINADMINACCESS'][sValue])?aAccess['DOMAINADMINACCESS'][sValue]:'full';if(sDomainAdminAccess!=sNewDomainAdminAccess){aValues[sUCValue]['ATTRIBUTES']['DOMAINADMINACCESS']=sNewDomainAdminAccess;bLocalChange=true;}}}
if(bLocalChange){bChange=true;aValues[sUCValue]['ATTRIBUTES']['DEFAULT']=false;}}
if(bChange)
{aResource['ATTRIBUTES']['DONT_SEND']=false;aResourceFrame['ATTRIBUTES']['DONT_SEND']=false;dataSet.add(sDataSet,[sResourceName],aResource);}}
else
{aResource={'ITEMS':[{'VALUES':{},'ATTRIBUTES':{'DONT_SEND':false}}],'ATTRIBUTES':{'DONT_SEND':false}};var aValues=aResource['ITEMS'][0]['VALUES'];for(var sValue in aResourceInfo)
aValues[sValue.toUpperCase()]={'VALUE':aResourceInfo[sValue],'ATTRIBUTES':{}};dataSet.add(sDataSet,[sResourceName],aResource);}
return true;};_me.getItem=function(sResourceName,sItemName){var rsc=GWOthers.get(sResourceName,'storage');return(rsc.VALUES&&rsc.VALUES[sItemName])?rsc.VALUES[sItemName]:'';};_me.setItem=function(sResourceName,sItemName,v){var tmp={};tmp[sItemName]=v;var rsc=GWOthers.set(sResourceName,tmp,'storage');};_me.setDefault=function(sResourceName,aResource,sDataSet,bEmpty){var aValues=this.getDefaultValues(sResourceName);if(typeof aValues=='object')
{var aResourceValues=aResource['ITEMS'][0]['VALUES'];for(sValue in aValues)
if(typeof aResourceValues[sValue]=='undefined')
aResourceValues[sValue]={'VALUE':aValues[sValue],'ATTRIBUTES':{'DEFAULT':true}};dataSet.add(sDataSet,[sResourceName],aResource);return aResource;}
else
if(bEmpty)
return false;else
return aResource;};_me.getDefaultValues=function(sResourceName)
{var aValues;switch(sResourceName){case'SKINS':aValues={'DEFAULT':'Default'};break;case'MAIL_SETTINGS_DEFAULT':aValues={'SPELLCHECKER':'en','HTML_MESSAGE':0,'READ_CONFIRMATION':0,'SAVE_SENT_MESSAGE':1,'ENCRYPT':0,'SIGN':0,'REPLY_TO_ADDRESS':'','PRIORITY':3,'CHARSET':'UTF-8'};break;case'MAIL_SETTINGS_GENERAL':aValues={'SOUND_NOTIFY':0,'AUTOUPDATE':0,'AUTOUPDATE_MINUTES':5,'MOVE_TO_TRASH':1,'FORWARD_MESSAGES':'inline','AUTOSAVE':1,'AUTOSAVE_MINUTES':5,'DEFAULT_FLAG':'1','AUTO_RECIPIENT_TO_ADDRESSBOOK':'0','AUTO_SHOW_IMAGES':'0','AUTOCLEAR_TRASH_DAYS':'30'};break;case'LAYOUT_SETTINGS':aValues={'SKIN':'default','LANGUAGE':'en','AB_VIEW_LIMIT':10,'LOGO':'logo.gif','DATE_FORMAT':0};break;case'CALENDAR_SETTINGS':aValues={'WEEK_BEGINS':'sunday','BEGIN_ON_TODAY':0,'DAY_BEGINS':8,'DAY_ENDS':16};break;case'DEFAULT_CALENDAR_SETTINGS':aValues={'EVENT_VIEW':'week_view','EVENT_SHOW_AS':'S','EVENT_SHARING':'U','CONTACT_SHARING':'U','JOURNAL_SHARING':'U','NOTE_SHARING':'U','TASK_SHARING':'U'};break;case'DEFAULT_REMINDER_SETTINGS':aValues={'TIME':0,'RM_TYPE':'E','EMAIL':''};break;case'DEFAULT_FOLDERS':aValues={'SENT':sPrimaryAccount+'/Sent','TRASH':sPrimaryAccount+'/Trash','DRAFTS':sPrimaryAccount+'/Drafts','SPAM':sPrimaryAccount+'/Spam'};break;case'READ_CONFIRMATION':aValues={'TEXT':getLang('EMAIL::READING_CONFIRMATION'),'SUBJECT':getLang('EMAIL::READING_CONFIRMATION_SUBJECT')};break;case'SIGNATURE':aValues={'TEXT':'','TO_TOP':1};break;case'LOGIN_DATA':aValues={'IE_6_WARNING_SHOW_ON':0};break;case'FORGOT_SETTINGS':aValues={'FORGOT':0,'MAIL':getLang('FORGOT_PASS::EMAIL'),'SUBJECT':getLang('FORGOT_PASS::SUBJECT')};break;case'RESTRICTIONS':aValues={'DISABLE_OTHERACCOUNTS':0,'DISABLE_CHANGEPASS':0,'DISABLE_SIGNUP':1};break;}
return aValues;};_me.checkLayoutSettings=function(sDataSet,sDataPath){var aSkin=this.get('SKINS',sDataSet,sDataPath);if(aSkin){var aData={};for(var i in aSkin['VALUES'])
if(i!='value')
aData[i]=aSkin['VALUES'][i];if(!aData[this.getItem('LAYOUT_SETTINGS','skin')])
this.setItem('LAYOUT_SETTINGS','skin',this.getDefaultValues('LAYOUT_SETTINGS').SKIN);}
var aLang=this.get('LANGUAGES',sDataSet,sDataPath);if(aLang){var aData={};for(var i in aLang['VALUES'])
aData[i]=aLang['VALUES'][i];if(!aData[this.getItem('LAYOUT_SETTINGS','language')])
this.setItem('LAYOUT_SETTINGS','language',this.getDefaultValues('LAYOUT_SETTINGS').LANGUAGE);}};var GWOthers=new gw_others();

/*** client/inc/json.js ***/

if(!this.JSON){JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}})();

/*** client/inc/obj_container_generic.js ***/

_me=obj_container_generic.prototype;function obj_container_generic(){}
_me._saveall=function(b){var dset={};for(var i in this){if(i.indexOf('_')==0)continue;if(typeof this[i]._saveme!=='undefined')
dset[this[i]._saveme(true)]=1;if(typeof obj[i]._saveall!=='undefined')
dset=objConcat(dset,this[i]._saveall(true));}
if(!b&&count(dset)){for(var i in dset)dataSet.update(i);return{};}
return dset;};

/*** client/inc/obj_form_generic.js ***/

_me=obj_form_generic.prototype;function obj_form_generic(){};_me._value=function(v){if(typeof v!='undefined'){this.__eIN.value=v;if(this.__restrictions&&this.__restrictions.length)this.__check();}
return this.__eIN.value.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n");};_me._disabled=function(b){if(typeof b=='undefined')
return this.__eIN.disabled;else
if(b){this.__eIN.disabled=true;addcss(this.__eIN,'disabled');}
else{this.__eIN.disabled=false;removecss(this.__eIN,'disabled');}};_me._focus=function(){setTimeout('try{'+this._pathName+'.__eIN.focus();}catch(er){}',300);};_me._tabindex=function(i){this.__eIN.tabIndex=parseInt(i);};_me.__update=function(sDataSet){if(!this._listener)
this._listener=sDataSet;else
if(sDataSet&&this._listener!=sDataSet)return;this._value(dataSet.get(this._listener,this._listenerPath));};

/*** client/inc/obj_form_restrict.js ***/

_me=obj_form_restrict.prototype;function obj_form_restrict(){};_me._restrict=function(){if(!arguments.length){this._disobeyEvent('onkeyup',[this,'__check']);this.__restrictions=null;return;}
this.__restrictions=arguments;this._obeyEvent('onkeyup',[this,'__check']);this.__check();};_me.__check=function(){if(!this.__restrictions||!this.__restrictions.length){if(this._checkError.length&&this._onerror){this._checkError=[];removecss(this._main,'error');this._onerror(false);}
return true;}
var r=this.__restrictions,v=this._value(),x,re,invert,ok;var checkError=[];for(var i=0;i<r.length;i+=2){re=r[i];ok=false;if(re.indexOf('!')===0){invert=true;re=re.substr(1);}
else
invert=false;if(re.charAt(0)==">"){var number;if(re.charAt(re.length-1)=='i'){if(v.match(/^[0-9]+$/)!=null&&(number=parseInt(v))!=NaN&&number>re.substr(1,re.length-2))
ok=true;}
else
if(v.match(/^[0-9.]+$/)!=null&&(number=parseFloat(v))!=NaN&&number>re.substr(1))
ok=true;}
else
if(re.charAt(0)=="<"){var number;if(re.charAt(re.length-1)=='i'){if(v.match(/^[0-9]+i?$/)&&(number=parseInt(v))!=NaN&&number<re.substr(1,re.length-2))
ok=true;}
else
if(v.match(/^[0-9.]+i?$/)&&(number=parseFloat(v))!=NaN&&number<re.substr(1))
ok=true;}
else{x=new RegExp(re,'gi');if(v.match(x))ok=true;}
if((ok&&invert)||(!ok&&!invert))
checkError.push(r[i+1]);}
if(checkError.length){addcss(this._main,'error');if(this._onerror&&!this._checkError.length){this._checkError=checkError;this._onerror(true);}
else
this._checkError=checkError;return false;}
if(this._checkError.length){this._checkError=[];if(this._onerror)this._onerror(false);removecss(this._main,'error');}
return true;};

/*** client/inc/obj_label.js ***/

_me=obj_label.prototype;function obj_label(){};_me.__constructor=function(){this.__eIN=mkElement('label',{"name":this._pathName+'main',"id":this._pathName+'main'});this._main.appendChild(this.__eIN);this.__eIN.className=this._type;var me=this;this.__eIN.onclick=function(e){e=e||window.event;if(me._onclick)me._onclick(e);me.__exeEvent('onclick',e,{"owner":me});}};_me._value=function(v){if(typeof v!='undefined'){this.__eIN.innerHTML=v;return v;}
return this.__eIN.innerHTML;};_me.__update=function(sDataSet){if(!this._listener)
this._listener=sDataSet;else
if(sDataSet&&this._listener!=sDataSet)return;this._value(dataSet.get(this._listener,this._listenerPath));};_me._bind=function(sElmName){this.__eIN.setAttribute("for",sElmName);};

/*** client/inc/obj_tabs.js ***/

_me=obj_tabs.prototype;function obj_tabs(){};_me._value=function(v){if(v&&v.indexOf("_")!=0&&typeof this[v]=='object')this[v]._active();return this.__value;};

/*** client/inc/obj_tab.js ***/

_me=obj_tab.prototype;function obj_tab(){};_me.__constructor=function(){this._isActive=false;this._isDisabled=false;this._wasActivated=false;var me=this;this.__drawTpl=null;this.__drawObj=null;this.__drawData=null;this.__eLink=mkElement('a',{'href':''});this.__eLink.onclick=this.__eLink.onfocus=function(){me._active();}
this.__eLi=mkElement('li');this.__eLi.appendChild(this.__eLink);var elm=this._parent._getAnchor('links');elm.appendChild(this.__eLi);elm=null;var first=1;for(var i in this._parent){if(i.indexOf('_')==0||this._parent[i]._name==this._name)continue;first=0;break;}
if(first)this._active();this._add_destructor('__destruct');};_me._value=function(v){this.__eLink.innerHTML=getLang(v);};_me._disabled=function(b){if(b==this._isDisabled)return;if(b){addcss(this.__eLi,'disabled');addcss(this._main,'obj_tabdisabled');}
else{removecss(this.__eLi,'disabled');removecss(this._main,'obj_tabdisabled');}
this._isDisabled=b;};_me._active=function(draw){if(this._isActive||this._isDisabled)return;draw=draw||false;this._isActive=true;this._wasActivated=true;if(this.__drawTpl){if(count(this.__drawTpl[2])<=0&&count(this.__drawData)>0)
this.__drawTpl[2]=this.__drawData;this._draw(this.__drawTpl[0],this.__drawTpl[1],this.__drawTpl[2]);draw=true;this.__drawTpl=null;}
if(this.__drawObj){this.__addObjects(this.__drawObj,null,this.__drawData);draw=true;this.__drawObj=null;}
if(this._parent.__value)this._parent[this._parent.__value].__deactive();this._parent.__value=this._name;addcss(this._main,'obj_tab_active');addcss(this.__eLi,'active');if(this._onactive)this._onactive(draw);this.__exeEvent('onactive',null,{"draw":draw,"owner":this});};_me.__deactive=function(){if(this._isActive==false)return;removecss(this._main,'obj_tab_active');removecss(this.__eLi,'active');this._isActive=false;};_me.__destruct=function(){if(this.__eLink)this.__eLink.parentNode.removeChild(this.__eLink);if(this.__eLi)this.__eLi.parentNode.removeChild(this.__eLi);this.__eLi=null;this.__eLink=null;this.__eMain=null;};

/*** client/inc/obj_input.js ***/

_me=obj_input.prototype;function obj_input(){};_me.__constructor=function(){var me=this;this._checkError=[];var elm=mkElement('input',{"type":'text',"name":this._pathName+'main',"id":this._pathName+'main'});if(this._type=='obj_password')elm.setAttribute('type','password');this._main.appendChild(elm);elm.className=this._type!='obj_input'?'obj_input '+this._type:'obj_input';this.__eIN=elm.form[elm.name];elm=null;this.__eIN.setAttribute('autocomplete',"off");this.__eIN.onkeydown=function(e){var e=e||window.event;switch(e.keyCode){case 13:if(me._onsubmit)me._onsubmit(e);break;case 27:if(me._onclose)return me._onclose(e);break;case 9:break;}
if(me._onkeydown)return me._onkeydown(e);me.__exeEvent('onkeydown',e,{"owner":me});return e.keyCode==13?false:true;};this.__eIN.onblur=function(e){var e=e||window.event;if(me._onblur)return me._onblur(e);me.__exeEvent('onblur',e,{"owner":me});return true;};this.__eIN.onfocus=function(e){var e=e||window.event;if(me._onfocus)me._onfocus(e);me.__exeEvent('onfocus',e,{"owner":me});return true;};this.__eIN.onkeyup=function(e){var e=e||window.event;if(me._onkeyup)me._onkeyup(e);me.__exeEvent('onkeyup',e,{"owner":me});return true;};this.__eIN.onclick=function(e){var e=e||window.event;if(me._onclick)me._onclick(e);me.__exeEvent('onclick',e,{"owner":me});return true;};this._main.onfocus=function(er){me.__eIN.focus();};};_me._getCartPos=function(){if(document.selection){var bookmark="¨";var orig=this._value();var caretPos=document.selection.createRange();var sel=caretPos.text;caretPos.text=bookmark;var tmpText=this._value();var i=tmpText.search(bookmark);this._value(orig);this._setRange(i,sel.length);return i;}
else
return this.__eIN.selectionStart;};_me._setRange=function(pos1,pos2){pos1=pos1||0;if(document.selection){var r=this.__eIN.createTextRange();r.collapse(true);r.moveStart("character",pos1);if(pos2)r.moveEnd("character",pos2);r.select();}
else
this.__eIN.setSelectionRange(pos1,pos2||pos1);this.__eIN.focus();};

/*** client/inc/obj_button.js ***/

_me=obj_button.prototype;function obj_button(){};_me.__constructor=function(){var elm=mkElement('input',{"type":'button',"name":this._pathName+'main',"id":this._pathName+'main'});this._main.appendChild(elm);elm.className=this._type;this.__eIN=elm.form[elm.name];var me=this;this.__eIN.onclick=function(e){var e=e||window.event;if(me._onclick)me._onclick(e);return false;}};_me._value=function(sValue){return this.__eIN.value=sValue?getLang(sValue):this.__eIN.value;};_me._title=function(sValue){return this.__eIN.value=sValue;};

/*** client/inc/obj_select.js ***/

_me=obj_select.prototype;function obj_select(){};_me.__constructor=function(){var me=this;this.__visibleOptions=false;this.__idTable={};this.__tempValue='';this.__disabled=false;setSelectNone(this._main);this.__eButton=this._getAnchor('button');this.__eButton.onmousemove=function(e){if(me.__disabled)return false;if(this.className.indexOf('obj_selectbuttonhover')==-1)addcss(this,'obj_selectbuttonhover');};this.__eButton.onmouseout=function(e){if(this.className.indexOf('obj_selectbuttonhover')>-1)removecss(this,'obj_selectbuttonhover');};this.__eButton.onclick=function(e){if(me.__disabled)return false;if(me.__visibleOptions)
me.__hide();else
me.__show();return false;};this.__eButton.onfocus=function(e){if(me._onfocus)
me._onfocus(e);me.__exeEvent('onfocus',null,{"owner":this});};this.__eButton.onblur=function(e){me.__hideTimeout=window.setTimeout('try{'+me._pathName+'.__hide();}catch(err){}',150);};this.__eButton.onkeydown=function(e){if(me.__disabled)return false;var e=e||window.event;var elm=e.target||e.srcElement;if(e.keyCode>36&&e.keyCode<41){if(!me.__tempValue.toString().length)me.__tempValue=me.__value;if(!me.__tempValue.toString().length)return false;var before,myself,after;for(var i in me.__idTable){if(i!=me.__tempValue){if(typeof myself=='undefined')
before=i;else{after=i;break;}}
else
myself=i;}}
switch(e.keyCode){case 37:case 38:if(typeof myself!='undefined'&&typeof before!='undefined')me._value(before);return false;case 39:case 40:if(typeof myself!='undefined'&&typeof after!='undefined')me._value(after);return false;case 13:break;case 27:me.__hide();break;}};};_me.__createOptionList=function(){if(!this.__idTable||!count(this.__idTable))
return false;if(this.__eOptions)
return true;this.__eOptions=mkElement('div');this.__eOptions.id=this._pathName+'.options';this.__eOptions.className=this._main.className+' obj_select_options';document.getElementsByTagName('body')[0].appendChild(this.__eOptions);setSelectNone(this.__eOptions);this._add_destructor('__destructor',this._pathName);var me=this;this.__eOptions.onmousedown=function(){var e=e||window.event;var elm=e.target||e.srcElement;switch(elm.tagName){case'A':break;case'SPAN':elm=elm.parentNode;break;default:return false;}
var id=elm.getAttribute('id').substr(me._pathName.length);me._value(id);me.__hide();};this.__eOptions.onmouseover=function(e){var e=e||window.event;var elm=e.target||e.srcElement;if(elm.tagName!='A')return;var id=elm.getAttribute('id').substr(me._pathName.length);if(typeof me.__tempValue!='undefined'){if(me.__tempValue==id)return false;var elm=document.getElementById(me._pathName+me.__tempValue);if(elm)removecss(elm,'active');}
me.__activate(id);me.__tempValue=id;};this._fill();return true;};_me.__destructor=function(x){if(this.__eOptions)this.__eOptions.parentNode.removeChild(this.__eOptions);};_me.__show=function(){if(this.__hideTimeout)
window.clearTimeout(this.__hideTimeout);if(!this.__createOptionList())
return;this.__visibleOptions=true;var pos_scroll=this._getScrollPosition();var pos=getSize(this._main);pos.x-=pos_scroll.x;pos.y-=pos_scroll.y;this.__eOptions.style.width=pos.w+'px';this.__eOptions.style.top=(pos.y+pos.h)+'px';this.__eOptions.style.left=pos.x+'px';this.__eButton.focus();this.__eOptions.style.display='block';if(count(this.__idTable)>10){this.__eOptions.style.overflow='auto';var size=0;try{size=getSize(this.__eOptions.getElementsByTagName('A')[0]).h*10;}
catch(er){size=153;}
this.__eOptions.style.height=size+'px';}
else{this.__eOptions.style.overflow='visible';this.__eOptions.style.height='auto';}
this.__activate();};_me.__hide=function(){this.__visibleOptions=false;if(this.__eOptions)
this.__eOptions.style.display='none';var elm;if((elm=document.getElementById(this._pathName+this.__tempValue)))removecss(elm,'active');};_me._getTextValue=function(){if(typeof this.__idTable[this.__value]=='object')
return this.__idTable[this.__value][0];else
return this.__idTable[this.__value];};_me._value=function(sData,bNoEvn){if(typeof sData=='undefined')return this.__value;var data=typeof this.__idTable[sData]=='object'?this.__idTable[sData][0]:this.__idTable[sData];text=Is.String(data)?data.entityify():data;if(typeof data=='undefined'||(this.__value==sData&&this.__eButton.innerHTML==text))return;this.__eButton.innerHTML='<span>'+text+'</span>';this.__activate(sData);this.__value=sData;if(typeof this.__idTable[sData]=='object')
this.__eButton.className='obj_selectbutton '+this.__idTable[sData][1];if(!bNoEvn){if(this._onchange)this._onchange(null);this.__exeEvent('onchange',null,{"owner":this});}};_me.__activate=function(key){if(!this.__eOptions)return;var elm;if(this.__tempValue){if((elm=document.getElementById(this._pathName+this.__tempValue)))
removecss(elm,'active');this.__tempValue='';}
if(this.__value&&(elm=document.getElementById(this._pathName+this.__value))){if(typeof key=='undefined'){addcss(elm,'active');if(elm.offsetTop>this.__eOptions.scrollTop+this.__eOptions.clientHeight||elm.offsetTop<this.__eOptions.scrollTop)
this.__eOptions.scrollTop=elm.offsetTop-(this.__eOptions.clientHeight/2);return;}
else
removecss(elm,'active');}
if(typeof key!='undefined'&&(elm=document.getElementById(this._pathName+key))){addcss(elm,'active');if(elm.offsetTop<this.__eOptions.scrollTop)
this.__eOptions.scrollTop=elm.offsetTop+1;else
if(elm.offsetTop+elm.offsetHeight>this.__eOptions.clientHeight+this.__eOptions.scrollTop)
this.__eOptions.scrollTop=elm.offsetTop+elm.offsetHeight-this.__eOptions.clientHeight-1;}};_me._fill=function(aData){if(aData)
this.__idTable=aData
if(this.__eOptions)
this.__eOptions.innerHTML='';if(!count(this.__idTable)||!this.__eOptions)
return false;var eTmp,sTmp,title;for(var i in this.__idTable){eTmp=mkElement('a',{"href":''});if(typeof this.__idTable[i]=='object'){title=this.__idTable[i][0];eTmp.className=this.__idTable[i][1];}
else
title=this.__idTable[i];eTmp.title=Is.String(title)?title.entityify():title;eTmp.innerHTML='<span>'+(title?title.escapeHTML():'&nbsp;')+'</span>';eTmp.setAttribute('id',this._pathName+i);this.__eOptions.appendChild(eTmp);eTmp=null;}
this.__activate();};_me._fillLang=function(aData){this.__idTable={};for(var i in aData){if(typeof aData[i]=='object')
this.__idTable[i]=[getLang(aData[i][0]),aData[i][1]];else
this.__idTable[i]=getLang(aData[i]);}
this._fill();};_me._disabled=function(b){this.__disabled=(b?true:false);if(this.__disabled){addcss(this.__eButton,'obj_selectdisabled');this.__hide();}
else
removecss(this.__eButton,'obj_selectdisabled');};_me.__update=function(sDataSet){if(!sDataSet)return;if(this._listener==sDataSet)
this._value(dataSet.get(this._listener,this._listenerPath));else
if(this._listener_data==sDataSet)
this._fill(dataSet.get(this._listener_data,this._listenerPath_data));};_me._listen_data=function(sDataSet,aDataPath){this._listener_data=sDataSet;if(typeof aDataPath=='object')this._listenerPath_data=aDataPath;dataSet.obey(this,'_listener_data',sDataSet);};

/*** client/inc/obj_loader.js ***/

_me=obj_loader.prototype;function obj_loader(){};_me._value=function(s){this._getAnchor('text').innerHTML=s;};

/*** client/inc/frm_login.js ***/

_me=frm_login.prototype;function frm_login(){};_me.__constructor=function(init){this._showIEWarningFrequency=1;var me=this;if(!init){storage.library('gw_others');GWOthers.load(['skins','login_settings','layout_settings','forgot_settings','restrictions','signup_domains']);}
this.__csid=unique_id();this._draw('frm_login','main',{userstring:GWOthers.getItem('LOGIN_SETTINGS','logging_type')>0?getLang('LOGIN_SCREEN::EMAIL'):getLang('LOGIN_SCREEN::USER'),csid:this.__csid,disable_forgot:GWOthers.getItem('FORGOT_SETTINGS','forgot')<1,disable_remember:GWOthers.getItem('RESTRICTIONS','disable_remember')>0,disable_signup:GWOthers.getItem('RESTRICTIONS','disable_signup')>0});document.title=GWOthers.getItem('LAYOUT_SETTINGS','title')||getLang('LOGIN_SCREEN::TITLE');this._create('btn_submit','obj_button','footer');this.btn_submit._value('LOGIN_SCREEN::LOGIN');if(this.tabs.tab1.inp_radio){var state=cookieManager.get('LoginState');if(typeof state=='undefined'||(state!='3'&&state!='2'&&state!='1'))
state=0;this.tabs.tab1.inp_radio._value(state);this.tabs.tab1.inp_radio._onchange=function(e){cookieManager.set('LoginState',this._value(),30);};var data=cookieManager.get('LoginData');if(data&&data.pass)this.tabs.tab1.inp_pass._value('*****');if(data&&data.user){this.tabs.tab1.inp_user._value(data.user);if(!data.pass)
this.tabs.tab1.inp_pass._focus();else
this.tabs.tab1.inp_user._focus();}
else
this.tabs.tab1.inp_user._focus();}
else{this.tabs.tab1.inp_user._focus();state=0;}
this._submit=function(){if(me.tabs.tab1._isActive){var aLogin={"username":me.tabs.tab1.inp_user._value()};if(!me.tabs.tab1.inp_radio){cookieManager.set('LoginState','');cookieManager.set('LoginData','');aLogin.password=me.tabs.tab1.inp_pass._value();}
else
switch(me.tabs.tab1.inp_radio._value().toString()){case'3':case'2':if(!data||!data.user||!data.pass||me.tabs.tab1.inp_pass._value()!='*****')
cookieManager.set('LoginData',{"user":me.tabs.tab1.inp_user._value(),"pass":auth.digest(me.tabs.tab1.inp_user._value(),me.tabs.tab1.inp_pass._value())},30);if(data&&data.pass&&me.tabs.tab1.inp_pass._value()=='*****'){var tmpc=cookieManager.get('LoginData');if(me.tabs.tab1.inp_user._value()!=data.user||(tmpc&&!tmpc.pass))
cookieManager.set('LoginData',{"user":me.tabs.tab1.inp_user._value(),"pass":data.pass},30);aLogin.digest=data.pass;break;}
default:switch(me.tabs.tab1.inp_radio._value().toString()){case'3':case'2':break;case'1':cookieManager.set('LoginData',{"user":me.tabs.tab1.inp_user._value()},30);break;default:cookieManager.set('LoginData','');break;}
if(data&&data.pass&&me.tabs.tab1.inp_pass._value()=='*****')
aLogin.digest=data.pass;else{aLogin.password=me.tabs.tab1.inp_pass._value();delete aLogin.digest;}}
var sid=auth.login(aLogin);if(sid&&!auth.error){me._destruct();var celm;if((celm=document.getElementById('gui.svn'))){celm.style.display='none';celm=null;}
window.oWM_INIT._checkBrowserVersion();return;}
else if(Is.Object(auth.error)){switch(auth.error.id){case'login_account_valid':alert(getLang('ERROR::ACCOUNT_DISABLED'));break;case'login_invalid':alert(getLang('ERROR::INVALID_LOGIN'));break;}}
me.tabs.tab1.inp_user._disabled(false);me.tabs.tab1.inp_pass._disabled(false);if(me.tabs.tab1.inp_radio)
me.tabs.tab1.inp_radio._disabled(false);}
else
if(me.tabs.tab2&&me.tabs.tab2._isActive){var aResponse=auth._forgot(me.tabs.tab2.inp_mail._value(),me.__csid,me.tabs.tab2.captcha._value());me.tabs.tab2.inp_mail._disabled(false);me.tabs.tab2.captcha._disabled(false);if(Is.Array(aResponse)){alert(getLang('FORGOT_PASS::FORGOT_SEND')+"\n"+aResponse.join(', '));me.tabs.tab2.inp_mail._value('');me.tabs.tab2.inp_mail._focus();me.tabs.tab2.captcha._value('');try{document.getElementById(me.tabs.tab2._pathName+'captcha1').ondblclick();}catch(er){}}
else
switch(aResponse){case'confirmation_uid':case'confirmation_word_mismatch':try{document.getElementById(me.tabs.tab2._pathName+'captcha1').ondblclick();}catch(er){}
alert(getLang('FORGOT_PASS::CAPTCHA_ERROR'));me.tabs.tab2.captcha._value('');me.tabs.tab2.captcha._focus();break;default:alert(getLang('FORGOT_PASS::FORGOT_ERROR'));me.tabs.tab2.inp_mail._focus();}}
else
if(me.tabs.tab3&&me.tabs.tab3._isActive){var oTab=me.tabs.tab3;var pass1=oTab.inp_pass._value();var pass2=oTab.inp_pass_conf._value();if(!pass1||pass1!==pass2){alert(getLang('SIGN_UP::INVALID_CPASS'));oTab.inp_pass_conf._value('');oTab.inp_pass_conf._focus();oTab.__checksubmit();return false;}
var aResponse=WMAccounts._signup(oTab.inp_user._value(),pass1,oTab.inp_full._value(),oTab.inp_domain._value(),oTab.inp_alt._value(),me.__csid,oTab.captcha._value());switch(aResponse.uid){case'confirmation_uid':case'confirmation_word_mismatch':try{document.getElementById(oTab._pathName+'captcha2').ondblclick()}catch(er){}
alert(getLang('SIGN_UP::CAPTCHA_ERROR'));oTab.captcha._value('');oTab.captcha._focus();break;case true:oTab.inp_user._value('');oTab.inp_pass._value('');oTab.inp_pass_conf._value('');oTab.inp_full._value('');oTab.inp_alt._value('');oTab.captcha._value('');try{document.getElementById(oTab._pathName+'captcha2').ondblclick()}catch(er){}
oTab.__checksubmit();alert(getLang('SIGN_UP::ACCOUNT_CREATED'));me.tabs.tab1._active();break;case'account_signup_error':switch(aResponse['value'].toString()){case'6':alert(getLang('SIGN_UP::PASS_ERROR'));break;case'7':case'8':alert(getLang('SIGN_UP::EXISTS_ERROR'));break;default:alert(getLang('SIGN_UP::ERROR'));break;}
break;default:alert(getLang('SIGN_UP::ERROR'));break;}}
me.btn_submit._disabled(false);};this.btn_submit._onclick=function(e){this._disabled(true);if(me.tabs.tab1._isActive){me.tabs.tab1.inp_user._disabled(true);me.tabs.tab1.inp_pass._disabled(true);if(me.tabs.tab1.inp_radio)
me.tabs.tab1.inp_radio._disabled(true);}
else
if(me.tabs.tab2&&me.tabs.tab2._isActive){me.tabs.tab2.inp_mail._disabled(true);me.tabs.tab2.captcha._disabled(true);}
setTimeout(this._pathName+'._parent._submit();',0);};function genc(){me.__csid=me.__csid?me.__csid:unique_id();var src='server/download.php?class=captcha&fullpath='+me.__csid+'&num='+Math.rand();if(currentBrowser()=='MSIE6'){var elm=this;setTimeout(function(){try{elm.src=src;}catch(e){}},500);}
else
this.src=src;me.tabs.tab2.captcha._value('');me.tabs.tab2.captcha._focus();};if(this.tabs.tab2){function checksubmit(){if(count(me.tabs.tab2.inp_mail._checkError)+count(me.tabs.tab2.captcha._checkError)==0){me.btn_submit._disabled(false);return true;}
else{me.btn_submit._disabled(true);return false;}};this.tabs.tab2.inp_mail._onerror=function(b){checksubmit();};this.tabs.tab2.captcha._onerror=function(b){checksubmit();};this.tabs.tab2.inp_mail._onsubmit=function(){if(checksubmit())
me.btn_submit._onclick();};this.tabs.tab2.captcha._onsubmit=function(){if(checksubmit())
me.btn_submit._onclick();};this.tabs.tab2.inp_mail._onsubmit=function(){if(checksubmit())
me.btn_submit._onclick();};this.tabs.tab2._onactive=function(b){me.btn_submit._value('LOGIN_SCREEN::SEND');checksubmit();try{document.getElementById(this._pathName+'captcha1').ondblclick()}catch(er){}};var celm;if((celm=document.getElementById(this.tabs.tab2._pathName+'captcha1')))
celm.ondblclick=genc;celm=null;}
if(this.tabs.tab3){this.tabs.tab3.__checksubmit=function(){if(count(this.captcha._checkError)+
count(this.inp_user._checkError)+
count(this.inp_pass._checkError)+
count(this.inp_pass_conf._checkError)==0){me.btn_submit._disabled(false);return true;}
else{me.btn_submit._disabled(true);return false;}};this.tabs.tab3.inp_user._onerror=function(b){this._parent.__checksubmit();};this.tabs.tab3.inp_pass._onerror=function(b){this._parent.__checksubmit();};this.tabs.tab3.inp_pass_conf._onerror=function(b){this._parent.__checksubmit();};this.tabs.tab3.captcha._onerror=function(b){this._parent.__checksubmit();};this.tabs.tab3._onactive=function(b){me.btn_submit._value('LOGIN_SCREEN::CREATE_ACCOUNT');this.__checksubmit();try{document.getElementById(this._pathName+'captcha2').ondblclick();}
catch(er){}};var s,aDom={},aResource=dataSet.get('storage',['SIGNUP_DOMAINS','ITEMS']);for(var i in aResource){s=aResource[i].VALUES.DOMAIN.VALUE;aDom[s]=s;}
this.tabs.tab3.inp_domain._fill(aDom);for(var i in aDom){this.tabs.tab3.inp_domain._value(aDom[i]);break;}
var celm;if((celm=document.getElementById(this.tabs.tab3._pathName+'captcha2')))
celm.ondblclick=genc;celm=null;}
this.tabs.tab1._onactive=function(b){me.btn_submit._value('LOGIN_SCREEN::LOGIN');me.btn_submit._disabled(false);};this.tabs.tab1.inp_user._onsubmit=function(){if(!this._value())return;if(this._parent.inp_pass._value())
me.btn_submit._onclick();else
this._parent.inp_pass._focus();};this.tabs.tab1.inp_pass._onsubmit=function(){if(!this._value())return;if(this._parent.inp_user._value())
me.btn_submit._onclick();else
this._parent.inp_user._focus();};this.title._value(GWOthers.getItem('LAYOUT_SETTINGS','login_title')||getLang('LOGIN_SCREEN::LOGIN_CAPTION'));this._getAnchor('logo').style.backgroundImage="url('client/skins/"+GWOthers.getItem('LAYOUT_SETTINGS','skin')+"/images/"+(GWOthers.getItem('LAYOUT_SETTINGS','logo')||'logo.gif')+"')";this.copyright=gui._create('copyright','obj_label');this.copyright._value(getLang('LOGIN_SCREEN::COPYRIGHT').replace("\$1",GWOthers.getItem('LOGIN_SETTINGS','version')));if(state=='3'&&data&&data.user&&data.pass)
this.btn_submit._onclick();};