window.addEvent('domready', function() {
	$('register-form').addEvent('submit', function(e){
		new Event(e).stop();
	    notice  = $('reg-notice');	        
		var url  = document.getElementsByTagName('base')[0].href;
	   	url += 'ajaxon/createAccount';
		var querystring = $(this.id).toQueryString();

		var request = new XHR({
			method: 'post',
		   	onRequest: function() {
				notice.style.display = 'block';
		      	notice.className = 'ajaxSpinner';
		      	notice.setHTML('');
			},
			onSuccess: function(response) {
				if (!response.match(/%refresh%/i)) {
					notice.className = 'ajaxNotice';
			            notice.setHTML(response);
				} else {
					window.location = window.location;
				}
			}
		});
		request.send(url, querystring);
	});
});