//this function returns all children of the element as associated array function getAllChildren(elem){ var obj = {}; var chNam = 'child'; for(var i = 0; i < elem.childNodes.length; i++){ var node = elem.childNodes[i]; obj[chNam + i] = {}; obj[chNam + i].elem = node; obj[chNam + i].type = node.nodeType; if(node.firstChild){ obj[chNam + i].children = getAllChildren(node); } } return obj; } //this function parses the associated array made by the previous function //and executes the function 'func' passed as the parameter function showAllChildren(obj, func){ for(var i in obj){ func.call(window, obj[i]); if(obj[i].children){ showAllChildren(obj[i].children, func); } } } Array.prototype._invert = function(){ var arr = []; for(var i = this.length - 1; i >= 0; i--){ arr.push(this[i]); } return arr; } function GetObjectModel(elem, objectModel){ while(typeof elem[objectModel] == "undefined"){ elem = elem.parentNode; } return elem[objectModel]; } /* For DragDrop */ function GetThis(elem, thisName){ var el = elem; while(typeof el[thisName] == 'undefined'){ el = el.parentNode; } return el[thisName]; } function MergeObjects(toObject, fromObject){ for(var i in fromObject){ toObject[i] = fromObject[i]; } return toObject; } /*************************/ /* For all */ String.prototype.camelize = function(){ var arrThis = this.split('-'); if(arrThis.length == 1){ return this; }else{ var wordCamelized = arrThis[0]; var firstSymbol; for(var i = 1; i < arrThis.length; i++){ firstSymbol = arrThis[i].substr(0, 1); arrThis[i] = arrThis[i].substr(1); arrThis[i] = firstSymbol.toUpperCase() + arrThis[i]; wordCamelized+=arrThis[i]; } return wordCamelized; } } /*************************/