//Load the growl type notifications for the cart items when added to cart
	var roar = new Roar({
		position: 'upperRight',
		duration: 3000 // 3 seconds until message fades out
	});

// Add items to the cart and change the "Add To Cart" image to "Item Added" and send growl notify to user
function add_cart (id, cart_item, qty, whse, bu){
	
	// Here we need to send the part to the ajax cart page and add the item to the users cart table
     var new_cart_item = new Request.HTML({  
        method: 'get',  
        url: '/ajax/cart.php',  
        onRequest: function() { 
			
			$('cart_part_items_holder').innerHTML = '<img src="/images/loading.gif" alt="" />'; 
			
			},  
        update: $('cart_part_items_holder'),  
        onComplete: function(response) { 
			
			$(id).innerHTML = '<img src="/images/added-cart-sm.gif" alt="Item Added" />'; 
			roar.alert('New Cart Item', 'Part ' + cart_item + ' Added To Cart'); 
			cart_count();
			
			}  
     
	 }).send("inv_id=" + cart_item + "&qty=" + $(qty).value + "&whse=" + whse + "&customer_group=" + bu);  
	 	
}

// Add items to the cart and change the "Add To Cart" image to "Item Added" and send growl notify to user
function add_cart_no_right (id, cart_item, qty, whse, bu){
	
	if(whse == "WA"){
	
	 	bu = "NC";
	
	}
	
	// Here we need to send the part to the ajax cart page and add the item to the users cart table
     var new_cart_item = new Request.HTML({  
        method: 'get',  
        url: '/ajax/cart.php',  
        onComplete: function(response) { 
			
			$(id).innerHTML = '<img src="/images/added-cart-sm.gif" alt="Item Added" />'; 
			roar.alert('New Cart Item', 'Part ' + cart_item + ' Added To Cart'); 
			cart_count();
			
			}  
     
	 }).send("inv_id=" + cart_item + "&qty=" + $(qty).value + "&whse=" + whse + "&customer_group=" + bu);  
	 	
}

// Update the cart count in the header so that it's always updated when a user adds new items to the cart
function cart_count(){
	
	    var count_cart = new Request.HTML({  
        method: 'get',  
        url: '/ajax/cart_count.php',  
        update: $('cart_qty')  
	 
	 }).send(); 
		
}

function show_pending_orders(appendage) {
	$('pending_add_button'+appendage).style.display = "none";
	$('pending_order_list'+appendage).style.display = "";
}

function pick_pending_order(appendage,qid, ids, cart_item, qty, whse, bu, price){
	$('pending_order_list'+appendage).style.display = "none";
	$('pending_add_button'+appendage).style.display = "";
     var new_order_item = new Request.HTML({  
        method: 'get',  
        url: '/ajax/pending_add.php',  
        onComplete: function(response) { 
        	//cut this out so they could add to a second order without reloading page.
        	//$('pb'+appendage).innerHTML = "<img src=\"/images/added-cart-sm.gif\" alt=\"Item Added To Pending Order\" title=\"Item Added To Pending Order\" />";
			roar.alert('New Item', 'Part ' + cart_item + ' Added To Pending Order ' + qid); 
		}       
	 }).send("queue_id=" + qid + "&inv_id=" + cart_item + "&qty=" + qty + "&whse=" + whse + "&customer_group=" + bu + "&price=" + price);  
}


