function show_project(cod_id, url, title, categories) {
	$('body').css({overflow: 'hidden'});
	$('#project_detail').fadeIn('slow');
	$("#content_overlay").fadeIn('slow');
	get_work_images(cod_id);
	if (url == '') {
		$('a.a_site').hide();
	} else {
		$('a.a_site').show();
		$('a.a_site').attr("href", url);
	}
	$('h3.title').html(title+'<small>Category: '+categories+'</small>');
}

function close_overlay() {
	$('body').css({overflow: 'scroll'});
	$('#project_detail').fadeOut('slow');
	$("#content_overlay").fadeOut('slow');
}

$(document).ready(function(){

	close_overlay();
	$("#images_count").html($(".slider_wrap ul li").length);

	/* FUNCIONALIDAD DEL CARRUSEL */


	$("li.next_btn").click( function () {
		var vItems = [];
		vItems = $(".slider_wrap ul li");
		if (vItems.length-indice_visible_detail-2 > 0) {			
			indice_visible_detail++;

			$("#current_image").html(indice_visible_detail+2);

			if (indice_visible_detail == 0) {
				$("li.prev_btn").removeClass('disabled');
			}
			vItems.eq(indice_visible_detail).animate({ 
				opacity: 0,
			}, 'slow');
			vItems.eq(indice_visible_detail+1).animate({ 
				opacity: 1,
			}, 'slow');
	
			vslider = $(".slider_wrap ul");
			vslider.animate( {
				marginLeft:(-590*(indice_visible_detail+1)),
			}, 'slow');
			if (vItems.length-indice_visible_detail-2 == 0) {
				$(this).addClass('disabled');
			}
		}
	});

	$("li.prev_btn").click( function () {

		if (indice_visible_detail >= 0) {
			var vItems = [];
			vItems = $(".slider_wrap ul li");
			vItems.eq(indice_visible_detail).animate({ 
				opacity: 1,
			}, 'slow');
			vItems.eq(indice_visible_detail+1).animate({ 
				opacity: 0,
			}, 'slow');
	
			vslider = $(".slider_wrap ul");
			vslider.animate( {
				marginLeft:-590*indice_visible_detail,
			}, 'slow');
	
			indice_visible_detail--;
			$("#current_image").html(indice_visible_detail+2);
			if (indice_visible_detail == -1) {		
				$(this).addClass('disabled');
			}
			if (vItems.length-indice_visible_detail-2 > 0) {		
				$("li.next_btn").removeClass('disabled');
			}
		}
	});
 });
