// déclaration pour fonction F_tombe_neige
var no = 16; // nombre de flocons
var speed = 15; // vitesse de chute des flocons
var snowflake = "/entete/images/flocon_01.gif";
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    // variables
var am, stx, sty;  // amplitude
var i, doc_width = 800, doc_height = 600;
// fin déclaration pour F_tombe_neige

function Affiche_banniere(ind)
{
var i;
var taille;

Banniere(ind);


// recherche si tombée neige
var mot;

mot = Detect_nav();

if (eval(mot.substring(2,3)) >= 4);
 {
if (ind)
 {
  taille = ind.length;
  for (i = 0; i < taille; ++ i)
   {
  // Si 'A', tombée de neige
    if (ind.substring(i,i+1) == 'A')
     {
//      F_tombe_neige();
     }
  // Si 'N', tombée de neige + père noel
    if (ind.substring(i,i+1) == 'N')
     {
//      F_tombe_neige();
//      F_pere_noel();
     }
  // Si 'P', Pere noel
    if (ind.substring(i,i+1) == 'P')
     {
//      F_pere_noel();
     }
  // Si 'V', Saint Valentin
    if (ind.substring(i,i+1) == 'V')
     {
      F_saint_valentin();
     }
   }
 }
}
}

function Banniere(ind)
{
var w_ind;
var taille;

//déf cadre
document.write('<table border="0" cellspacing="0" cellpadding="0" height="64" width="755">  <tr>');

//col cadrage
w_ind = 0;
if (ind)
 {
  taille = ind.length;
  for (i = 0; i < taille; ++ i)
   {
    if (ind.substring(i,i+1) == 'G')
     {
      w_ind = 1;
     }
   }
 }
if (w_ind != 1)
{
  document.write('<td width="62" height="64"></td>');
}
//col logo
document.write('<td width="183" height="64"><map name="FPMap0">');
/* document.write('<area href="/index.html" target="_top" shape="rect" coords="1, 2, 179, 58"></map><img src="/images/titreorleans2.gif" alt="Bienvenue sur Orléans City" border="0" usemap="#FPMap0"></td>'); */
document.write('<area href="http://www.orleanscity.com/index.htm" target="_top" shape="rect" coords="1, 2, 179, 58"></map><img src="http://images.orleanscity.com/entete/logo_oc_trans.gif" alt="Bienvenue sur Orléans City" border="0" usemap="#FPMap0"></td>');
//fete  noel OC document.write('<area href="http://www.orleanscity.com/index.htm" target="_top" shape="rect" coords="1, 2, 179, 58"></map><img src="http://images.orleanscity.com/entete/logo_oc_fetes.gif" alt="Bienvenue sur Orléans City" border="0" usemap="#FPMap0"></td>');
//col 1
document.write('<td width="120" height="65" align="center"><map name="FPMap1">');
document.write('<area href="http://www.orleanscity.com/creations/index.htm" target="_top" shape="rect" coords="3, 41, 122, 61">');
document.write('<area href="http://concours.orleanscity.com/concours.php" target="_top" shape="rect" coords="4, 23, 117, 43">');
document.write('<area href="http://emploi.orleanscity.com/index.htm" target="_top" shape="rect" coords="5, 4, 117, 25"></map><img rectangle="(5,4) (117,25)" src="http://images.orleanscity.com/entete/colonne_1.gif" alt="Choisissez un thème" border="0" usemap="#FPMap1"></td>');
//col 2
document.write('<td width="120" height="65" align="center"><map name="FPMap2">');
document.write('<area href="http://www.orleanscity.com/sports.php" target="_top" shape="rect" coords="4, 39, 120, 60">');
document.write('<area href="http://www.orleanscity.com/expositions.php" target="_top" shape="rect" coords="2, 21, 120, 41">');
document.write('<area href="http://www.orleanscity.com/assos/index.php" target="_top" shape="rect" coords="3, 2, 120, 23"></map><img rectangle="(3,2) (120,23)" src="http://images.orleanscity.com/entete/colonne_2.gif" alt="Choisissez un thème" border="0" usemap="#FPMap2"></td>');
//col 3
document.write('<td width="120" height="65" align="center"><map name="FPMap3">');
document.write('<area href="http://www.orleanscity.com/infos_locales.php" target="_top" shape="rect" coords="4, 40, 138, 60">');
document.write('<area href="http://www.orleanscity.com/vosloisirs.php" target="_top" shape="rect" coords="4, 20, 126, 42">');
document.write('<area href="http://www.orleanscity.com/spectacles.htm" target="_top" shape="rect" coords="3, 2, 121, 22"></map><img rectangle="(3,2) (121,22)" src="http://images.orleanscity.com/entete/colonne_3.gif" alt="Choisissez un thème" border="0" usemap="#FPMap3"></td>');
//col4 
document.write('<td width="103" height="65" align="center"><map name="FPMap4">');
document.write('<area href="http://www.orleanscity.com/portail/index.htm" target="_top" shape="rect" coords="6, 40, 109, 60">');
document.write('<area href="http://annonces.orleanscity.com/index.htm" target="_top" shape="rect" coords="4, 20, 109, 42">');
document.write('<area href="http://www.orleanscity.com/tourisme/index.htm" target="_top" shape="rect" coords="2, 2, 105, 21"></map><img rectangle="(2,2) (105,21)" src="http://images.orleanscity.com/entete/colonne_4.gif" alt="Choisissez un thème" border="0" usemap="#FPMap4"></td>');
document.write('</tr></table>');
}

function F_pere_noel()
{
 var w_x;
 document.write("<div style=\"left: 800; top: 0; width : 350; height : 120; position: absolute\" ID=\"traineau\"><img border=\"0\" src=\"/entete/images/traineau.gif\" width=\"350\" height=\"120\"></div>");
 x=800;
// window.alert(x);
 window.setTimeout("F_move_pere_noel(x);",100);
}

function F_move_pere_noel(w_x)
{
 w_time=100;
 x=w_x - 20;
 document.all['traineau'].style.visibility='visible';
// window.alert(x);
 if (x<=-400)
 {
  x=800;
  w_time=4000;
  document.all['traineau'].style.visibility='hidden';

//  window.alert('modif x');
 }
 document.all['traineau'].style.pixelLeft=x;

// document.write("<div style=\"left: " + x + "; top: 0; width : 350; height : 120; position: absolute\" ID=\"traineau\"><img border=\"0\" src=\"www.orleanscity.com/entete/images/traineau.gif\" width=\"350\" height=\"120\"></div>");
 window.setTimeout("F_move_pere_noel(x);",w_time);
}

function F_saint_valentin()
{
 var w_x;
 var w_y;
 document.write("<div style=\"left: 800; top: 0; width : 65; height : 25; position: absolute\" ID=\"coeur\"><img border=\"0\" src=\"/entete/images/coeur_ani.gif\" width=\"65\" height=\"25\"></div>");
 x=400+Math.random()*400;
 y=400+Math.random()*300;
 window.setTimeout("F_move_saint_valentin(x,y);",100);
}

function F_move_saint_valentin(w_x,w_y)
{
 w_time=100;
 x=w_x - Math.random()*15 + 5;
 y=w_y - Math.random()*15 + 5;
 document.all['coeur'].style.visibility='visible';
// window.alert(x);
 if ((x<=0) || (x>=800) || (y<=0) || (y>=600))
 {
  x=100+Math.random()*600;
  y=100+Math.random()*400;
  w_time=2000;
  document.all['coeur'].style.visibility='hidden';

//  window.alert('modif x');
 }
 document.all['coeur'].style.pixelLeft=x;
 document.all['coeur'].style.pixelTop=y;

// document.write("<div style=\"left: " + x + "; top: 0; width : 350; height : 120; position: absolute\" ID=\"traineau\"><img border=\"0\" src=\"www.orleanscity.com/entete/images/traineau.gif\" width=\"350\" height=\"120\"></div>");
 window.setTimeout("F_move_saint_valentin(x,y);",w_time);
}

function F_tombe_neige()
{
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++ i) {
dx[i] = 0;                        // set coordinate variables
xp[i] = Math.random()*(doc_width-50);  // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20;         // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 3 + Math.random();     // set step variables
if (ns4up) {                      // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");
   }
} else if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");
      }
   }
}
if (ns4up) {
snowNS();
} else if (ie4up) {
snowIE();
}

}
function snowNS() {  // Netscape main animation function
for (i = 0; i < no; ++ i) {  // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 70;
stx[i] = 0.02 + Math.random()/10;
//sty[i] = 0.7 + Math.random();
sty[i] = 2 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
dx[i] += stx[i];
document.layers["dot"+i].top = yp[i];
document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", speed);
}
function snowIE() {  // IE main animation function
for (i = 0; i < no; ++ i) {  // iterate for every dot
yp[i] += sty[i];
if (yp[i] > doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 70;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx[i] += stx[i];
document.all["dot"+i].style.pixelTop = yp[i];
document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowIE()", speed);
}

function Detect_nav()
 {
  var nav;

  if (navigator.appName.substring(0,9) == "Microsoft")
   {
    nav = "IE";
   }
  else
   {
    if (navigator.appName.substring(0,8) == "Netscape")
     {
      nav = "NS";
     }
   }
  nav = nav + parseInt(navigator.appVersion);

  mot = "Browser : " + nav;
return (nav);
 }
