//LayerOj.js + yysimple.js を足した奴
//v1.06

//---------------------------------------------------------------
//v1.03 Logo() でNN6.2様に+10px補正を掛けた
//v1.04 プログラム内のバグを修正
//v1.05 返信レス可能版1.03b の為に新しい関数追加
//v1.06 ファイル名変更
//---------------------------------------------------------------

//colorデータを分解しＹ，Ｘ座標をＣＧＩ側から格納する配列
var DateColorY = new Array();
var DateColorX = new Array();

//記事一覧の為の配列
var DateRes = new Array();

//表示記事の数が格納される
var DateCount=0;

///////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------
// レス部分のStyle.Display制御クラス（CGI側と連携して使用します）
//---------------------------------------------------------------

// (id <= ベースＩＤ, open <= 初期状態で表示=1・非表示=0, child <= レスの数）
var RDC = new Array();
function ResDisplayControl(id, mode, child, oya){
	this.id = id;
	this.openMode = mode;
	this.oya = oya;
	this.child = child;
}

// Style.Display展開する
ResDisplayControl.prototype.open = ResDisplayControl_Open;
function ResDisplayControl_Open(){
	var c, ID;
	if(this.child != 0){
		for(c=1; c<=this.child; c++){
			ID = this.id + "_" + c;
			if(!document.all && document.getElementById){
				document.getElementById(ID).style.display = '';
			}else if(document.all){
				document.all(ID).style.display = '';
			}
		}
	this.openMode = 1;
	}
}

// Style.Display格納する
ResDisplayControl.prototype.close = ResDisplayControl_Close;
function ResDisplayControl_Close(){
	var c, ID;
	if(this.child != 0){
		for(c=1; c<=this.child; c++){
			ID = this.id + "_" + c;
			if(!document.all && document.getElementById){
				document.getElementById(ID).style.display = 'none';
			}else if(document.all){
				document.all(ID).style.display = 'none';
			}
		}
	this.openMode = 0;
	}
}

//返信記事の展開・格納を自動判別で行う
ResDisplayControl.prototype.auto = ResDisplayControl_Auto;
function ResDisplayControl_Auto(){
	if(this.openMode == 1){
		this.close();
	} else {
		this.open();
	}
}

///////////////////////////////////////////////////////////////////////////////////////


//新規書き込みレイヤーと記事ソートのどちらが表示されてるか（0 = どちらも非表示, 1 = Write, 2 = Sort）
var Write_Sort_Flag = 0;

//新規書き込むレイヤー出現
function Write_Mode(){
	if(Write_Sort_Flag == 2){
		Res_Sort_Close();
	}

	P.setPoint(P_Point[0], P_Point[1]);
	PC.setPoint(PC_Point[0], PC_Point[1]);
	Write_Sort_Flag = 1;
}

//位置決めレイヤーが動いて無い場合は書き込みできない様に制御（レス可能版1.03b 〜）
// Write_Mode_Flag が 1 なら位置決めレイヤーを動かして無くても書き込める
function Write_Open(y, x){
	if(Point_Comment_Delete_Flag == 1 || Write_Mode_Flag == 1){
		WRITE.setPoint(y, x);
	} else {
		alert("まず、▼ ←これを書き込む位置までドラッグ（移動）させて下さい");
	}
}

function Write_Close(){
	P.setPoint(-10000, -10000);
	PC.setPoint(-10000, -10000);
	WRITE.setPoint(-10000, -10000);
	Write_Sort_Flag = 0;
}

//「記事のソート」レイヤーの出現
function Res_Sort_Mode(){
	if(Write_Sort_Flag == 1){
		Write_Close();
	}

	SORT.setPoint(SORT_Point[0], SORT_Point[1]);
	P.setPoint((P_Point[0] - 0), (P_Point[1] + 75));
	Write_Sort_Flag = 2;
}

function Res_Sort_Close(){
	P.setPoint(-10000, -10000);
	SORT.setPoint(-10000, -10000);
	Write_DE_Flag = 0;
}

//記事のソート(新しい記事から「mode="new"」, 古い記事から「mode="old"」, デフォルトに戻す「mode="default"」)（レス可能版1.03b 〜）
function Res_Sort(mode){

	var c, k;

	var max = DateCount; //１ページ当たりに表示する記事数

	//位置決めレイヤーの位置を基準にする
	var basic_Y = P.getTop();
	var basic_X = P.getLeft();

	//現在の記事のz-indexを格納
	var z_index = ZINDEX;
   if(Point_Comment_Delete_Flag == 1 || Write_Mode_Flag == 1){
	if(mode == "new"){
		for(c=1, k=1; c<=max; c++, k++){
			L[c].setPoint(basic_Y - (23*(k-1)), basic_X + (55*(k-1)));
			L[c].setZindex(z_index + (max-k));
			ZINDEX++;
		}
		Res_Sort_Close();
	} else if(mode =="old") {
		for(c=max, k=1; c>=1; c--, k++){
			L[c].setPoint(basic_Y - (23*(k-1)), basic_X + (55*(k-1)));
			L[c].setZindex(z_index + (max-k));
			ZINDEX++;
		}
		Res_Sort_Close();		
	} else if(mode =="default") {
		for(c=max; c>=1; c--){
			L[c].setPoint(DateColorY[c], DateColorX[c]);
			L[c].setZindex(++ZINDEX);
		}
		Point_Comment_Delete_Flag = 0;
	}	
   } else {
	alert("まず、▼ ←これをドラッグ（移動）させて下さい");
   }
}

//レイヤーにInnerHTMLで出力する（レス可能版1.03b 〜）
function InnerHTML_Data(id, s){
	if(!document.all || document.getElementById){
        	document.getElementById(id).innerHTML = s;
	}
	else if(document.all){
        	document.all(id).innerHTML = s;

	}
}

//書き込み位置決めのレイヤー横のコメント消し（レス可能版1.03b 〜）
var Point_Comment_Delete_Flag = 0; //これが「0」なら位置決めのレイヤーが動いてない。
function Point_Comment_Delete(){
	if(Point_Comment_Delete_Flag == 0){
		Select_Menu_Close(PC);
		Point_Comment_Delete_Flag = 1;	
	}
}

//セレクトメニューの非表示化（レス可能版1.03b 〜）
function Select_Menu_Close(layer){
	layer.setPoint(-1000, -1000);
}

//著作権表示部分の位置固定(IEは修正無し、NN6.2は＋２０)（レス可能版1.03b 〜）
function Logo(id){

	if(Load == 1){
	var Win = getFrameSize();
	if(document.all){
		document.all(id).style.left = document.body.scrollLeft + Win.w - 170;
		document.all(id).style.top = document.body.scrollTop + Win.h - 32;
	}else if(!document.all && document.getElementById){
		document.getElementById(id).style.left = window.pageXOffset + Win.w - 190;
		document.getElementById(id).style.top = window.pageYOffset + Win.h - 60;
	}
	}

}

//colorデータの合成
var MC;
function MakeColor(){
	MC = document.F1.color2.value +"&"+ P.getTop() +"&"+ P.getLeft();
	document.F1.color.value = MC;
}

var MakeColor2Y, MakeColor2X;
//colorデータの合成(記事修正モード用)
function MakeColor2(){

	MC = document.F1.color2.value +"&"+ MakeColor2Y +"&"+ MakeColor2X;
	document.F1.color.value = MC;
}

	//レイヤー用の配列・変数
	var TITLE;
	var L = new Array(); //記事全体
	var L_RES = new Array(); //記事のレスボタン
	var WRITE; //入力フォーム
	var P; //書き込む位置選択レイヤー
	var PC; //書き込む位置選択レイヤー横のコメントレイヤー
	var DRT; //記事一覧表のテーブル
	var S_MENU; //セレクトメニューレイヤー
	var PAGE; //ページ移動レイヤー
	var SORT; //記事整列メニューレイヤー
	var EDIT_DELETE; //削除・修正レイヤー
	var OTHER; //その他メニューレイヤー

//★超重用・・・レイヤーをオブジェクト化する関数★
//「res_mode = 1」ならレス可能モード
function SetLayer(color, res_mode){

		var c, ID, ID_RES, p, y, x;
		var p = DateCount + 10;

		//「書き込む位置」レイヤー
		P = new LayerOj("Point", 99999, 99999, 99999, 99999);
		P.setZindex(1000);
		MakeColor();

		PC = new LayerOj("Point_Comment", 99999, 99999, 99999, 99999);

		//タイトルレイヤー
		TITLE = new LayerOj('Title', 99999, 99999, 99999, 99999);
		//セレクトメニューレイヤー
		S_MENU = new LayerOj('Select_Menu', 99999, 99999, 99999, 99999);
		S_MENU.setZindex(999);

		//記事一覧レイヤー
		DRT = new LayerOj('DateRes', 99999, 99999, 99999, 99999);
		DRT.setZindex(999);

		//ページ移動レイヤー
		PAGE = new LayerOj('page', 99999, 99999, 99999, 99999);
		PAGE.setZindex(999);

		//削除・修正レイヤー
		EDIT_DELETE = new LayerOj('Edit_Delete', 99999, 99999, 99999, 99999);
		EDIT_DELETE.setZindex(999);

		//その他メニューレイヤー
		SORT = new LayerOj('Sort_Menu', 99999, 99999, 99999, 99999);
		SORT.setZindex(999);

		//その他メニューレイヤー
		OTHER = new LayerOj('Other_Menu', 99999, 99999, 99999, 99999);
		OTHER.setZindex(999);

		//入力フォームのレイヤー
		WRITE = new LayerOj("Input_Form_Div", -1000, -1000, 99999, 99999);
		L[0] = new LayerOj("Input_Form_Div", -1000, -1000, 99999, 99999);
		L[0].setZindex(1001);

	//記事レイヤー
	if(DateCount != 0){
		for(c=1; c<=DateCount; c++, p--){

			ID = 'P' + c;
			ID_RES = 'Res' + c;
			//y = Math.ceil(Math.random() * 500);
			//x = Math.ceil(Math.random() * 800);

			//L[$oya].setPoint(DateColorY[$oya], DateColorX[$oya]);

			L[c] = new LayerOj(ID, DateColorY[c], DateColorX[c], 99999, 99999);
			L[c].setZindex(p);
			L[c].setBgcolor(color);	
			//L[c].setBorderColor("#000000");

			L_RES[c] = new LayerOj(ID_RES, 99999, 99999, 99999, 99999);
			//L_RES[c].setBgcolor(color);
			if(res_mode != 1){
				//こいつが実行されるとレス不可モードになる
				L_RES[c].setDisplay(0);
			}					
		}
	}


}

//記事一覧表のアクション
function ResDateG(no, mode, c1, c2){

	var c;

	if(DateCount != 0){
		L[no].setBgcolor(c2);
		//L_RES[no].setBgcolor(c2);

		//mode = 0 なら標準に戻す・・・つまりZ-indexを変化させない
		if(mode != 0){ L[no].setZindex(ZindexConductor()); }	
	}

 	if(DateCount > 1){
		for(c=1; c<=DateCount; c++){
			if(c != no){
				L[c].setBgcolor(c1);
				//L_RES[c].setBgcolor(c1);
			}	
		}
 	}
}

//z-indexを統括する
var ZINDEX = 50; //ページに表示する記事の総数＋１０より大きくないと不具合が発生。
function ZindexConductor(){
	return ++ZINDEX;
}

function winOpen(url, name, op){
	window.open(url, name, op);
}
//ウィンド（自身のフレーム）のサイズの取得
function getFrameSize(){
	var w, h;

	if(document.all){
		w = document.body.clientWidth ;
		h = document.body.clientHeight ;
	}else if(!document.all && document.getElementById){
		w = self.innerWidth ;
		h = self.innerHeight ;
	}else if( document.layers !== void 0 ){
		w = self.innerWidth ;
		h = self.innerHeight ;
	}

	return { w : w, h : h };
}

//メニューを中央に配置する（h,w で配置するオブジェクトの縦横のサイズ。 h2,w2で補正）
function OjPositioning(id, h, w, h2, w2){

	FRAMSIZE = getFrameSize();
        var AMENDMENT_h, AMENDMENT_w;

	if(((FRAMSIZE.h - h)/2) <= 0){
		AMENDMENT_h = 0;
	} else {
		AMENDMENT_h = (FRAMSIZE.h - h)/2 + h2;
	}
	if(((FRAMSIZE.w - w)/2) <= 0){
		AMENDMENT_w = 0;
	} else {
		AMENDMENT_w = (FRAMSIZE.w - w)/2 + w2;
	}

	if(document.getElementById){
		//alert(AMENDMENT_h);
        	document.getElementById(id).style.top = AMENDMENT_h;
        	document.getElementById(id).style.left = AMENDMENT_w;
	}
	else if(document.all){
        	document.all(id).style.top = AMENDMENT_h;
        	document.all(id).style.left = AMENDMENT_w;
	}
	else if(document.layers){
		document.layers[id].moveBy(AMENDMENT_w, AMENDMENT_h);
	}
}


///////////////////////////////////////////////////////////////////////////////////////
//LayerOj.js
///////////////////////////////////////////////////////////////////////////////////////

//---------------------------------------------------------------------------------------------------

//レイヤーオブジェクトクラス（まだまだ未完成＾＾；）
function LayerOj(id, top, left, height, width){
	this.id = id;
	this.NONE = 99999;
	this.setPoint(top, left);
	this.setSize(height, width);
}

//位置を操作する
LayerOj.prototype.setPoint = setPoint_LayerOj;
function setPoint_LayerOj(top, left){
	if(document.getElementById){
		if(top != this.NONE){ document.getElementById(this.id).style.top = top; }
		if(left != this.NONE){ document.getElementById(this.id).style.left = left; }
	}else if(!document.getElementById && document.all){
		if(top != this.NONE){ document.all(this.id).style.top = top; }
		if(left != this.NONE){ document.all(this.id).style.left = left; }
	}
}

//縦横のサイズを操作する
LayerOj.prototype.setSize = setSize_LayerOj;
function setSize_LayerOj(height, width){
	if(document.getElementById){
		if(height != this.NONE){ document.getElementById(this.id).style.height = height; }
		if(width != this.NONE){ document.getElementById(this.id).style.width = width; }
	}else if(!document.getElementById && document.all){
		if(height != this.NONE){ document.all(this.id).style.height = height; }
		if(width != this.NONE){ document.all(this.id).style.width = width; }
	}
}

//「zindex」を操作する
LayerOj.prototype.setZindex = setZindex_LayerOj;
function setZindex_LayerOj(z){
	if(document.getElementById){
		document.getElementById(this.id).style.zIndex = z;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.zIndex = z;
	}
}

//「backgroundColor」を操作する
LayerOj.prototype.setBgcolor = setBgcolor_LayerOj;
function setBgcolor_LayerOj(bgc){
	if(document.getElementById){
		document.getElementById(this.id).style.backgroundColor = bgc;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.backgroundColor = bgc;
	}
}


//「display」を操作する
LayerOj.prototype.setDisplay = setDisplay_LayerOj;
function setDisplay_LayerOj(ch){

	var d;

	if(ch == 1){
		d = "";
	} else{
		d = "none";
	}
	if(document.getElementById){
		document.getElementById(this.id).style.display = d;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.display = d;
	}
}

//「visibility」を操作する
LayerOj.prototype.setVisibility = setVisibility_LayerOj;
function setVisibility_LayerOj(ch){

	var v;

	if(ch == 1){
		v = "visible";
	} else{
		v = "hidden";
	}

	if(document.getElementById){
		document.getElementById(this.id).style.visibility = v;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.visibility = v;
	}
}

//不透明度を操作する(ＩＥ系はインラインで「filter:alpha()」を設定しておく必要あり)
LayerOj.prototype.setOpacity = setOpacity_LayerOj;
function setOpacity_LayerOj(ch){

	var k;

	if(document.all){
		document.all(this.id).filters['alpha'].opacity = ch;
	}else if(document.getElementById && !document.all){
		k = ch + '%';
		document.getElementById(this.id).style.MozOpacity = k;
	}
}

//「color」を操作する
LayerOj.prototype.setColor = setColor_LayerOj;
function setColor_LayerOj(c){
	if(document.getElementById){
		document.getElementById(this.id).style.color = c;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.color = c;
	}
}

//「border-color」を操作する
LayerOj.prototype.setBorderColor = setBorderColor_LayerOj;
function setBorderColor_LayerOj(c){
	if(document.getElementById){
		document.getElementById(this.id).style.borderColor = c;
	}else if(!document.getElementById && document.all){
		document.all(this.id).style.borderColor = c;
	}
}

//「color」を取得する
LayerOj.prototype.getColor = getColor_LayerOj;
function getColor_LayerOj(){

	var c;

	if(document.getElementById){
		c = document.getElementById(this.id).style.color;
	}else if(!document.getElementById && document.all){
		c = document.all(this.id).style.color;
	}
	return c;
}

//不透明度を取得する(ＩＥ系はインラインで「filter:alpha()」を設定しておく必要あり)
LayerOj.prototype.getOpacity = getOpacity_LayerOj;
function getOpacity_LayerOj(ch){

	var k;

	if(document.all){
		k = document.all(this.id).filters['alpha'].opacity = ch;
	}else if(document.getElementById && !document.all){
		k = document.getElementById(this.id).style.MozOpacity;
        	k = eval(k.replace(/%/, "")*1);
		alert(k);
	}
	return k;
}

//「visibility」を取得する
LayerOj.prototype.getVisibility = getVisibility_LayerOj;
function getVisibility_LayerOj(){
	if(document.getElementById){
		v = document.getElementById(this.id).style.visibility;
	}else if(!document.getElementById && document.all){
		v = document.all(this.id).style.visibility;
	}
	return v;
}

//「display」を取得する
LayerOj.prototype.getDisplay = getDisplay_LayerOj;
function getDisplay_LayerOj(){
	if(document.getElementById){
		display = document.getElementById(this.id).style.display;
	}else if(!document.getElementById && document.all){
		display = document.all(this.id).style.display;
	}
	return display;
}

//「backgroundColor」を取得する
LayerOj.prototype.getBgcolor = getBgcolor_LayerOj;
function getBgcolor_LayerOj(){
	if(document.getElementById){
		bgc = document.getElementById(this.id).style.backgroundColor;
	}else if(!document.getElementById && document.all){
		bgc = document.all(this.id).style.backgroundColor;
	}
	return bgc;
}

//「zindex」を取得する
LayerOj.prototype.getZindex = getZindex_LayerOj;
function getZindex_LayerOj(){
	if(document.getElementById){
		z = document.getElementById(this.id).style.zIndex;
	}else if(!document.getElementById && document.all){
		z = document.all(this.id).style.zIndex;
	}
	return z;
}

//「top」を取得する
LayerOj.prototype.getTop = getTop_LayerOj;
function getTop_LayerOj(){

	var S, top;
	if(document.getElementById){
		S = document.getElementById(this.id).style.top;
        	top = eval(S.replace(/px/, "")*1);
	}
	else if(!document.getElementById && document.all){
		S = document.all(this.id).style.top;
        	top = eval(S.replace(/px/, "")*1);
	}
	return top;
}

//「left」を取得する
LayerOj.prototype.getLeft = getLeft_LayerOj;
function getLeft_LayerOj(){

	var S, left;
	if(document.getElementById){
		S = document.getElementById(this.id).style.left;
        	left = eval(S.replace(/px/, "")*1);
	}
	else if(!document.getElementById && document.all){
		S = document.all(this.id).style.left;
        	left = eval(S.replace(/px/, "")*1);
	}
	return left;
}

//「height」を取得する
LayerOj.prototype.getHeight = getHeight_LayerOj;
function getHeight_LayerOj(){

	var S, height;
	if(document.getElementById){
		S = document.getElementById(this.id).style.height;
        	height = eval(S.replace(/px/, "")*1);
	}
	else if(!document.getElementById && document.all){
		S = document.all(this.id).style.height;
        	height = eval(S.replace(/px/, "")*1);
	}
	return height;
}

//「width」を取得する
LayerOj.prototype.getWidth = getWidth_LayerOj;
function getWidth_LayerOj(){

	var S, width;
	if(document.getElementById){
		S = document.getElementById(this.id).style.width;
        	width = eval(S.replace(/px/, "")*1);
	}
	else if(!document.getElementById && document.all){
		S = document.all(this.id).style.width;
        	width = eval(S.replace(/px/, "")*1);
	}
	return width;
}




////////////////////////////////////////////////////////////////////////////////////////
//yysimple2.js Ver 1.02
////////////////////////////////////////////////////////////////////////////////////////
// Ver 1.02 [2002/01/07]コメントの半角文字列系の長さを制限できるようにしました。
// Ver 1.01 [2002/01/06]ちょっぴりNN6.2とIE5でクロスブラウザ＾＾；


//ヘッダ部分のメニューを隠したり出したり用(爆)(返信可能版1.03b〜使用せず)
var Sub_Menu_Flag = 0;
function Sub_Menu2(id, id2){

	if(Sub_Menu_Flag == 0){
		Sub_Menu_Flag = 1;
		K = "";
		K2 = "none";
	}
	else{
		Sub_Menu_Flag = 0;
		K = "none";
		K2 = "";
	}

	if(document.getElementById){
        	document.getElementById(id).style.display = K;
        	document.getElementById(id2).style.display = K2;
	}
	else if(document.all){
        	document.all(id).style.display = K;
        	document.all(id2).style.display = K2;
	}
}

//日付部分に各情報を出力する
function CH(id, s){
	if(document.getElementById){
        	document.getElementById(id).innerHTML = "<span class='Res_Date'>" +s+ "</span>";
	}
	else if(document.all){
        	document.all(id).innerHTML = "<span class='Res_Date'>" +s+ "</span>";

	}
}

//プレビューを実行する
function Send2(ch, C1, B1, C2, B2, imgsrc){

	var TEMP, P, myReg, cReg=0;
	Color1 = C1;
	BgColor1 = B1;
	Color2 = C2;
	BgColor2 = B2;

	if(ch == 1){

		P = document.F1.comment2.value;
		if(P != ""){

		//半角，半角スペースのリミット３０で制限・・・タグも関係なし(爆)
		myReg = /[a-zA-Z0-9' '!"#$%&'()=-~^|\`@{}*:+;_?>.<,][a-zA-Z0-9' '!"#$%&'()=-~^|\`@{}*:+;_?>.<,]{30,}/
		if(myReg.test(P)){ 
			alert("半角文字列の長さがリミットを越えました！Σ(￣▽￣;)");
		} else{

			if(!document.all && document.getElementById){

	                	document.getElementById("Comment_1").style.display = "none";
        	        	document.getElementById("Comment_2").style.display = "none";
                		document.getElementById("Comment_3").style.display = "none";
                		document.getElementById("Preview").style.display = "";

				document.F1.comment.value = P;

				document.getElementById("Preview_Comment").innerHTML = P.replace(/\n/g, "<br>");
				TEMP = "<input type=submit value='送信' class='submit' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>　<input type=reset value='修正' class='submit' onClick='Send2(0, Color1, BgColor1, Color2, BgColor2)' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>";
				document.getElementById("Send").innerHTML = TEMP;
			} if(document.all){

	                	document.all("Comment_1").style.display = "none";
        	        	document.all("Comment_2").style.display = "none";
                		document.all("Comment_3").style.display = "none";
                		document.all("Preview").style.display = "";
				document.F1.comment.value = P;
				document.all("Preview_Comment").innerHTML = P.replace(/\n/g, "<br>");
				TEMP = "<input type=submit value='送信' class='submit' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>　<input type=reset value='修正' class='submit' onClick='Send2(0, Color1, BgColor1, Color2, BgColor2)' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>";
				document.all("Send").innerHTML = TEMP;
			}
		}
		}
	}
	else {



			if(!document.all && document.getElementById){

                		document.getElementById("Preview").style.display = "none";
	                	document.getElementById("Comment_1").style.display = "";
        	        	document.getElementById("Comment_2").style.display = "";
                		document.getElementById("Comment_3").style.display = "";

				TEMP = "<div title=\"プレビューモード\" class=\"submit\" onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'><a href=\"JavaScript:Send2(1, Color1, BgColor1, Color2, BgColor2);\">Preview</a></div>";
				document.getElementById("Send").innerHTML = TEMP;
			} if(document.all){

                		document.all("Preview").style.display = "none";
	                	document.all("Comment_1").style.display = "";
        	        	document.all("Comment_2").style.display = "";
                		document.all("Comment_3").style.display = "";

				TEMP = "<div title=\"プレビューモード\" class=\"submit\" onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'><a href=\"JavaScript:Send2(1, Color1, BgColor1, Color2, BgColor2);\">Preview</a></div>";
				document.all("Send").innerHTML = TEMP;
			}
	}
}
//プレビューを実行する
var Send_P;
function Send(ch, C1, B1, C2, B2, imgsrc){

	var TEMP, P, myReg, cReg=0;
	Color1 = C1;
	BgColor1 = B1;
	Color2 = C2;
	BgColor2 = B2;

	if(ch == 1){

		P = document.F1.comment2.value;
		Send_P = document.F1.comment2.value;
 
		if(P != ""){

		//半角，半角スペースのリミット３０で制限・・・タグも関係なし(爆)
		myReg = /[a-zA-Z0-9' '!"#$%&'()=-~^|\`@{}*:+;_?>.<,][a-zA-Z0-9' '!"#$%&'()=-~^|\`@{}*:+;_?>.<,]{30,}/
		if(myReg.test(P)){ 
			alert("半角文字列の長さがリミットを越えました！Σ(￣▽￣;)");
		} else{

			if(document.getElementById){

	                	document.getElementById("Comment_1").style.display = "none";
        	        	document.getElementById("Comment_2").style.display = "none";
                		document.getElementById("Comment_3").style.display = "none";
                		document.getElementById("Preview").style.display = "";

				document.F1.comment.value = P;

				document.getElementById("Preview_Comment").innerHTML = P.replace(/\n/g, "<br>");
				TEMP = "<input type=submit value='送信' class='submit' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>　<input type=reset value='修正' class='submit' onClick='Send2(0, Color1, BgColor1, Color2, BgColor2)' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>";

                		document.getElementById("Send111").style.display = "none";
				document.getElementById("Send222").style.visibility = "visible";

			} else if(document.all){

	                	document.all("Comment_1").style.display = "none";
        	        	document.all("Comment_2").style.display = "none";
                		document.all("Comment_3").style.display = "none";
                		document.all("Preview").style.display = "";
				document.F1.comment.value = P;
				document.all("Preview_Comment").innerHTML = P.replace(/\n/g, "<br>");
				TEMP = "<input type=submit value='送信' class='submit' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>　<input type=reset value='修正' class='submit' onClick='Send2(0, Color1, BgColor1, Color2, BgColor2)' onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'>";

                		document.all("Send111").style.display = "none";
				document.all("Send222").style.visibility = "visible";
			}
		}
		}
	}
	else {

			if(document.getElementById){

                		document.getElementById("Preview").style.display = "none";
	                	document.getElementById("Comment_1").style.display = "";
        	        	document.getElementById("Comment_2").style.display = "";
                		document.getElementById("Comment_3").style.display = "";

				//TEMP = "<div title=\"プレビューモード\" class=\"submit\" onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'><a href=\"JavaScript:Send2(1, Color1, BgColor1, Color2, BgColor2);\">Preview</a></div>";
				//document.getElementById("Send").innerHTML = TEMP;

                		document.getElementById("Send111").style.display = "";
			document.F1.comment2.value = Send_P;
				document.getElementById("Send222").style.visibility = "hidden";

			} else if(document.all){

                		document.all("Preview").style.display = "none";
	                	document.all("Comment_1").style.display = "";
        	        	document.all("Comment_2").style.display = "";
                		document.all("Comment_3").style.display = "";

				//TEMP = "<div title=\"プレビューモード\" class=\"submit\" onmouseover='this.style.color=Color1; this.style.backgroundColor=BgColor1;' onmouseout='this.style.color=Color2; this.style.backgroundColor=BgColor2;'><a href=\"JavaScript:Send2(1, Color1, BgColor1, Color2, BgColor2);\">Preview</a></div>";
				//document.all("Send").innerHTML = TEMP;

                		document.all("Send111").style.display = "";
			document.F1.comment2.value = Send_P;
				document.all("Send222").style.visibility = "hidden";
			}
	}
}

//セレクトのcolorを取得反映
function SelectColorSet(id, color){
	if(document.getElementById){
		document.getElementById(id).style.color = color;
	} else if(document.all) {
		document.all(id).style.color = color;
	}
}
