function css() {
	$('.link-print').bind('click',function(){ window.print(); });
	$('.link-back').bind('click',function(){ history.back(); return false; });
	$('input[type=text],input[type=search],input[name=nl_email]').clear();
	
	if($(window).datepicker){
		$('#datepicker').datepicker({'display_inline':true});
		$('#d').datepicker();
	}
	
	$('#tabs-mod').tabs();
	
	//tutaj taki "myk", aby GoogleMaps zaczytało poprawnie mapy
	//po zaladowaniu map wylacza on widok wszystkich zakladek oprocz pierwszej
	$('#content-tabs .tab').css("display", "block");
	
	$('#content-tabs').tabs();
	
	if( $(window).fancybox )
	{
		$('.mod-gallery a').not('.movie').not('.link-more').fancybox();
		$('.mod-gallery a.movie').fancybox({
			'scrolling': 'no',
			'titleShow': false,
			'hideOnContentClick': false,
			'showNavArrows': true
		});
	}
		
	/*
	 * CUFON
	 *
	 * @ Swis721MdEU
	 * @ Swis721HvEU
	 *
	*/
	Cufon.replace('#content .mod h2, #content .mod h2+strong, .mod h4', {
		fontFamily: 'Swis721MdEU',
		hoverable: {
			a	: true,
			span: true
		},
		hover: true
		
	});
	
	$('.news-list img, .top-event .img img').each(function(){
		_self = this;
		$(this).css({
			'padding-top': _self.height+'px',
			'height': '0',
			'overflow': 'hidden',
			'background': 'url('+ _self.src+')'
		});
	});
	
	$('.mod-gallery img').each(function(){
		_self = this;
		$(this).css({
			'padding-top': _self.height+'px',
			'height': '0',
			'overflow': 'hidden'
		}).parent('a').css({
			'background': 'url('+ _self.src+')'
		});
	});
}


function ie() {
	/* go on for IE in generall */
	if($.browser.msie){
		
		
		$('.mod-gallery li:nth-child(5n+1)').addClass('nth-child5n');
		if($.browser.version <= 7) {
			/* take care IE 7 & lower */
			
			$('input').ieClass('type');
			$('#lang-mod li').cssAfter('|');
			$('.mod-gallery a.movie').cssAfter(' ');
			$('.link-more, footer li a').cssAfter('»');
			$('#breadcrumbs li').cssBefore('\\');
			
			$('td:empty').append('&nbsp;');
			
			$('#news-mod .col+.col').addClass('sibling');
			$('#news-mod .col+.col+.col').addClass('sibling2');
			$('.mod-gallery li:nth-child(5n+1)').before('<li class="empty"></li>');
			
		}
		
		$('div:last-child, li:last-child, td:last-child').addClass('last-child');
		$('tr:odd').addClass('odd');
		$('tr:even').addClass('even');
		
	
		function beforePrint(){
			$('nav, footer ul, aside').wrap('<div class="hide"></div>');
			$('header').wrap('<div class="header"></div>');
			$('aside').wrap('<div class="aside"></div>');
			$('article').wrap('<div class="article"></div>');
			$('footer').wrap('<div class="footer"></div>');
			
		}
		function afterPrint(){
			$('nav, footer ul, aside').unwrap();
			$('header, aside, article, footer, .mod-frm').unwrap();
		}
		
		window.attachEvent('onbeforeprint', beforePrint);
		window.attachEvent('onafterprint', afterPrint);
		
	}
	
}

	/* 
	 * Load HTML5 IE set 
	 * before DOM is ready
	 */
if($.browser.msie){
	var html5Set = "abbr,article,aside,nav,canvas,footer,header,section,time".split(','),i=html5Set.length;
	while (i--){
		document.createElement(html5Set[i])
	}
}

	/* 
	 * Load jQuery sets
	 */
$(document).ready(css);
$(document).ready(ie);


	/* 
	 * jQuery extras
	 */
$.fn.extend({
	ieClass: function(ieAttr) {
		return this.each(function(){
			$(this).addClass($(this).attr(ieAttr));
		});
	}, // ieClass	
	unwrap: function() {
		this.parent(':not(body)').each(function(){
			$(this).replaceWith( this.childNodes );
		});
		return this;
	}, // unwrap
	cssBefore: function(html) {
		this.prepend('<span class="before">'+html+'</span>')
		return this;
	}, // cssBefore
	cssAfter: function(html) {
		this.append('<span class="after">'+html+'</span>')
		return this;
	}, // cssAfter
	clear: function(){
		return this.each(function(i){
			var val;
			
			$(this).focus(function(){ 
				val = $(this).val(); 
				$(this).attr('rel',val)
				$(this).val(''); 
			}); // focus
			
			$(this).blur(function(){ 
				val = $(this).attr('rel');
				if($(this).val() == ''){
					$(this).removeAttr('rel');
					$(this).val(val); 
				}
			});	// blur
		}); // each		
	}, // clear
	tabs: function(){
		return this.each(function(i){
			var t = {
				root : $(this),
				nav : $(this).find('.tab-nav'),
				item : $(this).find('.tab-nav').find('li'),
				tab : $(this).find('.tab')
			}
			
			
			t.item.each(function(i){
				t.loop = true;
				if($(this).is('.act')){	
					t.tab.eq(i).show();
					t.loop = false;
				}
				if(t.loop && t.item.size() == (i+1)){
					t.item.eq(0).addClass('act');
					t.tab.eq(0).show();
				}
				return t.loop;
			});
			
			t.item.find('a').unbind().bind('click',function(a){
				a.preventDefault();
				t.id = $(this).attr('href').split('#')[1];

				$(this).parent().addClass('act').siblings().removeClass('act');
				
				if(t.id){					
					t.tab.hide();
					$('#'+t.id).show();
				}
				else
					t.tab.show();
					
				if($.browser.msie){
					$('.tab-nav a').css({
						'position': 'relative',
						'behavior': 'url(./css/PIE.htc)'
					});
				}
			});
			
		}); // each	
	} // tabs()
});
