window.onbeforeunload = function(){
   // Post to script that will log the user out
   xmlhttp.open("POST","logmeout.php",true);
   xmlhttp.send();
}