jQuery(function() {

// Slider Styling

jQuery('#slider_images ul li').hide();

jQuery('#slider_images ul li:first').show();

jQuery('#slider_nav li:first').addClass('current').stop().css({ background: "url('http://www.webdf.com.br/wp-content/themes/webdf_01_2011/img/slide-selected.png')", cursor: 'default' }).animate({ paddingLeft: "10px" }, 300);

jQuery('#slider_nav ul li:last-child').css({ border: 'none'});

var slider = 2;


var slider_rolagem=setInterval(function(){
  
  jQuery('#slider_images ul li').fadeOut();
  jQuery('#myImg_' + slider).fadeIn();
  
  jQuery('#slider_nav ul li').css({ background: 'none', cursor: 'pointer' }).animate({ paddingLeft: "1px" }, 150).removeClass( 'current' );
  jQuery('#myThumb_' + slider).css({ background: 'white', cursor: 'default' }).animate({ paddingLeft: "10px" }, 300).addClass( 'current' );
  
  if( slider >= 4 )
    slider = 1;
  else
    slider = slider + 1;
   
  }, 4000);

if (window)

jQuery(window).blur(function(){
  clearInterval(slider_rolagem);
});
jQuery(window).focus(function(){
  setInterval(function(){
  
  jQuery('#slider_images ul li').fadeOut();
  jQuery('#myImg_' + slider).fadeIn();
  
  jQuery('#slider_nav ul li').css({ background: 'none', cursor: 'pointer' }).animate({ paddingLeft: "1px" }, 150).removeClass( 'current' );
  jQuery('#myThumb_' + slider).css({ background: 'white', cursor: 'default' }).animate({ paddingLeft: "10px" }, 300).addClass( 'current' );
  
  if( slider >= 4 )
    slider = 1;
  else
    slider = slider + 1;
   
  }, 4000);
});
  
// Generate IDs for thumb and images LI
  
var i = 1;
var i2 = 1;
var i3 = 1;
  
jQuery('#slider_nav ul li').each(function() {
  
    jQuery(this).attr('id', 'myThumb_'+i);
  
    i++;
  
});


jQuery('#slider_images ul li').each(function() {

     jQuery(this).attr('id', 'myImg_'+i2);

    i2++;

});

// Image animation

jQuery('#slider_images img').mouseover(function(){
    clearInterval(slider_rolagem);
    }).mouseout(function(){
    slider_rolagem = setInterval(function(){
  
  jQuery('#slider_images ul li').fadeOut();
  jQuery('#myImg_' + slider).fadeIn();
  
  jQuery('#slider_nav ul li').css({ background: 'none', cursor: 'pointer' }).animate({ paddingLeft: "1px" }, 150).removeClass( 'current' );
  jQuery('#myThumb_' + slider).css({ background: 'white', cursor: 'default' }).animate({ paddingLeft: "10px" }, 300).addClass( 'current' );
  
  if( slider >= 4 )
    slider = 1;
  else
    slider = slider + 1;
   
  }, 4000);
});

jQuery('#slider_images img').hover(function(){

    jQuery(this).stop().animate({ opacity: .9 }, 250);

}, function(){

    jQuery(this).stop().animate({ opacity: 1 }, 350);

});

jQuery('#myThumb_1').click(function(){

if(jQuery(this).attr('class') != 'current') {

   jQuery('#slider_images ul li').fadeOut();
   jQuery('#myImg_1').fadeIn();

}

});

jQuery('#myThumb_2').click(function(){

if(jQuery(this).attr('class') != 'current') {

   jQuery('#slider_images ul li').fadeOut();
   jQuery('#myImg_2').fadeIn();

}

});

jQuery('#myThumb_3').click(function(){

if(jQuery(this).attr('class') != 'current') {

   jQuery('#slider_images ul li').fadeOut();
   jQuery('#myImg_3').fadeIn();

}

});

jQuery('#myThumb_4').click(function(){

if(jQuery(this).attr('class') != 'current') {

   jQuery('#slider_images ul li').fadeOut();
   jQuery('#myImg_4').fadeIn();

}

});

// Navigation animation


jQuery('#slider_nav li').click(function(){


   jQuery(this).stop().css({ background: 'white', cursor: 'default' }).animate({ paddingLeft: "10px" }, 300);

   if(jQuery(this).attr('class') != 'current') {

    jQuery('.current').stop().css({ background: 'none', cursor: 'pointer' }).animate({ paddingLeft: "1px" }, 150);
    jQuery('.current').removeClass('current');

}

  jQuery(this).addClass('current');


});

jQuery('#slider_nav li').hover(function(){

   if(jQuery(this).attr('class') != 'current') {

  jQuery(this).stop().animate({ paddingLeft: "10px" }, 300);

}

}, function(){

 if(jQuery(this).attr('class') != 'current') {

    jQuery(this).stop().animate({ paddingLeft: "1px" }, 150);

 }
});

// Dropdown menu

jQuery("ul#menu li").hover(
  function () {
    jQuery(this).children("a:first").toggleClass("hover");
  }
);

  jQuery("ul#menu li ul li").hover(
  function () {
    jQuery(this).children("a:first").removeClass("hover");
  }
);


jQuery('ul#menu ul li a').hover(function(){

    jQuery(this).addClass('menu_hovered');
    jQuery('ul#menu ul li a:not(.menu_hovered)').stop().animate({ opacity: .3 }, 150);

}, function(){

    jQuery('.menu_hovered').removeClass('menu_hovered');
    jQuery('ul#menu ul li a').stop().animate({ opacity: 1 }, 100);

});

// Widget Styling

jQuery('.box1 li:last-child').css({ border: 'none'});



// Animate thumb category

jQuery('.blog_thumb_category').hover(function(){

    jQuery(this).addClass('current_cat');
    jQuery('.current_cat a').stop().animate({ marginLeft: "12px" }, 150);

}, function(){

    jQuery('.current_cat a').stop().animate({ marginLeft: "7px" }, 150);
    jQuery(this).removeClass('current_cat');

});

jQuery('.blog_posts li').hover(function(){

    jQuery(this).addClass('hovered');
    jQuery('.blog_posts li:not(.hovered)').stop().animate({ opacity: .7 }, 250);

}, function(){

    jQuery(".hovered").removeClass('hovered');
    jQuery('.blog_posts li').stop().animate({ opacity: 1 }, 250);

});

// Recent Projects animation

jQuery('.view_project').css({ opacity: 0 });

jQuery('.view_project').hover(function(){

    jQuery(this).addClass('current_project');
    jQuery('.current_project').stop().animate({ opacity: 1 }, 300);
    
}, function(){

     jQuery('.current_project').stop().animate({ opacity: 0 }, 300);
     jQuery('.current_project').removeClass('current_project');

});

// Flickr Image Hover

jQuery('.flickr_widget li img').hover(function(){

    jQuery(this).stop().animate({ opacity: .7}, 300);

}, function(){

    jQuery(this).stop().animate({ opacity: 1}, 150);

});

// Blog image animation

jQuery('.blog_thumb_big').hover(function(){

    jQuery(this).stop().animate({ opacity: 0.8 }, 300);

}, function(){

    jQuery(this).stop().animate({ opacity: 1 }, 200);

});

jQuery('#slider_nav .block span a').removeAttr('href');

});



 

