// Fonction ouvreFenetre (Pop Up)
// url,nom,dimx,dimy,menus,centrer,masque

var browser = 0; var version = parseInt(navigator.appVersion);
if (navigator.appName.substring(0,8) == "Netscape" && version > 3 ) browser = 1;
if (navigator.appName.substring(0,9) == "Microsoft" &&  version >= 4 ) browser = 1;
if (navigator.appName.substring(0,9) == "Microsoft" &&  version > 3 && navigator.appVersion.indexOf("Mac") > 0 ) browser = 1;

var newwindow;

function popup(url1,nom,dimx,dimy,menus,centrer,masque) {
  if (browser == 0 && navigator.appVersion.indexOf("Win") > 0) dimy=dimy-19;
  if (centrer == 2){ LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-dimx)):100;
                     TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-dimy)-75)):100;}
  if (centrer == 1){ LeftPosition=(screen.width)?(screen.width-dimx)/2:100;
                     TopPosition=(screen.height)?(screen.height-dimy)/2:100;}
       if (menus == 1) { featur = "toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,"; } 
  else if (menus == 2) { featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,"; }
  else if (menus == 3) { featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,"; }
  else if (menus == 4) { featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,"; }
                  else { featur = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,"; }
  featur = featur + "width="+ dimx + ",height=" + dimy + ",top="+TopPosition+",left="+LeftPosition+',screenX='+LeftPosition+',screenY='+TopPosition;
  if (masque == 1) { newwindow = window.open("",nom,featur); cl.blur(); self.focus(); cl.location=url1; }
              else { newwindow = window.open(url1,nom,featur); if (window.focus) { newwindow.focus() } }
  }


// Teste si formulaire de recherche non vide
function Recherche(requete) {
	if(requete=='Rechercher') return false;
	if(!requete) return false;
	return true;
}


// Fonction Flyer
// par Michel Poulain (La Shampoo)

var popUpwin=new Date(); var gauche=0; var haut=0; 

function popImage(image,largeur,hauteur,couleur,titre) {
	
	hauteur = (hauteur*1)-1; // to avoid vetical lift 
	largeur = (largeur*1)-2; // turn into numerical
    titre   = titre.replace(/\"/g,'&quot;');
    
	if( (screen.width-(largeur+gauche))<0 ) 
			{ gauche=0; haut=haut+200; }
	if( (screen.height-(hauteur+haut))<0 ) 
			{ gauche=0; haut=0; }

    popUpwin++; page = window.open('about:blank',i,
    'width='+largeur+',height='+hauteur+
    ',menubar=no,status=no,toolbar=no,scrollbars=no'+
    ',resizable=no,dependent=yes,left='+gauche+',top='+haut+
    ',screenX='+gauche+',screenY='+haut);

    setTimeout('displayImage("'+image+'","'+titre+
    '","'+largeur+'","'+hauteur+'","'+couleur+'")',20); 
    
	gauche=gauche+largeur; //window.focus();


}


function displayImage(image,titre,largeur,hauteur,couleur) { 

    var contenu = "<HTML><HEAD><TITLE>"+titre+"</TITLE>\n"+
    '<' + 'script type="text/javascript" language="javascript">'+
    'document.onkeypress = function Ferme() { '+
    'if (event.keyCode==27) window.close(); }<'+'/script>'+
    "<BASE HREF='http://"+location.host+"/'></HEAD>\n" +
    '<BODY bgcolor="'+couleur+'" LEFTMARGIN="0" MARGINWIDTH="0" ' +
    'TOPMARGIN="0" MARGINHEIGHT="0"> <CENTER>' + "\n" +
    '<IMG src="'+image+'" alt="'+titre+'" border="0" ' +
    'onclick="window.close()" title="Cliquez ici pour fermer">' + 
    "\n" +'</CENTER></BODY></HTML>';

    page.document.write(contenu);

}

