It would take me a while to work this out because Javascript is not my area of expertise-- I code mostly with PHP. If you want to try to figure it out yourself, someone can probably help you with that, or perhaps someone will come along later and offer to write the whole script. You could also ask for paid help if you need it sooner.