How to make Screen change size when clicking 'submit'

Here is my contact form:
my contact form
When you click the GMAIL logo, a contact form pops out. When you click submit, I would like the box to change shape to fit the ‘thank you’ message I have made. An example is the video below (except it is done with a log in form).

Video example:
DropShots.com

Actual webpage:
SoundCloud - Your Sound, At The Heart

How can I achieve this trick (making the box change shape to fix the thank you message)?

anyone?

The form did not work for me - would not let me enter anything.
As far as resizing the div to fix thank you message - the way I would do it is to completely close the previous div and then open the new div with thank you message. This way it would fit.

This is basically the way I have setup on my project - you fill in the registration form which is inside the floating div, then when the result is returned via ajax, the original div is removed and the new div with “welcome to our site” is shown instead.

Really? I have tested it on several different computers and it works fine on all of them. When I test it out, it sends messages to my email. Did you click the ‘gmail thumbnail’, then click the bigger Gmail logo?

Do you mind posting the code for the way you achieved it?

thanks