// JavaScript Document		

 //##################
 //# VinzzZ Control #
 //##################
 function IsDate(JJ, MM, AAAA)
 {if(JJ<1||JJ>31||MM<1||MM>12) return false;
 if(MM==2)
 {if(JJ==30||JJ==31) return false;
   if(JJ==29) return ((AAAA%4==0&&AAAA%100!=0)||AAAA%400==0);
 }
 else if(JJ==31) return !(MM==4||MM==6||MM==9||MM==11);
 return true;
 }
  
 function IsEMail(emailStr)
 {var validDomain=false;
 var AtPos = emailStr.lastIndexOf("@");
 var DotPos= emailStr.lastIndexOf(".");
 if((AtPos>0)&&(DotPos>0)&&(AtPos<DotPos))
 {
	 var domainExtList='ac.ad.ae.af.ag.ai.al.am.an.ao.aq.ar.as.at.au.aw.az.ba.bb.bd.be.bf.bg.bh.bi.bj.bm.bn.bo.br.bs.bt.bv.bw.by.bz.ca.cc.cd.cf.cg.ch.ci.ck.cl.cm.cn.co.cr.cs.cu.cv.cx.cy.cz.de.dj.dk.dm.do.dz.ec.ee.eg.eh.er.es.et.fi.fj.fk.fm.fo.fr.fx.ga.gb.gd.ge.gf.gg .gh.gi.gl.gm.gn.gp.gq.gr.gs.gt.gu.gw.gy.hk.hm.hn.hr.ht.hu.id.ie.il.im.in.io.iq.ir.is.it.je.jm.jo.jp.ke.kg.kh.ki.km.kn.kp.kr.kw.ky.kz.la.lb.lc.li.lk.lr.ls.lt.lu.lv.ly.ma.mc.md.mg.mh.mk.ml.mm.mn.mo.mp.mq.mr.ms.mt.mu.mv.mw.mx.my.mz.na.nc.ne.nf.ng.ni.nl.no.np.nr.nt.nu.nz.om.pa.pe.pf.pg.ph.pk.pl.pm.pn.pr.ps.pt.pw.py.qa.re.ro.ru.rw.sa.sb.sc.sd.se.sg.sh.si.sj.sk.sl.sm.sn.so.sr.st.su.sv.sy.sz.tc.td.tf.tg.th.tj.tk.tm.tn.to.tp.tr.tt.tv.tw.tz.ua.ug.uk.um.us.uy.uz.va.vc.ve.vg.vi.vn.vu.wf.ws.ye.yt.yu.za.zm.zr.zw.com.edu.gov.int.mil.net.org .biz.pro.info.aero.name.coop.arpa.nato.museum.EoF';
   var domainExt=domainExtList.split(".");
   var emailExt=emailStr.substr(DotPos+1);
   emailExt=emailExt.toLowerCase();
   for(i=0;domainExt.length;i++)
   {if (domainExt[i]=='EoF') break; //infinite loop else
    if (emailExt==domainExt[i]) {validDomain=true;break;}
   }
 }
 return(validDomain);
 }
  
 function IsNumberString(NumStr)
 {var regEx=/^[0-9]+$/;
 var ret=false;
 if (regEx.test(NumStr)) ret=true;
 return ret;
 }
  
 function IsAlphaNumString(NumStr)
 {var regEx=/^[A-Za-z0-9]+$/;
 var ret=false;
 if (regEx.test(NumStr)) ret=true;
 return ret;
 }
  
 function IsAlphaString(NumStr)
 {var regEx=/^[A-Za-z???? -]+$/;
 var ret=false;
 if (regEx.test(NumStr)) ret=true;
 return ret;
 }
 
 //############
 //# PswC2007 #
 //############
 
// ===========================================================
function populate(htmlList, sourceArray, sourceArrayColCode, sourceArrayColLib){
	// clear de l objet
	document.getElementById(htmlList).options.length=1;
	// ajouter les options du tableau
	for (var i=0;i<sourceArray.length;i++) {
		// NOTE new Option(lib,code)
		var newOpt=new Option(sourceArray[i][sourceArrayColLib],sourceArray[i][sourceArrayColCode]);
		document.getElementById(htmlList).options[document.getElementById(htmlList).options.length]=newOpt;
		}
	}
// ===========================================================
function populateWithFilter(htmlList, sourceArray, sourceArrayColCode, sourceArrayColLib, sourceArrayColFilter, sourceArrayFilterValue){
	// clear de l objet
	document.getElementById(htmlList).options.length=1;
	// ajouter les options du tableau si filtre null
	for (var i=0;i<sourceArray.length;i++) {					
		if(sourceArray[i][sourceArrayColFilter]==sourceArrayFilterValue){
			var newOpt=new Option(sourceArray[i][sourceArrayColLib],sourceArray[i][sourceArrayColCode]);
			document.getElementById(htmlList).options[document.getElementById(htmlList).options.length]=newOpt;
			}
		}
	}
// ===========================================================
function populateWithExclusion(htmlList, sourceArray, sourceArrayColCode, sourceArrayColLib, sourceArrayColExclusion, sourceArrayExclusionValue){
	// clear de l objet
	document.getElementById(htmlList).options.length=1;
	// ajouter les options du tableau si filtre null
	for (var i=0;i<sourceArray.length;i++) {
		if(sourceArray[i][sourceArrayColExclusion]!=sourceArrayExclusionValue){
			var newOpt=new Option(sourceArray[i][sourceArrayColLib],sourceArray[i][sourceArrayColCode]);
			document.getElementById(htmlList).options[document.getElementById(htmlList).options.length]=newOpt;
			}
		}
	}
// ===========================================================
function populateWithDefault(htmlList, sourceArray, sourceArrayColCode, sourceArrayColLib, sourceArrayDefaultCode){
	// clear de l objet
	document.getElementById(htmlList).options.length=1;
	// ajouter les options du tableau si filtre null
	for (var i=0;i<sourceArray.length;i++) {	
		if(sourceArray[i][sourceArrayColCode]==sourceArrayDefaultCode){
			var newOpt=new Option(sourceArray[i][sourceArrayColLib],sourceArray[i][sourceArrayColCode],true,true);
			}
		else{var newOpt=new Option(sourceArray[i][sourceArrayColLib],sourceArray[i][sourceArrayColCode],false,false);}
		document.getElementById(htmlList).options[document.getElementById(htmlList).options.length]=newOpt;
		}
	}
// ===========================================================
function checkUpdate(id) {
	var CanBeValidated=true;
	var str_errMess="";
	if ((window.document.frm_update.nom.value=='') ||
		(window.document.frm_update.prenom.value=='') ||
		(window.document.frm_update.pays.value=='') ||
		(window.document.frm_update.categorie.value=='') ||
		(window.document.frm_update.email.value=='') ||
		(window.document.frm_update.pack.value=='') ||
		(window.document.frm_update.date_n.value=='')){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - champs obligatoires";
		}
	else{
		if (IsEMail(window.document.frm_update.email.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - email invalide";
			}
		}
	if(CanBeValidated==true){
		window.document.frm_update.method = "POST";
		window.document.frm_update.action = "index.php?page=fiche_racer&lang=fr&mode=adminpswc2007up&id="+id;
		window.document.frm_update.submit();
		}
	else{alert(str_errMess);}
	}
// ===========================================================
function onImgMouseOver(img, imgSrc) {
	img.src=imgSrc;
	}
// ===========================================================
function onImgMouseOut(img, imgSrc) {
	img.src=imgSrc;
	}
// ===========================================================
function afficheId(baliseId,mode){
	if (document.getElementById && document.getElementById(baliseId) != null){
		document.getElementById(baliseId).style.visibility='visible';
		document.getElementById(baliseId).style.display=mode;
		}
	}
// ===========================================================
function cacheId(baliseId,mode){
	if (document.getElementById && document.getElementById(baliseId) != null){
		document.getElementById(baliseId).style.visibility='hidden';
		document.getElementById(baliseId).style.display=mode;
		}
	}
// ===========================================================
function regis_categ_onchange(categCode){			
	if(categCode=='PRO'){
		afficheId('tab_pro','block');
		cacheId('tab_am','none');
		document.frm_inscription.sex.value="M";
		}
	else{
		if((categCode=='AM')||(categCode=='FEM')){
			afficheId('tab_am','block');
			cacheId('tab_pro','none');
			document.frm_inscription.sex.value="M";
			if(categCode=='FEM'){
				document.frm_inscription.sex.value="F";
				}
			}
		else{
			cacheId('tab_am','none');
			cacheId('tab_pro','none');
			document.frm_inscription.sex.value="M";
			}
		}
	calcul_amount();
	}
// ===========================================================
function calcul_noPack(){
	var noPackCount=0;
	var noPackAmount=0;
	// TIGHT
	for (i=0;i < document.frm_inscription.skate_tight.length;i++){
		if (document.frm_inscription.skate_tight[i].checked){
			var skate_tight = document.frm_inscription.skate_tight[i].value;
			}
		}
	if(skate_tight=="oui"){noPackCount=noPackCount+1;}
	document.frm_inscription.tightS.value=skate_tight;
	// SPECIAL
	for (i=0;i<document.frm_inscription.skate_special.length;i++){
		if (document.frm_inscription.skate_special[i].checked){
			var skate_special = document.frm_inscription.skate_special[i].value;
			}
		}
	if(skate_special=="oui"){noPackCount=noPackCount+1;}
	document.frm_inscription.specialS.value=skate_special;
	// GIANT
	for (i=0;i<document.frm_inscription.skate_geant.length;i++){
		if (document.frm_inscription.skate_geant[i].checked){
			var skate_geant = document.frm_inscription.skate_geant[i].value;
			}
		}
	if(skate_geant=="oui"){noPackCount=noPackCount+1;}
	document.frm_inscription.geantS.value=skate_geant;
	// SLIDE
	for (i=0;i<document.frm_inscription.slide.length;i++){
		if (document.frm_inscription.slide[i].checked){
			var slide = document.frm_inscription.slide[i].value;
			}
		}
	// if(slide=="oui"){noPackCount=noPackCount+1;}

	document.frm_inscription.slideC.value=slide;
	// VALo
	if(noPackCount < 1) // le slide est gratuit pour toute inscription slalom, sinon 10€
	{
		if(slide=="oui")
			noPackAmount=10;
		else 
			noPackAmount=0;
	}
	if(noPackCount==1){
		noPackAmount=20;
		}
	if(noPackCount==2){
		noPackAmount=35;
		}
	if(noPackCount>=3){
		noPackAmount=45;
		}
	document.frm_inscription.nopackAmount.disabled=false;
	document.frm_inscription.nopackAmount.value=noPackAmount;
	document.frm_inscription.nopackAmount.disabled=true;
	}
// ===========================================================
function calcul_Pack(){
	var AMPackAmount=50;
	var PROPackAmount=100;
	// riderz?
	for (i=0;i<document.frm_inscription.adh_riderz.length;i++){
		if (document.frm_inscription.adh_riderz[i].checked){
			var membreR = document.frm_inscription.adh_riderz[i].value;
		}
	}
	if(membreR=="oui"){
		AMPackAmount=35;
		PROPackAmount=85;
		}
	document.frm_inscription.AMpackAmount.disabled=false;
	document.frm_inscription.AMpackAmount.value=AMPackAmount;
	document.frm_inscription.AMpackAmount.disabled=true;
	document.frm_inscription.PROpackAmount.disabled=false;
	document.frm_inscription.PROpackAmount.value=PROPackAmount;
	document.frm_inscription.PROpackAmount.disabled=true;
	}
// ===========================================================
function calcul_amount(){
	var amount=0;
	calcul_noPack();
	if(document.frm_inscription.categorie.value!=""){
		calcul_Pack();
		// pro
		if(document.frm_inscription.categorie.value=="PRO"){
			amount=document.frm_inscription.PROpackAmount.value;
			document.frm_inscription.skatePack.value="pro";
			}
		else{
			calcul_noPack();
			// no pack
			if(document.frm_inscription.pack[0].checked==true){
				amount=document.frm_inscription.nopackAmount.value;
				document.frm_inscription.skatePack.value="no";
				}
			// pack am
			else{
				amount=document.frm_inscription.AMpackAmount.value;
				document.frm_inscription.skatePack.value="am";
				}
			}
		document.frm_inscription.amount.value=amount;
		}
	}
// ===========================================================
function checkInscription(lang) {
	var CanBeValidated=true;
	var str_errMess="";
	calcul_amount();
	// champs obligatoires
	if ((window.document.frm_inscription.nom.value=='') ||
		(window.document.frm_inscription.prenom.value=='') ||
		(window.document.frm_inscription.pays.value=='') ||
		(window.document.frm_inscription.categorie.value=='') ||
		(window.document.frm_inscription.email.value=='') ||
		(window.document.frm_inscription.date_nJJ.value=='') ||
		(window.document.frm_inscription.date_nMM.value=='') ||
		(window.document.frm_inscription.date_nAAAA.value=='')){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - champs obligatoires / mandatory fields";
			if (window.document.frm_inscription.nom.value==''){
				str_errMess=str_errMess+"\n   -> NOM / FIRSTNAME";}
			if (window.document.frm_inscription.prenom.value==''){
				str_errMess=str_errMess+"\n   -> PRENOM / NAME";}
			if (window.document.frm_inscription.pays.value==''){
				str_errMess=str_errMess+"\n   -> PAYS / COUNTRY";}
			if (window.document.frm_inscription.categorie.value==''){
				str_errMess=str_errMess+"\n   -> CATEGORIE / CATEGORY";}
			if (window.document.frm_inscription.email.value==''){
				str_errMess=str_errMess+"\n   -> EMAIL";}
			if ((window.document.frm_inscription.date_nJJ.value=='') ||
				(window.document.frm_inscription.date_nMM.value=='') ||
				(window.document.frm_inscription.date_nAAAA.value=='')){
				str_errMess=str_errMess+"\n   -> DATE DE NAISSANCE / BIRTH DATE";}
			str_errMess=str_errMess+"\n";
		}
	else{
		// valid email
		if (IsEMail(window.document.frm_inscription.email.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - email invalide / invalid email\n";
			}
		// valid birthdate
		if (IsDate(window.document.frm_inscription.date_nJJ.value, window.document.frm_inscription.date_nMM.value, window.document.frm_inscription.date_nAAAA.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - date de naissance invalide / invalid birth date\n";
			}
		else{window.document.frm_inscription.date_n.value=window.document.frm_inscription.date_nAAAA.value+'-'+window.document.frm_inscription.date_nMM.value+'-'+window.document.frm_inscription.date_nJJ.value;}
		// valid disciplines
			// si pro => 
		if ((document.frm_inscription.skate_tight[0].checked==false) &&
			(document.frm_inscription.skate_special[0].checked==false) &&
			(document.frm_inscription.skate_geant[0].checked==false) &&
			(document.frm_inscription.slide[0].checked==false)){
				CanBeValidated=false;
				str_errMess=str_errMess+"\n - 1 discipline minimum";
			}
		}
	if(CanBeValidated==true){
		window.document.frm_inscription.method = "POST";
		window.document.frm_inscription.action = "index.php?page=inscriptions2&lang="+lang;
		window.document.frm_inscription.submit();
		}
	else{alert(str_errMess);}
	}
// ===========================================================
function validateInscription(lang) {
	window.document.frm_validInscription.method = "POST";
	window.document.frm_validInscription.action = "index.php?page=inscriptions3&lang="+lang;
	window.document.frm_validInscription.submit();
	}
// ===========================================================
function deleteRacer(racer_id, racer_name) {
	if (
		confirm("Etes vous sur de vouloir supprimer definitivement le coureur " + racer_id + " " + racer_name + " ?")==true
		){
			window.location='index.php?page=delete_racer&lang=fr&mode=adminpswc2007del&id='+racer_id;
			}
	}
// ===========================================================
function changeFicheRacer(racer_id, racer_name) {
	if (
		confirm("Etes vous sur de vouloir enregistrer les modifications pour le coureur " + racer_id + " " + racer_name + " ?")==true
		){
			checkUpdate(racer_id);
			}
	}
// ===========================================================
function quitteFicheRacer(racer_id, racer_name) {
	if (
		confirm("Etes vous sur de vouloir quitter la fiche du coureur " + racer_id + " " + racer_name + " ? Toutes les modifications non enregistr?s seront perdues.")==true
		){
			window.location='index.php?page=liste-comp&lang=fr&mode=adminpswc2007';
			}
	}
// ===========================================================
function calcul_fiche_amount(){
	var amount=0;
	// riderz?
	for (i=0;i<document.frm_update.membre.length;i++){
		if (document.frm_update.membre[i].checked){
			var membreR = document.frm_update.membre[i].value;
		}
	}
	var ajst_riderz=0;
	if(membreR=="oui"){
		ajst_riderz=15;
		}
	// pro
	if(document.frm_update.pack.value=="pro"){
		amount=100-ajst_riderz;
		}
	// am
	if(document.frm_update.pack.value=="am"){
		amount=50-ajst_riderz;
		}
	// no
	if(document.frm_update.pack.value=="no"){
		var noPackCount=0;
		// TIGHT
		for (i=0;i<document.frm_update.skate_tight.length;i++){
			if (document.frm_update.skate_tight[i].checked){
				var skate_tight = document.frm_update.skate_tight[i].value;
				}
			}
		if(skate_tight=="oui"){
			noPackCount=noPackCount+1;
			}
		// SPECIAL
		for (i=0;i<document.frm_update.skate_special.length;i++){
			if (document.frm_update.skate_special[i].checked){
				var skate_special = document.frm_update.skate_tight[i].value;
				}
			}
		if(skate_special=="oui"){
			noPackCount=noPackCount+1;
			}
		// GIANT
		for (i=0;i<document.frm_update.skate_geant.length;i++){
			if (document.frm_update.skate_geant[i].checked){
				var skate_geant = document.frm_update.skate_geant[i].value;
				}
			}
		if(skate_geant=="oui"){
			noPackCount=noPackCount+1;
			}
		// SLIDE
		for (i=0;i<document.frm_update.slide.length;i++){
			if (document.frm_update.slide[i].checked){
				var slide = document.frm_update.slide[i].value;
				}
			}
		//if(slide=="oui"){
		//	noPackCount=noPackCount+1;
		//	}

		// VALo

		if(noPackCount < 1) // le slide est gratuit pour toute inscription slalom, sinon 10€
		{
			if(slide=="oui")
				amount=10;
			else 
				amount=0;
		}
		if(noPackCount==1){
			amount=20;
			}
		if(noPackCount==2){
			amount=35;
			}
		if(noPackCount>=3){
			amount=45;
			}
		}
	document.frm_update.somme_aff.disabled=true;
	document.frm_update.somme_aff.value=amount;
	document.frm_update.somme.value=amount;
	document.frm_update.somme_aff.disabled=true;
	}

// ===========================================================
// PSWC 2008
// ===========================================================

// ===========================================================
function change2008Slalom() {
	if(document.getElementById("cbx_slalom").checked==true){
		afficheId("tab_slalom","block");
		calcul2008amount();
		}
	else {
		cacheId("tab_slalom","none");
		calcul2008amount();
		}
	}
// ===========================================================
function calcul2008amount() {
	var amount=0;
	// ########## CALCULATE AMOUNT ##########
	// si slalom
	if (document.frm_inscription.cbx_slalom.checked==true){
		if (document.frm_inscription.rad_skate_cat[1].checked){amount=50;}
		else{amount=100;}
		if (document.frm_inscription.adh_riderz[0].checked){amount=amount-10;}
		}
	// sinon
	else{
		// si freestyle
		if (document.frm_inscription.cbx_freestyle.checked==true){amount=50;}
		// sinon
		else{
			// si bowl et/ou jump
			if ((document.frm_inscription.cbx_bowlRace.checked==true)||(document.frm_inscription.cbx_bowlContest.checked==true)){amount=15;}
			if (document.frm_inscription.cbx_Hijump.checked==true){amount=amount+10;}
			}
		}
	if(document.frm_inscription.sexe.value=="WOMAN"){amount=0;}
		// sinon
	document.frm_inscription.show_amount.value=amount;
	document.frm_inscription.inp_amount.value=amount;
	// ########## CHECK DISCIPLINES ##########
	document.frm_inscription.inp_slalomCat.value="";
	document.frm_inscription.inp_slalomTight.value="non";
	document.frm_inscription.inp_slalomSpecial.value="non";
	document.frm_inscription.inp_slalomHybrid.value="non";
	document.frm_inscription.inp_free.value="non";
	document.frm_inscription.inp_bowlRace.value="non";
	document.frm_inscription.inp_bowlContest.value="non";
	document.frm_inscription.inp_jump.value="non";
	// slalom
	if (document.frm_inscription.cbx_slalom.checked==true){
		if (document.frm_inscription.rad_skate_cat[1].checked){document.frm_inscription.inp_slalomCat.value="AMA";}
		else{document.frm_inscription.inp_slalomCat.value="PRO";}
		if(document.frm_inscription.sexe.value=="WOMAN"){document.frm_inscription.inp_slalomCat.value="WOM";}
		if (document.frm_inscription.cbx_slalom_tight.checked){document.frm_inscription.inp_slalomTight.value="oui";}
		if (document.frm_inscription.cbx_slalom_special.checked){document.frm_inscription.inp_slalomSpecial.value="oui";}
		if (document.frm_inscription.cbx_slalom_hybrid.checked){document.frm_inscription.inp_slalomHybrid.value="oui";}
		}
	// free
	if (document.frm_inscription.cbx_freestyle.checked==true){document.frm_inscription.inp_free.value="oui";}
	// bowl
	if (document.frm_inscription.cbx_bowlRace.checked==true){document.frm_inscription.inp_bowlRace.value="oui";}
	if (document.frm_inscription.cbx_bowlContest.checked==true){document.frm_inscription.inp_bowlContest.value="oui";}
	// jump
	if (document.frm_inscription.cbx_Hijump.checked==true){document.frm_inscription.inp_jump.value="oui";}
	}
// ===========================================================
function check2008Inscription(lang) {
	var CanBeValidated=true;
	var str_errMess="";
	calcul2008amount();
	// champs obligatoires
	if ((window.document.frm_inscription.nom.value=='') ||
		(window.document.frm_inscription.prenom.value=='') ||
		(window.document.frm_inscription.pays.value=='') ||
		(window.document.frm_inscription.email.value=='') ||
		(window.document.frm_inscription.date_nJJ.value=='') ||
		(window.document.frm_inscription.date_nMM.value=='') ||
		(window.document.frm_inscription.date_nAAAA.value=='')){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - champs obligatoires / mandatory fields";
			if (window.document.frm_inscription.nom.value==''){
				str_errMess=str_errMess+"\n   -> NOM / FIRST NAME";}
			if (window.document.frm_inscription.prenom.value==''){
				str_errMess=str_errMess+"\n   -> PRENOM / NAME";}
			if (window.document.frm_inscription.pays.value==''){
				str_errMess=str_errMess+"\n   -> PAYS / COUNTRY";}
			if (window.document.frm_inscription.email.value==''){
				str_errMess=str_errMess+"\n   -> EMAIL";}
			if ((window.document.frm_inscription.date_nJJ.value=='') ||
				(window.document.frm_inscription.date_nMM.value=='') ||
				(window.document.frm_inscription.date_nAAAA.value=='')){
				str_errMess=str_errMess+"\n   -> DATE DE NAISSANCE / BIRTH DATE";}
			str_errMess=str_errMess+"\n";
		}
	else{
		// valid email
		if (IsEMail(window.document.frm_inscription.email.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - email invalide / invalid email address\n";
			}
		// valid birthdate
		if (IsDate(window.document.frm_inscription.date_nJJ.value, window.document.frm_inscription.date_nMM.value, window.document.frm_inscription.date_nAAAA.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - date de naissance invalide / invalid birth date\n";
			}
		else{window.document.frm_inscription.date_n.value=window.document.frm_inscription.date_nAAAA.value+'-'+window.document.frm_inscription.date_nMM.value+'-'+window.document.frm_inscription.date_nJJ.value;}
		// ++++++++++++++++++++++++++++++++++
		// valid disciplines
			// si pro => 
		if ((document.frm_inscription.cbx_slalom.checked==false) &&
			(document.frm_inscription.cbx_freestyle.checked==false) &&
			(document.frm_inscription.cbx_bowlRace.checked==false) &&
			(document.frm_inscription.cbx_bowlContest.checked==false) &&
			(document.frm_inscription.cbx_Hijump.checked==false)){
				CanBeValidated=false;
				str_errMess=str_errMess+"\n - 1 discipline minimum";
			}
		}
	if(CanBeValidated==true){
		window.document.frm_inscription.method = "POST";
		window.document.frm_inscription.action = "index.php?page=inscriptions2&lang="+lang;
		window.document.frm_inscription.submit();
		}
	else{alert(str_errMess);}
	}
	
// ===========================================================
function validate2008Inscription(lang) {
	window.document.frm_validInscription.method = "POST";
	window.document.frm_validInscription.action = "index.php?page=inscriptions3&lang="+lang;
	window.document.frm_validInscription.submit();
	}
// ===========================================================
function change2008FicheRacer(racer_id, racer_name) {
	if (
		confirm("Etes vous sur de vouloir enregistrer les modifications pour le coureur " + racer_id + " " + racer_name + " ?")==true
		){
			check2008Update(racer_id);
			}
	}
// ===========================================================
function check2008Update(id) {
	var CanBeValidated=true;
	var str_errMess="";
	if ((window.document.frm_update.nom.value=='') ||
		(window.document.frm_update.prenom.value=='') ||
		(window.document.frm_update.pays.value=='') ||
		(window.document.frm_update.categorie.value=='') ||
		(window.document.frm_update.email.value=='') ||
		(window.document.frm_update.date_n.value=='')){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - champs obligatoires";
		}
	else{
		if (IsEMail(window.document.frm_update.email.value)==false){
			CanBeValidated=false;
			str_errMess=str_errMess+"\n - email invalide";
			}
		}
	if(CanBeValidated==true){
		window.document.frm_update.method = "POST";
		window.document.frm_update.action = "index.php?page=fiche_racer&lang=fr&mode=adminpswc2007up&id="+id;
		window.document.frm_update.submit();
		}
	else{alert(str_errMess);}
	}
// ===========================================================document.getElementById(baliseId).
function calcul2008fiche_amount(){
	changeCategorie();
	var amount=0;
	// ########## CALCULATE AMOUNT ##########
	
	// ===============  ==================
	// TIGHT
	for (i=0;i<document.frm_update.skate_tight.length;i++){
		if (document.frm_update.skate_tight[i].checked){
			var skate_tight = document.frm_update.skate_tight[i].value;
			}
		}
	// SPECIAL
	for (i=0;i<document.frm_update.skate_special.length;i++){
		if (document.frm_update.skate_special[i].checked){
			var skate_special = document.frm_update.skate_tight[i].value;
			}
		}
	// HYBRID
	for (i=0;i<document.frm_update.skate_hybrid.length;i++){
		if (document.frm_update.skate_hybrid[i].checked){
			var skate_hybrid = document.frm_update.skate_hybrid[i].value;
			}
		}
	// si slalom
	if ((skate_tight=="oui")||(skate_special=="oui")||(skate_hybrid=="oui")){
		if (window.document.frm_update.categorie.value=='WOM'){amount=0;}
		if (window.document.frm_update.categorie.value=='PRO'){amount=100;}
		if (window.document.frm_update.categorie.value=='AMA'){amount=50;}
		for (i=0;i<document.frm_update.membre.length;i++){
			if (document.frm_update.membre[i].checked){
				var membre = document.frm_update.membre[i].value;
				}
			}
		if (membre=="oui"){amount=amount-10;}
		}
	else{
		// FREESTYLE
		for (i=0;i<document.frm_update.freestyle.length;i++){
			if (document.frm_update.freestyle[i].checked){
				var freestyle = document.frm_update.freestyle[i].value;
				}
			}
		if (freestyle=="oui"){amount=50;}
		else{
			for (i=0;i<document.frm_update.bowl_race.length;i++){
				if (document.frm_update.bowl_race[i].checked){
					var bowl_race = document.frm_update.bowl_race[i].value;
					}
				}
			for (i=0;i<document.frm_update.bowl_contest.length;i++){
				if (document.frm_update.bowl_contest[i].checked){
					var bowl_contest = document.frm_update.bowl_contest[i].value;
					}
				}
			if ((bowl_race=="oui")||(bowl_contest=="oui")){
				amount=15;
				}		
			for (i=0;i<document.frm_update.jump.length;i++){
				if (document.frm_update.jump[i].checked){
					var jump = document.frm_update.jump[i].value;
					}
				}
			if (jump=="oui"){
				amount=amount+10;
				}
			}
		
		}
	if (window.document.frm_update.categorie.value=='WOM'){amount=0;}
	document.frm_update.montant_aff.disabled=true;
	document.frm_update.montant_aff.value=amount;
	document.frm_update.montant.value=amount;
	document.frm_update.montant_aff.disabled=true;
	}
// ===========================================================
function changeCategorie() {
	if (window.document.frm_update.categorie.value=='WOM'){
		window.document.frm_update.sex.value='F';
		}
	else{window.document.frm_update.sex.value='M';}
	}
