First, a little background information:
According to halakhah, there are two types of berakhoth: "long" and "short."
"Long" *berakhoth" are those that have a pethihah ("opening", i.e. "Barukh Atah HaShem Elohenu Melekh Ha-Olam...", a somewhat extended "middle" section, and then end with a hathimah ("ending", i.e. "...Barukh Atah HaShem _____________"). Another type of "long" berakhah is called samukhah le-haverta ("relying on its neighbor") and does not itself have a pethihah, but "relies" as it were on the opening of the berakhah that was said directly before it.
"Short" berakhoth consist of a pethihah only, like the berakhoth recited before eating, drinking, misswoth, etc.
[The Rambam discusses these issues in the following sections: Hilkhoth Qiryath Shema 1:8; Hilkhoth Berakhoth 1:15.]
In the halakhoth regarding the shemoneh esrei, it states that one must have kawwanah during the first berakhah of the prayer or he must return to the beginning. However, if one has proper kawwanah during the first blessing and then subsequently loses his kawwanah at any other time in the prayer, he does not have to return to the beginning and is still yosse yedhei hovatho. [See Rambam, Hilkhoth Tefillah 10:1]
The Rambam also mentions that if someone mistakenly says the incorrect berakhoth for Qiryath Shema (i.e. night ones during the day or vice-versa), they fulfill their obligation as long as the hathimah is the correct hathimah. This is true because of the principle that says, "She-kol ha-berakhoth holkhoth aharei hathimathan - For all blessings are determined by their hathimah" (See Hilkhoth Qiryath Shema 1:9).
Now for my question:
If someone is beginning to pray the shemoneh esrei and says the pethihah of the first berakhah with proper kawannah and then, during the middle section has stray thoughts or loses kawwanah, but then regains his clear mind and kawwanah during the hathimah - does he need to begin again? Or does his concentration during the hathimah suffice since that is how all berakhoth are reckoned?
[NOTE: I recognize that there are shittoth (usually associated with the commentators on the Tur and Shulhan Arukh) that hold that no one is capable of proper kawwanah in our times, and so this question is essentially moot. However, I am assuming here that what the gemara and the Rambam say on this matter still applies. Thanks.]