public/javascripts/yui/carousel/carousel-debug.js
function getStyle(el, style, type) {
        var value;

        if (!el) {
            return 0;
        }

        function getStyleIntVal(el, style) {
            var val;

            /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */
            if (style == "marginRight" && YAHOO.env.ua.webkit) {
                val = parseInt(Dom.getStyle(el, "marginLeft"), 10);
            } else {
                val = parseInt(Dom.getStyle(el, style), 10);
            }

            return JS.isNumber(val) ? val : 0;
        }

        function getStyleFloatVal(el, style) {
            var val;

            /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */
            if (style == "marginRight" && YAHOO.env.ua.webkit) {
                val = parseFloat(Dom.getStyle(el, "marginLeft"));
            } else {
                val = parseFloat(Dom.getStyle(el, style));
            }

            return JS.isNumber(val) ? val : 0;
        }

        if (typeof type == "undefined") {
            type = "int";
        }

        switch (style) {
        case "height":
            value = el.offsetHeight;
            if (value > 0) {
                value += getStyleIntVal(el, "marginTop")        +
                        getStyleIntVal(el, "marginBottom");
            } else {
                value = getStyleFloatVal(el, "height")          +
                        getStyleIntVal(el, "marginTop")         +
                        getStyleIntVal(el, "marginBottom")      +
                        getStyleIntVal(el, "borderTopWidth")    +
                        getStyleIntVal(el, "borderBottomWidth") +
                        getStyleIntVal(el, "paddingTop")        +
                        getStyleIntVal(el, "paddingBottom");
            }
            break;
        case "width":
            value = el.offsetWidth;
            if (value > 0) {
                value += getStyleIntVal(el, "marginLeft")       +
                        getStyleIntVal(el, "marginRight");
            } else {
                value = getStyleFloatVal(el, "width")           +
                        getStyleIntVal(el, "marginLeft")        +
                        getStyleIntVal(el, "marginRight")       +
                        getStyleIntVal(el, "borderLeftWidth")   +
                        getStyleIntVal(el, "borderRightWidth")  +
                        getStyleIntVal(el, "paddingLeft")       +
                        getStyleIntVal(el, "paddingRight");
            }
            break;
        default:
            if (type == "int") {
                value = getStyleIntVal(el, style);
            } else if (type == "float") {
                value = getStyleFloatVal(el, style);
            } else {
                value = Dom.getStyle(el, style);
            }
            break;
        }

        return value;
    }
function getStyle(el, style, type) {
        var value;

        if (!el) {
            return 0;
        }

        function getStyleIntVal(el, style) {
            var val;

            /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */
            if (style == "marginRight" && YAHOO.env.ua.webkit) {
                val = parseInt(Dom.getStyle(el, "marginLeft"), 10);
            } else {
                val = parseInt(Dom.getStyle(el, style), 10);
            }

            return JS.isNumber(val) ? val : 0;
        }

        function getStyleFloatVal(el, style) {
            var val;

            /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */
            if (style == "marginRight" && YAHOO.env.ua.webkit) {
                val = parseFloat(Dom.getStyle(el, "marginLeft"));
            } else {
                val = parseFloat(Dom.getStyle(el, style));
            }

            return JS.isNumber(val) ? val : 0;
        }

        if (typeof type == "undefined") {
            type = "int";
        }

        switch (style) {
        case "height":
            value = el.offsetHeight;
            if (value > 0) {
                value += getStyleIntVal(el, "marginTop")        +
                        getStyleIntVal(el, "marginBottom");
            } else {
                value = getStyleFloatVal(el, "height")          +
                        getStyleIntVal(el, "marginTop")         +
                        getStyleIntVal(el, "marginBottom")      +
                        getStyleIntVal(el, "borderTopWidth")    +
                        getStyleIntVal(el, "borderBottomWidth") +
                        getStyleIntVal(el, "paddingTop")        +
                        getStyleIntVal(el, "paddingBottom");
            }
            break;
        case "width":
            value = el.offsetWidth;
            if (value > 0) {
                value += getStyleIntVal(el, "marginLeft")       +
                        getStyleIntVal(el, "marginRight");
            } else {
                value = getStyleFloatVal(el, "width")           +
                        getStyleIntVal(el, "marginLeft")        +
                        getStyleIntVal(el, "marginRight")       +
                        getStyleIntVal(el, "borderLeftWidth")   +
                        getStyleIntVal(el, "borderRightWidth")  +
                        getStyleIntVal(el, "paddingLeft")       +
                        getStyleIntVal(el, "paddingRight");
            }
            break;
        default:
            if (type == "int") {
                value = getStyleIntVal(el, style);
            } else if (type == "float") {
                value = getStyleFloatVal(el, style);
            } else {
                value = Dom.getStyle(el, style);
            }
            break;
        }

        return value;
    }
function getStyle ( el , style , type ) { var value ; if ( ! el ) { return 0 ; } function getStyleIntVal ( el , style ) { var val ; /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */ if ( style == "marginRight" && YAHOO . env . ua . webkit ) { val = parseInt ( Dom . getStyle ( el , "marginLeft" ) , 10 ) ; } else { val = parseInt ( Dom . getStyle ( el , style ) , 10 ) ; } return JS . isNumber ( val ) ? val : 0 ; } function getStyleFloatVal ( el , style ) { var val ; /*
             * XXX: Safari calculates incorrect marginRight for an element
             * which has its parent element style set to overflow: hidden
             * https://bugs.webkit.org/show_bug.cgi?id=13343
             * Let us assume marginLeft == marginRight
             */ if ( style == "marginRight" && YAHOO . env . ua . webkit ) { val = parseFloat ( Dom . getStyle ( el , "marginLeft" ) ) ; } else { val = parseFloat ( Dom . getStyle ( el , style ) ) ; } return JS . isNumber ( val ) ? val : 0 ; } if ( typeof type == "undefined" ) { type = "int" ; } switch ( style ) { case "height" : value = el . offsetHeight ; if ( value > 0 ) { value += getStyleIntVal ( el , "marginTop" ) + getStyleIntVal ( el , "marginBottom" ) ; } else { value = getStyleFloatVal ( el , "height" ) + getStyleIntVal ( el , "marginTop" ) + getStyleIntVal ( el , "marginBottom" ) + getStyleIntVal ( el , "borderTopWidth" ) + getStyleIntVal ( el , "borderBottomWidth" ) + getStyleIntVal ( el , "paddingTop" ) + getStyleIntVal ( el , "paddingBottom" ) ; } break ; case "width" : value = el . offsetWidth ; if ( value > 0 ) { value += getStyleIntVal ( el , "marginLeft" ) + getStyleIntVal ( el , "marginRight" ) ; } else { value = getStyleFloatVal ( el , "width" ) + getStyleIntVal ( el , "marginLeft" ) + getStyleIntVal ( el , "marginRight" ) + getStyleIntVal ( el , "borderLeftWidth" ) + getStyleIntVal ( el , "borderRightWidth" ) + getStyleIntVal ( el , "paddingLeft" ) + getStyleIntVal ( el , "paddingRight" ) ; } break ; default : if ( type == "int" ) { value = getStyleIntVal ( el , style ) ; } else if ( type == "float" ) { value = getStyleFloatVal ( el , style ) ; } else { value = Dom . getStyle ( el , style ) ; } break ; } return value ; }
Get the computed style of an element.

@method getStyle
@param el {HTMLElement} The element for which the style needs to be
returned.
@param style {String} The style attribute
@param type {String} "int", "float", etc. (defaults to int)
@private
Get the computed style of an element .