// css frame 用 インデックスやメインのサイズ補正

var index_width = 230;		// インデックス幅
var head_height = 35;		// ヘッダー高さ
var footer_height = 20;		// フッター高さ

function arrange(){
	// ウィンドウのサイズ取得
	var obj = window;
	if( window.opera ) {
		var w = obj.innerWidth;
		var h = obj.innerHeight;
	} else if( document.all && obj.document.body){				//ie4-
		var w = obj.document.body.clientWidth;
		var h = obj.document.body.clientHeight;
	} else if( document.getElementById ){	//n6-7, m1, s1
		var w = obj.innerWidth;
		var h = obj.innerHeight;
	}

	var left = document.getElementById("index");	// インデックス
	var right = document.getElementById("main");	// メイン
	if(right && left){
		var right_style = right.style;
		var left_style = left.style;
		if(right_style && left_style){
			right_style.overflow = "auto";			// コンテンツ部分は自動スクロールバー

			// - インデックス高さ再計算 ヘッダーとフッタの高さ
			left_style.height = (h - head_height - footer_height) + "px";

			// インデックス内が分割されていれば
			var left_head = document.getElementById("index_head");		// インデックス内のヘッダ
			var left_body = document.getElementById("index_body");		// インデックス内の本体
			if(left_head && left_body){
				left_style.overflow = "hidden";		// インデックス全体のスクロールを禁止
				var a = left_style.height;
				left_body.style.height = (parseInt(left_style.height,10) - parseInt(left_head.style.height,10) - 2)  + "px";
					// -2 はボーダー分
			}
			else{
				left_style.overflow = "auto";
			}

			// - コンテンツ高さ再計算 ヘッダーとフッタの高さ
			right_style.height = (h - head_height - footer_height - 1) + "px";
			right_style.width = ( w - index_width  ) + "px";

			//var debug = document.getElementById("debug");	// コンテンツ
			//debug.innerHTML=right_style.width;
			
			var right_head = document.getElementById("main_head");	// コンテンツ
			if(right_head){
				right_head.style.width = ( w - index_width -20 ) + "px";
			}
		}
	}
}


var g_browser_ok = 0;
if ( document.getElementById ) { 
	g_browser_ok = 1;
}
if( navigator.userAgent.indexOf("MSIE 4") != -1 
	|| navigator.userAgent.indexOf("MSIE4") != -1 ){
	g_browser_ok = 0;
}
if( navigator.userAgent.indexOf("MSIE 5") != -1 
	|| navigator.userAgent.indexOf("MSIE5") != -1 ){
	g_browser_ok = 0;
}
if ( document.layers ) {
	g_browser_ok = 0;
}
if( g_browser_ok ) {
	window.onload = arrange;
	window.onresize = arrange;
}

