/*************************************************/
/** Utilities method for HTML navigation toolbar */
/*************************************************/

/**
* Modify img src attribut for a element(th) given.
*
* @param th the html img object.
* @param img the name of replacement picture.
* @param num the identification num page.
*/
function changeImg(th, img, num) {
  if (th.id != num) {
    th.src = "/voyages-carrefour/CS/images/navigation/" + img;
  }
}

/**
* Active navigation icon for a pageId(num) given.
*
* @param num the identification num page.
*/
function activeBtn(num) {
  elem = document.getElementById(num);
  dirImg = "/voyages-carrefour/CS/images/navigation/";

  if (typeof elem != "undefined") {
    switch (num) {
      case 0: elem.src = dirImg + "Accueil_on.gif"; break;
      case 1: elem.src = dirImg + "France_on.gif"; break;
      case 2: elem.src = dirImg + "Monde_on.gif"; break;
      case 3: elem.src = dirImg + "Vols_on.gif"; break;
      case 4: elem.src = dirImg + "WeekEnds_on.gif"; break;
      case 5: elem.src = dirImg + "Services_on.gif"; break;
      case 6 :elem.src = dirImg + "Selection_on.gif"; break;
      case 7 :elem.src = dirImg + "Promotions_on.gif"; break;
      case 11 :elem.src = dirImg + "Cadeaux_on.gif"; break;
      default: break;
    }
  }
}

/**
* pre-load navigation picture.
*/
function preLoadImg() {
  img0 = new Image();
  img0.src = "/voyages-carrefour/CS/images/navigation/Accueil_on.gif";

  img1 = new Image();
  img1.src = "/voyages-carrefour/CS/images/navigation/France_on.gif";

  img2 = new Image() ;
  img2.src = "/voyages-carrefour/CS/images/navigation/Monde_on.gif" ;

  img3 = new Image() ;
  img3.src = "/voyages-carrefour/CS/images/navigation/Vols_on.gif" ;

  img4 = new Image() ;
  img4.src = "/voyages-carrefour/CS/images/navigation/WeekEnds_on.gif" ;

  img5 = new Image() ;
  img5.src = "/voyages-carrefour/CS/images/navigation/Services_on.gif" ;

  img6 = new Image() ;
  img6.src = "/voyages-carrefour/CS/images/navigation/Selection_on.gif" ;

  img7 = new Image() ;
  img7.src = "/voyages-carrefour/CS/images/navigation/Promotions_on.gif" ;

  img7 = new Image() ;
  img7.src = "/voyages-carrefour/CS/images/navigation/Cadeaux_on.gif" ;
}
