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/sm5802701" target="_blank">\u3010\u30a4\u30ce\u30bb\u30f3\u30b5\u30fc\u3011\u300c\u3042\u306e\u697d\u5668\u300d\u3067\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u6d41\u661f\u7fa4\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011</a></p>'
		);
		return;
	}

	var video = Nicovideo.Video.create({
		v: 'sm5802701'
	,	id: 'sm5802701'
	,	title: '\u3010\u30a4\u30ce\u30bb\u30f3\u30b5\u30fc\u3011\u300c\u3042\u306e\u697d\u5668\u300d\u3067\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u6d41\u661f\u7fa4\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011'
	,	description: '\u3042\u3066\u3076\u308a\u30d5\u30a1\u30a4\u30eb\u914d\u5e03\u4e2d(Innocence\u30d5\u30eb\u4ed6)\u2192http:\/\/marista.up.seesaa.net\/upload\/anogakki.zip\u539f\u66f2sm1826238\u6bbf\u5802\u5165\u308a\u8a18\u5ff5\u306bsm5747161\u306e\u30bd\u30d5\u30c8\u3068\u30da\u30f3\u30bf\u30d6\u3067\u6311\u6226\u3057\u305f\u3088\u30023\u65e5\u7df4\u7fd2\u3057\u305f\u3051\u3069\u3053\u308c\u304c\u9650\u754c(\u00b4\u0434\uff40; \u30ea\u30ba\u30e0\u611f\u3092\u4ed8\u3051\u308b\u306e\u306b\u3082\u3063\u3066\u3053\u3044\u3060\u306d\u3053\u306e\u30bd\u30d5\u30c8\u306f\u30fb\u30fb\u30fb\u4f5c\u8005\u306b\u611f\u8b1d\uff01\u3000\u52d5\u753b\u306f\u30cd\u30bf\u3082\u4f55\u3082\u306a\u3044\u306e\u3067\u30c1\u30e9\u88cf\u7a0b\u5ea6\u306b\u898b\u3066\u3063\u3066\u304f\u3060\u3055\u3044\u3002\u9014\u4e2d\u306e\u30df\u30af\u7d75\u306f3DPV sm5480792 BGM\u306f\u672c\u5bb6sm2959233 \u6d41\u661f\u7fa4\u30ed\u30b4\u306fnc6353 \u30ab\u30fc\u30bd\u30eb\u306fsm4214520\u3088\u308a\u304a\u501f\u308a\u3057\u307e\u3057\u305f(\u30b5\u30e0\u30cd\u306f\u81ea\u4f5c)\u9cf4\u3089\u3057\u3066\u308b\u97f3\u8272\u306fBright Star(SD-80)\u3067\u3059\u3002\u3042\u3066\u3076\u308a\u30d5\u30a1\u30a4\u30eb\u8ffd\u52a0\u66f2\u2192mylist\/10447519(2\/16)\u5404\u7a2e\u30bd\u30d5\u30c8\u306e\u6bd4\u8f03\u8a18\u4e8b\u66f8\u304d\u307e\u3057\u305f\u3002\u904a\u3093\u3067\u307f\u305f\u3044\u65b9\u306e\u53c2\u8003\u306b\u2192http:\/\/marimostudio.seesaa.net\/article\/114369171.html(3\/5)\u65b0\u4f5c\u2192\u300c\u7089\u5fc3\u878d\u89e3\u300dsm6343303\u3000\u7d44\u66f2\u6f14\u594f\u3057\u305f\u65b9\u2192sm6352438'
	,	thumbnail: 'http:\/\/tn-skr2.smilevideo.jp\/smile?i=5802701'
	,	postedAt: new Date('2009\/01\/10 17:39:50 +0900')
	,	length: 856
	,	viewCount: 7539
	,	mylistCount: 141
	,	commentCount: 558
	,	movieType: 'flv'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
		thumbPlayKey: '1258953584.0.fCjOW9KMyWI-IcuetfVxb0m_IyI.'
	,	wv_title: '\u3010\u30a4\u30ce\u30bb\u30f3\u30b5\u30fc\u3011\u300c\u3042\u306e\u697d\u5668\u300d\u3067\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u6d41\u661f\u7fa4\u3010\u6f14\u594f\u3057\u3066\u307f\u305f\u3011'
	,	iee: '1'
	}, '', '');
	player.write();
})();

