// Copyright 1999 Macromedia, Inc. All rights reserved.

	function receiveArguments()
	{
		var itemID = arguments[0];
		var docPath = dw.getDocumentPath('document');
		if (itemID == "unlock")
		{
			if (dw.getFocus() == 'site')
				site.makeEditable();
			else
				dw.getDocumentDOM().makeEditable();
		}
		if (itemID == "connect")
		{
			if (site.getConnectionState() == true)
				site.setConnectionState(false);
			else
				site.setConnectionState(true);
		}
		if (itemID == "put")
		{
			if (dw.getFocus() == 'site')
				site.put("site");
			else
				site.put(docPath);
		}
		if (itemID == "get")
		{
			if (dw.getFocus() == 'site')
				site.get("site");
			else
				site.get(docPath);
		}
		if (itemID == "checkout")
		{
			if (dw.getFocus() == 'site')
				site.checkOut("site");
			else
				site.checkOut(docPath);
		}
		if (itemID == "checkin")
		{
			if (dw.getFocus() == 'site')
				site.checkIn("site");
			else
				site.checkIn(docPath);
		}
		if (itemID == "undocheckout")
		{
			if (dw.getFocus() == 'site')
				site.undoCheckOut("site");
			else
				site.undoCheckOut(docPath);
		}
		if (itemID == "findlocal")
		{
			if (dw.getFocus() == 'site')
				site.locateInSite("local","site");
			else
				site.locateInSite("local", docPath);
		}
		if (itemID == "findremote")
		{
			if (dw.getFocus() == 'site')
				site.locateInSite("remote","site");
			else
				site.locateInSite("remote", docPath);
		}
		if (itemID == "togglemap")
		{
			dw.toggleFloater('site map');
		}
   }

   function canAcceptCommand()
   {
		var itemID = arguments[0];
		var docPath = dw.getDocumentPath('document');
		if (itemID == "unlock")
		{
			if (dw.getFocus() == 'site')
				return site.canMakeEditable();
			else
				return dw.getDocumentDOM().canMakeEditable();
		}
		if (itemID == "connect")
		{
			return dw.getFocus() == 'site' && site.canConnect();
		}
		if (itemID == "put")
		{
			if (dw.getFocus() == 'site')
				return site.canPut("site");
			else
				return site.canPut(docPath);
		}
		if (itemID == "get")
		{
			if (dw.getFocus() == 'site')
				return site.canGet("site");
			else
				return site.canGet(docPath);
		}
		if (itemID == "checkout")
		{
			if (dw.getFocus() == 'site')
				return site.canCheckOut("site");
			else
				return site.canCheckOut(docPath);
		}
		if (itemID == "checkin")
		{
			if (dw.getFocus() == 'site')
				return site.canCheckIn("site");
			else
				return site.canCheckIn(docPath);
		}
		if (itemID == "undocheckout")
		{
			if (dw.getFocus() == 'site')
				return site.canUndoCheckOut("site");
			else
				return site.canUndoCheckOut(docPath);
		}
		if (itemID == "findlocal")
		{
			if (dw.getFocus() == 'site')
				return site.canLocateInSite("local","site");
			else
				return site.canLocateInSite("local",docPath);
		}
		if (itemID == "findremote")
		{
			if (dw.getFocus() == 'site')
				return site.canLocateInSite("remote","site");
			else
				return site.canLocateInSite("remote",docPath);
		}
		return true;
   }

   function setMenuText()
   {
		var itemID = arguments[0];
 		if (itemID == "connect")
		{
			if (site.getConnectionState() == true)
				return MENU_Disconnect;
			else
				return MENU_Connect;
		}
		else if (itemID == "togglemap")
		{
			if (dw.getFloaterVisibility("site map"))
				return MENU_SiteFiles;
			else
				return MENU_SiteMap;
		}
		else
			return "";
   }
