
function set_total_display( total, items ) {
	var total_aux = top.document.ftotal._total.value;
	total = total.replace("$","");	
	top.document.ftotal._total.value=total;
	top.document.ftotal._items.value=items;
}

function mc(carr_id, campo, maximo){
	// CTA: 10jun07, por ahora no se valida incremento maximo	
	// CTA: 31jul07, se habilita nuevamente validación incremento maximo	
	if( validar_cantidad(campo, maximo) == false ) {
		campo.value = maximo;
		//document.fc.reset();
		return;
	}
	cantidadaux = campo.value;
	if(cantidadaux == 0 ){
		if(confirm("Este producto será eliminado del carro de compra\n ¿Esta seguro de realizar la operación?")){
			var d = new Date();
			window.location = "/easy/OrderItemUpdate?carr_id0="+carr_id+"&cantidad0=0&registros=1&tm="+d.getTime();
			// Si existe categorias con productos => recarga
			//if( top.frames['ifrm_productos'] != 'undefined' && top.frames['ifrm_productos'] != null ) {	
			//	top.frames['ifrm_productos'].location.reload();
			//}
		}else{
			document.fc.reset();
		}
	}else{
		var d = new Date();
		top.frames['ifrm_carro'].location.href="/easy/OrderItemUpdate?carr_id0="+carr_id+"&cantidad0="+cantidadaux+"&registros=1&tm="+d.getTime();
	}
}

function addCarro( campo, incremento, maximo, id ) {
	var valor = 0;
	if (campo.value == "" || campo.value == "undefined"){
		campo.value = 0;
	}	
	valor = parseFloat(campo.value) + parseFloat(incremento);
	valor = Math.round(valor*1000)/1000;
	campo.value = valor;

	mc(id,campo,maximo);
}

function del( campo, incremento, maximo, id ) {
	var valor = 0;
	if (campo.value == "" || campo.value == "undefined"){
		campo.value = 0;
	}	
	valor = parseFloat(campo.value) - parseFloat(incremento);
	valor = Math.round(valor*1000)/1000;
	if( valor < 0 ) {
		campo.value = 0;
	}
	else
		campo.value = valor;
	mc(id,campo,maximo);
}

