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

	function receiveArguments()
	{
		dw.assetPalette.addToFavoritesFromSiteWindow();
   	}

   function canAcceptCommand()
   {
   		var selItems  = site.getSelection();
		if (selItems.length == 0)
			return false;

		var enableIt = false;			
		for (i=0; i < selItems.length; i++)
		{
			if (!DWfile.exists(selItems[i]) && selItems[i].lastIndexOf(":") > 0)
				enableIt = true;
			else if (DWfile.getAttributes(selItems[i]) != "D")
			{
				filename = selItems[i].toLowerCase();
				if ((filename.lastIndexOf(".gif") > 0) ||
					(filename.lastIndexOf(".jpe") > 0) ||
					(filename.lastIndexOf(".jpg") > 0) ||
					(filename.lastIndexOf(".jpeg") > 0) ||
					(filename.lastIndexOf(".png") > 0) ||
					(filename.lastIndexOf(".dcr") > 0) ||
					(filename.lastIndexOf(".dxr") > 0) ||
					(filename.lastIndexOf(".swf") > 0) ||
					(filename.lastIndexOf(".spl") > 0) ||
					(filename.lastIndexOf(".mov") > 0) ||
					(filename.lastIndexOf(".mpe") > 0) ||
					(filename.lastIndexOf(".mpg") > 0) ||
					(filename.lastIndexOf(".mpeg") > 0) ||
					(filename.lastIndexOf(".js") > 0) ||
					(filename.lastIndexOf(".vbs") > 0))
				{
					enableIt = true;
				}
			}
		}
		return enableIt;
   }

   function setMenuText()
   {
   		var selItems  = site.getSelection();
		if (selItems.length == 0)
			return MENU_Generic;

		var isImage = false;
		var isShockwave = false;
		var isFlash = false;
		var isMovie = false;
		var isScript = false;
		var isURL = false;
		for (i=0; i < selItems.length; i++)
		{
			if (!DWfile.exists(selItems[i]) && selItems[i].lastIndexOf(":") > 0)
			{
				isURL = true;
			}
	 		else if (DWfile.getAttributes(selItems[i]) != "D")
			{
				filename = selItems[i].toLowerCase();
				if ((filename.lastIndexOf(".gif") > 0) ||
					(filename.lastIndexOf(".png") > 0) ||
					(filename.lastIndexOf(".jpe") > 0) ||
					(filename.lastIndexOf(".jpg") > 0) ||
					(filename.lastIndexOf(".jpeg") > 0))
				{
					isImage = true;
				}
				if ((filename.lastIndexOf(".dcr") > 0) ||
					(filename.lastIndexOf(".dxr") > 0))
				{
					isShockwave = true;
				}
				if ((filename.lastIndexOf(".swf") > 0) ||
					(filename.lastIndexOf(".spl") > 0))
				{
					isFlash = true;
				}
				if ((filename.lastIndexOf(".mov") > 0) ||
					(filename.lastIndexOf(".mpe") > 0) ||
					(filename.lastIndexOf(".mpg") > 0) ||
					(filename.lastIndexOf(".mpeg") > 0))
				{
					isMovie = true;
				}
				if ((filename.lastIndexOf(".js") > 0) ||
					(filename.lastIndexOf(".vbs") > 0))
				{
					isScript = true;
				}
			}
		}

		if (isImage && !isShockwave && !isFlash && !isMovie && !isScript && !isURL)
			return MENU_Image;
		else if (!isImage && isShockwave && !isFlash && !isMovie && !isScript && !isURL)
			return MENU_Shockwave;
		else if (!isImage && !isShockwave && isFlash && !isMovie && !isScript && !isURL)
			return MENU_Flash;
		else if (!isImage && !isShockwave && !isFlash && isMovie && !isScript && !isURL)
			return MENU_Movie;
		else if (!isImage && !isShockwave && !isFlash && !isMovie && isScript && !isURL)
			return MENU_Script;
		else if (!isImage && !isShockwave && !isFlash && !isMovie && !isScript && isURL)
			return MENU_URL;
		else
			return MENU_Generic;
  }
