// 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 randomAdv_up() {
  m = 0, x = 0, y = 0;
  ad  = new Array();
  adv = new Array();
  hit = new Array();

  hit[0] = 1; adv[0] = '<a rel="nofollow" href="http://www.accesstrade.net/at/c.html?rk=01003yfd005mti" target="_blank"><img src="http://www.accesstrade.net/at/r.html?rk=01003yfd005mti" alt="" border="0" /></a>'; //やずや
  hit[1] = 1; adv[1] = '<a rel="nofollow" href="http://www.accesstrade.net/at/c.html?rk=01003rz2005mti" target="_blank"><img src="http://www.accesstrade.net/at/r.html?rk=01003rz2005mti" alt="" border="0" /></a>'; //コープネット生協宅配
  hit[2] = 1; adv[2] = '<a rel="nofollow" href="http://www.accesstrade.net/at/c.html?rk=010035go005mti" target="_blank"><img src="http://www.accesstrade.net/at/r.html?rk=010035go005mti" alt="" border="0" /></a>'; //オーダーサプリ・ドットコム
  hit[3] = 1; adv[3] = '<a rel="nofollow" href="http://px.a8.net/svt/ejp?a8mat=1I90NB+B5ABWQ+1SPQ+HX5B5" target="_blank"><img border="0" width="468" height="60" alt="" src="http://www24.a8.net/svt/bgt?aid=091120007674&amp;wid=008&amp;eno=01&amp;mid=s00000008387003010000&amp;mc=1" /></a><img border="0" width="1" height="1" src="http://www18.a8.net/0.gif?a8mat=1I90NB+B5ABWQ+1SPQ+HX5B5" alt="" />'; //天然醸造玄米もろみ黒酢
  hit[4] = 1; adv[4] = '<a rel="nofollow" href="http://px.a8.net/svt/ejp?a8mat=1I90NB+B6H74A+18D8+TSJ41" target="_blank"><img border="0" width="468" height="60" alt="" src="http://www22.a8.net/svt/bgt?aid=091120007676&amp;wid=008&amp;eno=01&amp;mid=s00000005750005004000&amp;mc=1" /></a><img border="0" width="1" height="1" src="http://www12.a8.net/0.gif?a8mat=1I90NB+B6H74A+18D8+TSJ41" alt="" />'; //モンドセレクション」２年連続金賞もろみ黒酢
  hit[5] = 1; adv[5] = '<a rel="nofollow" href="http://px.a8.net/svt/ejp?a8mat=1I90NB+B5VRII+1PJ0+HWPVL" target="_blank"><img border="0" width="468" height="60" alt="" src="http://www21.a8.net/svt/bgt?aid=091120007675&amp;wid=008&amp;eno=01&amp;mid=s00000007974003008000&amp;mc=1" /></a><img border="0" width="1" height="1" src="http://www10.a8.net/0.gif?a8mat=1I90NB+B5VRII+1PJ0+HWPVL" alt="" />'; //健康紫蘇酢「悠香」
  hit[6] = 1; adv[6] = '<a rel="nofollow" href="http://px.a8.net/svt/ejp?a8mat=1I90NB+B4OWAY+1YLO+5ZU29" target="_blank"><img border="0" width="468" height="60" alt="" src="http://www26.a8.net/svt/bgt?aid=091120007673&amp;wid=008&amp;eno=01&amp;mid=s00000009150001007000&amp;mc=1" /></a><img border="0" width="1" height="1" src="http://www19.a8.net/0.gif?a8mat=1I90NB+B4OWAY+1YLO+5ZU29" alt="" />'; //えがお 自然の力で明るい毎日を

  for(i=0; i<=hit.length - 1; i++) {
    m += hit[i];
  }
  n = Math.floor(Math.random() * m);
  n++;
  for(i=0; i<=hit.length - 1; i++) {
    x = y;
    y += hit[i];
    if(x<n && n<=y) ad = adv[i];
  }
  document.write(ad);
}

function oritatami(id){
	obj=(document.all)?document.all(id):((document.getElementById)?document.getElementById(id):null);
	if(obj)	obj.style.display=(obj.style.display=="none")?"block":"none";
}

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';
}

var commenter_name;

function individualArchivesOnLoad(commenter_name) {
    hideDocumentElement('comments-open');

    hideDocumentElement('trackbacks-info');



    if (document.comments_form) {
        if (document.comments_form.email != undefined &&
            (mtcmtmail = getCookie("mtcmtmail")))
            document.comments_form.email.value = mtcmtmail;
        if (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 (mtcmtauth || mtcmthome) {
            document.comments_form.bakecookie.checked = true;
        } else {
            document.comments_form.bakecookie.checked = false;
        }
    }
}

function writeTypeKeyGreeting(commenter_name, entry_id) {

}


