var net=new Object();
net.READY_STATE_UNINITIALIZED=0;
net.READY_STATE_LOADING=1;
net.READY_STATE_LOADED=2;
net.READY_STATE_INTERACTIVE=3;
net.READY_STATE_COMPLETE=4;
net.active=new Array();
net.ContentLoader=function(_1){
this.req=null;
for(p in _1){
this[p]=_1[p];
}
this.onerror=this.onerror||this.defaultError;
this.ontimeout=this.ontimeout||this.defaultTimeout;
this.ttl=this.ttl||4;
this.complete=false;
net.active.push(this);
if(!net.ttlTimer){
net.ttlTimer=window.setTimeout(net.ttlCheck,5000);
}
this.loadXMLDoc();
};
net.ContentLoader.prototype.loadXMLDoc=function(){
this.method=this.method||"POST";
if(!this.contentType&&this.method=="POST"){
this.contentType="application/x-www-form-urlencoded";
}
if(window.XMLHttpRequest){
this.req=new XMLHttpRequest();
}else{
if(window.ActiveXObject){
this.req=new ActiveXObject("Microsoft.XMLHTTP");
}
}
if(this.req){
try{
this.indicator=net.getFreeIndicator();
var _2=this;
this.req.onreadystatechange=function(){
net.ContentLoader.onReadyState.call(_2);
};
if(this.indicator){
this.indicator.start(this.ttl*5);
}
this.req.open(this.method,this.url,true);
if(this.contentType){
this.req.setRequestHeader("Content-Type",this.contentType);
}
this.req.send(this.params);
}
catch(err){
this.onerror.call(this);
}
}
};
net.ContentLoader.onReadyState=function(){
var _3=this.req;
var _4=_3.readyState;
if(_4==net.READY_STATE_COMPLETE){
var _5=-1;
try{
_5=_3.status;
}
catch(err){
_5=504;
}
this.complete=true;
if(_5==200||_5==0){
if(this.indicator){
this.indicator.reset();
}
this.onload.call(this);
}else{
if(_5!=504){
if(this.indicator){
this.indicator.error();
}
this.onerror.call(this);
}else{
if(this.indicator){
this.indicator.warning();
}
}
}
}
};
net.ContentLoader.prototype.setTTL=function(s){
this.ttl=(s+4)/5;
};
net.ContentLoader.prototype.setOnTimeout=function(f){
this.ontimeout=f;
};
net.ttlCheck=function(){
var i=0;
while(i<net.active.length){
var _9=net.active[i];
if((--_9.ttl)<=0){
if(!_9.complete){
_9.req.abort();
if(_9.indicator){
_9.indicator.error();
}
_9.ontimeout.call(_9);
}
if(i>0){
net.active[i]=net.active[0];
}
net.active.shift();
i--;
}
i++;
}
if(net.active.length>0){
net.ttlTimer=window.setTimeout(net.ttlCheck,5000);
}else{
delete net.ttlTimer;
}
};
net.ContentLoader.prototype.defaultTimeout=function(){
alert("Request timed out; data source unavailable?");
};
net.ContentLoader.prototype.defaultError=function(){
alert("error fetching data!"+"\n\nreadyState:"+this.req.readyState+"\nstatus: "+this.req.status+"\nheaders: "+this.req.getAllResponseHeaders()+"\nURL: "+this.url);
};
net.configIndicators=function(_a,_b){
if(net.Indicator){
net.indicator=new Array();
for(var i=0;i<_b;i++){
net.indicator[i]=new net.Indicator(i*9+2);
_a.appendChild(net.indicator[i].getElement());
}
}
};
net.getFreeIndicator=function(){
if(!net.indicator){
return null;
}
for(var i=0;i<net.indicator.length;i++){
if(!net.indicator[i].running){
return net.indicator[i];
}
}
return null;
};

net.Indicator=function(x){
this.img=document.createElement("img");
this.img.src="images/fin.png";
this.x=x*30;
this.y=60;
this.dx=1+x/10;
this.dy=0.5;
this.img.style.right=Math.floor(this.x)+"px";
this.img.style.top=Math.floor(this.y)+"px";
this.count=0;
this.state=0;
this.running=false;
};
net.Indicator.prototype.getElement=function(){
return this.img;
};
net.Indicator.prototype.error=function(){
this.state=2;
};
net.Indicator.prototype.warning=function(){
this.state=1;
};
net.Indicator.prototype.reset=function(){
if(this.running){
this.state=3;
}
};
net.Indicator.prototype.start=function(_2){
var i=40;
this.running=true;
this.state=0;
this.dy=-(this.dy);
Animator.add(i,this,this.animate);
};
net.Indicator.prototype.animate=function(){
if(!this.running){
return false;
}
var x0=findPosX(this.img);
switch(this.state){
case 0:
var w=parseInt(this.img.parentNode.style.width||800);
if(x0<-30){
this.x=-30;
this.y=25;
}
if(this.y>=40){
this.dy-=0.05;
if(this.y>61){
this.y=61;
}
}else{
if(this.y<10){
this.dy+=0.05;
if(this.y<-31){
this.y=-31;
}
}
}
this.x+=this.dx;
this.y+=this.dy;
break;
case 1:
case 2:
this.y+=1;
if(this.y>=60){
this.running=false;
}
break;
default:
this.dy+=0.05;
this.x+=this.dx;
this.y+=this.dy;
if(this.y>=60||this.y<=-31){
this.running=false;
this.dy=(this.dy<0?0.4:-0.4);
}
}
if(this.running){
this.img.style.right=Math.floor(this.x)+"px";
this.img.style.top=Math.floor(this.y)+"px";
}
return this.running;
};

var MD5=function(_1){
function RotateLeft(_2,_3){
return (_2<<_3)|(_2>>>(32-_3));
}
function AddUnsigned(lX,lY){
var _6,_7,_8,_9,_a;
_8=(lX&2147483648);
_9=(lY&2147483648);
_6=(lX&1073741824);
_7=(lY&1073741824);
_a=(lX&1073741823)+(lY&1073741823);
if(_6&_7){
return (_a^2147483648^_8^_9);
}
if(_6|_7){
if(_a&1073741824){
return (_a^3221225472^_8^_9);
}else{
return (_a^1073741824^_8^_9);
}
}else{
return (_a^_8^_9);
}
}
function F(x,y,z){
return (x&y)|((~x)&z);
}
function G(x,y,z){
return (x&z)|(y&(~z));
}
function H(x,y,z){
return (x^y^z);
}
function I(x,y,z){
return (y^(x|(~z)));
}
function FF(a,b,c,d,x,s,ac){
a=AddUnsigned(a,AddUnsigned(AddUnsigned(F(b,c,d),x),ac));
return AddUnsigned(RotateLeft(a,s),b);
}
function GG(a,b,c,d,x,s,ac){
a=AddUnsigned(a,AddUnsigned(AddUnsigned(G(b,c,d),x),ac));
return AddUnsigned(RotateLeft(a,s),b);
}
function HH(a,b,c,d,x,s,ac){
a=AddUnsigned(a,AddUnsigned(AddUnsigned(H(b,c,d),x),ac));
return AddUnsigned(RotateLeft(a,s),b);
}
function II(a,b,c,d,x,s,ac){
a=AddUnsigned(a,AddUnsigned(AddUnsigned(I(b,c,d),x),ac));
return AddUnsigned(RotateLeft(a,s),b);
}
function ConvertToWordArray(_33){
var _34;
var _35=_33.length;
var _36=_35+8;
var _37=(_36-(_36%64))/64;
var _38=(_37+1)*16;
var _39=Array(_38-1);
var _3a=0;
var _3b=0;
while(_3b<_35){
_34=(_3b-(_3b%4))/4;
_3a=(_3b%4)*8;
_39[_34]=(_39[_34]|(_33.charCodeAt(_3b)<<_3a));
_3b++;
}
_34=(_3b-(_3b%4))/4;
_3a=(_3b%4)*8;
_39[_34]=_39[_34]|(128<<_3a);
_39[_38-2]=_35<<3;
_39[_38-1]=_35>>>29;
return _39;
}
function WordToHex(_3c){
var _3d="",_3e="",_3f,_40;
for(_40=0;_40<=3;_40++){
_3f=(_3c>>>(_40*8))&255;
_3e="0"+_3f.toString(16);
_3d=_3d+_3e.substr(_3e.length-2,2);
}
return _3d;
}
function Utf8Encode(_41){
_41=_41.replace(/\r\n/g,"\n");
var _42="";
for(var n=0;n<_41.length;n++){
var c=_41.charCodeAt(n);
if(c<128){
_42+=String.fromCharCode(c);
}else{
if((c>127)&&(c<2048)){
_42+=String.fromCharCode((c>>6)|192);
_42+=String.fromCharCode((c&63)|128);
}else{
_42+=String.fromCharCode((c>>12)|224);
_42+=String.fromCharCode(((c>>6)&63)|128);
_42+=String.fromCharCode((c&63)|128);
}
}
}
return _42;
}
var x=Array();
var k,AA,BB,CC,DD,a,b,c,d;
var S11=7,S12=12,S13=17,S14=22;
var S21=5,S22=9,S23=14,S24=20;
var S31=4,S32=11,S33=16,S34=23;
var S41=6,S42=10,S43=15,S44=21;
_1=Utf8Encode(_1);
x=ConvertToWordArray(_1);
a=1732584193;
b=4023233417;
c=2562383102;
d=271733878;
for(k=0;k<x.length;k+=16){
AA=a;
BB=b;
CC=c;
DD=d;
a=FF(a,b,c,d,x[k+0],S11,3614090360);
d=FF(d,a,b,c,x[k+1],S12,3905402710);
c=FF(c,d,a,b,x[k+2],S13,606105819);
b=FF(b,c,d,a,x[k+3],S14,3250441966);
a=FF(a,b,c,d,x[k+4],S11,4118548399);
d=FF(d,a,b,c,x[k+5],S12,1200080426);
c=FF(c,d,a,b,x[k+6],S13,2821735955);
b=FF(b,c,d,a,x[k+7],S14,4249261313);
a=FF(a,b,c,d,x[k+8],S11,1770035416);
d=FF(d,a,b,c,x[k+9],S12,2336552879);
c=FF(c,d,a,b,x[k+10],S13,4294925233);
b=FF(b,c,d,a,x[k+11],S14,2304563134);
a=FF(a,b,c,d,x[k+12],S11,1804603682);
d=FF(d,a,b,c,x[k+13],S12,4254626195);
c=FF(c,d,a,b,x[k+14],S13,2792965006);
b=FF(b,c,d,a,x[k+15],S14,1236535329);
a=GG(a,b,c,d,x[k+1],S21,4129170786);
d=GG(d,a,b,c,x[k+6],S22,3225465664);
c=GG(c,d,a,b,x[k+11],S23,643717713);
b=GG(b,c,d,a,x[k+0],S24,3921069994);
a=GG(a,b,c,d,x[k+5],S21,3593408605);
d=GG(d,a,b,c,x[k+10],S22,38016083);
c=GG(c,d,a,b,x[k+15],S23,3634488961);
b=GG(b,c,d,a,x[k+4],S24,3889429448);
a=GG(a,b,c,d,x[k+9],S21,568446438);
d=GG(d,a,b,c,x[k+14],S22,3275163606);
c=GG(c,d,a,b,x[k+3],S23,4107603335);
b=GG(b,c,d,a,x[k+8],S24,1163531501);
a=GG(a,b,c,d,x[k+13],S21,2850285829);
d=GG(d,a,b,c,x[k+2],S22,4243563512);
c=GG(c,d,a,b,x[k+7],S23,1735328473);
b=GG(b,c,d,a,x[k+12],S24,2368359562);
a=HH(a,b,c,d,x[k+5],S31,4294588738);
d=HH(d,a,b,c,x[k+8],S32,2272392833);
c=HH(c,d,a,b,x[k+11],S33,1839030562);
b=HH(b,c,d,a,x[k+14],S34,4259657740);
a=HH(a,b,c,d,x[k+1],S31,2763975236);
d=HH(d,a,b,c,x[k+4],S32,1272893353);
c=HH(c,d,a,b,x[k+7],S33,4139469664);
b=HH(b,c,d,a,x[k+10],S34,3200236656);
a=HH(a,b,c,d,x[k+13],S31,681279174);
d=HH(d,a,b,c,x[k+0],S32,3936430074);
c=HH(c,d,a,b,x[k+3],S33,3572445317);
b=HH(b,c,d,a,x[k+6],S34,76029189);
a=HH(a,b,c,d,x[k+9],S31,3654602809);
d=HH(d,a,b,c,x[k+12],S32,3873151461);
c=HH(c,d,a,b,x[k+15],S33,530742520);
b=HH(b,c,d,a,x[k+2],S34,3299628645);
a=II(a,b,c,d,x[k+0],S41,4096336452);
d=II(d,a,b,c,x[k+7],S42,1126891415);
c=II(c,d,a,b,x[k+14],S43,2878612391);
b=II(b,c,d,a,x[k+5],S44,4237533241);
a=II(a,b,c,d,x[k+12],S41,1700485571);
d=II(d,a,b,c,x[k+3],S42,2399980690);
c=II(c,d,a,b,x[k+10],S43,4293915773);
b=II(b,c,d,a,x[k+1],S44,2240044497);
a=II(a,b,c,d,x[k+8],S41,1873313359);
d=II(d,a,b,c,x[k+15],S42,4264355552);
c=II(c,d,a,b,x[k+6],S43,2734768916);
b=II(b,c,d,a,x[k+13],S44,1309151649);
a=II(a,b,c,d,x[k+4],S41,4149444226);
d=II(d,a,b,c,x[k+11],S42,3174756917);
c=II(c,d,a,b,x[k+2],S43,718787259);
b=II(b,c,d,a,x[k+9],S44,3951481745);
a=AddUnsigned(a,AA);
b=AddUnsigned(b,BB);
c=AddUnsigned(c,CC);
d=AddUnsigned(d,DD);
}
var _5f=WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
return _5f.toLowerCase();
};

function Session(_1){
this.sessionCode=null;
this.deferred=new Array();
this.basePath=window.location.pathname.replace(/\/[^\/]*$/,"/");
this.service=_1||"DB";
}
Session.prototype.request=function(_2,_3){
if(_2.url.charAt(0)!="/"){
_2.url=this.basePath+_2.url;
}
if(_2.url.match(/\/$/)){
_2.data=(_2.data||"").replace(/.*var criteria={([^{]*)}$/,"$1");
_2.url+=encodeURI(_2.data.replace(/",|"$/g,"/").replace(/:"/g,"="));
_2.method="GET";
_2.onload=this.nreceive;
new net.ContentLoader(_2);
}else{
if(this.sessionCode==null){
if(this.inAuth){
this.deferred.push(_2);
}else{
this.inAuth=true;
this.deferred.push(_2);
if(this.iv==null){
new net.ContentLoader({url:_2.url,onload:this.startAuth,params:"&session="+this.service,session:this});
}else{
new LoginPrompt(this,_3||"Welcome");
}
}
}else{
_2.session=this;
_2.onload=this.receive;
_2.params="&session="+this.service+this.sessionCode+(_2.data!=null?"&data="+this.cipher.encipher(_2.data):"");
new net.ContentLoader(_2);
}
}
};
Session.prototype.startAuth=function(){
var _4=this.req.responseText;
if(_4){
var o=JSON.parse(_4);
if(typeof (o.needAuth)=="object"){
this.session.iv=o.needAuth.iv;
new LoginPrompt(this.session,o.message||"Welcome");
}else{
alert(o.message);
delete this.session.iv;
delete this.session.inAuth;
this.session.cancelDeferred();
}
}
};
Session.prototype.checkLogin=function(){
var _6=this.req.responseText;
var _7=this.session;
delete _7.inAuth;
if(_6){
try{
var o=JSON.parse(_6);
if(typeof (o.authOkay)=="object"){
_7.sessionCode=o.authOkay.session;
}
if(typeof (o.needAuth)=="object"){
_7.iv=o.needAuth.iv;
_7.inAuth=true;
_7.sessionCode=null;
new LoginPrompt(_7,o.message);
}else{
if(_7.sessionCode!=null&&_7.deferred.length>0){
var _9=_7.deferred.shift();
_7.request(_9);
}
}
}
catch(e){
alert("Bad response from server");
_7.cancelDeferred();
}
}else{
alert("Unexpected failure while authenticating");
_7.cancelDeferred();
}
};
Session.prototype.cancelDeferred=function(){
while(this.deferred.length>0){
var _a=this.deferred.shift();
if(_a.onerror){
_a.onerror.call(_a);
}
}
};
Session.prototype.receive=function(){
var _b="";
var _c=this.req.responseText;
var _d=this.session;
var _e,o={};
if(_c){
try{
o=JSON.parse(_c);
}
catch(e){
alert("Invalid JSON: "+_c);
}
if(typeof (o.needAuth)=="object"){
if(!_d.inAuth){
delete _d.sessionCode;
delete _d.cipher;
_d.iv=o.needAuth.iv;
_b+=o.message;
}
}else{
if(typeof (o.authOkay)=="object"){
_d.sessionCode=o.authOkay.session;
_b="Authorization OK";
}
}
if(_d.sessionCode!=null){
if(typeof (o.data)=="string"){
_e=_d.cipher.decipher(o.data);
}
}else{
_d.request(this,_b);
return;
}
}
if(_d.sessionCode!=null){
while(_d.deferred.length>0){
var _10=_d.deferred.shift();
_d.request(_10);
}
if(this.callback){
this.callback.call(this,o.message,_e||"{}");
}
}
if(_b){
alert(_b);
}
};
Session.prototype.nreceive=function(){
var _11=this.req.responseText;
if(this.callback){
this.callback.call(this,null,_11);
}
};
Session.prototype.signOff=function(){
if(this.sessionCode&&!this.inAuth){
var _12="&session="+this.service+this.sessionCode+"&data="+this.cipher.encipher("BYE");
new net.ContentLoader({url:"signOff.php",onload:function(){
},params:_12});
}
this.sessionCode=null;
delete this.iv;
delete this.cipher;
};

function Cipher(_1){
this.key=_1;
this.salt=this.calculateSalt(_1);
this.cipher_block_size=64;
this.encoding_buffer=1024;
this.b64str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-)!";
}
Cipher.prototype.calculateSalt=function(_2){
var n=0;
for(var i=0;i<_2.length;i++){
n+=i&_2.charCodeAt(i);
}
return String.fromCharCode(n%256);
};
Cipher.prototype.utf8_encode=function(_5){
var _6="";
var c;
var l0=_5.length;
for(var n=0;n<l0;n++){
c=_5.charCodeAt(n);
if(c<128){
_6+=String.fromCharCode(c);
}else{
if((c>127)&&(c<2048)){
_6+=String.fromCharCode((c>>6)|192);
_6+=String.fromCharCode((c&63)|128);
}else{
_6+=String.fromCharCode((c>>12)|224);
_6+=String.fromCharCode(((c>>6)&63)|128);
_6+=String.fromCharCode((c&63)|128);
}
}
}
return _6;
};
Cipher.prototype.utf8_decode=function(_a){
var _b="";
var c,c2,c3;
var i=0;
var l0=_a.length;
while(i<l0){
c=_a.charCodeAt(i);
if(c<128){
_b+=String.fromCharCode(c);
i++;
}else{
if((c>191)&&(c<224)){
c2=_a.charCodeAt(i+1);
_b+=String.fromCharCode(((c&31)<<6)|(c2&63));
i+=2;
}else{
c2=_a.charCodeAt(i+1);
c3=_a.charCodeAt(i+2);
_b+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));
i+=3;
}
}
}
return _b;
};
Cipher.prototype.base64_encode=function(_11){
var _12="";
var _13,_14,_15,_16,_17,_18,_19;
var i=0;
var l0=_11.length;
while(i<l0){
_13=_11.charCodeAt(i++);
_14=_11.charCodeAt(i++);
_15=_11.charCodeAt(i++);
_16=_13>>2;
_17=((_13&3)<<4)|(_14>>4);
_18=((_14&15)<<2)|(_15>>6);
_19=_15&63;
if(isNaN(_14)){
_18=_19=64;
}else{
if(isNaN(_15)){
_19=64;
}
}
_12+=this.b64str.charAt(_16)+this.b64str.charAt(_17)+this.b64str.charAt(_18)+this.b64str.charAt(_19);
}
return _12;
};
Cipher.prototype.base64_decode=function(_1c){
var _1d="";
var _1e,_1f,_20,_21,_22,_23,_24;
_1c=_1c.replace(/[^A-Za-z0-9\-\)\!]/g,"");
var i=0;
var l0=_1c.length;
while(i<l0){
_21=this.b64str.indexOf(_1c.charAt(i++));
_22=this.b64str.indexOf(_1c.charAt(i++));
_23=this.b64str.indexOf(_1c.charAt(i++));
_24=this.b64str.indexOf(_1c.charAt(i++));
_1e=(_21<<2)|(_22>>4);
_1f=((_22&15)<<4)|(_23>>2);
_20=((_23&3)<<6)|_24;
_1d+=String.fromCharCode(_1e);
if(_23!=64){
_1d+=String.fromCharCode(_1f);
}
if(_24!=64){
_1d+=String.fromCharCode(_20);
}
}
return _1d;
};
Cipher.prototype.encrypt=function(s){
if(s.length>this.cipher_block_size){
var m=parseInt(s.length/this.cipher_block_size);
var t=Math.round(m/2)*this.cipher_block_size;
return this.encrypt(s.substr(0,t))+this.encrypt(s.substr(t));
}
var r=parseInt(1+Math.random()*255);
var kl=this.key.length;
var o=String.fromCharCode(r);
for(var i=0;i<s.length;i++){
o+=String.fromCharCode(s.charCodeAt(i)^r^this.key.charCodeAt(i%kl));
}
return o;
};
Cipher.prototype.decrypt=function(s){
var dbs=(this.cipher_block_size+1);
if(s.length>dbs){
var m=parseInt(s.length/dbs);
var t=Math.round(m/2)*dbs;
return this.decrypt(s.substr(0,t))+this.decrypt(s.substr(t));
}
var n=s.charCodeAt(0);
var kl=this.key.length;
var o="";
for(var i=1;i<s.length;i++){
o+=String.fromCharCode(s.charCodeAt(i)^n^this.key.charCodeAt((i-1)%kl));
}
return o;
};
Cipher.prototype.encipher=function(_36){
var _37=this.salt;
var b=this.encoding_buffer;
_36=this.utf8_encode(_36);
var n=Math.floor(_36.length/b)+1;
var p=0;
while(p<n){
_37+=this.encrypt(_36.substr(p*b,b));
p++;
}
return this.base64_encode(_37);
};
Cipher.prototype.decipher=function(_3b){
_3b=this.base64_decode(_3b);
var d0=_3b.substr(1);
var _3d="";
var b=(this.encoding_buffer+this.encoding_buffer/this.cipher_block_size);
if(this.salt==_3b.substr(0,1)){
var n=Math.floor(d0.length/b)+1;
var p=0;
while(p<n){
_3d+=this.decrypt(d0.substr(p*b,b));
p++;
}
}
return this.utf8_decode(_3d);
};

function WindowSize(){
if(window.sizeWatcher){
return;
}
var _1=findFirst(document,"body");
if(_1){
this.trackDiv=document.createElementNS("http://www.w3.org/1999/xhtml","div");
this.trackDiv.style.position="absolute";
this.trackDiv.style.right="0px";
this.trackDiv.style.bottom="0px";
this.trackDiv.style.height="0px";
window.sizeWatcher=this;
addEvent(window,"resize",this.adjust,false);
_1.appendChild(this.trackDiv);
this.width=findPosX(this.trackDiv);
this.height=findPosY(this.trackDiv);
}else{
alert("No document body?");
}
this.notifyList=new Array();
}
WindowSize.getSizer=function(){
if(window.sizeWatcher){
return window.sizeWatcher;
}
return new WindowSize();
};
WindowSize.prototype.adjust=function(){
var ws=window.sizeWatcher;
ws.width=findPosX(ws.trackDiv);
ws.height=findPosY(ws.trackDiv);
ws.notifyAll();
};
WindowSize.prototype.addWatcher=function(_3){
if(_3.updateSize){
this.notifyList.push(_3);
}
};
WindowSize.prototype.notifyAll=function(){
for(var i=0;i<this.notifyList.length;i++){
this.notifyList[i].updateSize();
}
};

function Menu(_1,_2){
this.menuEl=document.getElementById(_1);
this.NS="http://www.w3.org/1999/xhtml";
this.menuSource=_2;
this.portalElements=new Object();
this.updateSize();
window.sizeWatcher.addWatcher(this);
net.configIndicators(document.getElementById("indicatorContainer"),15);
this.label=findFirst(this.menuEl.parentNode.firstChild,"div");
if(this.label){
this.label=findFirst(this.label,"span");
}
}
Menu.prototype.updateSize=function(){
var el=document.getElementById("leftPanel");
if(el){
var _4=findPosY(el)+1;
var _5=(window.sizeWatcher.height-_4-79)+"px";
el.style.height=_5;
el=document.getElementById("middlePanel");
if(el){
el.style.height=_5;
}
el=document.getElementById("rightPanel");
if(el){
el.style.height=_5;
}
}
};
Menu.prototype.setLabel=function(_6){
if(this.label){
while(this.label.lastChild){
this.label.removeChild(this.label.lastChild);
}
this.label.appendChild(document.createTextNode(_6||""));
}
};
Menu.prototype.signOn=function(){
var _7=this;
if(_7.menuEl==null){
_7=this.menu;
}
_7.clearMenu();
new LoginPrompt(window.session,"Welcome");
return false;
};
Menu.prototype.loadMenu=function(m0,_9){
this.menu.clearMenu();
var o=JSON.parse(_9);
if(typeof (o.global)=="object"){
window.formGlobals=new Object();
for(var i in o.global){
window.formGlobals[i]=o.global[i];
}
}
this.menu.setLabel("Menu");
if(typeof (o.menu)=="object"&&typeof (o.menu.content)=="object"){
if(o.menu.content.length>0){
var el=document.createElementNS(this.menu.NS,"ul");
this.menu.createMenu(el,o.menu.content,"M");
this.menu.menuEl.appendChild(el);
}
var a=document.createElementNS(this.menu.NS,"a");
a.setAttribute("href",".");
a.onclick=this.menu.signOff;
a.menu=this.menu;
a.appendChild(document.createTextNode("Sign Off"));
var e=document.getElementById("loginName");
if(e){
while(e.lastChild!=null){
e.removeChild(e.lastChild);
}
e.appendChild(document.createTextNode("Welcome, "+(window.formGlobals["firstName"]||"Amigo")));
}
this.menu.menuEl.appendChild(a);
}
if(typeof (o.rss)=="object"&&window.session.sessionCode){
for(var i in this.menu.portalElements){
if(o.rss[i]){
this.menu.portalElements[i].newContent(o.rss[i][0],o.rss[i][1],o.rss[i][2]);
}
}
}
};
Menu.prototype.createMenu=function(_f,a){
for(var i=0;i<a.length;i++){
if(a[i].type=="menu"&&a[i].content.length>0){
var e=document.createElementNS(this.NS,"li");
e.appendChild(document.createTextNode(a[i].label));
_f.appendChild(e);
var ul=document.createElementNS(this.NS,"ul");
this.createMenu(ul,a[i].content);
e.appendChild(ul);
}else{
if(a[i].type=="link"){
var li=document.createElementNS(this.NS,"li");
var e=document.createElementNS(this.NS,"a");
e.setAttribute("title",a[i].title);
e.setAttribute("href",a[i].url);
e.access=a[i].access;
e.label=a[i].label;
e.onclick=window.showForm;
e.appendChild(document.createTextNode(a[i].label));
li.appendChild(e);
_f.appendChild(li);
}
}
}
};
Menu.prototype.signOff=function(_15){
var _16=this;
if(_16.menuEl==null){
_16=this.menu;
_15=false;
}
var s=new Semaphore(1,_16,_16.signOff2);
if(window.formSet){
if(!window.formSet.closeAll(_15,s)){
return false;
}
}
s.decrement();
return false;
};
Menu.prototype.signOff2=function(){
window.session.signOff();
for(var i in this.portalElements){
this.portalElements[i].reset();
}
this.clearMenu();
var a=document.createElementNS(this.NS,"a");
a.setAttribute("href",".");
a.onclick=this.signOn;
a.menu=this;
a.appendChild(document.createTextNode("Sign On"));
var e=document.getElementById("loginName");
if(e){
while(e.lastChild!=null){
e.removeChild(e.lastChild);
}
}
if(!LoginPrompt.visible()){
new LoginPrompt(window.session,"Welcome");
}
return false;
};
Menu.prototype.clearMenu=function(){
var m=this.menuEl;
while(m.lastChild!=null){
m.removeChild(m.lastChild);
}
};
Menu.prototype.addPortalElement=function(_1c,_1d){
var el=document.getElementById(_1c);
if(el){
this.portalElements[_1c]=new PortalElement(window.session,el,_1d);
}
};

function PortalElement(_1,el,_3){
this.session=_1;
this.element=el;
this.interval=_3||600;
this.reset();
}
PortalElement.prototype.newContent=function(_4,_5,_6){
if(_6=="N"){
this.authId=null;
this.rssId=_4||"nil";
this.src=_5||"rss/";
this.go();
}else{
this.authId=_4;
this.authSrc=_5||"rssAuth.php";
if(this.session&&this.session.sessionCode){
this.go();
}
}
};
PortalElement.prototype.reset=function(){
this.src=this.element.getAttribute("src")||"rss/";
this.rssId=this.element.getAttribute("rssId")||"nil";
this.title=this.element.getAttribute("title");
if(this.title!=null){
this.setTitle(this.title);
}
this.authId=null;
this.authSrc=null;
this.go();
};
PortalElement.prototype.setTitle=function(_7){
var d=this.element.parentNode;
d=findFirst(d.firstChild,"div");
if(d){
d=findFirst(d.firstChild,"span");
}
if(d){
while(d.lastChild){
d.removeChild(d.lastChild);
}
d.appendChild(document.createTextNode(_7||""));
}
};
PortalElement.prototype.go=function(){
if(this.aID){
Animator.remove(this.aID);
}
this.aID=Animator.add(10,this,this.refresh);
};
PortalElement.prototype.refresh=function(){
if(this.authId!=null&&this.session.sessionCode){
this.session.request({url:this.authSrc,data:"rssId=\""+this.authId+"\"",pe:this,callback:this.sreceive,ttl:15,ontimeout:this.error,onerror:this.error});
}else{
if(this.rssId!="nil"){
new net.ContentLoader({url:this.src+"rssId="+this.rssId,method:"GET",ttl:15,pe:this,onload:this.receive,ontimeout:this.error,onerror:this.error});
}else{
while(this.element.firstChild!=null){
this.element.removeChild(this.element.firstChild);
}
}
}
return this.interval*1000;
};
PortalElement.prototype.sreceive=function(m0,_a){
try{
var o=JSON.parse(_a||"\"x\"");
if(typeof (o)=="string"){
if(window.menu&&window.menu.signOff){
window.menu.signOff(true);
}
}else{
if(typeof (o.title)=="string"&&this.pe.title!=null){
this.pe.setTitle(o.title);
}
if(typeof (o.content)=="object"){
while(this.pe.element.firstChild!=null){
this.pe.element.removeChild(this.pe.element.firstChild);
}
new JSONtoDOM(this.pe.element,o.content,null,this.pe.element.createElement);
}
}
}
catch(err){
alert("Error parsing response: "+err+"\n"+_a);
}
};
PortalElement.prototype.receive=function(){
var _c=this.req.responseText;
try{
var o=JSON.parse(_c||"\"x\"");
if(typeof (o)=="string"){
if(o.length>1){
alert(_c);
}
}else{
if(typeof (o.title)=="string"&&this.pe.title!=null){
this.pe.setTitle(o.title);
}
if(typeof (o.content)=="object"){
while(this.pe.element.firstChild!=null){
this.pe.element.removeChild(this.pe.element.firstChild);
}
new JSONtoDOM(this.pe.element,o.content,null,this.pe.element.createElement);
}
}
}
catch(err){
alert("Error parsing response: "+err+"\n"+_c);
}
};
PortalElement.prototype.error=function(){
alert("error fetching data!"+"\n\nreadyState:"+this.req.readyState+"\nstatus: "+this.req.status+"\nheaders: "+this.req.getAllResponseHeaders()+"\nURL: "+this.url);
};
PortalElement.printMap={v:"div",row:"div",trow:"div",l:"div",r:"div",c:"div"};
PortalElement.prototype.createElement=function(_e,d){
if(!_e.match){
alert("bad parse at "+_e+" which is "+typeof (_e));
return;
}
var n=_e.match(/([A-Za-z]+)([0-9\.]+)/);
var n0;
if(n!=null){
if(this.printMap[n[1]]){
n0=d.createElement(this.printMap[n[1]]);
n0.className=n[1];
}else{
n0=d.createElement(n[1]);
}
switch(n[1]){
case "v":
n0.style.height=(Math.floor(parseFloat(n[2])*10-4))+"px";
break;
default:
n0.style.width=(Math.floor(parseFloat(n[2])*10-4))+"px";
}
return n0;
}
if(this.printMap[_e]){
n0=d.createElement(this.printMap[_e]);
n0.className=_e;
return n0;
}
return d.createElement(_e);
};

function Forms(_1){
this.formsEl=document.getElementById(_1);
this.form=new Object();
window.sizeWatcher.addWatcher(this);
}
Forms.NS="http://www.w3.org/1999/xhtml";
Forms.prototype.updateSize=function(){
var _2=findPosY(this.formsEl)+1;
this.formsEl.style.height=(window.sizeWatcher.height-_2-79)+"px";
if(this.form.frameDiv){
_2=findPosY(this.form.frameDiv);
this.form.frameDiv.style.height=(window.sizeWatcher.height-_2-79)+"px";
var _3=findFirst(this.form.frameDiv,"iframe");
if(_3){
_3.style.height=this.form.frameDiv.style.height;
}
}
};
Forms.prototype.showForm=function(a){
if(!a){
return false;
}
var _5=null;
var _6=a.getAttribute("href");
if(_6){
_5=a.label||a.getAttribute("title")||_6;
}else{
return false;
}
if(this.form.inUse&&(this.form.formId==_5||this.form.name==_5)){
return false;
}
if(this.closeAll()){
return this.addForm(a);
}
};
Forms.prototype.addForm=function(a){
if(this.form.inUse){
return false;
}
var _8=null;
var _9=a.getAttribute("href");
if(_9){
_8=a.label||a.getAttribute("title")||_9;
}
if(this.form.frameDiv==null){
this.form.formId=this.formsEl.id+".0";
this.form.frameDiv=document.getElementById("formFrame");
}
if(this.form.frameDiv){
var _a=document.createElementNS(Forms.NS,"iframe");
_a.className="formContainer";
_a.id=this.form.formId;
_a.setAttribute("frameborder","0");
_a.src=_9;
this.form.frameDiv.appendChild(_a);
}
var n=findFirst(this.formsEl.firstChild,"span");
if(n){
n.replaceChild(document.createTextNode(_8),n.firstChild);
var a0=findFirst(n,"a");
if(a0){
a0.onclick=window.closeForm;
a0.setAttribute("href",this.form.formId);
}
}
this.form.name=_8;
this.form.url=_9;
this.form.inUse=true;
this.form.access=a.access||0;
delete this.form.objectToClose;
document.getElementById("middlePanel").style.display="none";
document.getElementById("rightPanel").style.display="none";
this.formsEl.style.visibility="visible";
this.formsEl.style.display="block";
this.updateSize();
return false;
};
Forms.prototype.changeForm=function(a,w){
var _f=a.getAttribute("href");
var _10=a.getAttribute("title")||_f;
if(!_f){
return false;
}
var _11=this.peekOrder();
if(this.form.formId==_11){
if(this.form.objectToClose){
var s=new Semaphore(1,null,function(){
w.location.replace(_f);
});
if(!this.form.objectToClose.close(false,s)){
return false;
}
}
var n=findFirst(this.formsEl.firstChild,"span");
if(n){
n.replaceChild(document.createTextNode(_10),n.firstChild);
var a=findFirst(n,"a");
if(a){
a.onclick=window.closeForm;
a.setAttribute("href",this.form.formId);
}
}
this.form.name=_10;
this.form.url=_f;
this.form.access=a.access||0;
delete this.form.objectToClose;
return false;
}
return false;
};
Forms.prototype.closeForm=function(a){
var _15=a.formId||a.getAttribute("href");
if(this.form.inUse&&this.form.formId==_15){
if(this.form.objectToClose){
if(!this.form.objectToClose.close()){
return false;
}
}
this.form.inUse=false;
this.hideForms();
this.form.frameDiv.removeChild(this.form.frameDiv.firstChild);
return false;
}
return false;
};
Forms.prototype.formTimeout=function(_16){
if(!this.inTimeout){
var o=this.form.objectToClose;
if(this.form.inUse&&o&&o.checkTimeout){
if(!o.checkTimeout(true)){
return;
}
}
this.inTimeout=true;
Animator.once(this,this.checkTimeout,new Semaphore(1,this,this.timeoutCancelled));
}
};
Forms.prototype.checkTimeout=function(_18){
window.menu.signOff(true);
delete this.inTimeout;
};
Forms.prototype.closeAll=function(_19,_1a){
if(this.form.inUse){
if(this.form.objectToClose){
if(_1a){
_1a.increment();
}
if(!this.form.objectToClose.close(_19,_1a)&&!_19){
return false;
}
}
this.form.inUse=false;
this.hideForms();
this.form.frameDiv.removeChild(this.form.frameDiv.firstChild);
}
return true;
};
Forms.prototype.setOnClose=function(_1b,_1c){
if(this.form.inUse&&this.form.formId==_1b){
this.form.objectToClose=_1c;
}
};
Forms.prototype.hideForms=function(){
this.formsEl.style.visibility="hidden";
this.formsEl.style.display="none";
document.getElementById("middlePanel").style.display="block";
document.getElementById("rightPanel").style.display="block";
window.sizeWatcher.adjust();
};
Forms.prototype.getFormId=function(a){
while(a!=null&&a.nodeName!="iframe"){
a=a.parentNode;
}
if(a==null){
return null;
}
a=a.parentNode;
if(a.nodeName=="div"){
return a.id;
}
return null;
};
Forms.prototype.getAccess=function(_1e){
if(this.form.inUse&&this.form.formId==_1e){
return this.form.access;
}
return 0;
};
Forms.prototype.peekOrder=function(){
if(this.form.inUse){
return this.form.formId;
}
return null;
};

function flipRSSDiv(_1){
_1=_1||window.event;
var _2=_1.target||_1.srcElement;
var d=_2.nextSibling;
while(d&&d.nodeName!="DIV"){
d=d.nextSibling;
}
if(d){
d.style.display=(d.style.display=="block"?"none":"block");
if(_2.nodeName=="IMG"){
_2.src=(d.style.display=="block"?"images/showless.png":"images/showmore.png");
}
}else{
alert("No d; img is "+_2.nodeName);
}
return false;
}
function flipFieldset(_4,_5){
if(!_4||!_4.firstChild){
_4=_4||window.event;
}
var s=_4.target||_4.srcElement;
if(s===undefined){
s=this;
}
var f=findUp(s,"FIELDSET");
if(f){
var d=f.firstChild;
while(d&&d.nodeName!="DIV"){
d=d.nextSibling;
}
if(d){
if(_5===undefined){
_5=(d.style.display=="none");
}
if(_5){
d.style.display="block";
s.replaceChild(document.createTextNode("(Hide)"),s.firstChild);
}else{
d.style.display="none";
s.replaceChild(document.createTextNode("(Show)"),s.firstChild);
}
}
}
return false;
}

function LoginPrompt(_1,_2){
this.session=_1;
_2=(_2||"")+(_2?": ":"")+"Please sign on";
var df=document.getElementById("loginDiv");
if(df){
df.style.display="block";
df.style.visibility="visible";
df.loginPrompt=this;
var f=findFirst(df.firstChild,"form");
if(!f){
alert("Couldn't find form");
}else{
f.login.value=this.session.login||"";
f.login.focus();
f.login.select();
var pm=document.getElementById("loginMessage");
if(pm){
pm.replaceChild(document.createTextNode(_2),pm.firstChild);
}
f.submit.onclick=this.dialogIn;
f.submit.disabled=false;
f.submit.value="Sign On";
}
window.menu.signOff(true);
}
window.menu.setLabel();
}
LoginPrompt.visible=function(){
var df=document.getElementById("loginDiv");
if(df){
return (df.style.display=="block");
}
return false;
};
LoginPrompt.prototype.dialogIn=function(){
var df=document.getElementById("loginDiv");
var f=findFirst(df,"form");
var s=df.loginPrompt.session;
var _a=f.login.value.replace(/^\s+/,"").replace(/\s+$/,"").replace(/@.*/,"");
var _b=f.password.value.replace(/^\s+/,"").replace(/\s+$/,"");
if(_a&&_b){
df.style.display="none";
df.style.visibility="hidden";
window.menu.setLabel("Waiting...");
delete s.iv;
new net.ContentLoader({url:"fetchMenu.php",params:"&session="+s.service,loginPrompt:df.loginPrompt,onload:function(){
var _c=this.req.responseText;
if(_c){
var o=JSON.parse(_c);
if(typeof (o.needAuth)=="object"){
s.iv=o.needAuth.iv;
}
}
if(s.iv){
s.login=_a;
this.loginPrompt.dialog2(_b);
}else{
window.menu.setLabel();
alert("Unable to authenticate: "+message);
}
}});
}else{
var pm=document.getElementById("loginMessage");
if(pm){
pm.replaceChild(document.createTextNode("Login name and Password required"),pm.firstChild);
}
}
delete s.iv;
f.password.value="";
return false;
};
LoginPrompt.prototype.dialog2=function(_f){
var _10=new Cipher(MD5(this.session.iv+"/"+this.session.login+"/"+MD5(_f)));
var _11=_10.encipher("login:{\"password\":\""+_f+"\"}");
this.session.cipher=new Cipher(MD5(this.session.iv+"/"+this.session.login+"/"+_f));
this.session.cancelDeferred();
this.session.deferred.push({url:"fetchMenu.php",data:"var menuRoot=\"PORTAL\";",callback:window.menu.loadMenu,ontimeout:window.menu.signOff,menu:window.menu});
var _12="&loginName="+encodeURIComponent(this.session.login)+"&iv="+this.session.iv+"&session="+this.session.service+"&login="+_11;
new net.ContentLoader({url:this.session.deferred[0].url,onload:this.session.checkLogin,params:_12,session:this.session});
};

function dateTime(){
var d=new Date();
var e=document.getElementById("date");
if(e){
e.replaceChild(document.createTextNode(d.toFormString()),e.firstChild);
}
e=document.getElementById("time");
var t=new Time(d.getHours(),d.getMinutes());
if(e){
e.replaceChild(document.createTextNode(t.toFormString()),e.firstChild);
}
return true;
}
function portalOnload(){
window.session=new Session("EM");
window.globalDisplayCache=new DisplayCache();
WindowSize.getSizer();
window.formSet=new Forms("formPanel");
window.menu=new Menu("menuDiv","fetchMenu.php");
new LoginPrompt(window.session,"Welcome");
dateTime();
Animator.add(2000,null,dateTime);
window.showForm=function(){
return formSet.showForm(this);
};
window.closeForm=function(){
try{
return formSet.closeForm(this);
}
catch(err){
alert(err.toString());
}
};
window.changeForm=function(a,w){
return formSet.changeForm(a,w);
};
window.revealForm=function(f){
};
var p=document.getElementsByTagName("div");
for(var i=0;i<p.length;i++){
if(p[i].getAttribute("portalElement")=="Y"){
window.menu.addPortalElement(p[i].id,p[i].getAttribute("refresh")||1800);
}
}
}


