// JavaScript Document

var InsLocation;
var homeDir   = 'fotoalbum/';
var scriptDir = homeDir+'scripts/';
var oldEl;
var oldChEl;
var oPassEl;

function setSession(win, stil) {
	InsLocation = '';
	serial_AJAX(scriptDir+'set_display.php', win, stil, 'nix');	
}

function setOldEl(el) {
	InsLocation = '';
	serial_AJAX(scriptDir+'set_display.php', 'oldEl', el, 'nix');	
}

function setOldChEl(el) {
	InsLocation = '';
	serial_AJAX(scriptDir+'set_display.php', 'oldChEl', el, 'nix');	
}

function schliess(fenster) {
	document.getElementById(fenster).style.display = 'none';
	setSession(fenster, 'none');
}

function oeffne(fenster) {
	document.getElementById(fenster).style.display = 'block';
	setSession(fenster, 'block');
}

function switchDisp(fenster) {
	if(document.getElementById(fenster).style.display == 'none') {
		oeffne(fenster);
	} else {
		schliess(fenster);	
	}
}

function subSwitchChart(fenster) {
	if(oldChEl) {
		schliess(oldChEl);
	}
	if(fenster == 'none' || oldChEl == fenster) {
		oldChEl = '';
		return;
	}
	if(fenster) {
		oeffne(fenster);
		oldChEl = fenster;
		setOldChEl(oldChEl);
	}
}

function subSwitchAlbs(fenster) {
	apasso('');
	if(oldEl) {
		schliess(oldEl);
	}
	if(fenster == 'none' || oldEl == fenster) {
		oldEl = '';
		return;
	}
	if(fenster) {
		oeffne(fenster);
		oldEl = fenster;
		setOldEl(oldEl);
	}
};

function showsub() {
	document.getElementById('chartsub').style.display = 'block';
//	document.getElementById('chartsub').focus();
}

function apasso(fenster) {
	if(oPassEl) {
		schliess(oPassEl);
	}
	if(fenster) {
		oeffne(fenster);
		oPassEl = fenster;
	}
}