// JavaScript Document

/* POUR MISE EN LIGNE */
function MM_goToURL()
			{ //v4.0
				var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
			  	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
			}

/* MENU */
window.onload=montre;

function montre(id) 
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) 
		{if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
		}
	if (d) {d.style.display='block';} 
}

function navigation(myNav)
{ 
	document.getElementById(myNav).style.visibility="visible";
}

function cache(myNav)
{
	document.getElementById(myNav).style.visibility="hidden";
}


/* Changement d'Images */
function ImageOver1() { 
document.images["La_Course"].src="Images/La_Course_OVER.jpg"
} 
function ImageOver2() { 
document.images["Concurrents"].src="Images/Concurrents_OVER.jpg"
} 
function ImageOver3() { 
document.images["Partenaires"].src="Images/Partenaires_OVER.jpg"
}
function ImageOver4() { 
document.images["Presse"].src="Images/Presse_OVER.jpg"
} 
function ImageOver5() { 
document.images["Suivi_Course"].src="Images/Suivi_Course_OVER.jpg"
} 
function ImageOver6() { 
document.images["Photos_Videos"].src="Images/Photos_Videos_OVER.jpg"
} 
function ImageOver7() { 
document.images["Goodies"].src="Images/Goodies_OVER.jpg"
} 

function ImageOut1() { 
document.images["La_Course"].src="Images/La_Course.jpg"
}
function ImageOut2() { 
document.images["Concurrents"].src="Images/Concurrents.jpg"
}
function ImageOut3() { 
document.images["Partenaires"].src="Images/Partenaires.jpg"
}
function ImageOut4() { 
document.images["Presse"].src="Images/Presse.jpg"
} 
function ImageOut5() { 
document.images["Suivi_Course"].src="Images/Suivi_Course.jpg"
} 
function ImageOut6() { 
document.images["Photos_Videos"].src="Images/Photos_Videos.jpg"
}
function ImageOut7() { 
document.images["Goodies"].src="Images/Goodies.jpg"
}

// Popup: gestion de l'affichage.
			function MM_openBrWindow(theURL,winName,features)
			{ //v2.0
  				window.open(theURL,winName,features);
			}

/* Vérification FORMULAIRE*/

var emailFilter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ;
var telephoneFilter  = /([0-9])/ ;
var dateFilter  = /^([0-9]{2})+\/([0-9]{2})\/([0-9]{4})+$/ ;
var societeFilter = /^([a-zA-Z0-9_\.\-\ ])+$/ ;

						/*l'email doit contenir une arobase et un point*/
						/*avant l'@ il peut y avoir des lettres quelconques (en minuscule ou majuscule), n'importe quel chiffre, 
						  et les caractères "-" ou "_"*/
						/*aprés l'@, idem, mais on interdit la présence de "_", et il faut impérativement au moins 2 caractères 
						  entre l'@ et le point*/
						/*aprés le point, faut impérativement au moins 2 ou 4 caractères */

function checkForm(f) /*Vérifie le Formulaire RESERVATIONS dans RP */
{

	if(f.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		f.nom.focus() ;
		return false ;
		};
		
	if(f.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		f.nom.focus() ;
		return false ;
		};
		
	if(f.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		f.prenom.focus() ;
		return false ;
		};
		
	if(f.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		f.prenom.focus() ;
		return false ;
		};

	if(f.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		f.mail.focus() ;
		return false ;
		};
		
	if(f.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		f.mail.focus() ;
		return false ;
		};

	if(f.mail.value.length>0 && !emailFilter.test(f.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		f.mail.focus() ;
		return false ;
		};
};

function checkFormAccr(g) /*Vérifie le Formulaire ACCREDITATIONS dans Presse */
{

	if(g.medianame.value.length==0) 
		{
		alert('Le champs « Nom du Média » est obligatoire') ;
		g.medianame.focus() ;
		return false ;
		};
		
	if(g.medianame.value=="Nom du Média") 
		{
		alert('Le champs « Nom du Média » est obligatoire') ;
		g.medianame.focus() ;
		return false ;
		};
	
	if(g.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		g.nom.focus() ;
		return false ;
		};
		
	if(g.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		g.nom.focus() ;
		return false ;
		};
		
	if(g.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		g.prenom.focus() ;
		return false ;
		};
		
	if(g.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		g.prenom.focus() ;
		return false ;
		};

	if(g.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		g.mail.focus() ;
		return false ;
		};
		
	if(g.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		g.mail.focus() ;
		return false ;
		};

	if(g.mail.value.length>0 && !emailFilter.test(g.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		g.mail.focus() ;
		return false ;
		};
};

function checkFormContact(h) /*Vérifie le Formulaire CONTACT */
{
	
	if(h.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		h.nom.focus() ;
		return false ;
		};
		
	if(h.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		h.nom.focus() ;
		return false ;
		};
		
	if(h.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		h.prenom.focus() ;
		return false ;
		};
		
	if(h.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		h.prenom.focus() ;
		return false ;
		};

	if(h.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		h.mail.focus() ;
		return false ;
		};
		
	if(h.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		h.mail.focus() ;
		return false ;
		};

	if(h.mail.value.length>0 && !emailFilter.test(h.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		h.mail.focus() ;
		return false ;
		};
};

function checkFormBourse(j) /*Vérifie le Formulaire BOURSE AUX EQUIPIERS */
{
	
	
	if(j.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		j.nom.focus() ;
		return false ;
		};
		
	if(j.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		j.nom.focus() ;
		return false ;
		};
		
	if(j.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		j.prenom.focus() ;
		return false ;
		};
		
	if(j.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		j.prenom.focus() ;
		return false ;
		};

	if(j.lanaissjj.value.length==0) 
		{
		alert('Le champs « jj » est obligatoire') ;
		j.lanaissjj.focus() ;
		return false ;
		};
		
	if(j.lanaissjj.value=="jj") 
		{
		alert('Le champs « jj » est obligatoire') ;
		j.lanaissjj.focus() ;
		return false ;
		};
		
	if(j.lanaissjj.value.length>0 && !telephoneFilter.test(j.lanaissjj.value)) 
		{
		alert('Le champs « jj » est incorect') ;
		j.lanaissjj.focus() ;
		return false ;
		};
	
	if(j.lanaissmm.value.length==0) 
		{
		alert('Le champs « mm » est obligatoire') ;
		j.lanaissmm.focus() ;
		return false ;
		};
		
	if(j.lanaissmm.value=="mm") 
		{
		alert('Le champs « mm » est obligatoire') ;
		j.lanaissmm.focus() ;
		return false ;
		};

	if(j.lanaissmm.value.length>0 && !telephoneFilter.test(j.lanaissmm.value)) 
		{
		alert('Le champs « mm » est incorect') ;
		j.lanaissmm.focus() ;
		return false ;
		};

	if(j.lanaissaaaa.value.length==0) 
		{
		alert('Le champs « aaaa » est obligatoire') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
		
	if(j.lanaissaaaa.value=="aaaa") 
		{
		alert('Le champs « aaaa » est obligatoire') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
	
	if(j.lanaissaaaa.value.length>0 && !telephoneFilter.test(j.lanaissaaaa.value)) 
		{
		alert('Le champs « aaaa » est incorect') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
	
	if(j.poids.value.length==0) 
		{
		alert('Le champs « Poids » est obligatoire') ;
		j.poids.focus() ;
		return false ;
		};
		
	if(j.poids.value=="Poids") 
		{
		alert('Le champs « Poids » est obligatoire') ;
		j.poids.focus() ;
		return false ;
		};

	if(j.poids.value.length>0 && !telephoneFilter.test(j.poids.value)) 
		{
		alert('Le champs « Poids » est incorect, seuls les chiffres sont acceptés') ;
		j.poids.focus() ;
		return false ;
		};

	if(j.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		j.mail.focus() ;
		return false ;
		};
		
	if(j.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		j.mail.focus() ;
		return false ;
		};

	if(j.mail.value.length>0 && !emailFilter.test(j.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		j.mail.focus() ;
		return false ;
		};
		
	if(j.posteabord.value.length==0) 
		{
		alert('Le champs « Poste à bord » est obligatoire') ;
		j.posteabord.focus() ;
		return false ;
		};
		
	if(j.posteabord.value=="Poste à bord") 
		{
		alert('Le champs « Poste à bord » est obligatoire') ;
		j.posteabord.focus() ;
		return false ;
		};	

};


function favoris() 
{ 
	if ( navigator.appName != 'Microsoft Internet Explorer' ) 
		{ 
		window.sidebar.addPanel("Route des Iles","http://www.route-des-iles.com",""); 
		} 
	else 
		{ 
		window.external.AddFavorite("http://www.route-des-iles.com","Route des Iles"); 
		} 
} 

// Gestion d'affichage: texte défilant dans la barre d'état (statut).
/*var Message="La Route des îles 2007, dernière étape du Championnat de France des Equipages !!!";
var position=1;
	
			function scrollIn()
			{
				window.status=Message.substring(0, position);
				if (position >= Message.length)
				{
					position=1;
					window.setTimeout("scrollOut()",300); 
				}
				else
				{
					position++;
					window.setTimeout("scrollIn()",50); 
   				} 
			}

			function scrollOut()
			{
				window.status=Message.substring(position, Message.length);
				if (position >= Message.length)
				{
					position=1;
					window.setTimeout("scrollIn()", 100);
				}
				else
				{
					position++;
					window.setTimeout("scrollOut()", 50);
				}
			}*/

/*function date()
{today = new Date();
			document.write(today.getDate(),"/",today.getMonth()+1,"/",today.getYear(),":::");
			document.write(today.getHours(),":",today.getMinutes());
}*/

/* 
couleur d'un hyperlien d'un objet document
document.linkColor="white"; 
document.linkColor="#FFFFFF";
*/

/* 
couleur d'un hyperlien déjà visité d'un objet document
document.vlinkColor="white"; 
document.vlinkColor="#FFFFFF";
*/

/*
function MM_jumpMenu(targ,selObj,restore)
			{ //v3.0
				eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
			  	if (restore) selObj.selectedIndex=0;
			}
*/


/* Fonctions Pour Cacher le Menu 2

function hideMenu() 
{
	chrone_attente=1;
	myinterval = setTimeout(offMenu,1000);
}

function offMenu() 
{
	if (global_id!="") 
		{	document.getElementById('smenu'+global_id).style.display = "none";
			global_id="";
			stopChrone();
		}
}

function stopChrone() 
{
	window.clearTimeout(myinterval);
	chrone_attente=0;
}
*/