		function esInteger(e) {		
			var charCode;
			if (navigator.appName == "Netscape")
				charCode = e.which;
			else
				charCode = e.keyCode;

			status = "" ;
			
			if (charCode > 31 && (charCode < 47 || charCode > 57)) { 
				return false;
			}				
			return true;
		}

		function esIntegerCp(e) {		
			var charCode;
			if (navigator.appName == "Netscape")
				charCode = e.which;
			else
				charCode = e.keyCode;

			status = "" ;
			
			if (charCode > 31 && (charCode < 48 || charCode > 57)) { 
				return false;
			}				
			return true;
		}

		function esIntegerTel(e) {		
			var charCode;
			if (navigator.appName == "Netscape")
				charCode = e.which;
			else
				charCode = e.keyCode;

			status = "" ;
			
			if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 32) { 
				return false;
			}				
			return true;
		}

function formIsValid() {
	// check to make sure a valid username has been entered
	if ( document.login.username.value == "" ) {
		alert('Por favor, escribe tu seudonimo para entrar al chat');
		return false;
	}

	return true;
}

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;

	// the size of the popup window
	var width =800;
	var height = 500;

	// 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 = "includes/chat/index.php?username=" + username + "";
	var options = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",noresize";

	// open the chat window as a popup, instead of embedded in webpage
	window.open( url, "chat", options );
}

function popupLogin2() {
	// 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;

	// the size of the popup window
	var width =800;
	var height = 500;

	// 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 = "includes/chat/index.php?username=" + username + "";
	var options = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",noresize";

	// open the chat window as a popup, instead of embedded in webpage
	window.open( url, "chat", options );
}

// check, if java is enabled in browser
function JavaCheck()
{
	var html = '';

	var status = 'Deshabilitado';
	if (navigator.javaEnabled()) status = 'Habilitado';

	if (status == 'Habilitado')
	{
	html += '\t\tJava Status:&nbsp;<span style="color: green;">'+status+'<\/span>\n<p>&nbsp;&nbsp;&nbsp;Tu PC tiene los requerimientos necesarios para ingresar al chat sin problemas.</p>';
        }

	else if (status == 'Deshabilitado')
	{
	html += '\t\tJava Status:&nbsp;<span style="color: red;">'+status+'<\/span>\n<p>&nbsp;&nbsp;&nbsp;Tu PC NO TIENE los requerimientos necesarios para ingresar al chat. Necesitas instalar JAVA.</p>';
	html += '\n<p>&nbsp;&nbsp;&nbsp;Bajalo del sitio: <a href="http://www.java.com/es/" target="_blank">http://www.java.com/es/<\/a></p>\n';
	}

	html += '';

	return html;
}
