function nazwaSekcji() {
	if ($('h2#sectionName').text() == '') {
		var activemenu = $('#mainmenu > ul > li.active > a').text();
		if (activemenu != '') {
			$('#sectionName h2').text(activemenu);
		} else {
			if ($('body').hasClass('Szukaj')) {
				$('#sectionName h2').text('Szukaj');
			} else {
				$('#sectionName h2').text('Karty bez tajemnic');
			}
		}
	}
}

$(document).ready(function() {
						   
	$('.Szukaj #sectionName h2').text('Szukaj');
	
	$('#introScroll').jCarouselLite({
		btnNext: '.next',
		btnPrev: '.prev',
		visible: 1,
		btnGo: ['.g1', '.g2', '.g3', '.g4', '.g5'],
		easing: 'easein',
		auto: 5000,
		speed: 400
	});



//	$('#czywieszZe').jCarouselLite({
//		btnNext: '.next',
//		btnPrev: '.prev',
//		visible: 1,
//		btnGo: ['.cw1', '.cw2', '.cw3', '.cw4', '.cw5'],
//		easing: 'easein',
//		vertical: 'vertical',
//		auto: 5000,
//		speed: 400
//	});

	//nazwa sekcji

	$('form.search input.text').focus(function() {
		if ($(this).val() == 'Szukana fraza...') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('Szukana fraza...');							  
	});
	
	$('#mainmenu > ul > li').each(function() {
		$(this).find('ul > li > a:first').addClass('top2');
		$(this).find('ul > li > a:last').addClass('bottom2');
	});
	
	$('#leftSidebar .menu a:visible').filter(':last').addClass('last');
	
	$('.parts').each(function() {
		$(this).find('div.part:not(:first)').hide();
	});

	$('.tabs a').click(function() {
		var tabs = $(this).parent().parent();
		var parts = $(tabs).prev();
		var nr = $(this).text();
		var q = tabs.attr('id');
		$(parts).find('div:visible').hide();
		$(parts).find('#'+q+nr).fadeIn('normal');
		$(tabs).find('li').removeClass('active');
		$(this).parent().addClass('active');
		return false;
	});
	
	
	
	$('.Szukaj div.boxSzukaj').hide();
	
	if ($('#srescheck').hasClass('on')) {
		$('#searchForm h3').hide();
		$('#searchForm input.text').focus();
	}

	$('.czyWieszZePage').each(function() {
		var pname = document.location.hash;
		var pid = $('a'+pname).parent().attr('id').substr(2);
		highlight(pid);
	});
	
	$('.faq .qa div').append('<p class="top"><a href="#faqQuestions">do góry</a></p>');
	$('.faq .qa div').removeClass('active');
	$('#faqQuestions a').click(function() {
		$('.faq .qa div').removeClass('active');
		$('.faq .qa div#q'+$(this).attr('href').substr(2)).addClass('active');
	});

});

//sIFR
var mp = { src: '/inc/sifr/myriadproreg.swf' };
sIFR.useStyleCheck = true;
sIFR.activate();
//sIFR.replace(mp, {
//	selector: '.box h3'
//	,css: [
//      '.sIFR-root { font-weight: bold; }'
//      ,'a { text-decoration: none; }'
//      ,'a:link { color: #253993; }'
//      ,'a:hover { color: #000000; }'
//    ]
//	,wmode: 'transparent'
//});
sIFR.replace(mp, {
	selector: '#sectionName h2'
	,css: [
      '.sIFR-root { font-weight: bold; color: #6C6C6C; }'
    ]
	,wmode: 'transparent'
});
sIFR.replace(mp, {
	selector: '#content h1'
	,css: [
      '.sIFR-root { font-weight: bold; color: #253993; }'
    ]
	,wmode: 'transparent'
});
sIFR.replace(mp, {
	selector: '.artLead p'
	,css: [
      '.sIFR-root { color: #6C6C6C; }'
    ]
	,wmode: 'transparent'
});


function highlight(id) {
	
var totalLinks = document.getElementById('czyWieszZe').getElementsByTagName('li');

for (i=0; i<totalLinks.length; i++) {

document.getElementById('cw' + i).className = '';
}

document.getElementById('cw' + id).className = 'cwActive';

}

