/* wl tab */

function sortTab(tab) {

	var listNr = 0;

	for (key in tabListSort) {

		if (key == tab) {

			var currentForm = tabListSort[key];

			for (sub in tabListSort) {

				if (tabListSort[sub] == currentForm) {
					showTabArea(sub);
				}

			}

			if (showSwitch) {

				$('#tab_form_switch_' + currentForm + '_1').show();
				$('#tab_form_switch_' + currentForm + '_2').show();
				$('#tab_form_switch_' + currentForm + '_3').show();
				$('#tab_form_switch_' + currentForm + '_background').show();

			}

			break;

		}

	}

}

function showTabArea(tab) {

	$('#tab_form_' + tab + '_1').show();
	$('#tab_form_' + tab + '_2').show();
	$('#tab_form_' + tab + '_3').show();
	$('#tab_' + tab + '_background').show();

}

function hideTabArea(tab) {

	$('#tab_form_' + tab + '_1').hide();
	$('#tab_form_' + tab + '_2').hide();
	$('#tab_form_' + tab + '_3').hide();
	$('#tab_' + tab + '_background').hide();

}

function clearSwitcher() {

	for (var i = 1; i <= 2; ++i) {

		$('#tab_form_switch_' + i + '_1').hide();
		$('#tab_form_switch_' + i + '_2').hide();
		$('#tab_form_switch_' + i + '_3').hide();
		$('#tab_form_switch_' + i + '_background').hide();

	}

}

function switchLayer(to) {

	currentForm = to;

	for (sub in tabListSort) {

		if (tabListSort[sub] == currentForm) {
			showTabArea(sub);
		} else {
			hideTabArea(sub);
		}

	}

	clearSwitcher();

	$('#tab_form_switch_' + to + '_1').show();
	$('#tab_form_switch_' + to + '_2').show();
	$('#tab_form_switch_' + to + '_3').show();
	$('#tab_form_switch_' + to + '_background').show();

}

function profileBoxDelete(id) {

    if (confirm($.base.phraseGet('profile_box_remove_confirmation'))) {
        $.profileBox.remove(id, user_id);

    }

}

