// change size of paragraph text



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



ChangeSize();



function ChangeSize()

{

	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")

		{

			// get the paragraphs from the selection.

			theTextRange = pageObject.textRange;

			paraTextRange = theTextRange.paragraphs;

			numParagraphs = paraTextRange.length;



			for (i = 0 ; i < numParagraphs ; i++)

			{

				aParagraph = paraTextRange[i];



				charTextRange = aParagraph.characters;

				charCount = charTextRange.length;



				if (charCount > 1)

				{

					halfWay = Math.round(charCount/2);

					fontSizeChanger = 36/halfWay;

					currentFontSize = 48;

					for (j = 0 ; j < halfWay-1; j++)

					{

						theChar = charTextRange[j];

						theChar.size = currentFontSize;	

						currentFontSize = currentFontSize - fontSizeChanger;

					}

					

					for (j = halfWay; j < charCount ; j++)

					{

						theChar = charTextRange[j];

						theChar.size = currentFontSize;

						currentFontSize = currentFontSize + fontSizeChanger;

					}

				}

			}

		}

	}

}