var Email = Class.create({
    initialize: function(id){
        this.form = $(id);
        this.submitButton = $(id+":sendEmail");
        this.formHash = this.form.serialize(true);
        this.toUpdate = this.form.up();
    },

    showError: function(){
        var toUpdate = this.toUpdate;
        toUpdate.insert({top: new Element('p').update("Oh noes!")});
    },

    showThankYou: function(){
        var toUpdate = this.toUpdate;
        toUpdate.update(this.createThankYou());
    },

    showContactUsThankYou: function(){
        var toUpdate = this.toUpdate;
        toUpdate.update(this.createContactUsThankYou());
    },

    createThankYou: function(){
        return  "<h3>Thank you for contacting the seller</h3>" +
                "<p>Your message has been sent to the dealer. You will be contacted soon regarding your inquiry." +
                "<h4>Any questions?</h4>" +
                "<p>Call 1-888-512-0094 or email us.  We're here to help M-F 8am-10pm S 10am-4pm ET.</p>" +
                "<h4>Fraud Awareness Tips</h4>" +
                "<p>Because there is no foolproof way to prevent fraud, awareness is the best defense<br/>"+
                "<a href=\"/syc/spotScam.xhtml\">Learn how to spot a scam</a></p>";
    },

    createContactUsThankYou: function(){
        return  "<h3>Thank you for contacting us!</h3><br/>" +
                "<p>Your message has been sent and you may be contacted soon regarding your inquiry.<br/><br/>" +
                "<h4>Anything else?</h4>" +
                "<p>Call 1-800-548-8889.  We're here to help M-F 8:30am-5:30pm ET.</p><br/>" +
                "<h4>Fraud Awareness Tips</h4>" +
                "<p>Because there is no foolproof way to prevent fraud, awareness is the best defense<br/>"+
                "<a href=\"/syc/spotScam.xhtml\">Learn how to spot a scam</a></p>";
    },

    showLoading: function(){
        var toUpdate = this.toUpdate;
        toUpdate.setStyle({height: toUpdate.getHeight()+"px"});
        new Effect.Fade(this.form, {fps: 50, duration: 0.1, afterFinish: function(){
                toUpdate.update(new Element("p", {id: "form-loading"}).update("Loading...").hide());
                new Effect.Appear("form-loading", {fps: 50, duration: 0.2});
            }
        });
    }
});