function get_obj(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	}
	if (document.all) {
		return document.all[id];
	}
	return null;
}

function ajax_xhr_new() {
	xhr = false;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xhr;
}

function ajax_xhr_send(xhr, url, param, treat) {
	xhr.open("POST", url, true);
	xhr.onreadystatechange = function() {
		if(xhr.readyState == 4) {
			eval(xhr.responseText);
			eval(treat);
		}
	}
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr.send(param);
}

function ajax_imageTwo(news_id, url, fonction) {
	var imagesTwo = get_obj('imagesTwo');
	imagesTwo.style.display = 'block';

	var xhr_object = ajax_xhr_new();
	urlparams = "method=json&id=" + news_id;
	ajax_xhr_send(xhr_object, url, urlparams, fonction);
}

function afficher_imageTwo(html) {
	var imageTwoContainer = get_obj('imageTwoContainer');
	imageTwoContainer.innerHTML = html;
}

function ajax_video(news_id, url, fonction) {
	var imagesTwo = get_obj('imagesTwo');
	imagesTwo.style.display = 'block';

	var xhr_object = ajax_xhr_new();
	urlparams = "method=json&id=" + news_id;
	ajax_xhr_send(xhr_object, url, urlparams, fonction);
}

function afficher_video(html) {
	var imageTwoContainer = get_obj('imageTwoContainer');
	imageTwoContainer.innerHTML = html;
}

function ajax_distribution(news_id, url, fonction) {
	var imagesTwo = get_obj('imagesTwo');
	imagesTwo.style.display = 'block';

	var xhr_object = ajax_xhr_new();
	urlparams = "method=json&id=" + news_id;
	ajax_xhr_send(xhr_object, url, urlparams, fonction);
}

function afficher_distribution(html) {
	var imageTwoContainer = get_obj('imageTwoContainer');
	imageTwoContainer.innerHTML = html;
}

function afficher_distrib() {
	var distrib = get_obj('distrib');
	distrib.style.display = 'block';
	var imagesTwo = get_obj('imagesTwo');
	imagesTwo.style.display = 'none';
}