$(document).ready(function(){ 
  tb_getPageWidth();
  set_columnPosition();
  $(window).bind("resize", function(){
   tb_getPageWidth();
   set_columnPosition();
  });
});

function tb_getPageWidth(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	arrayPageWidth = [w];
	return arrayPageWidth;
}
 
function set_columnPosition(){
	if(!document.getElementById) return;
	var contents = document.getElementById("contentsContainer");
	var gn = document.getElementById("globalNavi");
	var footer = document.getElementById("footer");
	var conth = $(contents).innerHeight();
	var gnh = $(gn).innerHeight();
	var w = tb_getPageWidth();
	var a = 330;
	var b = 80;
	var s = w-a;
	var rx = s+b;
	
	contents.style.position = gn.style.position = footer.style.position ="absolute";
	contents.style.top = gn.style.top  = 245 + "px";
	
	if(s<660){
	    s = 660;
		rx = 660+b;
	}
	if(conth <= gnh){
		footer.style.top = (gnh+250) + "px";
	}
	if(gnh <= conth){
		footer.style.top = (conth+250) + "px";
	}
	
	if ($.browser.msie) {
		var s = w-320;
		var rx = s+90;
		if(s<600){
	      s = 600;
		  rx = 690;
		}
		if(conth <= gnh){
		footer.style.top = (gnh+270) + "px";
	}
	if(gnh <= conth){
		footer.style.top = (conth+270) + "px";
	}
    }
	
	contents.style.width = s + "px";
	gn.style.left = rx + "px";
	footer.style.width = 100 + "%";
	
	setTimeout("set_columnPosition();", 0);
}