jQuery(document).ready(function()
{				
	//jQuery(document).pngFix();		
						
	jQuery('.header_menu_item').mouseover(function () {
		jQuery(this).find('.header_menu_item_active').css('display', 'block');
		jQuery(this).find('.header_menu_item_inactive').css('display', 'none');
    });
    
    jQuery('.header_menu_item').mouseout(function () {
		jQuery(this).find('.header_menu_item_active').css('display', 'none');
		jQuery(this).find('.header_menu_item_inactive').css('display', 'block');
    });
    
    jQuery('.produkty_folder, .produkty_folder2').mouseover(function () {
		jQuery(this).find('.produkty_image').css('display', 'none');
		jQuery(this).find('.produkty_image_blank').css('display', 'block');
    });
    
    jQuery('.produkty_folder, .produkty_folder2').mouseout(function () {
		jQuery(this).find('.produkty_image').css('display', 'block');
		jQuery(this).find('.produkty_image_blank').css('display', 'none');
    });
    
    jQuery('.wiecej').click(function () {
		jQuery(this).parent().parent().parent().find('.shortNews').css('display', 'none');
		jQuery(this).parent().parent().parent().find('.allNews').css('display', 'block');
    });
    
    jQuery('.zwin').click(function () {
    	jQuery(this).parent().parent().parent().find('.shortNews').css('display', 'block');
		jQuery(this).parent().parent().parent().find('.allNews').css('display', 'none');
    });
    
    jQuery('.ofertaPop').mouseover(function () {
    	jQuery(this).parent().find('.boxOfertaInfoLeft').css('display', 'block');
		jQuery(this).parent().find('.boxOfertaInfoRight').css('display', 'block');
		
		var h = jQuery(this).parent().find('.boxOfertaInfoLeft').height();
		if(h == null)
			h = jQuery(this).parent().find('.boxOfertaInfoRight').height();
		
		var p = jQuery(this).parent();
		var position = p.position();
		var diff = 310 - position.top - h - 15;
		
		//alert(diff);
		
		if(diff < 0)
		{
			jQuery(this).parent().find('.boxOfertaInfoLeft').css('top', diff + 'px');
			jQuery(this).parent().find('.boxOfertaInfoRight').css('top', diff + 'px');
		}
    });
    
    jQuery('.ofertaPop').mouseout(function () {
    	jQuery(this).parent().find('.boxOfertaInfoLeft').css('display', 'none');
		jQuery(this).parent().find('.boxOfertaInfoRight').css('display', 'none');
    });
    
    
    jQuery("a.fancyboxi").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.7,
		'overlayColor'	: 	"#AAAAAA",
		'titlePosition'	: 	"over",
		'titleShow'		: 	false,
		'showNavArrows'	: 	true,
		'autoScale'		: 	true,
		'titleFormat'	:	function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over"><font style="color:#3DAA01">'+title+'</font><br/>zdjęcie ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});

});
