function togglePassword()
{
	var fake = $('passwordClearText');
	var real = $('passwordPassword');
	
	var togs = real.retrieve('togs', 0);
	if ( ! togs || ! real.present())
	{
		fake.toggle();
		real.toggle();
		
		if (real.visible())
		{
			real.activate();
		}
		
		real.store('togs', 1);
	}
}

function toggleUsername()
{
	var fake = $('usernameClearText');
	var real = $('usernameUsername');
	
	var togs = real.retrieve('togs', 0);
	if ( ! togs || ! real.present())
	{
		fake.toggle();
		real.toggle();
		
		if (real.visible())
		{
			real.activate();
		}
		
		real.store('togs', 1);
	}
}

function expandlogin(){
	Effect.toggle('loginContainer', 'appear', {duration: .50, queue: 'parallel'});
	$('chatContainer').hide();

}

function expandchat(){
	Effect.toggle('chatContainer', 'appear', {duration: .50, queue: 'parallel'});
	$('loginContainer').hide();
}


function genesis() {
	$('loginContainer').hide();
	$('chatContainer').hide();
}

function show_popup(id) {
	var popups = document.getElementsByTagName('div');
	var popup = $('popup_'+id);
	var help = $('help_'+id);
	if (!popup.visible()) {
		for (var i = 0; i < popups.length; i++) {
			if (popups[i].className == 'focus_window popup') {
				var p = $(popups[i].id);
				if (p.visible()) {
					new Effect.Shrink(p.id, {duration: '.4', direction: 'top-left'});
				}
			}
		}
		var tmp = help.cumulativeOffset(help);
		Element.clonePosition(popup, help, {setTop: true, setLeft: true, setWidth: false, setHeight: false, offsetLeft: -2, offsetTop: -3})
			new Effect.Grow(popup.id, {duration: '.4', direction: 'top-left'});
	}
	//popup.show();
}

function hide_popup(id) {
	var popup = $('popup_'+id);
	var help = $('help_'+id);	
	new Effect.Shrink(popup.id, {duration: '.4', direction: 'top-left'});
}

function show_badge_code(id) {
	var badges = document.getElementsByTagName('div');
	var badge = $('badge_'+id);
	var help = $('help_'+id);
	if (!badge.visible()) {
		for (var i = 0; i < badges.length; i++) {
			if (badges[i].className == 'focus_window badge_code') {
				var p = $(badges[i].id);
				if (p.visible()) {
					new Effect.Shrink(p.id, {duration: '.4', direction: 'top-left'});
				}
			}
		}
		var tmp = help.cumulativeOffset(help);
		Element.clonePosition(badge, help, {setTop: true, setLeft: true, setWidth: false, setHeight: false, offsetLeft: -2,offsetTop: -3})
		new Effect.Grow(badge.id, {duration: '.4', direction: 'top-left'});
	}
}

function hide_badge_code(id) {
	var badge = $('badge_'+id);
	new Effect.Shrink(badge.id, {duration: '.4', direction: 'top-left'});
}

<!-- ------------------------ -->
// hookup autoLogout
Event.observe(window,'load',autoLogout_setup);

// autoLogout globals for countdown seconds
// and timer object for counting them down.
var autoLogoutSeconds = null;
var autoLogout_ticker = null;

function autoLogout_setup() {
	// HTML elements that specify the session/countdown times 
	var e1 = $('autoLogout-duration');
	var e2 = $('autoLogout-countdown');

	if (e1 && e2) {
		// wait specified time, then alert the user of session timeout
		var autoLogoutDuration = e1.innerHTML;
		/*
		   alert('Logout warning after ' + (autoLogoutDuration/60) + ' minutes.\n' +
		   'This is based on session.gc_maxlifetime (php.ini) less 2 minutes.\n\n' +
		   'This alert is in nethosting.js, autoLogout_setup()');
		   */
		window.setTimeout(autoLogout_warning, (autoLogoutDuration * 1000));

		// record how long the countdown timer should run
		autoLogoutSeconds = e2.innerHTML;
	}
	Event.stopObserving(window,'load',autoLogout_setup); 
}

function autoLogout_warning() {
	// show the countdown UI
	var e1, e2;
	e1 = $('autoLogout-disable').appear({duration: 0.5, from: 0.0, to: 0.6});
	e2 = e1.up('#site-wrapper-external');
	e1.setStyle({height:e2.getStyle('height'), width:e2.getStyle('width')});

	$('autoLogout').appear({duration: 0.5, from: 0.0, to: 1.0});

	// set up the exits via click/count
	$('autoLogout-renew').observe('click',autoLogout_click);
	autoLogout_ticker = new PeriodicalExecuter(autoLogout_count, 1);
}

function autoLogout_count() {
	// update the countdown timer
	var e = $('autoLogout-countdown');
	var curr = e.innerHTML;
	var next = curr - 1;
	e.update(next);

	if (!next)
		autoLogout_eval(true);
}

function autoLogout_click() {
	autoLogout_eval(false);
}

function autoLogout_eval(expired) {
	if (autoLogout_ticker) {

		// stop the countdown timer
		autoLogout_ticker.stop();
		autoLogout_ticker = null;

		// reset the UI
		$('autoLogout-disable').fade({duration: 0.5, from: 0.6, to: 0.0});
		$('autoLogout').fade({duration: 0.5});
		$('autoLogout-renew').stopObserving('click',autoLogout_click);
		$('autoLogout-countdown').update(autoLogoutSeconds);

		// logout or renew the session
		var result = (expired) ? 'true' : 'false';
		var callback = function(xhrObj) { autoLogout_proc(expired,xhrObj); };
		new Ajax.Request('/backroom/access/session_timer/' + result,
				{ method: 'get',
				  onComplete: callback
				});
	}
}

function autoLogout_proc(expired, xhrObj) {
	if (expired)
		window.location = xhrObj.responseText.replace(/(<!--.*?-->)$/,'');//'/backroom/access/logout';
	else
		autoLogout_setup();
}


