function menuBgs () {

	$('.menu-active').remove();

	$('#menu > li > a').each( function () {

		var menuName = $(this).attr('class');
		var menuClass = 'menu-active-' + menuName;

		// Create the BG

		$(this).parent().prepend('<div class="menu-active ' + menuClass + '"></div>');

		// Find the position of the link

		var menuPos = $(this).offset();

		$('.' + menuClass)
			//.css('left', menuPos.left)
			//.css('top', menuPos.top - 5)
			.css('opacity', 0);

		$(this).hover( function () {

			//$(this).stop().animate({color: '#000'},500);
			//$('.' + menuClass).stop().animate({opacity: 1},500);

			$(this).css('color', '#000');
			$('.' + menuClass).css('opacity', '1');

		}, function () {

			//$(this).stop().animate({color: '#fff'},500);
			//$('.' + menuClass).stop().animate({opacity: 0},500);
			
			$(this).css('color', '#fff');
			$('.' + menuClass).css('opacity', '0');

		});

	
	});


}

function toggle_faq (selector) {

	if($(selector).is(':visible')) {

		$(selector).slideUp('slow');

	} else {

		$(selector).slideDown('slow');

	}

	return false;

}


$(document).ready( function() {


	$('.carousel').jCarouselLite({
		btnNext: ".carousel-next",
		btnPrev: ".carousel-back",
		visible: 6,
		speed: 3500,
		auto: 500
	});

	$('#service-wheel').each(function() {

		var flashvars = {};
		var params = {};
		params.wmode = "transparent";
		var attributes = {};
		swfobject.embedSWF("swf/services.swf", "service-wheel", "930", "540", "9.0.0", false, flashvars, params, attributes);
		setTimeout(menuBgs, 1000);

	});

	$('.faq-question').each( function () {
	

		$(this).hover ( function () {
			
			$(this).addClass('hover');		
		
		}, function() {

			$(this).removeClass('hover');
		
		});

	
	});

	$('.cycle').cycle();

	menuBgs();
	$(window).bind("resize", menuBgs);

	$('.staff-member:nth-child(5n)').css('margin-right', 0);

	$("#menu").superfish({
		autoArrows: false
	});

	$('#menu > li').hover(
		function () {
			$(this).find('.menu-active').css('opacity', 1);
		},
		function () {
			$(this).find('.menu-active').css('opacity', 0);
		}
	)

});
