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 'SubMenu':
				
			Popup('../Manager/ManageMenu.aspx?_pid=' + treeNodeValue,720,700,0,1);	
			break; 
			
		case 'NewPage':
			Popup('../Manager/ManagePage.aspx?_mid=' + treeNodeValue, 720, 700, 0, 1);
			
			break;
			
		case 'Open':
			GetDialogResult('LOAD_PAGES',treeNodeValue);
			break; 
			
		case 'Edit':
			Popup('../Manager/EditMenu.aspx?_mid=' + treeNodeValue ,650,340,0,0);
			break; 
			
		case 'Delete':
			if (confirm(treeNodeText + ' Menusu silinecek. Emin misiniz?'))
				GetDialogResult('DEL_MENU',treeNodeValue);
			break; 

		case 'GoUp':
				GetDialogResult('GO_UP',treeNodeValue);
			break; 
		
		case 'GoDown':
				GetDialogResult('GO_DOWN',treeNodeValue);
			break; 
			
		case 'Permissions':
				Popup('../Popups/PermissionsForPage.aspx?_mid=' + treeNodeValue ,670,700,0,1);
				//GetDialogResult('PERMISSIONS_FOR_PAGE',treeNodeValue);
			break; 
			
		case 'GoToPage':
			GetDialogResult('MENU_DEFAULT_PAGE',treeNodeValue);
		break; 
		
		default: 
			break; 
	}  
}
function PopUpPagesHistory(id)
{
	Popup('../Popups/PageHistory.aspx?pgID=' + id, 670, 500, 0, 1);
}

function PopUpNewContainerPage(id)
{
	if (id != '')
		Popup('../Manager/NewContainer.aspx?cnr=' + id, 650, 550, 0, 0);
	else
		Popup('../Manager/NewContainer.aspx', 650, 550, 0, 0);
	
	
}

function PopUpNewUserPage()
{
	Popup('../Manager/NewUser.aspx',650,450,0,0);
}

function PopUpOldPageForModify(id)
{
	Popup('../Manager/managepage.aspx?phold='+ id, 720, 700, 0, 1);
}

function PopUpOldPageForPh(id)
{
	Popup('../Manager/managepage.aspx?ph='+ id, 720, 700, 0, 1);
}

function PopUpPreviewPage(id)
{
	Popup('../Popups/PreviewPage.aspx?pgID=' + id);
}
function PopUpPageForClone(id)
{
	Popup('../Manager/ClonePage.aspx?pgID='+ id, 670, 550, 0, 1);
}						
function PopUpNewPage(id)
{
	Popup('../Manager/ManagePage.aspx?pgID=' + id, 720, 700, 0, 1);
}

function PopUpVoteChoicePage(id)
{
	Popup('../Manager/ManageVoteChoice.aspx?vtID=' + id, 670, 550, 0, 1);
}

function PopupListItemPage(id,cnID)
{
	if (cnID != '')
		Popup('../Manager/ManageListItem.aspx?cnr=' +cnID, 670, 550, 0, 1);
	else
		Popup('../Manager/ManageListItem.aspx?listID=' +id, 670, 550, 0, 1);
}

function PopupCoursePage(HashID,ProductID)
{
	Popup('http://localhost/ELearning/Secure/Course.aspx?HashID=' + HashID + "&ProductID=" + ProductID, 800, 550, 0, 1);
}