Event.observe(window, 'load', init, false);

function init(){
     Event.observe('reg_email', 'focus', show_check_email, false);
     Event.observe('reg_password', 'focus', show_check_password, false);
}

function show_check_email(){
	Effect.Appear("reg_email_conf_row", {
	      duration: 0.5,
	      afterFinish: function() {
	        $('reg_email').focus();
	      }
    });
     Event.stopObserving('reg_email', 'focus', show_check_email, false);
}

function show_check_password(){
	Effect.Appear("reg_password_conf_row", {
	      duration: 0.5,
	      afterFinish: function() {
	        $('reg_password').focus();
	      }
    });
     Event.stopObserving('reg_password', 'focus', show_check_password, false);
}

function check_username_available(result, element){
	if (element.id=='reg_username' && result===true){
		var url = 'ajax_check_user.php';
		var pars = 'reg_username='+escape($F('reg_username'));
		var target = 'username_ok';
		var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
	}
}

