function makeRemoteFFF() {
	remote = window.open("/fanfic3/freischalter_aktiv.php","remotewin2","width=250,height=250,resizable");
	if (remote.opener == null) remote.opener = window;
	remote.opener.name = "opener";
}

function openFrame(fanfic, kapitel) {
	$j("#adminframe").attr("src", "/fanfic3/zuordnungs-frame.php?id=" + fanfic + "&kapitel=" + kapitel);
	var pos = $j('#zufr_' + fanfic + '_' + kapitel).position();
	$j('#adminframe').css({ "left": (pos.left)+"px", "top": (pos.top+20)+"px", "width": "410px", "height": "310px", "visibility": "visible" });
	activeAdmin = fanfic;
}
function closeFrame(i) {
	$j('#adminframe').css({ "left": "0px", "top": "0px", "visibility": "hidden" });
	activeAdmin = 0;
}
function clickAdmin(fanfic, kapitel) {
	if (activeAdmin == fanfic) closeFrame();
	else openFrame(fanfic, kapitel);
}

	
function searchbox_recalc_link_h() {
	if ($j("#searchbox_typ_serie").attr("checked")) return ($j("#searchbox_serie").val() != "");
	if ($j("#searchbox_typ_unterthema").attr("checked")) return ($j("#searchbox_unterthema").val() != "");
	if ($j("#searchbox_typ_genre").attr("checked")) return ($j("#searchbox_genre").val() != "");
	if ($j("#searchbox_typ_autor").attr("checked")) return ($j("#searchbox_autor").val() != "");
	if ($j("#searchbox_typ_username").attr("checked")) return ($j("#searchbox_username").val() != "");
	if ($j("#searchbox_typ_sprache").attr("checked")) return ($j("#searchbox_sprache").val() != "");
	if ($j("#searchbox_typ_tags").attr("checked")) return ($j("#searchbox_tags").val() != "");
	if ($j("#searchbox_typ_status").attr("checked")) return ($j("#searchbox_status").val() != "");
	if ($j("#searchbox_typ_ffname").attr("checked")) return ($j("#searchbox_ffname").val().length > 2);
	if ($j("#searchbox_typ_favoriten").attr("checked")) return true;
	return false;
}

function searchbox_recalc_link() {
	if (searchbox_recalc_link_h()) {
		var url = "";
		var modi = "";
		if ($j("#searchbox_modus0").attr("checked")) modi = "-";
		if ($j("#searchbox_typ_serie").attr("checked")) url = "serie/" + modi + $j("#searchbox_serie").val() + "/";
		if ($j("#searchbox_typ_unterthema").attr("checked")) url = "unterthema/" + modi + $j("#searchbox_unterthema").val() + "/";
		if ($j("#searchbox_typ_genre").attr("checked")) url = "genre/" + modi + $j("#searchbox_genre").val() + "/";
		if ($j("#searchbox_typ_autor").attr("checked")) url = "autor/" + modi + $j("#searchbox_autor").val() + "/";
		if ($j("#searchbox_typ_username").attr("checked")) url = "username/" + modi + encodeURI($j("#searchbox_username").val()) + "/";
		if ($j("#searchbox_typ_sprache").attr("checked")) url = "sprache/" + modi + $j("#searchbox_sprache").val() + "/";
		if ($j("#searchbox_typ_tags").attr("checked")) url = "tags/" + modi + $j("#searchbox_tags").val() + "/";
		if ($j("#searchbox_typ_status").attr("checked")) url = "status/" + modi + $j("#searchbox_status").val() + "/";
		if ($j("#searchbox_typ_ffname").attr("checked")) url = "ffname/" + modi + $j("#searchbox_ffname").val() + "/";
		if ($j("#searchbox_typ_favoriten").attr("checked")) url = "favoriten/" + animexx_user_id + "/";
		$j("#searchbox_form").attr("action", ff_such_base + url);
		$j("#searchbox_submit").attr("disabled", false);
	} else $j("#searchbox_submit").attr("disabled", true);
}

function f_toggleAdult(kapitel) {
	$j.get("/fanfic3/ajax-freischalter.php?id=" + kapitel + "&toggle_frei_adult=1", function(text) {
		$j("#ff_ad_span_" + kapitel).show();
		$j("#ff_ad_img_" + kapitel).hide();
		if (text == "1") $j("#ff_ad_" + kapitel).html("<font color='red'><b>Adult</b></font>");
		else $j("#ff_ad_" + kapitel).html("<i>kein Adult</i>");
	});
	$j("#ff_ad_span_" + kapitel).hide();
	$j("#ff_ad_img_" + kapitel).show();
}

function open_empf_win (f_id) {
	var url = "/fanfic3/frame_wer_empfohlen.php?id=" + f_id;
	var param = "toolbar=yes,location=no,status=yes,scrollbars=yes,resizable=yes,width=300,height=200";
	var remote = window.open(url, "remotewin_empf", param);
	if (remote.opener == null) remote.opener = window;
	remote.opener.name = "opener";
}
