$(document).ready(function () {

	// hover nad menu

	$(".main li").hover(
		function()
		{
			$(this).addClass("sfhover");
			$('ul',this).shadow ({ zIndex: 200, offset:3});
			$('ul',this).shadowEnable ();
		},
		function()
		{
			$(this).removeClass("sfhover");
			$('ul',this).shadowDisable ();
		}
	);

	// rotujici novinky
	$('.cycle dd').cycle({ 
		fx:			'fade',
		pause:		1,
		speed:		500, 
		timeout:	10000,
		random:		1
	});
		
	$('.action-close').each (function(){
		var acid = $(this).attr('id');
		var uid = 'action' + Math.round(Math.random()*500);
		if (typeof(acid) == 'string' && acid == "") {
			$(this).attr('id', uid);
			acid = uid;
		}
		
		cookie = $.cookie('close' + $(this).attr('rel'));
		cookie = cookie == "closed" ? "closed" : "opened";
		
		if (cookie == "opened") {
			var date = new Date();
 			date.setTime(date.getTime() + (3 * 24 * 60 * 60 * 1000));
		
			$(this).before ('<div class="button-close" rel="'+acid+'" id="button'+acid+'"><span>x</span></div>');
			
			$('#button'+acid).click(function() {
				acid = $(this).attr('rel');
				str = $('#' + acid).attr('rel');
			
				$(this).hide ();
				$('#'+acid).fadeOut ();
				$.cookie('close' + str, 'closed', { path: '/', expires: date });
			});
		}
		else {
			$(this).hide ();
		}
	});

});

function AddFavorite(linkObj,addUrl,addTitle)
{
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
  return false;
}
