function dsp_sousMenu(TR_name){	
	if(navigator.appName.indexOf("Internet Explorer") != -1){
		dsp_block = "block";
	}else{
		dsp_block = "table-row";
	}	
	tr_all = zone_sommaire.getElementsByTagName('TR')
	for(tr=0;tr<tr_all.length;tr++){
		if(tr_all[tr].className == 'sousMenu' ){
			tr_all[tr].style.display = 'none';
		}
	}
	for(tr=0;tr<tr_all.length;tr++){
		if(tr_all[tr].id == TR_name ){
			tr_all[tr].style.display = dsp_block;
		}
	}
}

/*
*************************************************************************************
Fonctions de navigation
*************************************************************************************
*/

function opn_window(page,nom,proprietes){	
	window.open(page,nom,proprietes)
}

function goPanier(panier_action,Nvid,lng){
	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.F_art.FLD_Qte.options[document.F_art.FLD_Qte.selectedIndex].value;			
			lst_ids = document.F_art.lst_ids.value;
			MID = Nvid
			dec_lstids = lst_ids.split(',');
			for(i=1;i<dec_lstids.length;i++){
				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){
	document.forms[0].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";			
			for(i=0;i<liv_zone.length-1;i++){	
				document.forms[1].elements[liv_zone[i].name].disabled=true;
			}			
		break;
		case '0':
			document.getElementById('zone_livraison').style.visibility="visible";			
			for(i=0;i<liv_zone.length-1;i++){	
				document.forms[1].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_societe 				= "Veuillez saisir le champ société";
			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_fax					= "Veuillez saisir votre n° de fax";
			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";	
			txt_alert_fonction				= "Veuillez saisir votre fonction"
			txt_alert_besoins				= "Veuillez préciser vos besoins";
			txt_alert_rdv					= "Veuillez précisez une date";
		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";	
			txt_alert_fonction				= "please type your function"
			txt_alert_besoins				= "please specify your needs";
			txt_alert_rdv					= "please specify a date";
		break;
	}
	
	
	
	switch(formulaire){		
		case 'search':
			if(!oForm.tSearch.value){
				alert('Veuillez sélectionner un critère de recherche')
				return false
			}
			
			switch(oForm.tSearch.value){
				case 'mot':
					if(!oForm.mot.value){
						alert(txt_alert_mot);
						oForm.mot.focus();
						return false
					}
					
					if((oForm.mot.value == 'Par mot clé')||(oForm.mot.value == 'Key words')){
						alert(txt_alert_mot);
						oForm.mot.focus();
						oForm.mot.value='';				
						return false
					}		
				break;
				case 'cat_prod':
					if(!oForm.cat_prod.selectedIndex > 0){
						alert('Veuillez sélectionner la catégorie')
						oForm.cat_prod.focus()
						return false
					}
				break;
				case 'marques':
					if(!oForm.marques.selectedIndex > 0){
						alert('Veuillez sélectionner la marque')
						oForm.marques.focus()
						return false
					}
				break;
			}
		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.societe.value){
				alert(txt_alert_societe);
				oForm.societe.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.fax.value){
				alert(txt_alert_fax)
				oForm.fax.focus();
				return false
			}
			
			if(oForm.typeContact[1].checked){
				if(!oForm.dep_HH.value){
					alert("Veuillez remplir l'heure d'appel");
					break;
				} else {
					if(isNaN(oForm.dep_HH.value)==true){
						alert("Votre heure d'appel est érronée");
						break;
					}
				}
				if(!oForm.fin_HH.value){
					alert("Veuillez remplir l'heure d'appel");
					break;
				} else {
					if(isNaN(oForm.fin_HH.value)==true){
						alert("Votre heure d'appel est érronée");
						break;
					}
				}
			}			
			
			if(!oForm.demande.value){
				alert(txt_alert_demande)
				oForm.demande.focus();
				return false
			}
		break;
		case 'devis':	
			if(!oForm.societe.value){
				alert(txt_alert_societe)
				oForm.societe.focus();
				return false
			}
			
			if(!oForm.nom.value){
				alert(txt_alert_nom)
				oForm.nom.focus();
				return false
			}
			
			if(oForm.fonction.options[oForm.fonction.selectedIndex].value == 'Autre'){
				if(!oForm.autre.value){
					alert("Veuillez précisez votre fonction")
					oForm.autre.focus();
					return false
				}
			}
			
			if(!oForm.tel.value){
				alert(txt_alert_code_tel)
				oForm.tel.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
			}
			
			check_zone = document.getElementsByName("besoins[]")
			is_check_besoins = 0;
			for(i=0;i<check_zone.length;i++){
				if(check_zone[i].checked == true){
					is_check_besoins = 1;
				}
			}
			
			if(is_check_besoins == 0){
				alert(txt_alert_besoins)
				return false
			}
			
			if(oForm.projet.options[oForm.projet.selectedIndex].value == 'Autre'){
				if(!oForm.autre_projet.value){
					alert("Veuillez précisez votre le type de projet")
					oForm.autre_projet.focus();
					return false
				}
			}
			
			if(oForm.etat_projet[oForm.etat_projet.selectedIndex].value == 'Autre'){
				if(!oForm.autre_etat.value){
					alert("Veuillez précisez l'état du projet")
					oForm.autre_etat.focus();
					return false
				}
			}		
		break;
		case 'support':
			if(!oForm.societe.value){
				alert(txt_alert_societe);
				oForm.societe.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.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.date_achat.value){
				alert("Veuillez sélectionner la date d'achat")
				return false
			}	
				
			if(!oForm.facture.value){
				alert("Veuillez saisir votre n° de facture")
				oForm.facture.focus()
				return false
			}		
			
			if(!oForm.demande.value){
				alert(txt_alert_demande)
				oForm.demande.focus();
				return false
			}			
		break;
		//case 'inscription'||'upt_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;		
	}
}


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 echanger(img1,img2){
	if(document.images){
		img1.src = img2
	}
}

function opn_window(page,nom,proprietes){
	window.open(page,nom,proprietes)
}
