configuration = {   sessionID: 'imE4XnIo8rpLY3thtrCrPw',   synchronous: false,   redirectURI: null,   connection: {       context: '/PortalSAT',       timeout: 30000,       heartbeat: {           interval: 20000,           timeout: 3000,           retries: 3       }   }};var Prototype={Version:"1.4",ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){
},K:function(x){
return x;
}};
var Class={create:function(){
return function(){
this.initialize.apply(this,arguments);
};
}};
var Abstract=new Object();
Object.extend=function(_2,_3){
for(property in _3){
_2[property]=_3[property];
}
return _2;
};
Object.inspect=function(_4){
try{
if(_4==undefined){
return "undefined";
}
if(_4==null){
return "null";
}
return _4.inspect?_4.inspect():_4.toString();
}
catch(e){
if(e instanceof RangeError){
return "...";
}
throw e;
}
};
Function.prototype.bind=function(){
var _5=this,_6=$A(arguments),_7=_6.shift();
return function(){
return _5.apply(_7,_6.concat($A(arguments)));
};
};
Function.prototype.bindAsEventListener=function(_8){
var _9=this;
return function(_a){
return _9.call(_8,_a||window.event);
};
};
Object.extend(Number.prototype,{toColorPart:function(){
var _b=this.toString(16);
if(this<16){
return "0"+_b;
}
return _b;
},succ:function(){
return this+1;
},times:function(_c){
$R(0,this,true).each(_c);
return this;
}});
var Try={these:function(){
var _d;
for(var i=0;i<arguments.length;i++){
var _f=arguments[i];
try{
_d=_f();
break;
}
catch(e){
}
}
return _d;
}};
var PeriodicalExecuter=Class.create();
PeriodicalExecuter.prototype={initialize:function(_10,_11){
this.callback=_10;
this.frequency=_11;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},onTimerEvent:function(){
if(!this.currentlyExecuting){
try{
this.currentlyExecuting=true;
this.callback();
}
finally{
this.currentlyExecuting=false;
}
}
}};
function $(){
var _12=new Array();
for(var i=0;i<arguments.length;i++){
var _14=arguments[i];
if(typeof _14=="string"){
_14=document.getElementById(_14);
}
if(arguments.length==1){
return _14;
}
_12.push(_14);
}
return _12;
}
Object.extend(String.prototype,{stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
},stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
},extractScripts:function(){
var _15=new RegExp(Prototype.ScriptFragment,"img");
var _16=new RegExp(Prototype.ScriptFragment,"im");
return (this.match(_15)||[]).map(function(_17){
return (_17.match(_16)||["",""])[1];
});
},evalScripts:function(){
return this.extractScripts().map(eval);
},escapeHTML:function(){
var div=document.createElement("div");
var _19=document.createTextNode(this);
div.appendChild(_19);
return div.innerHTML;
},unescapeHTML:function(){
var div=document.createElement("div");
div.innerHTML=this.stripTags();
return div.childNodes[0]?div.childNodes[0].nodeValue:"";
},toQueryParams:function(){
var _1b=this.match(/^\??(.*)$/)[1].split("&");
return _1b.inject({},function(_1c,_1d){
var _1e=_1d.split("=");
_1c[_1e[0]]=_1e[1];
return _1c;
});
},toArray:function(){
return this.split("");
},camelize:function(){
var _1f=this.split("-");
if(_1f.length==1){
return _1f[0];
}
var _20=this.indexOf("-")==0?_1f[0].charAt(0).toUpperCase()+_1f[0].substring(1):_1f[0];
for(var i=1,len=_1f.length;i<len;i++){
var s=_1f[i];
_20+=s.charAt(0).toUpperCase()+s.substring(1);
}
return _20;
},inspect:function(){
return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'";
}});
String.prototype.parseQuery=String.prototype.toQueryParams;
var $break=new Object();
var $continue=new Object();
var Enumerable={each:function(_24){
var _25=0;
try{
this._each(function(_26){
try{
_24(_26,_25++);
}
catch(e){
if(e!=$continue){
throw e;
}
}
});
}
catch(e){
if(e!=$break){
throw e;
}
}
},all:function(_27){
var _28=true;
this.each(function(_29,_2a){
_28=_28&&!!(_27||Prototype.K)(_29,_2a);
if(!_28){
throw $break;
}
});
return _28;
},any:function(_2b){
var _2c=true;
this.each(function(_2d,_2e){
if(_2c=!!(_2b||Prototype.K)(_2d,_2e)){
throw $break;
}
});
return _2c;
},collect:function(_2f){
var _30=[];
this.each(function(_31,_32){
_30.push(_2f(_31,_32));
});
return _30;
},detect:function(_33){
var _34;
this.each(function(_35,_36){
if(_33(_35,_36)){
_34=_35;
throw $break;
}
});
return _34;
},findAll:function(_37){
var _38=[];
this.each(function(_39,_3a){
if(_37(_39,_3a)){
_38.push(_39);
}
});
return _38;
},grep:function(_3b,_3c){
var _3d=[];
this.each(function(_3e,_3f){
var _40=_3e.toString();
if(_40.match(_3b)){
_3d.push((_3c||Prototype.K)(_3e,_3f));
}
});
return _3d;
},include:function(_41){
var _42=false;
this.each(function(_43){
if(_43==_41){
_42=true;
throw $break;
}
});
return _42;
},inject:function(_44,_45){
this.each(function(_46,_47){
_44=_45(_44,_46,_47);
});
return _44;
},invoke:function(_48){
var _49=$A(arguments).slice(1);
return this.collect(function(_4a){
return _4a[_48].apply(_4a,_49);
});
},max:function(_4b){
var _4c;
this.each(function(_4d,_4e){
_4d=(_4b||Prototype.K)(_4d,_4e);
if(_4d>=(_4c||_4d)){
_4c=_4d;
}
});
return _4c;
},min:function(_4f){
var _50;
this.each(function(_51,_52){
_51=(_4f||Prototype.K)(_51,_52);
if(_51<=(_50||_51)){
_50=_51;
}
});
return _50;
},partition:function(_53){
var _54=[],_55=[];
this.each(function(_56,_57){
((_53||Prototype.K)(_56,_57)?_54:_55).push(_56);
});
return [_54,_55];
},pluck:function(_58){
var _59=[];
this.each(function(_5a,_5b){
_59.push(_5a[_58]);
});
return _59;
},reject:function(_5c){
var _5d=[];
this.each(function(_5e,_5f){
if(!_5c(_5e,_5f)){
_5d.push(_5e);
}
});
return _5d;
},sortBy:function(_60){
return this.collect(function(_61,_62){
return {value:_61,criteria:_60(_61,_62)};
}).sort(function(_63,_64){
var a=_63.criteria,b=_64.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.collect(Prototype.K);
},zip:function(){
var _67=Prototype.K,_68=$A(arguments);
if(typeof _68.last()=="function"){
_67=_68.pop();
}
var _69=[this].concat(_68).map($A);
return this.map(function(_6a,_6b){
_67(_6a=_69.pluck(_6b));
return _6a;
});
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
var $A=Array.from=function(_6c){
if(!_6c){
return [];
}
if(_6c.toArray){
return _6c.toArray();
}else{
var _6d=[];
for(var i=0;i<_6c.length;i++){
_6d.push(_6c[i]);
}
return _6d;
}
};
Object.extend(Array.prototype,Enumerable);
Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(_6f){
for(var i=0;i<this.length;i++){
_6f(this[i]);
}
},clear:function(){
this.length=0;
return this;
},first:function(){
return this[0];
},last:function(){
return this[this.length-1];
},compact:function(){
return this.select(function(_71){
return _71!=undefined||_71!=null;
});
},flatten:function(){
return this.inject([],function(_72,_73){
return _72.concat(_73.constructor==Array?_73.flatten():[_73]);
});
},without:function(){
var _74=$A(arguments);
return this.select(function(_75){
return !_74.include(_75);
});
},indexOf:function(_76){
for(var i=0;i<this.length;i++){
if(this[i]==_76){
return i;
}
}
return -1;
},reverse:function(_78){
return (_78!==false?this:this.toArray())._reverse();
},shift:function(){
var _79=this[0];
for(var i=0;i<this.length-1;i++){
this[i]=this[i+1];
}
this.length--;
return _79;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});
var Hash={_each:function(_7b){
for(key in this){
var _7c=this[key];
if(typeof _7c=="function"){
continue;
}
var _7d=[key,_7c];
_7d.key=key;
_7d.value=_7c;
_7b(_7d);
}
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},merge:function(_7e){
return $H(_7e).inject($H(this),function(_7f,_80){
_7f[_80.key]=_80.value;
return _7f;
});
},toQueryString:function(){
return this.map(function(_81){
return _81.map(encodeURIComponent).join("=");
}).join("&");
},inspect:function(){
return "#<Hash:{"+this.map(function(_82){
return _82.map(Object.inspect).join(": ");
}).join(", ")+"}>";
}};
function $H(_83){
var _84=Object.extend({},_83||{});
Object.extend(_84,Enumerable);
Object.extend(_84,Hash);
return _84;
}
ObjectRange=Class.create();
Object.extend(ObjectRange.prototype,Enumerable);
Object.extend(ObjectRange.prototype,{initialize:function(_85,end,_87){
this.start=_85;
this.end=end;
this.exclusive=_87;
},_each:function(_88){
var _89=this.start;
do{
_88(_89);
_89=_89.succ();
}while(this.include(_89));
},include:function(_8a){
if(_8a<this.start){
return false;
}
if(this.exclusive){
return _8a<this.end;
}
return _8a<=this.end;
}});
var $R=function(_8b,end,_8d){
return new ObjectRange(_8b,end,_8d);
};
var Ice=new Object;
Object.methods=function(_8e){
for(property in _8e){
this.prototype[property]=_8e[property];
}
};
Object.subclass=function(_8f){
var _90=function(){
this.initialize.apply(this,arguments);
};
_90.methods=this.methods;
_90.subclass=this.subclass;
_90.prototype.initialize=Function.NOOP;
_90.methods(this.prototype);
_90.prototype.initializeSuperclass=this.prototype.initialize?this.prototype.initialize:Function.NOOP;
_90.methods(_8f||{});
return _90;
};
Boolean.prototype.ifTrue=function(e){
if(this==true){
e();
}
return this;
};
Boolean.prototype.ifFalse=function(e){
if(this==false){
e();
}
return this;
};
Number.prototype.asZeroPrefixedString=function(){
return this<9?("0"+this):this.toString();
};
Date.prototype.toTimestamp=function(){
return this.getDate().asZeroPrefixedString()+"/"+this.getMonth().asZeroPrefixedString()+"/"+this.getFullYear()+" "+this.getHours().asZeroPrefixedString()+":"+this.getMinutes().asZeroPrefixedString()+":"+this.getSeconds().asZeroPrefixedString();
};
Object.extend(String.prototype,{asBoolean:function(){
return "true"==this||"yes"==this;
},asNumber:function(){
return this*1;
},asElement:function(){
return document.getElementById(this);
},asExtendedElement:function(){
var _93=this.asElement();
if(!_93){
throw "cannot find element with id: '"+this+"'";
}
return Ice.ElementModel.Element.adaptToElement(_93);
},asRegexp:function(){
return new RegExp(this);
},containsWords:function(){
return /(\w+)/.test(this);
}});
Object.extend(Array.prototype,{as:function(_94){
_94.apply(_94,this);
},copy:function(){
return this.collect(function(_95){
return _95;
});
},copyFrom:function(_96,_97){
var _98=[];
var end=_96+_97;
for(var i=_96;i<end;i++){
_98.push(this[i]);
}
return _98;
},broadcast:function(_9b){
this.each(function(_9c){
_9c(_9b);
});
},broadcaster:function(){
return function(_9d){
this.broadcast(_9d);
}.bind(this);
},asSet:function(){
var set=[];
this.each(function(_9f){
if(!set.include(_9f)){
set.push(_9f);
}
});
return set;
}});
Function.prototype.delayFor=function(_a0){
var _a1=this;
return function(){
var _a2=this;
var _a3=arguments;
var _a4=function(){
try{
_a1.apply(_a2,_a3);
}
finally{
clearInterval(_a3.id);
_a3.id=null;
}
};
var id=_a3.id=setInterval(_a4,_a0);
arguments.callee.cancel=function(){
clearInterval(id);
_a3.id=null;
};
};
};
Function.prototype.delayExecutionFor=function(_a6){
var _a7=this.delayFor(_a6);
_a7.apply();
return _a7;
};
Function.prototype.repeatEvery=function(_a8){
var _a9=this;
return function(){
var _aa=this;
var _ab=arguments;
var _ac=function(){
_a9.apply(_aa,_ab);
};
var id=setInterval(_ac,_a8);
arguments.callee.cancel=function(){
clearInterval(id);
};
};
};
Function.prototype.repeatExecutionEvery=function(_ae){
var _af=this.repeatEvery(_ae);
_af.apply();
return _af;
};
Function.NOOP=function(){
};
window.width=function(){
return window.innerWidth?window.innerWidth:(document.documentElement&&document.documentElement.clientWidth)?document.documentElement.clientWidth:document.body.clientWidth;
};
window.height=function(){
return window.innerHeight?window.innerHeight:(document.documentElement&&document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight;
};
["onLoad","onUnload","onResize","onScroll"].each(function(_b0){
if(!window[_b0]){
window[_b0]=function(_b1){
var _b2=_b0.toLowerCase();
var _b3=window[_b2];
var _b4=_b3?[_b3,_b1]:[_b1];
window[_b2]=_b4.broadcaster();
window[_b0]=function(_b5){
if(!_b4.detect(function(_b6){
return _b6.toString()==_b5.toString();
})){
_b4.push(_b5);
}
};
};
}
});
window.onKeyPress=function(_b7){
var _b8=document.onkeypress;
document.onkeypress=_b8?function(e){
_b7(Ice.EventModel.Event.adaptToEvent(e));
_b8(e);
}:function(e){
_b7(Ice.EventModel.Event.adaptToKeyEvent(e));
};
};
[Ice].as(function(_bb){
_bb.Enumerator=Object.subclass({initialize:function(_bc){
this.indexedObject=_bc;
},_each:function(_bd){
for(var i=0;i<this.indexedObject.length;i++){
_bd(this.indexedObject[i],i);
}
},reverse:function(){
return new _bb.ReverseEnumerator(this.indexedObject);
}});
_bb.Enumerator.methods(Enumerable);
_bb.ReverseEnumerator=_bb.Enumerator.subclass({_each:function(_bf){
for(var i=(this.indexedObject.length-1);i>=0;i--){
_bf(this.indexedObject[i],i);
}
},reverse:function(){
return new _bb.Enumerator(this.indexedObject);
}});
Object.prototype.asEnumerator=function(){
return new _bb.Enumerator(this);
};
window.$enumerate=function(_c1){
return new _bb.Enumerator(_c1);
};
});
[Ice.Log=new Object].as(function(_c2){
_c2.Priority=Object.subclass({debug:function(_c3,_c4,_c5){
_c3.log(_c2.Priority.DEBUG,_c4,_c5);
},info:function(_c6,_c7,_c8){
_c6.log(_c2.Priority.INFO,_c7,_c8);
},warn:function(_c9,_ca,_cb){
_c9.log(_c2.Priority.WARN,_ca,_cb);
},error:function(_cc,_cd,_ce){
_cc.log(_c2.Priority.ERROR,_cd,_ce);
},asString:function(){
return this.name;
}});
_c2.Debug=_c2.Priority.subclass({initialize:function(){
this.name="debug";
this.color="#333";
}});
_c2.Info=_c2.Debug.subclass({initialize:function(){
this.name="info";
this.color="green";
},debug:Function.NOOP});
_c2.Warn=_c2.Info.subclass({initialize:function(){
this.name="warn";
this.color="orange";
},info:Function.NOOP});
_c2.Error=_c2.Warn.subclass({initialize:function(){
this.name="error";
this.color="red";
},warn:Function.NOOP});
_c2.Priority.DEBUG=new _c2.Debug;
_c2.Priority.INFO=new _c2.Info;
_c2.Priority.WARN=new _c2.Warn;
_c2.Priority.ERROR=new _c2.Error;
_c2.Priority.Levels=[_c2.Priority.DEBUG,_c2.Priority.INFO,_c2.Priority.WARN,_c2.Priority.ERROR];
_c2.Event=Object.subclass({initialize:function(_cf,_d0,_d1,_d2){
this.timestamp=new Date();
this.category=_cf;
this.priority=_d0;
this.message=_d1;
this.exception=_d2;
},asString:function(){
return this.timestamp.toTimestamp()+" "+this.priority.asString()+" \t["+this.category.join(".")+"] : "+this.message+(this.exception?("\n"+this.exception):"");
},asNodeIn:function(_d3){
var _d4=_d3.ownerDocument;
this.asString().split("\n").each(function(_d5){
if(_d5.containsWords()){
var _d6=_d4.createElement("div");
_d6.style.padding="3px";
_d6.style.color=this.priority.color;
_d3.appendChild(_d6).appendChild(_d4.createTextNode(_d5));
}
}.bind(this));
}});
_c2.Event.prototype.toString=_c2.Event.prototype.asString;
_c2.Logger=Object.subclass({initialize:function(_d7,_d8,_d9){
this.handler=_d8||{handle:Function.NOOP};
this.category=_d7;
this.children=[];
this.priority=_d9||_c2.Priority.ERROR;
},log:function(_da,_db,_dc){
this.handler.handle(new _c2.Event(this.category,_da,_db,_dc));
},debug:function(_dd,_de){
this.priority.debug(this,_dd,_de);
},info:function(_df,_e0){
this.priority.info(this,_df,_e0);
},warn:function(_e1,_e2){
this.priority.warn(this,_e1,_e2);
},error:function(_e3,_e4){
this.priority.error(this,_e3,_e4);
},child:function(_e5){
var _e6=this.category.copy();
_e6.push(_e5);
var _e7=new _c2.Logger(_e6,this.handler);
this.children.push(_e7);
return _e7;
},threshold:function(_e8){
this.priority=_e8;
this.children.each(function(_e9){
_e9.threshold(_e8);
});
},handleWith:function(_ea){
this.handler=_ea;
}});
_c2.WindowLogHandler=Object.subclass({initialize:function(_eb,_ec,_ed,_ee){
this.lineOptions=[25,50,100,200,400];
this.logger=_eb;
this.logger.handleWith(this);
this.parentWindow=_ec;
this.lines=_ed||this.lineOptions[3];
this.thresholdPriority=_ee||_c2.Priority.DEBUG;
this.categoryMatcher=/.*/;
this.closeOnExit=true;
this.noopHandle=Function.NOOP;
this.opHandle=function(_ef){
if(this.categoryMatcher.test(_ef.category.join("."))){
_ef.asNodeIn(this.log);
this.log.scrollTop=this.log.scrollHeight;
}
this.clearPreviousEvents();
};
this.handle=this.noopHandle;
this.parentWindow.onKeyPress(function(e){
var key=e.keyCode();
if((key==20||key==84)&&e.isCtrlPressed()&&e.isShiftPressed()){
this.enable();
}
}.bind(this));
},clearPreviousEvents:function(){
var _f2=$A(this.log.childNodes);
_f2.copyFrom(0,_f2.length-this.lines).each(function(_f3){
this.log.removeChild(_f3);
}.bind(this));
},clearAllEvents:function(){
$A(this.log.childNodes).each(function(_f4){
this.log.removeChild(_f4);
}.bind(this));
},enable:function(){
try{
this.window=this.parentWindow.open("","log","scrollbars=1,width=800,height=680");
var _f5=this.window.document;
this.log=this.window.document.getElementById("log-window");
if(this.log){
return;
}
_f5.body.appendChild(_f5.createTextNode(" Close on exit "));
var _f6=_f5.createElement("input");
_f6.style.margin="2px";
_f6.setAttribute("type","checkbox");
_f6.defaultChecked=true;
_f6.checked=true;
_f6.onclick=function(){
this.closeOnExit=_f6.checked;
}.bind(this);
_f5.body.appendChild(_f6);
_f5.body.appendChild(_f5.createTextNode(" Lines "));
var _f7=_f5.createElement("select");
_f7.style.margin="2px";
this.lineOptions.each(function(_f8,_f9){
var _fa=_f7.appendChild(_f5.createElement("option"));
if(this.lines==_f8){
_f7.selectedIndex=_f9;
}
_fa.appendChild(_f5.createTextNode(_f8.toString()));
}.bind(this));
_f7.onchange=function(_fb){
this.lines=this.lineOptions[_f7.selectedIndex];
this.clearPreviousEvents();
}.bind(this);
_f5.body.appendChild(_f7);
_f5.body.appendChild(_f5.createTextNode(" Category "));
var _fc=_f5.createElement("input");
_fc.style.margin="2px";
_fc.setAttribute("type","text");
_fc.setAttribute("value",this.categoryMatcher.source);
_fc.onchange=function(){
this.categoryMatcher=_fc.value.asRegexp();
}.bind(this);
_f5.body.appendChild(_fc);
_f5.body.appendChild(_f5.createTextNode(" Level "));
var _fd=_f5.createElement("select");
_fd.style.margin="2px";
_c2.Priority.Levels.each(function(_fe,_ff){
var _100=_fd.appendChild(_f5.createElement("option"));
if(this.thresholdPriority==_fe){
_fd.selectedIndex=_ff;
}
_100.appendChild(_f5.createTextNode(_fe.asString()));
}.bind(this));
this.logger.threshold(this.thresholdPriority);
_fd.onchange=function(_101){
this.thresholdPriority=_c2.Priority.Levels[_fd.selectedIndex];
this.logger.threshold(this.thresholdPriority);
}.bind(this);
_f5.body.appendChild(_fd);
var _102=_f5.createElement("input");
_102.style.margin="2px";
_102.setAttribute("type","button");
_102.setAttribute("value","Stop");
_102.onclick=function(){
_102.setAttribute("value",this.toggle()?"Stop":"Start");
}.bind(this);
_f5.body.appendChild(_102);
var _103=_f5.createElement("input");
_103.style.margin="2px";
_103.setAttribute("type","button");
_103.setAttribute("value","Clear");
_103.onclick=function(){
this.clearAllEvents();
}.bind(this);
_f5.body.appendChild(_103);
this.log=_f5.body.appendChild(_f5.createElement("pre"));
this.log.id="log-window";
this.log.style.width="100%";
this.log.style.minHeight="0";
this.log.style.maxHeight="550px";
this.log.style.borderWidth="1px";
this.log.style.borderStyle="solid";
this.log.style.borderColor="#999";
this.log.style.backgroundColor="#ddd";
this.log.style.overflow="scroll";
this.window.onunload=function(){
this.disable();
}.bind(this);
this.handle=this.opHandle;
}
catch(e){
this.disable();
}
},disable:function(){
this.logger.threshold(_c2.Priority.ERROR);
this.handle=this.noopHandle;
if(this.closeOnExit&&this.window){
this.window.close();
}
},toggle:function(){
if(this.handle==this.noopHandle){
this.handle=this.opHandle;
return true;
}else{
this.handle=this.noopHandle;
return false;
}
}});
});
[Ice.Ajax=new Object].as(function(This){
This.Client=Object.subclass({initialize:function(_105){
this.logger=_105.child("ajax");
this.cookies=new Object;
document.cookie.split("; ").each(function(_106){
var _107=_106.split("=");
this.cookies[_107.first()]=_107.last();
}.bind(this));
try{
if(window.createRequest){
this.createRequest=function(){
var _108=new This.RequestProxy(window.createRequest(),this.logger);
_108.post=function(_109,path,_10b,_10c){
this.get(_109,path,_10b,_10c);
};
return _108;
}.bind(this);
}else{
if(window.XMLHttpRequest){
this.createRequest=function(){
return new This.RequestProxy(new XMLHttpRequest(),this.logger);
}.bind(this);
}else{
if(window.ActiveXObject){
this.createRequest=function(){
return new This.RequestProxy(new ActiveXObject("Microsoft.XMLHTTP"),this.logger);
}.bind(this);
}
}
}
}
catch(e){
this.logger.error("failed to create factory request",e);
}
},getAsynchronously:function(path,_10e,_10f){
return this.createRequest().getAsynchronously(path,_10e,_10f);
},getSynchronously:function(path,_111,_112){
return this.createRequest().getSynchronously(path,_111,_112);
},postAsynchronously:function(path,_114,_115){
return this.createRequest().postAsynchronously(path,_114,_115);
},postSynchronously:function(path,_117,_118){
return this.createRequest().postSynchronously(path,_117,_118);
}});
This.ResponseCallback=Object.subclass({initialize:function(_119,_11a){
this.testFunction=_119;
this.handlerFunction=_11a;
},execute:function(_11b){
if(this.testFunction(_11b)){
this.handlerFunction(_11b);
}
}});
This.RequestProxy=Object.subclass({initialize:function(_11c,_11d){
this.identifier=+Math.random().toString().substr(2,7);
this.request=_11c;
this.logger=_11d;
this.callbacks=[];
this.responseCallback=function(){
this.callbacks.each(function(_11e){
try{
_11e.execute(this);
}
catch(e){
this.logger.error("failed to respond",e);
}
}.bind(this));
}.bind(this);
},on:function(test,_120){
this.callbacks.push(new This.ResponseCallback(test,_120));
},isComplete:function(){
return this.request.readyState==4;
},isResponseValid:function(){
try{
return this.request.status>=0;
}
catch(e){
return false;
}
},isOk:function(){
try{
return this.request.status==200;
}
catch(e){
return false;
}
},isUnavailable:function(){
try{
return this.request.status==503;
}
catch(e){
return false;
}
},isOkAndComplete:function(){
return this.isComplete()&&this.isOk();
},isUnavailableAndComplete:function(){
return this.isComplete()&&this.isUnavailable();
},getAsynchronously:function(path,_122,_123){
this.request.open("GET",path+"?"+_122+"&rand="+Math.random(),true);
if(_123){
_123(this);
}
this.request.onreadystatechange=this.responseCallback;
this.logger.debug("["+this.identifier+"] : send asynchronous GET");
this.request.send("");
return this;
},postAsynchronously:function(path,_125,_126){
this.request.open("POST",path,true);
if(_126){
_126(this);
}
this.request.onreadystatechange=this.responseCallback;
Ice.Focus.userInterupt=false;
this.logger.debug("["+this.identifier+"] : send asynchronous POST");
this.request.send(_125+"&rand="+Math.random()+"\n\n");
return this;
},getSynchronously:function(path,_128,_129){
this.request.open("GET",path+"?"+_128+"&rand="+Math.random(),false);
if(_129){
_129(this);
}
this.logger.debug("["+this.identifier+"] : send synchronous GET");
this.request.send("");
this.responseCallback();
return this;
},postSynchronously:function(path,_12b,_12c){
this.request.open("POST",path,false);
if(_12c){
_12c(this);
}
this.logger.debug("["+this.identifier+"] : send synchronous POST");
Ice.Focus.userInterupt=false;
this.request.send(_12b+"&rand="+Math.random()+"\n\n");
this.responseCallback();
return this;
},setRequestHeader:function(name,_12e){
this.request.setRequestHeader(name,_12e);
},getResponseHeader:function(name){
try{
return this.request.getResponseHeader(name);
}
catch(e){
return null;
}
},containsResponseHeader:function(name){
try{
var _131=this.request.getResponseHeader(name);
return _131&&_131!="";
}
catch(e){
return false;
}
},content:function(){
try{
return this.request.responseText;
}
catch(e){
return "";
}
},contentAsDOM:function(){
return this.request.responseXML;
},close:function(){
this.request.onreadystatechange=Function.NOOP;
this.request.abort();
this.request=null;
this.callbacks=null;
this.logger.debug("["+this.identifier+"] : connection closed");
}});
});
[Ice.Parameter=new Object].as(function(This){
This.Query=Object.subclass({initialize:function(){
this.parameters=[];
},add:function(name,_134){
if(!this.parameters.detect(function(_135){
return _135.name==name&&_135.value==_134;
})){
this.parameters.push(name.associateWith(_134));
}
},addQuery:function(_136){
_136.serializeOn(this);
return this;
},asURIEncodedString:function(){
return this.parameters.inject("",function(_137,_138,_139){
return _137+=(_139==0)?_138.asURIEncodedString():"&"+_138.asURIEncodedString();
});
},asString:function(){
return this.parameters.inject("",function(_13a,_13b,_13c){
return _13a+"\n| "+_13b.asString()+" |";
});
},sendOn:function(_13d){
_13d.send(this);
},send:function(){
if(!connection){
throw "default connection not available";
}
this.sendOn(connection);
},serializeOn:function(_13e){
this.parameters.each(function(_13f){
_13f.serializeOn(_13e);
});
}});
This.Query.create=function(_140){
var _141=new This.Query;
_140.apply(this,[_141]);
return _141;
};
This.Association=Object.subclass({initialize:function(name,_143){
this.name=name;
this.value=_143;
},asURIEncodedString:function(){
return encodeURIComponent(this.name)+"="+encodeURIComponent(this.value);
},asString:function(){
return this.name+"="+this.value;
},serializeOn:function(_144){
_144.add(this.name,this.value);
}});
Object.prototype.associateWith=function(_145){
return new This.Association(this,_145);
};
});
[Ice.Geometry=new Object].as(function(This){
This.Point=Object.subclass({initialize:function(x,y){
this.x=x;
this.y=y;
},asString:function(){
return "point ["+this.x+", "+this.y+"]";
},toString:function(){
return this.asString();
},serializeOn:function(_149){
_149.add("ice.event.x",this.x);
_149.add("ice.event.y",this.y);
}});
});
[Ice.ElementModel=new Object].as(function(This){
This.TemporaryContainer=function(){
var _14b=document.body.appendChild(document.createElement("div"));
_14b.style.visibility="hidden";
This.TemporaryContainer=function(){
return _14b;
};
return _14b;
};
This.DisconnectAllListenersAndPeers=function(e){
var _14d=e.getElementsByTagName("*");
for(var i=0;i<_14d.length;i++){
var _14f=_14d[i];
var peer=_14f.peer;
if(peer){
peer.eachListenerName(function(_151){
_14f[_151.toLowerCase()]=null;
});
_14f.peer=null;
peer.element=null;
}
}
};
This.Element=Object.subclass({MouseListenerNames:["onClick","onDblClick","onMouseDown","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],KeyListenerNames:["onKeyDown","onKeyPress","onKeyUp","onHelp"],initialize:function(_152){
this.element=_152;
},id:function(){
return this.element.id;
},replaceHtml:function(html){
this.withTemporaryContainer(function(_154){
_154.innerHTML=html;
var _155=_154.firstChild;
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_155);
});
},withAllChildElements:function(_156){
var _157=this.element.getElementsByTagName("*");
for(var i=0;i<_157.length;i++){
var peer=_157[i].peer;
if(peer){
_156(peer);
}
}
},disconnectAllListenersAndPeers:/MSIE/.test(navigator.userAgent)?function(){
This.DisconnectAllListenersAndPeers.delayFor(100)(this.element);
}:function(){
This.DisconnectAllListenersAndPeers(this.element);
},serializeOn:function(_15a){
},sendOn:function(_15b){
Query.create(function(_15c){
this.serializeOn(_15c);
}.bind(this)).sendOn(_15b);
},send:function(){
this.sendOn(connection);
},withTemporaryContainer:function(_15d){
try{
_15d.apply(this,[This.TemporaryContainer()]);
}
finally{
This.TemporaryContainer().innerHTML="";
}
},replaceHostElementWith:function(_15e){
this.displayOff();
this.element.parentNode.replaceChild(_15e,this.element);
this.element=_15e;
this.element.peer=this;
},displayOff:/Safari/.test(navigator.userAgent)?Function.NOOP:function(){
this.element.style.display="none";
},eachListenerName:function(_15f){
this.MouseListenerNames.each(_15f);
this.KeyListenerNames.each(_15f);
}});
This.Element.adaptToElement=function(e){
if(e.peer){
return e.peer;
}
switch(e.tagName.toLowerCase()){
case "textarea":
case "input":
e.peer=new This.InputElement(e);
break;
case "th":
case "td":
case "tr":
e.peer=new This.TableCellElement(e);
break;
case "button":
e.peer=new This.ButtonElement(e);
break;
case "select":
e.peer=new This.SelectElement(e);
break;
case "form":
e.peer=new This.FormElement(e);
break;
case "body":
e.peer=new This.BodyElement(e);
break;
case "script":
e.peer=new This.ScriptElement(e);
break;
case "title":
e.peer=new This.TitleElement(e);
break;
case "a":
e.peer=new This.AnchorElement(e);
break;
case "fieldset":
e.peer=new This.FieldSetElement(e);
break;
default:
e.peer=new This.Element(e);
break;
}
return e.peer;
};
This.InputElement=This.Element.subclass({InputListenerNames:["onBlur","onFocus","onChange"],initialize:function(_161){
this.element=_161;
var type=_161.type.toLowerCase();
this.isSubmitElement=type=="submit"||type=="image"||type=="button";
},isSubmit:function(){
return this.isSubmitElement;
},form:function(){
return This.Element.adaptToElement(this.element.form);
},focus:function(){
var _163=this.element.onfocus;
this.element.onfocus=Function.NOOP;
this.element.focus();
this.element.onfocus=_163;
},replaceHtml:function(html){
this.withTemporaryContainer(function(_165){
_165.innerHTML=html;
var _166=_165.firstChild;
this.element.className=_166.className;
this.element.disabled=_166.disabled;
this.element.src=_166.src;
this.element.value=_166.value;
this.element.readOnly=_166.readOnly;
if(_166.style.display){
this.element.style.display="none";
}else{
this.element.style.display="";
}
this.element.title=_166.title;
if(this.element.checked!=_166.checked){
this.element.checked=_166.checked;
}
this.eachListenerName(function(_167){
var name=_167.toLowerCase();
this.element[name]=_166[name]?_166[name].bind(this.element):null;
_166[name]=null;
}.bind(this));
});
},serializeOn:function(_169){
switch(this.element.type.toLowerCase()){
case "image":
case "textarea":
case "submit":
case "hidden":
case "password":
case "text":
_169.add(this.element.name,this.element.value);
break;
case "checkbox":
case "radio":
if(this.element.checked){
_169.add(this.element.name,this.element.value||"on");
}
break;
}
},eachListenerName:function(_16a){
this.MouseListenerNames.each(_16a);
this.KeyListenerNames.each(_16a);
this.InputListenerNames.each(_16a);
}});
This.SelectElement=This.InputElement.subclass({isSubmit:function(){
return false;
},replaceHtml:function(html){
this.withTemporaryContainer(function(_16c){
_16c.innerHTML=html;
var _16d=_16c.firstChild;
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_16d);
});
},serializeOn:function(_16e){
$enumerate(this.element.options).select(function(_16f){
return _16f.selected;
}).each(function(_170){
_16e.add(this.element.name,_170.value||_170.text);
}.bind(this));
}});
This.ButtonElement=This.InputElement.subclass({initialize:function(_171){
this.element=_171;
this.isSubmitElement=_171.type.toLowerCase()=="submit";
},isSubmit:function(){
return this.isSubmitElement;
},replaceHtml:function(html){
this.withTemporaryContainer(function(_173){
_173.innerHTML=html;
var _174=_173.firstChild;
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_174);
});
},serializeOn:function(_175){
_175.add(this.element.name,this.element.value);
}});
This.FormElement=This.Element.subclass({FormListenerNames:["onReset","onSubmit"],formElements:/Safari/.test(navigator.userAgent)?function(){
var _176=[];
$enumerate(this.element.elements).reverse().each(function(_177){
if(!_176.detect(function(_178){
return _177.id&&_178.element.id&&_178.element.id==_177.id;
})){
_176.push(This.Element.adaptToElement(_177));
}
});
return _176;
}:function(){
return $enumerate(this.element.elements).collect(function(_179){
return This.Element.adaptToElement(_179);
});
},serializeOn:function(_17a){
this.formElements().each(function(_17b){
if(!_17b.isSubmit()){
_17b.serializeOn(_17a);
}
});
},eachListenerName:function(_17c){
this.MouseListenerNames.each(_17c);
this.KeyListenerNames.each(_17c);
this.FormListenerNames.each(_17c);
}});
This.BodyElement=This.Element.subclass({replaceHtml:function(html){
this.disconnectAllListenersAndPeers();
this.element.innerHTML=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
}});
This.ScriptElement=This.Element.subclass({replaceHtml:function(html){
var _17f=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
if(_17f!=""&&_17f!=";"){
var _180=function(){
eval(_17f);
};
_180.apply(window);
}
}});
This.TitleElement=This.Element.subclass({replaceHtml:function(html){
this.element.ownerDocument.title=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
}});
This.FieldSetElement=This.Element.subclass({isSubmit:function(html){
return false;
}});
This.AnchorElement=This.Element.subclass({focus:function(){
var _183=this.element.onfocus;
this.element.onfocus=Function.NOOP;
this.element.focus();
this.element.onfocus=_183;
},serializeOn:function(_184){
_184.add(this.element.name,this.element.name);
},form:function(){
var _185=this.element.parentNode;
while(_185){
if(_185.tagName&&_185.tagName.toLowerCase()=="form"){
return This.Element.adaptToElement(_185);
}
_185=_185.parentNode;
}
throw "Cannot find enclosing form.";
}});
This.TableCellElement=This.Element.subclass({replaceHtml:function(html){
this.withTemporaryContainer(function(_187){
_187.innerHTML="<TABLE>"+html+"</TABLE>";
var _188=_187.firstChild;
while((null!=_188)&&(this.element.id!=_188.id)){
_188=_188.firstChild;
}
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_188);
});
}});
window.$element=This.Element.adaptToElement;
});
[Ice.EventModel=new Object,Ice.ElementModel.Element,Ice.Parameter.Query,Ice.Geometry].as(function(This,_18a,_18b,_18c){
This.IE=new Object;
This.Netscape=new Object;
This.Event=Object.subclass({initialize:function(_18d,_18e){
this.event=_18d;
this.currentElement=_18e;
},cancel:function(){
this.cancelBubbling();
this.cancelDefaultAction();
},isKeyEvent:function(){
return false;
},isMouseEvent:function(){
return false;
},captured:function(){
return this.currentElement?_18a.adaptToElement(this.currentElement):null;
},serializeEventOn:function(_18f){
_18f.add("ice.event.target",this.target()&&this.target().id());
_18f.add("ice.event.captured",this.captured()&&this.captured().id());
_18f.add("ice.event.type","on"+this.event.type);
},serializeOn:function(_190){
this.serializeEventOn(_190);
},sendOn:function(_191){
_18b.create(function(_192){
"partial".associateWith("true").serializeOn(_192);
try{
this.captured().serializeOn(_192);
this.serializeOn(_192);
}
catch(e){
this.serializeOn(_192);
}
}.bind(this)).sendOn(_191);
},sendFullOn:function(_193){
_18b.create(function(_194){
"partial".associateWith("false").serializeOn(_194);
try{
this.captured().serializeOn(_194);
this.captured().form().serializeOn(_194);
this.serializeOn(_194);
}
catch(e){
this.serializeOn(_194);
}
}.bind(this)).sendOn(_193);
},sendWithCondition:function(_195){
if(_195(this)){
this.send();
}
},send:function(){
this.cancel();
this.sendOn(connection);
},sendFull:function(){
this.cancel();
this.sendFullOn(connection);
}});
This.IE.Event=This.Event.subclass({target:function(){
return this.event.srcElement?_18a.adaptToElement(this.event.srcElement):null;
},cancelBubbling:function(){
this.event.cancelBubble=true;
},cancelDefaultAction:function(){
this.event.returnValue=false;
}});
This.Netscape.Event=This.Event.subclass({target:function(){
return this.event.target?_18a.adaptToElement(this.event.target):null;
},cancelBubbling:function(){
this.event.stopPropagation();
},cancelDefaultAction:function(){
this.event.preventDefault();
}});
var _196={isAltPressed:function(){
return this.event.altKey;
},isCtrlPressed:function(){
return this.event.ctrlKey;
},isShiftPressed:function(){
return this.event.shiftKey;
},isMetaPressed:function(){
return this.event.metaKey;
},serializeKeyAndMouseEventOn:function(_197){
_197.add("ice.event.alt",this.isAltPressed());
_197.add("ice.event.ctrl",this.isCtrlPressed());
_197.add("ice.event.shift",this.isShiftPressed());
_197.add("ice.event.meta",this.isMetaPressed());
}};
var _198={isMouseEvent:function(){
return true;
},serializeOn:function(_199){
this.serializeEventOn(_199);
this.serializeKeyAndMouseEventOn(_199);
this.pointer().serializeOn(_199);
_199.add("ice.event.left",this.isLeftButton());
_199.add("ice.event.right",this.isRightButton());
}};
This.IE.MouseEvent=This.IE.Event.subclass({pointer:function(){
return new _18c.Point(this.event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft),this.event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
},isLeftButton:function(){
return this.event.button==1;
},isRightButton:function(){
return this.event.button==2;
}});
This.IE.MouseEvent.methods(_196);
This.IE.MouseEvent.methods(_198);
This.Netscape.MouseEvent=This.Netscape.Event.subclass({pointer:function(){
return new _18c.Point(this.event.pageX,this.event.pageY);
},isLeftButton:function(){
return this.event.which==1;
},isRightButton:function(){
return this.event.which==3;
}});
This.Netscape.MouseEvent.methods(_196);
This.Netscape.MouseEvent.methods(_198);
var _19a={keyCharacter:function(){
return String.fromCharCode(this.keyCode());
},isEnterKey:function(){
return this.keyCode()==13;
},isEscKey:function(){
return this.keyCode()==27;
},isBackspaceKey:function(){
return this.keyCode()==8;
},isDeleteKey:function(){
return this.keyCode()==46||this.keyCode()==63272;
},isSpaceKey:function(){
return this.keyCode()==32;
},isTabKey:function(){
return this.keyCode()==9||(this.isShiftPressed()&&this.keyCode()==25);
},isHomeKey:function(){
return this.keyCode()==36||this.keyCode()==63273;
},isEndKey:function(){
return this.keyCode()==35||this.keyCode()==63275;
},isPageUpKey:function(){
return this.keyCode()==33||this.keyCode()==63276;
},isPageDownKey:function(){
return this.keyCode()==34||this.keyCode()==63277;
},isArrowUpKey:function(){
return this.keyCode()==38||this.keyCode()==63232;
},isArrowDownKey:function(){
return this.keyCode()==40||this.keyCode()==63233;
},isArrowLeftKey:function(){
return this.keyCode()==37||this.keyCode()==63234;
},isArrowRightKey:function(){
return this.keyCode()==39||this.keyCode()==63235;
},isKeyEvent:function(){
return true;
},serializeOn:function(_19b){
this.serializeEventOn(_19b);
this.serializeKeyAndMouseEventOn(_19b);
_19b.add("ice.event.keycode",this.keyCode());
}};
This.IE.KeyEvent=This.IE.Event.subclass({keyCode:function(){
return this.event.keyCode;
}});
This.IE.KeyEvent.methods(_196);
This.IE.KeyEvent.methods(_19a);
This.Netscape.KeyEvent=This.Netscape.Event.subclass({keyCode:function(){
return this.event.which==0?this.event.keyCode:this.event.which;
}});
This.Netscape.KeyEvent.methods(_196);
This.Netscape.KeyEvent.methods(_19a);
This.UnknownEvent=This.Event.subclass({initialize:function(_19c){
this.currentElement=_19c;
},target:function(){
return _18a.adaptToElement(this.currentElement);
},serializeEventOn:function(_19d){
_19d.add("ice.event.target",this.target()&&this.target().id());
_19d.add("ice.event.captured",this.captured()&&this.captured().id());
_19d.add("ice.event.type","unknown");
},cancelBubbling:Function.NOOP,cancelDefaultAction:Function.NOOP});
This.Event.adaptToPlainEvent=function(e,_19f){
return window.event?new This.IE.Event(event,_19f):new This.Netscape.Event(e,_19f);
};
This.Event.adaptToMouseEvent=function(e,_1a1){
return window.event?new This.IE.MouseEvent(event,_1a1):new This.Netscape.MouseEvent(e,_1a1);
};
This.Event.adaptToKeyEvent=function(e,_1a3){
return window.event?new This.IE.KeyEvent(event,_1a3):new This.Netscape.KeyEvent(e,_1a3);
};
This.Event.adaptToEvent=function(e,_1a5){
var _1a6=window.event||e;
if(_1a6){
var _1a7="on"+_1a6.type;
var _1a8=function(name){
return name.toLowerCase()==_1a7;
};
if(_18a.prototype.KeyListenerNames.detect(_1a8)){
return This.Event.adaptToKeyEvent(e,_1a5);
}else{
if(_18a.prototype.MouseListenerNames.detect(_1a8)){
return This.Event.adaptToMouseEvent(e,_1a5);
}else{
return This.Event.adaptToPlainEvent(e,_1a5);
}
}
}else{
return new This.UnknownEvent(_1a5);
}
};
window.$event=This.Event.adaptToEvent;
});
function iceSubmitPartial(form,_1ab,evt){
form=(form?form:_1ab.form);
Ice.Parameter.Query.create(function(_1ad){
"partial".associateWith(true).serializeOn(_1ad);
$event(evt,_1ab).serializeOn(_1ad);
if(form&&form.id){
$element(form).serializeOn(_1ad);
}
if(_1ab&&_1ab.id){
$element(_1ab).serializeOn(_1ad);
}
}).send();
resetHiddenFieldsFor(form);
}
function iceSubmit(_1ae,_1af,_1b0){
_1ae=(_1ae?_1ae:_1af.form);
var _1b1=$event(_1b0,_1af);
var form=$element(_1ae);
if(_1b1.isKeyEvent()){
if(_1b1.isEnterKey()){
var _1b3=form?form.formElements().detect(function(_1b4){
return _1b4.id()==_1b4.form().id()+":default";
}):null;
_1b1.cancelDefaultAction();
Ice.Parameter.Query.create(function(_1b5){
"partial".associateWith(false).serializeOn(_1b5);
_1b1.serializeOn(_1b5);
if(_1b3){
_1b3.serializeOn(_1b5);
}
if(form){
form.serializeOn(_1b5);
}
}).send();
}
}else{
var _1b6=_1af&&_1af.id?$element(_1af):null;
Ice.Parameter.Query.create(function(_1b7){
"partial".associateWith(false).serializeOn(_1b7);
_1b1.serializeOn(_1b7);
if(_1b6){
_1b6.serializeOn(_1b7);
}
if(form){
form.serializeOn(_1b7);
}
}).send();
}
resetHiddenFieldsFor(_1ae);
}
function resetHiddenFieldsFor(_1b8){
$enumerate(_1b8.elements).each(function(_1b9){
if(_1b9.type=="hidden"&&_1b9.name!="icefacesID"&&_1b9.name!="viewNumber"){
_1b9.value="";
}
});
}
[Ice.Document=new Object,Ice.ElementModel.Element,Ice.Connection].as(function(This,_1bb,_1bc){
This.Synchronizer=Object.subclass({initialize:function(ajax,_1be){
this.ajax=ajax;
this.logger=_1be.child("synchronizer");
if(window.frames[0].location.hash.length>0){
this.reload();
}
},synchronize:function(){
window.frames[0].location.hash="#reload";
this.logger.debug("mark document as modified");
this.synchronize=Function.NOOP;
},reload:function(){
try{
this.logger.info("synchronize body");
this.ajax.getAsynchronously(document.URL,"",function(_1bf){
_1bf.setRequestHeader("Connection","close");
_1bf.on(_1bc.Ok,function(){
var text=_1bf.content();
var _1c1="<BODY";
var end="</BODY>";
_1bb.adaptToElement(document.body).replaceHtml(text.substring(text.indexOf(_1c1),text.lastIndexOf(end)+end.length));
});
});
}
catch(e){
this.logger.error("failed to reload body",e);
}
}});
});
[Ice.Document].as(function(This){
This.Update=function(_1c4){
try{
var _1c5=_1c4.getAttribute("address");
var html=_1c4.firstChild.data.replace(/<\!\#cdata\#/g,"<![CDATA[").replace(/\#\#>/g,"]]>");
_1c5.asExtendedElement().replaceHtml(html);
logger.debug("applied update : "+html);
}
catch(e){
logger.error("failed to insert element: "+html,e);
}
};
});
function viewNumber(){
return $enumerate(document.forms).select(function(form){
return form["viewNumber"];
}).collect(function(form){
return form["viewNumber"].value;
}).asSet().inject("",function(_1c9,_1ca){
return _1ca+","+_1c9;
});
}
function icefacesID(){
return $enumerate(document.forms).select(function(form){
return form["icefacesID"];
}).collect(function(form){
return form["icefacesID"].value;
}).asSet().inject("",function(_1cd,ids){
return ids+","+_1cd;
});
}
function defaultParameters(){
return Ice.Parameter.Query.create(function(_1cf){
_1cf.add("focus",currentFocus);
_1cf.add("icefacesID",icefacesID());
_1cf.add("viewNumber",viewNumber());
});
}
var currentFocus;
Ice.Focus=new Object();
Ice.Focus.userInterupt=false;
Ice.Focus.userInterupt=function(e){
window.logger.debug("Interup pressed");
if(Ice.Focus.userInterupt==false){
window.logger.debug("User action. Set focus will be ignored.");
Ice.Focus.userInterupt=true;
}
};
Ice.Focus.setFocus=function(id){
if((Ice.Focus.userInterupt==false)&&(id!="")&&(id!="undefined")){
try{
id.asExtendedElement().focus();
setFocus(id);
window.logger.debug("Focus Set on ["+id+"]");
}
catch(e){
window.logger.error("Failed to set focus on ["+id+"]",e);
}
}else{
window.logger.debug("Focus interupted. Not Set on ["+id+"]");
}
};
document.onKeyDown=function(_1d2){
var _1d3=document.onkeydown;
document.onkeydown=_1d3!=null?function(e){
_1d2(Ice.EventModel.Event.adaptToKeyEvent(e));
_1d3(e);
}:function(e){
_1d2(Ice.EventModel.Event.adaptToKeyEvent(e));
};
};
document.onMouseDown=function(_1d6){
var _1d7=document.onmousedown;
document.onmousedown=_1d7!=null?function(e){
_1d6(e);
_1d7(e);
}:function(e){
_1d6(e);
};
};
document.onKeyDown(Ice.Focus.userInterupt);
document.onMouseDown(Ice.Focus.userInterupt);
function setFocus(id){
currentFocus=id;
}
window.onScroll(function(){
currentFocus=null;
window.focus();
});
[Ice.Status=new Object].as(function(This){
This.ElementIndicator=Object.subclass({initialize:function(_1dc,_1dd){
this.elementID=_1dc;
this.indicators=_1dd;
this.indicators.push(this);
this.off();
},on:function(){
this.indicators.each(function(_1de){
if(_1de!=this){
_1de.off();
}
}.bind(this));
this.elementID.asElement().style.visibility="visible";
},off:function(){
this.elementID.asElement().style.visibility="hidden";
}});
This.ToggleIndicator=Object.subclass({initialize:function(_1df,_1e0){
this.onElement=_1df;
this.offElement=_1e0;
this.off();
},on:function(){
this.onElement.on();
this.offElement.off();
},off:function(){
this.onElement.off();
this.offElement.on();
}});
This.PointerIndicator=Object.subclass({initialize:function(_1e1){
this.element=_1e1;
this.previousCursor=this.element.style.cursor;
},on:/Safari/.test(navigator.userAgent)?Function.NOOP:function(){
this.element.style.cursor="wait";
},off:/Safari/.test(navigator.userAgent)?Function.NOOP:function(){
this.element.style.cursor=this.previousCursor;
}});
This.OverlayIndicator=Object.subclass({initialize:function(_1e2,_1e3,_1e4){
this.message=_1e2;
this.description=_1e3;
this.panel=_1e4;
},on:function(){
this.panel.on();
messageContainer=document.createElement("div");
messageContainer.style.position="absolute";
messageContainer.style.textAlign="center";
messageContainer.style.zIndex="10001";
messageContainer.style.color="black";
messageContainer.style.backgroundColor="white";
messageContainer.style.paddingLeft="0";
messageContainer.style.paddingRight="0";
messageContainer.style.paddingTop="15px";
messageContainer.style.paddingBottom="15px";
messageContainer.style.borderBottomColor="gray";
messageContainer.style.borderRightColor="gray";
messageContainer.style.borderTopColor="silver";
messageContainer.style.borderLeftColor="silver";
messageContainer.style.borderWidth="2px";
messageContainer.style.borderStyle="solid";
messageContainer.style.width="270px";
document.body.appendChild(messageContainer);
var _1e5=document.createElement("div");
_1e5.appendChild(document.createTextNode(this.message));
_1e5.style.marginLeft="30px";
_1e5.style.textAlign="left";
_1e5.style.fontSize="14px";
_1e5.style.fontSize="14px";
_1e5.style.fontWeight="bold";
messageContainer.appendChild(_1e5);
var _1e6=document.createElement("div");
_1e6.appendChild(document.createTextNode(this.description));
_1e6.style.fontSize="11px";
_1e6.style.marginTop="7px";
_1e6.style.marginBottom="7px";
_1e6.style.fontWeight="normal";
_1e5.appendChild(_1e6);
var _1e7=document.createElement("input");
_1e7.type="button";
_1e7.value="Reload";
_1e7.style.fontSize="11px";
_1e7.style.fontWeight="normal";
_1e7.onclick=function(){
window.location.reload();
};
messageContainer.appendChild(_1e7);
var _1e8=function(){
messageContainer.style.left=((window.width()-messageContainer.clientWidth)/2)+"px";
messageContainer.style.top=((window.height()-messageContainer.clientHeight)/2)+"px";
}.bind(this);
_1e8();
window.onResize(_1e8);
messageContainer=null;
_1e5=null;
_1e6=null;
_1e7=null;
}});
This.StatusManager=Object.subclass({initialize:function(){
if("connection-status".asElement()){
this.indicators=[];
var _1e9=new This.ElementIndicator("connection-working",this.indicators);
var _1ea=new This.ElementIndicator("connection-idle",this.indicators);
this.busy=new This.ToggleIndicator(_1e9,_1ea);
this.connectionLost=new This.ElementIndicator("connection-lost",this.indicators);
this.sessionExpired=this.connectionLost;
}else{
this.busy=new This.PointerIndicator(document.body);
var _1eb="To reconnect click the Reload button on the browser or click the button below";
this.sessionExpired=new This.OverlayIndicator("User Session Expired",_1eb,this);
this.connectionLost=new This.OverlayIndicator("Network Connection Interrupted",_1eb,this);
}
},on:function(){
document.body.style.zIndex="0";
window.frames[0].document.body.style.backgroundColor="white";
var _1ec=document.getElementById("history-frame");
_1ec.style.position="absolute";
_1ec.style.visibility="visible";
_1ec.style.backgroundColor="white";
_1ec.style.zIndex="10000";
_1ec.style.top="0";
_1ec.style.left="0";
var _1ed=function(){
_1ec.style.width=window.width()+"px";
_1ec.style.height=window.height()+"px";
};
_1ed();
window.onResize(_1ed);
}});
});
[Ice.Connection=new Object,Ice.Connection].as(function(This,_1ef){
This.Redirect=function(_1f0){
return _1f0.isOkAndComplete()&&_1f0.containsResponseHeader("X-REDIRECT");
};
This.SessionExpired=function(_1f1){
return _1f1.isOkAndComplete()&&_1f1.containsResponseHeader("X-SESSION-EXPIRED");
};
This.BadResponse=function(_1f2){
return _1f2.isComplete()&&!_1f2.isResponseValid();
};
This.Receive=function(_1f3){
return _1f3.isOkAndComplete()&&!(This.Redirect(_1f3)||This.SessionExpired(_1f3));
};
This.Ok=function(_1f4){
return _1f4.isOkAndComplete();
};
This.Unavailable=function(_1f5){
return _1f5.isUnavailableAndComplete();
};
This.SyncConnection=Object.subclass({initialize:function(ajax,_1f7,_1f8,_1f9){
this.ajax=ajax;
this.logger=_1f7.child("sync-connection");
this.defaultQuery=_1f9;
this.onSendListeners=[];
this.onReceiveListeners=[];
this.onRedirectListeners=[];
this.connectionDownListeners=[];
this.sessionExpiredListeners=[];
this.timeoutBomb={cancel:Function.NOOP};
this.logger.info("synchronous mode");
this.sendURI=_1f8.context+"/block/receive-send-updates";
var _1fa=_1f8.timeout?_1f8.timeout:5000;
this.onSend(function(){
this.timeoutBomb.cancel();
this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(_1fa);
}.bind(this));
this.onReceive(function(){
this.timeoutBomb.cancel();
}.bind(this));
this.whenDown(function(){
this.timeoutBomb.cancel();
}.bind(this));
},send:function(_1fb){
var _1fc=_1fb.addQuery(this.defaultQuery());
this.logger.debug("send > "+_1fb.asString());
this.ajax.postAsynchronously(this.sendURI,_1fc.asURIEncodedString(),function(_1fd){
_1fd.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
_1fd.on(_1ef.Receive,function(){
try{
this.onReceiveListeners.broadcast(_1fd);
}
catch(e){
this.logger.error("receive broadcast failed",e);
}
}.bind(this));
_1fd.on(_1ef.Redirect,function(){
this.onRedirectListeners.broadcast(_1fd.getResponseHeader("X-REDIRECT"));
}.bind(this));
_1fd.on(_1ef.BadResponse,this.connectionDownListeners.broadcaster());
_1fd.on(_1ef.SessionExpired,this.sessionExpiredListeners.broadcaster());
this.onSendListeners.broadcast(_1fd);
}.bind(this));
},onSend:function(_1fe){
this.onSendListeners.push(_1fe);
},onReceive:function(_1ff){
this.onReceiveListeners.push(_1ff);
},onRedirect:function(_200){
this.onRedirectListeners.push(_200);
},whenDown:function(_201){
this.connectionDownListeners.push(_201);
},whenExpired:function(_202){
this.sessionExpiredListeners.push(_202);
},shutdown:function(){
this.onSendListeners.clear();
this.onReceiveListeners.clear();
this.onRedirectListeners.clear();
this.connectionDownListeners.clear();
this.sessionExpiredListeners.clear();
}});
});
Ice.Community=new Object;
[Ice.Community.Connection=new Object,Ice.Connection].as(function(This,_204){
This.AsyncConnection=Object.subclass({initialize:function(ajax,_206,_207,_208){
this.ajax=ajax;
this.logger=_206.child("async-connection");
this.defaultQuery=_208;
this.onSendListeners=[];
this.onReceiveListeners=[];
this.onRedirectListeners=[];
this.connectionDownListeners=[];
this.sessionExpiredListeners=[];
this.listener={close:Function.NOOP};
this.timeoutBomb={cancel:Function.NOOP};
this.sendURI=_207.context+"/block/send-updates";
this.receiveURI=_207.context+"/block/receive-updates";
var _209=_207.timeout?_207.timeout:5000;
this.onSend(function(){
this.timeoutBomb.cancel();
this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(_209);
}.bind(this));
this.onReceive(function(){
this.timeoutBomb.cancel();
}.bind(this));
this.connect();
this.logger.info("asynchronous mode");
},connect:function(){
this.logger.debug("closing previous connection...");
this.listener.close();
this.logger.debug("connect...");
this.connectionDownBroadcaster=this.connectionDownListeners.broadcaster();
this.listener=this.ajax.getAsynchronously(this.receiveURI,this.defaultQuery().asURIEncodedString(),function(_20a){
_20a.on(_204.BadResponse,function(){
this.connectionDownBroadcaster();
}.bind(this));
_20a.on(_204.Redirect,function(){
this.connectionDownBroadcaster=Function.NOOP;
this.onRedirectListeners.broadcast(_20a.getResponseHeader("X-REDIRECT"));
}.bind(this));
_20a.on(_204.SessionExpired,this.sessionExpiredListeners.broadcaster());
_20a.on(_204.Receive,function(){
try{
this.onReceiveListeners.broadcast(_20a);
}
catch(e){
this.logger.error("receive broadcast failed",e);
}
finally{
this.connect();
}
}.bind(this));
}.bind(this));
},send:function(_20b){
var _20c=_20b.addQuery(this.defaultQuery());
this.logger.debug("send > "+_20c.asString());
this.ajax.postAsynchronously(this.sendURI,_20c.asURIEncodedString(),function(_20d){
_20d.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
_20d.on(_204.SessionExpired,this.sessionExpiredListeners.broadcaster());
_20d.on(_204.Redirect,function(){
this.connectionDownBroadcaster=Function.NOOP;
this.onRedirectListeners.broadcast(_20d.getResponseHeader("X-REDIRECT"));
}.bind(this));
Ice.Focus.userInterupt=false;
this.onSendListeners.broadcast(_20d);
}.bind(this));
},onSend:function(_20e){
this.onSendListeners.push(_20e);
Ice.Focus.userInterupt=false;
},onReceive:function(_20f){
this.onReceiveListeners.push(_20f);
},onRedirect:function(_210){
this.onRedirectListeners.push(_210);
},whenDown:function(_211){
this.connectionDownListeners.push(_211);
},whenExpired:function(_212){
this.sessionExpiredListeners.push(_212);
},shutdown:function(){
this.listener.close();
this.onSendListeners.clear();
this.onReceiveListeners.clear();
this.onRedirectListeners.clear();
this.connectionDownListeners.clear();
this.sessionExpiredListeners.clear();
}});
});
window.connection={send:function(){
}};
[Ice.Community].as(function(This){
This.Application=Object.subclass({initialize:function(){
var _214=window.logger=this.logger=new Ice.Log.Logger(["window"]);
this.logHandler=new Ice.Log.WindowLogHandler(_214,window);
var ajax=new Ice.Ajax.Client(_214);
var _216=new Ice.Document.Synchronizer(ajax,_214);
var _217=new Ice.Status.StatusManager();
window.connection=this.connection=configuration.synchronous?new Ice.Connection.SyncConnection(ajax,_214,configuration.connection,defaultParameters):new This.Connection.AsyncConnection(ajax,_214,configuration.connection,defaultParameters);
window.onKeyPress(function(e){
if(e.isEscKey()){
e.cancelDefaultAction();
}
});
connection.onReceive(function(_219){
$enumerate(_219.contentAsDOM().documentElement.getElementsByTagName("update")).each(Ice.Document.Update);
});
this.connection.onReceive(function(){
_216.synchronize();
});
this.connection.onRedirect(function(url){
document.cookie="redirectViewNumber="+viewNumber();
if(url=="."){
window.location.reload();
_214.info("Reloading...");
}else{
window.location.href=url;
_214.info("Redirecting to "+url);
}
});
this.connection.whenDown(function(){
_214.warn("connection to server was lost");
_217.connectionLost.on();
this.dispose();
}.bind(this));
this.connection.whenExpired(function(){
_214.warn("session has expired");
_217.sessionExpired.on();
this.dispose();
}.bind(this));
this.connection.onSend(function(_21b){
_217.busy.on();
}.delayFor(100));
this.connection.onReceive(function(_21c){
_217.busy.off();
}.delayFor(100));
this.logger.info("page loaded!");
},dispose:function(){
this.connection.shutdown();
this.logger.info("page unloaded!");
this.logHandler.disable();
this.dispose=Function.NOOP;
}});
window.onLoad(function(){
this.application=new This.Application;
});
window.onUnload(function(){
this.application.dispose();
});
});

