function delElement(type, id)
{
  var element = type + '_' + id;
  if ($(element)) {
  	if (confirm("Are you sure you want to delete this item?")) {
	    $(element).remove();
	    var url = 'ssi/transact.php';
	    
	    var ajax = new Ajax.Updater(
	    	{success: 'delResult'},
	    	url,
	    	{method: 'post', parameters: {edit_type: 'del_' + type, id: id}});
	  }
  }
}

function addDoc(count)
{
  if (count >= 10) {
    var output = "You have already reached the maximum number of documents.";
    $('add_doc_para').update(output);
  } else {
    var idName = 'doc_tr_' + count;
    newCount = count + 1;
    var output = '<tr>\n<td colspan=\"2\" class=\"document\"><strong>Document #' + newCount + ':</strong></td>\n</tr>\n';
    output += '<td><strong>Title:</strong></td>\ntd><input name=\"doc_title_' + newCount + '\" type=\"text\" size=\"50\" /></td>\n';
    output += '</tr>\n<tr>\n<td><strong>Description:</strong></td>\n';
    output += '<td><textarea name=\"doc_desc_' + newCount + '\" rows=\"5\" cols=\"37\"></textarea></td>\n';
    output += '</tr>\n<tr>\n<td><strong>Document:</strong></td>\n';
    output += '<td><input type=\"file\" id=\"doc_' + newCount + '_desc_file\" value=\"\" /></td>\n';
    output += '</tr>\n';
    $('doc_tr_1').insert({after: output});
  }
  return count;
}
