<?php
  if ((!isset($_showneige) || (isset($_showneige) && $_showneige==1)) && (strpos($HTTP_USER_AGENT,"Netscape/7.0")<1)):
?>
<!-- Hide this script from old browsers --

    var dBirthday, dMarry;
    var dImgPerso, imgPersoURL, nbImgPerso;

		emplacement="http://www.whiler.com/IMAGES/neige/";
		nbImg=0;
		randomColor = new Array();
		today = new Date();
		year = today.getYear();
		if (year<1900) {
			// Correction bug an 2000 avec Netscape
			year+=1900;
		}
		// Gestion des images en fonction de la date...
		dFlocon=Math.abs(DatePosition('01/12/'+year)+DatePosition('19/12/'+year));
		if (dFlocon>1)
		  dFlocon=Math.abs(DatePosition('05/01/'+year)+DatePosition('31/01/'+year));
		dNoel=Math.abs(DatePosition('20/12/'+year)+DatePosition('31/12/'+year));
		if (dNoel>1)
		  dNoel=Math.abs(DatePosition('01/01/'+year)+DatePosition('04/01/'+year));
		dHalloween=Math.abs(DatePosition('28/10/'+year)+DatePosition('03/11/'+year));
		dSaintPatrick=Math.abs(DatePosition('15/03/'+year)+DatePosition('18/03/'+year));
		dMusique=Math.abs(DatePosition('17/06/'+year)+DatePosition('25/06/'+year));
		dAutomne=Math.abs(DatePosition('23/09/'+year)+DatePosition('27/10/'+year));
		if (dAutomne>1)
		  dAutomne=Math.abs(DatePosition('04/11/'+year)+DatePosition('30/11/'+year));
		dPaques=Math.abs(DatePosition(formatDate(DayAdd(GetEasters(),-6)))+DatePosition(formatDate(DayAdd(GetEasters(),4))));
		dPluie=Math.abs(DatePosition('01/02/'+year)+DatePosition('14/03/'+year));
		if (dPluie>1)
		  dPluie=Math.abs(DatePosition('20/03/'+year)+DatePosition(formatDate(DayAdd(GetEasters(),-7))));
		dMuguet=Math.abs(DatePosition('30/04/'+year)+DatePosition('03/05/'+year));
		dPrintemps=Math.abs(DatePosition('19/03/'+year)+DatePosition('16/06/'+year));
		dEte=Math.abs(DatePosition('26/06/'+year)+DatePosition('22/09/'+year));
		
		if (dImgPerso=="yes") {
			nbImg = 1;
			imgsrc = imgPersoURL;
			// Nombre d'images simultanées sur l'écran
			N = nbImgPerso;
		}
		else if (dBirthday=="yes") {
			nbImg = 3;
			imgsrc = "birthday";
			// Nombre d'images simultanées sur l'écran
			N = 20;
		}
		else if (dMarry=="yes") {
			nbImg = 6;
			imgsrc = "marry";
			// Nombre d'images simultanées sur l'écran
			N = 5;
		}
		else if (dFlocon<2) {
			nbImg = 6;
			imgsrc = "flocon";
			// Nombre d'images simultanées sur l'écran
			N = 40;
		}
		else if (dNoel<2) {
			nbImg = 14;
			imgsrc = "noel";
			// Nombre d'images simultanées sur l'écran
			N = 20;
		}
		else if (dHalloween<2) {
			nbImg = 7;
			imgsrc = "halloween";
			// Nombre d'images simultanées sur l'écran
			N = 25;
		}
		else if (dSaintPatrick<2) {
			nbImg = 2;
			imgsrc = "saintpatrick";
			// Nombre d'images simultanées sur l'écran
			N = 20;
		}
		else if (dMusique<2) {
			nbImg = 1;
			imgsrc = "musique";
			// Nombre d'images simultanées sur l'écran
			N = 25;
		}
		else if (dAutomne<2) {
			nbImg = 2;
			imgsrc = "automne";
			// Nombre d'images simultanées sur l'écran
			N = 20;
		}
		else if (dPaques<2) {
			nbImg = 2;
			imgsrc = "paques";
			// Nombre d'images simultanées sur l'écran
			N = 25;
		}
		else if (dPluie<2) {
			nbImg = 2;
			imgsrc = "pluie";
			// Nombre d'images simultanées sur l'écran
			N = 15;
		}
		else if (dMuguet<2) {
			nbImg = 1;
			imgsrc = "muguet";
			// Nombre d'images simultanées sur l'écran
			N = 20;
		}
		else if (dPrintemps<2) {
			nbImg = 3;
			imgsrc = "printemps";
			// Nombre d'images simultanées sur l'écran
			N = 5;
		}
		else if (dEte<2) {
			nbImg = 4;
			imgsrc = "ete";
			// Nombre d'images simultanées sur l'écran
			N = 15;
		}
		
		if (nbImg>0) {
			// Génération des n images
			for (i=1; i<=nbImg; i++) {
				if (dImgPerso=="yes") {
					eval('imgsrc'+i+'="'+imgsrc+'.gif";');
				}
				else {
					eval('imgsrc'+i+'="'+emplacement+imgsrc+i+'.gif";');
				}
			}
			
			// Script commun
			Y = new Array();
			X = new Array();
			S = new Array();
			A = new Array();
			B = new Array();
			M = new Array();
			V = (document.layers)?1:0;
		
			for (i=0; i < N; i++){
			  flakeColor = Math.ceil(Math.random()*nbImg);
			  eval('randomColor['+i+']=imgsrc'+flakeColor+';');
		  }
		
			iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;
			iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;
			for (i=0; i < N; i++){                                                                
				Y[i]=Math.round(Math.random()*iH);
				X[i]=Math.round(Math.random()*iW);
				S[i]=Math.round(Math.random()*5+1);
				A[i]=0;
				B[i]=Math.random()*0.1+0.1;
				M[i]=Math.round(Math.random()*1+5);
			}
			if (V){
				for (i = 0; i < N; i++) {
				  document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 ><img src='"+randomColor[i]+"'></LAYER>");
				}
			}
			else {
				document.write('<div style="position:absolute;top:0px;left:0px;z-index:"'+i+'>');
				document.write('<div style="position:relative;z-index:'+i+'">');
				for (i = 0; i < N; i++) {
					document.write('<div id="si'+i+'" style="position:absolute;top:0;left:0;"><img src="'+randomColor[i]+'"></div>')
				}
				document.write('</div></div>');
			}
			function snow() {
				var H=(document.layers)?window.innerHeight-40:window.document.body.clientHeight-40;
				var W=(document.layers)?window.innerWidth-40:window.document.body.clientWidth-40;
				var T=(document.layers)?window.pageYOffset:document.body.scrollTop;
				var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;
				for (i=0; i < N; i++){
					sy=S[i]*Math.sin(90*Math.PI/180);
					sx=S[i]*Math.cos(A[i]);
					Y[i]+=sy;
					X[i]+=sx; 
					if (Y[i] > H){
					Y[i]=-10;
					X[i]=Math.round(Math.random()*W);
					M[i]=Math.round(Math.random()*1+1);
					S[i]=Math.round(Math.random()*5+2);
				}
				if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}
				else{
				 document.getElementById("si"+i).style.top = Y[i]+T;
				 document.getElementById("si"+i).style.left = X[i];
//				si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T
				} 
				A[i]+=B[i];
				}
				setTimeout('snow()',100);
			}
		  snow();
		}

function withTwoDigits(number) {
	var retour=""+number;
	if (retour.length==1) {
		retour="0"+retour;
	}
	return retour;
}


//  GLOBAL VARIABLES
//  ~~~~~~~~~~~~~~~~
   var jDay = 0;
   var jMonth = 0;
   var oDay = 0;
   var oMonth = 0;
   var wDay = 0;
   var wMonth = 0;
   var year = 0;
	
//  STARTUP CODE
//  ~~~~~~~~~~~~

// check browser is version 2 or more
   if (parseFloat(navigator.appVersion) < 2)
      alert ("You may need to upgrade your browser !!!");

//  FUNCTIONS
//  ~~~~~~~~~
function GetEasters()
{
	today = new Date();
	year = today.getYear();
	if (year<1900) {
		// Correction bug an 2000 avec Netscape
		year+=1900;
	}
  year = parseInt(year, 10);
  if (isNaN(year))
      year = 0;

	// reset vars
	jDay = 0;
	jMonth = 0;
	oDay = 0;
	oMonth = 0;
	wDay = 0;
	wMonth = 0;
	
	EasterWestern ();
	today.setDate(wDay);
	today.setMonth(wMonth);
	today.setYear(year);
	return today;
}

function IntDiv (num, dvsr)
// performs integer division of num/dvsr - eg IntDiv(9,4)=2
{
   var negate = false;
   var result = 0;

   if (dvsr == 0)
      return null;
   else {
      if (num * dvsr < 0 )
         negate = true;
      if (num < 0)
         num = -num;
      if (dvsr < 0)
         dvsr = -dvsr;
      result = ((num - (num % dvsr)) / dvsr);
      if (negate)
         return -result;
      else
         return result;
   }
}

function EasterWestern()
{
   var g = 0;
   var c = 0;
   var h = 0;
   var i = 0;
   var j = 0;
   var p = 0;

   g = year % 19;
   c = IntDiv(year, 100);
   h = (c - IntDiv(c, 4) - IntDiv(8 * c + 13, 25) + 19 * g + 15) % 30;
   i = h - IntDiv(h, 28) * (1 - IntDiv(h, 28)
      * IntDiv(29, h + 1) * IntDiv(21 - g, 11));
   j = (year + IntDiv(year, 4) + i + 2 - c + IntDiv(c, 4)) % 7;
   p = i - j + 28;

   wDay = p;
   wMonth = 4;
   if (p > 31)
      wDay = p - 31;
   else
      wMonth = 3;
}

function DatePosition(dateString) {
/*
   function DatePosition 
   parameters: dateString
   returns: integer (-1, 0, 1)
   
   dateString is a date passed as a string in the following
   formats:

   Format de la date à passer : 29/05/1997
   
   dateType is a numeric integer from 1 to 7, representing
   the type of dateString passed, as defined above.

   Returns -1 if the date passed is behind todays date
   Returns 0 if the date passed is equal to todays date
   Returns 1 if the date passed is ahead of todays date
   
   Added Y2K checking.  (Works for any century cross over)
*/


    var now = new Date();
    actualYear=now.getYear();
		if (actualYear<1900) {
			// Correction bug an 2000 avec Netscape
			actualYear+=1900;
		}
    var today = new Date(actualYear,now.getMonth(),now.getDate());
    var century = parseInt(now.getYear()/100)*100;
        
    var date = new Date(dateString.substring(6,10),
                        dateString.substring(3,5)-1,
                        dateString.substring(0,2));
        
    if (date < today)
    {
        return -1;
    }
    else if (date > today)
    {
        return 1;
        
    }
    else
    {
        return 0;
    }
}

// Retourne une date en fonction du nombre de jour de différence
function DateAdd(startDate, numDays, numMonths, numYears)
{
	var returnDate = new Date(startDate.getTime());
	var yearsToAdd = numYears;
	
	var month = returnDate.getMonth()	+ numMonths;
	if (month > 11)
	{
		yearsToAdd = Math.floor((month+1)/12);
		month -= 12*yearsToAdd;
		yearsToAdd += numYears;
	}
	returnDate.setMonth(month);
	returnDate.setFullYear(returnDate.getFullYear()	+ yearsToAdd);
	
	returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);
	
	return returnDate;
}

function YearAdd(startDate, numYears)
{
		return DateAdd(startDate,0,0,numYears);
}

function MonthAdd(startDate, numMonths)
{
		return DateAdd(startDate,0,numMonths,0);
}

function DayAdd(startDate, numDays)
{
		return DateAdd(startDate,numDays,0,0);
}

function formatDate(uneDate) {
	leJour=withTwoDigits(uneDate.getDate());
	leMois=withTwoDigits(uneDate.getMonth());
	lAnnee=uneDate.getYear();
	if (lAnnee<1900) {
	// Correction bug an 2000 avec Netscape
	lAnnee+=1900;
	}
	return leJour+"/"+leMois+"/"+lAnnee;
}
// -- End Hiding Here -->
<?php
  endif;
?>