// apply a style to selected text



//$.bp();	//	Uncomment this line to cause the script to be run in the JavaScript debugger window.



ApplyStyle();



function ApplyStyle() 

{

	selectedItems = selection;



	// check to make sure something is selected.

	if (selectedItems.length == 0)

	{

		alert("Nothing is selected");

		return;

	}



	endIndex = selectedItems.length;



	for (index = 0; index < endIndex; index++)

	{



		pageObject = selectedItems[index];

		pageItemType = pageObject.typename;

		

		if (pageItemType == "TextFrame")

		{

			theTextRange = pageObject.textRange;

			theTextRange.size = 48;



			theGraphicStyles = activeDocument.graphicStyles;



			if (activeDocument.documentColorSpace == DocumentColorSpace.CMYK)

			{

				theGraphicStyles = theGraphicStyles[7];

				theGraphicStyles.applyTo(pageObject);

			}

			else

			{

				theGraphicStyles = theGraphicStyles[9];

				theGraphicStyles.applyTo(pageObject);

			}

		}

	}

}



