i have been attempting to use this to do what you are asking, it appears to work, only i am getting the url reset to the function whenever i login to my site. will explain in more detail after code.

JavaScript:
Code:
function killSession() {
	location = 'mypage.php?destroySession=true';
}
PHP:
Code:
if (isset($_GET['destroySession']) && $_GET['destroySession'] == "true")
...