added onload event, repaired syntax errors