// jQuery library in use
$(document).ready(function() {
	$('.noJs'). removeClass('noJs');
	
	var mbm = new Object();

	$('#audyt').css('cursor','pointer').click(function() {
		window.location = $('#audyt h2 a').attr('href');
	});
	
// karuzela
	$("#carousel").carouFredSel({
		items		: 7,
		direction	: 'up',
		scroll : {
			items			: 1,
			duration		: 2500,
			easing			: "linear",
			pauseOnHover	: true,
			pauseDuration	: 0
		}					
	});	
	
	$("#klienci").carouFredSel({
		items		: 5,
		direction	: 'left',
		scroll : {
			items			: 1,
			duration		: 4500,
			easing			: "linear",
			pauseOnHover	: false,
			pauseDuration	: 0
		}					
	});	

//partnerzy
	$('#przesuwane').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		slideExpr: 'div.loga',
		startingSlide:0,
		allowPagerClickBubble: true,
		pagerEvent: 'mouseover', 
    	pauseOnPagerHover: true,
		speed: 1000,
		timeout: 6000 
	});

// fancybox
	$('a[rel=lightbox]').fancybox({
		overlayOpacity	: 0.6,
		overlayColor	: '#000'
	});

// slideshow na głównej
	$('#konkurs').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		slideExpr: 'div.boksMaly',
		pager:  '#navpage',
		startingSlide:0,
		allowPagerClickBubble: true,
		pagerEvent: 'mouseover', 
    	pauseOnPagerHover: true,
		speed: 1500,
		timeout: 5000
	});

// menu górne
	$(".rozwiniete").hover(function() {
		$(this).parent().children().first().addClass('active');
	}, function() {
		$(this).parent().children().first().removeClass('active');
	});
	
	$("#menu ul li").hover(function() {
		$(this).children('.rozwiniete').slideDown(500);
	}, function() {
		$(this).children('.rozwiniete').slideUp(500);
	});

	// taby
	$('.tabs').tabs();
	
// zadaj pytanie
	if ($('#offerForm')) {
		$("#offerForm").validate({
			rules: {
				imie: {
					required: true
				},
				email: {
					required: true,
					email: true
				},
				tresc: {
					required: true
				}
			},
			submitHandler: function(form){
				$(form).submit(function(){
					return false;
				});
				$('body').addClass('wait');
				$.post('/wycena-pozycjonowania.html', $(form).serialize(), function(resp){
					$('#formularzContent').html(resp);
					$('body').removeClass('wait');
				});
				
			}
		});
	}


	
});

function potwierdz() {
	return confirm('Czy na pewno chcesz wykonać tą operację?');
}

function doAction(id, href) {
	$('#'+id).load(href);
	return false;
}

