// JavaScript Document

var winH;
var winW;
var topP;
var leftP;

$(function(){
	bgSet();
	
	$(window).resize(bgSet);
	window.setInterval("bgSet()", 100);
	
	
	window.onorientationchange = bgSet;
})

function bgSet(){
	winH = $(window).height();
	//if(winH > 900){ winH = 900; }
	winW = $(window).width();
	//if(winW > 1600){ winW = 1600; }
	
	$("#wrapper").css({
		"height": winH,
		"width": winW
	});
	
	
	
	/* if(winW > 1600 || winH > 900){
		if(winH > winW){
			$("#bg img").attr("height", winH);
			$("#bg img").attr("width", winH*1.8);
		}else {
			$("#bg img").attr("height", winW*0.6);
			$("#bg img").attr("width", winW);
		}
	}else {
		$("#bg img").attr("height", 900);
		$("#bg img").attr("width", 1600);
	}
	
	if(winH >= 900){
		topP = 0;
	}else {
		topP = (900 - winH) / 2;
	}
	if(winW >= 1600){
		leftP = 0;
	}else {
		leftP = (1600 - winW) / 2;
	}
	
	if(topP > 35){ topP = 35;}
	
	$("#bg").css({
		"left": "-"+leftP+"px",
		"top": "-"+topP+"px"
	}) */
	
	/* if((topP>=0) && (leftP>=0)){
		$("#wrapper").css({
			"background-position": "-"+leftP+"px -"+topP+"px"
		});
	}else if((topP>=0) && (leftP<0)){
		$("#wrapper").css({
			"background-position": "center -"+topP+"px"
		});
	}else if((topP<0) && (leftP>=0)) {
		$("#wrapper").css({
			"background-position": "-"+leftP+"px center"
		});
	}else {
		$("#wrapper").css({
			"background-position": "center center"
		});
	} */
}
