//CHARGEMENT DE LA VIDEO AU CLICK SUR LIMAGE
function load_video()
{
	s1.write;
}

//-- AJOUTER LA PAGE AUX FAVORIS
function f_favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
	{
	window.sidebar.addPanel(document.title,location.href,"");
	}
	else
	{
	window.external.AddFavorite(location.href,document.title);
	}
}





//-- IMPRESSION DE LA PAGE EN COURS
function f_imprimer(){
	window.print();
}





//----------------------------------------------------------
//-- CONFIRMATION SUPPRESSION
function confirmSuppr(langue) {
	if(langue=='fr'){msg = "Voulez-vous vraiment supprimer ?";}
	if(langue=='en'){msg = "Do you really want to delete this item from your basket ?";}
	conf = confirm(msg);
	return conf;
}




//-- Verif des champs du Formulaire de Contact
function f_verif_contact() {
	lang  = getElt("langue").value;
	civil = getElt("civil").value;
	nom   = getElt("nom").value;
	prenom= getElt("prenom").value;
	email = getElt("email").value;
	tel   = getElt("tel").value;
	mess  = getElt("message").value;
	
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé car il manque les informations suivantes :\n";}
	if(lang=="en"){Msg="This form can not be sent. The following informations are not present :\n";}
	
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null)
		{
		email2 = false;
		}
		else
		{
		email2 = true;
		}
	
	if (!civil)
		{
		if(lang=="fr"){Msg=Msg+"- Titre\n";}
		if(lang=="en"){Msg=Msg+"- Title\n";}
		}
	
	if (!nom)
		{
		if(lang=="fr"){Msg=Msg+"- Nom\n";}
		if(lang=="en"){Msg=Msg+"- Name\n";}
		}
		
	if (!prenom)
		{
		if(lang=="fr"){Msg=Msg+"- Prénom\n";}
		if(lang=="en"){Msg=Msg+"- First Name\n";}
		}
		
	if (!tel)
		{
		if(lang=="fr"){Msg=Msg+"- Téléphone\n";}
		if(lang=="en"){Msg=Msg+"- Phone number\n";}
		}
		
	if (!email)
		{
		Msg=Msg+"- Email\n";
		}
		else
		{
		if(!email2)
			{
			if(lang=="fr"){Msg=Msg+"- Adresse Email incorrecte!\n";}
			if(lang=="en"){Msg=Msg+"- Error in your Email!\n";}
			}
		}
	
	if (!mess)
		{
		if(lang=="fr"){Msg=Msg+"- Votre message\n";}
		if(lang=="en"){Msg=Msg+"- Your message\n";}
		}
	
	if (!civil || !nom || !prenom || !email2 || !tel || !mess){
		alert(Msg);
		return false;
		}
		else{return true;}
}

function f_checkEmail() {
	var email = getElt("email").value;	
	Msg="Merci de renseigner votre adresse email\n";
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null)
		{
		email2 = false;
		}
		else
		{
		email2 = true;
		}
	
	if (!email2){
		alert(Msg);
		return false;
	}
	else{
		return true;
	}
}




//-- Verif des champs du Formulaire ENVOYER A UN AMI
function f_verif_newsletter() {
	lang  = getElt("langue").value;
	email = getElt("newsletter").value;
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé car il manque les informations suivantes :\n";}
	if(lang=="en"){Msg="This form can not be sent. The following informations are not present :\n";}
	
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null)
		{
		email2 = false;
		}
		else
		{
		email2 = true;
		}

	if (!email)
		{
		Msg=Msg+"- Email\n";
		}
		else
		{
		if(!email2)
			{
			if(lang=="fr"){Msg=Msg+"- Adresse Email incorrecte!\n";}
			if(lang=="en"){Msg=Msg+"- Error in your Email!\n";}
			}
		}
	
	if (!email || !email2) {
		alert(Msg);
		return false;
		}
		else{return true;}
}





//----------------------------------------------------------
//--Fonction pour l'ouverture en POP-UP
function PopPage(mypage)
   {
      // Largeur et hauteur préconisées de la fenêtre SPPLUS
   	var PopupSpplus_largeur	= 450;
   	var PopupSpplus_hauteur	= 350;

      // Position haut et gauche de la fenêtre SPPLUS pour affichage centré dans l'écran
   	var PopupSpplus_top	=((screen.height-PopupSpplus_hauteur)/2);
   	var PopupSpplus_left=((screen.width-PopupSpplus_largeur)/2);

   	// Ouverture du popup SPLUS avec barre état uniquement et focus sur la fenêtre
   	var win = window.open(mypage, "SP","status=yes,scrollbars=yes,top="+PopupSpplus_top+",left="+PopupSpplus_left+",width="+PopupSpplus_largeur+",height="+PopupSpplus_hauteur);
   	win.focus();
}





















//******************************************************************************
//-- CLIENT / COMMANDE / LOGIN
//******************************************************************************
//-- Verif champs pour IDENTIFICATION
function f_verif_connect(){
	lang  = getElt("langue").value;
	email = getElt("login").value;
	mdp   = getElt("mdp").value;
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé :\n";}
	if(lang=="en"){Msg="This form can not be sent :\n";}
	
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null){email2 = false;}else{email2 = true;}
			
	if (!email)
		{
		if(lang=="fr"){Msg=Msg+"- Adresse email absente!\n";}
		if(lang=="en"){Msg=Msg+"- Your Email is not present!\n";}
		}
		else
		{
		if(!email2)
			{
			if(lang=="fr"){Msg=Msg+"- Adresse Email incorrecte!\n";}
			if(lang=="en"){Msg=Msg+"- Error in your Email!\n";}
			}
		}
		
	if (!mdp)
		{
		if(lang=="fr"){Msg=Msg+"- Mot de passe absent!\n";}
		if(lang=="en"){Msg=Msg+"- Your password is not present!\n";}
		}
		
	if (!email || !email2 || !mdp) {alert(Msg);return false;}else{return true;}
}





//-- Verif des champs du Formulaire LIVRAISON
function f_verif_delivery() {
	lang  = getElt("langue2").value;
	nom   = getElt("nom2").value;
	prenom= getElt("prenom2").value;
	ad    = getElt("adresse2").value;
	cp    = getElt("cp2").value;
	ville = getElt("ville2").value;
	pays  = getElt("pays2").value;
	etat  = getElt("state2").value;
	tel   = getElt("tel2").value;
	
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé car il manque les informations suivantes :\n";}
	if(lang=="en"){Msg="This form can not be sent. The following informations are not present :\n";}
	
	
	if(document.forms['FLiv'].elements['choix1'].checked && document.forms['FLiv'].elements['choix2'].checked)
		{
		if(lang=="fr"){Msg=Msg+"- Vous ne pouvez cocher qu\'une case à la fois!\n";}
		if(lang=="en"){Msg=Msg+"- You can tick off only one box at the same time !\n";}
		}

	
	if (!nom)
		{
		if(lang=="fr"){Msg=Msg+"- Nom\n";}
		if(lang=="en"){Msg=Msg+"- Name\n";}
		}
		
	if (!prenom)
		{
		if(lang=="fr"){Msg=Msg+"- Prénom\n";}
		if(lang=="en"){Msg=Msg+"- First Name\n";}
		}

	if (!ad)
		{
		if(lang=="fr"){Msg=Msg+"- Adresse\n";}
		if(lang=="en"){Msg=Msg+"- Address\n";}
		}
		
	if (!cp)
		{
		if(lang=="fr"){Msg=Msg+"- Code postal\n";}
		if(lang=="en"){Msg=Msg+"- ZIP code\n";}
		}
		
	if (!ville)
		{
		if(lang=="fr"){Msg=Msg+"- Ville\n";}
		if(lang=="en"){Msg=Msg+"- Town\n";}
		}
		
	if (!pays)
		{
		if(lang=="fr"){Msg=Msg+"- Pays\n";}
		if(lang=="en"){Msg=Msg+"- Country\n";}
		}
	if(pays==46)
		{
		if(!etat)
			{
			if(lang=="fr"){Msg=Msg+"- L'Etat\n";}
			if(lang=="en"){Msg=Msg+"- State\n";}
			}
		}
		else
		{
		etat = true;	
		}	
	
		
	if (!tel)
		{
		if(lang=="fr"){Msg=Msg+"- Téléphone\n";}
		if(lang=="en"){Msg=Msg+"- Phone number\n";}
		}

	if ( (document.forms['FLiv'].elements['choix1'].checked && document.forms['FLiv'].elements['choix2'].checked) || !nom || !prenom || !ad || !cp || !ville || !pays || !etat || !tel) {
		alert(Msg);
		return false;
		}
		else{return true;}
}





//-- Verif des champs du Formulaire inscription nouveau client
function f_verif_customer() {
	lang  = getElt("langue").value;
	titre = getElt("civil").value;
	nom   = getElt("nom").value;
	prenom= getElt("prenom").value;
	ad    = getElt("adresse").value;
	cp    = getElt("cp").value;
	ville = getElt("ville").value;
	pays  = getElt("pays").value;
	etat  = getElt("state").value;
	tel   = getElt("tel").value;
	email = getElt("mail").value;
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé car il manque les informations suivantes :\n";}
	if(lang=="en"){Msg="This form can not be sent. The following informations are not present :\n";}
	
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null)
		{
		email2 = false;
		}
		else
		{
		email2 = true;
		}
	
	if (!titre)
		{
		if(lang=="fr"){Msg=Msg+"- Titre\n";}
		if(lang=="en"){Msg=Msg+"- Title\n";}
		}
	
	if (!nom)
		{
		if(lang=="fr"){Msg=Msg+"- Nom\n";}
		if(lang=="en"){Msg=Msg+"- Name\n";}
		}
		
	if (!prenom)
		{
		if(lang=="fr"){Msg=Msg+"- Prénom\n";}
		if(lang=="en"){Msg=Msg+"- First Name\n";}
		}
	
	if (!ad)
		{
		if(lang=="fr"){Msg=Msg+"- Adresse\n";}
		if(lang=="en"){Msg=Msg+"- Address\n";}
		}
		
	if (!cp)
		{
		if(lang=="fr"){Msg=Msg+"- Code postal\n";}
		if(lang=="en"){Msg=Msg+"- ZIP code\n";}
		}
		
	if (!ville)
		{
		if(lang=="fr"){Msg=Msg+"- Ville\n";}
		if(lang=="en"){Msg=Msg+"- Town\n";}
		}
		
	if (!pays)
		{
		if(lang=="fr"){Msg=Msg+"- Pays\n";}
		if(lang=="en"){Msg=Msg+"- Country\n";}
		}
		
	if(pays==46)
		{
		if(!etat)
			{
			if(lang=="fr"){Msg=Msg+"- L'Etat\n";}
			if(lang=="en"){Msg=Msg+"- State\n";}
			}
		}
		else
		{
		etat = true;	
		}
		
	if (!tel)
		{
		if(lang=="fr"){Msg=Msg+"- Téléphone\n";}
		if(lang=="en"){Msg=Msg+"- Phone number\n";}
		}
		
	if (!email)
		{
		Msg=Msg+"- Email\n";
		}
		else
		{
		if(!email2)
			{
			if(lang=="fr"){Msg=Msg+"- Adresse Email incorrecte!\n";}
			if(lang=="en"){Msg=Msg+"- Error in your Email!\n";}
			}
		}
	
	if (!titre || !nom || !prenom || !email2 || !ad || !cp || !ville || !pays ||!etat || !tel) {
		alert(Msg);
		return false;
		}
		else
		return true;
}





//-- Verif champs pour renvoi des identifiants
function f_verif_envoiMDP(){
	lang  = getElt("langue").value;
	email = getElt("mail").value;
	
	if(lang=="fr"){Msg="Le formulaire ne peut pas être validé :\n";}
	if(lang=="en"){Msg="This form can not be sent :\n";}
	
	var email2 = true;
	var verif = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;
	if (verif.exec(email) == null)
		{
		email2 = false;
		}
		else
		{
		email2 = true;
		}
		
	if (!email)
		{
		if(lang=="fr"){Msg=Msg+"- Adresse email absente\n";}
		if(lang=="en"){Msg=Msg+"- Your Email is not present\n";}
		}
		else
		{
		if(!email2)
			{
			if(lang=="fr"){Msg=Msg+"- Adresse Email incorrecte!\n";}
			if(lang=="en"){Msg=Msg+"- Error in your Email!\n";}
			}
		}
		
	if (!email || !email2) {alert(Msg); return false;}else{return true;}
}



//-- Verif Quantité entière PANIER
function f_verif_qte(){
	nb_row= getElt("nb_row").value;
	lang  = getElt("langue").value;
	var verif = /^[0-9]{1,5}$/;
	
	if(lang=="fr"){Msg="Merci d'insérer des quantités entières !\n";}
	if(lang=="en"){Msg="Thanks to insert whole quantities !\n";}
	
	cond = true;
	for(j=0;j<nb_row;j++)
		{
		if( verif.exec(getElt("qte"+j).value) == null )
			{
			cond = false;
			}
		}
		
	if( cond==false ){alert(Msg);return false;}else{return true;}
}
