if ($amount == 0) {
					if (value("decision") == $lang->get("yes")) {
						// set new folder-id.
						$parentId = getDBCell("categories", "PARENT_CATEGORY_ID", "CATEGORY_ID = " . $oid);
						pushVar("pnode", $parentId);
						
						// delete folder.
						$delhandler->addDBAction("DELETE FROM categories WHERE CATEGORY_ID = $oid");
						$delhandler->process("deletefolder");
						// set new id.
						$oid = $pnode = $parentId;
					} else if (value("decision") != $lang->get("no")) {
						$title = getDBCell("categories", "CATEGORY_NAME", "CATEGORY_ID = " . $oid);

						$form = new YesNoForm($lang->get("r_deletefolder"). " $title", $lang->get("folder_delmes", "Do you really want to delete this folder?"));
						$form->add(new Hidden("action", $lang->get("del_folder")));
						$form->add(new Hidden("pnode", $pnode));
						$page->add($form);
						$handled = true;
					}
				} else {
					$title = getDBCell("categories", "CATEGORY_NAME", "CATEGORY_ID = $oid");

					$delform = new MessageForm($lang->get("r_deletefolder"). " $title", $lang->get("r_foldernotempty"), doc(). "?" . $auth->getSid());
					$page->add($delform);
					$handled = true;
				}
			}
		} else if ($action == $lang->get("edit_folder") && $auth->checkAccessToFunction("ED_FOLDER_PROPS") && $pnode != "0") {
			$go = "UPDATE";
		// delete an object
		} else if ($action == "delobject" && $aclf->checkAccessToFunction("DELETE_OBJECT")) {
			if (!isset($go))
				$go = "start";

			$delhandler = new ActionHandler("deleteobject");

			if (value("decision") == $lang->get("yes")) {
				$delhandler->addDBAction("UPDATE content SET DELETED = 1 WHERE CID = $oid");

				$delhandler->addDBAction("UPDATE cluster_template_items SET FKID=0 WHERE FKID=$oid");
				$delhandler->process("deleteobject");
			} else if (value("decision") != $lang->get("no")) {
				$title = getDBCell("content", "NAME", "CID = $oid");

				$form = new YesNoForm($lang->get("o_del"). " $title", $lang->get("o_delmes2", "Do you really want to delete this content? It may still be used in some clusters."));
				$form->add(new Hidden("action", "delobject"));
				$form->add(new Hidden("oid", $oid));
				$page->add($form);
				$handled = true;
			}
		}
	}

	if (!$handled) {
		$variation = variation();

		$go = "view";
		$form = new Form($lang->get("library", "Content Library"));
		$form->cols = 3;
			if ($go == "0" || $go == "")
				$go = "start";

			$delhandler = new ActionHandler("deleteobject");

			if (value("decision") == $lang->get("yes")) {
				$delhandler->addDBAction("UPDATE cluster_node SET DELETED = 1 WHERE CLNID = $oid");

				$delhandler->addDBAction("UPDATE cluster_content SET FKID=0 WHERE FKID = $oid");
				$delhandler->addDBAction("UPDATE cluster_template_items SET FKID=0 WHERE FKID = $oid");
				
				$delhandler->process("deleteobject");
				$handled = true;
			} else if (value("decision") != $lang->get("no")) {
				$title = getDBCell("cluster_node", "NAME", "CLNID = $oid");
				$form = new YesNoForm($lang->get("cl_del"). " $title", $lang->get("cl_delmes", "Do you really want to delete this cluster-instance?"));
				$form->add(new Hidden("action", $lang->get("CL_DEL")));
				$form->add(new Hidden("oid", $oid));
				$page->add($form);
				$handled = true;				
			}
		} else if (($action == $lang->get("cl_new")) && $aclf->checkAccessToFunction("NEW_INSTANCE")) {
			if (!isset($go) || $go == "0")
				$go = "insert";

			$page_action = "INSERT";		
			$clt = getVar("clt");
			$form = new stdEDForm($lang->get("cl_new"), "i_edit.gif");
			$cond = $form->setPK("cluster_node", "CLNID");
			$oname = new TextInput($lang->get("name"), "cluster_node", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE");
			$oname->setFilter("CLT_ID = $clt");
				$query = new query($db, $sql); 	
				$fkid = getDBCell("content_variations", "FK_ID", "CID=$oid AND VARIATION_ID = $variation");			
			} else {
				$fkid =nextGUID();
				$sql = "INSERT INTO content_variations (CID, FK_ID, VARIATION_ID, DELETED) VALUES ( $oid, $fkid, $variation, 0)";
				$query = new query($db, $sql);				
				$PGNRef = createPGNRef($content_MODULE_ID, $fkid);
        $PGNRef->sync();
			}			
			
			$page_state = "start";			
		} else if (value("action") == "cr_content" && value("decision") == $lang->get("no")) {				
				header("Location: ".$c["docroot"]."modules/content/objectbrowser.php?sid=$sid");
				exit;
		} else {
			$form = new YesNoForm($lang->get("cr_vr", "Create variation"), $lang->get("crlib_mes", "The content element does not exists in the selected variation. Do you want to create it?"));
			$form->add(new Hidden("action", "cr_content"));
			$form->add(new Hidden("oid", $oid));
			$form->add(new Hidden("crvar", $variation));
			$handled = true;
		}
        }
        
        if (! $handled) {
        	$form = new PanelForm($lang->get("edit_content", "Edit Content"). ": " . $name, '', 'con');
        
        	if ($aclf->checkAccessToFunction("EDIT_OBJECT")) {
        		$editpanel = new Panel($lang->get("edit_content"));
        		$buttonbar = new ButtonBar("variations");
        		$buttonbar->selectBoxDescr = true;
        		$buttonbar->setVariationSelector(createNameValueArrayEx("variations", "NAME", "VARIATION_ID", "1"), $variation);