/* prototype javascript framework * (c) 2005 sam stephenson * prototype is freely distributable under the terms of an mit-style license. * for details, see the prototype web site: http://prototype.conio.net/ /*--------------------------------------------------------------------------*/ //note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net). var class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } object.extend = function(destination, source) { for (property in source) destination[property] = source[property]; return destination; } function.prototype.bind = function(object) { var __method = this; return function() { return __method.apply(object, arguments); } } function.prototype.bindaseventlistener = function(object) { var __method = this; return function(event) { __method.call(object, event || window.event); } } function $() { if (arguments.length == 1) return get$(arguments[0]); var elements = []; $c(arguments).each(function(el){ elements.push(get$(el)); }); return elements; function get$(el){ if (typeof el == 'string') el = document.getelementbyid(el); return el; } } if (!window.element) var element = new object(); object.extend(element, { remove: function(element) { element = $(element); element.parentnode.removechild(element); }, hasclassname: function(element, classname) { element = $(element); if (!element) return; var hasclass = false; element.classname.split(' ').each(function(cn){ if (cn == classname) hasclass = true; }); return hasclass; }, addclassname: function(element, classname) { element = $(element); element.removeclassname(element, classname); element.classname += ' ' + classname; }, removeclassname: function(element, classname) { element = $(element); if (!element) return; var newclassname = ''; element.classname.split(' ').each(function(cn, i){ if (cn != classname){ if (i > 0) newclassname += ' '; newclassname += cn; } }); element.classname = newclassname; }, cleanwhitespace: function(element) { element = $(element); $c(element.childnodes).each(function(node){ if (node.nodetype == 3 && !/\s/.test(node.nodevalue)) element.remove(node); }); }, find: function(element, what) { element = $(element)[what]; while (element.nodetype != 1) element = element[what]; return element; } }); var position = { 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]; } }; document.getelementsbyclassname = function(classname) { var children = document.getelementsbytagname('*') || document.all; var elements = []; $c(children).each(function(child){ if (element.hasclassname(child, classname)) elements.push(child); }); return elements; } //useful array functions array.prototype.iterate = function(func){ for(var i=0;i