

function ScriptInclude(){
	this.src = "";
	this.args = new Array();
	this.set = ScriptInclude_Set;
};

function ScriptInclude_Set(){
	var tmpHTML = "";
	var tmpArgs = "";
	tmpHTML = "<script type='text\/javascript'"
		+ " src='" + this.src + "?";
	for(var i=0; i<this.args.length; i++){
		tmpArgs += this.args[i].replace("/","\/") + "&";
	};
	tmpHTML += tmpArgs;
	tmpHTML	+= "'><\/script>";
	document.write(tmpHTML);
};

if(typeof(SM_PAGEURL_SEND_ORDER_INFO) != 'undefined'){
	var sSecureTerminalLinkUrl = "https://www.smartstore.com/services/sm5/payment/saferpay/payinit.asp";
	var SIPayment = null;
	SIPayment = new ScriptInclude();
	SIPayment.src = sSecureTerminalLinkUrl;

	var oAmount = new cSMPrice();
	oAmount.decode(SMShop.basket.getAttribute(_SMAFinalSum));
	var iAmount = Math.round(cprimary.format(oAmount.gross, SM_CNOFORMAT) * 100);

	SIPayment.args[0] = "amount=" + escape(iAmount);
	SIPayment.args[1] = "curr=" + 'EUR';
	SIPayment.args[2] = "desc=" + '';
	SIPayment.args[3] = "accountid=" + '99867-94913159';

	SIPayment.args[4] = "location=" + SM_PAGEURL_SEND_ORDER_INFO;
	SIPayment.args[5] = "backURL=" + SM_PAGEURL_DATA_ENTRY_VERIFY;

	SIPayment.args[6] = "orderid=" +  SMShop.getAttribute("sid");
	SIPayment.set();
};

function SAFERPAY_doPay(oPayForm, bShowWaitForPay){
	strMode = "SMARTSTORE";
	strUrl = paymentLink;

	OpenSaferpayTerminalWindow();

	return(bShowWaitForPay);
};

function SAFERPAY_setFieldValue(fieldName, fieldValue){
	return(fieldValue);
};

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

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

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