var acValues = new Object();

//Format a single hint
function acFormatItem(row) {
	lastSelected = -1;
	var id = '';
	var html = '<div class="user_list_unselected">';
	if(row.map['class']=='KcUser'){
		html += '<img align="left" src="' + TT_BASE_URL_AVATAR + '/' + row.map['avatarFilename'] + '" width="26" />';
		html += '<font size="1">';
		html += '<b>' + row.map['nickname'] + '</b> [' + row.map['status'] + ']<br>';
		html += row.map['userID']+'</font>';
		var infos = row.map['firstName'] + ' ' + row.map['lastName'];
		if(row.map['firstName']==null || row.map['lastName']==null){
			infos = row.map['userID'];	
		}
		html += '<input id="info" type="hidden" class="acInfoInputClass" value="' + infos + '" />';
		id = row.map['userID'];
	}else if(row.map['class']=='KcGroup'){
		html += '<img align="left" src="' + TT_BASE_URL_AVATAR_GROUP + row.map['avatarFilename'] + '" width="26" />';
		html += '<font size="1">';
		if (row.map['name'] != ''){
			html += '<b>' + row.map['name'] + '</b> <br>';
		}
		html += row.map['creator.userID']+'</font>';
		html += '<input id="info" type="hidden" class="acInfoInputClass" value="' + row.map['name'] + '" />';
		id = row.map['id'];
	}else if(row.map['class']=='KcUserTagging'){
		html += '<img align="left" src="' + TT_BASE_URL_IMG + '/user/tagging/tagging.gif" width="25"/><p style="vertical-align:center; margin-top:3px;">' + row.map['tag.tag']+ '</i></p>';
		html += '<input id="info" type="hidden" class="acInfoInputClass" value="' + row.map['tag.tag'] + '" />';
		id = row.map['tag.tag'];
	}else if(row.map['class']=='KcTag'){
		html += '<img align="left" src="' + TT_SKIN_URL + '/img/action_ico/share_contents.gif" width="25"/><p style="vertical-align:center; margin-top:3px;">' + row.map['tag']+ '</i></p>';
		html += '<input id="info" type="hidden" class="acInfoInputClass" value="' + row.map['tag'] + '" />';
		id = row.map['tag'];
	}else if(row.map['class']=='KcNetwork'){
		html += '<p><i>' + row.map['id'] + ':</i> ' + row.map['name'] + '';
		if (row.map['description'] != null && row.map['description'] != ''){
			html += '<br><h6> ' + row.map['description'] + '</h6>';
		}
		html += '</p>';
		
		html += '<input id="info" type="hidden" class="acInfoInputClass" value="' + row.map['id'] + '" />';
		id = row.map['id'];
	}
	
	html += '<input id="id" type="hidden" class="acIdInputClass" value="' + id + '" />';
	html += '<input id="type" type="hidden" class="acClassInputClass" value="' + row.map['class'] + '" />';
	html += '</div>';
	
	acValues[row.map['class'] + '_' + id] = row.map;
	return html;
}

function getSelectedObject(e){
	var obj = new Object();
	$('.acIdInputClass', e).each(
		function(i, el) {
			obj['id'] = $(this).val();	
		}
	);
	$('.acClassInputClass', e).each(
		function(i, el) {
			obj['class'] = $(this).val();	
		}
	);
	$('.acInfoInputClass', e).each(
		function(i, el) {
			obj['info'] =  $(this).val();	
		}
	);
	obj.map = new Object(); 
	obj.map = acValues[obj['class'] + '_' + obj['id']];
	return obj;
}
