var foo = null; // object
var speed = 600;
var x=0;

function initFoo() {
  if (document.URL.search('index') >= 0 || (document.URL.search('html') < 0 && document.URL.search('php') < 0)){
     foo = document.getElementById('promog'); // get the "foo" object
  }
  else{
     foo = document.getElementById('promo'); // get the "foo" object
  }
  foo.style.visibility = 'visible';
  showHide(); // start animating
}

function showHide() {
  if (foo.style.visibility == 'hidden') {
     foo.style.visibility = 'visible';
     setTimeout(showHide, speed);
  }
  else {
     x++;
     if (x%4!=0){
        foo.style.visibility = 'hidden';
        setTimeout(showHide, speed / 3);
     }
     else{
        x = 0;
        setTimeout(showHide, speed * 3);
     }
  }
}