var w3c=document.getElementById && !document.all;
var ie=document.all;

if (ie||w3c) {
 // déclaration des variables uniquement pour IE vive microsoft ?!!
 var overlay;
 var my_window;
}


function affiche_overlay_window(image_fond_overlay,adresse_page){
	// creation de l'overlay et affichage de l'image
	montreoverlay("<table class = 'image_calque ' valign = 'center' border = '0' align = 'center'><tr><td> <IMG  SRC='"+image_fond_overlay+"'></td></tr>");
	// creation de la fenętre
	montrefenetre(adresse_page);


}


function montreoverlay(text) {
  if (w3c||ie){
    var arrayPageSize = this.getPageSize();
	 
	 
    overlay = document.all ? document.all["overlay"] : document.getElementById ? document.getElementById("overlay") : ""
		overlay.style.width = arrayPageSize[0]+'px';
		overlay.style.height =arrayPageSize[1]+'px';
		overlay.innerHTML = text; // fixe le code HTML dans l'overlay balise (div)
    overlay.style.visibility = "visible"; // modification du style
		

  }
}

function montrefenetre(html) {
  if (w3c||ie){
    //affichage de la fenetre
	my_window = document.all ? document.all['window'] : document.getElementById ? document.getElementById('window') : ""
    my_window.style.visibility = "visible";

	// affichage du corps de la fenętre (balise iframe)
    my_window = document.all ? document.all['contempwindow'] : document.getElementById ? document.getElementById('contempwindow') : ""
    my_window.style.visibility = "visible";
    frames['contempwindow'].location.href= html ;

  }
}




function cachetout(a_reload) {
	if (w3c||ie){

	// masque la fenetre (balise div [window] )
	if (a_reload == true) window.parent.reloadpage();
	my_window = parent.document.getElementById('window');
	my_window.style.visibility = "hidden";

	// masque le contenu (balise iframe [contempwindow])
	my_window = parent.document.getElementById('contempwindow');
	my_window.style.visibility = "hidden";

	// masque l'overlay (balise div [overlay])
	my_window = document.all ? parent.document.all['overlay'] : parent.document.getElementById ? parent.document.getElementById('overlay') : ""
	my_window.style.visibility = "hidden";

	}


}

function reloadpage(){
	location.reload();
}



 function  getPageSize() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			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
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				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 = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}

