//author: Marc des Garets

function info(type)
{
	document.getElementById('info').className='info_v';
	setInfo(type);
}

function ClickBanner(id,url)
{
	$j = jQuery.noConflict();
	$j.ajax({type:"GET", url: "/pub/maj.php?id="+id, async: false}).responseText;
}

var Chat = new Chat();

function Chat() {
	this.isActive = function() {
		jQuery.get("../popchat/ajax.php?isActive", function(data) {
			if(data!=""){
				var tmp = data.split("/");
				window.open('popchat/window.php?login='+tmp[0]+'&id='+tmp[1],'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=730, height=420');
			}
		});

		setTimeout("Chat.isActive()","3000");
	}

	this.send = function(id) {
		var message = document.getElementById('chat_message').value;

		jQuery.get("../popchat/ajax.php?id="+id+"&message="+encodeURIComponent(message), function(data) {
			var chat_text = document.getElementById('chat_text');
			chat_text.value=data;
			chat_text.scrollTop=chat_text.scrollHeight;
		});

		document.getElementById('chat_message').value='';
	}
}

function chatDown(){
	var chat_text = document.getElementById('chat_text');
	chat_text.scrollTop=chat_text.scrollHeight;
}

function refresh(id) {
	jQuery.get("../popchat/ajax.php?refresh&id="+id, function(data) {
		var chat_text = document.getElementById('chat_text');
		chat_text.value=data;
		chat_text.scrollTop=chat_text.scrollHeight;
	});
	
	setTimeout("refresh("+id+")",3000);		
}
