$(document).ready(function(){
    
$(document).pngFix(); //fix png dla IE6

$(".news_data").corner("3px");
$(".danie").corner("3px");
$(".gallery_box_top").corner("5px");

$(".slogan3").slideDown(2000);


$('.slogan').cycle({ 
    fx:    'fade', 
    speed:  2000,
    cleartype:  1, // enable cleartype corrections 
    //random:   1,
    timeout:  4000
 });
$('.slogan2').cycle({ 
    fx:    'fade', 
    speed:  2000,
    cleartype:  1, // enable cleartype corrections 
    //random:   1,
    timeout:  4000
 });

$('#flash_right').cycle({ 
    fx:    'fade', 
    speed:  1000,
    timeout:  6000
 });



//scroller images
$(function() {
        $(".scroller").jCarouselLite({
    auto: 800,
    speed: 2000,
    visible: 2,
    vertical: true
});
   
});
// centrowanie w pionie obrazkow w scrollu
(function ($) {
    $.fn.vAlign = function(container) {
        return this.each(function(i){
	   if(container == null) {
	      container = 'div';
	   }
	   var paddingPx = 10; //change this value as you need (It is the extra height for the parent element)
	   $(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
	   var el = $(this).children(container + ":first");
	   var elh = $(el).height(); //new element height
	   var ph = $(this).height(); //parent height
	   if(elh > ph) { //if new element height is larger apply this to parent
	       $(this).height(elh + paddingPx);
	       ph = elh + paddingPx;
	   }
	   var nh = (ph - elh) / 2; //new margin to apply
	   $(el).css('margin-top', nh);
        });
     };
})(jQuery);

$(".scroll_item").vAlign();



$(function() {
	$('a.lightbox').lightBox(); // Select all links with lightbox class
	});

//tooltips
$(".more").tooltip({
          top: -25,
          left: 30,
          fade: 650, 
          showBody: " - ",
          showURL: false,
          track: true
          });
$(".more_popup").tooltip({
          top: -25,
          left: 30,
          fade: 650, 
          showBody: " - ",
          showURL: false,
          track: true
          });
        $(".icon_link").tooltip({
          top: -25,
          left: 30,
          fade: 250,
          showBody: " - ",
          showURL: false,
          track: true
          });
        $(".footer_link").tooltip({
          top: -25,
          left: 30,
          fade: 250,
          showBody: " - ",
          showURL: false,
          track: true
          });
        $(".spi_link").tooltip({
          top: -25,
          left: 30,
          fade: 650, 
          showBody: " - ",
          showURL: false,
          track: true
          });
        $(".mail_link").tooltip({
          top: -25,
          left: 30,
          fade: 250,
          showBody: " - ",
          showURL: false,
          track: true
          });
        $(".flag_link").tooltip({
          top: -15,
          left: 30,
          fade: 250,
          showBody: " - ",
          showURL: false,
          track: true
          });
////==============FOTO POPUP================      


//centering popup  
   

 $(".open_popup").click(function(e){
    e.preventDefault();
    //centerPopup();
    $(".popup_background").css({"opacity": "0.3"});
    
   $(".popup_background").fadeIn("slow");
   $(".popup_foto").load($(this).attr('rel'));
   $(".popup").fadeIn("slow");
   //$(".popup_foto").load(this.href);
   
    });
   
   //zamyka po kliknieciu na popup
   $(".popup").click(function(){
    $(".popup_background").fadeOut("slow");  
   $(".popup").fadeOut("slow");
   

});
   
   //zamyka po kliknieciu na background
   $(".popup_background").click(function(){
    $(".popup_background").fadeOut("slow");  
   $(".popup").fadeOut("slow");
});
   
   //zamyka po nacisnieciu escape
   $(document).keypress(function(e){  
   if(e.keyCode==27){  
   $(".popup_background").fadeOut("slow");  
   $(".popup").fadeOut("slow"); 
   }  
   });
   
   ////==============FOTO POPUP - mini galeria================      

   $(".img_thumb").mouseover(function(){
   // e.preventDefault();
   $(".popup_from_gallery").load($(this).attr('rel')); 
   $(".popup_from_gallery").fadeIn("slow"); 
   //$(".popup_load").show();
   //$(".popup_foto").load(this.href);
  // var content = "news.php";
  // $(".popup_load").load($("http://www.gerda.pl/projektant3/"));
   
   //$(".popup_load").load('from_gallery.php');
  // $(".popup_load").load("news.html .popup_load");
    });
   
  
   
   
   //zamyka po zjechaniu myszko
   $(".img_thumb").mouseout(function(){
   
   $(".popup_from_gallery").fadeOut("slow");
   

});
   
  
   
   //zamyka po nacisnieciu escape
   $(document).keypress(function(e){  
   if(e.keyCode==27){  
   
   $(".popup_projektant").fadeOut("slow"); 
   }  
   });
   
   
//menu
$(".display_sub_menu1").click(function(){
    $(".submenu2").slideUp("slow"); 
    $(".submenu1").slideDown("slow");
    
});


$(".display_sub_menu2").click(function(){
    $(".submenu1").slideUp("slow");
    $(".submenu2").slideDown("slow");
    
});





}); // koniec dokument ready
