	var shippingMethods = new Array();
	
	function getShippingMethod(shipID){
		for(var i=0; i<shippingMethods.length; i++){ if(shippingMethods[i].ID == shipID){ return(shippingMethods[i]);break; }; };
		return(null);
		};

	function addZoneToShippingMethod(shipID, zoneID){
	var myShMeth, myZone;
		myShMeth = getShippingMethod(shipID); myZone = myShMeth.zones[myShMeth.zones.length] = new shippingMethodZone(zoneID);
		if(myShMeth!=null) return(myZone)
		else return(null);
		};
		
	function addTableToZoneCalculator(shipID, zoneID, tableID){
	var myShMeth, myZone, myTable, myCalc;
		myShMeth = getShippingMethod(shipID);
		myTable = new shippingMethodTableCalculatorTable(tableID);
		if(myShMeth!=null){
			myZone = myShMeth.getZoneByID(zoneID);
			if(myZone!=null){
				if(myZone.calculator.tables!=null) myTable = myZone.calculator.tables[myZone.calculator.tables.length] = new shippingMethodTableCalculatorTable(tableID);
				};
			};
		return(myTable);
		};
			// shippingmethod
			function shippingMethod(shipID){
				this.ID = shipID; this.number = ""; this.name = ""; this.description = ""; this.taxclass = 1; this.zones = new Array();
				// methods
				this.getZoneByCountry = shippingMethodGetZoneByCountry;
				this.getZoneByDefault = shippingMethodGetZoneByDefault;
				this.getZoneByID = shippingMethodGetZoneByID;
				this.set = shippingMethodSet;
				};
//
				function shippingMethodGetZoneByCountry(Country){
					for(var i=0; i<this.zones.length; i++){ if(this.zones[i].countryIsMember(Country)){ return(this.zones[i]);break; }; };
					if(this.getZoneByDefault()!=null) return(this.getZoneByDefault());
					return(this.zones[0]);
					};
//
				function shippingMethodGetZoneByDefault(){
				var zone;
					for(var i=0; i<this.zones.length; i++){ if(this.zones[i].isDefault){ return(this.zones[i]);break; }; };
					return(null);
					};
//
				function shippingMethodGetZoneByID(zoneID){
				var zone;
					for(var i=0; i<this.zones.length; i++){ if(this.zones[i].ID == zoneID){ return(this.zones[i]);break; }; };
					return(null);
					};
//
				function shippingMethodSet(name, description, taxclass, number){
					this.name = name; this.description = description; this.taxclass = taxclass; this.number = number;
					};
//
					function shippingMethodZone(zoneID){
						this.ID = zoneID; this.name = ""; this.isDefault = false; this.calculator = null; this.countries = new Array();
						// methods
						this.countryIsMember = shippingMethodZoneCountryIsMember;
						this.calcCharge = shippingMethodZoneCalcCharge;
						this.set = shippingMethodZoneSet;
						};
//
						function shippingMethodZoneCountryIsMember(Country){
							for(var i=0; i<this.countries.length; i++){ if(this.countries[i]==Country){ return(true);break; }; };
								return(false);
							};
//
						function shippingMethodZoneCalcCharge(LTP, LTW, LTI){
							return(this.calculator.calcCharge(LTP, LTW, LTI));
							};
//
						function shippingMethodZoneSet(name, countries, isDefault){
							this.name = name; this.countries = countries.split(","); this.isDefault = isDefault;
							};
//
						function shippingMethodStaticCalculator(calcID){
							this.ID = calcID; this.charge = 0; this.freeOfChargeFrom = -1;
							// dummy tables array
							this.tables = new Array();
							// methods
							this.calcCharge = shippingMethodStaticCalculatorCalcCharge;
							this.set = shippingMethodStaticCalculatorSet;
							};
//
							function shippingMethodStaticCalculatorCalcCharge(LTP, LTW, LTI){
								if(LTP>=parseFloat(this.freeOfChargeFrom)&&parseFloat(this.freeOfChargeFrom)!=parseFloat(0)) return(0)
								else return(parseFloat(this.charge));
								};
//
							function shippingMethodStaticCalculatorSet(charge, freeOfChargeFrom){
								this.charge = charge; this.freeOfChargeFrom = freeOfChargeFrom;
								};
//
						function shippingMethodDynamicCalculator(calcID){
							this.ID = calcID; this.percentage = 0; this.base = 0; this.max = -1; this.freeOfChargeFrom = -1; this.measurement = 0;
							// dummy tables array
							this.tables = new Array();
							// methods
							this.calcCharge = shippingMethodDynamicCalculatorCalcCharge;
							this.set = shippingMethodDynamicCalculatorSet;
							};
//
							function shippingMethodDynamicCalculatorCalcCharge(LTP, LTW, LTI){
							var charge = parseFloat(this.base);
								if(parseFloat(LTP)>=parseFloat(this.freeOfChargeFrom)&&parseFloat(this.freeOfChargeFrom)!=parseFloat(0)) return(0)
								else{
									if(this.measurement==0) charge += parseFloat(LTP) * parseFloat(this.percentage) / 100
									else if(this.measurement==1) charge += parseFloat(LTW) * parseFloat(this.percentage); 
									else charge += parseFloat(LTI) * parseFloat(this.percentage);
									if(parseFloat(charge)>=parseFloat(this.max)&&parseFloat(this.max)!=0) charge = this.max;
									return(charge);
									};
								};
//
						function shippingMethodDynamicCalculatorSet(percentage, base, max, freeOfChargeFrom, measurement){
							this.percentage = percentage; this.base = base; this.max = max; this.freeOfChargeFrom = freeOfChargeFrom; this.measurement = measurement;
							};
//
						function shippingMethodTableCalculator(calcID){
							this.ID = calcID; this.measurement = 0; this.tables = new Array();
							// methods
							this.getTableByUnit = shippingMethodTableCalculatorGetTableByUnit;
							this.calcCharge = shippingMethodTableCalculatorCalcCharge;
							this.set = shippingMethodTableCalculatorSet;
							};
//
							function shippingMethodTableCalculatorGetTableByUnit(unit){
							var table = null;
								for(var i=0; i<this.tables.length; i++){
									if(parseFloat(this.tables[i].upToAmount)>=unit){
										if(table==null) table = this.tables[i]
										else if(this.tables[i].upToAmount<table.upToAmount) table = this.tables[i];
										};
									};
								if(table==null){
									table = this.tables[0];
									for(var i=1; i<this.tables.length; i++){
										if(parseFloat(this.tables[i].upToAmount)>table.upToAmount) table = this.tables[i];
										};
									};
								return(table);
								};
//
							function shippingMethodTableCalculatorCalcCharge(LTP, LTW, LTI){
							var table = null;
							var unit;
								if(this.measurement==0) unit = parseFloat(LTP)
								else if(this.measurement==1) unit = parseFloat(LTW)
								else unit = parseFloat(LTI);
								table = this.getTableByUnit(unit);
								return(table.calcCharge(unit));
								};
//
							function shippingMethodTableCalculatorSet(measurement){
								this.measurement = measurement;
								};
//
							function shippingMethodTableCalculatorTable(tableID){
								this.ID = tableID; this.upToAmount = -1; this.isFixed = true; this.charge = 0;
								// methods
								this.calcCharge = shippingMethodTableCalculatorTableCalcCharge;
								this.set = shippingMethodTableCalculatorTableSet;
								};
//
								function shippingMethodTableCalculatorTableCalcCharge(unit){
									if(this.isFixed) return(this.charge)
									else return(this.charge * unit);
									};
//
								function shippingMethodTableCalculatorTableSet(upToAmount, isFixed, charge){
									this.upToAmount = upToAmount; this.isFixed = isFixed; this.charge = charge;
									};
//
	var myShMeth, myZone, myCalc, myTable;
	
	function createCalculator(CalcType, ID, Charge, FreeOfChargeFrom, Percentage, Base, Max, Measurement){
	var calculator = null;
		if(CalcType==0){ calculator = new shippingMethodStaticCalculator(ID); calculator.set(Charge, FreeOfChargeFrom); }
		else{
			if(CalcType==1){ calculator = new shippingMethodDynamicCalculator(ID); calculator.set(Percentage, Base, Max, FreeOfChargeFrom, Measurement); }
			else{ calculator = new shippingMethodTableCalculator(ID); calculator.set(Measurement); };
			};
		return(calculator);
		};
	

	myShMeth = shippingMethods[shippingMethods.length] = new shippingMethod("1037135902");myShMeth.set("Standard (only to the USA)","If not mentioned differently in the product description, please allow 2-3 weeks for shipment after receipt of your order",1,"Standard  (only to the USA)");

	myZone = addZoneToShippingMethod("1037135902","1121006036");myZone.set("Unbenannt","US",false);myZone.calculator = createCalculator(2, "42613317", 0, 0, 0, 0, 0, 0);

	myTable = addTableToZoneCalculator("1037135902","-99899065","-1876693811");myTable.set(4,true,5.62);
	myTable = addTableToZoneCalculator("1037135902","-99899065","-1890529782");myTable.set(8,true,6.39);
	myTable = addTableToZoneCalculator("1037135902","-99899065","-1697565757");myTable.set(12,true,7.16);
	myTable = addTableToZoneCalculator("1037135902","-99899065","-1928901816");myTable.set(20,true,8.69);
	myTable = addTableToZoneCalculator("1037135902","-99899065","-1041568855");myTable.set(999999,true,0);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-218161669");myTable.set(59.99,true,45);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-2084257631");myTable.set(99.99,true,70);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-1310293426");myTable.set(149.99,true,90);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-334038089");myTable.set(169.99,true,95);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-1057969876");myTable.set(199.99,true,100);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-1857338179");myTable.set(249.99,true,110);
	myTable = addTableToZoneCalculator("1037135902","1121006036","2019878084");myTable.set(129.99,true,82);
	myTable = addTableToZoneCalculator("1037135902","1121006036","742674037");myTable.set(299.99,true,129);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-1560146517");myTable.set(399.99,true,120);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-748418800");myTable.set(499.99,true,125);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-54921263");myTable.set(599.99,true,120);
	myTable = addTableToZoneCalculator("1037135902","1121006036","546723262");myTable.set(699.99,true,110);
	myTable = addTableToZoneCalculator("1037135902","1121006036","83215975");myTable.set(799.99,true,100);
	myTable = addTableToZoneCalculator("1037135902","1121006036","1136414122");myTable.set(9999.9,true,0);
	myTable = addTableToZoneCalculator("1037135902","1121006036","1125774405");myTable.set(69.99,true,52);
	myTable = addTableToZoneCalculator("1037135902","1121006036","-1790579166");myTable.set(79.99,true,59);
	myTable = addTableToZoneCalculator("1037135902","1121006036","1874683899");myTable.set(89.99,true,66);

function displPrice(aPrice,aTax){
	var taxamount = taxarea[xmlConfig.taxarea][parseInt(aTax) + 1];
	if(boolDisplTaxIncl){
		if(boolPriceTaxIncl) return(aPrice)
		else return aPrice * ( 1 + taxamount/100 );
		}
	else{
		if(boolPriceTaxIncl) return aPrice * ( 1 - taxamount/( 100 + taxamount ) )
		else return aPrice;
		};
	};
	
var defaultShipmentId = 1037135902;

function setShipment(anId){
var	myTotalItems = calculateTotalItems();
var myCountry = "";
var subtotal = 0;
	for(var i=0;i<shippingMethods.length;i++){
		if(parseInt(shippingMethods[i].ID) == parseInt(anId)){
			xmlOHeader.DeliveryMethodCode = shippingMethods[i].ID;
			xmlOHeader.DeliveryMethodName = shippingMethods[i].name;
			xmlOHeader.DeliveryMethodDesc = shippingMethods[i].description;
			xmlOHeader.DeliveryMethodTaxClass = shippingMethods[i].taxclass;
			xmlOHeader.DeliveryMethodTaxRate = taxarea[xmlConfig.taxarea][parseInt(shippingMethods[i].taxclass) + 1];
			// LinesTotalNet
			if(boolDisplTaxIncl) subtotal = xmlOHeader.TotalPriceGrossLC
			else subtotal = xmlOHeader.TotalPriceNetLC;
			// TotalWeight
			myTotalWeight = xmlOHeader.TotalWeight;
			if(xmlConfig.dataEnteredShipTo=="true"&&getElementByID(xmlOrder,'ShipToDiffers').checked=="1") 	myCountry = getElementByID(xmlOrder, "Ecom_ShipTo_Postal_CountryCode").getFirstItem("option").value
			else myCountry = getElementByID(xmlOrder, "Ecom_BillTo_Postal_CountryCode").getFirstItem("option").value
			myCharge = shippingMethods[i].getZoneByCountry(myCountry).calcCharge(subtotal,myTotalWeight,myTotalItems);
			if(boolPriceTaxIncl){
				xmlOHeader.ShippingNetLC = TFormatCurrencyValue(myCharge * ( 1 - parseFloat(xmlOHeader.DeliveryMethodTaxRate)/( 100 + parseFloat(xmlOHeader.DeliveryMethodTaxRate) ) ), objLeadCurrency);
				xmlOHeader.ShippingGrossLC = TFormatCurrencyValue(myCharge, objLeadCurrency);
				}
			else{
				xmlOHeader.ShippingNetLC = TFormatCurrencyValue(myCharge, objLeadCurrency);
				xmlOHeader.ShippingGrossLC = TFormatCurrencyValue(myCharge * ( 1 + parseFloat(xmlOHeader.DeliveryMethodTaxRate)/100 ), objLeadCurrency);
				};
			xmlOHeader.DeliveryMethodTaxValue = TFormatCurrencyValue(xmlOHeader.ShippingGrossLC - xmlOHeader.ShippingNetLC,objLeadCurrency);
			};
		};
	};
	
function finalizeShipment(){
	for(var i=0;i<document.forms[0].elements.length;i++){
		if(document.forms[0].elements[i].checked == true){ setShipment(document.forms[0].elements[i].value); break; };
		};
	};
	
function displayShipment(){
	var	myTotalItems = calculateTotalItems();
	var myCountry = "";
	if(xmlConfig.dataEnteredShipTo=="true"&&getElementByID(xmlOrder,'ShipToDiffers').checked=="1") 	myCountry = getElementByID(xmlOrder, "Ecom_ShipTo_Postal_CountryCode").getFirstItem("option").value
	else myCountry = getElementByID(xmlOrder, "Ecom_BillTo_Postal_CountryCode").getFirstItem("option").value;
	document.write('<TABLE class="SHIPMENTPARENT" border="0" cellpadding="3" cellspacing="0" >');
	document.write('<form name="Shipment">');
	document.write('<TR><td class="SHIPMENTHEADER">&nbsp;</td>');
	document.write('<td class="SHIPMENTHEADER" nowrap>Shipping Method</td>');	
	document.write('<td class="SHIPMENTHEADER" width="100%">Description</td>');	
	document.write('<td class="SHIPMENTHEADER">Price</td></tr>');	
	myTotalWeight = xmlOHeader.TotalWeight;
	if(boolDisplTaxIncl) subtotal = xmlOHeader.TotalPriceGrossLC
	else subtotal = xmlOHeader.TotalPriceNetLC;
	for(var i=0;i<shippingMethods.length;i++){
		document.write('<TR>');
		document.write('<TD class="SHIPMENTBODY"><input type="Radio" name="ShipmentMethodRadio" value=' + shippingMethods[i].ID);
		if(shippingMethods[i].ID == defaultShipmentId) document.write(" checked");
		document.write('></TD>');
		document.write('<TD class="SHIPMENTBODY" nowrap>' + shippingMethods[i].name + '&nbsp;</TD>');
		document.write('<TD class="SHIPMENTBODY">' + shippingMethods[i].description + '&nbsp;</TD>');
		document.write('<TD class="SHIPMENTBODY" nowrap>' + TFormatCurrency(displPrice(shippingMethods[i].getZoneByCountry(myCountry).calcCharge(subtotal,myTotalWeight,myTotalItems),shippingMethods[i].taxclass),objPriCurrency) + '&nbsp;</TD>');
		document.write("</TR>");
		};
	document.write('<TR>');
	document.write('<TD colspan="5"><input type="Button" name="btnBack" value="< Back" onClick="history.go(-1)" class="BUTTON">'
		+ '&nbsp;<input type="Button" name="btnContinue" value="Next >" onClick="finalizeShipment();requestSSL(\'pchase_verify.htm\');" class="BUTTON"></td>');
	document.write('</TR>');
	document.write('</form>');
	document.write("</TABLE>");
	};

function calculateTotalItems(){
var myLines = xmlOHeader.childNodes.length
var myTotalItems = 0;
	for(var i=0; i<myLines; i++){
		myTotalItems += parseInt(xmlOHeader.childNodes[i].QuantityAmount);
		};
	return(myTotalItems);
	};