function Envio(id,action,mensaje,tipo,accion){
	document.forms.frmEnvio.action=action;
	document.forms.frmEnvio.id.value=id;
	document.forms.frmEnvio.accion.value=accion;
	document.forms.frmEnvio.tipo.value=tipo;		

	if (confirm(mensaje))
		{
			document.forms.frmEnvio.submit();
		}

}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=750,height=475,left ="+(window.screen.width-750)/2+",top = "+(window.screen.height-425)/2+"');");
}
// End -->

function compruebaLogin(){

	with(document.forms.login)
		{
		if ((login.value=='') || (password.value==''))
			{
			alert('Por favor, escriba un nombre de usuario y una contraseña');
			return false;
			}else{
			return true;	
			}
	
		}

}

function mail(texto){
//Copyright © McAnam.com
    var mailres = true;            
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-";
    
    var arroba = texto.indexOf("@",0);
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1;
    
    var punto = texto.lastIndexOf(".");
                
     for (var contador = 0 ; contador < texto.length ; contador++){
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){
            mailres = false;
            break;
     }
    }

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 2 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1))
     mailres = true;
    else
     mailres = false;
                
    return mailres;
}

function trim(cadena)
{
	var salida="";
	 for (var contador = 0 ; contador < cadena.length ; contador++){	
	 	if (cadena[contador]!=' ')
		{
			salida+=cadena.indexOf(contador);
		}
		
	 }
	return salida;
}

function compruebaTexto(texto)
{
	var validos= "abcdefghijklmnñopqrstuvwxyzáéíóúÁÉÍÓÚABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890._- ,";	
	var pivote=true;
	for (var contador = 0 ; contador < texto.length ; contador++){

		if (validos.indexOf(texto.substr(contador, 1),0) == -1){
            pivote = false;
            break;
	     }
    }	
	return pivote;
}

function soloAlfanumericos(texto)
{
	var validos= "abcdefghijklmnñopqrstuvwxyzáéíóúÁÉÍÓÚABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890";	
	var pivote=true;
	for (var contador = 0 ; contador < texto.length ; contador++){

		if (validos.indexOf(texto.substr(contador, 1),0) == -1){
            pivote = false;
            break;
	     }
    }	
	return pivote;
}

function leermas(id)
{
	document.getElementById('comunicado'+id).innerHTML="<center><img src='imagenes/progress.gif' border='0'></center>\n";
	llamarasincrono("comunicado.php?id="+id,"comunicado"+id);
//	var elemento=document.getElementById('comunicado'+id);
//	elemento.style.overflow='hidden';
//	elemento.style.height='auto';
}