function clearField(element, defaulVal)
{
	if(element.value == defaulVal) {
		element.value = '';
	}
}

function CheckIC()
{
	if($('infopanel')) { $('infopanel').remove(); };

	var ic = Form.Element.getValue('ic');

	var url = '/ajax/registrace.php?ic=' + ic + '';

	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(xmlhttp) {
			if(response = xmlhttp.responseText)
			{
				new Insertion.After('CheckIC', response);
			};
		}

	});
	
	return false;
}

function ChangeVideo(polozkaId)
{
	var url = '/ajax/video.php?polozkaId=' + polozkaId + '';

	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(xmlhttp) {
			$('hpVideo').innerHTML =xmlhttp.responseText;
		}
	});	
}

function showComment(commentId)
{
	$('commentPerex-' + commentId).hide();
	$('commentDetail-' + commentId).show();
}

function hideComment(commentId)
{
	$('commentDetail-' + commentId).hide();
	$('commentPerex-' + commentId).show();
}

function SaveMenu(value) // bod 681
{		
	var url = '/ajax/save-menu.php?menu=' + value + '';

	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(xmlhttp) {
		}

	});
	
	return false;
}

var bannerIndex = 0;

function ReloadBanner()
{
	var Items = $$('#content-banners div');

  var max = Items.length;
  var min = 1; 
  var randomNumber = 0;
  
  while(randomNumber == bannerIndex)
  {
    randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
  }      
    
	for(var i = 0; i < Items.length; i++)
	{						
    Items[i].hide();
  }     
  
  Items[randomNumber-1].show();  	
	
	setTimeout('ReloadBanner()', 7500);
}

Event.observe(window, 'load', function()
{ 
	if($('content-banners'))
	{
		setTimeout('ReloadBanner()', 4000);
	}
});
