// Framer
// Nathaniel Vaughn KELSO
// 2007.July.8 
// at Hyattsville, MD
// Version 0.3
// TODO: Fix baseline offset issue (where the text frame moves up from where the point text was)

// Version 0.2
// (c) vd [vd(kot)online.com.ua]

if(documents.length > 0) {
	doc = activeDocument;
	mySelection = activeDocument.selection;
	if (mySelection instanceof Array) {

		for(i=0; i<mySelection.length; i++)
			if (mySelection[i].typename == "TextFrame" && mySelection[i].kind == TextType.POINTTEXT) {

				obj = mySelection[i];


//anchor x,y
//position x,y
//function isHiOrLeft(a,b){
//	if(a.position[1]-a.height > b.position[1]-b.height){
//		a.name = "hi";
//		return true;
//	} else if (a.position[1]-a.height == b.position[1]-b.height && a.position[0] < b.position[0]) {
//		a.name = "left";
//		return true;
//	}
//	return false;
//}
				// TODO: Fix baseline offset issue
				// (where the text frame moves up from where the point text was)
				rect = doc.pathItems.rectangle(obj.top,obj.left,obj.width,obj.height);
				copy1 = doc.textFrames.areaText(rect);
				copy1.selected = true;

				obj.textRange.duplicate(copy1);
				obj.remove();
			}
		
	}
}