
$(document).ready(function() {
    $('#logo a').livequery(function(){
	$(this).click(function(event){
	    event.preventDefault();
	    var toLoad = "/glowna #content";
	    var glowna = $(this).attr('href')+' #link_glowna';
	    $('#content').hide('fast');
	    window.location.hash = $(this).attr('href');
//.substr(0,$(this).attr('href').length);
	    $('#content').load(toLoad,'');
	    $('#link_glowna').load(glowna,'');
	    $('#content').show('fast');
	});
      });
      $('#nav a').livequery(function(){
	$(this).click(function(event){
	  event.preventDefault();
 	  var toLoad = $(this).attr('href')+' #content';
	  var logo = $(this).attr('href')+' #logo';
	  var nawigacja = $(this).attr('href')+' #nawigacja';
	  var prawo = $(this).attr('href')+' #tresc_prawo';
	  var lewo = $(this).attr('href')+' #tresc_lewo';
	  $('#logo').hide();
	  $('#nawigacja').hide();
	  $('#tresc_lewo').hide();
	  $('#content').hide();
	  $('#tresc_prawo').hide();

	  $('#logo').load(logo,'');
	  $('#nawigacja').load(nawigacja,'');
	  $('#tresc_lewo').load(lewo,'');
	  $('#content').load(toLoad,'');
	  $('#tresc_prawo').load(prawo,'');

	  $('#logo').show();
	  $('#nawigacja').show();
	  $('#tresc_lewo').show();
	  $('#content').show();
	  $('#tresc_prawo').show();
	  });
    });
    $('a[@rel*=podpis]').livequery(function(){
      $(this).click(function(event){
	    event.preventDefault();
	    var toLoad = $(this).attr('href')+' #content';
	    var prawo = $(this).attr('href')+' #tresc_prawo';
	    var lewo = $(this).attr('href')+' #tresc_lewo';
	    $('#tresc_lewo').hide();
	    $('#content').hide();
	    $('#tresc_prawo').hide();

	    $('#tresc_lewo').load(lewo,'');
	    $('#content').load(toLoad,'');
	    $('#tresc_prawo').load(prawo,'');

	    $('#tresc_lewo').show();
	    $('#content').show();
	    $('#tresc_prawo').show();

	    //window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);
	});
    });

    $('#galeria_pop a').livequery(function(){
	$(this).click(function(event){
	    event.preventDefault();
	    var toLoad = $(this).attr('href')+' #content';
	    var prawo = $(this).attr('href')+' #tresc_prawo';
	    var lewo = $(this).attr('href')+' #tresc_lewo';
	    $('#tresc_lewo').hide();
	    $('#content').hide();
	    $('#tresc_prawo').hide();

	    $('#tresc_lewo').load(lewo,'');
	    $('#content').load(toLoad,'');
	    $('#tresc_prawo').load(prawo,'');

	    $('#tresc_lewo').show();
	    $('#content').show();
	    $('#tresc_prawo').show();
	  });
      });

    $('#galeria_nast a').livequery(function(){
	$(this).click(function(event){
	    event.preventDefault();
	    var toLoad = $(this).attr('href')+' #content';
	    var prawo = $(this).attr('href')+' #tresc_prawo';
	    var lewo = $(this).attr('href')+' #tresc_lewo';
	    window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);
	    $('#tresc_lewo').hide();
	    $('#content').hide();
	    $('#tresc_prawo').hide();

	    $('#tresc_lewo').load(lewo,'');
	    $('#content').load(toLoad,'');
	    $('#tresc_prawo').load(prawo,'');

	    $('#tresc_lewo').show();
	    $('#content').show();
	    $('#tresc_prawo').show();
	});
    });

    $("a[href*=.flv]").livequery(function(){
      var player = $f("player", "/site_media/flowplayer-3.1.5.swf");
      player.load();
      });

    $("a[@rel*=lightbox]").livequery(function(){
      $("a[@rel*=lightbox]").lightBox(); });
    });


