jQuery.noConflict();
(function($){

	/* Colorbox */
	$('.colorbox').colorbox({
		maxWidth: '95%',
		maxHeight: '95%'
	});
	$('.video-colorbox').colorbox({iframe:true, innerWidth:700, innerHeight:394});
	$(".subscribe-btn").colorbox({width:"400px", inline:true, href:"#newsletter-form"});
	$(".free-dl").colorbox({width:"400px", inline:true, href:"#free-dl-form"});
	
	/* Slider */
	$('.preview').slides({
		//preload: true,
		preloadImage: 'images/loading.gif',
		container: 'preview-slider',
		next: 'next-ar',
		prev: 'prev-ar'
	});
	
	$('.next-ar, .prev-ar').click(function(){
		return false;
	});
	
	/* Tipsy Tooltips */
	$('.tooltip').tipsy();
	
	/* Remove border from last theme item */
	$('.theme-item:last-child').addClass('last-theme-item');
	
	/* Isotope Setup */
	$('#masonry').isotope({
		itemSelector : '.post',
		// 209 width + 24 margins (yeah shit, I know, why not 210 and 25).
		// Largest box = 466
		masonry: {
			columnWidth : 233 
		}
	});
	
	/* Isotope Filtering */
	
	$('.filter-themes').click(function(){
		$('#filters').slideToggle();
		return false;
	});
	
	$('#filters a').click(function(){
	  var selector = $(this).attr('data-filter');
	  $('#masonry').isotope({ filter: selector });
	  
	  // Add current class
	  $('#filters a').removeClass('current-filter');
	  $(this).addClass('current-filter');
	  return false;
	});
	
	/* Tweets List */
	$('.tweets-box').tweetable({
		limit: $('.tweets-box').attr('data-twitter-num'),
		username: $('.tweets-box').attr('data-twitter-user'),
		replies: true
	});
	
	/* Default e-mail input value */
	var default_value = $('.newsletter-widget #mce-EMAIL').val();
	$('.newsletter-widget #mce-EMAIL').focus(function(){
		if ($(this).val() == default_value) $(this).val("");
	}).blur(function(){
		if ($(this).val() == "") $(this).val(default_value);
	});
	
})(jQuery);
