

/* <a-zone id="history"> */

/* </a-zone> */


/**
 * This field is used to know if AJAX has already been initialized
 */
 var initDone = false;

/* <a-zone id="fields"> */
 var Return_addProductInShoppingCart=null;
 var preValidateFromRecapBasket=false;
 var emailToSendMdp=null;
 var demandeCpFromPromo=false;
/* </a-zone> */





 function initAJAX() {
	jsonrpc = new JSONRpcClient("/panier/componentPanier/remoteBasketManager.jsp?ajax-call=true");
	initDone = true;
	/* <a-zone id="initAJAX"> */
	//if the log.js script file has been included in the HTML code, you can now use the LOG methods
	//LOG.info('Initialization done!');
	/* </a-zone> */
}


 function addOrderInShoppingCart( numcmde) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.addOrderInShoppingCart(treatAddOrderInShoppingCart, numcmde);
}

 function treatAddOrderInShoppingCart( result,  exception) {
	/* <a-zone id="treatAddOrderInShoppingCart"> */
	if (onAddOrderInShoppingCartException != null && exception != null) {
		onAddOrderInShoppingCartException(exception);
	}
	if (onAddOrderInShoppingCartSuccess != null && result != null) {
		onAddOrderInShoppingCartSuccess(result);
		  if(document.location.href.indexOf("courses-en-ligne")!=-1){
        document.getElementById("basketTg").style.visibility="hidden";
        document.getElementById("basketDetail").style.height="155px";
       }
	}
	/* </a-zone> */
}

 function onAddOrderInShoppingCartException( exception) {
	/* <a-zone id="onAddOrderInShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onAddOrderInShoppingCartSuccess( result) {
	/* <a-zone id="onAddOrderInShoppingCartSuccess"> */
	if (result != null) {
		// rafraichir le panier
		RPC_getShoppingCart();
       		
	}
	/* </a-zone> */
}

 function changeQtyList( idListe,  irefc,  qty,  setValueQty) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.changeQtyList(treatChangeQtyList, idListe, irefc, qty, setValueQty);
}

 function treatChangeQtyList( result,  exception) {
	/* <a-zone id="treatChangeQtyList"> */
	if($('presScrollMaskLay'))scrollTop=$('presScrollMaskLay').scrollTop;
	if (onChangeQtyListException != null && exception != null) {
		onChangeQtyListException(exception);
	}
	if (onChangeQtyListSuccess != null && result != null) {
		onChangeQtyListSuccess(result);
	}
	/* </a-zone> */
}

 function onChangeQtyListException( exception) {
	/* <a-zone id="onChangeQtyListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onChangeQtyListSuccess( result) {
	/* <a-zone id="onChangeQtyListSuccess"> */
	if (result != null) {
		
		if(result[0]>0)
		{
		
		AWL_getRecapListe('AWL_recapListe');
		AWL_getRecapDetailListe('basketFull',result[0]);
		}
		else
		{
			if(result[0] == -2)
			{
				AWL_getMessage('maxQtyPdt');
			}
		}
		
	}
	/* </a-zone> */
}

 function envoisMdpPourEmail( email) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.envoisMdpPourEmail(treatEnvoisMdpPourEmail, email);
}

 function treatEnvoisMdpPourEmail( result,  exception) {
	/* <a-zone id="treatEnvoisMdpPourEmail"> */
	if (onEnvoisMdpPourEmailException != null && exception != null) {
		onEnvoisMdpPourEmailException(exception);
	}
	if (onEnvoisMdpPourEmailSuccess != null && result != null) {
		onEnvoisMdpPourEmailSuccess(result);
	}
	/* </a-zone> */
}

 function onEnvoisMdpPourEmailException( exception) {
	/* <a-zone id="onEnvoisMdpPourEmailException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onEnvoisMdpPourEmailSuccess( result) {
	/* <a-zone id="onEnvoisMdpPourEmailSuccess"> */
	if (result != null) {
		switch(result) {
			case 0 :
				emailToSendMdp=$('inputEmailGetMyPassword').value;
				//alert(emailToSendMdp);
				setCont('id','lbEmailLayPwd3',0,emailToSendMdp);
	    		PI_removeLay();
	    		PI_loadLay('errorLayPassword3');
				break;
			case -1 :
	    		PI_removeLay();
	    		PI_loadLay('errorLayPassword4');
				break;
			case -2 :
				PI_removeLay();
	    		PI_loadLay('errorLayPassword5');
				break;
		}
	}
	/* </a-zone> */
}

 function getHeureReservation( inputLivraison,  orderNumber,  slotId,  valid) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.getHeureReservation(treatGetHeureReservation, inputLivraison, orderNumber, slotId, valid);
}

 function treatGetHeureReservation( result,  exception) {
	/* <a-zone id="treatGetHeureReservation"> */
	if (onGetHeureReservationException != null && exception != null) {
		onGetHeureReservationException(exception);
	}
	if (onGetHeureReservationSuccess != null && result != null) {
		onGetHeureReservationSuccess(result);
	}
	/* </a-zone> */
}

 function onGetHeureReservationException( exception) {
	/* <a-zone id="onGetHeureReservationException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onGetHeureReservationSuccess( result) {
	/* <a-zone id="onGetHeureReservationSuccess"> */
	if (result != null) {
	
		// si traitement ok
		if (result.map.retour) {
			if($('creneauLivAdmin')!=null)
			{//Page orderDatas de l'admin boutique
				if (result.map.valid=='2') setCont('id','creneauLivraisonId',null,result.map.dateReserv);
			}
			else
			if($('slotId')!=null)
			{//Page creneau de livraison
        if($('reserverCreneau').value=='1')
        {
				setCont('id','heureReservId',null,result.map.dateLimiteReserv.replace(':','h'));
				$('heureReservTxt1').style.display='inline';	 
				$('mustChooseCreneau').style.display='none';
				}
			}
			else
			{//Rafraichir l'heure de livraison
				document.location.reload();
			}
		}
		// si traitement KO
		else
		{
			if($('creneauLivAdmin')!=null)
			{//Page orderDatas de l'admin boutique
				$('pbMajCreneauLivraisonId').style.display='inline';
			}
		}
	}
	/* </a-zone> */
}

 function inscriptionNewsletter( email,  typeNewsletter) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.inscriptionNewsletter(treatInscriptionNewsletter, email, typeNewsletter);
}

 function treatInscriptionNewsletter( result,  exception) {
	/* <a-zone id="treatInscriptionNewsletter"> */
	if (onInscriptionNewsletterException != null && exception != null) {
		onInscriptionNewsletterException(exception);
	}
	if (onInscriptionNewsletterSuccess != null && result != null) {
		onInscriptionNewsletterSuccess(result);
	}
	/* </a-zone> */
}

 function onInscriptionNewsletterException( exception) {
	/* <a-zone id="onInscriptionNewsletterException"> */
	if (exception) {
		alert(exception.message);
		alert(exception.code);
		alert(exception.name);
	}
	/* </a-zone> */
}

 function onInscriptionNewsletterSuccess( result) {
	/* <a-zone id="onInscriptionNewsletterSuccess"> */
	if (result != null) {
		if(result==-1)
			 AWL_getMessage('emailKO');
		else if (result == 0)
			 AWL_getMessage('inscriptionNewsletterKO');
		else if (result == 1)
			 AWL_getMessage('inscriptionNewsletterOK');
		else if (result == 2)
			 AWL_getMessage('inscriptionNewsletterDejaInscrit');
	}
	/* </a-zone> */
}

 function isCodePostalDesservi( codepostal,  stopQuestionToday) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.isCodePostalDesservi(treatIsCodePostalDesservi, codepostal, stopQuestionToday);
}

 function treatIsCodePostalDesservi( result,  exception) {
	/* <a-zone id="treatIsCodePostalDesservi"> */
	
	if (onIsCodePostalDesserviException != null && exception != null) {
		onIsCodePostalDesserviException(exception);
	}
	if (onIsCodePostalDesserviSuccess != null && result != null) {
		onIsCodePostalDesserviSuccess(result);
	}
	/* </a-zone> */
}

 function onIsCodePostalDesserviException( exception) {
	/* <a-zone id="onIsCodePostalDesserviException"> */
	if (exception) {
		alert("Veuillez renseigner un code postal");
	}
	/* </a-zone> */
}

 function onIsCodePostalDesserviSuccess( result) {
	/* <a-zone id="onIsCodePostalDesserviSuccess"> */
		
	if (result != null) {
		if (result==-1) {
		/* MODIF IFRAME_PANIER */
		if(document.getElementById("nodesserv_codePostal"))
		{
		  document.getElementById("nodesserv_codePostal").style.display = "block";
		  if ($('verificationcp')!=null)
		  {
			PI_removeRescueFrame($('verificationcp'));
		  }
		  // efface le panier
		  RPC_removeAllItems();
		}
		else
		{
			// suppression du layer verificationcp
			if ($('verificationcp')!=null)
			{
				PI_removeLayObj($('verificationcp'));
			}
		  // declenchement de souhaitez vous ętre prevenu
		  AWL_getMessage('deliveryLay');
		  // efface le panier
		  RPC_removeAllItems();
		}
    } else {
    //	alert("demandeCpFromPromo "+demandeCpFromPromo);
      //cas on vient des promos
      if(demandeCpFromPromo==true)
      {
     	demandeCpFromPromo=false;
      	document.location.href="/magasin/produitList.jsp?selListeProduits=promotions";
      }
      else
      {
      	// ajout au panier (fait lors du premier appel )et rechargement de la page
      	MyBasket.CPconfirme();
      	PI_removeLayObj($('verificationcp'));
      	//window.location.reload();
      }
    }
	}
	/* </a-zone> */
}

 function reset() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.reset(treatReset);
}

 function treatReset( result,  exception) {
	/* <a-zone id="treatReset"> */
	if (onResetException != null && exception != null) {
		onResetException(exception);
	}
	if (onResetSuccess != null && result != null) {
		onResetSuccess(result);
	}
	/* </a-zone> */
}

 function onResetException( exception) {
	/* <a-zone id="onResetException"> */
	if (exception) {
		//alert("Veuillez renseigner un code postal");
	}
	/* </a-zone> */
}

 function onResetSuccess( result) {
	/* <a-zone id="onResetSuccess"> */
	if (result != null) {
	}
	/* </a-zone> */
}

 function RPC_addListInShoppingCart( nomListe) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addListInShoppingCart(treatRPC_addListInShoppingCart, nomListe);
}

 function treatRPC_addListInShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_addListInShoppingCart"> */
	if (onRPC_addListInShoppingCartException != null && exception != null) {
		onRPC_addListInShoppingCartException(exception);
	}
	if (onRPC_addListInShoppingCartSuccess != null && result != null) {
		onRPC_addListInShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addListInShoppingCartException( exception) {
	/* <a-zone id="onRPC_addListInShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addListInShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_addListInShoppingCartSuccess"> */
	if (result != null) {
		//alert(result.map.retour+" "+result.map.raison);
	 if(result.map.retour){
	 	AWL_getMessage('listeEnPanierOK');
	 }else{
	 	
	 	switch(result.map.raison){
	 		case 0:
				break;
		 	case 1:
				AWL_getMessage('listeEnPanierErr');
				break;
			case 3:
				AWL_getMessage('maxVolumePack2_3', result.map.irefcs, result.map.prices, result.map.qtys, result.map.irefcVariety);
				break;
			case 4:
				AWL_getMessage('maxVolumePack1_3', result.map.irefcs, result.map.prices, result.map.qtys, result.map.irefcVariety);
				break;
			case 5:
				AWL_getMessage('maxQtyPdt');
				break;
			case 6:
				AWL_getMessage('cpconnupremierevisiteListe', result.map.nomListe);
				break;
			default:
				break;
		}
	 }
		
	}
	/* </a-zone> */
}

 function RPC_addOrderInList( nomListe,  order_number,  type) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addOrderInList(treatRPC_addOrderInList, nomListe, order_number, type);
}

 function treatRPC_addOrderInList( result,  exception) {
	/* <a-zone id="treatRPC_addOrderInList"> */
	if (onRPC_addOrderInListException != null && exception != null) {
		onRPC_addOrderInListException(exception);
	}
	if (onRPC_addOrderInListSuccess != null && result != null) {
		onRPC_addOrderInListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addOrderInListException( exception) {
	/* <a-zone id="onRPC_addOrderInListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addOrderInListSuccess( result) {
	/* <a-zone id="onRPC_addOrderInListSuccess"> */
	if (result != null) {
		//alert(result);
		if(result==0)
		{
			PI_removeLay();
			AWL_getMessage('cmdeEnListeOK');
		}
		else if(result ==1)
		{
			PI_removeLay();
			AWL_getMessage('cmdeEnListeErr');
		}
		else if(result ==2)
		{
			AWL_getMessage('listeVide');
		}
		else if(result ==3)
		{
			AWL_getMessage('listExist');
		}
		else if(result ==4)
		{
			AWL_getMessage('tailleNomListeErr');
		}
	}
	/* </a-zone> */
}

 function RPC_addProductInList( irefc,  irefc_variety,  nomListe,  qty,  type) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addProductInList(treatRPC_addProductInList, irefc, irefc_variety, nomListe, qty, type);
}

 function treatRPC_addProductInList( result,  exception) {
	/* <a-zone id="treatRPC_addProductInList"> */
	if (onRPC_addProductInListException != null && exception != null) {
		onRPC_addProductInListException(exception);
	}
	if (onRPC_addProductInListSuccess != null && result != null) {
		onRPC_addProductInListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addProductInListException( exception) {
	/* <a-zone id="onRPC_addProductInListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addProductInListSuccess( result) {
	/* <a-zone id="onRPC_addProductInListSuccess"> */
	if (result != null) {
		//alert(result);
		if(result==0)
		{
			PI_removeLay();
			AWL_getMessage('pdtEnListeOK');
		}
		else if(result ==2)
		{
			AWL_getMessage('listeVide');
		}
		else if(result ==3)
		{
			AWL_getMessage('listExist');
		}
		else if(result ==4)
		{
			AWL_getMessage('tailleNomListeErr');
		}
		else if(result ==5)
		{
			AWL_getMessage('Doublon');
		}
	}
	/* </a-zone> */
}

 function RPC_addProductInShoppingCart( irefc,  irefc_variety,  price,  qty) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addProductInShoppingCart(treatRPC_addProductInShoppingCart, irefc, irefc_variety, price, qty);
}

 function treatRPC_addProductInShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_addProductInShoppingCart"> */
	if($('presScrollMaskLay'))scrollTop=$('presScrollMaskLay').scrollTop;
	if (onRPC_addProductInShoppingCartException != null && exception != null) {
		onRPC_addProductInShoppingCartException(exception);
	}
	if (onRPC_addProductInShoppingCartSuccess != null && result != null) {
		onRPC_addProductInShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addProductInShoppingCartException( exception) {
	/* <a-zone id="onRPC_addProductInShoppingCartException"> */
	// il faudrait non pas lancer une exception mais afficher un message d'erreur par layer
  if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addProductInShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_addProductInShoppingCartSuccess"> */
	if (result != null) {
       // le produit est ajoute au panier
       if (result.map.retour) {
        //alert("Pdt ajouter au panier");
        awl_basket.shoppingCart=eval(result.map.panier.list);
        // debug awl_graphic.drawBasket();
        allItem=awl_basket.AWL_transformAWLBasket2PI();
        if($('ajoutLay'))PI_loadLay('ajoutLay','TIMER');
        //MyBasket.refresh();
        if(document.location.href.indexOf("courses-en-ligne")!=-1){
        document.getElementById("basketTg").style.visibility="hidden";
        document.getElementById("basketDetail").style.height="155px";
        }
       } else {
        //alert("Pdt pas ajouter au panier "+result.map.raison);
        // le produit n'est pas ajoute au panier
        if (result.map.raison==1) { // visiteur non localise
          
           
          AWL_getMessage('verificationcp');
          
           
        }
        if (result.map.raison==5)
        {
        	AWL_getMessage('maxQtyPdt');
        }
        if (result.map.raison==6)
        {
        	AWL_getMessage('maxAmountBasket');
        }
        
        
       }
       
       if ($('basketFull')) {
	       indexItem=allItem.product_html.indexOf($('basketFull'));
	       itemInfo=$('basketFull').down(0);
		   infoTab=itemInfo.innerHTML.split("-");
		   //alert("infoTab.length = "+infoTab.length);
		   if(infoTab!=null && infoTab.length==2)
		   	AWL_getRecapDetailListe('basketFull',infoTab[1]);
		   else
		   	RPC_getShoppingCart();
       }
       else
       {
       	RPC_getShoppingCart();
       }
    
      //RPC_getShoppingCart();
	}
	/* </a-zone> */
}

 function RPC_addProductsInList( irefc,  irefc_variety,  nomListe,  type) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addProductsInList(treatRPC_addProductsInList, irefc, irefc_variety, nomListe, type);
}

 function treatRPC_addProductsInList( result,  exception) {
	/* <a-zone id="treatRPC_addProductsInList"> */
	if (onRPC_addProductsInListException != null && exception != null) {
		onRPC_addProductsInListException(exception);
	}
	if (onRPC_addProductsInListSuccess != null && result != null) {
		onRPC_addProductsInListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addProductsInListException( exception) {
	/* <a-zone id="onRPC_addProductsInListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addProductsInListSuccess( result) {
	/* <a-zone id="onRPC_addProductsInListSuccess"> */
	if (result != null) {
		//alert(result);
		if(result==0)
		{
			PI_removeLay();
			AWL_getMessage('pdtsEnListeOK');
		}
		else if(result ==2)
		{
			AWL_getMessage('listeVide');
		}
		else if(result ==3)
		{
			AWL_getMessage('listExist');
		}
	}
	/* </a-zone> */
}

 function RPC_addProductsInShoppingCart( irefc,  irefc_variety,  price,  qty) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addProductsInShoppingCart(treatRPC_addProductsInShoppingCart, irefc, irefc_variety, price, qty);
}

 function treatRPC_addProductsInShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_addProductsInShoppingCart"> */
	if (onRPC_addProductsInShoppingCartException != null && exception != null) {
		onRPC_addProductsInShoppingCartException(exception);
	}
	if (onRPC_addProductsInShoppingCartSuccess != null && result != null) {
		onRPC_addProductsInShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addProductsInShoppingCartException( exception) {
	/* <a-zone id="onRPC_addProductsInShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addProductsInShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_addProductsInShoppingCartSuccess"> */
	if (result != null) {
		//alert(result.map.retour+" "+result.map.raison);
		if(result.map.retour){
			AWL_getMessage('listeEnPanierOK');
		}else{
			switch(result.map.raison){
	        	case 5:
	        		AWL_getMessage('maxQtyPdt');
	        		break;
	        	default:
	        		break;
        	}
		}
	}else{
		alert("result is null");
	}
	/* </a-zone> */
}

 function RPC_addShoppingCartInList( nomListe,  type) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_addShoppingCartInList(treatRPC_addShoppingCartInList, nomListe, type);
}

 function treatRPC_addShoppingCartInList( result,  exception) {
	/* <a-zone id="treatRPC_addShoppingCartInList"> */
	if (onRPC_addShoppingCartInListException != null && exception != null) {
		onRPC_addShoppingCartInListException(exception);
	}
	if (onRPC_addShoppingCartInListSuccess != null && result != null) {
		onRPC_addShoppingCartInListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_addShoppingCartInListException( exception) {
	/* <a-zone id="onRPC_addShoppingCartInListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_addShoppingCartInListSuccess( result) {
	/* <a-zone id="onRPC_addShoppingCartInListSuccess"> */
	if (result != null) {
		//alert(result);
		
		if(result==0)
		{
			PI_removeLay();
			AWL_getMessage('panierEnListeOK');
		}
		else if(result==2)
		{
			AWL_getMessage('listeVide');
		}
		else if(result ==3)
		{
			AWL_getMessage('listExist');
		}
		else if(result ==4)
		{
			AWL_getMessage('tailleNomListeErr');
		}	 
	}
	/* </a-zone> */
}

 function RPC_getShoppingCart() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_getShoppingCart(treatRPC_getShoppingCart);
}

 function treatRPC_getShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_getShoppingCart"> */
	if (onRPC_getShoppingCartException != null && exception != null) {
		onRPC_getShoppingCartException(exception);
	}
	if (onRPC_getShoppingCartSuccess != null && result != null) {
		onRPC_getShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_getShoppingCartException( exception) {
	/* <a-zone id="onRPC_getShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_getShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_getShoppingCartSuccess"> */
	if (result.map.panier != null) {
	    
        
        awl_basket.shoppingCart=eval(result.map.panier.list);
        allItem=awl_basket.AWL_transformAWLBasket2PI();
        MyBasket.refresh();
      
	}
	/* </a-zone> */
}

 function RPC_inscriptionClientNewsLetter( inscription,  userId) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_inscriptionClientNewsLetter(treatRPC_inscriptionClientNewsLetter, inscription, userId);
}

 function treatRPC_inscriptionClientNewsLetter( result,  exception) {
	/* <a-zone id="treatRPC_inscriptionClientNewsLetter"> */
	if (onRPC_inscriptionClientNewsLetterException != null && exception != null) {
		onRPC_inscriptionClientNewsLetterException(exception);
	}
	if (onRPC_inscriptionClientNewsLetterSuccess != null && result != null) {
		onRPC_inscriptionClientNewsLetterSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_inscriptionClientNewsLetterException( exception) {
	/* <a-zone id="onRPC_inscriptionClientNewsLetterException"> */
	if (exception) {
		alert(exception.message);
		alert(exception.code);
		alert(exception.name);
	}
	/* </a-zone> */
}

 function onRPC_inscriptionClientNewsLetterSuccess( result) {
	/* <a-zone id="onRPC_inscriptionClientNewsLetterSuccess"> */
	if (result != null) {
		switch(result)
		{
			case -2 :
				AWL_getMessage('desinscriptionNewsletterK0');
				break;
			case -1 :
				AWL_getMessage('inscriptionNewsletterK0');
				break;
			case 1 :
				AWL_getMessage('inscriptionNewsletterOK');
				break;
			case 2 :
				AWL_getMessage('desinscriptionNewsletterOK');
				break;
		}
	}

	/* </a-zone> */
}

 function RPC_preValidateShoppingCart() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_preValidateShoppingCart(treatRPC_preValidateShoppingCart);
}

 function treatRPC_preValidateShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_preValidateShoppingCart"> */
	if (onRPC_preValidateShoppingCartException != null && exception != null) {
		onRPC_preValidateShoppingCartException(exception);
	}
	if (onRPC_preValidateShoppingCartSuccess != null && result != null) {
		onRPC_preValidateShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_preValidateShoppingCartException( exception) {
	/* <a-zone id="onRPC_preValidateShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_preValidateShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_preValidateShoppingCartSuccess"> */
	if (result != null) {
		//On regarde si on valid le panier ŕ partir du mini panier 
		//ou du récap de panier (étape 1 du process de commande)
		if(preValidateFromRecapBasket){
			//alert("Resultat de la pré validation : "+result)
			switch(result) {
				case 2:
					AWL_getMessage('minimumpaniernonatteint');
					break;
				case 4:
				case 43:
				case 45:
				case 435:
					AWL_getMessage('montantSurgeleFromRecapBasket');
					break;
				default:
					AWL_verifSynthesePanier(true);
					break;
			}
		}else{
			switch(result) {
				case 1:// validation du panier sans etre identifie
					window.location.href="/client/identification.jsp?validBasket=1";
					break;
				case 2:
					AWL_getMessage('minimumpaniernonatteint');
					break;
				case 3:
					AWL_getMessage('warningServicePlus');
					break;
				case 4:
					AWL_getMessage('montantSurgele');
					break;
				case 5:
					window.location.href="/panier/panier.jsp";
					//AWL_getMessage('warningProduitPack');
					break;
				case 35:
					AWL_getMessage('warningServicePlus');
					//AWL_getMessage('warningProduitPack');
					break;
				case 43:
					AWL_getMessage('warningServicePlus');
					AWL_getMessage('montantSurgele');
					break;
				case 45:
					AWL_getMessage('warningProduitPack');
					AWL_getMessage('montantSurgele');
					break;
				case 435:
					AWL_getMessage('warningServicePlus');
					//AWL_getMessage('warningProduitPack');
					AWL_getMessage('montantSurgele');
					break;
				
				case 0:
					window.location.href="/panier/panier.jsp";
					break;
				default:
					
					break;

			}
		}
	}
	/* </a-zone> */
}

 function RPC_rechercheClient( dateNaissance,  nom,  numeroCarte,  prenom) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_rechercheClient(treatRPC_rechercheClient, dateNaissance, nom, numeroCarte, prenom);
}

 function treatRPC_rechercheClient( result,  exception) {
	/* <a-zone id="treatRPC_rechercheClient"> */
	if (onRPC_rechercheClientException != null && exception != null) {
		onRPC_rechercheClientException(exception);
	}
	if (onRPC_rechercheClientSuccess != null && result != null) {
		onRPC_rechercheClientSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_rechercheClientException( exception) {
	/* <a-zone id="onRPC_rechercheClientException"> */
	
	/* </a-zone> */
}

 function onRPC_rechercheClientSuccess( result) {
	/* <a-zone id="onRPC_rechercheClientSuccess"> */
	if (result != null) {
	
	if (result.map.codeRetour!=null) {
		if(result.map.codeRetour!='clientDifferent')
			AWL_getMessageWebService('codeRetour',result.map.codeRetour);
	}  else {
	  
	  if ($('inputCivility').value=="") {
	   if (result.map.rechercheClient.client.civilite=='M') {
         $('inputCivility').value='M.';
         $('imgM').src='/img/btn/radio-1.gif';
      }
      if (result.map.rechercheClient.client.civilite=='Mme') 
      { 
        $('inputCivility').value='Mme';
        $('imgMme').src='/img/btn/radio-1.gif';
      }
      if (result.map.rechercheClient.client.civilite=='Mlle') {
        $('inputCivility').value='Mlle';
        $('imgMlle').src='/img/btn/radio-1.gif';
      }
    }
	
  	if ($('inputDn').value=="") $('inputDn').value=result.map.dateNaissance;
		
    if ($('inputTel1').value=="") $('inputTel1').value=result.map.rechercheClient.client.telephone1;
		if ($('inputTel2').value=="") $('inputTel2').value=result.map.rechercheClient.client.telephone2;
		if ($('inputEmail').value=="") $('inputEmail').value=result.map.rechercheClient.client.mail;
		if ($('inputEmailConf').value=="") $('inputEmailConf').value=result.map.rechercheClient.client.mail;
		if ($('inputAdresseLiv').value=="") $('inputAdresseLiv').value=result.map.rechercheClient.adresseLivraison.adresse;
		if ($('inputVilleLiv').value=="") $('inputVilleLiv').value=result.map.rechercheClient.adresseLivraison.ville;
	  
	  
	  if ($('inputResidLiv').value=="") {
		  if (result.map.rechercheClient.adresseLivraison.appartement!=null) {
        $('inputResidLiv').value="Appartement";
        $('imgAppartement').src='/img/btn/radio-1.gif';
        $("appartementInfos").style.display = "block";
      } else {
        $('inputResidLiv').value="Maison";
        $('imgMaison').src='/img/btn/radio-1.gif';
        $("appartementInfos").style.display = "block";
        $("appartementInfos2").style.display = "none";
        $("radioPorteLiv").style.display = "none";
      }
		}
		if ($('inputBatLiv').value=="") $('inputBatLiv').value=result.map.rechercheClient.adresseLivraison.residence;
    if ($('inputDig1Liv').value=="") $('inputDig1Liv').value=result.map.rechercheClient.adresseLivraison.digicode1;
    if ($('inputDig2Liv').value=="") $('inputDig2Liv').value=result.map.rechercheClient.adresseLivraison.digicode2;
    if ($('inputDig3Liv').value=="") $('inputDig3Liv').value=result.map.rechercheClient.adresseLivraison.digicode3;
    
    if ($('inputInterphoneLiv').value=="") {
      if (result.map.rechercheClient.adresseLivraison.interphone) {
        $('inputInterphoneLiv').value=1;
        $('imgInterphoneLiv').src='/img/btn/radio-1.gif';
      }
    }
    
    if ($('inputInterphoneDiffLiv').value=="") $('inputInterphoneDiffLiv').value=result.map.rechercheClient.adresseLivraison.nomInterphone;
    if ($('inputEtageLiv').value=="") $('inputEtageLiv').value=result.map.rechercheClient.adresseLivraison.etage;
    
    if ($('inputAscenseur').value=="") {
      if (result.map.rechercheClient.adresseLivraison.ascenseur) {
        $('inputAscenseur').value=1;
        $('imgAscenseur').src="/img/btn/check-1.gif";
      }
    }
    
    if ($('inputPorteLiv').value=="") {
     if (result.map.rechercheClient.adresseLivraison.porte=='droite') {
       $('inputPorteLiv').value="Droit";
       $('imgPorteLivDroite').src='/img/btn/radio-1.gif';
      }
    
      if (result.map.rechercheClient.adresseLivraison.porte=='face') {
       $('inputPorteLiv').value="en Face";
       $('imgPorteLivFace').src='/img/btn/radio-1.gif';
      }
    
      if (result.map.rechercheClient.adresseLivraison.porte=='gauche') {
       $('inputPorteLiv').value="Gauche";
       $('imgPorteLivGauche').src='/img/btn/radio-1.gif';
      }
    }  
    

    if ($('inputPrecLiv').value=="") $('inputPrecLiv').value=result.map.rechercheClient.adresseLivraison.observation;
	}
	}
	/* </a-zone> */
}

 function RPC_removeAllItems() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeAllItems(treatRPC_removeAllItems);
}

 function treatRPC_removeAllItems( result,  exception) {
	/* <a-zone id="treatRPC_removeAllItems"> */
	if (onRPC_removeAllItemsException != null && exception != null) {
		onRPC_removeAllItemsException(exception);
	}
	if (onRPC_removeAllItemsSuccess != null && result != null) {
		onRPC_removeAllItemsSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeAllItemsException( exception) {
	/* <a-zone id="onRPC_removeAllItemsException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_removeAllItemsSuccess( result) {
	/* <a-zone id="onRPC_removeAllItemsSuccess"> */
	if (result != null) {
		if(document.location.href.indexOf("courses-en-ligne")!=-1 && result.map.retour){
           document.getElementById("basketTg").style.visibility="visible";
            document.getElementById("basketDetail").style.height="78px";
            document.getElementById("maskbasketItems").style.height="44px";
		}
        awl_basket.shoppingCart=new Array();
        allItem={
				"product_name":[],
				"product_quantite":[],
				"product_ref":[],
				"product_id":[],
				"product_price":[],
				"product_html":[],
				"product_brand":[],
				"product_productName":[],
				"product_variety":[]
				};
        
        MyBasket.refresh();
        if ($('basketFull')!=null) {
          PI_removeLay(); 
        }
	}
	/* </a-zone> */
}

 function RPC_removeAllItemsFromDeconnection() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeAllItemsFromDeconnection(treatRPC_removeAllItemsFromDeconnection);
}

 function treatRPC_removeAllItemsFromDeconnection( result,  exception) {
	/* <a-zone id="treatRPC_removeAllItemsFromDeconnection"> */
	if (onRPC_removeAllItemsFromDeconnectionException != null && exception != null) {
		onRPC_removeAllItemsFromDeconnectionException(exception);
	}
	if (onRPC_removeAllItemsFromDeconnectionSuccess != null && result != null) {
		onRPC_removeAllItemsFromDeconnectionSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeAllItemsFromDeconnectionException( exception) {
	/* <a-zone id="onRPC_removeAllItemsFromDeconnectionException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_removeAllItemsFromDeconnectionSuccess( result) {
	/* <a-zone id="onRPC_removeAllItemsFromDeconnectionSuccess"> */
	if (result != null) {
		    
        awl_basket.shoppingCart=new Array();
        allItem={
				"product_name":[],
				"product_quantite":[],
				"product_ref":[],
				"product_id":[],
				"product_price":[],
				"product_html":[],
				"product_brand":[],
				"product_productName":[],
				"product_variety":[]
				};
        
        MyBasket.refresh();
        if ($('basketFull')!=null) {
          PI_removeLay();
        } 
    }
	/* </a-zone> */
}

 function RPC_removeList( idListe) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeList(treatRPC_removeList, idListe);
}

 function treatRPC_removeList( result,  exception) {
	/* <a-zone id="treatRPC_removeList"> */
	if (onRPC_removeListException != null && exception != null) {
		onRPC_removeListException(exception);
	}
	if (onRPC_removeListSuccess != null && result != null) {
		onRPC_removeListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeListException( exception) {
	/* <a-zone id="onRPC_removeListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_removeListSuccess( result) {
	/* <a-zone id="onRPC_removeListSuccess"> */
	if (result != null) {
		//alert(result);
		//AWL_getRecapListe('AWL_recapListe');
		
		if(result==0)
		{
			AWL_getMessage('supListeOK');
		}
		else if(result==1)
		{
			AWL_getMessage('supListeErr');
		}
	}
	/* </a-zone> */
}

 function RPC_removeProductFromList( idListe,  irefc) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeProductFromList(treatRPC_removeProductFromList, idListe, irefc);
}

 function treatRPC_removeProductFromList( result,  exception) {
	/* <a-zone id="treatRPC_removeProductFromList"> */
	if($('presScrollMaskLay'))scrollTop=$('presScrollMaskLay').scrollTop;
	
	if (onRPC_removeProductFromListException != null && exception != null) {
		onRPC_removeProductFromListException(exception);
	}
	if (onRPC_removeProductFromListSuccess != null && result != null) {
		onRPC_removeProductFromListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeProductFromListException( exception) {
	/* <a-zone id="onRPC_removeProductFromListException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_removeProductFromListSuccess( result) {
	/* <a-zone id="onRPC_removeProductFromListSuccess"> */
	if (result != null) {
		if(result>=0)
		{
			//alert(result);
			//PI_closeBasketFull();
			//loadBasketFull('liste',result);
			AWL_getRecapListe('AWL_recapListe');
			AWL_getRecapDetailListe('basketFull',result);
			AWL_getMessage('supPdtListeOK');
			
			
		}
		else if(result ==-1)
		{
			AWL_getMessage('supPdtListeErr');
		}
	}
	/* </a-zone> */
}

 function RPC_removeProductFromShoppingCart( irefc) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeProductFromShoppingCart(treatRPC_removeProductFromShoppingCart, irefc);
}

 function treatRPC_removeProductFromShoppingCart( result,  exception) {
	/* <a-zone id="treatRPC_removeProductFromShoppingCart"> */
	if (onRPC_removeProductFromShoppingCartException != null && exception != null) {
		onRPC_removeProductFromShoppingCartException(exception);
	}
	if (onRPC_removeProductFromShoppingCartSuccess != null && result != null) {
		onRPC_removeProductFromShoppingCartSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeProductFromShoppingCartException( exception) {
	/* <a-zone id="onRPC_removeProductFromShoppingCartException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_removeProductFromShoppingCartSuccess( result) {
	/* <a-zone id="onRPC_removeProductFromShoppingCartSuccess"> */
	if (result != null) {
		if (result.map.retour) {
        	if ($('AWL_recapPanier')!=null) {
          		AWL_getRecapPanier('AWL_recapPanier');
          		if ($('AWL_synthesePanier')!=null) {
		            AWL_verifSynthesePanier(false);
          		}
        	}else{
        		if ($('basketFull')!=null) {
          			loadBasketFull('panier'); 
        		}
       
        		awl_basket.shoppingCart=eval(result.map.panier.list);
        		// debug awl_graphic.drawBasket();
        		allItem=awl_basket.AWL_transformAWLBasket2PI();
        		MyBasket.refresh();
        	}
        	if (document.location.href.indexOf("courses-en-ligne")!=-1 && result.map.raison==101){
        	document.getElementById("basketTg").style.visibility="visible";
        	 document.getElementById("basketDetail").style.height="78px";
        	 document.getElementById("maskbasketItems").style.height="44px";
        	}
        	if (result.map.raison==7){
	        	AWL_getMessage('bonAchatSupprimer');
	        }
        }
	}
	/* </a-zone> */
}

 function RPC_removeProductsFromList( idListe) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_removeProductsFromList(treatRPC_removeProductsFromList, idListe);
}

 function treatRPC_removeProductsFromList( result,  exception) {
	/* <a-zone id="treatRPC_removeProductsFromList"> */
	if($('presScrollMaskLay'))scrollTop=$('presScrollMaskLay').scrollTop;
	
	if (onRPC_removeProductsFromListException != null && exception != null) {
		onRPC_removeProductsFromListException(exception);
	}
	if (onRPC_removeProductsFromListSuccess != null && result != null) {
		onRPC_removeProductsFromListSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_removeProductsFromListException( exception) {
	/* <a-zone id="onRPC_removeProductsFromListException"> */
	if (exception) {
		alert(exception.message);
		alert(exception.code);
		alert(exception.name);
	}
	/* </a-zone> */
}

 function onRPC_removeProductsFromListSuccess( result) {
	/* <a-zone id="onRPC_removeProductsFromListSuccess"> */
	if (result != null) {
		if(result>=0)
		{
			//alert(result);
			//PI_closeBasketFull();
			//loadBasketFull('liste',result);
		//	AWL_getRecapListe('AWL_recapListe');
			//AWL_getRecapDetailListe('basketFull',result);
			AWL_getMessage('vidListeOK');
			
			
		}
		else if(result ==-1)
		{
			AWL_getMessage('vidListeErr');
		}
	}
	/* </a-zone> */
}

 function RPC_setIsLieuLivraisonConfirme() {
	if (initDone == false) {
		initAJAX();
	}
	
		jsonrpc.remoteBasketManager.RPC_setIsLieuLivraisonConfirme(treatRPC_setIsLieuLivraisonConfirme);

}

 function treatRPC_setIsLieuLivraisonConfirme( result,  exception) {
	/* <a-zone id="treatRPC_setIsLieuLivraisonConfirme"> */

	if (onRPC_setIsLieuLivraisonConfirmeException != null && exception != null) {
		onRPC_setIsLieuLivraisonConfirmeException(exception);
	}
	if (onRPC_setIsLieuLivraisonConfirmeSuccess != null && result == null) {
		onRPC_setIsLieuLivraisonConfirmeSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_setIsLieuLivraisonConfirmeException( exception) {
	/* <a-zone id="onRPC_setIsLieuLivraisonConfirmeException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_setIsLieuLivraisonConfirmeSuccess( result) {
	/* <a-zone id="onRPC_setIsLieuLivraisonConfirmeSuccess"> */
	awl_basket.AWL_CPconfirme();
	
	if (result != null) {
		alert(result);
	}
	/* </a-zone> */
}

 function RPC_setShoppingCartQuantity( irefc,  irefcVariety,  qty) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_setShoppingCartQuantity(treatRPC_setShoppingCartQuantity, irefc, irefcVariety, qty);
}

 function treatRPC_setShoppingCartQuantity( result,  exception) {
	/* <a-zone id="treatRPC_setShoppingCartQuantity"> */
	if (onRPC_setShoppingCartQuantityException != null && exception != null) {
		onRPC_setShoppingCartQuantityException(exception);
	}
	if (onRPC_setShoppingCartQuantitySuccess != null && result != null) {
		onRPC_setShoppingCartQuantitySuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_setShoppingCartQuantityException( exception) {
	/* <a-zone id="onRPC_setShoppingCartQuantityException"> */
	if (exception) {

	}
	/* </a-zone> */
}

 function onRPC_setShoppingCartQuantitySuccess( result) {
	/* <a-zone id="onRPC_setShoppingCartQuantitySuccess"> */
	if (result != null) {
		if (result.map.retour) {
	        if ($('AWL_recapPanier')!=null) {
	          AWL_getRecapPanier('AWL_recapPanier');
	          if ($('AWL_synthesePanier')!=null) {
	          	if (result.map.raison==7){
		        	AWL_getMessage('bonAchatSupprimer');
		        }
	            AWL_verifSynthesePanier(false);
	          }          
	        }else{
				if ($('basketFull')!=null) {
	          		loadBasketFull('panier');
	        	}
	        	// cas navigation accueil, fiche produit		
	        	awl_basket.shoppingCart=eval(result.map.panier.list);
	        	// debug awl_graphic.drawBasket();
	        	allItem=awl_basket.AWL_transformAWLBasket2PI();
	        	MyBasket.refresh();
	        	if (result.map.raison==7){
		        	AWL_getMessage('bonAchatSupprimer');
		        }
	        }
		}else{
	    	if ($('basketFull')!=null){
	        	loadBasketFull('panier'); 
	        }		
			if (result.map.raison==5){
	        	AWL_getMessage('maxQtyPdt');
	        }
	        if (result.map.raison==6){
	        	AWL_getMessage('maxAmountBasket');
	        }
		}
	}
	/* </a-zone> */
}

 function RPC_verifBasketBeforeAddProduct( irefc,  irefcVariety,  mode,  price,  qty) {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_verifBasketBeforeAddProduct(treatRPC_verifBasketBeforeAddProduct, irefc, irefcVariety, mode, price, qty);
}

 function treatRPC_verifBasketBeforeAddProduct( result,  exception) {
	/* <a-zone id="treatRPC_verifBasketBeforeAddProduct"> */
	if (onRPC_verifBasketBeforeAddProductException != null && exception != null) {
		onRPC_verifBasketBeforeAddProductException(exception);
	}
	if (onRPC_verifBasketBeforeAddProductSuccess != null && result != null) {
		onRPC_verifBasketBeforeAddProductSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_verifBasketBeforeAddProductException( exception) {
	/* <a-zone id="onRPC_verifBasketBeforeAddProductException"> */
	if (exception) {
		alert(exception.message);
		alert(exception.code);
		alert(exception.name);
	}
	/* </a-zone> */
}

 function onRPC_verifBasketBeforeAddProductSuccess( result) {
	/* <a-zone id="onRPC_verifBasketBeforeAddProductSuccess"> */
	if (result != null) {
		//alert(result.map.retour+" "+result.map.raison)
		//Si retour OK, le produit a ete ajoute
		if (result.map.retour) {
			//alert("[RPC_verifBasketBeforeAddProduct]On va ajouter le produit ("+result.map.irefc+", irefcVariety = "+result.map.irefcVariety+", price"+result.map.price+", qty="+result.map.qty+") ds le panier avec le mode = "+result.map.mode);
	        if(result.map.mode==1)RPC_addProductInShoppingCart(result.map.irefc, result.map.irefcVariety, result.map.price, result.map.qty);
	        if(result.map.mode==2)RPC_setShoppingCartQuantity( result.map.irefc,  result.map.irefcVariety,  result.map.qty);
		}else{
			switch(result.map.raison){
				case -1 :
					//Exception releve lors de la verification du panier
					break;
				case 2:
					//le produit n existe pas
					break;
				case 3:
					//Volume pack du panier superieur au volume maximum nÝ2
					//alert("maxVolumePack2");
					if(result.map.mode==1)
						AWL_getMessage('maxVolumePack2_1', result.map.irefc, result.map.price, result.map.qty, result.map.irefcVariety);
					if(result.map.mode==2)
						AWL_getMessage('maxVolumePack2_2', result.map.irefc, result.map.price, result.map.qty, result.map.irefcVariety);
					break;
				case 4:
					//Volume pack du panier superieur au volume maximum nÝ1
					//alert("maxVolumePack1");
					if(result.map.mode==1)
						AWL_getMessage('maxVolumePack1_1', result.map.irefc, result.map.price, result.map.qty, result.map.irefcVariety);
					if(result.map.mode==2)
						AWL_getMessage('maxVolumePack1_2', result.map.irefc, result.map.price, result.map.qty, result.map.irefcVariety);
					break;
				default:
					break;
			}	
			
		}
	}
	/* </a-zone> */
}

 function RPC_VerifPanierAvtInscription() {
	if (initDone == false) {
		initAJAX();
	}
	jsonrpc.remoteBasketManager.RPC_VerifPanierAvtInscription(treatRPC_VerifPanierAvtInscription);
}

 function treatRPC_VerifPanierAvtInscription( result,  exception) {
	/* <a-zone id="treatRPC_VerifPanierAvtInscription"> */
	if (onRPC_VerifPanierAvtInscriptionException != null && exception != null) {
		onRPC_VerifPanierAvtInscriptionException(exception);
	}
	if (onRPC_VerifPanierAvtInscriptionSuccess != null && result != null) {
		onRPC_VerifPanierAvtInscriptionSuccess(result);
	}
	/* </a-zone> */
}

 function onRPC_VerifPanierAvtInscriptionException( exception) {
	/* <a-zone id="onRPC_VerifPanierAvtInscriptionException"> */
	if (exception) {
		alert(exception.message);
		alert(exception.code);
		alert(exception.name);
	}
	/* </a-zone> */
}




 function onRPC_VerifPanierAvtInscriptionSuccess( result) {
	/* <a-zone id="onRPC_VerifPanierAvtInscriptionSuccess"> */
	if (result != null) {
		alert(result);
	}
	/* </a-zone> */
}
/* <a-zone id="applicative-code"> */

// methodes RPC call 
function RPCcall() {
	// Initialize the "connection" immedialty to have a more responsive call after.
	try {
	  initAJAX();
	} catch(e) {
	  
	}
	// verification du panier avant ajout du produit au panier 
	this.AWLRPC_verifBasketBeforeAddProduct= function(irefc,irefc_variety,mode,price,qty){
      // appel ajax
      RPC_verifBasketBeforeAddProduct(irefc,irefc_variety,mode,price,qty);
  	}
  // ajout produit au panier 
	this.AWLRPC_addProductInShoppingCart= function(irefc,irefc_variety,price,qty){
      // appel ajax
      RPC_addProductInShoppingCart(irefc,irefc_variety,price,qty);
      // le resultat est stocke dans     Return_addProductInShoppingCart 
      return Return_addProductInShoppingCart;
      
  }
	 // suppression  du  produit au panier 
	this.AWLRPC_removeProductFromShoppingCart= function(irefc){
	     RPC_removeProductFromShoppingCart(irefc); 
   }
   // maj  de la quatite du  produit dans lepanier
  this.AWLRPC_setShoppingCartQuantity= function(irefc,irefcVariety,qty){
       RPC_setShoppingCartQuantity(irefc,irefcVariety,qty);
  } 
   // retourne le panier
  this.AWLRPC_getShoppingCart = function() {
	     RPC_getShoppingCart();
  }
  this.AWLRPC_removeAllItems = function(){
       RPC_removeAllItems();
  }
  this.AWLRPC_removeAllItemsFromDeconnection = function(){
		RPC_removeAllItemsFromDeconnection();
  }

}




/* </a-zone> */
