function codeTouche(evenement)
{
        for (prop in evenement)
        {
                if(prop == 'which') return(evenement.which);
        }
        return(evenement.keyCode);
}


function scanTouche(evenement)
{
        var reCarValides = /\d/;

        var codeDecimal  = codeTouche(evenement);
        var car = String.fromCharCode(codeDecimal);
        var autorisation = reCarValides.test(car);

        return autorisation;
}

function controleqt()
{
	qtcommder=gerbbb.cmd_art_qt.value;
	qtcommder=Number(qtcommder);
	if (qtcommder<1)
	{
		qtcommder=1;
		gerbbb.cmd_art_qt.value=1;
	}
	else
	{
		gerbbb.cmd_art_qt.value=qtcommder;
	}
	refarticle=gerbbb.idrefarti.value;
	window.open("calcul.php?qt="+qtcommder+"&refarticle="+refarticle, target="gerbcalcout");
}


function controleqtmod()
{
	qtcommder=modifipan.cmd_art_qt.value;
	qtcommder=Number(qtcommder);
	if (qtcommder<1)
	{
		qtcommder=1;
		modifipan.cmd_art_qt.value=1;
	}
	else
	{
		modifipan.cmd_art_qt.value=qtcommder;
	}
	refarticle=modifipan.idrefartimod.value;
	window.open("calcul_mod.php?qt="+qtcommder+"&refarticle="+refarticle, target="gerbcalcout");
}


function verifatichepanier()
{}

function verimodifipan()
{}

function annulmodpan()
{
	document.location="?idpanier=1";
}

function verif_inscripp()
{
	if (nn.client_email.value=="")
	{
		alert("Email vide !");
		nn.client_email.focus();
		return false;
	}
	else
	{
		if (nn.client_pws.value=="")
		{
			alert("Mot de passe vide !");
			nn.client_pws.focus();
			return false;
		}
		else
		{
			if (nn.client_nom.value=="")
			{
				alert("Nom vide !");
				nn.client_nom.focus();
				return false;
			}
			else
			{
				if (nn.client_adr1.value=="")
				{
					alert("Adresse vide !");
					nn.client_adr1.focus();
					return false;
				}
				else
				{
					if (nn.client_cp.value=="")
					{
						alert("CP vide !");
						nn.client_cp.focus();
						return false;
					}
					else
					{
						if (nn.client_ville.value=="")
						{
							alert("Ville vide !");
							nn.client_ville.focus();
							return false;
						}
					}
				}
			}
		}
	}
}

function verif_misspws()
{
	if (nn.client_email.value=="")
	{
		alert("Vous avez oublié de saisir votre Email !");
		nn.client_email.focus();
		return false;
	}
}

function verif_connexxions()
{
}


function verif_modifprofil()
{
		if (nn.client_pws.value=="")
		{
			alert("Mot de passe vide !");
			nn.client_pws.focus();
			return false;
		}
		else
		{
			if (nn.client_nom.value=="")
			{
				alert("Nom vide !");
				nn.client_nom.focus();
				return false;
			}
			else
			{
				if (nn.client_adr1.value=="")
				{
					alert("Adresse vide !");
					nn.client_adr1.focus();
					return false;
				}
				else
				{
					if (nn.client_cp.value=="")
					{
						alert("CP vide !");
						nn.client_cp.focus();
						return false;
					}
					else
					{
						if (nn.client_ville.value=="")
						{
							alert("Ville vide !");
							nn.client_ville.focus();
							return false;
						}
					}
				}
			}
		}
}

function mod_info_liv()
{
	if (nn.tem_adr_liv.value==2)
	{
		document.all.autreadreliv.style.display="none";
	}
	else
	{
		document.all.autreadreliv.style.display="";
	}
	changepaysliv();
}

function choixmodepaiem(quoi)
{
	nn.g_t_mode_paiment.value=quoi;
	if (quoi==1)
	{
		document.img_paie_cheque.src="images/cocher.jpg";
		document.img_paie_carte.src="images/non_cocher.jpg";
	}
	else
	{
		document.img_paie_cheque.src="images/non_cocher.jpg";
		document.img_paie_carte.src="images/cocher.jpg";
	}
}

function verifcmddddd()
{
	if (nn.tem_adr_liv.value==1)
	{
		if(nn.g_l_client_nom.value=="")
		{
			alert("Vous avez oublié de saisir le destinataire !");
			nn.g_l_client_nom.focus();
			return false
		}
		else
		{
			if (nn.g_l_client_adr1.value=="")
			{
				alert("Vous avez oublié de saisir l'adresse de livraison !")
				nn.g_l_client_adr1.focus();
				return false
			}
			else
			{
				if (nn.g_l_client_cp.value=="")
				{
					alert("Vous avez oublié de saisir le code postal de livraison !")
					nn.g_l_client_cp.focus();
					return false
				}
				else
				{
					if (nn.g_l_client_ville.value=="")
					{
						alert("Vous avez oublié de saisir la ville de livraison !")
						nn.g_l_client_ville.focus();
						return false
					}
				}
			}
		}
	}
}

function pluss(id)
{
	document.location="?id="+id;
}

function pluss2(id)
{
	document.location="?id2="+id;
}

function pluss3(id)
{
	document.location="?id3="+id;
}

function articcc(id)
{
	document.location="?idref="+id;
}

function artplus()
{
	qtcommder=gerbbb.cmd_art_qt.value;
	qtcommder=Number(qtcommder);
	qtcommder=qtcommder+1;
	if (qtcommder<1)
	{
		qtcommder=1;
		gerbbb.cmd_art_qt.value=1;
	}
	else
	{
		gerbbb.cmd_art_qt.value=qtcommder;
	}
	refarticle=gerbbb.idrefarti.value;
	window.open("calcul.php?qt="+qtcommder+"&refarticle="+refarticle, target="gerbcalcout");
}

function artmoins()
{
	qtcommder=gerbbb.cmd_art_qt.value;
	qtcommder=Number(qtcommder);
	qtcommder=qtcommder-1;
	if (qtcommder<1)
	{
		qtcommder=1;
		gerbbb.cmd_art_qt.value=1;
	}
	else
	{
		gerbbb.cmd_art_qt.value=qtcommder;
	}
	refarticle=gerbbb.idrefarti.value;
	window.open("calcul.php?qt="+qtcommder+"&refarticle="+refarticle, target="gerbcalcout");
}

function annuler_badge_1()
{
	document.location="?idbadge=1";
}

function badge_etape_choix(j)
{
	bbbbadge.badge_type[j].checked=true;	
}

function verif_badge_etape1()
{
	for (var i=0; i<bbbbadge.badge_type.length;i++) 
	{
		if (bbbbadge.badge_type[i].checked)
		{
			bbbbadge.badge_type2.value=i;
		}
	}
	if (bbbbadge.badge_nom.value=="")
	{
		alert("Libellé obligatoire !");
		bbbbadge.badge_nom.focus();
		return false;
	}
}

function verif_badge_etape1b()
{
	if (bbbbadge.badge_nom.value=="")
	{
		alert("Libellé obligatoire !");
		bbbbadge.badge_nom.focus();
		return false;
	}
}


function controletypesupport()
{
	if (badgeetape3.ger_fac_badge_support.value==10)
	{
		document.all.badgeautresupport.style.display='';
	}
	else
	{
		document.all.badgeautresupport.style.display='none';
	}
}

function verifbadedevis()
{
	qtdevisbadge=badgeetape3.ger_fac_badge_qt.value;
	qtdevisbadge=Number(qtdevisbadge);
	badgeetape3.ger_fac_badge_qt.value=qtdevisbadge;
	if (qtdevisbadge<10)
	{
		alert("La quantité doit être supérieur à 10 !");
		badgeetape3.ger_fac_badge_qt.focus();
		return false;
	}
}


function devisbadge(queldevis)
{
		 winlupss = 900;
		 winhupss = 700;
		 winpropspff="height="+winhupss+", width="+winlupss+", top=10, left=10, scrollbars='auto', status=no, menubar=no, noresize";
		window.open("impression/GER_Facilities_devis_badge.php?queldevis="+queldevis, "gerfacilitiesbadedevis", winpropspff);

}

function badgeetapeun()
{
	document.location="?idbadge=1&badgeetap=1";
}

function supprimerformatbadge(jhjhjh)
{
		var confsuitesupmasqueb;
		confsuitesupmasqueb = confirm("voulez-vous supprimer ce masque de badge ?");
		if (confsuitesupmasqueb)
		{
			document.location="?idbadge=1&idbdaged="+jhjhjh;
		}
	
}

function dupliquermasquebadge(ttytyy)
{
	document.location="?idbadge=1&badgeetap=1&badgeiddup="+ttytyy;
}

function verif_recherche()
{
	if (gerbadgerech.gfac_rech_ref.value=="référence, mots clés")
	{
		gerbadgerech.gfac_rech_ref.value="";
	}
}

    function m_stop()
	{
        document.all.bnmarqueconso1.stop();
    }
    function m_star()
	{
        document.all.bnmarqueconso1.start();
    }

    function m_stop2()
	{
        document.all.bnmarqueconso2.stop();
    }
    function m_star2()
	{
        document.all.bnmarqueconso2.start();
    }

    function m_stop3()
	{
        document.all.bnmarqueconso3.stop();
    }
    function m_star3()
	{
        document.all.bnmarqueconso3.start();
    }
	
	function choixinfocmd(idd)
	{
		document.location="index.php?tcccc="+idd;
	}

function changepaysliv()
{
	if (nn.tem_adr_liv.value==2)
	{
		paysaliver=nn.g_f_client_pays.value;
	}
	else
	{
		paysaliver=nn.g_l_client_pays.value;
	}
	window.open("recalcullepoid.php?paysalivrer="+paysaliver+"&poidacontroler="+nn.commandeportpoid.value+"&totalttcavantport="+nn.commandetotalttcavantport.value, target="facilitiescalspoid");
}
