function addLoadEvent(fun) { var oldonload = window.onload; if(typeof(window.onload) != 'function') { window.onload = fun; } else { window.onload = function() { oldonload(); fun(); } } } //function insertAfter(newElement, targentElement) function insertAfter(insertedNode, adjacentNode) { var parent = adjacentNode.parentNode; if(parent.lastChild == adjacentNode) { parent.appendChild(insertedNode); } else { parent.insertBefore(insertedNode, adjacentNode.nextSibling); } }