window.operationMode = "normal";
function openBookmarkWindow(code) {
	openActionWindow("bookmark", code, 400, 220);
}
function openSendWindow(code) {
	openActionWindow("send", code, 400, 280);
}
function openActionWindow(action, code, w, h) {
	try {
		window.operationMode = action;
		var win = openSizedWindow("/view/" + code + "/", "AnyFilms", w, h, "location=yes");
		win.resizeTo(w, h);
	}
	catch (e) {
	}
}
function closeActionWindow() {
	window.close();
}
function getMode() {
	if (!window.opener) {
		return "";
	}
	try {
		return window.opener.operationMode;
	}
	catch (e) {
		return "";
	}
}
function openSizedWindow(url, name, w, h, options) {
	var n = (document.layers) ? 1 : 0;
	var ie = (document.all) ? 1 : 0;
	var safari = (navigator.userAgent.indexOf("Safari") > -1) ? 1 : 0;
	var mac = (navigator.userAgent.indexOf("Mac") > -1) ? 1 : 0;
	if (ie && mac) {
		w -= 16;
		h -= 16;
	}
	if (safari && mac) {
		w -= 2;
		h += 15;
	}
	var opts = "";
	if (options && options.length > 1) {
		opts = "," + options;
	}
	var win = window.open(url, name, "width=" + w + ",height=" + h + opts);
	win.focus();
	return win;
}
