/* auteur: Usager non enregistré */
/* Date de création: 22/04/2004 */


/*Fonctions pour le contenu dynamlique du calque*/
function change_contenu_calque(nom,texte) {
 $('#'+nom).html(texte);
 /*
 if (document.getElementById) {
   document.getElementById(nom).innerHTML = texte;
 }
 else if (document.all) {
  document.all[nom].innerHTML = texte;
 }
 else if (document.layers) {
   with (eval('document.'+nom+'.document')) {
     open();
     write(texte);
     close();
   }
 }
 else {
  alert("Version de navigateur imcompatible");
 }*/
}

/*function affiche_bonne_image(index) {
 if (index>1) {
   change_contenu_calque('description_image1','<span class=text_bleue_fonce>'+taille_pixels[index-1]+' '+taille_ko[document.getElementById('fichiers_existants1').selectedIndex]+'</span>' );
 }

}*/

/*Fonctions pour le fading*/
var tempo4;
var tempo5;

function changer_fade(id,oc) {
 if (navigator.appName=="Microsoft Internet Explorer") {
   document.getElementById(id).filters.alpha.opacity=oc;
 }else {
   return 1;
 }  
}

function fade(sonnom,op_arrive,op_cour,pas) {
  id=sonnom;
  oa=op_arrive;
  sonpas=pas;
  if (op_cour <= op_arrive) {
    changer_fade(sonnom,op_cour);
    op_cour=op_cour + pas;
    oc=op_cour;
    tempo4=window.setTimeout("fade(id,oa,oc,sonpas)",50);
  } else {
    clearTimeout(tempo4);
  }
}

function unfade(sonnom,op_arrive,op_cour,pas) {
  id=sonnom;
  oa=op_arrive;
  sonpas=pas;
  if (op_cour >= op_arrive) {
    changer_fade(sonnom,op_cour);
    op_cour=op_cour - pas;
    oc=op_cour;
    tempo5=window.setTimeout("unfade(id,oa,oc,sonpas)",50);
  } else {
    clearTimeout(tempo5);
  }
}

/*Fait bouger un calque en suivant la barre de défilement*/

var haut5=10;                  
ie4=document.all
ns6=document.getElementById&&!document.all
ns4=document.layers

function placeMenu(nom) {
  if (ie4) {
    //if (document.body.scrollTop>300 || document.body.scrollTop<pub_droite.style.pixelTop) {
      pub_droite.style.pixelTop=document.body.scrollTop+haut5
    //}	 
  } else if (ns6) {
    //if (window.pageYOffset>300 || window.pageYOffset<document.getElementById("pub_droite").style.top) {
      document.getElementById("pub_droite").style.top=window.pageYOffset+haut5
	//}
  } else if (ns4) {
    eval(document.pub_droite.top=eval(window.pageYOffset+haut5));
  }
  if(ie4 || ns6 || ns4) {
	setTimeout("placeMenu()",20);
  }	
}

/*Fait clignoter le texte d'un calque*/
function clignoter(nom) {
 if (document.getElementById(nom).style.visibility == 'visible') {
   document.getElementById(nom).style.visibility ='hidden';
 } else {
   document.getElementById(nom).style.visibility ='visible';
 }
}

function acc_Move(nomcalque,newX,newY) {

  // theory behind the motion:
  /*
    - Calculate distance difference (eg. 400 pixels left,300 pixels down)
    - Start by moving dot, adding a percentage of the total to the current location:
       1% of difference
       2% of difference
       3% ...
       .
       .
       10% of difference (then start going down)
       9% of difference
       8% ...
       1% ...
       0% (finished)

     - Due to some mathematical theory I'm sure..: 
       1 + 2 + 3 ... + 10, + 9 + 8 + ... + 1 = 100, thus 100%.
     - So because of this you get a smooth "slow - fast - slow" motion. 
  */

  pDistance += pDirection

  theDiv.style.pixelLeft = theDiv.style.pixelLeft + ((newX-oldX)*pDistance*0.01) // move by distance * (1 to 10%, then 10 to 1%)
  theDiv.style.pixelTop  = theDiv.style.pixelTop + ((newY-oldY)*pDistance*0.01)  // for both X and Y

  if (pDistance == 10 && pDirection)           // if at 10% (fastest point)
    pDirection = -1;                           // reverse, start slowing down

  if (pDistance != 0)                          // check for end condition (distance = 0)
    setTimeout("doMove()",20,"Javascript");
  else
    moveActive = 0;                            // reset "active" flag [see catchClickEvent()]
}
