Move all preview.pt js into separate file
Move js into separate file