﻿
var RESIZE_HEIGHT = true;

(function(func) {
	try {
		window.addEventListener("load", func, false);
	} catch(e) {
		window.attachEvent("onload", func);
	}
})(function() {
	windowCheck();
});

(function(func) {
	try {
		window.addEventListener("resize", func, false);
	} catch(e) {
		window.attachEvent("onresize", func);
	}
})(function() {
	var isWin9X = (navigator.appVersion.toLowerCase().indexOf('windows 98')+1);
	var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);
	var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')+1?1:0);
	if (isOpera) isIE = false;
	var isSafari = (navigator.appVersion.toLowerCase().indexOf('safari')+1?1:0);
	
	var obj = new Object();
	if (!isSafari && !isOpera) {
	obj.x = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth;
	obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
	} else {
	obj.x = window.innerWidth;
	obj.y = window.innerHeight;
	}
	var winX = obj.x;
	var winY = obj.y;
	
	var elm = document.getElementById("contents");
	if(winX < 1020){
		elm.style.width = 1008 + "px";
	}
	if(winX > 1009){
		elm.style.width = "100%";
	}
	
	if (RESIZE_HEIGHT) {
		if(winY < 640){
			elm.style.height = 649 + "px";
		}
		if(winY > 650){
			elm.style.height = "100%";
		}
	}
});

function windowCheck(){
	var isWin9X = (navigator.appVersion.toLowerCase().indexOf('windows 98')+1);
	var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);
	var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')+1?1:0);
	if (isOpera) isIE = false;
	var isSafari = (navigator.appVersion.toLowerCase().indexOf('safari')+1?1:0);
	
	var obj = new Object();
	if (!isSafari && !isOpera) {
	obj.x = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth;
	obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
	} else {
	obj.x = window.innerWidth;
	obj.y = window.innerHeight;
	}
	var winX = obj.x;
	var winY = obj.y;
	
	var elm = document.getElementById("contents");
	if(winX < 850){
		elm.style.width = 1008 + "px";
	}
	
	if (RESIZE_HEIGHT) {
		if(winY < 620){
			elm.style.height = 649 + "px";
		}
	}
}


