function ConvertCurrency()
{
    $CCRequest = new ConvertCurrencyRequest();
    $list = array();
    $baseamount = array('1.00', '100.00');
    $fromcode = array('GBP', 'EUR');
    $tocode = array('USD', 'CAD', 'JPY');
    for ($i = 0; $i < count($baseamount); $i++) {
        $ccType = new currency();
        $ccType->amount = $baseamount[$i];
        $ccType->code = $fromcode[$i];
        $list[$i] = $ccType;
    }
    $clist = array();
    for ($i = 0; $i < count($tocode); $i++) {
        $clist[$i] = array('currencyCode' => $tocode[$i]);
    }
    $CCRequest->baseAmountList = $list;
    $CCRequest->convertToCurrencyList = $clist;
    $CCRequest->requestEnvelope = new RequestEnvelope();
    $CCRequest->requestEnvelope->errorLanguage = "en_US";
    $ap = new AdaptivePayments();
    $response = $ap->ConvertCurrency($CCRequest);
    if (strtoupper($ap->isSuccess) == 'FAILURE') {
        $FaultMsg = $ap->getLastError();
        echo "Transaction ConvertCurrency Failed: error Id: ";
        if (is_array($FaultMsg->error)) {
            echo $FaultMsg->error[0]->errorId . ", error message: " . $FaultMsg->error[0]->message;
        } else {
            echo $FaultMsg->error->errorId . ", error message: " . $FaultMsg->error->message;
        }
    } else {
        echo "ConvertCurrency Transaction Successful! \n";
    }
}
    for ($i = 0; $i < count($_POST['baseamount']); $i++) {
        $ccType = new currency();
        $ccType->amount = $_REQUEST['baseamount'][$i];
        $ccType->code = $_REQUEST['fromcode'][$i];
        $list[$i] = $ccType;
    }
    $clist = array();
    for ($i = 0; $i < count($_POST['tocode']); $i++) {
        $clist[$i] = array('currencyCode' => $_REQUEST['tocode'][$i]);
    }
    $CCRequest->baseAmountList = $list;
    $CCRequest->convertToCurrencyList = $clist;
    $CCRequest->requestEnvelope = new RequestEnvelope();
    $CCRequest->requestEnvelope->errorLanguage = "en_US";
    $ap = new AdaptivePayments();
    $response = $ap->ConvertCurrency($CCRequest);
    /* Display the API response back to the browser.
    		   If the response from PayPal was a success, display the response parameters'
    		   If the response was an error, display the errors received using APIError.php.
    		*/
    if (empty($response->estimatedAmountTable)) {
        echo "<center><br><br><b>Invalid response from server</b><br></center>";
        echo "<center><a  href='Calls.html'>Home</a></center>";
        exit;
    }
    if (strtoupper($ap->isSuccess) == 'FAILURE') {
        $_SESSION['FAULTMSG'] = $ap->getLastError();
        $location = "APIError.php";
        header("Location: {$location}");
    }
} catch (Exception $ex) {