

function WORLDPAY_doPay(oPayForm, bShowWaitForPay){
	var sFormTarget = 'PaymentTerminal';
	var oWin = null;

	oWin = new SMPopup();
	with(oWin){
		targetName = sFormTarget;
		targetUrl = "about:blank";
		locationReplace = true;
		showScroll = true;
		showModal = false;
		pWidth = 800;
		pHeight = 560;
		openPage();
	};
	
	with(oPayForm){
		action = 'https://select.worldpay.com/wcc/purchase';
		target = sFormTarget;
		submit();
	};

	return(bShowWaitForPay);
};

function WORLDPAY_setFieldValue(fieldName, fieldValue){
	switch(fieldName){
		case 'amount':
			var oAmount = new cSMPrice();
			oAmount.decode(SMShop.basket.getAttribute(_SMAFinalSum));
			fieldValue = cprimary.format(oAmount.gross, SM_CNOFORMAT);
			break;
		case 'currency':
			fieldValue = 'EUR';
			break;
		case 'instId':
			fieldValue = '90850';
			break;
		case 'testMode':
			fieldValue = '0';
			break;
		case 'cartId':
			fieldValue = SMShop.getAttribute("sid");
			break;
		case 'desc':
			fieldValue = 'Shoes 4 Gruppe';
			break;
		case 'name':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_LASTNAME");
			break;
		case 'address':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_STREET_1");
			break;
		case 'postcode':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_POSTCODE");
			break;
		case 'country':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_COUNTRY", true);;
			break;
		case 'tel':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_PHONE_NUMBER");
			break;
		case 'fax':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_FAX_NUMBER");
			break;
		case 'email':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_EMAIL");
			break;
		case 'authMode':
			break;
		case 'accId1':
			fieldValue = '46263184';
			break;
		case 'lang':
			break;
		case 'hideCurrency':

			break;
		case 'fixContact':
			break;
		case 'hideContact':
			break;
		case 'MC_SiteDirectory':
			break;
		case 'MC_Build':
			break;
		case 'MC_Datastring':
			break;
	};
	return(fieldValue);
};

function WORLDPAY_removePayFormFields(){
	return(true);
};

function WORLDPAY_setForwardPayformFieldNames(){
	var sFields = ''; // semicolon separated string with paymethods formfields to show in ordermail
	return(sFields);
};

function WORLDPAY_setResponseQueryCaptions(param){
	var sCaption = '';
	switch(param.toLowerCase()){
		case 'transid': sCaption = 'Transaktionsnr.'; break;
		default: sCaption = param;
	};
	return(sCaption);
};