// JavaScript Document
// AFFICHAGE DE LA DATE DU JOUR
date=new Date();
function mois() {
argnr = mois.arguments.length
for (var i = 0; i < argnr; i++)
this[i+1] = mois.arguments[i]
}
var isnMonths= new mois("JANVIER","FEVRIER","MARS","AVRIL","MAI","JUIN","JUILLET",
"AOUT","SEPTEMBRE","OCTOBRE","NOVEMBRE","DECEMBRE");
var jours= new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi",
"Samedi");
var intYear = date.getYear() + ( (date.getYear() < 1900) ?
1900 : 0 ) ;

function affichDate(){
document.write (jours[date.getDay()] +" "+ date.getDate() +" "+ isnMonths[date.getMonth() + 1]);
};
	
// AFFICHAGE DU MOIS + ANNEE DANS COPYRIGHT
function affichDateDroits(){
document.write (isnMonths[date.getMonth() + 1] + '&nbsp;' + intYear);};
	
// ouverture des pop-ups
function ouvrirmag(){
	window.open('mag.htm','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=no,width=500, height=262,');
};

function ouvrirplan(){
	window.open('plan.htm','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=yes,resizable=yes,width=623, height=600');
};

function ouvrirphoto(){
	window.open('PhotJumel.htm','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=yes,resizable=yes,width=800, height=490');
};


function ouvririnfos()
{
window.open('infosorties.htm','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=yes,resizable=no,width=520, height=600');
};
function ouvririnfos2()
{
window.open('infosorties2.htm','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=yes,resizable=no,width=520, height=600');
};

// LES SCRIPTS DE DREAMWEAVER
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];}}
}

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_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

// POUR LE MENU DEROULANT DE ADMIN.HTM
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// pour l'encadré qui défile

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var delay = 4000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

/* Attention : n'afficher que 3 dates. Sinon : modifier le code ci-dessous*/
/* 8 lignes maxi */
var fcontent=new Array();
begintag='<div style="font: normal 10px Verdana; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<div  class=\"menugris\" align=\"center\"><br><br><h4>EN SEPTEMBRE</h4> <h4>AU BREUIL</h4></div>";
fcontent[1]="<div  class=\"menugris\" align=\"center\"><br><a href=\"sorties.htm\" target=\"_self\">5 SEPTEMBRE 2010<h4>CONCERT CAMERATA ALMA VIVA</h4><strong>VOYAGE DANS D\'AUTRES EUROPES<br>des Fjords à la Puszta<br>17H00 Eglise du Breuil</strong></a></div>";
fcontent[2]="<div  class=\"menugris\" align=\"center\"><br><a href=\"sorties.htm\" target=\"_self\">DU 24 SEPTEMBRE AU 10 OCTOBRE<h4>EXPOSITION DE VITRAUX</h4><strong>ANNIE REGNAULT <br>MICHEL ANDROUIN<br>Salle des expositions, en mairie</strong></a></div>";
fcontent[3]="<div  class=\"menugris\" align=\"center\"><br><a href=\"sorties.htm\" target=\"_self\">SAMEDI 25 SEPTEMBRE 2010<h4>LOTO DU COMIT&Eacute; DE JUMELAGE</h4><strong>Au profit du CCAS</strong></a></div>";
closetag='</div>';
var fwidth='218px'; //set scroller width
var fheight='113px'; //set scroller height


var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

/* 
if (ie4||DOM2)
  document.write('<div style="border:1px solid grey; position:absolute; top: 200px; left :4px; background-color: white;"><div id="fscroller" style="width:'+fwidth+';height:'+fheight+'"></div></div>');
  */

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent