var Usser = "";
var x = 0;
var y = 0;
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;
function getMousePosition(e) {
  if (!isIE) {
    x = e.pageX;
    y = e.pageY;
  }
  if (isIE) {
    x = event.clientX;
    y = event.clientY;
  }
  return x;
  return y;
}
function Conectar()
{
	if(window.XMLHttpRequest)
		Conexion=new XMLHttpRequest(); //mozilla
	else if(window.ActiveXObject)
		Conexion=new ActiveXObject("Microsoft.XMLHTTP"); //microsoft
}

function Mensajes()
{
	Conectar();;
	Conexion.open("POST", "mensajes.php", true);
	Conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	Conexion.send("user="+Usser);
	Conexion.onreadystatechange=function()
	{
		if (Conexion.readyState==4)
		{
			respuesta = Conexion.responseText;
			if(respuesta == 1){
			setInterval("txtDiv.filters.glow.enabled = !txtDiv.filters.glow.enabled", 700);
			document.getElementById('msjj').innerHTML='<a style="text-decoration: none; color: #000;" href="javascript:popMensaje(\'mss.php\'); ">Hay '+respuesta+' Mensaje Nuevo'+'</a>';
			}
			if(respuesta > 1){
			setInterval("txtDiv.filters.glow.enabled = !txtDiv.filters.glow.enabled", 700);
			document.getElementById('msjj').innerHTML='<a style="text-decoration: none; color: #000;" href="javascript:popMensaje(\'mss.php\'); ">Hay '+respuesta+' Mensajes Nuevos'+'</a>';
			}
			if(respuesta == 0){
			document.getElementById('msjj').innerHTML='';
			}
		}
	}
}

function popMensaje(pagina) {
  	window.open
   		(pagina,'','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=yes,status=no,titlebar=no,width=800, height=400, top=200, left=140');
}

function caracteres001(txarea)
{ 
    total = 250; 
    tam = txarea.value.length; 
    str=""; 
    str=str+tam; 
    document.getElementById('Digitado').innerHTML = str; 
    document.getElementById('Restante').innerHTML = total - str; 
    if (tam > total){ 
        aux = txarea.value; 
        txarea.value = aux.substring(0,total); 
        document.getElementById('Digitado').innerHTML = total 
        document.getElementById('Restante').innerHTML = 0 
    } 
} 
