//****************************
function callFolderTreePopup(selector_name, show_marker_selectors)
{
	if (show_marker_selectors == true)
		marker_selector_parameter = 1;
	else
		marker_selector_parameter = 0;

	top.newWin = window.open('/intranet/common/folderstree_popup.php?selector_name='+selector_name
	   +'&document_select=1&marker_select=' + marker_selector_parameter + '&folder_select=0&class_select=0', 'tree',
	        'dependent=yes,width=500,height=430,screenX=200,screenY=300,titlebar=yes, scrollbars=yes,status=yes,resizable=yes');
	return false;
}

// Function called from popup window with folderstree_popup.php
function addTreeCategory(object_id, object_aggregation, object_name, dest_name)
{
	jQuery('#' + dest_name + '_browse').val('');
	jQuery('#' + dest_name + '_special_id').val(object_id);
	jQuery('#' + dest_name + '_realname').val(object_name);

	return true;
}

//****************************

function callBrowser(dest_name)
{
	var browse_input = document.getElementById(dest_name + '_browse');

	//browse_input.click();
	jQuery('#' + dest_name + '_special_id').val('');

	jQuery('#' + dest_name + '_realname').val(browse_input.value);
}

function callInnerDocument(dest_name)
{
	jQuery('#' + dest_name + '_browse').val('');
	return callFolderTreePopup(dest_name);
}

/*
function showDocumentSelector(selector_id, show_marker_selectors)
{
	var selector = document.getElementById(selector_id);

	if (!selector) return false;

	return callFolderTreePopup(selector_id, show_marker_selectors);
}
*/

function callImageSelect(dest_name)
{
	var cur_id = jQuery('#' + dest_name + '_special_id').val();

	top.imageWin = window.open('/intranet/common/image_select_popup.php?dest_name='+dest_name + '&image_code=' + cur_id, 'image_win',
	        'dependent=yes,width=500,height=430,screenX=200,screenY=300,titlebar=yes, scrollbars=yes,status=yes,resizable=yes');
	return false;
}

function imageSelected(dest_name, image_code, realname)
{
	jQuery('#' + dest_name + '_browse').val('');
	jQuery('#' + dest_name + '_special_id').val(image_code);
	jQuery('#' + dest_name + '_realname').val(realname);
}

