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/sm10541106" target="_blank">\u4e16\u754c\u540c\u6642\u91d1\u878d\u4fdd\u8b77\u4e3b\u7fa9 \u6e21\u9089\u54f2\u4e5f\u6c0f\u306b\u805e\u304f \u30c1\u30e3\u30f3\u30cd\u30eb\u685c H22\/4 \/27</a></p>'
		);
		return;
	}

	var video = new Nicovideo.Video({
		v: 'sm10541106'
	,	id: 'sm10541106'
	,	title: '\u4e16\u754c\u540c\u6642\u91d1\u878d\u4fdd\u8b77\u4e3b\u7fa9 \u6e21\u9089\u54f2\u4e5f\u6c0f\u306b\u805e\u304f \u30c1\u30e3\u30f3\u30cd\u30eb\u685c H22\/4 \/27'
	,	description: '\u30ea\u30fc\u30de\u30f3\u30b7\u30e7\u30c3\u30af\u306b\u7aef\u3092\u767a\u3057\u3001\u30ae\u30ea\u30b7\u30e3\u5371\u6a5f\u304b\u3089\u6b27\u5dde\u5168\u571f\u306b\u98db\u3073\u706b\u3057\u3064\u3064\u3042\u308b\u4e16\u754c\u91d1\u878d\u5371\u6a5f\u3002\u5404\u56fd\u3068\u3082\u4fdd\u8b77\u4e3b\u7fa9\u306b\u8d70\u308b\u306a\u304b\u3001\u3000\u4e16\u754c\u7d4c\u6e08\u3092\u5e2d\u5dfb\u3057\u3066\u304d\u305f\u30b0\u30ed\u30fc\u30d0\u30eb\u4e3b\u7fa9\u306f\u7d42\u7109\u3092\u8fce\u3048\u308b\u306e\u304b\uff1f\u4eca\u56de\u306f\u300c\u7d4c\u6e08\u8a0e\u8ad6\u300d\u3067\u3082\u304a\u99b4\u67d3\u307f\u306e\u6e21\u9089\u54f2\u4e5f\u6c0f\u3092\u304a\u62db\u304d\u3057\u3001\u3000\u62e1\u5927\u7248\u3067\u7d4c\u6e08\u30fb\u91d1\u878d\u554f\u984c\u3092\u8ad6\u3058\u3066\u3044\u304d\u307e\u3059\u3002\u3000\u3046\uff50\u3057\u305f\u30c1\u30e3\u30f3\u30cd\u30eb\u685c\u95a2\u9023\u2192mylist\/12958032 mylist\/17781722\u516c\u5f0f\u3082\u518d\u751f\u3057\u3088\u3046 \u2192http:\/\/www.youtube.com\/watch?v=2WxMFrafexo\u3000YouTube\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u3042\u308b\u65b9\u306f\u5de6\u306b\u3042\u308b\u300c\u30c1\u30e3\u30f3\u30cd\u30eb\u767b\u9332\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u652f\u63f4 \u2192http:\/\/www.youtube.com\/user\/SakuraSoTV\u4e8c\u5343\u4eba\u59d4\u54e1\u4f1a\u59d4\u54e1\u306f\u6bce\u67081\u53e31\u4e07\u5186\uff06\u53cb\u306e\u4f1a\u306f\u6bce\u67081\u53e32\u5343\u5186\u3067\u652f\u63f4\u3067\u304d\u307e\u3059\u3002\u2192http:\/\/www.ch-sakura.jp\/579.html\u685c\u306e\u756a\u7d44\u304c\u898b\u653e\u984c\u306eSo-TV\u306f\u6708\u984d 3150\u5186 \u2192http:\/\/www.so-tv.jp\/'
	,	thumbnail: 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=10541106'
	,	postedAt: new Date('2010\/04\/29 01:28:24 +0900')
	,	length: 1347
	,	viewCount: 4145
	,	mylistCount: 73
	,	commentCount: 530
	,	movieType: 'mp4'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1329012033.0.8fQFzx9Iqru8sjNbssvlwzAg3rg...'
	,'playerTimestamp': '1328754876'
	,'player_version_xml': '1328857541'
	,'player_info_xml': '1328854461'
	,'v': 'sm10541106'
	,'videoId': 'sm10541106'
	,'thumbTitle': '\u4e16\u754c\u540c\u6642\u91d1\u878d\u4fdd\u8b77\u4e3b\u7fa9 \u6e21\u9089\u54f2\u4e5f\u6c0f\u306b\u805e\u304f \u30c1\u30e3\u30f3\u30cd\u30eb\u685c H22\/4 \/27'
	,'thumbDescription': '\u30ea\u30fc\u30de\u30f3\u30b7\u30e7\u30c3\u30af\u306b\u7aef\u3092\u767a\u3057\u3001\u30ae\u30ea\u30b7\u30e3\u5371\u6a5f\u304b\u3089\u6b27\u5dde\u5168\u571f\u306b\u98db\u3073\u706b\u3057\u3064\u3064\u3042\u308b\u4e16\u754c\u91d1\u878d\u5371\u6a5f\u3002\u5404\u56fd\u3068\u3082\u4fdd\u8b77\u4e3b\u7fa9\u306b\u8d70\u308b\u306a\u304b\u3001\u3000\u4e16\u754c\u7d4c...'
	,'thumbImage': 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=10541106'
	,'movie_type': 'mp4'
	,'wv_id': 'sm10541106'
	,'iee': '1'
	,'category': '\u653f\u6cbb'
	,'categoryGroup': '\u653f\u6cbb'
	,'leaf_switch': '2'
	}, '', '');
	player.write();
})();


