var $a = jQuery.noConflict()

var Geral = {

	__construct: function() {
		_this = Geral;
		$a.scrollTo.defaults.axis = 'xy';
		$a('.lista').scrollTo(0);
		$a('.bt02').click(_this.moveLeft);
		$a('.bt01').click(_this.moveRight);
	}, 
	
	atual: 3,

	moveLeft: function() {
		_this = Geral;
		atual = _this.atual;
		
		if (atual > 3) {
			_this.atual--;
			$a('.lista').scrollTo({top:0, left:'-=61px'}, 600);
		}
		return false;
	},
	
	moveRight: function() {
		_this = Geral;
		atual = _this.atual;
		var tam = $a(".lista ul li").length;
		if ((tam > 3) && (atual != tam-1)) {
			_this.atual++;
			$a('.lista').scrollTo({top:0, left:'+=61px'}, 600);
		} else {
			_this.atual = 3;
			$a('.lista').scrollTo(0, 1000);
		}
		return false;
	}
}

$a(function(){	

	Geral.__construct();

	$a("input[type='text'],input[type='password'],textarea").resetDefaultValue();

	//Fontes
	Cufon.replace(['.tt-destaque strong', '#depoimentos h2', '.box h2', 'secao'], {
		hover: true
	});

	$a(".video").cycle({
		fx: "scrollHorz",
		prev: ".bt-prev",
		next: ".bt-next",
		timeout: 0
	});
	
	$a('.lista ul li a').each(function(){
		$a(this).click(function(){
			$a(".lista ul li").removeClass("current");
			$a(this).parent().addClass("current");
			coment = $a(this).parent().find('.lista-eventos').html();
			$a(".eventos").empty().html(coment).find(".evento").slideDown();
			//console.log(coment);
			return false;
		});
	});

	$a("#redes-sociais ul li").hover(function(){
		var tooltip = $a(this).find("a").attr("title");
		//alert(tooltip);
		$a(this).append("<span class='title'>" + tooltip + "</span>");
		$a(this).animate({
			bottom: "3px"
		},100);
	}, function(){
		$a(this).find("span").remove();
		$a(this).animate({
			bottom: 0
		},100);
	});
	
	// select and go
	
	$a('select.and-go').change(function(){
		location.href = $a(this).val();
	});

});
