function EditFolder(folderID,element){
	SwitchTab('add') ;
	SwapToEditForm() ;
	GetFolderTitle(folderID) ;
	document.getElementById( 'link_inputs' ).className = 'noshow' ;
	document.forms[0].NodeID.value = folderID ;
	document.forms[0].NodeType.value = 'folder' ;
}

function DropFolder(folderID){
	if(confirm("Are you sure you want to do this? Once deleted, this element AND ANY OF ITS CONTENTS will not be able to be recovered unless all the changes from this session are cleared")){
		SwapToEditWarning() ;
		DeleteFolder(folderID) ;	
	}	
}

function EditLink(linkID){
	SwitchTab('add') ;
	SwapToEditForm() ;
	GetLinkData(linkID) ;
	document.getElementById( 'link_inputs' ).className = '' ;
	document.forms[0].NodeID.value = linkID ;
	document.forms[0].NodeType.value = 'file' ;
}

function DropLink(linkID){
	if(confirm("Are you sure you want to do this? Once deleted, this link will not be able to be recovered unless all the changes from this session are cleared")){
		SwapToEditWarning() ;
		DeleteLink(linkID) ;
	}	
}

function ShowCollections(collection,ID){
	
	SwapToEditWarning() ;
	
	allCollections = document.getElementsByClassName( 'droppeddown' ) ;
	for(x=0;x<allCollections.length;x++){
		allCollections[x].className = 'droppeddown noshow' ;
	}
	
	allFolders = document.getElementsByClassName( 'expandedfolder' ) ;
	for(x=0;x<allFolders.length;x++){
		allFolders[x].className = 'expandedfolder noshow' ;
	}
	
	allAddFolders = document.getElementsByClassName( 'addfolder' ) ;
	for(x=0;x<allAddFolders.length;x++){
		allAddFolders[x].className = 'addfolder noshow' ;	
	}
	
	allAddLinks = document.getElementsByClassName( 'addlink' ) ;
	for(x=0;x<allAddLinks.length;x++){
		allAddLinks[x].className = 'addlink noshow' ;
	}
	
	allFolderType = document.getElementsByClassName( 'foldertype' ) ;
	for(x=0;x<allFolderType.length;x++){
		allFolderType[x].className = 'foldertype noshow' ;
	}
	
	document.getElementById( 'droppeddown' + collection ).className = 'droppeddown' ;
	document.getElementById( 'addfolders' + collection ).className = 'addfolder' ;
	
	var btnattributes = document.getElementById( 'addfolders' + collection.substring(0,1) ).attributes ;
	btnattributes.getNamedItem("title").value = "Add a folder to this category" ;
	
	WriteFooter('collection',ID,collection) ;
}

function ShowFolders(folder,ID){
	
	SwapToEditWarning() ;
	
	allFolders = document.getElementsByClassName( 'expandedfolder' ) ;
	for(x=0;x<allFolders.length;x++){
		allFolders[x].className = 'expandedfolder noshow' ;	
	}
	
	document.getElementById( 'expandedfolder' + folder ).className = 'expandedfolder' ;
	document.getElementById( 'addlinks' + folder.substring(0,1) ).className = 'addlink' ;
	var btnattributes = document.getElementById( 'addfolders' + folder.substring(0,1) ).attributes ;
	btnattributes.getNamedItem("title").value = "Add a folder or subfolder to this category" ;
	
	WriteFooter('folder',ID,folder) ;
}

//sometimes a subcat or link cannot be added such as
//		if folder is deleted no links or subcats
//		if subcat is delete no links

