jQuery.noConflict();

jQuery(function($) {
	jQuery('#msg_btn').click(function() {				
		jQuery.blockUI({ message: $('#msg') });
		jQuery.post('/chat/read.php', {some:''});	//Устанавливаем статус о прочтении
	});
				
	setInterval("msg_new()", 5000);
});
			
//Отправляем сообщение
function msg_send() {
	if (jQuery('#msg_input').attr('value')) {
		jQuery.post('/chat/send.php', {message:jQuery('#msg_input').attr('value')});
		jQuery('#msg_input').attr('value', '');
	}
}
			
//Проверяет есть ли новые сообщения
function msg_new(){
	jQuery.post('/chat/new.php',{some:""}, msg_new_data);				
}
			
//Call back функция, сюда возращается статус о новых месаджах
function msg_new_data(status){
	jQuery.post('/chat/load.php',{some:''}, msg_load); //Загружаем новые сообщения
	if(status == 'true') {
		jQuery('#msg_btn').attr('src', '/img/novator/online_support_new.gif');
	} else {
		jQuery('#msg_btn').attr('src', '/img/novator/online_support.gif');
	}
}
			
//Call back функция, сюда возращается новые месаджи
function msg_load(data){
	jQuery("#msg_content").empty();
	jQuery("#msg_content").append(data);				
}


function msg_close(){
	jQuery.post('/chat/read.php', {some:''});	//Устанавливаем статус о прочтении

}