function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function Button(id)
{
    this.id = id
    this.Moving = false
    this.steps = 40
    this.step = 0

    this.Open = function()
    {
        this.Direction = 1
        if (this.Moving) return
        this.Moving = true
        this.Loop()
    }

    this.Close = function()
    {
        this.Direction = -1
        if (this.Moving) return
        this.Loop()
    }

    this.Loop = function()
    {
        this.step += this.Direction
        if (this.step > this.steps) this.step = this.steps
        if (this.step < 0) this.step = 0
        this.SetDiv(this.step/this.steps, this.Direction)
        if (this.step > 0 && this.step < this.steps)
        {
            setTimeout(this.id + ".Loop()", 10)
        }
        else
        {
            this.Moving = false
        } 
    }

    this.SetDiv = function(factor, direction)
    {
        factor = (.5 - Math.cos(factor * Math.PI) * .5);
        var hoogte = 47 + factor * 115;
				if(direction == 1) { var margin = 20;}
				if(direction == -1) { var margin = 20;}
       // document.getElementById(id+'Content').style.height = hoogte + 'px';
        document.getElementById(id+'Button').style.height =  hoogte  + 'px';
				document.getElementById(id+'Button').style.marginBottom =  margin  + 'px';
    }
}

mak = new Button('mak');
hyp = new Button('hyp');
pen = new Button('pen');
ver = new Button('ver');