var Survey = {
	init: function(){
		new Main.ajaxForm({
			form: "survey-form",
			mask_element: "survey-form-mask",
			listeners: {
				onSuccess: function(j){
					 Main.redirect(js_url+"survey.php?id="+j["question_id"]);
				},
				onFail: function(j){
					if(j.message){
						var error = "";
						for(var i=0; i<j.message.length; i++){
							error +='<div>'+j.message[i]+'</div>';
						}
						var el = Ext.get("survey-errors");
						el.dom.style.display = "";
						el.dom.innerHTML = error;
					}
				},
				scope: this
			}
		});
	}
};
Main.onReady(Survey.init, Survey);
