function $(id) {return document.getElementById(id);}
//------------------------------------------------------------------------
function openWin(url, ancho, alto)
{
	var day = new Date();
	var id  = day.getTime();
	var w   = screen.width;
  var h   = screen.height;
	var leftPos = (w-ancho)/2;
	var topPos = (h-alto)/2;

	eval("page" + id +
		 " = window.open(url, '" + id + "', '" +
		 "toolbar=0,"   +
		 "scrollbars=1,"+
		 "statusbar=0," +
		 "menubar=0,"   +
		 "resizable=0," +
		 "width="+ ancho + "," +
		 "height="+ alto + "," +
		 "top="+ topPos + ","  +
		 "left="+ leftPos +"');");
}
//------------------------------------------------------------------------
function runLogout()
{
	if (confirm('Close session?')) {
		document.location = 'logout.php';
	}
	return false;
}
//------------------------------------------------------------------------
function runLogin()
{
	var email = $('login_email');
	var clave = $('login_clave');

	if (email.value == '') { alert('Complete the email'); email.focus(); return false; }
	if (clave.value == '') { alert('Complete the password'); clave.focus(); return false; }

	return true;
}
//------------------------------------------------------------------------
function addLoadEvent(func)
{
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
      window.onload = function() {
        if (oldonload) {
            oldonload();
        }
        func();
}}}