// JavaScript Document


	
$(document).ready(function() {
	
	if($('body#top').is('*')){
	
		
		//Top Page Main Visual
		var theWindow = $(window);
		var bg = $("#bg");
		aspectRatio = bg.width() / bg.height();
		var img_height = $(window).height()-50;
		var nega = 0;
		
		
		function resizeBg() {
			img_height = $(window).height()-50;
			img_width = img_height*1.72;
			nega = 0-img_width/2;

			
			
			//if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
			if ( ($("#mainImg").width() / $("#mainImg").height()) <  aspectRatio) {
				bg
					.removeClass()
					.addClass("bgheight")
					.css({
						 "margin-left" : (nega)+"px"
					});
					//.css({
					//	 "min-height" : $("#mainImg").height(),
					//});
					
					
			} else {
				bg
					.removeClass()
					.addClass("bgheight")
					.css({
						 "margin-left" : (nega)+"px"
					});
					//.css({height : mainImgWidth});
					//.css({
					//	 "min-height" : $("#mainImg").height(),
					//});
					
			}
			
			menuPosition();
			
			
		}
		

			//if(theWindow.width < 300){
			theWindow.resize(function() {
				resizeBg();
			}).trigger("resize");
			//}
	

	}

	// Shoplist following Navigation setup 

});


function menuPosition(){
	
	var winHeight = $(window).height();
	
	var mainImgHeight = winHeight - 50;
	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 });
}


