var ppp = PAYPAL.apps.PPP({	
   "approvalUrl": "' . $approval . '",
   "placeholder": "ppplus",
   "mode": "' . $paypal->get_config('PAYPAL_MODE') . '",
   "language": "' . $_SESSION['language_code'] . '_' . $order->billing['country_iso_2'] . '",
   "country": "' . $order->billing['country_iso_2'] . '",
   "buttonLocation": "outside",
   "preselection": "paypal",
   "useraction": "continue",
   "showLoadingIndicator": "true",
   "showPuiOnSandbox": "true"
 });
 </script>' . "\n";
       $smarty->assign('javascript', $javascript);
       if (isset($_GET['payment_error'])) {
           $error = $paypal->get_error();
           $smarty->assign('error', $error['error']);
       }
       $cancel_link = xtc_href_link(FILENAME_LOGOFF, '', 'SSL');
       if (isset($_SESSION['customer_id'])) {
           $cancel_link = xtc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . (int) $_GET['oID'], 'SSL');
       }
       $smarty->assign('BUTTON_BACK', '<a href="' . $cancel_link . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>');
       $smarty->assign('BUTTON_CONTINUE', '<a href="#" onclick="ppp.doCheckout(); return false;">' . xtc_image_button('button_confirm.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</a>');
       $main_content = $smarty->fetch(DIR_FS_EXTERNAL . 'paypal/templates/ppp.html');
       $smarty->assign('main_content', $main_content);
       $smarty->assign('language', $_SESSION['language']);
       $smarty->caching = 0;
       if (!defined('RM')) {
           //$smarty->load_filter('output', 'note');
           $smarty->display(CURRENT_TEMPLATE . '/index.html');
        //Tomcraft - 2009-12-08 - fixed duplicate error messages in shopping cart
    } else {
        if (isset($_GET['info_message']) && xtc_not_null($_GET['info_message'])) {
            $smarty->assign('info_message', str_replace('+', ' ', encode_htmlspecialchars($_GET['info_message'])));
        }
        if (isset($o_paypal) && is_object($o_paypal)) {
            $smarty->assign('BUTTON_PAYPAL', $o_paypal->build_express_checkout_button());
        }
        ## PayPal
        require_once DIR_FS_EXTERNAL . 'paypal/classes/PayPalPayment.php';
        $paypal_cart = new PayPalPayment('paypalcart');
        if ($paypal_cart->enabled === true) {
            $smarty->assign('BUTTON_PAYPAL', $paypal_cart->checkout_button());
            if (isset($_GET['payment_error'])) {
                include_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/paypalcart.php';
                $error = $paypal_cart->get_error();
                $smarty->assign('info_message', $error['error']);
            }
        }
        $smarty->assign('BUTTON_RELOAD', xtc_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART));
        $smarty->assign('BUTTON_CHECKOUT', '<a href="' . xtc_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . xtc_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>');
    }
    // EOF - Tomcraft - 2009-10-03 - Paypal Express Modul
} else {
    // empty cart
    $cart_empty = true;
    //if ($_GET['info_message'])
    //  $smarty->assign('info_message', str_replace('+', ' ', encode_htmlspecialchars($_GET['info_message'])));
    $smarty->assign('cart_empty', $cart_empty);
    $smarty->assign('BUTTON_CONTINUE', '<a href="' . xtc_href_link(FILENAME_DEFAULT) . '">' . xtc_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>');
}