function css() {

	if($.browser.safari){
		$('head').append('<link type="text/css" media="screen" rel="stylesheet" href="css/ap-safari.css" />');
	}
		
	/* go on for IE in generall */
	if($.browser.msie){
		
		/* take care IE 6 only */
		if($.browser.version <= 6) {
			$('ul li:first-child').addClass('first-child');
			
				$('li').hover(function(){
					$(this).addClass('hover');
				}, function(){
					$(this).removeClass('hover');
				});
				
				$.getScript('/wp-content/themes/wzorowo/js/jq.supersleight.js');
			//	$('body').supersleight({shim: 'images/x.gif'});
			
			
				$('input').each(function(i){
					var c = $(this).attr('type');
					if($(this).attr('disabled'))
						c = $(this).attr('disabled');
						
					$(this).addClass(c);
				});		
		} // ie6
		
		$('.page-press .press-list li:nth-child(4n+1)').addClass('nth-child4n');

		$('ul li:last-child').addClass('last-child');
		
	} // ie
	
	
	
	Cufon.replace('#lang-mod strong a, #content:not(.c-contact) h3, .news .d a, .btn-download span, #footer', { fontFamily: 'Museo 300' });
	/*Cufon.replace('#nav li a, .qtrans_language_chooser li a, .page-contact h3 a', { fontFamily: 'Museo 500' }); */
	Cufon.replace('#nav li a, .qtrans_language_chooser li a', { fontFamily: 'Museo 500' });
	Cufon.replace('.page-about h4, #content .posts-list .post h3', { fontFamily: 'Museo 700' });
	
	
	
	/* navigation */
	$('#nav li').each(function(n){
		$(this).addClass('item-'+n);
		
		$(this).children('a').append('<span></span>');
		
		
		if($('.page').is('.page-about'))
			$('#nav li.item-2').addClass('current_page_item');
		
	});
	
	$('#lang-mod a, .qtrans_language_chooser a').append('<span></span>');
	
	$('.news .d a cufon, .btn-download span').append('<span></span>');


	$('.page:not(.page-press) h3').wrap('<div class="head"></div>');


	$('.posts-list ul').each(function(){
	
		c = $(this).children('li').length;
		
		if(c<13){
			i = 0;
			$(this).children('li').each(function(){
				r = Math.floor(Math.random()*4);
				
				if(r == 3 && i<3){
					$(this).addClass('i-rand');
					i++;
				}
			
			});
		}
		else if(c<14){
			i = 0;
			$(this).children('li').each(function(){
				r = Math.floor(Math.random()*4);
				
				if(r == 2 && i<2){
					$(this).addClass('i-rand');
					i++;
				}
			
			});
		}
		else if(c<15){
			i = 0;
			$(this).children('li').each(function(){
				r = Math.floor(Math.random()*4);
				
				if(r == 1 && i<1){
					$(this).addClass('i-rand');
					i++;
				}
			
			});
		}
		
	
	});

	
	win_height = $(window).height();
	page_height = $('#page').height();
	
	$('#page').css({
		'minHeight': win_height-110+'px'
	});
		 
	$('.pagination a').click(function(p){
		p.preventDefault();
		
		root = $(this).parents('.mod-subcat');
		

		path = '/';
		
		t = $(this).attr('href');
		t = t.slice(2);
		
		$.ajax({
			type: "GET",
			url: path+'projects/',
			data: 	t,
			success: function(html){
				root.html(html);
				$.getScript(path+'wp-content/themes/wzorowo/js/fx.js'); 
			}
		});		
		
	});
	
	$('.post .ngg-galleryoverview').ready(function(){
		
		$('.posts-list .item').each(function(s){			
			$(this).find('.ngg-gallery-thumbnail-box div').children('a').attr('rel','set_'+s);
				
		});
	
		$('.posts-list .thumb').not('.ignore-zoom').click(function(e){
			e.preventDefault();
			if($(this).is('.lot'))
				$(this).siblings('.post').addClass('act');
			else
				$(this).next('.post').addClass('act');
				
			$(this).next('.post').find('.ngg-gallery-thumbnail-box:eq(0) div').children('a').trigger('click');
		});		
		
	});

	
	$('#content .d a, #footer a').attr('target','_blank');

	$('a.fb').fancybox({
		'padding': 0,
		'imageScale': true,
		'zoomOpacity' : true,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500,
		'centerOnScroll': false
	});

	
}

$(document).ready(css);
