/*<meta http-equiv="Content-Type" content="text/html;  charset=utf-8">*/
function diaryWrite1(year,month,fullday,day,kinou,title){
myWeekTbl = new Array( "Sun","Mon","Tue","Wed","Thu","Fri","Sat" );
myDate = new Date(year,month-1,day);
myWeek = myDate.getDay();
if(myWeek==0){
	dayKind=" Day_holiday";
}else{
	dayKind="";
}
document.write('<a name="'+day+'"><span style="font-size:1px;"><br></span></a>');
document.write('<table cellspacing=0 cellpadding=0 border=0 width="75%" summary="" class="diary_one_table">');
document.write('	<tr>');
document.write('		<td WIDTH="77"><IMG SRC="images/diary_01.png" WIDTH="77" HEIGHT="74" ALT=""></td>');
document.write('		<td  background="images/diary_ue.png" height="74" style="padding-top : 25px;" class="diary_one_td_width">');
document.write('		</td>');
document.write('		<td WIDTH="77"><IMG SRC="images/diary_02.png" WIDTH="77" HEIGHT="74" ALT=""></td>');
document.write('	</tr>');
document.write('	<tr>');
document.write('		<td  WIDTH="77" background="images/diary_hidari.png"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALT=""></td>');
document.write('		<td style="padding : 0px;" background="images/diary_bg.png">');
document.write('<div class="date_box"><span class="YM">'+year+'/'+month+'</span><span class="week">'+myWeekTbl[myWeek]+'</span><span class="Day'+dayKind+'">'+fullday+'</span></div>');
document.write('<strong class="nikki_title">■'+title+'■</strong><br>');
document.write('			<p style="line-height:150%; margin : 0px 5px 20px 5px; text-align : right; clear:right;">');
document.write('<A HREF="#00" ONMOUSEOVER="changeImages(\'page_up_'+day+'\',\'images/page_up_01-over.png\'); return true;" ONMOUSEOUT="changeImages(\'page_up_'+day+'\', \'images/page_up_01.png\'); return true;" class="nomal"><IMG NAME="page_up_'+day+'" SRC="images/page_up_01.png" WIDTH=100 HEIGHT=20 BORDER=0 ALT="ページ先頭へ" style="margin-right : 5px;" onClick="smoothScrollTop();return false;" ></A>');
document.write('			</p>');
}

function diaryWrite2(date){
day_end = '		</td>';
day_end = day_end + '		<td  WIDTH="77" background="images/diary_migi.png"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALT=""></td>';
day_end = day_end + '	</tr>';
day_end = day_end + '	<tr>';
day_end = day_end + '		<td WIDTH="77"><IMG SRC="images/diary_03.png" WIDTH="77" HEIGHT="74" ALT=""></td>';
day_end = day_end + '		<td  background="images/diary_shita.png" height="74" align="right" style="padding : 10px;">';
day_end = day_end + '		<form name="form'+date+'" action="http://www.finetrick.net/ichamon/mail.php" method="post" style="float:left; margin:0px; margin-left:10px; text-align:left;">';
day_end = day_end + '			<input type="text" size="20" name="message">';
day_end = day_end + '			<input type="submit" value="いちゃもんをつける">';
day_end = day_end + '			<a href="index_f.html#ichamon" style="font-size:80%;">＞…について</a><br clear=all>';
day_end = day_end + '			<div style="position:relative;"><div id="preview" style="background-color:#ffffcc; color:#666666; position:absolute; padding:10px; font-size:85%; width:400px; display:none;"></div></div>';
day_end = day_end + '		</form>';

day_end = day_end + '		<A HREF="#00" onClick="smoothScrollTop();return false;" ><IMG SRC="images/page_up_01.png" WIDTH=100 HEIGHT=20 BORDER=0 ALT="ページ先頭へ" style="margin-right : 5px;"></A><br clear=all>';
day_end = day_end + '		</td><td WIDTH="77"><IMG SRC="images/diary_04.png" WIDTH="77" HEIGHT="74" ALT=""></td>';
day_end = day_end + '	</tr>';
day_end = day_end + '</table>';

document.write(day_end);
}

function diaryWrite3(date){
	finetrickServerDead=0;
	if(finetrickServerDead==0){
		day_end='';
		day_end = day_end + '<div style="position:relative; top:20px; border:1px solid #cccccc; padding:10px; text-align:center; background-color:#ffffff;">';
		day_end = day_end + '		<form name="form'+date+'" action="http://www.finetrick.net/ichamon/mail.php" method="post" style="margin:0px;padding:0px;">';
		day_end = day_end + '<table cellspacing="0" cellpadding="0" align="center"><tr>';
		day_end = day_end + '<td valign="top"><a href="#;" class="honbun send_ichamon_show" style="color:#32A550;" onclick="openSlide(\'openIchamon'+date+'\',210,\'inlineF'+date+'\',\'http://www.finetrick.net/ichamon/open_ichamon.php?date='+date+'\')"><img src="images/open.gif" width="16" height="16" border="0" style="margin:3px; margin-right:5px;"></a></td><td>';
		day_end = day_end + '			<textarea name="message" cols="20" rows="1" style="background-color:#ffffff" onMouseover="this.style.backgroundColor='+"\'"+'#ddffdd'+"\'"+'" onMouseout="this.style.backgroundColor='+"\'"+'#ffffff'+"\'"+'" class="ichamon_input"></textarea>';
		day_end = day_end + '			<label for="'+date+'"><input id="'+date+'" type="checkbox" name="open">公開</label>';
		day_end = day_end + '			<input type="hidden" name="datestamp" value="'+date+'">';
		day_end = day_end + '			<input type="submit" value="いちゃもんをつける">';
		day_end = day_end + '			<a href="about_ichamon.html" title="いちゃもんについて" rel="shadowbox;width=640;height=280;" style="font-size:80%;" class="about_ichamon">＞…について</a><br clear=all>';
		day_end = day_end + '			<iframe src="http://www.finetrick.net/ichamon/open_ichamon.php?date='+date+'&mode=count" id="comment_count_'+date+'" name="comment_countArea_'+date+'" frameborder="0" scrolling="no" style="margin:0px; padding:0px; width:100%; height:15px; border:0px solid #ffffff; overflow:auto;"></iframe>';
		day_end = day_end + '</td></tr><tr><td>';
		day_end = day_end + '			<div style="position:relative; bottom:150px;"><div id="preview" style="height:70px;background-color:#ffffcc; color:#666666; position:absolute; padding:10px; font-size:85%; width:400px; display:none; text-align:left;"></div></div>';
		day_end = day_end + '</td></tr></table>';
		day_end = day_end + '		</form>';
		day_end = day_end + '</div>';
		
		day_end = day_end + '<div id="openIchamon'+date+'" class="open_ichamon"><a href="#;" class="honbun" style="color:#32A550;" onclick="closeSlide(\'openIchamon'+date+'\')"><img src="images/close.gif" width="16" height="16" border="0" style="margin:3px; margin-right:5px;"></a><br>';
		day_end = day_end + '<iframe src="" id="inlineF'+date+'" name="ichamon_iFrame'+date+'" style="width:100%; height:170px; margin:0px; padding:0px; overflow:auto;" frameborder="0"></iframe>';
		day_end = day_end + '</div>';
		
	}else{
		day_end = "";
	}
	day_end = day_end + '		</td>';
	day_end = day_end + '		<td  WIDTH="77" background="images/diary_migi.png"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALT=""></td>';
	day_end = day_end + '	</tr>';
	day_end = day_end + '	<tr>';
	day_end = day_end + '		<td WIDTH="77"><IMG SRC="images/diary_03.png" WIDTH="77" HEIGHT="74" ALT=""></td>';
	day_end = day_end + '		<td  background="images/diary_shita.png" height="74" align="right" style="padding : 5px; border:0px dotted red; vertical-align:top;">';
	day_end = day_end + '		</td>';
	day_end = day_end + '		<td WIDTH="77"><IMG SRC="images/diary_04.png" WIDTH="77" HEIGHT="74" ALT=""></td>';
	day_end = day_end + '	</tr>';
	day_end = day_end + '</table>';
	document.write(day_end);
}

function realtime_preview(){
	//プレビューを表示
	if(document.forms[1].message.value){
		document.getElementById("preview").style.display="block";
		str = document.forms[1].message.value;
		str=str.replace(/</g,"＜");
		str=str.replace(/>/g,"＞");
		str=str.replace(/\n/g,"<br>");
		dispstr="<small style=\"color:red\">プレビュー</small><br>"+str;
		outputLAYER("preview",dispstr);
	}else{
		document.getElementById("preview").style.display="none";
	}

	//入力を監視
	setTimeout("realtime_preview()", 1000);
}

//レイヤー表示関数
function outputLAYER(layName,html){
	if(document.getElementById){        //N6,Moz,IE5,IE6用
	  document.getElementById(layName).innerHTML=html
	
	} else if(document.all){                       //IE4用
	  document.all(layName).innerHTML=html
	
	} else if(document.layers) {                   //NN4用
	   with(document.layers[layName].document){
	     open()
	     write(html)
	     close()
	  }
	}
}

//==================================================
//　　　　　　　　　ロールオーバーステートの設定
//====================================================

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		page_up_01_over = newImage("images/page_up_01-over.png");
		yesterday_01_over = newImage("images/yesterday_01-over.png");
		first_01_over = newImage("images/first_01-over.png");
		preloadFlag = true;
	}
}


//==================================================
//　　　　　　　　　スピーチFlashの書き込み（引数はファイル名）
//====================================================
function iSpeech(file){
	speech_document ="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"200\" height=\"50\" id=\"speech_"+file+"\" align=\"middle\">";
	speech_document =speech_document +"<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	speech_document =speech_document +"<param name=\"movie\" value=\""+file+"\" />";
	speech_document =speech_document +"<param name=\"quality\" value=\"high\" />";
	speech_document =speech_document +"<param name=\"bgcolor\" value=\"#ffffff\" />";
	speech_document =speech_document +"<embed src=\""+file+"\" quality=\"high\" bgcolor=\"#ffffff\" width=\"200\" height=\"50\" name=\"speech_"+file+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
	speech_document =speech_document +"</object>";
	document.write(speech_document);
}
	
//==================================================
//　　　　　　　　　スムーズスクロール
//====================================================
function smoothScrollTop(){
var j = 1;
var sec = 30;
   if(navigator.appName == "Microsoft Internet Explorer" && document.compatMode == "CSS1Compat") {
      var dist = document.body.parentNode.scrollTop;
   } else {
      var dist = document.body.scrollTop;
   }

   if(j<30 && dist) {
      dist = (dist>2) ? Math.ceil(dist*.2) : 1;
      j++;
      
      scrollBy(0,-dist);
      setTimeout("smoothScrollTop()",sec);

   } else {
      scrollTo(0,0);
      j = 1;

   }
}



//==================================================
//　　　　　　　　　いちゃもん開閉
//====================================================
function ichamon_open(open,hide){
	eval(open).style.display='block';
	eval(hide).style.display='none';
}


//==================================================
//　　　　　　　　　公開いちゃもん
//====================================================
startH = 0;//初期height
nowHeight=0;
mSec = 1;	//　展開速度（1秒＝1000）
mSecDefault=mSec;

r = Math.floor(Math.random()*100);

function openSlide(OBJ,h,ifm,URL){
	eval(OBJ).style.display='block';
	moveChar(OBJ,h);
	document.getElementById(ifm).src=URL;
}
function moveChar(OBJ,h){
	startH = startH + 20
	if(startH<h){
		eval(OBJ).style.height=startH;
		setTimeout("moveChar('"+OBJ+"','"+h+"')",mSec);
		mSec=mSec+1;
	}else{
		mSec=mSecDefault;
	}
}

function closeSlide(OBJ){
	startH = startH - 20
	eval(OBJ).style.height = startH;
	if(startH>0){
		setTimeout("closeSlide('"+OBJ+"')",mSec);
		mSec=mSec+1;
	}else{
		eval(OBJ).style.display='none';
		mSec=mSecDefault;
	}
}

