//document.write("<BR>●この下はスクロールバー対策の余白計算処理プログラム部分です（バグ発見用に結果を表示させています）●<BR><B>2005.8.7バージョンアップ：BODYタグに余白を適用するように改良した</B><BR><BR>");
//ウインドウ幅(Window_Width)の定義
if(navigator.appName=="Microsoft Internet Explorer"){
var Window_Width=parent.upper.document.body.clientWidth;
var Scrollbar_Width=parent.upper.document.body.clientWidth - document.body.clientWidth;
//document.write("<font color=#FFFF00>【IEバグ対策部分ここから／この部分はIEのみ表示されます】<BR>A…現在の上フレームのウインドウ幅は、<font color=#FF0000>"+parent.upper.document.body.clientWidth+"ピクセル</font>です。<BR>");
//document.write("B…現在の下フレームのウインドウ幅は、<font color=#FF0000>"+document.body.clientWidth+"ピクセル</font>です。<BR>");
//document.write("C…AとBの数値より計算されるこのブラウザのスクロールバー幅は、<font color=#FF0000>"+parent.upper.document.body.clientWidth+"−"+document.body.clientWidth+"＝"+Scrollbar_Width+"ピクセル</font>です。<BR>【IEバグ対策部分ここまで】</font><BR><BR>");
}
else if(navigator.appName == "Netscape"){
var Window_Width =window.outerWidth;
}
else{
var Window_Width = "1024";
}
//document.write("D…中心揃えの基準にするウインドウ幅は、<font color=#FF0000>"+Window_Width+"ピクセル</font>です。<BR>　↑の数字が上フレーム幅と一致すれば、ウインドウ幅の取得は成功しています。<BR>");

//左マージン幅の計算→Left_Marginに代入
var Left_Margin=(Window_Width-1024)/2;
if(Left_Margin<0){
var Left_Margin = 0;
}
//document.write("E…本来あるべき左余白は、(D-1024)÷2で求められ、<font color=#FF0000>"+Left_Margin+"ピクセル</font>です。<BR>　この文字が表示されれば、左余白の計算は成功しています。<BR>");
//計算処理前の結果の出力
//document.write("F…初期設定の左余白は<font color=#FF0000>"+document.getElementsByTagName("body")[0].style.backgroundPosition+"</font>です。（←0pxと表示されるはずです）<BR>0pxに設定されている左余白を、次の行で計算結果(E)の数値に置き換えます。<BR>");

//いよいよ計算結果をBODY左余白に適用
document.getElementsByTagName("body")[0].style.backgroundPosition=Left_Margin+"px 0px";
document.getElementsByTagName("body")[0].style.marginLeft=Left_Margin+"px";
//document.write("置き換え作業後の背景の左余白＝"+document.getElementsByTagName("body")[0].style.backgroundPosition+"<BR>");
//document.write("置き換え作業後の内容の左余白＝"+document.getElementsByTagName("body")[0].style.marginLeft+"<BR>");
//document.write("上２行の数値が、Eの計算結果と一致していればこのプログラムは成功です。");
