var SM_RESOURCEURL_LOGO = SMOMAbsoluteRootURL + "/";

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


	oWin = new SMPopup();

	with(oWin){
		targetName = sFormTarget;
		targetUrl = "https://e-payment.postfinance.ch/ncol/prod/orderstandard.asp";
		locationReplace = true;
		showScroll = true;
		showModal = false;
		pWidth = 800;
		pHeight = 560;
		openPage();
	};

	

	with(oPayForm){
		action = 'https://e-payment.postfinance.ch/ncol/prod/orderstandard.asp';
		target = sFormTarget;
		submit();
	};

	return(bShowWaitForPay);
};

function YELLOWPAY2_setFieldValue(fieldName, fieldValue)
{
	switch(fieldName){

		case 'pspid':
			fieldValue =  "artethio"; 
			break;
		case 'orderid':
			fieldValue =  SMShop.getAttribute("sid"); 
			break;
		case 'amount':
			var oAmount = new cSMPrice();
			oAmount.decode(SMShop.basket.getAttribute(_SMAFinalSum));
			fieldValue = cprimary.format(oAmount.gross, SM_CNOFORMAT).toFixed(2) * 100;
			break;
		case 'currency':
			fieldValue =  SMShop.basket.getAttribute("p-cur-iso"); 
			break;
		case 'language':
			//Kann das aus der Shopkonfigurationggezogen werden?
			fieldValue =  "de_DE"; 
			break;

		case 'email':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_EMAIL"); 
			break;
		case 'owneraddress':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_STREET_1"); 
			break;
		case 'ownercty':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_COUNTRY"); 
			break;
		case 'ownertelno':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_STREET_1"); 
			break;
		case 'ownertown':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_CITY"); 
			break;
		case 'ownerzip':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_POSTCODE"); 
			break;


		case 'accepturl':
			fieldValue = SM_PAGEURL_POPPAY_SUCCESS; 
			break;
		case 'declineurl':
			fieldValue = SM_PAGEURL_POPPAY_CANCEL; 
			break;
		case 'exceptionurl':
			fieldValue = SM_PAGEURL_POPPAY_CANCEL; 
			break;
		case 'cancelurl':
			fieldValue = SM_PAGEURL_POPPAY_CANCEL; 
			break;


		case 'shasign':
			var oAmount = new cSMPrice();
			oAmount.decode(SMShop.basket.getAttribute(_SMAFinalSum));
			var shaString = SMShop.getAttribute("sid");
			shaString += cprimary.format(oAmount.gross, SM_CNOFORMAT).toFixed(2) * 100;
			shaString += SMShop.basket.getAttribute("p-cur-iso");
			shaString += "artethio";
			shaString += "0123456789";
			fieldValue = SHA1(shaString);
			break;
		/*
		case 'logo':
			fieldValue = SM_RESOURCEURL_LOGO; 
			break;
		*/
	};
	return(fieldValue);
};

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

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

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