function printObject(o) { var out = ''; for (var p in o) { if (o[p] && typeof o[p] !== 'function') out += p+': '+o[p]+', \r\n'; } return '{'+out+'}'; } function getObject(id) { if (objectExists(document.getElementById(id))) return document.getElementById(id); return false; } function getValue(obj, attribute) { if (objectExists(obj)) return obj.getAttribute(attribute); return null; } function setValue(obj, attribute, value) { if (objectExists(obj)) obj.setAttribute(attribute, value); } function objectExists(obj) { if (typeof obj === 'undefined') return false; if (obj == null) return false; return true; } function objectSize(id) { var obj = getObject(id); if (obj) return obj.getBoundingClientRect(); return false; } function debug(text) { createComment("\r\nDEBUG: "+printObject(text)); } function createComment(comment) { document.body.appendChild(document.createComment(comment)) } function setStyle(obj, name, value) { if (objectExists(obj)) obj.style.setProperty(name, value); } function getStyle(obj, name) { if (objectExists(obj)) return obj.style.getPropertyValue(name); return null; }