// JavaScript Document
function addRemoveCart(id, priceID, node)
{
	var action = node.src = node.src.indexOf(emptyCart) > -1 ? 'add' : 'remove';
	
	$.post('/store/cfoscom/ajax/cartAction.cfm',
		   {
			id:id,
			priceID:priceID,
			action:action
		   },
		   function(data,textStatus)
		   {
				onCartStatus(data,textStatus,node)
		   }
		  )
}
function onCartStatus(data,textStatus,node)
{
	/*var notification = node.src.indexOf('add') > -1 ? 'Added' : 'Removed'
	$(node).fadeOut('slow',function(){
		node.src = node.src.indexOf('add') > -1 ? fullCart : emptyCart;
		$(this).fadeIn('slow',function(){addNotification($(this), 'Item ' + notification);});
									}
									);*/
	window.location.href = '/store/cart.cfm';
	
}

function addRemoveMFL(id,node)
{
	var action = node.src = node.src.indexOf(emptyCart) > -1 ? 'add' : 'remove';
	
	$.post('/store/cfoscom/ajax/mflAction.cfm',
		   {
			id:id,
			action:action
		   },
		   function(data,textStatus)
		   {
				onCartStatus(data,textStatus,node)
		   }
		  )
}
function addNotification(node,msg)
{
	var id = $('.notification').size() + 1;
	var html = '<div class="msg hint notification" id="notification_' + id + '">' + msg + '</div>';
	$('body').append(html);
	var theNotification = $('#notification_' + id);
	theNotification.css({'left': node.offset().left + node.width() + 12,'top':node.offset().top});
	
	var theInt = setInterval(function(){theNotification.fadeOut('slow'); clearInterval(theInt)},750);
}
