var tmout;
var previousstyle = -1;
var ie5win = false;

if (navigator.userAgent.indexOf('Win')    != -1 &&
    navigator.userAgent.indexOf('MSIE 5') != -1) {
	// MSIE5/Win :-(
	ie5win = true;
}

// >>>> FUNCTIONS >>>>


/**
 * Toggles the loginbox's visibility, fading in and out
 * @author Carsten Bluem
 * @version 2006-01-27
 */
function loginbox() {

	if (!document.getElementById('loginbox')) {
		return;
	}

	if (document.getElementById('loginbox').style.display == 'none') {
		// Fade in
		if (ie5win) {
			document.getElementById('loginbox').style.display = 'block';
			return;
		}
		new Effect.Appear('loginbox');
		window.setTimeout('document.forms[0].elements[0].focus()', 900);
	}
	else {
		// Fade out
		if (ie5win) {
			document.getElementById('loginbox').style.display = 'none';
			return;
		}
		new Effect.Fade('loginbox');
	}

} // function loginbox()


/**
 * Displays loginfo info when surfer is not logged in
 * @version 2006-03-19
 */
function logininfo(path, articleid) {
	return 'Dieser Bereich steht Ihnen nur als registrierter ' +
	       'S&Uuml;NJHAID!-Teilnehmer zur Verf&uuml;gung. ' +
	       '<a href="' + path + '?redirect=' + articleid + '" ' +
	       'style="text-decoration: underline; color: #4D6760">Dazu melden Sie sich bitte an</a>.' +
	       '<br />Wenn Sie an einer Veranstaltung teilnehmen, ' +
	       'bekommen Sie den Zugang zu unserem Netzwerk.';
}


/**
 * Display the symposiums' submenu
 * @author Carsten Bluem
 * @version 2006-01-27
 */
function shownav() {

	if (-1 == previousstyle) {
		// Perform only for very first call
		previousstyle = document.getElementById('symposiums').className;
	}

	window.clearTimeout(tmout);
	document.getElementById('subnavigation').style.visibility = 'visible';
	document.getElementById('symposiums').className = 'active';

} // function shownav()


/**
 * Starts a timer to hide the symposiums' submenu after a short delay
 * @author Carsten Bluem
 * @version 2006-01-27
 */
function hidenav() {

	tmout = window.setTimeout('doHide()', 500);

} // function hidenav()


/**
 * Hides the symposiums' submenu
 * @author Carsten Bluem
 * @version 2006-01-27
 */
function doHide() {

	window.clearTimeout(tmout);
	document.getElementById('subnavigation').style.visibility = 'hidden';
	document.getElementById('symposiums').className = previousstyle;

} // function doHide()


/**
 * Workaround for deficiencies in IE5/Win, used from the main navigation
 * @author Carsten Bluem
 * @version 2006-01-27
 */
function ie5nav(targetlocation) {

	if (!ie5win) {
		return true;
	}

	document.location.href = targetlocation;

} // function ie5nav(targetlocation)
