$(document).ready(function(){
	
$('html').removeClass('no-js');

$('input[placeholder]').placeholderLabel();

$("#gallery").preloader();

$("#gallery a, #foto a").lightBox();
	

$('#send1').click(function(){
	if(!$('#dostawa input[type=radio]:checked').size()) {
		alert('Wybierz opcja dostawy i płatności');
		return false;
	} else {
		sendForm();
	}
	
});

$('.my_slide').click(function(){
	$('.my_slide').next('.hide').slideUp();
	if(!$(this).next('.hide').is(':visible'))
		$(this).next('.hide').slideToggle();
})
	
$('.check_slider').click(function(){
	var selector = $(this).attr('data-toggle');
	$(selector).toggle();
	$(selector).find('input:first, textarea:first').focus();
})
	
$('#cat a.active').next('menu').slideDown();
$('#cat a').live('click', function(){
	if(!$(this).hasClass('go')) {
		if($(this).next('menu').size()) {
			$(this).next('menu').slideToggle();
			$(this).next('menu').find('menu').slideUp();
			return false;
		}
	}
});
	
	$('#products a.button.gray').click(function() {
		var box, boxId, boxName, id, nazwa, link;
		link = $(this);
		box = $('#contact-box, #contact-box-over');
		boxId = box.find('input[name="id"]');
		boxName = box.find('input[name="nazwa"]');
		id = link.data('id');
		nazwa = link.data('nazwa');
		boxId.val(id);
		boxName.val(nazwa);
		box.fadeIn('fast');
		return false;
	});

	$('.close-contact-box').click(function() {
		var box;
		box = $('#contact-box, #contact-box-over');
		box.fadeOut('fast');
		return false;
	});

	$('#contact-box form').ajaxForm({
		type: 'post',
		beforeSubmit: function() {
			$('#contact-box .sending').slideDown('fast');
		},
		success: function(responseText, statusText, xhr, $form) {
			var success = $form.find('.success');
			success.fadeIn('fast');
			setTimeout(function() {
				success.slideUp('fast');
				$('#contact-box .sending').slideUp('fast');
				$('#contact-box .close-contact-box').trigger('click');
			}, 1700);
		}
	});
	
// end ready()
});
