$(function(){  
    $('.hidden').hide();
    $('.unfold').next().next().show();
    
    $('#main_menu li').hover(function() {
      $(this).find('.submenu').fadeIn(200);
    }, function() {
      $(this).find('.submenu').fadeOut(200);
    });
    
    $("#side_menu li.top_node").hover(function() {
      $(this).find('a.toggle').fadeIn('fast');
    }, function() {
      $(this).find('a.toggle').fadeOut('fast');
    });
          	// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("a.jqbookmark").attr("rel") != ""){ // don't overwrite the rel attrib if already set
			$("a.jqbookmark").attr("rel","sidebar");
		}
	}

	$("a.jqbookmark").click(function(event){
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link
		var url = this.href;
		var title = this.title;

		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else if(window.opera) { // Opera 7+
			return false; // do nothing - the rel="sidebar" should do the trick
		} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}
	});
	function homepage(obj) {
  	if(navigator.userAgent.indexOf('MSIE') > -1) {
  		obj.style.behavior='url(#default#homepage)';
  		obj.setHomePage(document.location);
  	}
  	else if(window.opera && window.print) {
  		alert('Twoja przeglądarka nie pozwala na zmianę strony domowej. By zrobić to ręcznie, kliknij w menu przeglądarki "Narzędzia" > "Ustawienia" > "Użyj bieżącej"');
  	}
  	else {
  		alert('Twoja przeglądarka nie pozwala na zmianę strony domowej. By zrobić to ręcznie, przeciągnij link "Ustaw jako stronę domową" na przycisk "Strona domowa" w pasku nawigacji przeglądarki.');
  	}
  }
  
  $('.homepage_link').click(function() {
    homepage(this); return false;
  });
  $('.print_button').click(function() {
    window.print();
  });
});  

