
function handleEnterPack(id, event) 
	{
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) 
		{
			update_pack(id,'qtyUsrPack_'+id);
			return false;	
			
		} 
	} 


function handleEnter(id, event) 
	{
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) 
		{
			update(id,'qtyUsrItem_'+id);
			return false;	
			
		} 
	} 
	
function update_pack(id,qtyid)
{
	
	var val;
	try
	{
		val=document.getElementById(qtyid).value;
		if(isNaN(val))
		{
			alert("Please choose numeric quantity");
			document.getElementById(qtyid).select();
		}
		else
		{
			if(val<1)
			{
				if(confirm("Are you sure to delete this package?"))
				{
					window.location=("mycart.php?Act=DeletePack&packId=" + id);
				}
			}
			else
			{
				window.location=("mycart.php?Act=EditPack&packId=" + id +"&packQty=" + val);
			}
		}
	}
	catch(c)
	{
		alert(c);
	}

}
	
function update(id,qtyid)
{
	var val;
	try
	{
		val=document.getElementById(qtyid).value;
		if(isNaN(val))
		{
			alert("Please choose numeric quantity");
			document.getElementById(qtyid).select();
		}
		else
		{
			if(val<1)
			{
				if(confirm("Are you sure to delete this item?"))
				{
					window.location=("mycart.php?Act=Delete&proId=" + id);
				}
			}
			else
			{
				window.location=("mycart.php?Act=Edit&proId=" + id +"&proQty=" + val);
			}
		}
	}
	catch(c)
	{
		alert(c);
	}
			
}
function DeleteAll()
{
	if(confirm("Are you sure to delete all items from your cart?"))
	{
		window.location=("mycart.php?Act=DeleteAll");
	}
			
}
function ConfirmDelete(name,url)
{
	if(confirm("Are you sure to delete item "  + name + " from your cart?"))
	{
		window.location=(url);
	}
	else
		return false;
			
}
function ConfirmDelete_pack(name,url)
{
	if(confirm("Are you sure to delete this "  + name + " from your cart?"))
	{
		window.location=(url);
	}
	else
		return false;
			
}
function ConfirmChkout(val)
{
	var CoupenCode;
	CoupenCode = document.getElementById("vCoupenCode").value
	if(confirm("Are you sure to Checkout? \n Currently " + val + " Item(s) available in your cart."))
	{
		//alert("Wait a while, This is under construction");
		window.location="checkout.php?Act=1&ccode=" + CoupenCode;
	}
	else
		return false;
}