var g_menu={};g_menu.all_toggle={str:"全て表示",targetclass:".content",hash:"#all"};g_menu.gaiyou_toggle={str:"概要",targetclass:".content_gaiyou",hash:"#gai"};g_menu.index_toggle={str:"目次",targetclass:".content_index",hash:"#ind"};g_menu.hajimeni_toggle={str:"はじめに",targetclass:".content_hajimeni",hash:"#haj"};g_menu.honbun_toggle={str:"本文より",targetclass:".content_honbun",hash:"#hon"};g_menu.information_toggle={str:"information",targetclass:".content_information",hash:"#inf"};g_menu.img_toggle={str:"画像",targetclass:".content_img",hash:"#img"};g_menu.reference_toggle={str:"参考資料",targetclass:".content_reference",hash:"#ref"};g_bm={};g_bm.hatena='<a href="javascript:void window.open(\'http://b.hatena.ne.jp/append?\'+encodeURI(window.location.href));"><img src="img/b_entry.gif" alt="このページをはてなブックマークに追加" title="このページをはてなブックマークに追加" width="16" height="12" /></a>';g_bm.yahoo='<a href="javascript:void window.open(\'http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t=\'+encodeURIComponent(document.title)+\'&u=\'+encodeURIComponent(window.location.href)+\'&opener=bm&ei=UTF-8\',\'popup\',\'width=550px,height=480px,status=1,location=0,resizable=1,scrollbars=0,left=100,top=50\',0);"><img src="http://i.yimg.jp/images/sicons/ybm16.gif" alt="このページをYahoo!ブックマークに登録" title="このページをYahoo!ブックマークに登録" width="16" height="16" /></a>';g_bm.delicious='<a href="http://delicious.com/save" onclick="window.open(\'http://delicious.com/save?v=5&noui&jump=close&url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title), \'delicious\',\'toolbar=no,width=550,height=550\'); return false;"><img src="http://static.delicious.com/img/delicious.small.gif" height="10" width="10" alt="このページをDeliciousに登録" title="このページをDeliciousに登録" /></a>';g_bm.livedoor='<a href="javascript:void window.open(\'http://clip.livedoor.com/redirect?link=\'+encodeURIComponent(window.location.href)+\'&title=\'+encodeURIComponent(document.title));" title="このページをlivedoor クリップに登録"><img src="http://parts.blog.livedoor.jp/img/cmn/clip_16_16_w.gif" width="16" height="16" alt="このページをlivedoor クリップに登録" /></a>';g_bm.buzzurl='<a href="javascript:void window.open(\'http://buzzurl.jp/config/add/confirm?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title));" title="このページをBuzzurlに登録"><img src="http://buzzurl.jp.eimg.jp/static/image/api/icon/add_icon_mini_08.gif" alt="このページをBuzzurlに登録" width="16" height="16"></a>';$(function(){createMenuHtml();initTweetButton();initHoverToggle();initBookmarkButtons();initAnchors();if(location.hash=="#top"){location.hash=null}onHashChanged(location.hash);if(jQuery.browser.msie&&jQuery.browser.version.split(".")[0]=="6"){initMenuFunction();try{document.execCommand("BackgroundImageCache",false,true)}catch(a){}}});function initAnchors(){$('a[href="#top"]').click(function(){scrollTo(0);return false});$('a[href^="#"][href!="#top"]').click(function(){onHashChanged($(this).attr("href"));return false})}function onHashChanged(e){var c=(e=="")?"#gai":e;var d=g_menu;for(var a in g_menu){if(a!="all_toggle"){var b="#"+a.substr(0,3);if(c.indexOf(b)==0){toggle(a);if(c==b){location.hash_match=c}else{scrollTo($(c).offset().top,c)}}}}}function scrollTo(b,a){$("html, body").animate({scrollTop:b},"fast","swing",function(){if(a){location.hash=a}})}function initBookmarkButtons(){var a=$(document.createElement("div"));a.attr("id","bookmarkbuttons");a.append(g_bm.hatena);a.append(g_bm.yahoo);a.append(g_bm.delicious);a.append(g_bm.livedoor);a.append(g_bm.buzzurl);$("#main").prepend(a)}function initHoverToggle(){$(".content_honbun").hover(function(){$(".tweetbox",this).show()},function(){$(".tweetbox",this).hide()});$(".content .tweetbox").hide()}function initMenuFunction(){var a=g_menu;for(var b in a){$("#"+b).click(function(){var c="#"+$(this).attr("href").split("#")[1];onHashChanged(c);return false})}}function toggle(e){var c="all_toggle";var d=g_menu;var b=d[c].targetclass;var a=d[e].targetclass;if(e==c){$(a).show()}else{$(b).not(a).hide();$(a).show()}$("#"+e).addClass("current");$("#menu > li > a").not($("#"+e)).removeClass("current")}function createMenuHtml(){var c=g_menu;var a=$(document.createElement("ul"));a.attr("id","menu");for(var d in c){if(d!="all_toggle"){var b='<li><a id="'+d+'" href="'+c[d]["hash"]+'">'+c[d].str+"</a></li>";a.append(b)}}$("#main").prepend(a)}function initTweetButton(){$("div.content_honbun").each(function(){if($(this).attr("id").indexOf("hon")!=-1){$(this).append('<p class="tweetbox"><span class="tweet"><img src="img/t.png" />Twitter につぶやく</span></p>')}});$(".tweet").bind("click",tweetit)}function tweetit(){var d=$(this).parent().parent().attr("id");var a=location.href.replace(/\#.*$/,"")+"#"+d;var c=$(this).parent().siblings(".data")[0];c=jQuery.trim($(c).text());c=c+" #nakeru";var b="http://api.bit.ly/shorten?version=2.0.1&format=json&";b+="&login="+bitlylogin;b+="&apiKey="+bitlyapikey;b+="&longUrl="+encodeURIComponent(a);$.ajax({type:"GET",url:b,dataType:"jsonp",success:function(e){if(e.results&&e.results[a]){var g="http://twitter.com/?status=";c+=" "+e.results[a].shortUrl;var f=g+encodeURIComponent(c);window.open(f)}}})};