/* LJARI JS by Josh Lizarraga @ FreshCutSD.com */
/* Copyright 2011 ljari.com */

(function(){

/* ! Variables */

var	ANIM_OBJ	= { queue: false, duration: 250 };

/* ! Event Handlers */

var _boxEnter = function(e){
	
	var $top = ( $(this).hasClass('lj-box-double') ? 31 : 20 );
	
	$(this).closest('.lj-box').find('.lj-color').animate({ opacity: 1 }, ANIM_OBJ);
	
	$(this).find('span:first').animate({ top: $top }, ANIM_OBJ);
	
};

var _boxLeave = function(e){
	
	var $top = ( $(this).hasClass('lj-box-double') ? 100 : 0 );
	
	$(this).closest('.lj-box').find('.lj-color').animate({ opacity: 0 }, ANIM_OBJ);
	
	$(this).find('span:first').animate({ top: $top }, ANIM_OBJ);
	
};

var _menubarEnter = function(e){
	
	$(this).closest('li').find('span').animate({ opacity: 1 }, ANIM_OBJ);
	
};

var _menubarLeave = function(e){
	
	$(this).closest('li').find('span').animate({ opacity: 0 }, ANIM_OBJ);
	
};

/* ! Menubar */

$('#lj-header li a')
	.mouseenter(_menubarEnter)
	.mouseleave(_menubarLeave)
	.focus(_menubarEnter)
	.blur(_menubarLeave);

/* ! Search */

$('#lj-header input').focus(function(){
	
	$('#lj-header form').addClass('lj-active');
	
});

$('#lj-header input').blur(function(){
	
	$('#lj-header form').removeClass('lj-active');
	
});

/* ! Boxes */

if( $('.lj-boxes').length ){
	
	$('.lj-box a')
		.mouseenter(_boxEnter)
		.mouseleave(_boxLeave)
		.focus(_boxEnter)
		.blur(_boxLeave);
		
}

})();
