(function(){function a(){}function c(e,b,j){function g(e){if("function"==typeof b){var g=b.apply(e,f);if(j&&""!=j&&a.isFunction(g))e[j]=g;else throw Error("func returned illegal value");}}if(d[e])return g(d[e]),d[e];for(var h=c,l=e.split("."),k=0;k<l.length;k++)"undefined"===typeof h[l[k]]&&(h[l[k]]={}),h=h[l[k]];d[e]=h;g(h);return h}function b(e,a){for(var b in a)e.hasOwnProperty(b)||(e[b]=a[b]);return e}var d={},f=[a,c,window,document];b(a,{mixin:b,namespace:c,ns:c,extend:function(a,b,c){b.apply(a,
c||[]);var a=a.constructor.prototype,g;for(g in b.prototype)a[g]||(a[g]=b.prototype[g])},inherits:function(a,b,c,g){function d(){this.constructor=c}d.prototype=c.prototype;var d=new d,f;for(f in d)a[f]||(a[f]=d[f]);b.__super__={};for(f in d)b.__super__[f]=d[f];if(!1===b.__super__.hasOwnProperty("contructor"))b.__super__.constructor=d.constructor;$.isArray(g)?b.__super__.constructor.apply(a,g):b.__super__.constructor.apply(a);return a},param:function(a){var b=[],c;for(c in a)b.push(encodeURIComponent(c)+
"="+encodeURIComponent(a[c]));return b.join("&")},isFunction:function(a){return"function"===typeof a},inArray:function(a,b){var c=!1,g;for(g in b)if(a===b[g]){c=!0;break}return c},getFlashPlayerVersion:function(){var a=0;if(navigator.plugins&&navigator.mimeTypes["application/x-shockwave-flash"]){var b=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;b&&(a=parseFloat(b.description.match(/\d+\.\d+/)))}else{try{b=(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")).GetVariable("$version").match(/([0-9]+)/)}catch(c){try{b=
(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").match(/([0-9]+)/)}catch(g){}}b&&(a=parseFloat(b[0]))}6>=a&&(a=0);return a},proxy:function(a,b){return function(){var c=Array.prototype.slice.call(arguments,0);return a.apply(b,c)}}});window.WatchCommon=a})();WatchCommon.ns("log",function(a,c,b,d,f){function e(a){this.userId=f;this.setTargetUserIdBase(this.getDefaultTargetUserIdBase(a))}a.mixin(e.prototype,{WWW_TARGET_USER_ID_BASE:"33691181",DEV_TARGET_USER_ID_BASE:"39751",setUserId:function(a){this.userId=parseInt(a,10)},setTargetUserIdBase:function(a){this.targetUserIdBase=a},getDefaultTargetUserIdBase:function(a){return a?this.DEV_TARGET_USER_ID_BASE:this.WWW_TARGET_USER_ID_BASE}});return e},"LogEnabledCheckerContext");WatchCommon.ns("log",function(a,c,b,d,f){function e(){}var i=b.setTimeout,d={IMG:0,XHR:1};a.mixin(e,{TYPE:d,_type:d.IMG,_queue:[],_path:"api/ria",_filename:"log.gif",_userId:f,_baseUrl:f,_isStarted:!1,_logEnabledCheckerContext:null,_from:f,setFrom:function(b){if(!a.inArray(b,c.log.LogConstants.From))throw Error("WatchCommon.log.Logger: \u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u30ed\u30b0\u306e\u9001\u4fe1\u5143\u3067\u3059\u3002");this._from=b},setUserId:function(a){this._logEnabledCheckerContext.setUserId(a)},
setBaseUrl:function(a){this._baseUrl=a},setLogEnabledCheckerContext:function(a){this._logEnabledCheckerContext=a},start:function(){if(!this._baseUrl)throw Error("can not start. baseUrl not set");if(!this._logEnabledCheckerContext)throw Error("can not start. LogEnabledCheckerContext not set");this._isStarted=!0;for(var a=this._queue,b,c=0,d=a.length;c<d;c++)b=a[c],this.send(b.kind,b.onSend)},send:function(a,b){this._checkKind(a);if(this._isStarted){var c=a.getCheckers();if(!c)throw Error("kind.getCheckers must return array:"+
c);for(var d=0,e=c.length;d<e;d++)if(!c[d].check(this._logEnabledCheckerContext))return;b&&b();var f=this;i(function(){f._sendByIMG(a)},10)}else this._queue.push({kind:a,onSend:b})},_sendByIMG:function(a){(new b.Image).src=this._createUrl(a)},_checkKind:function(a){var b=a.getName(),a=a.getParams();if("string"!==typeof b||0>=b.length)throw Error("illegal parameter: name must be defined");if("undefined"!==typeof a.name)throw Error("illegal parameter: do not use params.name");if("undefined"!==typeof a.t)throw Error("illegal parameter: do not use params.t");
if("undefined"!==typeof a.from)throw Error("illegal parameter: do not use params.from");},_createUrl:function(b){var c=b.getParams();c.name=b.getName();c.t=(new Date).getTime();c.from=this._from;return this._baseUrl+this._path+"/"+this._filename+"?"+a.param(c)}});return e},"Logger");WatchCommon.ns("log",function(){function a(){throw Error("can not instantiate.");}a.Name={USER_ENVIRONMENT_LOG:"UserEnvironmentLog",WATCH_TIME_LOG:"WatchTimeLog",VIDEO_EXPLORER_CONTENT_TYPE_LOG:"VideoExplorerContentTypeLog",TV_CHAN_MENU_CLICK_LOG:"TVChanMenuClickLog",WALL_CHANGE_LOG:"WallChangeLog",WALL_USE_LOG:"WallUseLog",PERFORMANCE_SETTING_LOG:"PerformanceSettingLog",TWITTER_BUTTON_LOG:"TwitterButtonLog",FACEBOOK_BUTTON_LOG:"FacebookButtonLog"};a.From={ZEROWATCH:"zerowatch",HARAJUKU:"harajuku"};
return a},"LogConstants");WatchCommon.ns("log.checker",function(a){function c(){}a.mixin(c.prototype,{check:function(){throw Error("method check must be overrided");}});return c},"AbstractChecker");WatchCommon.ns("log.checker",function(a,c){function b(){a.extend(this,c.log.checker.AbstractChecker,[])}a.mixin(b.prototype,{check:function(){return!1}});return b},"ForceDisableChecker");WatchCommon.ns("log.checker",function(a,c){function b(b,f){a.extend(this,c.log.checker.AbstractChecker,[]);this.division=b;this.noUseBaseId=!0===f}a.mixin(b.prototype,{check:function(a){return this.noUseBaseId?0===a.userId%this.division:a.userId%this.division===a.targetUserIdBase%this.division}});return b},"UserIdBasedChecker");WatchCommon.ns("log.kind",function(a){function c(){}a.mixin(c.prototype,{getName:function(){throw Error("WatchCommon.log.kind.AbstractLogKind: getName\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002");},getParams:function(){throw Error("WatchCommon.log.kind.AbstractLogKind: getParams\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002");},getCheckers:function(){throw Error("getCheckers is not implemented.");}});return c},"AbstractLogKind");WatchCommon.ns("log.kind",function(a,c){function b(d){a.extend(this,c.log.kind.AbstractLogKind,[]);if(!a.inArray(d,b.notifyPage))throw Error("WatchCommon.log.kind.UserEnvironmentLogKind: \u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u30da\u30fc\u30b8\u3067\u3059\u3002");this._notifyPage=d}b.notifyPage={FLASH_PLAYER:"FlashPlayer",INTERNET_EXPLORER:"InternetExplorer",HARAJUKU:"harajuku"};a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.USER_ENVIRONMENT_LOG},getParams:function(){return{page:this._notifyPage,
flashVersion:a.getFlashPlayerVersion()}},getCheckers:function(){return[]}});return b},"UserEnvironmentLogKind");WatchCommon.ns("log.kind",function(a,c,b,d){function f(b,h){a.extend(this,c.log.kind.AbstractLogKind,[]);a.mixin(this,{_logger:h,_currentVideoPlayedAt:null,_currentBackgroundStartAt:d.hasFocus&&d.hasFocus()?null:e(),_videoStartedAt:null,_totalPlayTime:0,_watchVideoId:b,_backgroundTime:0,_ended:!1,_timer:new i(h,this),_indexMap:null,_enabled:!1,_heartbeatList:new j(f.DEFAULT_HEARTBEAT_LIST),_userIdBasedChecker:new c.log.checker.UserIdBasedChecker(f.USER_DIVISION_AMOUNT),_forceDisableChecker:new c.log.checker.ForceDisableChecker,
_sendCount:0})}function e(){return Number(new Date)}function i(a,b){this.logger=a;this.watchTimeLogKind=b;this.spentTime=this.currentInterval=this.startedAt=this.timeoutId=null}function j(a){this.list=a;this.currentIndex=0}a.mixin(f,{USER_DIVISION_AMOUNT:10,DEFAULT_HEARTBEAT_LIST:[1E4,2E4,3E4,3E4,3E4,6E4,6E4,6E4,3E5,12E5,18E5]});a.mixin(f.prototype,{onVideoPlayed:function(){if(null===this._currentVideoPlayedAt)this._currentVideoPlayedAt=e(),this._timer.start()},onVideoStopped:function(){if(null!==
this._currentVideoPlayedAt)this._totalPlayTime+=e()-this._currentVideoPlayedAt,this._currentVideoPlayedAt=null,this._timer.stop()},onVideoStarted:function(){this._videoStartedAt=e();this._send()},onBlur:function(){this._currentBackgroundStartAt=e()},onFocus:function(){if(null!==this._currentBackgroundStartAt)this._backgroundTime+=e()-this._currentBackgroundStartAt,this._currentBackgroundStartAt=null},onVideoEnded:function(a){this._ended=!0;this._send();if(!a)this.onVideoStopped()},onUserActioned:function(){this._lastActionTime=
e()},getName:function(){return c.log.LogConstants.Name.WATCH_TIME_LOG},getParams:function(){return{playtime:this._getPlayTime(),last_action_time:this._getLastActionTime(),watch_id:this._getWatchId(),watch_start_msec:this._getWatchStartMSec(),background_time:this._getBackgroundTime(),has_ended:this._hasEnded()}},getCheckers:function(){return!this._enabled?[this._forceDisableChecker]:[this._userIdBasedChecker]},cleanup:function(){this._send();this._timer.stop()},getNextInterval:function(){return this._heartbeatList.getNext()},
incrementSendCount:function(){this._sendCount++},setHeartBeatList:function(a){this._heartbeatList=new j(a)},getSendCount:function(){return this._sendCount},_getPlayTime:function(){var a=this._totalPlayTime;this._currentVideoPlayedAt&&(a+=e()-this._currentVideoPlayedAt);return a},_getLastActionTime:function(){return this._lastActionTime},_getWatchId:function(){return this._watchVideoId},_getWatchStartMSec:function(){return this._videoStartedAt},_getBackgroundTime:function(){var a=this._backgroundTime;
this._currentBackgroundStartAt&&(a+=e()-this._currentBackgroundStartAt);return a},_hasEnded:function(){return this._ended},_enable:function(){this._enabled=!0},_disable:function(){this._enabled=!1},_send:function(){this._enable();var a=this;this._logger.send(this,function(){a.incrementSendCount()});this._disable()}});a.mixin(i.prototype,{start:function(){var a=0;null===this.spentTime?(a=this.currentInterval=this.watchTimeLogKind.getNextInterval(),this.startedAt=e()):a=this.currentInterval-this.spentTime;
this.spentTime=null;var c=this;this.timeoutId=b.setTimeout(function(){c.onTimerFired()},a)},stop:function(){if(this.timeoutId)b.clearInterval(this.timeoutId),this.timeoutId=null,this.spentTime=e()-this.startedAt},onTimerFired:function(){this.watchTimeLogKind._send();this.start()}});a.mixin(j.prototype,{getNext:function(){var a=this.list[Math.min(this.currentIndex,this.list.length-1)];this.currentIndex++;return a}});return f},"WatchTimeLogKind");WatchCommon.ns("log.kind",function(a,c){function b(a){this.framerate=a.framerate;this.smooth=a.smooth;this.effect=a.effect;this.acceleration=a.acceleration;this._userIdBasedChecker=new c.log.checker.UserIdBasedChecker(b.USER_DIVISION_AMOUNT)}a.mixin(b,{USER_DIVISION_AMOUNT:100});a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.PERFORMANCE_SETTING_LOG},getParams:function(){return{framerate:this.framerate,smooth:this.smooth?1:0,effect:this.effect?1:0,acceleration:this.acceleration?
1:0}},getCheckers:function(){return[this._userIdBasedChecker]}});return b},"PerformanceSettingLogKind");WatchCommon.ns("log.kind",function(a,c){function b(b,f){a.extend(this,c.log.kind.AbstractLogKind,[]);this._checkers=[new c.log.checker.UserIdBasedChecker(100)];this._type=b;this._action=f}b.ACTION={SELECT:"select",NEXT_PLAY:"nextPlay"};a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.VIDEO_EXPLORER_CONTENT_TYPE_LOG},getParams:function(){return{type:this._type,action:this._action}},getCheckers:function(){return this._checkers}});return b},"VideoExplorerContentTypeLogKind");WatchCommon.ns("log.kind",function(a,c){function b(){d=c.log.kind.AbstractLogKind;f=c.log.LogConstants;e=c.log.checker.UserIdBasedChecker;++b.CLICK_NUM;a.extend(this,d,[])}var d,f,e;b.CLICK_NUM=0;a.mixin(b.prototype,{getName:function(){return f.Name.TV_CHAN_MENU_CLICK_LOG},getParams:function(){return{clickNum:b.CLICK_NUM}},getCheckers:function(){return[new e(100)]}});return b},"TVChanMenuClickLogKind");WatchCommon.ns("log.kind",function(a,c){function b(b){a.extend(this,c.log.kind.AbstractLogKind,[]);this._checkers=[new c.log.checker.UserIdBasedChecker(100,!0)];if("number"!==typeof b.prevWallId)throw Error("invalid argument: prevWallId.");if("number"!==typeof b.nextWallId)throw Error("invalid argument: nextWallId.");this._prevWallId=b.prevWallId;this._nextWallId=b.nextWallId}a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.WALL_CHANGE_LOG},getParams:function(){return{next_wall_id:this._nextWallId,
prev_wall_id:this._prevWallId}},getCheckers:function(){return this._checkers}});return b},"WallChangeLogKind");WatchCommon.ns("log.kind",function(a,c){function b(b){a.extend(this,c.log.kind.AbstractLogKind,[]);this._checkers=[new c.log.checker.UserIdBasedChecker(100,!0)];this._wallId=b}a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.WALL_USE_LOG},getParams:function(){return{wall_id:this._wallId}},getCheckers:function(){return this._checkers}});return b},"WallUseLogKind");WatchCommon.ns("log.kind",function(a,c){function b(f){a.inherits(this,b,c.log.kind.AbstractLogKind);var e=!1,i;for(i in d)if(f===d[i]){e=!0;break}if(!e)throw Error("Unexpected referrer value: "+f);this._checkers=[new c.log.checker.UserIdBasedChecker(100)];this.referrer=f}var d={INFO:"INFO",PLAYER:"PLAYER"};b.REFERRER=d;a.mixin(b.prototype,{getParams:function(){return{ref:this.referrer}},getCheckers:function(){return this._checkers}});return b},"AbstractSocialButtonLogKind");WatchCommon.ns("log.kind",function(a,c){function b(c){a.inherits(this,b,d,[c])}var d=c.log.kind.AbstractSocialButtonLogKind;b.REFERRER=d.REFERRER;a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.TWITTER_BUTTON_LOG}});return b},"TwitterButtonLogKind");WatchCommon.ns("log.kind",function(a,c){function b(c){a.inherits(this,b,d,[c])}var d=c.log.kind.AbstractSocialButtonLogKind;b.REFERRER=d.REFERRER;a.mixin(b.prototype,{getName:function(){return c.log.LogConstants.Name.FACEBOOK_BUTTON_LOG}});return b},"FacebookButtonLogKind");
