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

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

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

});

/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

/* 
 * EmailSpamProtection (jQuery Plugin)
 * Version: 1.0
 * Date: 2010 July
 * Author: Mike Unckel
 * Description and Demo: http://unckel.de/labs/jquery-plugin-email-spam-protection
 *
 * HTML: <span class="email">info [at] domain.com</span>
 * JavaScript: $("body").emailSpamProtection("email");
 *
 */

(function($) {
	$.fn.emailSpamProtection = function(className) {
		return $(this).find("." + className).each(function() {
			var $this = $(this);
			var s = $this.text().replace(" [at] ", "&#64;");
			$this.html("<a href=\"mailto:" + s + "\">" + s + "</a>");
		});
	};
})(jQuery);


 

