var SlideMenu = Class.create();

SlideMenu.prototype={
    initialize:function(item, x) {
    this.item = item;
    this.x = x;
    this.currently_displaying = "false";
},
moveItem: function(){
    if(this.currently_displaying == "false"){
       this.x = "-" + this.x;
       this.currently_displaying = "true";
    }
    else {
        this.x = 350;
        this.currently_displaying = "false";
    }
new Effect.MoveBy(
  this.item,
  0,
  this.x,
  {
    duration: 0.35,
    from: 0,
    to: 1,
    afterFinish: function() {
        var re = /([\w\/\.\\:]*\/)([\w\.]*)/;
        var imgSrc = $('toc').src;
        var myArray = re.exec(imgSrc);
        if (myArray[2] == "toc_open.png") {
            $('toc').src = "images/toc.png";
        }
        else {
            $('toc').src = "images/toc_open.png";
        }
    }
  }
);
},
closeMenu: function(url){
    if(this.currently_displaying == "true"){
        this.x = 350;
        this.currently_displaying = "false";
}
new Effect.MoveBy(
  this.item,
  0,
  this.x,
  {
    duration: 0.35,
    from: 0,
    to: 1,
    afterFinish: function() {
        var re = /([\w\/\.\\:]*\/)([\w\.]*)/;
        var imgSrc = $('toc').src;
        var myArray = re.exec(imgSrc);
        if (myArray[2] == "toc_open.png") {
            $('toc').src = "images/toc.png";
        }
        else {
            $('toc').src = "images/toc_open.png";
        }
        window.location = url;
    }
   }
   );
}
}



var slider = new SlideMenu('outerMenu', "350");