function confirm_entry()
{
input_box=confirm("Êtes-vous certain de vouloir poursuivre la suppression ?");
if (input_box==true)

{ 

}

else
{
return (false);
}

}

function confirm_del(Message)
{
	input_box=confirm(Message);
	if (!input_box) return (false);
}
// Fonction qui vérifie qu'on veuille vraiment supprimer le produit
function confirm_delete()
{
input_box=confirm("Êtes-vous certain de vouloir enlever ce produit de votre panier ?");
if (input_box==true)
{ 
	return(true); 
} else {
	return (false);
}

}
// Fonction qui vérifie qu'on veuille vraiment supprimer le produit
function confirm_deleteEng()
{
input_box=confirm("Do you really want to remove this item from your cart ?");
if (input_box==true)
{ 
	return(true); 
} else {
	return (false);
}

}
function confirm_deleteEsp()
{
input_box=confirm("¿Esta usted seguro de querer quitar el producto del carrito?");
if (input_box==true)
{ 
	return(true); 
} else {
	return (false);
}

}

// Fonction qui sert à vérifier si l'information entrée est un courriel valide

function CheckEmail(EMailToChk,Message)
{
var acomm=false;
var point=false;
var LAP=false;

	a = EMailToChk.value;

	for(tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac == "@") acomm=true;
		if (acomm)
		{
			if (charac == ".") point=true;
		}
		if (point)
		{
			if ( ( (charac >= "A") && (charac <="Z") ) ||( (charac >="a") && (charac <="z") ) ) LAP=true;
		}
	}

	if (!(acomm && point && LAP))
	{
		alert(Message + " est invalide");
		EMailToChk.focus();
		return(false);
	}
	return(true);
}

// Fonction qui sert à vérifier si l'information entrée est un courriel valide

function CheckEmailEng(EMailToChk,Message)
{
var acomm=false;
var point=false;
var LAP=false;

	a = EMailToChk.value;

	for(tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac == "@") acomm=true;
		if (acomm)
		{
			if (charac == ".") point=true;
		}
		if (point)
		{
			if ( ( (charac >= "A") && (charac <="Z") ) ||( (charac >="a") && (charac <="z") ) ) LAP=true;
		}
	}

	if (!(acomm && point && LAP))
	{
		alert(Message + " is invalid");
		EMailToChk.focus();
		return(false);
	}
	return(true);
}

function CheckEmailEsp(EMailToChk,Message)
{
var acomm=false;
var point=false;
var LAP=false;

	a = EMailToChk.value;

	for(tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac == "@") acomm=true;
		if (acomm)
		{
			if (charac == ".") point=true;
		}
		if (point)
		{
			if ( ( (charac >= "A") && (charac <="Z") ) ||( (charac >="a") && (charac <="z") ) ) LAP=true;
		}
	}

	if (!(acomm && point && LAP))
	{
		alert(Message + " no es valido");
		EMailToChk.focus();
		return(false);
	}
	return(true);
}
// Vérifie que le code postal est bien entré

function CheckCP(CPToChk)
{
var CPOK=true;

	a = CPToChk;
	
	if (a.length != 7) CPOK=false;
	for (tmp=0;tmp<7;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if ((tmp == 0) || (tmp == 2) || (tmp == 5))
		{
			if (!( ((charac >= "A") && (charac <="Z")) ||((charac >="a")&&(charac <="z")) )) CPOK=false;
		}
		if ((tmp == 1) || (tmp == 4) || (tmp == 6))
		{
			if ((charac < "0") || (charac > "9")) CPOK=false;
		}
		if (tmp == 3)
		{
			if (charac != " ") CPOK=false;
		}
	}
	if (!(CPOK))
	{
		alert("Le code postal n'est pas valide, veuillez entrer le code postal dans le format suivant : A9A 9A9");
		return(false);
	}
	return(true);
}

// Vérifie que le "ZIP code" est bien entré

function CheckZIP(ZIPToChk)
{
var ZIPOK=true;

	a = ZIPToChk;
	
	if (a.length != 10) CPOK=false;
	for (tmp=0;tmp<10;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (tmp != 5)
		{
			if ((charac < "0") || (charac > "9")) ZIPOK=false;
		}
		if (tmp == 5)
		{
			if (charac != "-") ZIPOK=false;
		}
	}
	if (!(ZIPOK))
	{
		return(false);
	}
	return(true);
}
// Vérifie que l'information entrée est bien de type numérique

function CheckNumber(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
		  if ((charac != ".") && (charac != ",")) 
		  {
		  	alert(Message + " doit être un nombre");
			NumToChk.focus();
			return(false);
		  }
		}
	}	
	return(true);
}
// Vérifie que l'information entrée est bien de type numérique

function CheckNumberEng(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
		  if ((charac != ".") && (charac != ",")) 
		  {
		  	alert(Message + " must be a number");
			NumToChk.focus();
			return(false);
		  }
		}
	}	
	return(true);
}

function CheckNumberEsp(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
		  if ((charac != ".") && (charac != ",")) 
		  {
		  	alert(Message + " tiene que ser un nombre");
			NumToChk.focus();
			return(false);
		  }
		}
	}	
	return(true);
}
// Vérifie que l'information entrée est bien de type numérique entière

function CheckNumberInt(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
			alert(Message + " doit être un nombre entier");
			NumToChk.focus();
			return(false);
		}
	}
	return(true);
}
// Vérifie que l'information entrée est bien de type numérique entière

function CheckNumberIntEng(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
			alert(Message + " must be a whole number");
			NumToChk.focus();
			return(false);
		}
	}
	return(true);
}
function CheckNumberIntEsp(NumToChk,Message)
{

	a = NumToChk.value;
	
	for (tmp=0;tmp<a.length;tmp++)
	{
		charac = a.substring(tmp,tmp+1);
		if (charac<"0" || charac>"9")
		{
			alert(Message + " tiene que ser un nombre entero");
			NumToChk.focus();
			return(false);
		}
	}
	return(true);
}
// Vérifie que le numéro de téléphone a été entrée avec la bonne syntaxe

function CheckTel(TelToChk)
{

var TelOK = true;

a= TelToChk;
if (a.length != 12) TelOK = false;
for (tmp=0;tmp<=11;tmp++)
{
	charac = a.substring(tmp,tmp+1);
	
	if ((tmp == 3) || (tmp == 7))
		if (charac != "-") TelOK = false;	
	if ((tmp != 3) && (tmp != 7))
		if (charac <"0" || charac > "9") TelOK = false;	
}

if (!(TelOK)) 
{
return(false);
}

return(true);
}

// Vérifie si la date est dans le bon format

function CheckDate(DateToChk,Message)
{
//Format jj/mm/aaaa

	var err=0;
	var psj=0;
	a= DateToChk.value;
	if (a.length != 10) err=1
	b = a.substring(0, 2)// Jour
	c = a.substring(2, 3)// '/' ou '-'
	d = a.substring(3, 5)// Mois
	e = a.substring(5, 6)// '/' ou '-'
	f = a.substring(6, 10)// Année
	
	//Vérification des erreurs de base
	if (d<1 || d>12) err = 1;
	if ((c != '/') && (c != '-')) err = 1;
	if (b<1 || b>31) err = 1;
	if ((e != '/') && (c != '-')) err = 1;
	if (f<0 || f>9999) err = 1;
	
	//Vérification des erreurs avancées

	// Mois à 30 jour
	if (d==4 || d==6 || d==9 || d==11){
		if (b==31) err=1
	}

	// Février, année bisextile
	if (d==2){
		// feb
		var g=parseInt(f/4)
		if (isNaN(g)) {
			err=1
		}

		if (b>29) err=1
		if (b==29 && ((f/4)!=parseInt(f/4))) err=1
	}

	if (err==1){
		alert("La "+ Message + " n'est pas valide. Veuillez entrer la date dans le format jj/mm/aaaa ou jj-mm-aaaa");
		DateToChk.focus();
		return (false);
	}
	else{
		return (true);
	}

}

function GetRadio(obj)
{
	var i;

	for( i=0; i<obj.length; ++i)
		if( obj[i].checked)
			return obj[i].value;
	// default (non selected)
	return -1;
}
function FormatNumber(expr, decplaces) {

var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));

while (str.length <= decplaces) {
str = "0" + str;
}

var decpoint = str.length - decplaces;

return str.substring(0,decpoint) + "." + str.substring(decpoint, str.length);

} //End function FormatNumber 
function IsEmpty(champ,Message)
{
	if (champ.value == "")
	{
		if (Message != "")
		{
			alert(Message);
			champ.focus();
		}
		return(true);
	}
	return(false);
}