function showBlock(whichblock) {
  var blocks=["intro","service","ourwine", "marketing"];
  var source = whichblock.getAttribute("href");
  source = source.replace("#", "");
  for (x in blocks)
  {
    var currentBlock = document.getElementById(blocks[x]);
    if (blocks[x] == source) {
	  currentBlock.style.display = "block";
	} else {
	  currentBlock.style.display = "none";
	}
  }
  return false;
}

function prepareBlocks() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("icons")) return false;
  var hcwhicons = document.getElementById("icons");
  var links = hcwhicons.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showBlock(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(prepareBlocks);
