How to onload?

Shipi

Dear Scriptmakers,

I have a PHP based page. I want to onload a javascript in a page but I do not know how can I do that. Let me explain:
My page has an index.php with a slidebar ofc. I always change the content part only. The page what should contain the script is the mainpage.php. I've saved the script in a separated file and I cannot onload it. Is that any way to do that?
This is my script: