/****************************************

Change tabs

****************************************/
function setvisible(which) {
	for (var i = 0; i < numberoftabs; i++) {
		$('tab_' + i).className = (i == which) ? 'selected' : '';
		$('content_' + i).className = (i == which) ? 'visible' : 'invisible';
	}
	activetab = which;
	if (navigator.appName == 'Microsoft Internet Explorer') {
		objektum.setAttribute('activetab', activetab);
		objektum.save('odatastore');
	}
}


/****************************************

Load tab data, activate tab

****************************************/
function loadtabs() {
	if (!numberoftabs)
		numberoftabs = 5;
	if (navigator.appName == 'Microsoft Internet Explorer') {
		objektum.load('odatastore');
		activetab = objektum.getAttribute('activetab');
	}
	if (activetab === undefined || activetab === null) {
		activetab = 0;
	}
	if (whichtab !== undefined) {
		activetab = whichtab;
	}
	setvisible(activetab);
}


//var activetab, numberoftabs, objektum;
var activetab = 0, numberoftabs, objektum;


function $(str) {
	return document.getElementById(str);
}


/****************************************

Initializing variables and events

****************************************/
var whichtab;

function inic() {
	var loc = window.location.href;
	var where = loc.indexOf('#') + 1;
	if (where != -1) {
		whichtab = loc.substr(where);
	}
	var numberoftabs = 5;
	$('tab_0').onclick = function() { setvisible(0); return false; };
	$('tab_1').onclick = function() { setvisible(1); return false; };
	$('tab_2').onclick = function() { setvisible(2); return false; };
	$('tab_3').onclick = function() { setvisible(3); return false; };
	$('tab_4').onclick = function() { setvisible(4); return false; };

	$('tab_0').hideFocus = true;
	$('tab_1').hideFocus = true;
	$('tab_2').hideFocus = true;
	$('tab_3').hideFocus = true;
	$('tab_4').hideFocus = true;
	

	objektum = document.getElementsByTagName('body')[0];
	objektum.style.behavior = 'url(#default#userdata);';

	loadtabs();
}