// JavaScript Document

// JavaScript Document

//produits peaux sèches
//-------------------------------------------------------------------------
produitsPeauxSeches = new Array();
produitsPeauxSeches[0] = 'Huile G&eacute;lifi&eacute;e<br>D&eacute;maquillante<br>Visage et Yeux';
produitsPeauxSeches[1] = 'Huile<br>pr&eacute;cieuse';
produitsPeauxSeches[2] = 'Soin Nuit<br/>Nutri-Actif';
produitsPeauxSeches[3] = 'Baume l&egrave;vres<br>Douceur<br>Nutri-r&eacute;parateur';
produitsPeauxSeches[4] = 'Masque<br/>Nutri-Intensif';
produitsPeauxSeches[5] = 'Nutrition<br/>et Fermet&eacute;';
produitsPeauxSeches[6] = 'Cr&egrave;me<br/>Soyeuse Mains<br/>et Ongles';
produitsPeauxSeches[7] = 'Huile S&egrave;che<br/>R&eacute;g&eacute;n&eacute;rante<br/>Corps';
produitsPeauxSeches[8] = 'Cr&egrave;me Lact&eacute;e<br>Nutri-r&eacute;paratrice<br>Corps';
produitsPeauxSeches[9] = 'Gommage<br>Soyeux<br>au Savon Noir<br>Corps';
produitsPeauxSeches[10] = 'Cr&egrave;me Confort R&eacute;paratrice ';
produitsPeauxSeches[11] = 'Emulsion Douceur R&eacute;paratrice';


//produits anti-age
//-------------------------------------------------------------------------
produitsAntiAge = new Array();
produitsAntiAge[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
produitsAntiAge[1] = 'Huile<br />Pr&eacute;cieuse';
produitsAntiAge[2] = 'Soin Tenseur<br/>Redensifiant';
produitsAntiAge[3] = 'Soin Nuit<br/>Nutri-Actif';
produitsAntiAge[4] = 'Soin<br/>Yeux-L&egrave;vres<br/>Redensifiant';
produitsAntiAge[5] = 'Masque<br/>Nutri-Intensif';
produitsAntiAge[6] = 'Huile S&egrave;che<br/>R&eacute;g&eacute;n&eacute;rante<br/>Corps';
produitsAntiAge[7] = 'Cr&egrave;me<br/>Soyeuse Mains<br/>et Ongles';
produitsAntiAge[8] = 'Nutrition<br/>et Fermet&eacute;';


//produits anti-rides
//-------------------------------------------------------------------------
produitsAntiRides = new Array();
produitsAntiRides[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
//produitsAntiRides[1] = 'S&eacute;rum Antirides<br/>R&eacute;parateur';
produitsAntiRides[1] = 'Elixir<br/>Jeunesse';
produitsAntiRides[2] = 'Cr&egrave;me';
produitsAntiRides[3] = 'Soin Nuit';
produitsAntiRides[4] = 'Soin Yeux<br/>Antirides';
produitsAntiRides[5] = 'Masque<br/>Antirides<br/>Rajeunissant';
produitsAntiRides[6] = 'Patchs Antirides<br/>Lissants Contour<br/>des Yeux';
produitsAntiRides[7] = 'Emulsion';
produitsAntiRides[8] = 'Cr&egrave;me<br/>SPF15';
produitsAntiRides[9] = 'Elixir de Jeunesse';


//produits &eacute;nergie
//-------------------------------------------------------------------------
produitsEnergie = new Array();
produitsEnergie[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
produitsEnergie[1] = 'Elixir Lissant Peau Neuve<br/>Suractivateur d\'&eacute;clat';
produitsEnergie[2] = 'Cr&egrave;me L&eacute;g&egrave;re<br/>Hydra-Energisante<br/>SPF 15';
produitsEnergie[3] = 'Cr&egrave;me Velours<br/>Hydra-Energisante<br/>SPF 15';
produitsEnergie[4] = 'Soin Yeux Fraîcheur<br/>D&eacute;fatigant';

			
//produits anti-taches
//-------------------------------------------------------------------------
produitsAntiTaches = new Array();
produitsAntiTaches[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
produitsAntiTaches[1] = 'S&eacute;rum &Eacute;claircissant<br/>Intensif';
produitsAntiTaches[2] = 'Cr&egrave;me Protection<br>Anti-Taches SPF 15';
produitsAntiTaches[3] = 'Concentr&eacute; Correcteur<br/>Anti-Taches';


//produits hydratation (AQUAPULPE)
//-------------------------------------------------------------------------
produitsHydratation = new Array();
produitsHydratation[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
produitsHydratation[1] = 'Elixir<br>Hydratant<br/>Intensif';
produitsHydratation[2] = 'Gel-Cr&egrave;me<br>Sorbet<br>Hydratant';
produitsHydratation[3] = 'Cr&egrave;me<br>Sorbet<br>Hydratante';
produitsHydratation[4] = 'Soin<br>Hydra-D&eacute;fense<br>SPF15';
produitsHydratation[5] = 'Masque<br/>R&eacute;hydratant<br/>Express';


//produits peaux grasses
//-------------------------------------------------------------------------
produitsPeauxGrasses = new Array();
produitsPeauxGrasses[0] = '&agrave; l\'eau distill&eacute;e<br/>de m&eacute;lilot';
produitsPeauxGrasses[1] = 'Gel Nettoyant<br/>Assainissant';
produitsPeauxGrasses[2] = 'Lotion<br/>Astringente';
//produitsPeauxGrasses[3] = 'Gel-Cr&egrave;me<br/>R&eacute;&eacute;quilibrant';
produitsPeauxGrasses[4] = 'Concentr&eacute;<br/>Perfecteur<br/>Assainissant';
produitsPeauxGrasses[5] = 'Masque<br/>Clarifiant<br/>3 en 1';
produitsPeauxGrasses[6] = 'Soin<br/>Assainissant<br/>R&eacute;novateur';
produitsPeauxGrasses[7] = 'Gel-Cr&egrave;me<br/>Hydra-Matifiant';


//produits d&eacute;maquillage
//-------------------------------------------------------------------------
produitsDemaquillage = new Array();
produitsDemaquillage[0] = 'Gel Nettoyant<br/>Moussant';
produitsDemaquillage[1] = 'Mousse<br/>Nettoyante<br/>D&eacute;maquillante';
produitsDemaquillage[2] = 'Lait<br/>D&eacute;maquillant';
produitsDemaquillage[3] = 'Eau<br/>D&eacute;maquillante<br/>Micellaire';
produitsDemaquillage[4] = '2 en 1<br/>D&eacute;maquillant';
produitsDemaquillage[5] = 'Lotion<br/>Tonique';
produitsDemaquillage[6] = 'D&eacute;maquillant<br/>Yeux';
produitsDemaquillage[7] = 'Gel&eacute;e Exfoliante';


//produits solaire1
//-------------------------------------------------------------------------
produitsSolaires1 = new Array();
produitsSolaires1[0] = 'Compl&eacute;ment<br/>Alimentaire';
produitsSolaires1[1] = 'Cr&egrave;me L&eacute;g&egrave;re Visage<br/>SPF50 +';
produitsSolaires1[2] = 'Beaume R&eacute;parateur<br/>Apr&egrave;s Soleil';
produitsSolaires1[3] = 'Lait Velout&eacute;<br/>Apr&egrave;s Soleil';
produitsSolaires1[4] = 'Gel Douche<br/>Apr&egrave;s Soleil';
produitsSolaires1[5] = 'Gel&eacute;e L&eacute;g&egrave;re<br/>Autobronzante';
produitsSolaires1[6] = 'Gel Cr&egrave;me Fraîcheur <br/>Anti-âge Apr&egrave;s Soleil';



mentionSolaire = 'A votre convenance';			

//produits solaire2
//-------------------------------------------------------------------------
produitsSolaires2 = new Array();
produitsSolaires2[0] = 'Compl&eacute;ment<br/>Alimentaire';
produitsSolaires2[1] = 'Spray Ultra l&eacute;ger<br/>SPF 50 ou 30';
produitsSolaires2[2] = 'Baume Stick <br/>Non Gras<br/>SPF 50';
produitsSolaires2[3] = 'Lait velout&eacute;<br/>SPF 50 ou 30';
produitsSolaires2[4] = 'Baume R&eacute;parateur<br/>Apr&egrave;s Soleil';
produitsSolaires2[5] = 'Lait Velout&eacute;<br/>Apr&egrave;s Soleil';
produitsSolaires2[6] = 'Gel Douche<br/>Apr&egrave;s Soleil';
produitsSolaires2[7] = 'Gel&eacute;e L&eacute;g&egrave;re<br/>Autobronzante';
produitsSolaires2[8] = 'Cr&egrave;me L&eacute;g&egrave;re<br/>SPF 30';
produitsSolaires2[9] = 'Fluide non Gras<br/> SPF30';
produitsSolaires2[10] ='Compact Teint&eacute;<br/>Eclat SPF 30';


//produits solaire3
//-------------------------------------------------------------------------
produitsSolaires3 = new Array();
produitsSolaires3[0] = 'Compl&eacute;ment<br/>Alimentaire';
produitsSolaires3[1] = 'Spray Ultra-L&eacute;ger Moyenne<br/>SPF 20';
produitsSolaires3[2] = 'Cr&egrave;me L&eacute;g&egrave;re <br/>SPF 20';
produitsSolaires3[3] = 'Lait velout&eacute;<br/>SPF 20';
produitsSolaires3[4] = 'Baume R&eacute;parateur<br/>Apr&egrave;s Soleil';
produitsSolaires3[5] = 'Lait Velout&eacute;<br/>Apr&egrave;s Soleil';
produitsSolaires3[6] = 'Gel Douche<br/>Apr&egrave;s Soleil';
produitsSolaires3[7] = 'Gel&eacute;e L&eacute;g&egrave;re<br/>Autobronzante';
produitsSolaires3[8] = 'Gel&eacute;e Fondante<br/>SPF 15';
produitsSolaires3[9] = 'Huile S&egrave;che Soyeuse<br> SPF 15';
produitsSolaires3[10] = 'Fluide Fraîcheur SPF 20';
	
//produits solaire4
//-------------------------------------------------------------------------
produitsSolaires4 = new Array();
produitsSolaires4[0] = 'Compl&eacute;ment<br/>Alimentaire';
produitsSolaires4[1] = 'Spray Ultra-L&eacute;ger<br/>SPF 10';
produitsSolaires4[2] = 'Gel Cr&egrave;me Fraîcheur<br/>Anti-âge Apr&egrave;s Soleil';
produitsSolaires4[3] = 'Lait Velout&eacute;<br/>Apr&egrave;s Soleil';
produitsSolaires4[4] = 'Baume R&eacute;parateur<br/>Apr&egrave;s Soleil';
produitsSolaires4[5] = 'Gel Douche<br/>Apr&egrave;s Soleil';
produitsSolaires4[6] = 'Gel&eacute;e L&eacute;g&egrave;re<br/>Autobronzante';
	
			
			
			
function removeAlt() {

	for ( var i = 0; i< document.images.length; i++ ) 
	{
	
		if ( typeof( document.images[i].alt ) == 'string' ) {
		
		document.images[i].alt = "";
		
		}
	
		if ( typeof( document.images[i].title ) == 'string' ) {
		
		document.images[i].title = "";
		
		}
	
	}

}

function openMenu(id){
	
	//sous menu
    if((id.toString()).indexOf(".") != -1 ){
		
		var cut = (id.toString()).split(".");
		var menu = cut[0];
		var smenu = cut[1];
		
		for(j=1; j<3;j++){	
		
			document.getElementById('sMenu' + menu + '.' + j).style.display = 'none';
		
		}
		
		document.getElementById('sousMenu3').style.display = 'block';
		
	    document.getElementById('sMenu' + menu).style.display = 'block';
		document.getElementById('sMenu' + id).style.display = 'block';
		document.getElementById('rub' + menu).className = 'rub'+menu+'On';
		document.getElementById('sRub' + id).className = 'menuItemClick';
	
	}
	
	//menu simple
	else{
		
		if(id==3){
			document.getElementById('sousMenu3').style.display = 'block';
		}
		
		
		document.getElementById('sMenu' + id).style.display = 'block';
		document.getElementById('rub' + id).className = 'rub'+id+'On';
	}
}

function closeMenu(id){
	
	document.getElementById( 'sMenu' + id ).style.display = 'none';
	document.getElementById('sousMenu3').style.display = 'none';
	
	if((id.toString()).indexOf(".") == -1 ){
				
		document.getElementById('rub'+id).className = 'rub'+id;	
		
	}
	else{
		
		document.getElementById('sRub' + id).className = 'menuItem';
		
		
	}
	
	for(i= 1; i < 7 ; i++){
			
		if(i != 4){
			
			document.getElementById( 'sMenu' + i ).style.display = 'none';
		}
	}
}


function ongletInit(){
	window.document.getElementById( "onglet1_txt" ).style.display = "block";
	if ( window.document.getElementById( "onglet2_img" ) != null ){
	window.document.getElementById( "onglet2_txt" ).style.display = "none";
	}
	window.document.getElementById( "onglet3_txt" ).style.display = "none";
	if ( window.document.getElementById( "onglet4_img" ) != null ){
		window.document.getElementById( "onglet4_txt" ).style.display = "none";
	}	
}

function onglet( id, type )
{
	
	

		bt = window.document.getElementById( id + "_img" );
		txt = window.document.getElementById( id + "_txt" );
		
		
		
	
			if ( type == "out" ){
				if ( txt.style.display == "none" || txt.style.display == "undefined" || txt.style.display == "" ){
				
					bt.style.visibility = 'hidden';
				
				}
				
			}else if ( type == "over" ){
				
				bt.style.visibility = 'visible';
				
			}	
	  
	

}

function ongletClick ( id ) {

	bt = window.document.getElementById( id + "_img" );
	txt = window.document.getElementById( id + "_txt" );

	window.document.getElementById( "onglet1_img" ).style.visibility = "hidden";
	
	if ( window.document.getElementById( "onglet2_img" ) != null ){
	window.document.getElementById( "onglet2_img" ).style.visibility = "hidden";
	}
	window.document.getElementById( "onglet3_img" ).style.visibility = "hidden";
	
	if ( window.document.getElementById( "onglet4_img" ) != null ){
		window.document.getElementById( "onglet4_img" ).style.visibility = "hidden";
	}
	
	window.document.getElementById( "onglet1_txt" ).style.display = "none";
	
	
	if ( window.document.getElementById( "onglet2_img" ) != null ){
		window.document.getElementById( "onglet2_txt" ).style.display = "none";
	}
	
	window.document.getElementById( "onglet3_txt" ).style.display = "none";
	
	if ( window.document.getElementById( "onglet4_img" ) != null ){
		window.document.getElementById( "onglet4_txt" ).style.display = "none";
	}
		
	bt.style.visibility = "visible";
	txt.style.display = "block";

}

function navGammeSolaire(id){


	 for(i=1; i<5; i++){
		
		document.getElementById('page' + i).style.display = 'none';  
	
	 }
	   
	document.getElementById('page' + id).style.display = 'block';  
}


// -------------------- Contacts --------------

function visible( obj, v ) {
	obj.style.display = ( v ) ? 'block' : 'none';
}

function checkChars( str_length, max_chars ) {
	return max_chars - str_length;
}

function charsChecker( obj, alertObj, max_chars )
{
	obj.onblur = obj.onkeyup = function()
	{
		var n = checkChars( this.value.length, max_chars );
		
		if ( n < 0 ) {
			alertObj.innerHTML = 'Please remove ' + (-n) + ' chars from your text field.';
		}
		else {
			alertObj.innerHTML = n;
		}
	};
	
	obj.onblur();
}

function isValidEmail( $str )
{ 
	var $isValid = true;
	
	$str = $str + '';
	
	//
	if ($str.indexOf("@") == -1) {
		$isValid = false;
	}
	// 
	var $array = new Array();
	$array = $str.split("@");
	//
	if ( $array.length != 2 )
	{
		$isValid = false;
		return $isValid;
	}
	
	if ($array[0] == "") {
		$isValid = false;
	}
	if ($array[1].indexOf(".") == -1) {
		$isValid = false;
	}
	// 
	var $array2 = new Array();
	$array2 = $array[1].split(".");
	//
	if ($array2[0] == "") {
		$isValid = false;
	}
	if ($array2[1] == "") {
		$isValid = false;
	}
	// 
	return $isValid;
}

function isValidZipCode( str )
{
	var isValid = true;
	
	str = str + '';
	
	
	if(str == '')
	{
		isValid = false;
	}
	/*
	if ( str.substr(0,1) == '0' )
	{  
		if ( isNaN( str.substr(1,4) ) ) {
			isValid = false; 
		}
		else
		{
			if ( str.substr(1,4) == '0000' ) {
				isValid = false; 
			}
		}
	}
	else
	{  
		if ( isNaN( str ) ) { 
			isValid = false;
		}
	}
	
	if ( str.length != 5 ) { 
		isValid = false; 
	}
	*/
	return isValid;
}

function isValidPhone($str)
{

	
	var $isValid = true;
	
	$str = $str + '';
	var $prefix = $str.substr(0,2); 
	
	if ( $prefix != "01" && $prefix != "02" && $prefix != "03" && $prefix != "04" && $prefix != "05" && $prefix != "08" && $prefix != "09") {
		$isValid = false;  
	}
	if ($str.length != 10) { 
		$isValid = false;
	}
	
	return $isValid;
}

function isValidMobile( $str )
{
	
	
	var $isValid = true;
	
	$str = $str + '';
	
	var $prefix = $str.substr(0,2); 
	
	
	if ($prefix != "06") {
		$isValid = false;
	}
	if ($str.length != 10) {
		$isValid = false;
	}
	
	return $isValid;
}

function formatDate( str, separator )
{
	var _ = str;
	
	var _split = str.split( separator );
	
	var s_jj = new String( _split[0] );
	var s_mm = new String( _split[1] );
	var s_aaaa = new String( _split[2] );
	
	var jj = new Number( s_jj );
	var mm = new Number( s_mm );
	
	if ( jj < 10 ) { 
		s_jj = '0' + jj;
	}
	
	if ( mm < 10 ) { 
		s_mm = '0' + mm;
	}
	
	_ = s_jj + separator + s_mm + separator + s_aaaa;
	
	return _;
}

function isValidDate( str, separator )
{
	var $isValid = true;
	
	str = str + '';
	str = formatDate( str, separator );
	
	var _split = str.split( separator );
	
	if ( _split.length != 3 ) {
		$isValid = false;
	}
	else
	{
		if ( (_split[0].length == 2) && (_split[1].length == 2) && (_split[2].length == 4) )
		{
			if ( isNaN( new String(_split[0]) ) || isNaN( new String(_split[1]) ) || isNaN( new String(_split[2]) ) )
			{
				$isValid = false;
			}
			else
			{
				var c1 = new Number( new String(_split[0]) );
				var c2 = new Number( new String(_split[1]) );
				var c3 = new Number( new String(_split[2]) );
				
				if ( c1 > 31 || c2 > 12 ) {
					$isValid = false;
				}
				else 
				{
					var _date = new Date();
				
					_date.setYear( c3 );
					_date.setMonth( c2 - 1 );
					_date.setDate( c1 );
					
					var test_jj = ( _date.getDate() < 10 ) ? '0' + _date.getDate() : _date.getDate();
					var test_mm = ( (_date.getMonth() + 1) < 10 ) ? '0' + (_date.getMonth() + 1) : (_date.getMonth() + 1);
					
					var test_date = test_jj + separator + test_mm + separator + _date.getFullYear();
					
					if ( test_date != str ) {
						$isValid = false;
					}
				}
			}
		}
		else
		{
			$isValid = false;
		}
	}
	
	return $isValid;
}

function checkForm( objs )
{	
	for ( var i = 0; i < objs.length; i++ )
	{ 
		
		if ( objs[i].type == 'text' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( (objs[i].elt.value.length < 1) || (objs[i].elt.value.length > objs[i]._max) ) 
			{	
				if ( !optional ) 
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
			
			if ( typeof( objs[i]._min ) != 'undefined' )
			{
				if ( objs[i].elt.value.length < objs[i]._min )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
			}
		}
		else if ( objs[i].type == 'checkbox' )
		{
			var n = 0;
			
			for ( var ii = 0; ii < objs[i].elt.length; ii++ )
			{
				if ( objs[i].elt[ii].checked ) {
					n++;
				}
			}
			
			objs[i]._min = ( typeof( objs[i]._min ) == 'undefined' ) ? 0 : objs[i]._min;
			objs[i]._max = ( typeof( objs[i]._max ) == 'undefined' ) ? objs[i].elt.length : objs[i]._max;
			
			if ( (n < objs[i]._min) || (n > objs[i]._max) )
			{
				if ( typeof( objs[i].callback ) != 'undefined' ) {
					objs[i].callback( objs[i] );
				}
				else {
					alert( objs[i].msg );
				}
				
				return false;
			}
		}
		else if ( objs[i].type == 'mail' )
		{ 
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidEmail( objs[i].elt.value ) )
			{
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
		}
		else if ( objs[i].type == 'zipcode' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidZipCode( objs[i].elt.value ) )
			{
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
		}
		else if ( (objs[i].type == 'phone') || (objs[i].type == 'mobile') )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidPhone( objs[i].elt.value ) && !isValidMobile( objs[i].elt.value ) )
			{ 
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {  
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 ) 
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
						
						return false;
					}
				}
			}
		}
		else if ( objs[i].type == 'date' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidDate( objs[i].elt.value, '/' ) )
			{ 
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
						
						return false;
					}
				}
			}
		}
		else if ( objs[i].type == 'noZero' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !optional )
			{
				if ( objs[i].elt.value == '0' )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {  
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
			}
		}else if ( objs[i].type == 'pays' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( objs[i].elt.value == 0 )
			{ 
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
			}
		}
	}
	
	return true;
}



function checkForm2( objs )
{
	for ( var i = 0; i < objs.length; i++ )
	{ 
		if ( objs[i].type == 'text' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( (objs[i].elt.value.length < 1) || (objs[i].elt.value.length > objs[i]._max) ) 
			{	
				if ( !optional ) 
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
			
			if ( typeof( objs[i]._min ) != 'undefined' )
			{
				if ( objs[i].elt.value.length < objs[i]._min )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
			}
		}
		else if ( objs[i].type == 'checkbox' )
		{
			var n = 0;
			
			for ( var ii = 0; ii < objs[i].elt.length; ii++ )
			{
				if ( objs[i].elt[ii].checked ) {
					n++;
				}
			}
			
			objs[i]._min = ( typeof( objs[i]._min ) == 'undefined' ) ? 0 : objs[i]._min;
			objs[i]._max = ( typeof( objs[i]._max ) == 'undefined' ) ? objs[i].elt.length : objs[i]._max;
			
			if ( (n < objs[i]._min) || (n > objs[i]._max) )
			{
				if ( typeof( objs[i].callback ) != 'undefined' ) {
					objs[i].callback( objs[i] );
				}
				else {
					alert( objs[i].msg );
				}
				
				return false;
			}
		}
		else if ( objs[i].type == 'mail' )
		{ 
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidEmail( objs[i].elt.value ) )
			{
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
		}
		
		else if ( objs[i].type == 'zipcode' )
		{
			
			
			
			if(objs[i].elt.value == '' || objs[i].elt.value == 'undefined '){
				return false;
			}
			
			
			/*var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidZipCode( objs[i].elt.value ) )
			{
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
					
						return false;
					}
				}
			}
			*/
		}
		
		else if ( (objs[i].type == 'phone') || (objs[i].type == 'mobile') )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidPhone( objs[i].elt.value ) && !isValidMobile( objs[i].elt.value ) )
			{ 
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {  
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 ) 
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
						
						return false;
					}
				}
			}
		}
		else if ( objs[i].type == 'date' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !isValidDate( objs[i].elt.value, '/' ) )
			{ 
				if ( !optional )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
				else
				{
					if ( objs[i].elt.value.length > 0 )
					{
						if ( typeof( objs[i].callback ) != 'undefined' ) {  
							objs[i].callback( objs[i] );
						}
						else {
							alert( objs[i].msg );
						}
						
						return false;
					}
				}
			}
		}
		else if ( objs[i].type == 'noZero' )
		{
			var optional = false;
			
			if ( typeof( objs[i].optional ) != 'undefined' ) {
				optional = objs[i].optional;
			}
			
			if ( !optional )
			{
				if ( objs[i].elt.value == '0' )
				{
					if ( typeof( objs[i].callback ) != 'undefined' ) {  
						objs[i].callback( objs[i] );
					}
					else {
						alert( objs[i].msg );
					}
					
					return false;
				}
			}
		}
	}
	
	return true;
}



var intV = 0;

function hideMsg( obj )
{
	clearInterval( intV );
	
	visible( obj, false );
}

function affichMsg( container, box, msg )
{
	visible( container, true );
	
	var winY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
	
	container.style.top = winY + 'px'; 
	box.innerHTML = msg;	
	
	hideMsg_str = 'hideMsg(' + container.id + ')';
	
	intV = setInterval( hideMsg_str, 3000 );
}

function restoreClass( id )
{ 	
	window.document.getElementById('erreur').innerHTML = '';
	
	clearInterval( intV );
	window.document.getElementById( id ).className = 'textField';
}

function highLighted( obj )
{
	window.document.getElementById('erreur').innerHTML = obj.msg;
	
	//obj.elt.className = 'hightLForm'; 
	//intV = setInterval( ('restoreClass(\'' + obj.elt.id + '\')'), 3000 );
}

function similarStr( str1, str2 ) {
	//alert('str1:' + str1 + "str2:"+ str2);
	return (str1 === str2);
}

function checkEmailSim()
{
	var v = similarStr( window.document.getElementById('email').value, window.document.getElementById('confemail').value );
	
	if ( !v ) {
		highLighted( {elt:window.document.getElementById('confemail'),msg:'Vos deux adresses e-mail ne sont pas similaires.'} );
	}
	
	return v;
}

function checkMPSim()
{
	var v = similarStr( window.document.getElementById('mp').value, window.document.getElementById('confmp').value );
	
	if ( !v ) {
		highLighted( {elt:window.document.getElementById('confmp'),msg:'Vos deux adresses e-mail ne sont pas similaires.'} );
	}
	
	return v;
}

/******************************************************** POPUPS ******************************************************/
function getBrowserCodeName()
{
	var name = null;
	
	if ( document.getElementById && !document.all )
	{
		name = 'NS6';
	}
	else if ( document.all )
	{
		name = 'IE';
	}
	else if ( navigator.appName == 'Netscape' && navigator.appVersion.charAt( 0 ) == '4' )
	{
		name = 'NS';
	}
	else if ( navigator.userAgent.indexOf( 'Mac' ) != -1 )
	{
		name = 'MAC';
	}
	
	return name;
}


function detectIE6(){
	var IE6 = false

	var strChUserAgent = navigator.userAgent;
	var intSplitStart = strChUserAgent.indexOf("(",0);
	var intSplitEnd = strChUserAgent.indexOf(")",0);
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);

	if(strChMid.indexOf("MSIE 6") != -1) IE6 = true;

	return IE6;
}



function getScrollY() {
  scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}


function affichPopup( nom ){
	/*Sous IE6 on masque les listes de formulaires*/
	if ( detectIE6() ){
		
		tags = document.getElementsByTagName( "select" );
	
		for( i=0; i<tags.length; i++ ){
				tags.item( i ).style.visibility = "hidden";
			}
	
	}
		
	maskPage();
	window.document.getElementById( 'mask_page' ).style.display = "block";	
	

	window.document.getElementById( nom ).style.display = "block";
	
}

function closePopup( nom ){
	
	/*Sous IE6 on masque les listes de formulaires*/
	if ( detectIE6() ){
		
		tags = document.getElementsByTagName( "select" );
	
		for( i=0; i<tags.length; i++ ){
				tags.item( i ).style.visibility = "visible";
			}
	
	}
	
	window.document.getElementById( 'mask_page' ).style.display = "none";
	
	window.document.getElementById( nom ).style.display = "none";
	
}


//Init des positions du masque
function maskPage()
{
	var obj = document.getElementById('mask_page').style;
	
	//var winY = document.documentElement.scrollTop;
	var winY = getScrollY();
	var winL = 1024;
	//var winH = document.documentElement.clientHeight;
	var winH = "";
	if ( window.innerHeight ) winH = window.innerHeight;
	if ( document.documentElement ) winH = document.documentElement.clientHeight;
	if ( document.body ) winH = document.body.clientHeight;
	
	if ( getBrowserCodeName() == 'IE' )
	{ 
		obj.width = winL;
		obj.height = winH + winY;
	}
	else if ( getBrowserCodeName() == 'NS6' || getBrowserCodeName() == 'NS' )
	{
		obj.width = winL + 'px';
		obj.height = ( winH + winY ) + 'px';
	}
}


