// show_hide elements
function show(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = 'block';
}
function hide(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = 'none';
}
function show_hide(id) {
	if (document.getElementById(id))
		document.getElementById(id).style.display = (document.getElementById(id).style.display == 'block')?'none':'block';
}
function download(uri) {
	if (uri)
		document.location.href='/outils/conversion-html-rtf/generate.php?uri='+uri+'&style=1';
}
function display_div(id_dst, id_src) {
	if (document.getElementById(id_src) && document.getElementById(id_dst)) {
		document.getElementById(id_dst).innerHTML = document.getElementById(id_src).innerHTML;
		
	}
}
function display_txt(id_dst, text) {
	if (document.getElementById(id_dst)) {
		document.getElementById(id_dst).innerHTML = text;
		
	}
}

function display_popup(id_src,title) {
	
	//var x = (screen.height) / 3;
	//var y = (screen.width) / 3;
	
	var x = 0;
	var y = 0;
	document.getElementById(id_src).onclick = position;

	if (document.getElementById('popup')) {
						
		show('popup');
				
		display_div('popup_content', id_src);
		
		display_txt('popup_title', title);
		
	}
}
function position(evt){
	if(!evt) evt = window.event;	
	x = evt.clientX;
	y = evt.clientY;
	document.getElementById('popup').style.marginTop = y + 'px';
	document.getElementById('popup').style.marginLeft = x + 'px';
}