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/sm9491339" target="_blank">\uff12\uff10\uff19\u7cfb\u3055\u3088\u306a\u3089\u904b\u8ee2\u7f75\u58f0\u5927\u4f1a\uff11</a></p>'
		);
		return;
	}

	var video = new Nicovideo.Video({
		v: 'sm9491339'
	,	id: 'sm9491339'
	,	title: '\uff12\uff10\uff19\u7cfb\u3055\u3088\u306a\u3089\u904b\u8ee2\u7f75\u58f0\u5927\u4f1a\uff11'
	,	description: 'Youtube\u304b\u3089\u8ee2\u8f09 \u3053\u306e\u65e5\u306f\u4eac\u6d5c\u6771\u5317\u7dda\u304b\u3089\u300c\uff12\uff10\uff19\u7cfb\u300d\u3068\u547c\u3070\u308c\u308b\u901a\u52e4\u578b\u8eca\u4e21\u304c\u5f15\u9000\u3059\u308b\u65e5\u3002\u30db\u30fc\u30e0\u306e\u4eba\u3060\u304b\u308a\u306f\u3001\u4eac\u6d5c\u6771\u5317\u7dda\u3092\u8d70\u308b\u300c\uff12\uff10\uff19\u7cfb\u300d\u96fb\u8eca\u306e\u6700\u5f8c\u306e\u59ff\u3092\u76ee\u306b\u713c\u304d\u4ed8\u3051\u3001\u96c4\u59ff\u3092\u64ae\u5f71\u3057\u3088\u3046\u3068\u3059\u308b\u9244\u9053\u30d5\u30a1\u30f3\u3060\u3063\u305f\u306e\u3060\u3002\u5225\u308c\u3092\u60dc\u3057\u3080\u30d5\u30a1\u30f3\u306f\u3001\u8eca\u5185\u306b\u3082\u591a\u6570\u4e57\u3063\u3066\u3044\u305f\u3002\u7279\u306b\u5148\u982d\u306e\u8eca\u4e21\u306f\u671d\u306e\u30e9\u30c3\u30b7\u30e5\u6642\u306b\u3082\u8ca0\u3051\u306a\u3044\u6e80\u54e1\u72b6\u614b\u3060\u3002\u4f55\u3082\u77e5\u3089\u305a\u306b\u4e57\u3063\u3066\u304d\u305f\u4e00\u822c\u306e\u4e57\u5ba2\u3002\u305d\u306e\u76ee\u306e\u524d\u3067\u306f\u3001\u4fe1\u3058\u3089\u308c\u306a\u3044\u3088\u3046\u306a\u7570\u69d8\u306a\u5149\u666f\u304c\u7e70\u308a\u5e83\u3052\u3089\u308c\u3066\u3044\u305f\u3002(\u5f15\u7528\uff1ahttp:\/\/sankei.jp.msn.com\/affairs\/crime\/100206\/crm1002061201013-n1.htm) Part2>sm9491326 Part3>sm9491349 Part4>sm9491369 \u5225\u30a2\u30f3\u30b0\u30eb>sm9491421'
	,	thumbnail: 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=9491339'
	,	postedAt: new Date('2010\/01\/25 04:07:32 +0900')
	,	length: 101
	,	viewCount: 22197
	,	mylistCount: 66
	,	commentCount: 939
	,	movieType: 'mp4'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1329039524.0.TnT4VkOozm5FDfYaUYF8KDSAWlo...'
	,'playerTimestamp': '1328754876'
	,'player_version_xml': '1328857541'
	,'player_info_xml': '1328854461'
	,'v': 'sm9491339'
	,'videoId': 'sm9491339'
	,'thumbTitle': '\uff12\uff10\uff19\u7cfb\u3055\u3088\u306a\u3089\u904b\u8ee2\u7f75\u58f0\u5927\u4f1a\uff11'
	,'thumbDescription': 'Youtube\u304b\u3089\u8ee2\u8f09 \u3053\u306e\u65e5\u306f\u4eac\u6d5c\u6771\u5317\u7dda\u304b\u3089\u300c\uff12\uff10\uff19\u7cfb\u300d\u3068\u547c\u3070\u308c\u308b\u901a\u52e4\u578b\u8eca\u4e21\u304c\u5f15\u9000\u3059\u308b\u65e5\u3002\u30db\u30fc\u30e0\u306e\u4eba\u3060\u304b\u308a\u306f\u3001\u4eac\u6d5c\u6771\u5317...'
	,'thumbImage': 'http:\/\/tn-skr4.smilevideo.jp\/smile?i=9491339'
	,'movie_type': 'mp4'
	,'wv_id': 'sm9491339'
	,'iee': '1'
	,'leaf_switch': '2'
	}, '', '');
	player.write();
})();


