
    $(function() {      
      // ------------ load Cufon
      Cufon.now();
                           
    	var widthSum = 0;
      $('#menu > li > a').each(function(index) {
        widthSum += $(this).width();
      });
      
      var menuLiPadding = 12;
      var menuWidth = $('#menu').width();
      var menuElement = $('#menu > li > a').length;
      var paddingSize = parseInt((menuWidth-widthSum-((menuElement-1)*menuLiPadding))/(menuElement*2)); 
      var rest = menuWidth - (paddingSize*menuElement*2+widthSum+((menuElement-1)*menuLiPadding));
    
      var paddingRestLeft = parseInt(rest/2);
      var paddingRestRight = rest-paddingRestLeft;
      
      $('#menu > li > a').css('padding-left', paddingSize+'px');
      $('#menu > li > a').css('padding-right', paddingSize+'px');
      
      $('#menu > li:last > a').css('padding-left', paddingSize+paddingRestLeft+'px');
      $('#menu > li:last > a').css('padding-right', paddingSize+paddingRestRight+'px');
  
  
  
      // add class to menu
      $("#menu li:last-child").addClass("lastkid");  
      
          
      //  input file style
      $("form.user_data li.file input[type=file]").filestyle({ 
         image: "img/choose-file.gif",
         imageheight : 21,
         imagewidth : 99,
         width : 420
       });  
                   
      //  input file style
      $("form.user_data input.iFile").filestyle({ 
         image: "img/choose-file.gif",
         imageheight : 21,
         imagewidth : 99,
         width : 207
      });
             
                   
      //  according tab
      $(".seeall").click(function() {
        $(this).parent().parent().children("div.pane").css("display", "block");
        $(this).parent().parent().children("h5").addClass("current");
      });        
                
      //  according tab                                         
      $(".accordion").tabs(".accordion div.pane", {tabs: 'h5', effect: 'slide', initialIndex: null});
                      
      //  lightbox    
	    $('a[rel^=lightbox]').fancybox();

      //  select style                           
	    $("select.select").sSelect();
	    
      //  select	                              
	    $(".hideSubSelect").hide();
	    $(".hideSubSelectDisplay").show();
	                                  
      //  according tab          
      $(".accordion").tabs(".accordion div.pane", {tabs: 'h5', effect: 'slide', initialIndex: null});  
      $(".accordionMainPage").tabs(".accordionMainPage div.pane", {tabs: 'h5', effect: 'slide', initialIndex: null});
      
      $(".tab").each(function(index) {
      //  $("#content .tab h5:first").addClass("active");
      //  $("#content .gallery_list .tab .tabs:first").addClass("active");
        $(".tab:eq("+index+") h5:first").addClass("active");
        $(".tab:eq("+index+") .tabs:first").show();
      });
      
      $(".accordion").each(function(index) {
      //  $("#content .tab h5:first").addClass("active");
      //  $("#content .gallery_list .tab .tabs:first").addClass("active");
        $(".accordion:eq("+index+") h5:first").addClass("current");
        $(".accordion:eq("+index+") .pane:first").addClass("active");
      });
    

      
      //  firma dnia fix height            
      var height = $("#obokFirmaDnia").height();
      $("#firmaDnia").css("height", height+10+"px");
      $("#firmaDnia div").css("height", height+"px");
      
      //  email                
      $("a.addToBook").click(function() {
        $.get($(this).attr("href"), function(data){
          $("#breadcrumbs").after(data);
        });  
        return false;
      }); 
             
      //  multiselect   
      $("div.newMultiListSelected")
        .mouseover(function(){
          $(this).addClass("newMultiListSelectedHover");
        })
        .mouseout(function(){
          $(this).removeClass("newMultiListSelectedHover");
        });
      
    });

    
      Cufon.replace('.cadPageHead span, .newsInfo span, #top ul.catMenu li a, #menu > li > a, #content h2, #content h3, #content h4, #content h5, #content h6' ,
      {
       // textShadow: '1px 1px #fff'
      });
      
    Cufon.replace('#login_top label' ,
      {
        textShadow: '1px 1px #000'
      });
    Cufon.replace('#login_top h2', {
	     color: '-linear-gradient(#fff, #b4b4b4)'
      });
           
    Cufon.replace('#top div.searchBox ul li a, #top div.forumBox ul li a, #top div.homeBox ul li a, #top div.addBox ul li a, #top div.userBox ul li a, #login_top p.name', {
     hover: true, hoverables:{a:true}
      });
    
    
  $(document).ready(function() {
                     
    // home page partners    
    $("#partners img").css('opacity', 0.95);  
    
    $("#partners img").hover(
      function () {$(this).fadeTo("slow", 1);}, 
      function () {$(this).fadeTo("slow", 0.95);}
    );
     
    $("#bigGalleryPhoto .scrollGalleryCompany").jCarouselLite({
      btnNext: "#bigGalleryPhoto  .moveRight",
      btnPrev: "#bigGalleryPhoto  .moveLeft",
      speed: 2000,
      circular: false,
      visible: 5,
      scroll: 5,
      marginRight: 0,
      vertical: false
    });
    
    $("#bigGalleryPhoto .scrollGalleryPage").jCarouselLite({
      btnNext: "#bigGalleryPhoto  .moveRight",
      btnPrev: "#bigGalleryPhoto  .moveLeft",
      speed: 2000,
      circular: false,
      visible: 9,
      scroll: 9,
      marginRight: 0,
      vertical: false
    });
    
    $("a.changeCheckboxCheck").click(function(){
      $("input[type='checkbox']").attr("checked", "checked");
      return false;
    });
    
    $("a.changeCheckboxUncheck").click(function(){
      $("input[type='checkbox']").removeAttr("checked");
      return false;
    });
    
    $(".popupCategory").hide();
    $("#act a.act").click(function(){
      $(".popupCategory").show();
      return false;
    });
    
    $(".popupCategory .topBkg .close").click(function(){
      $(".popupCategory").hide();
      return false;
    });
    

    
       
  });
  
  
  function changeGaleryPhoto(photoSrc, name, link){
     $("#bigPhotoInGallery img").attr('src', photoSrc);
     $("#bigPhotoInGallery strong").html(name);
     $("#bigPhotoInGallery a").attr('href', link);
  }
  function changeGaleryPhotoCompany(photoSrc, name){
     $("#bigPhotoInGallery img").attr('src', photoSrc);
     $("#bigPhotoInGallery strong").html(name);
  }
  
