var Style = { getElementStyle: function(elem, property){ var ME = arguments.callee; var value = null; if(window.getComputedStyle) { var compStyle = window.getComputedStyle(elem, ''); value = compStyle.getPropertyValue(property); }else if(elem.currentStyle){ value = elem.currentStyle[property.camelize()]; //!!String.camelize() } if(value) return value; }, getDimensions: function(elem){ var width, height; width = parseInt(this.getElementStyle(elem, "width")); if(isNaN(width)) width = elem.offsetWidth; height = parseInt(this.getElementStyle(elem, "height")); if(isNaN(height)) height = elem.offsetHeight; return {width: width, height: height}; }, setElementStyle: function(objElem, propName, propVal, usePx){ var elem = (typeof objElem == "string") ? document.getElementById(objElem) : objElem; if(typeof propName == "string"){ if(usePx && (typeof propVal == "number")){ propVal += "px"; } elem.style[propName] = propVal; }else if(typeof propName == "object"){ for(var i in propName){ var val = propName[i]; if(typeof val == "number" && usePx){ val += "px"; }//if elem.style[i] = val; }//for }//if-else-if //End of FUCNTION }, getCoords: function(elem){ var left = parseInt(this.getElementStyle(elem, 'left')); var top = parseInt(this.getElementStyle(elem, 'top')); var right = parseInt(this.getElementStyle(elem, 'right')); var bottom = parseInt(this.getElementStyle(elem, 'bottom')); left = isNaN(left) ? 0 : left; top = isNaN(top) ? 0 : top; right = isNaN(right) ? 0 : right; bottom = isNaN(bottom) ? 0 : bottom; return { left: left, top: top, right: right, bottom: bottom } } }