function checktimeout(uid)
{
	// the timeout value should be the same as in the "refresh" meta-tag
	setTimeout( "check_newmessages("+uid+")", 10000 );
	
}
		
function check_newmessages(uid)
{
	//check
	var resp = $.get( "/data.php", {'newmessages':uid},function(data){				  
		
		var re = parseInt(data);
		if(re>0){
			//$("#newmessages").css("display","block");
			$("a.chatlink").html("SUPPORT CHAT: <b>You have "+re+" new message(s)</b>");
		}
		else
		{
			//$("#newmessages").css("display","none");
			$("a.chatlink").html("SUPPORT CHAT");
		}
	}); 
	
	
	checktimeout(uid);
}