Current File : /pages/54/47/d0016649/home/htdocs/cd24/wp-content/themes/en-vision/lib/js/topbar.js
jQuery(document).ready(function(){

	if ( jQuery.isFunction( jQuery.fn.superfish ) ) {

		var topbar_menu = jQuery('.ui--custom-menu', '#top-bar');
		var topbar_menu_custom_animation_speed = topbar_menu.attr('data-animation-speed');

		topbar_menu.superfish({
			hoverClass: 'hover',
			cssArrows: false,
			delay: 500,
			speed: topbar_menu_custom_animation_speed || 50,
			speedOut: topbar_menu_custom_animation_speed || 50
		});
	}


	var search_form = jQuery('#widget--search', '#top-bar'),
		toggle 		= search_form.find('a'),
		input 		= search_form.find('input'),
		form 		= search_form.find('.ui--search-form'),
		cssanimations = jQuery('html').hasClass('cssanimations'); 


	toggle.click(function(e){
		e.preventDefault();
		input.focus();

	});

	input.bind('focus', function(){
		if( cssanimations ) {
			search_form.addClass('state--open');
		}
		else {
			form.stop(1).animate({'width': 150});
		}
		
		//toggle.addClass('ui--gradient-primary').removeClass('ui--gradient-grey');

	});

	input.bind('blur', function(){
		if( cssanimations ) {
			search_form.removeClass('state--open');
		}
		else {
			form.stop(1).animate({'width': 0});
		}
		
		//toggle.removeClass('ui--gradient-primary').addClass('ui--gradient-grey');
	});

});