/*mise en place des evenements de la page */

function joinEvents()
	{
	document.getElementById("address_form").onsubmit = function(){ 
		var form=document.getElementById("address_form");
		if(form.year && form.month && form.day && form.year.value != '' && form.month.value != '' && form.day.value !=''){
				if(form.day.value<10 && form.month.value<10)
					form.demographicField5.value=form.year.value+"/0"+form.month.value+"/0"+form.day.value;	
				else if(form.day.value<10)	
					form.demographicField5.value=form.year.value+"/"+form.month.value+"/0"+form.day.value;	
				else if(form.month.value<10)	
					form.demographicField5.value=form.year.value+"/0"+form.month.value+"/"+form.day.value;	
				else 
					form.demographicField5.value=form.year.value+"/"+form.month.value+"/"+form.day.value;		
			}
			if( document.getElementById("clarinsaccount") && document.getElementById("area") && form.area.value != '' && form.clarinsaccount.value != '' ){
				form.userField2.value = form.area.value+"///"+form.clarinsaccount.value;	
			}
		
		return testSubmit();}
	
		if(document.getElementById("storeId") && document.getElementById("langId")){
		var strId=parseInt(document.getElementById("storeId").value);
		var langId=parseInt(document.getElementById("langId").value);
	}	else{
		var strId=10051;
		var langId=-1;	
		}	
	/* japanese version : désactivation de la requete ajax : TEMPORAIREMENT !!! */
	affichDetail('ClarinsErrorMessagesView?storeId='+strId+'&langId='+langId,'error_messages');
	
	if(document.getElementById("area") && document.getElementById("clarinsaccount"))
		{
		document.getElementById("area").onchange = function(){changeSelect("area","clarinsaccount_container",'ClarinsUpdateCounterAreaView?storeId='+strId+'&langId='+langId+'&area=');}
		}
	
}
/*fin de la mise en place de evenements de la page*/

addEvent(window, "load", joinEvents);

function testSubmit()
	{
	messageAlert = "";
	controlMandatory();
	allFullSize("firstname"); //firstname full kanji+full katakana+full latin + no numbers
	allFullSize("lastname"); //firstname full kanji+full katakana+full latin + no numbers
	KanaFullCheck("firstname2"); //only full katakana
	KanaFullCheck("lastname2"); //only full katakana
	if(! isEmpty(trim(document.getElementById("zip").value)))
		numZipHalfCHeck("zip"); // control Zip
	if(! isEmpty(trim(document.getElementById("phone").value)))
		numPhoneHalfCHeck("phone"); // control phone
	if(! isEmpty(trim(document.getElementById("address_line_1").value)))
		{
			allFullSize("address_line_1"); // control address1 only all full width
		}
	if(! isEmpty(trim(document.getElementById("address_line_2").value)))
		{
			allFullSize("address_line_2"); // control address2 only all full width
		}
	validateDate("day","month","year"); // control validation date
	controlEquivalence("email", "email_confirm"); // control equivalence champ mail
	if(! isEmpty(trim(document.getElementById("email").value)))
		mailHalfCheck("email"); // control mail only half
	controlEquivalence("password", "password_confirm"); // control equivalence champ password
	controlPass("password") ; // control password > 6
	controlCity("state") ; // control choix city
	controlClarinsAccount("area","clarinsaccount") ;
	if(document.getElementById("privacypolice"))
		controlPrivacyPolice("privacypolice") ; // privacyPolice is checked
	return validSubmit();
	
	}
