
function DeletProduct(IndexID)	
{
	var res = NYT.MyCartNew.DeletProductFromCart(IndexID);
	//var resCartItem = 
	if(res.error != null)
	{
		alert(res.error.Message);
		return;
	}
	else
	{	
		//$("ItemsInCurt").innerHtml = res[0];
		$("ItemsInCurt").update(res.value[0]);
		//$("ItemsInCurt").update( "<b>asdsadasdas d</b>");
	}
}

function ChangeQuantity(indexId, isReq, Kindex, totalPack, event)
{
	
	
	var NewQuentity;
	var CurPrice;
	var contID;
/*	var el = Event.element(event);
	alert("Hello1")
	util.clearError(el);*/
	if(isReq==0)
	{
		NewQuentity = +$F("txtPro"+indexId);
		contID = "txtPro"+indexId	
	}
	else
	{
		NewQuentity = +$F("txtReq_"+indexId+"_"+Kindex)
		contID = "txtReq_"+indexId+"_"+Kindex
	}
	
	if(util.isEmpty(NewQuentity) || !NewQuentity ){
		util.stop(contID , 'Quantity must be more than zero (0).',event);
		util.setError(contID);
		return;	
	}
	if(totalPack && !util.isDigit(NewQuentity)){
		
		util.stop(contID , 'Pack quantity must be a positive integer number.',event);
		util.setError(contID);
		return;
	}
	
	var resCartItem = NYT.MyCartNew.ChangeQuantity(indexId,isReq, Kindex, NewQuentity);
	if(resCartItem.error != null)
	{
		alert(res.error.Message);
		return;
	}
	else
	{
		objCart[indexId] = resCartItem.value;
	}
	
	var proValue	= objCart[indexId];
	
	if(isReq==0)
	{
		
		var UnitPerPact = proValue.UnitPerPack;
		var CostPerUnit = proValue.CostPerUnit;
		if(UnitPerPact > 0)
		{
			CurPrice = NewQuentity * UnitPerPact * CostPerUnit; 
		}
		else
		{
			CurPrice = NewQuentity * CostPerUnit; 
		}
		
		$("txtProx"+indexId).value = util.toCurrency(CurPrice).toString();
	}
	else
	{

		var resRequerItem = proValue.RequaredItems[Kindex];

		var ReqControlVal = $F("txtReq_"+indexId+"_"+Kindex)
		
		var UnitPerPact = resRequerItem.UnitPerPact;
		var CostPerUnit = resRequerItem.CostPerUnit;
		if(UnitPerPact > 0)
		{
			CurPrice = NewQuentity * UnitPerPact * CostPerUnit; 
		}
		else
		{
			CurPrice = NewQuentity * CostPerUnit; 
		}
		$("lblReqPrice_"+indexId+"_"+Kindex).update(util.toCurrency(CurPrice));
	}
	//CalculateTotal();
}
