/*
---------------------------------------------------------
	Coda Popup Bubbles
---------------------------------------------------------
*/
$(function(){$("#header_right_btm").each(function(){var h=10;var g=250;var d=500;var c=null;var f=false;var e=false;var b=$(".trigger",this);var a=$(".rss_popup",this).css("opacity",0);$([b.get(0),a.get(0)]).mouseover(function(){if(c){clearTimeout(c)}if(f||e){return}else{f=true;a.css({top:8,left:590,display:"block"}).animate({left:"-="+h+"px",opacity:1},g,"swing",function(){f=false;e=true})}}).mouseout(function(){if(c){clearTimeout(c)}c=setTimeout(function(){c=null;a.animate({left:"-="+h+"px",opacity:0},g,"swing",function(){e=false;a.css("display","none")})},d)})})});

/*
---------------------------------------------------------
	BgSwitch
---------------------------------------------------------
*/
$(function(){var a=$.cookie("bgstyle");if(a==""){a="black"}if(a=="black"){bgBlack()}else{if(a=="white"){bgWhite()}}});$(function(){$("#bg_white_btn").click(function(){bgWhite()})});$(function(){$("#bg_black_btn").click(function(){bgBlack()})});function bgWhite(){$("#bg_white_btn").addClass("btn_on");$("#bg_black_btn").removeClass("btn_on");$("#wrapper_outer").css("background","#0e0e10 url(/higash/wp-content/themes/higash/img/wrapper_outer_bg_white.gif) center top repeat-y");$("#wrapper_outer").addClass("bg_white");$.cookie("bgstyle","white",{expires:7,path:"/"})}function bgBlack(){$("#bg_black_btn").addClass("btn_on");$("#bg_white_btn").removeClass("btn_on");$("#wrapper_outer").css("background","#0e0e10");$("#wrapper_outer").removeClass("bg_white");$.cookie("bgstyle","black",{expires:7,path:"/"})};

/*
---------------------------------------------------------
	Tabs
---------------------------------------------------------
*/
$(function(){var a=$.cookie("tabs");if(a==""){a="tabs_category"}$("#"+a+" a").click()});

/*
---------------------------------------------------------
	Tooltip
---------------------------------------------------------
*/
$(function(){$("input#author").focus(function(){$("label#label_author").css("display","inline-block")});$("input#author").blur(function(){$("label#label_author").css("display","none")})});$(function(){$("input#name").focus(function(){$("label#label_name").css("display","inline-block")});$("input#name").blur(function(){$("label#label_name").css("display","none")})});$(function(){$("input#email").focus(function(){$("label#label_email").css("display","inline-block")});$("input#email").blur(function(){$("label#label_email").css("display","none")})});$(function(){$("input#url").focus(function(){$("label#label_url").css("display","inline-block")});$("input#url").blur(function(){$("label#label_url").css("display","none")})});

/*
---------------------------------------------------------
	mailAddress
---------------------------------------------------------
*/
function mailAddress(){$(document).ready(function(){coded="J0m4@OJLryO.07l";key="kxtmXnE4gUs63MIF2lVG0KRLzy9wPqhu1cBpDT5dHeajQOiZSWf8CvoY7rbNAJ";shift=coded.length;link="";for(i=0;i<coded.length;i++){if(key.indexOf(coded.charAt(i))==-1){ltr=coded.charAt(i);link+=(ltr)}else{ltr=(key.indexOf(coded.charAt(i))-shift+key.length)%key.length;link+=(key.charAt(ltr))}}var a=document.getElementById("mailaddress");var b="";a.innerHTML='<a rel="nofollow" mailto:'+link+">"+link+"</a>"})};

/*
---------------------------------------------------------
	Banner
---------------------------------------------------------
*/
$(document).ready(function(){$("p.bnr a").attr("rel","nofollow")});

/*
---------------------------------------------------------
  addClass
---------------------------------------------------------
*/
$(document).ready(function(){$("ol.commentlist li:last").addClass("last")});

/*
---------------------------------------------------------
	Tweet
---------------------------------------------------------
*/
(function(a){a.fn.tweet=function(d){var c={username:["higash"],count:1,loading_text:"Loading..."};function b(f){var e=Date.parse(f);var g=(arguments.length>1)?arguments[1]:new Date();var h=parseInt((g.getTime()-e)/1000);if(h<60){return"1 分以内"}else{if(h<120){return"約 1 分前"}else{if(h<(45*60)){return(parseInt(h/60)).toString()+" 分前"}else{if(h<(90*60)){return"約 1 時間前"}else{if(h<(24*60*60)){return"約 "+(parseInt(h/3600)).toString()+" 時間前"}else{if(h<(48*60*60)){return"1 日前"}else{return(parseInt(h/86400)).toString()+" 日前"}}}}}}}if(d){a.extend(c,d)}return this.each(function(){var f=a('<p id="tweet_text">').appendTo(this);a("#tweet_text").hide();var g=a('<p id="tweet_loading">'+c.loading_text+"</p>");if(typeof(c.username)=="string"){c.username=[c.username]}var e="http://search.twitter.com/search.json?q=from:"+c.username.join("%20OR%20from:")+"&rpp="+c.count+"&callback=?";if(c.loading_text){a(this).append(g)}a.getJSON(e,function(h){if(c.loading_text){g.remove()}a.each(h.results,function(k,l){var j=truncate(l.text,36);f.append(j.replace(/(\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&#\?\/.=]+)/gi,'<a rel="nofollow" href="$1" title="$1" target="_blank">$1</a>').replace(/[\@]+([A-Za-z0-9-_]+)/gi,'<a rel="nofollow" href="http://twitter.com/$1" title="$1" target="_blank">@$1</a>').replace(/[&lt;]+[3]/gi,"<span class='heart'>&#x2665;</span>")+'<span id="tweet_link"><a rel="nofollow" href="http://twitter.com/'+l.from_user+"/statuses/"+l.id+'" title="view tweet on twitter" target="_blank">'+b(l.created_at)+"</a></span>");a("#tweet_text").fadeIn("slow")})})})}})(jQuery);