var Feedback = new Class({

    initialize: function() {
        SqueezeBox.assign($$('.feedbackCall'), {
            size: {x: 660, y: 440},
            onUpdate: function() {
                new FeedbackForm();
            }.bind(this)
        });
    }
});

var FeedbackForm = new Class({

initialize: function() {
        if ($('feedback_referer') && !$('feedback_referer').get('value')) {
            $('feedback_referer').set('value',location.href);
        }
        $('feedbackForm').addEvent('submit',function(e) {
            e.stop();
            this.set('send', {
                onComplete: function(response) {
                    var div = new Element('div').set('html',response);
                    if (div.getElement('form')) {
                        SqueezeBox.applyContent(response, {x: 660, y: 440});
                        new FeedbackForm();
                    } else {
                        SqueezeBox.applyContent(response, {x: 660, y: 90});
                    }
                }
            });
            this.send();
            SqueezeBox.trash();
            SqueezeBox.applyContent(null, SqueezeBox.options.sizeLoading);
        });
    }
});


