function envSet() {
	// ブラウザ判別.
	var ua = navigator.userAgent;
	var d  = document;

	this.isGecko      = ua.match(/Gecko\//);
	this.isSafari     = ua.match(/AppleWebKit/);
	this.isOpera      = window.opera;
	this.isOpera6     = (this.isOpera && ua.match(/Opera.6/));    // Opera 6.x
	this.isIE         = (d.all && !this.isGecko && !this.isSafari && !this.isOpera);
	this.isIE1        = (this.isIE && ua.match(/MSIE [4-6]\./));     // IE 4.0x - 6.xx
	this.isIE2        = (this.isIE && ua.match(/MSIE [7-9]\./));     // IE 7.xx - 9.xx
	this.isNN4        = d.layers;                                    // NN 4.x
	this.isMac        = ua.match(/Mac/);
	this.isWin        = ua.match(/Win/);
	this.isWinIE      = this.isWin && this.isIE;
	this.isMacIE      = this.isMac && this.isIE;
	if ((this.isIE1) && (this.isIE2))       {this.isIE1 = undefined;}

	// 各ブラウザ用補正 CSS のファイル名.
	this.patchCSS = 'kikusui_hp.css';this.DISP = 'Base';
	if (this.isMacIE)   {this.patchCSS = 'MacIE.css';}
	if (this.isIE1)	    {this.patchCSS = 'WinIE.css';}
	if (this.NN4)       {this.patchCSS = 'NN.css';}
	if (this.isGecko)   {this.patchCSS = 'Gecko.css';}
	return this;
}


// Start-up
//-------------------------------------------------------------------------------
//　Cookieから指定されたCSSデータを設定
//-------------------------------------------------------------------------------
function WriteCss(csspath){
	var env  = new envSet();
	document.write("<LINK REL='stylesheet' HREF='",csspath+env.patchCSS,"' TYPE='text/css'>");
}

//-------------------------------------------------------------------------------
//　Cookieから指定されたCSSデータを設定　のデバグ用ルーチン
//-------------------------------------------------------------------------------
function degugCss(csspath){
	var env  = new envSet();
	document.write('<div class="BG1">');
	document.write('<div class="BG1_TH">');
	document.write('<H2>デバグ CSS</H2>');
	document.write('</div>');
	document.write('<div class="BG1_TD">');

	document.write('<table class="BG1">');
	document.write('<tr><th>Flag</th><th>判定</th><th>内部数値</th>');

	document.write('<tr><th>User Agent</th>');
	document.write('<td colspan="2">',navigator.userAgent,'</td></tr>');

	document.write('<tr><th>Windows</th>');
	if (env.isWin) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isWin,'</td></tr>');

	document.write('<tr><th>Mac</th>');
	if (env.isMac) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isMac,'</td></tr>');


	document.write('<tr><th>Gecko</th>');
	if (env.isGecko) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isGecko,'</td></tr>');

	document.write('<tr><th>Safari</th>');
	if (env.isSafari) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isSafari,'</td></tr>');

	document.write('<tr><th>Opera</th>');
	if (env.isOpera) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isOpera,'</td></tr>');

	document.write('<tr><th>Opera6</th>');
	if (env.isOpera6) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isOpera6,'</td></tr>');

	document.write('<tr><th>IE</th>');
	if (env.isIE) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isIE,'</td></tr>');

	document.write('<tr><th>IE 4.0 - 6.xx</th>');
	if (env.isIE1) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isIE1,'</td></tr>');

	document.write('<tr><th>IE 7.xx - 9.xx</th>');
	if (env.isIE2) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isIE2,'</td></tr>');

	document.write('<tr><th>NN4</th>');
	if (env.isNN4) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isNN4,'</td></tr>');


	document.write('<tr><th>WinIE</th>');
	if (env.isWinIE) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isWinIE,'</td></tr>');

	document.write('<tr><th>WinIE2</th>');
	if (env.isWinIE2) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isWinIE2,'</td></tr>');

	document.write('<tr><th>MacIE</th>');
	if (env.isMacIE) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isMacIE,'</td></tr>');

	document.write('<tr><th>Gecko</th>');
	if (env.isGecko) {document.write('<td>Yes</td>');} else {document.write('<td>No</td>');}
	document.write('<td>',env.isGecko,'</td></tr>');

	document.write('<tr><th>UseCssFile</th>');
	document.write('<td><a href="',csspath+env.patchCSS,'">●</a></td>');
	document.write('<td>',csspath+env.patchCSS,'</td></tr>');

	document.write('<tr><th>Domain</th>');
	document.write('<td colspan="2">',document.domain,'</td></tr>');

	document.write('</table>');
	document.write('</div>');
	document.write('</div>');
}


function scroll1(){ 
	var move = 20; // スクロールのなめらかさ（1に近いほどなめらかに） 
	// 設定終了 
	// 初期化 
	var y = 0; 

	// スクロール位置をチェック（IE用） 
	if(document.all){ 
		y = document.body.scrollTop; 
	} 
	// スクロール位置をチェック（NN用） 
	else if(document.layers || document.getElementById){ 
		y = pageYOffset; 
	} 
	for (i=move;i>=0;i--)
	{
		yy = y * (i / move)
		window.scroll(0,yy); // スクロール処理 
	}
}

function scroll2(){ 
	var move = -16; // スクロールのなめらかさ（1に近いほどなめらかに） 
	// 設定終了 
	// 初期化 
	var y = 0; 

	do{
		ny = y; 
		window.scrollBy(0, move); // スクロール処理 
		// スクロール位置をチェック（IE用） 
		if(document.all){ 
			y = document.body.scrollTop; 
		} 
		// スクロール位置をチェック（NN用） 
		else if(document.layers || document.getElementById){ 
			y = pageYOffset; 
		} 
	}while(ny=y)
}

function a_scroll(){ 
	if (self.location.href.match(/#/) == '#') {
		window.scrollBy(0, -100);
	}
}

function a_junm(name){ 
	self.location.hash=name;
	a_scroll();
}


