$do = function(stuff){Event.onDOMReady(stuff)}; $do(function(){ $powerElement = function(el){ el.$power = true; el.$id = function(id){this.id = id; return this;} el.$position = function(p){this.style.position = p; return this;} el.$top = function(px){this.style.top = px + 'px'; return this;} el.$left = function(px){this.style.left = px + 'px'; return this;} el.$width = function(px){if(/^\d+%$/i.test(px)){this.style.width = px}else{this.style.width = px + 'px'}; return this;} el.$height = function(px){if(/^\d+%$/i.test(px)){this.style.height = px}else{this.style.height = px + 'px'}; return this;} el.$opacity = function(n){Element.setOpacity(this,n); return this;} el.$text = function(text){this.innerHTML=text; return this;}; el.$size = function(s){this.style.fontSize = s; return this;} el.$bold = function(){this.style.fontWeight = 'bold'; return this;} el.$css = function(css){this.className = css; return this;}; el.$float = function(d){if(/Gecko/.test(navigator.userAgent)){this.style.cssFloat = d}else{this.style.styleFloat = d}; return this;} el.$remove = function(){Element.remove(this)} el.$border = function(style){ if(!style){ this.style.border = '1px dashed #000'; }else{ var pattern = /^(top|right|bottom|left)(\s+)([\w\W]+)/ig; if(pattern.test(style)==true){ var d = style.replace(pattern, "$1"); d = d.replace(d.charAt(0),d.charAt(0).toUpperCase()); this.style['border'+d] = style.replace(pattern, "$3"); }else{ this.style.border = style; } } return this; }; el.$letterSpace = function(w){this.style.letterSpacing = w; return this;} el.$block = function(){this.style.display = 'block'; return this;} el.$inline = function(){this.style.display = 'inline'; return this;} el.$noDecor = function(){this.style.textDecoration = 'none'; return this;} el.$bgcolor = function(color){this.style.backgroundColor = color; return this;}; el.$color = function(color){this.style.color = color; return this;}; el.$bg = function(bg){this.style.background = bg; return this;}; el.$margin = function(margin){this.style.margin = margin; return this;}; el.$padding = function(style){var pattern = /^(top|right|bottom|left)(\s+)([\w\W]+)/ig; if(pattern.test(style)==true){ var d = style.replace(pattern, "$1"); d = d.replace(d.charAt(0),d.charAt(0).toUpperCase()); this.style['padding'+d] = style.replace(pattern, "$3"); }else{ this.style.padding = style; } return this; }; el.$overflow = function(overflow){this.style.overflow = overflow; return this;}; el.$overflowX = function(overflow){this.style.overflowX = overflow; return this;}; el.$overflowY = function(overflow){this.style.overflowY = overflow; return this;}; el.$textAlign = function(s){this.style.textAlign = s; return this;} el.$hand = function(){this.style.cursor = 'pointer'; return this;} el.$defaultCursor = function(){this.style.cursor = 'default'; return this;} el.$href = function(h){this.href = h; return this;} el.$src = function(h){this.src = h; return this;} el.$attr = el.$attribute = function(a){return this.getAttribute(a)} el.$readonly = function(b){this.readOnly = b; return this;} el.$value = function(s){this.value = s; return this;} el.$name = function(s){this.name = s; return this;} el.$abstop = function() {var el = this; var i = 0; while (el!=null) { i+=el["offsetTop"]; el = el.offsetParent;} return i; } el.$absleft = function() {var el = this; var i = 0; while (el!=null) { i+=el["offsetLeft"]; el = el.offsetParent;} return i; } el.$zIndex = function(z){this.style.zIndex = z; return this;} el.$focus = function(){var _this = this; setTimeout(function(){_this.focus()},0); return this;} el.$blur = function(){this.blur(); return this;} el.$abs = el.$absolute = function(x,y){return this.$position('absolute').$top(y).$left(x);} el.$rec = el.$rectangle = function(x,y){return this.$width(x).$height(y);} el.$font = function(s){this.style.font = s; return this;} el.$hide = function(){this.style.display = 'none'; return this;} el.$show = function(){this.style.display = ''; this.style.visibility = 'visible'; return this;} el.$invisible = function(){this.style.visibility = 'hidden'; return this;} el.$append = function(t,par){ var el; el = typeof(t)=='object' ? t : document.createElement(t); el.style.height = 'auto'; el.style.overflow = 'hidden'; if(par && par.type){el.type = par.type}; if(par && par.frameBorder){el.frameBorder = par.frameBorder}; if(par && par.at){this.insertBefore(el,par.at)}else{this.appendChild(el)}; return $$(el); } el.$onmousedown = function(f,b){if(!b)b=this; Event.observe(this,'mousedown',f.bindAsEventListener(b)); return this;} el.$onmouseup = function(f,b){if(!b)b=this; Event.observe(this,'mouseup',f.bindAsEventListener(b)); return this;} el.$onmouseover = function(f,b){if(!b)b=this; Event.observe(this,'mouseover',f.bindAsEventListener(b)); return this;} el.$onmouseout = function(f,b){if(!b)b=this; Event.observe(this,'mouseout',f.bindAsEventListener(b)); return this;} el.$onblur = function(f,b){if(!b)b=this; Event.observe(this,'blur',f.bindAsEventListener(b)); return this;} el.$onclick = function(f,b){if(!b)b=this; Event.observe(this,'click',f.bindAsEventListener(b)); return this;} el.$noselect = function(){if(/Gecko/.test(navigator.userAgent)){this.style.MozUserSelect = 'none';}else{this.onselectstart = function(){return false};}return this;} return el; }; $$ = function(id){ if(typeof(id)=='string'){ if(!$(id).$power){ return $powerElement($(id)); }else{ return $(id); } }else if(typeof(id)=='object'){ if(!id.$power){ return $powerElement(id); }else{ return id; } } }; $root = $$($A(document.getElementsByTagName('body'))[0]); $tags = function(tag){return $A(document.getElementsByTagName(tag))}; $geturl = function(u,f){return new Ajax.Request(u, {method: 'get', evalScripts: false, onComplete:f})} $readline = function(f){return f.split(/\n/)} $D = new Date('2008/1/1'); $TD = new Date(); $find = function(obj){ var obj = typeof(obj)=='string' ? $(obj) : obj; obj.$td = function(i){var a = $A(this.getElementsByTagName('td')); return i>=0 ? $find(a[i]) : a} obj.$tr = function(i){var a = $A(this.getElementsByTagName('tr')); return i>=0 ? $find(a[i]) : a} obj.$div = function(i){var a = $A(this.getElementsByTagName('div')); return i>=0 ? $find(a[i]) : a} obj.$tbody = function(){return $find($A(this.getElementsByTagName('tbody'))[0])} obj.$input = function(i){var a = $A(this.getElementsByTagName('input')); return i>=0 ? $find(a[i]) : a} obj.$a = function(i){var a = $A(this.getElementsByTagName('a')); return i>=0 ? $find(a[i]) : a} obj.$button = function(i){var a = $A(this.getElementsByTagName('button')); return i>=0 ? $find(a[i]) : a} obj.$span = function(i){var a = $A(this.getElementsByTagName('span')); return i>=0 ? $find(a[i]) : a} obj.$wbr = function(i){var a = $A(this.getElementsByTagName('wbr')); return i>=0 ? $find(a[i]) : a} obj.$b = function(i){var a = $A(this.getElementsByTagName('b')); return i>=0 ? $find(a[i]) : a} obj.$optgroup = function(i){var a = $A(this.getElementsByTagName('optgroup')); return i>=0 ? $find(a[i]) : a} obj.$option = function(i){var a = $A(this.getElementsByTagName('option')); return i>=0 ? $find(a[i]) : a} obj.$ul = function(i){var a = $A(this.getElementsByTagName('ul')); return i>=0 ? $find(a[i]) : a} obj.$li = function(i){var a = $A(this.getElementsByTagName('li')); return i>=0 ? $find(a[i]) : a} obj.$p = function(i){var a = $A(this.getElementsByTagName('p')); return i>=0 ? $find(a[i]) : a} return obj.$power ? obj : $$(obj); } Function.prototype.timeout = function(s){setTimeout(this,s)} }); function $t(s){$$(top.document.getElementById('ta')).value += s + "\n";} function $T(s){$$(top.document.getElementById('ta')).value = s;}