﻿/*----------------------------------------------------------

	suppin.js	by	IkemenHaizin

----------------------------------------------------------*/

var Suppin = {
	
	changeNextSiblingDisplay : function(ele) {
		MJ.Elem.changeDisplay(ele.nextSibling, 'block', 'none');
	},
	
	changeBackLink : function(url, no) {
		var parent = document.getElementById('page_center');
		var new_a = MJ.Elem.create('a', { 'href' : url + 'blog-entry-' + no + '.html' }, '元の記事に戻る');
		parent.removeChild(parent.firstChild);
		parent.appendChild(new_a);
	},
	
	writeEntryMore : function(text) {
		document.write('<span class="entry_more_button" onclick="Suppin.changeNextSiblingDisplay(this);">[記事の続き]</span><div class="entry_more">' + text + '</div>');
	},
	
	writePluginTitle : function(title, align) {
		if (! title.match(/^\s/i)) {
			document.write('<div class="plugin_title" style="text-align:' + align + ';">' + title + '</div>');
		}
	},
	
	writeTitlelistCategory : function(link, name, count, is_parent) {
		if (is_parent) {
			document.write('<h1><a href="' + link + '">' + name + ' (' + count + ')</a></h1>');
		} else {
			document.write('<h2><a href="' + link + '">' + name + ' (' + count + ')</a></h2>');
		}
		document.write('<ul id="titlelist_ul_' + name + '"></ul>');
	},
	
	writeTitlelist : function(title, url, category, year, month, day, hour, min) {
		var ul = document.getElementById('titlelist_ul_' + category);
		var li = ul.appendChild(MJ.Elem.create('li'));
		var h3 = li.appendChild(MJ.Elem.create('h3'));
		var stamp = '[' + year + '年' + month + '月' + day + '日 ' + hour + '時' + min + '分] ';
		var span = h3.appendChild(MJ.Elem.create('span', { 'class' : 'titlelist_stamp'}, stamp));
		var a = h3.appendChild(MJ.Elem.create('a', { 'href' : url }, title));
	}
}