$(function () {
	$('.lightbox').fancybox();
	$('#navigation ul li:eq(6)').hover(
		function() {
		$('#nav-info').css('display','block');
		$('.dropmenu').toggleClass('dropmenu_select');
		},
		function() {
		$('#nav-info').css('display','none');
		$('.dropmenu').toggleClass('dropmenu_select');
		}
	);
	$("#facebook-slider").hover(
		function(){
		$("#facebook-slider").stop(true, false).animate({right:"0"},"slow");
        },
		function(){
        $("#facebook-slider").stop(true, false).animate({right:"-348"},"slow");
		}
	);
	rotator(".shop-gallery", 6000);
	rotator("#cinema-rotator", 4300);
	rotator("#promo-rotator", 2400);
	rotator("#event-rotator", 8000);
	contact_form();
	$('#contact input:checkbox').parent().parent().parent().nextUntil(".captcha").hide();
	$('#contact input:checkbox').click(enable_form);

})

rotator = function (box, timer) {
		
	if ($(box +" li").length > 1) {

		$(box + " li").hide();
		var active = $(box + " li:first-child"); active.show();		
		rotate = function(fade, time) {
		play = setInterval(function() { 
				active.fadeOut(fade);
				active = active.next();
					if (active.length === 0) {
						active = $(box + " li:first-child");
					}
				active.fadeIn(fade);
			}, time);
		};

		rotate(700,timer);
	
		$(box + " li").hover(
				function() {
				clearInterval(play); 
		}, function() {
				rotate(700,timer);
		});	

	}
};

contact_form = function () {
	$("input[name='email']").bind({
		focus: function() {
			$(this).val('');
		}
	});
};

function enable_form() {
	if ($(this).is(':checked')) {
		$(this).parent().parent().parent().nextUntil(".captcha").slideDown('slow');
	} else 
		$(this).parent().parent().parent().nextUntil(".captcha").slideUp('slow');
};

var idswf;
function getID( swfID ){
	if(navigator.appName.indexOf("Microsoft") != -1){
		idswf = window[swfID];
		//idswf = document.getElementById(swfID);
	}else{
		idswf = document[swfID];
	}
}
				
function ustawsklep( str ){
	//alert(str);
	idswf.ustawsklep(str);
}

function lightbox_click(id){
	$('#'+id).fancybox().trigger('click');
}


