Well ...
You will need separate language files.
When a user comes to your web site, you will need to load a default language from the files.
When the user clicks your flag, you will reload the page with the new language files loaded.
Most of the time people do that by adding ?lang=esp to the end of the URL and do the check in the code for that in the URL.
In the example ?lang=esp, you would change the loaded files from whatever to Spanish.
To be honest, an explanation is a bit outside of my scope of teaching.
Use this URL to find some good tutorials.
http://www.google.com/search?hl=en&q=creating+multilingual+site&btnG=Google+Search