(function(){
	function forIE() {
		if (!$.browser.msie) return;
		$('#presenter-list .box').each(function(){
			if ($(this).position().top > 400) {
				$(this).remove();
			}
		});
	}
	jQuery(function($){
		$('#contents').css({
			background:'url(/css/images/presenter-images-bg.jpg) no-repeat 351px 440px' 
		});
		$('#header-main').insertBefore('#footer .main-navigations');
		$.getJSON('/gateway/is_campaign', function(json){
			if (!$('body').is('.campaign-page') && (json.campaign || location.search.match(/check/))) {
				$('#header .main-navigations #salon-link').replaceWith('<li id="campaign-link" ><a href="/campaign" title="普及キャンペーン指定サロン">普及キャンペーン指定サロン</a></li>');
				$('#footer .main-navigations #footer-salon-link').replaceWith('<li id="footer-campaign-link" ><a href="/campaign" title="普及キャンペーン指定サロン">普及キャンペーン指定サロン</a></li>');
			}
		});
		$('#presenter-list').masonry({
			itemSelector: '.box',
			columnWidth: 90
		}, forIE);
		setInterval(function(){
			$('#presenter-images').fadeTo(800, 0.1, function(){
				$(this).load('/experiences/updateImageList', function(){
					$('#presenter-list').masonry({}, forIE);
					$(this).fadeTo(1000, 1.0)
				})
			})
		}, 10000);
	});
})();
