/*******************/
/*  Attention !!!  */
/* need mootool.js */
/*******************/

function show_openbox(fichier) {

	var xhr=null;
		
		if (window.XMLHttpRequest) { 
			xhr = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) 
		{
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		xhr.onreadystatechange = function(){
												if (xhr.readyState==4 && xhr.status == 200) 
												{	
													response = xhr.responseText;
													construct_openbox(response);
												}
											}	
		 
	
		construct_openbox('<img src="../image/waiting.gif" alt="waiting" width="20" height="20" class="imgWait"/>'); 
		xhr.open("GET", fichier, true); 
		xhr.send(null);
}
var openbox = false;
function construct_openbox(content) {
if(!openbox)
	{
		openbox = document.createElement('div');
		openbox.style.position = 'absolute';
		openbox.style.backgroundColor = '#FFFFFF'
		openbox.style.border='solid 1px #000000';
		openbox.style.top='100px';
		openbox.style.left='50%';
		openbox.style.zIndex='15001';
		openbox.style.padding='5px';
		openbox.className = 'openbox';
		openbox.setAttribute('id','openbox');
		document.body.appendChild(openbox);
		
		openbox_close = document.createElement('a');
		openbox_close.style.display='block';
		openbox_close.style.fontFamily='"Trebuchet MS", Tahoma, Arial, sans-serif';
		openbox_close.style.textDecoration='none';
		openbox_close.style.color='#000000';
		openbox_close.style.fontSize='16px';
		openbox_close.style.fontWeight='bold';
		openbox_close.style.textAlign='right';
		openbox_close.style.marginBottom='5px';
		openbox_close.className = 'openbox_close';
		openbox_close.setAttribute('id','openbox_close');
		openbox_close.setAttribute('href','javascript:hide_openbox();');
		openbox_close.innerHTML = 'X';
		openbox.appendChild(openbox_close);
		
		openbox_content = document.createElement('div');
		openbox_content.className = 'openbox_content';
		openbox_content.setAttribute('id','openbox_content');
		openbox.appendChild(openbox_content);
		
		openbox_back = document.createElement('div');
		openbox_back.style.position='absolute';
		openbox_back.style.backgroundColor='#000000';
		openbox_back.style.zIndex='15000';
		openbox_back.style.opacity='0.50';
		openbox_back.style.KHTMLOpacity='0.50';
		openbox_back.style.MozOpacity='0.50';
		openbox_back.style.filter='alpha(opacity=50)';
		openbox_back.setAttribute('onClick','hide_openbox();');
		openbox_back.innerHTML = '&nbsp;';
		document.body.appendChild(openbox_back);
	}
	
	openbox.style.display='block';	
	openbox_back.style.display='block';
	openbox_content.innerHTML = content;
	get_size_openbox();
	get_size_openbox_back();
	window.onscroll = function () {get_size_openbox_back();};
	window.onresize = function () {get_size_openbox_back();};
}

function hide_openbox() {
	openbox.style.display='none';
	openbox_back.style.display='none';
	}

function get_size_openbox() {
	var posLeft;
	posLeft = ((openbox.offsetWidth)/2);	
	openbox.style.marginLeft='-'+posLeft+'px';
	}

function get_size_openbox_back() {	
		openbox_back.style.top=window.getScrollTop()+'px';
		openbox_back.style.left=window.getScrollLeft()+'px';
		openbox_back.style.height=window.getHeight()+'px';
		openbox_back.style.width=window.getWidth()+'px';
	}

