if (typeof Nicovideo == 'undefined') {
	Nicovideo = new Object();
}
if (typeof Nicovideo.Global == 'undefined') {
	Nicovideo.Global = {
		players: {},
		playerCount: 0,
		embedMode: "noflash"
	};
	(function () {
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] === "object" && navigator.mimeTypes && navigator.mimeTypes.length) {
			Nicovideo.Global.embedMode = "embed";
		} else if (typeof ActiveXObject !== "undefined") {
			try {
				var ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				if (ax) {
					Nicovideo.Global.embedMode = "object";
				}
			} catch (e) {}
		}
	})();
}

Nicovideo.version = '1.6.1';
Nicovideo.url = 'http://www.nicovideo.jp/';
Nicovideo.playerUrl = 'http://ext.nicovideo.jp/swf/player/thumbwatch.swf?ts=1422498786';

Nicovideo.Video = function (video) {
	if (video) {
		for (var key in video) {
			this[key] = video[key];
		}
	}
};
Nicovideo.Video.prototype = {
	getPlayURL: function () {
		return Nicovideo.url + 'watch/' + encodeURIComponent(this.v);
	},
	getShortTitle: function () {
		return this.title.substring(0, 60) +
			(this.title.length > 60 ? "..." : "");
	},
	getShortDescription: function () {
		return this.description.substring(0, 60) +
			(this.description.length > 60 ? "..." : "");
	}
};

Nicovideo.MiniPlayer = function (video, vars, width, height) {
	this.id          = Nicovideo.MiniPlayer.allocateId(this);
	this.video       = video;
	this.attributes  = {};
	this.parameters  = {};
	this.variables   = vars || {};
	this.listeners   = {};
	this.width = width ? width : '485';
	this.height = height ? height : '385';
	if (window.innerWidth && this.width > window.innerWidth) {
		var scale = (window.innerWidth - 20) / this.width;		if (scale > 0) {
			this.width = this.width * scale;
			this.height = this.height * scale;
		}
	}
};
Nicovideo.MiniPlayer.prototype = {
	defaultAttributes: {},
	defaultParameters: {
		allowScriptAccess: 'always',
		allowFullScreen: 'true',
		bgcolor: '#000000',
		quality: 'high'
	},

	addEventListener: function (type, listener) {
		type = String(type).toLowerCase();
		if (!this.listeners[type]) {
			this.listeners[type] = [];
		}
		this.listeners[type].push(listener);
	},
	removeEventListener: function (type, listener) {
		type = String(type).toLowerCase();
		if (this.listeners[type]) {
			var a = this.listeners[type];
			for (var i = a.length - 1; i >= 0; i--) {
				if (a[i] === listener) {
					a.splice(i, 1);
				}
			}
		}
	},
	fire: function (type, args) {
		type = String(type).toLowerCase();
		if (this.listeners[type]) {
			args = [this].concat(args || []);
			var a = this.listeners[type];
			for (var i = 0, l = a.length; i < l; i++) {
				var v = a[i];
				(typeof v == "string" ? window[v] : v).apply(window, args);
			}
		}
	},

	_merge: function () {
		var o = {};
		for (var i = 0, len = arguments.length; i < len; i++) {
			var arg = arguments[i];
			if (typeof arg != "object") continue;
			for (var key in arg) {
				o[key] = arg[key];
			}
		}
		return o;
	},
	_escape: function (s) {
		return String(s).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
	},
	getHTML: function () {
		var id = this.id,
			video = this.video,
			attrs = this._merge(this.defaultAttributes, this.attributes),
			params = this._merge(this.defaultParameters, this.parameters),
			vars = this.variables;

		var flashvars = [];
		for (var key in vars) {
			flashvars.push(key + '=' + encodeURIComponent(vars[key]));
		}
		params.flashvars = flashvars.join("&");

		var html;
		switch (Nicovideo.Global.embedMode) {
		case "embed":
			html =
				'<embed type="application/x-shockwave-flash"'
				+ ' id="' + id + '"'
				+ ' name="' + id + '"'
				+ ' src="' + Nicovideo.playerUrl + '"'
				+ ' width="' + this.width  + '"'
				+ ' height="' + this.height + '"'
				;
			for (var key in params) {
				html += ' ' + key + '="' + params[key] + '"';
			}
			for (var key in attrs) {
				html += ' ' + key + '="' + attrs[key] + '"';
			}
			html += ' />';
			break;
		case "object":
			html =
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
				+ ' id="' + id + '"'
				+ ' name="' + id + '"'
				+ ' width="' + this.width + '"'
				+ ' height="' + this.height + '"'
				;
			for (var key in attrs) {
				html += ' ' + key + '="' + attrs[key] + '"';
			}
	 		html += '>';
			html += '<param name="movie" value="' + Nicovideo.playerUrl + '" />';
			for (var key in params) {
				html += '<param name="' + key + '" value="' + params[key] + '" />';
			}
			html += '</object>';
			break;
		default:
			html =
				'<div style="'
						+ 'width:' + (this.width === "100%" ? this.width : this.width + "px")
						+ '; height:' + (this.height === "100%" ? this.height : this.height + "px")
						+ '; display:inline-block; background:#000; color:#FFF; margin:0; padding:0; overflow:hidden;">'
				+ '<a href="' + video.getPlayURL() + '" target="_blank" title="' + this._escape(video.title) + '"'
						+ ' style="position:relative; display:inline-block; width:100%; height:100%;">'
					+ '<img src="' + video.thumbnail + '" alt="" style="width:100%; height:100%; border:none;" />';
			if (!video.isDeleted && (this.width === "100%" || this.width >= 240) && (this.height === "100%" || this.height >= 120)) {
				html += '<span style="display:inline-block; position:absolute; left:0; top:0; width:100%; height:100%;'
							+ ' background-image: url(http://res.nimg.jp/img/thumb/nico/play.png); background-repeat: no-repeat; background-position: center center;"></span>';
			}
			html += '</a>'
				+ '</div>';
			break;
		}

		return html;
	},
	write: function (id) {
		if (id === undefined) {
			document.write(this.getHTML());
		} else if (typeof id == "string") {
			var el = document.all ? document.all[id] : document.getElementById(id);
			if (el) el.innerHTML = this.getHTML();
		} else if (id) {
			id.innerHTML = this.getHTML();
		}
	}
};

Nicovideo.MiniPlayer.allocateId = function (player) {
	var id = 'external_nico_' + (Nicovideo.Global.playerCount++);
	Nicovideo.Global.players[id] = player;
	return id;
};

if (document.all && !window.opera) {
	window.attachEvent("onbeforeunload", function () {
		window.attachEvent("onunload", function () {
			for (var i = 0, l = Nicovideo.Global.playerCount; i < l; i++) {
				var id = 'external_nico_' + i, el = document.all ? document.all[id] : document.getElementById(id);
				if (el && el.parentNode) {
					for (var key in el) {
						if (typeof el[key] == 'function')
							el[key] = null;
					}
					el.parentNode.removeChild(el);
				}
			}
		});
	});
}

window.onNicoPlayerReady = function (id) {
	var player = Nicovideo.Global.players[id];
	if (player) player.fire("onReady");
};
window.onNicoPlayerStatus = function (id, newStatus) {
	var player = Nicovideo.Global.players[id];
	if (player) {
		player.fire("onStateChange", [newStatus]);
		if (newStatus == "end") {
			player.fire("onVideoEnd");
		}
	}
};

(function () {

	var video = new Nicovideo.Video({
		v: '1314874685'
	,	id: 'so15483674'
	,	title: 'XBOX360\u300e\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\uff3a\uff5e\u30ab\u30b0\u30e9\uff5e\u300f\u30d5\u30a1\u30fc\u30b9\u30c8\u30fb\u30a4\u30f3\u30d7\u30ec\u30c3\u30b7\u30e7\u30f3\u6620\u50cf'
	,	description: '\u300c\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\u300d\u30b7\u30ea\u30fc\u30ba\u65b0\u7ae0\u3002\u65b0\u305f\u306a\u30a2\u30af\u30b7\u30e7\u30f3\u3002\u65b0\u305f\u306a\u30b2\u30fc\u30e0\u30b7\u30b9\u30c6\u30e0\u3002\u305d\u3057\u3066\u3001\u65b0\u305f\u306a\u30d2\u30ed\u30a4\u30f3\u3002\u30b7\u30ea\u30fc\u30ba\u6700\u9ad8\u306e\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9\u306f\u3068\u3073\u304d\u308a\u30bb\u30af\u30b7\u30fc\u306a\u30d2\u30ed\u30a4\u30f3\u3068\u904e\u6fc0\u306a\u30b0\u30ed\u30c6\u30b9\u30af\u8868\u73fe\u306e\u9032\u5316\u3092\u4fc3\u3057\u3001\u6d17\u7df4\u3055\u308c\u305f\u30b2\u30fc\u30e0\u30b7\u30b9\u30c6\u30e0\u3068\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u3088\u308b\u5feb\u611f\u306f\u904e\u53bb\u6700\u9ad8\u306e\u6ca1\u5165\u611f\u3078\u3068\u6df1\u5316\u3057\u305f\u3002\u3059\u3079\u3066\u304c\u65b0\u3057\u3044\u300c\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9Z \uff5e\u30ab\u30b0\u30e9\uff5e\u300d\u306f\u3001\u5438\u8840\u65cf\u306e\u59c9\u59b9\u3001\u795e\u697d\u3068\u6c99\u4e9c\u4e5f\u304c\u5e2f\u3073\u305f\u6697\u6bba\u4efb\u52d9\u304b\u3089\u59cb\u307e\u308b\u3002\u305d\u306e\u6a19\u7684\u306f\u3001\u304b\u3064\u3066\u306e\u30d2\u30ed\u30a4\u30f3\u5f69\u3068\u54b2\u3067\u3042\u3063\u305f\u2026\u3002XBOX360\u5c02\u7528\u30a2\u30af\u30b7\u30e7\u30f3\u30b2\u30fc\u30e0\u300e\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\uff3a\uff5e\u30ab\u30b0\u30e9\uff5e\u300f\u4eca\u51ac\u767a\u58f2\u4e88\u5b9a\u3000\u4e88\u4fa17,140\u5186\uff08\u7a0e\u8fbc\uff09\u58f0\u306e\u51fa\u6f14\uff1a\u6ca2\u57ce\u307f\u3086\u304d\u3000\u307b\u304b\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\uff3a\u516c\u5f0f\u30b5\u30a4\u30c8\u21d2http:\/\/www.d3p.co.jp\/anez_kaguraCERO\uff1a\uff3a\uff0818\u6b73\u4ee5\u4e0a\u306e\u307f\u5bfe\u8c61\uff09\u203b\u3053\u306e\u52d5\u753b\u3067\u306f18\u6b73\u4ee5\u4e0a\u3092\u5bfe\u8c61\u3068\u3059\u308b\u6620\u50cf\u306f\u542b\u3093\u3067\u304a\u308a\u307e\u305b\u3093\u3002'
	,	thumbnail: 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=15483674'
	,	postedAt: new Date('2011\/09\/01 21:50:00 +0900')
	,	length: 73
	,	viewCount: 123116
	,	mylistCount: 501
	,	commentCount: 765
	,	movieType: 'mp4'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'isNoLogin': '1'
	,'thumbWatch': '1'
	,'thumbPlayKey': '1423072745.1.1.qRWXrzm5ZAmuClaZiTYxV4c8Nw0.aHR0cDovL3d3dy5uaWNvdmlkZW8uanAvd2F0Y2gvMTMxNDg3NDY4NQ==..'
	,'playerTimestamp': '1422858136'
	,'player_version_xml': '1422858134'
	,'player_info_xml': '1418278282'
	,'translation_version_json': '1415685948'
	,'v': '1314874685'
	,'videoId': 'so15483674'
	,'thumbTitle': 'XBOX360\u300e\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\uff3a\uff5e\u30ab\u30b0\u30e9\uff5e\u300f\u30d5\u30a1\u30fc\u30b9\u30c8\u30fb\u30a4\u30f3\u30d7\u30ec\u30c3\u30b7\u30e7\u30f3\u6620\u50cf'
	,'thumbDescription': '\u300c\u304a\u59c9\u30c1\u30e3\u30f3\u30d0\u30e9\u300d\u30b7\u30ea\u30fc\u30ba\u65b0\u7ae0\u3002\u65b0\u305f\u306a\u30a2\u30af\u30b7\u30e7\u30f3\u3002\u65b0\u305f\u306a\u30b2\u30fc\u30e0\u30b7\u30b9\u30c6\u30e0\u3002\u305d\u3057\u3066\u3001\u65b0\u305f\u306a\u30d2\u30ed\u30a4\u30f3\u3002\u30b7\u30ea\u30fc\u30ba\u6700\u9ad8\u306e\u30b0\u30e9\u30d5\u30a3\u30c3...'
	,'thumbImage': 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=15483674'
	,'movie_type': 'mp4'
	,'wv_id': 'so15483674'
	,'language': 'ja-jp'
	,'is_community_thread': '1'
	,'isWide': '1'
	,'noAdSense': '1'
	,'category': '\u30b2\u30fc\u30e0'
	,'categoryGroup': '\u30a2\u30cb\u30e1\u30fb\u30b2\u30fc\u30e0\u30fb\u7d75'
	,'leaf_switch': '1'
	,'accessFromHash': '1422986345:56ba421c802ca606aaab086ec2faca3862ea8f63990a7c2c64b39343ffe4bb66'
	}, '644', '408');
	player.write();
})();

