// JavaScript Document


	
$(document).ready(function() {
	
	if($('body#home').is('*')){
	
		
		//Top Page Main Visual
		var theWindow = $(window);
		var bg = $("#bg");
		aspectRatio = bg.width() / bg.height();
		
		function resizeBg() {
			
			
			
			//if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
			if ( ($("#mainImg").width() / $("#mainImg").height()) <  aspectRatio) {
				bg
					.removeClass()
					.addClass("bgheight")
					//.css({
					//	 "min-height" : $("#mainImg").height(),
					//});
					
					
			} else {
				bg
					.removeClass()
					.addClass("bgheight")
					//.css({height : mainImgWidth});
					//.css({
					//	 "min-height" : $("#mainImg").height(),
					//});
					
			}
			
			menuPosition();
			
			
		}
		
		
		
		
		
		var ua = navigator.userAgent;
		var checker = {
		iphone: ua.match(/(iPhone|iPod)/),
		ipad: ua.match(/(iPad)/),
		blackberry: ua.match(/BlackBerry/),
		android: ua.match(/Android/)
		};
		
		if(checker.iphone || checker.ipad || checker.android){
			
			$("#bg").css({"height": 420})
			$("#bg").attr("src",$("#bg").attr("src").replace(/^(.+)(\.[a-z]+)$/,"$1_s$2"));
			$("#navi").css({ "top":360 });
			
		
		} else {
		
			//if(theWindow.width < 300){
			theWindow.resize(function() {
				resizeBg();
			}).trigger("resize");
			//}
		}
			
	
	
	
	}
	
	// init rollover
	JsRoller.initialize( 'rollover' );
	
	
	
	$("#slideImg").cycle({
			fx: 'fade',
			speed:900,
			delay: 0
		});
	
	// Shoplist following Navigation setup 
	if($('#shop').is('*')){
			$( '.shopNavi' ).scrollFollow(
				{
					speed: 500,
					offset: 100,
					container: 'shop',
					killSwitch: 'killSwitch'
				}
			);
		}

});


function menuPosition(){
	
	var winHeight = $(window).height();
	
	var mainImgHeight = winHeight - 110;
	if(mainImgHeight > 400){
		var naviPosition = mainImgHeight - 60;
	} else {
		var naviPosition = 360;
	}
	
	$("#mainImg").css({	
					  height:mainImgHeight,
					  "min-height":420
					});
	$("#navi").css({ top:naviPosition });
	$("#logo").css({ top:20 });
}

// scrollTo
function move(n){
	$.scrollTo(n, 500);
}

function nothing(){
}

function popup(n){
	window.open('http://www.point.co.jp/php_files/map.php?code=' + n, 'pop', 'width=550,height=750,scrollbars=yes');	
}
