function DoCartThing(CPayment,Lang)
{
	//Lang = 0;
	
	Indx=CPayment;
	
	with (document.SaveOrder.Pass_Shipping) 
	{
		document.SaveOrder.Pass_Shipping.options.length=0;
		
		if (Indx==3)
		{
			document.getElementById('QuoteRem').innerHTML = '';
			document.getElementById('Pass_ShippingCost').value = '0.00';
			document.getElementById('Pass_TotCost').value = document.getElementById('TotCost').value;
			
		}
		
		else if (Indx==4)
		{
			// Update Courier Combo Box
			options[0]=new Option("EMS18","EMS18");
			options[1]=new Option("REGISTADO","REGISTADO");
			
			// Do the Calculations
			MyShip = document.getElementById('ShippingCost').value;
			//document.getElementById('ShipIt').innerHTML = '€ ' +  MyShip;
			document.getElementById('ShipIt').innerHTML = '-.--';
			
			MyTot = document.getElementById('TotCost').value;
			//MyGTot = parseFloat(MyShip) + parseFloat(MyTot);
			//MyGTotS = formatCurrency(MyGTot);			
			MyGTotS = formatCurrency(MyTot);
			document.getElementById('OrderCost').innerHTML = '<strong> € ' + MyGTotS + '</strong>';
			
			// Remove the to be quoted message
			//document.getElementById('QuoteRem').innerHTML = '';
			// Update to be quoted message
			if (Lang == 0) { QuoteM = '* Envio mediante orçamento.'; }
			if (Lang == 1) { QuoteM = '* Shipping to be quoted.'; }
			document.getElementById('QuoteRem').innerHTML = QuoteM;
			
			// Update values to be posted
			//document.getElementById('Pass_ShippingCost').value = document.getElementById('ShippingCost').value;
			//document.getElementById('Pass_TotCost').value = MyGTotS;
			
			// Update values to be posted
			document.getElementById('Pass_ShippingCost').value = '0.00';
			document.getElementById('Pass_TotCost').value = document.getElementById('TotCost').value;
		}
		else
		{
			// Update Courier Combo Box

			if (Lang == 0) { OtherM = 'OUTRO'; }
			if (Lang == 1) { OtherM = 'OTHER'; }
			
			options[0]=new Option("CORREIO VERDE","CORREIO VERDE");
			options[1]=new Option("REGISTADO","REGISTADO");
			options[2]=new Option("EMS18","EMS18");
			options[3]=new Option(OtherM,OtherM);
			
			// Do the Calculations
			document.getElementById('ShipIt').innerHTML = '-.--';
			MyGTotS = document.getElementById('TotCost').value;
			document.getElementById('OrderCost').innerHTML = '<strong> € ' + MyGTotS + '</strong>';
			
			// Update to be quoted message
			if (Lang == 0) { QuoteM = '* Envio mediante orçamento.'; }
			if (Lang == 1) { QuoteM = '* Shipping to be quoted.'; }
			document.getElementById('QuoteRem').innerHTML = QuoteM;
			
			// Update values to be posted
			document.getElementById('Pass_ShippingCost').value = '0.00';
			document.getElementById('Pass_TotCost').value = document.getElementById('TotCost').value;
			
		}


	}
	
}


function formatCurrency(num) {

	num = num.toString().replace(/\$|\,/g,'');

	if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();

	if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));

	return (((sign)?'':'-') + num + '.' + cents);
	
}







