
jQuery(document).ready(function() {




function zaokraglijImg(img) {
	jQuery(img).wrap('<span class="imgCorner"></span>');
	jQuery(img).before('<span class="corner1"></span><span class="corner2"></span><span class="corner3"></span><span class="corner4"></span>');
	jQuery(img).parent().css('width', jQuery(img).width());
	jQuery(img).parent().css('height', jQuery(img).height());
}

	jQuery('a.phoca').each(function() {
		if (jQuery(this).find('img').attr('alt') != '') {
			jQuery(this).attr('title', jQuery(this).find('img').attr('alt'));
			jQuery(this).find('img').attr('alt', '');
		}
	});

	jQuery('.imgGallery a[rel^="prettyPhoto"]').css({position: 'relative', display: 'block'}).find('img').before('<span class="magnify"></span>');
	
	$('.tabsWrapper .parts #accMapa').css({position: 'static', display: 'none'});
	jQuery('.tabs li:first').addClass('active');
	//jQuery('.parts').children('div:not(:first)').fadeOut('fast');
	jQuery('.tabs a').click(function() {
		var tabs = jQuery(this).parent().parent();
		var parts = jQuery(tabs).next();
		if (jQuery(parts).attr('class') == 'partsOut') parts = jQuery(parts).find('div.parts');
		jQuery(tabs).children('.active').removeClass('active');
		jQuery(parts).find('.part').hide();
		var newActPart = jQuery(this).attr('href');
		jQuery(parts).find(newActPart).fadeIn('fast');
		jQuery(this).parent().addClass('active');
		return false;
	});
	if ($('a[href=#accOferty]').size() > 0 && (document.location.href.indexOf('tabs') != -1)) {
		$('a[href=#accOferty]').parent().parent().find('li:first').removeClass('active');
		$('a[href=#accOferty]').parent().addClass('active');
		$('#accPokoje').hide();
		$('#accOferty').show();
		//if (document.location.href.indexOf('tabs') != -1) console.log('x');
		document.location.href += '#oferty-specjalne';
	} else {
		$('a[href=#accPokoje]').parent().parent().find('li:first').removeClass('active');
		$('a[href=#accPokoje]').parent().addClass('active');
	}
	
	jQuery('.boxGaleria .tabs li').removeClass('active');
	jQuery('.boxGaleria .tabs li:eq(2)').addClass('active');
	//jQuery('#galLato').hide();
	//jQuery('#galWiosna').fadeIn();
	//jQuery('#galLato').fadeIn();
	//jQuery('#galJesien').fadeIn();
	jQuery('#galZima').fadeIn();
	
	jQuery('.linkedBox').css('cursor', 'pointer').click(function() {
		document.location.href = jQuery(this).find('h3 a').attr('href');
	});



	
	jQuery(document).ready(function() { //otwiera wszystkie linki w nowym oknie
	  jQuery("a[@href^=http]").each(
		function(){
				if(this.href.indexOf(location.hostname) == -1) {
			jQuery(this).attr('target', '_blank');
		  }
		}
	  )


	jQuery('.boxIntro .intro').show();
	jQuery('#introScroll').jCarouselLite({
		btnNext: '.next',
		btnPrev: '.prev',
		visible: 1,
		btnGo: ['.g1', '.g2', '.g3', '.g4', '.g5'],
		easing: 'easein',
		auto: 5000,
		speed: 800
	});
	
	jQuery('.cont2').html(jQuery('#g1 .cont p').html());
	
	jQuery('input.text, textarea').focus(function() {
		jQuery(this).addClass('textFocus');
	}).blur(function() {
		jQuery(this).removeClass('textFocus');
	});	
	
	jQuery('form.search input.text').focus(function() {
		if (jQuery(this).val() == 'Szukana fraza...') jQuery(this).val('');
	}).blur(function() {
		if (jQuery(this).val() == '') jQuery(this).val('Szukana fraza...');							  
	});
	
	jQuery('.boxNewsletter input.text').focus(function() {
		if (jQuery(this).val() == 'Twój adres e-mail') jQuery(this).val('');
	}).blur(function() {
		if (jQuery(this).val() == '') jQuery(this).val('Twój adres e-mail');							  
	});
	
	jQuery('form.eventSearch input.text').focus(function() {
		if (jQuery(this).val() == 'Szukane wydarzenie...') jQuery(this).val('');
	}).blur(function() {
		if (jQuery(this).val() == '') jQuery(this).val('Szukane wydarzenie...');							  
	});
	
	jQuery('.boxNoclegi select, .boxSzukajNoc select').selectbox();
	
	jQuery('#leftSidebar ul li ul li.active').next().addClass('underActive');
	jQuery('#leftSidebar ul li ul li ul li.active').next().removeClass('underActive');
	
	jQuery('.atrakcje .article_row img').each(function() {
		zaokraglijImg(jQuery(this));
	});
	
	jQuery('.xmap .level_0 > li:last').addClass('last');
	
	jQuery('table tr').each(function() {
		jQuery(this).find('td:last').addClass('lastCol');
	});
	
	jQuery('#mainmenu > ul > li > ul').each(function() {
		jQuery(this).find('li:last').addClass('last');
	});
	
	if (jQuery('.noPrintPolec').size() > 0) jQuery('.printPolec').hide();
	
	if (jQuery('.newsletterRegister').size() > 0) jQuery('.navButtons').hide();
	
	jQuery('#leftSidebar ul.menu li a:hidden').parent().hide();
	
	if (jQuery.browser.msie) {
		jQuery('ul.photoCategories li a, .atrakcje .article_row a').not('[rel^="prettyPhoto"]').click(function() {
			document.location.href = jQuery(this).attr('href');
		});
	}


/*kalendarz*/

	var btn_prev = jQuery('#btn_prev').html();
	var btn_next = jQuery('#btn_next').html();
	var days_naglowek = jQuery('.cal_td_daysnames').html();
	var monthCalendarTitle = jQuery('.monthCalendarTitle').html();

	if (btn_prev) {
		if (jQuery('.monthCalendarTitle').html()) {
			jQuery('.monthCalendarTitle').html(btn_prev + '&nbsp;' + monthCalendarTitle + '&nbsp;' + btn_next);
		} else {
			jQuery('.cal_td_daysnames').html(btn_prev + '&nbsp;' + days_naglowek + '&nbsp;' + btn_next);
		}
	}
		
	var link_nextMonth = jQuery('.prevNext .nextMonth').html();
	var link_prevMonth = jQuery('.prevNext .prevMonth').html()	
	
	if (btn_next && link_nextMonth)	{
	jQuery('a.nextMonth').attr('href', jQuery('#btn_next a:first').attr('href'));
	}
	
	if (btn_prev && link_prevMonth)	{
	jQuery('a.prevMonth').attr('href', jQuery('#btn_prev a:first').attr('href'));
	}	


if (jQuery('.monthCalendarTitle').html()) {

	jQuery('#sidebar').hide();
	jQuery('#main').css({width: '960'});

}


	jQuery('a[rel^="prettyPhoto"]').css('outline', '0').prettyPhoto();

});

});



//sIFR
var mp = { src: '/templates/sp/sifr/anivers398.swf' };
sIFR.useStyleCheck = true;
sIFR.activate();
sIFR.replace(mp, {
	selector: '#content h1'
    ,css: [
      '.sIFR-root { font-weight: normal; color: #313129; }'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #313129; }'
      ,'a:hover { color: #89B003; }'
    ]
	,wmode: 'transparent'
});
sIFR.replace(mp, {
	selector: '.box h3'
	,css: [
      '.sIFR-root { font-weight: normal; color: #313129; }'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #313129; }'
      ,'a:hover { color: #89B003; }'
    ]
	,wmode: 'transparent'
});
sIFR.replace(mp, {
	selector: '.boxIntro h3'
	,css: [
      '.sIFR-root { font-weight: normal; color: #ffffff; }'
    ]
	,wmode: 'transparent'
	,filters: {
	  DropShadow: {
		knockout: false
		,distance: 2
		,color: '#000000'
		,strength: 2
	  }
	}
});