$(document).ready( function() {
	/* ikony menu */
	$('#menu .ico').each( function(){
		i = $(this).index('#menu .ico')+1;
		$(this).css({'background':'url(imag/m'+i+'.png) no-repeat center bottom','width':$(this).closest('li').width()+'px','cursor':'pointer'});
		if( !$(this).closest('li').hasClass('act') ) {
			$(this).closest('a').hover( function() {
				i = $(this).find('.ico').index('#menu .ico')+1;
				$(this).find('.ico').css('background','url(imag/m'+i+'.png) no-repeat center top');
			}, function(){
				i = $(this).find('.ico').index('#menu .ico')+1;
				$(this).find('.ico').css('background','url(imag/m'+i+'.png) no-repeat center bottom');
			} );
		} else {
			i = $(this).closest('a').find('.ico').index('#menu .ico')+1;
			$(this).closest('a').find('.ico').css('background','url(imag/m'+i+'.png) no-repeat center top');
		}
	} );
	/* ie6 - menu fix */
	if( $.browser.msie && parseInt($.browser.version)<7 )
	{
		$('#menu li').each( function() {
			$(this).css( {'width':$(this).find('.nam').outerWidth()+'px', 'overflow':'hidden'} );
			$('.ico',this).css( {'width':$(this).find('.nam').outerWidth()+'px', 'overflow':'hidden'} );
		} );
	}
	/* czcionki */
	Cufon.replace('#menu2',{'hover':true});
	/* rotacja banerow */
	$(window).load( function(){
		$('#rotator').cycle({
			timeout: 5000,
			fx: 'fade'
		});
	} );
	/* usuwanie bekartow */
	$('#cont2').html( $('#cont2').html().replace(/ ([\S]{1}) /g,' $1&nbsp;') );
	/* specyfikacja */
	$('#stB').hover( function(){
		$('#stT').stop(true,true).slideDown(250);
	}, function() {
		$('#stT').slideUp(250);
	} );
	/* dzielenie wersow w specyfikacji technicznej */
	$('#stT li').each( function(){
		if( $(this).height()==32 && $(this).html().indexOf('<br')==-1 ) $(this).html( $(this).html().replace(/([:]){1}/,':<br />') );
	} );
	$('#stT').css('display','none');
	/* lightobx */
	$('#zdjecia a,#galeria a,.newsi a').lightBox();
	/* srodkowanie zdjecia w newsie */
	$('.newsi').each( function(){
		if( !$(this).hasClass('newsii') ) {
			$(this).css('line-height',$(this).closest('.news').children('.newsc').height()+'px');
		}
	} );
} );
