public/javascripts/yui/carousel/carousel-debug.js
function (val) {
            var carousel   = this,
                isCircular = carousel.get("isCircular"),
                numItems   = carousel.get("numItems"),
                sentinel   = numItems - 1;

            if (val < 0) {
                if (isCircular) {
                    val = numItems + val;
                } else {
                    val = carousel.get("selectedItem");
                }
            } else if (val > sentinel) {
                if (isCircular) {
                    val = val - numItems;
                } else {
                    val = carousel.get("selectedItem");
                }
            }
            return val;
        }
function (val) {
            var carousel   = this,
                isCircular = carousel.get("isCircular"),
                numItems   = carousel.get("numItems"),
                sentinel   = numItems - 1;

            if (val < 0) {
                if (isCircular) {
                    val = numItems + val;
                } else {
                    val = carousel.get("selectedItem");
                }
            } else if (val > sentinel) {
                if (isCircular) {
                    val = val - numItems;
                } else {
                    val = carousel.get("selectedItem");
                }
            }
            return val;
        }
function ( val ) { var carousel = this , isCircular = carousel . get ( "isCircular" ) , numItems = carousel . get ( "numItems" ) , sentinel = numItems - 1 ; if ( val < 0 ) { if ( isCircular ) { val = numItems + val ; } else { val = carousel . get ( "selectedItem" ) ; } } else if ( val > sentinel ) { if ( isCircular ) { val = val - numItems ; } else { val = carousel . get ( "selectedItem" ) ; } } return val ; }
Get the value for the selected item.

@method _getSelectedItem
@param val {Number} The new value for "selected" item
@return {Number} The new value that would be set
@protected
Get the value for the selected item .