
function montrepage()
{
   var h = window.outerHeight;
   var w = window.outerWidth;
   var y = window.pageYOffset;
   if( !isNaN(parseInt(y)) && !isNaN(parseInt(h)) )
   {
    h = parseInt(h) - 150;
    y = parseInt(y);
    var t = Math.abs(600-h) >> 1;
    var c = $('Content');
    var p = $('Page');
    if(c) c.style.height=h+'px;';
    if(p) { p.style.top = t+'px;'; p.style.display = "block"; }
    if(document.getElementById('AnnoncePopup'))
    {
     var p = document.getElementById('AnnoncePopup');
     p.top = (HEIGHT >>1 - 250)+"px";
     //p.left = (WIDTH >>1 - 350)+"px";

     setTimeout( function() {
     	var p = document.getElementById('AnnoncePopup');
		p.style.display="block";     
     } , 1000 );

     
     setTimeout( function() {
     	var p = document.getElementById('AnnoncePopup');
		p.style.display="none";     
     } , 5*1000 );
    }
   }
   else
   {
    var p = $('Page');
    if(p) p.style.display="block";
   }
   
   try {
    autoload();
    FONCTION_AUTOLOAD_PRESENTE = true;
   }
   catch(e) {
    // capture de l'erreur du lancement d'autoload
    FONCTION_AUTOLOAD_PRESENTE = false;
   }
}

function cachepage()
{
    var p = $('Page');
    if(p) p.style.display="none";
}

function popupbegin(nomimage,langue)
{
	var d = $('PopUp');
	if(!d)
	{
	 // on a peut-etre oublie d'ajouter la div...
	 var h = document.body.innerHTML +'<div id="PopUp"></div>';
	 document.body.innerHTML = h;
	 d = $('PopUp');
	}
	if(d) d.style.display="none";
	
	var c = $('Content');
	if(c) c.style.display="none"; 	
	
	var al = $('AjaxLoader');
	if(al)
	{
		var T = Math.ceil(HEIGHT/2)+'px';
		var L = Math.ceil(WIDTH/2)+'px';
		try {
		al.style.display='block';
		al.style.top = T;
		al.style.left = L;
		} catch(e) {
		}
	}

	new ajax('image-ajax.php5',
			{postBody: 'nomimage='+escape(nomimage)+'&langue='+escape(langue), onComplete: popupend, update: $('PopUp'), method: 'post'}
	).request();

}

function popupend(request)
{
	// rien a faire de plus...
}

function image_ajaxed_is_loaded(obj)
{
	var w = obj.width;
	var x = w<WIDTH ? ( WIDTH/2 - w/2 ) : 10;

	var d = $('PopUp');
	if(d) {
		d.style.left = x+"px";
		d.style.top = "10px";
		d.style.display="block"; 
	}
	
	var al = $('AjaxLoader');
	if(al) al.style.display='none';
}

function popupclose()
{
	var d = $('PopUp');
	if(d) {  d.style.display="none"; d.innerHTML=""; }
	var c = $('Content');
	if(c) c.style.display="block"; 	
}

function mml(domaine,utilisateur)
{
	var all = utilisateur.split("|").join(".") + "@" + domaine.split("|").join(".");
	document.write('<a href="mailto:'+ all +'">'+ all +'</a>');		
}

function mkl(texte_lien,url)
{
	if(url==undefined) url = ""+ texte_lien;
	var all = url.split("|").join(".") + '" target="_blank">' + texte_lien.split("|").join(".");
	document.write('<a href="http://'+ all +'</a>');		
}



   var FONCTION_AUTOLOAD_PRESENTE = false;
   var HEIGHT = parseInt(window.outerHeight);
   if(''+HEIGHT=='NaN') HEIGHT = 500;
   var WIDTH = parseInt(window.outerWidth);
   if(''+WIDTH=='NaN') WIDTH = 700;


//   window.addEvent('domready', montrepage );
     window.onload = montrepage;
//fin

