NATURALMENTE tu hai caricato con un tag script (messo prima del codice che ahi postato) il file .JS che contiene le definizioni delle funzioni che usi, come xbGetWindowWidth() e xbGetPageScrollY(), VERO?

Dimmi che non è così e ti bacchetto sulle manine...