Helper function that is called whenever a new item is selected
function _setSelectedItem(index) {
        if (index !== this._selectedItemIndex) {
            var oldIndex = this._selectedItemIndex;
            this._selectedItemIndex = index;
            this.layout.setLayoutOptions({
                selectedItemIndex: index
            });
            if ((oldIndex >= 0) && this._renderables.items[oldIndex].removeClass){
                this._renderables.items[oldIndex].removeClass('selected');
            }
            if (this._renderables.items[index].addClass) {
                this._renderables.items[index].addClass('selected');
            }
            if (oldIndex >= 0) {
                this._eventOutput.emit('tabchange', {
                    target: this,
                    index: index,
                    oldIndex: oldIndex,
                    item: this._renderables.items[index],
                    oldItem: ((oldIndex >= 0) && (oldIndex < this._renderables.items.length)) ? this._renderables.items[oldIndex] : undefined
                });
            }
        }
    }