jQuery(function() {

jQuery('#footer_widgets').masonry({
  singleMode: true,
  itemSelector: '.one_fourth'
});

jQuery('#square_text_module').masonry({
  singleMode: true,
  itemSelector: '.one_third'
});


// 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: '#F4F4F4', cursor: 'default' }).animate({ paddingLeft: "10px" }, 300);


// 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('#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();

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

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

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

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

}

});

// Navigation animation


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


   jQuery(this).stop().css({ background: '#F4F4F4', 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');

});
