/*
_checkReady is derived from Prototype 1.6.1

Copyright (c) 2005-2010 Sam Stephenson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. 
*/
if(!window.__MIXI_PLUGINS__){window.__MIXI_PLUGINS__={_inited:false,_host:{plugins:"plugins.mixi.jp",www:"www.mixi.jp"},_set:function(c,e,d,a){for(var b in e){if(d||typeof c[b]==="undefined"){c[b]=(a?a(e[b]):e[b])}}return c},create:function(c,d){var g=window.__MIXI_PLUGINS__;var b=c?c.split("."):[];for(var a=0,h=b.length;a<h;a++){var e=b[a];var f=g[e];if(!f){f=((d&&a+1==h)?d:{});g[e]=f}g=f}return g},provide:function(c,b,a){var d=window.__MIXI_PLUGINS__;return d._set(d.create(c),b,a)}}}__MIXI_PLUGINS__.provide("Constants",{mixi_xd_swfPath:"static/swf/xdproxy.swf",mixi_xd_proxy_name:"__mixi_xd_proxy",mixi_xd_origin:"__mixi_xd_origin",plugins_xd_proxy_url:"xd_proxy.pl"});__MIXI_PLUGINS__.provide("Util",{isInProxyFrame:function(){return window.location.toString().indexOf(__MIXI_PLUGINS__.Proxy.Fragment._magic)>0}});__MIXI_PLUGINS__.provide("Array",{isArray:function(a){if(!a){return false}return(Object.prototype.toString.apply(a)==="[object Array]"||(!(a instanceof Function)&&typeof a.length=="number"))},forEach:function(a,d){if(!a){return}if(__MIXI_PLUGINS__.Array.isArray(a)){for(var c=0,e=a.length;c<e;c++){d(a[c],c,a)}}else{for(var b in a){if(a.hasOwnProperty(b)){d(a[b],b,a)}}}}});__MIXI_PLUGINS__.provide("String",{trim:function(a){return a.replace(/^\s*|\s*$/g,"")},isBlank:function(a){return !a||(!__MIXI_PLUGINS__.String.trim(a).charAt(0))}});__MIXI_PLUGINS__.provide("",{config:null,init:function(){var a=window.__MIXI_PLUGINS__;if(a._inited){return}a.ready(a._init);a._checkReady();a._inited=true},_init:function(){var c=window.__MIXI_PLUGINS__;var b=c.Encoder.hash();if(b){c.config=c.Encoder.decode(b)}else{c.config={}}c.PluginContainer.initPluginContainerElements();var a=c.PluginContainer.getSpecialProxyUrl();if(c.PluginContainer.needCrossDomainProxy()){c.Proxy.init(function(){c.PluginContainer.tryCreatePlugins()},a)}else{c.PluginContainer.tryCreatePlugins()}},$:function(a){return document.getElementById(a)},$t:function(c,a){if(!c){return undefined}a=a||document;var b=a.getElementsByTagName(c);if(!b||b.length<1){return undefined}return b},getDomain:function(a){var c=window.__MIXI_PLUGINS__;var b=(window.location.protocol=="https:"?"https://":"http://");switch(a){case"plugins":return b+c._host.plugins+"/";case"www":return b+c._host.www+"/"}},guid:function(c){c=(c||"mixi");var a="";for(var b=1;b<=8;b++){a+=(((1+Math.random())*65536)|0).toString(16).substring(1)}return c+a},_onReadyCallbacks:[],_onReady:function(){var b=window.__MIXI_PLUGINS__;b._ready=true;for(var a=0,c=b._onReadyCallbacks.length;a<c;a++){b._onReadyCallbacks[a]()}b._onReadyCallbacks=[]},ready:function(a){var b=window.__MIXI_PLUGINS__;if(b._ready){window.setTimeout(a,10)}else{b._onReadyCallbacks.push(a)}},_checkReady:function(){(function(){var timer;function fireContentLoadedEvent(){if(__MIXI_PLUGINS__._ready){return}if(timer){window.clearTimeout(timer)}if(__MIXI_PLUGINS__._onReady){__MIXI_PLUGINS__._onReady()}}if(__MIXI_PLUGINS__._ready||document.readyState=="complete"){return fireContentLoadedEvent()}function checkReadyState(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",checkReadyState);fireContentLoadedEvent()}}function pollDoScroll(){try{document.documentElement.doScroll("left")}catch(e){timer=setTimeout(pollDoScroll,10);return}fireContentLoadedEvent()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false)}else{document.attachEvent("onreadystatechange",checkReadyState);if(window==top){timer=setTimeout(pollDoScroll,10)}}var oldonload=window.onload;window.onload=function(){fireContentLoadedEvent();if(oldonload){if(typeof oldonload=="string"){eval(oldonload)}else{oldonload()}}}})()},bind:function(){var b=Array.prototype.slice.call(arguments);var c=b.shift(),a=b.shift();return function(){return c.apply(a,b.concat(Array.prototype.slice.call(arguments)))}},_createClass:function(){return function(){this.initialize.apply(this,arguments)}},Class:function(b,a){var d=window.__MIXI_PLUGINS__;if(d._classes[b]){return d._classes[b]}var c=d._createClass();c.prototype=a;d.create(b,c);d._classes[b]=c;return c},subclass:function(c,d,b){var e=window.__MIXI_PLUGINS__;if(e._classes[c]){return e._classes[c]}var a=e.create(d);e._set(b,a.prototype);b._base=a;b._super=function(f){var g=Array.prototype.slice.call(arguments,1);return a.prototype[f].apply(this,g)};return e.Class(c,b)},_classes:{}});__MIXI_PLUGINS__.provide("Encoder",{encode:function(b){var a=[];__MIXI_PLUGINS__.Array.forEach(b,function(d,c){if(d!==null&&typeof d!="undefined"){a.push(encodeURIComponent(c)+"="+encodeURIComponent(d))}});a.sort();return a.join("&")},decode:function(e){if(!e){return null}var a={};var d=e.split("&");var c;for(var b=0,f=d.length;b<f;b++){c=d[b].split("=",2);if(c&&c[0]){a[decodeURIComponent(c[0])]=decodeURIComponent(c[1]||"")}}return a},hash:function(){var a=window.location.toString();if(a.indexOf("#")<1){return undefined}return a.substr(a.indexOf("#")+1)}});__MIXI_PLUGINS__.provide("UserAgent",{ie:function(){var a=window.__MIXI_PLUGINS__;a.UserAgent._init();return a.UserAgent._ie},_inited:false,_init:function(){var mx=window.__MIXI_PLUGINS__;if(mx.UserAgent._inited){return}mx.UserAgent._inited=true;mx.UserAgent._ie=false;
/*@cc_on mx.UserAgent._ie = @_jscript_version; @*/
}});__MIXI_PLUGINS__.provide("Flash",{_minVersions:[[10,0],[9,0,28,0]],_init:false,_callbacks:[],init:function(f){var e=window.__MIXI_PLUGINS__;if(e.Flash._init){return}e.Flash._init=true;var a=e.getDomain("plugins")+e.Constants.mixi_xd_swfPath;var d=!!e.UserAgent.ie();var c=document.body;var b=document.createElement("div");b.style.position="absolute";b.style.top="-10000px";b.style.width=0;b.style.height=0;c.appendChild(b).innerHTML=('<object type="application/x-shockwave-flash" id="'+f+'" '+(d?'name="'+f+'" ':"")+(d?"":'data="'+a+'" ')+(d?'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ':"")+'allowscriptaccess="always"><param name="movie" value="'+a+'"></param><param name="allowscriptaccess" value="always"></param></object>')},_getFlashVersion:function(){var c;try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(f){if(navigator.mimeTypes.length>0){var g="application/x-shockwave-flash";if(navigator.mimeTypes[g].enabledPlugin){var d="Shockwave Flash";c=(navigator.plugins[d+" 2.0"]||navigator.plugins[d]).description}}}var b=[];if(c){var h=c.replace(/\D+/g,",").match(/^,?(.+),?$/)[1].split(",");for(var e=0,a=h.length;e<a;e++){b.push(parseInt(h[e],10))}}return b},hasMinVersion:function(){var g=window.__MIXI_PLUGINS__;if(typeof g.Flash._hasMinVersion==="undefined"){var b=g.Flash._getFlashVersion();majorVersion:for(var e=0,a=g.Flash._minVersions.length;e<a;e++){var f=g.Flash._minVersions[e];if(f[0]!=b[0]){continue}for(var d=1,h=f.length,c=b.length;(d<h&&d<c);d++){if(b[d]<f[d]){g.Flash._hasMinVersion=false;continue majorVersion}else{g.Flash._hasMinVersion=true;if(b[d]>f[d]){break majorVersion}}}}if(typeof g.Flash._hasMinVersion==="undefined"){if(g.Flash._minVersions[0][0]<b[0]){g.Flash._hasMinVersion=true}}}return g.Flash._hasMinVersion},ready:function(a){var b=window.__MIXI_PLUGINS__;if(b.Flash._ready){window.setTimeout(a,10)}else{b.Flash._callbacks.push(a)}},onReady:function(){var b=window.__MIXI_PLUGINS__;b.Flash._ready=true;for(var a=0,c=b.Flash._callbacks.length;a<c;a++){b.Flash._callbacks[a]()}b.Flash._callbacks=[]}});__MIXI_PLUGINS__.provide("Proxy",{_type:null,_callbacks:{},_engine:null,init:function(d,b){var a=false;var c=window.__MIXI_PLUGINS__;if(window.addEventListener&&!window.attachEvent&&window.postMessage){a=true}else{if(window.attachEvent&&window.postMessage){a=true}}if(a){c.Proxy._type="postmessage";c.Proxy._engine=c.Proxy.PostMessage;c.Proxy.PostMessage.init(d)}else{if(c.Flash.hasMinVersion()){c.Proxy._type="flash";c.Proxy._engine=c.Proxy.Flash;c.Proxy.Flash.init(d)}else{var e=false;if(c.Util.isInProxyFrame()){e=true}else{if(c.PluginContainer.isInPluginFrame()){e=!!parent.frames[c.Constants.mixi_xd_proxy_name]}else{e=!!b}}if(e){c.Proxy._type="fragment";c.Proxy._engine=c.Proxy.Fragment;c.Proxy.Fragment.init(d,b)}else{d&&d()}}}},addMessageListener:function(c){var b=window.__MIXI_PLUGINS__;var a=b.guid();b.Proxy._callbacks[a]=c;if(b.Proxy._engine){b.ready(function(){b.Proxy._engine.initListener&&b.Proxy._engine.initListener(a)})}return a},postMessage:function(b,a){var c=window.__MIXI_PLUGINS__;if(!c.Proxy._engine){return}c.ready(function(){if(c.Proxy._engine.send){var d=c.config;b.cb=window.name;c.Proxy._engine.send(b,a)}})},resolveRelation:function(e){var f,d;var a=e.split(".");var b=window;for(var c=0,g=a.length;c<g;c++){f=a[c];if(f==="opener"||f==="parent"||f==="top"){b=b[f]}else{if(d=/^frames\[['"]?([a-zA-Z0-9-_]+)['"]?\]$/.exec(f)){b=b.frames[d[1]]}else{throw new SyntaxError("Malformed id to resolve: "+e+"("+f+")")}}}return b},recv:function(b){var c=window.__MIXI_PLUGINS__;if(typeof b=="string"){try{b=c.Encoder.decode(b)}catch(a){b=undefined}}if(!b){return}if(b.cb){var d=c.Proxy._callbacks[b.cb];d&&d(b)}},PostMessage:{init:function(a){a&&a()},initListener:function(a){var c=window.__MIXI_PLUGINS__;if(!c.Proxy._listenerInited){var b=c.Proxy.PostMessage.onMessage;window.addEventListener?window.addEventListener("message",b,false):window.attachEvent("onmessage",b);c.Proxy._listenerInited=true}},send:function(b,a){var d=window.__MIXI_PLUGINS__;var c=d.Proxy.resolveRelation((a||"parent"));if(c){c.postMessage(d.Encoder.encode(b),"*")}},onMessage:function(a){__MIXI_PLUGINS__.Proxy.recv(a.data)}},Flash:{flashPortName:"__mixi_plugin_proxy_flash",flashElementId:"MxXdComm",thisMovie:function(){var a=window.__MIXI_PLUGINS__;if(a.UserAgent.ie()){return window[a.Proxy.Flash.flashElementId]}else{return document[a.Proxy.Flash.flashElementId]}},init:function(b){var a=window.__MIXI_PLUGINS__;a.Proxy.Flash.callback=b;a.Flash.init(a.Proxy.Flash.flashElementId);a.Flash.ready(function(){b&&b()})},initListener:function(a){var c=window.__MIXI_PLUGINS__;try{c.Proxy.Flash.thisMovie().initListener(a);if(!c.Proxy._listenerInited){c.Proxy.Flash.thisMovie().addMessageListener("__MIXI_PLUGINS__.Proxy.Flash.onMessage",c.Proxy.Flash.flashPortName);c.Proxy._listenerInited=true}}catch(b){}},send:function(b,a){var c=window.__MIXI_PLUGINS__;c.Flash.ready(function(){b.relation=a;c.Proxy.Flash.thisMovie().postMessage(c.Encoder.encode(b),window.name,c.Proxy.Flash.flashPortName)})},onMessage:function(b,a){__MIXI_PLUGINS__.Proxy.recv(b)}},Fragment:{_proxyframe:null,_magic:"__mx_xd_fragment",init:function(g,e){var f=window.__MIXI_PLUGINS__;var b=f.config;if(f.Util.isInProxyFrame()){var d=f.Proxy.Fragment.onMessage;window.addEventListener?window.addEventListener("resize",d,false):window.attachEvent("onresize",d);g&&g()}else{var a=null;if(f.PluginContainer.isInPluginFrame()){var h=parent.frames[f.Constants.mixi_xd_proxy_name];if(h){var c=(h.window.__MIXI_PLUGINS__||h.__MIXI_PLUGINS__);if(c&&c.config){a=c.config[f.Constants.mixi_xd_origin]}}}else{a=f.getDomain("plugins")+f.Constants.plugins_xd_proxy_url}if(a){if(!f.Proxy.Fragment._proxyframe){f.Proxy.Fragment._proxyframe=new f.ProxyFrame(a,function(){g&&g()},e)}else{g&&g()}}}},send:function(b,a){var c=window.__MIXI_PLUGINS__;b.relation=a;if(c.Proxy.Fragment._proxyframe){c.Proxy.Fragment._proxyframe.sendMessage(c.Encoder.encode(b))}},onMessage:function(){var d=window.__MIXI_PLUGINS__;var b=d.Encoder.hash();if(b){var a=d.Encoder.decode(b);var c=d.Proxy.resolveRelation("parent."+(a.relation||"parent"));if(c&&c.__MIXI_PLUGINS__){c.__MIXI_PLUGINS__.Proxy.recv(b)}}}}});__MIXI_PLUGINS__.provide("PluginContainer",{_PLUGIN_ROOT_ID:"__mixi_root__",_PLUGIN_ATTR_PROXY_URL:"proxy-url",_PLUGIN_CONTAINER_TAG_NAME:"div",_PLUGIN_ATTR_PREFIX:"data-",_callbacks:{},_plugins:{},_pluginPages:{},_pluginRoot:null,tryCreatePlugins:function(){var a=window.__MIXI_PLUGINS__;a.Array.forEach(a.PluginContainer._plugins,function(c,b){c.impl.create(c.containers)})},_setPluginContainerElementDefaultStyle:function(a){a.style.display="inline-block";a.style.border="0";return a},initPluginContainerElements:function(){var c=window.__MIXI_PLUGINS__;var a=c.$t(c.PluginContainer._PLUGIN_CONTAINER_TAG_NAME);if(a){var b=c.PluginContainer._plugins;c.Array.forEach(a,function(d){var e=d.getAttribute(c.PluginContainer._PLUGIN_ATTR_PREFIX+"plugins-type");if(typeof e=="string"&&b[e]){b[e].containers.push(c.PluginContainer._setPluginContainerElementDefaultStyle(d))}})}c.PluginContainer._pluginRoot=c.$(c.PluginContainer._PLUGIN_ROOT_ID)},getPluginContainerAttributes:function(c,b,a){if(!a){a={}}if(!c||!b){return a}var d=window.__MIXI_PLUGINS__;d.Array.forEach(c,function(e){a[e]=b.getAttribute(d.PluginContainer._PLUGIN_ATTR_PREFIX+e.replace("_","-"))});return a},getSpecialProxyUrl:function(){var b=window.__MIXI_PLUGINS__;if(b.PluginContainer._pluginRoot==null){return null}var a=b.PluginContainer._pluginRoot.getAttribute(b.PluginContainer._PLUGIN_ATTR_PREFIX+b.PluginContainer._PLUGIN_ATTR_PROXY_URL);return a},needCrossDomainProxy:function(){var b=window.__MIXI_PLUGINS__;var a=false;b.Array.forEach(b.PluginContainer._plugins,function(c){a=a||c.impl.needCrossDomainProxy});return a},isInPluginFrame:function(){var b=window.__MIXI_PLUGINS__;var a=window.location;if(a.host!==__MIXI_PLUGINS__._host.plugins){return false}return !!b.PluginContainer._pluginPages[a.pathname]},regist:function(a){var b=window.__MIXI_PLUGINS__;if(!a||!a.name){throw new Error("plugin null point exception.")}if(b.PluginContainer._plugins[a.name]){return}else{if(!a.create||typeof a.create!="function"){throw new Error("plugin must be have create function.")}}b.PluginContainer._plugins[a.name]={impl:a,containers:[]};if(a.pages){b.Array.forEach(a.pages,function(c){if(typeof c!="string"||c.length<1){return}if(c[0]!=="/"){c="/"+c}b.PluginContainer._pluginPages[c]=true})}}});__MIXI_PLUGINS__.Class("IframeWidget",{_pluginContainerElement:null,_frameElement:null,_frameId:null,_checkAndSetPluginContainerElement:function(a){this._pluginContainerElement=a;if(!this._pluginContainerElement){throw new Error("Can't get plugin container tag!"+window.location.toString())}return this._pluginContainerElement},_formatRectParam:function(a){if(!a){return null}a+="";if(a.match("px$")!="px"){a+="px"}return a},_createFrame:function(l,d){var k=window.__MIXI_PLUGINS__;var f="border:0; overflow:hidden";var m=k.guid();var i=false,n=false;var j;k.PluginContainer._callbacks[m]=function(){if(i&&!n){n=true;l.onload&&l.onload(j.firstChild)}};if(l.width){f+=";width:"+this._formatRectParam(l.width)}if(l.height){f+=";height:"+this._formatRectParam(l.height)}if(l.position){f+=";position:"+l.position}if(l.visibility){f+=";visibility:"+l.visibility}if(l.display){f+=";display:"+l.display}if(l.top){f+=";top:"+this._formatRectParam(l.top)}if(l.left){f+=";left:"+this._formatRectParam(l.left)}f+=";";var h=l.name||k.guid();var g=l.name||h;if(!d){j=this._pluginContainerElement.appendChild(document.createElement("span"))}else{var c=document.createElement("div");var b=c.style;b.position="absolute";b.top="-10000px";b.width=b.height=0;j=this._pluginContainerElement.appendChild(c)}if(document.attachEvent){var a=('<iframe  id="'+h+'" src="'+l.src+'" name="'+g+'" frameborder="0" scrolling="no" allowTransparency="true" style="'+f+'" onload="__MIXI_PLUGINS__.PluginContainer._callbacks.'+m+'()"></iframe>');j.innerHTML=a;i=true}else{var e;e=document.createElement("iframe");e.id=h;e.onload=k.PluginContainer._callbacks[m];e.setAttribute("frameborder","0");e.setAttribute("allowTransparency","true");e.setAttribute("style",f);e.scrolling="no";e.setAttribute("src",l.src);e.name=g;j.appendChild(e);i=true}return h},getFrame:function(a){a=(a||this._frameId);if(!this._frameElement){this._frameElement=document.getElementById(this._frameId)}return this._frameElement}});__MIXI_PLUGINS__.subclass("ProxyFrame","IframeWidget",{_url:null,initialize:function(a,c,d){var f=window.__MIXI_PLUGINS__;var b=a.indexOf("#");if(b>0){a=a.substr(0,b)}a+=((a.indexOf("?")<0?"?":"&")+f.Proxy.Fragment._magic);this._url=a;var e=d||window.location.toString();b=e.indexOf("#");if(b>0){e=e.substr(0,b)}a+="#"+f.Constants.mixi_xd_origin+"="+e;this._checkAndSetPluginContainerElement(document.body);if(!f.$(f.Constants.mixi_xd_proxy_name)){this._createProxyframe(a,c)}else{this._frameId=f.Constants.mixi_xd_proxy_name;c&&c(f.$(f.Constants.mixi_xd_proxy_name))}},_createProxyframe:function(a,b){this._frameId=this._createFrame({src:a,name:__MIXI_PLUGINS__.Constants.mixi_xd_proxy_name,visibility:"hidden",onload:b,width:"30",height:"0"},true)},sendMessage:function(b){var c=this.getFrame();c.src=(this._url+"#"+b);var a=c.style.width;c.style.width=(c.style.width=="100px")?"50px":"100px"}});__MIXI_PLUGINS__.provide("FavoriteConstants",{favorite_button_url:"favorite.pl",favorite_comment_url:"favorite_comment.pl",version:1,layout_vertical:1,layout_horizontal:2});__MIXI_PLUGINS__.provide("FavoriteConstants",{favorite_default_configurations:{small:{button:{width:52,height:15},count:{width:45,height:15,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_horizontal},faces:{width:170,height:30,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_vertical,max:10},face:{width:30,height:30,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_horizontal,spacing:4}},medium:{button:{width:70,height:20},count:{width:65,height:20,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_horizontal},faces:{width:225,height:50,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_vertical,max:10},face:{width:40,height:40,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_horizontal,spacing:5}},large:{button:{width:70,height:20},count:{width:70,height:40,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_vertical},faces:{width:225,height:50,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_vertical,max:10},face:{width:40,height:40,layout:__MIXI_PLUGINS__.FavoriteConstants.layout_horizontal,spacing:5}}}});__MIXI_PLUGINS__.provide("FavoriteUtil",{_clone:function(a){var d=window.__MIXI_PLUGINS__;var c={};for(var b in a){if(typeof a[b]=="object"){c[b]=d.FavoriteUtil._clone(a[b])}else{c[b]=a[b]}}return c},createFavoriteConfig:function(g,d,i,b){var h=window.__MIXI_PLUGINS__;var f=h.FavoriteUtil;var j=h.FavoriteConstants;var c;g=g||"medium";switch(g){case"medium":c=f._clone(j.favorite_default_configurations.medium);break;case"large":c=f._clone(j.favorite_default_configurations.large);break;default:throw new Error("Invalid Parameter!")}if(d!="1"&&!d!="yes"&d!="true"){c.count.width=0;c.count.height=0}if(i!="1"&&!i!="yes"&i!="true"){c.faces.width=0;c.faces.height=0;c.faces.max=0}else{var a=b||c.faces.width;var e=(c.face.width+c.face.spacing);c.faces.max=Math.floor(a/e);c.faces.width=e*c.faces.max}return c}});__MIXI_PLUGINS__.subclass("FavoriteFrame","IframeWidget",{_commentFrame:null,_frameConfig:null,_callbackKey:null,_options:null,initialize:function(a){this._options={};this._checkAndSetPluginContainerElement(a);this._createFavoriteShowframe()},_computeDimension:function(b,a){var c=window.__MIXI_PLUGINS__;switch(a.layout){case c.FavoriteConstants.layout_vertical:b.width=Math.max(b.width,a.width);b.height=b.height+a.height;break;case c.FavoriteConstants.layout_horizontal:b.width=b.width+a.width;b.height=Math.max(b.height,a.height);break}return b},_createFavoriteShowframe:function(){var e=window.__MIXI_PLUGINS__;this._options=e.PluginContainer.getPluginContainerAttributes(["href","service_key","width","show_faces","show_comment","show_count","size"],this._pluginContainerElement,this._options);var d=this._options;if(e.String.isBlank(d.service_key)){throw new Error("Invalid Parameter!")}if(e.String.isBlank(d.href)){d.href=window.location.toString()}var c=e.FavoriteUtil.createFavoriteConfig(d.size,d.show_count,d.show_faces,d.width);var b={width:c.button.width,height:c.button.height};b=this._computeDimension(b,c.count);b=this._computeDimension(b,c.faces);if(d.width){b.width=d.width}var a=e.getDomain("plugins")+e.FavoriteConstants.favorite_button_url;a+="?show_comment_in_frame=1&ver="+e.FavoriteConstants.version;e.Array.forEach(d,e.bind(function(g,f){if(g){a+="&"+f+"="+encodeURIComponent(g)}},this));this._callbackKey=e.Proxy.addMessageListener(e.bind(this.onMessage,this));this._frameConfig=c;this._frameId=this._createFrame({src:a,name:this._callbackKey,width:b.width,height:b.height})},_createCommnetFrame:function(){if(!this._commentFrame){this._commentFrame=new __MIXI_PLUGINS__.CommentFrame(this)}return this._commentFrame},onMessage:function(a){if(!a||!a.act){return}if(a.act==="create"){this._createCommnetFrame()}else{if(this._commentFrame){this._commentFrame.onMessage(a)}}}});__MIXI_PLUGINS__.subclass("CommentFrame","IframeWidget",{_visible:false,_favoriteFrame:null,_commentWidth:400,_commentHeight:221,_interval:1,initialize:function(a){this._favoriteFrame=a;this._checkAndSetPluginContainerElement(document.body);this._createCommentframe(a._callbackKey)},_createCommentframe:function(c){var e=window.__MIXI_PLUGINS__;var d=this._favoriteFrame._options;var b=e.getDomain("plugins")+e.FavoriteConstants.favorite_comment_url;b+="?href="+encodeURIComponent(d.href);b+="&service_key="+d.service_key;b+="#ftcb="+c;var a=e.Proxy.addMessageListener(e.bind(this.onMessage,this));this._frameId=this._createFrame({src:b,name:a,top:"-10000",left:"0",position:"absolute",visibility:"hidden",width:this._commentWidth,height:this._commentHeight})},show:function(a){if(!this._visible){var b=this.getFrame();if(a){b.style.top=a.top+"px";b.style.left=a.left+"px"}this._visible=true;b.style.width=this._commentWidth+"px";b.style.height=this._commentHeight+"px";b.style.display="";b.style.visibility="";b.style["z-index"]="10001"}},hide:function(){if(this._visible){var a=this.getFrame();this._visible=false;a.style.display="none";a.style.width="0px";a.style.height="0px"}},_getWindowSize:function(){var b=document.body;var a=document.documentElement;return{height:Math.max((b.scrollHeight+b.offsetTop),(a.scrollHeight+a.offsetTop),b.clientHeight,a.clientHeight),width:Math.max(b.scrollWidth+b.offsetLeft,a.scrollWidth+a.offsetLeft,b.clientWidth,a.clientWidth)}},onMessage:function(m){if(m.act==="show"){var j=__MIXI_PLUGINS__;var i=this._favoriteFrame.getFrame().getBoundingClientRect();var a=document.documentElement.scrollTop||document.body.scrollTop;var l=document.documentElement.scrollLeft||document.body.scrollLeft;var d=this._favoriteFrame._frameConfig;var f=d.button;var g=0;if(d.count.layout==j.FavoriteConstants.layout_vertical){g=d.count.height}var h=a+i.top+g+f.height+this._interval;var e=l+i.left;var c=this._getWindowSize();if(c.width>this._commentWidth&&c.height>this._commentHeight){if((h+this._commentHeight)>c.height){h-=(f.height+this._commentHeight+2*this._interval);h=Math.max(h,0)}if((e+this._commentWidth)>c.width){e-=(this._commentWidth-f.width);e=Math.max(e,0)}}if(j.UserAgent.ie()&&!window.HTMLCollection){var b=2;h-=b;e-=b}this.show({top:h,left:e})}else{if(m.act=="hide"){this.hide()}else{if(m.act=="size_inited"){var k=parseInt(m.height,10);if(k){this._commentHeight=k}this.getFrame().style.display="none"}}}}});__MIXI_PLUGINS__.PluginContainer.regist({name:"mixi-favorite",pages:[__MIXI_PLUGINS__.FavoriteConstants.favorite_button_url,__MIXI_PLUGINS__.FavoriteConstants.favorite_comment_url],needCrossDomainProxy:true,create:function(a){var b=__MIXI_PLUGINS__;if(!b.PluginContainer.isInPluginFrame()&&!b.Util.isInProxyFrame()){b.Array.forEach(a,function(c,d){new b.FavoriteFrame(c)})}}});__MIXI_PLUGINS__.init();
