// JavaScript Document
var path = "lib/";

function updateOrder(itemid)
{
	$.getJSON((path + "ajax/updateorder.php"),
		  	{
			ID: itemid,
			Quantity: $('#Qty_' + itemid).val()
			},
		   function (json)
		   {
			if(json.Reload == 1)
			{
				window.location.reload();
			}

			$('#Qty_' + itemid).val(json.Quantity);

			$('#row_' + itemid + ' .Price').fadeOut(function ()
				{
					$(this).html(json.Price).fadeIn("medium");
				});

			$('#Total_Products').fadeOut(function ()
								{
									$(this).html(json.Total_Products).fadeIn("medium");
								});

			$('#Total_Quantity').fadeOut(function ()
								{
									$(this).html(json.Total_Quantity).fadeIn("medium");
								});

			$('#Total_Price').fadeOut(function ()
								{
									$(this).html(json.Total_Price).fadeIn("medium");
								});

			$('#Total_PST').fadeOut(function ()
								{
									$(this).html(json.Total_PST).fadeIn("medium");
								});

			$('#Total_GST').fadeOut(function ()
								{
									$(this).html(json.Total_GST).fadeIn("medium");
								});

			$('#Total').fadeOut(function ()
								{
									$(this).html(json.Total).fadeIn("medium");
								});
		});
}

function saveNotes(id)
{
	$.post(path + "ajax/notes.save.php",
			{
				ID: id,
				Private: $('#Private_Notes').val(),
				Notes: $('#Notes').val()
			},
			function (data)
			{
				$('#notes_udpate').html("Notes Updated");
			});
}
