if (typeof Nicovideo == 'undefined') {
	Nicovideo = new Object();
}
if (typeof Nicovideo.Global == 'undefined') {
	Nicovideo.Global = {
		playerCount: 0
	};
}

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

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.width       = width  || '485';
	this.height      = height || '385';
};
Nicovideo.MiniPlayer.prototype = {
	defaultAttributes: {},
	defaultParameters: {
		allowScriptAccess: 'always',
		allowFullScreen: 'true',
		bgcolor: '#000000',
		quality: 'high'
	},


	_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;
	},
	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;
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
			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 += ' />';
		} else {
			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>';
		}

		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++);
	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);
				}
			}
		});
	});
}


(function () {
	var b = true;
	try {
		var w = window.parent, self = window.self;
		while (w && w != self) {
			if (w.location.host != self.location.host) {
				b = false;
				break;
			}
			if (w === w.parent) break;
			w = w.parent;
		}
	} catch (e) {
		b = false;
	}

	if (!b) {
		Nicovideo = undefined;
		document.write(
			'<p><a href="http://www.nicovideo.jp/watch/sm5335851" target="_blank">\u3010\u4ecf\u5177\u3067\u3011\u3066\u3063\u3066\u3063\u3066\u30fc\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011\u4fee\u6b63\u30fb\u8ffd\u52a0\u7248</a></p>'
		);
		return;
	}

	var video = new Nicovideo.Video({
		v: 'sm5335851'
	,	id: 'sm5335851'
	,	title: '\u3010\u4ecf\u5177\u3067\u3011\u3066\u3063\u3066\u3063\u3066\u30fc\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011\u4fee\u6b63\u30fb\u8ffd\u52a0\u7248'
	,	description: '\u6cd5\u8981\u306e\u5f85\u3061\u6642\u9593\u306b\u4fee\u6b63\u2192\u97f3\u30ba\u30ec\u306f\u89e3\u6d88\u3057\u307e\u3057\u305f\u304c\u3001\u4e16\u9593\u306e\u30cb\u30fc\u30ba\u304b\u3089\u8457\u3057\u304f\u30ba\u30ec\u3066\u308b\u611f\u306f\u5426\u3081\u307e\u305b\u3093\u3002\u6728\u9b5a\u5927\u30fb\u9285\u947c\u30fb\u91d1\u78ec\uff08\u304d\u3093\u3051\u3044\uff09\u3092\u8ffd\u52a0\u3002\u4ecf\u6559\u8b1b\u5ea7\u3000mylist\/21033758\u3000\u4ecf\u5177\u30b7\u30ea\u30fc\u30ba\u3000mylist\/9397467 20\u4e07\u56de\u5fcc\u3001\u8996\u8074\u8005\u306a\u3089\u3073\u306bAA\u8077\u4eba\u3055\u3093\u306b\u6df1\u304f\u611f\u8b1d\uff01m(_ _)m\u3088\u3082\u3084\u672a\u3060\u306b\u4f38\u3073\u308b\u3068\u306f\u601d\u3063\u3066\u304a\u308a\u307e\u305b\u306a\u3093\u3060\uff01\u3061\u3087\u3063\u3068\u306e\u9593\u8131\u529b\u3057\u3066\u8cb0\u3048\u308c\u3070\u5e78\u3044\u3067\u3059\u30d7\u30ed\u3068\u3044\u3046\u304b\u3001\u80a9\u66f8\u304d\u306f\u73fe\u5bfa\u9662\u306e\u4e8c\u5341\u4e94\u4ee3\u4f4f\u8077\u30fb\u963f\u95cd\u68a8\u30fb\u5927\u50e7\u90fd\u3067\u3057\u3066\u4fee\u884c\u3057\u305f\u7d50\u679c\u304c\u3053\u308c\u3060\u3088\uff01\u3086\u3063\u304f\u308a\u6210\u4ecf\u3057\u640d\u306a\u3063\u305f\u306d\uff01\u3068\u8a00\u3063\u305f\u611f\u3058\u3067\u3057\u3087\u3046\u304b\u2026\u6bce\u6642\u30fb\u30c7\u30a4\u30ea\u30fc\u3082\u6a5f\u80fd\u7f8eP\u3068\u540c\u6642\u671f\u3067\u2192nm5340491\u3001\u591a\u751f\u306e\u7e01\u3060\u306a\u3041\u3068\u3002\u6240\u611f\u30fb\u820e\u5229\u79ae\u6587\u89e3\u8aac\u30fb\u5fa1\u793c\u306a\u3069\u306f\u30b5\u30a4\u30c8\u306e\u65b9\u306b\u2192http:\/\/bouzumekuri.jugem.cc\/?eid=194'
	,	thumbnail: 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=5335851'
	,	postedAt: new Date('2008\/11\/23 22:53:43 +0900')
	,	length: 94
	,	viewCount: 362906
	,	mylistCount: 7801
	,	commentCount: 8512
	,	movieType: 'flv'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1329211954.0.7wHlZKkK9GQ3_om02dJbxYP3biI...'
	,'playerTimestamp': '1328754876'
	,'player_version_xml': '1328857541'
	,'player_info_xml': '1328854461'
	,'v': 'sm5335851'
	,'videoId': 'sm5335851'
	,'thumbTitle': '\u3010\u4ecf\u5177\u3067\u3011\u3066\u3063\u3066\u3063\u3066\u30fc\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011\u4fee\u6b63\u30fb\u8ffd\u52a0\u7248'
	,'thumbDescription': '\u6cd5\u8981\u306e\u5f85\u3061\u6642\u9593\u306b\u4fee\u6b63\u2192\u97f3\u30ba\u30ec\u306f\u89e3\u6d88\u3057\u307e\u3057\u305f\u304c\u3001\u4e16\u9593\u306e\u30cb\u30fc\u30ba\u304b\u3089\u8457\u3057\u304f\u30ba\u30ec\u3066\u308b\u611f\u306f\u5426\u3081\u307e\u305b\u3093\u3002\u6728\u9b5a\u5927\u30fb\u9285\u947c\u30fb\u91d1\u78ec\uff08\u304d\u3093\u3051\u3044...'
	,'thumbImage': 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=5335851'
	,'movie_type': 'flv'
	,'wv_id': 'sm5335851'
	,'iee': '1'
	,'category': '\u6f14\u594f\u3057\u3066\u307f\u305f \u30a2\u30a4\u30c9\u30eb\u30de\u30b9\u30bf\u30fc'
	,'categoryGroup': '\u30a2\u30cb\u30e1\u30fb\u30b2\u30fc\u30e0\u30fb\u7d75'
	,'leaf_switch': '2'
	}, '', '');
	player.write();
})();


