Lo script te lo ho dato tutto.

Se hai problemi per implementarlo nel tuo codice HTML, devipostare le parti interessate.