/*
*************************************************************************************
Fonctions de navigation
*************************************************************************************
*/
function mailing_act(){
	oForm = document.forms['mailing']
	window.open("./wait.php", "popup");
	oForm.target = "popup";
	oForm.submit();
}

function mailing_addDel(th){
	member_mail = document.forms['mailing'].members_mail.value;
	switch(th.value){
		case '1':
			formAction = "http://mailing.duostyle.fr/subscribe/members/add";
		break;
		case '0':
			formAction  = "http://mailing.duostyle.fr/subscribe/members/"+member_mail+"/del";
		break;
	}
	document.forms['mailing'].action = formAction
}

function fct_search(pageR){
	document.forms['F_marques'].pageR.value = pageR
	document.forms['F_marques'].submit();
}

function opn_window(page,nom,proprietes){	
	window.open(page,nom,proprietes)
}

function att_type(typeS){
	document.rechercher.typeS.value = typeS
}

function Go_navi(page,MID,pageR){		
	document.sommair.page.value=page
	document.sommair.MID.value=MID;
	document.sommair.pageR.value=pageR;
	document.sommair.TID.value=1;
	document.sommair.submit();	
}

function goPanier(panier_action,Nvid,lng,F_art){
	switch(lng){
		case '1':
			txt_areUsure 		= "Etes vous sur ? ";
			txt_viderP 			= "Etes vous sur de vouloir vider votre panier ?";
		break;
		case '2':
			txt_areUsure 		= "Are your sure ?";
			txt_viderP	 		= "Are your sure to want to erase your basket ?";			
		break;
		case '3':
			txt_areUsure 	 	= "Are your sure ?";
			txt_viderP 		 	= "Are your sure to want to erase your basket ?";
		break;
	}
	switch(panier_action){
		case "view":
			location.href="index.php?page=panier&panier_action="+panier_action+"&langue_id="+lng;		
		break;
		case "add":		
			QTE = document.forms[F_art].FLD_Qte.options[document.forms[F_art].FLD_Qte.selectedIndex].value;		
			lst_ids = document.forms[F_art].lst_ids.value;
			MID = Nvid
			dec_lstids = lst_ids.split(',');
			for(i=1;i<dec_lstids.length;i++){
				//alert("document.F_art.feat_"+dec_lstids[i]+".selectedIndex")
				N_idx = eval("document."+F_art+".feat_"+dec_lstids[i]+".selectedIndex")
				N_idxVal = eval("document."+F_art+".feat_"+dec_lstids[i]+".options[document."+F_art+".feat_"+dec_lstids[i]+".selectedIndex].value")
				MID += ","+N_idxVal				
			}
			window.open('page/panier.php?&page=panier&panier_action=add&MID='+MID+'&QTE='+QTE+"&VID="+lst_ids+'&langue_id='+lng,'caddy','width=300 height=150 status=yes')
		break;	
		case "vider":
			if(confirm(txt_viderP)){				
				location.href="index.php?page=panier&panier_action="+panier_action+"&langue_id="+lng;						
				return false
			}			
		break;
		case "remove_P":
			if(confirm(txt_areUsure)){	
				location.href="index.php?page=panier&panier_action="+panier_action+"&MIDS="+Nvid+"&langue_id="+lng;		
				return false
			}				
		break;
		default:// inscription,mdp,unlogin,login
			location.href="index.php?page=panier&panier_action="+panier_action+"&langue_id="+lng;		
		break;				
	}	
}

function consult_panier(lng){
	//opener.fctCallWaitMessage()
	window.opener.location.href="../panier-view-"+lng+"-panier.html";
	window.close();
	//window.opener.location.href="../index.php?page=panier&panier_action=view";
}

function att_featVal(formulaire,element){	
	oForm = document.forms[formulaire]
	idx = oForm.elements[element].selectedIndex
	lstVal_field = oForm.val_ids.value
	if(idx > 0){
		featId = oForm.elements[element].options[idx].value3		
		featPrix = oForm.elements[element].options[idx].value2	
		oForm.val_ids.value += ","+featId
		
		alert(lstVal_field.indexOf(featId,0));
		if(lstVal_field.indexOf(featId,0) == -1){			
			oForm.val_ids.value += ","+featId
			if(featPrix){			
				strInt = document.getElementById("TD_tarif").innerHTML	
				//document.getElementById("TD_tarif").innerHTML += "<br>"+"+"+featPrix+" € TTC";
			}				
		}				
	}else{
		//location.href = location.href
	}	
}

/* *********************************************************************************
update du panier
********************************************************************************* */
function upt_Qte(MID,FQTE,toto,lng){
	location.href="index.php?page=panier&panier_action=upt_panier&MID="+MID+"&F_Qte="+FQTE+"&langue_id="+lng		
}
function upt_Dst(pays_id,lng){
	location.href="index.php?page=panier&panier_action=view&pays_id="+pays_id+"&langue_id="+lng
}
function upt_Liv(livraison_id,lng){
	location.href="index.php?page=panier&panier_action=view&livraison_id="+livraison_id+"&langue_id="+lng
}

function dsp_val(element,valeur,tform){
	tform = (tform)?tform:0
	document.forms[tform].elements[element].value = valeur
}

/*
*************************************************************************************
Fonctions de navigation
*************************************************************************************
*/

//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////

/*
*************************************************************************************
Fonctions d'inscription
*************************************************************************************
*/
function act_livraison(action){
	liv_zone = zone_livraison.getElementsByTagName('input');	
	switch(action){
		case '1':
			document.getElementById('zone_livraison').style.visibility="hidden";			
			$('.livraison_field').each(function(){
				$(this).attr("disabled", true);
			});
			/*
			for(i=0;i<liv_zone.length-1;i++){	
				document.forms[2].elements[liv_zone[i].name].disabled=true;
			}			
			*/
		break;
		case '0':
			document.getElementById('zone_livraison').style.visibility="visible";			
			$('.livraison_field').each(function(){
				$(this).attr("disabled", false);
			});
			/*
			for(i=0;i<liv_zone.length-1;i++){	
				document.forms[2].elements[liv_zone[i].name].disabled=false;			
			}		
			*/		
		break;
	}		
}

function verif_PanierForm(formulaire,lng){
	oForm = document.forms[formulaire];
	switch(lng){
		case '1':			
			txt_alert_email					= "Veuillez saisir E-mail";
			txt_alert_email_inc 			= "E-mail invalide\nvérifiez la syntaxe";			
			txt_alert_mdp					= "Veuillez saisir un mot de passe";
			txt_alert_mdp_confirm			= "Veuillez confirmer votre mot de passe";
			txt_alert_nom 					= "Veuillez saisir votre nom";
			txt_alert_prenom 				= "Veuillez saisir votre prénom";
			txt_alert_adresse 				= "Veuillez saisir votre adresse";
			txt_alert_code_postal 			= "Veuillez saisir votre code postal";
			txt_alert_code_ville			= "Veuillez saisir votre ville";
			txt_alert_code_tel 				= "Veuillez saisir votre n° de téléphone";
			txt_alert_mobile				= "Veuillez saisir votre n° de mobile";
			txt_cond_ventes					= "Vous devez accepter les conditions générales de ventes";
			
			txt_alert_nom_liv 				= "Veuillez saisir votre nom";
			txt_alert_prenom_liv 			= "Veuillez saisir votre prénom";
			txt_alert_adresse_liv 			= "Veuillez saisir votre adresse";
			txt_alert_code_postal_liv 		= "Veuillez saisir votre code postal";
			txt_alert_code_ville_liv 		= "Veuillez saisir votre ville";
			txt_alert_code_tel_liv 			= "Veuillez saisir votre n° de téléphone";
			
			txt_alert_typeS					= "Veuillez sélection un critère de recherche";
			txt_alert_mot					= "Veuillez saisir un mot clé";
			txt_alert_cat					= "Veuillez sélectionner une catégorie";
			txt_alert_alpha					= "Veuillez sélectionner une lettre";
			txt_alert_incCat				= "Sélection incorrecte";
			// demande de devis
			txt_alert_demande				= "Veuillez saisir votre demande";	
		break;
		case '2':
			txt_alert_email					= "Please type your E-mail";
			txt_alert_email_inc 			= "Incorrect E-mail ";			
			txt_alert_mdp					= "Please type a password";
			txt_alert_mdp_confirm			= "please confirm your password";
			txt_alert_nom 					= "Please type your last name";
			txt_alert_prenom 				= "Please type your first name";
			txt_alert_adresse 				= "Please type your adress";
			txt_alert_code_postal 			= "Please type your zip code";
			txt_alert_code_ville			= "Please type your city";
			txt_alert_code_tel 				= "Please type your phine number";
			txt_cond_ventes					= "You must be agree with the generals conditions terms";
			
			txt_alert_nom_liv 				= "Please type your last name";
			txt_alert_prenom_liv 			= "Please type your first name";
			txt_alert_adresse_liv 			= "Please type your adress";
			txt_alert_code_postal_liv 		= "Please type your zip code";
			txt_alert_code_ville_liv 		= "Please type your city";
			txt_alert_code_tel_liv 			= "Please type your phine number";
			
			txt_alert_typeS					= "please sélect a search option";
			txt_alert_mot					= "please type a key word";
			txt_alert_cat					= "please select a category";
			txt_alert_alpha					= "please select a letter";
			txt_alert_incCat				= "Incorrect selection";
			// demande de devis
			txt_alert_demande				= "please type your request";	
		break;
	}
	
	
	
	switch(formulaire){		
		case 'recherche':
			if(!oForm.mot.value){
				alert(txt_alert_mot);
				oForm.mot.focus();
				return false
			}
			
			if(oForm.mot.value == 'Mots clés'){
				alert(txt_alert_mot);
				oForm.mot.focus();
				oForm.mot.value='';				
				return false
			}
		break;
		case 'mdp':
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}			
					
			oForm.panier_action.value="mdp";
			oForm.submit();
		break;
		case 'login':
			/*
			if(!oForm.nom.value){
				alert(txt_alert_email)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.prenom.value){
				alert(txt_alert_email)
				oForm.prenom.focus();
				return false
			}
			*/
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}			
			
			if(!oForm.mdp.value){
				alert(txt_alert_mdp)
				oForm.mdp.focus();
				return false
			}
			/*
			oForm.panier_action.value="login";
			*/
			oForm.submit();
		break;
		case 'mailing':
			if(!oForm.nom.value){
				alert(txt_alert_nom_liv)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.prenom.value){
				alert(txt_alert_prenom_liv)
				oForm.prenom.focus();
				return false
			}
			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}			
			
		break;
		case 'contact':
			if(!oForm.nom.value){
				alert(txt_alert_nom_liv)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.prenom.value){
				alert(txt_alert_prenom_liv)
				oForm.prenom.focus();
				return false
			}
			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}		
			
			if(!oForm.tel.value){
				alert(txt_alert_code_tel)
				oForm.tel.focus();
				return false
			}
			
			if(!oForm.mobile.value){
				alert(txt_alert_mobile)
				oForm.mobile.focus();
				return false
			}
			
			if(!oForm.demande.value){
				alert(txt_alert_demande)
				oForm.demande.focus();
				return false
			}
		break;
		default:
		case 'upt_inscription':
		case 'inscription':			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}			
			
			if(!oForm.mdp.value){
				alert(txt_alert_mdp)
				oForm.mdp.focus();
				return false
			}
			
			if(!oForm.mdp_confirm.value){
				alert(txt_alert_mdp_confirm)
				oForm.mdp_confirm.focus();
				return false
			}
			
			if(oForm.mdp.value!=oForm.mdp_confirm.value){
				alert(txt_alert_mdp_confirm)
				oForm.mdp_confirm.focus();
				return false
			}
			
			if(!oForm.nom.value){
				alert(txt_alert_nom)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.prenom.value){
				alert(txt_alert_prenom)
				oForm.prenom.focus();
				return false
			}
			
			if(!oForm.adresse.value){
				alert(txt_alert_adresse)
				oForm.adresse.focus();
				return false
			}
			
			if(!oForm.code_postal.value){
				alert(txt_alert_code_postal)
				oForm.code_postal.focus();
				return false
			}
						
			if(!oForm.ville.value){
				alert(txt_alert_code_ville)
				oForm.ville.focus();
				return false
			}			
			
			if(!oForm.tel.value){
				alert(txt_alert_code_tel)
				oForm.tel.focus();
				return false
			}
			
			if(formulaire=='upt_inscription'){
				if(!oForm.acc_cond.checked==true){
					alert(txt_cond_ventes)
					oForm.acc_cond.focus();
					return false
				}			
			}
			if(oForm.same_adr[1].checked==1){				
				if(!oForm.nom_liv.value){
					alert(txt_alert_nom_liv)
					oForm.nom_liv.focus();
					return false
				}
				
				if(!oForm.prenom_liv.value){
					alert(txt_alert_prenom_liv)
					oForm.prenom_liv.focus();
					return false
				}
				
				if(!oForm.adresse_liv.value){
					alert(txt_alert_adresse_liv)
					oForm.adresse_liv.focus();
					return false
				}
				
				if(!oForm.code_postal_liv.value){
					alert(txt_alert_code_postal_liv)
					oForm.code_postal_liv.focus();
					return false
				}
							
				if(!oForm.ville_liv.value){
					alert(txt_alert_code_ville_liv)
					oForm.ville_liv.focus();
					return false
				}			
				
				if(!oForm.tel_liv.value){
					alert(txt_alert_code_tel_liv)
					oForm.tel_liv.focus();
					return false
				}		
				
				if(oForm.email_liv.value){
					if ((oForm.email_liv.value.indexOf("@",1)>1)&&(oForm.email_liv.value.indexOf(".",1)>0)){			
					}else{
						alert(txt_alert_email_inc);
						oForm.email_liv.focus();
						return false
					}	
				}												
			}				
		break;		
	}
}
/*
*************************************************************************************
Fonctions d'inscription
*************************************************************************************
*/
function verif_seach(formulaire,lng){
	switch(lng){
		case '1':	
			txt_alert_mot					= "Veuillez saisir un mot clé";
		break;
		case '2':
			txt_alert_mot					= "Please type a key word";
		break;
	}
	oForm = document.forms[formulaire]
	if(!oForm.mot.value){	
		alert(txt_alert_mot)
		oForm.mot.focus()
		return false
	}
}


function ouvrir_fenetre(page,nom,proprietes){
	largeur = 600;
	hauteur = 420;
	M_largeur = (screen.width /2)-(largeur/2);
	M_hauteur = 185;	
	window.open(page,nom,"width="+largeur+" height="+hauteur+" top="+M_hauteur+" left="+M_largeur+"status=1 scrollbars=yes")
}

function fctNull(){
	// Ne pas supprimer
}

// Actions spéciales

var SB_ACTION_QUESTION_ABOUT_PRODUCT 		= 1;
var SB_ACTION_COLISPOSTE 					= 2;

var BOX_SYS_DEFAULT_CLASS_NAME				= 'JQBox';
var FLAG_DEBUG								= false;

var b 	= null;
var box	= null;

var boxName									= 'defaultName';

$(JQinit)

function JQinit(){

	$.ajaxSetup({
	  type: "POST",
	  cache:false,
	  async:false
	});
	
	b = $('body')
	$('.actOnClick').click(JQevent)
}

function JQevent(e){
	var t = e.type
	var o = e.target
	
	/*
	alert('Fonctionnalité en cours de développement...\nMerci de votre compréhension !')
	return
	*/
	
	switch(t){
		// Gestion des évènements focus
		case 'focus':
			switch(o.id){
				case 'idFieldQuestion':
				case 'idFieldEmail':
				case 'idCodeColis':
					if($(o).data('focused'))return
					$(o).data('focused',1)
					o.value=''
					break;		
				}
			break;
		// Gestion des évènements click
		case 'click':
			
			switch(o.id){	
				case 'idSubmit':
					
					if(!JQcheck())return
					var response = '';
					var ckeckSendQuestion = false;
					var data = $(":input",$(box)).serializeArray();
					
					$.post(
								'sendQuestion.php',
								data,
								function(output){response=output},
								'html'
						)
					$.post(
								'sendQuestion.php',
								{},
								function(output){response=output},
								'html'
						)
					eval(response)
					if(ckeckSendQuestion){

						JQdisplayMsgOK();
					} else {
						alert('Une erreur s\'est produite lors du traitement du message !\nVeuillez renouveler votre demande ultérieurement.')
					}
					break;
				case 'idClose':
					fctHideBox()
					break;
				case 'idQuestionAboutProduct':
					if($('.'+boxName).size())return
					$('body').data('questionTargetProduct',$(o).attr('param'))
					fctIniBox(SB_ACTION_QUESTION_ABOUT_PRODUCT);
					break;
				case 'idColisPoste':
					if($('.'+boxName).size())return
					fctIniBox(SB_ACTION_COLISPOSTE);
					break;
				case 'idCheckCode':
					$('#idFormColisPostal').submit()
					setTimeout(fctHideBox,2000);
					break;
			}
			
			
			break;
	}
}

function JQcheck(){
	var check 		= true;
	var err 		= ['Erreur sur le formulaire :\n'];
	var filter		=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	email 			= $('#idFieldEmail').val()
	question 		= $('#idFieldQuestion').val();
	emailFocused 	= $('#idFieldEmail').data('focused')
	questionFocused	= $('#idFieldQuestion').data('focused')
	if(!emailFocused||!questionFocused){
		err[err.length] = 'Vous n\'avez pas correctement renseigné le formulaire.'
		check = false;	
	} else {
	
		if(!filter.test(email)){
			err[err.length] = 'Saisie de l\'email incorrect !'
			check = false;	
		}
		if(!question.length){
			err[err.length] = 'Vous n\'avez pas saisie de question !'
			check = false;	
		}
		
	}	
	if(!check)alert(err.join('\n'))
	return check
}

function JQdisplayMsgOK(){

	var output = '<div style="text-align:center;padding-top:40px;font-size:12px;font-weight:bold;color:white;">'
	output += 'Votre question nous a bien été transmise !<br />Duostyle vous remercie de votre confiance !'
	output += '</div>'
	
	$('.boxInput',$(box)).fadeOut(50)
	$('.boxInput',$(box)).html(output)
	$('.boxInput',$(box)).fadeIn(250)
	
	setTimeout(fctHideBox,2000);
}

function fctIniBox(action){
	
	var html 					= '';
	var param 					= '';
	var boxTargetPos			= 'centerHorizontal';
	var cssPosition 			= 'relative';
	var cssDisplay				= 'block';
	var cssBorder 				= 'none';
	var cssBackgroundColor 		= 'white';
	var cssTargetHeight 		= 300;
	var cssTargetWidth  		= 500;

	switch(action){
		case SB_ACTION_COLISPOSTE:
			boxName 		= 'boxColiPoste'
			cssPosition		= 'absolute'
			cssDisplay		= 'none'
			cssBorder		= '1px solid lightgrey'
			cssTargetHeight = 150
			cssTargetWidth  = 500
			html 		= 	'<div class="'+BOX_SYS_DEFAULT_CLASS_NAME+'">'
			html 		+= 	' 	<form id="idFormColisPostal" method="post" target="blank" action="http://www.coliposte.fr/gp/services/main.jsp?m=10003005">'
			html		+=	'	<input type="hidden" name="formName" value="formColisPostal" />'	
			html 		+= 	'	<div class="boxBar" style="background-color:#569AED;text-align:right;display:none;">'
			html		+=	'		<div style="margin:0px 0px 0px auto;cursor:pointer;" class="crux"><img id="idClose" src="img/closer.jpg" /></div>'
			html 		+= 	'	</div>'			
			html 		+= 	'	<div class="boxInput" style="margin:5px;display:none;">'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">Code Coliposte</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><input id="idCodeColis" style="border:1px solid lightgrey;width:300px;font-size:11px;" type="text" name="colispart" value="Saisissez votre code \'Coliposte\'" /></span>'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">&nbsp;</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><input style="border:1px outset lightgrey;width:300px;padding:4px 0px 4px 0px;cursor:pointer" type="button" name="fldSubmit" id="idCheckCode" value="Envoyer" /></span>'
			html 		+= 	'	</div>'
			html		+= 	'	</form>'
			html		+= 	'</div>'		
			break;
		case SB_ACTION_QUESTION_ABOUT_PRODUCT:
			//alert()
			boxName 	= 'boxQuestionAboutProduct'
			cssPosition	= 'absolute'
			cssDisplay	= 'none'
			cssBorder	= '1px solid lightgrey'
			html 		= 	'<div class="'+BOX_SYS_DEFAULT_CLASS_NAME+'">'
			html 		+= 	' 	<form id="idFormQuestion" method="post" action="">'
			html		+=	'	<input type="hidden" name="formName" value="formQuestion" />'	
			html 		+= 	'	<div class="boxBar" style="background-color:#569AED;text-align:right;display:none;">'
			html		+=	'		<div style="margin:0px 0px 0px auto;cursor:pointer;" class="crux"><img id="idClose" src="img/closer.jpg" /></div>'
			html 		+= 	'	</div>'			
			html 		+= 	'	<div class="boxInput" style="margin:5px;display:none;">'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">Produit</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><input id="idFieldProduct" readonly style="border:1px solid lightgrey;width:300px;font-size:11px;" type="text" name="fldProduct" value="'+$('body').data('questionTargetProduct')+'" /></span>'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">Votre e-mail</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><input id="idFieldEmail" style="border:1px solid lightgrey;width:300px;font-size:11px;" type="text" name="fldEmail" value="'+(FLAG_DEBUG?'info@ansm.net':'Votre email ...')+'" /></span>'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">Saisissez votre question</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><textarea id="idFieldQuestion" style="border:1px solid lightgrey;width:300px;height:200px;font-size:11px;" name="fldQuestion" >'+(FLAG_DEBUG?'Quel est l\'âge du capitaine':'Votre question ...')+'</textarea></span>'
			html 		+= 	'		<span style="clear:both;float:left;width:180px;"><label style="font-weight:bold;">&nbsp;</label></span>'
			html 		+= 	'		<span style="float:left;width:300px;"><input style="border:1px outset lightgrey;width:300px;padding:4px 0px 4px 0px;cursor:pointer" type="button" name="fldSubmit" id="idSubmit" value="Envoyer" /></span>'
			html 		+= 	'	</div>'
			html		+= 	'	</form>'
			html		+= 	'</div>'
			break;
	}

	param =	{
				boxName:boxName,
				cssPosition:cssPosition,
				cssBorder:cssBorder,
				cssDisplay:cssDisplay,
				boxTargetPos:boxTargetPos,
				cssTargetHeight:cssTargetHeight,
				cssTargetWidth:cssTargetWidth,
				cssBackgroundColor:cssBackgroundColor,
				html:html
			}		
	fctShowBox(param)		
	
}

function fctHideBox(param){
	if(typeof(param)!='undefined'){
		if(!$('.'+param.boxName).size())return
	}
	
	//$(box).html('')
	$(box).css('backgroundColor','#A477D0');
	$('.boxInput',$(box)).fadeOut(50)
	$(box).animate({
						width:'1px',
						height:'1px',
						top:1,
						left:1
				  },
				  1500,
				  '',
				  function(){$(box).remove()}
				  )	
	
	}

function fctShowBox(param){
	
	// Vérifie que le box ne soit pas déjà affiché
	//fctHideBox(param)
	
	
	if(!$('.'+param.boxName).size()){
		b.prepend(param.html)
		box = $('.'+BOX_SYS_DEFAULT_CLASS_NAME).removeClass(BOX_SYS_DEFAULT_CLASS_NAME).addClass(param.boxName)
	}
	
	$(box).css('position',param.cssPosition).css('border',param.cssBorder).css('display',param.cssDisplay).css('top',1).css('left',1).css('backgroundColor','#A477D0')
	$('.boxBar',$(box)).css('width',param.cssTargetWidth+'px')
	if(FLAG_DEBUG){
		$(box).css('border:1px solid red')
		//$(box).html(param.cssTargetWidth+' '+param.cssTargetHeight)
	}
	
	switch(param.boxTargetPos){
		case 'centerHorizontal':
			iTop 	= 200
			iLeft 	= 200
			iLeft 	= Math.ceil(($(window).width()-param.cssTargetWidth)/2)
			//alert($(window).height()+' '+param.cssTargetHeight)
			break;
	}
	
	//$(box).css('display','block')
	$('#idClose',$(box)).click(JQevent);
	$('#idSubmit',$(box)).click(JQevent);
	$('#idCheckCode',$(box)).click(JQevent);
	
	$(box).animate({
						width:param.cssTargetWidth+'px',
						height:param.cssTargetHeight+'px',
						top:iTop,
						left:iLeft,
						opacity:1
				  },
				  1500,
				  function(){
								$('.boxBar',$(box)).fadeIn(300);
				  				$('.boxInput',$(box)).fadeIn(600)
							}
				  )
	
	
	//alert($('input',$(box)).size())
	$('input',$(box)).focus(JQevent).data('focused',((FLAG_DEBUG)?1:0)) 
	$('textarea',$(box)).focus(JQevent).data('focused',((FLAG_DEBUG)?1:0))
}

function checkModePaiement(){
	if(document.valid_caddy.mode_paiement.selectedIndex	==	0){
		alert("Veuillez sélectionner un mode de paiement")
		return false
	}
}