// fonction pour afficher l'adresse de facturation

afficheFacturation = function(){
							var adresse_other = document.getElementById('adresse_other');
							var adresse_self = document.getElementById('adresse_self');
							if (!adresse_other || !adresse_self) return;
							var monDiv = document.getElementById('facturation');
								adresse_other.onclick= function(){	
									monDiv.style.display = 'block';		
								}
								adresse_self.onclick= function(){	
									monDiv.style.display = 'none';		
								}
						}

addEvent(window, "load", afficheFacturation);

	function limite(textarea, max)
{
    if(textarea.value.length >= max)
    {
        textarea.value = textarea.value.substring(0,max);
    }
    var reste = max - textarea.value.length;
    var affichage_reste =  reste + ' caractÃ¨res restants';
    document.getElementById('max_desc').innerHTML = affichage_reste;
}
	

var Functions_2 = {
	Start: function(){
	
		if(document.getElementById('identify')) Functions_2.lostmail_Form();
		if(document.getElementById('identify')) Functions_2.identification_Form();
		if(document.getElementById('newsletter')) Functions_2.Newsletter_Form();
		if(document.getElementById('mail_form')) Functions_2.Mail_Form();
		if(document.getElementById('address_form')) Functions_2.Address_Form();
		if(document.getElementById('order_form') && document.getElementById('page').className == 'checkout-4') Functions_2.Order_Form();
		if(document.getElementById('btn-discount')) Functions_2.Pop_In_Discount();
		if(document.getElementById('search_form')) Functions_2.Search_Form(document.getElementById('search_form'));
	},
	
	Search_Form: function(Form){
		var Error_in_Page = false,
			Error_Message = 'The form isn\'t correctly filled in \n',
			Chp_Area_Code = document.getElementById('area_code'),
			Chp_Post_Code = document.getElementById('post_code'),
			storetype = document.getElementById('storetype');
		
		Form.onsubmit = function(){
			// refine search : if completed, no error
			if(storetype && storetype.value) {return true;}
			
			if(Chp_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chp_Area_Code.value)){
				Error_in_Page = true;
				Error_Message += '- Area Code : invalid format \n';
				Field_in_Red(Chp_Area_Code);
			}else{
				Gray_Field(Chp_Area_Code);
			}
			
			if(Chp_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chp_Post_Code.value)){
				Error_in_Page = true;
				Error_Message += '- Post Code : invalid format \n';
				Field_in_Red(Chp_Post_Code);
			}else{
				Gray_Field(Chp_Post_Code);
			}
			
			if(Chp_Area_Code.value == '' || Chp_Post_Code.value == '') {
				Error_in_Page = true;
				Error_Message += '- Post Code : Mandatory Field \n';
			}
			if(Chp_Area_Code.value == '') {Field_in_Red(Chp_Area_Code);}
			if(Chp_Post_Code.value == '') {Field_in_Red(Chp_Post_Code);}
			
			if(Error_in_Page == true){
				alert(Error_Message);
				Error_Message = 'The form isn\'t correctly filled in \n';
				Error_in_Page = false;
				return false;
			}else{
				return true;
			}
		};
		
		function Field_in_Red(obj){obj.style.border = '1px solid red';}
		function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
	},
	
	Pop_In_Discount: function(){
		document.getElementById('btn-discount').onclick = function(){
			if(window.pageYOffset){document.getElementById('messagesent').style.top = (250+window.pageYOffset) + 'px';}
			else{document.getElementById('messagesent').style.top = (250+document.documentElement.scrollTop) + 'px';}
			
			document.getElementById('messagesent').style.display = 'block';
			return false;
		}
	},
	
	Newsletter_Form: function() {
		var Email = document.getElementById('newsletter');
		
		Email.form.onsubmit = function() {
			var Form_Error = false,
				Error_Msg = 'Address email \n';
			
			if(Email.value == ''){
				Form_Error = true;
				Error_Msg += '- Email: Mandatory Field \n';
				Red_Field(Email);
			}else{
				var email = Email.value.toLowerCase(); 
					if (email.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
					{
					Form_Error = true;
					Error_Msg += 'Invalid email \n';
					Red_Field(Email);
				}else
				Gray_Field(Email);
			}
				
			if(Form_Error == true){alert(Error_Msg);return false;}
			else{return true;}
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		};
	},
	
	identification_Form: function() {
		var Email = document.getElementById('email');
		var Password = document.getElementById('password');
		
		Email.form.onsubmit = function() {
			var Form_Error = false,
				Error_Msg = 'Erreur(s) : \n \n';
			
			if(Email.value == ''){
				Form_Error = true;
				Error_Msg += '- Adresse Email: Champ Ã  remplir obligatoirement \n';
				Red_Field(Email);
			}else{
				if (Email.value.indexOf("@") == -1 || Email.value.indexOf(".") == -1){
					Form_Error = true;
					Error_Msg += 'L\'email saisi est invalide \n';
					Red_Field(Email);
				}else
				Gray_Field(Email);
			}
			if(Password.value == ''){
			Form_Error = true;
				Error_Msg += '- Le mot de passe saisi est invalide \n';
				Red_Field(Email);
			}else{
					Gray_Field(Password);
				}
			
			if(Form_Error == true){alert(Error_Msg);return false;}
			else{return true;}
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		};
	},
	
	
	lostmail_Form: function() {
		var Email = document.getElementById('lostmail_action');
		if(Email){
		Email.form.onsubmit = function() {
			var Form_Error = false,
				Error_Msg = 'Champ email \n';
			
			if(Email.value == ''){
				Form_Error = true;
				Error_Msg += '- Adresse Email: ce champ n\'est pas rempli \n';
				Red_Field(Email);
			}else{
				if (Email.value.indexOf("@") == -1 || Email.value.indexOf(".") == -1){
					Form_Error = true;
					Error_Msg += 'L\'email saisi est invalide \n';
					Red_Field(Email);
				}else
				Gray_Field(Email);
			}
				
			if(Form_Error == true){alert(Error_Msg);return false;}
			else{return true;}
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		};
		}
	},
	
	Mail_Form: function(){
		if(document.getElementById('mail_form').className == 'newsletter-registration'){
			Functions_2.Formulaires.Check_Radio_Title(document.getElementById('mail_form'));
			Functions_2.Formulaires.NL_Registration(document.getElementById('mail_form'));
		}
	},
	
	Address_Form: function(){
		var AdressForm = document.getElementById('address_form');
		
		if(document.getElementById('country')) Functions_2.Formulaires.Country_Restriction();
		
		if(AdressForm.className == 'ask-clarins' || AdressForm.className == 'join-clarins' || AdressForm.className == 'join-clarins_qas'){
			Functions_2.Formulaires.Check_Radio_Title(AdressForm);
			if(document.getElementById('subject')){Functions_2.Formulaires.Send_Question(AdressForm);}
			else if(document.getElementById('page').className == 'checkout-2a'){Functions_2.Formulaires.Checkout_2a();}
			else if(document.getElementById('page').className == 'change-details'){Functions_2.Formulaires.Change_Details();}
			else if(document.getElementById('page').className == 'address-mgmt'){Functions_2.Formulaires.Address_Mgmt();}
			else if(document.getElementById('page').className == 'tunnel-address-mgmt'){Functions_2.Formulaires.Tunnel_Address_Mgmt();}
			else if(document.getElementById('page').className == 'join-clarins-qas'){Functions_2.Formulaires.Join_Clarins_qas(AdressForm);}
			else{Functions_2.Formulaires.Join_Clarins(AdressForm);}
		}
	},
	
	Order_Form: function(){
		var OrderForm = document.getElementById('order_form');
		var Card_Type = document.getElementById('type');
		
		var Debit_Card = new Array('visa_debit', 'visa_electron', 'uk_maestro', 'solo', 'delta');
		var Credit_Card = new Array('visa', 'mastercard', 'jcb','amex');
		
		var Issue_Number = document.getElementById('issue_number');
		var Block_Start_Date = document.getElementById('start-month').parentNode;
		var name_as_it_appears_on_the_card = document.getElementById('name_as_it_appears_on_the_card');
		
		Check_Card_Type();
		
		Card_Type.onchange = function(){Check_Card_Type();}
		
		function Check_Card_Type(){
			for(var i = 0; i<Debit_Card.length;i++){
				if(Card_Type.value == Debit_Card[i]){
					Issue_Number.parentNode.style.display = 'block';
					if(Debit_Card[i] == 'delta') Block_Start_Date.style.display = 'none';
					else Block_Start_Date.style.display = 'block';
				}
			}
			
			for(var i = 0; i<Credit_Card.length;i++){
				if(Card_Type.value == Credit_Card[i]){
					Issue_Number.parentNode.style.display = 'none';
					Block_Start_Date.style.display = 'none';
				}
			}
		}
		
		OrderForm.onsubmit = function(){
			var Error_Message = 'The form isn\'t correctly filled in \n';
			var maReg = new RegExp ( "^[a-zA-Z]*$", "gi" );
			
			if ( (name_as_it_appears_on_the_card.value.search( maReg )) == -1  || (name_as_it_appears_on_the_card.value == "")){
					var Error_in_Page = true;
					Error_Message += '- Name as it appears on the card : invalid format \n';
					Field_in_Red(document.getElementById('name_as_it_appears_on_the_card'));
			}
			else{
					Gray_Field(document.getElementById('name_as_it_appears_on_the_card'));
			}
					
			if(document.getElementById('number').value.length < 15){
				var Error_in_Page = true;
				Error_Message += '- Card Number : 15 characters minimum \n';
				Field_in_Red(document.getElementById('number'));
			}else{
				Gray_Field(document.getElementById('number'));
			}
			
			if(document.getElementById('security_code').value.length != 4 && Card_Type.value != 'jcb'){
				var Error_in_Page = true;
				Error_Message += '- Security Code : 4 characters required \n';
				Field_in_Red(document.getElementById('security_code'));
			}else{
				Gray_Field(document.getElementById('security_code'));
			}
			
			for(var i = 0; i<Debit_Card.length;i++){
				if(Card_Type.value == Debit_Card[i] && Issue_Number.value.length != 2){
					var Error_in_Page = true;
					Error_Message += '- Issue Number : 2 characters required \n';
					Field_in_Red(Issue_Number);
				}
				
				if(Card_Type.value == Debit_Card[i] && Issue_Number.value.length == 2){Gray_Field(Issue_Number);}
			}
			
			if(Error_in_Page == true){alert(Error_Message);return false;}
			else{return true;}
		}
		
		function Field_in_Red(obj){obj.style.border = '1px solid red';}
		function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
	},
	
	Formulaires:{
		Check_Radio_Title: function(Form){
			var InputPrecise = document.getElementById('precise');
			var InputLi_2 = document.getElementById('li_2');
			var InputsForm = Form.getElementsByTagName('input');
			InputPrecise.style.visibility = 'hidden';
			if (document.getElementById('title_other').checked ) document.getElementById('precise').style.visibility = 'visible';
			if (document.getElementById('title_other2'))
				{
				if (document.getElementById('title_other2').checked ) 
					document.getElementById('li_2').style.visibility = 'visible';
				}
			for(var i = 0, a;a = InputsForm[i];i++){
				if(InputsForm[i].name == 'personTitle'){
					if(InputsForm[i].id == 'title_other') InputsForm[i].onclick = function(){InputPrecise.style.visibility = 'visible';}
					else InputsForm[i].onclick = function(){InputPrecise.style.visibility = 'hidden';}
				}
				if(InputsForm[i].name == 'personTitle2'){
					if(InputsForm[i].id == 'title_other2') InputsForm[i].onclick = function(){InputLi_2.style.visibility = 'visible';}
					else InputsForm[i].onclick = function(){InputLi_2.style.visibility = 'hidden';}
				}
			}
		},
		
		Country_Restriction: function(){
		
			var Post_Restriction_Error = document.getElementById('address_data').getElementsByTagName('div')[0].innerHTML;
			
			document.getElementById('country').onchange = function(){
			
				if(this.value != "UK" && this.value != "GB" ){
					var Restriction_Error = '<b class="red" id="restriction_cntry_msg"><br />Sorry Only addresses in UK can register</b>';
					document.getElementById('address_data').getElementsByTagName('div')[0].innerHTML += Restriction_Error;
				}else{
					if(document.getElementById('restriction_cntry_msg')){
						document.getElementById('address_data').getElementsByTagName('div')[0].innerHTML = Post_Restriction_Error;
					}
				}
			}
		},
		
		Join_Clarins: function(Form){
			var InputsForm = Form.getElementsByTagName('input');
			
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Address = document.getElementById('address_line_1');
			var Chps_City = document.getElementById('city');
			var Chps_Area_Code = document.getElementById('area_code');
			var Chps_Post_Code = document.getElementById('post_code');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Chps_Password = document.getElementById('password');
			var Chps_Password_Confirm = document.getElementById('password_confirm');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
					
					if(InputsForm[i].name == 'gender'){
						if(InputsForm[i].checked){Gender_Checked = InputsForm[i];}
					}
				}
				
				// Vérification Title et Gender
				if(Title_Checked.value == 'Mr.' && Gender_Checked.value == 'Female'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mr. can\'t be a Female \n';
				}
				
				if(Title_Checked.value == 'Miss.' && Gender_Checked.value == 'Male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Miss. can\'t be a Male \n';
				}
				
				if(Title_Checked.value == 'Mrs.' && Gender_Checked.value == 'Male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mrs. can\'t be a Male \n';
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Address.value == ''){
					Form_Error = true;
					Error_Msg += '- Address Line 1 : Mandatory Field \n';
					Red_Field(Chps_Address);
				}else{
					Gray_Field(Chps_Address);
				}
				
				if(Chps_City.value == ''){
					Form_Error = true;
					Error_Msg += '- Town / City : Mandatory Field \n';
					Red_Field(Chps_City);
				}else{
					Gray_Field(Chps_City);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid format \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				if(document.getElementById('country').value == 2){
					Form_Error = true;
					Error_Msg += '- Country : Only addresses in UK can register \n';
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Password.value == ''){
					var Form_Error = true;
					Error_Msg += '- Password : Mandatory Field \n';
					Red_Field(Chps_Password);
				}else{
					Gray_Field(Chps_Password);
				}
				
				if(Chps_Password_Confirm.value == ''){
					var Form_Error = true;
					Error_Msg += '- Password Confirm : Mandatory Field \n';
					Red_Field(Chps_Password_Confirm);
				}else{
					Gray_Field(Chps_Password_Confirm);
				}
				
				if(Chps_Password.value != Chps_Password_Confirm.value && Chps_Password_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Password Confirm : False \n';
					Red_Field(Chps_Password_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
		
		
		
		
		
		
		Join_Clarins_qas: function(Form){
		
			var InputsForm = Form.getElementsByTagName('input');
		
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Area_Code = document.getElementById('area_code');
			var Chps_Post_Code = document.getElementById('post_code');
			var Chps_Area_Code2 = document.getElementById('area_code2');
			var Chps_Post_Code2 = document.getElementById('post_code2');
			var Chps_Phone = document.getElementById("phone7");
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Butt_Ok = document.getElementById('ok');
			var Butt_Sel_Address = document.getElementById('select_address');
			var Butt_Sel_Address = document.getElementById('select_address');
			var Address=document.getElementById('address');
			var continueQas=document.getElementById('continueQas');
			var Chps_Password = document.getElementById('password');
			var Chps_Password_Confirm = document.getElementById('password_confirm');
			var Chps_Address1 = document.getElementById('address_line_1');
			var Chps_Address2 = document.getElementById('address_line_2');
			var Chps_Address3 = document.getElementById('address_line_3');
			var Chps_Area_Code2 = document.getElementById('area_code2');
			var Chps_Post_Code2 = document.getElementById('post_code2');
			var Chps_City = document.getElementById('city');
			if (document.getElementById('continue_qas'))
				var Continue_Qas = document.getElementById('continue_qas');
			var Chps_State = document.getElementById('state');
			var Chps_Precise2 = document.getElementById('precise2');
			var Chps_Firstname2 = document.getElementById('firstname2');
			var Chps_Lastname2 = document.getElementById('lastname2');
			var Chps_Area_Code4 = document.getElementById('area_code4');
			var Chps_Post_Code4 = document.getElementById('post_code4');
			var Chps_Phone2 = document.getElementById("phone7bis");
			var Chps_Email2 = document.getElementById('email2');
			var Chps_Email_Confirm2 = document.getElementById('email_confirm2');
			var Chps_Address_Line1 = document.getElementById('address_line_1bis');
			var Chps_City2 = document.getElementById('city2');
			var Chps_State2 = document.getElementById('state2');
		
			try{
				Continue_Qas.onclick = function(){
			
				remplirZipCode2();
				remplirZipCode4();
				}
			}
			catch(e)
			{
			}
			
			
			Butt_Sel_Address.onclick = function(){
				
				if (Address.value!=("no")){
					var NomDiv=document.getElementById("full_address");
					NomDiv.style.display ='none';
					/* fill the full adress fields */
					setAddress(document.getElementById('address').value);
				}
			}
			
			Butt_Ok.onclick = function(){
			
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
					
					if(InputsForm[i].name == 'gender'){
						if(InputsForm[i].checked){Gender_Checked = InputsForm[i];}
					}
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid format \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				
				
				
				
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					var email = Chps_Email.value.toLowerCase(); 
					if (email.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
					{
						
							Form_Error = true;
							Error_Msg += '- Email Address: Syntax error \n';
							Red_Field(Chps_Email);
						}
						else
							Gray_Field(Chps_Email);
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					var email_confirm = Chps_Email_Confirm.value.toLowerCase(); 
					if (email_confirm.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
					{
							Form_Error = true;
							Error_Msg += '- Email Confirm: Syntax error \n';
							Red_Field(Chps_Email_Confirm);
						}
						else 
						Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{
				
					captureAdress();
					return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
			
			
			
			
		
		
			Form.onsubmit = function(){
			
			if(document.getElementById('qas_content2').style.display =='block')
			{
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
			
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							if(InputsForm[i].checked && InputsForm[i].id == 'title_other')
								{
									InputsForm[i].value = Chps_Precise.value;
								}
							Gray_Field(Chps_Precise);
						}
					}
					
					if(InputsForm[i].name == 'gender'){
						if(InputsForm[i].checked){Gender_Checked = InputsForm[i];}
					}
				}
				
				// Vérification Title et Gender
				if(document.getElementById('female')&&document.getElementById('male')){
					if(Title_Checked.value.toUpperCase() == 'MR' && Gender_Checked.value.toUpperCase() == 'F'){
						Form_Error = true;
						Error_Msg += '- Title or Gender : Mr. can\'t be a Female \n';
					}
					
					if(Title_Checked.value.toUpperCase() == 'MISS' && Gender_Checked.value.toUpperCase() == 'M'){
						Form_Error = true;
						Error_Msg += '- Title or Gender : Miss. can\'t be a Male \n';
					}
					
					if(Title_Checked.value.toUpperCase() == 'MRS' && Gender_Checked.value.toUpperCase() == 'M'){
						Form_Error = true;
						Error_Msg += '- Title or Gender : Mrs. can\'t be a Male \n';
					}
				}//if
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Area_Code2.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code2.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code2);
				}else{
					Gray_Field(Chps_Area_Code2);
				}
				
				if(Chps_Area_Code2.value == '' || Chps_Post_Code2.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code2.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code2.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid format \n';
					Red_Field(Chps_Post_Code2);
				}else{
					Gray_Field(Chps_Post_Code2);
				}
				
				if(Chps_Area_Code2.value == '') Red_Field(Chps_Area_Code2);
				if(Chps_Post_Code2.value == '') Red_Field(Chps_Post_Code2);
				
				if(Chps_Phone.value == ''){
					Form_Error = true;
					Error_Msg += '- Phone : Mandatory Field \n';
					Red_Field(Chps_Phone);
				}else{
					Gray_Field(Chps_Phone);
				}
				
				var email = Chps_Email.value.toLowerCase(); 
					if (email.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
					{
				
					Form_Error = true;
					Error_Msg += '- Email Address: Syntax error \n';
					Red_Field(Chps_Email);
				}
				
				var email_confirm = Chps_Email_Confirm.value.toLowerCase(); 
					if (email_confirm.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
					{
					Form_Error = true;
					Error_Msg += '- Email Confirm: Syntax error \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				if(document.getElementById('password_confirm')){
					if(Chps_Password.value == ''){
						var Form_Error = true;
						Error_Msg += '- Password : Mandatory Field \n';
						Red_Field(Chps_Password);
					}else{
						Gray_Field(Chps_Password);
					}
					
					if(Chps_Password_Confirm.value == ''){
						var Form_Error = true;
						Error_Msg += '- Password Confirm : Mandatory Field \n';
						Red_Field(Chps_Password_Confirm);
					}else{
						Gray_Field(Chps_Password_Confirm);
					}
					if(Chps_Password.value != Chps_Password_Confirm.value && Chps_Password_Confirm.value != ''){
						Form_Error = true;
						Error_Msg += '- Password Confirm : False \n';
						Red_Field(Chps_Password_Confirm);
					}else if(Chps_Password.value == Chps_Password_Confirm.value && Chps_Password_Confirm.value != '')
					{
						Gray_Field(Chps_Password_Confirm);
					}
				
				}//if
				
				
				if(Chps_Area_Code2.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code2.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code2);
				}else{
					Gray_Field(Chps_Area_Code2);
				}
				
				if(Chps_Area_Code2.value == '' || Chps_Post_Code2.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code2.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code2.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid format \n';
					Red_Field(Chps_Post_Code2);
				}else Gray_Field(Chps_Post_Code2);
				
				if(Chps_Area_Code2.value == '') Red_Field(Chps_Area_Code2);
					
					
				if(Chps_Post_Code2.value == '') Red_Field(Chps_Post_Code2);
					
				
				if(Chps_City.value == ''){
					Form_Error = true;
					Error_Msg += '- Town / City : Mandatory Field \n';
					Red_Field(Chps_City);
				}else{
					Gray_Field(Chps_City);
				}
				if(Chps_State.value == '-'){
					Form_Error = true;
					Error_Msg += '- County : Mandatory Field \n';
					Red_Field(Chps_State);
				}else{
					Gray_Field(Chps_State);
				}
				/* control country */
				if(document.getElementById('country').value != "UK" && document.getElementById('country').value != "GB" ){
					
					Form_Error = true;
					Error_Msg += '- Sorry Only addresses in UK can register \n';
					Red_Field(document.getElementById('country'));
					}
				else{
					Gray_Field(document.getElementById('country'));
				}
				/* control sur phone */
				
				var num = document.getElementById("phone7").value;
				var format_exp = /^[0-9]{1,13}[0-9 ]*[0-9]$/;
				
				if(num == ""){
				document.getElementById("phone").value = "000000000000";
				}
				else{
				document.getElementById("phone").value = num;
				}
				if (num !=""){
						
					if(format_exp.test(num)){
					Gray_Field(document.getElementById('phone7'));
					
					
					}else{
							Form_Error = true;
							Error_Msg += '- Number format invalid \n';
							Red_Field(document.getElementById('phone7'));
					}
				}
				
				
				if(document.getElementById("adresse_other"))
				{
				
				if(document.getElementById("adresse_other").checked)
						{
							for(var i = 0, a;a = InputsForm[i];i++){
					
							if(InputsForm[i].name == 'personTitle2'){
								if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
								
								if(InputsForm[i].checked && InputsForm[i].id == 'title_other2' && Chps_Precise.value == ''){
									var Form_Error = true;
									Error_Msg += '- Precise Title : Mandatory Field \n';
									Red_Field(Chps_Precise);
								}else{
									if(InputsForm[i].checked && InputsForm[i].id == 'title_other2')
										{
											InputsForm[i].value = Chps_Precise.value;
										}
									Gray_Field(Chps_Precise);
								}
							}
							
							
						}
						
					
						if(Chps_Firstname2.value == ''){
							Form_Error = true;
							Error_Msg += '- Firstname : Mandatory Field \n';
							Red_Field(Chps_Firstname2);
						}else{
							Gray_Field(Chps_Firstname2);
						}
						
						if(Chps_Lastname2.value == ''){
							Form_Error = true;
							Error_Msg += '- Lastname : Mandatory Field \n';
							Red_Field(Chps_Lastname2);
						}else{
							Gray_Field(Chps_Lastname2);
						}
						if(Chps_Address_Line1.value == ''){
							Form_Error = true;
							Error_Msg += '- Address Line1 : Mandatory Field \n';
							Red_Field(Chps_Address_Line1);
						}else{
							Gray_Field(Chps_Address_Line1);
						}
						if(Chps_Area_Code4.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code4.value)){
							Form_Error = true;
							Error_Msg += '- Area Code : invalid format \n';
							Red_Field(Chps_Area_Code4);
						}else{
							Gray_Field(Chps_Area_Code4);
						}
						
						if(Chps_Area_Code4.value == '' || Chps_Post_Code4.value == ''){
							Form_Error = true;
							Error_Msg += '- Area Code : Mandatory Field \n';
						}
						
						if(Chps_Post_Code4.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code4.value)) {
							Form_Error = true;
							Error_Msg += '- Post Code : invalid format \n';
							Red_Field(Chps_Post_Code4);
						}else{
							Gray_Field(Chps_Post_Code4);
						}
						
						if(Chps_Area_Code4.value == '') Red_Field(Chps_Area_Code4);
						if(Chps_Post_Code4.value == '') Red_Field(Chps_Post_Code4);
						
						if(Chps_Phone2.value == ''){
							Form_Error = true;
							Error_Msg += '- Phone : Mandatory Field \n';
							Red_Field(Chps_Phone2);
						}else{
							Gray_Field(Chps_Phone2);
						}
						
						var email = Chps_Email2.value.toLowerCase(); 
							if (email.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
							{
						
							Form_Error = true;
							Error_Msg += '- Email Address: Syntax error \n';
							Red_Field(Chps_Email2);
						}
						
						var email_confirm = Chps_Email_Confirm2.value.toLowerCase(); 
							if (email_confirm.search(/^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+$/) == -1)
							{
							Form_Error = true;
							Error_Msg += '- Email Confirm: Syntax error \n';
							Red_Field(Chps_Email_Confirm2);
						}
						
						if(Chps_Email2.value == ''){
							Form_Error = true;
							Error_Msg += '- Email Address: Mandatory Field \n';
							Red_Field(Chps_Email2);
						}else{
							Gray_Field(Chps_Email2);
						}
						
						if(Chps_Email_Confirm2.value == ''){
							Form_Error = true;
							Error_Msg += '- Email Address Confirm : Mandatory Field \n';
							Red_Field(Chps_Email_Confirm2);
						}else{
							Gray_Field(Chps_Email_Confirm2);
						}
						
						if(Chps_Email2.value != Chps_Email_Confirm2.value && Chps_Email_Confirm2.value != ''){
							Form_Error = true;
							Error_Msg += '- Email Address Confirm : False \n';
							Red_Field(Chps_Email_Confirm2);
						}
		
						
		
						
						
						if(Chps_City2.value == ''){
							Form_Error = true;
							Error_Msg += '- Town / City : Mandatory Field \n';
							Red_Field(Chps_City2);
						}else{
							Gray_Field(Chps_City2);
						}
						if(Chps_State2.value == '-'){
							Form_Error = true;
							Error_Msg += '- County : Mandatory Field \n';
							Red_Field(Chps_State2);
						}else{
							Gray_Field(Chps_State2);
						}
						
						if(document.getElementById('country2').value != "UK" && document.getElementById('country2').value != "GB" ){
							
							Form_Error = true;
							Error_Msg += '- Sorry Only addresses in UK can register \n';
							Red_Field(document.getElementById('country2'));
							}
						else{
							Gray_Field(document.getElementById('country2'));
						}
					
						
						var num = document.getElementById("phone7bis").value;
						var format_exp = /^[0-9]{1,13}[0-9 ]*[0-9]$/;
						
						if(num == ""){
						document.getElementById("phone2").value = "000000000000";
						}
						else{
						document.getElementById("phone2").value = num;
						}
						if (num !=""){
								
							if(format_exp.test(num)){
							Gray_Field(document.getElementById('phone7bis'));
							
							
							}else{
									Form_Error = true;
									Error_Msg += '- Number format invalid \n';
									Red_Field(document.getElementById('phone7bis'));
							}
						}
							
								
							}	
								
								
							}
						
						/* fin cotrol phone*/
				
				/* Format & validate date */
				if(document.getElementById('day')&&document.getElementById('month')&&document.getElementById('year')){
					FormatDate("address_form");
					
					var daySelect = document.getElementById('day');
					var monthSelect = document.getElementById('month');
					var yearSelect = document.getElementById('year');
					
					if(daySelect.selectedIndex == 0 || monthSelect.selectedIndex == 0 || yearSelect.selectedIndex == 0) {
						Form_Error = true;
						Error_Msg += '- invalid date format \n';
						Red_Field(yearSelect) ;
						Red_Field(monthSelect) ;
						Red_Field(daySelect) ;
						
					}
					
					
					if((daySelect.value != "") && (monthSelect.value != "") && (yearSelect.value != "")){
						var datTest_Date = new Date(yearSelect.value, monthSelect.value-1, daySelect.value);
						if ((daySelect.value != datTest_Date.getDate()) || (monthSelect.value-1 != datTest_Date.getMonth()))
						 { 
						 	Form_Error = true;
							Error_Msg += '- invalid date format \n';
							Red_Field(yearSelect) ;
							Red_Field(monthSelect) ;
							Red_Field(daySelect) ;
						 }
					}
					
					var today=new Date();
					var birthdate=new Date(yearSelect.value, monthSelect.value-1, daySelect.value); //Month is 0-11 in JavaScript
					var age = today.getFullYear() - yearSelect.value;
					var annivDate = new Date(today.getFullYear(), monthSelect.value-1, daySelect.value); 
				      // Si pas encore passé, retirer 1 an
				    if (annivDate> today)  age--;
					if(age<18){
						Form_Error = true;
						Error_Msg += '- You haven\'t the legal age yet, you are a minor \n';
						
					}
				}
				/* fin validate date */
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{
					var affiche = document.getElementById('qas_content2');
					affiche.style.display ='block';
					var NomDiv=document.getElementById("full_address");
					NomDiv.style.display ='block';
					return true;}
			}
			else
			{
			return false;}
			};
			
			
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
			
			
		},
		
		
		
		NL_Registration: function(Form){
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
					
					if(InputsForm[i].name == 'gender'){
						if(InputsForm[i].checked){Gender_Checked = InputsForm[i];}
					}
				}
				
				// Vérification Title et Gender
				if(Title_Checked.value == 'Mr.' && Gender_Checked.value == 'female'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mr. can\'t be a Female \n';
				}
				
				if(Title_Checked.value == 'Miss.' && Gender_Checked.value == 'male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Miss. can\'t be a Male \n';
				}
				
				if(Title_Checked.value == 'Mrs.' && Gender_Checked.value == 'male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mrs. can\'t be a Male \n';
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
		
		Send_Question: function(Form){
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
					
					if(InputsForm[i].name == 'gender'){
						if(InputsForm[i].checked){Gender_Checked = InputsForm[i];}
					}
				}
				
				// Vérification Title et Gender
				if(Title_Checked.value == 'Mr.' && Gender_Checked.value == 'female'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mr. can\'t be a Female \n';
				}
				
				if(Title_Checked.value == 'Miss.' && Gender_Checked.value == 'male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Miss. can\'t be a Male \n';
				}
				
				if(Title_Checked.value == 'Mrs.' && Gender_Checked.value == 'male'){
					Form_Error = true;
					Error_Msg += '- Title or Gender : Mrs. can\'t be a Male \n';
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{
					return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
		
		Checkout_2a: function(){
			var Form = document.getElementById('address_form');
			
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Chps_Address = document.getElementById('address_line_1');
			var Chps_City = document.getElementById('city');
			var Chps_Area_Code = document.getElementById('area_code');
			var Chps_Post_Code = document.getElementById('post_code');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Address.value == ''){
					Form_Error = true;
					Error_Msg += '- Address Line 1 : Mandatory Field \n';
					Red_Field(Chps_Address);
				}else{
					Gray_Field(Chps_Address);
				}
				
				if(Chps_City.value == ''){
					Form_Error = true;
					Error_Msg += '- Town / City : Mandatory Field \n';
					Red_Field(Chps_City);
				}else{
					Gray_Field(Chps_City);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				if(document.getElementById('country').value == 2){
					Form_Error = true;
					Error_Msg += '- Country : Only addresses in UK can register \n';
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
		
		
		
		
		
		Change_Details: function(){
			var Form = document.getElementById('address_form');
			
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Chps_Address = document.getElementById('address_line_1');
			var Chps_City = document.getElementById('city');
			var Chps_Area_Code = document.getElementById('area_code');
			var Chps_Post_Code = document.getElementById('post_code');
			var Chps_Password = document.getElementById('password');
			var Chps_Password_Confirm = document.getElementById('password_confirm');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Address.value == ''){
					Form_Error = true;
					Error_Msg += '- Address Line 1 : Mandatory Field \n';
					Red_Field(Chps_Address);
				}else{
					Gray_Field(Chps_Address);
				}
				
				if(Chps_City.value == ''){
					Form_Error = true;
					Error_Msg += '- Town / City : Mandatory Field \n';
					Red_Field(Chps_City);
				}else{
					Gray_Field(Chps_City);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				if(document.getElementById('country').value == 2){
					Form_Error = true;
					Error_Msg += '- Country : Only addresses in UK can register \n';
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Password.value == ''){
					var Form_Error = true;
					Error_Msg += '- Password : Mandatory Field \n';
					Red_Field(Chps_Password);
				}else{
					Gray_Field(Chps_Password);
				}
				
				if(Chps_Password_Confirm.value == ''){
					var Form_Error = true;
					Error_Msg += '- Password Confirm : Mandatory Field \n';
					Red_Field(Chps_Password_Confirm);
				}else{
					Gray_Field(Chps_Password_Confirm);
				}
				
				if(Chps_Password.value != Chps_Password_Confirm.value && Chps_Password_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Password Confirm : False \n';
					Red_Field(Chps_Password_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
		
		Address_Mgmt: function(){
			var Form = document.getElementById('address_form');
			
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_Address = document.getElementById('address_line_1');
			var Chps_Post_Code = document.getElementById('post_code');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Chps_Area_Code = document.getElementById('area_code');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Address.value == ''){
					Form_Error = true;
					Error_Msg += '- Address Line 1 : Mandatory Field \n';
					Red_Field(Chps_Address);
				}else{
					Gray_Field(Chps_Address);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		},
	
		Tunnel_Address_Mgmt: function(){
			var Form = document.getElementById('address_form');
			
			var InputsForm = Form.getElementsByTagName('input');
			var Chps_Precise = document.getElementById('precise');
			var Chps_Firstname = document.getElementById('firstname');
			var Chps_Lastname = document.getElementById('lastname');
			var Chps_City = document.getElementById('city');
			var Chps_Address = document.getElementById('address_line_1');
			var Chps_Post_Code = document.getElementById('post_code');
			var Chps_Email = document.getElementById('email');
			var Chps_Email_Confirm = document.getElementById('email_confirm');
			var Chps_Area_Code = document.getElementById('area_code');
			
			Form.onsubmit = function(){
				var Error_Msg = 'The form isn\'t correctly filled in \n';
				
				for(var i = 0, a;a = InputsForm[i];i++){
					if(InputsForm[i].name == 'personTitle'){
						if(InputsForm[i].checked){Title_Checked = InputsForm[i];}
						
						if(InputsForm[i].checked && InputsForm[i].id == 'title_other' && Chps_Precise.value == ''){
							var Form_Error = true;
							Error_Msg += '- Precise Title : Mandatory Field \n';
							Red_Field(Chps_Precise);
						}else{
							Gray_Field(Chps_Precise);
						}
					}
				}
				
				if(Chps_Firstname.value == ''){
					Form_Error = true;
					Error_Msg += '- Firstname : Mandatory Field \n';
					Red_Field(Chps_Firstname);
				}else{
					Gray_Field(Chps_Firstname);
				}
				
				if(Chps_Lastname.value == ''){
					Form_Error = true;
					Error_Msg += '- Lastname : Mandatory Field \n';
					Red_Field(Chps_Lastname);
				}else{
					Gray_Field(Chps_Lastname);
				}
				
				if(Chps_Email.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address: Mandatory Field \n';
					Red_Field(Chps_Email);
				}else{
					Gray_Field(Chps_Email);
				}
				
				if(Chps_Address.value == ''){
					Form_Error = true;
					Error_Msg += '- Address Line 1 : Mandatory Field \n';
					Red_Field(Chps_Address);
				}
				
				if(Chps_City.value == ''){
					Form_Error = true;
					Error_Msg += '- Town / City : Mandatory Field \n';
					Red_Field(Chps_City);
				}else{
					Gray_Field(Chps_City);
				}
				
				if(Chps_Area_Code.value != '' && !/^[a-zA-Z][a-zA-Z0-9]{0,3}$/.test(Chps_Area_Code.value)){
					Form_Error = true;
					Error_Msg += '- Area Code : invalid format \n';
					Red_Field(Chps_Area_Code);
				}else{
					Gray_Field(Chps_Area_Code);
				}
				
				if(Chps_Area_Code.value == '' || Chps_Post_Code.value == ''){
					Form_Error = true;
					Error_Msg += '- Post Code : Mandatory Field \n';
				}
				
				if(Chps_Post_Code.value != '' && !/^\d[a-zA-Z]{2}$/.test(Chps_Post_Code.value)) {
					Form_Error = true;
					Error_Msg += '- Post Code : invalid \n';
					Red_Field(Chps_Post_Code);
				}else{
					Gray_Field(Chps_Post_Code);
				}
				
				if(Chps_Area_Code.value == '') Red_Field(Chps_Area_Code);
				if(Chps_Post_Code.value == '') Red_Field(Chps_Post_Code);
				
				if(document.getElementById('country').value == 2){
					Form_Error = true;
					Error_Msg += '- Country : Only addresses in UK can register \n';
				}
				
				if(Chps_Email_Confirm.value == ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : Mandatory Field \n';
					Red_Field(Chps_Email_Confirm);
				}else{
					Gray_Field(Chps_Email_Confirm);
				}
				
				if(Chps_Email.value != Chps_Email_Confirm.value && Chps_Email_Confirm.value != ''){
					Form_Error = true;
					Error_Msg += '- Email Address Confirm : False \n';
					Red_Field(Chps_Email_Confirm);
				}
				
				if(Form_Error == true){alert(Error_Msg);return false;}
				else{return true;}
			};
			
			function Red_Field(obj){obj.style.border = '1px solid red';}
			function Gray_Field(obj){obj.style.border = '1px solid #ADB0B0';}
		}
	}
};

//window.onload = function(){Functions_2.Start();}
addEvent(window, "load", Functions_2.Start);