﻿function PopupEditWindow(type, params)
{
	var url = "/nodes/edit_" + type + ".asp?" + params;
/*
	var w = window.open(url, "edit", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=820,height=700");
	w.focus();
*/
	window.document.location = url;
}

function PopupImportWindow(type, params)
{
	var url = "/nodes/import_" + type + ".asp?" + params;
	window.document.location = url;
}

function NewNode(type, parent)
{
	PopupEditWindow(type, (parent ? "parent=" + parent : "") + "&back=1");
}

function EditNode(type, id)
{
	PopupEditWindow(type, (id ? "node=" + id : ""));
}

function DeleteNode(type, id)
{
	if (window.confirm("Ali ste prepričani, da želite zbrisati zapis?")) {
		PopupEditWindow(type, "action=delete&" + (id ? "node=" + id : ""));
		// return true;
	} // else
	//	return false;	
}

function AuthorizeNode(type, id)
{
	PopupEditWindow(type, "action=authorize&" + (id ? "node=" + id : ""));
	// return true;
}

function UnauthorizeNode(type, id)
{
	PopupEditWindow(type, "action=unauthorize&" + (id ? "node=" + id : ""));
	// return true;
}

function ImportNodes(type, parent)
{
	PopupImportWindow(type, (parent ? "parent=" + parent : "") + "&back=1");
}

function ChangePassword(id)
{
	var url = "/nodes/change_password.asp?" + (id ? "node=" + id : "");
	window.document.location = url;
}

function Impersonate(m_id, pwdhash)
{
	var url = "/sl/login.asp?" + (m_id ? "m_id=" + m_id + "&" : "&") + (pwdhash ? "pwdhash=" + pwdhash : "");
	window.document.location = url;
}
