	function new_proj_id(which) {
		current = $("#destaques div.current").attr("id");
		var num = current.substring(current.lastIndexOf('_') + 1, current.length);
		if(which == 'next')
			num++;
		else
			num--;
		var new_id = 'item_' + num;
		return new_id;
		}
	
	function get_last_project_id() {
		return $("#destaques div.last").attr("id");
		}
	
	function set_current(id) {
		$("#destaques .current").removeClass('current');
		$('#' + id).addClass('current');
		}
						
	function next_project(e) {
		if($('#destaques div.current').hasClass('last')) {
			to_project('item_1', 1200);
			}
		else {
			var new_id = new_proj_id('next');
			to_project(new_id, 600);		
			}
		return preventDefaultAction(e);
		}	
	
	function previous_project(e) {
		if($('#destaques div.current').hasClass('first')) {
			var last_id = get_last_project_id()
			to_project(last_id, 1200);	
			}
		else {
			var new_id = new_proj_id('previous');	
			to_project(new_id, 600);
			}
		return preventDefaultAction(e);
		}
		
	function to_project(new_id, speed) {
		if(speed) {
			$("#destaques").animate({
					left: 140-$('#' + new_id).position().left
					}, speed);
				set_current(new_id);
			}
		else {
			$("#destaques").animate({
					left: 140-$('#' + new_id).position().left
					}, 600);
				set_current(new_id);
			}
		}
	
	function init() {
			$("#next_btn").click(next_project);
			$("#previous_btn").click(previous_project);
			
			$('div.item_info, div.item_info_bg').fadeTo(5, 0);
			$('div.item_info, div.item_info_bg').show();
			$('div.item_info').hover(
				function() {$(this).fadeTo('normal', 1); $(this).siblings('div.item_info_bg').fadeTo('normal', .93);},
				function() {$(this).fadeTo('normal', 0);$(this).siblings('div.item_info_bg').fadeTo('normal', 0);}
				);
			
			$('div.item_info2, div.item_info2_bg').fadeTo(5, 0);
			$('div.item_info2, div.item_info2_bg').show();
			$('div.item_info2').hover(
				function() {$(this).fadeTo('normal', 1);$(this).siblings('div.item_info2_bg').fadeTo('normal', .93);},
				function() {$(this).fadeTo('normal', 0);$(this).siblings('div.item_info2_bg').fadeTo('normal', 0);}
				);
			
			$('div.item_info3, div.item_info3_bg').fadeTo(5, 0);
			$('div.item_info3, div.item_info3_bg').show();
			$('div.item_info3').hover(
				function() {$(this).fadeTo('normal', 1);$(this).siblings('div.item_info3_bg').fadeTo('normal', .93);},
				function() {$(this).fadeTo('normal', 0);$(this).siblings('div.item_info3_bg').fadeTo('normal', 0);}
				);

		}
		
	$(document).ready(function(){
		init();	 
	});