// JavaScript Document

size = 0;
Speed = 0;
sHeight = 0;

function accordion(context){

var a = $(context+' a');
  for (i=0; i<a.length; i++) {

    if (a[i].id.indexOf("get_accordion") != -1) {
     
      a[i].onclick = function(){       
        show = $('#'+this.id.replace("get_", ""));
        if (show && show.className.indexOf("_on") == -1) {
          changeClass('#center',show);
          changeClass('#center',this);
          size = show.firstChild.offsetHeight;
          show.style.height = '0px';
          sHeight = 0;
          d = new Date().getTime();
          setTimeout(SlideHeight, 80);
        }
        return false;
      }
    }
  }
}

function SlideHeight() {
  rectifTime();
  fact = (size/5)+Speed;
  sHeight = (sHeight+fact> size)? size : sHeight+fact;
  SetStyle(show);
  if (sHeight < size) {setTimeout(SlideHeight,80)}
  else{show.style.height = '100%';}
}

function SetStyle(obj){
  obj.style.filter = 'alpha(opacity = '+(sHeight/size)*100+')';
  obj.style.opacity = sHeight/size;
  obj.style.height = sHeight+'px';
}

function rectifTime(){
  d2 = new Date().getTime();
  Speed = (d2-(d+=80))/5;
  if(Speed<0){Speed=0}
  return Speed;
}


