function onPageLoad(functionName) {
  //check IE's proprietary DOM members.  If both are undefined, it's firefox (or at least, not IE)...
	if(document.uniqueID==document.expando) {
		// handle multiple functions
		fns = functionName.split(';');
		for (x=0;x<fns.length;x++) {
			if (fns[x].length>3) {
				document.addEventListener("DOMContentLoaded", eval(fns[x].replace('()','')), false);
			}
		}
		return;
	}
  //you can create any tagName, even customTag like <document:ready />
  var tempNode = document.createElement('document:ready');
  (function(){
      try {

        //wait until document.readyState === 'complete';
        if(document.readyState != 'complete') return setTimeout(arguments.callee, 0);

        //see if it throws errors until after ondocumentready
        tempNode.doScroll('left');

        //call your function which catch window.onDocumentReady
        eval(functionName);

        //relaese some memory, if possible
        tempNode = null;

      }catch (err){
        setTimeout(arguments.callee, 100);
      }
  })();
};
onPageLoad('hideBlocks();initLightbox();');
//onPageLoad('initLightbox');

var lastBlockId='';

function showBlock(id) {
	if (lastBlockId!='') {
		document.getElementById(lastBlockId).style.display='none';
		document.getElementById('a-'+lastBlockId).className='';
	}
	document.getElementById(id).style.display='block';
	document.getElementById('a-'+id).className='active';
	lastBlockId=id;
	return false;
}

function hideBlocks() {
//	alert('test');
	divs = document.getElementsByClassName('showBlock');
	if (divs.length<1) { return; }
	lastBlockId = divs[0].id;
	document.getElementById('a-'+lastBlockId).className='active';
	if (divs.length>1) {
		for (x=1;x<divs.length;x++) {
			divs[x].style.display="none";
		}
	}
}

