caph.app.addScene('MoviesScene', $class({
    $extends: ListScene,

    getSceneOption: function() {
    	return {
    		title: 'CAPH VIDEO',
    		selectedCategory: 'Movies',
    		list: {
    			row: 2,
    			column: 7.07,
    			width: Style.width - Style.listLeft, 
    			height: Style.height - Style.listTop - Style.listMarginBottom,
    			x: Style.listLeft, 
    			y: Style.listTop,
    			decorateItem: function(data, index) {
    				return ListItem.getMovie({
    	    			id: data.id,
    	    			genreId: data.genre.id,
    	        		title: data.title,
    	        		publishYear: data.publishYear,
    	    			thumbnailUrl: '../../' + Style.imageRootPath + data.thumbnailUrl
    	        	});
    			},
    			onnextpage: function() {
    				/* server version
    				caph.xhr(listUrl, {
                    	type: 'JSON',
                    	parameter: {
                    		id: 2,
                    		start: this.getItemCount(),
                    		offset: 4
                    	}
                    }).then(function(result) {
                    	var value = result.value;
                    	
                    	if (value.status === 'OK' && value.dataList.length > 0) {
                    		this.addItems(value.dataList);
                    	}
                    }.bind(this));	
    				*/
    			}
    		}
    	}
    },
    
    onshow: function(message) {
    	this.$super(message);
    	
    	this.bottom.on({
			keydown: function(message) {
				var source = message.source;

				if (message.key().up && source.getProperty('data-list-item-index') % 2 === 0) {
					message.stopPropagation();
					currentCategory.focus();
				}
			}
		});
    	
    	if (this.bottom.getItemCount() < 1) {
    		// local version
        	caph.xhr(listUrl[2], {
        		type: 'JSON'
        	}).then(function(result) {
        		var value = result.value;
        		
        		if (value.status === 'OK') {
        			this.bottom.addItems(value.dataList);
        			currentItem = this.bottom.getCurrentPositionItem();
        		}
        	}.bind(this));
        	
        	/* server version
        	caph.xhr(listUrl, {
            	type: 'JSON',
            	parameter: {
            		id: 2,
            		start: 0,
            		offset: 16
            	}
            }).then(function(result) {
        		var value = result.value;
        		
        		if (value.status === 'OK') {
        			this.bottom.addItems(value.dataList);
        			currentItem = this.bottom.getCurrentPositionItem();
        		}
        	}.bind(this));
        	*/
    	} else {
    		currentItem = this.bottom.getCurrentPositionItem();
    	}
    	
    	currentCategory = this.top.getChildren()[2];
    	currentCategory.focus();
    }
}));