// --- Détection Browser
//IsNS  = (document.layers)?1:0;
IsNS = false;
IsNS6 = (document.getElementById&&!document.all)?1:0;       // --- also firefox
IsIE  = document.all?1:0;

IsNoel = true;

function GetWindowHeight() 
{
  	if (IsIE) return document.body.clientHeight;
  	if (IsNS) return window.innerHeight;
  	if (IsNS6) return window.innerHeight;
  	return 0;
}

function GetWindowWidth() 
{
  	if (IsIE) return document.body.clientWidth;
  	if (IsNS) return window.innerWidth;
  	if (IsNS6) return window.innerWidth;
  	return 0;
}

// --- début du script

  // nécessaire pour activer le script neige et pour centrer le texte?????
//  document.write ("<font size='0'><br></font>");
  
   var snowsrc;
   var sens;
   var no;
   
	// parametre du script mouette
	var CurY = Math.random () * 80;
//	var CurY = 50  ;
	var CurX = - 100;
	var VertSign = 1;
	var xdir = 0;
	var CptUp = 0;

   var Ymax = 0;
	Ymax = 130;
	ydir = 5;
      

function InitMouette ()
{
//	if (IsNS || IsNS6) return;
	document.write ("<div style='position:absolute;top:0px;left:0px'><div style='position:relative'>");

   if (IsNoel == true)
      document.write("<img id='anim' src='images/perenoel.gif' style='position:absolute; top:0px; left:0px'>");            
   else
      document.write("<img height='120' id='anim' src='images/mouette.gif' style='position:absolute; top:0px; left:0px'>");            
   document.write("</div></div>");
}
  
function RepeatAnim() 
{  
   // --- deplacement du homard   
   	CptUp = CptUp + ydir * VertSign;
   	if (CptUp < 0) ydir = 1;
   	else if (CptUp < 5) ydir = 2;
   	else if (CptUp < 10) ydir = 3;
   	else if (CptUp > (Ymax - 30) ) ydir = 3;
   	else if (CptUp > (Ymax - 20) ) ydir = 2;
   	else if (CptUp > (Ymax - 10) ) ydir = 1;
   	else ydir = 5;

//   	CptUp = 0;
   	
   	if (CptUp > Ymax) VertSign = -1;
   	if (CptUp < -30) VertSign = 1;
   	
   	CurX = (xdir == 0) ? CurX + 15 : CurX - 15;
      if (CurX > GetWindowWidth() - 100) {
	      CurY = Math.random () * 80;
//	      CurY = 100;
	      CptUp = 0;
	      if (IsNoel == true) VertSign = 1;
         CurX = -500 - Math.random () * 300;
      }
      if (CurX < 10) xdir = 0;
      if (IsNS) {
      }
      else if (IsNS6) {
         document.getElementById("anim").style.top = CurY + CptUp;
         document.getElementById("anim").style.left = CurX;
      }
      else {
         document.all["anim"].style.pixelTop = CurY + CptUp;
         document.all["anim"].style.pixelLeft = CurX;
   	}
	    
    setTimeout("RepeatAnim()", 100);
}

if (IsIE) {
   if (IsNoel == false) 
   {
      //InitMouette ();
      //setTimeout("RepeatAnim()",100);
   }
}

   