<!-- FONCTIONS JAVASCRIPT -->

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function Semaine()
{
	this[0] = "Dimanche";  this[1] = "Lundi";
	this[2] = "Mardi";     this[3] = "Mercredi";
	this[4] = "Jeudi";     this[5] = "Vendredi";
	this[6] = "Samedi";
}

function Mois()
{
	this[0] = "Janvier";    this[1] = "Février";
	this[2] = "Mars";       this[3] = "Avril";
	this[4] = "Mai";        this[5] = "Juin";
	this[6] = "Juillet";    this[7] = "Août";
	this[8] = "Septembre";  this[9] = "Octobre";
	this[10] = "Novembre";  this[11] = "Décembre";
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function Aujourdhui()
{
	var DateActuel = new Date();
	
    var semaine=new Semaine();
    var jour = DateActuel.getDate();
	var mois=new Mois();
    var annee = DateActuel.getFullYear();
  
	var date_jour = semaine[DateActuel.getDay()] + "&nbsp;" + jour + "&nbsp;" + mois[DateActuel.getMonth()] + "&nbsp;" + annee;

	var heure = DateActuel.getHours();
	var minutes = DateActuel.getMinutes();
	var secondes = DateActuel.getSeconds();
	
	if(heure<10)
	{
		heure = '0'+heure;
	}
	
    if(minutes<10)
	{
		minutes = '0'+minutes;
	}
    
	if(secondes<10)
	{
		secondes = '0'+secondes;
	}
	
	var heure_jour = heure + "&nbsp;:&nbsp;" + minutes + "&nbsp;:&nbsp;" + secondes;
	
	var Today = date_jour + "<br>" + heure_jour;

	if (document.getElementById("date_heure"))
	{
		document.getElementById("date_heure").innerHTML = Today;
	}

	if (document.layers)
	{ 
    	document.date_heure.document.write(Today); 
		document.date_heure.document.close(); 
  	}

	if ((document.all)&&(!document.getElementById))
	{ 
    	document.all["date_heure"].innerHTML = Today;
 	}

	setTimeout("Aujourdhui()", 1000)
}
	
window.onload = Aujourdhui;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function recherche()
{	
	if(document.frmrecherche.mot.value=="")
	{
		alert("Vous devez saisir votre recherche !"); 
	}
	else
	{
		document.frmrecherche.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function chiffres(event)
{
	// Compatibilité IE / Firefox
	if(!event&&window.event)
	{
		event=window.event;
	}
	
	// IE
	if(event.keyCode < 48 || event.keyCode > 57)
	{
		event.returnValue = false;
		event.cancelBubble = true;
	}
	
	// DOM
	if(event.which < 48 || event.which > 57)
	{
		event.preventDefault();
		event.stopPropagation();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verifier_qte(formulaire)
{	
	if(formulaire.qte.value=="" || formulaire.qte.value==0)
	{
		alert("Vous devez saisir une quantité > 0 !"); 
	}
	else
	{
		formulaire.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function suppression(formulaire)
{	
	formulaire.etat.value= "supprimer";
	formulaire.submit();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function vider()
{	
	if(confirm("Etes-vous sûr de vouloir de vider le panier ?"))
	{  
		document.frmpanier.submit();
	} 
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function fiche(numero)
{
	window.open('fiche_lot.php?numlot='+numero+'','', config='height=483, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function commander()
{	
	document.frmpanier.vide.value= "non";
	document.frmpanier.action= "conditions1.php";
	document.frmpanier.submit();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function conditions()
{	
	if (document.frmconditions.croix.checked == false)
	{
		alert("Vous devez accepter les Conditions Générales de Vente !"); 
	}
	else
	{
		document.frmconditions.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function contact()
{
	if(document.frmcontact.nom.value=="" || document.frmcontact.prenom.value=="" || document.frmcontact.email.value=="" || document.frmcontact.sujet.value=="" || document.frmcontact.message.value=="")
	{
		alert("Les champs marqués d'un * doivent être saisis !"); 
	}
	else if(document.frmcontact.email.value.indexOf('@',0)== -1 || document.frmcontact.email.value.indexOf('.',0)== -1)
	{
		alert("L'adresse e-mail est incorrecte !"); 
	}
	else
	{
		document.frmcontact.envoi.value="oui";
		document.frmcontact.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verifier_client()
{
	if(document.frmclient.login_client.value=="" || document.frmclient.pass_client.value=="")
	{
		alert("Vous devez saisir votre adresse e-mail et votre mot de passe !"); 
	}
	else if(document.frmclient.login_client.value.indexOf('@',0)== -1 || document.frmclient.login_client.value.indexOf('.',0)== -1)
	{
		alert("L'adresse e-mail est incorrecte !"); 
	}
	else
	{
		document.frmclient.existe_client.value="oui";
		document.frmclient.action="formulaire.php";
		document.frmclient.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verifier_formulaire()
{
	if(document.frmclient.email_client.value=="" || document.frmclient.pass1_client.value=="" || document.frmclient.pass2_client.value=="" || document.frmclient.nom_client.value=="" || document.frmclient.prenom_client.value=="" || document.frmclient.adresse1_facturation_client.value=="" || document.frmclient.cp_facturation_client.value=="" || document.frmclient.ville_facturation_client.value=="" || document.frmclient.adresse1_livraison_client.value=="" || document.frmclient.cp_livraison_client.value=="" || document.frmclient.ville_livraison_client.value=="")
	{
		alert("Les champs marqués d'un * doivent être saisis !"); 
	}
	else if(document.frmclient.email_client.value.indexOf('@',0)== -1 || document.frmclient.email_client.value.indexOf('.',0)== -1)
	{
		alert("L'adresse e-mail est incorrecte !"); 
	}
	else if(document.frmclient.pass1_client.value != document.frmclient.pass2_client.value)
	{
		alert("Les mots de passe saisis doivent être identiques !"); 
	}
	else
	{
		document.frmclient.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function annuler()
{	
	if(confirm("Etes-vous sûr de vouloir annuler la commande ?"))
	{  
		document.frmcommande.vide.value="oui";
		document.frmcommande.submit();
	} 
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function valider_commande()
{	
	document.frmcommande.facture.value="oui";
	document.frmcommande.action="commande.php";
	document.frmcommande.submit();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function modifier_client()
{
	window.open('fiche_client.php','', config='height=658, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function effacer_formulaire()
{
	for (var i=0; i < document.forms["frmfiche"].length; i++)
	{
		if (document.forms["frmfiche"].elements[i].type!='button' && window.document.forms["frmfiche"].elements[i].type!='select-one')
		{
			document.forms["frmfiche"].elements[i].value="";
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verifier_fiche()
{
	if(document.frmfiche.email_client.value=="" || document.frmfiche.pass1_client.value=="" || document.frmfiche.pass2_client.value=="" || document.frmfiche.nom_client.value=="" || document.frmfiche.prenom_client.value=="" || document.frmfiche.adresse1_facturation_client.value=="" || document.frmfiche.cp_facturation_client.value=="" || document.frmfiche.ville_facturation_client.value=="" || document.frmfiche.adresse1_livraison_client.value=="" || document.frmfiche.cp_livraison_client.value=="" || document.frmfiche.ville_livraison_client.value=="")
	{
		alert("Les champs marqués d'un * doivent être saisis !"); 
	}
	else if(document.frmfiche.email_client.value.indexOf('@',0)== -1 || document.frmfiche.email_client.value.indexOf('.',0)== -1)
	{
		alert("L'adresse e-mail est incorrecte !"); 
	}
	else if(document.frmfiche.pass1_client.value != document.frmfiche.pass2_client.value)
	{
		alert("Les mots de passe saisis doivent être identiques !"); 
	}
	else
	{
		document.frmfiche.existe_client.value="non";
		document.frmfiche.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function pass()
{
	window.open('pass.php','', config='height=182, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function verifier_pass()
{
	if(document.frmpass.email.value=="")
	{
		alert("Vous devez saisir une adresse e-mail !"); 
	}
	else if(document.frmpass.email.value.indexOf('@',0)== -1 || document.frmpass.email.value.indexOf('.',0)== -1)
	{
		alert("L'adresse e-mail est incorrecte !"); 
	}
	else
	{
		document.frmpass.existe_mail.value="oui";
		document.frmpass.submit();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function resolution()
{
	alert("Vous etes en résolution : "+screen.width+"*"+screen.height+" !");
	
	longueur=screen.width;
	
	taille=Math.round(longueur*0.023);
	document.frmrecherche.mot.size=taille;
	//alert(taille);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function apercu_commande(numero_commande)
{
	document.location.href='fiche_commande.php';
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function lien(chemin)
{
	document.location.href=chemin;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function form_sponsor()
{
	window.open('add_sponsor.php','', config='height=428, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

<!-- FONCTIONS JAVASCRIPT -->
