/* Copyright (c) 2008, MyBlock Author: Kristoffer Ahl, Spinit AB =Valid comments: =BUG: Denotes a bug =TODO: Denotes that something needs to be done =KLUDGE: Denotes a hack or something that could be nicer =NOTE: Denotes extra information =Namespaces for MyBlock MB MB.Ajax MB.Common MB.Common.Authentication MB.Common.Search MB.Common.TipInvitation MB.Components {...} MB.Config {...} MB.Maps MB.Pages {...} MB.UI MB.UI.ExpandCollapse MB.Utilities MB.Validation MB.Web.UI.WebControls.MessageManager =Requirements for Core methods: Object.prototype RegExp */ /* =TODO: Test and document browser compatibility */ /* =TODO: Add comments for variables, functions, methods etc */ /* =MB */ var MB = function() { /** * @description Contains the base name. * @property base_name * @private * @static * @type string */ var base_name = "MB"; return { // =init init : function() { if (!Object.prototype) { return false; } else { String.prototype.trim = function() { return MB.trim(this); }; String.prototype.toBool = function() { return MB.toBool(this); }; } }, // =addClass addClass : function (elem,cls) { if (elem.nodeType != 1) return true; if (!elem.className) { elem.className = cls; } else { elem.className += " " + cls; } }, // =addEvent addEvent : function(obj,evType,fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } }, // =createNamespace createNamespace : function() { var args=arguments, args_length, obj=null, i, j, parts, parts_length; for (i=0, args_length=args.length; i