LowPro = {}; LowPro.Version = '0.4.1'; if (!Element.addMethods) Element.addMethods = function(o) { Object.extend(Element.Methods, o) }; // Simple utility methods for working with the DOM DOM = { insertAfter : function(element, node, otherNode) { element = $(element); if (otherNode.nextSibling) return element.insertBefore(node, otherNode.nextSibling); else return element.appendChild(node); }, addBefore : function(element, node) { element = $(element); return element.parentNode.insertBefore(node, element); }, addAfter : function(element, node) { element = $(element); return $(element.parentNode).insertAfter(node, element); }, replaceElement : function(element, node) { $(element).parentNode.replaceChild(node, element); return node; }, prependChild : function(element, node) { $(element).insertBefore(node, element.firstChild); }, appendChildren : function(element, children) { element = $(element); if (!(children instanceof Array)) children = Array.prototype.slice.call(arguments, 1); children.each(function(child) { element.appendChild(child) }); return children; } }; // Add them to the element mixin Element.addMethods(DOM); // DOMBuilder for prototype DOM.Builder = { IE_TRANSLATIONS : { 'class' : 'className', 'for' : 'htmlFor' }, cache: {}, ieAttrSet : function(attrs, attr, el) { var trans; if (trans = this.IE_TRANSLATIONS[attr]) el[trans] = attrs[attr]; else if (attr == 'style') el.style.cssText = attrs[attr]; else if (attr.match(/^on/)) el[attr] = new Function(attrs[attr]); else el.setAttribute(attr, attrs[attr]); }, getElement : function(tag) { var element = DOM.Builder.cache[tag]; if (element == null) element = DOM.Builder.cache[tag] = document.createElement(tag); return element.cloneNode(false); }, tagFunc : function(tag) { return function() { var attrs, children; if (arguments.length>0) { if (arguments[0].nodeName || typeof arguments[0] == "string") children = arguments; else { attrs = arguments[0]; children = Array.prototype.slice.call(arguments, 1); }; } return DOM.Builder.create(tag, attrs, children); }; }, create : function(tag, attrs, children) { attrs = attrs || {}; children = children || []; tag = tag.toLowerCase(); var isIE = navigator.userAgent.match(/MSIE/); var el = (isIE && attrs.name) ? document.createElement("<" + tag + " name=" + attrs.name + ">") : DOM.Builder.getElement(tag); for (var attr in attrs) { if (attrs[attr] === true) attrs[attr] = attr; if (typeof attrs[attr] != 'function') { if (isIE) this.ieAttrSet(attrs, attr, el); else el.setAttribute(attr, attrs[attr].toString()); } else if (attr.match(/^on(.+)$/)) { Event.observe(el, RegExp.$1, attrs[attr]); }; } for (var i=0; i$/)) return $(element.toElement()); return old$.apply(this, arguments); } })(); // Adapted from DOM Ready extension by Dan Webb // http://www.vivabit.com/bollocks/2006/06/21/a-dom-ready-extension-for-prototype // which was based on work by Matthias Miller, Dean Edwards and John Resig // // Usage: // // Event.onReady(callbackFunction); Object.extend(Event, { _domReady : function() { if (arguments.callee.done) return; arguments.callee.done = true; if (Event._timer) clearInterval(Event._timer); Event._readyCallbacks.each(function(f) { f() }); Event._readyCallbacks = null; }, onReady : function(f) { if (!this._readyCallbacks) { var domReady = this._domReady; if (domReady.done) return f(); if (document.addEventListener) document.addEventListener("DOMContentLoaded", domReady, false); /*@cc_on @*/ /*@if (@_win32) var dummy = location.protocol == "https:" ? "https://javascript:void(0)" : "javascript:void(0)"; document.write("