	    /*function Require(obForm,vFields){
		            var fields = vFields.split(",");
		            var vMissing= new Array();
		            for(x=0;x<fields.length;x++)
		               {
		               if(obForm.elements[fields[x]].value.length==0)
		                    {vMissing[vMissing.length]=new String(fields[x]);}
		               }
		            if(vMissing.length)
		              {
		              alert("The field"+((vMissing.length>1)?"s ":" ")+vMissing.join(",")+" must be filled in first");
		              return false
		              }
		            return true;
		            }
*/

function Require(obForm,vFields)
{ 
		            var fields = vFields.split(",");
		            var vMissing= new Array();
					for(x=0;x<fields.length;x++)
		               {	
						if( fields[x]=="age" || fields[x]=="country")
						{
							if (obForm.elements[fields[x]].value == "" || obForm.elements[fields[x]].value == -1)
							{
								vMissing[vMissing.length] = x;
							}	
						}
						else						
						if(obForm.elements[fields[x]].value.length==0)
		                    {
								//alert("The field "+fields[x]+" must be completed");	
							
								vMissing[vMissing.length] = x ;
							}
							/*
							if (obForm.elements[fields[x]].value == "-1" )
							{
								vMissing[vMissing.length] = x;
							}*/	
						
		               }
					if(vMissing.length>0)
		              {
		            //  alert("The field"+((vMissing.length>1)?"s ":" ")+vMissing.join(",")+" must be filled in first");
							ErrorMsg = "";
	
							for( var i=0; i<vMissing.length; i++ ){
								if( error_array[ vMissing[i] ] )
									ErrorMsg += error_array[vMissing[i] ] + "\n";
							}
														
							if(ErrorMsg!="") 
							{
								alert(ErrorMsg );
								return false;
							}
		              }
		            return true;
}

function submitTheFormFreesample(form)
{ 
	var radioLength = document.subscribe.prod.length;
	var v = 0;
	
	for(var i = 0; i < radioLength; i++) 
	{
		if(document.subscribe.prod[i].checked) 
		{
			v += 1;
		}
	}
	
	/*if ( v==0)
	{
		alert("Aucun des échantillons gratuits n'a été sélectionné. Merci de choisir un échantillon gratuit!");
	}
	else*/
	{
		var radioLength = document.subscribe.opt_online.length;
		var off = 0;
		var on = 0;
		var on_off = 0;
		
		for(var i = 0; i < radioLength; i++) 
		{ /*
			if(document.subscribe.opt_offline[i].checked) 
			{
				off += 1;
			} */
			if(document.subscribe.opt_online[i].checked) 
			{
				on += 1;
			}
			if(document.subscribe.opt_onoff[i].checked) 
			{
				on_off += 1;
			}
			
		}
		/*
		if (off == 0)
		{
			alert("Please indicate if you would like to receive free product samples from Envive and other  Procter & Gamble Feminine Care brands.");
		}
		else */
			if ( (on == 0) || (on_off == 0) )
			{
				alert("Merci d'indiquer si vous souhaiteriez recevoir les dernières informations en ligne et des échantillons d'autres marques Procter & Gamble?");
			}
			else				
				{
					
					if ( (document.subscribe.email.value!='') && !ValidEmail(document.subscribe.email.value) )
					{
						alert('Merci d\'entrer une adresse email valide!');
					}
					else
					{					
						if ( document.subscribe.country.value == "roi")
						{
							if ( checkDateDiv() &&  Require(form, 'email,fname,lname,address,city,country') )
							document.subscribe.submit();
						}
						else
						{
							if ( checkDateDiv() &&  Require(form, 'email,fname,lname,address,city,country,postcode') )
							document.subscribe.submit();
						}
					}
				}
					
	}		
}

function checkDateDiv()
{	
	var myDayStr = document.getElementById("daySelect").value;
	var myMonthStr = document.getElementById("monthSelect").value;
	var myYearStr = document.getElementById("yearSelect").value;
	var myMonth = new Array('January','February','March','April','May','June','July','August','September','October','November','December'); 
	var myDateStr = myDayStr + ' ' + myMonth[myMonthStr-1] + ' ' + myYearStr;

	var myDate = new Date();
	myDate.setFullYear( myYearStr, myMonthStr-1, myDayStr );

	if ( myDayStr!= -1 && myMonthStr!=-1 && myYearStr!=-1 )
	{
	
		if  (myDate.getMonth() != (myMonthStr-1) ) 
		{
			alert( 'Je suis désolée mais la  "' + myDateStr + '" que vous avez saisi n\'est pas valide ' );
			return false;
		} 
		else
		{
			return true;
		}
	}
	else
	{
		alert( 'Merci de sélectionner votre date de naissance!' );
		return false;
	}
}

function EmptyString(s) 
{ 
				var Count; 
				var Nblank = 0; 
				if (s.length == 0) return (true); // empty string 
				// count the number of blank chars 
				for (Count = 0; Count < s.length; Count++) { 
				if (s.charAt(Count) == " ") Nblank++; 
				} 
				if (Nblank == s.length) 
				return (true); 
				else 
				return (false); 
} // end EmptyString

function ValidEmail(s) 
{ 
				var Count; 
				var s2; 
				// empty or blank email 
				if (EmptyString(s) == false) {
					// email without @ 
					if (s.indexOf('@') == -1) return (false); 
					// email with @ as the 1st char 
					if (s.indexOf('@') == 0) return (false); 
					// email with @ as the last char 
					if ((s.indexOf('@')+1) == s.length) return (false); 
					// email without . 
					if (s.indexOf('.') == -1) return (false); 
					// email with . as the 1st char 
					if (s.indexOf('.') == 0) return (false); 
					// email with . as the last char 
					if ((s.indexOf('.')+1) == s.length) return (false); 
					// Now look for the first . after the first @ 
					// s2 = string after the first @ 
					s2=s.substring(s.indexOf('@')+1,s.length); 
					// email without a dot after the first @ 
					if (s2.indexOf('.') == -1) return (false); 
					// email dot right after the first @ 
					if (s2.indexOf('.') == 0) return (false); 
				}
				else
					return false;
				return (true); 
} // end ValidEmail



function check_contact()
{
	$errorMessage = '';
	$errorNumber = 0;
	
	if (document.contactusform.firstname.value == '')
	{
		$errorMessage = $errorMessage + 'Insérez votre prenom\n';
		$errorNumber = $errorNumber+1;
	}
	
	if (document.contactusform.email.value == '')
	{
		$errorMessage = $errorMessage + 'Insérez votre adresse e-mail, svp\n';
		$errorNumber = $errorNumber+1;
	}
	
	if (document.contactusform.message.value == '')
	{
		$errorMessage = $errorMessage + 'Insérez un message, svp\n';
		$errorNumber = $errorNumber+1;
	}
	
	if (document.contactusform.age.value == -1)
	{
		$errorMessage = $errorMessage + 'Insérez votre Âge\n';
		$errorNumber = $errorNumber+1;
	}
	
	if ( $errorNumber == 0)
		document.contactusform.submit();
	else
		alert ($errorMessage);
}

function checkProductSelectorForm()
{
	var found_checked = false;
	for(var i=0; i<4; i++){
		if(document.selectorform.product[i].checked==true)
			found_checked = true;
	}
	if(!found_checked){
		alert('Veuillez sélectionner');
		return false;
	}
	return true;
}