/*------------------------------------------------------*/
/* tab.js */
/*------------------------------------------------------*/
/*
Copyright (c) 2011, Kentaro Mito
http://www.k13style.org
2011.05.17
version: 1.0
--------------------------------------------------------*/
var winWidth	=	$(window).width();
var winHeight	=	$(window).height();
var headerHeight	=	$("#header").outerHeight({margin: true});
var footerHeight	=	$("#footer").outerHeight({margin: true});
var footerPos;
var contentHeight;

//content
var topcontentHeight	=	$("#topcontent").outerHeight({margin: true});
var topcontentWidth		=	$("#topcontent").outerWidth({margin: true});
var topcontentPosX;
var topcontentPosY;
$(function(){
	setlayout();
});
$(window).resize(function(){
    setlayout();
});
function setlayout(){
	winWidth	=	$(window).width();
	winHeight	=	$(window).height();

	if(winHeight <= 650){
		footerPos = 605;
		contentHeight	=	650 - headerHeight - footerHeight;
	}else if(winHeight > 650){
		footerPos		=	winHeight - footerHeight;
		contentHeight	=	winHeight - headerHeight - footerHeight;
	}
	topcontentPosX	=	(winWidth	-	topcontentWidth)/2;
	topcontentPosY	=	(contentHeight	-	topcontentHeight)/2;
	
	$("#footer").css("top",footerPos + "px");
	$("#content").css("height",contentHeight + "px");
	$("#bg_img").css("height",contentHeight + "px");
	$("#topcontent").css("left",topcontentPosX + "px");
	$("#topcontent").css("top",topcontentPosY + "px");
}

