Using Prototype
AjaxPreview = Class.create();

AjaxPreview.prototype =
    initialize: function(id, div, iframe)
        this.form = id;
        this.div = div;
        this.iframe = iframe;

        Event.observe(id, 'submit', this.router);

    router: function()
and setting up like this:

HTML Code:
            <input type="submit" id="submit" name="submit" value="Generate Preview" />
        <!-- SET UP AJAX PREVIEW -->
        <script type="text/javascript">
            var preview = new AjaxPreview('preview', 'upload', 'frame');
When I submit the form the alert that comes up shows undefined, but it should show the ID of the form that was set with the new AjaxPreview().

I honestly don't have a clue why it's not working. Any help would be great.

PS. the router method is just testing that the variables are set at the moment. It'll be used for something different later on haha.