// JavaScript Document
<!--
function formIsValid() {
	// check to make sure a valid username has been entered
	if ( document.login.username.value == '' ) {
		alert('Please input a username.');
		return false;
	}

	return true;
}

// a small poupup window to show who's in the chat at the current time
function showInfo() {
	// the size of the popup window
	var width = 400;
	var height = 300;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = 'info.php';
	var options = 'width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',resizable';

	// open the info window as a popup, instead of embedded in webpage
	window.open( url, 'info', options );
}

function basicLogin() {
	if (formIsValid()) {		
		document.login.submit();
	}
}

function popupLogin() {
	// check to make sure a valid username has been entered
	if (!formIsValid()) return;

	var username = document.login.username.value;
	var password = document.login.password.value;
	var lang = document.login.lang.value;

	// the size of the popup window
	var width = 800;
	var height = 600;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = 'TanyaChat/flashchat.php?username=' + username + '&password=' + password + '&lang=' + lang;
	var options = 'width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',resizable';

	// open the chat window as a popup, instead of embedded in webpage
	window.open( url, 'chat', options );
}
//-->
