/** 	$Id: 23.07.2007 16:09:21 ober $ **/
/* COMMENT AVATAR FUNCTIONS */

var colCount = 3;
var is_show_avatar_selector = false;

function toggleAvatarSelector()
{
	if (is_show_avatar_selector)
		hideAvatarSelector(0);
	else
		showAvatarSelector();
}

function showAvatarSelector()
{
	var eOn = document.getElementById( 'avatar_selected' );
	cmnSet_class( eOn, 'caActive' );
	//
	var avatarSelector = document.getElementById('avatar_selector');
	avatarSelector.style.width = (widthAvatar * colCount) + 'px';
	if ('undefined' != typeof( hide_timeout )) clearTimeout(hide_timeout);
	avatarSelector.style.display = 'block';
	is_show_avatar_selector = true;
}

function hideAvatarSelector(microtime)
{	
	var eOn = document.getElementById( 'avatar_selected' );
	cmnRemove_class( eOn, 'caActive' );
	//
	if (0 == microtime)
	{
		document.getElementById('avatar_selector').style.display = 'none';
		is_show_avatar_selector = false;
	}
	else
		hide_timeout = setTimeout("hideAvatarSelector(0)",microtime)
}

function selectAvatar(id)
{
	var avatarCurrent = document.getElementById('avatar_'+main_avatar_id);
	var avatarSelected = document.getElementById('avatar_'+id);
	//
	if (!avatarSelected)
		return false;
	var src = avatarSelected.style.backgroundImage;
	document.getElementById('avatar_selected').style.backgroundImage = src;
	document.getElementById('avatar_id_input').value = id;
	main_avatar_id = id;
	//
	hideAvatarSelector();
}