/**
 * Handles Multi Item Contollers
 * @class MultiItemContoller
 * @namesapce VZT
 */
VZT.MultiItemController = new Class({
    _view:null,
    _cur:0,
    initialize:function() {},
    setView:function(view) {
      this._view = view;
      return this;  
    },
    next:function() {
        var n = this._cur + 1;

        if (this.canGo(n)) {
            this.go(n);
        } else {
            this.first();
        }
        return this;
    },
    previous:function() {
    	var n = this._cur - 1;
    	if (this.canGo(n)) {
    		this.go(n);
    	} else {
    		this.last();
    	}
    	return this;
    },
    first:function() {
    	this.go(0);
    	return this;
    },
    last:function() {
    	this.go(this._view.getItems().length-1);
    	return this;	
    },
    _onGo:function(i) {
        //module specific implementation here
    },
    go:function(i) {
    	if (this.canGo(i)) {
    		this._onGo(i);
    	}
    	return this;
    },
    canGo:function(i) {
    	return (i >= 0 && i<this._view.getItems().length);
    }
    
});

