jQuery(document).ready(function() {

	jQuery("#formularz_logowania").addClass("hide_formularz", 0 );
	
	jQuery('a.toggle_logowanie').click(function() {
			jQuery( "#formularz_logowania" ).toggleClass("hide_formularz",300 );
		return false;
	});	

	jQuery('#formularz_logowania').hover(
			function(){ 
				jQuery( "#formularz_logowania" ).toggleClass("hide_formularz",300 );	
			}, function(){   
				jQuery( "#formularz_logowania" ).toggleClass("hide_formularz",300 );		
	}); 
		

	jQuery('.toggle').hide();
	
	jQuery('a.toggler').click(function() {
		//var index = jQuery("ul#menu_kategorie_produktow li h4 a").index(this);
		//jQuery(".toggle:eq("+index+")").slideToggle(300);
		jQuery(this).parent().parent().children(".toggle").slideToggle(300);
		//alert(index);
		return false;
	});
    
	jQuery('a.to_top').click(function(){  
		jQuery('html, body').animate({scrollTop:0}, 'slow');  
       return false;  
    });

	jQuery("a.fancybox").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
});

/*
jQuery(document).ready(function() {

jQuery('a.opis_wiecej').click(function() {
	loadContent = this.href;
	jQuery('#opis_produktu_ajax').load(loadContent + ' .produkt').css("visibility","visible").animate({}, 50000);
	return false;
});

jQuery('#opis_produktu_ajax').click(function() {
	jQuery('#opis_produktu_ajax').css("visibility","hidden").animate({}, 50000);
	return false;
});
	
});
*/
/*
jQuery(document).ready(function() {

jQuery('a.opis_wiecej').click(function() { 

    var pageToLoad = jQuery(this).attr('href') + " #produkt"; 
	alert (pageToLoad);
    jQuery('#opis_produktu_ajax').load(pageToLoad); 
	alert('1');
    jQuery.fancybox({ 
        autoDimensions: false, 
        width: 600, 
        height: 650, 
        overlayColor: #000, 
        overlayOpacity: 0.5, 
        scrolling: 'no', 
        onComplete: function() { 
            jQuery('#opis_produktu_ajax').css('height', '650px'); 
        } 
    } 
    ); 
        return false; 
        }); 

});
*/


jQuery(document).ready(function () {

    //jQuery('a.opis_wiecej').fancybox({
    //		'autoScale': false,
    //		'autoDimensions': false,
    //		'width': 550,
    //		'height': 480,
    //		'type': 'ajax',     
    //		'ajax': {         
    //				dataFilter: function(data) 	{ 
    //												return jQuery(data).find('#szczegolowy_opis_produktu')[0];         
    //											}     
    //				} 		

    //		});

//    jQuery('a.opis_stan_magazynowy').fancybox({
//        'autoScale': false,
//        'autoDimensions': false,
//        'width': 400,
//        'height': 300,
//        'type': 'ajax',
//        'ajax': {
//            dataFilter: function (data) {
//                return jQuery(data).find('#szczegolowy_stan_magazynowy')[0];
//            }
//        }
//    });

    jQuery('a.opis_wiecej').fancybox({
        'autoScale': false,
        'autoDimensions': false,
        'width': 550,
        'height': 480,
        'type': 'ajax',
        'ajax': {
            beforeSend: function (request) {
                request.setRequestHeader("UseJS", "true");
            }
        }
    });


    jQuery('a.opis_stan_magazynowy').fancybox({
        'autoScale': false,
        'autoDimensions': false,
        'width': 400,
        'height': 300,
        'type': 'ajax',
        'ajax': {
            beforeSend: function (request) {
                request.setRequestHeader("UseJS", "true");
            }
        }
    });

});


/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 


this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		jQuery("body").append("<p id='tooltip'>"+ this.t +"</p>");
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });	
	jQuery("a.tooltip").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



// starting the script on page load
jQuery(document).ready(function(){
	tooltip();
});
