/* 
Created by: Kenrick Beckett

Name: Chat Engine
*/

var instanse = false;
var state;
var mes;
var file;


// kolor_wiadomosci

function get_messages(user_id)
{

//alert("You entered: " + document.getElementById("kolor_wiadomosci").style.color)


     $.ajax({
		   type: "POST",
		   url: "/script/mark_news.php",
		   data: {
		   			'function': 'get_messages',
					'id': user_id,
					'file': file
				 },
		   dataType: "json",
		   success: function(data){
                        document.getElementById("licz_wiadomosci").innerHTML = data.ilosc_wiadomosci;
//                        document.getElementById("licz_wiadomosci2").innerHTML = data.ilosc_wiadomosci;
		   } // tu był przecinek
		});
}



function mark_read(message_id,user_id)
{
    document.getElementById("kolor_wiadomosci_" + message_id).style.color = "rgb(220, 220, 220)";
    $.ajax({
		   type: "POST",
		   url: "/script/mark_news.php",
		   data: {  
		   			'function': 'mark_read',
					'id': message_id,
					'file': file
				 },
		   dataType: "json",
		   success: function(data){
                        get_messages(user_id);
		   } // tu był przecinek
		});
}

