var rocID = {

	start: function() {
		if ($('search_lastname_firstname')) rocID.getUserByName($('search_lastname_firstname'));
	},

	getUserByName: function (el) {
		el.addEvent('keyup', function(e) {
			var value = el.getValue();
			if (value.length > 3) {
				wu.AjaxTimed(1200, '/system/remote/rocid.php?get=user&search=' + value, 'search_result', true, '');
			}
		});
	},

	getLoginForm: function (rocid) {
		var complete = function () {
			$('search_lastname_firstname').setProperty('disabled', 'disabled');
			rocID.doLogin();
		}
		wu.Ajax('/system/remote/rocid.php?get=login_form&rocid=' + rocid, 'search_result', true, complete);
	},

	doLogin: function () {
		$('login').addEvent('click', function(e) {
			var complete = function () {
				if ($('next_step')) rocID.getNextStep();
			}
			wu.Ajax('/system/remote/rocid.php?get=login&' + $('registration_login').toQueryString(), 'search_result', true, complete);
		});
	},

	getNextStep: function () {
		location.reload();
	}

};
