function perform($page, $actionName)
    {
        // Auslesen der Daten
        global $registrationhandleraddress;
        global $registrationsenderaddress;
        global $infomailaddress;
        // function to correct the date format
        function korr_datum($datum1)
        {
            $datum = $datum1['Y'];
            if (strlen($datum1['M']) < 2) {
                $datum .= "-0" . $datum1['M'];
            } else {
                $datum .= "-" . $datum1['M'];
            }
            if (strlen($datum1['d']) < 2) {
                $datum .= "-0" . $datum1['d'];
            } else {
                $datum .= "-" . $datum1['d'];
            }
            return $datum;
        }
        $values = $page->controller->exportValues();
        $mdb2 =& MDB2::singleton();
        if (PEAR::isError($mdb2)) {
            die("Error while connecting : " . $mdb2->getMessage());
        }
        $sql1 = 'INSERT INTO participants SET firstname = ?, lastname = ?, preferred_name = ?, title = ?, street = ?,
		postcode = ?, city = ?, country = ?, countrytext = ?, phone = ?, mobile = ?, email = ?, dateofbirth = ?, 
		maritalstatus = ?, gender = ?, passport_name = ?, passport_no = ?, passport_dateofissue = ?, 
		passport_dateofexpire = ?, nationality = ?, nationalitytext = ?, invitation_letter = ?, 
		emergency_firstname = ?, emergency_lastname = ?, emergency_phone = ?, sj_reason = ?, 
		special_job = ?, part_type = ?, jobwish_2 = ?, status = ?';
        $sth = $mdb2->prepare($sql1, $typen, MDB2_PREPARE_RESULT);
        if (PEAR::isError($mdb2)) {
            die("Error while preparing : " . $mdb2->getMessage());
        }
        $daten = array(utf8_decode($values['firstname']), utf8_decode($values['lastname']), utf8_decode($values['preferredname']), utf8_decode($values['title']), utf8_decode($values['street']), $values['plzort']['postcode'], utf8_decode($values['plzort']['city']), $values['countrygroup']['country'], $values['countrygroup']['othercountry'], $values['phone'], $values['handy'], $values['email'], korr_datum($values['dateofbirth']), $values['maritalstatus'], $values['gender'], utf8_decode($values['passportname']), utf8_decode($values['passportno']));
        $daten[] = korr_datum($values['dateofissue']);
        $daten[] = korr_datum($values['dateofexpire']);
        $daten[] = $values['nationgroup']['nationality'];
        $daten[] = utf8_decode($values['nationgroup']['othernation']);
        $daten[] = $page->controller->exportValue('seite1', 'invitationletter');
        $daten[] = utf8_decode($values['emergency_firstname']);
        $daten[] = utf8_decode($values['emergency_lastname']);
        $daten[] = $values['emergency_phone'];
        $daten[] = utf8_decode($values['staff_text']);
        $daten[] = $values['parttype'];
        $daten[] = '5';
        // part type == 5 means staff
        $daten[] = $values['exhib_acco'];
        $daten[] = '1';
        // status field
        $affRow = $sth->execute($daten);
        if (PEAR::isError($affRow)) {
            die("Error while executing : " . $affRow->getMessage());
        }
        $last_id = $mdb2->lastInsertID('participants', 'id');
        if (PEAR::isError($last_id)) {
            die('failed... Fehler:' . $last_id->getMessage());
            //  echo ($mdb2->getMessage().' - '.$mdb2->getUserinfo());
        }
        $sth->Free();
        $sql1 = "SELECT fee, name FROM countries WHERE id=" . $values['countrygroup']['country'];
        $erg =& $mdb2->query($sql1);
        if (PEAR::isError($erg)) {
            die($erg->getMessage());
        }
        while ($row = $erg->fetchRow()) {
            $preis = $row[0];
            $land_name = $row[1];
        }
        $erg->Free();
        $zufall = rand(100, 999);
        $pdffile = 'pdfs/' . $zufall . '_' . $last_id . '_' . date("Ymd") . '.pdf';
        // now let's create a PDF file
        create_pdf($values, $last_id, $pdffile, $preis, $land_name);
        $text = T_("Dear") . " " . $values["firstname"] . "\n\n";
        $text .= T_("we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe.");
        $text .= "\n \n";
        $text .= "You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe.";
        $text .= "\n \n";
        $text .= htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        $text .= "\n \n";
        $text .= htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is sent to the Bank (see details attached if not paid by credit card) and you send us the signed registration form. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        $text .= "\n \n";
        $text .= T_("Please ensure that this happens so that we can process your registration as quickly as possible.");
        $text .= "\n \n";
        $text .= T_("Please find attached all necessary documents again in the PDF format.") . "\n";
        $text .= T_("You may download this PDF file right here:") . " ";
        $text .= "https://register.mission-net.org/" . $pdffile;
        $text .= "\n \n";
        $text .= "Thanks again for registering for Mission-Net, and we trust that this event will be an exciting new step in your journey in the Christian faith.";
        $text .= "\n \n \n";
        $text .= "Many Blessings";
        $text .= "\n \n";
        $text .= "Mission-Net Congress Management Team";
        $text .= "\n \n";
        $text .= "Mission-Net 2009 -- Alte Neckarelzer Str. 2 -- D-74821 Mosbach";
        $text .= "\n";
        $text .= $infomailaddress;
        $html = "Dear " . $values["firstname"] . "<br><br>\n";
        $html .= htmlentities(T_("we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is sent to the Bank (see details attached if not paid by credit card) and you send us the signed registration form. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        $html .= "\n<br><br>\n";
        $html .= "Please ensure that this happens so that we can process your registration as quickly as possible.";
        $html .= "\n<br><br>\n";
        $html .= "Please find attached all necessary documents again in the PDF format.<br>";
        $html .= "You may download this PDF file right here:" . " ";
        $html .= "<a href='https://register.mission-net.org/" . $pdffile . "'>PDF Document</a>";
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Thanks again for registering for Mission-Net, and we trust that this event will be an exciting new step in your journey in the Christian faith"));
        $html .= "\n<br><br><br>\n";
        $html .= "Many Blessings";
        $html .= "\n<br><br>\n";
        $html .= "Mission-Net Congress Management Team";
        $html .= "\n<br><br>\n";
        $html .= "Mission-Net 2009 -- Alte Neckarelzer Str. 2 -- D-74821 Mosbach";
        $html .= "\n<br>";
        $html .= $infomailaddress;
        $crlf = "\n";
        //######## Mail to registrant ##################
        //##############################################
        $mime = new Mail_mime($crlf);
        $mime->setTXTBody($text);
        $mime->setHTMLBody($html);
        if (file_exists($pdffile)) {
            $mime->addAttachment($pdffile, 'application/pdf');
        }
        $message = $mime->get();
        $betreff = htmlentities(T_('Mission Net registration 2009')) . ' ' . $values['lastname'] . ', ' . $values['firstname'] . ', ' . $values["nationality"];
        $headers = array('From' => $registrationsenderaddress, 'To' => $registrationhandleraddress, 'Subject' => $betreff);
        $hdrs = $mime->headers($headers);
        $empfaenger = $values["email"];
        // create the mail object using the Mail::factory method
        $mail_message =& Mail::factory('mail');
        $mail_message->send($empfaenger, $hdrs, $message);
        if (PEAR::isError($mail_message)) {
            die($mail_message->getMessage());
        }
        //######## Mail to mission-net #################
        //##############################################
        foreach ($daten as &$dval) {
            $text .= "\n" . $dval;
            $html .= "\n<br>" . $dval;
        }
        $om_mime = new Mail_mime($crlf);
        $om_mime->setTXTBody($text);
        $om_mime->setHTMLBody($html);
        if (file_exists($pdffile)) {
            $om_mime->addAttachment($pdffile, 'application/pdf');
        }
        $om_message = $om_mime->get();
        $om_betreff = $values['firstname'] . ' ' . $values['lastname'] . ' hat sich angemeldet. No.: ' . $last_id;
        $om_headers = array('From' => $registrationsenderaddress, 'To' => $registrationhandleraddress, 'Subject' => $om_betreff);
        $om_hdrs = $om_mime->headers($om_headers);
        $om_mail_message =& Mail::factory('mail');
        $om_mail_message->send($registrationhandleraddress, $om_hdrs, $om_message);
        if (PEAR::isError($om_mail_message)) {
            die($om_mail_message->getMessage());
        }
        //#### here comes the resulting screen after the registration #
        //#############################################################
        ?>
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <title>
	 <?php 
        echo htmlentities(T_("Mission Net Online Registration"));
        ?>
	 </title>
        </head>
        <body>
        <table><tr>
         <td>
         <img src="images/MN_Logo_kleiner.png" alt="Mission-Net Logo">
         </td><td>
         <font size="-2">
	 <?php 
        echo htmlentities(T_("Germany")) . "<br>" . htmlentities(T_("8. April to 13. April 2009")) . "<br>Oldenburg</font>";
        ?>
         </td>
         </tr>
        </table>
	<h2>
	<?php 
        echo htmlentities(T_("Confirmation of registration for Mission-Net 2009"));
        echo '</h2>';
        $format = htmlentities(T_("Dear")) . " %1\$s";
        printf($format, $values["firstname"]);
        echo ", <br><br>\n";
        echo htmlentities(T_('we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe.'));
        echo "\n<br><br>\n";
        echo htmlentities(T_('You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe.'));
        echo "\n<br><br>\n";
        echo htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        echo "\n<br><br><br>\n";
        echo htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is paid. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Please ensure that this happens so that we can process your registration as quickly as possible."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Thanks again for registering for Mission-Net and we trust that this event will be an exciting new step in your journey in the Christian faith."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Many Blessings"));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Mission-Net Congress Management Team"));
        echo "\n<br><br>\n";
        echo "<b>" . htmlentities(T_("Payment Instructions")) . "</b><br>\n";
        echo htmlentities(T_("There are two ways of paying for Mission-Net 2009:")) . "<br>\n";
        echo "<ol><li>" . htmlentities(T_("Wire transfer of money to our bank account")) . "</li>\n";
        echo "<li>" . htmlentities(T_("Credit Card Payment")) . "</li></ol><br>\n";
        echo "<b>" . htmlentities(T_("Wire transfer:")) . "</b><br>\n";
        echo htmlentities(T_("Please transfer the sum of")) . " " . $preis . " " . T_("Euro") . "<br>\n";
        echo htmlentities(T_("to")) . "<br>" . T_("OM Europa / Mission-Net") . "<br>\n";
        echo htmlentities(T_("Account no:")) . " 5010802" . "<br>\n";
        global $iban;
        global $swiftcode;
        global $bank;
        echo $iban . "<br>\n";
        echo $swiftcode . "<br>\n";
        echo T_("Address of bank:") . $bank . "<br>\n";
        echo htmlentities(T_("and use this reference:")) . "<b> M09-" . $last_id . "</b><br>\n";
        echo "<br><b>" . htmlentities(T_("Credit Card Payment:")) . "</b><br>\n";
        echo htmlentities(T_("If you prefer to pay by credit or debit card, we have to add a supplement of 10 Euro for the transaction.")) . "<br>\n";
        $gsumme = $preis + 10;
        echo htmlentities(T_("Please transfer the sum of")) . " " . $preis . " Euro + " . T_("10 Euro") . " = " . money_format('%i', $gsumme) . " " . htmlentities(T_("Euro")) . "<br>\n";
        echo htmlentities(T_("by clicking this link:"));
        ?>
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="neu">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="*****@*****.**">
<input type="hidden" name="item_name" value="Mission-Net event">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="bn"  value="ButtonFactory.PayPal.002">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="on0" value="<?php 
        echo $values['lastname'] . ', ' . $values['firstname'];
        ?>
">
<input type="hidden" name="os0" value="">
<input type="hidden" name="on1" value="Reference No: <?php 
        echo 'M09-' . $last_id;
        ?>
 ">
<input type="hidden" name="os1" value="">
<br>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif">
</form>
<?php 
        echo htmlentities(T_("Note:")) . " " . htmlentities(T_("Your registration is only valid as soon as we received your payment.")) . "<br>\n";
        echo htmlentities(T_("You have to pay within 2 weeks of completing your registration (this is now), otherwise the system will delete your registration automatically")) . "<br>\n";
        session_destroy();
    }
    function perform($page, $actionName)
    {
        // Auslesen der Daten
        global $infomailaddress;
        global $registrationsenderaddress;
        global $registrationhandleraddress;
        // function to correct the date format
        function korr_datum($datum1)
        {
            $datum = $datum1['Y'];
            if (strlen($datum1['M']) < 2) {
                $datum .= "-0" . $datum1['M'];
            } else {
                $datum .= "-" . $datum1['M'];
            }
            if (strlen($datum1['d']) < 2) {
                $datum .= "-0" . $datum1['d'];
            } else {
                $datum .= "-" . $datum1['d'];
            }
            return $datum;
        }
        $values = $page->controller->exportValues();
        $mdb2 =& MDB2::singleton();
        if (PEAR::isError($mdb2)) {
            die("Error while connecting : " . $mdb2->getMessage());
        }
        $sql1 = 'INSERT INTO participants SET firstname = ?, lastname = ?, preferred_name = ?, title = ?, street = ?,
		postcode = ?, city = ?, country = ?, countrytext = ?, phone = ?, mobile = ?, email = ?, 
		dateofbirth = ?, maritalstatus = ?, gender = ?,
		passport_name = ?, passport_no = ?, passport_dateofissue = ?, passport_dateofexpire = ?,
		nationality = ?, nationalitytext = ?, invitation_letter = ?, vegeterian = ?, medication = ?, what_medication = ?, 
		medication_reason = ?, disabilities = ?, allergies = ?, emergency_firstname = ?,
		emergency_lastname = ?, emergency_phone = ?, groupleader_name = ?, groupleader_email = ?,
		church_name = ?, church_deno = ?, church_address = ?, ref_person_church_task = ?, ref_person_lastname = ?, 
                ref_person_firstname = ?, ref_person_phone = ?, ref_person_email = ?,
		other_conf= ?, leadership_exp = ?, german_skill = ?, english_skill = ?,
		mother_tongue = ?, IN2_team_1 = ?, IN2_team_2 = ?, part_type = ?, why_trip = ?, learn_trip= ?, 
		outreach_organisation = ?, musical_ability = ?, outreach_ability = ?, story = ?, 
		why_mission = ?, jobwish_1 = ?, jobwish_2 = ?, jobwish_comment = ?, special_job = ?, 
		sj_reason = ?, status = ?, arrival_date =?, departure_date = ?, remarks =?';
        $sth = $mdb2->prepare($sql1, $typen, MDB2_PREPARE_RESULT);
        $daten = array(utf8_decode($values['firstname']), utf8_decode($values['lastname']), utf8_decode($values['preferredname']), utf8_decode($values['title']), utf8_decode($values['street']), $values['plzort']['postcode'], utf8_decode($values['plzort']['city']), $values['countrygroup']['country'], $values['countrygroup']['othercountry'], $values['phone'], $values['handy'], $values['email'], korr_datum($values['dateofbirth']), $values['maritalstatus'], $values['gender'], utf8_decode($values['passportname']), utf8_decode($values['passportno']));
        $daten[] = korr_datum($values['dateofissue']);
        $daten[] = korr_datum($values['dateofexpire']);
        $daten[] = $values['nationgroup']['nationality'];
        $daten[] = $values['nationgroup']['othernation'];
        $daten[] = $page->controller->exportValue('seite1', 'invitationletter');
        $daten[] = $page->controller->exportValue('seite3', 'vegetarian');
        $daten[] = $page->controller->exportValue('seite3', 'medication');
        $daten[] = utf8_decode($values['what_medication']);
        $daten[] = utf8_decode($values['medication_reason']);
        $daten[] = utf8_decode($values['disabilities']);
        $daten[] = utf8_decode($values['allergies']);
        $daten[] = utf8_decode($values['emergency_firstname']);
        $daten[] = utf8_decode($values['emergency_lastname']);
        $daten[] = $values['emergency_phone'];
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'gl_name'));
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'gl_email'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'church_name'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'denomination'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'church_address'));
        $daten[] = $page->controller->exportValue('seite3', 'ref_function');
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'ref_firstname'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'ref_lastname'));
        $daten[] = $page->controller->exportValue('seite3', 'ref_phone');
        $daten[] = $page->controller->exportValue('seite3', 'email');
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'other_conf'));
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'leader_exp'));
        $daten[] = $page->controller->exportValue('seite2', 'german_skill');
        $daten[] = $page->controller->exportValue('seite2', 'english_skill');
        $daten[] = $page->controller->exportValue('seite2', 'mother_tongue');
        $daten[] = $page->controller->exportValue('seite3', 'IN2_wish_1');
        $daten[] = $page->controller->exportValue('seite3', 'IN2_wish_2');
        $daten[] = $values['parttype'];
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'why_IN2'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'learn_IN2'));
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'story'));
        $daten[] = utf8_decode($page->controller->exportValue('seite2', 'why_mission'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'outreach_org'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'musical_ability'));
        $daten[] = utf8_decode($page->controller->exportValue('seite3', 'outreach_ability'));
        $daten[] = $page->controller->exportValue('seite4', 'st_wish_1');
        $daten[] = $page->controller->exportValue('seite4', 'st_wish_2');
        $daten[] = utf8_decode($page->controller->exportValue('seite4', 'st_comment'));
        $daten[] = $page->controller->exportValue('seite4', 'counsellor');
        $daten[] = utf8_decode($page->controller->exportValue('seite4', 'counsellor_reason'));
        $daten[] = '1';
        // status field
        $daten[] = $page->controller->exportValue('seite4', 'arr_date');
        $daten[] = $page->controller->exportValue('seite4', 'dep_date');
        $daten[] = utf8_decode($page->controller->exportValue('seite4', 'bemerkung'));
        $affRow = $sth->execute($daten);
        $last_id = $mdb2->lastInsertID('participants', 'id');
        if (PEAR::isError($affRow)) {
            die('failed... Fehler:' . $affRow->getMessage());
            echo $mdb2->getMessage() . ' - ' . $mdb2->getUserinfo();
        }
        $sth->Free();
        if ($values['parttype'] == '2') {
            $sql1 = "SELECT service_team_fee, name FROM countries WHERE id=" . $values['countrygroup']['country'];
        } else {
            $sql1 = "SELECT fee, name FROM countries WHERE id=" . $values['countrygroup']['country'];
        }
        $erg =& $mdb2->query($sql1);
        if (PEAR::isError($erg)) {
            die($erg->getMessage());
        }
        while ($row = $erg->fetchRow()) {
            $preis = $row[0];
            $land_name = $row[1];
        }
        $erg->Free();
        $zufall = rand(100, 999);
        $pdffile = 'pdfs/' . $zufall . '_' . $last_id . '_' . date("Ymd") . '.pdf';
        // now let's create a PDF file
        create_pdf($values, $last_id, $pdffile, $preis, $land_name);
        $text = T_("Dear") . " " . $values["firstname"] . "\n\n";
        $text .= T_("we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe.");
        $text .= "\n \n";
        $text .= htmlentities(T_("You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe."));
        $text .= "\n \n";
        $text .= htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        $text .= "\n \n";
        $text .= htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is sent to the Bank (see details attached if not paid by credit card) and you send us the signed registration form, if you are under 18 years. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        $text .= "\n \n";
        $text .= T_("Please ensure that this happens so that we can process your registration as quickly as possible.");
        $text .= "\n \n";
        $text .= T_("Please find attached all necessary documents again in the PDF format.") . "\n";
        $text .= T_("You may download this PDF file right here:") . " ";
        $text .= "https://register.mission-net.org/" . $pdffile;
        $text .= "\n \n";
        $text .= htmlentities(T_("Thanks again for registering for Mission-Net, and we trust that this event will be an exciting new step in your journey in the Christian faith."));
        $text .= "\n \n \n";
        $text .= htmlentities(T_("Many Blessings"));
        $text .= "\n \n";
        $text .= htmlentities(T_("Mission-Net Congress Management Team"));
        $text .= "\n \n";
        $text .= htmlentities(T_("Mission-Net 2009 -- Alte Neckarelzer Str. 2 -- D-74821 Mosbach"));
        $text .= "\n";
        $text .= $infomailaddress;
        $html = htmlentities(T_("Dear")) . " " . $values["firstname"] . "<br><br>\n";
        $html .= htmlentities(T_("we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is sent to the Bank (see details attached if not paid by credit card) and you send us the signed registration form, if you are under 18 years. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Please ensure that this happens so that we can process your registration as quickly as possible."));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Please find attached all necessary documents again in the PDF format.")) . "<br>";
        $html .= htmlentities(T_("You may download this PDF file right here:")) . " ";
        $html .= "<a href='https://register.mission-net.org/" . $pdffile . "'>" . htmlentities(T_("PDF Document")) . "</a>";
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Thanks again for registering for Mission-Net, and we trust that this event will be an exciting new step in your journey in the Christian faith"));
        $html .= "\n<br><br><br>\n";
        $html .= htmlentities(T_("Many Blessings"));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Mission-Net Congress Management Team"));
        $html .= "\n<br><br>\n";
        $html .= htmlentities(T_("Mission-Net 2009 -- Alte Neckarelzer Str. 2 -- D-74821 Mosbach"));
        $html .= "\n<br>";
        $html .= $infomailaddress;
        $crlf = "\n";
        //######## Mail to registrant ##################
        //##############################################
        $mime = new Mail_mime($crlf);
        $mime->setTXTBody($text);
        $mime->setHTMLBody($html);
        if (file_exists($pdffile)) {
            $mime->addAttachment($pdffile, 'application/pdf');
        }
        $message = $mime->get();
        $betreff = htmlentities(T_('Mission Net registration 2009')) . ' ' . $values['lastname'] . ', ' . $values['firstname'] . ', ' . $values["nationality"] . ' ' . $last_id;
        $headers = array('From' => $registrationsenderaddress, 'To' => $registrationhandleraddress, 'Cc' => '*****@*****.**', 'Subject' => $betreff);
        $hdrs = $mime->headers($headers);
        $empfaenger = $values["email"];
        // create the mail object using the Mail::factory method
        $mail_message =& Mail::factory('mail');
        $mail_message->send($empfaenger, $hdrs, $message);
        if (PEAR::isError($mail_message)) {
            die($mail_message->getMessage());
        }
        //######## Mail to mission-net #################
        //##############################################
        $sql = "SELECT p.id, firstname, lastname, preferred_name, title, street, postcode, city, c.name as country, countrytext, phone, mobile,";
        $sql .= " email, t.type as part_type, dateofbirth, m.status as maritalstatus, gender, passport_name, passport_no, ";
        $sql .= "passport_dateofissue, passport_dateofexpire, n.name as nationality, nationalitytext, IF(invitation_letter=0,'No', 'Yes') as ";
        $sql .= "invitation_letter_required, IF(vegeterian=0,'No','Yes') as vegetarian, IF(medication=0,'No','Yes') as medication, ";
        $sql .= "what_medication, disabilities, allergies, dietary, emergency_firstname, emergency_lastname, emergency_phone, ";
        $sql .= "church_name, church_deno, church_address, groupleader_name, ref_person_firstname, ref_person_lastname, ";
        $sql .= "ref_person_phone, ref_person_email, ref_person_church_task, groupleader_email, other_conf, team_conf, ";
        $sql .= "leadership_exp, gl.level_desc as german_skill, el.level_desc as english_skill, l.name as mothertongue, ";
        $sql .= "p.IN2_team_1, p.IN2_team_2, why_trip, learn_trip, story, why_mission, outreach_organisation, ";
        $sql .= "musical_ability, p.outreach_ability, w1.work_area as jobwish_1, w2.work_area as jobwish_2, jobwish_comment, ";
        $sql .= "special_job, sj_reason, p.arrival_date, p.departure_date, p.remarks, p.status, p.appdate";
        $sql .= ' FROM participants p, countries c, marital_status m, part_type t, countries n, ';
        $sql .= 'languages l, work_area_list w1, work_area_list w2, english_level el, english_level gl';
        $sql .= ' where p.id = ' . $last_id . ' and c.id = p.country and m.id = p.maritalstatus and t.id = p.part_type ';
        $sql .= 'and n.id=p.nationality and l.id=p.mother_tongue and ';
        $sql .= 'w1.id=p.jobwish_1 and w2.id=p.jobwish_2 and el.id=p.english_skill and gl.id=german_skill';
        $row = $mdb2->queryRow($sql);
        if (PEAR::isError($row)) {
            die($row->getMessage());
        }
        foreach ($row as $k => $wert) {
            $text .= "\n" . $k . " : " . $wert;
            $html .= "\n<br>" . $k . " : " . $wert;
        }
        $text .= "\nPreis: " . $preis;
        $html .= "\n<br>Preis: " . $preis;
        $sql = "SELECT p.country as LandID, n.email AS nat_email FROM participants p, national_motivators n";
        $sql .= ' WHERE p.id = ' . $last_id . ' and n.countryid = p.country';
        $erg =& $mdb2->query($sql);
        if (PEAR::isError($erg)) {
            die($erg->getMessage());
        }
        $cc_empf = '';
        while ($row = $erg->fetchRow()) {
            if ($cc_empf == '') {
                $cc_empf .= $row[1];
            } else {
                $cc_empf .= ', ' . $row[1];
            }
            $landid = $row[0];
        }
        $erg->free();
        $om_mime = new Mail_mime($crlf);
        $om_mime->setTXTBody($text);
        $om_mime->setHTMLBody($html);
        if (file_exists($pdffile)) {
            $om_mime->addAttachment($pdffile, 'application/pdf');
        }
        $om_message = $om_mime->get();
        $om_betreff = $values['firstname'] . ' ' . $values['lastname'] . ' hat sich angemeldet. No.: ' . $last_id;
        $om_headers = array('From' => $registrationsenderaddress, 'To' => $registrationhandleraddress, 'Cc' => $cc_empf, 'Subject' => $om_betreff);
        $om_hdrs = $om_mime->headers($om_headers);
        $om_mail_message =& Mail::factory('mail');
        $om_mail_message->send($registrationhandleraddress, $om_hdrs, $om_message);
        if (PEAR::isError($om_mail_message)) {
            die($om_mail_message->getMessage());
        }
        //#### here comes the resulting screen after the registration #
        //#############################################################
        ?>
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <title>
	 <?php 
        echo htmlentities(T_("Mission Net Online Registration"));
        ?>
	 </title>
        </head>
        <body>
        <table><tr>
         <td>
         <img src="images/MN_Logo_kleiner.png" alt="Mission-Net Logo">
         </td><td>
         <font size="-2">
	 <?php 
        echo htmlentities(T_("Germany")) . "<br>" . htmlentities(T_("8. April to 13. April 2009")) . "<br>Oldenburg</font>";
        ?>
         </td>
         </tr>
        </table>
	<h2>
	<?php 
        echo htmlentities(T_("Confirmation of registration for Mission-Net 2009"));
        echo '</h2>';
        $format = htmlentities(T_("Hello")) . " %1\$s";
        printf($format, $values["firstname"]);
        echo ", <br><br>\n";
        echo htmlentities(T_('we are so excited that you have just registered for Mission-net in Oldenburg, 2009. We are looking forward to meeting you and 6000 others from all over Europe.'));
        echo "\n<br><br>\n";
        echo htmlentities(T_('You are in for a great time with great worship, speakers, and of course the chance to meet like minded people from all over Europe.'));
        echo "\n<br><br>\n";
        echo htmlentities(T_("We have a National Coordinator in your country who this message has also been sent to. Nearer the time they will be in contact with you to give you more information on others from your country that will be attending this exciting event, as well as practical details of things like travel and what you need to bring."));
        echo "\n<br><br><br>\n";
        echo htmlentities(T_("In order for your registration to be processed please ensure that the congress fee is paid. If you are under 18 years old, you are also required to send in the PDF form sent with the confirmation e-mail, signed by your parents and you. On receipt of payment, we will send you another confirmation e-mail that the money has received which will also be sent to the National Coordinator in your country."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Please ensure that this happens so that we can process your registration as quickly as possible."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Thanks again for registering for Mission-Net and we trust that this event will be an exciting new step in your journey in the Christian faith."));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Many Blessings"));
        echo "\n<br><br>\n";
        echo htmlentities(T_("Mission-Net Congress Management Team"));
        echo "\n<br><br>\n";
        echo "<b>" . htmlentities(T_("Payment Instructions")) . "</b><br>\n";
        echo htmlentities(T_("There are two ways of paying for Mission-Net 2009:")) . "<br>\n";
        echo "<ol><li>" . htmlentities(T_("Wire transfer of money to our bank account")) . "</li>\n";
        echo "<li>" . htmlentities(T_("Credit Card Payment")) . "</li></ol><br>\n";
        echo "<b>" . htmlentities(T_("Wire transfer:")) . "</b><br>\n";
        echo htmlentities(T_("Please transfer the sum of")) . " " . $preis . " " . T_("Euro") . "<br>\n";
        echo htmlentities(T_("to")) . "<br>" . T_("OM Europa / Mission-Net") . "<br>\n";
        echo htmlentities(T_("Account no:")) . " 5010802" . "<br>\n";
        global $iban;
        global $bank;
        global $swiftcode;
        echo $iban . "<br>\n";
        echo $swiftcode . "<br>\n";
        echo T_("Address of bank:") . " " . $bank . "<br>\n";
        if ($landid == 3) {
            echo htmlentities(T_("Participants from Switzerland might use the following Swiss account to avoid banking fees:")) . "<br>\n";
            echo htmlentities(T_("Account no:")) . " 91-479018-6" . "<br>\n";
            global $swiss_iban;
            global $swiss_bank;
            global $swiss_swiftcode;
            echo $swiss_iban . "<br>\n";
            echo $swiss_swiftcode . "<br>\n";
            echo T_("Address of bank:") . $swiss_bank . "<br>\n";
        }
        echo htmlentities(T_("and use this reference:")) . "<b> M09-" . $last_id . "</b><br>\n";
        echo "<br><b>" . htmlentities(T_("Credit Card Payment:")) . "</b><br>\n";
        echo htmlentities(T_("If you prefer to pay by credit or debit card, we have to add a supplement of 10 Euro for the transaction.")) . "<br>\n";
        $gsumme = $preis + 10;
        echo htmlentities(T_("Please transfer the sum of")) . " " . $preis . " Euro + " . T_("10 Euro") . " = " . money_format('%i', $gsumme) . " " . htmlentities(T_("Euro")) . "<br>\n";
        echo htmlentities(T_("by clicking this link:"));
        ?>
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="neu">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="*****@*****.**">
<input type="hidden" name="item_name" value="Mission-Net event">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="bn"  value="ButtonFactory.PayPal.002">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="on0" value="<?php 
        echo $values['lastname'] . ', ' . $values['firstname'];
        ?>
">
<input type="hidden" name="os0" value="">
<input type="hidden" name="on1" value="Reference No: <?php 
        echo 'M09-' . $last_id;
        ?>
 ">
<input type="hidden" name="os1" value="">
<br>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif">
</form>
<?php 
        //	echo "<a href='http://www.paypal.com?func=missionnet09'>http://www.paypal.com?func=missionnet09</a><br>";
        echo htmlentities(T_("Note:")) . " " . htmlentities(T_("Your registration is only valid as soon as we received your payment and if you are under 18 years the signed PDF form.")) . "<br>\n";
        echo htmlentities(T_("You have to pay within 2 weeks after completing your online registration (this is now), otherwise the system will delete your registration automatically")) . "<br>\n";
        echo htmlentities(T_("Please note that we will only process payments we receive until 30th March that are in our account.")) . "<br>\n";
        session_destroy();
    }