function auth_user_profiles_manager_load()
{
	
	var params = Array();
    call_ajax('auth_user_profiles_manager', 'content', params);    

}


function auth_user_register_page_load()
{
	
	var params = Array();
    call_ajax('auth_user_register_page', 'auth_user_register_form', params);    

}

function auth_user_confirm_page_load()
{

	var params = Array();
    call_ajax('auth_user_confirm_page', 'content', params);    

}





function auth_user_register_form_load()
{
	
	var params = Array();
    call_ajax('auth_user_register_form', 'content', params);    

}

function auth_user_register() 
{
	debugger;	
	var params = get_input_values('auth_user_register_form');
    params['s_action'] = 'register_user';

	clean_form_message('auth_user_register_form');
	send_form_message('auth_user_register_form', 'Анализ данных', 'inform');

    call_ajax('auth_user_state', 'form_message', params);    

}


function profile_load_form(plugin_form_name)
{

	var container = document.getElementById('auth_user_profiles_manager_content');
	container.innerHTML = '<div id="profile_form_body"><div/>'
	call_ajax(plugin_form_name, 'profile_form_body');

}



/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

//01.04.2008 Roman - добавлен обязательный аттрибут form_body_id для работы со несколькими формами врамках броузера (по идее он соответствует идентификатору контейнера плагина и потому из-вестен на уровне стейта)
function send_form_message(form_body_id, message, type_id) 
{

	var form_message_element = get_form_message_element(form_body_id); 
	form_message_element.innerHTML += '<span class="form_message_' + type_id + '">' + message + '</span>';

}

/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

//01.04.2008 Roman - добавлен обязательный аттрибут form_body_id для работы со несколькими формами врамках броузера (по идее он соответствует идентификатору контейнера плагина и потому из-вестен на уровне стейта)
function clean_form_message(form_body_id) 
{

	var form_message_element = get_form_message_element(form_body_id); 
	form_message_element.innerHTML = '';

}

/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

function get_form_message_element(form_body_id) 
{
	
	var form_body = document.getElementById(form_body_id);
	var elements = form_body.getElementsByTagName('div');

	for (var i = 0; i < elements.length; i++) 
	{
		var element = elements[i];
		if(element.getAttribute('name') == 'form_message') 
		{
			return element; 
		}
	
	}

	return false;
}

/**
 * function auth_user_activate_jur_lica
 * активирует юридические лица на форме регистрации пользователя
 * @access public	
 * @autor Dorian 
 * @param 
 * @return 
*/

function auth_user_activate_jurlica()
{
	set_conatiner_elements_disabled_value('auth_user_register_form.jurlica', false);
    set_conatiner_elements_disabled_value('auth_user_register_form.phizlica', true);
}

function auth_user_activate_phizlica()
{
	set_conatiner_elements_disabled_value('auth_user_register_form.jurlica', true);
    set_conatiner_elements_disabled_value('auth_user_register_form.phizlica', false);
}

function auth_user_profile_apply(btn)
{
	var params = get_input_values('auth_user.account');

	params['s_action'] = 'profile_apply';
    params['i_user_id'] = document.getElementById('auth_user_profile').getAttribute('i_user_id');
	
	clean_form_message('auth_user.account');
	send_form_message('auth_user.account', 'Анализ данных', 'inform');

    call_ajax('auth_user_state', false, params);    
}

function auth_user_profile_apply_password(btn)
{

	clean_form_message('auth_user.account_password');

	var params = get_input_values('auth_user.account_password');
    params['s_action'] = 'profile_apply_password';
    params['i_user_id'] = document.getElementById('auth_user_password_profile').getAttribute('i_user_id');


	if(params['a_auth_user[account][confirmation_password]'] != params['a_auth_user[account][password]']) 
	{
		send_form_message('auth_user.account_password', 'Пароли не совпадают', 'error');
		return false;
	}

	send_form_message('auth_user.account_password', 'Анализ данных', 'inform');

    call_ajax('auth_user_state', false, params);    
}

function auth_user_activate_profile_apply(btn)
{
	var params = get_input_values('auth_user_profile_activate');

	params['s_action'] = 'profile_apply_active';
    params['i_user_id'] = document.getElementById('auth_user_profile_activate').getAttribute('i_user_id');
	
	clean_form_message('auth_user_profile_activate');
	send_form_message('auth_user_profile_activate', 'Анализ данных', 'inform');

    call_ajax('auth_user_state', false, params);    
}

function auth_user_roles_profile_apply(btn)
{
	var params = get_input_values('auth_user_profile_roles');

	params['s_action'] = 'profile_apply_roles';
    params['i_user_id'] = document.getElementById('auth_user_profile_roles').getAttribute('i_user_id');
	
	clean_form_message('auth_user_profile_roles');
	send_form_message('auth_user_profile_roles', 'Анализ данных', 'inform');

    call_ajax('auth_user_state', false, params);    
}


/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

function auth_user_admin_users_list_open_manager(user_id) 
{

	document.getElementById('auth_user_admin_users_list[list]').style.display = 'none';
	
	var form_body = document.getElementById('auth_user_admin_users_list[form_manager]');
	form_body.style.display = 'block';
	form_body.innerHTML = '<div id="auth_user_admin_users_list[form_manager]_body"></div>';
	
	var params = new Array();
	params['i_user_id'] = user_id;
	call_ajax('auth_user_admin_users_list_form_manager', 'auth_user_admin_users_list[form_manager]_body', params); 

}

function auth_user_admin_users_list_open_manager_close()
{

	document.getElementById('auth_user_admin_users_list[list]').style.display = 'block';
	document.getElementById('auth_user_admin_users_list[form_manager]').style.display = 'none';
	document.getElementById('auth_user_admin_users_list[form_manager]').innerHTML = '';

}

function admin_profile_load_form(plugin_form_name)
{

	var container = document.getElementById('auth_user_admin_users_list_form_manager_content');
	container.innerHTML = '<div id="admin_profile_form_body"><div/>'

	var params = new Array();
	params['i_user_id'] = document.getElementById('auth_user_admin_users_list_form_manager').getAttribute('i_user_id');

	call_ajax(plugin_form_name, 'admin_profile_form_body', params);

}


/**
 * function 
 * 
 * @access public	
 * @param 
 * @return 
*/

function auth_user_admin_users_delete(user_id) 
{

	if(confirm('Вы уверенны что ходите удалить пользователя?'))
	{ 

		var params = new Array();

		params['s_action'] = 'profile_delete';
		params['i_user_id'] = user_id;

		call_ajax('auth_user_state', false, params);    

	}

}