HO risolto con uno script recuperato da un progetto open source ed adattato all'xhtml.