var typecount = 0;

function deltype( id, typev1, typev2, typeid )
{
	if ( confirm( "Вы уверены в том, что хотите удалить эту запись?" ) )
	{
		ShowHideObj( id );

		obj = getObjectByID( typev1 );
		if ( obj )
		{
			obj.value = '';
		}; //if

		obj = getObjectByID( typev2 );
		if ( obj )
		{
			obj.value = '';
		}; //if

		obj = getObjectByID( id );
		if ( obj )
		{
			obj.removeNode(true);
		}; //if

		if ( typeid )
		{
			xajax_ajax_delete_type( typeid );
		}; //if
	}; //if
}; //func

function addtype( activityname, typename, typeid, id, boxId, dontask, showhide )
{
	if ( !dontask )
	{
		if ( !confirm( "Добавить '" + activityname + ": " + typename + "' к списку типов?" ) )
		{
			return;
		}; //if
	}; //if

	obj = getObjectByID( boxId );
	if ( obj && obj.innerHTML )
	{
		typecount = typecount + 1;
		obj.innerHTML = obj.innerHTML +
		'	<table width="100%" border="0" cellpadding="4" id="type' + typecount + '" class="visible">' + 
		'		<tr>' + 
		'			<td width="5"><a href="#type" title="Удалить запись" onClick="deltype( \'type' + typecount + '\', \'typeid' + typecount + '\', \'typetype' + typecount + '\', \'' + id + '\' )">[X]</a></td>' +
		'			<td width="50%" align="center"><b>' + activityname + '</b></td>' + 
		'			<td width="50%" align="center">' + typename + '</td>' + 
		'		</tr>' + 
		'	</table>' +
		'<input type="hidden" name="form[addtype_id][]" value="' + id + '" id="typeid' + typecount + '"><input type="hidden" name="form[addtype_type][]" value="' + typeid + '" id="typetype' + typecount + '">';
	}; //if

}; //func
