
var fenetre="";
var ns4 = (document.layers)? true:false;			//NS 4
var ie4 = (document.all)? true:false;			//IE 4
var dom = (document.getElementById)? true:false;	//DOM
var xMax, yMax, xOffset, yOffset;
var nom_chemin="";
var nom_fichier="";
var taille="";
var format="";
var retour="";
var fen = null ;


/* ouvre une fenetre ( sert pour les fiches de postes ) */

function fenetre(url) { 



if ((fen == null) || (fen.closed))

  {

  fen=window.open (url,'fenetre','scrollbars=yes, resizable=yes,width=600,height=450');

  }

else

  {

  fen.location = url;

  fen.focus();

  }

}
function affiche_document_sans_background(chemin,fichier,longueur,type_retour,type_format)
{
var HTMLCode="";



// affectation des variables nom_chemin et nom_fichier
nom_chemin = chemin;
nom_fichier = fichier;
taille = longueur;
format = type_format;
//format=type_format;
retour=type_retour;

 

HTMLCode+="<body topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";


if (format=="A4")
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=160 height=45 style=div style='position:absolute;top:25px;left:730px'>";
}
else // format A3
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=160 height=45 style=div style='position:absolute;top:25px;left:1430px'>";
}
  HTMLCode+="<TBODY><TR>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:15px'><input type='image' src='http://glenans/images/imprimer.jpg' alt='imprimer' onclick=window.print()></TD>";
  HTMLCode+="</DIV></TD>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:60px'><input type='image' height=30 width=40 src='http://glenans/images/download.gif' alt='télécharger' onclick=telecharger()>"; 
 
  if ( retour=="history") // retour sur la page precedente
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:115px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=history.go(-1)>"; 
  }
  else // retour en fermenat la fenetre
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:115px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=window.close()>"; 
  }
  HTMLCode+="</DIV></TD>";
  HTMLCode+="</TR>";
  HTMLCode+="</TABLE></TR></TBODY><BR>";

HTMLCode+="</BODY>";

document.write(HTMLCode);
}



function affiche_document(chemin,fichier,longueur,type_retour,type_format)
{
var HTMLCode="";



// affectation des variables nom_chemin et nom_fichier
nom_chemin = chemin;
nom_fichier = fichier;
taille = longueur;
format = type_format;
//format=type_format;
retour=type_retour;

 

HTMLCode+="<body background=http://glenans/images/fond.jpeg topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";


if (format=="A4")
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=160 height=45 style=div style='position:absolute;top:25px;left:730px'>";
}
else // format A3
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=160 height=45 style=div style='position:absolute;top:25px;left:1430px'>";
}
  HTMLCode+="<TBODY><TR>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:15px'><input type='image' src='http://glenans/images/imprimer.jpg' alt='imprimer' onclick=window.print()></TD>";
  HTMLCode+="</DIV></TD>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:60px'><input type='image' height=30 width=40 src='http://glenans/images/download.gif' alt='télécharger' onclick=telecharger()>"; 
 
  if ( retour=="history") // retour sur la page precedente
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:115px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=history.go(-1)>"; 
  }
  else // retour en fermenat la fenetre
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:115px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=window.close()>"; 
  }
  HTMLCode+="</DIV></TD>";
  HTMLCode+="</TR>";
  HTMLCode+="</TABLE></TR></TBODY><BR>";

HTMLCode+="</BODY>";

document.write(HTMLCode);

}

function retour_page_precedente()
{
var HTMLCode="";
HTMLCode+="<body topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";

HTMLCode+="<TABLE border=1 bordercolor=blue width=60 height=45 style=div style='position:absolute;top:420px;left:360px'>";
HTMLCode+="<TBODY><TR>";
HTMLCode+="<TD><DIV style='position:absolute;top:10px;left:15px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='retour sur la page précédente' onclick=history.go(-1);>"; 
HTMLCode+="</DIV></TD>";
HTMLCode+="</TR>";
HTMLCode+="</TABLE></TR></TBODY><BR>";
HTMLCode+="</BODY>";

document.write(HTMLCode);
}

function affiche_document_sans_telecharger(chemin,fichier,longueur,type_retour,type_format)
{
var HTMLCode="";



// affectation des variables nom_chemin et nom_fichier
nom_chemin = chemin;
nom_fichier = fichier;
taille = longueur;
format = type_format;
//format=type_format;
retour=type_retour;

 

HTMLCode+="<body background=http://glenans/images/fond.jpeg topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";


if (format=="A4")
{
  
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:10px;left:760px'>";
}
else // format A3
{
  
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:25px;left:2930px'>";
}
  HTMLCode+="<TBODY><TR>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:15px'><input type='image' height=30 width=40 src='http://glenans/images/imprimer.jpg' alt='imprimer' onclick=window.print()>"; 
 
  if ( retour=="history") // retour sur la page precedente
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:75px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=history.go(-1)>"; 
  }
  else // retour en fermant la fenetre
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:75px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=window.close()>"; 
  }
  HTMLCode+="</DIV></TD>";
  HTMLCode+="</TR>";
  HTMLCode+="</TABLE></TR></TBODY><BR>";

HTMLCode+="</BODY>";

document.write(HTMLCode);

}

function affiche_document_sans_quitter(chemin,fichier,longueur,type_retour,type_format)
{
var HTMLCode="";



// affectation des variables nom_chemin et nom_fichier
nom_chemin = chemin;
nom_fichier = fichier;
taille = longueur;
format = type_format;
//format=type_format;
retour=type_retour;

 

HTMLCode+="<body background=http://glenans/images/fond.jpeg topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";


if (format=="A4")
{
  
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:10px;left:760px'>";
}
else // format A3
{
  
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:25px;left:2930px'>";
}
  HTMLCode+="<TBODY><TR>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:15px'><input type='image' height=30 width=40 src='http://glenans/images/imprimer.jpg' alt='imprimer' onclick=window.print()>"; 
 
  HTMLCode+="</DIV></TD>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:70px'><input type='image' height=30 width=40 src='http://glenans/images/download.gif' alt='télécharger' onclick=telecharger()>";
  HTMLCode+="</DIV></TD>";
  HTMLCode+="</TR>";
  HTMLCode+="</TABLE></TR></TBODY><BR>";

HTMLCode+="</BODY>";

document.write(HTMLCode);

}

function affiche_document_sans_impression(chemin,fichier,longueur,type_retour,type_format)
{
var HTMLCode="";



// affectation des variables nom_chemin et nom_fichier
nom_chemin = chemin;
nom_fichier = fichier;
taille = longueur;
format = type_format;
//format=type_format;
retour=type_retour;

 
//alert("chemin = " + nom_chemin + " fichier = " + nom_fichier + " taille = " + longueur + " format = " + format + " retour = " + retour);

HTMLCode+="<body background=http://glenans/images/fond.jpeg topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";


if (format=="A4")
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:10px;left:760px'>";
}
else // format A3
{
  HTMLCode+="<TABLE border=1 bordercolor=blue width=120 height=45 style=div style='position:absolute;top:25px;left:1430px'>";
}
  HTMLCode+="<TBODY><TR>";
  HTMLCode+="<TD><div style='position:absolute;top:5px;left:15px'><input type='image' height=30 width=40 src='http://glenans/images/download.gif' alt='télécharger' onclick=telecharger()>"; 
 
  if ( retour=="history") // retour sur la page precedente
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:75px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=history.go(-1)>"; 
  }
  else // retour en fermant la fenetre
  {
    HTMLCode+="<TD><DIV style='position:absolute;top:5px;left:75px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=window.close()>"; 
  }
  HTMLCode+="</DIV></TD>";
  HTMLCode+="</TR>";
  HTMLCode+="</TABLE></TR></TBODY><BR>";

HTMLCode+="</BODY>";

document.write(HTMLCode);

}

function telecharger()
{

var codeHTML="";
codeHTML="http://glenans/php/telecharger.php?nom_fichier="+nom_fichier;
codeHTML+="&chemin_fichier=" + nom_chemin +"&taille="+ taille + " method=post";


//var essai= nom_chemin + nom_fichier;


window.location=codeHTML;

}


function ouvreFenetreScroll(nom1,intitule)
{

ouvre_fenetre_scroll(nom1,intitule,950,650);

}

function ouvre_fenetre_scroll(MyFile,MyWindow,MyWidth,MyHeight)
{
 
//MyFile :		nom du fichier contenant le code HTML du pop-up
//MyWindow :	nom de la fenêtre (ne pas mettre d'espace)
//MyWidth :		entier indiquant la largeur de la fenêtre en pixels
//MyHeight :	entier indiquant la hauteur de la fenêtre en pixels

	var ns4 = (document.layers)? true:false;			//NS 4
	var ie4 = (document.all)? true:false;			//IE 4
	var dom = (document.getElementById)? true:false;	//DOM
	var xMax, yMax, xOffset, yOffset;
	var retour,fenetre;

		xMax = 800;
		yMax = 600;

		
	xOffset = (xMax - MyWidth)/2;
	yOffset = (yMax - MyHeight)/2;
	
	
    if (fenetre) {
		if (!fenetre.closed) {
			fenetre.focus();
			return;
		}
	} 
	 
	fenetre = window.open(MyFile,"",'scrollbars=yes,width=950,height=650,resizable=yes,status=no,title=yes');
		
 }

function ouvreFenetre2(nom)
{

ouvre_fenetre2(nom,950,650);

}

function ouvre_fenetre2(MyFile,MyWindow,MyWidth,MyHeight)
{
 
//MyFile :		nom du fichier contenant le code HTML du pop-up
//MyWindow :	nom de la fenêtre (ne pas mettre d'espace)
//MyWidth :		entier indiquant la largeur de la fenêtre en pixels
//MyHeight :	entier indiquant la hauteur de la fenêtre en pixels

	var ns4 = (document.layers)? true:false;			//NS 4
	var ie4 = (document.all)? true:false;			//IE 4
	var dom = (document.getElementById)? true:false;	//DOM
	var xMax, yMax, xOffset, yOffset;
	var retour,fenetre;

		xMax = 800;
		yMax = 600;

		
	xOffset = (xMax - MyWidth)/2;
	yOffset = (yMax - MyHeight)/2;
	
	
    if (fenetre) {
		if (!fenetre.closed) {
			fenetre.focus();
			return;
		}
	} 
	 
	fenetre = window.open(MyFile,"",'toolbar=yes, menubar=yes, scrollbars=yes,width=950,height=650,resizable=yes,status=yes,title=yes');
		
 }
function ouvreFenetre(nom,intitule)
{

ouvre_fenetre(nom,intitule,950,650);

}

function ouvre_fenetre(MyFile,MyWindow,MyWidth,MyHeight)
{
 
//MyFile :		nom du fichier contenant le code HTML du pop-up
//MyWindow :	nom de la fenêtre (ne pas mettre d'espace)
//MyWidth :		entier indiquant la largeur de la fenêtre en pixels
//MyHeight :	entier indiquant la hauteur de la fenêtre en pixels

	var ns4 = (document.layers)? true:false;			//NS 4
	var ie4 = (document.all)? true:false;			//IE 4
	var dom = (document.getElementById)? true:false;	//DOM
	var xMax, yMax, xOffset, yOffset;
	var retour,fenetre;

		xMax = 800;
		yMax = 600;

		
	xOffset = (xMax - MyWidth)/2;
	yOffset = (yMax - MyHeight)/2;
	
	
    if (fenetre) {
		if (!fenetre.closed) {
			fenetre.focus();
			return;
		}
	} 
	 
	fenetre = window.open(MyFile,"",'scrollbars=no,width=950,height=650,resizable=yes,status=no,title=yes');
		
 }
		

function affiche_page(no,titre)
{
  window.location=no;
}



function affiche_page2(no,titre)
{
var HTMLCode="";

HTMLCode+="<body background=http://glenans/images/fond.jpeg topMargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=auto>";
/*HTMLCode+="form action="../php/telechargement.php" method="post">*/
HTMLCode+="<TBODY><TR><TABLE  align=center border=0>";
HTMLCode+="<TBODY><TR>";
HTMLCode+="<TD width=100><div style='position:absolute;top:10px;left:600px'><input type='image' src='http://glenans/images/imprimante.gif' alt='imprimer' onclick=window.print()></TD>";
HTMLCode+="</DIV></TD>";
HTMLCode+="<TD width=100><div style='position:absolute;top:10px;left:700px'><input type='image' src='http://glenans/images/telecharger2.jpg' alt='télécharger' onclick=telecharger.php()>"; 
HTMLCode+="<TD><DIV style='position:absolute;top:10px;left:850px'><input type='image' src='http://glenans/images/Quitter.jpg' alt='fermer la fenêtre' onclick=window.close()>"; 
HTMLCode+="</DIV></TD>";
HTMLCode+="</TR></TBODY>";
HTMLCode+="</TABLE></TR></TBODY><BR>";
window.location=no;
document.write(HTMLCode);

}

function cree_cookie(nom,titre,jours)
{
 var expireDate = new Date();
      expireDate.setTime(expireDate.getTime() + jours*24*3600*1000);
      document.cookie = nom + "=" + escape(titre)
         + ";expires=" + expireDate.toGMTString();
 
}

function lit_cook(nom) {
      var deb,fin
      deb = document.cookie.indexOf(nom + "=")
      if (deb >= 0) {
         deb += nom.length + 1
         fin = document.cookie.indexOf(";",deb)
         if (fin < 0) fin = document.cookie.length
         return unescape(document.cookie.substring(deb,fin))
      }
      return ""

}

function litCook(nom) {
      var c=lit_cook(nom)
      if(c=="") alert("Le cookie est vide !")
      else return(c)
      }
	  
function tue_cook(nom) { cree_cookie(nom,"",-1) }
      
function telecharger(nom_fichier,chemin)
{

parent.location=("../php4/telecharger.php?nom_fichier=" + nom_fichier + "&chemin_fichier=" + chemin );
}


