////////////////////////////////////////////////////
// Programmation JavaScript - Philippe Jarlan - janvier 2002
// Code commun 
////////////////////////////////////////////////////

//Date courante 
	d = new Date();
	j= d.getDay();
	day=d.getDate();
	m = d.getMonth();

	
	if (navigator.appName.indexOf("Netscape")!=-1){
	var a=(d.getYear()+1900);
	}
	else{
	var a=d.getYear();
	}
	var jour=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
	var mois=new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
	var Ladate=(jour[j]+" "+day+" "+mois[m]+" "+a);


// Ouverture d'une fenêtre contenant une topo et la légende
function OpenTopo(img,txt) {


img='../Topos/'+img;
rp='../Media';
titre='Les topos';


w=open("",'image','width=700,height=400,left=0,top=0,toolbar=no,scrollbars=yes,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE><style type='text/css' media='print'>div.page{writing-mode: tb-rl;height:80%;margin:10% 0%;}</style></HEAD>");
	w.document.write("<BODY text='#0033CC' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><BR><CENTER><H3>"+txt+"</H3></CENTER><IMG src='"+img+"' border=0 alt='"+img+"'><div align='right'><a href='Javascript:self.print()'><img src='"+rp+"/imp.gif' width='23' height='21' border='0'></a><a href='Javascript:self.close()'><img src='"+rp+"/close.gif' width='23' height='21' border='0'></a></div>");
	w.document.write("<BR></div></BODY></HTML>");
	w.document.close();
}

// Ouverture d'une fenêtre contenant une topo et la légende
function OpenRetro(img,txt) {


img='Retro/'+img;
rp='Media';
titre='Rétro';

w=open("",'image','width=700,height=400,left=0,top=0,toolbar=no,scrollbars=yes,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE><style type='text/css' media='print'>div.page{writing-mode: tb-rl;height:80%;margin:10% 0%;}</style></HEAD>");
	w.document.write("<BODY text='#0033CC' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><BR><CENTER><H3>"+txt+"</H3></CENTER><IMG src='"+img+"' border=0 alt='"+img+"'><div align='right'><a href='Javascript:self.print()'><img src='"+rp+"/imp.gif' width='23' height='21' border='0'></a><a href='Javascript:self.close()'><img src='"+rp+"/close.gif' width='23' height='21' border='0'></a></div>");
	w.document.write("<BR></div></BODY></HTML>");
	w.document.close();
}


// Ouverture popup
function popup(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
// Ouverture d'une fenêtre popup centrée et ajustée à l'image
function OpenFen(img) {
var largeur = 590;
var hauteur = 800;
titre='Images';
rp='../Media';

var top=(screen.height-largeur)/2;
var left=(screen.width-largeur)/2;
var options='toolbar=no,scrollbars=no,resizable=no,status=no,directories=no';

w=window.open("","","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE><style type='text/css' media='print'>div.page{writing-mode: tb-rl;height:100%;margin:10% 0%;}</style><script type='text/javascript'>window.onload = function () { var img = document.getElementById('img'); var hImg = img.offsetHeight; var lImg = img.offsetWidth; window.resizeTo(lImg+10, hImg+80); }</script></HEAD>");
w.document.write("<body text='#0033CC' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG id='img' src='"+img+"' border=0 alt='"+img+"'><div style='position: absolute; top: 0px; left: 0px; zIndex: 1;'><a href='Javascript:self.print()' title='Imprimer'><img src='"+rp+"/imp.gif' width='23' height='21' border='0'></a>&nbsp;<a href='Javascript:self.close()' title='Fermer la fenêtre'><img src='"+rp+"/close.gif' width='23' height='21' border='0'></a></div>");
w.document.write("<BR></div></BODY></HTML>");
w.document.close();
}

function DefilementNews(conteneur, defilement, pas, tempo) {
   this.pas = pas;
   this.tempo = tempo;
   this.conteneur = conteneur;
   with (this.conteneur.style) {
      position = "relative";
      overflow = "hidden";
   }
   this.defilement = defilement;
   with (this.defilement.style) {
      position = "absolute";
      top = (this.conteneur.offsetHeight / 2) + "px";
   }
   this.start();
   var objet = this;
   this.conteneur.onmouseover = function () { objet.stop(); };
   this.conteneur.onmouseout = function () { objet.start(); };
   window.onunload = this.stop;
}
DefilementNews.prototype.defiler = function () {
   if (parseInt(this.defilement.style.top) + this.defilement.offsetHeight < 0) {
      this.defilement.style.top = this.conteneur.offsetHeight + "px";
   }
   else {
      this.defilement.style.top = parseInt(this.defilement.style.top) - this.pas + "px";
   }
}
DefilementNews.prototype.start = function () {
   var objet = this;
   this.timer = setInterval(function () { objet.defiler(); }, this.tempo);
}
DefilementNews.prototype.stop = function () {
   clearInterval(this.timer);
   this.timer = null;
}

