https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference
https://developer.mozilla.org/en/Gecko_DOM_Reference
One way is with window.open (and ordinary page request) to create a popup. But they look nasty since browsers these days won't allow you to remove status bars, address field etc.
The other way is by showing a div or similar in the current document. Either by creating it dynamically, or by having it there all the time and just changing display or visibility CSS properties.
To check the phone number, you perform an XHR (xml http request), aka ajax.
The response returned is preferably json_encoded, so that you can eval the returned result, and then go through it to decide what information should be presented to the user.
Doing it all from the ground up by yourself takes a bit of initial work, mainly due to browser inconsistencies, but it might be a good learning experience. If you don't care about that or are looking for quicker results, there are numerous javascript libraries that can help you out. jQuery, prototype, yui among many others.
Another reason to look into libraries is if you want more complex visual effects.