jQuery.noConflict();
jQuery(document).ready(function($) {

	// ソーシャルブックマーク
	$( 'body#common' ).each(function(){
		if ( document.location.protocol == 'https:' ) {
			return false;
		}
		var uri = new Array(
			'hatena	はてな	http://b.hatena.ne.jp/add?mode=confirm&title=%G_TITLE%&url=%G_URI%',
			'delicious	デリシャス	http://del.icio.us/post?url=%G_URI%&title=%G_TITLE%',
//del 20110405			'nifty	ニフティ	http://clip.nifty.com/create?url=%G_URI%&title=%G_TITLE%',
			'livedoor	ライブドア	http://clip.livedoor.com/redirect?link=%G_URI%&title=%G_TITLE%',
			'buzzurl	バザール	http://buzzurl.jp/entry/%G_URI%',
			'yahoo	ヤフー	http://bookmarks.yahoo.co.jp/action/bookmark?t=%G_TITLE%&amp;u=%G_URI%',
			'google	グーグル	http://www.google.com/bookmarks/mark?op=edit&bkmk=%G_URI%&title=%G_TITLE%',
			'twitter	ツイッター	http://twitter.com/?status=%G_TITLE%%20%G_URI%%20%23gnavi',
			''
		);
		uri.pop();
		var page = '<div id="sb" class="sns"><div><ul>';
		$.map( uri, function(obj,idx){
			g_obj = obj.split( /\t/ );
			page += '<li><span><img src="http://img.gnavi.co.jp/COMMON/IMG/sb-' + g_obj[0] + '.png" alt="' + g_obj[1] + '" title ="' + g_obj[1] + '" id ="' + g_obj[0] + '" longdesc="' + g_obj[2] + '" /></span></li>';
		});
		page += '</ul></div></div>';
		$( '#recipe_header>ul.btn').before( page );

		$( 'img', 'div#sb' ).live( 'click', function() {
			var objhref = $( this ).attr( 'longdesc' );
			var objid = $( this ).attr('id');
			var g_uri = ( location.href ).replace( /#.*$/g, '' );
			var g_title = $( 'title' ).html();
			if (objid != 'buzzurl') {
				g_uri = encodeURIComponent( g_uri );
			}
			objhref = objhref.replace( /%G_URI%/g, g_uri ).replace( /%G_TITLE%/g, encodeURIComponent(g_title) );
			window.open( objhref, objid );
			return false;
		});
	});

});

