// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (f.author != undefined)
       setCookie('mtcmtauth', f.author.value, now, '/', '', '');
    if (f.email != undefined)
       setCookie('mtcmtmail', f.email.value, now, '/', '', '');
    if (f.url != undefined)
       setCookie('mtcmthome', f.url.value, now, '/', '', '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '/', '');
    deleteCookie('mtcmthome', '/', '');
    deleteCookie('mtcmtauth', '/', '');
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

function hideDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'none';
}

function showDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'block';
}

function showAnonymousForm() {
    showDocumentElement('comments-form');

    captcha_timer = setInterval('delayShowCaptcha()', 1000);

}

var captcha_timer;
function delayShowCaptcha() {
    clearInterval(captcha_timer);
    var div = document.getElementById('comments-open-captcha');
    if (div) {
        div.innerHTML = '<div class="label"><label for="captcha_code">Captcha:</label></div><div class="field"><input type="hidden" name="token" value="nDZX2iC0olT8XVNYsBmTirnJWtZUoh8gOsUoTuRb" /><img src="/mt/mt-comments.cgi/captcha/1/nDZX2iC0olT8XVNYsBmTirnJWtZUoh8gOsUoTuRb" width="150" height="35" /><br /><input name="captcha_code" id="captcha_code" value="" autocomplete="off" /><p>画像の中に見える文字を入力してください。</p></div>';
    }
}


var commenter_name;
var commenter_blog_ids;
var is_preview;
var mtcmtmail;
var mtcmtauth;
var mtcmthome;

function individualArchivesOnLoad(commenter_name) {



    hideDocumentElement('trackbacks-info');



    if (document.comments_form) {
        if (!commenter_name && (document.comments_form.email != undefined) &&
            (mtcmtmail = getCookie("mtcmtmail")))
            document.comments_form.email.value = mtcmtmail;
        if (!commenter_name && (document.comments_form.author != undefined) &&
            (mtcmtauth = getCookie("mtcmtauth")))
            document.comments_form.author.value = mtcmtauth;
        if (document.comments_form.url != undefined &&
            (mtcmthome = getCookie("mtcmthome")))
            document.comments_form.url.value = mtcmthome;
        if (document.comments_form["bakecookie"]) {
            if (mtcmtauth || mtcmthome) {
                document.comments_form.bakecookie.checked = true;
            } else {
                document.comments_form.bakecookie.checked = false;
            }
        }
    }
}

function writeCommenterGreeting(commenter_name, entry_id, blog_id, commenter_id, commenter_url) {

}




function Tategaki(){//右側h1文章の『ー』を『|』に変える。
	tate=new String();
	tate2=new String();
	tatearray=new Array();
	tate=document.getElementById("seo");
	tatearray=tate.innerHTML.split("ー");
	tate2=tatearray.join(" | ");
	strong=document.getElementById("seo");
	strong.innerHTML=tate2;

	ua=navigator.userAgent;
	if(ua.indexOf("Mac")>=0){
		Kuten_mac();
	}else{
		Kuten();
	}
	//alert("**");
}

function Kuten(){//右側h1文章の『。』『、』を『°』『’』に変える。
	kuten=new String();
	kuten2=new String();
	kutenarray=new Array();
	kuten=document.getElementById("seo");
	kutenarray=kuten.innerHTML.split("。");
	kuten2=kutenarray.join("\<span class='kuten'\>"+"&nbsp"+"\<\/span\>");
	strong=document.getElementById("seo");
	strong.innerHTML=kuten2;

	kuten=new String();
	kuten2=new String();
	kutenarray=new Array();
	kuten=document.getElementById("seo");
	kutenarray=kuten.innerHTML.split("、");
	kuten2=kutenarray.join("\<span class='touten'\>"+"&nbsp"+"\<\/span\>");
	strong=document.getElementById("seo");
	strong.innerHTML=kuten2;
}

function Kuten_mac(){//右側h1文章の『。』『、』を『°』『’』に変える（Mac用）。
	kuten=new String();
	kuten2=new String();
	kutenarray=new Array();
	kuten=document.getElementById("seo");
	kutenarray=kuten.innerHTML.split("。");
	kuten2=kutenarray.join("\<span class='kuten_mac'\>"+"&nbsp"+"\<\/span\>");
	strong=document.getElementById("seo");
	strong.innerHTML=kuten2;

	kuten=new String();
	kuten2=new String();
	kutenarray=new Array();
	kuten=document.getElementById("seo");
	kutenarray=kuten.innerHTML.split("、");
	kuten2=kutenarray.join("\<span class='touten_mac'\>"+"&nbsp"+"\<\/span\>");
	strong=document.getElementById("seo");
	strong.innerHTML=kuten2;
}

		  
function Navi(){//画面幅によるmicronaviの位置変更
	
	var c_w=(document.body.clientWidth)/2;
	if(document.body.clientWidth<=800){
		var p=document.getElementById("micronavi");
		p.style.right="90%";
	}else if(document.body.clientWidth>800){
		var p=document.getElementById("micronavi");
		p.style.right=c_w+335+"px";
	}else if(document.documentElement.clientWidth<=760){
		var p=document.getElementById("micronavi");
		p.style.right="90%";
		
	}else if(document.innerWidth<=800){
		var p=document.getElementById("micronavi");
		p.style.right="90%";
		
	}else{
		var p=document.getElementById("micronavi");
		p.style.right="90%";
	}
	setTimeout("Navi()",100);


	/*var c_w=(Math.pow((document.body.clientWidth+40),2)/200000);
	if(document.body.clientWidth<=950){
		var p=document.getElementById("micronavi");
		p.style.left="-2%";		

	}else if(document.body.clientWidth>950){
		var p=document.getElementById("micronavi");
		p.style.left=((c_w/4.2)*c_w)+"%";	
	
	}else if(document.documentElement.clientWidth<=950){
		var p=document.getElementById("micronavi");
		p.style.left="2%";		
		
	}else if(document.innerWidth<=950){
		var p=document.getElementById("micronavi");
		p.style.left="2%";		
		
	}else{
		var p=document.getElementById("micronavi");
		p.style.left="11%";
	}
	setTimeout("Navi()",100);*/
}

var sth=0;var mpi=0;var mpi2=0;var navi_y=0;var dbs2=0;//navi_vertical_move
function IE6_navi(sth){
	var p=document.getElementById("micronavi");
	var dbs=document.body.scrollTop+30;
	var mpi=(Math.floor(dbs-navi_y)/8);

	if((Math.abs(dbs2-dbs))==0){//画面スクロールが止まったらナビを動かす

		if(Math.abs(dbs-navi_y)>0){
			navi_y+=mpi;
			p.style.top=navi_y+"px";
		}else{
			navi_y=dbs;
			mpi=0;
			p.style.top=dbs+"px";
		}
	}
	mpi2=mpi;
	dbs2=dbs;

	setTimeout("IE6_navi(sth)",4);
}


// ロールオーバー
function WinCls(){
        window.close()
                       }

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document;
  if(d.images){ 
  	if(!d.MM_p) d.MM_p=new Array();
    	var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
			for(i=0; i<a.length; i++)
    			if (a[i].indexOf("#")!=0){
					d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
				}
			}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;
  document.MM_sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
	   document.MM_sr[j++]=x;
	   if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}

// 新しい小窓
function w01()
{
window.open("history.html","history","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=600,height=600");
}

function w02()
{
window.open("as.html","appleservice","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=no,width=600,height=600,screenX=200,screenY=200,left=200,top=200");
}

// 小窓閉じる
function wincls(){
        window.close()
}

/* ovプレイメ
preload_img = new Image();
preload_img.src = 'imgs/menubar/home_ov.gif';
preload_img2 = new Image();
preload_img2.src = 'imgs/menubar/news_ov.gif';
*/

//フラッシュ画像を表示する（swf_srcがファイルの名前）
function flash_play(swf_src){
	/*document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'")
	document.write(" codebase='http://www.adobe.com/shockwave/download/download.cgi")
	document.write("?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese'")
	document.write(" width=700 height=600>")
	document.write("<param name=movie value='swf/main.swf'>")
	document.write("<param name=quality value=high>")
	document.write("<param name=menu value=false>")*/

	document.write("<embed src="+swf_src+" quality=high menu=false ")
	document.write(" width=700 height=600")
	document.write(" type='application/x-shockwave-flash' ")
	document.write("pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese'>")
	document.write("</embed>")
	
	//document.write("</object>")
}



// スクロール
var sc_f=34;
var sc_b=35;

function page5Scroll(){
	if(sc_f>0){
		sc_f--;
		scrollBy(0,sc_f);
		setTimeout("page5Scroll()",2);
	}else{
		sc_f=34;
	}
}

function top3Scroll(){
	if(sc_b>3){
		sc_b--;
		scrollBy(0,-sc_b);
		setTimeout("top3Scroll()",2);
	}else{
		sc_b=35;
	}
}

/*function top3Scroll(){
	if(b<36){
		b++;
		scrollBy(0,-b);
		setTimeout("top3Scroll()",3);
	}else{
		b=0;
	}
}*/


function a_Count(){
	
	for(i=6;i>=1;i--){
		document.write('<img src="bcnt.cgi?'+i+'">');
	}
}


