(function($){
	$.Galeria = {

		__constructor : function(){
			var me = this;
			me.initConfig();

			// targets (bind em elementos passando o evento)
			$('#arrowleft').click(me.moveLeft);
			$('#arrowright').click(me.moveRight);
		},

		atual: 4,
		total:null,
		larguraFoto:173,

		moveLeft: function() {
			me = $.Galeria;
			atual = me.atual;
			total = me.total.length;
			//alert('atual ->'+atual+' total -> '+total);
			if (atual > 4) {
				me.atual--;
				$('#scroll div.box').scrollTo({left:'-='+me.larguraFoto, top:0}, 600);
			} else {
				$('#scroll div.box').scrollTo(me.larguraFoto*(total-4), 1000);
				me.atual = total;
			}
		},

		moveRight: function() {
			me = $.Galeria;
			atual = me.atual;
			total = me.total.length;

			if ((total > 4) && (atual < total)) {
				me.atual++;
				$('#scroll div.box').scrollTo({left:'+='+me.larguraFoto, top:0}, 600);
			} else {
				me.atual = 4;
				$('#scroll div.box').scrollTo(0, 1000);
			}
		},

		initConfig: function() {
			var me = this;

			$.scrollTo.defaults.axis = 'xy';
			$('#scroll div.box').scrollTo(0);
			me.total = $("#scroll ul li");
		}

	}
})(jQuery);
