var activ; var activ1; var activ2;
var check_activ = 1;
var check_activ1 = 1;
var d = 0;
var z = 0;
var check = true;
var current_item = '';

function slow_zoom(nav_div){
  if (nav_div != current_item){
    if (current_item != ''){
      var cur_div = window.document.getElementById(current_item);
      var property = getTransformProperty(cur_div);
      cur_div.style[property] = 'scale(1, 1)';
      cur_div.style.zIndex = '0';
      cur_div.style.border = 'none';
      check_activ1 = 1;
      z = 0;
    }
    current_item = nav_div;
  }
  clearInterval(activ1);
  clearInterval(activ2);
  var div = window.document.getElementById(nav_div);
  var property = getTransformProperty(div);
  div.style.zIndex = '100';
  div.style.border = '#aaaaaa solid 1px';
  if (check_activ1 == 1){
    check_activ1 = 0;
    if (property) {
        activ1 = setInterval(
          function () {
            if (z < 25){
              div.style[property] = 'scale(1.' + z*0.2 + ', 1.'+ z*0.2 +')';
              z++;
            }
          },
        5
        );
    }
  }else{
    check_activ1 = 1;
    if (property) {
      activ2 = setInterval(
        function () {
          if (z >= 0){
            div.style[property] = 'scale(1.' + z*0.2 + ', 1.'+ z*0.2 +')';
            z--;
          }
        },
      15
      );
    }
    div.style.border = 'none';
  }
}

function getTransformProperty(element) {
    var properties = [
        'transform',
        'WebkitTransform',
        'msTransform',
        'MozTransform',
        'OTransform'
    ];
    var p;
    while (p = properties.shift()) {
        if (typeof element.style[p] != 'undefined') {
            return p;
        }
    }
    return false;
}

