document.write('<script language="javascript1.1" src="/portailBP_img/BP/FRA/contenus/js/wreport.js"></script>');
document.write('<script language="javascript1.1" src="/portailBP_img/BP/FRA/contenus/js/wbo_performance_a.js"></script>');
document.write('<script language="javascript1.1" src="/portailBP_img/BP/FRA/contenus/js/wbo_performance_rnat_v2.1b.js"></script>');

// --- Donne le feu vert pour marquer (on ne marque qu'en prod)



var feu = getFeuVert();
 if ( feu == "NON" ) {
 if ( navigator.appName != 'Netscape') {
 magalylargeur=30;
 if ( screen.width == 1024 ) magalylargeur=30;
 if ( screen.width == 1280 ) magalylargeur=34;
 document.write("<STYLE>");
 document.write("#refreshlayer {position: absolute;");
 document.write("top: 26px;");
 document.write("left: " + magalylargeur + "%;");
 document.write("margin-left: 30px;");
 document.write("z-index: 30;");
 document.write("}");
 document.write("</STYLE>");
 document.write('<DIV ID="refreshlayer">');
 document.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td>');
 document.write('<a href="javascript:flushppr();"><img src="/portailBP_img/BP/FRA/contenus/pictos/refreshppr.gif" border=0></a>');
 document.write('</td></tr></table>');
 document.write('</DIV>');
 }
  }

function getFeuVert() {
  nomDomaine = new String(document.location);  
  if (nomDomaine.indexOf("dev.3suisses.fr") != -1 ) return "NON";
  if (nomDomaine.indexOf("devbpf.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("devbpfs.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("dev.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("devs.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("int.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("ints.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("dmt.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("dmts.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("rct.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("rcts.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("miroir.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("miroirs.bp.si3si.int") != -1 ) return "NON";
  if (nomDomaine.indexOf("localhost") != -1 ) return "NON";
  return "OUI";
}

function marqueur(nomPage, niveau2) {
  var WRP_ID= 278375;  
  var WRP_SECTION="";  
  var WRP_SUBSECTION="";  
  var WRP_CONTENT="";  
  var WRP_CHANNEL="";  
  wreport_ok=1;  
  /* Profondeur Frame */  
  var WRP_ACC;    
  // on verifie s'il faut effectuer l'enregistrement (uniquement en prod)  
  var feuVert = getFeuVert();      
  // DEBUT ALIMENTATION DES VARIABLES  
  // Si pas de nom page alors on n'enregistre rien  
  if (nomPage == ""){  	return;  }    
  // Traitement specifique a la descente produit  
  if (niveau2 == 1 || niveau2 == 50 || niveau2 == 51 || niveau2 == 52 || niveau2 == 54 || niveau2 == 55 || niveau2 == 60 || niveau2 == 70 || niveau2 == 73 || niveau2 == 86 || niveau2 == 89 || niveau2 == 90 || niveau2 == 91 || niveau2 == 96){
    refnat = new performanceRefNat();
    refnat.setParseOthers(0); /* 0 or 1 to put it active on all domains */
    refnat.execute(); 
    // on est dans le cas de la descente produit donc on peut decomposer le nomPage qui est la concatenation des codes EDS        
    // on commence par supprimer les eventuels '::''    
    for (var xi=0;xi<3;xi++) {      
      if (nomPage.indexOf("::") != -1 ){        
        nomPage = nomPage.substring(nomPage.indexOf("::")+2,nomPage.length);      
      }    
    }        
    // on recupere les differents codes eds    
    if (nomPage.indexOf("_") == -1 ){ // UNIVERS      
      // on doit etre sur une page univers car il n'y a pas de concatenation de codes EDS (on ne trouve pas "_")      
      WRP_CHANNEL=nomPage;      
      WRP_SECTION=nomPage; // Boutique      
      WRP_SUBSECTION="Accueil"; // Rayon      
      WRP_CONTENT="";    
    } else{      
      WRP_CHANNEL= nomPage.substring(0,nomPage.indexOf("_"));// Univers      
      nomPage = nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);      
      if (nomPage.indexOf("_") == -1 ){ // BOUTIQUE        
        nomPage =  WRP_CHANNEL + '_' + nomPage;        
        // on doit etre sur une page boutique        
        WRP_SECTION=nomPage; // Boutique        
        WRP_SUBSECTION="Accueil"; // Rayon        
        WRP_CONTENT="";      
      }else{        
        WRP_SECTION=WRP_CHANNEL + '_' + nomPage.substring(0,nomPage.indexOf("_"));// Boutique        
        nomPage = nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);        
        //if (nomPage.indexOf("_") == -1 ){ // RAYON OU SOUS RAYON          
          // on doit etre sur une page rayon ou sous rayon          
          WRP_SUBSECTION=nomPage;          
          WRP_CONTENT="";        
        //}else{        
          //  WRP_SUBSECTION=nomPage.substring(0,nomPage.indexOf("_"));        
          //  WRP_CONTENT=nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);        
        //}      
      }    
    }  
  } else{    
    // Traitement en dehors de la descente produit        
    // Traitement pour la page d accueil    
    if (nomPage == "Accueil"){      
      WRP_SECTION="Accueil";      
      WRP_SUBSECTION="Accueil";      
      WRP_CONTENT=""; // Pas de contenu a ce stade      
      WRP_CHANNEL=""; // Pas de chaine thematique a ce stade   
      refnat = new performanceRefNat();
      refnat.setParseOthers(0); /* 0 or 1 to put it active on all domains */
      refnat.execute(); 
    } else{      
      // Traitement specifique pour le process commande et la relation cliente      
      WRP_CONTENT=""; // Pas de contenu a ce stade      
      WRP_CHANNEL=""; // Pas de chaine thematique a ce stade      
      // PAGE PANIER      
      if(nomPage.indexOf("portlet_panier") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Panier";      
      // PAGE IDENTIFICATION      
      }else if(nomPage.indexOf("identification") != -1 
          || nomPage.indexOf("identifier") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Identification";      
      // PAGE LIVRAISON      
      }else if(nomPage.indexOf("choix_adresse_livraison") != -1 
          || nomPage.indexOf("mode_livraison_domicile") != -1 
          || nomPage.indexOf("recherche_localite") != -1 
          || nomPage.indexOf("recherche_relais") != -1 
          || nomPage.indexOf("adresse_cadeau") != -1 
          || nomPage.indexOf("annulation_commande") != -1 
          || nomPage.indexOf("livraison_DOMTOM") != -1 
          || nomPage.indexOf("recapitulatif_commande_livraison") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Livraison"; 
        WRP_CONTENT=nomPage;
      // PAGE PAIEMENT        
      }else if(nomPage.indexOf("choix_mode_paiement") != -1 
          || nomPage.indexOf("erreur_validation_commande") != -1 
          || nomPage.indexOf("paiement_cheque") != -1 
          || nomPage.indexOf("paiement_carte4E") != -1 
          || nomPage.indexOf("paiement_carteTenor") != -1 
          || nomPage.indexOf("page_titulaire_CB") != -1 
          || nomPage.indexOf("popup_infos_CB") != -1 
          || nomPage.indexOf("Bdc_Confirmation") != -1){ 
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Paiement";
        WRP_CONTENT=nomPage;
      // PAGE CONFIRMATION        
      }else if(nomPage.indexOf("Bdc_Fin_Commande") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Confirmation";      
      }else{        
        WRP_SECTION=nomPage;        
        WRP_SUBSECTION=nomPage;      
      }    
    }  
  }  
  // FIN ALIMENTATION DES VARIABLES    
  //document.write("CHANNEL : " + WRP_CHANNEL);  
  //document.write("<BR>");  
  //document.write("SECTION : " + WRP_SECTION);  
  //document.write("<BR>");  
  //document.write("SUBSECTION : " + WRP_SUBSECTION);  
  //document.write("<BR>");  
  //document.write("CONTENT : " + WRP_CONTENT);  
  //document.write("<BR>");  
  //document.write("FEU VERT : " + feuVert);  
  //document.write("<BR>");      
  if (feuVert == "OUI") {    
    // si wreport renvoi ok alors on marque le passage    
    if(wreport_ok==1){       
      var w_counter = new wreport_counter(WRP_SECTION, WRP_SUBSECTION, WRP_ID, WRP_ACC, WRP_CHANNEL);      
      w_counter.add_content(WRP_CONTENT);      
      w_counter.count();    
    }  
  }
}


// ---- Fonction des gestion de l'affichage de la Confirmation CDE
function marqueur_ConfCde(nomPage,valPanier) {   
  Marquer_ConfCde(nomPage,valPanier);
}

// ---- Fonction des gestion de l'affichage Fin de CDE
function marqueur_Fin_Cde(nomPage,valPanier,fact,nbArticles,isNew) {
  Marquer_ConfCde(nomPage,valPanier);
  // Debut insertion code performance
  WBO_MONTANT=valPanier; // <== set here the command amount
  WBO_FACT="";     // <== set here your bill id
  WBO_NB_ARTICLES=1; // <== set here the number of item
  WBO_CLIENT="";     /* <== set here your client id */
  if (fact!=null)
    WBO_FACT=fact;
  if (nbArticles!=null)
    WBO_NB_ARTICLES=nbArticles;
  WBO_POST_VALIDATION=0; // <== set to 1 if need backoffice validation 
  var feuVert = getFeuVert();
  // On verifie si environnement de prod
  if (feuVert == "OUI") {
    transfo = new performanceTransfo(SITE=278375, WBO_ID_TRANSFO=822);
    transfo.setAmount(WBO_MONTANT);
    transfo.setClient(WBO_CLIENT);
    transfo.setId(WBO_FACT);
    transfo.setQuantity(WBO_NB_ARTICLES);
    transfo.setPostValidation(WBO_POST_VALIDATION);
    /* numerical parameter */
    if (isNew!=null && (isNew == 'nouveau' || isNew > 0)) transfo.addParam("N1", "1.0");
    transfo.execute();
  }
  // Fin insertion code performance
}


// --- Marquer sans param en https
function Marquer_ConfCde(nomPage,valPanier) {
  var WRP_ID= 278375;  
  var WRP_SECTION="";  
  var WRP_SUBSECTION="";  
  var WRP_CONTENT="";  
  var WRP_CHANNEL="";  
  wreport_ok=1;  
  /* Profondeur Frame */  
  var WRP_ACC;    
  // on verifie s'il faut effectuer l'enregistrement (uniquement en prod)  
  var feuVert = getFeuVert();      
  // DEBUT ALIMENTATION DES VARIABLES  
  // Si pas de nom page alors on n'enregistre rien  
  if (nomPage == ""){  	return;  }  
  // PAGE PAIEMENT  
  if(nomPage.indexOf("choix_mode_paiement") != -1 
      || nomPage.indexOf("Bdc_Confirmation") != -1){    
    WRP_SECTION="Commande";    
    WRP_SUBSECTION="Paiement";  
  // PAGE CONFIRMATION    
  }else if(nomPage.indexOf("Bdc_Fin_Commande") != -1){    
    WRP_SECTION="Commande";    
    WRP_SUBSECTION="Confirmation";  
  }else{    
    WRP_SECTION=nomPage;    
    WRP_SUBSECTION=nomPage;  
  }  
  WRP_CONTENT=valPanier;   
  WRP_CHANNEL=""; // Pas de chaine thematique a ce stade    
  //document.write("CHANNEL : " + WRP_CHANNEL);  
  //document.write("<BR>");  
  //document.write("SECTION : " + WRP_SECTION);  
  //document.write("<BR>");  
  //document.write("SUBSECTION : " + WRP_SUBSECTION);  
  //document.write("<BR>");  
  //document.write("CONTENT : " + WRP_CONTENT);  
  //document.write("<BR>");  
  //document.write("FEU VERT : " + feuVert);      
  if (feuVert == "OUI") {    
    // si wreport renvoi ok alors on marque le passage    
    if(wreport_ok==1){       
      var w_counter = new wreport_counter(WRP_SECTION, WRP_SUBSECTION, WRP_ID, WRP_ACC, WRP_CHANNEL);      
      w_counter.add_content(WRP_CONTENT);      
      w_counter.count();    
    }  
  }
}

function marqueurFP(nomPage, niveau2, familleModele, libelle, univers) {  
univers=univers.toUpperCase();
  var WRP_ID= 278375;
  var WRP_SECTION="";  
  var WRP_SUBSECTION="";  
  var WRP_CONTENT="";  
  var WRP_CHANNEL=""; 
  wreport_ok=1;  
  /* Profondeur Frame */  
  var WRP_ACC;    
  // on verifie s'il faut effectuer l'enregistrement (uniquement en prod)  
  var feuVert = getFeuVert();      
  // DEBUT ALIMENTATION DES VARIABLES  
  // Si pas de nom page alors on n'enregistre rien  
  if (nomPage == ""){  	return;  }    
  // Traitement specifique a la descente produit  
  if (niveau2 == 1 || niveau2 == 50 || niveau2 == 51 || niveau2 == 52 || niveau2 == 54 || niveau2 == 55 || niveau2 == 60 || niveau2 == 70 || niveau2 == 73 || niveau2 == 86 || niveau2 == 89 || niveau2 == 90 || niveau2 == 91 || niveau2 == 96){    
    refnat = new performanceRefNat();
    refnat.setParseOthers(0); /* 0 or 1 to put it active on all domains */
    refnat.execute();
    // on est dans le cas de la descente produit donc on peut decomposer le nomPage qui est la concatenation des codes EDS        
    // on commence par supprimer les eventuels '::''    
    for (var xi=0;xi<3;xi++) {      
      if (nomPage.indexOf("::") != -1 ){        
        nomPage = nomPage.substring(nomPage.indexOf("::")+2,nomPage.length);      
      }    
    }        
    // on recupere les differents codes eds    
    if (nomPage.indexOf("_") == -1 ){ // UNIVERS      
      // on doit etre sur une page univers car il n'y a pas de concatenation de codes EDS (on ne trouve pas "_")      
      WRP_CHANNEL=nomPage;      
      WRP_SECTION=nomPage; // Boutique      
      WRP_SUBSECTION="Accueil"; // Rayon      
      WRP_CONTENT="";    
    } else{      
      WRP_CHANNEL= nomPage.substring(0,nomPage.indexOf("_"));// Univers      
      nomPage = nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);      
      if (nomPage.indexOf("_") == -1 ){ // BOUTIQUE        
        nomPage =  WRP_CHANNEL + '_' + nomPage;        
        // on doit etre sur une page boutique        
        WRP_SECTION=nomPage; // Boutique        
        WRP_SUBSECTION="Accueil"; // Rayon        
        WRP_CONTENT="";      
      }else{        
        WRP_SECTION=WRP_CHANNEL + '_' + nomPage.substring(0,nomPage.indexOf("_"));// Boutique        
        nomPage = nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);        
        //if (nomPage.indexOf("_") == -1 ){ // RAYON OU SOUS RAYON          
          // on doit etre sur une page rayon ou sous rayon          
          WRP_SUBSECTION=nomPage;          
          WRP_CONTENT="";        
        //}else{        
          //  WRP_SUBSECTION=nomPage.substring(0,nomPage.indexOf("_"));        
          //  WRP_CONTENT=nomPage.substring(nomPage.indexOf("_")+1,nomPage.length);        
        //}      
      }    
    }  
  } else{    
    // Traitement en dehors de la descente produit        
    // Traitement pour la page d accueil    
    if (nomPage == "Accueil"){      
      WRP_SECTION="Accueil";      
      WRP_SUBSECTION="Accueil";      
      WRP_CONTENT=""; // Pas de contenu a ce stade      
      WRP_CHANNEL=""; // Pas de chaine thematique a ce stade   
      refnat = new performanceRefNat();
      refnat.setParseOthers(0); /* 0 or 1 to put it active on all domains */
      refnat.execute(); 
    } else{      
      // Traitement specifique pour le process commande et la relation cliente      
      WRP_CONTENT=""; // Pas de contenu a ce stade      
      WRP_CHANNEL=""; // Pas de chaine thematique a ce stade      
      // PAGE PANIER      
      if(nomPage.indexOf("portlet_panier") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Panier";      
      // PAGE IDENTIFICATION      
      }else if(nomPage.indexOf("identification") != -1 
          || nomPage.indexOf("identifier") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Identification";      
      // PAGE LIVRAISON      
      }else if(nomPage.indexOf("choix_adresse_livraison") != -1 
          || nomPage.indexOf("mode_livraison_domicile") != -1 
          || nomPage.indexOf("recherche_localite") != -1 
          || nomPage.indexOf("recherche_relais") != -1 
          || nomPage.indexOf("adresse_cadeau") != -1 
          || nomPage.indexOf("annulation_commande") != -1 
          || nomPage.indexOf("livraison_DOMTOM") != -1 
          || nomPage.indexOf("recapitulatif_commande_livraison") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Livraison";
        WRP_CONTENT=nomPage;
      // PAGE PAIEMENT        
      }else if(nomPage.indexOf("choix_mode_paiement") != -1 
          || nomPage.indexOf("erreur_validation_commande") != -1 
          || nomPage.indexOf("paiement_cheque") != -1 
          || nomPage.indexOf("paiement_carte4E") != -1 
          || nomPage.indexOf("paiement_carteTenor") != -1 
          || nomPage.indexOf("page_titulaire_CB") != -1 
          || nomPage.indexOf("popup_infos_CB") != -1 
          || nomPage.indexOf("Bdc_Confirmation") != -1){ 
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Paiement";      
        WRP_CONTENT=nomPage;
      // PAGE CONFIRMATION        
      }else if(nomPage.indexOf("Bdc_Fin_Commande") != -1){        
        WRP_SECTION="Commande";        
        WRP_SUBSECTION="Confirmation";      
      }else{
        /* Cas des nouvelles fiches produits => on passe la chaine dans la variable univers */
        WRP_SECTION=nomPage;        
        WRP_SUBSECTION=nomPage;
        if (typeof univers == 'string' && univers.length > 1) {
        	WRP_CHANNEL=univers;
        	if (typeof libelle == 'string' && libelle.length > 2) {
        		WRP_CONTENT = libelle;
        	}
        }
      }    
    }  
  }  
  // FIN ALIMENTATION DES VARIABLES    
  //document.write("CHANNEL : " + WRP_CHANNEL);  
  //document.write("<BR>");  
  //document.write("SECTION : " + WRP_SECTION);  
  //document.write("<BR>");  
  //document.write("SUBSECTION : " + WRP_SUBSECTION);  
  //document.write("<BR>");  
  //document.write("CONTENT : " + WRP_CONTENT);  
  //document.write("<BR>");  
  //document.write("FEU VERT : " + feuVert);  
  //document.write("<BR>");      
  if (feuVert == "OUI") {    
    // si wreport renvoi ok alors on marque le passage    
    if(wreport_ok==1){       
      var w_counter = new wreport_counter(WRP_SECTION, WRP_SUBSECTION, WRP_ID, WRP_ACC, WRP_CHANNEL);      
      w_counter.add_content(WRP_CONTENT);      
      w_counter.count();    
    }  
  }
}

