function setProduct(codeSizeSelected,articleId,Ref_Article){

	var currentSelectedSize;
	currentSelectedSize=document.getElementById('currentSelectedSize').value;
	var previousSelectedRef=document.getElementById('Ref_Article').value;
	document.getElementById('popUp'+previousSelectedRef).style.display="none"; // hide the previous article pop up

	if(document.getElementById(currentSelectedSize)){
		document.getElementById(currentSelectedSize).className=" svsvs ";
		}	
	
	//alert("currentSelectedSize :"+currentSelectedSize);
	document.getElementById(codeSizeSelected).className="on";
	document.getElementById('currentSelectedSize').value=codeSizeSelected;
	document.getElementById('articleId').value=articleId;
	document.getElementById('Ref_Article').value=Ref_Article;
	document.getElementById('popUp'+Ref_Article).style.display="block"; // display pop up current selected article
	//alert("currentSelectedSize :"+currentSelectedSize+" thisChosen : "+codeSizeSelected +"----"+articleId);
    //alert("currentSelectedSize"+document.getElementById(currentSelectedSize).className);
    //alert("now selectedSize"+document.getElementById(codeSizeSelected).className);
    //alert("now selectedSize"+document.getElementById(codeSizeSelected).innerHTML);
	return true;
}


function setTailleValues(codeColorSelected,libelleCouleurSelected,defaultSize,defaultArticleId,defaultRef_Article){

	var currentSelectedColorVar;
	currentSelectedColorVar=document.getElementById('currentSelectedColor').value;
	document.getElementById('tailleCouleur'+codeColorSelected).style.display="block";
	document.getElementById(currentSelectedColorVar).className=" codeBlanc ";
    document.getElementById('tailleCouleur'+currentSelectedColorVar).style.display="none";
	document.getElementById(codeColorSelected).className="codeBlanc ? codeOn";
	document.getElementById('currentSelectedColor').value=codeColorSelected;
	document.getElementById('libelleCouleurSelected').innerHTML=libelleCouleurSelected;

	var oldSelectedSize=document.getElementById('currentSelectedSize').value;
	var oldRefArticle=document.getElementById('Ref_Article').value;
	document.getElementById(oldSelectedSize).className="";
	document.getElementById('popUp'+oldRefArticle).style.display="none";
	document.getElementById('popUp'+defaultRef_Article).style.display="block";

	document.getElementById('Ref_Article').value=defaultRef_Article;
	document.getElementById('articleId').value=defaultArticleId;
	document.getElementById('currentSelectedSize').value=defaultSize;
	document.getElementById(defaultSize).className="on";

	//alert("currentSelectedColor :"+currentSelectedColorVar+" thisChosen : "+codeColorSelected +"----"+articleId);
	return true;
}

//AJOUT J.FALCON 29/04/11 GLCOM-436 : activation du bloc prix de l'article courant
function changePriceDisplayed(Ref_Article){
	$('.article_price_on').removeClass('article_price_on');
	$('.prod_price_on').removeClass('prod_price_on');
	$('#prices-' + Ref_Article).addClass('article_price_on');
	$('#prod_priceFP_' + Ref_Article).addClass('prod_price_on');
}

function changePriceDisplayedQV(Ref_Article){
	$('.article_price_on_QV').removeClass('article_price_on_QV');
	$('.prod_price_on_QV').removeClass('prod_price_on_QV');
	$('#pricesQV-' + Ref_Article).addClass('article_price_on_QV');
	$('#prod_priceQV_' + Ref_Article).addClass('prod_price_on_QV');
}
//FIN AJOUT J.FALCON 29/04/11 GLCOM-436

//AJOUT GLCOM-1 : modification de la fonction pour pointer sur la bonne popUp

function AddCartAjaxcall(urlServerProcess){

	var prod =$("#globalFP #prod").attr("value");
	var quantity = $("#globalFP .selecteurQuantity > .dropdownCell").attr("value");
	var colorSize = $("#globalFP .cliq .selecteurSize > .dropdownCell").attr("value");
	//MODIF J.FALCON 29/04/11 GLCOM-436 : choix du prix de l'article courant	
	var prod_price=$(".prod_price_on_QV").attr("value");
	//FIN MODIF J.FALCON 29/04/11 GLCOM-436 : choix du prix de l'article courant	
	var url_client=urlServerProcess;
	var qty_max=$("#globalFP #qty_max").attr("value");
	var sub_array_name;
	var stringData = 'prod='+ prod +'&quantity='+quantity+'&colorSize='+colorSize+'&prod_price='+prod_price+'&qty_max='+qty_max;
	var stringUrl = url_client;

	$.ajax({
		type: "POST",
		url: stringUrl,
		data: stringData,
		success: function(returnedValues) {
			eval(returnedValues);

			if(ajaxReturnValues['status']=="OK"){

//				var sousTotal = $('#DivPanierQuick #popInfoId'+colorSize).html();//=ajaxReturnValues['cartInfo']['infoTotalPanier'];
//				var nb=ajaxReturnValues['cartInfo']['nbArticles'];
//				$('#DivPanierQuick #popInfoId'+colorSize).html(ajaxReturnValues['cartInfo']['infoTotalPanier']);
//				$('#nbArticles').html(nb);
//				$('#DivPanierQuick').css('height', '300px');
//				$('#DivPanierQuick #lienValiderCommande'+colorSize).css('display', 'block');
//				if($('#DivPanierQuick #popUp'+colorSize)){
//					$('#DivPanierQuick #popUp'+colorSize).css('display', 'block');
//				}

				emptyQuick();
				rechargerVotrePanier();

				if (document.getElementById('conteneur_headerBA')){

					if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion <=6){

						$('#imagePanierBA').mouseover().delay(4000).queue(function(){
							$(this).mouseleave();
						});
					}
					else{

						function cartWrapperBA(){
							document.getElementById('flechePanierFermeBA').style.display = 'none';
							document.getElementById('votrePanierFermeBA').style.display = 'none';
							document.getElementById('menuPanier').style.display = 'block';

						};

						function cartHiderBA(){
							document.getElementById('flechePanierFermeBA').style.display = 'block';
							document.getElementById('votrePanierFermeBA').style.display = 'block';
							document.getElementById('menuPanier').style.display = 'none';

						};

						cartWrapperBA();
						setTimeout(cartHiderBA, 4000);
					}
				}else{
					if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion <=6){

						$('#imagePanier').mouseover().delay(4000).queue(function(){
							$(this).mouseleave();
						});
					}
					else{

						function cartWrapper(){
							document.getElementById('flechePanierFerme').style.display = 'none';
							document.getElementById('votrePanierFerme').style.display = 'none';
							document.getElementById('menuPanier').style.display = 'block';

						};

						function cartHider(){
							document.getElementById('flechePanierFerme').style.display = 'block';
							document.getElementById('votrePanierFerme').style.display = 'block';
							document.getElementById('menuPanier').style.display = 'none';

						};

						cartWrapper();
						setTimeout(cartHider, 4000);
					}


				}
				
				if (document.getElementById('products')){
					$('#products').removeClass('products-pop');
				}

			}else{

				/**
				 * MODIF SBR GLCOM-318 : évolution de l'affichage des messages d'erreur
				 * 
				 * 
				 */
				
				if( ajaxReturnValues['status']=="NOK" ){
					$('#errorMessageQV').html('<div id="errorTextQV">'+ajaxReturnValues['error_text']+'</div>');
					
				}
				
				/**
				 * FIN MODIF SBR GLCOM-318
				 * 
				 */
//				alert(ajaxReturnValues['status']);
//				alert(ajaxReturnValues['error']);
//				$('#BgPopup').show();
//				$('#DivPanierQuick').css('height', '172px');
//				affichePopQuick();

			}
			

		},
		error: ""

	});


}

function affichePopQuick() {

	$('#pop-quick-produit').css('display', 'block');
	$('#cnt-pop-quick').css('display', 'block');
	$('#globalFP').css('display','block');
	$('#cnt-pop-top').css('background-image', 'none');
	$('#DivPanierQuick').show();
	$('#cnt-pop-quick-left').html('');
	$('#cnt-pop-quick-right').html('');
	$('#'+popIn.menuID).css('z-index', -1);
	$('#'+popIn.footerID).css('z-index', -1);

	// On cache les select sous IE6

	if($.browser.msie && $.browser.version < 7){
		$('select').css('visibility', 'hidden');
	}

	$('#DivPanierQuick').find('.closedPopIn').bind('click',function(){
		popIn.closed('DivPanierQuick');
		$('#DivPanierQuick > div').each(function(){
			$(this).css('display', 'none');
		});
	});
}

//FIN AJOUT GLCOM-1

function AddCartAjaxcallFP(urlServerProcess){

	var prod =$("#prodFP").attr("value");
	var quantity = $("#globalFP2 .selecteurQuantity > .dropdownCell").attr("value");
	var colorSize = $("#globalFP2 .cliq .selecteurSize > .dropdownCell").attr("value");	
	//MODIF J.FALCON 29/04/11 GLCOM-436 : choix du prix de l'article courant
	var prod_price=$(".prod_price_on").attr("value");	
	//FIN MODIF J.FALCON 29/04/11 GLCOM-436 : choix du prix de l'article courant	
	var url_client=urlServerProcess;
	var qty_max=$("#qty_maxFP").attr("value");
	var sub_array_name;
	var stringData = 'prod='+ prod +'&quantity='+quantity+'&colorSize='+colorSize+'&prod_price='+prod_price+'&qty_max='+qty_max;
	var stringUrl = url_client;
	$.ajax({
		type: "POST",
		url: stringUrl,
		data: stringData,
		success: function(returnedValues){
			eval(returnedValues);
			if(ajaxReturnValues['status']=="OK"){

				//alert($('#DivPanier #popInfoId'+colorSize).html());

//				var sousTotal=$('#DivPanier #popInfoId'+colorSize).html();//=ajaxReturnValues['cartInfo']['infoTotalPanier'];
//				var nb=ajaxReturnValues['cartInfo']['nbArticles'];
//				$('#DivPanier #popInfoId'+colorSize).html(ajaxReturnValues['cartInfo']['infoTotalPanier']);
//				$('#nbArticles').html(nb);
//				$('#DivPanier').css('height', '300px');
//				$('#DivPanier #lienValiderCommande'+colorSize).css('display', 'block');
//				if($('#DivPanier #popUp'+colorSize)){
//					$('#DivPanier #popUp'+colorSize).css('display', 'block');
//				}

				rechargerVotrePanier();
				$('#errorMessage').html('');




				if (document.getElementById('conteneur_headerBA')){

					if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion <=6){

						$('#imagePanierBA').mouseover().delay(4000).queue(function(){
							$(this).mouseleave();
						});
					}
					else{

						function cartWrapper(){
							document.getElementById('flechePanierFermeBA').style.display = 'none';
							document.getElementById('votrePanierFermeBA').style.display = 'none';
							document.getElementById('menuPanier').style.display = 'block';

						};

						function cartHider(){
							document.getElementById('flechePanierFermeBA').style.display = 'block';
							document.getElementById('votrePanierFermeBA').style.display = 'block';
							document.getElementById('menuPanier').style.display = 'none';

						};

						cartWrapper();
						setTimeout(cartHider, 4000);
					}
				}else{
					if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion <=6){

						$('#imagePanier').mouseover().delay(4000).queue(function(){
							$(this).mouseleave();
						});
					}
					else{

						function cartWrapper(){
							document.getElementById('flechePanierFerme').style.display = 'none';
							document.getElementById('votrePanierFerme').style.display = 'none';
							document.getElementById('menuPanier').style.display = 'block';

						};

						function cartHider(){
							document.getElementById('flechePanierFerme').style.display = 'block';
							document.getElementById('votrePanierFerme').style.display = 'block';
							document.getElementById('menuPanier').style.display = 'none';

						};

						cartWrapper();
						setTimeout(cartHider, 4000);
					}


				}

			}else{

				if( ajaxReturnValues['status']=="NOK" ){
					
					/**
					 * MODIF SBR GLCOM-318 : évolution de l'affichage des messages d'erreur
					 * 
					 * 
					 */
					
					if( ajaxReturnValues['status']=="NOK" ){
						$('#errorMessage').html('<div id="errorText">'+ajaxReturnValues['error_text']+'</div>');
					}
					
					/**
					 * FIN MODIF SBR GLCOM-318
					 * 
					 */
					
//					$('#DivPanier #popUpNull .contenuAjoutStatus').html("<h3>"+ajaxReturnValues['error_text']+"</h3><br /><br /><br /><br />");
//					$('#DivPanier #popUpNull').css('display','block');
//					$('#DivPanier #popUpNull .bloc-btn').css('display', 'none');
				}

				//alert(ajaxReturnValues['status']);
				//alert(ajaxReturnValues['error']);
//				$('#BgPopup').show();
//				$('#DivPanier').css('height', '172px');
//				affichePop();

			}

		},
		error: ""

	});

}

function affichePop() {

	$('#DivPanier').show();
	$('#'+popIn.menuID).css('z-index', -1);
	$('#'+popIn.footerID).css('z-index', -1);

	// On cache les select sous IE6

	if($.browser.msie && $.browser.version < 7){
		$('select').css('visibility', 'hidden');
	}

	$('#DivPanier').find('.closedPopIn').bind('click',function(){
		popIn.closed('DivPanier');
		$('#DivPanier > div').each(function(){
			$(this).css('display', 'none');
		});
	});
}

function emptyQuick() {
	$('#pop-quick-produit').hide();
	$('#pop-quick-produit').html('<div id="cnt-pop-quick" style="display: none;"></div>');

}

// FIN AJOUT GLCOM-1 SBR

function afficheBackgroundPop() {
	$('#pop-quick-produit #cnt-pop-top').css('display', 'block');
	$('#pop-quick-produit #cnt-pop-bottom').css('display', 'block');
	$('#pop-quick-produit #cnt-pop-center').css('background-image', 'url(\'/_img/tmp/pop_up/pop-center.png\')');
}

/*
 * GLCOM-621 : Cache du site
 * Modification du type "POST" en "GET"
 */
function fillProdConsult(urlServerProcess,divToFill){

	//alert(urlServerProcess);



	var url_client=urlServerProcess;


	var stringData ;//= 'prod='+ prod +'&quantity='+quantity+'&colorSize='+colorSize;
	stringData='';
	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "GET",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){

			// $('#'+divToFill).html(returnedValues);
			document.getElementById(divToFill).innerHTML=returnedValues;
			slides.SlideShowProduct();
		},
		error: ""

	});

}

function fillProdPagination(urlServerProcess,divToFill){

	//alert(urlServerProcess);



	var url_client=urlServerProcess;


	var stringData ;//= 'prod='+ prod +'&quantity='+quantity+'&colorSize='+colorSize;
	stringData='';
	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "POST",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){
			//alert(returnedValues);
			// $('#'+divToFill).html(returnedValues);
			document.getElementById(divToFill).innerHTML=returnedValues;

			//slides.SlideShowProduct();
		},
		error: ""

	});

}

/*
 * GLCOM-621 : Cache du site
 * Modification du type "POST" en "GET"
 */
function fillPagination(urlServerProcess){
	//alert(urlServerProcess);

	var url_client=urlServerProcess;

	var stringData ;//= 'prod='+ prod +'&quantity='+quantity+'&colorSize='+colorSize;
	stringData='';
	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "GET",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){
			//alert(returnedValues);
			// $('#'+divToFill).html(returnedValues);
			//document.getElementById(divToFill).innerHTML=returnedValues;

			//slides.SlideShowProduct();
		},
		error: ""

	});
}

function validateEnvoiAmi(urlServerProcess){

	//alert(urlServerProcess);
	var error=0;

	if (error == 0) {
		var url_client = urlServerProcess;
		var email_ami1=$('#email_ami1').val();


		var VotreMail=$('#VotreMail').val();
		var VotreMessage=$('#VotreMessage').val();

		//var MessageEnvoye=$('#MessageEnvoye').val();
		// var InscriptionNews=$('#InscriptionNews').val();

		var stringDataAmi = '&email_ami1='+email_ami1;
		var stringDataInfoPerso = '&message='+VotreMessage+'&email='+VotreMail;

		var stringData=stringDataAmi+stringDataInfoPerso;
		var stringUrl = url_client;
		//alert(stringUrl);
		//alert(stringData);
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				//alert(returnedValues);
				eval(returnedValues);

				if (ajaxReturnValues['status'] == "OK") {
					//alert(ajaxReturnValues['msgSuccess']);
					popIn.closed('DivEnvoiAmi');//close pop up

					showDivConfirmEnvoiAmi();// afffchage message ok.


				}
				else {

					if(ajaxReturnValues['type_error']=="SERVER_ERROR"){ // ERREUER DE SERVEUR ICI

						popIn.closed('DivEnvoiAmi');//close pop up  INITIALE
						showDivMessageEchoue();// show message server error;cad envoie echou??

					}else{
						var i=0;
						var errorString='';
						for (i=0;i<=ajaxReturnValues['errorArray'].length-1;i++)
						{
							errorString = errorString + " <br /> " + ajaxReturnValues['errorArray'][i];

						}

						//alert(errorString); // affichage erreoir

						//popIn.closed('DivCoupCoeur');//close pop up
						//popIn.closed('DivEnvoiAmi');

						var ErrorMessage="<strong>"+errorString+"</strong>";
						showErrorMessage(ErrorMessage,"DivEnvoiAmi");

					}

				}


			},
			error: ""

		});
	}
}


function ajoutCoupDeCoeur(urlServerProcess,customersLoginYes){

	//alert(customersLoginYes);


	// alert(urlServerProcess +'---'+saisiEmail +'---'+saisiPassword);
	if (customersLoginYes == '') {
		var saisiEmail = $('#saisiEmail').val();
		var saisiPassword = $('#saisiPassword').val();
		var stringDataAmi = 'email='+ saisiEmail +'&pwd='+saisiPassword;

	}else{
		var stringDataAmi=''; //pas envoi par post sur  cette page
	}
	var url_client = urlServerProcess;
	var error=0;

	var articleId_CurrentSelected = $('#articleId').val();
	var Ref_Article_CurrentSelected = $('#Ref_Article').val();
	// http://gl_refonte.cyo.local/process_coupdecoeur.php?action=addcoupdecoeur&prodid=9235&ref=20046B011 (297ms)
	var getExtentionParam="&prodid="+articleId_CurrentSelected+"&ref="+Ref_Article_CurrentSelected;
	if (error == 0) {



		var stringData=stringDataAmi+'&articleId_CurrentSelected='+articleId_CurrentSelected+'&Ref_Article_CurrentSelected='+Ref_Article_CurrentSelected;
		var stringUrl = url_client+getExtentionParam;
		//alert(stringData);

		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

				if(getCookie('cust')!= ""){
					popIn.closed('DivCoupCoeur');//close pop up
				}
				if (ajaxReturnValues['status'] == "OK") {

					//alert("Info:\n "+ajaxReturnValues['msg']);
					document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];
					document.getElementById('textMessageCoupCoeurOK').style.display="block";
					document.getElementById('textMessageCoupCoeurNOK').style.display="none";

					popIn.closed('DivCoupCoeur');//close pop up
					showDivConfirmAjoutCoeur();
				}
				else {

					//$typeErreur="EXISTE";
					if (ajaxReturnValues['typeErreur'] == "EXISTE") // cad le coup de coeur existe deja dans
					{
						document.getElementById('textMessageCoupCoeurOK').style.display="none";
						document.getElementById('textMessageCoupCoeurNOK').style.display="block";
						popIn.closed('DivCoupCoeur');//close pop up
						showDivConfirmAjoutCoeur();


					}else{
						//  alert("Error:\n "+ajaxReturnValues['msg']); //afiche message erreur
						// popIn.closed('DivCoupCoeur');//close pop up
						// popIn.closed('DivEnvoiAmi');
						var ErrorMessage="<strong>"+ajaxReturnValues['msg']+"</strong>";
						showErrorMessage(ErrorMessage,"DivCoupCoeur");


					}


					if(ajaxReturnValues['divTofill']!=''){ // on doit remplir les nouveau lien
						document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];

					}

				}


			},
			error: ""

		});
	}
}



function ajoutCoupDeCoeurPanier(urlServerProcess,customersLoginYes){

	//alert(customersLoginYes);
	// alert(urlServerProcess +'---'+saisiEmail +'---'+saisiPassword);
	/*if (customersLoginYes == '') {
	/*var saisiEmail = $('#saisiEmail').val();
	var saisiPassword = $('#saisiPassword').val();
	var stringDataAmi = 'email='+ saisiEmail +'&pwd='+saisiPassword;*/
	//popIn.closed('DivProduitCoeur');//close pop up
	//	document.getElementById('DivProduitCoeur').style.display="none";
	//}
	var url_client = urlServerProcess;
	var error=0;

	var articleId_CurrentSelected = $('#articleId').val();
	var Ref_Article_CurrentSelected = $('#Ref_Article').val();
	// http://gl_refonte.cyo.local/process_coupdecoeur.php?action=addcoupdecoeur&prodid=9235&ref=20046B011 (297ms)
	var getExtentionParam="&prodid="+articleId_CurrentSelected+"&ref="+Ref_Article_CurrentSelected +"&Ref_Article="+Ref_Article_CurrentSelected;




	if (error == 0) {



		var stringData= '&prodid='+articleId_CurrentSelected+'&ref='+Ref_Article_CurrentSelected+"&Ref_Article="+Ref_Article_CurrentSelected;
		var stringUrl = url_client+getExtentionParam;
		//alert(stringData);

		$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

				if (ajaxReturnValues['status'] == "OK") {

					//alert("Info:\n "+ajaxReturnValues['msg']);
					document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];
					document.getElementById('textMessageCoupCoeurOK').style.display="block";
					document.getElementById('textMessageCoupCoeurNOK').style.display="none";

					popIn.closed('DivCoupCoeur');//close pop up
					showDivConfirmAjoutCoeur();
				}
				else {

					//$typeErreur="EXISTE";
					if (ajaxReturnValues['typeErreur'] == "EXISTE") // cad le coup de coeur existe deja dans
					{
						document.getElementById('textMessageCoupCoeurOK').style.display="none";
						document.getElementById('textMessageCoupCoeurNOK').style.display="block";
						popIn.closed('DivCoupCoeur');//close pop up
						showDivConfirmAjoutCoeur();

					}else{
						//  alert("Error:\n "+ajaxReturnValues['msg']); //afiche message erreur
						// popIn.closed('DivCoupCoeur');//close pop up
						// popIn.closed('DivEnvoiAmi');
						var ErrorMessage="<strong>"+ajaxReturnValues['msg']+"</strong>";
						showErrorMessage(ErrorMessage,"DivCoupCoeur");


					}


					if(ajaxReturnValues['divTofill']!=''){ // on doit remplir les nouveau lien
						document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];

					}

				}


			},
			error: ""

		});
	}
}

/*
 * GLCOM-621 : Cache du site
 * Modification du type "POST" en "GET"
 */
function setCookieProdConsult(urlServerProcess,productsId){

	var url_client=urlServerProcess;


	var stringData = '';

	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "GET",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){

		},
		error: ""

	});

}
function loggedAjoutcoupdecoeur(urlServerProcess,iteration){

	var ref = $('#ref_'+iteration).val();
	var Ref_Article = $('#Ref_Article_'+iteration).val();
	var url_client=urlServerProcess;
	var url_client = urlServerProcess;
	var stringData= '&ref='+ref+'&Ref_Article='+Ref_Article;
	var stringUrl = url_client;
	$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['typeErreur'] == "EXISTE") // cad le coup de coeur existe deja dans
				{

					document.getElementById('textMessageCoupCoeurOK').style.display = "none";
					document.getElementById('textMessageCoupCoeurNOK').style.display = "block";
					popIn.closed('DivCoupCoeur');//close pop up
					showDivConfirmAjoutCoeur();
				}else{
					window.location = ajaxReturnValues['divTofillValue'];
				}

			},
		error: ""

	});
}
function showCreateCompteCoupCoeur(){
	$(document).ready(function (){

		popIn.closed('DivCoupCoeur'); // fermer le coup de coeur
		popIn.maximizeOverlay();
		var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
		$('#DivCreaCompte').show();
		$('#'+popIn.menuID).css('z-index', -1);
		$('#'+popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if($.browser.msie && $.browser.version < 7){
			$('select').css('visibility', 'hidden');
		}
		$('#DivCreaCompte').find('.closedPopIn').bind('click',function(){
			popIn.closed('DivCreaCompte');
		});
	});
}

function ajoutCoupDeCoeurCreerCompte(urlServerProcess){

	//alert(customersLoginYes);
	// alert(urlServerProcess +'---'+saisiEmail +'---'+saisiPassword);

	var saisiEmail = $('#saisiEmail2').val();
	var saisiPassword = $('#saisiPassword2').val();
	var saisiEmailConfirm = $('#ConfirmEmail').val();
	var saisiPasswordConfirm  = $('#ConfirmPassword').val();

	var stringDataAmi = 'email='+ saisiEmail +'&pwd='+saisiPassword+'&emailConfirm='+ saisiEmailConfirm  +'&pwdConfirm='+saisiPasswordConfirm ;


	var url_client = urlServerProcess;
	var error=0;

	var articleId_CurrentSelected = $('#articleId').val();
	var Ref_Article_CurrentSelected = $('#Ref_Article').val();
	var getExtentionParam="&prodid="+articleId_CurrentSelected+"&ref="+Ref_Article_CurrentSelected;

	if (error == 0) {



		var stringData=stringDataAmi+'&articleId_CurrentSelected='+articleId_CurrentSelected+'&Ref_Article_CurrentSelected='+Ref_Article_CurrentSelected;
		var stringUrl = url_client+getExtentionParam;
		//alert(stringData);

		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

				if (ajaxReturnValues['status'] == "OK"  && ajaxReturnValues['divTofill'] != 'monPanier') {

					// alert("Info:\n "+ajaxReturnValues['msg']);
					document.getElementById('textMessageCoupCoeurOK').style.display="block";
					document.getElementById('textMessageCoupCoeurNOK').style.display="none";

					document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];
					popIn.closed('DivCreaCompte');//close pop up
					showDivConfirmAjoutCoeur();
				}

				else if(ajaxReturnValues['status'] == "OK"  && ajaxReturnValues['divTofill'] == 'monPanier'){
					window.location = ajaxReturnValues['divTofillValue'];
				}
				else {

					if (ajaxReturnValues['typeErreur'] == "EXISTE") // cad le coup de coeur existe deja dans
					{
						document.getElementById('textMessageCoupCoeurOK').style.display = "none";
						document.getElementById('textMessageCoupCoeurNOK').style.display = "block";
						popIn.closed('DivCreaCompte');//close pop up
						showDivConfirmAjoutCoeur();

					}
					else {

						var ErrorMessage="<strong>"+ajaxReturnValues['msg']+"</strong>";
						showErrorMessage(ErrorMessage,"DivCreaCompte");
					}
					if(ajaxReturnValues['divTofill']!=''){ // on doit remplir les nouveau lien
						document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];
						popIn.closed('DivCreaCompte');//close pop up
					}

				}





			},
			error: ""

		});
	}
}

function ajoutAdrlivr(ProcessUrl){

	var civilite = $('#civilite').val();
	var nom = $('#nom').val();
	var prenom = $('#prenom').val();
	var societe = $('#societe').val();
	var escalier = $('#escalier').val();
	var etage = $('#etage').val();
	var adresse = $('#adresse').val();
	var cp = $('#cp').val();
	var ville = $('#ville').val();
	var telF = $('#telF').val();
	var telP = $('#telP').val();
	var telB = $('#telB').val();
	var pays = $('#pays').val();
	var check_qas = $('#check_qas').val();
	var action = 'add';

	var stringData = 'act='+ action +'&nom='+ nom +'&prenom='+prenom +'&societe='+ societe  +'&escalier='+escalier +'&etage='+etage+'&adresse='+ adresse  +'&cp='+cp+'&ville='+ ville  +'&telF='+telF +'&telP='+telP+'&telB='+ telB+'&civilite='+ civilite+'&pays='+ pays+'&check_qas='+check_qas;
	//alert(stringData);
	var url_client = ProcessUrl;
	var error=0;

	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function() {

			},
			success: function(returnedValues) {
						eval(returnedValues);

						if (ajaxReturnValues['status'] == "noError" && ajaxReturnValues['divTofill'] == "monPanier") {
							popIn.closed('DivPanierModif');//close pop up
							window.location = ajaxReturnValues['divTofillValue'];
						}

						else if ((ajaxReturnValues['status'] == "notFoundAddress") ||
								  (ajaxReturnValues['status'] == "chooseAddress") ||
								  (ajaxReturnValues['status'] == "acceptAddress")) {
							//QAS

							//Make the XMLHttpRequest object
							var http = createQCObject();

							displayAjax('qas', http, 'add');
						}

						else {
							var ErrorMessage="&nbsp;<strong>"+ajaxReturnValues['msg']+"</strong>";
							document.getElementById('errormsg').innerHTML=ErrorMessage;
						}
					 },
					 error: ""

			});
		}
}

function loginCoupDeCoeurCompte(urlServerProcess,customersLoginYes){

	//alert(customersLoginYes);
	// alert(urlServerProcess +'---'+saisiEmail +'---'+saisiPassword);
	if (customersLoginYes == '') {
		var saisiEmail = $('#saisiEmail').val();
		var saisiPassword = $('#saisiPassword').val();
		var stringDataAmi = 'email='+ saisiEmail +'&pwd='+saisiPassword;

	}else{
		var stringDataAmi=''; //pas envoi par post sur  cette page
	}
	var url_client = urlServerProcess;
	var error=0;

	if (error == 0) {

		var stringData=stringDataAmi;
		var stringUrl = url_client;

		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

				if (ajaxReturnValues['status'] == "OK" && ajaxReturnValues['divTofill'] == "monPanier") {

					popIn.closed('DivCoupCoeur');//close pop up
					document.getElementById('ajouCC').submit();
					//window.location = ajaxReturnValues['divTofillValue'];

				}else{

					var ErrorMessage="<strong>"+ajaxReturnValues['msg']+"</strong>";


					showErrorMessage(ErrorMessage,"DivCoupCoeur");


				}


				if(ajaxReturnValues['divTofill']!=''){ // on doit remplir les nouveau lien
					document.getElementById(ajaxReturnValues['divTofill']).innerHTML=ajaxReturnValues['divTofillValue'];

				}

			},
			error: ""

		});
	}

}
function showDivConfirmAjoutCoeur(){

	$(document).ready(function (){
		popIn.maximizeOverlay();
		var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
		$('#DivConfirmAjoutCoeur').show();
		$('#'+popIn.menuID).css('z-index', -1);
		$('#'+popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if($.browser.msie && $.browser.version < 7){
			$('select').css('visibility', 'hidden');
		}
		$('#DivConfirmAjoutCoeur').find('.closedPopIn').bind('click',function(){
			popIn.closed('DivConfirmAjoutCoeur');
		});
	});
}

function showDivConfirmEnvoiAmi(){

	$(document).ready(function (){
		popIn.maximizeOverlay();
		var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
		$('#DivConfirmEnvoiAmi').show();
		$('#'+popIn.menuID).css('z-index', -1);
		$('#'+popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if($.browser.msie && $.browser.version < 7){
			$('select').css('visibility', 'hidden');
		}
		$('#DivConfirmEnvoiAmi').find('.closedPopIn').bind('click',function(){
			popIn.closed('DivConfirmEnvoiAmi');
		});
	});
}

function showDivMessageEchoue(){

	$(document).ready(function(){
		popIn.maximizeOverlay();
		var popInDiv = 'Div' + functions.ucfirst($(this).attr('id'));
		$('#DivMessageEchoue').show();
		$('#' + popIn.menuID).css('z-index', -1);
		$('#' + popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if ($.browser.msie && $.browser.version < 7) {
			$('select').css('visibility', 'hidden');
		}
		$('#DivMessageEchoue').find('.closedPopIn').bind('click', function(){
			popIn.closed('DivMessageEchoue');
		});
	});
}

function  showErrorMessage(ErrorMessage,parentDiv){

	$(document).ready(function (){
		document.getElementById('messageErreurTexte').innerHTML=ErrorMessage;


		popIn.maximizeOverlay();
		//var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
		$('#DivVerif').show();
		$('#'+popIn.menuID).css('z-index', -1);
		$('#'+popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if($.browser.msie && $.browser.version < 7){
			$('select').css('visibility', 'hidden');
		}
		$('#DivVerif').find('.closedPopIn').bind('click',function(){
			popIn.closed('DivVerif');
			// alert('herer');
			if(parentDiv=='DivCoupCoeur'){
				popIn.closed('DivEnvoiAmi');
				popIn.closed('DivCreaCompte');
			}else if(parentDiv=='DivEnvoiAmi'){
				popIn.closed('DivCoupCoeur');//close pop up
				popIn.closed('DivCreaCompte');
			}else if(parentDiv=='DivCreaCompte'){
				popIn.closed('DivCoupCoeur');
				popIn.closed('DivEnvoiAmi');
			}

			affichePopByDivName(parentDiv);

		});



	});
}
function affichePopByDivName(divName) {

	//alert(divName);
	popIn.closed(divName);
	popIn.maximizeOverlay();
	$('#'+divName).show();
	$('#'+popIn.menuID).css('z-index', -1);
	$('#'+popIn.footerID).css('z-index', -1);

	// On cache les select sous IE6

	if($.browser.msie && $.browser.version < 7){
		$('select').css('visibility', 'hidden');
	}

	$('#'+divName).find('.closedPopIn').bind('click',function(){
		popIn.closed(divName);
	});


}


function carouselCoupCoeurPanier(idName, amtCC, currCC){

	var defalutCC 	= 1;
	var currCC 		= document.getElementById('ccPagi').value;
	var ccTab 		= new Array();
	var pointer		= 0;
	var j 			= 0;
	var valTab		= 1;
	var lienPagination = '<p class="paginate">';


	for (i = defalutCC; i <= amtCC ; i++){
		document.getElementById(idName+i).style.display="none";
		document.getElementById(idName+'Act'+i).style.display="none";
	}
	/*
	gere les nombre d'article ajouter au coup de coeur
	*/



	if(amtCC > 0){
		var firstCurrCC;
		if(currCC > 1){
			firstCurrCC = parseInt(currCC) - 1;
		}else{
			firstCurrCC = parseInt(currCC);
		}
		lienPagination += '<a href="javascript:void(0);" class="next" onclick="document.getElementById(\'ccPagi\').value='+(firstCurrCC)+';carouselCoupCoeurPanier(\''+idName +'\','+amtCC+','+firstCurrCC+');"> < </a>';


		for (i = valTab ; i <= amtCC ; i++){

			if(currCC == i){
				document.getElementById(idName+i).style.display="block";
				document.getElementById(idName+'Act'+i).style.display="block";
				lienPagination += '<a href="javascript:void(0);" class="current" onclick="document.getElementById(\'ccPagi\').value='+(i)+'; carouselCoupCoeurPanier('+idName+','+amtCC+','+(i)+'); ">'+(i)+'</a>';
			}else{
				document.getElementById(idName+i).style.display="none";
				document.getElementById(idName+'Act'+i).style.display="none";
				lienPagination += '<a href="javascript:void(0);" onclick="document.getElementById(\'ccPagi\').value='+(i)+'; carouselCoupCoeurPanier(\''+idName+'\','+amtCC+','+(i)+');">'+(i)+'</a>';
			}

		}
		//	if(amtCC > 4){
		var newCurrCC = parseInt(currCC) + 1;

		if(newCurrCC > amtCC){
			newCurrCC = parseInt(currCC);
		}

		lienPagination += '<a href="javascript:void(0);" class="next" onclick="document.getElementById(\'ccPagi\').value='+(newCurrCC)+';carouselCoupCoeurPanier(\''+idName+'\','+amtCC+','+newCurrCC+');"> > </a>';
		//}

	}
	lienPagination += '</p>';


	document.getElementById('CCpaginate').innerHTML=lienPagination;



}

function openPopup(conteneur){
	$(document).ready(function (){
		popIn.maximizeOverlay();
		var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
		$('#DivPanierModif').show();
		$('#'+popIn.menuID).css('z-index', -1);
		$('#'+popIn.footerID).css('z-index', -1);
		// On cache les select sous IE6
		if($.browser.msie && $.browser.version < 7){
			$('select').css('visibility', 'hidden');
			$('#DivPanierModif').find('select').css('visibility', 'visible');
		}
		$('#DivPanierModif').find('.closedPopIn').bind('click',function(){
			popIn.closed('DivPanierModif');
		});
	});
}
function openPopupSup(){
	$(document).ready(function (){
	popIn.maximizeOverlay();
	var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
	$('#DivSuppression').show();
	$('#'+popIn.menuID).css('z-index', -1);
	$('#'+popIn.footerID).css('z-index', -1);
	// On cache les select sous IE6
	if($.browser.msie && $.browser.version < 7){
		$('select').css('visibility', 'hidden');
	}
	$('#DivSuppression').find('.closedPopIn').bind('click',function(){
		popIn.closed('DivSuppression');
	});
});

}


function SupAdrlivr(ProcessUrl){
	var numadr = $('#Numadr').val();
	var supprimable = $('#supprimable').val();
	var action = 'supprimeAdr';
	var stringData = 'act='+ action +'&numadr='+ numadr + '&supprimable='+supprimable;
	var url_client = ProcessUrl;
	var error=0;

	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['status'] == "noError" && ajaxReturnValues['divTofill'] == "monPanier") {
						popIn.closed('DivSuppression');//close pop up
						window.location = ajaxReturnValues['divTofillValue'];
					}else{
						var ErrorMessage="&nbsp;<strong>"+ajaxReturnValues['msg']+"</strong>";
						document.getElementById('errormsg').innerHTML=ErrorMessage;
					}

				},
			error: ""

		});
	}
}


function OpenModifPop(processUrl,refadr){
	var numadr = refadr;
	var stringData = 'numAdr='+ numadr;

	var url_client = processUrl;
	var error=0;

	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if(document.getElementById(ajaxReturnValues['gender'])){
					document.getElementById(ajaxReturnValues['gender']).selected = 'selected';
				}
				document.getElementById('nomMod').value = ajaxReturnValues['nom'];
				document.getElementById('prenomMod').value = ajaxReturnValues['prenom'];
				document.getElementById('societeMod').value = ajaxReturnValues['societe'];
				document.getElementById('lieuMod').value = ajaxReturnValues['lieu'];
				document.getElementById('cpMod').value = ajaxReturnValues['codePostal'];
				document.getElementById('villeMod').value = ajaxReturnValues['ville'];
				document.getElementById('telPMod').value = ajaxReturnValues['telP'];
				document.getElementById('telBMod').value = ajaxReturnValues['telA'];
				document.getElementById('telFMod').value = ajaxReturnValues['telF'];
				document.getElementById('escalierMod').value = ajaxReturnValues['comp_ad'];
				document.getElementById('adresseMod').value = ajaxReturnValues['adresse'];
				document.getElementById('etageMod').value = ajaxReturnValues['etage'];
				document.getElementById('paysMod').innerHTML = ajaxReturnValues['ca_add_pays'];
				document.getElementById('numAdrHidden').value = numadr;
				},
			error: ""

		});
	}
	$(document).ready(function (){
	popIn.maximizeOverlay();
	var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
	$('#DivPanierModifadr').show();
	$('#'+popIn.menuID).css('z-index', -1);
	$('#'+popIn.footerID).css('z-index', -1);
	// On cache les select sous IE6
	if($.browser.msie && $.browser.version < 7){
		$('select').css('visibility', 'hidden');
		$('#DivPanierModifadr').find('select').css('visibility', 'visible');
	}
	$('#DivPanierModifadr').find('.closedPopIn').bind('click',function(){
		popIn.closed('DivPanierModifadr');
	});
});

}


function modifAdrlivr(ProcessUrl){

	var civilite = $('#civiliteMod').val();
	var nom = $('#nomMod').val();
	var prenom = $('#prenomMod').val();
	var societe = $('#societeMod').val();
	var escalier = $('#escalierMod').val();
	var etage = $('#etageMod').val();
	var adresse = $('#adresseMod').val();
	var cp = $('#cpMod').val();
	var ville = $('#villeMod').val();
	var telF = $('#telFMod').val();
	var telP = $('#telPMod').val();
	var telB = $('#telBMod').val();
	var pays = $('#paysModif').val();
	var check_qas = $('#check_qasMod').val();
	var numadr = $('#numAdrHidden').val();

	var action = 'modifier';
	var stringData = 'act='+ action +'&nom='+ nom +'&prenom='+prenom +'&societe='+ societe  +'&escalier='+escalier +'&etage='+etage+'&adresse='+ adresse  +'&cp='+cp+'&ville='+ ville  +'&telF='+telF +'&telP='+telP+'&telB='+ telB+'&civilite='+ civilite+'&pays='+ pays + '&numadr=' + numadr + '&check_qas='+check_qas;

	var url_client = ProcessUrl;
	var error=0;
	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

					if (ajaxReturnValues['status'] == "noError" && ajaxReturnValues['divTofill'] == "monPanier") {
						popIn.closed('DivPanierModifadr');//close pop up
						window.location = ajaxReturnValues['divTofillValue'];
					}

					else if ((ajaxReturnValues['status'] == "notFoundAddress") ||
							  (ajaxReturnValues['status'] == "chooseAddress") ||
							  (ajaxReturnValues['status'] == "acceptAddress")) {
						//QAS

						//Make the XMLHttpRequest object
						var http = createQCObject();

						displayAjax('qas', http, 'mod');
					}

					else{
						var ErrorMessage="&nbsp;<strong>"+ajaxReturnValues['msg']+"</strong>";
						document.getElementById('errormsgMod').innerHTML=ErrorMessage;
					}
				},
			error: ""

		});
		}
}


function createQCObject() {
	var req;

	if(window.XMLHttpRequest){
	    // Firefox, Safari, Opera...
	    req = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
	    // Internet Explorer 5+
	    req = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	    alert('Problem creating the XMLHttpRequest object');
	}
	return req;
}

function displayAjax(m, http, type) {
	//var ran_no=(Math.round((Math.random()*9999)));
	http.open('GET', '_pop_'+m+'.php');
   	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) {
      		var response = http.responseText;
      		if(response) {

			    var BgPopup           = document.getElementById('BgPopup').style;
				var DivPanierModif    = document.getElementById('DivPanierModif').style;
				var DivPanierModifadr = document.getElementById('DivPanierModifadr').style;

				js_opacity(BgPopup, 0.8);

				if (type == 'mod') {
					js_opacity(DivPanierModifadr, 0.2);
				}
				else {
					js_opacity(DivPanierModif, 0.2);
				}

				document.getElementById('DivQas').innerHTML = http.responseText;
				document.getElementById('DivQas').style.display = 'block';
				//cacher les combo select
				cacheSelect();

				if (type == 'mod') {
					document.getElementById('check_qasMod').value = "0";
				}
				else {
					document.getElementById('check_qas').value = "0";
				}

			    $('#DivCheck').find('.closedPopIn').bind('click',function(){
			    	document.getElementById('DivQas').style.display = 'none';
					js_opacity(BgPopup, 0.5);

					if (type == 'mod')
						js_opacity(DivPanierModifadr, 1);
					else
						js_opacity(DivPanierModif, 1);
			    });
			    $('#DivCheck').find('.closedPopIn2').bind('change',function(){
			    	document.getElementById('DivQas').style.display = 'none';
					js_opacity(BgPopup, 0.5);
					//montrer les combo select
					montreSelect();
					if (type == 'mod')
						js_opacity(DivPanierModifadr, 1);
					else
						js_opacity(DivPanierModif, 1);
			    });

      		}
   		}
	}
   	http.send(null);
}

function js_opacity(obj, op) {

	opIE = (op*100);

    obj.opacity = op; //W3C
    obj.MozOpacity = op; //Mozilla, vieux firefox)
    obj.KhtmlOpacity = op; //KHTML / Safari
    obj.filter = "alpha(opacity="+opIE+")"; //IE
}


function identification(ProcessUrl){
	var email = $('#email').val();
	var mdp1 = $('#mdp1').val();
	var stringData = 'email='+ email +'&pwd='+ mdp1;
	var url_client = ProcessUrl;
	var error=0;
	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

					if (ajaxReturnValues['status'] == "noError" && ajaxReturnValues['divTofill'] == "monPanier") {
						window.location = ajaxReturnValues['divTofillValue'];
					}
				},
			error: ""

		});
		}

}


function oubliemdb(ProcessUrl){
	var email = $('#mdp2').val();

	var stringData = 'emailRecover='+ email;
	alert(stringData);
	var url_client = ProcessUrl;
	var error=0;
	if (error == 0) {
		var stringUrl = url_client;
		$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

					if (ajaxReturnValues['status'] == "noError" && ajaxReturnValues['divTofill'] == "monPanier") {
						window.location = ajaxReturnValues['divTofillValue'];
					}
				},
			error: ""

		});
		}

}

function openInNewWindow(url) {
 // Change "_blank" to something like "newWindow" to load all links in the same new window
 var newWindow = window.open(url, '_blank');
 newWindow.focus();
 return false;
 }


/**
 * pour faire apparitre les select quand on n'a pas le fonds gris???
 * et faire disparraitre les selects quand le popup s'affiche
 */

	function cacheSelect(){

		theObjects = document.getElementsByTagName("select");
		for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].style.visibility = "hidden";
		}

	}

	function montreSelect(){

		theObjects = document.getElementsByTagName("select");
		for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].style.visibility = "visible";
		}

	}

function showPopUp(val){

		$(document).ready(function (){
			popIn.maximizeOverlay();
			var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
			//$('#DivNewsLetter').show();
			$('#'+popIn.menuID).css('z-index', -1);
			$('#'+popIn.footerID).css('z-index', -1);
			// On cache les select sous IE6
			if($.browser.msie && $.browser.version < 7){
				$('select').css('visibility', 'hidden');
			}
			$('#DivNewsLetter').find('.closedPopIn').bind('click',function(){
				popIn.closed('DivNewsLetter');
				if(val != ''){
					window.location = "\index.php?nws=" + val;
				}
			});
		});
	}




function checkEmail(e) {

    var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]??{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
    var reg = new RegExp('^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$', 'i');
    var textErr = document.getElementById('errornews').value;
    if (reg.test(e)) {

		var email_input = $('#recevoirOffres').val();
		var from = $('#from').val();

		var stringData = 'email_input='+ email_input +'&from='+ from;

		url_client = 'newsletter.php?action=subscribe'
		var stringUrl = url_client;
		$.ajax({
			type: "GET",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);

				window.location = "\index.php?nws=" + email_input;
				},
			error: ""

		});
   } else {

       alert(textErr);
        return false;
    }

}


function verifMail_noResult(mail){
	 // DEBUT MODIF NVELATI GLCOM-1104
	 var reg = new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	 //var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");
	// FIN MODIF NVELATI GLCOM-1104	 
	var textErr = document.getElementById('errornews').value;
	 if (reg.test(mail)) {

		var email_input = mail

		var from = $('#from').val();

		var stringData = 'email_input='+ email_input +'&from='+ from;
		url_client = '/newsletter.php?action=subscribe'

		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){
			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['status'] == "noError") {
						showPopUp('');
						$('#DivPopUpNewsLetter').show();


						document.getElementById('imageNewsletter').src = "/_img/common/fonds/confirm_newsletter.jpg";
	        			document.getElementById('textNewsLetter').innerHTML = "";
	        			document.getElementById('textPopNews').style.paddingTop = "20px";
						document.getElementById('ressayer').style.display = "none";
						document.getElementById('contenuNewsLetterPop').style.fontSize = "12px";

						document.getElementById('textNewsLetter').innerHTML = ajaxReturnValues['msg1'];
						document.getElementById('contenuNewsLetterPop').style.paddingLeft = "10px";
						document.getElementById('contenuNewsLetterPop').innerHTML = '<span style="padding-bottom:5px;font-size:14px;">' + ajaxReturnValues['msg'] + '</span> <span class="textPopNewsColor">' + ajaxReturnValues['msg2']  + '</span>';
						document.getElementById('footerSuccessNews').style.display = 'none';

						// On cache les select sous IE6
						if($.browser.msie && $.browser.version < 7){
							$('select').css('visibility', 'hidden');
						}

				}else{
					document.getElementById('textMessageCoupCoeurOK1').innerHTML = ajaxReturnValues['msg'];
					showPopUp('');
						$('#DivNewsLetter').show();

				}
				email_input = "";
				email_input_ft ="";
				},
				error: ""


		});
		$(document).ready(function (){
			$('#DivPopUpNewsLetter').find('.Fermer').bind('click',function(){
					popIn.closed('DivPopUpNewsLetter');

				});
		});
   } else {
	   alert(textErr);
        return false;
    }
}


function verifMail(mail){
	 // DEBUT MODIF NVELATI GLCOM-1104
	 var reg = new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	 //var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");
	// FIN MODIF NVELATI GLCOM-1104	 
	var textErr = document.getElementById('errornews').value;
	 if (reg.test(mail)) {

		var email_input = $('#recevoirOffres').val();
		var email_input_ft = $('#email_input').val();

		if(email_input != "Entrez votre adresse e-mail"){
			strEmail =  email_input;
		}else if(email_input_ft != "e-mail"){
			strEmail =  email_input_ft;
		}
		var from = $('#from').val();

		var stringData = 'email_input='+ strEmail +'&from='+ from;
		url_client = 'http://www.galerieslafayette.com/newsletter.php?action=subscribe'

		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['status'] == "noError") {

						showPopUp('');
						$('#DivPopUpNewsLetter').show();


						document.getElementById('imageNewsletter').src = "/_img/common/fonds/confirm_newsletter.jpg";
	        			document.getElementById('textNewsLetter').innerHTML = "";
	        			document.getElementById('textPopNews').style.paddingTop = "12px";
						document.getElementById('ressayer').style.display = "none";
						document.getElementById('contenuNewsLetterPop').style.fontSize = "1.2em";
//						document.getElementById('contenuNewsLetterPop').style.fontWeight = "bold";

						document.getElementById('textNewsLetter').innerHTML = ajaxReturnValues['msg1'];
						document.getElementById('contenuNewsLetterPop').style.paddingLeft = "10px";
						document.getElementById('contenuNewsLetterPop').innerHTML = '<p style="padding-bottom:5px;font-size:14px;">' + ajaxReturnValues['msg'] + '</p> <span class="textPopNewsColor" style="font-size:14px;">' + ajaxReturnValues['msg2']  + '</span>';
						document.getElementById('footerSuccessNews').style.display = 'none';

						// On cache les select sous IE6
						if($.browser.msie && $.browser.version < 7){
							$('select').css('visibility', 'hidden');
						}

				}else{

					document.getElementById('textMessageCoupCoeurOK1').innerHTML = ajaxReturnValues['msg'];
						showPopUp('');
						$('#DivNewsLetter').show();

				}
				email_input = "";
				email_input_ft ="";
				},
				error: ""


		});
		$(document).ready(function (){
			$('#DivPopUpNewsLetter').find('.Fermer').bind('click',function(){
					popIn.closed('DivPopUpNewsLetter');

				});
		});
   } else {
        alert(textErr);
        return false;
    }
}

//ARAGGI JIRA GLCOM-1 03/12/10 => correction des bugs
function verifMailFrise(mail){
	var scrolling=document.documentElement.scrollTop;
	var home = $('#home').val();
	$(document).ready(function (){
		$('#DivNewsLetterFrise').find('.Fermer').bind('click',function(){

				popIn.closed('DivNewsLetterFrise');
				$('#email_input').val('Entrez votre adresse e-mail');
				$('#recevoirOffres').val('Entrez votre adresse e-mail');
			});
		$('#formNewsletter').find('.Fermer').bind('click',function(){

			popIn.closed('formNewsletter');
			$('#email_input').val('Entrez votre adresse e-mail');
			$('#recevoirOffres').val('Entrez votre adresse e-mail');
		});
		$('#DivPopUpNewsLetter').find('.Fermer').bind('click',function(){

			popIn.closed('DivPopUpNewsLetter');
			$('#email_input').val('Entrez votre adresse e-mail');
			$('#recevoirOffres').val('Entrez votre adresse e-mail');
		});


    });

	   var reg = new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	 //var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");

	 var textErr = document.getElementById('errornews').value;
	 if (reg.test(mail)) {

		var email_input = $('#recevoirOffres').val();
		var email_input_ft = $('#email_input').val();

		if(email_input != "Entrez votre adresse e-mail"){
			strEmail =  email_input;
		}else if(email_input_ft != "e-mail"){
			strEmail =  email_input_ft;
		}
		var from = $('#from').val();

		var stringData = 'email_input='+ strEmail +'&from='+ from;
		url_client = home+'/newsletter.php?action=subscribe'

		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['status'] == "noError") {

					_gaq.push(['_trackPageview','/layer/inscription_newsletter/confirmation_from_footer/']);
					document.getElementById('imageNewsletter').src = "/_img/common/fonds/confirm_newsletter.jpg";
        			document.getElementById('textNewsLetter').innerHTML = "";
        			document.getElementById('textPopNews').style.paddingTop = "20px";
					document.getElementById('ressayer').style.display = "none";
					document.getElementById('contenuNewsLetterPop').style.fontSize = "12px";
//					document.getElementById('contenuNewsLetterPop').style.fontWeight = "bold";
					document.getElementById('DivNewsLetterFrise').style.display = "none";
					document.getElementById('textNewsLetter').innerHTML = ajaxReturnValues['msg1'];
					document.getElementById('contenuNewsLetterPop').style.paddingLeft = "10px";
					document.getElementById('contenuNewsLetterPop').innerHTML = '<p style="padding-bottom:5px;font-size:14px;">' + ajaxReturnValues['msg'] + '</p> <span class="textPopNewsColor" style="font-size:14px;">' + ajaxReturnValues['msg2']  + '</span>';
					document.getElementById('footerSuccessNews').style.display = 'none';
					showPopUp('');
					$('#DivPopUpNewsLetter').show();


				}else{
					document.getElementById('textMessageCoupCoeurNOK1').innerHTML = ajaxReturnValues['msg'];
					document.getElementById('textMessageCoupCoeurNOK1').style.display = "block";
					document.getElementById('textMessageCoupCoeurOK1').style.display = "none";
					 $('#DivNewsLetterFrise').css('top',$('#DivNewsLetterFrise').offset().top + 200);
					showPopUp('');
					$('#DivNewsLetterFrise').show();


				}
				email_input = "";
				email_input_ft ="";
				},
			error: ""

		});
   } else {
        //alert(textErr);
        $('#DivNewsLetterFrise').css('top',$('#DivNewsLetterFrise').offset().top + 200);
        showPopUp('');
		$('#DivNewsLetterFrise').show();
        document.getElementById('DivNewsLetterFrise').style.display = "block";
		document.getElementById('textMessageCoupCoeurOK1').style.display = "none";
		document.getElementById('textMessageCoupCoeurNOK1').style.display = "none";
		//document.getElementById('textMessageCoupCoeurerr').style.display = "block";
		document.getElementById('textMessageCoupCoeurNOK1').style.display = "block";

		//	document.getElementById('textMessageCoupCoeurNOK1').innerHTML = ajaxReturnValues['msg'];

		document.getElementById('textMessageCoupCoeurNOK1').innerHTML = textErr;
		_gaq.push(['_trackPageview', '/layer/inscription_newsletter/erreur/']);
		


        return false;
    }



}



function verifMailPop(mail){

	 // DEBUT MODIF NVELATI GLCOM-1104
	 var reg = new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	 //var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");
	// FIN MODIF NVELATI GLCOM-1104

	 var textErr = document.getElementById('errornews').value;
	 if (reg.test(mail)) {

		var email_input = $('#recevoirOffresPop').val();
		var email_input_ft = $('#email_inputPop').val();

		if(email_input != "Entrez votre adresse e-mail"){
			strEmail =  email_input;
		}else if(email_input_ft != "e-mail"){
			strEmail =  email_input_ft;
		}
		var from = $('#fromPop').val();

		var stringData = 'email_input='+ strEmail +'&from='+ from;
		url_client = '/newsletter.php?action=subscribe'

		var stringUrl = url_client;
		$.ajax({
			type: "POST",
			url: stringUrl,
			data: stringData,
			beforeSend: function(){

			},
			success: function(returnedValues){
				eval(returnedValues);
				if (ajaxReturnValues['status'] == "noError") {


					document.getElementById('imageNewsletter').src = "/_img/common/fonds/confirm_newsletter.jpg";
        			document.getElementById('textNewsLetter').innerHTML = "";
        			document.getElementById('textPopNews').style.paddingTop = "20px";
					document.getElementById('ressayer').style.display = "none";
					document.getElementById('contenuNewsLetterPop').style.fontSize = "12px";
//					document.getElementById('contenuNewsLetterPop').style.fontWeight = "bold";

					document.getElementById('textNewsLetter').innerHTML = ajaxReturnValues['msg1'];
					document.getElementById('contenuNewsLetterPop').style.paddingLeft = "10px";
					document.getElementById('contenuNewsLetterPop').innerHTML = '<p style="padding-bottom:5px;font-size:14px;">' + ajaxReturnValues['msg'] + '</p> <span class="textPopNewsColor" style="font-size:14px;">' + ajaxReturnValues['msg2']  + '</span>';
					document.getElementById('footerSuccessNews').style.display = 'none';
					_gaq.push(['_trackPageview','/layer/inscription_newsletter/confirmation_from_layer/']);

				}else{

					$(document).ready(function (){
						$('.textPopNewsColor').css('color', '');
					});

					document.getElementById('textError').style.display = "block";
					document.getElementById('textError').innerHTML = ajaxReturnValues['msg'];
				}
				email_input = "";
				email_input_ft ="";
				},
			error: ""

		});
   } else {
        showPopUp('');
 		document.getElementById('textError').style.display = "block";
 		_gaq.push(['_trackPageview', '/layer/inscription_newsletter/erreur/']);
		document.getElementById('textError').innerHTML = textErr;
        return false;
    }
}




/**fonction pour gere le popup d jeux sur la home page**/
function popupExtra(urlServerProcess){

	var url_client=urlServerProcess;

	var stringData;
	stringData='';
	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "GET",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){
			$(document).ready(function (){

				var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
				$('#DivPopUpJeux').show();
				$('#MediaJeux').html(returnedValues);
				var t=setTimeout(closepopupExtra,7000);
				// On cache les select sous IE6
				if($.browser.msie && $.browser.version < 7){
					$('select').css('visibility', 'hidden');
				}

			});

		},
		error: ""

	});
}

/**fin fonction pour gere le popup d jeux sur la home page**/
function closepopupExtra(){
	javascript:document.getElementById('DivPopUpJeux').style.display='none';
}
/***debut fonction qui ferme la popup jeux sur la homepage apres 5 secondes */

/***fin fonction qui ferme la popup jeux sur la homepage apres 5 secondes */

/*** fonvtion pour verifier l'inscription a la newsletter ***/


function verifNewsleter(urlServerProcess){

	var url_client=urlServerProcess;

	var stringData;
	stringData='';
	var stringUrl = url_client;
	//alert(stringUrl);
	//alert(stringData);


	$.ajax({
		type: "GET",
		url: stringUrl,
		data: stringData,
		beforeSend: function() {

		},
		success: function(returnedValues){
			$(document).ready(function (){
			var popInDiv = 'Div'+functions.ucfirst($(this).attr('id'));
				if(returnedValues == ""){
					
					_gaq.push(['_trackPageview', '/layer/inscription_newsletter/']);

					showPopUp('');
					$('#DivPopUpNewsLetter').show();

					// On cache les select sous IE6
					if($.browser.msie && $.browser.version < 7){
						$('select').css('visibility', 'hidden');
					}
				}


			});

		},
		error: ""

	});


	$(document).ready(function (){
		$('#DivPopUpNewsLetter').find('.Fermer').bind('click',function(){
				popIn.closed('DivPopUpNewsLetter');

			});

		$('#recevoirOffresPop').bind('keypress', function(e) {
			 var email  = $('#recevoirOffresPop').val();
	     if(e.keyCode==13){
	           	/*$('#sendNewsletter').trigger('click'); */
	        	verifMailPop(email);
	        return ( false );
	        }
		});

	});

}

