//generale
root_path = "http://integrarertt.arca.org.ro/wp-content/themes/integrarertt/";
$(document).ready(function(){
//ascuns text home page afla mai mult
    $('.entry_home_bun_venit .more-link').html('');
//galerie
    $('dt.gallery-icon a').css({'display':'block','height':'75px'});
    $('dt.gallery-icon img').hover(function(){                                    
        $(this).animate({opacity:0.4},300);
        $('.hidden',(this)).css('background','url(images/bulina.png) no-repeat');
        //$('.hidden',(this)).css('_background','none !important');
    }, function (){
        $(this).animate({opacity:1},300);
        $('.hidden',(this)).css('background','none');
    });
    
//get a href from resources and linked it to parent li
    $('li.resurse').live('click',function(e){
        e.preventDefault;
        this.blur;
        window.open($('li.resurse a').attr('href'));
    }).css('cursor','pointer');
//functionalitate header
     function deschide(timp,cookie1){
             $('div#headerimg').animate({height:"134px",top:"0px"},timp,'linear',function(){$('#button-up img').attr("src",root_path+"images/button_up.jpg");$.cookie('header', cookie1,{ expires: 365, path: '/' });
             $('#button-up img').attr("title","inchide");
});
     }
     function inchide(timp,cookie1){
        $('div#headerimg').animate({height:"20px",top:"-20px"},timp,'linear',function(){$('#button-up img').attr("src",root_path+"images/button_down.jpg"); $.cookie('header', cookie1,{ expires: 365, path: '/' }); });  
         $('#button-up img').attr("title","deschide");      
     }     
     
     if($.cookie('header')==0) 
       inchide(0,0)
     else
        deschide(0,1);
     $('#button-up img').click(function(){
     if($('div#headerimg').css('top')=='-20px' && $.cookie('header'))
            deschide(400,1)
     else
            inchide(250,0)
     }) 

     //functionalitate meniu
    pad = 4//luat din css
    lungimeT = 0; //lungime totala
    noduri = 0;
    $('#menu a').each(function(index) {
        lungimeA = $('#menu li:eq('+index+')').width();
        lungimeT += $('#menu li:eq('+index+')').outerWidth(true);
        $('#menu li:eq('+index+')').width(lungimeA);
        noduri = index;
    });
    
    $('ul#menu').width(lungimeT+pad*noduri*2); //calculam lungimea totala a meniului, ca sa il putem centra
    
    $('#menu li:not(.current-cat)').hover(
        function () {
            $(this).addClass('current-cat');
        },
        function () {
             $(this).removeClass('current-cat');
      }).corner("bottom","#fff"); 
           
     $('#menu li.current-cat').corner("bottom","#fff"); 
     //innegrire ultima linie posturi   
     posts = $('div.post').length;   
     $('div.post').eq(posts-1).css({'border-bottom':'1px solid #7d7d7d','padding-bottom':'22px'});
     posts_despre_proiect = $('ul.advanced-recent-posts li').length;
     $('.advanced-recent-posts a').eq(posts_despre_proiect-1).css('border-bottom','none');
     //aranjare contact
     categorii = $('ul.advanced-recent-posts li').length; 
  //   if((categorii==1) || (categorii>3))
    //    $('#postsofcurrentcategory-3').hide();   
});


