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

	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;
}
function AddCartAjaxcall(urlServerProcess){

	//alert(urlServerProcess);


	var prod = document.getElementById('prod').value;
	var quantity = document.getElementById('quantity').value;
	var colorSize=document.getElementById('Ref_Article').value;
	var prod_price=document.getElementById('prod_price').value;
	var url_client=urlServerProcess;

	document.getElementById('popUp'+colorSize).style.display="block";
	//alert(colorSize);

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

			eval(returnedValues);
			if(ajaxReturnValues['status']=="OK"){
				// alert('ok');
				var sousTotal=document.getElementById('popInfoId'+colorSize).innerHTML;//=ajaxReturnValues['cartInfo']['infoTotalPanier'];
				var nb=ajaxReturnValues['cartInfo']['nbArticles'];
				document.getElementById('popInfoId'+colorSize).innerHTML=ajaxReturnValues['cartInfo']['infoTotalPanier'];
				$('p#nbArticles a').text('('+nb+')');
				// alert(sousTotal);

			}else{

				if( ajaxReturnValues['error']=="NON_DISPONIBLE" ){
                    document.getElementById('lienValiderCommande'+colorSize).style.display="none";
                }
                document.getElementById('contenuAjoutStatus'+colorSize).innerHTML="<h3>"+ajaxReturnValues['error_text']+"</h3><br /><br /><br /><br />";
			}
			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');
	});

}


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: "POST",
		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: ""

	});

}

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: "POST",
		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 ami1=$('#ami1').val();
		var email_ami1=$('#email_ami1').val();
		var ami2=$('#ami2').val();
		var email_ami2=$('#email_ami2').val();
		var ami3=$('#ami3').val();
		var email_ami3=$('#email_ami3').val();

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

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

		var MessageEnvoye=document.getElementById('MessageEnvoye').checked;
		var InscriptionNews=document.getElementById('InscriptionNews').checked;
		if(MessageEnvoye==true){
			MessageEnvoye=1;
		}else{
			MessageEnvoye=0;
		}

		if(InscriptionNews==true){
			InscriptionNews=1;
		}else{
			InscriptionNews=0;
		}

		var stringDataAmi = 'ami1='+ ami1 +'&email_ami1='+email_ami1+'&ami2='+ami2+'&email_ami2='+email_ami2+'&ami3='+ami3+'&email_ami3='+email_ami3;
		var stringDataInfoPerso = '&nom='+ VotreNom +'&message='+VotreMessage+'&prenom='+VotrePrenom+'&email='+VotreMail+'&captcha='+captcha_text+'&copie='+MessageEnvoye+'&newsletter='+InscriptionNews;

		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 (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: ""

		});
	}
}


function setCookieProdConsult(urlServerProcess,productsId){

	var url_client=urlServerProcess;


	var stringData = '';

	var stringUrl = url_client ;
	//alert(stringUrl);
	//alert(stringData);
	$.ajax({
		type: "POST",
		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(mail){
	
	 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 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://gl-recette-refonte.cyo.fr/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('DivNewsLetter').style.display = "block";
						document.getElementById('textMessageCoupCoeurOK1').style.display = "block";
						document.getElementById('textMessageCoupCoeurNOK1').style.display = "none";
						showPopUp(strEmail);
							
				}else{
						document.getElementById('DivNewsLetter').style.display = "block";
						document.getElementById('textMessageCoupCoeurOK1').style.display = "none";
						document.getElementById('textMessageCoupCoeurNOK1').style.display = "block";
						showPopUp('');
				}
				email_input = "";
				email_input_ft ="";
				},
			error: ""

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

function verifMailFrise(mail){
 $(document).ready(function (){
		$('#DivNewsLetterFrise').find('.Fermer').bind('click',function(){
			
				popIn.closed('DivNewsLetterFrise');
				$('#email_input').val('Entrez votre adresse e-mail');
				$('#recevoirOffres').val('Entrez vorte adresse e-mail');
			});
    });		
	 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 = '/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('DivNewsLetterFrise').style.display = "block";
						document.getElementById('textMessageCoupCoeurOK1').style.display = "block";
						document.getElementById('textMessageCoupCoeurNOK1').style.display = "none";
						showPopUp(strEmail);

				}else{
						document.getElementById('DivNewsLetterFrise').style.display = "block";
						document.getElementById('textMessageCoupCoeurOK1').style.display = "none";
						document.getElementById('textMessageCoupCoeurNOK1').style.display = "block";
						showPopUp('');
				}
				email_input = "";
				email_input_ft ="";
				},
			error: ""

		});
   } else {
        //alert(textErr);
        showPopUp('');
        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('textMessageCoupCoeurerr').innerHTML = textErr;
        return false;
    }
}



function verifMailPop(mail){

	 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 = $('#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('DivNewsLetterFrise').style.display = "block";
						document.getElementById('textMessageCoupCoeurOK1').style.display = "block";
						document.getElementById('textMessageCoupCoeurNOK1').style.display = "none";
						showPopUp(strEmail);*/
					
					document.getElementById('imageNewsletter').src = "/_img/common/fonds/confir.jpg";
        			document.getElementById('textNewsLetter').innerHTML = "";
        			document.getElementById('textPopNews').innerHTML = "";
					document.getElementById('ressayer').style.display = "none";
					document.getElementById('contenuNewsLetterPop').style.fontSize = "14px";
					document.getElementById('contenuNewsLetterPop').style.fontWeight = "bold";
					document.getElementById('textNewsLetter').innerHTML = ajaxReturnValues['msg1'];
					document.getElementById('contenuNewsLetterPop').style.paddingLeft = "0px";
					document.getElementById('contenuNewsLetterPop').innerHTML = '<p style="padding-bottom:5px;">' + ajaxReturnValues['msg'] + '</p> <span class="textPopNewsColor" style="font-size:1em;">' + ajaxReturnValues['msg2']  + '</span>'; 
					document.getElementById('footerSuccessNews').style.display = 'none';
		

				}else{
					/*document.getElementById('contenuNewsLetterPop').innerHTML = "";
					document.getElementById('textPopNews').innerHTML = "";
        				document.getElementById('textNewsLetter').innerHTML = "";
					document.getElementById('contenuNewsLetterPop').style.fontSize ="14px";
					document.getElementById('ressayer').style.display = "block";
					document.getElementById('contenuNewsLetterPop').innerHTML = ajaxReturnValues['msg'];*/	


					/*document.getElementById('contenuNewsLetterPop').innerHTML = "";
					document.getElementById('textPopNews').innerHTML = "";
        				document.getElementById('textNewsLetter').innerHTML = "";
					/*document.getElementById('contenuNewsLetterPop').style.fontSize ="14px";*/
					document.getElementById('textError').style.display = "block";
					document.getElementById('textError').innerHTML = ajaxReturnValues['msg'];					
				}				

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

		});
   } else {
        showPopUp('');
        	/*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('DivNewsLetterFrise').style.border= "1px solid black";*/

        	/*document.getElementById('contenuNewsLetterPop').innerHTML = "";
        	document.getElementById('textPopNews').innerHTML = "";
        	document.getElementById('textNewsLetter').innerHTML = "";
		document.getElementById('contenuNewsLetterPop').style.fontSize ="14px";
		document.getElementById('ressayer').style.display = "block";
		document.getElementById('contenuNewsLetterPop').innerHTML = textErr;*/

		 /*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('DivNewsLetterFrise').style.border= "1px solid black";*/
        /*document.getElementById('contenuNewsLetterPop').innerHTML = "";
        document.getElementById('textPopNews').innerHTML = "";
        document.getElementById('textNewsLetter').innerHTML = "";
		document.getElementById('contenuNewsLetterPop').style.fontSize ="14px";
		document.getElementById('ressayer').style.display = "block";
		document.getElementById('contenuNewsLetterPop').innerHTML = textErr;*/
		document.getElementById('textError').style.display = "block";
		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 == ""){
					popIn.maximizeOverlay();
					$('#DivPopUpNewsLetter').show();
					// On cache les select sous IE6
					if($.browser.msie && $.browser.version < 7){
						$('select').css('visibility', 'hidden');
					}
				}
				
			
			});

		},
		error: ""

	});
	                $(document).ready(function (){
                               
                                                
                                $('#recevoirOffresPop').bind('keypress', function(e) {
                                                 var email  = $('#recevoirOffresPop').val();         
                                                                 if(e.keyCode==13){
                                                                                verifMailPop(email);
                                                                                 return ( false );       
                                                                        }
                                });
                                
                });

} 
