var Prototype={Version:"1.6.0",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){
},K:function(x){
return x;
}};
if(Prototype.Browser.MobileSafari){
Prototype.BrowserFeatures.SpecificElementExtensions=false;
}
if(Prototype.Browser.WebKit){
Prototype.BrowserFeatures.XPath=false;
}
var Class={create:function(){
var _2=null,_3=$A(arguments);
if(Object.isFunction(_3[0])){
_2=_3.shift();
}
function klass(){
this.initialize.apply(this,arguments);
}
Object.extend(klass,Class.Methods);
klass.superclass=_2;
klass.subclasses=[];
if(_2){
var _4=function(){
};
_4.prototype=_2.prototype;
klass.prototype=new _4;
_2.subclasses.push(klass);
}
for(var i=0;i<_3.length;i++){
klass.addMethods(_3[i]);
}
if(!klass.prototype.initialize){
klass.prototype.initialize=Prototype.emptyFunction;
}
klass.prototype.constructor=klass;
return klass;
}};
Class.Methods={addMethods:function(_6){
var _7=this.superclass&&this.superclass.prototype;
var _8=Object.keys(_6);
if(!Object.keys({toString:true}).length){
_8.push("toString","valueOf");
}
for(var i=0,_a=_8.length;i<_a;i++){
var _b=_8[i],_c=_6[_b];
if(_7&&Object.isFunction(_c)&&_c.argumentNames().first()=="$super"){
var _d=_c,_c=Object.extend((function(m){
return function(){
return _7[m].apply(this,arguments);
};
})(_b).wrap(_d),{valueOf:function(){
return _d;
},toString:function(){
return _d.toString();
}});
}
this.prototype[_b]=_c;
}
return this;
}};
var Abstract={};
Object.extend=function(_f,_10){
for(var _11 in _10){
_f[_11]=_10[_11];
}
return _f;
};
Object.extend(Object,{inspect:function(_12){
try{
if(_12===undefined){
return "undefined";
}
if(_12===null){
return "null";
}
return _12.inspect?_12.inspect():_12.toString();
}
catch(e){
if(e instanceof RangeError){
return "...";
}
throw e;
}
},toJSON:function(_13){
var _14=typeof _13;
switch(_14){
case "undefined":
case "function":
case "unknown":
return;
case "boolean":
return _13.toString();
}
if(_13===null){
return "null";
}
if(_13.toJSON){
return _13.toJSON();
}
if(Object.isElement(_13)){
return;
}
var _15=[];
for(var _16 in _13){
var _17=Object.toJSON(_13[_16]);
if(_17!==undefined){
_15.push(_16.toJSON()+": "+_17);
}
}
return "{"+_15.join(", ")+"}";
},toQueryString:function(_18){
return $H(_18).toQueryString();
},toHTML:function(_19){
return _19&&_19.toHTML?_19.toHTML():String.interpret(_19);
},keys:function(_1a){
var _1b=[];
for(var _1c in _1a){
_1b.push(_1c);
}
return _1b;
},values:function(_1d){
var _1e=[];
for(var _1f in _1d){
_1e.push(_1d[_1f]);
}
return _1e;
},clone:function(_20){
return Object.extend({},_20);
},isElement:function(_21){
return _21&&_21.nodeType==1;
},isArray:function(_22){
return _22&&_22.constructor===Array;
},isHash:function(_23){
return _23 instanceof Hash;
},isFunction:function(_24){
return typeof _24=="function";
},isString:function(_25){
return typeof _25=="string";
},isNumber:function(_26){
return typeof _26=="number";
},isUndefined:function(_27){
return typeof _27=="undefined";
}});
Object.extend(Function.prototype,{argumentNames:function(){
var _28=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
return _28.length==1&&!_28[0]?[]:_28;
},bind:function(){
if(arguments.length<2&&arguments[0]===undefined){
return this;
}
var _29=this,_2a=$A(arguments),_2b=_2a.shift();
return function(){
return _29.apply(_2b,_2a.concat($A(arguments)));
};
},bindAsEventListener:function(){
var _2c=this,_2d=$A(arguments),_2e=_2d.shift();
return function(_2f){
return _2c.apply(_2e,[_2f||window.event].concat(_2d));
};
},curry:function(){
if(!arguments.length){
return this;
}
var _30=this,_31=$A(arguments);
return function(){
return _30.apply(this,_31.concat($A(arguments)));
};
},delay:function(){
var _32=this,_33=$A(arguments),_34=_33.shift()*1000;
return window.setTimeout(function(){
return _32.apply(_32,_33);
},_34);
},wrap:function(_35){
var _36=this;
return function(){
return _35.apply(this,[_36.bind(this)].concat($A(arguments)));
};
},methodize:function(){
if(this._methodized){
return this._methodized;
}
var _37=this;
return this._methodized=function(){
return _37.apply(null,[this].concat($A(arguments)));
};
}});
Function.prototype.defer=Function.prototype.delay.curry(0.01);
Date.prototype.toJSON=function(){
return "\""+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z\"";
};
var Try={these:function(){
var _38;
for(var i=0,_3a=arguments.length;i<_3a;i++){
var _3b=arguments[i];
try{
_38=_3b();
break;
}
catch(e){
}
}
return _38;
}};
RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(str){
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1");
};
var PeriodicalExecuter=Class.create({initialize:function(_3d,_3e){
this.callback=_3d;
this.frequency=_3e;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},execute:function(){
this.callback(this);
},stop:function(){
if(!this.timer){
return;
}
clearInterval(this.timer);
this.timer=null;
},onTimerEvent:function(){
if(!this.currentlyExecuting){
try{
this.currentlyExecuting=true;
this.execute();
}
finally{
this.currentlyExecuting=false;
}
}
}});
Object.extend(String,{interpret:function(_3f){
return _3f==null?"":String(_3f);
},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(_40,_41){
var _42="",_43=this,_44;
_41=arguments.callee.prepareReplacement(_41);
while(_43.length>0){
if(_44=_43.match(_40)){
_42+=_43.slice(0,_44.index);
_42+=String.interpret(_41(_44));
_43=_43.slice(_44.index+_44[0].length);
}else{
_42+=_43,_43="";
}
}
return _42;
},sub:function(_45,_46,_47){
_46=this.gsub.prepareReplacement(_46);
_47=_47===undefined?1:_47;
return this.gsub(_45,function(_48){
if(--_47<0){
return _48[0];
}
return _46(_48);
});
},scan:function(_49,_4a){
this.gsub(_49,_4a);
return String(this);
},truncate:function(_4b,_4c){
_4b=_4b||30;
_4c=_4c===undefined?"...":_4c;
return this.length>_4b?this.slice(0,_4b-_4c.length)+_4c:String(this);
},strip:function(){
return this.replace(/^\s+/,"").replace(/\s+$/,"");
},stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
},stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
},extractScripts:function(){
var _4d=new RegExp(Prototype.ScriptFragment,"img");
var _4e=new RegExp(Prototype.ScriptFragment,"im");
return (this.match(_4d)||[]).map(function(_4f){
return (_4f.match(_4e)||["",""])[1];
});
},evalScripts:function(){
return this.extractScripts().map(function(_50){
return eval(_50);
});
},escapeHTML:function(){
var _51=arguments.callee;
_51.text.data=this;
return _51.div.innerHTML;
},unescapeHTML:function(){
var div=new Element("div");
div.innerHTML=this.stripTags();
return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(_53,_54){
return _53+_54.nodeValue;
}):div.childNodes[0].nodeValue):"";
},toQueryParams:function(_55){
var _56=this.strip().match(/([^?#]*)(#.*)?$/);
if(!_56){
return {};
}
return _56[1].split(_55||"&").inject({},function(_57,_58){
if((_58=_58.split("="))[0]){
var key=decodeURIComponent(_58.shift());
var _5a=_58.length>1?_58.join("="):_58[0];
if(_5a!=undefined){
_5a=decodeURIComponent(_5a);
}
if(key in _57){
if(!Object.isArray(_57[key])){
_57[key]=[_57[key]];
}
_57[key].push(_5a);
}else{
_57[key]=_5a;
}
}
return _57;
});
},toArray:function(){
return this.split("");
},succ:function(){
return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);
},times:function(_5b){
return _5b<1?"":new Array(_5b+1).join(this);
},camelize:function(){
var _5c=this.split("-"),len=_5c.length;
if(len==1){
return _5c[0];
}
var _5e=this.charAt(0)=="-"?_5c[0].charAt(0).toUpperCase()+_5c[0].substring(1):_5c[0];
for(var i=1;i<len;i++){
_5e+=_5c[i].charAt(0).toUpperCase()+_5c[i].substring(1);
}
return _5e;
},capitalize:function(){
return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();
},underscore:function(){
return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();
},dasherize:function(){
return this.gsub(/_/,"-");
},inspect:function(_60){
var _61=this.gsub(/[\x00-\x1f\\]/,function(_62){
var _63=String.specialChar[_62[0]];
return _63?_63:"\\u00"+_62[0].charCodeAt().toPaddedString(2,16);
});
if(_60){
return "\""+_61.replace(/"/g,"\\\"")+"\"";
}
return "'"+_61.replace(/'/g,"\\'")+"'";
},toJSON:function(){
return this.inspect(true);
},unfilterJSON:function(_64){
return this.sub(_64||Prototype.JSONFilter,"#{1}");
},isJSON:function(){
var str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
},evalJSON:function(_66){
var _67=this.unfilterJSON();
try{
if(!_66||_67.isJSON()){
return eval("("+_67+")");
}
}
catch(e){
}
throw new SyntaxError("Badly formed JSON string: "+this.inspect());
},include:function(_68){
return this.indexOf(_68)>-1;
},startsWith:function(_69){
return this.indexOf(_69)===0;
},endsWith:function(_6a){
var d=this.length-_6a.length;
return d>=0&&this.lastIndexOf(_6a)===d;
},empty:function(){
return this=="";
},blank:function(){
return /^\s*$/.test(this);
},interpolate:function(_6c,_6d){
return new Template(this,_6d).evaluate(_6c);
}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE){
Object.extend(String.prototype,{escapeHTML:function(){
return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
},unescapeHTML:function(){
return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");
}});
}
String.prototype.gsub.prepareReplacement=function(_6e){
if(Object.isFunction(_6e)){
return _6e;
}
var _6f=new Template(_6e);
return function(_70){
return _6f.evaluate(_70);
};
};
String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});
with(String.prototype.escapeHTML){
div.appendChild(text);
}
var Template=Class.create({initialize:function(_71,_72){
this.template=_71.toString();
this.pattern=_72||Template.Pattern;
},evaluate:function(_73){
if(Object.isFunction(_73.toTemplateReplacements)){
_73=_73.toTemplateReplacements();
}
return this.template.gsub(this.pattern,function(_74){
if(_73==null){
return "";
}
var _75=_74[1]||"";
if(_75=="\\"){
return _74[2];
}
var ctx=_73,_77=_74[3];
var _78=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/,_74=_78.exec(_77);
if(_74==null){
return _75;
}
while(_74!=null){
var _79=_74[1].startsWith("[")?_74[2].gsub("\\\\]","]"):_74[1];
ctx=ctx[_79];
if(null==ctx||""==_74[3]){
break;
}
_77=_77.substring("["==_74[3]?_74[1].length:_74[0].length);
_74=_78.exec(_77);
}
return _75+String.interpret(ctx);
}.bind(this));
}});
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={};
var Enumerable={each:function(_7a,_7b){
var _7c=0;
_7a=_7a.bind(_7b);
try{
this._each(function(_7d){
_7a(_7d,_7c++);
});
}
catch(e){
if(e!=$break){
throw e;
}
}
return this;
},eachSlice:function(_7e,_7f,_80){
_7f=_7f?_7f.bind(_80):Prototype.K;
var _81=-_7e,_82=[],_83=this.toArray();
while((_81+=_7e)<_83.length){
_82.push(_83.slice(_81,_81+_7e));
}
return _82.collect(_7f,_80);
},all:function(_84,_85){
_84=_84?_84.bind(_85):Prototype.K;
var _86=true;
this.each(function(_87,_88){
_86=_86&&!!_84(_87,_88);
if(!_86){
throw $break;
}
});
return _86;
},any:function(_89,_8a){
_89=_89?_89.bind(_8a):Prototype.K;
var _8b=false;
this.each(function(_8c,_8d){
if(_8b=!!_89(_8c,_8d)){
throw $break;
}
});
return _8b;
},collect:function(_8e,_8f){
_8e=_8e?_8e.bind(_8f):Prototype.K;
var _90=[];
this.each(function(_91,_92){
_90.push(_8e(_91,_92));
});
return _90;
},detect:function(_93,_94){
_93=_93.bind(_94);
var _95;
this.each(function(_96,_97){
if(_93(_96,_97)){
_95=_96;
throw $break;
}
});
return _95;
},findAll:function(_98,_99){
_98=_98.bind(_99);
var _9a=[];
this.each(function(_9b,_9c){
if(_98(_9b,_9c)){
_9a.push(_9b);
}
});
return _9a;
},grep:function(_9d,_9e,_9f){
_9e=_9e?_9e.bind(_9f):Prototype.K;
var _a0=[];
if(Object.isString(_9d)){
_9d=new RegExp(_9d);
}
this.each(function(_a1,_a2){
if(_9d.match(_a1)){
_a0.push(_9e(_a1,_a2));
}
});
return _a0;
},include:function(_a3){
if(Object.isFunction(this.indexOf)){
if(this.indexOf(_a3)!=-1){
return true;
}
}
var _a4=false;
this.each(function(_a5){
if(_a5==_a3){
_a4=true;
throw $break;
}
});
return _a4;
},inGroupsOf:function(_a6,_a7){
_a7=_a7===undefined?null:_a7;
return this.eachSlice(_a6,function(_a8){
while(_a8.length<_a6){
_a8.push(_a7);
}
return _a8;
});
},inject:function(_a9,_aa,_ab){
_aa=_aa.bind(_ab);
this.each(function(_ac,_ad){
_a9=_aa(_a9,_ac,_ad);
});
return _a9;
},invoke:function(_ae){
var _af=$A(arguments).slice(1);
return this.map(function(_b0){
return _b0[_ae].apply(_b0,_af);
});
},max:function(_b1,_b2){
_b1=_b1?_b1.bind(_b2):Prototype.K;
var _b3;
this.each(function(_b4,_b5){
_b4=_b1(_b4,_b5);
if(_b3==undefined||_b4>=_b3){
_b3=_b4;
}
});
return _b3;
},min:function(_b6,_b7){
_b6=_b6?_b6.bind(_b7):Prototype.K;
var _b8;
this.each(function(_b9,_ba){
_b9=_b6(_b9,_ba);
if(_b8==undefined||_b9<_b8){
_b8=_b9;
}
});
return _b8;
},partition:function(_bb,_bc){
_bb=_bb?_bb.bind(_bc):Prototype.K;
var _bd=[],_be=[];
this.each(function(_bf,_c0){
(_bb(_bf,_c0)?_bd:_be).push(_bf);
});
return [_bd,_be];
},pluck:function(_c1){
var _c2=[];
this.each(function(_c3){
_c2.push(_c3[_c1]);
});
return _c2;
},reject:function(_c4,_c5){
_c4=_c4.bind(_c5);
var _c6=[];
this.each(function(_c7,_c8){
if(!_c4(_c7,_c8)){
_c6.push(_c7);
}
});
return _c6;
},sortBy:function(_c9,_ca){
_c9=_c9.bind(_ca);
return this.map(function(_cb,_cc){
return {value:_cb,criteria:_c9(_cb,_cc)};
}).sort(function(_cd,_ce){
var a=_cd.criteria,b=_ce.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.map();
},zip:function(){
var _d1=Prototype.K,_d2=$A(arguments);
if(Object.isFunction(_d2.last())){
_d1=_d2.pop();
}
var _d3=[this].concat(_d2).map($A);
return this.map(function(_d4,_d5){
return _d1(_d3.pluck(_d5));
});
},size:function(){
return this.toArray().length;
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});
function $A(_d6){
if(!_d6){
return [];
}
if(_d6.toArray){
return _d6.toArray();
}
var _d7=_d6.length,_d8=new Array(_d7);
while(_d7--){
_d8[_d7]=_d6[_d7];
}
return _d8;
}
if(Prototype.Browser.WebKit){
function $A(_d9){
if(!_d9){
return [];
}
if(!(Object.isFunction(_d9)&&_d9=="[object NodeList]")&&_d9.toArray){
return _d9.toArray();
}
var _da=_d9.length,_db=new Array(_da);
while(_da--){
_db[_da]=_d9[_da];
}
return _db;
}
}
Array.from=$A;
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){
Array.prototype._reverse=Array.prototype.reverse;
}
Object.extend(Array.prototype,{_each:function(_dc){
for(var i=0,_de=this.length;i<_de;i++){
_dc(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(_df){
return _df!=null;
});
},flatten:function(){
return this.inject([],function(_e0,_e1){
return _e0.concat(Object.isArray(_e1)?_e1.flatten():[_e1]);
});
},without:function(){
var _e2=$A(arguments);
return this.select(function(_e3){
return !_e2.include(_e3);
});
},reverse:function(_e4){
return (_e4!==false?this:this.toArray())._reverse();
},reduce:function(){
return this.length>1?this:this[0];
},uniq:function(_e5){
return this.inject([],function(_e6,_e7,_e8){
if(0==_e8||(_e5?_e6.last()!=_e7:!_e6.include(_e7))){
_e6.push(_e7);
}
return _e6;
});
},intersect:function(_e9){
return this.uniq().findAll(function(_ea){
return _e9.detect(function(_eb){
return _ea===_eb;
});
});
},clone:function(){
return [].concat(this);
},size:function(){
return this.length;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
},toJSON:function(){
var _ec=[];
this.each(function(_ed){
var _ee=Object.toJSON(_ed);
if(_ee!==undefined){
_ec.push(_ee);
}
});
return "["+_ec.join(", ")+"]";
}});
if(Object.isFunction(Array.prototype.forEach)){
Array.prototype._each=Array.prototype.forEach;
}
if(!Array.prototype.indexOf){
Array.prototype.indexOf=function(_ef,i){
i||(i=0);
var _f1=this.length;
if(i<0){
i=_f1+i;
}
for(;i<_f1;i++){
if(this[i]===_ef){
return i;
}
}
return -1;
};
}
if(!Array.prototype.lastIndexOf){
Array.prototype.lastIndexOf=function(_f2,i){
i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;
var n=this.slice(0,i).reverse().indexOf(_f2);
return (n<0)?n:i-n-1;
};
}
Array.prototype.toArray=Array.prototype.clone;
function $w(_f5){
if(!Object.isString(_f5)){
return [];
}
_f5=_f5.strip();
return _f5?_f5.split(/\s+/):[];
}
if(Prototype.Browser.Opera){
Array.prototype.concat=function(){
var _f6=[];
for(var i=0,_f8=this.length;i<_f8;i++){
_f6.push(this[i]);
}
for(var i=0,_f8=arguments.length;i<_f8;i++){
if(Object.isArray(arguments[i])){
for(var j=0,_fa=arguments[i].length;j<_fa;j++){
_f6.push(arguments[i][j]);
}
}else{
_f6.push(arguments[i]);
}
}
return _f6;
};
}
Object.extend(Number.prototype,{toColorPart:function(){
return this.toPaddedString(2,16);
},succ:function(){
return this+1;
},times:function(_fb){
$R(0,this,true).each(_fb);
return this;
},toPaddedString:function(_fc,_fd){
var _fe=this.toString(_fd||10);
return "0".times(_fc-_fe.length)+_fe;
},toJSON:function(){
return isFinite(this)?this.toString():"null";
}});
$w("abs round ceil floor").each(function(_ff){
Number.prototype[_ff]=Math[_ff].methodize();
});
function $H(_100){
return new Hash(_100);
}
var Hash=Class.create(Enumerable,(function(){
if(function(){
var i=0,Test=function(_103){
this.key=_103;
};
Test.prototype.key="foo";
for(var _104 in new Test("bar")){
i++;
}
return i>1;
}()){
function each(_105){
var _106=[];
for(var key in this._object){
var _108=this._object[key];
if(_106.include(key)){
continue;
}
_106.push(key);
var pair=[key,_108];
pair.key=key;
pair.value=_108;
_105(pair);
}
}
}else{
function each(_10a){
for(var key in this._object){
var _10c=this._object[key],pair=[key,_10c];
pair.key=key;
pair.value=_10c;
_10a(pair);
}
}
}
function toQueryPair(key,_10f){
if(Object.isUndefined(_10f)){
return key;
}
return key+"="+encodeURIComponent(String.interpret(_10f));
}
return {initialize:function(_110){
this._object=Object.isHash(_110)?_110.toObject():Object.clone(_110);
},_each:each,set:function(key,_112){
return this._object[key]=_112;
},get:function(key){
return this._object[key];
},unset:function(key){
var _115=this._object[key];
delete this._object[key];
return _115;
},toObject:function(){
return Object.clone(this._object);
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},index:function(_116){
var _117=this.detect(function(pair){
return pair.value===_116;
});
return _117&&_117.key;
},merge:function(_119){
return this.clone().update(_119);
},update:function(_11a){
return new Hash(_11a).inject(this,function(_11b,pair){
_11b.set(pair.key,pair.value);
return _11b;
});
},toQueryString:function(){
return this.map(function(pair){
var key=encodeURIComponent(pair.key),_11f=pair.value;
if(_11f&&typeof _11f=="object"){
if(Object.isArray(_11f)){
return _11f.map(toQueryPair.curry(key)).join("&");
}
}
return toQueryPair(key,_11f);
}).join("&");
},inspect:function(){
return "#<Hash:{"+this.map(function(pair){
return pair.map(Object.inspect).join(": ");
}).join(", ")+"}>";
},toJSON:function(){
return Object.toJSON(this.toObject());
},clone:function(){
return new Hash(this);
}};
})());
Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;
Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(_121,end,_123){
this.start=_121;
this.end=end;
this.exclusive=_123;
},_each:function(_124){
var _125=this.start;
while(this.include(_125)){
_124(_125);
_125=_125.succ();
}
},include:function(_126){
if(_126<this.start){
return false;
}
if(this.exclusive){
return _126<this.end;
}
return _126<=this.end;
}});
var $R=function(_127,end,_129){
return new ObjectRange(_127,end,_129);
};
var Ice=new Object;
Object.methods=function(_12a){
for(property in _12a){
this.prototype[property]=_12a[property];
}
};
Object.subclass=function(_12b){
var _12c=function(){
this.initialize.apply(this,arguments);
};
_12c.methods=this.methods;
_12c.subclass=this.subclass;
_12c.prototype.initialize=Function.NOOP;
_12c.methods(this.prototype);
_12c.prototype.initializeSuperclass=this.prototype.initialize?this.prototype.initialize:Function.NOOP;
_12c.methods(_12b||{});
return _12c;
};
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.toLocaleTimeString().substr(0,8);
};
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 _12f=this.asElement();
if(!_12f){
throw "cannot find element with id: '"+this+"'";
}
return Ice.ElementModel.Element.adaptToElement(_12f);
},asRegexp:function(){
return new RegExp(this);
},contains:function(_130){
return this.indexOf(_130)>=0;
},containsWords:function(){
return /(\w+)/.test(this);
}});
Object.extend(Array.prototype,{eachWithGuard:function(_131){
this.each(function(_132){
try{
_131(_132);
}
catch(e){
}
});
},intersect:function(_133){
return this.select(function(item){
return _133.include(item);
});
},complement:function(_135){
return this.reject(function(item){
return _135.include(item);
});
},isEmpty:function(){
return this.length==0;
},isNotEmpty:function(){
return this.length>0;
},as:function(_137){
_137.apply(_137,this);
},copy:function(){
return this.collect(function(_138){
return _138;
});
},copyFrom:function(_139,_13a){
var copy=[];
var end=_139+_13a;
for(var i=_139;i<end;i++){
copy.push(this[i]);
}
return copy;
},broadcast:function(_13e){
this.each(function(_13f){
_13f(_13e);
});
},broadcaster:function(){
return function(_140){
this.broadcast(_140);
}.bind(this);
},asSet:function(){
var set=[];
this.each(function(_142){
if(!set.include(_142)){
set.push(_142);
}
});
return set;
}});
Function.prototype.delayFor=function(_143){
var _144=this;
return function(){
var _145=this;
var _146=arguments;
var call=function(){
try{
_144.apply(_145,_146);
}
finally{
clearInterval(_146.id);
_146.id=null;
}
};
var id=_146.id=setInterval(call,_143);
arguments.callee.cancel=function(){
clearInterval(id);
_146.id=null;
};
};
};
Function.prototype.delayExecutionFor=function(_149){
var call=this.delayFor(_149);
call.apply();
return call;
};
Function.prototype.repeatEvery=function(_14b){
var _14c=this;
return function(){
var _14d=this;
var _14e=arguments;
var call=function(){
_14c.apply(_14d,_14e);
};
var id=setInterval(call,_14b);
arguments.callee.cancel=function(){
clearInterval(id);
};
};
};
Function.prototype.repeatExecutionEvery=function(_151){
var call=this.repeatEvery(_151);
call.apply(this);
return call;
};
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","onBeforeUnload","onResize","onScroll"].each(function(name){
if(!window[name]){
window[name]=function(_154){
var _155=name.toLowerCase();
var _156=window[_155];
var _157=_156?[_156,_154]:[_154];
window[_155]=_157.broadcaster();
window[name]=function(_158){
if(!_157.detect(function(_159){
return _159.toString()==_158.toString();
})){
_157.push(_158);
}
};
};
}
});
if(typeof OpenAjax!="undefined"){
if(typeof OpenAjax.addOnLoad!="undefined"){
var current=window.onLoad;
window.onLoad=OpenAjax.addOnLoad;
OpenAjax.addOnLoad(current);
}
if(typeof OpenAjax.addOnUnLoad!="undefined"){
var current=window.onUnload;
window.onUnload=OpenAjax.addOnUnLoad;
OpenAjax.addOnLoad(current);
}
}
window.onKeyPress=function(_15a){
var _15b=document.onkeypress;
document.onkeypress=_15b?function(e){
_15a(Ice.EventModel.Event.adaptToEvent(e));
_15b(e);
}:function(e){
_15a(Ice.EventModel.Event.adaptToKeyEvent(e));
};
};
[Ice].as(function(This){
This.Enumerator=Object.subclass({initialize:function(_15f){
this.indexedObject=_15f;
},_each:function(_160){
var _161=this.indexedObject.length;
for(var i=0;i<_161;i++){
_160(this.indexedObject[i],i);
}
},reverse:function(){
return new This.ReverseEnumerator(this.indexedObject);
}});
This.Enumerator.methods(Enumerable);
This.ReverseEnumerator=This.Enumerator.subclass({_each:function(_163){
var _164=this.indexedObject.length-1;
for(var i=_164;i>=0;i--){
_163(this.indexedObject[i],i);
}
},reverse:function(){
return new This.Enumerator(this.indexedObject);
}});
window.$enumerate=function(_166){
return new This.Enumerator(_166);
};
});
[Ice.Log=new Object].as(function(This){
This.Priority=Object.subclass({debug:function(_168,_169,_16a,_16b){
_168.debug(_169,_16a,_16b);
},info:function(_16c,_16d,_16e,_16f){
_16c.info(_16d,_16e,_16f);
},warn:function(_170,_171,_172,_173){
_170.warn(_171,_172,_173);
},error:function(_174,_175,_176,_177){
_174.error(_175,_176,_177);
}});
This.Debug=This.Priority.subclass({asString:function(){
return "Debug";
}});
This.Info=This.Debug.subclass({debug:Function.NOOP,asString:function(){
return "Info";
}});
This.Warn=This.Info.subclass({info:Function.NOOP,asString:function(){
return "Warn";
}});
This.Error=This.Warn.subclass({warn:Function.NOOP,asString:function(){
return "Error";
}});
This.Priority.DEBUG=new This.Debug;
This.Priority.INFO=new This.Info;
This.Priority.WARN=new This.Warn;
This.Priority.ERROR=new This.Error;
This.Priority.Levels=[This.Priority.DEBUG,This.Priority.INFO,This.Priority.WARN,This.Priority.ERROR];
This.Logger=Object.subclass({initialize:function(_178,_179,_17a){
this.handler=_179||{debug:Function.NOOP,info:Function.NOOP,warn:Function.NOOP,error:Function.NOOP};
this.category=_178;
this.children=[];
this.priority=_17a||This.Priority.ERROR;
},debug:function(_17b,_17c){
this.priority.debug(this.handler,this.category,_17b,_17c);
},info:function(_17d,_17e){
this.priority.info(this.handler,this.category,_17d,_17e);
},warn:function(_17f,_180){
this.priority.warn(this.handler,this.category,_17f,_180);
},error:function(_181,_182){
this.priority.error(this.handler,this.category,_181,_182);
},child:function(_183){
var _184=this.category.copy();
_184.push(_183);
var _185=new This.Logger(_184,this.handler,this.priority);
this.children.push(_185);
return _185;
},threshold:function(_186){
this.priority=_186;
this.children.each(function(_187){
_187.threshold(_186);
});
},handleWith:function(_188){
this.handler=_188;
}});
This.WindowLogHandler=Object.subclass({initialize:function(_189,_18a,_18b,_18c){
this.lineOptions=[25,50,100,200,400];
this.logger=_189;
this.logger.handleWith(this);
this.parentWindow=_18a;
this.lines=_18b||this.lineOptions[3];
this.thresholdPriority=_18c||This.Priority.DEBUG;
this.categoryMatcher=/.*/;
this.closeOnExit=true;
this.toggle();
this.parentWindow.onKeyPress(function(e){
var key=e.keyCode();
if((key==20||key==84)&&e.isCtrlPressed()&&e.isShiftPressed()){
this.enable();
}
}.bind(this));
this.parentWindow.onUnload(function(){
window.logger.info("page unloaded!");
this.disable();
}.bind(this));
},enable:function(){
try{
this.window=this.parentWindow.open("","log"+window.identifier,"scrollbars=1,width=800,height=680");
var _18f=this.window.document;
this.log=this.window.document.getElementById("log-window");
this.toggle();
if(this.log){
return;
}
_18f.body.appendChild(_18f.createTextNode(" Close on exit "));
var _190=_18f.createElement("input");
_190.style.margin="2px";
_190.setAttribute("type","checkbox");
_190.defaultChecked=true;
_190.checked=true;
_190.onclick=function(){
this.closeOnExit=_190.checked;
}.bind(this);
_18f.body.appendChild(_190);
_18f.body.appendChild(_18f.createTextNode(" Lines "));
var _191=_18f.createElement("select");
_191.style.margin="2px";
this.lineOptions.each(function(_192,_193){
var _194=_191.appendChild(_18f.createElement("option"));
if(this.lines==_192){
_191.selectedIndex=_193;
}
_194.appendChild(_18f.createTextNode(_192.toString()));
}.bind(this));
_191.onchange=function(_195){
this.lines=this.lineOptions[_191.selectedIndex];
this.clearPreviousEvents();
}.bind(this);
_18f.body.appendChild(_191);
_18f.body.appendChild(_18f.createTextNode(" Category "));
var _196=_18f.createElement("input");
_196.style.margin="2px";
_196.setAttribute("type","text");
_196.setAttribute("value",this.categoryMatcher.source);
_196.onchange=function(){
this.categoryMatcher=_196.value.asRegexp();
}.bind(this);
_18f.body.appendChild(_196);
_18f.body.appendChild(_18f.createTextNode(" Level "));
var _197=_18f.createElement("select");
_197.style.margin="2px";
This.Priority.Levels.each(function(_198,_199){
var _19a=_197.appendChild(_18f.createElement("option"));
if(this.thresholdPriority==_198){
_197.selectedIndex=_199;
}
_19a.appendChild(_18f.createTextNode(_198.asString()));
}.bind(this));
this.logger.threshold(this.thresholdPriority);
_197.onchange=function(_19b){
this.thresholdPriority=This.Priority.Levels[_197.selectedIndex];
this.logger.threshold(this.thresholdPriority);
}.bind(this);
_18f.body.appendChild(_197);
var _19c=_18f.createElement("input");
_19c.style.margin="2px";
_19c.setAttribute("type","button");
_19c.setAttribute("value","Stop");
_19c.onclick=function(){
_19c.setAttribute("value",this.toggle()?"Stop":"Start");
}.bind(this);
_18f.body.appendChild(_19c);
var _19d=_18f.createElement("input");
_19d.style.margin="2px";
_19d.setAttribute("type","button");
_19d.setAttribute("value","Clear");
_19d.onclick=function(){
this.clearAllEvents();
}.bind(this);
_18f.body.appendChild(_19d);
this.log=_18f.body.appendChild(_18f.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);
}
catch(e){
this.disable();
}
},disable:function(){
this.logger.threshold(This.Priority.ERROR);
this.handle=Function.NOOP;
if(this.closeOnExit&&this.window){
this.window.close();
}
},toggle:function(){
if(this.handle==Function.NOOP){
delete this.handle;
return true;
}else{
this.handle=Function.NOOP;
return false;
}
},debug:function(_19e,_19f,_1a0){
this.handle("#333","debug",_19e,_19f,_1a0);
},info:function(_1a1,_1a2,_1a3){
this.handle("green","info",_1a1,_1a2,_1a3);
},warn:function(_1a4,_1a5,_1a6){
this.handle("orange","warn",_1a4,_1a5,_1a6);
},error:function(_1a7,_1a8,_1a9){
this.handle("red","error",_1a7,_1a8,_1a9);
},handle:function(_1aa,_1ab,_1ac,_1ad,_1ae){
if(this.categoryMatcher.test(_1ac.join("."))){
var _1af=this.log.ownerDocument;
var _1b0=(new Date()).toTimestamp();
var _1b1=_1ac.join(".");
("["+_1b1+"] : "+_1ad+(_1ae?("\n"+_1ae):"")).split("\n").each(function(line){
if(line.containsWords()){
var _1b3=_1af.createElement("div");
_1b3.style.padding="3px";
_1b3.style.color=_1aa;
_1b3.setAttribute("title",_1b0+" | "+_1ab);
this.log.appendChild(_1b3).appendChild(_1af.createTextNode(line));
}
}.bind(this));
this.log.scrollTop=this.log.scrollHeight;
}
this.clearPreviousEvents();
},clearPreviousEvents:function(){
var _1b4=$A(this.log.childNodes);
_1b4.copyFrom(0,_1b4.length-this.lines).each(function(node){
this.log.removeChild(node);
}.bind(this));
},clearAllEvents:function(){
$A(this.log.childNodes).each(function(node){
this.log.removeChild(node);
}.bind(this));
}});
This.NOOPConsole={debug:Function.NOOP,info:Function.NOOP,warn:Function.NOOP,error:Function.NOOP};
This.FirebugLogHandler=Object.subclass({initialize:function(_1b7){
_1b7.handleWith(this);
this.logger=_1b7;
this.console=This.NOOPConsole;
this.enable();
},enable:function(){
this.console=window.console;
this.logger.threshold(This.Priority.DEBUG);
},disable:function(){
this.console=This.NOOPConsole;
this.logger.threshold(This.Priority.ERROR);
},toggle:Function.NOOP,debug:function(_1b8,_1b9,_1ba){
_1ba?this.console.debug(this.format(_1b8,_1b9),_1ba):this.console.debug(this.format(_1b8,_1b9));
},info:function(_1bb,_1bc,_1bd){
_1bd?this.console.info(this.format(_1bb,_1bc),_1bd):this.console.info(this.format(_1bb,_1bc));
},warn:function(_1be,_1bf,_1c0){
_1c0?this.console.warn(this.format(_1be,_1bf),_1c0):this.console.warn(this.format(_1be,_1bf));
},error:function(_1c1,_1c2,_1c3){
_1c3?this.console.error(this.format(_1c1,_1c2),_1c3):this.console.error(this.format(_1c1,_1c2));
},format:function(_1c4,_1c5){
return "["+_1c4.join(".")+"] "+_1c5;
}});
});
[Ice.Ajax=new Object].as(function(This){
This.Client=Object.subclass({initialize:function(_1c7){
this.logger=_1c7;
this.cookies=new Object;
document.cookie.split("; ").each(function(_1c8){
var _1c9=_1c8.split("=");
this.cookies[_1c9.first()]=_1c9.last();
}.bind(this));
try{
if(window.createRequest){
this.createRequest=function(){
var _1ca=new This.RequestProxy(window.createRequest(),this.logger);
_1ca.post=function(_1cb,path,_1cd,_1ce){
this.get(_1cb,path,_1cd,_1ce);
};
return _1ca;
}.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,_1d0,_1d1){
return this.createRequest().getAsynchronously(path,_1d0,_1d1);
},getSynchronously:function(path,_1d3,_1d4){
return this.createRequest().getSynchronously(path,_1d3,_1d4);
},postAsynchronously:function(path,_1d6,_1d7){
return this.createRequest().postAsynchronously(path,_1d6,_1d7);
},postSynchronously:function(path,_1d9,_1da){
return this.createRequest().postSynchronously(path,_1d9,_1da);
}});
This.RequestProxy=Object.subclass({initialize:function(_1db,_1dc){
this.identifier=+Math.random().toString().substr(2,7);
this.request=_1db;
this.logger=_1dc;
this.callbacks=[];
this.responseCallback=function(){
if(this.isComplete()){
this.logger.debug("["+this.identifier+"] : receive ["+this.statusCode()+"] "+this.statusText());
}
this.callbacks.each(function(_1dd){
try{
_1dd(this);
}
catch(e){
this.logger.error("failed to respond",e);
}
}.bind(this));
}.bind(this);
},statusCode:function(){
try{
return this.request.status;
}
catch(e){
return 0;
}
},statusText:function(){
try{
return this.request.statusText;
}
catch(e){
return "";
}
},on:function(test,_1df){
this.callbacks.push(function(_1e0){
if(test(_1e0)){
_1df(_1e0);
}
});
},isComplete:function(){
try{
return this.request.readyState==4;
}
catch(e){
return false;
}
},isResponseValid:function(){
try{
return this.request.status>=0;
}
catch(e){
return false;
}
},isOk:function(){
try{
return this.request.status==200;
}
catch(e){
return false;
}
},isServerError:function(){
try{
return this.request.status==500;
}
catch(e){
return false;
}
},isOkAndComplete:function(){
return this.isComplete()&&this.isOk();
},getAsynchronously:function(path,_1e2,_1e3){
this.request.open("GET",path+"?"+_1e2+"&rand="+Math.random(),true);
if(_1e3){
_1e3(this);
}
this.request.onreadystatechange=this.responseCallback;
this.logger.debug("["+this.identifier+"] : send asynchronous GET");
this.request.send("");
return this;
},postAsynchronously:function(path,_1e5,_1e6){
this.request.open("POST",path,true);
if(_1e6){
_1e6(this);
}
this.request.onreadystatechange=this.responseCallback;
this.logger.debug("["+this.identifier+"] : send asynchronous POST");
this.request.send(_1e5+"&rand="+Math.random()+"\n\n");
return this;
},getSynchronously:function(path,_1e8,_1e9){
this.request.open("GET",path+"?"+_1e8+"&rand="+Math.random(),false);
if(_1e9){
_1e9(this);
}
this.logger.debug("["+this.identifier+"] : send synchronous GET");
this.request.send("");
this.responseCallback();
return this;
},postSynchronously:function(path,_1eb,_1ec){
this.request.open("POST",path,false);
if(_1ec){
_1ec(this);
}
this.logger.debug("["+this.identifier+"] : send synchronous POST");
this.request.send(_1eb+"&rand="+Math.random()+"\n\n");
this.responseCallback();
return this;
},setRequestHeader:function(name,_1ee){
this.request.setRequestHeader(name,_1ee);
},getResponseHeader:function(name){
try{
return this.request.getResponseHeader(name);
}
catch(e){
return null;
}
},containsResponseHeader:function(name){
try{
var _1f1=this.request.getResponseHeader(name);
return _1f1&&_1f1!="";
}
catch(e){
return false;
}
},content:function(){
try{
return this.request.responseText;
}
catch(e){
return "";
}
},contentAsDOM:function(){
return this.request.responseXML;
},close:function(){
try{
this.request.onreadystatechange=Function.NOOP;
this.request.abort();
}
catch(e){
}
finally{
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,_1f4){
this.parameters.push(new This.Association(name,_1f4));
},addQuery:function(_1f5){
_1f5.serializeOn(this);
return this;
},asURIEncodedString:function(){
return this.parameters.inject("",function(_1f6,_1f7,_1f8){
return _1f6+=(_1f8==0)?_1f7.asURIEncodedString():"&"+_1f7.asURIEncodedString();
});
},asString:function(){
return this.parameters.inject("",function(_1f9,_1fa,_1fb){
return _1f9+"\n| "+_1fa.asString()+" |";
});
},sendOn:function(_1fc){
_1fc.send(this);
},serializeOn:function(_1fd){
this.parameters.each(function(_1fe){
_1fe.serializeOn(_1fd);
});
}});
This.Query.create=function(_1ff){
var _200=new This.Query;
_1ff.apply(this,[_200]);
return _200;
};
This.Association=Object.subclass({initialize:function(name,_202){
this.name=name;
this.value=_202;
},asURIEncodedString:function(){
return encodeURIComponent(this.name)+"="+encodeURIComponent(this.value);
},asString:function(){
return this.name+"="+this.value;
},serializeOn:function(_203){
_203.add(this.name,this.value);
}});
});
[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(_207){
_207.add("ice.event.x",this.x);
_207.add("ice.event.y",this.y);
}});
});
[Ice.ElementModel=new Object].as(function(This){
This.TemporaryContainer=function(){
var _209=document.body.appendChild(document.createElement("div"));
_209.style.visibility="hidden";
This.TemporaryContainer=function(){
return _209;
};
return _209;
};
This.Element=Object.subclass({MouseListenerNames:["onClick","onDblClick","onMouseDown","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],KeyListenerNames:["onKeyDown","onKeyPress","onKeyUp","onHelp"],initialize:function(_20a){
this.element=_20a;
},id:function(){
return this.element.id;
},isSubmit:function(){
return false;
},replaceHtml:function(html){
this.withTemporaryContainer(function(_20c){
_20c.innerHTML=html;
var _20d=_20c.firstChild;
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_20d);
});
},disconnectAllListenersAndPeers:function(){
var _20e=this.element.getElementsByTagName("*");
var _20f=_20e.length;
for(var i=0;i<_20f;i++){
var _211=_20e[i];
var peer=_211.peer;
if(peer){
peer.eachListenerName(function(_213){
_211[_213.toLowerCase()]=null;
});
_211.peer=null;
peer.element=null;
}
}
},serializeOn:function(_214){
},sendOn:function(_215){
Query.create(function(_216){
this.serializeOn(_216);
}.bind(this)).sendOn(_215);
},send:function(){
this.sendOn(connection);
},withTemporaryContainer:function(_217){
try{
_217.apply(this,[This.TemporaryContainer()]);
}
finally{
This.TemporaryContainer().innerHTML="";
}
},defaultReplaceHostElementWith:function(_218){
this.displayOff();
this.element.parentNode.replaceChild(_218,this.element);
this.element=_218;
this.element.peer=this;
},replaceHostElementWith:function(_219){
this.defaultReplaceHostElementWith(_219);
},displayOff:/Safari/.test(navigator.userAgent)?Function.NOOP:function(){
this.element.style.display="none";
},eachListenerName:function(_21a){
this.MouseListenerNames.each(_21a);
this.KeyListenerNames.each(_21a);
},findConnection:function(){
return this.findContainerFor("bridge").bridge.connection;
},findContainerFor:function(_21b){
var _21c=this.element;
while(_21c){
if(_21c[_21b]){
return _21c;
}else{
_21c=_21c.parentNode;
}
}
throw "couldn't find container for property: "+_21b;
}});
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 "head":
e.peer=new This.HeadElement(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 "iframe":
e.peer=new This.IFrameElement(e);
break;
case "html":
e.peer=new This.HtmlElement(e);
break;
default:
e.peer=new This.Element(e);
break;
}
return e.peer;
};
This.InputElement=This.Element.subclass({InputListenerNames:["onBlur","onFocus","onChange"],initialize:function(_21e){
this.element=_21e;
var type=_21e.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 _220=this.element.onfocus;
this.element.onfocus=Function.NOOP;
this.element.focus();
this.element.onfocus=_220;
},replaceHostElementWith:function(_221){
this.eachAttributeName(function(_222){
var _223=_221[_222];
var _224=this.element[_222];
if(_224!=_223){
this.element[_222]=_223;
}
}.bind(this));
var _225=_221.getAttribute("style");
var _226=this.element.getAttribute("style");
if(_225!=_226){
this.element.setAttribute("style",_225);
}
this.eachListenerName(function(_227){
var name=_227.toLowerCase();
this.element[name]=_221[name]?_221[name].bind(this.element):null;
_221[name]=null;
}.bind(this));
},eachAttributeName:function(_229){
["className","title","lang"].each(_229);
["name","value","checked","disabled","readOnly","size","maxLength","src","alt","useMap","isMap","tabIndex","accessKey","accept"].each(_229);
},serializeOn:function(_22a){
switch(this.element.type.toLowerCase()){
case "image":
case "textarea":
case "submit":
case "hidden":
case "password":
case "text":
_22a.add(this.element.name,this.element.value);
break;
case "checkbox":
case "radio":
if(this.element.checked){
_22a.add(this.element.name,this.element.value||"on");
}
break;
}
},eachListenerName:function(_22b){
this.MouseListenerNames.each(_22b);
this.KeyListenerNames.each(_22b);
this.InputListenerNames.each(_22b);
}});
This.SelectElement=This.InputElement.subclass({isSubmit:function(){
return false;
},replaceHostElementWith:function(_22c){
this.defaultReplaceHostElementWith(_22c);
},serializeOn:function(_22d){
$enumerate(this.element.options).select(function(_22e){
return _22e.selected;
}).each(function(_22f){
var _230=_22f.value||(_22f.value==""?"":_22f.text);
_22d.add(this.element.name,_230);
}.bind(this));
}});
This.ButtonElement=This.InputElement.subclass({initialize:function(_231){
this.element=_231;
this.isSubmitElement=_231.type.toLowerCase()=="submit";
},isSubmit:function(){
return this.isSubmitElement;
},replaceHostElementWith:function(_232){
this.defaultReplaceHostElementWith(_232);
},serializeOn:function(_233){
_233.add(this.element.name,this.element.value);
}});
This.FormElement=This.Element.subclass({FormListenerNames:["onReset","onSubmit","submit"],detectDefaultSubmit:function(){
var _234=this.element.elements;
var _235=_234.length;
var _236=this.element.id+":default";
for(var i=0;i<_235;i++){
var _238=_234[i];
if(_238.id==_236){
return This.Element.adaptToElement(_238);
}
}
return null;
},eachFormElement:/Safari/.test(navigator.userAgent)?function(_239){
var _23a=[];
$enumerate(this.element.elements).reverse().each(function(_23b){
if(!_23a.detect(function(_23c){
return _23b.id&&_23c.id&&_23c.id==_23b.id;
})){
_23a.push(_23b);
_239(This.Element.adaptToElement(_23b));
}
});
}:function(_23d){
$enumerate(this.element.elements).each(function(e){
_23d(This.Element.adaptToElement(e));
});
},captureOnSubmit:function(){
var _23f=this.element.onsubmit;
this.element.onsubmit=function(_240){
if(_23f){
_23f();
}
$event(_240).cancelDefaultAction();
iceSubmit(this.element,null,_240);
};
},redirectSubmit:function(){
var _241=this.element.submit;
this.element.submit=function(){
if(_241){
_241();
}
iceSubmit(this.element,null,null);
};
},captureAndRedirectSubmit:function(){
this.captureOnSubmit();
this.redirectSubmit();
},serializeOn:function(_242){
this.eachFormElement(function(_243){
if(!_243.isSubmit()){
_243.serializeOn(_242);
}
});
},eachListenerName:function(_244){
this.MouseListenerNames.each(_244);
this.KeyListenerNames.each(_244);
this.FormListenerNames.each(_244);
}});
This.HtmlElement=This.Element.subclass({replaceHtml:function(html){
var _246=function(tag){
var _248=new RegExp("<"+tag+"[^<]*>","g").exec(html);
var end=new RegExp("</"+tag+">","g").exec(html);
return html.substring(_248.index,end.index+end[0].length);
};
var _24a=document.body;
new This.BodyElement(_24a).replaceHtml(_246("body"));
var _24b=document.getElementsByTagName("title")[0];
new This.TitleElement(_24b).replaceHtml(_246("title"));
var _24c=document.getElementsByTagName("head")[0];
if(_24c&&!/MSIE/.test(navigator.userAgent)){
new This.HeadElement(_24c).replaceHtml(_246("head"));
}
}});
This.HeadElement=This.Element.subclass({replaceHtml:function(html){
$enumerate(this.element.childNodes).each(function(e){
this.element.removeChild(e);
}.bind(this));
this.withTemporaryContainer(function(_24f){
_24f.innerHTML=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
$enumerate(_24f.childNodes).each(function(e){
this.element.appendChild(e);
}.bind(this));
});
}});
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 _253=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
if(_253!=""&&_253!=";"){
var _254=function(){
eval(_253);
};
_254.apply(window);
}
}});
This.TitleElement=This.Element.subclass({replaceHtml:function(html){
this.element.ownerDocument.title=html.substring(html.indexOf(">")+1,html.lastIndexOf("<"));
}});
This.AnchorElement=This.Element.subclass({isSubmit:function(){
return true;
},focus:function(){
var _256=this.element.onfocus;
this.element.onfocus=Function.NOOP;
this.element.focus();
this.element.onfocus=_256;
},serializeOn:function(_257){
if(this.element.name){
_257.add(this.element.name,this.element.name);
}
},form:function(){
var _258=this.element.parentNode;
while(_258){
if(_258.tagName&&_258.tagName.toLowerCase()=="form"){
return This.Element.adaptToElement(_258);
}
_258=_258.parentNode;
}
throw "Cannot find enclosing form.";
}});
This.TableCellElement=This.Element.subclass({replaceHtml:function(html){
this.withTemporaryContainer(function(_25a){
_25a.innerHTML="<TABLE>"+html+"</TABLE>";
var _25b=_25a.firstChild;
while((null!=_25b)&&(this.element.id!=_25b.id)){
_25b=_25b.firstChild;
}
this.disconnectAllListenersAndPeers();
this.replaceHostElementWith(_25b);
});
}});
This.IFrameElement=This.Element.subclass({replaceHostElementWith:function(_25c){
this.eachAttributeName(function(_25d){
var _25e=_25c.getAttribute(_25d);
if(_25e==null){
this.element.removeAttribute(_25d);
}else{
this.element.setAttribute(_25d,_25e);
}
}.bind(this));
var _25f=this.element.contentWindow.location.href;
var _260=_25c.contentWindow.location.href;
if(_25f!=_260){
this.element.contentWindow.location=_260;
}
this.eachListenerName(function(_261){
var name=_261.toLowerCase();
this.element[name]=_25c[name]?_25c[name].bind(this.element):null;
_25c[name]=null;
}.bind(this));
},eachAttributeName:function(_263){
["title","lang","dir","class","style","align","frameborder","width","height","hspace","ismap","longdesc","marginwidth","marginheight","name","scrolling"].each(_263);
}});
window.$element=This.Element.adaptToElement;
});
[Ice.EventModel=new Object,Ice.ElementModel.Element,Ice.Parameter.Query,Ice.Geometry].as(function(This,_265,_266,_267){
This.IE=new Object;
This.Netscape=new Object;
This.Event=Object.subclass({initialize:function(_268,_269){
this.event=_268;
this.currentElement=_269;
},cancel:function(){
this.cancelBubbling();
this.cancelDefaultAction();
},isKeyEvent:function(){
return false;
},isMouseEvent:function(){
return false;
},captured:function(){
return this.currentElement?_265.adaptToElement(this.currentElement):null;
},serializeEventOn:function(_26a){
_26a.add("ice.event.target",this.target()&&this.target().id());
_26a.add("ice.event.captured",this.captured()&&this.captured().id());
_26a.add("ice.event.type","on"+this.event.type);
},serializeOn:function(_26b){
this.serializeEventOn(_26b);
},sendOn:function(_26c){
_266.create(function(_26d){
_26d.add("ice.submit.partial",false);
try{
this.captured().serializeOn(_26d);
this.serializeOn(_26d);
}
catch(e){
this.serializeOn(_26d);
}
}.bind(this)).sendOn(_26c);
},sendFullOn:function(_26e){
_266.create(function(_26f){
_26f.add("ice.submit.partial",false);
try{
this.captured().serializeOn(_26f);
this.form().serializeOn(_26f);
this.serializeOn(_26f);
}
catch(e){
this.serializeOn(_26f);
}
}.bind(this)).sendOn(_26e);
},sendWithCondition:function(_270){
if(_270(this)){
this.send();
}
},send:function(){
this.cancel();
this.sendOn(this.captured().findConnection());
},sendFull:function(){
this.cancel();
this.sendFullOn(this.captured().findConnection());
}});
This.IE.Event=This.Event.subclass({target:function(){
return this.event.srcElement?_265.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?_265.adaptToElement(this.event.target):null;
},cancelBubbling:function(){
this.event.stopPropagation();
},cancelDefaultAction:function(){
this.event.preventDefault();
}});
var _271={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(_272){
_272.add("ice.event.alt",this.isAltPressed());
_272.add("ice.event.ctrl",this.isCtrlPressed());
_272.add("ice.event.shift",this.isShiftPressed());
_272.add("ice.event.meta",this.isMetaPressed());
}};
var _273={isMouseEvent:function(){
return true;
},serializeOn:function(_274){
this.serializeEventOn(_274);
this.serializeKeyAndMouseEventOn(_274);
this.pointer().serializeOn(_274);
_274.add("ice.event.left",this.isLeftButton());
_274.add("ice.event.right",this.isRightButton());
}};
This.IE.MouseEvent=This.IE.Event.subclass({pointer:function(){
return new _267.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(_271);
This.IE.MouseEvent.methods(_273);
This.Netscape.MouseEvent=This.Netscape.Event.subclass({pointer:function(){
return new _267.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(_271);
This.Netscape.MouseEvent.methods(_273);
var _275={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(_276){
this.serializeEventOn(_276);
this.serializeKeyAndMouseEventOn(_276);
_276.add("ice.event.keycode",this.keyCode());
}};
This.IE.KeyEvent=This.IE.Event.subclass({keyCode:function(){
return this.event.keyCode;
}});
This.IE.KeyEvent.methods(_271);
This.IE.KeyEvent.methods(_275);
This.Netscape.KeyEvent=This.Netscape.Event.subclass({keyCode:function(){
return this.event.which==0?this.event.keyCode:this.event.which;
}});
This.Netscape.KeyEvent.methods(_271);
This.Netscape.KeyEvent.methods(_275);
This.UnknownEvent=This.Event.subclass({initialize:function(_277){
this.currentElement=_277;
},target:function(){
return this.currentElement==null?null:_265.adaptToElement(this.currentElement);
},serializeEventOn:function(_278){
_278.add("ice.event.target",this.target()&&this.target().id());
_278.add("ice.event.captured",this.captured()&&this.captured().id());
_278.add("ice.event.type","unknown");
},cancelBubbling:Function.NOOP,cancelDefaultAction:Function.NOOP});
This.Event.adaptToPlainEvent=function(e,_27a){
return window.event?new This.IE.Event(event,_27a):new This.Netscape.Event(e,_27a);
};
This.Event.adaptToMouseEvent=function(e,_27c){
return window.event?new This.IE.MouseEvent(event,_27c):new This.Netscape.MouseEvent(e,_27c);
};
This.Event.adaptToKeyEvent=function(e,_27e){
return window.event?new This.IE.KeyEvent(event,_27e):new This.Netscape.KeyEvent(e,_27e);
};
This.Event.adaptToEvent=function(e,_280){
var _281=window.event||e;
if(_281){
var _282="on"+_281.type;
var _283=function(name){
return name.toLowerCase()==_282;
};
if(_265.prototype.KeyListenerNames.detect(_283)){
return This.Event.adaptToKeyEvent(e,_280);
}else{
if(_265.prototype.MouseListenerNames.detect(_283)){
return This.Event.adaptToMouseEvent(e,_280);
}else{
return This.Event.adaptToPlainEvent(e,_280);
}
}
}else{
return new This.UnknownEvent(_280);
}
};
window.$event=This.Event.adaptToEvent;
});
[Ice].as(function(This){
This.Cookie=This.Parameter.Association.subclass({initialize:function(name,_287){
this.name=name;
this.value=_287||"";
this.save();
},saveValue:function(_288){
this.value=_288;
this.save();
},loadValue:function(){
this.load();
return this.value;
},save:function(){
document.cookie=this.name+"="+this.value;
return this;
},load:function(){
var _289=This.Cookie.parse().detect(function(_28a){
return this.name==_28a[0];
}.bind(this));
this.value=_289[1];
return this;
},remove:function(){
document.cookie=this.name+"=0; expires="+(new Date).toGMTString();
}});
This.Cookie.all=function(){
return This.Cookie.parse().collect(function(_28b){
var name=_28b[0];
var _28d=_28b[1];
return new This.Cookie(name,_28d);
});
};
This.Cookie.lookup=function(name){
var _28f=This.Cookie.parse().detect(function(_290){
return name==_290[0];
});
if(_28f){
return new This.Cookie(_28f[0],_28f[1]);
}else{
throw "Cannot find cookie named: "+name;
}
};
This.Cookie.parse=function(){
return document.cookie.split("; ").collect(function(_291){
return _291.contains("=")?_291.split("="):[_291,""];
});
};
});
function currentConnection(){
var e=$enumerate(arguments).detect(function(i){
return !!i;
});
return e.findConnection();
}
function iceSubmitPartial(form,_295,evt){
form=(form?form:_295.form);
var _297=new Ice.Parameter.Query();
if(Ice.Menu.menuContext!=null){
_297.add("ice.menuContext",Ice.Menu.menuContext);
}
_297.add("ice.submit.partial",true);
$event(evt,_295).serializeOn(_297);
if(form&&form.id){
$element(form).serializeOn(_297);
}
if(_295&&_295.id){
var c=$element(_295);
if(c.isSubmit()){
c.serializeOn(_297);
}
}
_297.sendOn(currentConnection($element(form),$element(_295)));
resetHiddenFieldsFor(form);
}
function iceSubmit(_299,_29a,_29b){
_299=(_299?_299:_29a.form);
var _29c=$event(_29b,_29a);
var form=$element(_299);
var _29e=new Ice.Parameter.Query();
if(Ice.Menu.menuContext!=null){
_29e.add("ice.menuContext",Ice.Menu.menuContext);
}
_29e.add("ice.submit.partial",false);
if(_29c.isKeyEvent()){
if(_29c.isEnterKey()){
var _29f=form?form.detectDefaultSubmit():null;
_29c.cancelDefaultAction();
_29c.serializeOn(_29e);
if(_29f){
_29f.serializeOn(_29e);
}
if(form){
form.serializeOn(_29e);
}
_29e.sendOn(currentConnection($element(_299),$element(_29a)));
}
}else{
var _2a0=_29a&&_29a.id?$element(_29a):null;
_29c.serializeOn(_29e);
if(_2a0&&_2a0.isSubmit()){
_2a0.serializeOn(_29e);
}
if(form){
form.serializeOn(_29e);
}
_29e.sendOn(currentConnection($element(_299),$element(_29a)));
}
resetHiddenFieldsFor(_299);
}
function resetHiddenFieldsFor(_2a1){
$enumerate(_2a1.elements).each(function(_2a2){
if(_2a2.type=="hidden"&&_2a2.id==""){
_2a2.value="";
}
});
}
[Ice.Document=new Object,Ice.ElementModel.Element,Ice.Connection,Ice.Ajax].as(function(This,_2a4,_2a5,Ajax){
This.Synchronizer=Object.subclass({initialize:function(_2a7){
this.logger=_2a7.child("synchronizer");
this.ajax=new Ajax.Client(this.logger);
if(window.frames[0].location.hash.length>0){
this.reload();
}
},synchronize:function(){
try{
window.frames[0].location.hash="#reload";
this.logger.debug("mark document as modified");
this.synchronize=Function.NOOP;
}
catch(e){
this.logger.warn("could not mark document as modified",e);
}
},reload:function(){
try{
this.logger.info("synchronize body");
this.ajax.getAsynchronously(document.URL,"",function(_2a8){
_2a8.setRequestHeader("Connection","close");
_2a8.on(_2a5.Ok,function(){
var text=_2a8.content();
var _2aa="<BODY";
var end="</BODY>";
_2a4.adaptToElement(document.body).replaceHtml(text.substring(text.indexOf(_2aa),text.lastIndexOf(end)+end.length));
});
});
}
catch(e){
this.logger.error("failed to reload body",e);
}
}});
});
[Ice.Command=new Object].as(function(This){
This.Dispatcher=Object.subclass({initialize:function(){
this.commands=new Object;
},register:function(_2ad,_2ae){
this.commands[_2ad]=_2ae;
},deserializeAndExecute:function(_2af){
var _2b0=_2af.tagName;
for(name in this.commands){
if(name==_2b0){
this.commands[_2b0](_2af);
return;
}
}
throw "Unknown message received: "+_2b0;
}});
This.SetCookie=function(_2b1){
document.cookie=_2b1.firstChild.data;
};
This.ParsingError=function(_2b2){
logger.error("Parsing error");
var _2b3=_2b2.firstChild;
logger.error(_2b3.data);
var _2b4=_2b3.firstChild;
logger.error(_2b4.data);
};
});
[Ice.Script=new Object,Ice.Ajax.Client].as(function(This,_2b6){
This.Loader=Object.subclass({initialize:function(_2b7){
this.logger=_2b7.child("script-loader");
this.referencedScripts=[];
this.client=new _2b6(this.logger);
$enumerate(document.documentElement.getElementsByTagName("script")).each(function(_2b8){
if(_2b8.src){
this.referencedScripts.push(_2b8.src);
}
}.bind(this));
},searchAndEvaluateScripts:function(_2b9){
$enumerate(_2b9.getElementsByTagName("script")).each(function(s){
this.evaluateScript(s);
}.bind(this));
},evaluateScript:function(_2bb){
var uri=_2bb.src;
if(uri){
if(!this.referencedScripts.include(_2bb.src)){
this.logger.debug("loading : "+uri);
this.client.getAsynchronously(uri,"",function(_2bd){
_2bd.on(Ice.Connection.Ok,function(){
this.referencedScripts.push(uri);
this.logger.debug("evaluating script at : "+uri);
try{
eval(_2bd.content());
}
catch(e){
this.logger.warn("Failed to evaluate script located at: "+uri,e);
}
}.bind(this));
}.bind(this));
}
}else{
var code=_2bb.innerHTML;
this.logger.debug("evaluating script : "+code);
try{
eval(code);
}
catch(e){
this.logger.warn("Failed to evaluate script: \n"+code,e);
}
}
}});
});
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){
window.setTimeout("Ice.Focus.setFocusNow('"+id+"');",100);
};
Ice.Focus.setFocusNow=function(id){
if((Ice.Focus.userInterupt==false)&&(id!="")&&(id!="undefined")){
try{
id.asExtendedElement().focus();
setFocus(id);
var ele=document.getElementById(id);
if(ele){
ele.focus();
}else{
window.logger.debug("Focus Failed. No element for id ["+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(_2c3){
var _2c4=document.onkeydown;
document.onkeydown=_2c4!=null?function(e){
_2c3(Ice.EventModel.Event.adaptToKeyEvent(e));
_2c4(e);
}:function(e){
_2c3(Ice.EventModel.Event.adaptToKeyEvent(e));
};
};
document.onMouseDown=function(_2c7){
var _2c8=document.onmousedown;
document.onmousedown=_2c8!=null?function(e){
_2c7(e);
_2c8(e);
}:function(e){
_2c7(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.NOOPIndicator={on:Function.NOOP,off:Function.NOOP};
This.RedirectIndicator=Object.subclass({initialize:function(uri){
this.uri=uri;
},on:function(){
window.location.href=this.uri;
}});
This.ElementIndicator=Object.subclass({initialize:function(_2ce,_2cf){
this.elementID=_2ce;
this.indicators=_2cf;
this.indicators.push(this);
this.off();
},on:function(){
this.indicators.each(function(_2d0){
if(_2d0!=this){
_2d0.off();
}
}.bind(this));
this.elementID.asElement().style.visibility="visible";
},off:function(){
this.elementID.asElement().style.visibility="hidden";
}});
This.ToggleIndicator=Object.subclass({initialize:function(_2d1,_2d2){
this.onElement=_2d1;
this.offElement=_2d2;
this.off();
},on:function(){
this.onElement.on();
this.offElement.off();
},off:function(){
this.onElement.off();
this.offElement.on();
}});
This.PointerIndicator=Object.subclass({initialize:function(_2d3){
this.element=_2d3;
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(_2d4,_2d5,_2d6,_2d7){
this.message=_2d4;
this.description=_2d5;
this.iconPath=_2d6;
this.panel=_2d7;
},on:function(){
this.panel.on();
var _2d8=document.createElement("div");
var _2d9=_2d8.style;
_2d9.position="absolute";
_2d9.textAlign="center";
_2d9.zIndex="10001";
_2d9.color="black";
_2d9.backgroundColor="white";
_2d9.paddingLeft="0";
_2d9.paddingRight="0";
_2d9.paddingTop="15px";
_2d9.paddingBottom="15px";
_2d9.borderBottomColor="gray";
_2d9.borderRightColor="gray";
_2d9.borderTopColor="silver";
_2d9.borderLeftColor="silver";
_2d9.borderWidth="2px";
_2d9.borderStyle="solid";
_2d9.width="270px";
document.body.appendChild(_2d8);
var _2da=document.createElement("div");
_2da.appendChild(document.createTextNode(this.message));
var _2db=_2da.style;
_2db.marginLeft="30px";
_2db.textAlign="left";
_2db.fontSize="14px";
_2db.fontSize="14px";
_2db.fontWeight="bold";
_2d8.appendChild(_2da);
var _2dc=document.createElement("div");
_2dc.appendChild(document.createTextNode(this.description));
var _2dd=_2dc.style;
_2dd.fontSize="11px";
_2dd.marginTop="7px";
_2dd.marginBottom="7px";
_2dd.fontWeight="normal";
_2da.appendChild(_2dc);
var _2de=document.createElement("input");
_2de.type="button";
_2de.value="Reload";
var _2df=_2de.style;
_2df.fontSize="11px";
_2df.fontWeight="normal";
_2de.onclick=function(){
window.location.reload();
};
_2d8.appendChild(_2de);
var _2e0=function(){
_2d9.left=((window.width()-_2d8.clientWidth)/2)+"px";
_2d9.top=((window.height()-_2d8.clientHeight)/2)+"px";
}.bind(this);
_2e0();
window.onResize(_2e0);
}});
This.StatusManager=Object.subclass({initialize:function(_2e1,_2e2){
this.container=_2e2;
var _2e3=_2e1.redirectURI?new This.RedirectIndicator(_2e1.redirectURI):null;
if(_2e2.connectionStatus){
this.indicators=[];
var _2e4=new This.ElementIndicator(_2e2.connectionStatus.working,this.indicators);
var _2e5=new This.ElementIndicator(_2e2.connectionStatus.idle,this.indicators);
this.busy=new This.ToggleIndicator(_2e4,_2e5);
this.connectionLost=_2e3?_2e3:new This.ElementIndicator(_2e2.connectionStatus.lost,this.indicators);
this.connectionTrouble=new This.ElementIndicator(_2e2.connectionStatus.trouble,this.indicators);
this.sessionExpired=this.connectionLost;
this.serverError=this.connectionLost;
}else{
this.busy=new This.PointerIndicator(_2e2);
var _2e6="To reconnect click the Reload button on the browser or click the button below";
var _2e7=_2e1.connection.context+"/xmlhttp/css/xp/css-images/connect_disconnected.gif";
var _2e8=_2e1.connection.context+"/xmlhttp/css/xp/css-images/connect_caution.gif";
this.sessionExpired=new This.OverlayIndicator("User Session Expired",_2e6,_2e7,this);
this.serverError=new This.OverlayIndicator("Server Internal Error",_2e6,_2e8,this);
this.connectionLost=_2e3?_2e3:new This.OverlayIndicator("Network Connection Interrupted",_2e6,_2e8,this);
this.connectionTrouble={on:Function.NOOP,off:Function.NOOP};
}
},on:function(){
var _2e9=this.container.ownerDocument.createElement("iframe");
_2e9.setAttribute("src","about:blank");
_2e9.setAttribute("frameborder","0");
var _2ea=_2e9.style;
_2ea.position="absolute";
_2ea.display="block";
_2ea.visibility="visible";
_2ea.backgroundColor="white";
_2ea.zIndex="10000";
_2ea.top="0";
_2ea.left="0";
_2ea.opacity=0.22;
_2ea.filter="alpha(opacity=22)";
this.container.appendChild(_2e9);
var _2eb=this.container.tagName.toLowerCase()=="body"?function(){
_2ea.width=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)+"px";
_2ea.height=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)+"px";
}:function(){
_2ea.width=this.container.offsetWidth+"px";
_2ea.height=this.container.offsetHeight+"px";
};
_2eb();
window.onResize(_2eb);
}});
});
[Ice.Connection=new Object,Ice.Connection,Ice.Ajax,Ice.Parameter.Query].as(function(This,_2ed,Ajax,_2ef){
This.FormPost=function(_2f0){
_2f0.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
};
This.Close=function(_2f1){
_2f1.close();
};
This.BadResponse=function(_2f2){
return _2f2.isComplete()&&!_2f2.isResponseValid();
};
This.ServerError=function(_2f3){
return _2f3.isComplete()&&_2f3.isServerError();
};
This.Receive=function(_2f4){
return _2f4.isOkAndComplete();
};
This.Ok=function(_2f5){
return _2f5.isOkAndComplete();
};
This.SyncConnection=Object.subclass({initialize:function(_2f6,_2f7,_2f8){
this.logger=_2f6.child("sync-connection");
this.channel=new Ajax.Client(this.logger);
this.defaultQuery=_2f8;
this.onSendListeners=[];
this.onReceiveListeners=[];
this.onServerErrorListeners=[];
this.connectionDownListeners=[];
this.timeoutBomb={cancel:Function.NOOP};
this.logger.info("synchronous mode");
this.sendURI=_2f7.context.current+"block/send-receive-updates";
this.disposeViewsURI=_2f7.context.current+"block/dispose-views";
var _2f9=_2f7.timeout?_2f7.timeout:5000;
this.onSend(function(){
this.timeoutBomb.cancel();
this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(_2f9);
}.bind(this));
this.onReceive(function(){
this.timeoutBomb.cancel();
}.bind(this));
this.whenDown(function(){
this.timeoutBomb.cancel();
}.bind(this));
this.receiveCallback=function(_2fa){
try{
this.onReceiveListeners.broadcast(_2fa);
}
catch(e){
this.logger.error("receive broadcast failed",e);
}
}.bind(this);
this.badResponseCallback=this.connectionDownListeners.broadcaster();
this.serverErrorCallback=this.onServerErrorListeners.broadcaster();
},send:function(_2fb){
var _2fc=new _2ef();
_2fc.addQuery(_2fb);
_2fc.addQuery(this.defaultQuery);
_2fc.add("ice.focus",window.currentFocus);
this.logger.debug("send > "+_2fc.asString());
this.channel.postAsynchronously(this.sendURI,_2fc.asURIEncodedString(),function(_2fd){
This.FormPost(_2fd);
_2fd.on(_2ed.Receive,this.receiveCallback);
_2fd.on(_2ed.BadResponse,this.badResponseCallback);
_2fd.on(_2ed.ServerError,this.serverErrorCallback);
_2fd.on(_2ed.Receive,_2ed.Close);
this.onSendListeners.broadcast(_2fd);
}.bind(this));
},onSend:function(_2fe){
this.onSendListeners.push(_2fe);
},onReceive:function(_2ff){
this.onReceiveListeners.push(_2ff);
},onServerError:function(_300){
this.onServerErrorListeners.push(_300);
},whenDown:function(_301){
this.connectionDownListeners.push(_301);
},whenTrouble:function(_302){
},cancelDisposeViews:function(){
this.sendDisposeViews=Function.NOOP;
},sendDisposeViews:function(){
try{
this.channel.postSynchronously(this.disposeViewsURI,this.defaultQuery.asURIEncodedString(),function(_303){
_2ed.FormPost(_303);
_303.on(_2ed.Receive,_2ed.Close);
});
}
catch(e){
this.logger.warn("Failed to notify view disposal",e);
}
},shutdown:function(){
this.shutdown=Function.NOOP;
this.send=Function.NOOP;
[this.onSendListeners,this.onReceiveListeners,this.onServerErrorListeners,this.connectionDownListeners].eachWithGuard(function(_304){
_304.clear();
});
}});
});
Ice.Community=new Object;
[Ice.Reliability=new Object].as(function(This){
This.Heartbeat=Object.subclass({initialize:function(_306,_307,_308){
this.period=_306;
this.logger=_308.child("heartbeat");
this.pingListeners=[];
this.lostPongListeners=[];
this.beat=function(){
var _309=function(){
this.logger.warn("pong lost");
this.lostPongListeners.each(function(_30a){
_30a.notify();
});
}.bind(this).delayExecutionFor(_307);
this.pingListeners.broadcast(new This.Ping(_309,this,this.logger));
}.bind(this);
window.onKeyPress(function(e){
if(e.keyCode()==46&&e.isCtrlPressed()&&e.isShiftPressed()){
this.beatPID?this.stop():this.start();
}
}.bind(this));
},start:function(){
this.beatPID=this.beat.repeatExecutionEvery(this.period);
this.logger.info("heartbeat started");
return this;
},stop:function(){
try{
this.beatPID.cancel();
this.beatPID=null;
this.lostPongListeners.each(function(_30c){
_30c.ignoreNotifications();
});
this.logger.info("heartbeat stopped");
}
catch(e){
this.logger.warn("heartbeat not started",e);
}
return this;
},reset:function(){
this.lostPongListeners.each(function(_30d){
_30d.reset();
});
},onPing:function(_30e){
this.pingListeners.push(_30e);
},onLostPongs:function(_30f,_310){
var _311=_310||1;
this.lostPongListeners.push(new This.CoalescingListener(_311,_30f));
}});
This.Ping=Object.subclass({initialize:function(pid,_313,_314){
this.pid=pid;
this.heartbeat=_313;
this.logger=_314;
this.logger.info("ping");
},pong:function(){
if(this.pid){
this.heartbeat.reset();
this.pid.cancel();
this.pong=Function.NOOP;
this.logger.info("pong");
}
}});
This.CoalescingListener=Object.subclass({initialize:function(_315,_316){
this.count=0;
this.retries=_315;
this.callback=_316;
},notify:function(){
this.count+=1;
if(this.count==this.retries){
this.callback();
this.reset();
}
},ignoreNotifications:function(){
this.notify=Function.NOOP;
},reset:function(){
this.count=0;
}});
});
[Ice.Community.Connection=new Object,Ice.Connection,Ice.Ajax,Ice.Reliability.Heartbeat,Ice.Cookie,Ice.Parameter.Query].as(function(This,_318,Ajax,_31a,_31b,_31c){
This.AsyncConnection=Object.subclass({initialize:function(_31d,_31e,_31f,_320,_321,_322){
this.logger=_31d.child("async-connection");
this.sendChannel=new Ajax.Client(this.logger.child("ui"));
this.receiveChannel=new Ajax.Client(this.logger.child("blocking"));
this.defaultQuery=_321;
this.onSendListeners=[];
this.onReceiveListeners=[];
this.onServerErrorListeners=[];
this.connectionDownListeners=[];
this.connectionTroubleListeners=[];
this.listener={close:Function.NOOP};
this.timeoutBomb={cancel:Function.NOOP};
this.heartbeat={stop:Function.NOOP};
this.pingURI=_320.context.current+"block/ping";
this.getURI=_320.context.current+"block/receive-updates";
this.sendURI=_320.context.current+"block/send-receive-updates";
this.receiveURI=_320.context.async+"block/receive-updated-views";
this.disposeViewsURI=_320.context.current+"block/dispose-views";
var _323=_320.timeout?_320.timeout:5000;
this.onSend(function(){
this.timeoutBomb.cancel();
this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(_323);
}.bind(this));
this.onReceive(function(){
this.timeoutBomb.cancel();
}.bind(this));
this.badResponseCallback=this.connectionDownListeners.broadcaster();
this.serverErrorCallback=this.onServerErrorListeners.broadcaster();
this.receiveCallback=function(_324){
try{
this.onReceiveListeners.broadcast(_324);
}
catch(e){
this.logger.error("receive broadcast failed",e);
}
}.bind(this);
this.sendXWindowCookie=Function.NOOP;
this.receiveXWindowCookie=function(_325){
var _326=_325.getResponseHeader("X-Set-Window-Cookie");
if(_326){
this.sendXWindowCookie=function(_327){
_327.setRequestHeader("X-Window-Cookie",_326);
};
}
}.bind(this);
try{
this.updatedViews=_31b.lookup("updates");
}
catch(e){
this.updatedViews=new _31b("updates","");
}
_322.register("updated-views",function(_328){
this.updatedViews.saveValue(_328.firstChild.data);
}.bind(this));
try{
this.listening=_31b.lookup("bconn");
this.listening.remove();
}
catch(e){
}
this.listenerInitializerProcess=function(){
try{
this.listening=_31b.lookup("bconn");
}
catch(e){
this.listening=new _31b("bconn","started");
this.heartbeat.stop();
var _329=_320.heartbeat.interval?_320.heartbeat.interval:20000;
var _32a=_320.heartbeat.timeout?_320.heartbeat.timeout:3000;
var _32b=_320.heartbeat.retries?_320.heartbeat.retries:3;
this.heartbeat=new _31a(_329,_32a,this.logger);
this.heartbeat.onPing(function(ping){
_322.register("pong",function(){
ping.pong();
});
this.sendChannel.postAsynchronously(this.pingURI,this.defaultQuery.asURIEncodedString(),_318.FormPost);
}.bind(this));
this.heartbeat.onLostPongs(this.connectionDownListeners.broadcaster(),_32b);
this.heartbeat.onLostPongs(this.connectionTroubleListeners.broadcaster());
this.heartbeat.onLostPongs(function(){
this.logger.debug("retry to connect...");
this.connect();
}.bind(this));
this.heartbeat.start();
this.connect();
}
}.bind(this).delayFor(200).repeatExecutionEvery(1000);
this.updatesListenerProcess=function(){
try{
var _32d=this.updatedViews.loadValue().split(" ");
var _32e=_31e+":"+_31f;
if(_32d.include(_32e)){
this.sendChannel.postAsynchronously(this.getURI,this.defaultQuery.asURIEncodedString(),function(_32f){
_318.FormPost(_32f);
_32f.on(_318.Receive,this.receiveCallback);
_32f.on(_318.Receive,_318.Close);
}.bind(this));
this.updatedViews.saveValue(_32d.complement([_32e]).join(" "));
}
}
catch(e){
this.logger.warn("failed to listen for updates",e);
}
}.bind(this).repeatExecutionEvery(300);
this.logger.info("asynchronous mode");
},connect:function(){
this.logger.debug("closing previous connection...");
this.listener.close();
this.logger.debug("connect...");
var _330=new _31c();
window.sessions.each(function(_331){
_330.add("ice.session",_331);
});
this.listener=this.receiveChannel.postAsynchronously(this.receiveURI,_330.asURIEncodedString(),function(_332){
this.sendXWindowCookie(_332);
_318.FormPost(_332);
_332.on(_318.BadResponse,this.badResponseCallback);
_332.on(_318.ServerError,this.serverErrorCallback);
_332.on(_318.Receive,this.receiveCallback);
_332.on(_318.Receive,this.receiveXWindowCookie);
_332.on(_318.Receive,function(){
this.connect();
}.bind(this).delayFor(150));
}.bind(this));
},send:function(_333){
var _334=new _31c();
_334.addQuery(_333);
_334.addQuery(this.defaultQuery);
_334.add("ice.focus",window.currentFocus);
this.logger.debug("send > "+_334.asString());
this.sendChannel.postAsynchronously(this.sendURI,_334.asURIEncodedString(),function(_335){
_318.FormPost(_335);
_335.on(_318.Receive,this.receiveCallback);
_335.on(_318.ServerError,this.serverErrorCallback);
_335.on(_318.Receive,_318.Close);
this.onSendListeners.broadcast(_335);
}.bind(this));
},onSend:function(_336){
this.onSendListeners.push(_336);
},onReceive:function(_337){
this.onReceiveListeners.push(_337);
},onServerError:function(_338){
this.onServerErrorListeners.push(_338);
},whenDown:function(_339){
this.connectionDownListeners.push(_339);
},whenTrouble:function(_33a){
this.connectionTroubleListeners.push(_33a);
},cancelDisposeViews:function(){
this.sendDisposeViews=Function.NOOP;
},sendDisposeViews:function(){
try{
this.sendChannel.postSynchronously(this.disposeViewsURI,this.defaultQuery.asURIEncodedString(),function(_33b){
_318.FormPost(_33b);
_33b.on(_318.Receive,_318.Close);
});
}
catch(e){
this.logger.warn("Failed to notify view disposal",e);
}
},shutdown:function(){
try{
this.shutdown=Function.NOOP;
this.send=Function.NOOP;
this.connect=Function.NOOP;
this.heartbeat.stop();
this.listening.remove();
this.listener.close();
}
catch(e){
}
finally{
[this.onSendListeners,this.onReceiveListeners,this.connectionDownListeners,this.onServerErrorListeners].eachWithGuard(function(_33c){
_33c.clear();
});
[this.updatesListenerProcess,this.listenerInitializerProcess].eachWithGuard(function(_33d){
_33d.cancel();
});
}
}});
});
[Ice.Community].as(function(This){
This.Application=Object.subclass({initialize:function(_33f,_340){
var _341=_33f.session;
var _342=_33f.view;
var _343=window.logger.child(_341.substring(0,4)+"#"+_342);
var _344=new Ice.Status.StatusManager(_33f,_340);
var _345=new Ice.Script.Loader(_343);
var _346=new Ice.Command.Dispatcher();
var _347=Ice.Parameter.Query.create(function(_348){
_348.add("ice.session",_341);
_348.add("ice.view",_342);
});
this.connection=_33f.synchronous?new Ice.Connection.SyncConnection(_343,_33f.connection,_347):new This.Connection.AsyncConnection(_343,_341,_342,_33f.connection,_347,_346);
_346.register("noop",Function.NOOP);
_346.register("set-cookie",Ice.Command.SetCookie);
_346.register("parsererror",Ice.Command.ParsingError);
_346.register("redirect",function(_349){
var url=_349.getAttribute("url").replace(/&#38;/g,"&");
_343.info("Redirecting to "+url);
if(url.contains("rvn=")){
this.connection.cancelDisposeViews();
}
window.location.href=url;
}.bind(this));
_346.register("reload",function(_34b){
_343.info("Reloading");
var url=window.location.href;
this.connection.cancelDisposeViews();
if(url.contains("rvn=")){
window.location.reload();
}else{
var view=_34b.getAttribute("view");
var _34e=url.contains("?")?"&":"?";
window.location.href=url+_34e+"rvn="+view;
}
}.bind(this));
_346.register("macro",function(_34f){
$enumerate(_34f.childNodes).each(function(_350){
_346.deserializeAndExecute(_350);
});
});
_346.register("updates",function(_351){
$enumerate(_351.getElementsByTagName("update")).each(function(_352){
try{
var _353=_352.getAttribute("address");
var html=_352.firstChild.data.replace(/<\!\#cdata\#/g,"<![CDATA[").replace(/\#\#>/g,"]]>");
_353.asExtendedElement().replaceHtml(html);
_343.debug("applied update : "+html);
_345.searchAndEvaluateScripts(_353.asElement());
if(Ice.StateMon){
Ice.StateMon.checkAll();
Ice.StateMon.rebuild();
}
}
catch(e){
_343.error("failed to insert element: "+html,e);
}
});
});
_346.register("session-expired",function(){
_343.warn("Session has expired");
_344.sessionExpired.on();
this.dispose();
}.bind(this));
window.onBeforeUnload(function(){
this.connection.sendDisposeViews();
this.connection.shutdown();
}.bind(this));
window.onUnload(function(){
this.dispose();
}.bind(this));
this.connection.onSend(function(){
Ice.Focus.userInterupt=false;
});
this.connection.onReceive(function(_355){
_346.deserializeAndExecute(_355.contentAsDOM().documentElement);
});
this.connection.onReceive(function(){
window.documentSynchronizer.synchronize();
});
this.connection.onServerError(function(_356){
_343.error("server side error");
_344.serverError.on();
this.connection.sendDisposeViews();
this.dispose();
$element(document.documentElement).replaceHtml(_356.content());
_345.searchAndEvaluateScripts(document.documentElement);
}.bind(this));
this.connection.whenDown(function(){
_343.warn("connection to server was lost");
_344.connectionLost.on();
this.dispose();
}.bind(this));
this.connection.whenTrouble(function(){
_343.warn("connection in trouble");
_344.connectionTrouble.on();
});
this.connection.onSend(function(){
_344.busy.on();
});
this.connection.onReceive(function(){
_344.busy.off();
});
_343.info("bridge loaded!");
},dispose:function(){
this.connection.shutdown();
this.dispose=Function.NOOP;
}});
});
window.logger=new Ice.Log.Logger(["window"]);
window.console&&window.console.firebug?new Ice.Log.FirebugLogHandler(window.logger):new Ice.Log.WindowLogHandler(window.logger,window);
window.onLoad(function(){
window.documentSynchronizer=new Ice.Document.Synchronizer(window.logger);
});
window.onKeyPress(function(e){
if(e.isEscKey()){
e.cancelDefaultAction();
}
});

if (typeof OpenAjax != 'undefined' && typeof OpenAjax.registerLibrary != 'undefined' && typeof OpenAjax.registerGlobals != 'undefined') {
    OpenAjax.registerLibrary('icefaces-d2d', 'http://www.icefaces.org/', '1.5.3');
    OpenAjax.registerGlobals('icefaces-d2d', ['Class','Enumerable','iceSubmit','$A','resetHiddenFieldsFor','$H','setFocus','property','$R','$break','Hash','ObjectRange','$w','Template','current','$continue','PeriodicalExecuter','Try','currentFocus','Abstract','Ice','iceSubmitPartial']);
}


