


jQuery(document).ready(function($) {
	
	
	
	if ( 	!$('body').hasClass('work_page') && !$('body').hasClass('single') ){
	
		$('#page').append('<div class="bubble"></div>')
	
		var bubble = $('.bubble');
		if ( bubble.length > 0 ){
			var endX = 125;
			bubble.css('left',endX-50);
			setTimeout(function(){ bubble.animate({top:'242px'},4000); }, 2000);
			setTimeout(function(){ bubble.animate({left:endX-40+'px'},{ queue: false, duration: 1000 }); }, 200);
			setTimeout(function(){ bubble.animate({left:endX+20+'px'},{ queue: false, duration: 1000 }); }, 3000);
			setTimeout(function(){ bubble.animate({left:endX-10+'px'},{ queue: false, duration: 1000 }); }, 4000);
			setTimeout(function(){ bubble.animate({left:endX+'px'},{ queue: false, duration: 1000 }); }, 5000);
		}
	}
	
	
	
	
	
	$('.listing .thumb a').hover( 
		function(){
			$(this).animate({ 
				opacity: 0.4,
			}, 150 );
		},
		function(){
			$(this).animate({ 
				opacity: 1,
			}, 350 );
		}
	);
	
	
	
	
	
	var eml = 'me@';
	eml += 'jonah';
	eml += 'goldst';
	eml += 'ein.com';
	var lnk = 'mailto:' + eml;
	$(' a.my_email').attr("href",lnk);
	
	
	
	
	
	var imgs_with_rollovers = $('.has_info');	
	imgs_with_rollovers.wrap('<div class="img_wrapper"></div>');
	imgs_with_rollovers.each( function(){
		$(this).after( $(this).parent().next( '.roll_info') ); 
	});
	
	$('.roll_info').wrap('<div class="info_wrapper"></div>');
	imgs_with_rollovers.hover(
		function(){
			var info = $(this).next();
			info.css('width',$(this).width());
			info.css('height',$(this).height());
			info.fadeIn();
		},
		function(){}
	);
	$('.info_wrapper').hover(
		function(){},
		function(){
			$(this).fadeOut();
		}
	);
	
	
	
	var p = $('.entry>p').eq(0).addClass('first-paragraph');
	
	
	
	
	var tag_box = $('#main_menu .tags');
	tag_box.wrap('<div></div>');
	var box_wrapper = tag_box.parent();
	box_wrapper.addClass('tags_wrapper');
	box_wrapper.addClass('clearfix');
	tag_box.css('display','block');
	$('#all_kinds').click( 
		function(){
			if( $('.tags_wrapper').css('display')=='block' ){
				$(this).css('backgroundColor','');
				$(this).css('backgroundPosition','');
				box_wrapper.slideUp();
			} else {
				$(this).css('backgroundColor','#777');
				$(this).css('backgroundPosition', ($(this).width()+26) + "px " + ' -90px'  );
				var pos = $(this).position();
				box_wrapper.css(	{ 	'left':pos.left-box_wrapper.width(), 'top':pos.top-20 }	);
				box_wrapper.slideDown();
			}
			return false;

		}
	);
	
	
	/*
	#
	#		WORK INFO
	*/
	$('#work_box').show();
	$('#work_box div').each( function(){
		$(this).attr( 'wfinal', $(this).width() );
	});
	$('#work_box').hide();

	$('.work_btn').click( function(){
		$('#work_box div').css('width',1);
		var delay = 100;
		$('#work_box div').each( function(){
			
			delay += 100;
			var this_obj = $(this);
			setTimeout( 
				function(){ 
					this_obj.animate( { width: this_obj.attr('wfinal') }, 1000 );
				}, delay );

			
		});
		$('#blocker').fadeIn();
		$('#work_box').fadeIn();
		return false;
	});
	$('#work_box .close_work, #blocker').click( function(){
		$('#blocker, #work_box').fadeOut();
		return false;
	});


	
	
});