How to multiple post PHP form onload?

I have html and javascript code like this.

<form action="http://MYCACTI/cacti/logout.php" name="logout_cacti" method="post"></form> 
<form action="http://MYCACTI/cacti/" name="auth_cacti" method="post">
<input type="hidden" name="action" value="login">
<input type="hidden" name="realm" value="local">
<input type="hidden" name="login_username" value="guest">
<input type="hidden" name="login_password" value="guest">
</form> 

window.onload = PageLoad;
function PageLoad(){
    Logout();
    Login();
}
function Logout(){
    setTimeout(document.forms['logout_cacti'].submit(), 4000);
} 
function Login(){
    setTimeout(document.forms['auth_cacti'].submit(), 4000);
}

The question is, i want to make autologin cacti in iframe, and the problem is if the session in cacti is destroyed or if we already logout from cacti the script is working fine, it can go autologin to the site. But if we already login into cacti, there is an error display like this.

You are not permitted to access this section of Cacti. If you feel
that you need access to this particular section, please contact the
Cacti administrator.

I have implemented javascript window.onload but nothing successful, this is the output from firebug.

Firebug

Thank you.

Leave a comment