vedi come risolvono qui
http://www.bigresource.com/JAVASCRIP...-80RO3JD7.html