set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "v="
set idCode to text item 2 of pageURL
set AppleScript's text item delimiters to oldDelims
if idCode contains "&" then
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "&"
set idCode to text item 1 of idCode
set AppleScript's text item delimiters to oldDelims
end if