function doDirectoryRequest(){	//Step 1		document.getElementById('fase4Button').disabled=true;	document.getElementById('fase4Button').style.cursor='wait';	document.body.style.cursor='wait';				queryIdeal('dirreq','', doneDirectoryRequest)}function doTransferRequest(){	//Step 2	document.getElementById('fase4Button').disabled=true;	document.getElementById('fase4Button').style.cursor='wait';			document.body.style.cursor='wait';	vFields=new Array("InvoiceNumber","issuerID")	queryIdeal('transreq',vFields, doneTransferRequest)		 }function doStatusRequest(){	//Step 3	document.getElementById('fase4Button').disabled=true;	document.getElementById('fase4Button').style.cursor='wait';			document.body.style.cursor='wait';		frm = document.forms.inschrijving;	for (n=0;n<frm.WijzeFacturering.length;n++){		if (frm.WijzeFacturering[n].value=='ideal'){			frm.WijzeFacturering[n].checked=true;		}	}	vFields=new Array("iDealTransactionID")	queryIdeal('statreq',vFields, doneStatusRequest)	// transactie afgesloten, cookie kan weg	Set_Cookie( 'idealinvid', '' );}function doneDirectoryRequest(sServerData){	//Step 1	vServerData=sServerData.split('#@#');	 $('div#iDealDiv').html(vServerData[1]);	 if (vServerData[0]=='true'){		document.getElementById('fase4Button').onclick=doTransferRequest;		document.getElementById('fase4Button').disabled=false;					} else {		//Change the button to return to the payment choice fase		document.getElementById('fase4Button').onclick=checkfase4;		document.getElementById('fase4Button').disabled=false;					}	document.body.style.cursor='default';	document.getElementById('fase4Button').style.cursor='default';	}function doneTransferRequest(sServerData){	//Step 2	vServerData=sServerData.split('#@#');	 if (vServerData[0]=='true'){		//URL		window.location=vServerData[1]	} else {		//Content		$('div#iDealDiv').html(vServerData[1]);		//Change the button to return to the payment choice fase		document.getElementById('fase4Button').onclick=checkfase4;			document.getElementById('fase4Button').disabled=false;				}	document.body.style.cursor='default';	document.getElementById('fase4Button').style.cursor='default';}function doneStatusRequest(sServerData){	//Step 3	vServerData=sServerData.split('#@#');	 $('div#iDealDiv').html(vServerData[1]);	 if (vServerData[0]=='true'){	 	//completed. allow switch to done		document.getElementById('fase4Button').onclick=gotofase5;		document.getElementById('fase4Button').disabled=false;		//Get invoicedata?	//		getInvoiceData(); 		sendAllFields();			 } else {		//Not payed. Give a route back		document.getElementById('fase4Button').onclick=resetfase4;			document.getElementById('fase4Button').disabled=false;				}	document.body.style.cursor='default';		document.getElementById('fase4Button').style.cursor='default';	}function queryIdeal(sAction,vFields, completedFunction){	var fieldHash='';	//Read all field values, and put them together	if (document.all){		//IE branch		for(var nInput=0;nInput<vFields.length;nInput++){			var vInput=vFields[nInput];			if (fieldHash.indexOf(vInput.name +':=')==-1){				newHash=readField(document.all[vInput])				if (newHash!=''){					if (fieldHash!=''){							fieldHash=fieldHash + '~@@~' + newHash;					} else {						fieldHash=newHash;					}				}			}				}			} else {		//Others		for(var nInput in vFields){			var vInput=vFields[nInput];			if (fieldHash.indexOf(vInput.name +':=')==-1){				newHash=readField(document.getElementsByName(vInput)[0])				if (newHash!=''){					if (fieldHash!=''){						fieldHash=fieldHash + '~@@~' + newHash;					} else {						fieldHash=newHash;					}				}			}		}	}		//Add the action to the field list	actionHash='iDealAction:=' + sAction	if (fieldHash!=''){						fieldHash=actionHash + '~@@~' + fieldHash;					} else {						fieldHash=actionHash;	}		//Submit the field values to the server	$.ajax({  		type: "POST",  		url: dbpath + "iDeal_AJAX?openagent",		dataType: "text",		data: fieldHash, 		success: completedFunction, 		error: handleIDealAjaxErrorContent	});		}function handleIDealAjaxErrorContent(data){	window.alert('An error has occurred: ' + data);}
