var debug = true,
GA = function(pt) {
	// Versao 1.1 B
	// Depencias Jquery-1.3.2 + Jquery.easing.1.3 + Jquery.mousewheel
	// By Gabriel Galiaso	
	for (var k in pt) this[k] = pt[k];
}

GA.prototype = {
	'_xMover': 0,
	'idContent': '',
	'idMascara': '',
	'btMais': '',
	'btMenos':'',
	'twening': false,
	'ease': 'easeInOutBack',
	'create': function(){
		var ObjThis = this;
		
		$('#'+this.idMascara).mousewheel(function(event, delta) {
			event.stopPropagation();
		    event.preventDefault();
			
			if (delta > 0) ObjThis.changePage(1);
			else ObjThis.changePage(-1);
		});
		
		$("#"+this.btMais).css('cursor', 'pointer');
		$("#"+this.btMais).click(function(){
			ObjThis.changePage(-1);
		});
		
		$("#"+this.btMenos).css('cursor', 'pointer');
		$("#"+this.btMenos).click(function(){
			ObjThis.changePage(1);
		});
	},
	'changePage': function(op){
		var WC = $('#'+this.idContent).width();
		var WM = $('#'+this.idMascara).width();
		
			
		var TOTAL_OUT = (WC-WM);
		if(TOTAL_OUT < 0) TOTAL_OUT = 0;
		
		var posX = parseInt($('#'+this.idContent).css('left'));
		
		if(posX >= 0 && op == 1)return false;
		else{
			posX += this._xMover*op;		
			if(posX <= (TOTAL_OUT*-1)) return false;	
			
			var ObjThis = this;
			
			if(this.twening) return false;
			this.twening = true;
			
			$('#'+this.idContent).stop().animate({ 
				left: posX 
			}, 500, this.ease, 
			function(){ 
				ObjThis.twening = false;
			});
		}
		
	}
}
