var xmlHttp

function showMessages(receiver_id)
{ 
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			}
			
var url="getmessage.php?receiver_id="+receiver_id;

	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				
				if(xmlHttp.responseText > 0){
					
						$.pnotify({
						pnotify_title: ' <font color=\'#ff0000\'>Usted Tiene '+xmlHttp.responseText+' Mensajes por Leer!</font>',
						pnotify_text: '<a href=\'members_area.php?page=messaging&section=received\'>Haga Clic Aqui! Para ir a su Cuenta</a>',
						pnotify_notice_icon: 'picon picon-mail-unread-new', 
                        pnotify_hide: true,
						pnotify_shadow: false,
						pnotify_delay : 299000
                       
					})
				}
				
			} 
	}

function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
	catch (e)
		{
 		//Internet Explorer
 		try
  			{
  				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  			}
	catch (e)
		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
	}
return xmlHttp;
}
