summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/prado.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/js/prado.js')
-rw-r--r--framework/Web/Javascripts/js/prado.js3939
1 files changed, 2091 insertions, 1848 deletions
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js
index 794114d9..6737d4ce 100644
--- a/framework/Web/Javascripts/js/prado.js
+++ b/framework/Web/Javascripts/js/prado.js
@@ -1,2016 +1,2259 @@
-var Prototype={Version:"1.4.0",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];
+
+var Prototype = {
+Version: '1.50',
+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(destination, source) {
+for (var property in source) {
+destination[property] = source[property];
+}
+return destination;
+}
+Object.inspect = function(object) {
+try {
+if (object == undefined) return 'undefined';
+if (object == null) return 'null';
+return object.inspect ? object.inspect() : object.toString();
+} catch (e) {
+if (e instanceof RangeError) return '...';
+throw e;
}
-return _2;
-};
-Object.inspect=function(_4){
-try{
-if(_4==undefined){
-return "undefined";
}
-if(_4==null){
-return "null";
+Function.prototype.bind = function() {
+var __method = this, args = $A(arguments), object = args.shift();
+return function() {
+return __method.apply(object, args.concat($A(arguments)));
}
-return _4.inspect?_4.inspect():_4.toString();
}
-catch(e){
-if(e instanceof RangeError){
-return "...";
+Function.prototype.bindAsEventListener = function(object) {
+var __method = this;
+return function(event) {
+return __method.call(object, event || window.event);
}
-throw e;
}
-};
-Function.prototype.bind=function(){
-var _5=this,args=$A(arguments),object=args.shift();
-return function(){
-return _5.apply(object,args.concat($A(arguments)));
-};
-};
-Function.prototype.bindAsEventListener=function(_6){
-var _7=this;
-return function(_8){
-return _7.call(_6,_8||window.event);
-};
-};
-Object.extend(Number.prototype,{toColorPart:function(){
-var _9=this.toString(16);
-if(this<16){
-return "0"+_9;
-}
-return _9;
-},succ:function(){
-return this+1;
-},times:function(_10){
-$R(0,this,true).each(_10);
+Object.extend(Number.prototype, {
+toColorPart: function() {
+var digits = this.toString(16);
+if (this < 16) return '0' + digits;
+return digits;
+},
+succ: function() {
+return this + 1;
+},
+times: function(iterator) {
+$R(0, this, true).each(iterator);
return this;
-}});
-var Try={these:function(){
-var _11;
-for(var i=0;i<arguments.length;i++){
-var _13=arguments[i];
-try{
-_11=_13();
+}
+});
+var Try = {
+these: function() {
+var returnValue;
+for (var i = 0; i < arguments.length; i++) {
+var lambda = arguments[i];
+try {
+returnValue = lambda();
break;
+} catch (e) {}
}
-catch(e){
+return returnValue;
}
}
-return _11;
-}};
-var PeriodicalExecuter=Class.create();
-PeriodicalExecuter.prototype={initialize:function(_14,_15){
-this.callback=_14;
-this.frequency=_15;
-this.currentlyExecuting=false;
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+initialize: function(callback, frequency) {
+this.callback = callback;
+this.frequency = frequency;
+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 _16=new Array();
-for(var i=0;i<arguments.length;i++){
-var _17=arguments[i];
-if(typeof _17=="string"){
-_17=document.getElementById(_17);
-}
-if(arguments.length==1){
-return _17;
-}
-_16.push(_17);
-}
-return _16;
-}
-function isAlien(a){
-return isObject(a)&&typeof a.constructor!="function";
-}
-function isArray(a){
-return isObject(a)&&a.constructor==Array;
-}
-function isBoolean(a){
-return typeof a=="boolean";
-}
-function isFunction(a){
-return typeof a=="function";
-}
-function isNull(a){
-return typeof a=="object"&&!a;
-}
-function isNumber(a){
-return typeof a=="number"&&isFinite(a);
-}
-function isObject(a){
-return (a&&typeof a=="object")||isFunction(a);
-}
-function isRegexp(a){
-return a&&a.constructor==RegExp;
-}
-function isString(a){
-return typeof a=="string";
-}
-function isUndefined(a){
-return typeof a=="undefined";
-}
-function isEmpty(o){
-var i,v;
-if(isObject(o)){
-for(i in o){
-v=o[i];
-if(isUndefined(v)&&isFunction(v)){
-return false;
-}
-}
-}
-return true;
-}
-function undef(v){
-return isUndefined(v);
-}
-function isdef(v){
-return !isUndefined(v);
-}
-function isElement(o,_21){
-return o&&isObject(o)&&((!_21&&(o==window||o==document))||o.nodeType==1);
-}
-function isList(o){
-return o&&isObject(o)&&isArray(o);
-}
-function $(n,d){
-if(isElement(n)){
-return n;
-}
-if(isString(n)==false){
-return null;
-}
-var p,i,x;
-if(!d){
-d=document;
-}
-if((p=n.indexOf("?"))>0&&parent.frames.length){
-d=parent.frames[n.substring(p+1)].document;
-n=n.substring(0,p);
-}
-if(!(x=d[n])&&d.all){
-x=d.all[n];
-}
-for(i=0;!x&&i<d.forms.length;i++){
-x=d.forms[i][n];
-}
-for(i=0;!x&&d.layers&&i<d.layers.length;i++){
-x=DOM.find(n,d.layers[i].document);
-}
-if(!x&&d.getElementById){
-x=d.getElementById(n);
-}
-return x;
-}
-Function.prototype.bindEvent=function(){
-var _25=this,args=$A(arguments),object=args.shift();
-return function(_26){
-return _25.apply(object,[_26||window.event].concat(args));
-};
-};
-Object.extend(String.prototype,{stripTags:function(){
-return this.replace(/<\/?[^>]+>/gi,"");
-},stripScripts:function(){
-return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
-},extractScripts:function(){
-var _27=new RegExp(Prototype.ScriptFragment,"img");
-var _28=new RegExp(Prototype.ScriptFragment,"im");
-return (this.match(_27)||[]).map(function(_29){
-return (_29.match(_28)||["",""])[1];
+},
+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.prototype.bindEvent = function()
+{
+var __method = this, args = $A(arguments), object = args.shift();
+return function(event)
+{
+return __method.apply(object, [event || window.event].concat(args));
+}
+}
+Class.extend = function(base, definition)
+{
+var component = Class.create();
+Object.extend(component.prototype, base.prototype);
+if(definition)
+Object.extend(component.prototype, definition);
+return component;
+}
+Object.extend(String.prototype, {
+gsub: function(pattern, replacement) {
+var result = '', source = this, match;
+replacement = arguments.callee.prepareReplacement(replacement);
+while (source.length > 0) {
+if (match = source.match(pattern)) {
+result += source.slice(0, match.index);
+result += (replacement(match) || '').toString();
+source= source.slice(match.index + match[0].length);
+} else {
+result += source, source = '';
+}
+}
+return result;
+},
+sub: function(pattern, replacement, count) {
+replacement = this.gsub.prepareReplacement(replacement);
+count = count === undefined ? 1 : count;
+return this.gsub(pattern, function(match) {
+if (--count < 0) return match[0];
+return replacement(match);
});
-},evalScripts:function(){
-return this.extractScripts().map(eval);
-},escapeHTML:function(){
-var div=document.createElement("div");
-var _31=document.createTextNode(this);
-div.appendChild(_31);
+},
+scan: function(pattern, iterator) {
+this.gsub(pattern, iterator);
+return this;
+},
+truncate: function(length, truncation) {
+length = length || 30;
+truncation = truncation === undefined ? '...' : truncation;
+return this.length > length ?
+this.slice(0, length - truncation.length) + truncation : 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 matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+return (this.match(matchAll) || []).map(function(scriptTag) {
+return (scriptTag.match(matchOne) || ['', ''])[1];
+});
+},
+evalScripts: function() {
+return this.extractScripts().map(function(script) { return eval(script) });
+},
+escapeHTML: function() {
+var div = document.createElement('div');
+var text = document.createTextNode(this);
+div.appendChild(text);
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 _32=this.match(/^\??(.*)$/)[1].split("&");
-return _32.inject({},function(_33,_34){
-var _35=_34.split("=");
-_33[_35[0]]=_35[1];
-return _33;
+},
+unescapeHTML: function() {
+var div = document.createElement('div');
+div.innerHTML = this.stripTags();
+return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
+},
+toQueryParams: function() {
+var pairs = this.match(/^\??(.*)$/)[1].split('&');
+return pairs.inject({}, function(params, pairString) {
+var pair = pairString.split('=');
+params[pair[0]] = pair[1];
+return params;
});
-},toArray:function(){
-return this.split("");
-},camelize:function(){
-var _36=this.split("-");
-if(_36.length==1){
-return _36[0];
-}
-var _37=this.indexOf("-")==0?_36[0].charAt(0).toUpperCase()+_36[0].substring(1):_36[0];
-for(var i=1,len=_36.length;i<len;i++){
-var s=_36[i];
-_37+=s.charAt(0).toUpperCase()+s.substring(1);
-}
-return _37;
-},inspect:function(){
-return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'";
-}});
-String.prototype.parseQuery=String.prototype.toQueryParams;
-Object.extend(String.prototype,{pad:function(_39,len,chr){
-if(!chr){
-chr=" ";
-}
-var s=this;
-var _42=_39.toLowerCase()=="left";
-while(s.length<len){
-s=_42?chr+s:s+chr;
-}
-return s;
-},padLeft:function(len,chr){
-return this.pad("left",len,chr);
-},padRight:function(len,chr){
-return this.pad("right",len,chr);
-},zerofill:function(len){
-return this.padLeft(len,"0");
-},trim:function(){
-return this.replace(/^\s+|\s+$/g,"");
-},trimLeft:function(){
-return this.replace(/^\s+/,"");
-},trimRight:function(){
-return this.replace(/\s+$/,"");
-},toFunction:function(){
-var _43=this.split(/\./);
-var _44=window;
-_43.each(function(_45){
-if(_44[new String(_45)]){
-_44=_44[new String(_45)];
+},
+toArray: function() {
+return this.split('');
+},
+camelize: function() {
+var oStringList = this.split('-');
+if (oStringList.length == 1) return oStringList[0];
+var camelizedString = this.indexOf('-') == 0
+? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
+: oStringList[0];
+for (var i = 1, len = oStringList.length; i < len; i++) {
+var s = oStringList[i];
+camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
+}
+return camelizedString;
+},
+inspect: function() {
+return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
}
});
-if(isFunction(_44)){
-return _44;
-}else{
-if(typeof Logger!="undefined"){
-Logger.error("Missing function",this);
+String.prototype.gsub.prepareReplacement = function(replacement) {
+if (typeof replacement == 'function') return replacement;
+var template = new Template(replacement);
+return function(match) { return template.evaluate(match) };
+}
+String.prototype.parseQuery = String.prototype.toQueryParams;
+var Template = Class.create();
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+Template.prototype = {
+initialize: function(template, pattern) {
+this.template = template.toString();
+this.pattern= pattern || Template.Pattern;
+},
+evaluate: function(object) {
+return this.template.gsub(this.pattern, function(match) {
+var before = match[1];
+if (before == '\\') return match[2];
+return before + (object[match[3]] || '').toString();
+});
}
-return Prototype.emptyFunction;
}
-},toInteger:function(){
-var exp=/^\s*[-\+]?\d+\s*$/;
-if(this.match(exp)==null){
+Object.extend(String.prototype, {
+pad : function(side, len, chr) {
+if (!chr) chr = ' ';
+var s = this;
+var left = side.toLowerCase()=='left';
+while (s.length<len) s = left? chr + s : s + chr;
+return s;
+},
+padLeft : function(len, chr) {
+return this.pad('left',len,chr);
+},
+padRight : function(len, chr) {
+return this.pad('right',len,chr);
+},
+zerofill : function(len) {
+return this.padLeft(len,'0');
+},
+trim : function() {
+return this.replace(/^\s+|\s+$/g,'');
+},
+trimLeft : function() {
+return this.replace(/^\s+/,'');
+},
+trimRight : function() {
+return this.replace(/\s+$/,'');
+},
+toFunction : function()
+{
+var commands = this.split(/\./);
+var command = window;
+commands.each(function(action)
+{
+if(command[new String(action)])
+command=command[new String(action)];
+});
+if(typeof(command) == "function")
+return command;
+else
+{
+if(typeof Logger != "undefined")
+Logger.error("Missing function", this);
+throw new Error("Missing function '"+this+"'");
+}
+},
+toInteger : function()
+{
+var exp = /^\s*[-\+]?\d+\s*$/;
+if (this.match(exp) == null)
return null;
-}
-var num=parseInt(this,10);
-return (isNaN(num)?null:num);
-},toDouble:function(_48){
-_48=_48||".";
-var exp=new RegExp("^\\s*([-\\+])?(\\d+)?(\\"+_48+"(\\d+))?\\s*$");
-var m=this.match(exp);
-if(m==null){
+var num = parseInt(this, 10);
+return (isNaN(num) ? null : num);
+},
+toDouble : function(decimalchar)
+{
+if(this.length <= 0) return null;
+decimalchar = decimalchar || ".";
+var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
+var m = this.match(exp);
+if (m == null)
return null;
-}
-var _50=m[1]+(m[2].length>0?m[2]:"0")+"."+m[4];
-var num=parseFloat(_50);
-return (isNaN(num)?null:num);
-},toCurrency:function(_51,_52,_53){
-_51=_51||",";
-_53=_53||".";
-_52=typeof (_52)=="undefined"?2:_52;
-var exp=new RegExp("^\\s*([-\\+])?(((\\d+)\\"+_51+")*)(\\d+)"+((_52>0)?"(\\"+_53+"(\\d{1,"+_52+"}))?":"")+"\\s*$");
-var m=this.match(exp);
-if(m==null){
+m[1] = m[1] || "";
+m[2] = m[2] || "0";
+m[4] = m[4] || "0";
+var cleanInput = m[1] + (m[2].length>0 ? m[2] : "0") + "." + m[4];
+var num = parseFloat(cleanInput);
+return (isNaN(num) ? null : num);
+},
+toCurrency : function(groupchar, digits, decimalchar)
+{
+groupchar = groupchar || ",";
+decimalchar = decimalchar || ".";
+digits = typeof(digits) == "undefined" ? 2 : digits;
+var exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
++ ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
++ "\\s*$");
+var m = this.match(exp);
+if (m == null)
return null;
-}
-var _54=m[2]+m[5];
-var _55=m[1]+_54.replace(new RegExp("(\\"+_51+")","g"),"")+((_52>0)?"."+m[7]:"");
-var num=parseFloat(_55);
-return (isNaN(num)?null:num);
-},toDate:function(_56){
-return Date.SimpleParse(this,_56);
-}});
-var $break=new Object();
-var $continue=new Object();
-var Enumerable={each:function(_57){
-var _58=0;
-try{
-this._each(function(_59){
-try{
-_57(_59,_58++);
-}
-catch(e){
-if(e!=$continue){
-throw e;
-}
+var intermed = m[2] + m[5] ;
+var cleanInput = m[1] + intermed.replace(
+new RegExp("(\\" + groupchar + ")", "g"), "")
++ ((digits > 0) ? "." + m[7] : "");
+var num = parseFloat(cleanInput);
+return (isNaN(num) ? null : num);
+},
+toDate : function(format)
+{
+return Date.SimpleParse(this, format);
}
});
-}
-catch(e){
-if(e!=$break){
-throw e;
-}
-}
-},all:function(_60){
-var _61=true;
-this.each(function(_62,_63){
-_61=_61&&!!(_60||Prototype.K)(_62,_63);
-if(!_61){
-throw $break;
+var $break= new Object();
+var $continue = new Object();
+var Enumerable = {
+each: function(iterator) {
+var index = 0;
+try {
+this._each(function(value) {
+try {
+iterator(value, index++);
+} catch (e) {
+if (e != $continue) throw e;
}
});
-return _61;
-},any:function(_64){
-var _65=true;
-this.each(function(_66,_67){
-if(_65=!!(_64||Prototype.K)(_66,_67)){
+} catch (e) {
+if (e != $break) throw e;
+}
+},
+all: function(iterator) {
+var result = true;
+this.each(function(value, index) {
+result = result && !!(iterator || Prototype.K)(value, index);
+if (!result) throw $break;
+});
+return result;
+},
+any: function(iterator) {
+var result = true;
+this.each(function(value, index) {
+if (result = !!(iterator || Prototype.K)(value, index))
throw $break;
-}
});
-return _65;
-},collect:function(_68){
-var _69=[];
-this.each(function(_70,_71){
-_69.push(_68(_70,_71));
+return result;
+},
+collect: function(iterator) {
+var results = [];
+this.each(function(value, index) {
+results.push(iterator(value, index));
});
-return _69;
-},detect:function(_72){
-var _73;
-this.each(function(_74,_75){
-if(_72(_74,_75)){
-_73=_74;
+return results;
+},
+detect: function (iterator) {
+var result;
+this.each(function(value, index) {
+if (iterator(value, index)) {
+result = value;
throw $break;
}
});
-return _73;
-},findAll:function(_76){
-var _77=[];
-this.each(function(_78,_79){
-if(_76(_78,_79)){
-_77.push(_78);
-}
+return result;
+},
+findAll: function(iterator) {
+var results = [];
+this.each(function(value, index) {
+if (iterator(value, index))
+results.push(value);
});
-return _77;
-},grep:function(_80,_81){
-var _82=[];
-this.each(function(_83,_84){
-var _85=_83.toString();
-if(_85.match(_80)){
-_82.push((_81||Prototype.K)(_83,_84));
-}
-});
-return _82;
-},include:function(_86){
-var _87=false;
-this.each(function(_88){
-if(_88==_86){
-_87=true;
+return results;
+},
+grep: function(pattern, iterator) {
+var results = [];
+this.each(function(value, index) {
+var stringValue = value.toString();
+if (stringValue.match(pattern))
+results.push((iterator || Prototype.K)(value, index));
+})
+return results;
+},
+include: function(object) {
+var found = false;
+this.each(function(value) {
+if (value == object) {
+found = true;
throw $break;
}
});
-return _87;
-},inject:function(_89,_90){
-this.each(function(_91,_92){
-_89=_90(_89,_91,_92);
+return found;
+},
+inject: function(memo, iterator) {
+this.each(function(value, index) {
+memo = iterator(memo, value, index);
});
-return _89;
-},invoke:function(_93){
-var _94=$A(arguments).slice(1);
-return this.collect(function(_95){
-return _95[_93].apply(_95,_94);
+return memo;
+},
+invoke: function(method) {
+var args = $A(arguments).slice(1);
+return this.collect(function(value) {
+return value[method].apply(value, args);
});
-},max:function(_96){
-var _97;
-this.each(function(_98,_99){
-_98=(_96||Prototype.K)(_98,_99);
-if(_98>=(_97||_98)){
-_97=_98;
-}
+},
+max: function(iterator) {
+var result;
+this.each(function(value, index) {
+value = (iterator || Prototype.K)(value, index);
+if (result == undefined || value >= result)
+result = value;
});
-return _97;
-},min:function(_100){
-var _101;
-this.each(function(_102,_103){
-_102=(_100||Prototype.K)(_102,_103);
-if(_102<=(_101||_102)){
-_101=_102;
-}
+return result;
+},
+min: function(iterator) {
+var result;
+this.each(function(value, index) {
+value = (iterator || Prototype.K)(value, index);
+if (result == undefined || value < result)
+result = value;
});
-return _101;
-},partition:function(_104){
-var _105=[],falses=[];
-this.each(function(_106,_107){
-((_104||Prototype.K)(_106,_107)?_105:falses).push(_106);
+return result;
+},
+partition: function(iterator) {
+var trues = [], falses = [];
+this.each(function(value, index) {
+((iterator || Prototype.K)(value, index) ?
+trues : falses).push(value);
});
-return [_105,falses];
-},pluck:function(_108){
-var _109=[];
-this.each(function(_110,_111){
-_109.push(_110[_108]);
+return [trues, falses];
+},
+pluck: function(property) {
+var results = [];
+this.each(function(value, index) {
+results.push(value[property]);
});
-return _109;
-},reject:function(_112){
-var _113=[];
-this.each(function(_114,_115){
-if(!_112(_114,_115)){
-_113.push(_114);
-}
+return results;
+},
+reject: function(iterator) {
+var results = [];
+this.each(function(value, index) {
+if (!iterator(value, index))
+results.push(value);
});
-return _113;
-},sortBy:function(_116){
-return this.collect(function(_117,_118){
-return {value:_117,criteria:_116(_117,_118)};
-}).sort(function(left,_120){
-var a=left.criteria,b=_120.criteria;
-return a<b?-1:a>b?1:0;
-}).pluck("value");
-},toArray:function(){
+return results;
+},
+sortBy: function(iterator) {
+return this.collect(function(value, index) {
+return {value: value, criteria: iterator(value, index)};
+}).sort(function(left, right) {
+var a = left.criteria, b = right.criteria;
+return a < b ? -1 : a > b ? 1 : 0;
+}).pluck('value');
+},
+toArray: function() {
return this.collect(Prototype.K);
-},zip:function(){
-var _121=Prototype.K,args=$A(arguments);
-if(typeof args.last()=="function"){
-_121=args.pop();
-}
-var _122=[this].concat(args).map($A);
-return this.map(function(_123,_124){
-_121(_123=_122.pluck(_124));
-return _123;
+},
+zip: function() {
+var iterator = Prototype.K, args = $A(arguments);
+if (typeof args.last() == 'function')
+iterator = args.pop();
+var collections = [this].concat(args).map($A);
+return this.map(function(value, index) {
+return iterator(collections.pluck(index));
});
-},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(_125){
-if(!_125){
-return [];
-}
-if(_125.toArray){
-return _125.toArray();
-}else{
-var _126=[];
-for(var i=0;i<_125.length;i++){
-_126.push(_125[i]);
-}
-return _126;
+},
+inspect: function() {
+return '#<Enumerable:' + this.toArray().inspect() + '>';
}
-};
-Object.extend(Array.prototype,Enumerable);
-Object.extend(Array.prototype,{_each:function(_127){
-for(var i=0;i<this.length;i++){
-_127(this[i]);
}
-},clear:function(){
-this.length=0;
+Object.extend(Enumerable, {
+map: Enumerable.collect,
+find:Enumerable.detect,
+select:Enumerable.findAll,
+member:Enumerable.include,
+entries: Enumerable.toArray
+});
+var $A = Array.from = function(iterable) {
+if (!iterable) return [];
+if (iterable.toArray) {
+return iterable.toArray();
+} else {
+var results = [];
+for (var i = 0; i < iterable.length; i++)
+results.push(iterable[i]);
+return results;
+}
+}
+Object.extend(Array.prototype, Enumerable);
+if (!Array.prototype._reverse)
+Array.prototype._reverse = Array.prototype.reverse;
+Object.extend(Array.prototype, {
+_each: function(iterator) {
+for (var i = 0; i < this.length; i++)
+iterator(this[i]);
+},
+clear: function() {
+this.length = 0;
return this;
-},first:function(){
+},
+first: function() {
return this[0];
-},last:function(){
-return this[this.length-1];
-},compact:function(){
-return this.select(function(_128){
-return _128!=undefined||_128!=null;
+},
+last: function() {
+return this[this.length - 1];
+},
+compact: function() {
+return this.select(function(value) {
+return value != undefined || value != null;
});
-},flatten:function(){
-return this.inject([],function(_129,_130){
-return _129.concat(_130.constructor==Array?_130.flatten():[_130]);
+},
+flatten: function() {
+return this.inject([], function(array, value) {
+return array.concat(value && value.constructor == Array ?
+value.flatten() : [value]);
});
-},without:function(){
-var _131=$A(arguments);
-return this.select(function(_132){
-return !_131.include(_132);
+},
+without: function() {
+var values = $A(arguments);
+return this.select(function(value) {
+return !values.include(value);
});
-},indexOf:function(_133){
-for(var i=0;i<this.length;i++){
-if(this[i]==_133){
-return i;
-}
-}
+},
+indexOf: function(object) {
+for (var i = 0; i < this.length; i++)
+if (this[i] == object) return i;
return -1;
-},shift:function(){
-var _134=this[0];
-for(var i=0;i<this.length-1;i++){
-this[i]=this[i+1];
-}
-this.length--;
-return _134;
-},inspect:function(){
-return "["+this.map(Object.inspect).join(", ")+"]";
-}});
-var Hash={_each:function(_135){
-for(key in this){
-var _136=this[key];
-if(typeof _136=="function"){
-continue;
+},
+reverse: function(inline) {
+return (inline !== false ? this : this.toArray())._reverse();
+},
+inspect: function() {
+return '[' + this.map(Object.inspect).join(', ') + ']';
}
-var pair=[key,_136];
-pair.key=key;
-pair.value=_136;
-_135(pair);
-}
-},keys:function(){
-return this.pluck("key");
-},values:function(){
-return this.pluck("value");
-},merge:function(hash){
-return $H(hash).inject($H(this),function(_139,pair){
-_139[pair.key]=pair.value;
-return _139;
});
-},toQueryString:function(){
-return this.map(function(pair){
-return pair.map(encodeURIComponent).join("=");
-}).join("&");
-},inspect:function(){
-return "#<Hash:{"+this.map(function(pair){
-return pair.map(Object.inspect).join(": ");
-}).join(", ")+"}>";
-}};
-function $H(_140){
-var hash=Object.extend({},_140||{});
-Object.extend(hash,Enumerable);
-Object.extend(hash,Hash);
+var Hash = {
+_each: function(iterator) {
+for (var key in this) {
+var value = this[key];
+if (typeof value == 'function') continue;
+var pair = [key, value];
+pair.key = key;
+pair.value = value;
+iterator(pair);
+}
+},
+keys: function() {
+return this.pluck('key');
+},
+values: function() {
+return this.pluck('value');
+},
+merge: function(hash) {
+return $H(hash).inject($H(this), function(mergedHash, pair) {
+mergedHash[pair.key] = pair.value;
+return mergedHash;
+});
+},
+toQueryString: function() {
+return this.map(function(pair) {
+return pair.map(encodeURIComponent).join('=');
+}).join('&');
+},
+inspect: function() {
+return '#<Hash:{' + this.map(function(pair) {
+return pair.map(Object.inspect).join(': ');
+}).join(', ') + '}>';
+}
+}
+function $H(object) {
+var hash = Object.extend({}, object || {});
+Object.extend(hash, Enumerable);
+Object.extend(hash, Hash);
return hash;
}
-ObjectRange=Class.create();
-Object.extend(ObjectRange.prototype,Enumerable);
-Object.extend(ObjectRange.prototype,{initialize:function(_141,end,_143){
-this.start=_141;
-this.end=end;
-this.exclusive=_143;
-},_each:function(_144){
-var _145=this.start;
-do{
-_144(_145);
-_145=_145.succ();
-}while(this.include(_145));
-},include:function(_146){
-if(_146<this.start){
+ObjectRange = Class.create();
+Object.extend(ObjectRange.prototype, Enumerable);
+Object.extend(ObjectRange.prototype, {
+initialize: function(start, end, exclusive) {
+this.start = start;
+this.end = end;
+this.exclusive = exclusive;
+},
+_each: function(iterator) {
+var value = this.start;
+do {
+iterator(value);
+value = value.succ();
+} while (this.include(value));
+},
+include: function(value) {
+if (value < this.start)
return false;
+if (this.exclusive)
+return value < this.end;
+return value <= this.end;
}
-if(this.exclusive){
-return _146<this.end;
-}
-return _146<=this.end;
-}});
-var $R=function(_147,end,_148){
-return new ObjectRange(_147,end,_148);
-};
-document.getElementsByClassName=function(_149,_150){
-var _151=($(_150)||document.body).getElementsByTagName("*");
-return $A(_151).inject([],function(_152,_153){
-if(_153.className.match(new RegExp("(^|\\s)"+_149+"(\\s|$)"))){
-_152.push(_153);
-}
-return _152;
});
-};
-if(!window.Element){
-var Element=new Object();
-}
-Object.extend(Element,{visible:function(_154){
-return $(_154).style.display!="none";
-},toggle:function(){
-for(var i=0;i<arguments.length;i++){
-var _155=$(arguments[i]);
-Element[Element.visible(_155)?"hide":"show"](_155);
-}
-},hide:function(){
-for(var i=0;i<arguments.length;i++){
-var _156=$(arguments[i]);
-_156.style.display="none";
-}
-},show:function(){
-for(var i=0;i<arguments.length;i++){
-var _157=$(arguments[i]);
-_157.style.display="";
-}
-},remove:function(_158){
-_158=$(_158);
-_158.parentNode.removeChild(_158);
-},update:function(_159,html){
-$(_159).innerHTML=html.stripScripts();
-setTimeout(function(){
-html.evalScripts();
-},10);
-},getHeight:function(_161){
-_161=$(_161);
-return _161.offsetHeight;
-},classNames:function(_162){
-return new Element.ClassNames(_162);
-},hasClassName:function(_163,_164){
-if(!(_163=$(_163))){
-return;
-}
-return Element.classNames(_163).include(_164);
-},addClassName:function(_165,_166){
-if(!(_165=$(_165))){
-return;
-}
-return Element.classNames(_165).add(_166);
-},removeClassName:function(_167,_168){
-if(!(_167=$(_167))){
-return;
+var $R = function(start, end, exclusive) {
+return new ObjectRange(start, end, exclusive);
+}
+function $() {
+var results = [], element;
+for (var i = 0; i < arguments.length; i++) {
+element = arguments[i];
+if (typeof element == 'string')
+element = document.getElementById(element);
+results.push(Element.extend(element));
+}
+return results.length < 2 ? results[0] : results;
+}
+document.getElementsByClassName = function(className, parentElement) {
+var children = ($(parentElement) || document.body).getElementsByTagName('*');
+return $A(children).inject([], function(elements, child) {
+if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
+elements.push(Element.extend(child));
+return elements;
+});
}
-return Element.classNames(_167).remove(_168);
-},cleanWhitespace:function(_169){
-_169=$(_169);
-for(var i=0;i<_169.childNodes.length;i++){
-var node=_169.childNodes[i];
-if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
+if (!window.Element)
+var Element = new Object();
+Element.extend = function(element) {
+if (!element) return;
+if (_nativeExtensions) return element;
+if (!element._extended && element.tagName && element != window) {
+var methods = Element.Methods, cache = Element.extend.cache;
+for (property in methods) {
+var value = methods[property];
+if (typeof value == 'function')
+element[property] = cache.findOrStore(value);
+}
+}
+element._extended = true;
+return element;
+}
+Element.extend.cache = {
+findOrStore: function(value) {
+return this[value] = this[value] || function() {
+return value.apply(null, [this].concat($A(arguments)));
+}
+}
+}
+Element.Methods = {
+visible: function(element) {
+return $(element).style.display != 'none';
+},
+toggle: function() {
+for (var i = 0; i < arguments.length; i++) {
+var element = $(arguments[i]);
+Element[Element.visible(element) ? 'hide' : 'show'](element);
+}
+},
+hide: function() {
+for (var i = 0; i < arguments.length; i++) {
+var element = $(arguments[i]);
+element.style.display = 'none';
+}
+},
+show: function() {
+for (var i = 0; i < arguments.length; i++) {
+var element = $(arguments[i]);
+element.style.display = '';
+}
+},
+remove: function(element) {
+element = $(element);
+element.parentNode.removeChild(element);
+},
+update: function(element, html) {
+$(element).innerHTML = html.stripScripts();
+setTimeout(function() {html.evalScripts()}, 10);
+},
+replace: function(element, html) {
+element = $(element);
+if (element.outerHTML) {
+element.outerHTML = html.stripScripts();
+} else {
+var range = element.ownerDocument.createRange();
+range.selectNodeContents(element);
+element.parentNode.replaceChild(
+range.createContextualFragment(html.stripScripts()), element);
+}
+setTimeout(function() {html.evalScripts()}, 10);
+},
+getHeight: function(element) {
+element = $(element);
+return element.offsetHeight;
+},
+classNames: function(element) {
+return new Element.ClassNames(element);
+},
+hasClassName: function(element, className) {
+if (!(element = $(element))) return;
+return Element.classNames(element).include(className);
+},
+addClassName: function(element, className) {
+if (!(element = $(element))) return;
+return Element.classNames(element).add(className);
+},
+removeClassName: function(element, className) {
+if (!(element = $(element))) return;
+return Element.classNames(element).remove(className);
+},
+cleanWhitespace: function(element) {
+element = $(element);
+for (var i = 0; i < element.childNodes.length; i++) {
+var node = element.childNodes[i];
+if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
Element.remove(node);
}
-}
-},empty:function(_171){
-return $(_171).innerHTML.match(/^\s*$/);
-},scrollTo:function(_172){
-_172=$(_172);
-var x=_172.x?_172.x:_172.offsetLeft,y=_172.y?_172.y:_172.offsetTop;
-window.scrollTo(x,y);
-},getStyle:function(_173,_174){
-_173=$(_173);
-var _175=_173.style[_174.camelize()];
-if(!_175){
-if(document.defaultView&&document.defaultView.getComputedStyle){
-var css=document.defaultView.getComputedStyle(_173,null);
-_175=css?css.getPropertyValue(_174):null;
-}else{
-if(_173.currentStyle){
-_175=_173.currentStyle[_174.camelize()];
-}
-}
-}
-if(window.opera&&["left","top","right","bottom"].include(_174)){
-if(Element.getStyle(_173,"position")=="static"){
-_175="auto";
-}
-}
-return _175=="auto"?null:_175;
-},setStyle:function(_177,_178){
-_177=$(_177);
-for(name in _178){
-_177.style[name.camelize()]=_178[name];
-}
-},getDimensions:function(_179){
-_179=$(_179);
-if(Element.getStyle(_179,"display")!="none"){
-return {width:_179.offsetWidth,height:_179.offsetHeight};
-}
-var els=_179.style;
-var _181=els.visibility;
-var _182=els.position;
-els.visibility="hidden";
-els.position="absolute";
-els.display="";
-var _183=_179.clientWidth;
-var _184=_179.clientHeight;
-els.display="none";
-els.position=_182;
-els.visibility=_181;
-return {width:_183,height:_184};
-},makePositioned:function(_185){
-_185=$(_185);
-var pos=Element.getStyle(_185,"position");
-if(pos=="static"||!pos){
-_185._madePositioned=true;
-_185.style.position="relative";
-if(window.opera){
-_185.style.top=0;
-_185.style.left=0;
-}
-}
-},undoPositioned:function(_187){
-_187=$(_187);
-if(_187._madePositioned){
-_187._madePositioned=undefined;
-_187.style.position=_187.style.top=_187.style.left=_187.style.bottom=_187.style.right="";
-}
-},makeClipping:function(_188){
-_188=$(_188);
-if(_188._overflow){
-return;
-}
-_188._overflow=_188.style.overflow;
-if((Element.getStyle(_188,"overflow")||"visible")!="hidden"){
-_188.style.overflow="hidden";
-}
-},undoClipping:function(_189){
-_189=$(_189);
-if(_189._overflow){
-return;
-}
-_189.style.overflow=_189._overflow;
-_189._overflow=undefined;
-}});
-var Toggle=new Object();
-Toggle.display=Element.toggle;
-Abstract.Insertion=function(_190){
-this.adjacency=_190;
-};
-Abstract.Insertion.prototype={initialize:function(_191,_192){
-this.element=$(_191);
-this.content=_192.stripScripts();
-if(this.adjacency&&this.element.insertAdjacentHTML){
-try{
-this.element.insertAdjacentHTML(this.adjacency,this.content);
-}
-catch(e){
-if(this.element.tagName.toLowerCase()=="tbody"){
+},
+empty: function(element) {
+return $(element).innerHTML.match(/^\s*$/);
+},
+childOf: function(element, ancestor) {
+element = $(element), ancestor = $(ancestor);
+while (element = element.parentNode)
+if (element == ancestor) return true;
+return false;
+},
+scrollTo: function(element) {
+element = $(element);
+var x = element.x ? element.x : element.offsetLeft,
+y = element.y ? element.y : element.offsetTop;
+window.scrollTo(x, y);
+},
+getStyle: function(element, style) {
+element = $(element);
+var value = element.style[style.camelize()];
+if (!value) {
+if (document.defaultView && document.defaultView.getComputedStyle) {
+var css = document.defaultView.getComputedStyle(element, null);
+value = css ? css.getPropertyValue(style) : null;
+} else if (element.currentStyle) {
+value = element.currentStyle[style.camelize()];
+}
+}
+if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
+if (Element.getStyle(element, 'position') == 'static') value = 'auto';
+return value == 'auto' ? null : value;
+},
+setStyle: function(element, style) {
+element = $(element);
+for (var name in style)
+element.style[name.camelize()] = style[name];
+},
+getDimensions: function(element) {
+element = $(element);
+if (Element.getStyle(element, 'display') != 'none')
+return {width: element.offsetWidth, height: element.offsetHeight};
+var els = element.style;
+var originalVisibility = els.visibility;
+var originalPosition = els.position;
+els.visibility = 'hidden';
+els.position = 'absolute';
+els.display = '';
+var originalWidth = element.clientWidth;
+var originalHeight = element.clientHeight;
+els.display = 'none';
+els.position = originalPosition;
+els.visibility = originalVisibility;
+return {width: originalWidth, height: originalHeight};
+},
+makePositioned: function(element) {
+element = $(element);
+var pos = Element.getStyle(element, 'position');
+if (pos == 'static' || !pos) {
+element._madePositioned = true;
+element.style.position = 'relative';
+if (window.opera) {
+element.style.top = 0;
+element.style.left = 0;
+}
+}
+},
+undoPositioned: function(element) {
+element = $(element);
+if (element._madePositioned) {
+element._madePositioned = undefined;
+element.style.position =
+element.style.top =
+element.style.left =
+element.style.bottom =
+element.style.right = '';
+}
+},
+makeClipping: function(element) {
+element = $(element);
+if (element._overflow) return;
+element._overflow = element.style.overflow;
+if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
+element.style.overflow = 'hidden';
+},
+undoClipping: function(element) {
+element = $(element);
+if (element._overflow) return;
+element.style.overflow = element._overflow;
+element._overflow = undefined;
+}
+}
+Object.extend(Element, Element.Methods);
+var _nativeExtensions = false;
+if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+var HTMLElement = {}
+HTMLElement.prototype = document.createElement('div').__proto__;
+}
+Element.addMethods = function(methods) {
+Object.extend(Element.Methods, methods || {});
+if(typeof HTMLElement != 'undefined') {
+var methods = Element.Methods, cache = Element.extend.cache;
+for (property in methods) {
+var value = methods[property];
+if (typeof value == 'function')
+HTMLElement.prototype[property] = cache.findOrStore(value);
+}
+_nativeExtensions = true;
+}
+}
+Element.addMethods();
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+Abstract.Insertion = function(adjacency) {
+this.adjacency = adjacency;
+}
+Abstract.Insertion.prototype = {
+initialize: function(element, content) {
+this.element = $(element);
+this.content = content.stripScripts();
+if (this.adjacency && this.element.insertAdjacentHTML) {
+try {
+this.element.insertAdjacentHTML(this.adjacency, this.content);
+} catch (e) {
+var tagName = this.element.tagName.toLowerCase();
+if (tagName == 'tbody' || tagName == 'tr') {
this.insertContent(this.contentFromAnonymousTable());
-}else{
+} else {
throw e;
}
}
-}else{
-this.range=this.element.ownerDocument.createRange();
-if(this.initializeRange){
-this.initializeRange();
-}
+} else {
+this.range = this.element.ownerDocument.createRange();
+if (this.initializeRange) this.initializeRange();
this.insertContent([this.range.createContextualFragment(this.content)]);
}
-setTimeout(function(){
-_192.evalScripts();
-},10);
-},contentFromAnonymousTable:function(){
-var div=document.createElement("div");
-div.innerHTML="<table><tbody>"+this.content+"</tbody></table>";
+setTimeout(function() {content.evalScripts()}, 10);
+},
+contentFromAnonymousTable: function() {
+var div = document.createElement('div');
+div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
return $A(div.childNodes[0].childNodes[0].childNodes);
-}};
-var Insertion=new Object();
-Insertion.Before=Class.create();
-Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){
+}
+}
+var Insertion = new Object();
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+initializeRange: function() {
this.range.setStartBefore(this.element);
-},insertContent:function(_193){
-_193.each((function(_194){
-this.element.parentNode.insertBefore(_194,this.element);
+},
+insertContent: function(fragments) {
+fragments.each((function(fragment) {
+this.element.parentNode.insertBefore(fragment, this.element);
}).bind(this));
-}});
-Insertion.Top=Class.create();
-Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){
+}
+});
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+initializeRange: function() {
this.range.selectNodeContents(this.element);
this.range.collapse(true);
-},insertContent:function(_195){
-_195.reverse(false).each((function(_196){
-this.element.insertBefore(_196,this.element.firstChild);
+},
+insertContent: function(fragments) {
+fragments.reverse(false).each((function(fragment) {
+this.element.insertBefore(fragment, this.element.firstChild);
}).bind(this));
-}});
-Insertion.Bottom=Class.create();
-Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){
+}
+});
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+initializeRange: function() {
this.range.selectNodeContents(this.element);
this.range.collapse(this.element);
-},insertContent:function(_197){
-_197.each((function(_198){
-this.element.appendChild(_198);
+},
+insertContent: function(fragments) {
+fragments.each((function(fragment) {
+this.element.appendChild(fragment);
}).bind(this));
-}});
-Insertion.After=Class.create();
-Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){
+}
+});
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+initializeRange: function() {
this.range.setStartAfter(this.element);
-},insertContent:function(_199){
-_199.each((function(_200){
-this.element.parentNode.insertBefore(_200,this.element.nextSibling);
+},
+insertContent: function(fragments) {
+fragments.each((function(fragment) {
+this.element.parentNode.insertBefore(fragment,
+this.element.nextSibling);
}).bind(this));
-}});
-Element.ClassNames=Class.create();
-Element.ClassNames.prototype={initialize:function(_201){
-this.element=$(_201);
-},_each:function(_202){
-this.element.className.split(/\s+/).select(function(name){
-return name.length>0;
-})._each(_202);
-},set:function(_204){
-this.element.className=_204;
-},add:function(_205){
-if(this.include(_205)){
-return;
-}
-this.set(this.toArray().concat(_205).join(" "));
-},remove:function(_206){
-if(!this.include(_206)){
-return;
-}
-this.set(this.select(function(_207){
-return _207!=_206;
-}).join(" "));
-},toString:function(){
-return this.toArray().join(" ");
-}};
-Object.extend(Element.ClassNames.prototype,Enumerable);
-Object.extend(Element,{condClassName:function(_208,_209,cond){
-(cond?Element.addClassName:Element.removeClassName)(_208,_209);
-}});
-var Field={clear:function(){
-for(var i=0;i<arguments.length;i++){
-$(arguments[i]).value="";
-}
-},focus:function(_211){
-$(_211).focus();
-},present:function(){
-for(var i=0;i<arguments.length;i++){
-if($(arguments[i]).value==""){
-return false;
-}
}
+});
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+initialize: function(element) {
+this.element = $(element);
+},
+_each: function(iterator) {
+this.element.className.split(/\s+/).select(function(name) {
+return name.length > 0;
+})._each(iterator);
+},
+set: function(className) {
+this.element.className = className;
+},
+add: function(classNameToAdd) {
+if (this.include(classNameToAdd)) return;
+this.set(this.toArray().concat(classNameToAdd).join(' '));
+},
+remove: function(classNameToRemove) {
+if (!this.include(classNameToRemove)) return;
+this.set(this.select(function(className) {
+return className != classNameToRemove;
+}).join(' '));
+},
+toString: function() {
+return this.toArray().join(' ');
+}
+}
+Object.extend(Element.ClassNames.prototype, Enumerable);
+var Field = {
+clear: function() {
+for (var i = 0; i < arguments.length; i++)
+$(arguments[i]).value = '';
+},
+focus: function(element) {
+$(element).focus();
+},
+present: function() {
+for (var i = 0; i < arguments.length; i++)
+if ($(arguments[i]).value == '') return false;
return true;
-},select:function(_212){
-$(_212).select();
-},activate:function(_213){
-_213=$(_213);
-_213.focus();
-if(_213.select){
-_213.select();
-}
-}};
-var Form={serialize:function(form){
-var _215=Form.getElements($(form));
-var _216=new Array();
-for(var i=0;i<_215.length;i++){
-var _217=Form.Element.serialize(_215[i]);
-if(_217){
-_216.push(_217);
-}
-}
-return _216.join("&");
-},getElements:function(form){
-form=$(form);
-var _218=new Array();
-for(tagName in Form.Element.Serializers){
-var _219=form.getElementsByTagName(tagName);
-for(var j=0;j<_219.length;j++){
-_218.push(_219[j]);
-}
-}
-return _218;
-},getInputs:function(form,_221,name){
-form=$(form);
-var _222=form.getElementsByTagName("input");
-if(!_221&&!name){
-return _222;
-}
-var _223=new Array();
-for(var i=0;i<_222.length;i++){
-var _224=_222[i];
-if((_221&&_224.type!=_221)||(name&&_224.name!=name)){
+},
+select: function(element) {
+$(element).select();
+},
+activate: function(element) {
+element = $(element);
+element.focus();
+if (element.select)
+element.select();
+}
+}
+var Form = {
+serialize: function(form) {
+var elements = Form.getElements($(form));
+var queryComponents = new Array();
+for (var i = 0; i < elements.length; i++) {
+var queryComponent = Form.Element.serialize(elements[i]);
+if (queryComponent)
+queryComponents.push(queryComponent);
+}
+return queryComponents.join('&');
+},
+getElements: function(form) {
+form = $(form);
+var elements = new Array();
+for (var tagName in Form.Element.Serializers) {
+var tagElements = form.getElementsByTagName(tagName);
+for (var j = 0; j < tagElements.length; j++)
+elements.push(tagElements[j]);
+}
+return elements;
+},
+getInputs: function(form, typeName, name) {
+form = $(form);
+var inputs = form.getElementsByTagName('input');
+if (!typeName && !name)
+return inputs;
+var matchingInputs = new Array();
+for (var i = 0; i < inputs.length; i++) {
+var input = inputs[i];
+if ((typeName && input.type != typeName) ||
+(name && input.name != name))
continue;
-}
-_223.push(_224);
-}
-return _223;
-},disable:function(form){
-var _225=Form.getElements(form);
-for(var i=0;i<_225.length;i++){
-var _226=_225[i];
-_226.blur();
-_226.disabled="true";
-}
-},enable:function(form){
-var _227=Form.getElements(form);
-for(var i=0;i<_227.length;i++){
-var _228=_227[i];
-_228.disabled="";
-}
-},findFirstElement:function(form){
-return Form.getElements(form).find(function(_229){
-return _229.type!="hidden"&&!_229.disabled&&["input","select","textarea"].include(_229.tagName.toLowerCase());
+matchingInputs.push(input);
+}
+return matchingInputs;
+},
+disable: function(form) {
+var elements = Form.getElements(form);
+for (var i = 0; i < elements.length; i++) {
+var element = elements[i];
+element.blur();
+element.disabled = 'true';
+}
+},
+enable: function(form) {
+var elements = Form.getElements(form);
+for (var i = 0; i < elements.length; i++) {
+var element = elements[i];
+element.disabled = '';
+}
+},
+findFirstElement: function(form) {
+return Form.getElements(form).find(function(element) {
+return element.type != 'hidden' && !element.disabled &&
+['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
});
-},focusFirstElement:function(form){
+},
+focusFirstElement: function(form) {
Field.activate(Form.findFirstElement(form));
-},reset:function(form){
+},
+reset: function(form) {
$(form).reset();
-}};
-Form.Element={serialize:function(_230){
-_230=$(_230);
-var _231=_230.tagName.toLowerCase();
-var _232=Form.Element.Serializers[_231](_230);
-if(_232){
-var key=encodeURIComponent(_232[0]);
-if(key.length==0){
-return;
}
-if(_232[1].constructor!=Array){
-_232[1]=[_232[1]];
-}
-return _232[1].map(function(_234){
-return key+"="+encodeURIComponent(_234);
-}).join("&");
-}
-},getValue:function(_235){
-_235=$(_235);
-var _236=_235.tagName.toLowerCase();
-var _237=Form.Element.Serializers[_236](_235);
-if(_237){
-return _237[1];
-}
-}};
-Form.Element.Serializers={input:function(_238){
-switch(_238.type.toLowerCase()){
-case "submit":
-case "hidden":
-case "password":
-case "text":
-return Form.Element.Serializers.textarea(_238);
-case "checkbox":
-case "radio":
-return Form.Element.Serializers.inputSelector(_238);
+}
+Form.Element = {
+serialize: function(element) {
+element = $(element);
+var method = element.tagName.toLowerCase();
+var parameter = Form.Element.Serializers[method](element);
+if (parameter) {
+var key = encodeURIComponent(parameter[0]);
+if (key.length == 0) return;
+if (parameter[1].constructor != Array)
+parameter[1] = [parameter[1]];
+return parameter[1].map(function(value) {
+return key + '=' + encodeURIComponent(value);
+}).join('&');
+}
+},
+getValue: function(element) {
+element = $(element);
+var method = element.tagName.toLowerCase();
+var parameter = Form.Element.Serializers[method](element);
+if (parameter)
+return parameter[1];
+}
+}
+Form.Element.Serializers = {
+input: function(element) {
+switch (element.type.toLowerCase()) {
+case 'submit':
+case 'hidden':
+case 'password':
+case 'text':
+return Form.Element.Serializers.textarea(element);
+case 'checkbox':
+case 'radio':
+return Form.Element.Serializers.inputSelector(element);
}
return false;
-},inputSelector:function(_239){
-if(_239.checked){
-return [_239.name,_239.value];
-}
-},textarea:function(_240){
-return [_240.name,_240.value];
-},select:function(_241){
-return Form.Element.Serializers[_241.type=="select-one"?"selectOne":"selectMany"](_241);
-},selectOne:function(_242){
-var _243="",opt,index=_242.selectedIndex;
-if(index>=0){
-opt=_242.options[index];
-_243=opt.value;
-if(!_243&&!("value" in opt)){
-_243=opt.text;
-}
-}
-return [_242.name,_243];
-},selectMany:function(_244){
-var _245=new Array();
-for(var i=0;i<_244.length;i++){
-var opt=_244.options[i];
-if(opt.selected){
-var _247=opt.value;
-if(!_247&&!("value" in opt)){
-_247=opt.text;
-}
-_245.push(_247);
-}
-}
-return [_244.name,_245];
-}};
-var $F=Form.Element.getValue;
-Abstract.TimedObserver=function(){
-};
-Abstract.TimedObserver.prototype={initialize:function(_248,_249,_250){
-this.frequency=_249;
-this.element=$(_248);
-this.callback=_250;
-this.lastValue=this.getValue();
+},
+inputSelector: function(element) {
+if (element.checked)
+return [element.name, element.value];
+},
+textarea: function(element) {
+return [element.name, element.value];
+},
+select: function(element) {
+return Form.Element.Serializers[element.type == 'select-one' ?
+'selectOne' : 'selectMany'](element);
+},
+selectOne: function(element) {
+var value = '', opt, index = element.selectedIndex;
+if (index >= 0) {
+opt = element.options[index];
+value = opt.value || opt.text;
+}
+return [element.name, value];
+},
+selectMany: function(element) {
+var value = [];
+for (var i = 0; i < element.length; i++) {
+var opt = element.options[i];
+if (opt.selected)
+value.push(opt.value || opt.text);
+}
+return [element.name, value];
+}
+}
+var $F = Form.Element.getValue;
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+initialize: function(element, frequency, callback) {
+this.frequency = frequency;
+this.element = $(element);
+this.callback= callback;
+this.lastValue = this.getValue();
this.registerCallback();
-},registerCallback:function(){
-setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
-},onTimerEvent:function(){
-var _251=this.getValue();
-if(this.lastValue!=_251){
-this.callback(this.element,_251);
-this.lastValue=_251;
-}
-}};
-Form.Element.Observer=Class.create();
-Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
-return Form.Element.getValue(this.element);
-}});
-Form.Observer=Class.create();
-Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
-return Form.serialize(this.element);
-}});
-Abstract.EventObserver=function(){
-};
-Abstract.EventObserver.prototype={initialize:function(_252,_253){
-this.element=$(_252);
-this.callback=_253;
-this.lastValue=this.getValue();
-if(this.element.tagName.toLowerCase()=="form"){
-this.registerFormCallbacks();
-}else{
-this.registerCallback(this.element);
+},
+registerCallback: function() {
+setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+},
+onTimerEvent: function() {
+var value = this.getValue();
+if (this.lastValue != value) {
+this.callback(this.element, value);
+this.lastValue = value;
}
-},onElementEvent:function(){
-var _254=this.getValue();
-if(this.lastValue!=_254){
-this.callback(this.element,_254);
-this.lastValue=_254;
-}
-},registerFormCallbacks:function(){
-var _255=Form.getElements(this.element);
-for(var i=0;i<_255.length;i++){
-this.registerCallback(_255[i]);
-}
-},registerCallback:function(_256){
-if(_256.type){
-switch(_256.type.toLowerCase()){
-case "checkbox":
-case "radio":
-Event.observe(_256,"click",this.onElementEvent.bind(this));
-break;
-case "password":
-case "text":
-case "textarea":
-case "select-one":
-case "select-multiple":
-Event.observe(_256,"change",this.onElementEvent.bind(this));
-break;
}
}
-}};
-Form.Element.EventObserver=Class.create();
-Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+getValue: function() {
return Form.Element.getValue(this.element);
-}});
-Form.EventObserver=Class.create();
-Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
-return Form.serialize(this.element);
-}});
-if(!window.Event){
-var Event=new Object();
-}
-Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_257){
-return _257.target||_257.srcElement;
-},isLeftClick:function(_258){
-return (((_258.which)&&(_258.which==1))||((_258.button)&&(_258.button==1)));
-},pointerX:function(_259){
-return _259.pageX||(_259.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
-},pointerY:function(_260){
-return _260.pageY||(_260.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
-},stop:function(_261){
-if(_261.preventDefault){
-_261.preventDefault();
-_261.stopPropagation();
-}else{
-_261.returnValue=false;
-_261.cancelBubble=true;
-}
-},findElement:function(_262,_263){
-var _264=Event.element(_262);
-while(_264.parentNode&&(!_264.tagName||(_264.tagName.toUpperCase()!=_263.toUpperCase()))){
-_264=_264.parentNode;
-}
-return _264;
-},observers:false,_observeAndCache:function(_265,name,_266,_267){
-if(!this.observers){
-this.observers=[];
-}
-if(_265.addEventListener){
-this.observers.push([_265,name,_266,_267]);
-_265.addEventListener(name,_266,_267);
-}else{
-if(_265.attachEvent){
-this.observers.push([_265,name,_266,_267]);
-_265.attachEvent("on"+name,_266);
-}
-}
-},unloadCache:function(){
-if(!Event.observers){
-return;
-}
-for(var i=0;i<Event.observers.length;i++){
-Event.stopObserving.apply(this,Event.observers[i]);
-Event.observers[i][0]=null;
-}
-Event.observers=false;
-},observe:function(_268,name,_269,_270){
-var _268=$(_268);
-_270=_270||false;
-if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_268.attachEvent)){
-name="keydown";
-}
-this._observeAndCache(_268,name,_269,_270);
-},stopObserving:function(_271,name,_272,_273){
-var _271=$(_271);
-_273=_273||false;
-if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_271.detachEvent)){
-name="keydown";
-}
-if(_271.removeEventListener){
-_271.removeEventListener(name,_272,_273);
-}else{
-if(_271.detachEvent){
-_271.detachEvent("on"+name,_272);
-}
-}
-}});
-Event.observe(window,"unload",Event.unloadCache,false);
-Object.extend(Event,{OnLoad:function(fn){
-var w=document.addEventListener&&!window.addEventListener?document:window;
-Event.__observe(w,"load",fn);
-},observe:function(_276,name,_277,_278){
-if(!isList(_276)){
-return this.__observe(_276,name,_277,_278);
-}
-for(var i=0;i<_276.length;i++){
-this.__observe(_276[i],name,_277,_278);
-}
-},__observe:function(_279,name,_280,_281){
-var _279=$(_279);
-_281=_281||false;
-if(name=="keypress"&&((navigator.appVersion.indexOf("AppleWebKit")>0)||_279.attachEvent)){
-name="keydown";
-}
-this._observeAndCache(_279,name,_280,_281);
-},keyCode:function(e){
-return e.keyCode!=null?e.keyCode:e.charCode;
-},isHTMLEvent:function(type){
-var _284=["abort","blur","change","error","focus","load","reset","resize","scroll","select","submit","unload"];
-return _284.include(type);
-},isMouseEvent:function(type){
-var _285=["click","mousedown","mousemove","mouseout","mouseover","mouseup"];
-return _285.include(type);
-},fireEvent:function(_286,type){
-_286=$(_286);
-if(document.createEvent){
-if(Event.isHTMLEvent(type)){
-var _287=document.createEvent("HTMLEvents");
-_287.initEvent(type,true,true);
-}else{
-if(Event.isMouseEvent(type)){
-var _287=document.createEvent("MouseEvents");
-_287.initMouseEvent(type,true,true,document.defaultView,1,0,0,0,0,false,false,false,false,0,null);
-}else{
-if(Logger){
-Logger.error("undefined event",type);
-}
-return;
}
+});
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+getValue: function() {
+return Form.serialize(this.element);
}
-_286.dispatchEvent(_287);
-}else{
-if(_286.fireEvent){
-_286.fireEvent("on"+type);
-_286[type]();
-}else{
-_286[type]();
-}
-}
-}});
-var Position={includeScrollOffsets:false,prepare:function(){
-this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
-this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
-},realOffset:function(_288){
-var _289=0,valueL=0;
-do{
-_289+=_288.scrollTop||0;
-valueL+=_288.scrollLeft||0;
-_288=_288.parentNode;
-}while(_288);
-return [valueL,_289];
-},cumulativeOffset:function(_290){
-var _291=0,valueL=0;
-do{
-_291+=_290.offsetTop||0;
-valueL+=_290.offsetLeft||0;
-_290=_290.offsetParent;
-}while(_290);
-return [valueL,_291];
-},positionedOffset:function(_292){
-var _293=0,valueL=0;
-do{
-_293+=_292.offsetTop||0;
-valueL+=_292.offsetLeft||0;
-_292=_292.offsetParent;
-if(_292){
-p=Element.getStyle(_292,"position");
-if(p=="relative"||p=="absolute"){
+});
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+initialize: function(element, callback) {
+this.element= $(element);
+this.callback = callback;
+this.lastValue = this.getValue();
+if (this.element.tagName.toLowerCase() == 'form')
+this.registerFormCallbacks();
+else
+this.registerCallback(this.element);
+},
+onElementEvent: function() {
+var value = this.getValue();
+if (this.lastValue != value) {
+this.callback(this.element, value);
+this.lastValue = value;
+}
+},
+registerFormCallbacks: function() {
+var elements = Form.getElements(this.element);
+for (var i = 0; i < elements.length; i++)
+this.registerCallback(elements[i]);
+},
+registerCallback: function(element) {
+if (element.type) {
+switch (element.type.toLowerCase()) {
+case 'checkbox':
+case 'radio':
+Event.observe(element, 'click', this.onElementEvent.bind(this));
break;
-}
-}
-}while(_292);
-return [valueL,_293];
-},offsetParent:function(_294){
-if(_294.offsetParent){
-return _294.offsetParent;
-}
-if(_294==document.body){
-return _294;
-}
-while((_294=_294.parentNode)&&_294!=document.body){
-if(Element.getStyle(_294,"position")!="static"){
-return _294;
-}
-}
-return document.body;
-},within:function(_295,x,y){
-if(this.includeScrollOffsets){
-return this.withinIncludingScrolloffsets(_295,x,y);
-}
-this.xcomp=x;
-this.ycomp=y;
-this.offset=this.cumulativeOffset(_295);
-return (y>=this.offset[1]&&y<this.offset[1]+_295.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_295.offsetWidth);
-},withinIncludingScrolloffsets:function(_297,x,y){
-var _298=this.realOffset(_297);
-this.xcomp=x+_298[0]-this.deltaX;
-this.ycomp=y+_298[1]-this.deltaY;
-this.offset=this.cumulativeOffset(_297);
-return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_297.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_297.offsetWidth);
-},overlap:function(mode,_300){
-if(!mode){
-return 0;
-}
-if(mode=="vertical"){
-return ((this.offset[1]+_300.offsetHeight)-this.ycomp)/_300.offsetHeight;
-}
-if(mode=="horizontal"){
-return ((this.offset[0]+_300.offsetWidth)-this.xcomp)/_300.offsetWidth;
-}
-},clone:function(_301,_302){
-_301=$(_301);
-_302=$(_302);
-_302.style.position="absolute";
-var _303=this.cumulativeOffset(_301);
-_302.style.top=_303[1]+"px";
-_302.style.left=_303[0]+"px";
-_302.style.width=_301.offsetWidth+"px";
-_302.style.height=_301.offsetHeight+"px";
-},page:function(_304){
-var _305=0,valueL=0;
-var _306=_304;
-do{
-_305+=_306.offsetTop||0;
-valueL+=_306.offsetLeft||0;
-if(_306.offsetParent==document.body){
-if(Element.getStyle(_306,"position")=="absolute"){
+case 'password':
+case 'text':
+case 'textarea':
+case 'select-one':
+case 'select-multiple':
+Event.observe(element, 'change', this.onElementEvent.bind(this));
break;
}
}
-}while(_306=_306.offsetParent);
-_306=_304;
-do{
-_305-=_306.scrollTop||0;
-valueL-=_306.scrollLeft||0;
-}while(_306=_306.parentNode);
-return [valueL,_305];
-},clone:function(_307,_308){
-var _309=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
-_307=$(_307);
-var p=Position.page(_307);
-_308=$(_308);
-var _310=[0,0];
-var _311=null;
-if(Element.getStyle(_308,"position")=="absolute"){
-_311=Position.offsetParent(_308);
-_310=Position.page(_311);
-}
-if(_311==document.body){
-_310[0]-=document.body.offsetLeft;
-_310[1]-=document.body.offsetTop;
-}
-if(_309.setLeft){
-_308.style.left=(p[0]-_310[0]+_309.offsetLeft)+"px";
-}
-if(_309.setTop){
-_308.style.top=(p[1]-_310[1]+_309.offsetTop)+"px";
-}
-if(_309.setWidth){
-_308.style.width=_307.offsetWidth+"px";
-}
-if(_309.setHeight){
-_308.style.height=_307.offsetHeight+"px";
-}
-},absolutize:function(_312){
-_312=$(_312);
-if(_312.style.position=="absolute"){
-return;
-}
-Position.prepare();
-var _313=Position.positionedOffset(_312);
-var top=_313[1];
-var left=_313[0];
-var _315=_312.clientWidth;
-var _316=_312.clientHeight;
-_312._originalLeft=left-parseFloat(_312.style.left||0);
-_312._originalTop=top-parseFloat(_312.style.top||0);
-_312._originalWidth=_312.style.width;
-_312._originalHeight=_312.style.height;
-_312.style.position="absolute";
-_312.style.top=top+"px";
-_312.style.left=left+"px";
-_312.style.width=_315+"px";
-_312.style.height=_316+"px";
-},relativize:function(_317){
-_317=$(_317);
-if(_317.style.position=="relative"){
-return;
-}
-Position.prepare();
-_317.style.position="relative";
-var top=parseFloat(_317.style.top||0)-(_317._originalTop||0);
-var left=parseFloat(_317.style.left||0)-(_317._originalLeft||0);
-_317.style.top=top+"px";
-_317.style.left=left+"px";
-_317.style.height=_317._originalHeight;
-_317.style.width=_317._originalWidth;
-}};
-if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
-Position.cumulativeOffset=function(_318){
-var _319=0,valueL=0;
-do{
-_319+=_318.offsetTop||0;
-valueL+=_318.offsetLeft||0;
-if(_318.offsetParent==document.body){
-if(Element.getStyle(_318,"position")=="absolute"){
-break;
-}
}
-_318=_318.offsetParent;
-}while(_318);
-return [valueL,_319];
-};
}
-var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_320){
-_320=_320.toUpperCase();
-var _321=this.NODEMAP[_320]||"div";
-var _322=document.createElement(_321);
-try{
-_322.innerHTML="<"+_320+"></"+_320+">";
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+getValue: function() {
+return Form.Element.getValue(this.element);
}
-catch(e){
+});
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+getValue: function() {
+return Form.serialize(this.element);
}
-var _323=_322.firstChild||null;
-if(_323&&(_323.tagName!=_320)){
-_323=_323.getElementsByTagName(_320)[0];
+});
+if (!window.Event) {
+var Event = new Object();
+}
+Object.extend(Event, {
+KEY_BACKSPACE: 8,
+KEY_TAB: 9,
+KEY_RETURN: 13,
+KEY_ESC:27,
+KEY_LEFT: 37,
+KEY_UP: 38,
+KEY_RIGHT:39,
+KEY_DOWN: 40,
+KEY_DELETE: 46,
+element: function(event) {
+return event.target || event.srcElement;
+},
+isLeftClick: function(event) {
+return (((event.which) && (event.which == 1)) ||
+((event.button) && (event.button == 1)));
+},
+pointerX: function(event) {
+return event.pageX || (event.clientX +
+(document.documentElement.scrollLeft || document.body.scrollLeft));
+},
+pointerY: function(event) {
+return event.pageY || (event.clientY +
+(document.documentElement.scrollTop || document.body.scrollTop));
+},
+stop: function(event) {
+if (event.preventDefault) {
+event.preventDefault();
+event.stopPropagation();
+} else {
+event.returnValue = false;
+event.cancelBubble = true;
+}
+},
+findElement: function(event, tagName) {
+var element = Event.element(event);
+while (element.parentNode && (!element.tagName ||
+(element.tagName.toUpperCase() != tagName.toUpperCase())))
+element = element.parentNode;
+return element;
+},
+observers: false,
+_observeAndCache: function(element, name, observer, useCapture) {
+if (!this.observers) this.observers = [];
+if (element.addEventListener) {
+this.observers.push([element, name, observer, useCapture]);
+element.addEventListener(name, observer, useCapture);
+} else if (element.attachEvent) {
+this.observers.push([element, name, observer, useCapture]);
+element.attachEvent('on' + name, observer);
+}
+},
+unloadCache: function() {
+if (!Event.observers) return;
+for (var i = 0; i < Event.observers.length; i++) {
+Event.stopObserving.apply(this, Event.observers[i]);
+Event.observers[i][0] = null;
+}
+Event.observers = false;
+},
+observe: function(element, name, observer, useCapture) {
+var element = $(element);
+useCapture = useCapture || false;
+if (name == 'keypress' &&
+(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+|| element.attachEvent))
+name = 'keydown';
+this._observeAndCache(element, name, observer, useCapture);
+},
+stopObserving: function(element, name, observer, useCapture) {
+var element = $(element);
+useCapture = useCapture || false;
+if (name == 'keypress' &&
+(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+|| element.detachEvent))
+name = 'keydown';
+if (element.removeEventListener) {
+element.removeEventListener(name, observer, useCapture);
+} else if (element.detachEvent) {
+element.detachEvent('on' + name, observer);
}
-if(!_323){
-_323=document.createElement(_320);
}
-if(!_323){
+});
+if (navigator.appVersion.match(/\bMSIE\b/))
+Event.observe(window, 'unload', Event.unloadCache, false);
+Object.extend(Event,
+{
+OnLoad : function (fn)
+{
+var w = document.addEventListener &&
+!window.addEventListener ? document : window;
+Event.observe(w,'load',fn);
+},
+keyCode : function(e)
+{
+ return e.keyCode != null ? e.keyCode : e.charCode
+},
+isHTMLEvent : function(type)
+{
+var events = ['abort', 'blur', 'change', 'error', 'focus',
+'load', 'reset', 'resize', 'scroll', 'select',
+'submit', 'unload'];
+return events.include(type);
+},
+isMouseEvent : function(type)
+{
+var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+'mouseover', 'mouseup'];
+return events.include(type);
+},
+fireEvent : function(element,type)
+{
+element = $(element);
+if(document.createEvent)
+{
+if(Event.isHTMLEvent(type))
+{
+var event = document.createEvent('HTMLEvents');
+event.initEvent(type, true, true);
+}
+else if(Event.isMouseEvent(type))
+{
+var event = document.createEvent('MouseEvents');
+event.initMouseEvent(type,true,true,
+document.defaultView, 1, 0, 0, 0, 0, false,
+false, false, false, 0, null);
+}
+else
+{
+if(Logger)
+Logger.error("undefined event", type);
return;
}
-if(arguments[1]){
-if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){
-this._children(_323,arguments[1]);
-}else{
-var _324=this._attributes(arguments[1]);
-if(_324.length){
-try{
-_322.innerHTML="<"+_320+" "+_324+"></"+_320+">";
-}
-catch(e){
-}
-_323=_322.firstChild||null;
-if(!_323){
-_323=document.createElement(_320);
-for(attr in arguments[1]){
-_323[attr=="class"?"className":attr]=arguments[1][attr];
+element.dispatchEvent(event);
}
+else if(element.fireEvent)
+{
+element.fireEvent('on'+type);
+element[type]();
}
-if(_323.tagName!=_320){
-_323=_322.getElementsByTagName(_320)[0];
+else
+element[type]();
}
+});
+var Position = {
+ includeScrollOffsets: false,
+prepare: function() {
+this.deltaX =window.pageXOffset
+|| document.documentElement.scrollLeft
+|| document.body.scrollLeft
+|| 0;
+this.deltaY =window.pageYOffset
+|| document.documentElement.scrollTop
+|| document.body.scrollTop
+|| 0;
+},
+realOffset: function(element) {
+var valueT = 0, valueL = 0;
+do {
+valueT += element.scrollTop|| 0;
+valueL += element.scrollLeft || 0;
+element = element.parentNode;
+} while (element);
+return [valueL, valueT];
+},
+cumulativeOffset: function(element) {
+var valueT = 0, valueL = 0;
+do {
+valueT += element.offsetTop|| 0;
+valueL += element.offsetLeft || 0;
+element = element.offsetParent;
+} while (element);
+return [valueL, valueT];
+},
+positionedOffset: function(element) {
+var valueT = 0, valueL = 0;
+do {
+valueT += element.offsetTop|| 0;
+valueL += element.offsetLeft || 0;
+element = element.offsetParent;
+if (element) {
+p = Element.getStyle(element, 'position');
+if (p == 'relative' || p == 'absolute') break;
+}
+} while (element);
+return [valueL, valueT];
+},
+offsetParent: function(element) {
+if (element.offsetParent) return element.offsetParent;
+if (element == document.body) return element;
+while ((element = element.parentNode) && element != document.body)
+if (Element.getStyle(element, 'position') != 'static')
+return element;
+return document.body;
+},
+within: function(element, x, y) {
+if (this.includeScrollOffsets)
+return this.withinIncludingScrolloffsets(element, x, y);
+this.xcomp = x;
+this.ycomp = y;
+this.offset = this.cumulativeOffset(element);
+return (y >= this.offset[1] &&
+y <this.offset[1] + element.offsetHeight &&
+x >= this.offset[0] &&
+x <this.offset[0] + element.offsetWidth);
+},
+withinIncludingScrolloffsets: function(element, x, y) {
+var offsetcache = this.realOffset(element);
+this.xcomp = x + offsetcache[0] - this.deltaX;
+this.ycomp = y + offsetcache[1] - this.deltaY;
+this.offset = this.cumulativeOffset(element);
+return (this.ycomp >= this.offset[1] &&
+this.ycomp <this.offset[1] + element.offsetHeight &&
+this.xcomp >= this.offset[0] &&
+this.xcomp <this.offset[0] + element.offsetWidth);
+},
+overlap: function(mode, element) {
+if (!mode) return 0;
+if (mode == 'vertical')
+return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+element.offsetHeight;
+if (mode == 'horizontal')
+return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+element.offsetWidth;
+},
+clone: function(source, target) {
+source = $(source);
+target = $(target);
+target.style.position = 'absolute';
+var offsets = this.cumulativeOffset(source);
+target.style.top= offsets[1] + 'px';
+target.style.left = offsets[0] + 'px';
+target.style.width= source.offsetWidth + 'px';
+target.style.height = source.offsetHeight + 'px';
+},
+page: function(forElement) {
+var valueT = 0, valueL = 0;
+var element = forElement;
+do {
+valueT += element.offsetTop|| 0;
+valueL += element.offsetLeft || 0;
+if (element.offsetParent==document.body)
+if (Element.getStyle(element,'position')=='absolute') break;
+} while (element = element.offsetParent);
+element = forElement;
+do {
+valueT -= element.scrollTop|| 0;
+valueL -= element.scrollLeft || 0;
+} while (element = element.parentNode);
+return [valueL, valueT];
+},
+clone: function(source, target) {
+var options = Object.extend({
+setLeft:true,
+setTop: true,
+setWidth: true,
+setHeight:true,
+offsetTop:0,
+offsetLeft: 0
+}, arguments[2] || {})
+source = $(source);
+var p = Position.page(source);
+target = $(target);
+var delta = [0, 0];
+var parent = null;
+if (Element.getStyle(target,'position') == 'absolute') {
+parent = Position.offsetParent(target);
+delta = Position.page(parent);
+}
+if (parent == document.body) {
+delta[0] -= document.body.offsetLeft;
+delta[1] -= document.body.offsetTop;
+}
+if(options.setLeft) target.style.left= (p[0] - delta[0] + options.offsetLeft) + 'px';
+if(options.setTop)target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
+if(options.setWidth)target.style.width = source.offsetWidth + 'px';
+if(options.setHeight) target.style.height = source.offsetHeight + 'px';
+},
+absolutize: function(element) {
+element = $(element);
+if (element.style.position == 'absolute') return;
+Position.prepare();
+var offsets = Position.positionedOffset(element);
+var top = offsets[1];
+var left= offsets[0];
+var width = element.clientWidth;
+var height= element.clientHeight;
+element._originalLeft = left - parseFloat(element.style.left|| 0);
+element._originalTop= top- parseFloat(element.style.top || 0);
+element._originalWidth= element.style.width;
+element._originalHeight = element.style.height;
+element.style.position = 'absolute';
+element.style.top= top + 'px';;
+element.style.left = left + 'px';;
+element.style.width= width + 'px';;
+element.style.height = height + 'px';;
+},
+relativize: function(element) {
+element = $(element);
+if (element.style.position == 'relative') return;
+Position.prepare();
+element.style.position = 'relative';
+var top= parseFloat(element.style.top|| 0) - (element._originalTop || 0);
+var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+element.style.top= top + 'px';
+element.style.left = left + 'px';
+element.style.height = element._originalHeight;
+element.style.width= element._originalWidth;
+}
+}
+if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+Position.cumulativeOffset = function(element) {
+var valueT = 0, valueL = 0;
+do {
+valueT += element.offsetTop|| 0;
+valueL += element.offsetLeft || 0;
+if (element.offsetParent == document.body)
+if (Element.getStyle(element, 'position') == 'absolute') break;
+element = element.offsetParent;
+} while (element);
+return [valueL, valueT];
+}
+}
+var Selector = Class.create();
+Selector.prototype = {
+initialize: function(expression) {
+this.params = {classNames: []};
+this.expression = expression.toString().strip();
+this.parseExpression();
+this.compileMatcher();
+},
+parseExpression: function() {
+function abort(message) { throw 'Parse error in selector: ' + message; }
+if (this.expression == '')abort('empty expression');
+var params = this.params, expr = this.expression, match, modifier, clause, rest;
+while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
+params.attributes = params.attributes || [];
+params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
+expr = match[1];
+}
+if (expr == '*') return this.params.wildcard = true;
+while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
+modifier = match[1], clause = match[2], rest = match[3];
+switch (modifier) {
+case '#': params.id = clause; break;
+case '.': params.classNames.push(clause); break;
+case '':
+case undefined: params.tagName = clause.toUpperCase(); break;
+default:abort(expr.inspect());
+}
+expr = rest;
+}
+if (expr.length > 0) abort(expr.inspect());
+},
+buildMatchExpression: function() {
+var params = this.params, conditions = [], clause;
+if (params.wildcard)
+conditions.push('true');
+if (clause = params.id)
+conditions.push('element.id == ' + clause.inspect());
+if (clause = params.tagName)
+conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
+if ((clause = params.classNames).length > 0)
+for (var i = 0; i < clause.length; i++)
+conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')');
+if (clause = params.attributes) {
+clause.each(function(attribute) {
+var value = 'element.getAttribute(' + attribute.name.inspect() + ')';
+var splitValueBy = function(delimiter) {
+return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
+}
+switch (attribute.operator) {
+case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
+case '~=':conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
+case '|=':conditions.push(
+splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
+); break;
+case '!=':conditions.push(value + ' != ' + attribute.value.inspect()); break;
+case '':
+case undefined: conditions.push(value + ' != null'); break;
+default:throw 'Unknown operator ' + attribute.operator + ' in selector';
}
+});
}
-}
-if(arguments[2]){
-this._children(_323,arguments[2]);
-}
-return _323;
-},_text:function(text){
-return document.createTextNode(text);
-},_attributes:function(_326){
-var _327=[];
-for(attribute in _326){
-_327.push((attribute=="className"?"class":attribute)+"=\""+_326[attribute].toString().escapeHTML()+"\"");
-}
-return _327.join(" ");
-},_children:function(_328,_329){
-if(typeof _329=="object"){
-_329.flatten().each(function(e){
-if(typeof e=="object"){
-_328.appendChild(e);
-}else{
-if(Builder._isStringOrNumber(e)){
-_328.appendChild(Builder._text(e));
-}
-}
+return conditions.join(' && ');
+},
+compileMatcher: function() {
+this.match = new Function('element', 'if (!element.tagName) return false; \
+return ' + this.buildMatchExpression());
+},
+findElements: function(scope) {
+var element;
+if (element = $(this.params.id))
+if (this.match(element))
+if (!scope || Element.childOf(element, scope))
+return [element];
+scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
+var results = [];
+for (var i = 0; i < scope.length; i++)
+if (this.match(element = scope[i]))
+results.push(Element.extend(element));
+return results;
+},
+toString: function() {
+return this.expression;
+}
+}
+function $$() {
+return $A(arguments).map(function(expression) {
+return expression.strip().split(/\s+/).inject([null], function(results, expr) {
+var selector = new Selector(expr);
+return results.map(selector.findElements.bind(selector)).flatten();
+});
+}).flatten();
+}
+var Builder = {
+NODEMAP: {
+AREA: 'map',
+CAPTION: 'table',
+COL: 'table',
+COLGROUP: 'table',
+LEGEND: 'fieldset',
+OPTGROUP: 'select',
+OPTION: 'select',
+PARAM: 'object',
+TBODY: 'table',
+TD: 'table',
+TFOOT: 'table',
+TH: 'table',
+THEAD: 'table',
+TR: 'table'
+},
+node: function(elementName) {
+elementName = elementName.toUpperCase();
+var parentTag = this.NODEMAP[elementName] || 'div';
+var parentElement = document.createElement(parentTag);
+try {parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
+} catch(e) {}
+var element = parentElement.firstChild || null;
+if(element && (element.tagName != elementName))
+element = element.getElementsByTagName(elementName)[0];
+if(!element) element = document.createElement(elementName);
+if(!element) return;
+if(arguments[1])
+if(this._isStringOrNumber(arguments[1]) ||
+(arguments[1] instanceof Array)) {
+this._children(element, arguments[1]);
+} else {
+var attrs = this._attributes(arguments[1]);
+if(attrs.length) {
+try {parentElement.innerHTML = "<" +elementName + " " +
+attrs + "></" + elementName + ">";
+} catch(e) {}
+element = parentElement.firstChild || null;
+ if(!element) {
+element = document.createElement(elementName);
+for(attr in arguments[1])
+element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
+}
+if(element.tagName != elementName)
+element = parentElement.getElementsByTagName(elementName)[0];
+}
+}
+if(arguments[2])
+this._children(element, arguments[2]);
+return element;
+},
+_text: function(text) {
+ return document.createTextNode(text);
+},
+_attributes: function(attributes) {
+var attrs = [];
+for(attribute in attributes)
+attrs.push((attribute=='className' ? 'class' : attribute) +
+'="' + attributes[attribute].toString().escapeHTML() + '"');
+return attrs.join(" ");
+},
+_children: function(element, children) {
+if(typeof children=='object') {children.flatten().each( function(e) {
+if(typeof e=='object')
+element.appendChild(e)
+else
+if(Builder._isStringOrNumber(e))
+element.appendChild(Builder._text(e));
});
-}else{
-if(Builder._isStringOrNumber(_329)){
-_328.appendChild(Builder._text(_329));
-}
-}
-},_isStringOrNumber:function(_330){
-return (typeof _330=="string"||typeof _330=="number");
-}};
-Object.extend(Builder,{exportTags:function(){
-var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];
-tags.each(function(tag){
-window[tag]=function(){
+} else
+if(Builder._isStringOrNumber(children))
+ element.appendChild(Builder._text(children));
+},
+_isStringOrNumber: function(param) {
+return(typeof param=='string' || typeof param=='number');
+}
+}
+Object.extend(Builder,
+{
+exportTags:function()
+{
+var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG", "CAPTION"];
+tags.each(function(tag)
+{
+window[tag]=function()
+{
var args=$A(arguments);
-if(args.length==0){
+if(args.length==0)
return Builder.node(tag,null);
-}
-if(args.length==1){
+if(args.length==1)
return Builder.node(tag,args[0]);
-}
-if(args.length>1){
+if(args.length>1)
return Builder.node(tag,args.shift(),args);
-}
};
});
-}});
+}
+});
Builder.exportTags();
-Object.extend(Date.prototype,{SimpleFormat:function(_334,data){
-data=data||{};
-var bits=new Array();
-bits["d"]=this.getDate();
-bits["dd"]=String(this.getDate()).zerofill(2);
-bits["M"]=this.getMonth()+1;
-bits["MM"]=String(this.getMonth()+1).zerofill(2);
-if(data.AbbreviatedMonthNames){
-bits["MMM"]=data.AbbreviatedMonthNames[this.getMonth()];
-}
-if(data.MonthNames){
-bits["MMMM"]=data.MonthNames[this.getMonth()];
-}
-var _337=""+this.getFullYear();
-_337=(_337.length==2)?"19"+_337:_337;
-bits["yyyy"]=_337;
-bits["yy"]=bits["yyyy"].toString().substr(2,2);
-var frm=new String(_334);
-for(var sect in bits){
-var reg=new RegExp("\\b"+sect+"\\b","g");
-frm=frm.replace(reg,bits[sect]);
+Object.extend(Date.prototype,
+{
+SimpleFormat: function(format, data)
+{
+data = data || {};
+var bits = new Array();
+bits['d'] = this.getDate();
+bits['dd'] = String(this.getDate()).zerofill(2);
+bits['M'] = this.getMonth()+1;
+bits['MM'] = String(this.getMonth()+1).zerofill(2);
+if(data.AbbreviatedMonthNames)
+bits['MMM'] = data.AbbreviatedMonthNames[this.getMonth()];
+if(data.MonthNames)
+bits['MMMM'] = data.MonthNames[this.getMonth()];
+var yearStr = "" + this.getFullYear();
+yearStr = (yearStr.length == 2) ? '19' + yearStr: yearStr;
+bits['yyyy'] = yearStr;
+bits['yy'] = bits['yyyy'].toString().substr(2,2);
+var frm = new String(format);
+for (var sect in bits)
+{
+var reg = new RegExp("\\b"+sect+"\\b" ,"g");
+frm = frm.replace(reg, bits[sect]);
}
return frm;
-},toISODate:function(){
-var y=this.getFullYear();
-var m=String(this.getMonth()+1).zerofill(2);
-var d=String(this.getDate()).zerofill(2);
-return String(y)+String(m)+String(d);
-}});
-Object.extend(Date,{SimpleParse:function(_341,_342){
-val=String(_341);
-_342=String(_342);
-if(val.length<=0){
-return null;
-}
-if(_342.length<=0){
-return new Date(_341);
-}
-var _343=function(val){
-var _345="1234567890";
-for(var i=0;i<val.length;i++){
-if(_345.indexOf(val.charAt(i))==-1){
-return false;
+},
+toISODate : function()
+{
+var y = this.getFullYear();
+var m = String(this.getMonth() + 1).zerofill(2);
+var d = String(this.getDate()).zerofill(2);
+return String(y) + String(m) + String(d);
}
+});
+Object.extend(Date,
+{
+SimpleParse: function(value, format)
+{
+val=String(value);
+format=String(format);
+if(val.length <= 0) return null;
+if(format.length <= 0) return new Date(value);
+var isInteger = function (val)
+{
+var digits="1234567890";
+for (var i=0; i < val.length; i++)
+{
+if (digits.indexOf(val.charAt(i))==-1) { return false; }
}
return true;
};
-var _346=function(str,i,_348,_349){
-for(var x=_349;x>=_348;x--){
-var _350=str.substring(i,i+x);
-if(_350.length<_348){
-return null;
-}
-if(_343(_350)){
-return _350;
-}
+var getInt = function(str,i,minlength,maxlength)
+{
+for (var x=maxlength; x>=minlength; x--)
+{
+var token=str.substring(i,i+x);
+if (token.length < minlength) { return null; }
+if (isInteger(token)) { return token; }
}
return null;
};
-var _351=0;
-var _352=0;
+var i_val=0;
+var i_format=0;
var c="";
-var _354="";
-var _355="";
+var token="";
+var token2="";
var x,y;
var now=new Date();
var year=now.getFullYear();
-var _358=now.getMonth()+1;
+var month=now.getMonth()+1;
var date=1;
-while(_352<_342.length){
-c=_342.charAt(_352);
-_354="";
-while((_342.charAt(_352)==c)&&(_352<_342.length)){
-_354+=_342.charAt(_352++);
-}
-if(_354=="yyyy"||_354=="yy"||_354=="y"){
-if(_354=="yyyy"){
-x=4;
-y=4;
-}
-if(_354=="yy"){
-x=2;
-y=2;
-}
-if(_354=="y"){
-x=2;
-y=4;
-}
-year=_346(val,_351,x,y);
-if(year==null){
-return null;
-}
-_351+=year.length;
-if(year.length==2){
-if(year>70){
-year=1900+(year-0);
-}else{
-year=2000+(year-0);
-}
-}
-}else{
-if(_354=="MM"||_354=="M"){
-_358=_346(val,_351,_354.length,2);
-if(_358==null||(_358<1)||(_358>12)){
-return null;
-}
-_351+=_358.length;
-}else{
-if(_354=="dd"||_354=="d"){
-date=_346(val,_351,_354.length,2);
-if(date==null||(date<1)||(date>31)){
-return null;
-}
-_351+=date.length;
-}else{
-if(val.substring(_351,_351+_354.length)!=_354){
-return null;
-}else{
-_351+=_354.length;
-}
-}
+while (i_format < format.length)
+{
+c=format.charAt(i_format);
+token="";
+while ((format.charAt(i_format)==c) && (i_format < format.length))
+{
+token += format.charAt(i_format++);
+}
+if (token=="yyyy" || token=="yy" || token=="y")
+{
+if (token=="yyyy") { x=4;y=4; }
+if (token=="yy") { x=2;y=2; }
+if (token=="y"){ x=2;y=4; }
+year=getInt(val,i_val,x,y);
+if (year==null) { return null; }
+i_val += year.length;
+if (year.length==2)
+{
+if (year > 70) { year=1900+(year-0); }
+else { year=2000+(year-0); }
+}
+}
+else if (token=="MM"||token=="M")
+{
+month=getInt(val,i_val,token.length,2);
+if(month==null||(month<1)||(month>12)){return null;}
+i_val+=month.length;
+}
+else if (token=="dd"||token=="d")
+{
+date=getInt(val,i_val,token.length,2);
+if(date==null||(date<1)||(date>31)){return null;}
+i_val+=date.length;
+}
+else
+{
+if (val.substring(i_val,i_val+token.length)!=token) {return null;}
+else {i_val+=token.length;}
+}
+}
+if (i_val != val.length) { return null; }
+if (month==2)
+{
+if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) {
+if (date > 29){ return null; }
+}
+else { if (date > 28) { return null; } }
+}
+if ((month==4)||(month==6)||(month==9)||(month==11))
+{
+if (date > 30) { return null; }
+}
+var newdate=new Date(year,month-1,date, 0, 0, 0);
+return newdate;
}
-}
-}
-if(_351!=val.length){
-return null;
-}
-if(_358==2){
-if(((year%4==0)&&(year%100!=0))||(year%400==0)){
-if(date>29){
-return null;
-}
-}else{
-if(date>28){
-return null;
-}
-}
-}
-if((_358==4)||(_358==6)||(_358==9)||(_358==11)){
-if(date>30){
-return null;
-}
-}
-var _360=new Date(year,_358-1,date,0,0,0);
-return _360;
-}});
-var Prado={Version:"3.0a",Browser:function(){
-var info={Version:"1.0"};
-var _362=parseInt(navigator.appVersion);
-info.nver=_362;
-info.ver=navigator.appVersion;
-info.agent=navigator.userAgent;
-info.dom=document.getElementById?1:0;
-info.opera=window.opera?1:0;
-info.ie5=(info.ver.indexOf("MSIE 5")>-1&&info.dom&&!info.opera)?1:0;
-info.ie6=(info.ver.indexOf("MSIE 6")>-1&&info.dom&&!info.opera)?1:0;
-info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;
-info.ie=info.ie4||info.ie5||info.ie6;
-info.mac=info.agent.indexOf("Mac")>-1;
-info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;
-info.ie3=(info.ver.indexOf("MSIE")&&(_362<4));
-info.hotjava=(info.agent.toLowerCase().indexOf("hotjava")!=-1)?1:0;
-info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;
-info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);
-info.ver3=(info.hotjava||info.ie3);
-info.opera7=((info.agent.toLowerCase().indexOf("opera 7")>-1)||(info.agent.toLowerCase().indexOf("opera/7")>-1));
-info.operaOld=info.opera&&!info.opera7;
+});
+var Prado =
+{
+Version: '3.0a',
+Browser : function()
+{
+var info = { Version : "1.0" };
+var is_major = parseInt( navigator.appVersion );
+info.nver = is_major;
+info.ver = navigator.appVersion;
+info.agent = navigator.userAgent;
+info.dom = document.getElementById ? 1 : 0;
+info.opera = window.opera ? 1 : 0;
+info.ie5 = ( info.ver.indexOf( "MSIE 5" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
+info.ie6 = ( info.ver.indexOf( "MSIE 6" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
+info.ie4 = ( document.all && !info.dom && !info.opera ) ? 1 : 0;
+info.ie = info.ie4 || info.ie5 || info.ie6;
+info.mac = info.agent.indexOf( "Mac" ) > -1;
+info.ns6 = ( info.dom && parseInt( info.ver ) >= 5 ) ? 1 : 0;
+info.ie3 = ( info.ver.indexOf( "MSIE" ) && ( is_major < 4 ) );
+info.hotjava = ( info.agent.toLowerCase().indexOf( 'hotjava' ) != -1 ) ? 1 : 0;
+info.ns4 = ( document.layers && !info.dom && !info.hotjava ) ? 1 : 0;
+info.bw = ( info.ie6 || info.ie5 || info.ie4 || info.ns4 || info.ns6 || info.opera );
+info.ver3 = ( info.hotjava || info.ie3 );
+info.opera7 = ( ( info.agent.toLowerCase().indexOf( 'opera 7' ) > -1 ) || ( info.agent.toLowerCase().indexOf( 'opera/7' ) > -1 ) );
+info.operaOld = info.opera && !info.opera7;
return info;
-},ImportCss:function(doc,_364){
-if(Prado.Browser().ie){
-var _365=doc.createStyleSheet(_364);
-}else{
-var elm=doc.createElement("link");
-elm.rel="stylesheet";
-elm.href=_364;
-if(headArr=doc.getElementsByTagName("head")){
+},
+ImportCss : function(doc, css_file)
+{
+if (Prado.Browser().ie)
+var styleSheet = doc.createStyleSheet(css_file);
+else
+{
+var elm = doc.createElement("link");
+elm.rel = "stylesheet";
+elm.href = css_file;
+if (headArr = doc.getElementsByTagName("head"))
headArr[0].appendChild(elm);
}
}
-}};
-Prado.Focus=Class.create();
-Prado.Focus.setFocus=function(id){
-var _368=document.getElementById?document.getElementById(id):document.all[id];
-if(_368&&!Prado.Focus.canFocusOn(_368)){
-_368=Prado.Focus.findTarget(_368);
-}
-if(_368){
-try{
-_368.focus();
-_368.scrollIntoView(false);
-if(window.__smartNav){
-window.__smartNav.ae=_368.id;
-}
-}
-catch(e){
-}
-}
-};
-Prado.Focus.canFocusOn=function(_369){
-if(!_369||!(_369.tagName)){
-return false;
-}
-var _370=_369.tagName.toLowerCase();
-return !_369.disabled&&(!_369.type||_369.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_370)&&Prado.Focus.isVisible(_369);
-};
-Prado.Focus.isFocusableTag=function(_371){
-return (_371=="input"||_371=="textarea"||_371=="select"||_371=="button"||_371=="a");
-};
-Prado.Focus.findTarget=function(_372){
-if(!_372||!(_372.tagName)){
-return null;
-}
-var _373=_372.tagName.toLowerCase();
-if(_373=="undefined"){
-return null;
-}
-var _374=_372.childNodes;
-if(_374){
-for(var i=0;i<_374.length;i++){
-try{
-if(Prado.Focus.canFocusOn(_374[i])){
-return _374[i];
-}else{
-var _375=Prado.Focus.findTarget(_374[i]);
-if(_375){
-return _375;
-}
-}
-}
-catch(e){
-}
-}
-}
-return null;
};
-Prado.Focus.isVisible=function(_376){
-var _377=_376;
-while((typeof (_377)!="undefined")&&(_377!=null)){
-if(_377.disabled||(typeof (_377.style)!="undefined"&&((typeof (_377.style.display)!="undefined"&&_377.style.display=="none")||(typeof (_377.style.visibility)!="undefined"&&_377.style.visibility=="hidden")))){
-return false;
-}
-if(typeof (_377.parentNode)!="undefined"&&_377.parentNode!=null&&_377.parentNode!=_377&&_377.parentNode.tagName.toLowerCase()!="body"){
-_377=_377.parentNode;
-}else{
-return true;
-}
-}
-return true;
-};
-Prado.PostBack=function(_378,_379){
-var form=$(_379["FormID"]);
-var _380=true;
-if(_379["CausesValidation"]&&Prado.Validation){
-var _381=true;
-if(_379["ValidationGroup"]){
-_381=Prado.Validation.ValidateValidationGroup(_379["ValidationGroup"]);
-}else{
-_381=Prado.Validation.ValidateNonGroup(form);
-}
-if(!_381){
-return Event.stop(_378);
-}
-}
-if(_379["PostBackUrl"]&&_379["PostBackUrl"].length>0){
-form.action=_379["PostBackUrl"];
-}
-if(_379["TrackFocus"]){
-var _382=$("PRADO_LASTFOCUS");
-if(_382){
-var _383=document.activeElement;
-if(_383){
-_382.value=_383.id;
-}else{
-_382.value=_379["EventTarget"];
-}
-}
-}
-$("PRADO_POSTBACK_TARGET").value=_379["EventTarget"];
-$("PRADO_POSTBACK_PARAMETER").value=_379["EventParameter"];
+Prado.PostBack = function(event,options)
+{
+var form = $(options['FormID']);
+var canSubmit = true;
+if(options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+{
+if(!Prado.Validation.validate(options['FormID'], options['ValidationGroup']))
+return Event.stop(event);
+}
+if(options['PostBackUrl'] && options['PostBackUrl'].length > 0)
+form.action = options['PostBackUrl'];
+if(options['TrackFocus'])
+{
+var lastFocus = $('PRADO_LASTFOCUS');
+if(lastFocus)
+{
+var active = document.activeElement;
+if(active)
+lastFocus.value = active.id;
+else
+lastFocus.value = options['EventTarget'];
+}
+}
+$('PRADO_POSTBACK_TARGET').value = options['EventTarget'];
+$('PRADO_POSTBACK_PARAMETER').value = options['EventParameter'];
Event.fireEvent(form,"submit");
-if(_379["StopEvent"]){
-Event.stop(_378);
-}
-};
-Prado.Element={setValue:function(_384,_385){
-var el=$(_384);
-if(el&&typeof (el.value)!="undefined"){
-el.value=_385;
-}
-},select:function(_387,_388,_389){
-var el=$(_387);
-var _390=_387.indexOf("[]")>-1;
-if(!el&&!_390){
-return;
-}
-_388=_390?"check"+_388:el.tagName.toLowerCase()+_388;
-var _391=Prado.Element.Selection;
-if(isFunction(_391[_388])){
-_391[_388](_390?_387:el,_389);
-}
-},click:function(_392){
-var el=$(_392);
-if(!el){
-return;
-}
-if(document.createEvent){
-var evt=document.createEvent("HTMLEvents");
-evt.initEvent("click",true,true);
+if(options['StopEvent'])
+Event.stop(event);
+}
+Prado.Element =
+{
+setValue : function(element, value)
+{
+var el = $(element);
+if(el && typeof(el.value) != "undefined")
+el.value = value;
+},
+select : function(element, method, value)
+{
+var el = $(element);
+var isList = element.indexOf('[]') > -1;
+if(!el && !isList) return;
+method = isList ? 'check'+method : el.tagName.toLowerCase()+method;
+var selection = Prado.Element.Selection;
+if(isFunction(selection[method]))
+selection[method](isList ? element : el,value);
+},
+click : function(element)
+{
+var el = $(element);
+if(!el) return;
+if(document.createEvent)
+{
+var evt = document.createEvent('HTMLEvents');
+evt.initEvent('click', true, true);
el.dispatchEvent(evt);
-}else{
-if(el.fireEvent){
-el.fireEvent("onclick");
-if(isFunction(el.onclick)){
-el.onclick();
}
+else if(el.fireEvent)
+{
+el.fireEvent('onclick');
+if(isFunction(el.onclick))
+el.onclick();
}
-}
-},setAttribute:function(_394,_395,_396){
-var el=$(_394);
-if(_395=="disabled"&&_396==false){
-el.removeAttribute(_395);
-}else{
-el.setAttribute(_395,_396);
-}
-},setOptions:function(_397,_398){
-var el=$(_397);
-if(el&&el.tagName.toLowerCase()=="select"){
-while(el.length>0){
+},
+setAttribute : function(element, attribute, value)
+{
+var el = $(element);
+if(attribute == "disabled" && value==false)
+el.removeAttribute(attribute);
+else
+el.setAttribute(attribute, value);
+},
+setOptions : function(element, options)
+{
+var el = $(element);
+if(el && el.tagName.toLowerCase() == "select")
+{
+while(el.length > 0)
el.remove(0);
+for(var i = 0; i<options.length; i++)
+el.options[el.options.length] = new Option(options[i][0],options[i][1]);
+}
+},
+focus : function(element)
+{
+var obj = $(element);
+if(isObject(obj) && isdef(obj.focus))
+setTimeout(function(){ obj.focus(); }, 100);
+return false;
}
-for(var i=0;i<_398.length;i++){
-el.options[el.options.length]=new Option(_398[i][0],_398[i][1]);
-}
-}
-},focus:function(_399){
-var obj=$(_399);
-if(isObject(obj)&&isdef(obj.focus)){
-setTimeout(function(){
-obj.focus();
-},100);
}
-return false;
-}};
-Prado.Element.Selection={inputValue:function(el,_401){
-switch(el.type.toLowerCase()){
-case "checkbox":
-case "radio":
-return el.checked=_401;
-}
-},selectValue:function(el,_402){
-$A(el.options).each(function(_403){
-_403.selected=_403.value==_402;
+Prado.Element.Selection =
+{
+inputValue : function(el, value)
+{
+switch(el.type.toLowerCase())
+{
+case 'checkbox':
+case 'radio':
+return el.checked = value;
+}
+},
+selectValue : function(el, value)
+{
+$A(el.options).each(function(option)
+{
+option.selected = option.value == value;
});
-},selectIndex:function(el,_404){
-if(el.type=="select-one"){
-el.selectedIndex=_404;
-}else{
-for(var i=0;i<el.length;i++){
-if(i==_404){
-el.options[i].selected=true;
-}
-}
-}
-},selectClear:function(el){
-el.selectedIndex=-1;
-},selectAll:function(el){
-$A(el.options).each(function(_405){
-_405.selected=true;
-Logger.warn(_405.value);
+},
+selectIndex : function(el, index)
+{
+if(el.type == 'select-one')
+el.selectedIndex = index;
+else
+{
+for(var i = 0; i<el.length; i++)
+{
+if(i == index)
+el.options[i].selected = true;
+}
+}
+},
+selectClear : function(el)
+{
+el.selectedIndex = -1;
+},
+selectAll : function(el)
+{
+$A(el.options).each(function(option)
+{
+option.selected = true;
+Logger.warn(option.value);
});
-},selectInvert:function(el){
-$A(el.options).each(function(_406){
-_406.selected=!_406.selected;
+},
+selectInvert : function(el)
+{
+$A(el.options).each(function(option)
+{
+option.selected = !option.selected;
});
-},checkValue:function(name,_407){
-$A(document.getElementsByName(name)).each(function(el){
-el.checked=el.value==_407;
+},
+checkValue : function(name, value)
+{
+$A(document.getElementsByName(name)).each(function(el)
+{
+el.checked = el.value == value
});
-},checkIndex:function(name,_408){
-var _409=$A(document.getElementsByName(name));
-for(var i=0;i<_409.length;i++){
-if(i==_408){
-_409[i].checked=true;
-}
-}
-},checkClear:function(name){
-$A(document.getElementsByName(name)).each(function(el){
-el.checked=false;
+},
+checkIndex : function(name, index)
+{
+var elements = $A(document.getElementsByName(name));
+for(var i = 0; i<elements.length; i++)
+{
+if(i == index)
+elements[i].checked = true;
+}
+},
+checkClear : function(name)
+{
+$A(document.getElementsByName(name)).each(function(el)
+{
+el.checked = false;
});
-},checkAll:function(name){
-$A(document.getElementsByName(name)).each(function(el){
-el.checked=true;
+},
+checkAll : function(name)
+{
+$A(document.getElementsByName(name)).each(function(el)
+{
+el.checked = true;
});
-},checkInvert:function(name){
-$A(document.getElementsByName(name)).each(function(el){
-el.checked=!el.checked;
+},
+checkInvert : function(name)
+{
+$A(document.getElementsByName(name)).each(function(el)
+{
+el.checked = !el.checked;
});
-}};
-Object.extend(Prado.Element,{Insert:{After:function(_410,_411){
-new Insertion.After(_410,_411);
-},Before:function(_412,_413){
-new Insertion.Before(_412.innerHTML);
-},Below:function(_414,_415){
-new Insertion.Bottom(_414,_415);
-},Above:function(_416,_417){
-new Insertion.Top(_416,_417);
-}},CssClass:{set:function(_418,_419){
-_418=new Element.ClassNames(_418);
-_418.set(_419);
-}}});
-Prado.WebUI=Class.create();
-Prado.WebUI.PostBackControl=Class.create();
-Object.extend(Prado.WebUI.PostBackControl.prototype,{initialize:function(_420){
-this.element=$(_420["ID"]);
-if(_420["CausesValidation"]&&Prado.Validation){
-Prado.Validation.AddTarget(_420["ID"],_420["ValidationGroup"]);
-}
-if(this.onInit){
-this.onInit(_420);
-}
-}});
-Prado.WebUI.createPostBackComponent=function(_421){
-var _422=Class.create();
-Object.extend(_422.prototype,Prado.WebUI.PostBackControl.prototype);
-if(_421){
-Object.extend(_422.prototype,_421);
-}
-return _422;
+}
+};
+Prado.WebUI = Class.create();
+Prado.WebUI.PostBackControl = Class.create();
+Prado.WebUI.PostBackControl.prototype =
+{
+_elementOnClick : null,
+initialize : function(options)
+{
+this.element = $(options.ID);
+if(this.onInit)
+this.onInit(options);
+},
+onInit : function(options)
+{
+if(typeof(this.element.onclick)=="function")
+{
+this._elementOnClick = this.element.onclick;
+this.element.onclick = null;
+}
+Event.observe(this.element, "click", this.onClick.bindEvent(this,options));
+},
+onClick : function(event, options)
+{
+var src = Event.element(event);
+var doPostBack = true;
+var onclicked = null;
+if(this._elementOnClick)
+{
+var onclicked = this._elementOnClick(event);
+if(typeof(onclicked) == "boolean")
+doPostBack = onclicked;
+}
+if(doPostBack)
+this.onPostBack(event,options);
+if(typeof(onclicked) == "boolean" && !onclicked)
+Event.stop(event);
+},
+onPostBack : function(event, options)
+{
+Prado.PostBack(event,options);
+}
};
-Prado.WebUI.TButton=Prado.WebUI.createPostBackComponent();
-Prado.WebUI.ClickableComponent=Prado.WebUI.createPostBackComponent({_elementOnClick:null,onInit:function(_423){
-if(isFunction(this.element.onclick)){
-this._elementOnClick=this.element.onclick;
-this.element.onclick=null;
-}
-Event.observe(this.element,"click",this.onClick.bindEvent(this,_423));
-},onClick:function(_424,_425){
-var src=Event.element(_424);
-var _427=true;
-var _428=null;
-if(this._elementOnClick){
-var _428=this._elementOnClick(_424);
-if(isBoolean(_428)){
-_427=_428;
-}
-}
-if(_427){
-this.onPostBack(_424,_425);
-}
-if(isBoolean(_428)&&!_428){
-Event.stop(_424);
-}
-},onPostBack:function(_429,_430){
-Prado.PostBack(_429,_430);
-}});
-Prado.WebUI.TLinkButton=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TCheckBox=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TBulletedList=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TImageMap=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TImageButton=Class.create();
-Object.extend(Prado.WebUI.TImageButton.prototype,Prado.WebUI.ClickableComponent.prototype);
-Object.extend(Prado.WebUI.TImageButton.prototype,{hasXYInput:false,onPostBack:function(_431,_432){
-if(!this.hasXYInput){
-this.addXYInput(_431,_432);
-this.hasXYInput=true;
-}
-Prado.PostBack(_431,_432);
-},addXYInput:function(_433,_434){
-var _435=Position.cumulativeOffset(this.element);
-var _436=[_433.clientX,_433.clientY];
-var x=_436[0]-_435[0]+1;
-var y=_436[1]-_435[1]+1;
-var id=_434["EventTarget"];
-var _437=INPUT({type:"hidden",name:id+"_x",value:x});
-var _438=INPUT({type:"hidden",name:id+"_y",value:y});
-this.element.parentNode.appendChild(_437);
-this.element.parentNode.appendChild(_438);
-}});
-Prado.WebUI.TRadioButton=Prado.WebUI.createPostBackComponent(Prado.WebUI.ClickableComponent.prototype);
-Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;
-Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(_439){
-this.element=$(_439["ID"]);
-if(!this.element.checked){
-this.onRadioButtonInitialize(_439);
-}
-}});
-Prado.WebUI.TTextBox=Prado.WebUI.createPostBackComponent({onInit:function(_440){
-if(_440["TextMode"]!="MultiLine"){
-Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));
-}
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_440));
-},handleReturnKey:function(e){
-if(Event.keyCode(e)==Event.KEY_RETURN){
-var _441=Event.element(e);
-if(_441){
-Event.fireEvent(_441,"change");
+Prado.WebUI.TButton = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TLinkButton = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TCheckBox = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TBulletedList = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TImageMap = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TImageButton = Class.extend(Prado.WebUI.PostBackControl);
+Object.extend(Prado.WebUI.TImageButton.prototype,
+{
+hasXYInput : false,
+onPostBack : function(event, options)
+{
+if(!this.hasXYInput)
+{
+this.addXYInput(event,options);
+this.hasXYInput = true;
+}
+Prado.PostBack(event, options);
+},
+addXYInput : function(event,options)
+{
+var imagePos = Position.cumulativeOffset(this.element);
+var clickedPos = [event.clientX, event.clientY];
+var x = clickedPos[0]-imagePos[0]+1;
+var y = clickedPos[1]-imagePos[1]+1;
+var id = options['EventTarget'];
+var x_input = INPUT({type:'hidden',name:id+'_x',value:x});
+var y_input = INPUT({type:'hidden',name:id+'_y',value:y});
+this.element.parentNode.appendChild(x_input);
+this.element.parentNode.appendChild(y_input);
+}
+});
+Prado.WebUI.TRadioButton = Class.extend(Prado.WebUI.PostBackControl);
+Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize = Prado.WebUI.TRadioButton.prototype.initialize;
+Object.extend(Prado.WebUI.TRadioButton.prototype,
+{
+initialize : function(options)
+{
+this.element = $(options['ID']);
+if(!this.element.checked)
+this.onRadioButtonInitialize(options);
+}
+});
+Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
+{
+onInit : function(options)
+{
+if(options['TextMode'] != 'MultiLine')
+Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
+Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
+},
+handleReturnKey : function(e)
+{
+ if(Event.keyCode(e) == Event.KEY_RETURN)
+{
+var target = Event.element(e);
+if(target)
+{
+Event.fireEvent(target, "change");
Event.stop(e);
}
}
-}});
-Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_442){
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_442));
-}});
-Prado.WebUI.TListBox=Prado.WebUI.TListControl;
-Prado.WebUI.TDropDownList=Prado.WebUI.TListControl;
-Prado.WebUI.DefaultButton=Class.create();
-Object.extend(Prado.WebUI.DefaultButton.prototype,{initialize:function(_443){
-this.options=_443;
-this._event=this.triggerEvent.bindEvent(this);
-Event.observe(_443["Panel"],"keydown",this._event);
-},triggerEvent:function(ev,_445){
-var _446=Event.keyCode(ev)==Event.KEY_RETURN;
-var _447=Event.element(ev).tagName.toLowerCase()=="textarea";
-if(_446&&!_447){
-var _448=$(this.options["Target"]);
-if(_448){
-this.triggered=true;
-Event.fireEvent(_448,this.options["Event"]);
+}
+});
+Prado.WebUI.TListControl = Class.extend(Prado.WebUI.PostBackControl,
+{
+onInit : function(options)
+{
+Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
+}
+});
+Prado.WebUI.TListBox = Class.extend(Prado.WebUI.TListControl);
+Prado.WebUI.TDropDownList = Class.extend(Prado.WebUI.TListControl);
+Prado.WebUI.DefaultButton = Class.create();
+Prado.WebUI.DefaultButton.prototype =
+{
+initialize : function(options)
+{
+this.options = options;
+this._event = this.triggerEvent.bindEvent(this);
+Event.observe(options['Panel'], 'keydown', this._event);
+},
+triggerEvent : function(ev, target)
+{
+var enterPressed = Event.keyCode(ev) == Event.KEY_RETURN;
+var isTextArea = Event.element(ev).tagName.toLowerCase() == "textarea";
+if(enterPressed && !isTextArea)
+{
+var defaultButton = $(this.options['Target']);
+if(defaultButton)
+{
+this.triggered = true;
+Event.fireEvent(defaultButton, this.options['Event']);
Event.stop(ev);
}
}
-}});
-Prado.WebUI.TTextHighlighter=Class.create();
-Prado.WebUI.TTextHighlighter.prototype={initialize:function(id){
-if(!window.clipboardData){
-return;
}
-var _449={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"};
-var div=DIV({className:"copycode"},A(_449,"Copy Code"));
+};
+Prado.WebUI.TTextHighlighter=Class.create();
+Prado.WebUI.TTextHighlighter.prototype=
+{
+initialize:function(id)
+{
+if(!window.clipboardData) return;
+var options =
+{
+href : 'javascript:;/'+'/copy code to clipboard',
+onclick : 'Prado.WebUI.TTextHighlighter.copy(this)',
+onmouseover : 'Prado.WebUI.TTextHighlighter.hover(this)',
+onmouseout : 'Prado.WebUI.TTextHighlighter.out(this)'
+}
+var div = DIV({className:'copycode'}, A(options, 'Copy Code'));
document.write(DIV(null,div).innerHTML);
-}};
-Object.extend(Prado.WebUI.TTextHighlighter,{copy:function(obj){
-var _450=obj.parentNode.parentNode.parentNode;
-var text="";
-for(var i=0;i<_450.childNodes.length;i++){
-var node=_450.childNodes[i];
-if(node.innerText){
-text+=node.innerText=="Copy Code"?"":node.innerText;
-}else{
-text+=node.nodeValue;
-}
-}
-if(text.length>0){
-window.clipboardData.setData("Text",text);
-}
-},hover:function(obj){
-obj.parentNode.className="copycode copycode_hover";
-},out:function(obj){
-obj.parentNode.className="copycode";
-}});
-Prado.WebUI.TRatingList=Class.create();
-Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(_451){
-this.options=_451;
-this.element=$(_451["ID"]);
-Element.addClassName(this.element,_451.cssClass);
-this.radios=document.getElementsByName(_451.field);
-for(var i=0;i<this.radios.length;i++){
-Event.observe(this.radios[i].parentNode,"mouseover",this.hover.bindEvent(this,i));
-Event.observe(this.radios[i].parentNode,"mouseout",this.recover.bindEvent(this,i));
-Event.observe(this.radios[i].parentNode,"click",this.click.bindEvent(this,i));
-}
-this.caption=CAPTION();
+}
+};
+Object.extend(Prado.WebUI.TTextHighlighter,
+{
+copy : function(obj)
+{
+var parent = obj.parentNode.parentNode.parentNode;
+var text = '';
+for(var i = 0; i < parent.childNodes.length; i++)
+{
+var node = parent.childNodes[i];
+if(node.innerText)
+text += node.innerText == 'Copy Code' ? '' : node.innerText;
+else
+text += node.nodeValue;
+}
+if(text.length > 0)
+window.clipboardData.setData("Text", text);
+},
+hover : function(obj)
+{
+obj.parentNode.className = "copycode copycode_hover";
+},
+out : function(obj)
+{
+obj.parentNode.className = "copycode";
+}
+});
+Prado.WebUI.TRatingList = Class.create();
+Prado.WebUI.TRatingList.prototype =
+{
+selectedIndex : -1,
+initialize : function(options)
+{
+this.options = options;
+this.element = $(options['ID']);
+Element.addClassName(this.element,options.cssClass);
+this.radios = document.getElementsByName(options.field);
+for(var i = 0; i<this.radios.length; i++)
+{
+Event.observe(this.radios[i].parentNode, "mouseover", this.hover.bindEvent(this,i));
+Event.observe(this.radios[i].parentNode, "mouseout", this.recover.bindEvent(this,i));
+Event.observe(this.radios[i].parentNode, "click", this.click.bindEvent(this, i));
+}
+this.caption = CAPTION();
this.element.appendChild(this.caption);
-this.selectedIndex=_451.selectedIndex;
+this.selectedIndex = options.selectedIndex;
this.setRating(this.selectedIndex);
-},hover:function(ev,_452){
-for(var i=0;i<this.radios.length;i++){
-this.radios[i].parentNode.className=(i<=_452)?"rating_hover":"";
+},
+hover : function(ev,index)
+{
+for(var i = 0; i<this.radios.length; i++)
+this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
+this.setCaption(index);
+},
+recover : function(ev,index)
+{
+for(var i = 0; i<=index; i++)
+Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+this.setRating(this.selectedIndex);
+},
+click : function(ev, index)
+{
+for(var i = 0; i<this.radios.length; i++)
+this.radios[i].checked = (i == index);
+this.selectedIndex = index;
+this.setRating(index);
+if(isFunction(this.options.onChange))
+this.options.onChange(this,index);
+},
+setRating: function(index)
+{
+for(var i = 0; i<=index; i++)
+this.radios[i].parentNode.className = "rating_selected";
+this.setCaption(index);
+},
+setCaption : function(index)
+{
+this.caption.innerHTML = index > -1 ?
+this.radios[index].value : this.options.caption;
}
-this.setCaption(_452);
-},recover:function(ev,_453){
-for(var i=0;i<=_453;i++){
-Element.removeClassName(this.radios[i].parentNode,"rating_hover");
}
-this.setRating(this.selectedIndex);
-},click:function(ev,_454){
-for(var i=0;i<this.radios.length;i++){
-this.radios[i].checked=(i==_454);
-}
-this.selectedIndex=_454;
-this.setRating(_454);
-if(isFunction(this.options.onChange)){
-this.options.onChange(this,_454);
-}
-},setRating:function(_455){
-for(var i=0;i<=_455;i++){
-this.radios[i].parentNode.className="rating_selected";
-}
-this.setCaption(_455);
-},setCaption:function(_456){
-this.caption.innerHTML=_456>-1?this.radios[_456].value:this.options.caption;
-}};
-