function getItemPrice(form_name, n) {
	$.post('/functions/get_price.php', 
	$('#'+form_name).serialize()+'&n='+n+'&form='+form_name, function(data) { if (data) { eval(data); } });
}

function addItem(form_name, n) {
	$.post('/functions/add_item.php', 
	$('#'+form_name).serialize()+'&n='+n+'&form='+form_name, function(data) { if (data) { eval(data); } });
}

function showHelp(n) {
	if (document.getElementById('help_'+n) != undefined) {
		$('#help_'+n).fadeIn('fast');
	}
}

function hideHelp(n) {
	if (document.getElementById('help_'+n) != undefined) {
		$('#help_'+n).fadeOut('fast');
	}
}

/* På bestillingslisten */

$(document).ready(function() {
	$("#code_new").autocomplete({
		select: function(event, ui) {
			//window.location.href = 'order.php?id=<? echo $order->id; ?>&tab=4&add='+ui.item.value;
			$.post('/functions/add_empty_item.php', {'item_id':ui.item.id}, function(data) { if (data) { eval(data); } window.location.href = window.location.href; });
		},
		source: function(request, response) {
			jQuery.ajax({
				url: "/functions/find_item.php",
				dataType: "json",
				data: {
					term : request.term,
				},
				success: function(data) {
					response(data);
				}
			});
		}
	});
});