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=1469509651';

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: 'sm26167279'
	,	id: 'sm26167279'
	,	title: '\u3010GUMI\u3011\u30d8\u30ea\u30aa\u30e9\u30a4\u30c8\u3010\u30aa\u30ea\u30b8\u30ca\u30eb\u3011'
	,	description: '\u5275\u9020\u3059\u308b\u4e16\u754c\u306f \u304d\u3063\u3068\u904b\u547d\u3092\u5909\u3048\u308b\u3093\u3060\u25a0\u4f5c\u8a5e\u4f5c\u66f2\uff1a\u308c\u308b\u308a\u308a mylist\/16274546\u3000@rerulili\u25a0\u30de\u30b9\u30bf\u30ea\u30f3\u30b0\uff1a\u304b\u3054\u3081P mylist\/13631314\u25a0\u30a4\u30e9\u30b9\u30c8\uff1a\u516b\u8c37\u30a2\u30c4\u30ad\u25a0\u30ab\u30e9\u30aa\u30b1\u30aa\u30ea\u30b8\u30ca\u30eb\u30ad\u30fc\u3000nc111497\u7537\u6027\u30ad\u30fc\u3000nc111699\u25bc\u30b1\u30eb\u30d9\u30ed\u30b9\u30d6\u30ec\u30a4\u30c9\u3068\u306f\uff1f2015\u5e74\u306e\u5730\u7403\u3092\u821e\u53f0\u3068\u3057\u305f\u3001\u73fe\u4ee3\u30d5\u30a1\u30f3\u30bf\u30b8\u30fc\u30d6\u30e9\u30a6\u30b6RPG\u3002\u4e0d\u6b7b\u306a\u308b\u300c\u30c7\u30a6\u30b9\u30a8\u30af\u30b9\u300d\u306e\u66b4\u8650\u306b\u6652\u3055\u308c\u305f\u4e16\u754c\u3067\u3001\u552f\u4e00\u5f7c\u7b49\u3092\u6bba\u305b\u308b\u8005\u3001\u5730\u7344\u306e\u756a\u72ac\u300c\u30b1\u30eb\u30d9\u30ed\u30b9\u300d\u304c\u76ee\u899a\u3081\u308b\u2026\u2026\uff01\u4eca\u4e8b\u524d\u767b\u9332\u3059\u308b\u3068\u3001\u300c\u541b\u306e\u8003\u3048\u305f\u5fc5\u6bba\u6280\u300d\u304c\u30b2\u30fc\u30e0\u306b\u767b\u5834\u3059\u308b\uff01 \u25bc\u30b1\u30eb\u30d9\u30ed\u30b9\u30d6\u30ec\u30a4\u30c9\u30c1\u30e3\u30f3\u30cd\u30ebhttp:\/\/ch.nicovideo.jp\/t-walker'
	,	thumbnail: 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=26167279.L'
	,	postedAt: new Date('2015\/05\/03 14:00:00 +0900')
	,	length: 277
	,	viewCount: 176323
	,	mylistCount: 4845
	,	commentCount: 1760
	,	movieType: 'mp4'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'fv_transparent': '2'
	,'fv_no_logo': '1'
	,'thumbWatch': '1'
	,'thumbPlayKey': '1475785669.1.1.BZxe40mMBQIxLf7ifG0gkn-FRSM.aHR0cDovL2NoLm5pY292aWRlby5qcC90LXdhbGtlcg==...0'
	,'playerTimestamp': '1474358893'
	,'player_version_xml': '1474358891'
	,'player_info_xml': '1473226121'
	,'translation_version_json': '1473917763'
	,'v': 'sm26167279'
	,'videoId': 'sm26167279'
	,'thumbTitle': '\u3010GUMI\u3011\u30d8\u30ea\u30aa\u30e9\u30a4\u30c8\u3010\u30aa\u30ea\u30b8\u30ca\u30eb\u3011'
	,'thumbDescription': '\u5275\u9020\u3059\u308b\u4e16\u754c\u306f \u304d\u3063\u3068\u904b\u547d\u3092\u5909\u3048\u308b\u3093\u3060\u25a0\u4f5c\u8a5e\u4f5c\u66f2\uff1a\u308c\u308b\u308a\u308a mylist\/16274546\u3000@rerulili\u25a0\u30de\u30b9\u30bf\u30ea...'
	,'thumbTags': 'VOCALOID \u308c\u308b\u308a\u308a GUMI \u30d8\u30ea\u30aa\u30e9\u30a4\u30c8 \u30b1\u30eb\u30d9\u30ed\u30b9\u30d6\u30ec\u30a4\u30c9 \u3055\u3089\u306b\u8a55\u4fa1\u3055\u308c\u308b\u3079\u304d JOYSOUND\u914d\u4fe1\u4e2d VOCALOID\u6bbf\u5802\u5165\u308a \u9ed9\u3063\u3066\u30de\u30a4\u30ea\u30b9'
	,'thumbImage': 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=26167279.L'
	,'movie_type': 'mp4'
	,'wv_id': 'sm26167279'
	,'language': 'ja-jp'
	,'iee': '1'
	,'isWide': '1'
	,'noAdSense': '1'
	,'category': 'VOCALOID'
	,'categoryGroup': '\u30a8\u30f3\u30bf\u30e1\u30fb\u97f3\u697d'
	,'leaf_switch': '2'
	,'accessFromHash': '1475699269:6034be5a6de7f8f6c78008a6495cc49edb799b6ebb9b33f9bbb647ab25306595'
	}, '600', '');
	player.parameters["wmode"] = "opaque";
	player.write();
})();

