function submitPoll() { //new Event(e).stop(); // stop the event so the form doesn't submit the regular way surveyInputSlide.hide(); $('survey-output').addClass('loading'); var request = new Request.HTML( { url: '/survey/vote/', update: $('survey-output'), data: $('surveyForm'), onSuccess: function() { surveyOutputSlide.show(); $('survey-output').removeClass('loading'); } }).send(); } function displayPoll() { surveyOutputSlide.hide(); var request = new Request.HTML( { url: '/survey/view/', update: $('survey-input'), data: {}, onSuccess: function() { surveyInputSlide.show(); } }).send(); } window.addEvent('domready', function() { // if surveyForm doesn't exist on this page, don't try to work with it if($('survey-input') != null) surveyInputSlide = new Fx.Slide('survey-input'); if($('survey-output') != null) surveyOutputSlide = new Fx.Slide('survey-output'); if($('surveyForm') == null ) return; /* $('surveyForm').addEvent('submit', function(e) { }); */ });