$(document).ready(function(){
	/* Carrossel Img Produtos */
	var itemSize = $(".carrossel-produto ul li").length,
		itemShow = 3,
		itemWidth = 78,
		mLeft = -5;
	
	$(".box-img-produto .btn-voltar").click(function(){
		if (mLeft < (itemWidth * -1)){
			mLeft = mLeft + itemWidth;		
			$(".carrossel-produto ul").animate({marginLeft: mLeft + 10}, 200);
		};
	});
	
	$(".box-img-produto .btn-avancar").click(function(){
		if (mLeft > ((itemSize * itemWidth) - (itemShow * itemWidth)) * -1){
			mLeft = mLeft - itemWidth;
			$(".carrossel-produto ul").animate({marginLeft: mLeft}, 200);
		};
	});
	
	$(".carrossel-produto ul li img").click(function(){
		var urlImg = $(this).attr('src').replace('miniatura/', '');
		
		$('img.imgGrande').attr('src', urlImg);
	})
	/* //Carrossel Img Produtos */
	
	// Retorna as caracteristicas do produto de acordo com a linha escolhida
	$("#selLinha").change(function(){
		$.ajax({
			cache: false,
			success: function(resposta)
			{
				$("div.box-listagem-caracteristica").html(resposta);
			},
			data: 'LinhaID=' + $(this).val() + '&ProdutoID=' + $("#hdnProduto").val(),
			type: "post",
			url: CAMINHO_ABSOLUTO  + 'produtos/carregar-produto-caracteristica'
		});
	});
});
