String.prototype.rememberScrollPosition = function (){
  var objElement = document.getElementById(this);
  var intTop = (objElement.id + "-y").getCookie();
  if(intTop)objElement.scrollTop = intTop;
  var intLeft = (objElement.id + "-x").getCookie();
  if(intLeft)objElement.scrollLeft = intLeft;
  objElement.onscroll = function(){
    document.cookie = this.id + "-x=" + objElement.scrollLeft;
    document.cookie = this.id + "-y=" + objElement.scrollTop;
    alert("scrolling");
  }
} 

String.prototype.getCookie = function(){
  if (document.cookie.length > 0){
    var intBegin = document.cookie.indexOf(this+"="); 
    if(intBegin != -1){ 
      intBegin += this.length + 1; 
      var intEnd = document.cookie.indexOf(";", intBegin);
      if(intEnd == -1) intEnd = document.cookie.length;
      return unescape(document.cookie.substring(intBegin, intEnd));
    }
  }
  return null;
} 
