CKEditor 3: Properly Getting ID of Link or Image textbox to return URL

I'm still hacking away trying to upgrade FCKEditor 2 to CKEditor 3.  Today's problem centered around getting the proper ID for the textbox of either the Link Button or Image Button insert window.  Turns out these ID's are quite random, not unlike how .Net generates ID's for server controls (unfortunately).  Like most things in the CKEditor world, this is quite poorly documented but after many different combinations of searches I finally found this board posting which cleared things up.
I'm reposting my code here so as to help spread the word.

Background:
The Link and Image buttons  (as well as others) in CKEditor will show a dialog box asking you for a URL.  You have the option to set a Browser Server button in one of these box's in your config file which can point to some kind of file browser, probably some other portion of your system or CMS.  The challange is then to return a URL form your code back to the CKEditor window.  Normally this is quite easy with something like this.
strURL += "javascript:window.opener.document.";
strURL += "getElementById('" + strReturnControlID + "')";
strURL += ".value='/" + strPageTitle.Replace("'", "\\'");
strURL += "'; window.close()";
Where strReturnControlID would contain the ID of the parent textbox from the querystring that I set in the CKEditor Config for the Browser Server button.  Problem is, this ID changes, often with each page reload.  Lame.

Solution:
The solution is to use the CKEditor API to do the heavy lifting.
strURL += "javascript:window.parent.opener.CKEDITOR.tools.callFunction(";
strURL += Request.QueryString["CKEditorFuncNum"].ToString();
strURL += ", '" + strPageTitle.Replace("'", "\\'") + "', '' ); window.close();"; 
I was quite surprised when this worked the first time!
The CKEditorFuncNum isn't something you have to worry about, the CKEditor auto passes the correct value for you.
Hope this helps someone else, let me know if you need any further clarification.