if(typeof(window.yj_share_btn)==="undefined"||!yj_share_btn){emma_util={addEvent:function(c,a,b){if(c.addEventListener){c.addEventListener(a,b,false)}else{if(c.attachEvent){c.attachEvent("on"+a,b)}}},cumulativeOffset:function(b){var c=0,a=0;do{c+=b.offsetTop||0;a+=b.offsetLeft||0;b=b.offsetParent}while(b);return{top:c,left:a}},isDefined:function(a){return(typeof(a)==="undefined"||!a)?"":a},isInteger:function(a){return(parseInt(a,10)==a)},clone:function(b){var a=function(){};a.prototype=b;return new a},objGetElement:function(b){for(var a in b){return b[a]}return false}};yj_share_btn={box_obj_list:{},btn_obj_list:{},init:function(){var a=window.yj_share_btn_info;if(a===undefined){a=this.convertCompatibleParam_1_0_2()}else{pop_obj=emma_util.objGetElement(a);if(pop_obj.position===undefined||pop_obj.post_data===undefined){a=this.convertCompatibleParam_1_1_x(a)}}this.box_obj_list=this.createBoxObjList(a);this.btn_obj_list=this.createBtnObjList(a)},convertCompatibleParam_1_1_x:function(c){var a=window;var e={};var d={title:a.yj_share_btn_title,comment:a.yj_share_btn_comment,primary_url:a.yj_share_btn_primary_url,pc_url:a.yj_share_btn_pc_url,mob_url:a.yj_share_btn_mob_url,smp_url:a.yj_share_btn_smp_url,img_url:a.yj_share_btn_img_url};for(var b in c){e[b]={position:c[b],post_data:emma_util.clone(d)}}return e},convertCompatibleParam_1_0_2:function(){var a=window;var c={};var b={title:a.yj_share_btn_title,comment:a.yj_share_btn_comment,primary_url:a.yj_share_btn_primary_url,pc_url:a.yj_share_btn_pc_url,mob_url:a.yj_share_btn_mob_url,smp_url:a.yj_share_btn_smp_url,img_url:a.yj_share_btn_img_url};c.share_button1={position:{type:emma_util.isDefined(a.yj_share_btn_type1),align:emma_util.isDefined(a.yj_share_btn_box_align1),offset_x:emma_util.isDefined(a.yj_share_btn_box_offset_x1),offset_y:emma_util.isDefined(a.yj_share_btn_box_offset_y1)},post_data:b};c.share_button2={position:{type:emma_util.isDefined(a.yj_share_btn_type2),align:emma_util.isDefined(a.yj_share_btn_box_align2),offset_x:emma_util.isDefined(a.yj_share_btn_box_offset_x2),offset_y:emma_util.isDefined(a.yj_share_btn_box_offset_y2)},post_data:b};return c},createBoxObjList:function(b){boxObj={id:"share_button",align:"right",offset_x:0,offset_y:0,request_url:"",init_box:function(e,h){this.id=e;var g=h.position;this.align=(g.align==="left")?"left":"right";this.offset_x=emma_util.isInteger(g.offset_x)?parseInt(g.offset_x):0;this.offset_y=emma_util.isInteger(g.offset_y)?parseInt(g.offset_y):0;var f=h.post_data;this.request_url=yj_share_btn.createRequestURL(f)}};var d={};for(var a in b){var c=b[a];d[a]=emma_util.clone(boxObj);d[a].init_box(a,c)}return d},createBtnObjList:function(d){btnObj={id:"share_button",img_id:"yjPofeeButton",type:1,markup:"",init_btn:function(g,h,f){this.id=g;this.img_id="yjPofeeButton"+f;this.type=(h.position["type"])?h.position["type"]:1;this.markup=this.set_img()},set_img:function(){var f='<img src="http://i.yimg.jp/images/pofee/btn/__BUTTON__ alt="シェアする" id="yjPofeeButton" style="cursor:pointer" />';var h=this.type;var g=(h==1)?'h22_a.gif" width="79" height="22"':(h==2)?'h30_a.gif" width="89" height="30"':(h==3)?'h34_a.gif" width="85" height="34"':(h==4)?'h38_a.gif" width="100" height="38"':(h==5)?'h38_big_a.gif" width="123" height="38"':(h==6)?'h22_c.gif" width="130" height="22"':(h==7)?'h30_c.gif" width="136" height="30"':(h==8)?'h34_c.gif" width="141" height="34"':(h==9)?'h38_c.gif" width="88" height="38"':(h==10)?'h38_big_c.gif" width="209" height="38"':(h==11)?'h22_e.gif" width="130" height="22"':(h==12)?'h30_e.gif" width="136" height="30"':(h==13)?'h34_e.gif" width="141" height="34"':(h==14)?'h38_e.gif" width="88" height="38"':(h==15)?'h38_big_e.gif" width="209" height="38"':(h==16)?'h22_ntxt_c.gif" width="79" height="22"':(h==17)?'h22_ntxt_e.gif" width="79" height="22"':'h38_big_c.gif" width="209" height="38" ';return f.replace("__BUTTON__",g).replace("yjPofeeButton",this.img_id)}};var c=1;var b={};for(var a in d){var e=d[a];b[a]=emma_util.clone(btnObj);b[a].init_btn(a,e,c);c++}return b},createRequestURL:function(c){var a=window;var d={yj_share_btn_src:a.yj_share_btn_src,yj_share_btn_done_url:a.yj_share_btn_done_url,yj_share_btn_mixi_check_key:a.yj_share_btn_mixi_check_key,yj_share_btn_mixi_content_rating:a.yj_share_btn_mixi_content_rating};for(var b in d){d[b]=emma_util.isDefined(d[b]);d[b]=a.encodeURIComponent(d[b])}for(var b in c){c[b]=emma_util.isDefined(c[b]);c[b]=a.encodeURIComponent(c[b])}n=d.yj_share_btn_done_url;d.yj_share_btn_done_url=(n)?n:a.encodeURIComponent(document.URL);n=c.title;c.title=(n)?n:a.encodeURIComponent(document.title);return"http://share.yahoo.co.jp/render/box/?.done="+d.yj_share_btn_done_url+"&.src="+d.yj_share_btn_src+"&title="+c.title+"&comment="+c.comment+"&primary_url="+c.primary_url+"&pc_url="+c.pc_url+"&mob_url="+c.mob_url+"&smp_url="+c.smp_url+"&img_url="+c.img_url+"&mixi_check_key="+d.yj_share_btn_mixi_check_key+"&mixi_content_rating="+d.yj_share_btn_mixi_content_rating},renderButton:function(){document.write('<style type="text/css">@import url(http://i.yimg.jp/images/pofee/css/yj_share_btn_out.css);</style>');for(var a in this.btn_obj_list){var c=this.btn_obj_list[a];var b=document.getElementById(c.id);if(b){b.innerHTML=c.markup}}},renderPofeeBox:function(a){var b=document.createElement("div");b.id="yjPofeeOn";b.style.display="none";b.innerHTML='<div id="yjPofeeBox">    <div id="yjPofeeBoxIn">        <h3 class="yjPofeeH3">            <span class="yjPofeeH3Brd clearfix">                <label>おすすめ情報をみんなにシェアしよう！</label>                <span id="yjPofeeWinClose" title="閉じる">閉じる</span><a href="http://help.yahoo.co.jp/help/jp/common/common-02.html" id="yjPofeeLinkHelp">ヘルプ</a>            </span>        </h3>        <div id="yjPofeeMain">            <div id="yjPofeeContent" >            <iframe id="yjPofeeContentIframe" height="300" frameborder="0" src="'+a+'"></iframe>            </div>         </div>    </div></div>';document.body.appendChild(b);document.getElementById("yjPofeeOn").style.display="block"},initEventHandler:function(){for(key in this.btn_obj_list){var b=this.btn_obj_list[key];var a=document.getElementById(b.img_id);if(a){emma_util.addEvent(a,"click",function(c){var e=c.target||c.srcElement;var d=e.parentNode;while(d.id==""){d=d.parentNode}yj_share_btn.dispatchEvent4PofeeBox(d.id)})}}},dispatchEvent4PofeeBox:function(e){var d=this.btn_obj_list[e];var c=function(){var f=document.getElementById("yjPofeeOn");document.body.removeChild(f)};if(!document.getElementById("yjPofeeOn")){this.renderPofeeBox(this.box_obj_list[d.id].request_url);this.setBoxPos(d.img_id,this.box_obj_list[d.id]);var a=document.getElementById("yjPofeeWinClose");emma_util.addEvent(a,"click",c)}else{if(this.isBoxOwn(d.img_id,this.box_obj_list[d.id])){var b=document.getElementById("yjPofeeOn");document.body.removeChild(b)}else{var b=document.getElementById("yjPofeeOn");document.body.removeChild(b);this.renderPofeeBox(this.box_obj_list[d.id].request_url);this.setBoxPos(d.img_id,this.box_obj_list[d.id]);var a=document.getElementById("yjPofeeWinClose");emma_util.addEvent(a,"click",c)}}},setBoxPos:function(a,c){var d=document.getElementById("yjPofeeBox");var b=this.calcBoxPos(a,c);d.style.top=b.top+"px";d.style.left=b.left+"px"},calcBoxPos:function(c,e){var b=document.getElementById(c);var g=document.getElementById("yjPofeeBox");var f=emma_util.cumulativeOffset(b);var d=f.top+b.offsetHeight+e.offset_y;var a=f.left+e.offset_x;if(e.align==="right"){a+=b.offsetWidth-g.offsetWidth}return{top:d,left:a}},isBoxOwn:function(a,c){var b=this.calcBoxPos(a,c);var d=document.getElementById("yjPofeeBox");b.top+="px";b.left+="px";return(b.top==d.style.top&&b.left==d.style.left)},execute:function(){this.init();this.renderButton();this.initEventHandler()}};yj_share_btn.execute()};
