
function treeContextMenu(treeNode, e)
{
	contextMenu.ShowContextMenu(e, treeNode);
}

function contextMenuClickHandler(menuItem)
{

	var commandText = menuItem.Text;
	var commandValue = menuItem.Value;
	var contextDataNode = menuItem.ParentMenu.ContextData; 
	var treeNodeText = contextDataNode.Text;
	var treeNodeValue = contextDataNode.Value;
											
	switch(commandValue)
	{
		case 'NewFolder':
			Popup('ManageFolder.aspx?pid=' + treeNodeValue,500,125,0,0);
			break; 
			
		case 'NewDocument':
			Popup('ManageDoc.aspx?fid=' + treeNodeValue, 550, 200, 0, 0);
			break;
			
		case 'Open':
			GetDialogResult('LOAD_DOCS',treeNodeValue);
			break; 
			
		case 'Edit':
			Popup('ManageFolder.aspx?fid=' + treeNodeValue ,500,125,0,0);
			break; 
			
		case 'Delete':
			if (confirm(treeNodeText + ' klasörü silinecek. Emin misiniz?'))
				GetDialogResult('DEL_FOLDER',treeNodeValue);
			break; 

		case 'GoUp':
				GetDialogResult('GO_UP',treeNodeValue);
			break; 
		
		case 'GoDown':
				GetDialogResult('GO_DOWN',treeNodeValue);
			break; 
		
		default: 
			break; 
	}  
}

function PopUpDocEdit(id)
{
	Popup('ManageDoc.aspx?did=' + id, 550, 200, 0, 0);
}
function PopUpCodeEdit(id)
{
	if (id != '-1')
	Popup('ManageCode.aspx?code=' + id, 426, 120, 0, 0);
	else
	Popup('ManageCode.aspx', 426, 120, 0, 0);
	
}
function PopUpDoc(id)
{
	Popup('Data/' + id, 500, 400, 1, 1);
}

function PopUpDocWithPath(id,sPath)
{
	Popup(sPath+ '/' + id, 500, 400, 1, 1);
}

// Preload CSS-referenced images 
var img1 = new Image();
img1.src = 'imgMenu/group_background.gif';
var img2 = new Image();
img2.src = 'imgMenu/break_bg.gif';
