function addToCart(productID, productIndex, productPrice, productImage, strAttributes)
{
	var ele = document.getElementById('item'+productID);
	//Make ajax call for update
	 $.ajax({
	   type: "GET",
	   data: "opt=add&new_price="+productPrice+"&id="+productID+'&attributes='+strAttributes+'&hash='+parseInt(Math.random() * 10000000000),
	   url: "cart_process.php",
	   success: function(msg){
		    //Shows the effect
			showAddEffect(ele, "moving"+productID, 'moving_blk', productImage, productIndex, msg);
	   }
   });
}

function showAddEffect(parentDiv, divID, divClass, divImage, divIndex, msg)
{
	cartHeight = $('#cart_wrap')[0].offsetHeight;
	var newdiv = document.createElement('div');
	if(divIndex)
	{
		newdiv.style.top = ((Math.ceil(divIndex/3)-1) * 297 + 50)+'px';
		newdiv.style.left = (((divIndex-1) % 3) * 185 + 200)+'px';
	}
	newdiv.setAttribute("id", divID);
	newdiv.className = divClass;
	newdiv.innerHTML = '<img src="'+divImage+'">';
	parentDiv.appendChild(newdiv);
	$(divID).css('opacity', '0.5');
	$('#'+divID).animate({left:"823px", top:"0px", width: "175px", height: (cartHeight-5)+"px", opacity:".3"}, 1000, function(){
			$(this).fadeOut(1000, function(){
				parentDiv.removeChild(newdiv);
				arrTemp1 = msg.split('<|||>');
				$('#cart_blk').css({paddingLeft:"5px", paddingTop:"5px"});
				$('#cart_blk')[0].innerHTML = arrTemp1[0];
				$('#cart_btm')[0].innerHTML = arrTemp1[1];
				$('#cart_blk').slideDown(1000, function(){
					$('#cart_btm').slideDown();
					$('#cart_top')[0].innerHTML = '<div style="float:left"><a href="shopping_cart.php" class="lnkwht1">CART</a></div><div style="float:right;padding-right:10px;"><a href="javascript:void(0)" onclick="javascript:hideCart()"><img id="arrow_blk" src="img/sort_asc_white.gif" style="border:0px"></a></div><div class="spacer"></div>';
					totalQuantity = arrTemp1[2];
					grandTotal = arrTemp1[3];

					//Change top cart with effect
					changeTopCart(totalQuantity, grandTotal);
					});
				});
		});
}
