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

var commenter_name;

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




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



////////// 20071212追加分

function ZoomImage(sImg, sImgClass){
	var aHtmlLines = new Array();
	var iCnt=0;
	var iTmpCnt=0;
	var sNavigator = GetNavigatorName();
	wImg = window.open("", "_brank","width=1020,location=no,directories=no,toolbar=no,scrollbars=yes");
	
	if (sNavigator == "Safari") {
		
		// ウィンドウサイズを取得する
		iWindowHeight = wImg.innerHeight;
		
	} else {
		// ウィンドウサイズを100%とする
		iWindowHeight = "100%";
	}
		
aHtmlLines[0] = '<html><head><title>ZOOM IN</title>';
aHtmlLines[1] = '<meta http-equiv="Content-Type" content="text/html;charset=Shift_JIS" />';
aHtmlLines[2] = '';
aHtmlLines[3] = '</head><body scroll="auto" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">';
aHtmlLines[4] = '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="' + iWindowHeight + '">';
aHtmlLines[5] = '<tr><td align="center" valign="center" width="100%" height="' + iWindowHeight + '">';
aHtmlLines[6] = '<table border="0" cellpadding="0" cellspacing="0"><tr>';
aHtmlLines[7] = '<td align="center" nowrap="nowrap"><a href="javascript:window.close();" title="ウィンドウを閉じる"><img src="' + sImg + '" class="' + sImgClass + '" border="0" /></a></td>';
aHtmlLines[8] = '</tr></table></td></tr></table></body></html>';
	
	for (iCnt = 0; iCnt < 9; iCnt++) {
		wImg.document.write(aHtmlLines[iCnt]);
	}
}


function GetNavigatorName(){
	if (navigator.IBM_HPR) return "HomepageReader";
	
	var aName = "";
	aName = navigator.userAgent.toUpperCase();
	if (aName.indexOf("SAFARI") >= 0) return "Safari";
	if (aName.indexOf("CHIMERA") >= 0) return "Camino";
	
	aName = navigator.appName.toUpperCase();
	if (aName.indexOf("NETSCAPE") >= 0)  return "Netscape";
	if (aName.indexOf("MICROSOFT") >= 0) return "Explorer";
	return "";
}

////////// 20071212追加分ここまで

////////// ムービーポップアップ用
function MoviePopUp(sMv){
	var aHtmlLines = new Array();
	var iCnt=0;
	var iTmpCnt=0;
	var sNavigator = GetNavigatorName();
	wImg = window.open("", "_brank","width=600,location=no,directories=no,toolbar=no,scrollbars=yes");
	
	if (sNavigator == "Safari") {
		
		// ウィンドウサイズを取得する
		iWindowHeight = wImg.innerHeight;
		
	} else {
		// ウィンドウサイズを100%とする
		iWindowHeight = "100%";
	}
		
aHtmlLines[0] = '<html><head><title>MOVIE</title>';
aHtmlLines[1] = '<meta http-equiv="Content-Type" content="text/html;charset=Shift_JIS" />';
aHtmlLines[2] = '';
aHtmlLines[3] = '</head><body scroll="auto" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">';
aHtmlLines[4] = '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="' + iWindowHeight + '">';
aHtmlLines[5] = '<tr><td align="center" valign="center" width="100%" height="' + iWindowHeight + '">';
aHtmlLines[6] = '<table border="0" cellpadding="0" cellspacing="0"><tr>';
aHtmlLines[7] = '<td align="center" nowrap="nowrap"><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="496" height="440" id="dummy_player_large" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://tv.rakuuri.jp/player_large.swf?video_id=48164747/48164747peevee' + sMv + '.flv" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="http://tv.rakuuri.jp/player_large.swf?video_id=48164747/48164747peevee' + sMv + '.flv" quality="high" wmode="transparent" width="496" height="440" name="dummy_player_large" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object><br /><a href="javascript:window.close();" title="ウィンドウを閉じる">ウィンドウを閉じる</a></td>';
aHtmlLines[8] = '</tr></table></td></tr></table></body></html>';
	
	for (iCnt = 0; iCnt < 9; iCnt++) {
		wImg.document.write(aHtmlLines[iCnt]);
	}
}
////////// ムービーポップアップ用ここまで

////////// タグクラウド折りたたみ用
function showHide(entryID, entryLink, htmlObj) {
  extTextDivID = ('Text' + (entryID));
  extLinkDivID = ('Link' + (entryID));
    if( document.getElementById ) {
    if( document.getElementById(extTextDivID).style.display ) {
      if( entryLink != 0 ) {
        document.getElementById(extTextDivID).style.display = "block";
        document.getElementById(extLinkDivID).style.display = "none";
        htmlObj.blur();
      } else { 
        document.getElementById(extTextDivID).style.display = "none";
        document.getElementById(extLinkDivID).style.display = "block";
      }
    } else {
      location.href = entryLink;
      return true;
    }
  } else {
    location.href = entryLink;
    return true;
  }
}
////////// タグクラウド折りたたみ用ここまで





function writeTypeKeyGreeting(commenter_name, entry_id) {

}



