apple script Q & A

i am working on a program to run my chacha account when im away, im trying to write it so i can open the application, tell it how long i want it to run for and have it log me in and set my status to available and start answering the questions and then log me out tell me its done when the time is up. (for those of you who r not familiar with chacha there Q & A’ing, the section consists of 2 buttons one to select the answer and one to send the answer) i have goten as far as the scrypt you see below but i am not shure how i am supost to write where it slects and or clicks the buttons for me and then logs out when the time is up. is there anybody that could explain to me how this can be done?


set myresult to (display dialog "How long would you like to run?" with title "ChaCha Automator " default answer "" buttons {"Start", "Cancel"} default button 1)
set theMinutes to (text returned of myresult) * 60
set button_pressed to button returned of myresult
if the button_pressed is "Start" then
   delay 1
   tell application "Firefox"
       activate
       open location "https://universe.chacha.com"
       tell application "System Events"
           delay 4
           keystroke tab
           keystroke "Guitarfreak"
           keystroke tab
           keystroke "xxxxxxxxxxxxxxxxxx"
           keystroke tab
           keystroke "xxxxx"
           delay 1
           keystroke return
           delay theMinutes
           display dialog "" buttons {"log Out"} with title "ChaCha Automator " default button 1
       end tell
   end tell
end if