function tabControl() {
	$$('div.tabArea').each( function(tabArea) {
		tabArea.style.display = tabArea.getAttribute('id') == 'BLOCK1' ? 'block' : 'none';
	} );

	$$('div.tabArea table td.tab a').each( function(tabLink) {
		tabLink.onclick = function() {
			var href =  this.getAttribute('href');
			var len = href.length;
			var num = href.charAt(len - 1);
			
			var count = 1;
			while(count < 30) {
				if ($('BLOCK' + count)) {
					if (count == num) {
						$('BLOCK' + count).style.display = 'block';
					} else {
						$('BLOCK' + count).style.display = 'none';
					}
				}
				count++;
			}
			return false;
		}
	});
}

Event.observe(window, "load", tabControl, false);

