/*
	Rain or Shine Default Script for jQuery
	Copyright(C) 2009 Rain or Shine
	http://surface.ddo.jp
*/

jQuery(function($) {
	insert_blank_icon($);
});

// Add target _blank icon 
function insert_blank_icon($) {
	var icon_tag = '<img src="/wp-content/themes/WP-Blank-E_/images/icons/target_blank.gif" alt="" />';
	var obj = $("a[target='_blank']", ".entry-content p");
	obj.each(function() {
		$(this).html($(this).html() + icon_tag);
	});
};

// repleace more tag
function replace_more_span($) {
	var element = '.entry-content span#more-*';
	var replace = '<script type="text/javascript"><!--'
				+ 'google_ad_client = "pub-3607816143748682";'
				+ '/* 468x60, 作成済み 08/06/07 */'
				+ 'google_ad_slot = "0891429997";'
				+ 'google_ad_width = 468;'
				+ 'google_ad_height = 60;'
				+ '//-->'
				+ '</script>'
				+ '<script type="text/javascript"'
				+ 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'
				+ '</script>';
	$(element).html(replace);
}

(function($) { $(function() {
	var siteurl = 'http://www.rainorshine.asia/';
	var targetClass = '.hotentry';
	$.ajax({
		dataType: "jsonp",
		data: {'sort':'count', 'url':siteurl},
		cache: true,
		url: "http://b.hatena.ne.jp/entrylist/json",
		success: function (data)
		{
			var content = '';
			$.each(data, function(i,item)
				{
					if(item.link != siteurl) {
						content += '<li>';
						content += '<a href="http://b.hatena.ne.jp/entry/' + item.link + '" class="resentHatebu">';
						content += '<img src="http://b.hatena.ne.jp/entry/image/small/' + item.link + '"></a>';
						content += '<a href="' + item.link + '">' + item.title + '</a>';
						content += '</li>';
					}
				}
			);
			$(targetClass).html('<ul>' + content + '</ul>');
		}
	});
}) })(jQuery);

