
$(document).ready(function() {
	$('.navigation li.active > ul').show();
	$('.navigation li.active > a').css('font-weight','bold');
	
	
	$('.orcamento-adicionar a').click(function() {
		var quantidade = $('#var_quantidade' + $(this).attr('rel')).attr('value');
		var actual = $(this);
		var parent = $(this).parent();
		var URL = $(this).attr('id');
		
		parent.append('<p class="msg">enviando para lista..</p>');
			$.post($(this).attr('href'),{produto_id: $(this).attr('rel'), var_quantidade:quantidade},function(data) {
				actual.animate( {opacity:0.5},200,function() {
					$('.lista-right a').animate( {opacity:0.5},200)
					$('.lista-right a').animate( {opacity:1},200)	
					$('p.msg').empty();
					$('p.msg').text('enviado com sucesso')
					setTimeout (function() {$('p.msg').remove()}, 1000)
					$('#total-lista').load(''+URL+'index/itens')
					actual.animate( {opacity:1},200)
				});
			});
			
		return false;
	});
	
	/*THUMBS*/
	$('.thumbs a').click(function() {
		var atual = $(this);
		var container = $('.imagemfull');
		var url = atual.attr('rel');
		var linkImagem = atual.attr('id');
		container.empty();
		
		container.append("<a href='"+url+"images/produto/"+linkImagem+"'><img width='160' height='120' src='"+url+"images/produto/"+linkImagem+"'/></a>")
		$('.imagemfull a').lightBox();
				
	});
	
	$('table.produtos input').blur(function() {
		var quantidade = $(this).attr('value');
		$.post($(this).parent().prev().find('a').attr('href'),{produto_id: $(this).attr('id'), var_quantidade:quantidade},function(data) {
			
		});
		return false;
	});
});