if (typeof Nicovideo == 'undefined') {
	Nicovideo = new Object();
}

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

if (typeof Nicovideo.Video == 'undefined') {
	Nicovideo.Video = function (video) {
		if (video) {
			for (var key in video) {
				this[key] = video[key];
			}
		}
	};
	Nicovideo.Video.create = function (video) {
		if (typeof this.__cache == "undefined") this.__cache = {};
		var v = this.__cache[video.v];
		if (!v) v = this.__cache[video.v] = new this(video);
		return v;
	};
	Nicovideo.Video.prototype = {
		getPlayURL: function () {
			return Nicovideo.url + 'watch/' + 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 ? "..." : "");
		}
	};
}
if (typeof Nicovideo.MiniPlayer == 'undefined') {
	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',
			bgcolor: '#000000',
			quality: 'high'
		},
		defaultVariables: {
			thumbWatch: 1,
			playerTimestamp: '1258606760',
			player_version_xml: '1258608916'
		},


		_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._merge(
					this.defaultVariables,
					{
						v: video.v,
						thumbTitle: video.getShortTitle(),
						thumbDescription: video.getShortDescription(),
						thumbImage: video.thumbnail,
						thumbWidth: this.width,
						thumbHeight: this.height,
						mylist_counter: video.mylistCount.toString()
							.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,"),
						movie_type: video.movieType,
						wv_id: video.id
					},
					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.getElementById(id);
				if (el) el.innerHTML = this.getHTML();
			} else if (id) {
				id.innerHTML = this.getHTML();
			}
		}
	};

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


}

(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/sm2248075" target="_blank">S.P.\u30c0\u30fc\u30de\u306f\u5730\u7344\u304b\u3089\u306e\u4f7f\u8005\u306a\u306e\u304b\uff1f\u6700\u7d42\u9b3c\u755c\u8718\u86db\u7537\u30b9\u30d1\u30a4\uff65D</a></p>'
		);
		return;
	}

	var video = Nicovideo.Video.create({
		v: 'sm2248075'
	,	id: 'sm2248075'
	,	title: 'S.P.\u30c0\u30fc\u30de\u306f\u5730\u7344\u304b\u3089\u306e\u4f7f\u8005\u306a\u306e\u304b\uff1f\u6700\u7d42\u9b3c\u755c\u8718\u86db\u7537\u30b9\u30d1\u30a4\uff65D'
	,	description: '\u904e\u53bb\u306b\u6563\u3063\u3066\u3044\u3063\u305fMAD\u9054\u306e\u30ea\u30b9\u30da\u30af\u30c8\u3068\u3057\u3066\u4f5c\u3063\u305f\u611f\u3082\u3042\u308b\u306e\u3067\u805e\u304d\u899a\u3048\u306e\u3042\u308b\u30d5\u30ec\u30fc\u30ba\u3082\u3042\u308b\u304b\u3068\u3002 \u524a\u9664\u3055\u308c\u308b\u3068\u4f5c\u8005\u81ea\u8eab\u304c\u54bd\u3073\u6ce3\u304f\u306e\u3067\u52d5\u753b\u306f\u304a\u307e\u3051\u3067\u3059\u3002  \u203b6\/20\u300050\u4e07\u518d\u751f\uff65\uff65\uff1f\u4f55\u56de\u3067\u3082\u5b57\u5e55\u3092\u4ed8\u3051\u3066\u304f\u308c\u308b\u8077\u4eba\u306e\u70ba\u306b\u30ef\u30b7\u306f\u5b87\u5b99\u5869\u3092\u5473\u564c\u9c24\u3060\u305e\uff01\u8a31\u305b\u308b\uff01 \u7269\u8a00\u308f\u306c\u6a29\u5229\u8005\u306e\u611b\u306b\u5e0c\u671b\u3092\u898b\u3066\u304a\u308a\u307e\u3059\u3002\u3000 \u30b9\u30de\u30d6\u30e9\u7248\u3092\u4f5c\u3063\u3066\u304f\u308c\u305f\u7537\u3000\uff08sm2467271\uff09 \u6b4c\u3063\u3066\u304f\u308c\u305f\u60c5\u3051\u7121\u7528\u306e\u7537\u9054\uff08sm2328548\uff09\u306f\u3044\u3060\u3089\u6c0f\u3000\u3000\uff08sm2341370\uff09 \u73c8\u7432\u91ce\u90ce\u6c0f    \u307e\u3055\u304b\u306e\u8e0a\u3063\u3066\u307f\u305f\u7537\u3010sm3092144\u3011    7\/2\u3000\u65b0\u4f5c\u3067\u304d\u307e\u3057\u305f\u2192sm3835131 \u3042\u3069\u3051\u306a\u3044\u4f5c\u8005\u306e\u4ed6\u306e\u4f5c\u54c1\u9054\uff08mylist\/1772301\uff09   \u3053\u306e\u52d5\u753b\u306f\u6771\u6620\u682a\u5f0f\u4f1a\u793e\u306e\u6a29\u5229\u3092\u4fb5\u5bb3\u3057\u3066\u3044\u305f\u305f\u3081\u3001\u307e\u305f\u306f\u7533\u3057\u7acb\u3066\u304c\u3042\u3063\u305f\u305f\u3081\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002'
	,	thumbnail: 'http://res.nimg.jp/img/thumb/del_img.jpg'
	,	postedAt: new Date('2008\/02\/06 22:44:43 +0900')
	,	length: 182
	,	viewCount: 528628
	,	mylistCount: 3079
	,	commentCount: 35387
	,	movieType: 'flv'
	,	isDeleted: true	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
		thumbPlayKey: '1258971256.0.ZSyjqdzOSJZXR7K28Abk4VziK04.'
	,	wv_title: 'S.P.\u30c0\u30fc\u30de\u306f\u5730\u7344\u304b\u3089\u306e\u4f7f\u8005\u306a\u306e\u304b\uff1f\u6700\u7d42\u9b3c\u755c\u8718\u86db\u7537\u30b9\u30d1\u30a4\uff65D'
	,	has_owner_thread: '1'
	,	iee: '1'
	}, '485', '386');
	player.write();
})();

