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/sm1972386" target="_blank">Call of Duty 4 \u30c6\u30af\u30c6\u30af\u5f93\u8ecd\u8a18 part1</a></p>'
		);
		return;
	}

	var video = new Nicovideo.Video({
		v: 'sm1972386'
	,	id: 'sm1972386'
	,	title: 'Call of Duty 4 \u30c6\u30af\u30c6\u30af\u5f93\u8ecd\u8a18 part1'
	,	description: 'PC \u82f1\u8a9e\u7248COD4\u306e\u30d7\u30ec\u30a4\u52d5\u753b\u3067\u3059\u3002\u96e3\u6613\u5ea6\u306fVeteran\u3002\u4e00\u5fdc\u521d\u30d7\u30ec\u30a4\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u30cb\u30b3\u30cb\u30b3\u306e\u30d7\u30ec\u30a4\u52d5\u753b\u3067\u3001\u4e88\u7fd2\u306f\u3057\u3066\u3042\u308b\u306e\u3067\u305d\u308c\u306a\u308a\u306b\u30b9\u30e0\u30fc\u30ba\u306b\u884c\u3051\u308b\u304b\u3068\u306f\u601d\u3044\u307e\u3059\u3002\u3053\u3061\u3089\u306f\u306e\u3093\u3073\u308a\u9032\u3081\u3066BIOSHOCK\u306e\u65b9\u3092\u512a\u5148\u3057\u3066\u9032\u3081\u305f\u3044\u3068\u601d\u3063\u3066\u307e\u3059\u3002\u8a33\u306f\u65e5\u672c\u8a9e\u8a33Wiki\u3068\u30cb\u30b3\u30cb\u30b3\u306e\u30d7\u30ec\u30a4\u52d5\u753b\u304b\u3089\u5f15\u7528\u53c2\u8003\u306b\u3057\u307e\u3057\u305f\u3002\u6240\u3005\u624b\u3092\u52a0\u3048\u305f\u3068\u3053\u308d\u3082\u3042\u308a\u307e\u3059\u3002\u203b\u306a\u3093\u304b\u8aa4\u89e3\u3092\u62db\u3044\u305f\u3088\u3046\u306a\u306e\u3067\u88dc\u8db3\u3000\u30ad\u30eb\u30cf\u30a6\u30b9\u7a81\u5165\u8a13\u7df4\u307e\u3067\u306f\u30ad\u30e3\u30d7\u30c6\u30b9\u30c8\u3067\u8a66\u9a13\u7684\u306b\u6570\u56de\u30d7\u30ec\u30a4\u3057\u3066\u307e\u3059\u3002\u3000\u8ca8\u7269\u8239\u30df\u30c3\u30b7\u30e7\u30f3\u304b\u3089\u306f\u5b8c\u5168\u306b\u521d\u3067\u3059\u3002\u30de\u30a4\u30ea\u30b9\u30c8\u21d2mylist\/4394813[\u7d9a\u304d\u21d2sm1973041]BIOSHOCK -\u30c6\u30af\u30c6\u30af\u6d77\u5e95\u8a18- \u21d2 mylist\/4043679OBLIVION -\u30c6\u30af\u30c6\u30af\u5192\u967a\u8a18- \u21d2 mylist\/2350574'
	,	thumbnail: 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=1972386'
	,	postedAt: new Date('2008\/01\/07 13:20:08 +0900')
	,	length: 612
	,	viewCount: 795311
	,	mylistCount: 9327
	,	commentCount: 15416
	,	movieType: 'flv'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1329030403.0.Am3FpMUD5tNN9b0fu6gM2uEVww0...'
	,'playerTimestamp': '1328754876'
	,'player_version_xml': '1328857541'
	,'player_info_xml': '1328854461'
	,'v': 'sm1972386'
	,'videoId': 'sm1972386'
	,'thumbTitle': 'Call of Duty 4 \u30c6\u30af\u30c6\u30af\u5f93\u8ecd\u8a18 part1'
	,'thumbDescription': 'PC \u82f1\u8a9e\u7248COD4\u306e\u30d7\u30ec\u30a4\u52d5\u753b\u3067\u3059\u3002\u96e3\u6613\u5ea6\u306fVeteran\u3002\u4e00\u5fdc\u521d\u30d7\u30ec\u30a4\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u30cb\u30b3\u30cb\u30b3\u306e\u30d7\u30ec\u30a4\u52d5\u753b\u3067\u3001\u4e88\u7fd2\u306f\u3057...'
	,'thumbImage': 'http:\/\/tn-skr3.smilevideo.jp\/smile?i=1972386'
	,'movie_type': 'flv'
	,'wv_id': 'sm1972386'
	,'iee': '1'
	,'category': '\u30b2\u30fc\u30e0'
	,'categoryGroup': '\u30a2\u30cb\u30e1\u30fb\u30b2\u30fc\u30e0\u30fb\u7d75'
	,'leaf_switch': '2'
	}, '', '');
	player.write();
})();


