// JavaScript Document
var lightbox1_width = 980, lightbox1_height= 700;
movelayer();
var larg = screen.width; 
var haut = screen.height;
document.write("<div id=overlay style=\"position:absolute;z-index:9;background-color:#000000;display:none;\" class=\"trans90\" ></div>");
document.write("<div id=\"popup\" style=\"position:absolute;z-index:10;\" ></div>");
function showImg(html_mil) 
{ 
	var arrayPageSize = getPageSize();
    document.getElementById('overlay').style.width = (arrayPageSize[0] + 'px');
	document.getElementById('overlay').style.height = (arrayPageSize[1] + 'px');
	document.getElementById('popup').style.left = ( ( ( arrayPageSize[0] / 2 ) - ( lightbox1_width / 2 ) ) + 'px');
	document.getElementById('popup').style.top = ( ( getPageScroll() + (( haut / 2 ) - ( lightbox1_height / 2 ) )) + 'px');
	document.getElementById('popup').style.display='block';
	document.getElementById('popup').style.width = lightbox1_width+'px'; 
	document.getElementById('popup').style.height = lightbox1_height+'px';
    document.getElementById('overlay').style.display='block';
	document.getElementById('popup').innerHTML = html_mil;
	//alert(); 
} 
 
function writediv()
{
	
	texte=file('form.php');
	showImg(texte);
}
function closepopup()
{
	document.getElementById('popup').style.display='none';
	document.getElementById('overlay').style.display='none';
}

function file(fichier)
 {
	 if(window.XMLHttpRequest) // FIREFOX
		  xhr_object = new XMLHttpRequest(); 
	 else if(window.ActiveXObject) // IE
		  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	 else 
		  return(false); 
	 xhr_object.open("GET", fichier, false); 
	 xhr_object.setRequestHeader("Cache-Control","no-cache");
	 xhr_object.send(null); 
	 if(xhr_object.readyState == 4) return(xhr_object.responseText);
	 else return(false);
 }
 
 function getPageScroll(){
	var theTop = 0;
	var old = 0;

	if (window.innerHeight) {
		pos = window.pageYOffset
	} else if (document.documentElement && document.documentElement.scrollTop) {
		pos = document.documentElement.scrollTop
	} else if (document.body) {
		pos = document.body.scrollTop
	}
	return pos;
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

var theTop = 0;
var old = 0;
function movelayer() {
	var pos;
	if (window.innerHeight) {
		  pos = window.pageYOffset
	} else if (document.documentElement && document.documentElement.scrollTop) {
		pos = document.documentElement.scrollTop
	} else if (document.body) {
		  pos = document.body.scrollTop
	}
	
	if (pos < theTop)
		pos = theTop
	else
		pos += 30
	if (pos == old)
		document.getElementById("popup").style.top = pos + "px"

	old = pos
	setTimeout("movelayer()",20);
}