
// gets commune from codepostal
function getCommune(codepostal, formObjDestination){
    if (codepostal != "") 
        getDataIntoFormObjValue("sscripts/getcommune.php?codepostal=" + codepostal, formObjDestination);
    return;
}

// returns true if password valid
function isValidPwd(str){
    return (str.length >= 4);
}


function isIdFormValid2()//allows nickname
{
	var alertobj = "";
    var valideLogin = false;
    var handleAction = function(){
    	this.destroy();
    }
    var strHeaderAlertPp = "<div class='tl'><img src=\"images/fond_attention.jpg\"/></div>xxxTitre<div class='tr'></div>";
    //check remplir nickname
    if (document.getElementById("mail").value.length != 0) {
    
    
        // check if nickname
        if (document.getElementById("mail").value.indexOf("@") < 0 && document.getElementById("mail").value.length >= 3) {
        
            valideLogin = true;
        }
        // check valide mail
        else 
            if (isValidEmail(document.getElementById("mail").value)) 
            
                valideLogin = true;
            
            else {
            	strHeaderAlertPp = repS(strHeaderAlertPp,"Titre",MLJS("txterreur") );
            	alertobj = createFrmPopup_update(3,strHeaderAlertPp,MLJS("txtsaisirmailpseudovalide"),'',handleAction,"alertPanel","containerdiv");
  				alertobj.cfg.setProperty('fixedcenter',false);
            //	showalertpanel(MLJS("txterreur"),MLJS("txtsaisirmailpseudovalide"),'',3,1,'');
                return false;
            }
        
    }
    else {
    	strHeaderAlertPp = repS(strHeaderAlertPp,"Titre",MLJS("txterreur") );
       
 
    	alertobj = createFrmPopup_update(3,strHeaderAlertPp,MLJS("txtsaisirpseudomail"),'',handleAction,"alertPanel","containerdiv");

  		alertobj.cfg.setProperty('fixedcenter',false);
        //showalertpanel(MLJS("txterreur"),MLJS("txtsaisirpseudomail"),'',3,1,'');
        return false;
    }
    
    if (valideLogin == true) {
    
    
        if (isValidPwd(document.getElementById("pwd").value)) 
            return true;
        else {
        	strHeaderAlertPp = repS(strHeaderAlertPp,"Titre",MLJS("txtmdpinvalide") );
    		alertobj = createFrmPopup_update(3,strHeaderAlertPp,MLJS("txtsaisirmdpvalide"),'',handleAction,"alertPanel","containerdiv");        	
  			alertobj.cfg.setProperty('fixedcenter',false);
			//showalertpanel(MLJS("txtmdpinvalide"),MLJS("txtsaisirmdpvalide"),'',3,1,'');
            return false;
        }
        
        
    }
   
}

function isInviteFormValid(){
    if (isValidEmail(document.getElementById("mail0").value)) 
        return true;
    else {
		 showalertpanel(MLJS("txtemailinvalide"),MLJS("txtsaisiremailvalide"),'',3,1,'');
        return false;
    }
}

function InitForm1(){
	
	var fields=new Array();
	fields.push({id:'mail',fct:isValidEmailForm},{id:'pwd0',fct:isValidPwd0Form},
	{id:'nom',fct:isValidLastNameForm},
	{id:'prenom',fct:isValidFirstNameForm},{id:'ischeckmajeur',fct:isValidcheckMajeurForm});
	InitForm(fields);
	
}

function InitForm2(){
	
	var fields=new Array();
	fields.push({id:'mail',fct:isValidEmailForm},{id:'pwd0',fct:isValidPwd0Form},
	{id:'pwd1',fct:isValidPwd1Form},{id:'nom',fct:isValidLastNameForm}
	,{id:'prenom',fct:isValidFirstNameForm},
	{id:'mailparent',fct:isValidEmailParentForm},{id:'pwdparent0',fct:isValidPwd0ParentForm},
	{id:'nomparent',fct:isValidLastNameParentForm},
	{id:'prenomparent',fct:isValidFirstNameParentForm},{id:'ischeckmajeur',fct:isValidcheckMajeurForm});
	InitForm(fields);
	
}	
function InitForm(fields){
	
	 for (var i = 0; i < fields.length; i++){
	 	var myId=fields[i].id;
		var myFct=fields[i].fct;
		 if(document.getElementById(myId)!=null){
			document.getElementById(myId).onkeyup = function() {
				var errors=new Array();
				var myLocalId=this.id;
				var myLocalFct=null;
				for (var j=0;j<fields.length;++j)
					if (fields[j].id==myLocalId) myLocalFct = fields[j].fct;
				if (myLocalFct!=null)
					myLocalFct(myLocalId,errors);
				if (errors.length>0) {
					//pas ok
					var myError=errors[0].txt;
					if(document.getElementById(myLocalId+"OK")!=null)
						document.getElementById(myLocalId+"OK").innerHTML = "<img src='images/error_icon.png' width='15px' height='15px' alt='"+myError+"'/>";
				}
				else {
					//ok
					if(document.getElementById(myLocalId+"OK")!=null)
						document.getElementById(myLocalId+"OK").innerHTML ="<img src='images/ok_icon.png' width='15px' height='15px'/>";
				}
			}
			document.getElementById(myId).onclick  = function() {
			var errors=new Array();
			var myLocalId=this.id;
			var myLocalFct=null;
			for (var j=0;j<fields.length;++j)
				if (fields[j].id==myLocalId) myLocalFct = fields[j].fct;
			if (myLocalFct!=null)
				myLocalFct(myLocalId,errors);
			
			if (errors.length>0) {
				//pas ok
				var myError=errors[0].txt;
				if(document.getElementById(myLocalId+"OK")!=null)
					document.getElementById(myLocalId+"OK").innerHTML = "<img src='images/error_icon.png' width='15px' height='15px' alt='"+myError+"'/>";
			}
			else {
				//ok
				if(document.getElementById(myLocalId+"OK")!=null)
					document.getElementById(myLocalId+"OK").innerHTML ="<img src='images/ok_icon.png' width='15px' height='15px'/>";
			}
		}
		document.getElementById(myId).onfocus = function() {
			var myLocalId=this.id;
			//document.getElementById(myLocalId).style.backgroundColor = "white";
			document.getElementById(myLocalId).style.background= "url(images/roundedinput.png) no-repeat left top";
		}
	 }
	 }
}
function ValidForm1() {
	calculate_time_zone();
	var fields=new Array();
	fields.push({id:'mail',fct:isValidEmailForm},{id:'pwd0',fct:isValidPwd0Form},
	{id:'nom',fct:isValidLastNameForm}
	,{id:'prenom',fct:isValidFirstNameForm},{id:'ischeckmajeur',fct:isValidcheckMajeurForm});
	var result=ValidForm(fields);
	//alert(result);
	return result;
}

function ValidForm2(){
	calculate_time_zone();
	var fields=new Array();
	fields.push({id:'mail',fct:isValidEmailForm},{id:'pwd0',fct:isValidPwd0Form},
	{id:'nom',fct:isValidLastNameForm}
	,{id:'prenom',fct:isValidFirstNameForm},
	{id:'mailparent',fct:isValidEmailParentForm},{id:'pwdparent0',fct:isValidPwd0ParentForm},
	{id:'nomparent',fct:isValidLastNameParentForm},
	{id:'prenomparent',fct:isValidFirstNameParentForm},{id:'ischeckmajeur',fct:isValidcheckMajeurForm});
	var result=ValidForm(fields);
	return result;
}
function ValidFormCadeau(){
	
		var fields=new Array();
		fields.push({id:'mailexpediteur',fct:isValidEmailCadeauForm},
					{id:'maildestinataire',fct:isValidEmailCadeauForm},
					{id:'telexpediteur',fct:isValidTelCadeauForm},
					{id:'nomexpediteur',fct:isValidNameCadeauForm},
					{id:'prenomdestinataire',fct:isValidNameCadeauForm},
					{id:'nomdestinataire',fct:isValidNameCadeauForm});
		
		var result=ValidFormCadeau2(fields);
		return result;
}
function isValidEmailCadeauForm(myId,err){
		if (document.getElementById(myId).value=="")
			err.push({id:myId,txt:"Email invalide"});
}
function isValidNameCadeauForm(myId,err){
		if (document.getElementById(myId).value=="")
			err.push({id:myId,txt:"Nom Invalide"});
}
function isValidTelCadeauForm(myId,err){
		if (!(isValidTelephone(document.getElementById(myId).value)))
			err.push({id:myId,txt:"Tel. Invalide"});
}
function isValidTelephone(tel){
	
	var strValidChars = "0123456789";
	var strChar;
    var blnResult = true;
    if(tel=="")
    	return true;
    for (i = 0; i < tel.length && blnResult == true; i++) {
        strChar = tel.charAt(i);
        if ((strValidChars.indexOf(strChar) == -1)) 
            blnResult = false;
    }
    return blnResult;
}
function ValidFormCadeau2(fields){
	
	var errors=new Array();
	 for (var i = 0; i < fields.length; i++){
	 	var myId=fields[i].id;
		//document.getElementById(myId).style.backgroundColor = "white";
		document.getElementById(myId).style.background= "url(images/roundedinputcadeau.png) no-repeat left top";
		var myFct=fields[i].fct;
		myFct(myId,errors);
		
	 }
	 var totalerror="";
	 
	  for (var i = 0; i < errors.length; i++){
	  	var myId=errors[i].id;
		var myError=errors[i].txt;
		 //document.getElementById(myId).style.backgroundColor = "red";
		 document.getElementById(myId).style.background= "url(images/roundedinputred.png) no-repeat left top";
		 totalerror+=myError+"<br>";
	  }
	  if(totalerror!=""){
	 	
		  showalertpanel(MLJS("txtattention"),totalerror,'',3,1,'');
		 return false;
		 
		}
	else 
	return true;
}
function ValidForm(fields){

	var errors=new Array();
	 for (var i = 0; i < fields.length; i++){
	 	var myId=fields[i].id;
		//document.getElementById(myId).style.backgroundColor = "white";
		document.getElementById(myId).style.background= "url(images/roundedinput.png) no-repeat left top";
		var myFct=fields[i].fct;
		myFct(myId,errors);
		
	 }
	 var totalerror="";
	 
	  for (var i = 0; i < errors.length; i++){
	  	var myId=errors[i].id;
		var myError=errors[i].txt;
		 //document.getElementById(myId).style.backgroundColor = "red";
		 document.getElementById(myId).style.background= "url(images/roundedinputred.png) no-repeat left top";
		 totalerror+=myError+"<br>";
	  }
	  if(totalerror!=""){
	 	
		  showalertpanel(MLJS("txtattention"),totalerror,'',3,1,'');
		 return false;
		 
		}
	else 
	return true;
}

function isValidEmailForm(myId,err){
	if (!(isValidEmail(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtemailinvalide")});
}
 
function isValidPwd0Form(myId,err){
	if (!(isValidPwd(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtsaisirmdpvalide")});
}
function isValidPwd1Form(myId,err){
	if (!(isValidPwd(document.getElementById(myId).value)))
	err.push({id:myId,txt:MLJS("txtdeuxmdpinvalide")});
	else if (document.getElementById(myId).value != document.getElementById("pwd0").value) 
		err.push({id:myId,txt:MLJS("txtmdpnotcorrespond")});
}
function isValidFirstNameForm(myId,err){
	
	if (!(isValidName(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtprenominvalide")});
}
function isValidLastNameForm(myId,err){
	
	if (!(isValidName(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtnominvalide")});
}
function isValidEmailParentForm(myId,err){

if(document.getElementById('inscriptionparent').style.display =="block"){
		if (document.getElementById(myId).value != document.getElementById("mail").value){
		if (!(isValidEmail(document.getElementById(myId).value)))
			err.push({id:myId,txt:MLJS("txtsaisiremailvalideparent")});
		}
		else{
			err.push({id:myId,txt:MLJS("txtemailinvalide")});
		}
	}
}
function isValidPwd0ParentForm(myId,err){
if(document.getElementById('inscriptionparent').style.display=="block"){
	if (!(isValidPwd(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtsaisirmdpvalideparent")});
	}
}
function isValidPwd1ParentForm(myId,err){
if(document.getElementById('inscriptionparent').style.display =="block"){
	if (!(isValidPwd(document.getElementById(myId).value)))
	err.push({id:myId,txt:MLJS("txtdeuxmdpparentinvalide")});
	else if (document.getElementById(myId).value != document.getElementById("pwdparent0").value) 
		err.push({id:myId,txt:MLJS("txtmdpparentnotcorrespond")});
	}
}
function isValidFirstNameParentForm(myId,err){
	if(document.getElementById('inscriptionparent').style.display =="block"){
	if (!(isValidName(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtprenomparentinvalide")});
	}
}
function isValidLastNameParentForm(myId,err){
	if(document.getElementById('inscriptionparent').style.display =="block"){
	if (!(isValidName(document.getElementById(myId).value)))
		err.push({id:myId,txt:MLJS("txtnomparentinvalide")});
	}
}

function isValidName(name){
	
	var strValidChars = "0123456789";
	var strChar;
    var nombredepoint = 0;
    var blnResult = true;
	if(name=="")
		return false;
    for (i = 0; i < name.length && blnResult == true; i++) {
        strChar = name.charAt(i);
        if ((strValidChars.indexOf(strChar) != -1)) 
            blnResult = false;
    }
    return blnResult;
}

function isValidcheckMajeurForm(myId,err){

if ((document.getElementById(myId).checked)==false)
		err.push({id:myId,txt:MLJS("txtacceptercgu")});
}

function verifydateProf(){
	var jour=document.getElementById("jour").value;
	var mois=document.getElementById("mois").value;
	var annee=document.getElementById("annee").value;
	if(!isValidDate(jour,mois,annee)){
		showalertpanel(MLJS("txtattention"),MLJS("txtetremajeurins"),'',3,1,'');
		document.getElementById("jour").value="1";
		document.getElementById("mois").value="1";
		document.getElementById("annee").value="1984";
	}
}
function verifydateEleve(lg){

	var jour=document.getElementById('jour').value;
	var mois=document.getElementById("mois").value;
	var annee=document.getElementById("annee").value;
	if(!isValidDate(jour,mois,annee)){
		document.getElementById("inscriptioneleve").style.background= "url(images/inscription_fond_eleve_small.png) no-repeat left top";
		document.getElementById('showhidetd').style.display ="block";
		}
	else{
		//document.getElementsByName("group2")[0].checked=true;
		//document.getElementById("group2").options[0].selectedIndex = true;
		document.getElementById("group2").getElementsByTagName("option")[0].disabled = true;
		document.getElementById("inscriptioneleve").style.background= "url(images/inscription_fond_eleve_small.png) no-repeat left top";
		document.getElementById('showhidetd').style.display ="none";
		document.getElementById('inscriptionparent').style.display ="none";
		//document.getElementById('inscriptionpubeleve'+lg).style.display ="block";
		document.getElementById('identificationparent').style.display ="none";
		
		}
		
	
}
function verifydateParent(){
	var jourparent=document.getElementById("jourparent").value;
	var moisparent=document.getElementById("moisparent").value;
	var anneeparent=document.getElementById("anneeparent").value;
	if(!isValidDate(jourparent,moisparent,anneeparent)){
		showalertpanel(MLJS("txtattention"),MLJS("txtetremajeurparent"),'',3,1,'');
		document.getElementById("jourparent").value="1";
		document.getElementById("moisparent").value="1";
		document.getElementById("anneeparent").value="1984";
		}
}
function isValidDate(jour,mois,annee){
	var currentdate=new Date();
	var currentday= currentdate.getDate();
	var currentmounth= currentdate.getMonth()+1;
	var currentyear= currentdate.getFullYear();
	var age="";
	if((currentday>=jour && currentmounth ==mois)|| currentmounth >mois)
		age = currentyear - annee; 
	else
		age = currentyear - annee-1;
		 
	return(age>17);
}
function ChoiceInscriptionEleve(){
var type=document.getElementById('group2').value;

	if(type=='eleveseul')
	{
		document.getElementById('inscriptionparent').style.display ="none";
		document.getElementById('identificationparent').style.display ="none";
		//document.getElementById('inscriptionpubeleve'+lg).style.display ="block";
	}
	if(type=='eleveparentnoninscrit'){
		document.getElementById('inscriptionparent').style.display ="block";
		document.getElementById('identificationparent').style.display ="none";
		//document.getElementById('inscriptionpubeleve'+lg).style.display ="none";
	}
	if(type=='eleveparentinscrit'){
		document.getElementById('inscriptionparent').style.display ="none";
		document.getElementById('identificationparent').style.display ="block";
		//document.getElementById('inscriptionpubeleve'+lg).style.display ="none";
	}
}


function startNickNameLoop(){
	if(document.getElementById('nom')!=null){
	    isNickNameLoop = true;
	    isRequestOn = false;
	    lastActivityTime = new Date();
	    window.setTimeout("nickNameLoop();", 200);
	}
}

function startNickNameLoopParent(){
	if(document.getElementById('nomparent')!=null){
	    isNickNameLoop2 = true;
	    isRequestOn2 = false;
	    lastActivityTime2 = new Date();
		window.setTimeout("nickNameLoopParent();", 200);
	}
}
function nickNameLoop(){


    var now = new Date();
    var nom = document.getElementById('nom').value;
    var prenom = document.getElementById('prenom').value;

    document.getElementById('nom').value = document.getElementById('nom').value.toUpperCase();
    if ((nom != '') && (prenom != '')) {
        if (((now - lastActivityTime) > 1500) && (isRequestOn == false)) {
        
            thedata = "nom=" + nom + "&prenom=" + prenom;
            isRequestOn = true;
            //document.getElementById('champNick').innerHTML = MLJS("txtdonnerpseudo");
            postDataValue("sscripts/generateNickname.php", document.getElementById('champNick'), thedata);
            
        }
    }
    else 
    	document.getElementById('champNick').innerHTML='';
        //document.getElementById('champNick').innerHTML = MLJS("txtavoirpseudo");
    
    if (isNickNameLoop == true) 
        window.setTimeout("nickNameLoop();", 300);
}
function nickNameLoopParent(){		
	var now = new Date();
    var nom = document.getElementById('nomparent').value;
    var prenom = document.getElementById('prenomparent').value;

    document.getElementById('nomparent').value = document.getElementById('nomparent').value.toUpperCase();
    if ((nom != '') && (prenom != '')) {
        if (((now - lastActivityTime2) > 1500) && (isRequestOn2== false)) {
        
            thedata = "nom=" + nom + "&prenom=" + prenom;
            isRequestOn2 = true;
            //document.getElementById('champNickparent').innerHTML = MLJS("txtdonnerpseudo");
            postDataValue("sscripts/generateNickname.php", document.getElementById('champNickparent'), thedata);
            
        }
    }
    else
    	document.getElementById('champNickparent').innerHTML=''; 
        //document.getElementById('champNickparent').innerHTML = MLJS("txtavoirpseudo");
    
    if (isNickNameLoop2== true) 
        window.setTimeout("nickNameLoopParent();", 300);
}

function messageEmailProf(){
showalertpanel(MLJS("txtinfo"),MLJS("txtprofemail"),'',3,1,'');
}

//concerne les inscriptions
function AskInviteParent(value){
	
	if(value=="majeur"){
 		document.getElementById("inscriptionenfant").style.visibility = "hidden";
		
		}
	if(value=="parentetenfant"){
 		document.getElementById("inscriptionenfant").style.visibility = "visible";
		
		}
	
}
function showhideleftins(type,lg){

	if(type==1){//show
		document.getElementById("leftins").style.visibility = "visible";
		document.getElementById("imageeleve"+lg).style.background= "url(images/bouton_eleve_"+lg+".png) no-repeat left top";
	}
	if(type==0){//hide
		document.getElementById("leftins").style.visibility = "hidden";
		document.getElementById("imageeleve"+lg).style.background= "url(images/bouton_eleve_"+lg+".png) no-repeat left top";
	}
}
	
function showhiderightins(type,lg){
	if(type==1){//show
		document.getElementById("rightins").style.visibility = "visible";
		document.getElementById("imageprof"+lg).style.background= "url(images/bouton_prof_"+lg+".png) no-repeat left top";
	}
	else{//hide
		document.getElementById("rightins").style.visibility = "hidden";
		document.getElementById("imageprof"+lg).style.background= "url(images/bouton_prof_"+lg+".png) no-repeat left top";
		
	}

}
function showhideadress(){
	if(document.getElementById("showhideadress").style.display =="block"){
		document.getElementById("renseigner").innerHTML = "<a href=\"javascript:showhideadress()\">"+MLJS('txtrenseigneradd')+"</a>";
		document.getElementById("showhideadress").style.display = "none";
		document.getElementById("inscriptionparent").style.background= "url(images/fond_parents_small.png) no-repeat left top";
		document.getElementById('inscriptionparent').style.height='320px';
	}
	else{
		document.getElementById("renseigner").innerHTML = "<a href=\"javascript:showhideadress()\">"+MLJS('txtmemeadd')+"</a>";
		document.getElementById("showhideadress").style.display = "block";
		document.getElementById("inscriptionparent").style.background= "url(images/fond_parents_big.png) no-repeat left top";
		document.getElementById('inscriptionparent').style.height='448px';
	}
}

function SameName(name){
document.getElementById("nomparent").value = name;	
}
function SameAdresse(adresse){
document.getElementById("adresseparent").value = adresse;
document.getElementById("codepostalparent").value = document.getElementById("codepostal").value;
document.getElementById("villeparent").value = document.getElementById("ville").value;		
}
function SameTelephone(tel){
	document.getElementById("telephoneparent").value = tel;
}



function VerifMotdepasseInfoperso(pwd,pwd0,pwd1){
	 if (isValidPwd(pwd)) {
        if (isValidPwd(pwd0)) {
            if (isValidPwd(pwd1)) {
                if (pwd0 != pwd1){
					
					 document.getElementById('pwd0').style.backgroundColor = "red";
					  document.getElementById('pwd1').style.backgroundColor = "red";
					  showalertpanel(MLJS("txtattention"),MLJS("txtconfirmmdpinvalide"),'',3,1,'');

				} 
			    else {
						var thedata = "";
			    		thedata =thedata+ "pwd=" + codeUrl(pwd);
				 		thedata =thedata+ "&pwd0=" + codeUrl(pwd0);
				
				 		var dataSource = "sscripts/uppass.php";
			    		getDataValueJSON(dataSource, thedata, ModifMotdePasseInfoperso);
                }
            }
            else {
				document.getElementById('pwd1').style.backgroundColor = "red";
	            showalertpanel(MLJS("txtattention"),MLJS("txtsaisirmdpvalide"),'',3,1,'');
		    }
        }
        else {
		document.getElementById('pwd0').style.backgroundColor = "red";
         showalertpanel(MLJS("txtattention"),MLJS("txtsaisirmdpvalide"),'',3,1,'');
		}
    }
	else {
			document.getElementById('pwd').style.backgroundColor = "red";
			 showalertpanel(MLJS("txtattention"),MLJS("txtmdpinvalide"),'',3,1,'');
        }
}
function RefreshInfoperso(){
	document.location.href = 'infoperso.php';
}

function ModifMotdePasseInfoperso (xmlDoc){
	xmlDoc = json(xmlDoc);
	if(xmlDoc){

	    var okbonmotdepasse = "";   
		var okbonmotdepasse = g1J(xmlDoc,"okbonmotdepasse");
				
	    
		if(okbonmotdepasse==1)
	     	showalertpanel(MLJS("txtinfo"),MLJS("txtmdpmodifie"),'',2,1,RefreshInfoperso);
		else
		   	 showalertpanel(MLJS("txtattention"),MLJS("txtmdpactuelinvalide"),'',3,1,'');
	}
}
function NewsLetterEmail(emailnewsletter){
	if (!(isValidEmail(emailnewsletter)))
		showalertpanelhome(MLJS("txtattention"),MLJS("txtsaisirmailvalide"),'',3,1,'');
	else{
		thedata="emailnewsletter="+emailnewsletter;
	 	getDataValueJSON("sscripts/email_newsletter.php", thedata, repNewsLetterEmail);
	}
}
 function repNewsLetterEmail(jsonRep){
	var array=json(jsonRep);
	var okemail = g1J(array,"okemail");
	if(okemail==0){
		showalertpanelhome(MLJS("txtinfo"),MLJS("txtmercinewsletter"),'',2,1,'');
		document.getElementById('emailnewsletter').value= "";
		}
	else
		showalertpanelhome(MLJS("txtattention"),MLJS("txtmaildejaexistantnewsletter"),'',3,1,'');
}
function calculate_time_zone() {
	var dateuser = new Date();
	var jan1 = new Date(dateuser.getFullYear(), 0, 1, 0, 0, 0, 0);  // jan 1st
	var june1 = new Date(dateuser.getFullYear(), 6, 1, 0, 0, 0, 0); // june 1st
	var temp = jan1.toGMTString();
	var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	temp = june1.toGMTString();
	var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
	var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
	var dst="0";
	
	if (std_time_offset == daylight_time_offset) {
		dst = "0"; // daylight savings time is NOT observed
	} else {
		// positive is southern, negative is northern hemisphere
		var hemisphere = std_time_offset - daylight_time_offset;
		if (hemisphere >= 0)
			std_time_offset = daylight_time_offset;
		dst = "1"; // daylight savings time is observed
	}
	var hour= parseInt(std_time_offset);
   	var mins =parseInt((std_time_offset-hour)*60);
	
	if (hour == 0) 
		hour = "00";
	else if (hour >9) 
		hour ="+"+hour;
	else if (hour >0&&hour <10) 
		hour = "+0"+hour;
	else if (std_time_offset<-9) 
		hour = "-"+hour;
	else
		hour = "-0"+hour;
	if (mins == 0) 
		mins = "00";
	document.getElementById('decalage').value=hour+":"+mins;
	document.getElementById('dst').value=dst;
}
