function initTab(tab)
{
	document.getElementById(tab).style.display = 'block';
    if( document.getElementById(tab+'_ful') )
	{
		document.getElementById(tab+'_ful').className = 'active';
	}

}

function showTab(tab)
{
    hideall();
    document.getElementById(tab).style.display = 'block';
	//document.getElementById(tab).style.visibility = 'visible';
	document.getElementById(tab+'_ful').className = 'active';

    $.ajax({
		type: "GET",
		url: '_setcurrenttab.php',
		data: 'tab='+tab
	});
}

function hideTab(tab)
{
    document.getElementById(tab).style.display = 'none';
	if( document.getElementById(tab+'_ful') )
	{
		document.getElementById(tab+'_ful').className = '';
	}
}

function hideall()
{
	hideTab('tab1');
	hideTab('tab2');
	hideTab('tab3');
	hideTab('tab4');
	hideTab('tab5');
	hideTab('tab6');
	hideTab('tab7');
}

function reloadCaptcha(id)
{
	document.getElementById('captcha_'+id).src = 'include/captcha.php?id='+id+'&'+Math.random();
}

function show_idoszak()
{
	document.getElementById('idoszak').style.display = 'block';
}

$(function()
{
	$('.date-pick').datePicker({startDate:'2000-01-01'});
	$('#idoszak_tol').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#idoszak_ig').dpSetStartDate(d.addDays(1).asString());
			}
		}
	);
	$('#idoszak_ig').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#idoszak_tol').dpSetEndDate(d.addDays(-1).asString());
			}
		}
	);
});