$(document).ready(function() {

	// this is for fading manufacturers
	$('#manufacturers-list li').each(function() {
	
		$(this).hover(function() {
			$(this).children('a').animate({opacity: .5}, { duration: 500, queue: false });
		},function() {
			$(this).children('a').animate({opacity: 1}, { duration: 500, queue: false });
		});
	
	});
	
	// hearing aid movement code
	
	var section_count = $('.section').size(),i = 1;
	
	$('#hearing-aids .next-section').click(function() {
	
		if(i == section_count) {
			i = 1;
			$('#hearing-aids .section-wrapper').animate({"left": "0px"},{duration: 500});
		} else {
			$('#hearing-aids .section-wrapper').animate({"left": "-=900px"},{duration: 500});
			i++;
		}	
	});
	
	// home module treatments
	
	
	
	var modules = $('.module'), i = 0;
	
	$('#home-modules .module').css({opacity:0});
	
	(function() {$(modules[i++]).animate({opacity:.5},1000, arguments.callee);})();
	
	$('#home-modules .module').each(function() {
	
		$(this).hover(function() {
			$(this).animate({opacity: 1}, { duration: 500, queue: false });
		},function() {
			$(this).animate({opacity: .5}, { duration: 500, queue: false });
		});
	
	});
	
	
	// fade in the header images
	
	//$(".header-image img").bind("load", function () { $(this).fadeIn(3000); });
	
	$(".header-image img").one("load",function(){
		$(this).fadeIn(3000);
	}).each(function(){
		if(this.complete) $(this).trigger("load");
	});
	
	// map lightbox
	
	 $('.location .location-image a').lightBox();
		
});
