   var old_location = "";

   if((pos = location.href.indexOf("#")) != -1) {
      if(have_ajax_support)
         a_href(location.href.substr(pos+1,location.href.length-pos),"my_content",0);
      else {
         location.href = "/?page=" + location.href.substr(pos+1,location.href.length-pos);
      }
   }

   function check_ajax() {
      if(!have_ajax_support) return;

      new Ajax.Updater("ajax_check","ajax.php?ajax=1", {
         method: 'get'
      });
   }

   function a_href(menu_id,element,do_return) {
      if(!have_ajax_support) return;

      var new_location = location.href;
      var pos = new_location.indexOf("#");

      if(pos != -1) {
         new_location = new_location.substr(0,pos);
      }

      old_location = menu_id;
      location.href = new_location + "#" + menu_id;

      new Ajax.Updater(element,"ajax.php?page=" + menu_id, {
         method: 'get'
      });

      if(do_return)
         return(false);
   }

   function checkLocation() {
      window.setTimeout("checkLocation()", 500);
      var new_location = location.href;
      var pos = new_location.indexOf("#");
      if(pos != -1) {
         new_location = new_location.substr(pos+1,location.href.length-pos);
      }
      if(old_location != "" && old_location != new_location) {
         a_href(new_location,"my_content",0);
      }
      old_location = new_location;
   }

   if(have_ajax_support)
      checkLocation();

