
// ■ カテゴリー別色分け
// BaseScript : stroll::blog(http://melrose.jugem.cc/?eid=132)
// Customize : sampling.sys(http://yaplog.jp/material/)
function getCategoryColor(userName) {
var userImages = [
['家族', 'http://sample.main.jp/blog/file/c1.gif'], 
['つぶやく', 'http://sample.main.jp/blog/file/c2.gif'], 
['MTカスタマイズ', 'http://sample.main.jp/blog/file/c3.gif'], 
['かぎ編み', 'http://sample.main.jp/blog/file/c4.gif'],
['レース編み', 'http://sample.main.jp/blog/file/c4.gif'],
['棒編み', 'http://sample.main.jp/blog/file/c4.gif'],
['その他', 'http://sample.main.jp/blog/file/c4.gif'], 
['HTML/CSS', 'http://sample.main.jp/blog/file/c5.gif'],
['JavaScript', 'http://sample.main.jp/blog/file/c5.gif'],
['ヤプログのあれこれ', 'http://sample.main.jp/blog/file/c5.gif'],
['ブログパーツ', 'http://sample.main.jp/blog/file/c6.gif'], 
['掲示板', 'http://sample.main.jp/blog/file/c6.gif']
];


// 上記投稿者名以外に表示する画像のURL
var otherImage = 'http://○○○.jugem.cc/?image=4';

// imgタグに指定する属性
// 例）var addAttribute = 'class="pict" alt="test"';
var addAttribute = 'alt=""';

if ('' == userName) {
if ('' != otherImage) document.write('<img src="'+ otherImage +'" ' + addAttribute + ' />');
return;
}
if (userName.indexOf('</a>') > -1) {
var m = userName.match(/>.+<\/a>/);
if (null != m) userName = m[0].substr(1, m[0].length - 5);
}
for (var i = 0; i < userImages.length; i++) {
if (userImages[i][0] == userName) {
window.document.write('<img src="' + userImages[i][1] + '" ' + addAttribute + ' />');
return;
}
}
if ('' != otherImage) window.document.write('<img src="'+ otherImage +'" ' + addAttribute + ' />');
return;
}



// ■ OpenWin

function openWin1(a) {  return false;
}
var w = window;
function openWin1(a)  {
	if ((w == window) || w.closed) {
		w = open(a, "comments", "width=400,height=400,left=0,top=0,toolbar=no,status=no,location=no,scrollbars=yes,resizable=yes,");
	} else {
		w.focus();
	}
	return(false);
}



// ■ 新着にアイコン

function getNewIcon(up_time) {
	var last_time='10'; //何時間後までアイコンを付けるか
	var new_t='<img border=0 src="http://sample.main.jp/blog/file/new.gif" width=5 height=5>'; //新着用マーク
	var new_f=''; //それ以外

	var today = new Date();
	var et = new Date(up_time);

	if( today.getTime() <= et.setTime(et.getTime() + (last_time * 60 *60 * 1000)) ){
		document.write(new_t);
	}else{
		document.write(new_f);
	}
}



// ■ 追記文章の折りたたみ用スクリプト by小粋空間さん
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 ChFontsize(){

   var val = document.obj.sel.options[document.obj.sel.selectedIndex].value;
      if (val) {
         document.getElementsByTagName('body').item(0).style.fontSize = val;
      }
}


// ■ コメント二重送信チェク　・・・これで良いの？11/8
var flag = false;
function send_check()
{
	if (flag) { return false; }
	flag = true;
	return true;
}


