function get_home_url(){
	return $("base").attr("href");
}

function get_url_to_ajax(){
	return get_home_url()+"ajax/";
}

function jezyk(id)
{
	document.cookie = "LANGUAGE="+id;
	location.reload(true);
}

function switch_month(date)
{
	var data = date.split('-');
	$.post(get_url_to_ajax()+ "kalendarz.html",
	{ 
		year: data[0],
		month: data[1],
		day: data[2]
	},
	  function(ajax_data){
		$("#txtLeft").html(ajax_data);
		
		setTimeout(function() {
			loadingTooltips();
		},300);
	  });	
}

function loadingTooltips(){
	
	  $('.calendar .week .tooltip').each(function(){
		  $obj = $(this).prev();
		  var position = $obj.offset();
		  if( $(this).width()>400 ){
			  $(this).css('width', 400);
			  position = $obj.offset();
		  }
		  
		  var height = $(this).height();
		  $(this).css('left', position.left+36);
		  $(this).css('top', position.top-height-16);
	  });
	  
	  $(".calendar .week .name a").mouseover(
			  function(){
				  $(this).parent().next('.calendar .week .tooltip').fadeIn('fast');
			  }
	  );
	  $(".calendar .week .name a").mouseout(
			  function(){
				  $(this).parent().next('.calendar .week .tooltip').fadeOut('fast');
			  }
	  );
}

$(document).ready(function() {
for (i=0; i<document.links.length;) {
		document.links[i].onfocus=document.links[i++].blur;
	}

	if($(".content").height()<430){
		$(".content").css("height","430px");
	}
	
	  $(".part_logo").hover(
	    function() {
	    
	      szer = $(this).attr("alt");
	      new_szer = parseInt(szer)+4;
	      $(this).animate( { width:new_szer }, 200 );
	   
	    
	    },
	    function() {
	    
	      szer = $(this).attr("alt");
	      new_szer = parseInt(szer);
	      $(this).animate( { width:new_szer }, 200 );
	    
	    }
	  );
	  
	  loadingTooltips();
});
