Make single page PDF's out of Indesign CS3.

I’m trying to get an applescript to make single page PDF’s out of Indesign CS3.
The script works fine, but as soon as you section the pages (add page numbers, 255,256,257…etc),
the script no longer works as it is supposed to.
If I put the page numbers back to (1,2,3,4…etc.) it works again.
This one has me totally baffled.
I think I need to add a sectioning line to the script, but know how I would do this.

Any help would be great.
Thank You in advance.

tell application "Adobe InDesign CS3"
tell (active document) to set {file_name, doc_pages, page_numbers} to {name, pages, name of pages}
set pdf_style to name of PDF export presets
set export_style to (choose from list pdf_style with prompt "Select PDF Export Preset") as string
if export_style is "false" then return
set folder_path to (choose folder with prompt "Select folder to Save PDF files") as string

set oldPref to page numbering of general preferences
set page numbering of general preferences to absolute

set pagesToPrint to (choose from list page_numbers with prompt "Choose Pages to PDF" with multiple selections allowed)
if pagesToPrint is false then return

repeat with anItem in pagesToPrint
if length of anItem is 4 then
set new_number to contents of anItem
set new_number to text -3 thru -1 of ("00" & anItem)
end if
set PDF_name to folder_path & file_name & "_" & new_number & ".pdf"
set page range of PDF export preferences to (anItem as string)
tell active document to export format PDF type to PDF_name using export_style without showing options
end repeat
set page numbering of general preferences to oldPref
display dialog "Your PDFs are Done" buttons {"Done"} default button 1
end tell