﻿// JScript File

function adminNav(type,obj)
{
	switch(type)
	{
		case 'editClient':
			location.href= 'Client_edit.aspx?id=' + obj.options[obj.selectedIndex].value;
			break;
	}
	
}
function showFiles(id)
{
	self.location.href = "Client_files.aspx?id=" + id;
}

function deleteUser(id)
{
	if(confirm('Är du säker på att du vill ta bort denna användare?\nAlla referenser till filer kommer också att tas bort och detta går ej att ångra.') != false)
		self.location= 'Client_delete.aspx?clientId=' + id;
	else
		return false;
}
document.clientId = 0;
function openFileManager(id)
{
	var path = (arguments[1] != undefined)? "?rootpath=" + arguments[1] : "";
	if(id != null)
		document.clientId= id;
    imageBrowserWin = window.open('FileManager/files.aspx' + path,"imageBrowser","width=600,height=400,status=yes,toolbar=no,scrollbars=yes,resizable=yes");
    imageBrowserWin.focus();
}
function fileBrowserCallBack_return(fileRef)
{
	if(arguments[1] != undefined && arguments[1] == "folder")
		self.location="/clientlogin/Client_folder_set.aspx?id=" + document.clientId + "&folderref=" + fileRef + "&rw=" + arguments[2];
	else
		self.location="/clientlogin/Client_files_set.aspx?id=" + document.clientId + "&fileref=" + fileRef;
}
function getScript()
{
	var loc = window.location.href;
	var pos = loc.lastIndexOf('?');	
	return (pos != 0) ? loc.substring(0,pos): loc;	
}
